Skip to main content

Module browser_terminal_line

Module browser_terminal_line 

Source
Expand description

terminal on a grant that asks about each line (docs/specs/SPEC_BROWSER_WEB_TERMINAL_TYPING_2026_10_23.md §4.4).

The agent’s line is typed without its Enter, read back from the terminal, and shown to the person in the pane with Run it and Don’t run. Only a click on Run it, relayed by the host, lets Enter go in, and only if the terminal still shows the very line the person was shown. In every other end (No, no answer, Take over, Pause, the grant ending) what the agent typed is erased.

Structs§

Call 🔒
What the handler hands over once the grant, the page and the prompt are checked.

Constants§

ANSWER_WAIT 🔒
How long the person has to answer a line before it is erased.
BANNER_ROWS 🔒
Rows of the terminal the banner shows with the line.
BANNER_ROW_CHARS 🔒
The widest a terminal row is shown in the banner.
MAX_SHOWN 🔒
The longest line shown in full; a longer one is refused, not shown cut.
MAX_WRAP_ROWS 🔒
Rows a wrapped line is looked for over.
READBACK_POLL 🔒
How often the rows are read while waiting.
READBACK_WAIT 🔒
How long to keep reading for the typed line to reach the terminal’s rows, which trail the screen (more so in a window that has no focus).

Functions§

ask_person 🔒
Show the person the line and wait for Run it or Don’t run. The returned guard keeps the pane’s tools paused until the caller has acted on the answer.
brake 🔒
Why the keys must stop now, if they must: the pane is paused or the grant that allowed them is gone.
erase 🔒
Take back what the agent typed: as many Backspaces as it typed characters, then, if the prompt still doesn’t read as it did, Ctrl+C. Best effort: the pane may be gone or off the granted site, and then nothing more is sent. The Backspaces go at once, before a person who took the pane over can type; the Ctrl+C waits for the screen and is dropped if the person has the pane by then, since it could interrupt what they started.
finish 🔒
The answer to the agent, with the output the terminal shows once it settles.
is_hidden 🔒
Is c a character the person could not see in a line, or would read as something else? Controls, joiners, direction marks and look-alike spaces.
read_back 🔒
The line the terminal shows at its prompt now. With typed, the line must end with it, over as many rows as it wrapped; None means the terminal does not show what was typed, so what Enter would run can’t be confirmed. Without typed (only keys were pressed, say ArrowUp), it is the last row.
refuse 🔒
A call that ended with nothing run: logged as refused and answered with why.
rows_for_banner 🔒
The last rows of the terminal as the banner shows them: hidden characters written out, token shapes masked, each row cut. They are page content and exist only while the banner is up.
rows_showing 🔒
Read the terminal until it shows the line that was typed, for at most READBACK_WAIT. Answers the last rows read, and the line if they show it.
run 🔒
Run the call under a grant that asks about each line.
send 🔒
Send keys to the terminal in chunks.
split_line 🔒
The keys before the Enter, and whether the call wants Enter pressed. One line to a call, and the Enter last: the Enter is what the person answers.
still_the_line 🔒
Read the terminal again as the person said Run it: the line must be the one they were shown.
tail_row 🔒
The last row that shows anything, without its trailing blanks.
type_pre 🔒
Type the keys before the Enter, the brakes checked between chunks. Answers how many went in, and why it stopped, if it did.
visible 🔒
s with every hidden character written out (\u{1b}), so what the person reads is what the shell would receive.