Expand description
Reactive messaging system for agent-to-agent terminal communication. Port of Go’s pkg/reactive/.
Provides message injection into terminal panes, agent registration, rate limiting, message sanitization, audit logging, and cross-host polling via AgentMux Cloud service.
Re-exports§
pub use handler::get_global_handler;pub use handler::Handler;pub use handler::ReactiveHandler;pub use poller::Poller;pub use sanitize::broadcast_turn_message;pub use sanitize::device_turn_message;pub use sanitize::format_injected_message;pub use sanitize::sanitize_message;pub use sanitize::validate_agent_id;pub use sanitize::validate_muxbus_url;pub use types::*;
Modules§
- action_
audit - The audit line for a recorded RPC call (
backend::rpc::action_record): kept like the jekt lines, in the ring behindGET /agentmux/reactive/auditand in the audit file.event_kindisaction;outcomeis the command;source_agentis the actor (agent:<id>,operatororunproven);target_agentandblock_idare what it acted on;reasonnames the identifier it acted on;successanderror_messagesay how it went. - activity_
watcher - Empty-title recovery: a running agent with conversation and no usable
session title gets one, written straight to its block’s
term:ambient_summary, which the pane header and the Swarm row read. - audit_
store - The durable copy of the jekt audit trail. The handler keeps the last
AUDIT_LOG_MAXentries in memory forGET /agentmux/reactive/audit, and loses them at every restart. Every entry is also appended here, as one JSON line, to a file that is never rotated or truncated: AgentMux keeps agent history, and the record of what agents did, forever. - cli_
native_ audit - Audit lines for messages agents send each other through the CLI’s own
messaging (
backend::cli_native), kept like the jekt lines: in the ring behindGET /agentmux/reactive/auditand, for good, in the audit file. As with jekts, a line holds the text’s hash and length, not the text. - controller_
wait - An agent whose pane is open but whose controller is not there yet.
- handler
- held_
notes - srv’s informational
[AgentMux]notes wait for the agent’s next turn instead of starting one. A note sent as input is a turn of its own: when MuxBus and the model API went down together, every agent spent minutes retrying a turn for a note that asked nothing of it, and the user’s own messages queued behind those turns. - held_
request - A held jekt row turned back into the request it was accepted as, for the replay (
server/jekt_held.rs, which re-exports it). It reads only the row and the ack policy, so the reactive tests reach it from the core. - poller
- post_
secrets - What a text posted for others to read (a bulletin or a channel post) must not hold besides credential words
(
sanitize::post_refusal_reason): a value AgentMux knows to be a secret, and a credential word beside a value. The refusals name the rule, never the text that matched. - progress_
watcher - Pushed per-agent progress: the agent’s current todo checklist and the
tool it is running right now, published as an
agent:progressMuxEvent so the Swarm pane can list them under the agent’s name. - rate_
limiter - The jekt handler’s rate limiter: at most
max_tokensdeliveries a second. - registry
- File-based cross-instance agent registry.
- sanitize
- sender
- Whether a jekt’s sender name can be shown as an agent’s.
- sensitive_
audit - The typed audit fields of a sensitive-op decision
(
REPORT_AGENTS_AND_OS_PROMPTS_2026_11_07.md§4.6): the dialog’s text, the exact answer, its risk level, and whether a remembered grant allowed it rather than a fresh countdown. Split out ofhandler.rs(over the file-size baseline) the same wayaction_audit.rsandcli_native_audit.rsalready are: its own file, built onHandler’s fields the way those are. - sent_
audit - The sender’s half of a message’s trail: the
sentline written where a message is handed to this srv. The receiving srv writes the line it writes today under the same message id (msg_id), andaudit.queryjoins the two into one row. A message another srv handed over (a peer, another channel, the cloud) has nosentline here: its sender wrote it. - system_
turn - A turn started by AgentMux itself (a note that asks the agent for something, such as its status
after a sign-in), by the same sender a message takes. Split out of
handler.rs(over the file-size baseline) the waysensitive_audit.rsis. - transcript_
request transcript_request/transcript_responsewire payload —muxspectPhase B/C’s LAN/WAN conversation-visibility protocol (docs/specs/SPEC_MUXSPECT_CROSS_TIER_CONVERSATION_VISIBILITY_2026_08_21.md, jekt tier rules confirmed in docs/specs/SPEC_JEKT_TRANSCRIPT_REQUEST_TIER_RULES_2026_08_22.md).- turn_
audit - What a message did to the agent’s turns, for the audit (
SPEC_CHEAPER_FLEET_MESSAGING_2026_10_30.md§7). - types
Constants§
- DEFAULT_
POLL_ INTERVAL_ SECS - Default poll interval for AgentMux poller (seconds).
- MAX_
MESSAGE_ LENGTH - Maximum message length in bytes.
- TRUNCATION_
SUFFIX - Suffix appended when a message is truncated.
- UNAVAILABLE_
PREFIX - How a refusal to deliver to an agent that can’t work now begins: its
account is out of quota or signed out (
SPEC_UNRESPONSIVE_AGENTS_2026_10_23.md§5). Only where the message can’t be held: a LAN or cross-channel hop, a cron fire, a Swarm broadcast.
Functions§
- held_
input_ wake - Woken whenever an agent registers, so the input held for an agent that was stopped goes out as soon
as it starts (
server/held_input.rs). Its own, as aNotifyhands one wake to one waiter. - held_
jekt_ wake - Woken whenever an agent registers, so jekts held for an absent agent are
replayed promptly (
SPEC_DURABLE_JEKT_DELIVERY_2026_09_24.md§2.3).notify_onedoes no I/O, so it is safe under the handler lock. - is_
spawn_ gate_ refusal - Whether a delivery error is the target’s spawn gate refusing to start it
(
run_agent_turn’s “identity spawn gate: …”): not signed in. Recoverable once the receiver signs in (SPEC_JEKT_DELIVERY_STATES_AND_MAILBOX_2026_10_01.md Phase 0 item 4, G4). - is_
transient_ delivery_ error - Whether a delivery error is worth retrying shortly, as is: the target is
still absent, rate-limited, its queue is full, it is starting,
restarting or stopping (“… try again shortly”), or its pane is open and
its controller is not there yet (
controller_wait). Shared by the held-jekt replay and the cron scheduler’s pending fires, which must agree. - is_
unavailable_ refusal - Whether a delivery error is
UNAVAILABLE_PREFIX’s refusal: recoverable at the reset, confirmed sign-in or an account move. - registered
- An agent just registered in
block_id: replay what was held for it, wake the relay subscription to take its names, and after an upgrade tell a resumed agent once, whatever runs it (SPEC_UPGRADE_FOR_USERS_AND_AGENTS_2026_10_15.md§5.2). No I/O here: safe under the handler lock (the note is sent from a task of its own).