Skip to content

desktop: let agents drive browser displays over a scoped CDP endpoint #156

Closed

Description

@yansfil

Why

An agent should drive the same browser display the operator is watching, and the operator can take over with the mouse at any point.
hide should not ship its own automation engine: a standard CDP endpoint lets the agent bring an existing client, none of which needs Playwright.

Clients this must work with

  • hide browser (hide browser: agent page commands built from chromux's page logic #159): hide's own agent commands, built from chromux's page logic; the default path for agents.
  • agent-browser --cdp <url> (vercel-labs/agent-browser): a native Rust CLI that speaks CDP directly, with no Playwright or Node runtime; snapshot with refs, click, fill, screenshot.
  • chrome-devtools-mcp --browser-url <url>.
  • Playwright chromium.connectOverCDP(url) and Browser Use BU_CDP_URL, for agents that already use them.

Scope

  • The desktop main process serves a loopback CDP gateway in front of Electron's debugging endpoint, scoped to browser displays: /json/version, /json/list and the Target domain list only browser-display targets, attaching to the shell's own renderer is refused, and a client's new-target request opens a new browser display in the same View area.
  • Design reference: the view-scoped gateway in Herdr's official.browser plugin (ogulcancelik/herdr-browser src/cdpGateway.ts, MIT).
  • hide browser connect [--display <id>] prints cdp_http_url and browser_ws_url, and hide browser open returns them too.
  • The endpoint grants full control of browser content: loopback only, and the PRD decides whether it also needs a per-launch token that the clients above still accept.
  • The area tab marks a display an agent is attached to; the operator keeps full control while it is attached.
  • An agent-facing doc with one working invocation per client.

Considered

  • ego lite (citrolabs/ego-lite): its ego-browser runtime calls native bindings built into its own Chromium build (docs/native-bindings-api.md), so it cannot drive hide's Electron views.
    Its per-agent Spaces and code-based tool calls stay design references.

Done when

  • agent-browser --cdp and chrome-devtools-mcp each open a page, snapshot, click and type in a display the operator sees, and the shell's own target never appears in either client's target list.
  • Closing the client leaves the display open, and closing the display ends the client's session on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions