Skip to content

feat(browser): connected browser executor, relay connection and local controls - #23

Merged
mrgoonie merged 9 commits into
mainfrom
feat/17-browser-executor
Oct 14, 2026
Merged

mrgoonie merged 9 commits into
mainfrom
feat/17-browser-executor

Conversation

@mrgoonie

Copy link
Copy Markdown
Contributor

Summary

Adds the opt-in connected browser: a Dewee agent can read and act in tabs of the person's own Chrome, only as far as the person allows in the side panel. The extension is an executor, never an agent. It runs a fixed set of bundled actions (tabs, open, navigate, snapshot, click, type, press, scroll, wait, close) sent by the Gateway relay over /ws. It never runs code, CDP methods or selectors from the wire.

Closes #17. Gateway side: nextlevelbuilder/dewee#1221, nextlevelbuilder/dewee#1223 (PR to dev linked below).

What the person controls

  • Off by default. It is turned on in Options (self-hosted only). The workspace must also enable it on the Gateway; otherwise the panel explains that it is off.
  • Grants. In the panel the person registers this browser, then allows chosen agents on exact origins with Read or Read and act, for a limited time. Chrome host permission is requested per origin (never <all_urls>). A grant is trusted only if this device created it, it matches what the person approved (origins, agents, capabilities), and the exact host permission is present.
  • Only owned tabs. An agent drives only tabs it opened under a grant. It sees them as opaque handles (t1, t2) and never sees raw tab ids.
  • Approval card. High-risk actions need a per-action confirmation in the panel: submit, publish, delete, pay, type with submit, and press Enter. Denying or closing returns approval_denied.
  • Pause / Stop / Revoke work locally and immediately. Pause/Stop is stored per device and survives a Chrome restart. After reconnecting, the extension sends active only if the person's last choice was Resume.
  • Redaction. Password, hidden, payment and one-time-code values are never read or typed (sensitive_field). Page content is never stored.

Notable behaviour

  • No replay. A command lost after it may have run reports outcome_unknown, never a re-send. This includes an interact result whose page URL cannot be reported.
  • Revoked or expired grants. A grant revoked or dropped while a command runs, or waits for approval, cancels the command with grant_revoked; an expired grant gives grant_expired.
  • Waits for attach. Grant creation and enrolment wait until browser.device.attach has completed, so a not-yet-attached socket can never make the extension forget its device.
  • Contract. docs/connected-browser-relay-contract.md is synced with the Gateway copy.

Docs

  • New: docs/browser-control-threat-model.md.
  • Updated: docs/architecture.md, docs/api-contract.md, docs/development.md, README.md, and the side-panel exception in AGENTS.md.

Verification

🤖 Generated with Claude Code

mrgoonie and others added 8 commits October 14, 2026 23:08
Let Dewee agents the person allows drive tabs in this Chrome through the
Gateway relay (self-hosted, opt-in, off by default).

- Relay transport on /ws with the personal API key, heartbeat, backoff
  and no replay; device enroll/attach/rename/revoke and grants.
- Every command is validated and re-checked locally (grant, agent,
  capability, exact origin, restricted pages, owned tabs, host
  permission, Pause/Stop) before ack and execution.
- Bundled executor for tabs/open/navigate/snapshot/click/type/press/
  scroll/wait/close; snapshots redact password, hidden, payment and
  one-time-code values; risky actions wait for approval in the panel.
- Side panel drawer for status, device, grants, approvals and
  Pause/Resume/Stop; Settings toggle; en and vi strings.
- Unit tests, Playwright e2e against a loopback relay and page server,
  threat model and docs. No new install-time permission.

Refs #17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Ask before pressing Enter, naming the focused element, and re-describe
  the target after any approval; a changed element fails with stale_ref.
- Show a clipped preview of the text that type-with-submit would send.
- Redact and refuse typing into revealed passwords, PIN, OTP and
  verification-code fields, whatever role the page gives them.
- Use only grants created in this browser, for this device, over exact
  origins; require host permission for the exact host.
- Re-check the grant and Pause while waiting for text, refuse about:blank,
  cap command time locally, close tabs created after a cancel, and inject
  only once storage.local is locked.
- Update the threat model and the API contract notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Gateway answers FAILED_PRECONDITION to every relay method while the
workspace has not turned connected browsing on. Registering showed a
generic error and an enrolled browser reconnected silently. The panel
now says the feature is off and who can turn it on; the reconnect
backoff keeps retrying, so the device attaches once it is enabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A live spec runs the real build against a local Dewee Gateway and the
stub model, which calls the browser tool with target connected: the
feature flag off and on, registering, grants per agent and site,
open, snapshot, click and type with the password redacted, a site
outside the grant, an approval denial, revoke and Stop. With the CLI
it also checks the device and grant lists and that browser trace
spans carry no typed text. The docs gain the feature flag step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sync the contract from the Gateway. A revoked grant now reports
grant_revoked, both for a command it cancels and for one that arrives
after it. Page results and screenshots carry the page url. After every
attach the extension re-sends its control state, active included, so
a Resume made offline or a Gateway restart cannot leave the device
paused. Grant creation explains a device removed elsewhere (forgotten
locally) and an agent the person may not allow. Device names with
control or format characters or over 100 bytes, and origins with a
trailing dot or an over-long or non-punycode host, are refused
before anything is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ult agent in the live run

The Gateway now refuses grants for agents another person owns. The live setup makes the Super Agent the workspace default, as in a real workspace, and the spec checks that the side panel refuses the shared E2E Helper. Trace spans are polled because they are written after the turn ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pause, Stop and Resume are now kept per profile and device in
storage.local and re-sent after attach. Without a stored choice nothing
is sent, so a pause held by the Gateway is never lifted; a stored choice
that cannot be read leaves the browser paused locally.

Grant requests and enrollment wait until attach has completed on the
socket, so a refusal from a socket still attaching cannot wipe the
device. A created grant whose sites, agents or capabilities differ from
what the person approved is refused and withdrawn. A refresh that drops
a grant cancels its running commands, approvals included, with
grant_revoked.

A page result that cannot be reported after an interaction is
outcome_unknown, since the action may have run. Device names with line
or paragraph separators are refused, and an UNAUTHORIZED grant request
now explains both causes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrgoonie mrgoonie self-assigned this Oct 14, 2026
…y rules

A revoked grant reports grant_revoked also for a command in flight, and screenshot is refused when the run's workspace is shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrgoonie
mrgoonie merged commit 2508ce4 into main Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(browser): Chrome MV3 executor, relay connection và local control UI

1 participant