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 for every agent subscribed to the cloud, and one more when delivery resumes, with what was delivered and what expired meanwhile (notes). Each waits for the agent’s next turn and never starts one (reactive::held_notes); a pause that ends before that turn is one note. The notes come from srv itself, 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.
Constants§
- EVENT_
MUXBUS_ STATUS - The WebSocket event carrying a changed
MuxBusDeliveryStatus.
Functions§
- can_
work_ again agentcan work: holds its one note about relay messages left at the relay, if any were. Call after its pull’s own messages are delivered, so the note comes last.- fetched
- One agent’s pull answered:
deliveredmessages reached it and the relay reportedexpired. Holds 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). - has_
left_ at_ relay - Whether relay messages for
agentwere left at the relay and it has not been told. - 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.
- left_
at_ relay - A relay message for
agentwas left at the relay, because the agent can’t work now (out of quota, signed out). Remembered, so it is told once when it can. - 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.- saw_
session - The subscriber found a stored sign-in, or a sign-in just succeeded.
- 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.