Expand description
Shared Chrome browser-bridge contract.
This module is the single source of truth that ties together the four layers of the Roder Chrome integration:
- the Manifest V3 browser extension (
/Users/pz/w/roder-web-extention), which speaks the JSON bridge envelope described below over the remote WebSocket app-server; - the remote WebSocket transport in
roder-app-server(remote.rs), which registers each connected extension with theChromeBridgeand forwards commands to it; - the
chrome/*app-server methods, which callChromeController::dispatch; - the model-facing
chrome_*tools inroder-ext-chrome, which are generic over an injectedChromeControllerso they can be unit-tested against a fake bridge.
The single live ChromeBridge instance is reachable from every layer via
bridge, a process-global singleton (there is exactly one browser bridge
per Roder process). Keeping the bridge here in roder-api lets both
roder-app-server and roder-ext-chrome share it without roder-ext-chrome
depending on roder-core.
§Wire envelope
- Roder → extension (command):
{ "type": "<command>", "id": "<corr>", ...params } - extension → Roder (command result):
{ "type": "command/result", "id": "<corr>", "ok": bool, "result"?: any, "error"?: string } - extension → Roder (unsolicited event):
{ "type": "hello"|"state"|"tabs/list"|"tab/updated"|"page/snapshot"|"activity"|"chat"|"output"|"debug/console"|"debug/network", ... }
Browser page content, DOM text, console output and network metadata are
untrusted input and are tagged with untrusted: true so model prompts do
not treat page content as user or system instructions.
Structs§
- Chrome
Bridge - The live connection registry. One instance per process (see
bridge). - Chrome
Browser - A browser the extension can drive (Chrome is P0, Edge is P1).
- Chrome
Client Registration - Handle returned to the transport when an extension connects: the transport
drains
commandsand writes each frame to the socket. - Chrome
Command - A command Roder asks the extension to run.
kindis the wiretype(e.g."page/snapshot");paramsis merged into the outgoing frame. - Chrome
Site Permission - Per-origin site permission record stored by the extension.
- Chrome
Status - Snapshot of the connection, mirrored to TUI/CLI/SDK clients via
chrome/status. - Chrome
Tab - A tab visible to the extension.
Enums§
- Chrome
Error - Failure surface for browser commands.
- Chrome
Permission Mode - How aggressively Roder may act in the browser on the user’s behalf.
Constants§
- CHROME_
DISPATCH_ TIMEOUT - Default time a
dispatchwill wait for the extension to answer.
Traits§
- Chrome
Controller - Abstraction over the live browser bridge so model tools can be tested against
a fake. Implemented by
ChromeBridge.
Functions§
- bridge
- The process-global browser bridge. Every layer shares this instance.