cdpilot 0.4.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,6 +86,39 @@ npx cdpilot launch # Start browser with CDP enabled
86
86
  npx cdpilot status # Check connection
87
87
  ```
88
88
 
89
+ ### Upgrading from 0.4.x → 0.5.0 — read this first
90
+
91
+ **One breaking change**, the rest is additive.
92
+
93
+ **Breaking — Visual feedback default flipped to OFF.** The green glow border,
94
+ animated fake cursor, click ripples, and keystroke display made cdpilot feel
95
+ like an amateur typing on every page. They are now opt-in:
96
+
97
+ ```bash
98
+ cdpilot show on # restore the old visual feedback layer
99
+ cdpilot show off # default since 0.5.0
100
+ ```
101
+
102
+ The MCP server's persistent-glow flow (`CDPILOT_MCP_SESSION=1`) is **unchanged**
103
+ — AI agents that rely on visible feedback during a session still see it
104
+ automatically. Only direct-CLI users see the difference.
105
+
106
+ **New in 0.5.0** (no migration needed):
107
+
108
+ - `cdpilot dismiss` — heuristic auto-click for "Stay signed out / No thanks"
109
+ buttons on LLM chat sign-up walls.
110
+ - `cdpilot adaptive on` — auto-escalate to stealth on CAPTCHA-protected
111
+ hosts, with persistent per-host memory.
112
+ - `cdpilot cookies save/load` — export/import cookies as JSON to replay
113
+ CF/DataDome clearance across runs.
114
+ - `cdpilot context create/list/close` + `CDPILOT_TARGET` — isolated browser
115
+ contexts for true parallel automation inside a single browser.
116
+ - `cdpilot fast` / `cdpilot show` — bundled timing + visual toggles.
117
+ - Pure performance: post-load sleep 1500ms → 300ms, `scrollIntoView` instant,
118
+ WebSocket connection pool, `/json` TTL cache.
119
+
120
+ See [CHANGELOG.md](CHANGELOG.md) for the full list with rationale.
121
+
89
122
  ## Commands
90
123
 
91
124
  ### Navigation & Content
@@ -119,8 +152,50 @@ cdpilot network [url] # Monitor network requests
119
152
  cdpilot debug [url] # Full diagnostic (console+network+perf+shot)
120
153
  cdpilot perf # Performance metrics
121
154
  cdpilot eval <js> # Execute JavaScript
155
+ cdpilot eval-batch <json> # Run N JS expressions in 1 roundtrip (5-30x faster)
156
+ ```
157
+
158
+ ```bash
159
+ # Example: read 4 DOM values in a single CDP roundtrip instead of 4
160
+ cdpilot eval-batch '["document.title","location.href","document.links.length","document.images.length"]'
161
+ # → [{"ok":true,"value":"..."}, {"ok":true,"value":"..."}, ...]
162
+ ```
163
+
164
+ ### Performance
165
+
166
+ ```bash
167
+ cdpilot block # Show status
168
+ cdpilot block on # Enable (default preset: images+fonts+ads)
169
+ cdpilot block off # Disable
170
+ cdpilot block preset images,fonts,ads,media # Set patterns from named presets
171
+ cdpilot block patterns '*.png' '*.woff2' # Custom URL patterns
172
+ cdpilot block clear # Drop all patterns
173
+ ```
174
+
175
+ > **Stealth caveat:** `block` changes the fingerprint surface — real browsers fetch
176
+ > images, fonts, and analytics. Cloudflare-class bot detectors notice missing
177
+ > requests. Keep `block` **off** for stealth/anti-bot targets; turn it **on** for
178
+ > known-safe internal sites where speed matters more than blending in.
179
+
180
+ ```bash
181
+ cdpilot fast # Show status (effective auto-wait ms)
182
+ cdpilot fast on # Auto-wait 5s → 2s, less idle padding
183
+ cdpilot fast off # Back to defaults
184
+ CDPILOT_WAIT_MS=1000 cdpilot click # Per-command override (env wins over fast mode)
122
185
  ```
123
186
 
187
+ ```bash
188
+ cdpilot show # Show status (visual feedback on/off)
189
+ cdpilot show on # Re-enable glow border + cursor + ripples + keystrokes
190
+ cdpilot show off # Default since 0.4.4 — quiet, professional output
191
+ ```
192
+
193
+ > **Visual feedback default changed in 0.4.4** — the old animations (green glow,
194
+ > moving cursor, click ripples) used to make every action look like an amateur
195
+ > driving the screen. They're now opt-in via `cdpilot show on`. The MCP server's
196
+ > persistent-glow flow (`CDPILOT_MCP_SESSION=1`) is unaffected — AI agents that
197
+ > rely on visible feedback during a session still see it automatically.
198
+
124
199
  ### Tab Management
125
200
 
126
201
  ```bash
@@ -189,7 +264,10 @@ cdpilot session-close [id] # Close session
189
264
  ### Advanced
190
265
 
191
266
  ```bash
192
- cdpilot cookies [domain] # List cookies
267
+ cdpilot cookies [domain] # List cookies (filter by domain)
268
+ cdpilot cookies save <file> [<domain>]
269
+ # Export cookies as JSON (optional domain filter)
270
+ cdpilot cookies load <file> # Import cookies (replay CF clearance across runs)
193
271
  cdpilot storage # localStorage contents
194
272
  cdpilot upload <sel> <file> # Upload file to input
195
273
  cdpilot multi-eval <js> # Execute JS in all tabs
@@ -199,6 +277,36 @@ cdpilot dialog auto-accept # Auto-accept dialogs
199
277
  cdpilot permission grant geo # Grant geolocation
200
278
  ```
201
279
 
280
+ ### Parallel Contexts
281
+
282
+ ```bash
283
+ cdpilot context create [url] # Make fresh browser context + tab (prints JSON)
284
+ cdpilot context list # Tree of contexts and their tabs
285
+ cdpilot context close <ctx> # Destroy a context (refuses 'default')
286
+ ```
287
+
288
+ Address a specific context's tab in subsequent commands via the env pin:
289
+
290
+ ```bash
291
+ ID=$(cdpilot context create https://example.com | jq -r .target_id)
292
+ CDPILOT_TARGET=$ID cdpilot eval 'document.title'
293
+ ```
294
+
295
+ > True isolation — each context has its own cookie/storage jar. Designed for
296
+ > running N AI chat queries in parallel without history pollution, or A/B
297
+ > testing logged-in vs logged-out flows without spinning up multiple browsers.
298
+
299
+ ### Smart Navigation (LLM-aware)
300
+
301
+ ```bash
302
+ cdpilot dismiss # Click best "Stay signed out / No thanks" button
303
+ cdpilot dismiss aggressive # Handle chained modals (cookie banner → signup)
304
+ ```
305
+
306
+ > Built-in English + Turkish pattern library. Explicitly excludes destructive
307
+ > lookalikes (Delete account, Sign out, Subscribe) — safe to chain into a
308
+ > query workflow.
309
+
202
310
  ### Stealth & CAPTCHA
203
311
 
204
312
  Zero-dependency anti-fingerprint layer — patches `navigator.webdriver`,
@@ -216,8 +324,20 @@ cdpilot captcha-check # JSON detection of Turnstile/hCaptcha/reCAPTCHA/
216
324
  # DataDome/PerimeterX/Arkose/GeeTest. Exit 0/3
217
325
  cdpilot captcha-wait [sec] # block until user solves (interactive)
218
326
  # or poll with JSON stream (non-interactive)
327
+
328
+ cdpilot adaptive [on|off|status]
329
+ # Auto-escalate to stealth on hosts that show
330
+ # CAPTCHA. Persistent per-host memory.
331
+ cdpilot adaptive forget <host>
332
+ # Remove a hostname from the stealth list
333
+ cdpilot adaptive clear # Drop the stealth host memory entirely
219
334
  ```
220
335
 
336
+ > **Adaptive mode** is the "run fast, climb walls when seen" automation: cdpilot
337
+ > runs in the open lane by default, detects CAPTCHA after each navigation, and
338
+ > when it sees one — adds the host to a persistent list, retries once with
339
+ > stealth on. Never auto-demotes. Conservative by design.
340
+
221
341
  Verified against public bot-detection panels:
222
342
  - **bot.sannysoft.com:** 24/24 PASS (WebDriver, Chrome obj, Plugins as PluginArray, WebGL, PHANTOM_*, HEADCHR_*, SELENIUM_DRIVER)
223
343
  - **bot.incolumitas.com** intoli: 6/6 OK — new-tests: 6/7 OK (one FAIL = pure CDP presence, cannot be JS-patched)
@@ -347,6 +467,15 @@ The only browser MCP with built-in test assertions. Here's what we've shipped an
347
467
  - [x] **Vision fallback** (`describe`) — a11y + screenshot + text in one call
348
468
  - [x] **Annotated screenshots** — @N badge overlays on interactive elements
349
469
  - [x] **Auto-wait** — MutationObserver-based, 5s automatic element waiting
470
+ - [x] **`wait-for-text`** — adaptive text-based waiting (subtree + characterData) for streaming AI responses, async toasts, and selector-less synchronization
471
+ - [x] **`eval-batch`** — run N JS expressions in 1 CDP roundtrip (5-30x speedup vs sequential `eval`)
472
+ - [x] **`block`** — request blocking via `Network.setBlockedURLs` with built-in presets (images/fonts/ads/media), 3-10x faster page loads on opt-in
473
+ - [x] **`dismiss`** — heuristic auto-click for LLM chat sign-up walls (EN+TR pattern library, destructive-action guards)
474
+ - [x] **`adaptive`** — auto-escalate to stealth on CAPTCHA-protected hosts, persistent per-host memory ("run fast, climb walls")
475
+ - [x] **`cookies save/load`** — export/import cookies as JSON (replay CF/DataDome clearance across runs)
476
+ - [x] **`context` pool + `CDPILOT_TARGET`** — isolated browser contexts for true parallel automation in a single browser (Playwright's parallel-tabs model)
477
+ - [x] **`fast` / `show`** — bundled timing + visual toggles. Default quiet/fast in 0.5.0
478
+ - [x] **WebSocket pool + `/json` TTL cache** — zero-regression connection reuse for MCP/batch workloads
350
479
  - [x] **Batch commands** — pipe JSON arrays via stdin for multi-step automation
351
480
  - [x] Visual feedback system (persistent green glow, cursor, ripples, keystroke display)
352
481
  - [x] AI control warning toast (red warning when user interacts during automation)
package/bin/cdpilot.js CHANGED
@@ -318,16 +318,45 @@ function showHelp() {
318
318
  network [url] Monitor network requests
319
319
  debug [url] Full diagnostic
320
320
  eval <js> Execute JavaScript
321
+ eval-batch <json> Run N JS expressions in 1 roundtrip (perf)
322
+
323
+ PERFORMANCE
324
+ block [on|off|preset|patterns|clear]
325
+ Block requests via Network.setBlockedURLs (perf opt-in,
326
+ breaks fingerprint plausibility — not for stealth targets)
327
+ fast [on|off] Fast mode — auto-wait 5s→2s (env CDPILOT_WAIT_MS overrides)
328
+ show [on|off] Visual feedback (glow + cursor + ripples).
329
+ Default OFF since 0.4.4 — opt-in for "see automation" mode.
330
+
331
+ SMART NAVIGATION
332
+ dismiss [N|aggressive]
333
+ Click best "Stay signed out / No thanks / Skip" button.
334
+ English + Turkish patterns; never clicks destructive
335
+ lookalikes (Delete account, Sign out, Subscribe).
336
+ Pass N (1-10) or "aggressive" for chained modals.
321
337
 
322
338
  TABS
323
339
  tabs List open tabs
324
340
  new-tab [url] Open new tab
325
341
  close-tab [id] Close tab
326
342
 
343
+ PARALLEL CONTEXTS (isolated cookies/storage inside one browser)
344
+ context create [url] Make a fresh browser context + tab; prints JSON
345
+ context list List all browser contexts and their tabs
346
+ context close <ctx-id> Destroy a browser context (closes all its tabs)
347
+ (Address a context's tab in subsequent commands via CDPILOT_TARGET=<tgt-id>)
348
+
327
349
  STEALTH & CAPTCHA
328
350
  stealth [on|off] Toggle anti-fingerprint patches (opt-in)
329
351
  captcha-check Detect CAPTCHA on active page (JSON output)
330
352
  captcha-wait [s] Pause until user solves CAPTCHA (default 300s)
353
+ adaptive [on|off] Auto-escalate to stealth on hosts that show CAPTCHA.
354
+ Remembers per-host. Use 'adaptive forget <host>' to reset.
355
+ cookies save <file> [<dom>]
356
+ Export cookies (all or scoped). Replay clearance cookies
357
+ across cdpilot runs to skip Cloudflare walls.
358
+ cookies load <file>
359
+ Import previously-saved cookies into the current jar.
331
360
 
332
361
  RELIABILITY
333
362
  browser [name] Show or set preferred browser (chrome|brave|chromium|edge|vivaldi|auto)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdpilot",
3
- "version": "0.4.4",
3
+ "version": "0.5.0",
4
4
  "description": "Zero-dependency browser automation from your terminal. One command, full control.",
5
5
  "bin": {
6
6
  "cdpilot": "./bin/cdpilot.js",