Expand description
Phase B.2 IPC wire protocol — shared between agentmux-launcher (server) and agentmux-cef (client). One source of truth so the Command / Event shapes can’t drift between binaries on a version-skew release.
See specs/SPEC_WINDOW_PROCESS_STATE_MACHINE_2026_04_27.md §5.
Wire format: newline-delimited JSON. One message per line,
parsed via serde_json. Format chosen for debuggability —
operators can cat / nc the named pipe and read traffic
without a binary protocol decoder.
Backward compat policy (B.2 baseline; harden in Phase D):
- Externally tagged enums (
{"cmd":"register",...}) so adding variants is non-breaking; clients send what they know. - Unknown commands → server replies
Event::Errorrather than crashing. version: u64on every Event lets Phase D’s GetSnapshot / resync detect skew. For B.2 it’s set but not enforced.
Structs§
- Rect
- Phase B.9.1 — rectangle in Win32 screen coordinates (pixels).
Matches Windows’
RECTsemantics:rightandbottomare one past the last included pixel, soright - left == width. - Window
Snapshot - Phase D.1 — serializable view of one window in the launcher
reducer’s canonical state. Maps 1:1 to the launcher’s internal
WindowMirrorminusopened_at(which is launcher-local clock data not meaningful to subscribers).
Enums§
- Client
Kind - Stable identifier for a connected client. Tagged so the launcher can route replies + log who said what.
- Command
- Commands flow client → launcher.
- Drift
Kind - Phase B.4 follow-up — which mirror diverged. Tagged so subscribers can route alerts (windows-drift might page; pool-drift is more ephemeral since the pool turns over fast).
- Error
Code - Discriminant for
Event::Error— keeps clients structured against failure modes without parsing message text. - Event
- Events flow launcher → client. Versioned per spec §5.2 — every
event carries a monotonic
version: u64per launcher run, used by Phase D’s resync protocol. - Host
Frame - Phase CPD-1 (cross-process dispatch) — envelope enum for frames
sent over the launcher → host pipe direction. Today the host’s
read loop only expects
EventJSON; CPD-2 extends the read loop to recognize this tagged union and dispatch bykind: - Hwnd
Drift Kind - Phase B.9.1 — six classes of CEF↔Win32 disagreement the reducer can detect at event-dispatch time. See the WRR design doc for the per-kind triggering Command and reducer action.
- Lifecycle
Phase - Coarse-grained launcher state. Spec §4: Starting → Running → Quitting → Dead, no other transitions allowed. The reducer in agentmux-launcher::reducer enforces this; a violation panics (Job Object reaps via OS).
- Severity
- Phase B.9.1 — drift severity. Operator-tunable severity floor
in
WrrConfig.severity_floorcontrols which events get broadcast (ones below the floor are still logged at DEBUG so they show up in--diag wrrpost-mortem). - Window
Kind - Wire-side enum for
WindowKind. Mirrorsagentmux-cef::state::WindowKind— kept here so the launcher can deserialize without depending on the host crate. The host serializes its own type viaserde(rename_all = "snake_case")so the JSON shape matches exactly.