diff --git a/browser_tests/tests/agent/agentToolCallHistoryPersistence.spec.ts b/browser_tests/tests/agent/agentToolCallHistoryPersistence.spec.ts index 45cbda920d8..26ea05e9172 100644 --- a/browser_tests/tests/agent/agentToolCallHistoryPersistence.spec.ts +++ b/browser_tests/tests/agent/agentToolCallHistoryPersistence.spec.ts @@ -97,13 +97,14 @@ test( tool_calls: [ { id: 'call-1', + tool_call_id: 'call-1', tool_name: 'search_nodes', - status: 'ok', + status: 'success', duration_ms: 420 }, { - // Deliberately 'success' (not 'ok', like call-1) to cover both terminal vocabularies. id: 'call-2', + tool_call_id: 'call-2', tool_name: 'add_node', status: 'success', duration_ms: 180 diff --git a/packages/ingest-types/src/index.ts b/packages/ingest-types/src/index.ts index f5e147d5ca5..0104da0c5e1 100644 --- a/packages/ingest-types/src/index.ts +++ b/packages/ingest-types/src/index.ts @@ -1023,6 +1023,7 @@ export type { TeamCreditStopPrice, TeamCreditStops, TeamCreditStopSummary, + ToolCallSummary, UpdateAssetData, UpdateAssetError, UpdateAssetErrors, diff --git a/packages/ingest-types/src/types.gen.ts b/packages/ingest-types/src/types.gen.ts index 2face4f1f1e..3e8bee75154 100644 --- a/packages/ingest-types/src/types.gen.ts +++ b/packages/ingest-types/src/types.gen.ts @@ -465,6 +465,35 @@ export type UpdateHubProfileRequest = { website_urls?: Array } +/** + * One persisted tool call attached to an assistant message's content.tool_calls (services/agent/internal/persist.ToolCallSummary), so a chat reload can render the tool-call history a turn produced. Display data only — raw arguments/results are never projected here. Only terminal rows (status ok/error) are ever surfaced; a row a dead turn left in pending/running has no wire-status mapping and is dropped rather than shown as a perpetual-progress chip. + */ +export type ToolCallSummary = { + /** + * Omitted when zero. + */ + duration_ms?: number + /** + * Present only when status is error. + */ + error_code?: string + finished_at?: string + /** + * This tool-call row's own primary key. + */ + id: string + started_at?: string + /** + * The WIRE status vocabulary (api/agent_events.schema.json's agent_tool_call), translated from the audit-row vocabulary (pending/running/ok/error) via ToolCallWireStatus — the same function the live agent_tool_call broadcast uses, so reloaded history and a live frame for the same call never disagree on the vocabulary. "running" never appears here: only terminal rows are queried, so a call still in flight when its turn died is omitted rather than shown as a perpetually in-progress chip. + */ + status: 'success' | 'error' + /** + * The provider tool-use id, the same id a live agent_tool_call WebSocket frame carries as tool_call_id — the frontend keys its tool chip on this value so a reload and a resumed live frame for the same call render as one chip, not two. Rows recorded before this id existed have none; id (this row's own primary key) is emitted instead, so the field is never empty, though it then cannot match any live frame. + */ + tool_call_id: string + tool_name: string +} + /** * Credit-stop ladder for the pricing slider (BE-1254). Returned by GET /api/billing/plans for every workspace regardless of the caller's token or workspace type (the personal/team distinction was removed); omitted only when the catalog defines no stops. */ @@ -4478,9 +4507,10 @@ export type AgentPendingAsk = { */ export type AgentMessage = { /** - * Message payload. User turns carry {text, attachments?} (attachments are the input-image filenames from the request); assistant turns carry {text} — the final answer text (or error copy on a failed turn). Omitted when empty (e.g. an assistant message still streaming). Per-turn token accounting is NOT included here; it is surfaced on the agent_message_done WebSocket broadcast. + * Message payload. User turns carry {text, attachments?, attachment_refs?, workflow_references?}. Attachments are the input-image filenames from the request. attachment_refs is the server's own resolution of those same filenames to library assets, as {name, id?, kind?} objects, and exists so a later turn in the thread can reach an earlier turn's file — clients should keep reading attachments. workflow_references is an optional array of explicit non-target references, each with workflow_id and name (an empty string when no name was supplied). An optional unavailable: true records that the reference could not be authorized at turn start, without distinguishing unknown IDs, inaccessible workflows, or lookup failures. These entries preserve the user's reference intent without exposing workflow content; the frontend restores reference chips from this metadata. The field is omitted when there are no references. Assistant turns carry {text} — the final answer text (or error copy on a failed turn). Omitted when empty (e.g. an assistant message still streaming). Per-turn token accounting is NOT included here; it is surfaced on the agent_message_done WebSocket broadcast. tool_calls is an optional array of ToolCallSummary, attached to an assistant message that has persisted terminal (ok/error) tool-call rows — it lets a chat reload render the tool history a turn produced instead of showing nothing until the next live turn. Omitted when the message has no such rows. */ content?: { + tool_calls?: Array [key: string]: unknown } id: string diff --git a/packages/ingest-types/src/zod.gen.ts b/packages/ingest-types/src/zod.gen.ts index 1b4858023b2..0fdfbfb9150 100644 --- a/packages/ingest-types/src/zod.gen.ts +++ b/packages/ingest-types/src/zod.gen.ts @@ -313,6 +313,20 @@ export const zUpdateHubProfileRequest = z.object({ website_urls: z.array(z.string()).optional() }) +/** + * One persisted tool call attached to an assistant message's content.tool_calls (services/agent/internal/persist.ToolCallSummary), so a chat reload can render the tool-call history a turn produced. Display data only — raw arguments/results are never projected here. Only terminal rows (status ok/error) are ever surfaced; a row a dead turn left in pending/running has no wire-status mapping and is dropped rather than shown as a perpetual-progress chip. + */ +export const zToolCallSummary = z.object({ + duration_ms: z.number().int().optional(), + error_code: z.string().optional(), + finished_at: z.string().datetime().optional(), + id: z.string(), + started_at: z.string().datetime().optional(), + status: z.enum(['success', 'error']), + tool_call_id: z.string(), + tool_name: z.string() +}) + /** * Pre/post-discount price for a team credit stop, in cents. */ @@ -2607,7 +2621,11 @@ export const zAgentPendingAsk = z.object({ * A persisted message in an agent thread. */ export const zAgentMessage = z.object({ - content: z.record(z.unknown()).optional(), + content: z + .object({ + tool_calls: z.array(zToolCallSummary).optional() + }) + .optional(), id: z.string(), pending_ask: zAgentPendingAsk.optional(), role: z.enum(['user', 'assistant', 'tool', 'system']), diff --git a/src/workbench/extensions/agent/schemas/agentApiSchema.ts b/src/workbench/extensions/agent/schemas/agentApiSchema.ts index 9b9f408abd2..196adc26ddc 100644 --- a/src/workbench/extensions/agent/schemas/agentApiSchema.ts +++ b/src/workbench/extensions/agent/schemas/agentApiSchema.ts @@ -7,6 +7,7 @@ import { zAgentRunMode as zGeneratedAgentRunMode, zAgentThreadListResponse as zGeneratedAgentThreadListResponse, zAgentTurnAccepted as zGeneratedAgentTurnAccepted, + zToolCallSummary, zWorkflowListResponse } from '@comfyorg/ingest-types/zod' import type { @@ -97,37 +98,32 @@ export type AgentRunModeValue = AgentRunModePreference['mode'] /** * One entry of a persisted assistant row's `content.tool_calls` (see * `agentTranscript.ts`'s `parseToolCallEntry`), the reload-path counterpart - * to the live WebSocket's `zAgentToolCallData` above. `status` is - * deliberately `z.string()` rather than a closed enum: an unrecognized value - * must still surface as a failed `ToolPart` (`toolCallOk` treats anything - * other than `pending`/`running`/`ok`/`success` as failure), so schema - * validation should reject a malformed *entry* (missing `id`/`tool_name`), - * not an unfamiliar *status* string or a bad `duration_ms` — `duration_ms` is - * `z.unknown().optional()` so a NaN/Infinity/negative value there doesn't - * sink the whole entry; `parseToolCallEntry` narrows it separately and just - * omits it. `status` is likewise `.optional()`: an entry that omits it - * entirely must still survive validation (`toolCallPartState`/`toolCallOk` - * already treat `undefined` as terminal-and-failed, matching the old - * parser's behavior for a status-less call). + * to the live WebSocket's `zAgentToolCallData` above. Sourced directly from + * the generated `ToolCallSummary` schema (Comfy-Org/cloud#10360) — the + * backend only ever persists terminal rows (`status: 'success' | 'error'`); + * a row a dead turn left in `pending`/`running` has no wire-status mapping + * and is dropped server-side rather than reaching this parser. */ -export const zPersistedToolCallSummary = z +export const zPersistedToolCallSummary = zToolCallSummary + +/** + * The generated `AgentMessage.content` schema narrows to just `tool_calls` + * (typed via `zToolCallSummary`), but the OpenAPI-generated TS type still + * carries a `[key: string]: unknown` index signature for it — the zod + * plugin's output didn't get a matching `.passthrough()`. Re-widened here so + * a persisted row's other `content` fields (`text`, `attachments`, + * `attachment_refs`, `workflow_references`, ...; see `agentTranscript.ts`) + * keep parsing. + */ +const zAgentMessageContent = z .object({ - id: z.string(), - // The provider tool-use id a LIVE `agent_tool_call` frame carries as - // `tool_call_id` (see `zAgentToolCallData` above). `parseToolCallEntry` - // prefers this over `id` when building `callId` so a restored `ToolPart` - // is keyed the same way a live frame for the same call will be, and can - // be updated in place rather than rendered as an unmatched duplicate. - // Optional: rows recorded before `tool_call_id` existed have none. - tool_call_id: z.string().optional(), - tool_name: z.string(), - status: z.string().optional(), - duration_ms: z.unknown().optional() + tool_calls: z.array(zToolCallSummary).optional() }) .passthrough() export const zAgentMessage = zGeneratedAgentMessage .extend({ + content: zAgentMessageContent.optional(), pending_ask: zAgentPendingAsk.optional() }) .passthrough() diff --git a/src/workbench/extensions/agent/services/agent/agentEventTransport.test.ts b/src/workbench/extensions/agent/services/agent/agentEventTransport.test.ts index 6332b60c607..121a925001e 100644 --- a/src/workbench/extensions/agent/services/agent/agentEventTransport.test.ts +++ b/src/workbench/extensions/agent/services/agent/agentEventTransport.test.ts @@ -433,7 +433,7 @@ describe('agentEventTransport text and tool parts', () => { id: 'audit-row-uuid-1', tool_call_id: 'call-1', tool_name: 'run', - status: 'running' + status: 'error' } ] } diff --git a/src/workbench/extensions/agent/services/agent/agentTranscript.test.ts b/src/workbench/extensions/agent/services/agent/agentTranscript.test.ts index f698ee632bb..0b0cac1bc5a 100644 --- a/src/workbench/extensions/agent/services/agent/agentTranscript.test.ts +++ b/src/workbench/extensions/agent/services/agent/agentTranscript.test.ts @@ -248,9 +248,10 @@ describe('normalizeAgentTranscript', () => { text: 'Done', tool_calls: [ { - id: 'call-1', + id: 'audit-row-uuid-1', + tool_call_id: 'call-1', tool_name: 'search_nodes', - status: 'ok', + status: 'success', duration_ms: 420 } ] @@ -271,7 +272,7 @@ describe('normalizeAgentTranscript', () => { ]) }) - it('prefers tool_call_id over id when deriving callId, matching what live frames key on', () => { + it('keys callId on tool_call_id, matching what live frames key on', () => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') message.content = { text: 'Done', @@ -280,7 +281,7 @@ describe('normalizeAgentTranscript', () => { id: 'audit-row-uuid-1', tool_call_id: 'provider-call-1', tool_name: 'search_nodes', - status: 'ok' + status: 'success' } ] } @@ -299,20 +300,20 @@ describe('normalizeAgentTranscript', () => { ]) }) - it('falls back to id for callId when a row was recorded before tool_call_id existed', () => { + it('drops a tool-call entry with no tool_call_id, matching the generated ToolCallSummary contract', () => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') message.content = { text: 'Done', tool_calls: [ - { id: 'audit-row-uuid-1', tool_name: 'search_nodes', status: 'ok' } + { id: 'audit-row-uuid-1', tool_name: 'search_nodes', status: 'success' } ] - } + } as unknown as AgentMessages[number]['content'] const transcript = normalizeAgentTranscript([message]) - expect(transcript.messages[0].parts).toContainEqual( - expect.objectContaining({ callId: 'audit-row-uuid-1' }) - ) + expect(transcript.messages[0].parts).toEqual([ + { type: 'text', text: 'Done', state: 'done' } + ]) }) it('omits tool parts entirely when a message carries no tool_calls', () => { @@ -330,8 +331,18 @@ describe('normalizeAgentTranscript', () => { message.content = { text: 'Done', tool_calls: [ - { id: 'call-1', tool_name: 'search_nodes', status: 'ok' }, - { id: 'call-2', tool_name: 'add_node', status: 'error' } + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'success' + }, + { + id: 'audit-2', + tool_call_id: 'call-2', + tool_name: 'add_node', + status: 'error' + } ] } @@ -356,35 +367,37 @@ describe('normalizeAgentTranscript', () => { ]) }) - it('clamps a restored pending/running tool call to done+ok:false with no live transport', () => { + it('drops a persisted tool call left pending/running by a dead turn, matching the backend contract that only terminal rows are ever persisted', () => { const message = row(1, 'assistant', 'turn-a', '', 'row-1') message.content = { tool_calls: [ - { id: 'call-1', tool_name: 'search_nodes', status: 'running' } + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'running' + } ] - } + } as unknown as AgentMessages[number]['content'] const transcript = normalizeAgentTranscript([message]) - expect(transcript.messages[0].parts).toEqual([ - { - type: 'tool', - callId: 'call-1', - name: 'search_nodes', - state: 'done', - ok: false - } - ]) + expect(transcript.messages[0].parts).toEqual([]) }) - it('keeps a pending/running tool call streaming when its row is the live run_approval ask', () => { + it('keeps the runApproval part and pending state for a live run_approval ask even though its stale pending/running tool call is dropped', () => { const message = row(1, 'assistant', 'turn-a', '', 'row-1') message.status = 'streaming' message.content = { tool_calls: [ - { id: 'call-1', tool_name: 'search_nodes', status: 'running' } + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'running' + } ] - } + } as unknown as AgentMessages[number]['content'] message.pending_ask = { message_id: 'row-1', ask_id: 'ask-1', @@ -398,22 +411,26 @@ describe('normalizeAgentTranscript', () => { const transcript = normalizeAgentTranscript([message]) - expect(transcript.messages[0].parts).toContainEqual({ - type: 'tool', - callId: 'call-1', - name: 'search_nodes', - state: 'streaming' - }) + expect(transcript.messages[0].parts).toEqual([ + { type: 'runApproval', askId: 'ask-1' } + ]) expect(transcript.pending?.messageId).toBe('row-1') }) - it.for(['success', 'failed', 'cancelled', 'timeout', 'unrecognized'])( - 'maps terminal tool-call status %s through the broadened vocabulary', + it.for(['success', 'error'] as const)( + 'maps terminal tool-call status %s to ok matching status === success', (status) => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') message.content = { text: 'Done', - tool_calls: [{ id: 'call-1', tool_name: 'search_nodes', status }] + tool_calls: [ + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status + } + ] } const transcript = normalizeAgentTranscript([message]) @@ -428,17 +445,44 @@ describe('normalizeAgentTranscript', () => { } ) - it.for([NaN, Infinity, -Infinity, -1])( - 'rejects a non-finite or negative durationMs (%s)', + it('omits durationMs for a negative but otherwise valid duration_ms', () => { + const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') + message.content = { + text: 'Done', + tool_calls: [ + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'success', + duration_ms: -1 + } + ] + } + + const transcript = normalizeAgentTranscript([message]) + + expect(transcript.messages[0].parts).toContainEqual({ + type: 'tool', + callId: 'call-1', + name: 'search_nodes', + state: 'done', + ok: true + }) + }) + + it.for([NaN, Infinity, -Infinity])( + 'drops the whole tool-call entry when duration_ms is non-finite (%s), since the generated schema requires an integer', (durationMs) => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') message.content = { text: 'Done', tool_calls: [ { - id: 'call-1', + id: 'audit-1', + tool_call_id: 'call-1', tool_name: 'search_nodes', - status: 'ok', + status: 'success', duration_ms: durationMs } ] @@ -446,13 +490,9 @@ describe('normalizeAgentTranscript', () => { const transcript = normalizeAgentTranscript([message]) - expect(transcript.messages[0].parts).toContainEqual({ - type: 'tool', - callId: 'call-1', - name: 'search_nodes', - state: 'done', - ok: true - }) + expect(transcript.messages[0].parts).toEqual([ + { type: 'text', text: 'Done', state: 'done' } + ]) } ) @@ -461,12 +501,23 @@ describe('normalizeAgentTranscript', () => { message.content = { text: 'Done', tool_calls: [ - { id: 'call-1', tool_name: 'search_nodes', status: 'running' }, - { id: 'call-2', tool_name: 'add_node', status: 'ok' }, { - id: 'call-1', + id: 'audit-1', + tool_call_id: 'call-1', tool_name: 'search_nodes', - status: 'ok', + status: 'success' + }, + { + id: 'audit-2', + tool_call_id: 'call-2', + tool_name: 'add_node', + status: 'success' + }, + { + id: 'audit-3', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'success', duration_ms: 420 } ] @@ -497,12 +548,17 @@ describe('normalizeAgentTranscript', () => { it.for([ { tool_calls: 'not-an-array' }, { tool_calls: [null, 17, 'a-string'] }, - { tool_calls: [{ tool_name: 'no_id', status: 'ok' }] }, - { tool_calls: [{ id: 'call-1', status: 'ok' }] }, + { tool_calls: [{ tool_name: 'no_id', status: 'success' }] }, + { + tool_calls: [{ id: 'call-1', tool_call_id: 'call-1', status: 'success' }] + }, { tool_calls: [] } ])('ignores malformed tool_calls metadata: $tool_calls', (content) => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') - message.content = { text: 'Done', ...content } + message.content = { + text: 'Done', + ...content + } as unknown as AgentMessages[number]['content'] const transcript = normalizeAgentTranscript([message]) @@ -514,14 +570,22 @@ describe('normalizeAgentTranscript', () => { it('dedupes a repeated callId across two assistant rows of the same turn', () => { const first = row(1, 'assistant', 'turn-a', '', 'row-1') first.content = { - tool_calls: [{ id: 'call-1', tool_name: 'search_nodes', status: 'ok' }] + tool_calls: [ + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'success' + } + ] } const second = row(2, 'assistant', 'turn-a', 'Done', 'row-2') second.content = { text: 'Done', tool_calls: [ { - id: 'call-1', + id: 'audit-2', + tool_call_id: 'call-1', tool_name: 'search_nodes', status: 'error', duration_ms: 900 @@ -543,23 +607,18 @@ describe('normalizeAgentTranscript', () => { ]) }) - it('renders a persisted tool call with no status field as a failure, not a dropped entry', () => { + it('drops a persisted tool call entry with no status field, since status is required by the generated contract', () => { const message = row(1, 'assistant', 'turn-a', 'Done', 'row-1') message.content = { text: 'Done', - tool_calls: [{ id: 'call-1', tool_name: 'search_nodes' }] - } + tool_calls: [ + { id: 'audit-1', tool_call_id: 'call-1', tool_name: 'search_nodes' } + ] + } as unknown as AgentMessages[number]['content'] const transcript = normalizeAgentTranscript([message]) expect(transcript.messages[0].parts).toEqual([ - { - type: 'tool', - callId: 'call-1', - name: 'search_nodes', - state: 'done', - ok: false - }, { type: 'text', text: 'Done', state: 'done' } ]) }) diff --git a/src/workbench/extensions/agent/services/agent/agentTranscript.ts b/src/workbench/extensions/agent/services/agent/agentTranscript.ts index ea5503632f0..05b6c2b2df7 100644 --- a/src/workbench/extensions/agent/services/agent/agentTranscript.ts +++ b/src/workbench/extensions/agent/services/agent/agentTranscript.ts @@ -143,17 +143,13 @@ function parseUserWorkflowReferences( } /** - * A persisted tool-call status is `pending`/`running` while it was still in - * flight when the turn ended, and some terminal string otherwise (`ok`, - * `success`, `error`, `failed`, `cancelled`, `timeout`, ...) — the exact - * terminal vocabulary is not yet settled between the backend's persisted and - * live wire formats, so anything other than `pending`/`running` is treated as - * terminal here. - * - * A restored (non-live) row has no transport left to ever settle its tool - * parts, so a `pending`/`running` status there would otherwise spin forever; - * only `isLive` (the row is the one actively backed by a live transport — - * the run_approval mid-ask case) keeps it in `streaming` state. + * `zPersistedToolCallSummary` only ever validates a terminal + * (`success`/`error`) row — the backend drops a row a dead turn left in + * `pending`/`running` before persisting it. `isLive` (the row is the one + * actively backed by a live transport — the run_approval mid-ask case) is + * kept only for a call that arrives through the live WebSocket path with a + * status this schema doesn't cover; a restored (non-live) row is always + * `done`. */ function toolCallPartState( status: unknown, @@ -166,17 +162,15 @@ function toolCallPartState( /** * `undefined` while the call is still genuinely in progress (matching the * live path, which omits `ok` until a terminal status arrives); once the - * part is in a `done` state, only `ok`/`success` counts as success — every - * other terminal string, including a restored `pending`/`running` call that - * had no live transport to finish it, reads as failure rather than being - * rendered as if it succeeded. + * part is in a `done` state, only `success` counts as success — `error` + * reads as failure, matching `ToolCallSummary.status`. */ function toolCallOk( status: unknown, state: ToolPart['state'] ): boolean | undefined { if (state === 'streaming') return undefined - return status === 'ok' || status === 'success' + return status === 'success' } /** @@ -184,7 +178,7 @@ function toolCallOk( * and maps it onto the same `ToolPart` the live WebSocket path builds from * `agent_tool_call` events, so a reloaded transcript renders through the * identical work-summary UI as a live turn. `undefined` for anything that - * doesn't validate (missing `id`/`tool_name`, wrong types, ...). + * doesn't validate (missing `id`/`tool_call_id`/`tool_name`, wrong types, ...). */ function parseToolCallEntry( entry: unknown, @@ -193,7 +187,6 @@ function parseToolCallEntry( const parsed = zPersistedToolCallSummary.safeParse(entry) if (!parsed.success) return undefined const { - id, tool_call_id: toolCallId, tool_name: toolName, status, @@ -209,11 +202,10 @@ function parseToolCallEntry( : undefined return { type: 'tool', - // A live `agent_tool_call` frame keys its update on `tool_call_id`, not - // this row's own `id` — prefer it so a restored part matches a live - // frame that arrives for it later. Falls back to `id` only for rows - // recorded before `tool_call_id` existed. - callId: toolCallId ?? id, + // A live `agent_tool_call` frame keys its update on `tool_call_id`, so a + // restored part uses the same id to match a live frame that arrives for + // it later. + callId: toolCallId, name: toolName, state, ...(ok !== undefined ? { ok } : {}), diff --git a/src/workbench/extensions/agent/stores/agent/agentConversationStore.test.ts b/src/workbench/extensions/agent/stores/agent/agentConversationStore.test.ts index 17370cbbfff..c512a1d10ae 100644 --- a/src/workbench/extensions/agent/stores/agent/agentConversationStore.test.ts +++ b/src/workbench/extensions/agent/stores/agent/agentConversationStore.test.ts @@ -717,7 +717,14 @@ describe('useAgentConversationStore', () => { const assistant = historyRow(2, 'assistant', 'turn-a', 'Done') assistant.content = { text: 'Done', - tool_calls: [{ id: 'call-1', tool_name: 'search_nodes', status: 'ok' }] + tool_calls: [ + { + id: 'audit-1', + tool_call_id: 'call-1', + tool_name: 'search_nodes', + status: 'success' + } + ] } const store = useAgentConversationStore() @@ -737,7 +744,14 @@ describe('useAgentConversationStore', () => { const threadAAssistant = historyRow(2, 'assistant', 'turn-a', 'Done A') threadAAssistant.content = { text: 'Done A', - tool_calls: [{ id: 'call-a', tool_name: 'search_nodes', status: 'ok' }] + tool_calls: [ + { + id: 'audit-a', + tool_call_id: 'call-a', + tool_name: 'search_nodes', + status: 'success' + } + ] } const threadA = [ historyRow(1, 'user', 'turn-a', 'Find a node'),