diff --git a/extensions/bluebubbles/src/setup-core.ts b/extensions/bluebubbles/src/setup-core.ts index a8da7d1f1f5..1ee8b23e840 100644 --- a/extensions/bluebubbles/src/setup-core.ts +++ b/extensions/bluebubbles/src/setup-core.ts @@ -21,8 +21,8 @@ export function setBlueBubblesDmPolicy( const existingAllowFrom = resolvedAccountId === "default" ? cfg.channels?.bluebubbles?.allowFrom - : cfg.channels?.bluebubbles?.accounts?.[resolvedAccountId]?.allowFrom ?? - cfg.channels?.bluebubbles?.allowFrom; + : (cfg.channels?.bluebubbles?.accounts?.[resolvedAccountId]?.allowFrom ?? + cfg.channels?.bluebubbles?.allowFrom); return patchScopedAccountConfig({ cfg, channelKey: channel, diff --git a/extensions/bluebubbles/src/setup-surface.ts b/extensions/bluebubbles/src/setup-surface.ts index c73d34d3ecb..b220de69c72 100644 --- a/extensions/bluebubbles/src/setup-surface.ts +++ b/extensions/bluebubbles/src/setup-surface.ts @@ -149,14 +149,9 @@ const dmPolicy: ChannelSetupDmPolicy = { resolveBlueBubblesAccount({ cfg, accountId: accountId ?? resolveDefaultBlueBubblesAccountId(cfg), - }).config - .dmPolicy ?? "pairing", + }).config.dmPolicy ?? "pairing", setPolicy: (cfg, policy, accountId) => - setBlueBubblesDmPolicy( - cfg, - accountId ?? resolveDefaultBlueBubblesAccountId(cfg), - policy, - ), + setBlueBubblesDmPolicy(cfg, accountId ?? resolveDefaultBlueBubblesAccountId(cfg), policy), promptAllowFrom: promptBlueBubblesAllowFrom, }; diff --git a/extensions/discord/src/actions/runtime.guild.ts b/extensions/discord/src/actions/runtime.guild.ts index 1dc57f060ab..4514e2a7eab 100644 --- a/extensions/discord/src/actions/runtime.guild.ts +++ b/extensions/discord/src/actions/runtime.guild.ts @@ -108,7 +108,8 @@ export async function handleDiscordGuildAction( const userId = readStringParam(params, "userId", { required: true, }); - const effectiveAccountId = accountId ?? (cfg ? resolveDefaultDiscordAccountId(cfg) : undefined); + const effectiveAccountId = + accountId ?? (cfg ? resolveDefaultDiscordAccountId(cfg) : undefined); const member = effectiveAccountId ? await discordGuildActionRuntime.fetchMemberInfoDiscord(guildId, userId, { accountId: effectiveAccountId, diff --git a/extensions/discord/src/actions/runtime.test.ts b/extensions/discord/src/actions/runtime.test.ts index f96bdc9f477..8dd6006685a 100644 --- a/extensions/discord/src/actions/runtime.test.ts +++ b/extensions/discord/src/actions/runtime.test.ts @@ -499,7 +499,9 @@ describe("handleDiscordGuildAction", () => { client_status: {}, } as never); - discordGuildActionRuntime.fetchMemberInfoDiscord = vi.fn(async () => ({ user: { id: "U1" } })) as never; + discordGuildActionRuntime.fetchMemberInfoDiscord = vi.fn(async () => ({ + user: { id: "U1" }, + })) as never; const result = await handleDiscordGuildAction( "memberInfo", diff --git a/extensions/discord/src/channel-actions.test.ts b/extensions/discord/src/channel-actions.test.ts index 06642d065ef..422926ccef0 100644 --- a/extensions/discord/src/channel-actions.test.ts +++ b/extensions/discord/src/channel-actions.test.ts @@ -90,9 +90,7 @@ describe("discordMessageActions", () => { accountId: "work", }); - expect(defaultDiscovery?.actions).toEqual( - expect.arrayContaining(["send", "poll"]), - ); + expect(defaultDiscovery?.actions).toEqual(expect.arrayContaining(["send", "poll"])); expect(defaultDiscovery?.actions).not.toContain("react"); expect(workDiscovery?.actions).toEqual( expect.arrayContaining(["send", "react", "reactions", "emoji-list"]), diff --git a/extensions/discord/src/group-policy.ts b/extensions/discord/src/group-policy.ts index e41145347a4..f1d19d98ef3 100644 --- a/extensions/discord/src/group-policy.ts +++ b/extensions/discord/src/group-policy.ts @@ -80,10 +80,7 @@ function resolveDiscordPolicyContext(params: ChannelGroupContext) { (params.accountId ? params.cfg.channels?.discord?.accounts?.[params.accountId]?.guilds : undefined) ?? params.cfg.channels?.discord?.guilds; - const guildEntry = resolveDiscordGuildEntry( - guilds, - params.groupSpace, - ); + const guildEntry = resolveDiscordGuildEntry(guilds, params.groupSpace); const channelEntries = guildEntry?.channels; const channelEntry = channelEntries && Object.keys(channelEntries).length > 0 diff --git a/extensions/discord/src/monitor/message-handler.preflight.ts b/extensions/discord/src/monitor/message-handler.preflight.ts index 48d180b2a62..a8b44a0d52b 100644 --- a/extensions/discord/src/monitor/message-handler.preflight.ts +++ b/extensions/discord/src/monitor/message-handler.preflight.ts @@ -22,6 +22,7 @@ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing"; import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; import { getChildLogger } from "openclaw/plugin-sdk/runtime-env"; import { logDebug } from "openclaw/plugin-sdk/text-runtime"; +import { resolveDefaultDiscordAccountId } from "../accounts.js"; import { isDiscordGroupAllowedByPolicy, normalizeDiscordSlug, @@ -34,7 +35,6 @@ import { } from "./allow-list.js"; import { resolveDiscordDmCommandAccess } from "./dm-command-auth.js"; import { handleDiscordDmCommandDecision } from "./dm-command-decision.js"; -import { resolveDefaultDiscordAccountId } from "../accounts.js"; import { formatDiscordUserTag, resolveDiscordSystemLocation, diff --git a/extensions/feishu/src/tool-account.ts b/extensions/feishu/src/tool-account.ts index a6b13e5c1a0..7764dbde6e0 100644 --- a/extensions/feishu/src/tool-account.ts +++ b/extensions/feishu/src/tool-account.ts @@ -36,7 +36,10 @@ function resolveImplicitToolAccountId(params: { } const contextualAccountId = normalizeOptionalAccountId(params.defaultAccountId); - if (contextualAccountId && listFeishuAccountIds(params.api.config).includes(contextualAccountId)) { + if ( + contextualAccountId && + listFeishuAccountIds(params.api.config).includes(contextualAccountId) + ) { const contextualAccount = resolveFeishuAccount({ cfg: params.api.config, accountId: contextualAccountId, diff --git a/extensions/googlechat/src/setup-surface.ts b/extensions/googlechat/src/setup-surface.ts index 44eb2b5ee0e..10126f826b1 100644 --- a/extensions/googlechat/src/setup-surface.ts +++ b/extensions/googlechat/src/setup-surface.ts @@ -82,9 +82,7 @@ const googlechatDmPolicy: ChannelSetupDmPolicy = { dm: { ...currentDm, policy, - ...(policy === "open" - ? { allowFrom: addWildcardAllowFrom(currentDm?.allowFrom) } - : {}), + ...(policy === "open" ? { allowFrom: addWildcardAllowFrom(currentDm?.allowFrom) } : {}), }, }, }); diff --git a/extensions/googlechat/src/setup.test.ts b/extensions/googlechat/src/setup.test.ts index 189fa30bc17..6abf490fe97 100644 --- a/extensions/googlechat/src/setup.test.ts +++ b/extensions/googlechat/src/setup.test.ts @@ -328,10 +328,7 @@ describe("googlechat setup", () => { expect(next?.channels?.googlechat?.dm?.policy).toBeUndefined(); expect(next?.channels?.googlechat?.accounts?.alerts?.dm?.policy).toBe("open"); - expect(next?.channels?.googlechat?.accounts?.alerts?.dm?.allowFrom).toEqual([ - "users/123", - "*", - ]); + expect(next?.channels?.googlechat?.accounts?.alerts?.dm?.allowFrom).toEqual(["users/123", "*"]); }); it("keeps startAccount pending until abort, then unregisters", async () => { diff --git a/extensions/line/src/accounts.ts b/extensions/line/src/accounts.ts index bdd8eacc929..f9f93c81e97 100644 --- a/extensions/line/src/accounts.ts +++ b/extensions/line/src/accounts.ts @@ -94,9 +94,7 @@ export function resolveLineAccount(params: { accountId?: string; }): ResolvedLineAccount { const cfg = params.cfg; - const accountId = normalizeSharedAccountId( - params.accountId ?? resolveDefaultLineAccountId(cfg), - ); + const accountId = normalizeSharedAccountId(params.accountId ?? resolveDefaultLineAccountId(cfg)); const lineConfig = cfg.channels?.line as LineConfig | undefined; const accounts = lineConfig?.accounts; const accountConfig = diff --git a/extensions/line/src/monitor.ts b/extensions/line/src/monitor.ts index c2f8d4cec64..53c8101c8ae 100644 --- a/extensions/line/src/monitor.ts +++ b/extensions/line/src/monitor.ts @@ -19,6 +19,7 @@ import { beginWebhookRequestPipelineOrReject, createWebhookInFlightLimiter, } from "openclaw/plugin-sdk/webhook-request-guards"; +import { resolveDefaultLineAccountId } from "./accounts.js"; import { deliverLineAutoReply } from "./auto-reply-delivery.js"; import { createLineBot } from "./bot.js"; import { processLineMessage } from "./markdown-to-line.js"; @@ -37,7 +38,6 @@ import { showLoadingAnimation, } from "./send.js"; import { buildTemplateMessageFromPayload } from "./template-messages.js"; -import { resolveDefaultLineAccountId } from "./accounts.js"; import type { LineChannelData, ResolvedLineAccount } from "./types.js"; import { createLineNodeWebhookHandler } from "./webhook-node.js"; diff --git a/extensions/matrix/src/matrix/client.test.ts b/extensions/matrix/src/matrix/client.test.ts index a55d355a82a..3c9f625c70d 100644 --- a/extensions/matrix/src/matrix/client.test.ts +++ b/extensions/matrix/src/matrix/client.test.ts @@ -1124,10 +1124,7 @@ describe("resolveMatrixAuth", () => { env: {} as NodeJS.ProcessEnv, }); - expect(matrixDoRequestMock).toHaveBeenCalledWith( - "GET", - "/_matrix/client/v3/account/whoami", - ); + expect(matrixDoRequestMock).toHaveBeenCalledWith("GET", "/_matrix/client/v3/account/whoami"); expect(auth).toMatchObject({ accountId: "default", homeserver: "https://matrix.example.org", diff --git a/extensions/nextcloud-talk/src/setup-core.ts b/extensions/nextcloud-talk/src/setup-core.ts index 7c60372f445..09b61d51623 100644 --- a/extensions/nextcloud-talk/src/setup-core.ts +++ b/extensions/nextcloud-talk/src/setup-core.ts @@ -192,9 +192,7 @@ export const nextcloudTalkDmPolicy: ChannelSetupDmPolicy = { }); return setNextcloudTalkAccountConfig(cfg as CoreConfig, resolvedAccountId, { dmPolicy: policy, - ...(policy === "open" - ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } - : {}), + ...(policy === "open" ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } : {}), }); }, promptAllowFrom: promptNextcloudTalkAllowFromForAccount, diff --git a/extensions/qqbot/src/config.test.ts b/extensions/qqbot/src/config.test.ts index 23544a15051..e95f56389a9 100644 --- a/extensions/qqbot/src/config.test.ts +++ b/extensions/qqbot/src/config.test.ts @@ -5,11 +5,7 @@ import { validateJsonSchemaValue } from "../../../src/plugins/schema-validator.j import { qqbotPlugin } from "./channel.js"; import { qqbotSetupPlugin } from "./channel.setup.js"; import { QQBotConfigSchema } from "./config-schema.js"; -import { - DEFAULT_ACCOUNT_ID, - resolveDefaultQQBotAccountId, - resolveQQBotAccount, -} from "./config.js"; +import { DEFAULT_ACCOUNT_ID, resolveDefaultQQBotAccountId, resolveQQBotAccount } from "./config.js"; describe("qqbot config", () => { it("accepts top-level speech overrides in the manifest schema", () => { diff --git a/extensions/signal/src/message-actions.test.ts b/extensions/signal/src/message-actions.test.ts index b977238663c..74b595c8c11 100644 --- a/extensions/signal/src/message-actions.test.ts +++ b/extensions/signal/src/message-actions.test.ts @@ -52,9 +52,9 @@ describe("signalMessageActions", () => { it("honors account-scoped reaction gates during discovery", () => { const cfg = createSignalAccountOverrideCfg(); - expect(signalMessageActions.describeMessageTool?.({ cfg, accountId: "default" })?.actions).toEqual( - ["send"], - ); + expect( + signalMessageActions.describeMessageTool?.({ cfg, accountId: "default" })?.actions, + ).toEqual(["send"]); expect(signalMessageActions.describeMessageTool?.({ cfg, accountId: "work" })?.actions).toEqual( ["send", "react"], ); diff --git a/extensions/signal/src/setup-core.ts b/extensions/signal/src/setup-core.ts index d8dc16ec193..eca2aeda63b 100644 --- a/extensions/signal/src/setup-core.ts +++ b/extensions/signal/src/setup-core.ts @@ -140,7 +140,11 @@ export const signalDmPolicy = { getCurrent: (cfg: OpenClawConfig, accountId?: string) => resolveSignalAccount({ cfg, accountId: accountId ?? resolveDefaultSignalAccountId(cfg) }).config .dmPolicy ?? "pairing", - setPolicy: (cfg: OpenClawConfig, policy: "pairing" | "allowlist" | "open" | "disabled", accountId?: string) => + setPolicy: ( + cfg: OpenClawConfig, + policy: "pairing" | "allowlist" | "open" | "disabled", + accountId?: string, + ) => patchChannelConfigForAccount({ cfg, channel, diff --git a/extensions/slack/src/channel-type.test.ts b/extensions/slack/src/channel-type.test.ts index 46c7caacad8..9e8c511c949 100644 --- a/extensions/slack/src/channel-type.test.ts +++ b/extensions/slack/src/channel-type.test.ts @@ -1,8 +1,5 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; -import { - __resetSlackChannelTypeCacheForTest, - resolveSlackChannelType, -} from "./channel-type.js"; +import { __resetSlackChannelTypeCacheForTest, resolveSlackChannelType } from "./channel-type.js"; const conversationsInfoMock = vi.fn(); diff --git a/extensions/slack/src/message-actions.ts b/extensions/slack/src/message-actions.ts index b7423893a44..c0e701b331b 100644 --- a/extensions/slack/src/message-actions.ts +++ b/extensions/slack/src/message-actions.ts @@ -8,9 +8,8 @@ export function listSlackMessageActions( cfg: OpenClawConfig, accountId?: string | null, ): ChannelMessageActionName[] { - const accounts = (accountId - ? [resolveSlackAccount({ cfg, accountId })] - : listEnabledSlackAccounts(cfg) + const accounts = ( + accountId ? [resolveSlackAccount({ cfg, accountId })] : listEnabledSlackAccounts(cfg) ).filter((account) => account.enabled && account.botTokenSource !== "none"); if (accounts.length === 0) { return []; diff --git a/extensions/slack/src/setup-core.ts b/extensions/slack/src/setup-core.ts index 00069e82d8d..1d6632d7b65 100644 --- a/extensions/slack/src/setup-core.ts +++ b/extensions/slack/src/setup-core.ts @@ -166,8 +166,7 @@ export function createSlackSetupWizardBase(handlers: { unconfiguredHint: "needs tokens", configuredScore: 2, unconfiguredScore: 1, - resolveConfigured: ({ cfg, accountId }) => - inspectSlackAccount({ cfg, accountId }).configured, + resolveConfigured: ({ cfg, accountId }) => inspectSlackAccount({ cfg, accountId }).configured, }), introNote: { title: "Slack socket mode tokens", diff --git a/extensions/telegram/src/bot-handlers.runtime.ts b/extensions/telegram/src/bot-handlers.runtime.ts index b3344714a31..4178e042166 100644 --- a/extensions/telegram/src/bot-handlers.runtime.ts +++ b/extensions/telegram/src/bot-handlers.runtime.ts @@ -45,6 +45,7 @@ import { resolveDefaultAgentId, resolveDefaultModelForAgent, } from "./bot-handlers.agent.runtime.js"; +import { buildTelegramInboundDebounceKey } from "./bot-handlers.debounce-key.js"; import { hasInboundMedia, hasReplyTargetMedia, @@ -101,7 +102,6 @@ import { resolveModelSelection, type ProviderInfo, } from "./model-buttons.js"; -import { buildTelegramInboundDebounceKey } from "./bot-handlers.debounce-key.js"; import { buildInlineKeyboard } from "./send.js"; export const registerTelegramHandlers = ({ diff --git a/extensions/tlon/src/channel.ts b/extensions/tlon/src/channel.ts index 8a166881bb8..d2fc6bcfa31 100644 --- a/extensions/tlon/src/channel.ts +++ b/extensions/tlon/src/channel.ts @@ -32,7 +32,9 @@ const loadTlonChannelRuntime = createLazyRuntimeModule(() => import("./channel.r const tlonSetupWizardProxy = createTlonSetupWizardBase({ resolveConfigured: async ({ cfg, accountId }) => - await (await loadTlonChannelRuntime()).tlonSetupWizard.status.resolveConfigured({ + await ( + await loadTlonChannelRuntime() + ).tlonSetupWizard.status.resolveConfigured({ cfg, accountId, }), diff --git a/extensions/tlon/src/setup-core.ts b/extensions/tlon/src/setup-core.ts index 451d6809f1a..2122c537865 100644 --- a/extensions/tlon/src/setup-core.ts +++ b/extensions/tlon/src/setup-core.ts @@ -135,7 +135,9 @@ export async function resolveTlonSetupConfigured( } const accountIds = listTlonAccountIds(cfg); return accountIds.length > 0 - ? accountIds.some((resolvedAccountId) => isConfigured(resolveTlonAccount(cfg, resolvedAccountId))) + ? accountIds.some((resolvedAccountId) => + isConfigured(resolveTlonAccount(cfg, resolvedAccountId)), + ) : isConfigured(resolveTlonAccount(cfg, DEFAULT_ACCOUNT_ID)); } diff --git a/extensions/twitch/src/actions.test.ts b/extensions/twitch/src/actions.test.ts index 3cbeb26ea60..93a3ca21283 100644 --- a/extensions/twitch/src/actions.test.ts +++ b/extensions/twitch/src/actions.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi, beforeEach } from "vitest"; import { twitchMessageActions } from "./actions.js"; -import { twitchOutbound } from "./outbound.js"; import { resolveTwitchAccountContext } from "./config.js"; +import { twitchOutbound } from "./outbound.js"; vi.mock("./config.js", () => ({ DEFAULT_ACCOUNT_ID: "default", diff --git a/extensions/twitch/src/setup-surface.ts b/extensions/twitch/src/setup-surface.ts index ec948e56f96..93197368fce 100644 --- a/extensions/twitch/src/setup-surface.ts +++ b/extensions/twitch/src/setup-surface.ts @@ -10,11 +10,7 @@ import { type OpenClawConfig, type WizardPrompter, } from "openclaw/plugin-sdk/setup"; -import { - DEFAULT_ACCOUNT_ID, - getAccountConfig, - resolveDefaultTwitchAccountId, -} from "./config.js"; +import { DEFAULT_ACCOUNT_ID, getAccountConfig, resolveDefaultTwitchAccountId } from "./config.js"; import type { TwitchAccountConfig, TwitchRole } from "./types.js"; import { isAccountConfigured } from "./utils/twitch.js"; @@ -233,11 +229,15 @@ function setTwitchAccessControl( return cfg; } - return setTwitchAccount(cfg, { - ...account, - allowedRoles, - requireMention, - }, accountId); + return setTwitchAccount( + cfg, + { + ...account, + allowedRoles, + requireMention, + }, + accountId, + ); } function resolveTwitchGroupPolicy(cfg: OpenClawConfig): "open" | "allowlist" | "disabled" { @@ -266,7 +266,10 @@ const twitchDmPolicy: ChannelSetupDmPolicy = { policyKey: "channels.twitch.allowedRoles", allowFromKey: "channels.twitch.accounts..allowFrom", getCurrent: (cfg) => { - const account = getAccountConfig(cfg as OpenClawConfig, resolveSetupAccountId(cfg as OpenClawConfig)); + const account = getAccountConfig( + cfg as OpenClawConfig, + resolveSetupAccountId(cfg as OpenClawConfig), + ); if (account?.allowedRoles?.includes("all")) { return "open"; } @@ -296,10 +299,14 @@ const twitchDmPolicy: ChannelSetupDmPolicy = { .map((s) => s.trim()) .filter(Boolean); - return setTwitchAccount(cfg as OpenClawConfig, { - ...(account ?? undefined), - allowFrom, - }, accountId); + return setTwitchAccount( + cfg as OpenClawConfig, + { + ...(account ?? undefined), + allowFrom, + }, + accountId, + ); }, }; @@ -309,11 +316,17 @@ const twitchGroupAccess: NonNullable = { skipAllowlistEntries: true, currentPolicy: ({ cfg }) => resolveTwitchGroupPolicy(cfg as OpenClawConfig), currentEntries: ({ cfg }) => { - const account = getAccountConfig(cfg as OpenClawConfig, resolveSetupAccountId(cfg as OpenClawConfig)); + const account = getAccountConfig( + cfg as OpenClawConfig, + resolveSetupAccountId(cfg as OpenClawConfig), + ); return account?.allowFrom ?? []; }, updatePrompt: ({ cfg }) => { - const account = getAccountConfig(cfg as OpenClawConfig, resolveSetupAccountId(cfg as OpenClawConfig)); + const account = getAccountConfig( + cfg as OpenClawConfig, + resolveSetupAccountId(cfg as OpenClawConfig), + ); return Boolean(account?.allowedRoles?.length || account?.allowFrom?.length); }, setPolicy: ({ cfg, policy }) => setTwitchGroupPolicy(cfg as OpenClawConfig, policy), @@ -324,9 +337,13 @@ const twitchGroupAccess: NonNullable = { export const twitchSetupAdapter: ChannelSetupAdapter = { resolveAccountId: ({ cfg }) => resolveSetupAccountId(cfg as OpenClawConfig), applyAccountConfig: ({ cfg, accountId }) => - setTwitchAccount(cfg, { - enabled: true, - }, accountId), + setTwitchAccount( + cfg, + { + enabled: true, + }, + accountId, + ), }; export const twitchSetupWizard: ChannelSetupWizard = { @@ -339,7 +356,10 @@ export const twitchSetupWizard: ChannelSetupWizard = { configuredHint: "configured", unconfiguredHint: "needs setup", resolveConfigured: ({ cfg }) => { - const account = getAccountConfig(cfg as OpenClawConfig, resolveSetupAccountId(cfg as OpenClawConfig)); + const account = getAccountConfig( + cfg as OpenClawConfig, + resolveSetupAccountId(cfg as OpenClawConfig), + ); return account ? isAccountConfigured(account) : false; }, resolveStatusLines: ({ cfg }) => { @@ -382,15 +402,19 @@ export const twitchSetupWizard: ChannelSetupWizard = { const channelName = await promptChannelName(prompter, account); const { clientSecret, refreshToken } = await promptRefreshTokenSetup(prompter, account); - const cfgWithAccount = setTwitchAccount(cfg as OpenClawConfig, { - username, - accessToken: token, - clientId, - channel: channelName, - clientSecret, - refreshToken, - enabled: true, - }, accountId); + const cfgWithAccount = setTwitchAccount( + cfg as OpenClawConfig, + { + username, + accessToken: token, + clientId, + channel: channelName, + clientSecret, + refreshToken, + enabled: true, + }, + accountId, + ); const cfgWithAllowFrom = forceAllowFrom && twitchDmPolicy.promptAllowFrom diff --git a/extensions/whatsapp/src/channel.setup.test.ts b/extensions/whatsapp/src/channel.setup.test.ts index bffb958c6ab..c47b5ad010d 100644 --- a/extensions/whatsapp/src/channel.setup.test.ts +++ b/extensions/whatsapp/src/channel.setup.test.ts @@ -2,8 +2,8 @@ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { createQueuedWizardPrompter } from "../../../test/helpers/plugins/setup-wizard.js"; -import type { OpenClawConfig } from "./runtime-api.js"; import { whatsappPlugin } from "./channel.js"; +import type { OpenClawConfig } from "./runtime-api.js"; import { finalizeWhatsAppSetup } from "./setup-finalize.js"; const hoisted = vi.hoisted(() => ({ diff --git a/extensions/whatsapp/src/heartbeat-recipients.test.ts b/extensions/whatsapp/src/heartbeat-recipients.test.ts index 9e8cb6fd2ed..1303f286ad4 100644 --- a/extensions/whatsapp/src/heartbeat-recipients.test.ts +++ b/extensions/whatsapp/src/heartbeat-recipients.test.ts @@ -167,11 +167,7 @@ describe("resolveWhatsAppHeartbeatRecipients", () => { { accountId: "work" }, ); - expect(readChannelAllowFromStoreSyncMock).toHaveBeenCalledWith( - "whatsapp", - process.env, - "work", - ); + expect(readChannelAllowFromStoreSyncMock).toHaveBeenCalledWith("whatsapp", process.env, "work"); expect(result).toEqual({ recipients: ["+15550000003", "+15550000002"], source: "allowFrom", @@ -198,11 +194,7 @@ describe("resolveWhatsAppHeartbeatRecipients", () => { }, }); - expect(readChannelAllowFromStoreSyncMock).toHaveBeenCalledWith( - "whatsapp", - process.env, - "work", - ); + expect(readChannelAllowFromStoreSyncMock).toHaveBeenCalledWith("whatsapp", process.env, "work"); expect(result).toEqual({ recipients: ["+15550000003", "+15550000002"], source: "allowFrom", diff --git a/extensions/whatsapp/src/heartbeat-recipients.ts b/extensions/whatsapp/src/heartbeat-recipients.ts index 11f0ccb6a2d..8811935968d 100644 --- a/extensions/whatsapp/src/heartbeat-recipients.ts +++ b/extensions/whatsapp/src/heartbeat-recipients.ts @@ -1,3 +1,4 @@ +import { resolveDefaultWhatsAppAccountId, resolveWhatsAppAccount } from "./accounts.js"; import { DEFAULT_ACCOUNT_ID, loadSessionStore, @@ -7,7 +8,6 @@ import { resolveStorePath, type OpenClawConfig, } from "./heartbeat-recipients.runtime.js"; -import { resolveDefaultWhatsAppAccountId, resolveWhatsAppAccount } from "./accounts.js"; type HeartbeatRecipientsResult = { recipients: string[]; source: string }; type HeartbeatRecipientsOpts = { to?: string; all?: boolean; accountId?: string }; @@ -58,10 +58,11 @@ export function resolveWhatsAppHeartbeatRecipients( const sessionRecipients = getSessionRecipients(cfg); const resolvedAccountId = opts.accountId?.trim() || resolveDefaultWhatsAppAccountId(cfg) || DEFAULT_ACCOUNT_ID; - const configuredAllowFrom = - (resolveWhatsAppAccount({ cfg, accountId: resolvedAccountId }).allowFrom ?? []) - .filter((value) => value !== "*") - .map(normalizeE164); + const configuredAllowFrom = ( + resolveWhatsAppAccount({ cfg, accountId: resolvedAccountId }).allowFrom ?? [] + ) + .filter((value) => value !== "*") + .map(normalizeE164); const storeAllowFrom = readChannelAllowFromStoreSync( "whatsapp", process.env, diff --git a/extensions/whatsapp/src/send.ts b/extensions/whatsapp/src/send.ts index 6811edd012e..42c25b95289 100644 --- a/extensions/whatsapp/src/send.ts +++ b/extensions/whatsapp/src/send.ts @@ -57,9 +57,8 @@ export async function sendMessageWhatsApp( cfg, accountId: options.accountId, }); - const { listener: active, accountId: resolvedAccountId } = requireActiveWebListener( - effectiveAccountId, - ); + const { listener: active, accountId: resolvedAccountId } = + requireActiveWebListener(effectiveAccountId); const account = resolveWhatsAppAccount({ cfg, accountId: resolvedAccountId ?? options.accountId, diff --git a/extensions/zalo/src/actions.test.ts b/extensions/zalo/src/actions.test.ts index d14360fb807..4b8841a29e8 100644 --- a/extensions/zalo/src/actions.test.ts +++ b/extensions/zalo/src/actions.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import type { OpenClawConfig } from "./runtime-api.js"; import { zaloMessageActions } from "./actions.js"; +import type { OpenClawConfig } from "./runtime-api.js"; describe("zaloMessageActions.describeMessageTool", () => { it("honors the selected Zalo account during discovery", () => { diff --git a/extensions/zalo/src/monitor.webhook.ts b/extensions/zalo/src/monitor.webhook.ts index 0cc2a450739..d95522586e1 100644 --- a/extensions/zalo/src/monitor.webhook.ts +++ b/extensions/zalo/src/monitor.webhook.ts @@ -82,7 +82,14 @@ function buildReplayEventCacheKey( ): string { const chatId = update.message?.chat?.id ?? ""; const senderId = update.message?.from?.id ?? ""; - return JSON.stringify([target.path, target.account.accountId, update.event_name, chatId, senderId, messageId]); + return JSON.stringify([ + target.path, + target.account.accountId, + update.event_name, + chatId, + senderId, + messageId, + ]); } function isReplayEvent(target: ZaloWebhookTarget, update: ZaloUpdate, nowMs: number): boolean { diff --git a/extensions/zalo/src/setup-core.ts b/extensions/zalo/src/setup-core.ts index 1e04226dd93..f308841f3b8 100644 --- a/extensions/zalo/src/setup-core.ts +++ b/extensions/zalo/src/setup-core.ts @@ -8,8 +8,8 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId, } from "openclaw/plugin-sdk/setup"; -import type { OpenClawConfig } from "./runtime-api.js"; import { resolveDefaultZaloAccountId, resolveZaloAccount } from "./accounts.js"; +import type { OpenClawConfig } from "./runtime-api.js"; const channel = "zalo" as const; diff --git a/extensions/zalouser/src/setup-surface.ts b/extensions/zalouser/src/setup-surface.ts index d096552c9bb..6ccbb4ae44b 100644 --- a/extensions/zalouser/src/setup-surface.ts +++ b/extensions/zalouser/src/setup-surface.ts @@ -69,15 +69,11 @@ function setZalouserDmPolicy( resolvedAccountId, { dmPolicy: policy, - ...(policy === "open" - ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } - : {}), + ...(policy === "open" ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } : {}), }, { dmPolicy: policy, - ...(policy === "open" - ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } - : {}), + ...(policy === "open" ? { allowFrom: addWildcardAllowFrom(resolved.config.allowFrom) } : {}), }, ); } @@ -318,9 +314,10 @@ export const zalouserSetupWizard: ChannelSetupWizard = { }, resolveStatusLines: async ({ cfg, accountId, configured }) => { void cfg; - const label = accountId && accountId !== DEFAULT_ACCOUNT_ID - ? `Zalo Personal (${accountId})` - : "Zalo Personal"; + const label = + accountId && accountId !== DEFAULT_ACCOUNT_ID + ? `Zalo Personal (${accountId})` + : "Zalo Personal"; return [`${label}: ${configured ? "logged in" : "needs QR login"}`]; }, },