The extension's relay link now talks to OpenCode Browser's relay
(ws://127.0.0.1:19988, protocol 2) and nothing in the extension refers to
Browser Control:
- Renamed browser-control.ts / src/browser-control / browser-control.tsx to
agent-relay.ts / src/agent-relay / agents.tsx; panel, welcome tab, page
pill and card, badges, and the toolbar menu ("Let agents use this tab")
speak of agents. Storage keys are agentRelayPort/agentRelayProfile.
- Synced with upstream's extension at 8c80ac2: removes other extensions'
frames and password-manager overlays (1Password closed shadow hosts,
LastPass) while attached or running, re-attaches after a target_closed
detach, retries CDP calls that hit an extension frame or a lost debugger,
falls back to tabs.update for Page.navigate, names tab groups after the
agent session, and ports the offscreen recording cleanup. profile.rename
is gone (the relay no longer sends it).
- The "rejected" status is removed (our relay accepts our IDs);
"incompatible" now says to run `npx opencode-browser-cli install`.
- Reliability: reconnects back off exponentially (0.5s to 15s, +/-25%
jitter) with a 10s connect timeout, listeners register once per worker,
and per-connection timers are cleared on close.
- Logging: a 500-entry relay event log (connects, close codes, backoff,
slow or failed commands) in memory and chrome.storage.session, with Copy
diagnostics in the agents menu, the problem notice, and the welcome tab.
- Agent guidance points at browser.* for the user's tabs and describes the
opencode-browser MCP server as part of the same product.
Verified: typecheck, build, lint, and no "browser control"/19989 matches.
Headless Chrome for Testing against an isolated relay: status connected,
execute returned example.com's title, a handoff completed from the page's
Continue, a default-mode recording wrote a 2.6 MB webm, "Let agents use this
tab" attached a user tab, password-manager overlays were removed (synthetic
elements), and the link reconnected about 3s after a relay restart. Light
and dark screenshots checked. The target_closed re-attach path was not
exercised.
opencode Browser now connects to the local Browser Control relay
(ws://127.0.0.1:19989/extension, protocol 2) and runs its commands, so the
relay's CLI, MCP server, and Playwright execute drive tabs through this
extension instead of the separate Browser Control extension.
- debugger-hub.ts: one chrome.debugger attachment per tab shared by owners
(each opencode page and the relay); the tab detaches with its last owner.
cdp.ts now attaches through it instead of calling chrome.debugger directly.
- browser-control.ts: relay link ported from browser-control's background
(hello with a stored profile id, debugger/tab/group/badge/page-status/profile
and recording commands, events only for relay-owned tabs, reconnect with
backoff, /version probe to tell "not running" from "refused").
- Recording: offscreen document + tabCapture ported verbatim; frames encoded
with the relay's BCRD format.
- content.js (separate IIFE build): in-page status pill and "Your turn"
handoff card in opencode's style; restyles the relay's ghost cursor.
- Badge shows ON/RUN/WAIT for relay tabs, else the site-script count. The
toolbar still opens the panel; "Let Browser Control use this tab" moved to
the icon's context menu. First install opens welcome.html (placeholder).
- Manifest adds offscreen, tabCapture, activeTab, contextMenus and the
content script.
Verified: typecheck, build, and lint pass. Headless Chrome for Testing with an
isolated relay on port 19990: `browser-control status` reports the extension
connected (protocol 2, profile "opencode Browser"); `browser-control execute`
opened example.com, hovered a link, returned the title; the page showed the
status pill and the panel received the relay tab state.