Files
openclaw/extensions/googlechat/src/group-policy.ts
Peter Steinberger 5579f009fb refactor(channels): converge internal group-policy drift onto the scope tree (#107865)
* refactor(channels): converge internal group-policy drift onto the scope tree

* chore(plugin-sdk): refresh API baseline hash for scope-key exports

* fix(config): avoid shadowing the scopeKey export in the case-insensitive lookup
2026-07-14 18:30:04 -07:00

29 lines
909 B
TypeScript

import {
buildChannelGroupsScopeTree,
resolveScopeRequireMention,
type ScopeTree,
} from "openclaw/plugin-sdk/channel-policy";
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
type GroupContext = { cfg: OpenClawConfig; accountId?: string | null; groupId?: string | null };
export function buildGoogleChatGroupPolicyScope(params: {
tree: ScopeTree;
groupId?: string | null;
}) {
const matchKey =
params.groupId && Object.hasOwn(params.tree.scopes, params.groupId)
? params.groupId
: undefined;
return { tree: params.tree, path: matchKey ? [matchKey] : [], matchKey };
}
export function resolveGoogleChatGroupRequireMention(params: GroupContext): boolean {
return resolveScopeRequireMention(
buildGoogleChatGroupPolicyScope({
tree: buildChannelGroupsScopeTree(params.cfg, "googlechat", params.accountId),
groupId: params.groupId,
}),
);
}