refactor: centralize target normalization

This commit is contained in:
Peter Steinberger
2026-01-17 06:45:06 +00:00
parent 5a1ff5b9e7
commit 353d778988
10 changed files with 75 additions and 23 deletions

View File

@@ -31,12 +31,3 @@ export function isMessagingToolSendAction(
if (!plugin?.actions?.extractToolSend) return false;
return Boolean(plugin.actions.extractToolSend({ args })?.to);
}
export function normalizeTargetForProvider(provider: string, raw?: string): string | undefined {
if (!raw) return undefined;
const providerId = normalizeChannelId(provider);
const plugin = providerId ? getChannelPlugin(providerId) : undefined;
const normalized =
plugin?.messaging?.normalizeTarget?.(raw) ?? (raw.trim().toLowerCase() || undefined);
return normalized || undefined;
}