feat(chat): Part C — chat panel over the live /acp session - #52
Merged
Conversation
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
force-pushed
the
feat/chat-part-c-panel
branch
from
August 14, 2026 10:35
bcd45b8 to
426610d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ontomainonce #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_cancelcommands +agent-updateevents).Changes (
console/)src/chat.ts— transcript view-model + pure render (mirrorsrender.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 ofChatTurn[], unit-testable without a DOM.src/main.ts— turn wiring. Single-shot turn model (katashiro): a prompt typed mid-turn is queued;flushQueuereleases 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; 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, per ADR).src/source.ts—agentPrompt/agentCancelbridge; 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 --noEmitclean, 59 console tests green,vite buildOK.Notes