fix(ci): restore account setup typings

This commit is contained in:
Peter Steinberger
2026-04-03 18:48:37 +01:00
parent dc306013e1
commit 3ddf745f97
4 changed files with 46 additions and 24 deletions

View File

@@ -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<string, BlueBubblesGroupConfig>;
/** 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<BlueBubblesAccountConfig, "actions"> & {
/** Optional per-account BlueBubbles configuration (multi-account). */
accounts?: Record<string, BlueBubblesAccountConfig>;

View File

@@ -5,6 +5,7 @@ import {
createPluginSetupWizardStatus,
createTestWizardPrompter,
runSetupWizardConfigure,
type WizardPrompter,
} from "../../../test/helpers/plugins/setup-wizard.js";
vi.mock("./probe.js", () => ({

View File

@@ -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,

View File

@@ -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<TResolved>(params: {
type AccountScopedChannel =
| "bluebubbles"
| "discord"
| "feishu"
| "imessage"
| "line"
| "signal"