Skip to content

Add CDP attachment for running real browsers - #71

Merged
konard merged 6 commits into
mainfrom
issue-66-5981186aa8ce
Aug 2, 2026
Merged

Add CDP attachment for running real browsers#71
konard merged 6 commits into
mainfrom
issue-66-5981186aa8ce

Conversation

@konard

@konard konard commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • add connectBrowser(...) for attaching Playwright or Puppeteer to an existing CDP endpoint while preserving the { browser, page } contract used by Browser Commander
  • add launchAndConnectRealBrowser(...) to discover genuine installed Chrome, Edge, Brave, or Chromium binaries across Linux, macOS, and Windows, launch them with a dedicated profile, wait for CDP, and attach
  • support optional cookie/storage-state seeding for dedicated profiles, with loopback and default-profile safety checks
  • mirror CDP attachment in Rust (Chromiumoxide plus Playwright/Puppeteer bridges) and Python (Playwright plus Selenium), and document cross-language parity

Root cause and reproduction

Browser Commander only exposed managed browser launch paths. A caller with a genuine installed browser already listening on CDP had no supported way to obtain the same { browser, page } handle, and launching an automation-bundled browser does not satisfy sites that require a normal installed browser.

Before this change, importing or calling a browser connector failed because no connector API existed. A representative real-browser setup is:

google-chrome \
  --remote-debugging-address=127.0.0.1 \
  --remote-debugging-port=9222 \
  --user-data-dir=/tmp/browser-commander-cdp-profile
const { browser, page } = await connectBrowser({
  engine: "playwright",
  cdpEndpoint: "http://127.0.0.1:9222",
  seedCookies,
});

const commander = makeBrowserCommander({ page });

Chrome 136+ requires the remote-debugging profile to differ from the default browser profile. The launch helper enforces that boundary and never downloads or selects a bundled Chromium.

Verification

  • JavaScript: 498 tests; ESLint; Prettier; duplication check; generated JSDoc; changeset validation
  • Python: 256 tests; Ruff lint/format; mypy; file-size check
  • Rust: 150 unit tests and 6 doc tests; rustfmt; Clippy across all targets/features; file-size check
  • real installed Chrome smoke tests: JavaScript Playwright and Puppeteer; Rust Chromiumoxide, Playwright, and Puppeteer; Python Playwright
  • the smoke paths seed a cookie and drive makeBrowserCommander({ page }) against the connected page

This is a non-visual API change, so screenshots are not applicable.

Closes #66

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #66
@konard konard self-assigned this Aug 2, 2026
@konard konard changed the title [WIP] connectBrowser: attach to a running real browser over CDP (connectOverCDP / puppeteer.connect) Add CDP attachment for running real browsers Aug 2, 2026
@konard
konard marked this pull request as ready for review August 2, 2026 04:20
@konard

konard commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Working session summary

Implemented and finalized issue #66.

  • Added real-browser CDP attachment across JavaScript, Rust, and Python.
  • Added genuine installed-browser discovery, dedicated-profile safeguards, and cookie seeding.
  • Added regression tests, documentation, changelog fragments, and real Chrome smoke examples.
  • All local suites and real-browser smoke tests pass.
  • All 29 GitHub checks pass on commit ab5d6cb.
  • Branch is current with main, clean, pushed, and mergeable.
  • PR title/body updated and marked ready for review.

PR: #71

💰 Cost estimation:

  • Model: GPT-5.6 Sol
  • Provider: OpenAI
  • Public pricing estimate: $21.269639

📊 Context and tokens usage:

  • 509.4K / 200K (255%) input tokens, 71.0K / 128K (55%) output tokens

Total: (509.4K + 13.0M cached) input tokens, 71.0K output tokens, $21.269639 cost


This summary was automatically extracted from the AI working session output.

@konard

konard commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.6 Sol
  • Provider: OpenAI
  • Public pricing estimate: $21.269639

📊 Context and tokens usage:

  • 509.4K / 200K (255%) input tokens, 71.0K / 128K (55%) output tokens

Total: (509.4K + 13.0M cached) input tokens, 71.0K output tokens, $21.269639 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.6-sol
  • Thinking level: xhigh (~31999 tokens)
  • Model: GPT 5.6 Sol (gpt-5.6-sol)

📎 Log file uploaded as Gist (4867KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
konard merged commit b765736 into main Aug 2, 2026
29 checks passed
@konard

konard commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Auto-merged by hive-mind with --auto-merge flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connectBrowser: attach to a running real browser over CDP (connectOverCDP / puppeteer.connect)

1 participant