Expand description
Whether cloud (MuxBus) messages are reaching this channel’s agents, made visible: a sign-in that stops working, or a relay that can’t be reached, used to leave nothing but a log line while agents silently stopped getting review, CI and cross-machine messages.
State (muxbus.status’s delivery, and the muxbus:status event on
every change) is derived in machine::derive from two things only: what
the cloud subscriber’s loop last reported (set_link, saw_session)
and the credential broker’s state for the sign-in. It never reads the
credential store itself.
What follows from it (machine::Effect):
- one OS notification when a needs-sign-in episode starts (the notify
Router’s
CloudSignedOutkind), taken down when it ends; - after
machine::PAUSE_NOTICE_MSpaused, one AgentMux system note to every agent subscribed to the cloud, and one more when delivery resumes, with what was delivered and what expired meanwhile (notes). The notes are delivered locally by srv, never through the relay; seenotes::NOTE_MARKERfor why one can’t be forged.
Re-exports§
pub use machine::Link;
Modules§
- machine 🔒
- The pure half of
super: what state cloud delivery is in, given what the cloud subscriber and the credential broker last said, and what to do when it changes. No clock, no I/O; every call takesnow_ms. - notes
- The AgentMux system notes agents get about cloud delivery, and the
per-agent bookkeeping behind the resume note. Pure: times come in as
unix ms, and
hhmmis the one place they become wall-clock text.
Structs§
Constants§
- EVENT_
MUXBUS_ STATUS - The WebSocket event carrying a changed
MuxBusDeliveryStatus. - TICK 🔒
- How often the state is re-derived (the broker can move on its own) and the time-based notes are checked.
Statics§
- RUNTIME 🔒
- SIGN_
IN_ 🔒NOTICE_ OWED - The episode’s notification is owed but had no router to go to (no window
had connected yet);
run_ticksends it once one exists.
Functions§
- apply 🔒
- broker_
state 🔒 - deliver 🔒
- deliver_
one 🔒 - Deliver
note(itsattempt-th try); a failure is retried on later ticks. - fetched
- One agent’s pull answered:
deliveredmessages reached it and the relay reportedexpired. Sends its resume or expiry note, if it has one; call after the pull’s own messages are delivered, so the note comes last. - fresh_
sign_ in - The user just signed in (
muxbus.login). - install
- Where status changes and the notification go. Call once at startup; starts the tick. Before this, state is still tracked but nothing is sent.
- pull_
failed agent’s pull (fetch or claim) got no usable answer from the relay, though the WebSocket may be open: its messages aren’t arriving.- router 🔒
- rt 🔒
- run_
tick 🔒 - saw_
session - The subscriber found a stored sign-in, or a sign-in just succeeded.
- send_
owed_ 🔒sign_ in_ notice - set_
link - What the subscriber’s loop is doing now.
- signed_
out - The user signed out (
muxbus.disconnect). - status
- The current state, for
muxbus.status. - subscribed_
agents 🔒