Expand description
The viewer routes a paired device calls, served only on the viewer
listener (TLS, backend::lan_listeners), never on the loopback or LAN
routers (agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07
§13.2, §13.3):
POST /agentmux/viewer/pair: a pairing code for a viewer token. The only route without a token.GET /agentmux/viewer/hello,GET /agentmux/viewer/agents,GET /agentmux/viewer/agents/:name/feed,GET /agentmux/viewer/panes,GET /agentmux/viewer/terminals/:block_id/feed(server::http_viewer_terminal),GET /agentmux/viewer/procs, andGET /agentmux/viewer/sysinfoand…/sysinfo/feed(server::http_viewer_sysinfo):Authorization: Bearer amxv_…only. Neither thelan_keynor the instanceauth_keyopens them, and the token opens nothing else: no other router knows it.
Read-only throughout. An agent hidden from paired devices is left out of the list and its feed is 404; agents of other channels on this machine are 404 too for now (they are not in this channel’s registry).
Structs§
- Agent
Probe 🔒 - What a feed asks about its agent while it runs: the block it runs in now, whether it has been hidden from paired devices, its state, and the provider of a block it moves to.
- Feed
Source 🔒 - Where a feed reads its agent’s transcript from.
- Feed
Timing 🔒 - A feed’s clocks.
- Pair
Body 🔒 - Procs
Query 🔒 - Snapshot 🔒
- A snapshot as read: where the feed stands after it, and its lines from
from_line. - Viewer
Caller 🔒 - The paired device a request authenticated as.
Enums§
- CatchUp 🔒
- What
FeedSource::catch_upfound.
Constants§
- FEED_
HEARTBEAT 🔒 - Heartbeat comment on a quiet feed.
- FOLLOW_
POLL 🔒 - How often a feed checks that its agent hasn’t moved to another block, and
reads lines of the agent’s shared transcript that no event of this block
brought (another block, or another srv instance, running the same agent).
The desktop pane polls the shared transcript as often
(
useAgentStream.ts,SHARED_ZONE_POLL_MS). - HEARTBEAT 🔒
- READ_
LIMIT 🔒 - The most lines one bounded read returns (
blockfile:read_range’s cap). - RETRY_
PREAMBLE 🔒 - SETTING_
TOWER_ 🔒SHARE - Settings key: let paired devices see this computer’s processes in their
Tower (
GET /agentmux/viewer/procs). Off unless set. - SNAPSHOT_
TAIL_ 🔒BYTES - SNAPSHOT_
TAIL_ 🔒TURNS - The snapshot: the last 50 turns or 256 KB, whichever is smaller.
- STATUS_
POLL 🔒 - How often a feed looks at its agent’s state. One controller lookup and one block read, so a second is cheap and keeps the device’s chip current.
Functions§
- agent_
hidden 🔒 - Whether the agent in
block_idis hidden from paired devices: its definition (the block’sagentId) hashide_from_devicesset. - append_
event 🔒 - bad_
request 🔒 - build_
viewer_ router - The viewer router: pairing, plus the token-gated read-only routes.
- feed_
stream 🔒 - One feed:
retry, then asnapshot(or, for a reconnect whoseLast-Event-IDstill holds, the lines it missed as oneappend), then anappendper published transcript append,reset+snapshotwhen the transcript is rewritten or the feed loses its place, and a heartbeat on a quiet stream. Astatusfollows eachsnapshotand every change of the agent’s state (feed::status_step). Ends withresetwhen the device falls more than 1 MB behind or the agent is hidden, and silently when the device is revoked (its lease’s token) or goes away. The lease is held until the stream is dropped. - handle_
viewer_ 🔒agents GET /agentmux/viewer/agents: this channel’s agents, hidden ones left out, sorted case-insensitively.- handle_
viewer_ 🔒feed GET /agentmux/viewer/agents/:name/feed: the agent’s transcript as Server-Sent Events (seefeed_stream). 404 for an agent that isn’t this channel’s or is hidden; 503 past the feed caps.- handle_
viewer_ 🔒hello GET /agentmux/viewer/hello: who this is, and which device is asking.- handle_
viewer_ 🔒pair POST /agentmux/viewer/pair:{code, device_name, device_key?}for{token, device_id, hostname, channel, version, install_id?}; 401 for an unknown or expired code, 429 after too many wrong ones.- handle_
viewer_ 🔒panes GET /agentmux/viewer/panes: every pane on this computer, window by window and tab by tab, with each agent’s shell drawer (backend::viewer::panes): names, types, the agent name a feed opens by, and whether a terminal runs. No content, command line or working directory; agents hidden from paired devices, and their shells, are left out.- handle_
viewer_ 🔒procs GET /agentmux/viewer/procs?filter=: this computer’s Tower snapshot for a paired device (SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md §8.3): its tasks and the busiest and largest of its processes, names only, never a command line. 403 unless the user turned sharing on; an agent hidden from paired devices, and its processes, are left out.- not_
found 🔒 - provider_
of 🔒 - The agent’s provider id (
claude,codex, …), ‘’ when unknown. - reset_
event 🔒 - snapshot_
event 🔒 - status_
event 🔒 status{state, since_ms, now_ms};stateandsince_msare null when a state the device was shown has gone (it drops its chip).- viewer_
auth_ 🔒middleware - Admit a request carrying a paired device’s viewer token: its SHA-256 is
compared, in constant time, with every paired device’s. Stamps the
device’s
last_seen_msat most once a minute.
Type Aliases§
- Status
Probe 🔒 - The state of the agent in a block, if it has one.