fix: normalize googlechat targets
This commit is contained in:
@@ -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.
|
- 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)
|
- 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: 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
|
## 2026.1.23-1
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ export function normalizeGoogleChatTarget(raw?: string | null): string | undefin
|
|||||||
if (!trimmed) return undefined;
|
if (!trimmed) return undefined;
|
||||||
const withoutPrefix = trimmed.replace(/^(googlechat|google-chat|gchat):/i, "");
|
const withoutPrefix = trimmed.replace(/^(googlechat|google-chat|gchat):/i, "");
|
||||||
const normalized = withoutPrefix
|
const normalized = withoutPrefix
|
||||||
.replace(/^user:/i, "users/")
|
.replace(/^user:(users\/)?/i, "users/")
|
||||||
.replace(/^space:/i, "spaces/");
|
.replace(/^space:(spaces\/)?/i, "spaces/");
|
||||||
if (isGoogleChatUserTarget(normalized)) {
|
if (isGoogleChatUserTarget(normalized)) {
|
||||||
const suffix = normalized.slice("users/".length);
|
const suffix = normalized.slice("users/".length);
|
||||||
return suffix.includes("@") ? `users/${suffix.toLowerCase()}` : normalized;
|
return suffix.includes("@") ? `users/${suffix.toLowerCase()}` : normalized;
|
||||||
|
|||||||
@@ -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 {
|
export function resolveSlackGroupRequireMention(params: GroupMentionParams): boolean {
|
||||||
const account = resolveSlackAccount({
|
const account = resolveSlackAccount({
|
||||||
cfg: params.cfg,
|
cfg: params.cfg,
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ export {
|
|||||||
resolveWhatsAppGroupRequireMention,
|
resolveWhatsAppGroupRequireMention,
|
||||||
resolveBlueBubblesGroupToolPolicy,
|
resolveBlueBubblesGroupToolPolicy,
|
||||||
resolveDiscordGroupToolPolicy,
|
resolveDiscordGroupToolPolicy,
|
||||||
|
resolveGoogleChatGroupToolPolicy,
|
||||||
resolveIMessageGroupToolPolicy,
|
resolveIMessageGroupToolPolicy,
|
||||||
resolveSlackGroupToolPolicy,
|
resolveSlackGroupToolPolicy,
|
||||||
resolveTelegramGroupToolPolicy,
|
resolveTelegramGroupToolPolicy,
|
||||||
|
|||||||
Reference in New Issue
Block a user