fix: bypass DM sessions without metadata and make tool globally visible #4

Merged
hzhang merged 5 commits from fix/dm-bypass-and-tool-visibility into feat/whispergate-mvp 2026-02-27 15:30:12 +00:00
Showing only changes of commit 75f358001b - Show all commits

View File

@@ -43,7 +43,10 @@ function stripTrailingMetadata(input: string): string {
function getLastChar(input: string): string {
const t = stripTrailingMetadata(input).trim();
return t.length ? t[t.length - 1] : "";
if (!t.length) return "";
// Use Array.from to handle multi-byte characters (emoji, surrogate pairs)
const chars = Array.from(t);
return chars[chars.length - 1] || "";
}
export function resolvePolicy(config: WhisperGateConfig, channelId?: string, channelPolicies?: Record<string, ChannelPolicy>) {