Files
Ryan Vogel 0bd901e7bb feat(browser-extension): connect the extension to its own relay as "agents"
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.
2026-10-06 10:18:48 -04:00

11 lines
227 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>OpenCode Browser recording</title>
</head>
<body>
<script type="module" src="./src/agent-relay/offscreen.ts"></script>
</body>
</html>