feat: add desktop CDP connection management#75
Open
Pleasurecruise wants to merge 1 commit intojackwener:mainfrom
Open
feat: add desktop CDP connection management#75Pleasurecruise wants to merge 1 commit intojackwener:mainfrom
Pleasurecruise wants to merge 1 commit intojackwener:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces managed Chrome DevTools Protocol (CDP) connection handling for desktop Electron “sites”, adding CLI commands to save/remove endpoints and wiring the saved endpoint into Playwright MCP sessions.
Changes:
- Add
opencli connect <site>/opencli disconnect <site>commands that persist CDP endpoints for supported desktop apps. - Route “desktop CDP commands” through a saved
cdpEndpointpassed intobrowserSession/PlaywrightMCP.connect. - Update desktop adapter READMEs to use
opencli connect ...instead of exporting CDP env vars.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/runtime.ts | Extends browser session connection options to accept a CDP endpoint. |
| src/main.ts | Adds connect/disconnect commands and uses saved endpoints for desktop CDP commands. |
| src/connections.ts | New module for persisting endpoints, probing CDP availability, and building “disconnected” status output. |
| src/browser/mcp.ts | Allows overriding the resolved CDP endpoint via connect({ cdpEndpoint }). |
| src/clis//README.md | Updates setup instructions to use the new connect command. |
| .gitignore | Ignores .idea/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduce managed CDP connections for desktop Electron apps: add a new connections module (src/connections.ts) to save, probe and resolve CDP endpoints, plus unit tests (src/connections.test.ts). Add CLI commands connect/disconnect in main.ts to persist endpoints and validate reachability, and update dynamic command execution to use resolved CDP endpoints for desktop sites. Propagate cdpEndpoint through runtime.browserSession and PlaywrightMCP.connect (src/runtime.ts, src/browser/mcp.ts). Update multiple README files to instruct using `opencli connect <site>`, and ignore .idea in .gitignore.
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.
Problem
Electron desktop adapters in opencli previously relied on manually configured CDP environment variables (e.g.,
OPENCLI_CDP_ENDPOINT). When a globalPLAYWRIGHT_MCP_EXTENSION_TOKENwas set, desktop commands could incorrectly fall back to Playwright extension mode.What This Change Introduces
New Commands
opencli connect <site>— validates and saves the app's CDP endpoint to~/.opencli/connections.jsonopencli disconnect <site>— removes the saved connection for a given siteTechnical Changes
src/connections.ts— manages saved CDP endpoints, probes live connectivity, and provides per-site defaultssrc/main.ts— addsconnectanddisconnectcommandsPlaywrightMCPand runtime — updated to accept an optionalcdpEndpointopencli connect <site>instructions.gitignore— adds.idea/Future Extension
Can consider add an auto-launch layer on top of
connect:The current workflow requires the target Electron app to already be running with
--remote-debugging-port. The next logical step is to haveopencli connect <site>automatically launch the app in the background, wait for the CDP endpoint to become available, and then persist the connection — evolving the current "connect to a running app" workflow into a full "launch + connect" experience.