Skip to content

Add the ai-chat-acp viewer: part rows, permission card, session bar (#4292 C10) - #4308

Merged
mstomar125 merged 4 commits into
mainfrom
issue-4292-c10-acp-viewer
Nov 19, 2026
Merged

mstomar125 merged 4 commits into
mainfrom
issue-4292-c10-acp-viewer

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Core item C10 of #4292: the third chat viewer, for ai-chat-acp, developed against fixtures. No type, schema or wire change beyond the three review nits below; nothing under packages/agent, daemon session code or session proto is touched.

Base: this PR targets main. C6 (#4304) has landed, so it is based on current main with no stacked dependency.

What it adds

  • ai-chat-acp-node-viewer.svelte, registered as the third viewer (aiChatAcpNodePlugin). It derives the conversation from the chat's message children and renders one row per ACP part: user and reply text (existing ChatMessage), thinking (collapsed details), tool call (kind, title, status in words; updated in place), plan (Markdown from content, open by default), system notice (stop reasons, permission answers).
  • The live, in-memory side arrives as an optional session prop (AcpSessionSource in types/acp-session.ts): pending permission request, turn running, context usage, error, and controls (send, stop, end, resume). With no source the viewer is a read-only view of the stored conversation; nothing here talks to a daemon.
  • Permission card: shows only the once-only choices (allow once, reject once) plus a "Cancel request" that answers cancelled; an allow_always, reject_always or unknown option kind is never shown. Native buttons, labelled group, role="alert" so it is announced, each choice named in words (not colour alone), answers once per request.
  • Session bar: "Session active" / "Session ended" as text in a status region, agent, context usage as text, and only the control that fits the state (Stop while a turn runs, End session while active, Resume session once ended).
  • Gated by the AI chat Labs flag (a notice replaces the viewer when it is off).
  • Review follow-ups (second commit): the card shows only NodeSpace's own words for a choice (an agent-supplied option name is never shown, so a hostile name cannot mislead); a rejected or throwing answer is shown and the choices come back so the user can retry; no card renders for an ended session; focus moves to the card when it appears and to the message input (else the conversation) when it is answered or leaves, never to the page.
  • Fixtures: tests/helpers/acp-session-fixture.svelte.ts (scripted session, four-option permission request).

Review nits folded in from #4304: re-wrapped the schema comment, part_kind doc now says "absent for a whole message" (and that a tool_call part may carry no tool_* fields), TS regenerated; the viewer renders a bare tool_call part ("Tool call", "Tool", "Waiting") with a fixture and test.

Tests: bun run quality:fix clean (eslint, design tokens, svelte-check, cargo fmt, clippy), run again after the follow-ups with no changes; full frontend (5789) and browser (219) suites green; types:check, shape:check, node-types:check and core/types nextest (3545) green earlier on the Rust diff (comment/doc only). New: 32 viewer tests, 9 util tests, 6 real-browser tests (focus on the card, Tab order and Enter/Space with real key events, focus off the page after an answer, the answered guard and the disabled attribute each proven alone), plugin registry updates. Mutation checks: 35 frontend mutants in all, every one killed after adding tests for the survivors (two survivors in the follow-up round: onAnswered focus hand-off and the per-request key).

Low follow-ups noted, no change now: the card's alert re-reads when "Answer sent." appears (consider live region on that note only); the conversation is role=list with non-listitem children (as in the native viewer); no virtualisation for huge plans (as in the native viewer); the header still renders with the Labs flag off.

Part of #4292 (does not close it).

🤖 Generated with Claude Code

mstomar125 and others added 4 commits November 19, 2026 11:10
…4292 C10)

A third chat subtype viewer, registered in corePlugins. It derives the
conversation from the chat's message children (one row per ACP part: text,
thinking, tool call, plan, system notice) and renders the live session state
a supplied source holds in memory: the pending permission request, the turn,
context usage and the session controls. The permission card offers only the
once-only choices and a cancel. Gated by the AI chat Labs flag.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…, cover a bare tool_call part in the viewer

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… the ACP viewer in the pin guard

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s handling, no card for an ended session

Review follow-ups: the card no longer shows the agent-supplied option name
(only NodeSpace's own Allow once / Reject once), a rejected or throwing answer
is shown and can be retried, focus moves to the card when it appears and off it
when it is answered or leaves, no card renders for an ended session, and the
browser tests drive it with real key events and test the answered guard and the
disabled attribute independently.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4292-c10-acp-viewer branch from f30722a to 1920b8d Compare November 19, 2026 10:10
@mstomar125
mstomar125 merged commit 43ef9a8 into main Nov 19, 2026
@mstomar125
mstomar125 deleted the issue-4292-c10-acp-viewer branch November 19, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant