Skip to main content

Module chrome

Module chrome 

Source
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 the ChromeBridge and forwards commands to it;
  • the chrome/* app-server methods, which call ChromeController::dispatch;
  • the model-facing chrome_* tools in roder-ext-chrome, which are generic over an injected ChromeController so 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§

ChromeBridge
The live connection registry. One instance per process (see bridge).
ChromeBrowser
A browser the extension can drive (Chrome is P0, Edge is P1).
ChromeClientRegistration
Handle returned to the transport when an extension connects: the transport drains commands and writes each frame to the socket.
ChromeCommand
A command Roder asks the extension to run. kind is the wire type (e.g. "page/snapshot"); params is merged into the outgoing frame.
ChromeSitePermission
Per-origin site permission record stored by the extension.
ChromeStatus
Snapshot of the connection, mirrored to TUI/CLI/SDK clients via chrome/status.
ChromeTab
A tab visible to the extension.

Enums§

ChromeError
Failure surface for browser commands.
ChromePermissionMode
How aggressively Roder may act in the browser on the user’s behalf.

Constants§

CHROME_DISPATCH_TIMEOUT
Default time a dispatch will wait for the extension to answer.

Traits§

ChromeController
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.