Introduce a single command point - the bus - that the HTTP API, the web console,
and any future remote/flare client all go through, mirroring wardenOS's
architecture (flare-edge `sprint`). wardenOS runs this as an MQTT broker over a
Unix socket; per its own porting note the right first step is to implement the
Bus facade (publish_state / read_state / request / emit) over an in-process
broker with the registry as the contract, swappable for a socket broker later
without touching callers. alkane-os is std-only and headless, so that is what
this does - no tokio, no MQTT.
- bus.rs: the in-process hub. Retained `state` topics (reads), `req`/`reply`
verbs dispatched to one owning handler (the single write path), and a bounded
`evt` ring. BusError carries warden-style E_* codes.
- registry.rs: the contract - every topic and verb as typed constants plus a
machine-readable description. A test asserts the live bus matches it, the
property busgen gives warden, so the contract cannot drift from the code.
- service.rs: the miner service owns the control/settings/dashboard verbs and
publishes the hardware/summary/control state. Like a warden service it
republishes the affected state the instant a command applies, so a reader
never sees a command lag the periodic telemetry publish (the bus is held Weak
to avoid an Arc cycle).
- web.rs is now a thin HTTP->bus translator (WebContext{bus, csrf}): writes are
bus.request, miner-state reads are bus.read_state, the legacy hand-rendered
page arms are gone (the console renders every nav tab). console.rs reads the
state docs and the csrf is passed in. app::start/main.rs build the bus, register
the service, and publish each control period.
Verified on --serve-sim: stop -> switch to ambient:18000 -> start now each
reflect immediately in /api/control, live frequency tracks the target, and a
stale CSRF is rejected. 193 lib tests pass (incl. bus/registry/service), full
suite green, clippy -D warnings clean, no emojis.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk