mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
OpenCode Browser lets AI agents use the user's real Chromium browser (Chrome, Edge, Brave, Opera, Vivaldi, Chromium, Helium, Arc). It has no chat UI: agents drive it through the `browse` MCP server (added in the next commit), which talks to it through a local relay: agent - browse MCP (stdio) - relay 127.0.0.1:19988 - WebSocket - extension The extension (src/): - background/agent-relay.ts: the WebSocket link to the relay. Runs its commands (CDP through chrome.debugger, tabs, groups, badges, tab-capture recordings) and reports tab events; reconnects with backoff; survives an extension reload or worker restart by re-attaching its tabs (debugger-hub.ts). Commands it doesn't know get an error reply instead of leaving the relay waiting. - agent-groups.ts, tab-cleanup.ts: agent tabs are grouped under the session's name at the start of the tab strip, collapsed unless the user is looking at one; agent tabs nobody uses for 10 minutes close. - background/index.ts: the toolbar button lets agents use the current tab, or stops them (badge ON / RUN / WAIT). - content/page-status.ts: the in-page banner while an agent works or waits for a handoff (login, 2FA, payment), with Continue. - status/ (welcome.html, also the options page): install command, relay connection, reconnect, close agent tabs, copy diagnostics. Permissions: debugger, tabs, tabGroups, storage, alarms, offscreen and tabCapture (recordings), <all_urls> (agents work on any site the user asks; the banner content script). The manifest key pins the unpacked ID (afeafocngkodbmaipcngoamamfmekgfo); the store build is mfnicocicmmlkpjnaffgihfjhdgjkdjg. store/ holds the Web Store listing and privacy policy; scripts/package.ts builds the store zip. Verified: typecheck, lint, build; loaded in a clean headless Chrome (status page connects, no worker errors) and in Helium, driven through the browse MCP tools.
52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>OpenCode Browser</title>
|
|
<link rel="stylesheet" href="./src/status/status.css" />
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<header>
|
|
<img src="/icons/icon-48.png" width="32" height="32" alt="" />
|
|
<h1>OpenCode Browser</h1>
|
|
</header>
|
|
<p class="lead">
|
|
Lets your AI agents use this browser through the <code>browse</code> MCP tools: open and drive tabs, run
|
|
Playwright, take screenshots, record, and hand off to you for logins.
|
|
</p>
|
|
|
|
<section>
|
|
<h2>Set up</h2>
|
|
<p>Run this once in a terminal. It adds the <code>browse</code> tools to opencode.</p>
|
|
<div class="command">
|
|
<code id="install-command">npx opencode-browser-cli install</code>
|
|
<button type="button" id="copy-command">Copy</button>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Status</h2>
|
|
<p class="status" id="status" data-state="offline">Checking…</p>
|
|
<div class="actions">
|
|
<button type="button" id="reconnect">Reconnect</button>
|
|
<button type="button" id="cleanup">Close agent tabs</button>
|
|
<button type="button" id="diagnostics">Copy diagnostics</button>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Using it</h2>
|
|
<ul>
|
|
<li>Agents open their own tabs, grouped at the top of the tab strip. Tabs nobody uses for 10 minutes close.</li>
|
|
<li>To let agents use a tab you have open, click the OpenCode Browser toolbar button on it. Click again to stop.</li>
|
|
<li>When an agent needs you (a login, 2FA, a payment), the page shows a banner. Finish, then click Continue.</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<footer>Extension ID <span id="extension-id"></span></footer>
|
|
</main>
|
|
<script type="module" src="./src/status/status.ts"></script>
|
|
</body>
|
|
</html>
|