Agents: fix lint in tool-call sanitizers

This commit is contained in:
Justin
2026-02-03 05:39:22 +08:00
committed by Shakker
parent 31face5740
commit 67f90dae54
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ export function installSessionToolResultGuard(
if (sanitized.length === 0) { if (sanitized.length === 0) {
return undefined; return undefined;
} }
nextMessage = sanitized[0] as AgentMessage; nextMessage = sanitized[0];
} }
const nextRole = (nextMessage as { role?: unknown }).role; const nextRole = (nextMessage as { role?: unknown }).role;
+2 -3
View File
@@ -114,11 +114,10 @@ export function repairToolCallInputs(messages: AgentMessage[]): ToolCallInputRep
continue; continue;
} }
const assistant = msg as Extract<AgentMessage, { role: "assistant" }>;
const nextContent = []; const nextContent = [];
let droppedInMessage = 0; let droppedInMessage = 0;
for (const block of assistant.content) { for (const block of msg.content) {
if (isToolCallBlock(block) && !hasToolCallInput(block)) { if (isToolCallBlock(block) && !hasToolCallInput(block)) {
droppedToolCalls += 1; droppedToolCalls += 1;
droppedInMessage += 1; droppedInMessage += 1;
@@ -134,7 +133,7 @@ export function repairToolCallInputs(messages: AgentMessage[]): ToolCallInputRep
changed = true; changed = true;
continue; continue;
} }
out.push({ ...assistant, content: nextContent }); out.push({ ...msg, content: nextContent });
continue; continue;
} }