Skip to main content

Module browser_standing

Module browser_standing 

Source
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 agent on pane, made from a standing row that names the site url (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 grant agent already holds there is not replaced.
add_powers 🔒
The person’s “Always” on a request banner: a row for agent on the sites the banner named, with powers added 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 agent with the terminal power (a preset is for consoles).
find 🔒
The row of rows that lets agent work on url, 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 id and 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 agent on sites (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 bytes to path so a reader never sees half a file: a temp file in the same folder, flushed, then renamed over it.
write_rows 🔒
rows as the file at path (None: nowhere, for tests). The error says what failed, for the person.