Skip to main content

Module mps

Module mps 

Source
Expand description

AgentMux Pub/Sub system: event brokering with scoped subscriptions. Port of Go’s pkg/wps/wps.go + wpstypes.go (Wave Terminal’s original names).

The Broker supports:

  • All-scope subscriptions (receive all events of a type)
  • Exact-scope subscriptions (e.g., “block:uuid”)
  • Star-scope subscriptions (e.g., “block:*”)
  • Event persistence (history/replay)

Structs§

Broker
The central pub/sub broker for MuxEvents.
MuxEvent
One event on the broker. The envelope is typed; data is each event’s own payload, still untyped (any) on the frontend: srv builds most payloads with json!, so there is no Rust type per event to generate yet.
StreamPos
One transcript stream’s position for an append: the records it wrote are lines line .. lines of generation gen of stream.
SubscriptionRequest
WSFileEventData

Constants§

EVENT_AGENT_API_RETRY
A Claude CLI request is being retried, or no longer is (backend::agent_api_retry). Payload: { "retry": {…} | null }. Not persisted: it carries time remaining as of sending.
EVENT_AGENT_CONTEXT_USAGE
Where an agent process will auto-compact, as its CLI reports it. See agent_context_usage.rs.
EVENT_AGENT_FAILURE
Fired when an agent subprocess exits non-zero (or reports an error on its terminal result frame). Carries the classified AgentFailure so the pane shows the real cause instead of a bare exit code.
EVENT_AGENT_MESSAGE_ACCEPTED
Fired by SubprocessController::spawn_turn when a user message is picked up (either direct-spawn or queue drain). Frontend uses this to promote pending PendingMessage entries into the conversation document. Payload: { block_id, message_id }.
EVENT_AGENT_MESSAGE_QUEUED
Fired when a message reaches srv while the agent’s process is still alive (a turn running, or only a command the model sent to the background), so the message waits for that process to end. Lets the pane say so, and how many messages are ahead, instead of “reaching the agent any moment”. Payload: { block_id, message_id, ahead }.
EVENT_AGENT_RESUME_RETRY
Fired by the persistent controller’s stale---resume recovery path (retry_after_resume_failure / publish_resume_retry_status, docs/status/STATUS_STALE_RESUME_LIVE_REPRO_AND_FIX_PLAN_2026_08_23.md §6.2) so the pane can show a “Reconnecting…” readout instead of going silent for the ~seconds-to-tens-of-seconds it can take the controller to detect a stale registry session_id and respawn against a recovered one. Payload: { "status": "retrying", "startedAt": "<rfc3339>" } or { "status": "resolved" }. persist: 2 (unlike compaction_started’s persist: 0) is deliberate: both ends of this signal travel over this same MPS channel (there’s no separate out-of-band completion marker the way compact_boundary is for compaction), so replaying the latest retrying→resolved pair to a freshly (re)subscribed pane is always the correct current state, not a stale echo — see publish_resume_retry_status’s own doc comment for why 2, not 1.
EVENT_AGENT_RUNTIME
What an agent process was actually spawned with. See agent_runtime.rs.
EVENT_AGENT_TURN
The agent’s turn as the user sees it, over however many CLI passes. See blockcontroller::health::TurnLedger.
EVENT_ATTACHMENT_BATCH_DONE
EVENT_ATTACHMENT_FAILED
EVENT_ATTACHMENT_PROGRESS
Image attachment processing (SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.5). Scoped block:<id> of the pane that started the batch. Payloads are AttachmentProgressEvent / AttachmentReadyEvent / AttachmentFailedEvent / AttachmentBatchDoneEvent in rpc_types::attachments.
EVENT_ATTACHMENT_READY
EVENT_BLOCK_ACTIVITY
Fired by the agent-pane PTY read loop when an OSC 0/2 window-title sequence from Claude Code is extracted. Carries the normalised conversation-topic string so the frontend can surface it as a term:osc_title tab label. Payload: { "blockId": "...", "activity": "auth refactor" }.
EVENT_BLOCK_CLOSE
EVENT_BLOCK_FILE
EVENT_BLOCK_STATS
EVENT_BROWSER_PAUSE_ALL
“Pause all agent browsing” was turned on or off, by the person or an agent: { paused, since_ms, by }.
EVENT_BTW_ANSWER_CHUNK
Fired by the /btw slash command’s one-shot side-question turn (server/agent_handlers/side_question.rs, AskSideQuestionCommand) — one event per AgentEvent translated from the throwaway turn’s stream-json output (same ClaudeTranslator the drone Agent block runner uses, agents/translator/claude.rs), plus a final event with "done": true when the turn completes (successfully, with an error, or via a timeout/no-response fallback).
EVENT_CHECKS_FLOW
The checks of a PR’s head commit (pr_flow): ids, a state and times only, never a log. Not scoped. Payload: ChecksFlowEvent.
EVENT_CONFIG
EVENT_CONN_CHANGE
EVENT_CONTAINER_RUNTIME
The container runtime appeared, went away or changed (container_status). Not scoped. Payload: ContainerRuntimeStatus.
EVENT_CONTAINER_STATUS
One of this machine’s agent containers changed (container_status). Not scoped. Payload: ContainerStatus.
EVENT_CONTROLLER_STATUS
EVENT_CRON_CHANGED
Fired whenever a cron job is created, fires, is paused/resumed, or deleted (SPEC_SWARM_LONG_RUNNING_PROCESS_ROWS_2026_07_20 Phase 2). Payload-free, unscoped — the Swarm pane just reloads the full list via cron.ListActive on receipt, the same “any event of this type ⇒ refetch” pattern shell_node_create/shell_chunk(op:"exit") already use.
EVENT_DOCK_CLEAR
Fired by handle_muxspect_dock_clear when a muxspect dock clear request is served. Scoped block:<id>, same convention as shell_node_create — only a renderer currently displaying that block receives it. Payload: { node_id }. The receiving renderer flips that one ToolNode to status: "canceled" via the ForceCancelToolNode document-reducer command; a renderer without that node (already resolved, or a different pane’s block) no-ops. See docs/specs/SPEC_MUXSPECT_DOCK_DIAGNOSIS_AND_REMEDIATION_2026_08_06.md §3.2.
EVENT_FOLDER_OVERLAP_ASKS
The asks agents made for the person’s go-ahead with a host agent that shares a folder with a container agent: { asks } (backend/folder_overlap_asks.rs).
EVENT_INSTALL_PROGRESS
EVENT_MERGE_FLOW
A PR reached its end (pr_flow): ids, a state and times only. Not scoped. Payload: MergeFlowEvent.
EVENT_MESSAGE_FLOW
One message between two agents was handled by this srv: ids and times only, never its text (message_flow). Not scoped: any window may subscribe. Payload: MessageFlowEvent.
EVENT_MUX_OBJ_UPDATE
EVENT_PIN_ASKS
The asks agents made to move or forget a pin, waiting for the person: { asks } (backend/pin_asks.rs).
EVENT_RECORD_FLAGS
What the rules that read the record have flagged and still say (record_notice): stalls in an hour, a size that keeps growing. Persisted (1), so a window that opens later gets it; an empty list clears it.
EVENT_REMOTES_CHANGE
The Connectors → Remotes list changed in a way connchange doesn’t cover: a remote’s settings, or a recent one forgotten (SPEC_REMOTES_PANE_2026_10_05.md §4.6).
EVENT_REVIEW_FLOW
A review of a PR for the agent it belongs to (pr_flow): ids, a state and times only, never the review’s text. Not scoped. Payload: ReviewFlowEvent.
EVENT_ROUTE_GONE
EVENT_SHELL_CHUNK
Fired per stdout/stderr line and on process exit by ShellNodeRunner. op: "chunk" carries { shell_id, kind, content, timestamp }; op: "exit" carries { shell_id, exit_code, timestamp }.
EVENT_SHELL_NODE_CREATE
Fired by handle_shell_create when a persistent shell is launched. Frontend creates the ShellNode row on receipt. Payload: { shell_id, cmd, cwd?, title, timestamp }.
EVENT_SRV_PANICS
srv’s own panics, counted (panic_watch): warn above 20 in a minute, critical above 200. Persisted (1), so a window that opens mid-storm gets it.
EVENT_SUBAGENT_BACKFILL_STATUS
Fired by SubagentWatcher::scan_session_subagents (the pane-reopen cold-backfill entry point, subagent_watcher/scan.rs) so a pane can show its BrainSpinner overlay (block.tsx’s ready() gate) until its own subagent/dispatch history has actually finished backfilling, instead of exposing the Activity Dock’s genuinely-changing intermediate states — see docs/retro/retro-activity-dock-flicker-survives-debounce-fix-2026-08-24.md §5 option 1/2. Payload: { "status": "started" | "done" }. persist: 2, same rationale as EVENT_AGENT_RESUME_RETRY above — both ends travel over this one channel, so a mount-time EventReadHistoryCommand read (guarding the same “pane subscribed after the backend already finished” race that event’s own hook already handles) always recovers the correct current status rather than a stale one.
EVENT_SYS_INFO
EVENT_TASK_FLOW
A task was filed, reassigned, started or handed back (task_flow): names, ids and times only, never its text. Not scoped. Payload: TaskFlowEvent.
EVENT_USER_ATTENTION
A call to action srv holds open started or ended: { key, block_id, kind, text, window_ids, active } (backend/user_attention.rs).
EVENT_USER_INPUT
EVENT_VAULT
The Vault changed, or its agents’ requests did: { requests, changed_ms }, never an entry or a value.
EVENT_WIDGET_PACKAGES
The widget packages changed: installed, approved, edited, removed (SPEC_USER_WIDGETS_AND_WIDGET_API_2026_10_09.md §8). Payload { packages }.
EVENT_WIDGET_REQUESTS
Agents’ widget install requests waiting for the user: { requests }.
EVENT_WIDGET_STORAGE
A widget package’s storage changed: { id, keys }, never the values.
FILE_OP_APPEND
FILE_OP_CREATE
FILE_OP_DELETE
FILE_OP_INVALIDATE
FILE_OP_REPLACE
A transcript output replaced by other content (restore): pos names the new generation and its line count (Phase 5a-3).
FILE_OP_TRUNCATE

Traits§

WpsClient
Trait for event delivery to connected clients.

Functions§

publish_block_activity
Publish a Claude Code OSC window-title activity string to the frontend for a given agent-pane block. Frontend subscribes to block:activity events scoped to block:{block_id} and writes the payload to term:osc_title block metadata, which the tab label reads.
publish_install_progress
Publish a single install-progress line to the frontend for a given block. The frontend subscribes to install_progress events scoped to block:{block_id} and displays each message as a log line in the agent presentation view.

Type Aliases§

BrokerObserver
See Broker::add_observer.