High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat: auto-update skill files on npm install/update (#349)
Alice Losasso11948748380f
diff --git a/npm/bin/pinchtab b/npm/bin/pinchtabindex a4bf237b..e367fcd3 100755--- a/npm/bin/pinchtab+++ b/npm/bin/pinchtab@@ -43,6 +43,61 @@ function getBinaryPath() {return path.join(os.homedir(), '.pinchtab', 'bin', getBinaryName());}+// Handle `pinchtab skill update` at the Node.js level (no Go binary needed)+const args = process.argv.slice(2);+if (args[0] === 'skill' && (args[1] === 'update' || args[1] === 'sync')) {+ try {+ const { syncSkills } = require('../scripts/sync-skills');+ console.log('Syncing Pinchtab skill files...\n');+ const { updated, skipped } = syncSkills({ verbose: true });++ if (updated.length > 0) {+ console.log(`\n✓ Updated ${updated.length} skill director${updated.length === 1 ? 'y' : 'ies'}`);+ } else {+ console.log('\nNo agent skill directories found to update.');+ console.log('Skill directories are synced only where agents are already installed.');+ }++ if (skipped.length > 0) {+ console.log(`⚠ Skipped ${skipped.length} (permission errors)`);+ }+ } catch (err) {+ console.error(`Failed to sync skills: ${err.message}`);+ process.exit(1);+ }+ process.exit(0);+}++if (args[0] === 'skill' && args[1] === 'list') {+ try {+ const { getTargetSkillDirs, getBundledSkillsDir } = require('../scripts/sync-skills');+ const bundled = getBundledSkillsDir();+ console.log(`Bundled skills: ${fs.existsSync(bundled) ? bundled : '(not found)'}`);+ console.log('\nDetected agent skill directories:');+ const targets = getTargetSkillDirs();+ if (targets.length === 0) {+ console.log(' (none found)');+ } else {+ targets.forEach((t) => {+ const exists = fs.existsSync(t);+ console.log(` ${exists ? '●' : '○'} ${t}${exists ? '' : ' (will be created on sync)'}`);+ });+ }+ } catch (err) {+ console.error(`Failed to list skills: ${err.message}`);+ process.exit(1);+ }+ process.exit(0);+}++if (args[0] === 'skill') {+ console.log('Usage: pinchtab skill <command>\n');+ console.log('Commands:');+ console.log(' update Sync bundled skill files to agent directories');+ console.log(' list Show detected agent skill directories');+ process.exit(0);+}+const binaryPath = getBinaryPath();// Check binary existsdiff --git a/npm/package.json b/npm/package.jsonindex 44c913b8..e4ca2e7b 100644--- a/npm/package.json+++ b/npm/package.json@@ -23,6 +23,8 @@"dist/src","bin","scripts/postinstall.js",+ "scripts/sync-skills.js",+ "skills","LICENSE"],"keywords": [diff --git a/npm/scripts/postinstall.js b/npm/scripts/postinstall.jsindex bac8d42c..48945708 100644--- a/npm/scripts/postinstall.js+++ b/npm/scripts/postinstall.js@@ -369,6 +369,19 @@ async function downloadBinary(platform, version) {}}+ // Sync bundled skill files to detected agent directories+ try {+ const { syncSkills } = require('./sync-skills');+ const { updated } = syncSkills({ verbose: false });+ if (updated.length > 0) {+ console.log(+ `✓ Synced skill files to ${updated.length} agent director${updated.length === 1 ? 'y' : 'ies'}`+ );+ }+ } catch (_err) {+ // Non-fatal: skill sync failure shouldn't block install+ }+console.log('✓ Pinchtab setup complete');process.exit(0);} catch (err) {diff --git a/npm/scripts/sync-skills.js b/npm/scripts/sync-skills.jsnew file mode 100644index 00000000..1bb4f770--- /dev/null+++ b/npm/scripts/sync-skills.js@@ -0,0 +1,136 @@+#!/usr/bin/env node++/**+ * Syncs bundled skill files to detected agent skill directories.+ * Only updates directories that already exist (doesn't create new ones).+ *+ * Used by:+ * - postinstall (automatic on npm install/update)+ * - `pinchtab skill update` (manual trigger)+ */++const fs = require('fs');+const path = require('path');+const os = require('os');++const SKILL_NAME = 'pinchtab';++/**+ * Returns the path to the bundled skills directory inside the npm package.+ */+function getBundledSkillsDir() {+ return path.join(__dirname, '..', 'skills', SKILL_NAME);+}++/**+ * Returns candidate agent skill directories to sync to.+ * Only returns paths whose parent directory already exists.+ */+function getTargetSkillDirs() {+ const home = os.homedir();++ const candidates = [+ // Claude Code / Claude Desktop+ path.join(home, '.claude', 'skills', SKILL_NAME),+ // OpenClaw+ path.join(home, '.openclaw', 'workspace', '.agents', 'skills', SKILL_NAME),+ // Cursor+ path.join(home, '.cursor', 'skills', SKILL_NAME),+ // Windsurf+ path.join(home, '.windsurf', 'skills', SKILL_NAME),+ ];++ return candidates.filter((dir) => {+ // Check if the parent skills directory exists+ const parentDir = path.dirname(dir);+ return fs.existsSync(parentDir);+ });+}++/**+ * Recursively copies a directory.+ */+function copyDirSync(src, dest) {+ if (!fs.existsSync(dest)) {+ fs.mkdirSync(dest, { recursive: true });+ }++ const entries = fs.readdirSync(src, { withFileTypes: true });+ for (const entry of entries) {+ const srcPath = path.join(src, entry.name);+ const destPath = path.join(dest, entry.name);++ if (entry.isDirectory()) {+ copyDirSync(srcPath, destPath);+ } else {+ fs.copyFileSync(srcPath, destPath);+ }+ }+}++/**+ * Syncs bundled skills to all detected agent directories.+ * @param {object} options+ * @param {boolean} options.verbose - Print detailed output+ * @returns {{ updated: string[], skipped: string[] }}+ */+function syncSkills({ verbose = false } = {}) {+ const bundledDir = getBundledSkillsDir();+ const updated = [];+ const skipped = [];++ if (!fs.existsSync(bundledDir)) {+ if (verbose) {+ console.error(`⚠ Bundled skills not found at ${bundledDir}`);+ }+ return { updated, skipped };+ }++ const targets = getTargetSkillDirs();++ if (targets.length === 0) {+ if (verbose) {+ console.log('No agent skill directories detected. Nothing to sync.');+ }+ return { updated, skipped };+ }++ for (const target of targets) {+ try {+ copyDirSync(bundledDir, target);+ updated.push(target);+ if (verbose) {+ console.log(` ✓ ${target}`);+ }+ } catch (err) {+ skipped.push(target);+ if (verbose) {+ console.warn(` ✗ ${target}: ${err.message}`);+ }+ }+ }++ return { updated, skipped };+}++// If run directly (not required as module)+if (require.main === module) {+ const verbose = process.argv.includes('--verbose') || process.argv.includes('-v');+ console.log('Syncing Pinchtab skill files...\n');+ const { updated, skipped } = syncSkills({ verbose });++ if (updated.length > 0) {+ console.log(+ `\n✓ Updated ${updated.length} skill director${updated.length === 1 ? 'y' : 'ies'}`+ );+ } else {+ console.log('\nNo agent skill directories found to update.');+ console.log('Skill directories are synced only where agents are already installed.');+ }++ if (skipped.length > 0) {+ console.log(`⚠ Skipped ${skipped.length} (permission errors)`);+ }+}++module.exports = { syncSkills, getTargetSkillDirs, getBundledSkillsDir };diff --git a/npm/skills/pinchtab/SKILL.md b/npm/skills/pinchtab/SKILL.mdnew file mode 100644index 00000000..57cdaf9b--- /dev/null+++ b/npm/skills/pinchtab/SKILL.md@@ -0,0 +1,425 @@+---+name: pinchtab+description: "Use this skill when a task needs browser automation through PinchTab: open a website, inspect interactive elements, click through flows, fill out forms, scrape page text, log into sites with a persistent profile, export screenshots or PDFs, manage multiple browser instances, or fall back to the HTTP API when the CLI is unavailable. Prefer this skill for token-efficient browser work driven by stable accessibility refs such as `e5` and `e12`."+metadata:+ openclaw:+ requires:+ bins:+ - pinchtab+ anyBins:+ - google-chrome+ - google-chrome-stable+ - chromium+ - chromium-browser+ env:+ - PINCHTAB_TOKEN+ - PINCHTAB_CONFIG+ homepage: https://github.com/pinchtab/pinchtab+ install:+ - kind: brew+ formula: pinchtab/tap/pinchtab+ bins: [pinchtab]+ - kind: go+ package: github.com/pinchtab/pinchtab/cmd/pinchtab@latest+ bins: [pinchtab]+---++# Browser Automation with PinchTab++PinchTab gives agents a browser they can drive through stable accessibility refs, low-token text extraction, and persistent profiles or instances. Treat it as a CLI-first browser skill; use the HTTP API only when the CLI is unavailable or you need profile-management routes that do not exist in the CLI yet.++Preferred tool surface:++- Use `pinchtab` CLI commands first.+- Use `curl` for profile-management routes or non-shell/API fallback flows.+- Use `jq` only when you need structured parsing from JSON responses.++## Safety Defaults++- Default to `http://localhost` targets. Only use a remote PinchTab server when the user explicitly provides it and, if needed, a token.+- Prefer read-only operations first: `text`, `snap -i -c`, `snap -d`, `find`, `click`, `fill`, `type`, `press`, `select`, `hover`, `scroll`.+- Do not evaluate arbitrary JavaScript unless a simpler PinchTab command cannot answer the question.+- Do not upload local files unless the user explicitly names the file to upload and the destination flow requires it.+- Do not save screenshots, PDFs, or downloads to arbitrary paths. Use a user-specified path or a safe temporary/workspace path.+- Never use PinchTab to inspect unrelated local files, browser secrets, stored credentials, or system configuration outside the task.++## Core Workflow++Every PinchTab automation follows this pattern:++1. Ensure the correct server, profile, or instance is available for the task.+2. Navigate with `pinchtab nav <url>` or `pinchtab instance navigate <instance-id> <url>`.+3. Observe with `pinchtab snap -i -c`, `pinchtab snap --text`, or `pinchtab text`, then collect the current refs such as `e5`.+4. Interact with those fresh refs using `click`, `fill`, `type`, `press`, `select`, `hover`, or `scroll`.+5. Re-snapshot or re-read text after any navigation, submit, modal open, accordion expand, or other DOM-changing action.++Rules:++- Never act on stale refs after the page changes.+- Default to `pinchtab text` when you need content, not layout.+- Default to `pinchtab snap -i -c` when you need actionable elements.+- Use screenshots only for visual verification, UI diffs, or debugging.+- Start multi-site or parallel work by choosing the right instance or profile first.++## Selectors++PinchTab uses a unified selector system. Any command that targets an element accepts these formats:++| Selector | Example | Resolves via |+|---|---|---|+| Ref | `e5` | Snapshot cache (fastest) |+| CSS | `#login`, `.btn`, `[data-testid="x"]` | `document.querySelector` |+| XPath | `xpath://button[@id="submit"]` | CDP search |+| Text | `text:Sign In` | Visible text match |+| Semantic | `find:login button` | Natural language query via `/find` |++Auto-detection: bare `e5` → ref, `#id` / `.class` / `[attr]` → CSS, `//path` → XPath. Use explicit prefixes (`css:`, `xpath:`, `text:`, `find:`) when auto-detection is ambiguous.++```bash+pinchtab click e5 # ref+pinchtab click "#submit" # CSS (auto-detected)+pinchtab click "text:Sign In" # text match+pinchtab click "xpath://button[@type]" # XPath+pinchtab fill "#email" "[email protected]" # CSS+pinchtab fill e3 "[email protected]" # ref+```++The same syntax works in the HTTP API via the `selector` field:++```json+{"kind": "click", "selector": "text:Sign In"}+{"kind": "fill", "selector": "#email", "text": "[email protected]"}+{"kind": "click", "selector": "e5"}+```++Legacy `ref` field is still accepted for backward compatibility.++## Command Chaining++Use `&&` only when you do not need to inspect intermediate output before deciding the next step.++Good:++```bash+pinchtab nav https://example.com && pinchtab snap -i -c+pinchtab click --wait-nav e5 && pinchtab snap -i -c+pinchtab nav https://example.com --block-images && pinchtab text+```++Run commands separately when you must read the snapshot output first:++```bash+pinchtab nav https://example.com+pinchtab snap -i -c+# Read refs, choose the correct e#+pinchtab click e7+pinchtab snap -i -c+```++## Handling Authentication and State++Pick one of these five patterns before you start interacting with the site.++### 1. One-off public browsing++Use a temporary instance for public pages, scraping, or tasks that do not need login persistence.++```bash+pinchtab instance start+pinchtab instances+# Point CLI commands at the instance port you want to use.+pinchtab --server http://localhost:9868 nav https://example.com+pinchtab --server http://localhost:9868 text+```++### 2. Reuse an existing named profile++Use this for recurring tasks against the same authenticated site.++```bash+pinchtab profiles+pinchtab instance start --profile work --mode headed+pinchtab --server http://localhost:9868 nav https://mail.google.com+```++If the login is already stored in that profile, you can switch to headless later:++```bash+pinchtab instance stop inst_ea2e747f+pinchtab instance start --profile work --mode headless+```++### 3. Create a dedicated auth profile over HTTP++Use this when you need a durable profile and it does not exist yet.++```bash+curl -X POST http://localhost:9867/profiles \+ -H "Content-Type: application/json" \+ -d '{"name":"billing","description":"Billing portal automation","useWhen":"Use for billing tasks"}'++curl -X POST http://localhost:9867/profiles/billing/start \+ -H "Content-Type: application/json" \+ -d '{"headless":false}'+```++Then target the returned port with `--server`.++### 4. Human-assisted headed login, then agent reuse++Use this for CAPTCHA, MFA, or first-time setup.++```bash+pinchtab instance start --profile work --mode headed+# Human completes login in the visible Chrome window.+pinchtab --server http://localhost:9868 nav https://app.example.com/dashboard+pinchtab --server http://localhost:9868 snap -i -c+```++Once the session is stored, reuse the same profile for later tasks.++### 5. Remote or non-shell agent with tokenized HTTP API++Use this when the agent cannot call the CLI directly.++```bash+curl http://localhost:9867/health+curl -X POST http://localhost:9867/instances/launch \+ -H "Content-Type: application/json" \+ -d '{"name":"work","headless":true}'+curl -X POST http://localhost:9868/action \+ -H "Content-Type: application/json" \+ -d '{"kind":"click","selector":"e5"}'+```++If the server is exposed beyond localhost, require a token and use a dedicated automation profile. See [TRUST.md](./TRUST.md) and [config.md](../../docs/reference/config.md).++## Essential Commands++### Server and targeting++```bash+pinchtab server # Start server foreground+pinchtab daemon install # Install as system service+pinchtab health # Check server status+pinchtab instances # List running instances+pinchtab profiles # List available profiles+pinchtab --server http://localhost:9868 snap -i -c # Target specific instance+```++### Navigation and tabs++```bash+pinchtab nav <url>+pinchtab nav <url> --new-tab+pinchtab nav <url> --tab <tab-id>+pinchtab nav <url> --block-images+pinchtab nav <url> --block-ads+pinchtab back # Navigate back in history+pinchtab forward # Navigate forward+pinchtab reload # Reload current page+pinchtab tab # List tabs or focus by ID+pinchtab tab new <url>+pinchtab tab close <tab-id>+pinchtab instance navigate <instance-id> <url>+```++### Observation++```bash+pinchtab snap+pinchtab snap -i # Interactive elements only+pinchtab snap -i -c # Interactive + compact+pinchtab snap -d # Diff from previous snapshot+pinchtab snap --selector <css> # Scope to CSS selector+pinchtab snap --max-tokens <n> # Token budget limit+pinchtab snap --text # Text output format+pinchtab text # Page text content+pinchtab text --raw # Raw text extraction+pinchtab find <query> # Semantic element search+pinchtab find --ref-only <query> # Return refs only+```++Guidance:++- `snap -i -c` is the default for finding actionable refs.+- `snap -d` is the default follow-up snapshot for multi-step flows.+- `text` is the default for reading articles, dashboards, reports, or confirmation messages.+- `find --ref-only` is useful when the page is large and you already know the semantic target.++### Interaction++All interaction commands accept unified selectors (refs, CSS, XPath, text, semantic). See the Selectors section above.++```bash+pinchtab click <selector> # Click element+pinchtab click --wait-nav <selector> # Click and wait for navigation+pinchtab click --x 100 --y 200 # Click by coordinates+pinchtab dblclick <selector> # Double-click element+pinchtab type <selector> <text> # Type with keystrokes+pinchtab fill <selector> <text> # Set value directly+pinchtab press <key> # Press key (Enter, Tab, Escape...)+pinchtab hover <selector> # Hover element+pinchtab select <selector> <value> # Select dropdown option+pinchtab scroll <selector|pixels> # Scroll element or page+```++Rules:++- Prefer `fill` for deterministic form entry.+- Prefer `type` only when the site depends on keystroke events.+- Prefer `click --wait-nav` when a click is expected to navigate.+- Re-snapshot immediately after `click`, `press Enter`, `select`, or `scroll` if the UI can change.++### Export, debug, and verification++```bash+pinchtab screenshot+pinchtab screenshot -o /tmp/pinchtab-page.png # Format driven by extension+pinchtab screenshot -q 60 # JPEG quality+pinchtab pdf+pinchtab pdf -o /tmp/pinchtab-report.pdf+pinchtab pdf --landscape+```++### Advanced operations: explicit opt-in only++Use these only when the task explicitly requires them and safer commands are insufficient.++```bash+pinchtab eval "document.title"+pinchtab download <url> -o /tmp/pinchtab-download.bin+pinchtab upload /absolute/path/provided-by-user.ext -s <css>+```++Rules:++- `eval` is for narrow, read-only DOM inspection unless the user explicitly asks for a page mutation.+- `download` should prefer a safe temporary or workspace path over an arbitrary filesystem location.+- `upload` requires a file path the user explicitly provided or clearly approved for the task.++### HTTP API fallback++```bash+curl -X POST http://localhost:9868/navigate \+ -H "Content-Type: application/json" \+ -d '{"url":"https://example.com"}'++curl "http://localhost:9868/snapshot?filter=interactive&format=compact"++curl -X POST http://localhost:9868/action \+ -H "Content-Type: application/json" \+ -d '{"kind":"fill","selector":"e3","text":"[email protected]"}'++curl http://localhost:9868/text+```++Use the API when:++- the agent cannot shell out,+- profile creation or mutation is required,+- or you need explicit instance- and tab-scoped routes.++## Common Patterns++### Open a page and inspect actions++```bash+pinchtab nav https://pinchtab.com && pinchtab snap -i -c+```++### Fill and submit a form++```bash+pinchtab nav https://example.com/login+pinchtab snap -i -c+pinchtab fill e3 "[email protected]"+pinchtab fill e4 "correct horse battery staple"+pinchtab click --wait-nav e5+pinchtab text+```++### Search, then extract the result page cheaply++```bash+pinchtab nav https://example.com+pinchtab snap -i -c+pinchtab fill e2 "quarterly report"+pinchtab press Enter+pinchtab text+```++### Use diff snapshots in a multi-step flow++```bash+pinchtab nav https://example.com/checkout+pinchtab snap -i -c+pinchtab click e8+pinchtab snap -d -i -c+```++### Target elements without a snapshot++When you know the page structure, skip the snapshot and use CSS or text selectors directly:++```bash+pinchtab click "text:Accept Cookies"+pinchtab fill "#search" "quarterly report"+pinchtab click "xpath://button[@type='submit']"+```++### Bootstrap an authenticated profile++```bash+pinchtab profiles+pinchtab instance start --profile work --mode headed+# Human signs in once.+pinchtab --server http://localhost:9868 text+```++### Run separate instances for separate sites++```bash+pinchtab instance start --profile work --mode headless+pinchtab instance start --profile staging --mode headless+pinchtab instances+```++Then point each command stream at its own port using `--server`.++## Security and Token Economy++- Use a dedicated automation profile, not a daily browsing profile.+- If PinchTab is reachable off-machine, require a token and bind conservatively.+- Prefer `text`, `snap -i -c`, and `snap -d` before screenshots, PDFs, eval, downloads, or uploads.+- Use `--block-images` for read-heavy tasks that do not need visual assets.+- Stop or isolate instances when switching between unrelated accounts or environments.++## Diffing and Verification++- Use `pinchtab snap -d` after each state-changing action in long workflows.+- Use `pinchtab text` to confirm success messages, table updates, or navigation outcomes.+- Use `pinchtab screenshot` only when visual regressions, CAPTCHA, or layout-specific confirmation matters.+- If a ref disappears after a change, treat that as expected and fetch fresh refs instead of retrying the stale one.++## Privacy and Security++PinchTab is a fully open-source, local-only browser automation tool:++- **Runs on localhost only.** The server binds to `127.0.0.1` by default. No external network calls are made by PinchTab itself.+- **No telemetry or analytics.** The binary makes zero outbound connections.+- **Single Go binary (~16 MB).** Fully verifiable — anyone can build from source at [github.com/pinchtab/pinchtab](https://github.com/pinchtab/pinchtab).+- **Local Chrome profiles.** Persistent profiles store cookies and sessions on your machine only. This enables agents to reuse authenticated sessions without re-entering credentials, similar to how a human reuses their browser profile.+- **Token-efficient by design.** Uses the accessibility tree (structured text) instead of screenshots, keeping agent context windows small. Comparable to Playwright but purpose-built for AI agents.+- **Multi-instance isolation.** Each browser instance runs in its own profile directory with tab-level locking for safe multi-agent use.++## References++- Command surface: [commands.md](../../docs/commands.md)+- CLI overview: [cli.md](../../docs/reference/cli.md)+- Profiles: [profiles.md](../../docs/reference/profiles.md)+- Instances: [instances.md](../../docs/reference/instances.md)+- Full API: [api.md](./references/api.md)+- Minimal env vars: [env.md](./references/env.md)+- Config reference: [config.md](../../docs/reference/config.md)+- Security model: [TRUST.md](./TRUST.md)diff --git a/npm/skills/pinchtab/TRUST.md b/npm/skills/pinchtab/TRUST.mdnew file mode 100644index 00000000..aa0dfd87--- /dev/null+++ b/npm/skills/pinchtab/TRUST.md@@ -0,0 +1,71 @@+# Pinchtab Security & Trust++**TL;DR**: Pinchtab is a local, sandboxed browser control tool. It does not phone home, steal credentials, or exfiltrate data. Source code is public; binaries are signed and published via GitHub.++## What Pinchtab Does++- Launches a Chrome browser (local, under your control)+- Exposes navigation, clicking, typing, and page inspection via HTTP API+- Extracts the page's accessibility tree (for AI agents)+- Runs screenshots, PDFs, and JavaScript evaluation++High-risk operations such as JavaScript evaluation, local-file upload, and direct file writes should be treated as explicit opt-in actions for the current task, not the default workflow.++**All of this stays local.** No telemetry. No external API calls (except to sites you navigate to).++## What Pinchtab Does NOT Do++- ❌ Doesn't access your saved passwords/credentials (Chrome sandboxing)+- ❌ Doesn't exfiltrate data to remote servers+- ❌ Doesn't inject ads, malware, or miners+- ❌ Doesn't track browsing or send analytics+- ❌ Doesn't modify system files outside its state directory (`~/.pinchtab`)++## Builds & Verification++Every release includes **checksums** alongside binaries:++```bash+# After downloading, verify:+sha256sum -c checksums.txt+```++Binaries are built automatically from tagged commits via GitHub Actions (publicly visible at https://github.com/pinchtab/pinchtab/actions).++## Open Source++- **Source**: https://github.com/pinchtab/pinchtab (MIT)+- **Releases**: https://github.com/pinchtab/pinchtab/releases+- **Latest**: v0.8.0 (March 2026)++If you're concerned, audit the source—it's 12MB, zero external dependencies, mostly Go stdlib.++## VirusTotal Flag++Pinchtab may trigger heuristic scanners on VirusTotal because:++- ✓ It launches Chrome (subprocess execution — flagged by AV heuristics)+- ✓ It runs JavaScript evaluation (eval-like operations)+- ✓ It makes HTTP requests (network activity)++These are **intentional design features**, not security flaws. Your browser does all three things by default.++**False positives are common for development tools.** The VT flag is a known false positive for chromedp-based tools (subprocess + HTTP server). Always verify SHA256 checksums from GitHub releases before running.++For maximum confidence, use the npm package (`npm install -g pinchtab`) or Docker image, which undergo additional validation.++## Sandboxing++Pinchtab runs a separate Chrome process with:++- Isolated profile directory (default: `~/.pinchtab`)+- No access to your user's home files (unless you explicitly navigate to `file://` URLs)+- Standard Chrome security model (site isolation, CSP, etc.)++Use `profiles.baseDir`, `profiles.defaultProfile`, or `PINCHTAB_CONFIG` if you need to control where PinchTab stores browser state.++## Questions?++- Source code: https://github.com/pinchtab/pinchtab+- Issues/security reports: https://github.com/pinchtab/pinchtab/issues+- Docs: https://pinchtab.comdiff --git a/npm/skills/pinchtab/agents/openai.yaml b/npm/skills/pinchtab/agents/openai.yamlnew file mode 100644index 00000000..bd2140ca--- /dev/null+++ b/npm/skills/pinchtab/agents/openai.yaml@@ -0,0 +1,4 @@+interface:+ display_name: "PinchTab"+ short_description: "Control browsers and access sites with PinchTab"+ default_prompt: "Use $pinchtab to navigate a site, inspect fresh refs, and complete the browser task efficiently."diff --git a/npm/skills/pinchtab/references/api.md b/npm/skills/pinchtab/references/api.mdnew file mode 100644index 00000000..d93be101--- /dev/null+++ b/npm/skills/pinchtab/references/api.md@@ -0,0 +1,344 @@+# Pinchtab API Reference++Base URL for all examples: `http://localhost:9867`++> **CLI alternative:** All endpoints have CLI equivalents. Use `pinchtab help` for the full list. Examples are shown as `# CLI:` comments below.++## Navigate++```bash+# CLI: pinchtab nav https://pinchtab.com [--new-tab] [--block-images]+curl -X POST /navigate \+ -H 'Content-Type: application/json' \+ -d '{"url": "https://pinchtab.com"}'++# With options: custom timeout, block images, open in new tab+curl -X POST /navigate \+ -H 'Content-Type: application/json' \+ -d '{"url": "https://pinchtab.com", "timeout": 60, "blockImages": true, "newTab": true}'+```++## Snapshot (accessibility tree)++```bash+# CLI: pinchtab snap [-i] [-c] [-d] [-s main] [--max-tokens 2000]+# Full tree+curl /snapshot++# Interactive elements only (buttons, links, inputs) — much smaller+curl "/snapshot?filter=interactive"++# Limit depth+curl "/snapshot?depth=5"++# Smart diff — only changes since last snapshot (massive token savings)+curl "/snapshot?diff=true"++# Text format — indented tree, ~40-60% fewer tokens than JSON+curl "/snapshot?format=text"++# Compact format — one-line-per-node, 56-64% fewer tokens than JSON (recommended)+curl "/snapshot?format=compact"++# YAML format+curl "/snapshot?format=yaml"++# Scope to CSS selector (e.g. main content only)+curl "/snapshot?selector=main"++# Truncate to ~N tokens+curl "/snapshot?maxTokens=2000"++# Combine for maximum efficiency+curl "/snapshot?format=compact&selector=main&maxTokens=2000&filter=interactive"++# Disable animations before capture+curl "/snapshot?noAnimations=true"++# Write to file+curl "/snapshot?output=file&path=/tmp/snapshot.json"+```++Returns flat JSON array of nodes with `ref`, `role`, `name`, `depth`, `value`, `nodeId`.++**Token optimization**: Use `?format=compact` for best token efficiency. Add `?filter=interactive` for action-oriented tasks (~75% fewer nodes). Use `?selector=main` to scope to relevant content. Use `?maxTokens=2000` to cap output. Use `?diff=true` on multi-step workflows to see only changes. Combine all params freely.++## Act on elements++```bash+# CLI: pinchtab click e5 / pinchtab type e12 hello / pinchtab press Enter+# Click by ref+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "click", "ref": "e5"}'++# Type into focused element (click first, then type)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "click", "ref": "e12"}'+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "type", "ref": "e12", "text": "hello world"}'++# Press a key+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "press", "key": "Enter"}'++# Focus an element+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "focus", "ref": "e3"}'++# Fill (set value directly, no keystrokes)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "fill", "selector": "#email", "text": "[email protected]"}'++# Hover (trigger dropdowns/tooltips)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "hover", "ref": "e8"}'++# Select dropdown option (by value or visible text)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "select", "ref": "e10", "value": "option2"}'++# Scroll to element+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "scroll", "ref": "e20"}'++# Scroll by pixels (infinite scroll pages)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "scroll", "scrollY": 800}'++# Click and wait for navigation (link clicks)+curl -X POST /action -H 'Content-Type: application/json' \+ -d '{"kind": "click", "ref": "e5", "waitNav": true}'+```++## Batch actions++```bash+# Execute multiple actions in sequence+curl -X POST /actions -H 'Content-Type: application/json' \+ -d '{"actions":[{"kind":"click","ref":"e3"},{"kind":"type","ref":"e3","text":"hello"},{"kind":"press","key":"Enter"}]}'++# Stop on first error (default: false)+curl -X POST /actions -H 'Content-Type: application/json' \+ -d '{"tabId":"TARGET_ID","actions":[...],"stopOnError":true}'+```++## Extract text++```bash+# CLI: pinchtab text [--raw]+# Readability mode (default) — strips nav/footer/ads+curl /text++# Raw innerText+curl "/text?mode=raw"+```++Returns `{url, title, text}`. Cheapest option (~1K tokens for most pages).++## PDF export++Prefer returning base64 or raw bytes unless the user explicitly wants a file written to disk.+When writing to disk, use a safe temporary or workspace path.++```bash+# CLI: pinchtab pdf --tab TAB_ID [-o file.pdf] [--landscape] [--scale 0.8]+# Returns base64 JSON+curl "/tabs/TAB_ID/pdf"++# Raw PDF bytes+curl "/tabs/TAB_ID/pdf?raw=true" -o page.pdf++# Save to disk in a safe temp location+curl "/tabs/TAB_ID/pdf?output=file&path=/tmp/pinchtab-page.pdf"++# Landscape with custom scale+curl "/tabs/TAB_ID/pdf?landscape=true&scale=0.8&raw=true" -o page.pdf++# Custom paper size (Letter: 8.5x11, A4: 8.27x11.69)+curl "/tabs/TAB_ID/pdf?paperWidth=8.5&paperHeight=11&marginTop=0.5&marginLeft=0.5&raw=true" -o custom.pdf++# Export specific pages+curl "/tabs/TAB_ID/pdf?pageRanges=1-5&raw=true" -o pages.pdf++# With header/footer+curl "/tabs/TAB_ID/pdf?displayHeaderFooter=true&headerTemplate=%3Cspan%20class=title%3E%3C/span%3E&raw=true" -o header.pdf++# Accessible PDF with document outline+curl "/tabs/TAB_ID/pdf?generateTaggedPDF=true&generateDocumentOutline=true&raw=true" -o accessible.pdf++# Honor CSS page size+curl "/tabs/TAB_ID/pdf?preferCSSPageSize=true&raw=true" -o css-sized.pdf+```++**Query Parameters:**++| Param | Type | Default | Description |+|-------|------|---------|-------------|+| `paperWidth` | float | 8.5 | Paper width in inches |+| `paperHeight` | float | 11.0 | Paper height in inches |+| `landscape` | bool | false | Landscape orientation |+| `marginTop` | float | 0.4 | Top margin in inches |+| `marginBottom` | float | 0.4 | Bottom margin in inches |+| `marginLeft` | float | 0.4 | Left margin in inches |+| `marginRight` | float | 0.4 | Right margin in inches |+| `scale` | float | 1.0 | Print scale (0.1–2.0) |+| `pageRanges` | string | all | Pages to export (e.g., `1-3,5`) |+| `displayHeaderFooter` | bool | false | Show header and footer |+| `headerTemplate` | string | — | HTML template for header |+| `footerTemplate` | string | — | HTML template for footer |+| `preferCSSPageSize` | bool | false | Honor CSS `@page` size |+| `generateTaggedPDF` | bool | false | Generate accessible/tagged PDF |+| `generateDocumentOutline` | bool | false | Embed document outline |+| `output` | string | JSON | `file` to save to disk, default returns base64 |+| `path` | string | auto | Destination path (prefer temp or workspace paths with `output=file`) |+| `raw` | bool | false | Return raw PDF bytes instead of JSON |++Wraps `Page.printToPDF`. Prints background graphics by default.++## Download files++Prefer raw bytes or base64 responses unless the user explicitly asks for a saved file.++```bash+# Returns base64 JSON by default (uses browser session/cookies/stealth)+curl "/download?url=https://site.com/report.pdf"++# Raw bytes (pipe to file)+curl "/download?url=https://site.com/image.jpg&raw=true" -o image.jpg++# Save directly to disk in a safe temp location+curl "/download?url=https://site.com/export.csv&output=file&path=/tmp/pinchtab-export.csv"+```++## Upload files++Only upload local files the user explicitly provided or approved for the task.++```bash+# Upload a local file to a file input+curl -X POST "/upload?tabId=TAB_ID" -H "Content-Type: application/json" \+ -d '{"selector": "input[type=file]", "paths": ["/tmp/user-approved-photo.jpg"]}'++# Upload base64-encoded data+curl -X POST /upload -H "Content-Type: application/json" \+ -d '{"selector": "#avatar-input", "files": ["data:image/png;base64,iVBOR..."]}'+```++Sets files on `<input type=file>` elements via CDP. Fires `change` events. Selector defaults to `input[type=file]` if omitted.++## Screenshot++```bash+# CLI: pinchtab ss [-o file.jpg] [-q 80]+# Returns raw JPEG (default)+curl "/screenshot?raw=true" -o screenshot.jpg+curl "/screenshot?raw=true&quality=50" -o screenshot.jpg++# Returns raw PNG+curl "/screenshot?raw=true&format=png" -o screenshot.png+```++## Evaluate JavaScript++Use this sparingly. Prefer `text`, `snapshot`, and normal actions first.+Default to read-only DOM inspection and avoid reading cookies, localStorage, or unrelated page secrets unless the user explicitly asks for that behavior.++```bash+# CLI: pinchtab eval "document.title"+curl -X POST /evaluate -H 'Content-Type: application/json' \+ -d '{"expression": "document.title"}'+```++## Tab management++```bash+# CLI: pinchtab tabs / pinchtab tabs new <url> / pinchtab tabs close <id>+# List tabs+curl /tabs++# Open new tab+curl -X POST /tab -H 'Content-Type: application/json' \+ -d '{"action": "new", "url": "https://pinchtab.com"}'++# Close tab+curl -X POST /tab -H 'Content-Type: application/json' \+ -d '{"action": "close", "tabId": "TARGET_ID"}'+```++Multi-tab: pass `?tabId=TARGET_ID` to snapshot/screenshot/text, or `"tabId"` in POST body.++## Tab-specific endpoints++All read/action endpoints have tab-scoped variants using `/tabs/{id}/...`:++```bash+# Navigate a specific tab+curl -X POST /tabs/TARGET_ID/navigate \+ -H 'Content-Type: application/json' \+ -d '{"url": "https://pinchtab.com"}'++# Snapshot a specific tab+curl "/tabs/TARGET_ID/snapshot"+curl "/tabs/TARGET_ID/snapshot?filter=interactive&format=compact"++# Screenshot a specific tab+curl "/tabs/TARGET_ID/screenshot?raw=true" -o tab-screenshot.jpg++# Extract text from a specific tab+curl "/tabs/TARGET_ID/text"++# Action on a specific tab+curl -X POST /tabs/TARGET_ID/action \+ -H 'Content-Type: application/json' \+ -d '{"kind": "click", "ref": "e5"}'++# Batch actions on a specific tab+curl -X POST /tabs/TARGET_ID/actions \+ -H 'Content-Type: application/json' \+ -d '{"actions": [{"kind": "click", "ref": "e3"}, {"kind": "type", "ref": "e3", "text": "hello"}]}'+```++These are equivalent to using `?tabId=TARGET_ID` on top-level endpoints but follow REST conventions. The tab ID comes from `/tabs` or from the `tabId` field in navigate/tab creation responses.++## Tab locking (multi-agent)++```bash+# Lock a tab (default 30s timeout, max 5min)+curl -X POST /tab/lock -H 'Content-Type: application/json' \+ -d '{"tabId": "TARGET_ID", "owner": "agent-1", "timeoutSec": 60}'++# Unlock+curl -X POST /tab/unlock -H 'Content-Type: application/json' \+ -d '{"tabId": "TARGET_ID", "owner": "agent-1"}'+```++Locked tabs show `owner` and `lockedUntil` in `/tabs`. Returns 409 on conflict.++## Cookies++```bash+# Get cookies for current page+curl /cookies++# Set cookies+curl -X POST /cookies -H 'Content-Type: application/json' \+ -d '{"url":"https://pinchtab.com","cookies":[{"name":"session","value":"abc123"}]}'+```++## Stealth++```bash+# Check stealth status and score+curl /stealth/status++# Rotate browser fingerprint+curl -X POST /fingerprint/rotate -H 'Content-Type: application/json' \+ -d '{"os":"windows"}'+# os: "windows", "mac", or omit for random+```++## Health check++```bash+curl /health+```diff --git a/npm/skills/pinchtab/references/env.md b/npm/skills/pinchtab/references/env.mdnew file mode 100644index 00000000..e869e9a9--- /dev/null+++ b/npm/skills/pinchtab/references/env.md@@ -0,0 +1,36 @@+# PinchTab Environment Variables++This reference is intentionally narrow.++For agent workflows, most runtime behavior should be configured through `config.json` or the `pinchtab config` commands, not environment variables.++## Agent-relevant variables++| Var | Typical use | Notes |+|---|---|---|+| `PINCHTAB_TOKEN` | Authenticate CLI or MCP requests to a protected server | Sent as `Authorization: Bearer ...` |+| `PINCHTAB_CONFIG` | Override the config file path | Prefer this over ad hoc env overrides when automating |++## Targeting remote servers++Use the `--server` CLI flag instead of environment variables:++```bash+pinchtab --server http://192.168.1.50:9867 snap+pinchtab --server https://pinchtab.example.com snap+```++## What is intentionally not listed++- Browser tuning should generally live in `config.json`, not in ad hoc env vars.+- Internal process wiring and inherited env passthrough are implementation details, not part of the skill contract.++## Recommended default++For most agent tasks, the only variable you need is:++```bash+PINCHTAB_TOKEN=...+```++Everything else should be handled through config, profiles, instances, and the `--server` flag.diff --git a/npm/skills/pinchtab/references/profiles.md b/npm/skills/pinchtab/references/profiles.mdnew file mode 100644index 00000000..b97235ce--- /dev/null+++ b/npm/skills/pinchtab/references/profiles.md@@ -0,0 +1,107 @@+# Profile Management++When running `pinchtab`, profiles are managed via the dashboard API on port 9867.++## List profiles++```bash+curl http://localhost:9867/profiles+```++Returns array of profiles with `id`, `name`, `accountEmail`, `useWhen`, etc.++## Start a profile++```bash+# Auto-allocate port (recommended)+curl -X POST http://localhost:9867/profiles/<ID>/start++# With specific port and headless mode+curl -X POST http://localhost:9867/profiles/<ID>/start \+ -H 'Content-Type: application/json' \+ -d '{"port": "9868", "headless": true}'++# Short alias+curl -X POST http://localhost:9867/start/<ID>+```++Returns instance info including allocated `port`. Use that port for all subsequent API calls.++## Stop a profile++```bash+curl -X POST http://localhost:9867/profiles/<ID>/stop++# Short alias+curl -X POST http://localhost:9867/stop/<ID>+```++## Check instance status++```bash+# By profile ID (recommended)+curl http://localhost:9867/profiles/<ID>/instance++# By profile name+curl http://localhost:9867/profiles/My%20Profile/instance+```++## Launch by name++```bash+curl -X POST http://localhost:9867/instances/launch \+ -H 'Content-Type: application/json' \+ -d '{"name": "work", "port": "9868"}'+```++## CLI usage with profiles++The CLI doesn't have profile subcommands yet — use `curl` for profile management.+Once a profile instance is running, point the CLI at it using the `--server` flag:++```bash+# Get the instance port, then use CLI+pinchtab --server http://localhost:9868 snap -i+```++## Typical agent flow++```bash+# 1. List profiles+PROFILES=$(curl -s http://localhost:9867/profiles)++# 2. Start profile (auto-allocates port)+INSTANCE=$(curl -s -X POST http://localhost:9867/profiles/$PROFILE_ID/start)+PORT=$(echo $INSTANCE | jq -r .port)++# 3. Use the instance+curl -X POST http://localhost:$PORT/navigate -H 'Content-Type: application/json' \+ -d '{"url": "https://mail.google.com"}'+curl http://localhost:$PORT/snapshot?maxTokens=4000++# 4. Stop when done+curl -s -X POST http://localhost:9867/profiles/$PROFILE_ID/stop+```++## Profile IDs++Each profile gets a stable 12-char hex ID (SHA-256 of name, truncated) stored in `profile.json`. IDs are URL-safe and never change — use them instead of names in automation.++## Headed mode++Headed mode = real visible Chrome window managed by Pinchtab.++- Human can log in, pass 2FA/captcha, validate state+- Agent calls HTTP APIs against the same running instance+- Session state persists in profile directory (cookies/storage carry over)++Recommended human + agent flow:++```bash+# Human starts dashboard and sets up profile+pinchtab++# Agent resolves the profile endpoint+PINCHTAB_BASE_URL="$(pinchtab connect <profile-name>)"+curl "$PINCHTAB_BASE_URL/health"+```diff --git a/scripts/check-npm.sh b/scripts/check-npm.shindex 4152f88a..0b979f2b 100644--- a/scripts/check-npm.sh+++ b/scripts/check-npm.sh@@ -50,6 +50,8 @@ REQUIRED=("dist/src/index.js""dist/src/index.d.ts""scripts/postinstall.js"+ "scripts/sync-skills.js"+ "skills/pinchtab/SKILL.md""bin/pinchtab""LICENSE")@@ -63,6 +65,7 @@ for file in "${REQUIRED[@]}"; dodonenode -c scripts/postinstall.js+node -c scripts/sync-skills.jsnode -e "const pkg = require('./package.json');