diff --git a/frontend/src/lib/components/aiAgentResult.ts b/frontend/src/lib/components/aiAgentResult.ts index b7ec8d695e..c954ac3964 100644 --- a/frontend/src/lib/components/aiAgentResult.ts +++ b/frontend/src/lib/components/aiAgentResult.ts @@ -173,7 +173,7 @@ const STREAM_EVENT_TYPES = [ 'tool_result' ] -function parseStreamEvent(line: string): Record | undefined { +function parseStreamEvent(line: string): (Record & { type: string }) | undefined { let event: unknown try { event = JSON.parse(line) @@ -183,7 +183,9 @@ function parseStreamEvent(line: string): Record | undefined { if (!isRecord(event) || typeof event.type !== 'string') { return undefined } - return STREAM_EVENT_TYPES.includes(event.type) ? event : undefined + return STREAM_EVENT_TYPES.includes(event.type) + ? (event as Record & { type: string }) + : undefined } /**