refactor: extract iMessage echo cache and unify suppression guards

This commit is contained in:
Peter Steinberger
2026-02-25 00:53:39 +00:00
parent 196a7dbd24
commit 5c6b2cbc8e
9 changed files with 116 additions and 104 deletions

View File

@@ -286,6 +286,14 @@ export function extractToolErrorMessage(result: unknown): string | undefined {
return normalizeToolErrorText(text);
}
function resolveMessageToolTarget(args: Record<string, unknown>): string | undefined {
const toRaw = typeof args.to === "string" ? args.to : undefined;
if (toRaw) {
return toRaw;
}
return typeof args.target === "string" ? args.target : undefined;
}
export function extractMessagingToolSend(
toolName: string,
args: Record<string, unknown>,
@@ -298,12 +306,7 @@ export function extractMessagingToolSend(
if (action !== "send" && action !== "thread-reply") {
return undefined;
}
const toRaw =
typeof args.to === "string"
? args.to
: typeof args.target === "string"
? args.target
: undefined;
const toRaw = resolveMessageToolTarget(args);
if (!toRaw) {
return undefined;
}