mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b355acd56c
TanStack's chat() engine runs a multi-turn agent loop: after the model returns tool calls, it tries to execute them via processToolCalls(). Frontend-only tools (like render_pie_chart) are unknown to TanStack, so executeToolCalls() treats them as errors and buildToolResultChunks() re-emits TOOL_CALL_END without a preceding TOOL_CALL_START. The ag-ui verify middleware rejects this duplicate. Fix: track a runFinished flag in convertTanStackStream and discard all events after the first RUN_FINISHED, which marks the boundary between the streaming pass and TanStack's internal tool execution loop. Also adds built-in-agent to docker-compose.local.yml and local-ports.json.