Expand description
The person’s standing grants: “this agent may do these things on this site, until I say otherwise” (docs/specs/SPEC_BROWSER_WEB_TERMINAL_TYPING_2026_10_23.md §3).
A row names one agent and one site (with, for a preset, the frames of other
sites that belong to it) and the powers it carries. It is a
setting: it lives in a file in the config folder and survives restarts. A
row grants nothing by itself. When its agent works on a pane showing a
site the row names, activate_at makes a pane grant from it (the strip,
Stop, Pause, Take over and the idle rule are the pane grant’s), so the
agent never has to ask again and the person’s controls are the ones they
already know.
Only the person writes rows: through the Settings window
(app_api/browser_grants.rs, which checks that), or by answering a
request banner with “Always”. No agent route reaches this module.
Structs§
- Preset 🔒
- A console the person can switch on for an agent with one click.
- Row 🔒
- Store 🔒
- The rows, and where they are kept (None: nowhere, for tests).
Constants§
- FILE_
NAME 🔒 - The file the rows are kept in, in the config folder.
- MAX_
ROWS 🔒 - Most rows kept: a list this long is a mistake, not a use.
- PRESETS 🔒
- The presets. The sites are the ones the console’s own documentation names; each is to be checked against the real console in a signed-in run (the spec’s Phase 0 live check), and AWS CloudShell and GitHub Codespaces wait for that check, because their hostnames vary by region and by codespace.
Functions§
- activate_
at 🔒 - The pane grant for
agentonpane, made from a standing row that names the siteurl(the address the host read from the page itself). None: no row says so, or the person stopped the grant on this pane and hasn’t turned it on again. A grantagentalready holds there is not replaced. - add_
powers 🔒 - The person’s “Always” on a request banner: a row for
agenton the sites the banner named, withpowersadded to whatever it already carried (a banner that shows fewer powers than a row has never narrows the row). - enable_
preset 🔒 - Turn a preset on for
agentwith the terminal power (a preset is for consoles). - find 🔒
- The row of
rowsthat letsagentwork onurl, if one does. A page with no web origin (about:blank,data:) is never covered. - list 🔒
- Every row, oldest first.
- resume 🔒
- The person turned auto-approve on again, or answered the agent’s request:
a standing row may make
pane’s grant again. - revoke 🔒
- Remove row
idand end the pane grants made from it, at once: an in-flight call ends and the strip comes down. Returns whether the row was there; an error when the file could not be written, in which case the row stays (it would be back after a restart anyway). - set_
powers 🔒 - Change the powers of row
id. - stop_
by_ 🔒person - The person pressed Stop on
pane’s grant: if it is a standing one, hold off making it again. Returns whether it was a standing one. - stopped 🔒
- Panes whose standing grant the person ended with Stop. A standing row would make the grant again on the agent’s next call, so Stop would end only the call in flight: until the person turns auto-approve on again or answers the agent’s request, the pane’s calls ask as they did before.
- store 🔒
- upsert 🔒
- Add a row, or change the powers of the one for this agent and site. The caller has checked that the person is the one asking. A changed row ends the pane grants made from it, which are made again from the new row on the agent’s next call.
- upsert_
in 🔒 - Add or replace the row for
agentonsites(the first names the row). A wildcard (*.example.com) is only for a preset or a banner the person answered (wildcard_ok): a row the person types in names one site. - write_
atomic 🔒 - Write
bytestopathso a reader never sees half a file: a temp file in the same folder, flushed, then renamed over it. - write_
rows 🔒 rowsas the file atpath(None: nowhere, for tests). The error says what failed, for the person.