diff --git a/extensions/googlechat/src/channel.ts b/extensions/googlechat/src/channel.ts index c4ee5364643..6c401293003 100644 --- a/extensions/googlechat/src/channel.ts +++ b/extensions/googlechat/src/channel.ts @@ -19,7 +19,6 @@ import { missingTargetError, PAIRING_APPROVED_MESSAGE, resolveChannelMediaMaxBytes, - resolveGoogleChatGroupRequireMention, runPassiveAccountLifecycle, type ChannelMessageActionAdapter, type ChannelPlugin, @@ -36,6 +35,7 @@ import { type ResolvedGoogleChatAccount, } from "./accounts.js"; import { googlechatMessageActions } from "./actions.js"; +import { resolveGoogleChatGroupRequireMention } from "./group-policy.js"; import { getGoogleChatRuntime } from "./runtime.js"; import { googlechatSetupAdapter } from "./setup-core.js"; import { googlechatSetupWizard } from "./setup-surface.js"; diff --git a/extensions/googlechat/src/group-policy.test.ts b/extensions/googlechat/src/group-policy.test.ts new file mode 100644 index 00000000000..5f907695aad --- /dev/null +++ b/extensions/googlechat/src/group-policy.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, it } from "vitest"; +import { resolveGoogleChatGroupRequireMention } from "./group-policy.js"; + +describe("googlechat group policy", () => { + it("uses generic channel group policy helpers", () => { + const cfg = { + channels: { + googlechat: { + groups: { + "spaces/AAA": { + requireMention: false, + }, + "*": { + requireMention: true, + }, + }, + }, + }, + // oxlint-disable-next-line typescript/no-explicit-any + } as any; + + expect(resolveGoogleChatGroupRequireMention({ cfg, groupId: "spaces/AAA" })).toBe(false); + expect(resolveGoogleChatGroupRequireMention({ cfg, groupId: "spaces/BBB" })).toBe(true); + }); +}); diff --git a/extensions/googlechat/src/group-policy.ts b/extensions/googlechat/src/group-policy.ts new file mode 100644 index 00000000000..3518ce6e13c --- /dev/null +++ b/extensions/googlechat/src/group-policy.ts @@ -0,0 +1,17 @@ +import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; + +type GoogleChatGroupContext = { + cfg: OpenClawConfig; + accountId?: string | null; + groupId?: string | null; +}; + +export function resolveGoogleChatGroupRequireMention(params: GoogleChatGroupContext): boolean { + return resolveChannelGroupRequireMention({ + cfg: params.cfg, + channel: "googlechat", + groupId: params.groupId, + accountId: params.accountId, + }); +} diff --git a/src/plugin-sdk/googlechat.ts b/src/plugin-sdk/googlechat.ts index ce6d5f44511..ade38097fad 100644 --- a/src/plugin-sdk/googlechat.ts +++ b/src/plugin-sdk/googlechat.ts @@ -20,7 +20,7 @@ export { export { buildComputedAccountStatusSnapshot } from "./status-helpers.js"; export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; export { createAccountStatusSink, runPassiveAccountLifecycle } from "./channel-lifecycle.js"; -export { resolveGoogleChatGroupRequireMention } from "../channels/plugins/group-mentions.js"; +export { resolveGoogleChatGroupRequireMention } from "../../extensions/googlechat/src/group-policy.js"; export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; export {