Skip to content

feat(chat): Part C — chat panel over the live /acp session - #52

Merged
brettchien merged 1 commit into
mainfrom
feat/chat-part-c-panel
Aug 14, 2026
Merged

feat(chat): Part C — chat panel over the live /acp session#52
brettchien merged 1 commit into
mainfrom
feat/chat-part-c-panel

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Stacked on #48 (feat/chat-part-b-backend) — this PR's base is the Part B branch, so the diff is Part C only. Rebase onto main once #48 squash-merges (see the stacked-slice note).

What

The first visible, end-to-end chat: type a prompt → the agent streams back → rendered as markdown. Consumes the Part B backend (agent_prompt / agent_cancel commands + agent-update events).

Changes (console/)

  • src/chat.ts — transcript view-model + pure render (mirrors render.ts). markdown-it (html:false, linkify) renders a finalized agent turn; spinner + raw text while streaming; user text and panel chrome are escaped. Pure reducers (appendUser / appendChunk / endTurn) keep the render a function of ChatTurn[], unit-testable without a DOM.
  • src/main.ts — turn wiring. Single-shot turn model (katashiro): a prompt typed mid-turn is queued; flushQueue releases the next only when the current turn ends, so two turns never overlap (the backend in-flight guard from feat(chat): Part B(1) backend — session/prompt pipe over the live /acp socket #48 stays a safety net). agent-update (chunk/turn_end) drives the transcript; Stopagent_cancel; per-turn Copy (raw text); a mid-turn socket drop finalizes the open turn so no spinner hangs. Agent markdown is DOMPurify-sanitized at the DOM-write boundary (markdown-it + DOMPurify, per ADR).
  • src/source.tsagentPrompt/agentCancel bridge; the browser build synthesizes a canned reply so the panel is demonstrable without a gateway.
  • index.html + styles.css — the panel (transcript, input, Send/Stop), light/dark.
  • src/chat.test.ts — 14 tests: markdown, raw-HTML / javascript:-link safety, reducers, render.

Verification

  • tsc --noEmit clean, 59 console tests green, vite build OK.
  • End-to-end against a live gateway needs the desktop shell (same limitation as Part B) — not runnable in CI.

Notes

  • Bundle grows ~60 kB (markdown-it + dompurify); the >500 kB chunk warning is pre-existing (codemirror).

The first visible, end-to-end-testable chat: type a prompt, watch the agent
stream back, rendered as markdown. Consumes the Part B backend (agent_prompt /
agent_cancel commands, agent-update events).

- console/src/chat.ts: the transcript view-model + PURE render (mirrors
  render.ts). markdown-it (html:false, linkify) renders a finalized agent turn;
  a spinner + raw text while streaming; user text and chrome are escaped. Pure
  reducers (appendUser / appendChunk / endTurn) keep the render a function of
  ChatTurn[] and unit-testable without a DOM.
- console/src/main.ts: turn wiring. Single-shot turn model (katashiro): a prompt
  typed mid-turn is queued and flushQueue releases the next only when the current
  turn ends — so two turns never overlap and the backend in-flight guard stays a
  safety net. agent-update (chunk/turn_end) drives the transcript; Stop →
  agent_cancel; per-turn Copy (raw text); a mid-turn socket drop finalizes the
  open turn so no spinner hangs. Agent markdown is DOMPurify-sanitized at the
  DOM-write boundary (markdown-it + DOMPurify, ADR).
- source.ts: agentPrompt/agentCancel bridge (agent_prompt/agent_cancel); the
  browser build synthesizes a canned reply so the panel is demonstrable.
- index.html + styles.css: the panel (transcript, input, Send/Stop), light/dark.
- chat.test.ts: 14 tests — markdown, raw-HTML/js-link safety, reducers, render.

Verified: tsc clean, 59 console tests green, vite build OK. End-to-end against a
live gateway needs the desktop shell (as with Part B) — not runnable here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@brettchien
brettchien force-pushed the feat/chat-part-c-panel branch from bcd45b8 to 426610d Compare August 14, 2026 10:35
@brettchien
brettchien changed the base branch from feat/chat-part-b-backend to main August 14, 2026 10:35
@brettchien
brettchien merged commit 441243f into main Aug 14, 2026
2 checks passed
@brettchien
brettchien deleted the feat/chat-part-c-panel branch August 14, 2026 10:35
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