refactor(tools): unify tool APIs and result handling (#38367)

This commit is contained in:
Kit Langton 2026-07-23 17:13:31 -04:00 committed by GitHub
commit 79c1544072
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
133 changed files with 3602 additions and 2770 deletions

View file

@ -2342,8 +2342,7 @@ test("settles pending tools when a live failure arrives", async () => {
sessionID: "session-1",
assistantMessageID: "msg_explicit_assistant_9",
callID: "call-1",
structured: { sessionID: "session-child", status: "running" },
content: [],
metadata: { sessionID: "session-child", status: "running" },
},
})
@ -2353,7 +2352,7 @@ test("settles pending tools when a live failure arrives", async () => {
assistant?.type === "assistant" &&
assistant.content[0]?.type === "tool" &&
assistant.content[0].state.status === "running" &&
assistant.content[0].state.structured.sessionID === "session-child"
assistant.content[0].state.metadata.sessionID === "session-child"
)
})
@ -2361,7 +2360,7 @@ test("settles pending tools when a live failure arrives", async () => {
id: "evt_failed_1",
created: 0,
type: "session.tool.failed",
durable: durable("session-1", 6),
durable: durable("session-1", 6, 2),
data: {
sessionID: "session-1",
assistantMessageID: "msg_explicit_assistant_9",
@ -2392,8 +2391,8 @@ test("settles pending tools when a live failure arrives", async () => {
if (tool.state.status !== "error") return
expect(tool.state.error).toEqual({ type: "unknown", message: "aborted" })
expect(tool.state.input).toEqual({})
expect(tool.state.structured).toEqual({ sessionID: "session-child", status: "running" })
expect(tool.state.content).toEqual([])
expect(tool.state.metadata).toBeUndefined()
expect(tool.state.content).toBeUndefined()
expect(tool.executed).toBe(false)
expect(tool.providerState).toEqual({ call: true })
expect(tool.providerResultState).toEqual({ result: true })