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,…/history(server::http_viewer_history),…/attachments/:id(server::http_viewer_attachments),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. -
POST /agentmux/viewer/agents/:name/input(server::http_viewer_input): a message to an agent, as the user, from a device the owner allowed to send, signed by the device’s key.
Read-only otherwise. An agent hidden from paired devices is left out of the list and its feed and input are 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, who it is for each snapshot, and what
waits in it (its controller’s
pending_for_devices). - Feed
Source 🔒 - Where a feed reads its agent’s transcript from.
- Feed
Timing 🔒 - A feed’s clocks.
- Pair
Body 🔒 - Procs
Query 🔒 - Shown 🔒
status{state, since_ms, now_ms};stateandsince_msare null when a state the device was shown has gone (it drops its chip). What a feed last told its device about the agent.- 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. A store that can’t answer hides it: a device never sees, or sends to, an agent because a read failed. - append_
event 🔒 - audited_
feed 🔒 lease, with the feed’s Audit rows: opened now, closed when the lease drops.whatnames what it shows (the agent, or a terminal). A computer’s feed open is signed (http_viewer_computers::refuse_unsigned_open); a phone’s carries its token.- bad_
request 🔒 - build_
viewer_ router - The viewer router: pairing, plus the token-gated read-only routes.
- facts_
events 🔒 - The events that tell the device what changed about the agent in
block_id: its state (status,feed::status_step) and what waits in it (pending,pending_step): the request waiting for the user’s answer by id and kind, and how many messages wait to be sent, never their text (§2). - feed_
refused 🔒 - The answer to a feed open that got no lease: 503 past the caps, 403
stopped_by_hostwhen the host’s person stopped this device’s viewing. - 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, and apendingevery change of what waits in it (facts_events). Ends withresetwhen the device falls more than 1 MB behind, or the agent is hidden or, for a computer, its host’s person stops allowing computers (hiddenboth:AgentProbe::for_device), 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, which device is asking, and whether it may send.- 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.- identity_
of 🔒 - Who the agent registered as
nameis, for the top of a device’s pane (docs/specs/SPEC_REMOTE_PANES_WATCH_AND_DRIVE_AN_AGENT_ON_ANOTHER_COMPUTER_2026_11_20.md §2):{name, color?, seat?}, its name as registered, the colour its own pane is drawn in (ui:color), and its seat as the LAN shares it with peers (agent_seat::summarize). Nothing else of its definition. - not_
found 🔒 - pending_
on_ 🔒resume - What waits in the agent, for a feed resumed from its
Last-Event-ID(no snapshot): sent once even when nothing does, since the device may still show a request answered or a message sent while it was away; thenpending_stepsends it only when it changes. - pending_
step 🔒 - Whether to send what waits in the agent now: when it changed since it was last sent, and after a snapshot (which starts the device over) when anything waits. Nothing while nothing has waited yet.
- provider_
of 🔒 - The agent’s provider id (
claude,codex, …), ‘’ when unknown. - reset_
event 🔒 - send_
state 🔒 - Whether a device may send to agents:
allowed(the owner’s grant and a key on file),off(no grant), orpair_again(a grant, but the device paired without a key, so it can’t sign). agentmux-mobile’s SPEC_SEND_FROM_THE_PHONE_2026_10_13 §4. - snapshot_
event 🔒 - The snapshot event;
agentis who the agent is (identity_of), so the first event a device gets says it. - status_
event 🔒 - 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.