fix(tool-pair-validator): emit schema-compatible synthetic tool results

This commit is contained in:
rshks
2026-05-08 14:09:42 +05:30
committed by YeonGyu-Kim
parent 24f7e560ca
commit b504fb1deb
7 changed files with 218 additions and 20 deletions
+10 -2
View File
@@ -139,12 +139,20 @@ describe("createMessagesTransformHandler", () => {
expect(messages).toHaveLength(5)
expect(messages[2]).toEqual({
info: { role: "user" },
parts: [{ type: "tool_result", tool_use_id: "toolu_01SRMQs3DUtVKWoSxC8bxxVA", content: "Tool output unavailable (context compacted)" }],
parts: [{
type: "tool_result",
toolUseId: "toolu_01SRMQs3DUtVKWoSxC8bxxVA",
tool_use_id: "toolu_01SRMQs3DUtVKWoSxC8bxxVA",
isError: true,
content: [{ type: "text", text: "Tool output unavailable (context compacted)" }],
}],
})
expect(messages[4]?.parts[0]).toEqual({
type: "tool_result",
toolUseId: "toolu_01Lu5cHvRtEvzoifP1UVBVRb",
tool_use_id: "toolu_01Lu5cHvRtEvzoifP1UVBVRb",
content: "Tool output unavailable (context compacted)",
isError: true,
content: [{ type: "text", text: "Tool output unavailable (context compacted)" }],
})
expect(messages[4]?.parts[1]).toEqual({ type: "text", text: "next" })
})