feat(skills): engine-generic browser skill with Browser Use 3.0 option

Merged
KI
3mo ago
+631-27

What & why

Makes the superset:browser skill engine-generic and adds Browser Use 3.0 as a selectable second engine — the same shape #6644 gave desktop control with the superset:computer skill and Cua Driver. Plus a desktop change so Browser Use (and any browser-level CDP client) can drive the in-app panes too.

Skill + docs (engine-generic browser skill)

  • keeps the in-app browser pane CDP path (superset browser via the Superset CLI) as the default engine — existing content and conventions preserved;
  • adds a Choose an engine routing section: in-app pane by default; Browser Use 3.0 for system-browser or standalone automation the panes can't reach;
  • Browser Use preflight asks before installing it or uv, and requires explicit consent before attaching to the user's signed-in Chrome profile (its default connection mode); otherwise routes to a scratch browser (BU_CDP_URL/BU_CDP_WS) or a Browser Use cloud browser (asks first; bills until stopped);
  • defers driving details to the engine's own reference (browser-use skill); keeps the shared Verify loop and an extended Safety section.

Desktop: Target-domain emulation on the pane CDP endpoint

Investigating whether Browser Use could drive an in-app pane surfaced a real incompatibility. superset browser cdp proxies verbatim to the pane's Electron guest debugger, which answers Target.getTargets with the whole process's target list — the web page is type: "webview" and the host app shell is a file:// type: "page". A browser-level client (browser-use, Playwright) looks for a type: "page", attaches to the shell, and reads an empty document.

browser-manager.ts now emulates the Target domain in the proxy: presents the pane as a single page target, maps the synthetic flatten session to the debugger's root channel (strip inbound, tag root events outbound), synthesizes attachedToTarget for setAutoAttach, treats createTarget as reuse (a single pane can't spawn tabs), and makes closeTarget a no-op so a client disconnect can't destroy the user's pane. The existing verbs and raw-CDP path are unchanged. This unlocks any browser-level CDP client against a pane, not just Browser Use.

Command + behavior verification

  • Browser Use commands verified live against browser-use 0.13.7 (uvx --python 3.12 --from 'browser-use[cli]' browser-use, isolated scratchpad): --help, --version, --doctor, skill, heredoc drive (new_tab/wait_for_load/page_info/js/cdp/click_at_xy), BU_CDP_URL/BU_CDP_WS, start_remote_daemon/stop_remote_daemon. --mcp from installed cli.py + official MCP docs. uv tool install browser-use + Python 3.12 from the CLI 3.0 changelog and CLI docs.
  • Target-domain shim verified end-to-end: real browser-use driving a live Superset pane through a standalone port of the exact shim logic — navigate, read, accessibility-tree targeting, click, and type all succeed (OUT: clicked:ada). The in-app version is the same logic relocated into the proxy.
  • bun run typecheck: passes in apps/docs and apps/desktop. biome check: clean on the edited file.

Refs #6644

Summary by CodeRabbit

  • New Features

    • Browser Use 3.0 can connect to Superset’s in-app browser panes, enabling automation for websites unavailable through native panes.
    • Browser connections provide improved compatibility with browser automation tools while preserving existing pane behavior.
    • Browser Use can be recommended for complex, autonomous, resilient, or recorded browser tasks.
  • Documentation

    • Added guidance for choosing browser engines, installing and connecting Browser Use, handling consent, protecting signed-in sessions, troubleshooting, and cleanup.
    • Clarified that Browser Use is optional third-party software and may expose signed-in Chrome sessions when attached.