refactor: unify onboarding dm/group policy scaffolding

This commit is contained in:
Peter Steinberger
2026-03-07 21:38:27 +00:00
parent fecca6fd8d
commit 6b1c82c4f1
20 changed files with 239 additions and 169 deletions

View File

@@ -7,11 +7,11 @@ import type {
} from "openclaw/plugin-sdk/bluebubbles";
import {
DEFAULT_ACCOUNT_ID,
addWildcardAllowFrom,
formatDocsLink,
mergeAllowFromEntries,
normalizeAccountId,
resolveAccountIdForConfigure,
setTopLevelChannelDmPolicyWithAllowFrom,
} from "openclaw/plugin-sdk/bluebubbles";
import {
listBlueBubblesAccountIds,
@@ -26,19 +26,11 @@ import { normalizeBlueBubblesServerUrl } from "./types.js";
const channel = "bluebubbles" as const;
function setBlueBubblesDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy): OpenClawConfig {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.bluebubbles?.allowFrom) : undefined;
return {
...cfg,
channels: {
...cfg.channels,
bluebubbles: {
...cfg.channels?.bluebubbles,
dmPolicy,
...(allowFrom ? { allowFrom } : {}),
},
},
};
return setTopLevelChannelDmPolicyWithAllowFrom({
cfg,
channel: "bluebubbles",
dmPolicy,
});
}
function setBlueBubblesAllowFrom(