Skip to content

feat(studio): protocol seam — structural decoders for the daemon wire - #969

Closed
jtenniswood wants to merge 1 commit into
studio/S03from
studio/S04
Closed

feat(studio): protocol seam — structural decoders for the daemon wire#969
jtenniswood wants to merge 1 commit into
studio/S03from
studio/S04

Conversation

@jtenniswood

Copy link
Copy Markdown

Stack 4/21 — Studio: the protocol seam

src/lib/protocol/ — the ONE typed reader of raw daemon JSON, landed whole and final with its full decoder test suite. No UI in this PR; it trades a demo step for keeping the Chats PR reviewable.

  • events.ts — SSE event translation: failed turns always surface (stop/error/permanent), approvals are three-way, retractions withdraw their ask, delegation becomes badges, watch envelopes (ADR 0250) with run-id stamping (ADR 0249), steer echo + media parts (ADR 0251/0252), and unknown event kinds render as visible notices, never silent drops.
  • sessions.ts — capability-driven session decoding (the complete-walk rule), the debug-session exception (ADR 0254), the permission-mode codec.
  • schedules.ts — schedule decode/encode incl. the carried-spec round-trip and the wire's sharp edge: protojson requests, stdlib-JSON responses (never echo a response body back as a request).
  • internal.ts / index.ts — the two-dialect helpers and the public surface.
  • Carried here so the seam compiles: features/agent/types.ts (the StreamEvent union, final — landed once rather than regrown per feature PR; features/** is knip-ignored by config) and lib/file-meta.ts (+test).

Pure decoders + types: no runtime behavior change, no server/proxy edits. ~46 vitest cases land with their modules (each suite is its file's knip entry).

Part of the stacked landing of #618.

🤖 Generated with Claude Code

src/lib/protocol is the ONE typed reader of raw daemon JSON. events.ts
translates the SSE stream: failed turns always surface (stop/error/
permanent), approvals are three-way, retractions withdraw their ask,
delegation becomes badges, watch envelopes (ADR 0250) carry run-id stamping
(ADR 0249), steer echo and media parts per ADR 0251/0252, and unknown event
kinds render as visible notices, never silent drops. sessions.ts decodes the
inventory capability-first (the complete-walk rule) with the debug-session
exception (ADR 0254) and the permission-mode codec. schedules.ts encodes the
protojson-request / stdlib-JSON-response asymmetry and the carried-spec
round-trip. internal.ts holds the two-dialect helpers.

Carried so the seam compiles: features/agent/types.ts (the StreamEvent
union, final) and lib/file-meta.ts. The barrel and a few exports whose first
consumers land with later PRs in the series stay unexported/deferred until
then (knip-honest staging).

~46 decoder tests land with their modules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jtenniswood jtenniswood added enhancement New feature or request WebUI Applies to the WebUI interface labels Sep 2, 2026
@jhrozek jhrozek closed this Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request WebUI Applies to the WebUI interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants