mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-04 01:51:42 +00:00
* 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
29 lines
909 B
TypeScript
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,
|
|
}),
|
|
);
|
|
}
|