Commit graph

157 commits

Author SHA1 Message Date
Luke Parker
90a267a750 docs(browser): the focus parameter names no implicit active tab 2026-11-18 14:24:53 +10:00
Luke Parker
98714af3a6 fix(browser): a file approval names and remembers the file that opens, not the spelling that asked for it
The prompt for showing a file carried the model's own string, so an encoded address or a run of dot segments read as another name, and nothing was remembered for a file at all. The server now resolves the input before it asks: the prompt names the workspace file that opens, says which link led to it when one did, and always is kept for that file, so no other spelling of it asks again and none stands for another file. A link that points elsewhere by the time the answer comes is refused.
2026-11-18 14:24:22 +10:00
Luke Parker
964e73e849 fix(browser): the server agrees with the desktop on a file named .html, and reads a workspace address in any case
The server took a file named only .html for a page, which the desktop shows in the file panel, so tabs.open failed for want of a tab. A workspace address whose scheme or session ID was not in lower case named nothing, though the prefix it is compared with is written in lower case.
2026-11-18 14:24:21 +10:00
Luke Parker
ee844bfcf1 docs(browser): tell the agent to pass focus: true only when asked to show a page 2026-11-18 12:37:28 +10:00
Luke Parker
bbdaf3d191 feat(browser): tabs.open and navigate take a workspace file in path, and browser.preview is removed
The server checks the path as it did for preview and sends the desktop the same preview action (navigate.path to move an existing tab). The permission check names the called operation and preview, so a deny of the old name still stops the path forms.
2026-11-18 10:27:12 +10:00
Luke Parker
56b712740e refactor(browser): parse a workspace address in one place for the server and the desktop 2026-11-18 10:27:02 +10:00
Luke Parker
2843cd57c7 chore(browser): match the skill to the not-attached error and drop leftovers of the timed rule
The browser skill still told the model about [browser.disconnected] for a session with no desktop, where the tools now throw [browser.not_attached] and tabs.list answers calmly; it now describes both. A comment still named the removed grace period, two connection helpers had no caller left, and the automation's configured-rules merge gets a line saying why it does not read hook denies.
2026-11-17 12:26:17 +10:00
Luke Parker
6a53757a06 Merge remote-tracking branch 'origin/persisted-browser' into browser-pane-open 2026-11-17 11:06:21 +10:00
Luke Parker
551c5b4814 Merge branch 'browser-deep-snapshot' (ea08948131) into persisted-browser
Conflict in chromium.ts reload(): keep the held-restore retry from browser-ext-fix and drop the second navigation interrupt, as browser-deep-snapshot does: every reload now arrives through execute, which interrupts once, and a second interrupt would skip a hard reload of a held restore.
2026-11-17 10:58:12 +10:00
Luke Parker
1529b601ee docs(browser): warn that full-page screenshots resize the page 2026-11-17 10:33:20 +10:00
Luke Parker
6526cdba93 fix(browser): allow more time for full-page redraws 2026-11-17 09:47:31 +10:00
Luke Parker
7aa948ad0e test(browser): exercise plugin wake, activity marks and pane fit 2026-11-17 09:38:54 +10:00
Luke Parker
c0fc1b8ab0 fix(browser): separate agent activity from the selected tab 2026-11-17 09:35:37 +10:00
Luke Parker
fd4afe780e fix(browser): hold hidden tabs awake through URL and delay waits 2026-11-17 09:35:18 +10:00
Luke Parker
8df4933923 fix(browser): reject conflicting scripts and describe file IDs 2026-11-17 09:29:27 +10:00
Luke Parker
7fe1f810a2 fix(browser): distinguish unattached inventory from unexecuted actions 2026-11-17 09:24:27 +10:00
Luke Parker
27777efd13 fix(browser): stop granting the browser skill on attach
Confirmation review, the gap I reported. If the browser plugin was
removed (plugins: ["-opencode.browser"]) after a crash left a grant,
the grant's skill "browser" allow outranked a person's deny or ask on
their own skill named browser. Nothing sweeps a grant once the plugin
is gone.

The skill rule was not needed. The experimental.rules hook already
hides the built-in skill while the session holds no browser grant or
its agent is denied the browser. Allowed agents get the skill from
their own rules: the default agent rules allow "*".

Now:
- An attachment writes only browser "*" allow (BrowserMachine.GRANT).
- isGrant still matches the old skill allow. A revoke, the
  reconcile on attach and the startup sweep therefore remove grants
  written by earlier versions. The configured rules the hooks read
  still leave that allow out.
- The hook checks for the browser grant itself (holdsGrant), so a
  leftover skill allow does not count as attached.
- With no skill rule in any grant, the evaluate hook's skill branch
  and the hook's "configured skill deny" check are removed. Core's
  own rules decide every skill. A configured skill deny or ask is
  final again.

Tests:
- grant fixtures drop the skill rule. The startup-sweep test uses the
  old two-rule grant and still revokes it.
- A machine test: an old grant is revoked in full and replaced with
  the new one.
- The truth table and skill tests pass unchanged: with no skill rule
  in the grant, the built-in skill is listed and loads for an allowed
  agent with a desktop, and is hidden otherwise.
- New: with the plugin removed, a person's deny on their own browser
  skill holds against a grant left behind. An old-version grant there
  still outranks it, and the test pins that as the remaining case.
2026-11-17 09:06:57 +10:00
Luke Parker
545a330056 fix(browser): keep the grant from overriding a configured skill rule
Review finding L1, and the browser plugin moves to the deny-only hook.

The attachment's grant includes skill "browser" allow. It is the last
rule, so with skill "*": deny or ask and a desktop attached, the
built-in browser skill was listed and loaded without a prompt. This
was already the case at 9e20e99a4f.

A person's own skill named browser replaces the built-in (ConfigSkill
loads later). Before, it was hidden whenever no desktop was attached,
because of the agent-level default deny. It was also hidden whenever
the agent was denied the browser, even with an explicit skill allow.

Now:
- The agent-level default deny covers only browser "*". The skill
  deny moves to the experimental.rules hook.
- The hook pushes a skill "browser" deny in two cases:
  - the configured rules (agent, then session without the grant)
    deny that skill;
  - the registered browser skill is the built-in one (its path is
    skill://browser/SKILL.md) and the session has no grant, or the
    agent is denied the whole browser.
  A person's own skill is denied only by their own rules.
- If the skill list cannot be read, the hook treats the skill as the
  built-in one, so it hides the skill rather than shows it.
- The evaluate hook gets a branch for skill "browser": a configured
  ask prompts despite the grant, unless the same save key was saved
  before. This works as the ask for browser operations does.
- The browser deny is now event.deny.push({ action: "browser",
  resource: "*" }) under the same condition as before. Call outcomes
  for browser operations do not change. For an agent denied the
  browser, a scheduled check's preflight now fails with core's
  "Permission denied: browser" message instead of the plugin's
  "[browser.denied] ...".

Tests (browser-permission.test.ts), review finding L3:
- A row pins the tool.use policy gap as it is today: listed, and
  calls refused with "Blocked by configuration policy".
- With the plugin removed by "-opencode.browser" and a grant left in
  the session, nothing is registered or listed.
- skill "*": deny hides the skill and the read tool refuses it.
  skill browser: ask lists it and prompts.
- The read tool refuses the skill to an agent denied the browser.
- A person's own browser skill with an explicit allow stays listed
  while the agent is denied the browser, attached or not.
- A scheduled code check runs the browser for an allowed agent and
  refuses one denied the browser.

With the plugin's experimental.rules hook skipped, 12 of the 45 tests
in the file fail:
- the 7 that failed before;
- 2 no-desktop rows, whose skill hiding is now in the hook;
- the 3 new skill and scheduled-check tests.
2026-11-17 08:51:28 +10:00
Luke Parker
bbb8ac1e8d fix(browser): budget snapshots by landmark and preserve document refs 2026-11-17 08:50:42 +10:00
Luke Parker
0bb06881e5 feat(browser): show interactive controls with bounded snapshot lines 2026-11-17 08:31:57 +10:00
Luke Parker
3cbfdd88d4 feat(browser): accept recorded tool aliases and response-only bodies 2026-11-17 08:29:47 +10:00
Luke Parker
f5decd10c3 feat(browser): capture full pages in background tabs 2026-11-17 08:14:08 +10:00
Luke Parker
d0fd8fceb8 fix(browser): do not list the browser to an agent that denies it
When a desktop attaches, the plugin appends a session grant (browser
"*" allow, skill "browser" allow). The grant is evaluated after every
agent rule. The PR's permission.evaluate hook already refused the
calls of an agent whose configured rules deny the browser. But
Tool.snapshot still saw the grant last and listed about 45 browser
tools, plus the browser skill, to that agent. For agents without Code
Mode, such as explore, these tools were listed as direct tools.

Now an experimental.rules hook appends browser "*" deny and skill
"browser" deny after the session rules, but only when
deniesAll("browser") holds for the rules the evaluate hook already
uses: the agent's configured rules (config and agent definition,
before the plugin's default deny) followed by the session's rules
without the grant.

Calls do not change. If deniesAll holds, every browser operation is
already refused: the last rule that matches the action has resource
"*", so it is the rule that decides every operation. Core now refuses
the call itself, and refuse() still runs first in the tool and keeps
the "[browser.denied]" message. The only new refusal is reading the
browser skill (skill:// read) for such an agent. Before, the grant
allowed it.

Listing becomes:
- A configured or agent-level browser deny, or "*" deny: not listed.
  This covers the tools, the Code Mode catalog and search, the skill,
  and direct tools.
- ask, a deny of some operations or a pattern, or a deny followed by
  an allow of one operation: listed, and decided per call as before.
- No desktop attached: not listed (the default deny), as before.
- Agent rules override global rules because they come later.
  Subagents lose the inherited grant at their first prompt.
  Startup sweeps stale grants. These rules are unchanged.

Each step calls SessionContext.select, so an agent switch, a session
rule change, a config reload, or an attach or detach updates the
listing on the next step. The Code Mode catalog cache is keyed by the
set of visible tool names.

Tests (browser-permission.test.ts) run the real plugin, permission
service and SessionContext:
- A 13-row truth table checks listing (catalog, skill, direct tools)
  against the outcomes of tabs.list and tabs.open.
- Code Mode catalog, search and tools for a denied agent.
- Agent switch, session rule, config reload, and detach and re-attach
  between steps.
- Subagents, including explore attached directly.
With the hook disabled, 7 of these tests fail.
2026-11-17 08:12:25 +10:00
Luke Parker
292141ac44 fix(browser): report unattached sessions without failing tool calls 2026-11-17 08:11:12 +10:00
Luke Parker
8a31028efe feat(browser): hard reload and clear cache for one site 2026-11-17 07:59:47 +10:00
Luke Parker
ec452dfe59 fix(browser): snapshot and search deep accessibility trees 2026-11-17 07:53:04 +10:00
Luke Parker
ce772bc1ac fix(preview): distinguish unavailable file verification from missing files 2026-11-17 01:22:53 +10:00
Luke Parker
11bf34af21 fix(browser): keep a linked workspace's own path when preview finds its file
locate returned the file's real path. In a workspace reached through a link, as macOS's tmpdir under /private is, that path lies outside the workspace's spelling: preview asked again for it, and the tool sent the desktop a ../../private path. It now names the physical file under the workspace as the session spells it and asks only when a link inside the workspace points elsewhere in it.
2026-11-16 18:49:45 +10:00
Luke Parker
bd6134583e Merge branch 'browser-sec-agent' (c55bc33c90) into persisted-browser 2026-11-16 18:43:30 +10:00
Luke Parker
e686fc2c0f fix(preview): enforce agent read permissions for every workspace resource 2026-11-16 18:35:19 +10:00
Luke Parker
c55bc33c90 fix(browser): cancel agent-caused file pickers before native UI 2026-11-16 18:27:57 +10:00
Luke Parker
8d3b292ea2 fix(browser): authorize exact preview paths before lookup 2026-11-16 18:16:18 +10:00
Luke Parker
f364faada1 Merge branch 'browser-prompts' (6bc2a7b647) into persisted-browser 2026-11-16 15:58:37 +10:00
Luke Parker
1437faca4e Merge branch 'browser-sec-agent' (1fd0956128) into persisted-browser 2026-11-16 15:53:53 +10:00
Luke Parker
291797e643 fix(browser): scope workspace reads to the explicitly opened document folder 2026-11-16 15:36:35 +10:00
Luke Parker
1fd0956128 fix(browser): keep delayed native menus off the agent input path 2026-11-16 15:15:46 +10:00
Luke Parker
8b842aae0f fix(browser): remove private capture exports with their session 2026-11-16 15:15:46 +10:00
Luke Parker
5f165f9ac7 fix(browser): match URL waits without regex backtracking 2026-11-16 15:15:45 +10:00
Luke Parker
56e47a98f3 fix(browser): scope saved approvals without changing operation policy matching 2026-11-16 15:15:45 +10:00
Luke Parker
b6e797197b fix(browser): exclude extension-attributed diagnostic entries 2026-11-16 15:15:45 +10:00
Luke Parker
977d75caad fix(browser): route shell shortcuts only from hardware input 2026-11-16 15:00:28 +10:00
Luke Parker
8fb32beaec fix(browser): verify pointer hits and keyboard focus before dispatch 2026-11-16 14:59:22 +10:00
Luke Parker
1ba162790f fix(browser): refuse clipboard chords and stop granting script activation 2026-11-16 14:55:24 +10:00
Luke Parker
6a0adf289f fix(browser): authorize server file reads and capture exports 2026-11-16 14:53:41 +10:00
Luke Parker
5892aab6b4 fix(browser): retry failed previews on reattach and distinguish outdated servers 2026-11-16 14:33:04 +10:00
Luke Parker
04b955c0d4 refactor(browser): share preview path checks and drop stale file URL helper 2026-11-16 14:07:30 +10:00
Luke Parker
9e4db6980f fix(browser): apply filename restrictions on the owning filesystem 2026-11-16 13:54:56 +10:00
Luke Parker
95150190cc feat(browser): ask the user in the pane for page dialogs, leaving, site permissions and sign-ins
alert, confirm, prompt, Leave site? and HTTP sign-in show as a tab-scoped app dialog over the page; permission requests show as a bar above it. Only the window answers; the agent shares the dialog gate (first answer wins) and gets sign_in_required for a sign-in. Kept permission decisions are listed in Settings > Browser.
2026-11-16 13:24:12 +10:00
Luke Parker
1d0e6a8599 fix(browser): point the agent to preview when it opens a workspace preview address 2026-11-16 12:57:40 +10:00
Luke Parker
d9f41d3167 feat(browser): stream workspace HTML in the session browser 2026-11-16 12:49:24 +10:00