fix: normalize googlechat targets

This commit is contained in:
Peter Steinberger
2026-01-25 00:04:37 +00:00
parent 72858a5311
commit c147962434
4 changed files with 15 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ Docs: https://docs.clawd.bot
- macOS: default direct-transport `ws://` URLs to port 18789; document `gateway.remote.transport`. (#1603) Thanks @ngutman.
- Voice Call: return stream TwiML for outbound conversation calls on initial Twilio webhook. (#1634)
- Google Chat: tighten email allowlist matching, typing cleanup, media caps, and onboarding/docs/tests. (#1635) Thanks @iHildy.
- Google Chat: normalize space targets without double `spaces/` prefix.
## 2026.1.23-1

View File

@@ -6,8 +6,8 @@ export function normalizeGoogleChatTarget(raw?: string | null): string | undefin
if (!trimmed) return undefined;
const withoutPrefix = trimmed.replace(/^(googlechat|google-chat|gchat):/i, "");
const normalized = withoutPrefix
.replace(/^user:/i, "users/")
.replace(/^space:/i, "spaces/");
.replace(/^user:(users\/)?/i, "users/")
.replace(/^space:(spaces\/)?/i, "spaces/");
if (isGoogleChatUserTarget(normalized)) {
const suffix = normalized.slice("users/".length);
return suffix.includes("@") ? `users/${suffix.toLowerCase()}` : normalized;

View File

@@ -164,6 +164,17 @@ export function resolveGoogleChatGroupRequireMention(params: GroupMentionParams)
});
}
export function resolveGoogleChatGroupToolPolicy(
params: GroupMentionParams,
): GroupToolPolicyConfig | undefined {
return resolveChannelGroupToolsPolicy({
cfg: params.cfg,
channel: "googlechat",
groupId: params.groupId,
accountId: params.accountId,
});
}
export function resolveSlackGroupRequireMention(params: GroupMentionParams): boolean {
const account = resolveSlackAccount({
cfg: params.cfg,

View File

@@ -154,6 +154,7 @@ export {
resolveWhatsAppGroupRequireMention,
resolveBlueBubblesGroupToolPolicy,
resolveDiscordGroupToolPolicy,
resolveGoogleChatGroupToolPolicy,
resolveIMessageGroupToolPolicy,
resolveSlackGroupToolPolicy,
resolveTelegramGroupToolPolicy,