Skip to content

docs(adr): chatting with a connected agent — session/prompt over /acp (Part C) - #47

Merged
brettchien merged 7 commits into
mainfrom
docs/adr-agent-chat-panel
Aug 14, 2026
Merged

docs(adr): chatting with a connected agent — session/prompt over /acp (Part C)#47
brettchien merged 7 commits into
mainfrom
docs/adr-agent-chat-panel

Conversation

@brettchien

@brettchien brettchien commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

ADR for review (per Brett: ADR-first, then Jellyfish review). Goal: give OAB Studio a chat panel that reaches parity with katashiro's chat experience, on the same live /acp session Part B already opens.

What this proposes

  • Part A — chat rides the existing session. No second connection; session/prompt ({sessionId, prompt:[{type:"text",text}]}{stopReason}) + streamed session/update/agent_message_chunk + one-way session/cancel. Wire contract copied from katashiro (working client, same gateway).
  • Part B — backend. acp-tunnel: prompt/cancel builders + classify session/update into Inbound::AgentChunk. remote.rs: RemoteState gains an mpsc write-handle, run_once select!s prompt-out against read-in, the Inbound::Other drop site becomes app.emit("agent-update"), prompt responses are id-correlated (pendingReqs), and the handshake resumes a persisted sessionId (falling back to session/new).
  • Part C — the panel. New vanilla-TS console panel/tab; UX parity from katashiro's chat (two-phase render: plain-text streaming → markdown-once-at-finalize; markdown-it+DOMPurify+hljs+copy; stop/retry; batched queue; stick-to-bottom + jump pill; persistent transcript restored before connect; agent_prompt/agent_cancel commands).

Scope

  • ✅ MVP: single bound agent; text single-turn streaming; stop/retry; batched queue; markdown; autoscroll; persistent history + session/resume.
  • ⚠️ Deferred: tool-call & thought session/update kinds; browser-tunnel status strip.
  • 🚫 Not a goal: multi-agent room / @mention / relay / loop-guard; accessibility (single-operator internal tool) — both per Brett, 2026-08-14.

Review asks for Jellyfish

  1. Facade routing (open q docs(adr): Agent Lifecycle State Machine #1) — does the gateway/facade actually route session/prompt to the bound agent (Orca) and stream session/update back? You have the server + key to confirm before Part B lands.
  2. session/update taxonomy (open q feat: studio control-plane — agent-lifecycle + vendored oabctl + MCP (slice-0) #2) — what update kinds does the openab agent emit beyond agent_message_chunk (thoughts, tool_call/tool_call_update)? Shapes the phase-2 card model.
  3. Sanity-check the remote.rs bidirectional refactor (mpsc + select! + id-correlation + resume) against the openab /acp server's actual behaviour — especially whether session/resume is honoured server-side.

Reference: brettchien/katashiro.

🤖 Generated with Claude Code

brettchien and others added 7 commits August 14, 2026 16:27
… (Part C)

Part B made Studio publish its `oab` tools to the agent (reverse MCP); the
remote connection works but the operator still can't talk to the agent —
`session/update` chat frames arrive on the live socket and are dropped.

This ADR proposes the chat panel: additive on the same `/acp` session
(session/prompt + streamed session/update + session/cancel), with a
three-layer design (acp-tunnel builders + typed AgentChunk; remote.rs
mpsc write-handle + tokio::select! + emit agent-update + id-correlated
pendingReqs; console chat panel) and a UX parity target lifted from the
working `brettchien/katashiro` client on the same gateway.

MVP scope: single bound agent, text single-turn streaming, stop/retry,
batched queue, markdown-at-finalize, autoscroll. Multi-agent room,
tool-call cards, history/resume deferred. Open questions flag the facade
routing + session/update taxonomy for server-side confirmation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Multi-agent room / @mention / relay / loop-guard is not a goal (Brett,
2026-08-14). Studio chats exactly one remote.toml-bound agent; the room
machinery is left behind, not deferred. Removes it from parity target,
scope, and open questions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Brett: history + session/resume are needed -> moved from deferred into
MVP scope (persist sessionId in the Rust core, resume-then-new handshake,
transcript restored before connect). Accessibility dropped, but recorded
with the correct rationale (single-operator internal tool, not 'because
it's native' — a11y is a webview concern that would otherwise apply).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… streaming

Jellyfish's live server-side eval (against Orca /acp) established: (1)
session/prompt routes to the bound agent and runs tools, returns
stopReason:end_turn — Part B viable; (2) openab emits ONLY a single
terminal agent_message_chunk (~5.5s silence then one ~329-char chunk),
zero tool_call/thought — so token-streaming and tool-call cards are
upstream-blocked, not Studio slices; (3) the mpsc+select!+pendingReqs
id-correlation refactor is sound.

Rewrites the 'streaming' premise across the ADR: reply rendering is
single-shot behind a think-spinner, keeping an accumulate-then-render
shape as forward-compat if openab later streams; stop = abandon the
turn (no partial in single-shot); §7 splits resolved-by-review from
still-open (session/resume server-side, persistence store, Tauri threat
model). Part B backend skeleton can start (streaming-independent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resume is honoured and preserves agent memory across reconnect
(codeword recall verified). Two implementation requirements folded into
§3: resume params must be {sessionId, cwd, mcpServers} (sessionId-only
fails -32602 missing cwd), and oab mcpServers must be re-declared so the
reverse-MCP tunnel re-attaches on the resumed session (else the agent
keeps memory but loses Studio's oab tools). §7 moves session/resume from
still-open to resolved-by-review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…el re-attach)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nlit impl

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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