acpmux protocol: type attach, events, detach, view, markUnread, watch and _acpmux/event

Merged
TE
16d ago
+1159-100

Summary

No capture: no visible UI change; the pane only swaps untyped requests for typed ones over generated protocol types.

This is PR2 of the typed acpmux protocol. PR1 was #20576.

New typed methods. The Rust registry now types the session-log methods and their notification. The types live in protocol/events.rs:

MethodParamsResult
_acpmux/attachAttachParamsAttachResult, with SessionDetail (the summary plus modes, config options, models, agent info and capabilities, usage, rules and pending permissions)
_acpmux/eventsEventsParamsEventsResult
_acpmux/detach, _acpmux/markUnreadSessionRefDone
_acpmux/viewViewParamsDone
_acpmux/watchWatchParamsSessionsResult
_acpmux/event (notification)SessionEventn/a

One definition of the event shape. server::event_value now builds its record from SessionEvent, so the wire shape and the schema can't drift apart. The keys are unchanged: sessionId, seq, at, dir, kind, msg.

Paging correction. Since PR1 landed, _acpmux/sessions and _acpmux/watch page with limit and cursor and return nextCursor. SessionsParams and SessionsResult now describe that. PR1 had SessionsParams closed to {}.

Registry completeness. Base now serves _acpmux/harness/update and _acpmux/sessions/restart_harness, so both are registered as untyped requests. The completeness test caught them.

Web client.

  • The pane sends these methods through a typed typed() helper.
  • Its EventRecord derives from the generated SessionEvent. Only msg stays loose, and the cast for it lives in a single records() helper.
  • There are no behavior changes.

Verification

All results are from the Linux builder, at feat-cmux-next 82e0e8c26258 plus this change.

Rust:

  • cargo test -p acpmux --lib protocol: 3 pass. That covers the IR being current, unique names and every served method being named.
  • cargo clippy -p acpmux --all-targets -D warnings is clean.
  • crash_ratchet.py: ok.
  • cargo test -p acpmux --no-fail-fast: every suite passes except 5 harness_health tests. Those fail the same way on an unmodified base checkout on the builder.

Web:

  • Typecheck and lint have no warnings or errors.
  • acpmux-codegen.test.ts: 4 pass.
  • The drift check is current.
  • bun run check fails only at check:browser-lanes. That is a base red that also fails other feat PRs, and this PR does not touch it.

Changelog

none

šŸ¤– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Types the session-log methods _acpmux/attach, _acpmux/events, _acpmux/detach, _acpmux/view, _acpmux/markUnread, _acpmux/watch and the _acpmux/event notification in the acpmux registry (protocol/events.rs), replacing the prior untyped entries. No visible UI change; the pane only swaps untyped requests for typed ones over generated protocol types.

  • AttachResult carries a SessionDetail that flattens the current SessionSummary, keeping the IR current with base's summary fields after the latest merges (including backgroundsWork).
  • server::event_value builds its record from SessionEvent, so the wire shape and the schema share one source.
  • The web client sends these methods through a typed helper, and its EventRecord derives from the generated SessionEvent via one cast, with no behavior changes.
  • The _acpmux/sessions paging correction and the harness/update and sessions/restart_harness registrations landed in base (#21807), so this PR drops its copies.
  • A merge dropped the registry line a local hook added for test_media_auto_tour.py, which base leaves unregistered.