fix(web): harden typed SPA chat lifecycle

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
This commit is contained in:
shaggy (mosaic-dev box)
2026-08-10 00:24:20 -05:00
co-authored by Claude Haiku 4.5
parent b2e005f2b4
commit caebf9ef70
20 changed files with 1778 additions and 125 deletions
+11 -3
View File
@@ -6,9 +6,17 @@ export function ToolCallList({ tools }: { tools: ToolCallState[] }): ReactElemen
return (
<ul aria-label="Tool calls" className="flex flex-col gap-1 px-4 pb-2 text-xs">
{tools.map((tool) => (
<li key={tool.toolCallId} role={tool.status === 'error' ? 'alert' : 'status'}>
{tool.toolName} {tool.status}
{tools.map((tool, index) => (
<li
// A valid server-controlled toolCallId can legitimately repeat
// (e.g. two tool:start events sharing one id) — keying on it alone
// would give React two identical keys. Pairing it with its
// (stable, append-only) render index keeps every key unique.
key={`${tool.toolCallId}-${index}`}
role={tool.status === 'error' || tool.status === 'anomaly' ? 'alert' : 'status'}
>
{tool.toolName} {' '}
{tool.status === 'anomaly' ? 'unexpected end (unknown tool call)' : tool.status}
</li>
))}
</ul>