Expand description
Supervisor + Auto-mode dispatch surfaces.
The zero-commands crate does not know how the headless
supervisor or the engine’s Auto-mode flag are actually
implemented; it only needs to know there is a typed seam for
asking for a specific action. The adapters in
crates/zero/src/main.rs (for the engine-facing AutoSource)
and in zero-headless (for the daemon-facing
SupervisorSource) turn those asks into concrete work —
an HTTP call, a launchd/systemd spawn, a Unix-socket probe.
Keeping the traits here (rather than in an adapter crate) means the dispatcher, the tests, and the TUI adapters all agree on the wire shape of the “request” and the “reply” by construction. ADR-006 and M2_PLAN §5 are the source of truth for the verbs.
Structs§
- Auto
Reply - Reply from an
AutoSourcecall.modeis the effective mode after the adapter acted (soOnreturnsAutoMode::Onon success,AutoMode::Offon adapter-side refusal), andchangedistruewhen the call flipped the mode. The dispatcher renders different lines for the two cases so the operator is never left guessing whether the toggle actually did something. - Mock
Auto Source - In-memory
AutoSourceused by tests and offline paths. Flips the stored mode onOn/Off, returns it onStatus.changedis computed by comparing the requested action against the current mode, matching the production adapter’s contract. - Mock
Supervisor Source - In-memory
SupervisorSourceused by tests and the M2 CLI’s own “no daemon yet” path. Tracks daemon state as a boolean and reports a stubbed socket path onStart/Statusso the dispatcher copy has something concrete to print. - Supervisor
Reply - Reply from a
SupervisorSourcecall.stateis the observed state after the adapter acted.socketis the daemon’s Unix socket path when the daemon is running. Production paths are operator-local; tests stub this to any path.
Enums§
- Auto
Mode - Observed Auto-mode state. Mirrors the engine’s two-state
switch; no
Paused/Transitioningintermediate — the engine either accepts Plan verdicts or it does not. - Auto
Request - A command issued to the engine’s Auto-mode switch.
- Supervisor
Action - A command issued to the operator-local supervisor daemon.
- Supervisor
Error - Errors an adapter can return.
- Supervisor
State - Observed daemon lifecycle state.
Traits§
- Auto
Source - Dispatcher-side handle to the engine’s Auto-mode switch.
- Supervisor
Source - Dispatcher-side handle to the operator-local supervisor.