Skip to main content

Module browser_waiting

Module browser_waiting 

Source
Expand description

A Browser call that needs the person doesn’t hold the agent’s turn (docs/specs/SPEC_WAITING_CALLS_RETURN_AND_FREE_THE_TURN_2026_11_10.md).

The call waits as it always did for a short grace, so a quick Allow still answers with the finished result. If the request is still open then, the call returns “waiting for the person” with the request’s id and the agent ends its turn; the banner stays up in the pane and a task of srv’s own waits for the answer, carries the approved action out through the same checked path as before, and tells the agent the outcome with a note that starts a turn. This module holds what the agent can ask about meanwhile (Browser request_status, cancel_request) and the note.

In memory, like the hand-off log: a day, the newest few hundred. A request that srv’s restart cut off reads as unknown, and its banner goes with the pane’s next refresh.

Structs§

Handoff 🔒
A hand-off’s identity for the task that waits on it.
Rec 🔒
Status 🔒
One request as the agent reads it.

Enums§

State 🔒
What became of a request.

Constants§

GRACE 🔒
How long a call waits for the person before it returns “waiting”: long enough that the usual quick Allow is still one step for the agent, short enough that a person who stops to ask a question isn’t holding the agent’s turn. AGENTMUX_BROWSER_WAIT_GRACE_MS changes it (tests; 0 returns at once).
KEEP 🔒
KEEP_FOR 🔒

Functions§

any_open 🔒
Whether any request is open. A list of agents asks about each of them only then.
deliver_to 🔒
One try at text for agent, by the name the request was opened under. That is the agent’s stable slug, which the handler keeps bound after a rename, so its own resolution finds the agent; the display name in the registry is not what is asked for.
detach_handoff 🔒
The call that raised a hand-off returns “waiting” now; a task of srv’s waits on for the person’s Done or Cancel, records it as the call used to and tells the agent how it went.
finish 🔒
Settle request id. The first settlement stands: an agent that cancelled it keeps that, and a late answer finds it over. Whether this call is the one that settled it.
grace 🔒
handle_ui_browser_request 🔒
POST /api/v1/ui/browser/request — backs Browser request_status and cancel_request. An agent reads and takes down only its own requests.
lock 🔒
make_room 🔒
Fewer than keep records: those settled a day ago go, then the oldest settled ones. A request still open is never dropped for room.
open 🔒
Record that request id (its banner’s id) went to agent as a call that returned “waiting”.
open_on 🔒
The request of an agent that is waiting on pane’s person, if any: its id and what it asked.
open_pane_of 🔒
The pane of agent’s own request id, if it is still open: the pane the agent’s cancel answers it on (crate::server::browser_attention::withdraw). That call settles the request and marks it the agent’s own doing in one step, and the task waiting on the request reads the mark from its answer (crate::server::browser_attention::Settled::by_agent) and settles it so, without waking the agent. If the call fails the person answered first and the request stands.
outcome_text 🔒
The text the agent is woken with: what became of question, and what to do next.
outcome_text_after 🔒
outcome_text, for a hand-off with how long its banner was up (open_secs): “clicked Done after 7 s”.
paused_text 🔒
The refusal an agent’s other call on a pane gets while its request is open there: paused (why its tools are paused) and, if the agent already got “waiting” for a request, that it ends its turn and doesn’t ask again.
pending_for 🔒
The pane where agent’s open request waits for the person, if it has one: an agent between turns with one is waiting for the person (agent_runtime). Its oldest request, so every look gives the same pane.
status 🔒
What became of agent’s request id, or its newest on pane.
status_of 🔒
table 🔒
trimmed 🔒
waiting_json 🔒
What a call that returned “waiting” answers.
wake 🔒
Tell agent how a request ended, with a note that starts a turn if it is between turns. Retried a few times: the agent may just be registering again.