Repository navigation
Description
Render an agent's work (thinking, tool calls, approvals) as parts that stand alone and fold together inside a message, with approvals rendered from their record. Also give the shared story axe sweep a reliable contrast check on translucent backgrounds such as the attention wash.
Part of #94.
Why
An agent's steps need parts that work on their own and fold into one summary line inside a chat message. Approvals follow Interchange's record: approved or denied, once or always, or timed out or expired. The host passes the record and never computes the resolved state.
Axe tends to report text on a translucent background as "incomplete" rather than pass or fail, and the approval's text sits on --attention-wash. Without a fallback the sweep can't vouch for it.
What
src/ui/tool.tsx:Tool,ToolHeader,ToolInput,ToolOutput.src/ui/tool-approval.tsx:ToolApproval(part,onDecide({ outcome, scope })). Pending shows Approve, Approve always and Deny; any other status shows the resolved line frompart.approval(approved once, approved always, denied, timed out, expired).src/ui/tool-group.tsx:ToolGroupfor aPartToolBatch.src/ui/reasoning.tsx:Reasoning,ReasoningTrigger,ReasoningContent.src/ui/activity.tsx:Activity,ActivityTrigger,ActivityContent.stories/chat/tool.stories.tsxandstories/chat/activity.stories.tsx, using the shared samples from Add sample conversations for the chat stories #96.e2e/stories-a11y.spec.ts: when axe returnscolor-contrastas incomplete inside a story's iframe, measure the element's computed text and background colours (compositing translucent backgrounds) and fail below 4.5:1, keying failures the same waye2e/stories-a11y.known.jsondoes. Every later story inherits the check.e2e/fixtures.tsx: atool-approvalscenario that records decisions, withe2e/tool-approval.spec.ts.src/ui/tool.test.tsx,src/ui/tool-approval.test.tsx,src/ui/activity.test.tsx; the five modules exported fromsrc/index.ts.
Requirements
- R13:
Tooland its parts render everyToolTraceStatus, input and output through a callerrenderprop. - R14:
ToolApprovalwith Approve, Approve always and Deny; resolved approvals rendered from the record. - R15:
ToolGroup,ReasoningandActivity(summary line closed, latest 10 open, a control for the rest); open state controllable. - R11: the contrast fallback makes the "no serious or critical violation" check hold on the wash.
- R5–R12: the shared component rules.
Constraints
- "Pending" follows the contract rule:
approval.status === "pending"wins overToolTraceStatus; a part with no record falls back toToolTraceStatus === "approval-requested". - Open state through
useControllableState; no timers inside the components. - Labels are props with English defaults.
- The old
ToolBlock,ToolNarrative,ReasoningBlockandApprovalCardstay until Remove the old chat components #110; these are new modules beside them. - The shared rules in Replace the chat components with a stateless Conversation family #94 apply: no new dependency or peer, no optional-peer import, token-only styling, no change to existing modules, additions only to
src/index.tsande2e/fixtures.tsx.
Done when
- Unit tests cover:
- Each
ToolTraceStatusrenders its label and icon, and the error state shows the output. ToolApprovalpending callsonDecideonce with{ outcome: "approved", scope: "once" },{ outcome: "approved", scope: "always" }or{ outcome: "rejected", scope: "once" }; each resolved status renders its line and no buttons; a record markedpendingshows the buttons whatever theToolTraceStatus.Activityclosed shows the summary; opening shows the latest 10 and a control that reveals the rest; a controlledopenis respected.
- Each
- The approval spec passes in the browser.
- The axe sweep gives the approval story a pass or fail contrast verdict, never only "incomplete".
- No serious or critical axe violation in the new stories, in light or dark.
bun run check,bun run build,bun run test:e2eandbun run dep-guardpass.
Activity