Repository navigation
Closed
Labels
enhancementNew feature or request
Description
What problem does this solve?
A graphical client (desktop, phone, web) needs three things tole serve does not offer today:
- Live events.
POST /sessions/{id}/promptblocks until the turn ends; there is no event stream, so a UI cannot show streamed text, tool cards or approval requests as they happen. - Reading a transcript. There is no route to read a session's entries, so a client that connects late (or reconnects) cannot render history.
- Resuming a session by id.
GET /sessionslists only live sessions andPOST /sessionsonly acceptscwd, so a client cannot reopen an existing session.
docs/mobile-control.md currently says "no new backend exists or is planned"; that has to change for UI clients. This is also what the gateway/scheduler discussion needs (see disc:tole-naik-kelas notes), so it is not UI-only work.
Proposed solution
Additive routes under the existing token-authenticated serve face (no change to existing routes):
GET /sessions/{id}/events?after=<seq>— Server-Sent Events.- Durable frames: entries from the session JSONL, each carrying its
seq. The log is append-only with strictly increasingseq, soafter=<seq>(andLast-Event-ID) gives lossless replay after a reconnect. - Ephemeral frames:
text_delta,reasoning, tool started/finished fromTurnObserver. These are best-effort and not replayable (deltas are not stored; the final answer is an entry). - Approval frames:
approval_requested/approval_resolved, mirroring the existing/approvalsqueue. - Heartbeat comment frames; the stream ends cleanly when the session is closed.
- Durable frames: entries from the session JSONL, each carrying its
GET /sessions/{id}/entries?after=<seq>&limit=<n>— paginated transcript read (JSON).- Resume by id:
POST /sessionsaccepts an existing session id (shape to be agreed in this issue). - Optional, may be split out:
POST /sessionsacceptsmodel/effortat creation. - Wire types as serde structs in one
protocolmodule with a JSON Schema export, so Dart and TypeScript clients can be generated instead of hand-written.
Docs in the same PR (AGENTS.md §7): docs/mobile-control.md, docs/daemon-design.md, README status line, docs/epics.md.
Open questions
- SSE vs WebSocket. SSE is one-way, curl-able and fits the append-only log; browsers'
EventSourcecannot send anAuthorizationheader, so a web client needs a fetch-based stream reader (or a short-lived stream token). Preferred: SSE. - Are lost deltas acceptable on reconnect? Proposal: yes, the final answer entry always arrives; clients show a "resynced" marker.
- Backpressure and a cap on concurrent streams per token.
- Does
after=<seq>on a very large session need an index, givensessions --allreplays every file today?
Alternatives considered
- Polling
GET /sessions/{id}/status(what mobile does now): no streamed text, no history. - ACP as the UI transport: ACP is an editor protocol over stdio; a phone cannot use it.
Acceptance criteria
- Gate: owner approves un-parking the multi-client daemon (see epic).
- Events route replays losslessly from a
seqafter a dropped connection (test). - Transcript read is paginated and matches what
tole resumereplays (test). - Resume-by-id works and respects the per-session jail and busy rules (test).
- No route weakens approval gates: approvals stay owner-token decisions;
Destructivestays unregistrable without an interactive approver. - Docs synced in the same PR.
Part of #523.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
feat(serve): paginated transcript read GET /sessions/{id}/entries (#544)
feat(serve): resume a session by id with POST /sessions {"resume"} (#545
fix(serve): heartbeat clock resets only on a real write; TOLE_SERVE_H…
feat(serve): SSE event stream GET /sessions/{id}/events (#546)