Skip to main content

Module supervisor

Module supervisor 

Source
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§

AutoReply
Reply from an AutoSource call. mode is the effective mode after the adapter acted (so On returns AutoMode::On on success, AutoMode::Off on adapter-side refusal), and changed is true when 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.
MockAutoSource
In-memory AutoSource used by tests and offline paths. Flips the stored mode on On / Off, returns it on Status. changed is computed by comparing the requested action against the current mode, matching the production adapter’s contract.
MockSupervisorSource
In-memory SupervisorSource used by tests and the M2 CLI’s own “no daemon yet” path. Tracks daemon state as a boolean and reports a stubbed socket path on Start / Status so the dispatcher copy has something concrete to print.
SupervisorReply
Reply from a SupervisorSource call. state is the observed state after the adapter acted. socket is the daemon’s Unix socket path when the daemon is running. Production paths are operator-local; tests stub this to any path.

Enums§

AutoMode
Observed Auto-mode state. Mirrors the engine’s two-state switch; no Paused / Transitioning intermediate — the engine either accepts Plan verdicts or it does not.
AutoRequest
A command issued to the engine’s Auto-mode switch.
SupervisorAction
A command issued to the operator-local supervisor daemon.
SupervisorError
Errors an adapter can return.
SupervisorState
Observed daemon lifecycle state.

Traits§

AutoSource
Dispatcher-side handle to the engine’s Auto-mode switch.
SupervisorSource
Dispatcher-side handle to the operator-local supervisor.