Skip to main content

Module install_presence

Module install_presence 

Source
Expand description

An install’s presence record: one AgentMux install (a channel on a machine) saying it is up, on which platform, and which agents it runs, so the account’s relay can list it to a signed-in phone that is not on the same LAN. Wire contract: agentmux-mobile’s SPEC_FLEET_HOST_TAGS_AND_CLOUD_HOSTS_2026_10_06 §6.1; version 2 adds each agent’s state (agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07 §13.1). The desktop publishes v2; v1 is still built and checked, for the relay’s sake. Version 3 is v2 with an optional top-level gone. The desktop sends it only as the goodbye when it quits, signs out or stops publishing: gone: true and no agent states, which the relay keeps as “offline since” for a short while instead of a live entry. Version 4 is v3 with each agent’s optional line, its Swarm summary line (agentmux’s SPEC_SWARM_OTHER_HOSTS_AND_CHANNELS_2026_10_02 §3.4 Phase 4), signed as a fourth agent field. The desktop publishes v4 when it has lines to share; a goodbye stays v3.

Signed with the install’s WAN instance key (the W3-S identity in crate::jekt_sign), so the record names the key that signed it and instance_id is checkable against it. agentmux-srv’s muxbus::wan_presence builds and publishes it; the relay re-implements the check in TypeScript, and the fixed vector in the tests below is the contract between the two.

Structs§

InstallPresence
The record, in the contract’s field order. Public keys and the signature are standard base64.
PresenceAgent
One agent of the install. kind is host or container (the agent’s block agentMode); state (v2 and later) is one of PRESENCE_STATES, or absent when unknown; line (v4 only) is its summary line, or absent.

Constants§

MAX_CHANNELS_RUNNING
MAX_PRESENCE_AGENTS
Agents in one record; the rest are left out.
MAX_PRESENCE_LINE_BYTES
Most bytes of lines one signed record carries, so a record stays small enough to send on every change; lines past it are dropped.
MAX_PRESENCE_LINE_CHARS
Longest agent line, in characters (agent_line::MAX_LINE_CHARS in srv).
MAX_PRESENCE_NAME_CHARS
Longest hostname, channel and agent name, in characters.
MAX_PRESENCE_VERSION_CHARS
PRESENCE_STATES
The values an agent’s state may take (the LAN feed’s agent_status).
PRESENCE_VERSION
The version the desktop publishes.
PRESENCE_VERSION_GOODBYE
The goodbye: gone: true, no agent state.
PRESENCE_VERSION_LINES
v3 plus each agent’s optional line.
PRESENCE_VERSION_V1
The first version: no agent state.

Functions§

canonical_agents
The agents as a record carries them: sorted by lower-cased name, ties by name; an agent whose name, kind, state or line is out of bounds (a control character, too long, an unknown kind or state) left out; each name once; at most MAX_PRESENCE_AGENTS.