Skip to main content

Module fleet_feed

Module fleet_feed 

Source
Expand description

The names-only fleet feed LAN peers read: GET /agentmux/fleet and its Server-Sent Events stream GET /agentmux/fleet/events (docs/specs/SPEC_LAN_FLEET_FEED_2026_10_03.md §2, which links the mobile spec that owns the wire contract).

One task compares this instance’s reachable agent names once a second and publishes (rev, names) through a watch, so the snapshot route and every stream read the same value and no stream can fall behind: a slow reader skips straight to the latest state. Agent names only, the same line handle_reactive_agent_names holds for a lan_key holder, plus (owner decision 2026-10-06, agentmux-mobile’s SPEC_FLEET_HOST_TAGS_AND_CLOUD_HOSTS_2026_10_06 §5.1) where each agent runs (agent_kinds), how many channels this machine runs, its platform and this install’s id; and (owner decision D1, 2026-10-07, agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07 §3.2, §13.1) each agent’s state and since when (agent_status, backend::agent_state), with this machine’s clock (now_ms); and, while it is up, the viewer listener’s port (same spec §13.2), which opens nothing by itself; and (owner decision 2026-10-13) each agent’s summary line (agent_lines, backend::agent_line), absent while swarm:sharesummaries is off. The cloud presence publisher (muxbus::wan_presence) reads the same snapshot.

Structs§

FleetBody 🔒
The /agentmux/fleet body, in the contract’s field order.
FleetFeed
FleetObservation
What one look at the instance found: each reachable agent with its kind, None when its block couldn’t be read, the channel count, and the state of each agent that has one, by name.
FleetSnapshot
One state of the fleet. rev starts at 1 and goes up by one on every change of any field below; agents is sorted case-insensitively and de-duplicated; agent_kinds and agent_status have an entry for each of agents whose kind or state is known.
StreamSlot 🔒
A held stream slot; releases it on drop.

Constants§

CHANGE_POLL_INTERVAL
How often the name set is compared.
HEARTBEAT 🔒
HEARTBEAT_INTERVAL
Comment line sent on an idle stream, so a client can tell a dead TCP connection (30 s of silence, spec §6) from a quiet fleet.
MAX_STREAMS
Concurrent event streams per srv; beyond this a request gets 503, so a LAN peer holding the lan_key cannot exhaust the srv.
RETRY_PREAMBLE 🔒
The stream’s first write: how long an SSE client waits before reconnecting.

Functions§

normalize_agents 🔒
Sort case-insensitively and drop names that differ only by case (registration keys are lower-cased, so those are one agent). Ties break on the exact string so the result does not depend on input order. Each surviving name keeps its own kind.

Type Aliases§

AgentKind
An agent’s kind as the feed reports it: "host" or "container" (operator_config_seed::agent_kind).