You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add precheck for CDP and Bridge mode availability
- CDP: curl WebSocket handshake on port 9222
- Bridge: curl Socket.IO on port 3766
- Route to Puppeteer if both unavailable
- Add implicit login state as CDP trigger
Copy file name to clipboardExpand all lines: skills/browser/SKILL.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,29 @@ This skill has three modes. Choose based on the user's intent:
46
46
| Mode | When to use | How it works |
47
47
|------|------------|-------------|
48
48
|**Puppeteer (default)**| User wants to browse a URL, scrape data, test UI — no need for their own browser | Launches a new headless Chrome, isolated from user's browser |
49
-
|**CDP mode**| User says "connect to my Chrome", "control my browser", "CDP", "remote debugging", or wants to operate their existing browser | Connects to user's Chrome via DevTools Protocol. Requires remote debugging enabled (`chrome://inspect` > "Allow remote debugging"). No extension needed |
49
+
|**CDP mode**| User says "connect to my Chrome", "control my browser", "CDP", "remote debugging", or wants to operate their existing browser. Also use when the task **implicitly requires login state** (e.g., "check my orders", "open my dashboard", "look at my account")| Connects to user's Chrome via DevTools Protocol. Requires remote debugging enabled (`chrome://inspect` > "Allow remote debugging"). No extension needed |
50
50
|**Bridge mode**| User explicitly mentions "bridge", "extension", or has Midscene Chrome Extension installed and prefers to use it | Connects to user's Chrome via the Midscene Chrome Extension |
51
51
52
52
**CDP vs Bridge**: Both control the user's real Chrome with login sessions preserved. CDP only needs a Chrome setting toggle; Bridge needs a Chrome Extension installed. If the user doesn't specify, prefer **CDP mode** as it has fewer prerequisites.
53
53
54
+
### Precheck: detect available connection modes
55
+
56
+
Before using CDP or Bridge mode, run a quick precheck to verify the target is reachable. This avoids long timeouts when the user hasn't enabled remote debugging or installed the extension.
57
+
58
+
```bash
59
+
# CDP precheck (port 9222, 2s timeout) — returns "101" if available
- CDP returns `101` → CDP mode is available, use `--cdp`
68
+
- Bridge returns `200` or `400` → Bridge extension is listening, use `--bridge`
69
+
- Both fail → fall back to Puppeteer mode, or ask the user to enable remote debugging
70
+
- Both available and user didn't specify → prefer CDP
71
+
54
72
## Prerequisites
55
73
56
74
Midscene requires models with strong visual grounding capabilities. The following environment variables must be configured — either as system environment variables or in a `.env` file in the current working directory (Midscene loads `.env` automatically):
0 commit comments