From 3ddf745f978cd500d46850318a11e0ae6cec0f2e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 3 Apr 2026 18:48:37 +0100 Subject: [PATCH] fix(ci): restore account setup typings --- extensions/bluebubbles/src/types.ts | 30 +++++++++++--------- extensions/feishu/src/setup-surface.test.ts | 1 + extensions/feishu/src/setup-surface.ts | 28 +++++++++++++----- src/channels/plugins/setup-wizard-helpers.ts | 11 +++++-- 4 files changed, 46 insertions(+), 24 deletions(-) diff --git a/extensions/bluebubbles/src/types.ts b/extensions/bluebubbles/src/types.ts index 54043d769ab..3b496ae74c8 100644 --- a/extensions/bluebubbles/src/types.ts +++ b/extensions/bluebubbles/src/types.ts @@ -11,6 +11,20 @@ export type BlueBubblesGroupConfig = { tools?: { allow?: string[]; deny?: string[] }; }; +export type BlueBubblesActionConfig = { + reactions?: boolean; + edit?: boolean; + unsend?: boolean; + reply?: boolean; + sendWithEffect?: boolean; + renameGroup?: boolean; + setGroupIcon?: boolean; + addParticipant?: boolean; + removeParticipant?: boolean; + leaveGroup?: boolean; + sendAttachment?: boolean; +}; + export type BlueBubblesAccountConfig = { /** Optional display name for this account (used in CLI/UI lists). */ name?: string; @@ -61,26 +75,14 @@ export type BlueBubblesAccountConfig = { allowPrivateNetwork?: boolean; /** Per-group configuration keyed by chat GUID or identifier. */ groups?: Record; + /** Per-action tool gating (default: true for all). */ + actions?: BlueBubblesActionConfig; /** Channel health monitor overrides for this channel/account. */ healthMonitor?: { enabled?: boolean; }; }; -export type BlueBubblesActionConfig = { - reactions?: boolean; - edit?: boolean; - unsend?: boolean; - reply?: boolean; - sendWithEffect?: boolean; - renameGroup?: boolean; - setGroupIcon?: boolean; - addParticipant?: boolean; - removeParticipant?: boolean; - leaveGroup?: boolean; - sendAttachment?: boolean; -}; - export type BlueBubblesConfig = Omit & { /** Optional per-account BlueBubbles configuration (multi-account). */ accounts?: Record; diff --git a/extensions/feishu/src/setup-surface.test.ts b/extensions/feishu/src/setup-surface.test.ts index b85fb6c3716..f064bad48c1 100644 --- a/extensions/feishu/src/setup-surface.test.ts +++ b/extensions/feishu/src/setup-surface.test.ts @@ -5,6 +5,7 @@ import { createPluginSetupWizardStatus, createTestWizardPrompter, runSetupWizardConfigure, + type WizardPrompter, } from "../../../test/helpers/plugins/setup-wizard.js"; vi.mock("./probe.js", () => ({ diff --git a/extensions/feishu/src/setup-surface.ts b/extensions/feishu/src/setup-surface.ts index 9a0e01a0380..1cdc89a3088 100644 --- a/extensions/feishu/src/setup-surface.ts +++ b/extensions/feishu/src/setup-surface.ts @@ -13,10 +13,14 @@ import { type OpenClawConfig, type SecretInput, } from "openclaw/plugin-sdk/setup"; -import { inspectFeishuCredentials, listFeishuAccountIds, resolveFeishuAccount } from "./accounts.js"; +import { + inspectFeishuCredentials, + listFeishuAccountIds, + resolveFeishuAccount, +} from "./accounts.js"; import { probeFeishu } from "./probe.js"; import { feishuSetupAdapter } from "./setup-core.js"; -import type { FeishuConfig } from "./types.js"; +import type { FeishuAccountConfig, FeishuConfig } from "./types.js"; const channel = "feishu" as const; @@ -28,12 +32,15 @@ function normalizeString(value: unknown): string | undefined { return trimmed || undefined; } -function getScopedFeishuConfig(cfg: OpenClawConfig, accountId: string): FeishuConfig { +function getScopedFeishuConfig( + cfg: OpenClawConfig, + accountId: string, +): FeishuConfig | FeishuAccountConfig { const feishuCfg = (cfg.channels?.feishu as FeishuConfig | undefined) ?? {}; if (accountId === DEFAULT_ACCOUNT_ID) { return feishuCfg; } - return (feishuCfg.accounts?.[accountId] as FeishuConfig | undefined) ?? {}; + return (feishuCfg.accounts?.[accountId] as FeishuAccountConfig | undefined) ?? {}; } function patchFeishuConfig( @@ -138,9 +145,13 @@ async function promptFeishuAllowFrom(params: { const entry = await params.prompter.text({ message: "Feishu allowFrom (user open_ids)", placeholder: "ou_xxxxx, ou_yyyyy", - initialValue: existingAllowFrom.length > 0 ? existingAllowFrom.map(String).join(", ") : undefined, + initialValue: + existingAllowFrom.length > 0 ? existingAllowFrom.map(String).join(", ") : undefined, }); - const mergedAllowFrom = mergeAllowFromEntries(existingAllowFrom, splitSetupEntries(String(entry))); + const mergedAllowFrom = mergeAllowFromEntries( + existingAllowFrom, + splitSetupEntries(String(entry)), + ); return setFeishuAllowFrom(params.cfg, params.accountId, mergedAllowFrom); } @@ -363,7 +374,10 @@ export const feishuSetupWizard: ChannelSetupWizard = { next = patchFeishuConfig(next, resolvedAccountId, { connectionMode }); if (connectionMode === "webhook") { - const currentVerificationToken = getScopedFeishuConfig(next, resolvedAccountId).verificationToken; + const currentVerificationToken = getScopedFeishuConfig( + next, + resolvedAccountId, + ).verificationToken; const verificationTokenResult = await promptSingleChannelSecretInput({ cfg: next, prompter, diff --git a/src/channels/plugins/setup-wizard-helpers.ts b/src/channels/plugins/setup-wizard-helpers.ts index 836a3c37dfa..a8846f93972 100644 --- a/src/channels/plugins/setup-wizard-helpers.ts +++ b/src/channels/plugins/setup-wizard-helpers.ts @@ -651,12 +651,16 @@ export function createLegacyCompatChannelDmPolicy(params: { } | undefined) ?? {}; const accountConfig = - accountId && accountId !== DEFAULT_ACCOUNT_ID ? channelConfig.accounts?.[accountId] : undefined; - return accountConfig?.dmPolicy ?? + accountId && accountId !== DEFAULT_ACCOUNT_ID + ? channelConfig.accounts?.[accountId] + : undefined; + return ( + accountConfig?.dmPolicy ?? accountConfig?.dm?.policy ?? channelConfig.dmPolicy ?? channelConfig.dm?.policy ?? - "pairing"; + "pairing" + ); }, setPolicy: (cfg, policy, accountId) => accountId && accountId !== DEFAULT_ACCOUNT_ID @@ -843,6 +847,7 @@ export function createAccountScopedGroupAccessSection(params: { type AccountScopedChannel = | "bluebubbles" | "discord" + | "feishu" | "imessage" | "line" | "signal"