Skip to main content

Module http_viewer_terminal

Module http_viewer_terminal 

Source
Expand description

GET /agentmux/viewer/terminals/:block_id/feed: one terminal’s output, live and read-only, for a paired device (agentmux-mobile/docs/reports/REPORT_PANE_LIST_TERMINALS_AND_FROZEN_FEED_2026_10_12.md §2.4, §2.5 phase B). Served beside the other viewer routes, on the viewer listener only, for the viewer token only.

Off unless the user turns on “Share terminals with paired devices” (viewer:shareterminals): a terminal’s scrollback routinely holds secrets, and terminals have no per-pane hide flag. The shell drawer of an agent hidden from paired devices is hidden with it. Nothing is ever sent to the terminal: no input, no resize. The device renders at the size the desktop gave the PTY (size events).

Wire (SSE): snapshot { offset, next_offset, data64, cols?, rows? }, the last 256 KB of the terminal’s output from a line start; append { offset, data64 } per write; size { cols, rows } when the PTY is resized; reset { reason } before a fresh snapshot, or before the stream ends (behind, hidden, not_shared); : hb every 15 s. Ids are the byte offset after the event; a reconnect whose Last-Event-ID is still within 256 KB of the end (a snapshot’s worth) gets the bytes it missed as one append.

Structs§

TermProbe 🔒
What a terminal feed asks while it runs: the PTY’s size, and whether it may still be watched (Some(reason) ends the stream).
TermSnapshot 🔒
A snapshot as read: its bytes start at offset; the file ends at next.
TermSource 🔒
Where a terminal feed reads the terminal’s output from: its term file.
TermTiming 🔒
A terminal feed’s clocks.

Enums§

Unwatchable 🔒
Why a block’s terminal can’t be watched.

Constants§

SETTING_SHARE_TERMINALS 🔒
Settings key: let paired devices watch this computer’s terminals. Off unless set.

Functions§

append_event 🔒
b64 🔒
handle_viewer_terminal_feed 🔒
refused 🔒
reset_event 🔒
size_event 🔒
snapshot_event 🔒
terminal_stream 🔒
One terminal feed: retry, a snapshot (or, for a reconnect that still holds, the bytes it missed as one append), then an append per write, size on a resize, reset + snapshot when the file is truncated or the feed loses its place, and a heartbeat on a quiet stream. Ends with reset when the device falls more than 1 MB behind or the terminal may no longer be watched, and silently when the device is revoked or goes away.
terminal_watchable 🔒
Whether block_id is a terminal a paired device may watch (sharing aside).
terminals_shared 🔒
Whether the user lets paired devices watch terminals.