mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 20:01:23 +00:00
refactor: extract iMessage echo cache and unify suppression guards
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user