Skip to main content

Module browser_attention

Module browser_attention 

Source
Expand description

An agent’s browser pane asking the human for something: a hand-off (sign in, a CAPTCHA, anything the agent mustn’t do) or approval of a committing action (submit, send, pay, delete) (docs/specs/SPEC_AGENT_DRIVEN_BROWSER_PANES_2026_10_07.md §5.2, §5.4).

The request is shown as a banner in the pane through the block’s browser:attention meta key. The human’s answer comes back only through the CEF host (/api/v1/host/browser_attention, authenticated with the host’s IPC token, which agents never see): an agent can’t answer its own request, even though it holds the instance auth key every other route trusts.

A pane’s slot has two levels (REPORT_BROWSER_PANE_BLANK_AFTER_BLOCKED_SIGN_IN_REDIRECT_RCA_2026_10_16.md §6.1): below, one hand-off, approval, auto-approve question or page dialog; above it, one question or notice about a navigation the pane stopped. A sign-in redirect during a hand-off is asked about over the hand-off, whose banner returns when it’s answered.

Structs§

Pending 🔒
Raised 🔒
A request put up in its pane’s banner, not yet answered.
Settled 🔒
How a request ended: the human’s answer, or the lack of one, and whether the agent that asked took the request back itself (withdraw). Both are written in the one step that settles the request, so whoever waits on it reads who ended it from the answer, not from a table kept somewhere else.
Waiting 🔒
A request that is still up. Dropping it takes the request down: it leaves the pending map, which unlocks the pane, and the banner shows what is left (the request under it, or nothing). That happens on every path, including when the waiting HTTP handler is cancelled because its caller went away.

Enums§

Answer 🔒
The human’s answer, or the lack of one.
AskError 🔒
Why a request couldn’t be put up. Callers handle each: a busy slot must never turn into silence (RCA §7.2).
Kind 🔒

Constants§

ATTENTION_META_KEY 🔒
Block meta key the browser pane’s banner reads.

Functions§

ask 🔒
Show payload in block_id’s banner and wait for the human, up to timeout. The pane stays locked until the returned Waiting is dropped, so a caller that acts on a Yes holds it until that action is done. See slot_taken for what may be up at the same time.
asking 🔒
The panes with a request of kind up.
cancel_for 🔒
Answer every request waiting on block_id with Cancelled: the user took the pane over, which ends whatever the agent was waiting for there.
cancel_kind_for 🔒
Answer block_id’s unanswered request of kind, if any, with Cancelled: what it asked about ended on its own (a page dialog whose page navigated).
clear_stale 🔒
The human answered a banner srv has no request for (srv restarted, so its requests are gone but the block meta persisted): take that banner down, so its buttons don’t sit there doing nothing. Host-authenticated callers only.
next_seq 🔒
pending 🔒
raise 🔒
Put payload up in block_id’s banner as a request of kind, without waiting for the answer: the caller learns at once whether the slot was free. A notice on the pane is replaced.
resolve 🔒
Resolve request id on block_id with the human’s answer. Called only by the host-authenticated route.
settle 🔒
show 🔒
Show block_id’s banner from its requests: the newest unanswered one, the upper level first. With none unanswered, the banner already shown stays while its request is still being acted on (an approved click being made), so an answered banner never comes back. Called with the map locked, so two changes can’t publish out of order.
slot_taken 🔒
Whether a new request of kind on block_id must wait, and on which kind. Each level holds one request at a time, except that a page dialog may follow one already answered (the approved click opened it). A notice holds nothing and is replaced by anything new, but doesn’t cover a navigation question still unanswered.
waiting_on_user 🔒
What block_id is waiting on the human for, if anything. While it waits, the agent’s tools on that pane are refused: during a hand-off so it can’t watch what the human types (§5.2), during an approval so it can’t change the form the human is reading (§5.4). A notice holds nothing. With a question over another request, the one under it is named: it holds the pane longest.
withdraw 🔒
The agent that asked takes request id on block_id back: it ends as Cancelled, marked as the agent’s own doing (Settled::by_agent) in the same step that takes the answer, so a person’s Cancel that got there first is never read as the agent’s, and the other way round. Fails like resolve when the request is already answered.