Expand description
Which agent owns which agent-opened browser pane (docs/specs/SPEC_AGENT_DRIVEN_BROWSER_PANES_2026_10_07.md §3).
An agent may drive a browser pane only if it opened that pane with
OpenBrowser. The authority is this in-memory map, written only by
ui_handlers::handle_ui_browser_open after verifying the caller’s
signed identity. The block’s browser:owner_agent meta key mirrors it
for the “Driven by” badge, and both must agree:
- a client that writes the meta key itself gains nothing, since the map has no entry for it;
- a duplicated pane copies the meta key but gets a new block id, which the map doesn’t know;
- the human’s Take over clears the meta key; the client-write guard
(
guard_client_meta_write) then drops the map entry, so ownership ends for good, and no client can set the key at all; - deleting the block drops its entry (
wcore::delete_block); - after srv restarts the map is filled again from
browser_pane_records, for the panes whose block still names the same owner (a Take over cleared the key; a copy has no record). - a Take over is remembered for a day, so the agent that lost the pane is told
what happened instead of guessing (
lost_message); a pane that closed is only logged, since a deleted block is already answered as “no such pane”. - the agent gets such a pane back with
retakeonce the person pressed Give back in the pane header (relayed by the host, like every answer to a pane’s banner, so no agent can give itself the pane) or took the pane over during the agent’s own hand-off; otherwise the person is still using it and the agent is told to wait.
Structs§
- Lost
Entry 🔒 - What srv remembers about a pane an agent lost to a Take over.
Enums§
- Denied 🔒
- Why a caller may not drive a pane. Not an authentication failure: the caller’s identity was already verified.
- Lost 🔒
- Why an agent no longer drives a pane.
Constants§
- GIVEN_
BACK_ 🔒META_ KEY - Block meta key naming the agent the person gave the pane back to (their Give back click, relayed by the host), so the retake still works after an srv restart. Cleared when an agent drives the pane again.
- IDLE_
BEFORE_ 🔒RETAKE - How long the person must have left a pane they took over alone before the agent that lost it may drive it again.
- LAST_
DRIVER_ 🔒META_ KEY - Block meta key naming the agent that drove the pane last, written by srv whenever an agent becomes its driver and kept through the person’s Take over, so the pane header can offer “Give back to X”.
- LOST_
KEPT 🔒 - LOST_
KEPT_ 🔒FOR - How long a lost pane is remembered, so an agent that comes back the next day is still told what happened.
- OWNER_
META_ 🔒KEY - Block meta key mirroring the owner, for the frontend.
- TOOK_
CONTROL_ 🔒META_ KEY - Block meta key set to true while the agent that drives the pane did not open it (
take_control), so the header says “took control”. Cleared when the agent lets the pane go.
Functions§
- ago 🔒
- How long ago, in words an agent can read.
- ago_
exact 🔒 - How long ago, to the second under a minute.
- all_
owners 🔒 - Every pane an agent owns and the agent, for
browser_pane_records. - changed 🔒
- Woken whenever the set of owned panes changes, or the host needs the
whole set again (it registered). See
browser_host_sync. - check 🔒
- May
agent_iddrivepane?blockis the pane’s block as stored (None if it no longer exists) andrecordedits entry in the owner map. - driver_
meta 🔒 - The meta that shows
agentdriving a pane: the owner the header reads, and the last driver Give back names. - driver_
of 🔒 - Who drives a browser pane, for
Pane layout: the agent’s id,personafter they took it over from an agent that has not got it back, or None for a pane no agent has driven. - forget 🔒
- Drop
block_id’s owner: the pane was deleted or taken over. Its bypass, if any, ends with the ownership. - forget_
because 🔒 - Drop
block_id’s owner and remember why. Its bypass, if any, ends with the ownership, and so does a pause (the action log stays, for the person to read). Logged, so a refusal an agent reports can be traced to its cause. - guard_
client_ 🔒meta_ write - Guard for meta updates that come from a client (the
setmetaWebSocket command and theUpdateObjectMetaservice call), not from srv itself.browser:owner_agentis srv’s to write: a client may only clear it, which is the human’s Take over and ends that pane’s ownership for good. Setting or changing it is refused, so a taken-over agent can’t write itself back.browser:attention(the hand-off and approval banner) is srv’s alone: a client that could write it could keep a real request’s id and change what the banner tells the human they’re approving. - lost 🔒
- Panes the person took over, newest few hundred. In memory like the owner map, so after an srv restart there is nothing here and the plain refusal is the right answer.
- lost_
message 🔒 - What to tell the agent that lost a pane to the person’s Take over. Another agent asking about the same pane gets the plain refusal, and never learns who drove it. None after an srv restart (nothing is remembered) or for a pane the agent never opened.
- mark_
given_ 🔒back - The person pressed Give back on
block_id: the agent that lost it may retake it. - may_
retake 🔒 - May
agent_iddriveblock(block_id) again, the pane it lost to the person’s Take over? Yes once the person gave the pane back (remembered in memory and in the block’s meta, which outlives an srv restart), or took it over during the agent’s own hand-off, or has not used the pane forIDLE_BEFORE_RETAKE; a pane the person is still using is refused with what to do.since_inputis how long ago the host last saw the person use the pane’s page:Duration::MAXwhen it never has, None when the host could not say (then only Give back counts). The caller then writes the owner meta (retaken_meta) and records the agent (record). - owned_
panes 🔒 - Every pane an agent owns. The host keeps a copy, to decide inside
on_before_popupwhich of a pane’s popups open in-app (SPEC_BROWSER_PANE_NATIVE_POPUPS_AGENT_DRIVEN_2026_10_08.md §3); it is only a hint there, since who may drive what is always checked here. - owner_
of 🔒 - owners 🔒
- person_
has_ 🔒left - Has the person left a pane they took over alone for
IDLE_BEFORE_RETAKE? Their Take over click is their last touch if they never used the page itself. Unknown (the host could not say) is not left. - record 🔒
- Record
agent_idas the owner ofblock_id. OnlyOpenBrowsercalls this. - released_
meta 🔒 - The meta of a pane nobody drives and the person did not take over: an agent let it go (
release). - restore 🔒
- Put back the owner
browser_pane_recordskept across a restart, for a pane whose block still names that agent. Only the owner is restored; the take-over record and a pane’s grants keep their own rules. - retaken_
meta 🔒 driver_metafor an agent that drives a pane again: the Give back it used is spent.- srv_
only_ 🔒keys - Meta keys only srv writes, from its own records: who drives a pane, the banner that asks the person something, the bypass the person granted, what the agent did and whether the person paused it, what opened a popup, the sites a pane is limited to, and which agent coaches a worker.
- strip_
srv_ 🔒only_ keys - Remove srv-only keys from the meta a client gives a NEW block
(
pane.openover RPC or HTTP,object.CreateBlock). Removed rather than refused, so duplicating a pane still works: the copy is an ordinary pane, without an owner, a banner, or a claim to be a popup. srv’s own callers (OpenBrowser, the popup route) set these keys after this check, throughopen_panedirectly. Returns the keys it removed. - taken_
over_ 🔒ago - How long ago the person took
block_idover from an agent, if srv remembers it (not after a restart). - takeover_
in_ 🔒use - The person took
block_idover fromagent_idand has neither given it back nor taken it over at the agent’s own request: only their idleness can return it. Some(how long ago they took it over) then, so the caller knows to ask the host when they last used the pane. - took_
control_ 🔒meta - The meta that shows
agentdriving a pane it did not open.