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
ca 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. Withouttyped(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
keysto 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 🔒
swith every hidden character written out (\u{1b}), so what the person reads is what the shell would receive.