feat(browser): Chrome 144+ auto-discovery via DevToolsActivePort#11
Merged
jackwener merged 1 commit intojackwener:mainfrom Mar 15, 2026
Merged
Conversation
Chrome 144+ allows enabling remote debugging from chrome://inspect without any command-line flags (--remote-debugging-port). Chrome writes the active port and browser GUID to a DevToolsActivePort file in the user data directory. This change reads that file to auto-discover the CDP WebSocket endpoint, eliminating the need for the Playwright MCP Bridge browser extension in most cases. Connection priority: 1. OPENCLI_CDP_ENDPOINT env var (manual override) 2. DevToolsActivePort auto-discovery (Chrome/Edge, cross-platform) 3. --extension mode fallback (original behavior) Supports Windows, macOS, and Linux with Chrome, Edge, and Chromium. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a757f32 to
55f71de
Compare
Owner
|
Thanks for the great contribution @backtime1993! 🎉 The PR has been merged. On top of your code, I made a few enhancements:
All tests pass ✅. Thanks again! |
jackwener
added a commit
that referenced
this pull request
Mar 19, 2026
P0 Critical: - #1 Fix double IIFE wrapping: unified wrapForEval() replaces normalizeEvaluateSource + ad-hoc wrap in page.evaluate() - #2 Fix navigate race: check tab.status before addListener, reduced timeout 30s→15s P1 Should Fix: - #8 Remove unused permissions (scripting, host_permissions, content_scripts) - #10 Add retry (3x, 500ms) + timeout (30s) to sendCommand() P2 Cleanup: - #3 Extract isWebUrl() to safely handle undefined tab.url - #4 Sanitize maxDepth with Math.max/min bounds - #6 Delete empty src/daemon/ directory - #7 Remove dead createJsonRpcRequest + its test - #9 Remove stale IIFE-mode comment - #11 Validate body.id in daemon request handler - #12 Guard ensureAttached: detach+re-attach on 'already attached' - #14 Extract _tabOpt() helper (removes 13x spread duplication) - #15 Add verbose warning for unsupported consoleMessages() All 35 unit tests pass.
jackwener
added a commit
that referenced
this pull request
Mar 19, 2026
P0 Critical: - #1 Fix double IIFE wrapping: unified wrapForEval() replaces normalizeEvaluateSource + ad-hoc wrap in page.evaluate() - #2 Fix navigate race: check tab.status before addListener, reduced timeout 30s→15s P1 Should Fix: - #8 Remove unused permissions (scripting, host_permissions, content_scripts) - #10 Add retry (3x, 500ms) + timeout (30s) to sendCommand() P2 Cleanup: - #3 Extract isWebUrl() to safely handle undefined tab.url - #4 Sanitize maxDepth with Math.max/min bounds - #6 Delete empty src/daemon/ directory - #7 Remove dead createJsonRpcRequest + its test - #9 Remove stale IIFE-mode comment - #11 Validate body.id in daemon request handler - #12 Guard ensureAttached: detach+re-attach on 'already attached' - #14 Extract _tabOpt() helper (removes 13x spread duplication) - #15 Add verbose warning for unsupported consoleMessages() All 35 unit tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chrome://inspect#remote-debugging— no--remote-debugging-portflag neededDevToolsActivePortfile in the user data directory--cdp-endpointinstead of--extensionHow it works
Connection priority
OPENCLI_CDP_ENDPOINTenv var (manual override)DevToolsActivePortauto-discovery (Chrome/Edge, cross-platform)--extensionmode fallback (original behavior, fully backward compatible)Platform support
Setup (for users)
chrome://inspect#remote-debuggingopencliwill auto-detect the running ChromeTest plan
opencli weibo hotworks correctly--extensionmode when Chrome is not running / feature disabled🤖 Generated with Claude Code