aboutsummaryrefslogtreecommitdiff
path: root/skills
diff options
context:
space:
mode:
authoramankumarsingh77 <amankumarsingh7702@gmal.com>2026-05-02 21:59:30 +0530
committeramankumarsingh77 <amankumarsingh7702@gmal.com>2026-05-02 21:59:30 +0530
commita1df2d3e0998e99176a4bfe3cffb83b9e6a2377e (patch)
treef84522e4f08fd6adeaf4954e09fc6e43a59d02f7 /skills
parentc9d1605b1e3b8dbe88cd3674a9256aa0465f3e6d (diff)
release: v0.3.1 — audit fixes for list_tabs IDs, switch_tab prefix matching, download auto-mkdir, session recovery, docs updates
Bug fixes: - list_tabs: show full 32-char targetIds (was truncated to 8 chars) - switch_tab: prefix matching fallback for hex prefixes >= 8 chars - download: auto-create directory with mkdir -p - ensureAlive: Runtime.evaluate probe to recover from crashed page targets Docs: - dispatch_key: clarify DOM-only event behavior - navigate: warn about Google anti-bot limitation - network_log: update deprecated promptSnippet - SKILL.md: document actual daemon API (evaluateJs, pageInfo, session.call) - SKILL.md: add troubleshooting for sharp/maxDim and Google navigation - sharp: add to optionalDependencies for screenshot maxDim auto-resize
Diffstat (limited to 'skills')
-rw-r--r--skills/pi-browser-harness/SKILL.md21
1 files changed, 17 insertions, 4 deletions
diff --git a/skills/pi-browser-harness/SKILL.md b/skills/pi-browser-harness/SKILL.md
index 59c236f..81a233c 100644
--- a/skills/pi-browser-harness/SKILL.md
+++ b/skills/pi-browser-harness/SKILL.md
@@ -130,7 +130,18 @@ The script is written to disk, so it's auditable and re-runnable.
**Script bindings:**
- `params` — the arguments passed to browser_run_script
-- `daemon` — browser daemon (daemon.cdp(), daemon.evaluateJS(), daemon.getPageInfo(), etc.)
+- `daemon` — browser daemon with these methods:
+ - `daemon.evaluateJs(expression)` — run JS in the current page
+ - `daemon.pageInfo()` — get current page info or dialog
+ - `daemon.listTabs()` — returns `{ success, data: [{ targetId, url, title }] }`
+ - `daemon.switchTab(targetId)` — switch to a tab by full targetId
+ - `daemon.newTab(url?)` — open and switch to a new tab
+ - `daemon.current()` — returns `{ targetId, url?, title? }`
+ - `daemon.session(targetId)` — returns a session object for raw CDP:
+ - `session.call(method, params?)` — CDP command on the page target
+ - `session.callOnTarget(method, params, sessionId)` — CDP on a specific session
+ - `session.callBrowser(method, params?)` — CDP on the browser target
+ - `session.takeDialog()` — get/dismiss pending dialog
- `require` — Node.js require() (use 'fs', 'path', 'crypto', etc.)
- `signal` — AbortSignal for cancellation
- `onUpdate` — progress callback: onUpdate({ content: [{ type: 'text', text: '...' }] })
@@ -140,9 +151,9 @@ The script is written to disk, so it's auditable and re-runnable.
**Example — a script that extracts structured data:**
```javascript
// /tmp/extract-products.js
-const info = await daemon.getPageInfo();
-if ("dialog" in info) throw new Error("Dialog is blocking: " + info.dialog.message);
-const data = await daemon.evaluateJS(`
+const info = await daemon.pageInfo();
+if (info && "dialog" in info) throw new Error("Dialog is blocking: " + info.dialog.message);
+const data = await daemon.evaluateJs(`
JSON.stringify(Array.from(document.querySelectorAll('${params.rowSelector}')).map(el => ({
title: el.querySelector('${params.titleSelector}')?.textContent?.trim(),
price: el.querySelector('${params.priceSelector}')?.textContent?.trim(),
@@ -196,6 +207,8 @@ browser_execute_js("!!document.querySelector('.loaded-content')")
- **Stale session**: Run `/browser-reload-daemon` to restart the daemon
- **Dialog blocking**: Run browser_page_info to detect it, then browser_handle_dialog
- **Status check**: Run `/browser-status` to see daemon health and current page
+- **Screenshot maxDim not working**: Install sharp (`npm install sharp`) for auto-resize support
+- **Google navigation fails**: Google's anti-bot detection may reject CDP navigation; use `browser_http_get` to fetch search results instead
## Architecture