Conversation
…a an opt-in CDP relay Vendors oh-my-pi's browser-relay (MIT) as chrome-relay/: bridge.ts/protocol.ts byte-identical (one import-specifier delta, documented), server.ts is the Node port of the Bun original, and the MV3 extension gains a configurable host field (WSL2 NAT) with its esbuild bundle committed. scripts/chrome-relay.mjs adds the pi-agent-browser-chrome-relay bin (start/status/stop/token/extension-path, temp-file state). The wrapper tool itself is unchanged: connect ws://127.0.0.1:<port>/cdp is an ordinary upstream connect against the relay's Chrome discovery façade. Safety invariants inherited and pinned by test: loopback-only bind, Origin rejection on /cdp, chrome-extension:// origin + optional token on /ext, Browser.close never forwarded, chrome:// pages ineligible, 256 MiB max payload. Docs: docs/CHROME_RELAY.md (setup, Windows/WSL2 NAT recipes, security model) plus cross-links in README, COMMAND_REFERENCE, ARCHITECTURE, SUPPORT_MATRIX (RQ-0153). Offline coverage: test/chrome-relay.sidecar.test.ts (10 cases, fake extension + fake CDP peers, no Chrome in the default gate).
480efea to
3cf9fd1
Compare
|
**Phase 2 dogfood evidence (Tasks 2.1–2.2) Rebase (2.1) — rebased onto 40e1c2a (v0.7.0); one conflict resolved (
Linux gauntlet (2.2) — packaged sidecar (
Observed: the sidecar CLI passes no logger into the bridge, so connection events go unseen ( Windows leg (2.3) in progress — operator Load-unpacked pending; NAT docs fix (2.4) and merge (2.5) follow its result. |
…tab guidance Dogfood findings from the live Windows-Chrome validation: - docs/CHROME_RELAY.md: the WSL2 section now documents the VALIDATED recipe — 127.0.0.1 + localhostForwarding works as-is; socat-in-WSL is the fallback; direct WSL-IP dialing is refused by the loopback bind (previous advice was wrong). Adds adopted-browser tab semantics (open navigates the session's current tab; close tabs by explicit tN; close --all ends only the session) and notes status/stop track the most recent start. - scripts/chrome-relay.mjs: --token-gen now prints the token once so the documented options-page flow is actually usable.
|
**Phase 2 dogfood evidence (Tasks 2.3–2.4) — Windows leg, operator's real Chrome No-token connect: extension Loaded-unpacked from the staged folder → Real-tab adoption: Incident → fix → docs: upstream wrapper semantics bit on an adopted browser: Token round: relay restarted with Grouping: tab-strip visual confirmation still pending from the operator (headless can't show it); noted as the one open observation. Task 2.4 shipped in f99ea0a: NAT section rewritten to the validated recipe (localhostForwarding primary; socat-in-WSL fallback; why direct WSL-IP dialing is refused by the loopback bind — the previous advice was wrong), adopted-browser tab-semantics section, Both connect modes validated. Ready to merge. |
Summary
Phase 1 of the Chrome adoption plan: vendor oh-my-pi's browser-relay (MIT) as an opt-in sidecar so
agent-browser connect ws://127.0.0.1:9224/cdpcan drive the user's real, headed Chrome (signed-in sessions, extensions) through an MV3chrome.debuggerextension — no--remote-debugging-port, which Chrome 136+ blocks on default profiles anyway.Changes
chrome-relay/:bridge.ts/protocol.tsvendored verbatim (single documented import-specifier delta),server.ts= Node port of the Bun original (same routes, 503→200 discovery impersonation, 256 MiB max payload, 30 s pings, loopback-only bind),promises.d.ts(ES2024 decl),VENDOR.md+LICENSE(attribution verified against upstream package.json: MIT © Stencil Labs, Inc.)chrome-relay/extension/: manifest/options verbatim;background.tsgains a configurable bare-host relay address (WSL2 NAT) — builtbackground.jscommittedscripts/chrome-relay.mjs→pi-agent-browser-chrome-relaybin:start/status/stop/token/extension-path, temp-file state, token never loggedpackage.json: new bin + files entries;wsruntime dep,@types/wsdev depdocs/CHROME_RELAY.md(setup incl. Windows/WSL2 NAT recipes + security model) + cross-links in README, COMMAND_REFERENCE (human region — baseline check green), ARCHITECTURE, SUPPORT_MATRIX RQ-0153test/chrome-relay.sidecar.test.ts: 10 offline cases through the real vendored bridge with fake extension/CDP peers — discovery 503→200, minted PAGE ids, chrome:// hidden, Target.* emulation, forwarded-command round-trip via extension rpc, Browser.close refusal, Origin-403, token-401, loopback bind, targetCreated fan-outSafety invariants (pinned by test)
loopback-only bind · Origin rejection on /cdp · chrome-extension:// origin + optional shared token on /ext · Browser.close acknowledged but never forwarded · chrome:// pages ineligible · 256 MiB max payload
Test plan
npx tsx --test test/chrome-relay.sidecar.test.ts— 10/10 passnpm test(builds dist, 1220 tests): zero regressions — the 6 failures reproduce identically on pristineHEAD(verified in a clean worktree: Electron path checks, HOME pinning, startup-arg env leakage on this box, plus theparser.derefkeep-alive flake in extension-ref-guards which fails on baseline runs too)npm run docs -- command-reference check— in syncchrome://extensionsload — steps in docs/CHROME_RELAY.md)