Skip to main content

Module terminal

Module terminal 

Source
Expand description

The pure pieces of a paired device’s terminal feed (GET /agentmux/viewer/terminals/:block_id/feed, the route in server::http_viewer_terminal): where a snapshot of a terminal’s output starts, and how each published append moves the feed’s byte cursor.

A terminal’s output is the block’s term file: the PTY’s raw bytes, ANSI escapes and all, appended in order. Each append is published with the byte offset it is written at, before it is written, so a feed that subscribes, then reads the file’s size, can place every later event: an event that ends at or before the cursor was in the snapshot, one that starts past it means bytes were missed.

Enums§

TermStep
What to do with one published append.

Constants§

LINE_START_WINDOW 🔒
How far into a tail a snapshot looks for a line start.
SNAPSHOT_TAIL_BYTES
How much of a terminal’s output a snapshot holds, at most.

Functions§

apply_term_append
Apply one published append, written at offset, to a cursor at next.
tail_start
Where a snapshot of data, read from byte offset of the file, starts: right after its first newline when it doesn’t start the file, so the device’s terminal doesn’t open in the middle of an escape sequence or a character; all of it when it starts the file, or has no newline early on.