High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix(npm): align sdk/package tests with current cli flow
Luigi Agostib0eb053c5c12
diff --git a/.github/RELEASING.md b/.github/RELEASING.mdindex 3e7329eb..97563068 100644--- a/.github/RELEASING.md+++ b/.github/RELEASING.md@@ -20,16 +20,19 @@ Pushing a tag like `v0.7.0` triggers [release.yml](/Users/luigi/dev/prj/giago/pt## Release steps1. Verify the branch you want to release is merged to `main`.-2. Push the release tag:+2. If the release includes security-impacting changes, update `skills/pinchtab/TRUST.md`:+ - extend `## Security History` when needed+ - adjust `**Minimum recommended version:**` if the safe floor changes+3. Push the release tag:```bashgit tag v0.7.0git push origin v0.7.0```-3. Watch the `Release` workflow in GitHub Actions.-4. Confirm GoReleaser opens a PR in `pinchtab/homebrew-tap`.-5. Merge that PR.+4. Watch the `Release` workflow in GitHub Actions.+5. Confirm GoReleaser opens a PR in `pinchtab/homebrew-tap`.+6. Merge that PR.After the tap PR is merged, users can install with:diff --git a/.github/workflows/reusable-publish-skill.yml b/.github/workflows/reusable-publish-skill.ymlindex 7c23e520..cc0dc5f9 100644--- a/.github/workflows/reusable-publish-skill.yml+++ b/.github/workflows/reusable-publish-skill.yml@@ -30,6 +30,19 @@ jobs:with:node-version: '22'+ - name: Resolve version+ id: version+ run: |+ if [ -n "${{ inputs.version }}" ]; then+ VERSION="${{ inputs.version }}"+ elif [ -n "${{ github.event.inputs.version }}" ]; then+ VERSION="${{ github.event.inputs.version }}"+ else+ VERSION=${GITHUB_REF_NAME#v}+ fi+ VERSION=${VERSION#v}+ echo "value=$VERSION" >> "$GITHUB_OUTPUT"+- name: Install ClawHub CLIrun: npm i -g clawhub@@ -40,14 +53,7 @@ jobs:- name: Publish skillrun: |- if [ -n "${{ inputs.version }}" ]; then- VERSION="${{ inputs.version }}"- elif [ -n "${{ github.event.inputs.version }}" ]; then- VERSION="${{ github.event.inputs.version }}"- else- VERSION=${GITHUB_REF_NAME#v}- fi- VERSION=${VERSION#v}+ VERSION="${{ steps.version.outputs.value }}"clawhub publish skills/pinchtab \--slug pinchtab \--name "Pinchtab" \diff --git a/.gitignore b/.gitignoreindex 6c10d26f..1ca66229 100644--- a/.gitignore+++ b/.gitignore@@ -14,6 +14,7 @@# npm package# package-lock.json is committed for reproducible installs via npm ci*.js+!npm/scripts/*.js*.pyc*.test.DS_Store@@ -43,6 +44,8 @@ internal/dashboard/dashboard/dashboard.htmlmemory/node_modules/npm/node_modules/+npm/.npm-cache/+npm/skills/pinchtab-devpinchtab-smallpinchtab.exediff --git a/npm/README.md b/npm/README.mdindex bdf001d0..f6e886c0 100644--- a/npm/README.md+++ b/npm/README.md@@ -27,6 +27,22 @@ On install, the postinstall script automatically:- Node.js 16+- macOS, Linux, or Windows+### Local Development With A Local Binary++If you are testing the npm package from a local checkout, build the canonical+repo-local binary first:++```bash+bash scripts/npm-dev-binary.sh+cd npm+npm install+node bin/pinchtab --version+```++In a source checkout, the npm package now expects the local binary at+`../pinchtab-dev` and will fail clearly if it is missing. It does not download a+release binary in that mode.+### Proxy SupportWorks with corporate proxies. Set standard environment variables:diff --git a/npm/bin/pinchtab b/npm/bin/pinchtabindex 74a0b705..8b1c5f22 100755--- a/npm/bin/pinchtab+++ b/npm/bin/pinchtab@@ -5,6 +5,25 @@ const { spawn, spawnSync } = require('child_process');const os = require('os');const fs = require('fs');+function findRepoRoot() {+ const repoRoot = path.join(__dirname, '..', '..');+ if (+ fs.existsSync(path.join(repoRoot, 'go.mod')) &&+ fs.existsSync(path.join(repoRoot, 'cmd', 'pinchtab'))+ ) {+ return repoRoot;+ }+ return null;+}++function getCheckoutBinaryPath() {+ const repoRoot = findRepoRoot();+ if (!repoRoot) {+ return null;+ }+ return path.join(repoRoot, 'pinchtab-dev');+}+function getBinaryName() {const platform = process.platform;let arch;@@ -36,6 +55,11 @@ function getVersion() {}function getBinaryPath() {+ const checkoutBinaryPath = getCheckoutBinaryPath();+ if (checkoutBinaryPath) {+ return checkoutBinaryPath;+ }+// Try version-specific path first: ~/.pinchtab/bin/0.7.0/pinchtab-darwin-arm64const version = getVersion();const versionedPath = path.join(os.homedir(), '.pinchtab', 'bin', version, getBinaryName());@@ -109,7 +133,13 @@ if (!fs.existsSync(binaryPath)) {console.error('❌ Pinchtab binary not found at:');console.error(` ${binaryPath}`);console.error('\nTo fix this, run:');- console.error(' npm rebuild pinchtab');+ if (getCheckoutBinaryPath()) {+ console.error(' bash scripts/npm-dev-binary.sh');+ console.error(' # or');+ console.error(' go build -o ./pinchtab-dev ./cmd/pinchtab');+ } else {+ console.error(' npm rebuild pinchtab');+ }process.exit(1);}diff --git a/npm/package-lock.json b/npm/package-lock.jsonindex fe2f8845..60406bfe 100644--- a/npm/package-lock.json+++ b/npm/package-lock.json@@ -1,12 +1,12 @@{"name": "pinchtab",- "version": "0.7.6",+ "version": "0.0.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "pinchtab",- "version": "0.7.6",+ "version": "0.0.0","hasInstallScript": true,"license": "MIT","bin": {diff --git a/npm/package.json b/npm/package.jsonindex e4ca2e7b..a2efc4a6 100644--- a/npm/package.json+++ b/npm/package.json@@ -1,6 +1,6 @@{"name": "pinchtab",- "version": "0.7.6",+ "version": "0.0.0","description": "Browser control API for AI agents","main": "dist/src/index.js","types": "dist/src/index.d.ts",@@ -14,10 +14,12 @@"lint": "eslint src tests scripts","format": "prettier --write src tests scripts","format:check": "prettier --check src tests scripts",+ "stage:skills": "node scripts/stage-skills.js","build": "npm run lint && npm run format:check && tsc","test": "node --test 'dist/tests/**/*.test.js'","postinstall": "node scripts/postinstall.js",- "prepare": "npm run build"+ "prepare": "npm run build",+ "prepack": "npm run stage:skills"},"files": ["dist/src",diff --git a/npm/scripts/postinstall.js b/npm/scripts/postinstall.jsindex 48945708..d06cdc76 100644--- a/npm/scripts/postinstall.js+++ b/npm/scripts/postinstall.js@@ -8,6 +8,25 @@ const crypto = require('crypto');const GITHUB_REPO = 'pinchtab/pinchtab';+function findRepoRoot() {+ const repoRoot = path.join(__dirname, '..', '..');+ if (+ fs.existsSync(path.join(repoRoot, 'go.mod')) &&+ fs.existsSync(path.join(repoRoot, 'cmd', 'pinchtab'))+ ) {+ return repoRoot;+ }+ return null;+}++function getCheckoutBinaryPath() {+ const repoRoot = findRepoRoot();+ if (!repoRoot) {+ return null;+ }+ return path.join(repoRoot, 'pinchtab-dev');+}+function getVersion() {const pkgPath = path.join(__dirname, '..', 'package.json');const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));@@ -54,11 +73,6 @@ function getBinaryName(platform) {}function getBinaryPath(binaryName) {- // Allow override via environment variable (useful for Docker, dev, containers)- if (process.env.PINCHTAB_BINARY_PATH) {- return process.env.PINCHTAB_BINARY_PATH;- }-return path.join(os.homedir(), '.pinchtab', 'bin', binaryName);}@@ -331,9 +345,18 @@ async function downloadBinary(platform, version) {const platform = detectPlatform();const version = getVersion();- // Ensure binary was successfully downloaded- // (If PINCHTAB_BINARY_PATH is set, skip download but trust the binary exists)- if (!process.env.PINCHTAB_BINARY_PATH) {+ // Ensure binary was successfully downloaded, unless this is a source checkout+ // that should use the canonical local pinchtab-dev binary instead.+ const checkoutBinaryPath = getCheckoutBinaryPath();+ if (checkoutBinaryPath) {+ if (!fs.existsSync(checkoutBinaryPath)) {+ throw new Error(+ `Expected local source-checkout binary at ${checkoutBinaryPath}\n` ++ `Build it first with: bash scripts/npm-dev-binary.sh`+ );+ }+ console.log(`✓ Using source-checkout Pinchtab binary: ${checkoutBinaryPath}`);+ } else {const binaryPath = getBinaryPath(getBinaryName(platform));const binDir = path.dirname(binaryPath);@@ -396,9 +419,6 @@ async function downloadBinary(platform, version) {if (process.env.HTTPS_PROXY || process.env.HTTP_PROXY) {console.error(' • Check proxy settings (HTTPS_PROXY / HTTP_PROXY)');}- console.error('\nFor Docker or custom binaries:');- console.error(' export PINCHTAB_BINARY_PATH=/path/to/pinchtab');- console.error(' npm rebuild pinchtab');process.exit(1);}})();diff --git a/npm/scripts/stage-skills.js b/npm/scripts/stage-skills.jsnew file mode 100644index 00000000..38aedad9--- /dev/null+++ b/npm/scripts/stage-skills.js@@ -0,0 +1,41 @@+#!/usr/bin/env node++const fs = require('fs');+const path = require('path');++const SKILL_NAME = 'pinchtab';+const sourceDir = path.join(__dirname, '..', '..', 'skills', SKILL_NAME);+const targetDir = path.join(__dirname, '..', 'skills', SKILL_NAME);++function copyDirSync(src, 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);+ continue;+ }++ fs.copyFileSync(srcPath, destPath);+ }+}++function stageSkills() {+ if (!fs.existsSync(sourceDir)) {+ throw new Error(`source skill directory not found: ${sourceDir}`);+ }++ fs.rmSync(targetDir, { recursive: true, force: true });+ copyDirSync(sourceDir, targetDir);+}++if (require.main === module) {+ stageSkills();+ console.log(`Staged ${SKILL_NAME} skill into npm package`);+}++module.exports = { stageSkills };diff --git a/npm/scripts/sync-skills.js b/npm/scripts/sync-skills.jsindex 1bb4f770..885a4068 100644--- a/npm/scripts/sync-skills.js+++ b/npm/scripts/sync-skills.js@@ -19,7 +19,14 @@ 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);+ const packagedDir = path.join(__dirname, '..', 'skills', SKILL_NAME);+ if (fs.existsSync(packagedDir)) {+ return packagedDir;+ }++ // In a source checkout, fall back to the repo-root skill so local development+ // does not depend on prepack having staged npm/skills first.+ return path.join(__dirname, '..', '..', 'skills', SKILL_NAME);}/**diff --git a/npm/skills/pinchtab/SKILL.md b/npm/skills/pinchtab/SKILL.mddeleted file mode 100644index dc526719..00000000--- a/npm/skills/pinchtab/SKILL.md+++ /dev/null@@ -1,494 +0,0 @@-----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-```--## Challenge Solving--PinchTab includes a pluggable solver framework that auto-detects and resolves browser challenges (Cloudflare Turnstile, CAPTCHAs, interstitials). Use this **after navigation** when the page shows a challenge instead of the expected content.--**Important:** Solvers work best with `stealthLevel: "full"` in the PinchTab config (or `instanceDefaults.stealthLevel: "full"`). Full stealth mode patches CDP detection vectors, rotates fingerprints, and masks automation signals — all of which challenge providers like Cloudflare check before and after the checkbox click. Without full stealth, the solver may click correctly but the challenge can still fail fingerprint verification.--```bash-# Auto-detect and solve any challenge on the current page-curl -X POST http://localhost:9867/solve \- -H 'Content-Type: application/json' \- -d '{"maxAttempts": 3, "timeout": 30000}'--# Use a specific solver-curl -X POST http://localhost:9867/solve/cloudflare \- -H 'Content-Type: application/json' \- -d '{"maxAttempts": 3}'--# Tab-scoped solve-curl -X POST http://localhost:9867/tabs/TAB_ID/solve \- -H 'Content-Type: application/json' \- -d '{}'--# List available solvers-curl http://localhost:9867/solvers-```--**When to use solve:**--- Page title is "Just a moment..." or similar challenge indicator-- `pinchtab text` returns empty or challenge-page text after navigation-- A Cloudflare Turnstile widget blocks the target content--**Workflow pattern:**--```bash-pinchtab nav https://protected-site.com-pinchtab text # Check if page loaded or shows challenge-# If challenge detected:-curl -X POST http://localhost:9867/solve \- -H 'Content-Type: application/json' -d '{}'-pinchtab text # Verify: should now show real page content-```--**Response fields:** `solver` (which solver handled it), `solved` (bool), `challengeType` (e.g. "managed"), `attempts`, `title` (final page title).--The auto-detect mode (`POST /solve` without specifying a solver) tries each registered solver in order and returns immediately with `solved: true, attempts: 0` if no challenge is present. This makes it safe to call speculatively after any navigation.--## 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/profiles \- -H "Content-Type: application/json" \- -d '{"name":"work"}'-curl -X POST http://localhost:9867/instances/start \- -H "Content-Type: application/json" \- -d '{"profileId":"work","mode":"headless"}'-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--## Instance-scoped solve (instance port, not server port)-curl -X POST http://localhost:9868/solve \- -H "Content-Type: application/json" \- -d '{"maxAttempts": 3}'--curl http://localhost:9868/solvers-```--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']"-```--### Navigate through a Cloudflare-protected site--```bash-pinchtab nav https://protected-site.com-# Page may show CF challenge ("Just a moment...")-curl -X POST http://localhost:9867/solve \- -H 'Content-Type: application/json' -d '{"maxAttempts": 3}'-# Now the real page is loaded — proceed normally-pinchtab snap -i -c-pinchtab text-```--### 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.mddeleted file mode 100644index aa0dfd87..00000000--- a/npm/skills/pinchtab/TRUST.md+++ /dev/null@@ -1,71 +0,0 @@-# 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.yamldeleted file mode 100644index bd2140ca..00000000--- a/npm/skills/pinchtab/agents/openai.yaml+++ /dev/null@@ -1,4 +0,0 @@-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.mddeleted file mode 100644index d93be101..00000000--- a/npm/skills/pinchtab/references/api.md+++ /dev/null@@ -1,344 +0,0 @@-# 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.mddeleted file mode 100644index e869e9a9..00000000--- a/npm/skills/pinchtab/references/env.md+++ /dev/null@@ -1,36 +0,0 @@-# 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.mddeleted file mode 100644index b97235ce..00000000--- a/npm/skills/pinchtab/references/profiles.md+++ /dev/null@@ -1,107 +0,0 @@-# 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/npm/src/index.ts b/npm/src/index.tsindex 56db3c3f..3aedc715 100644--- a/npm/src/index.ts+++ b/npm/src/index.ts@@ -1,7 +1,8 @@import { spawn, ChildProcess } from 'child_process';import * as path from 'path';import * as fs from 'fs';-import { detectPlatform, getBinaryName, getBinaryPath } from './platform';+import * as os from 'os';+import { detectPlatform, getBinaryName, getBinaryPath, getCheckoutBinaryPath } from './platform';import {SnapshotParams,SnapshotResponse,@@ -22,11 +23,16 @@ export class Pinchtab {private port: number;private process: ChildProcess | null = null;private binaryPath: string | null = null;+ private tempConfigDir: string | null = null;+ private token: string | null;+ private readonly configuredToken: string | null;constructor(options: PinchtabOptions = {}) {this.port = options.port || 9867;this.baseUrl = options.baseUrl || `http://localhost:${this.port}`;this.timeout = options.timeout || 30000;+ this.configuredToken = options.token?.trim() || null;+ this.token = this.configuredToken;}/**@@ -42,18 +48,54 @@ export class Pinchtab {}this.binaryPath = binaryPath;+ const tempConfigPath = this.createTempConfig();return new Promise((resolve, reject) => {- this.process = spawn(binaryPath, ['serve', `--port=${this.port}`], {+ let settled = false;+ const fail = (message: string) => {+ if (settled) {+ return;+ }+ settled = true;+ this.cleanupTempConfig();+ reject(new Error(message));+ };++ this.process = spawn(binaryPath, ['server'], {stdio: 'inherit',+ env: {+ ...process.env,+ PINCHTAB_CONFIG: tempConfigPath,+ },});this.process.on('error', (err) => {- reject(new Error(`Failed to start Pinchtab: ${err.message}`));+ fail(`Failed to start Pinchtab: ${err.message}`);});- // Give the server a moment to start- setTimeout(resolve, 500);+ this.process.on('exit', (code, signal) => {+ this.cleanupTempConfig();+ if (!settled) {+ const reason = signal ? `signal ${signal}` : `exit code ${code ?? 0}`;+ reject(new Error(`Pinchtab exited before becoming ready (${reason})`));+ }+ });++ void this.waitForServerReady()+ .then(() => {+ if (settled) {+ return;+ }+ settled = true;+ resolve();+ })+ .catch((err: Error) => {+ if (this.process) {+ this.process.kill();+ this.process = null;+ }+ fail(err.message);+ });});}@@ -63,11 +105,21 @@ export class Pinchtab {async stop(): Promise<void> {if (this.process) {return new Promise((resolve) => {- this.process?.kill();+ const proc = this.process;this.process = null;- resolve();+ if (!proc) {+ this.cleanupTempConfig();+ resolve();+ return;+ }+ proc.once('exit', () => {+ this.cleanupTempConfig();+ resolve();+ });+ proc.kill();});}+ this.cleanupTempConfig();}/**@@ -116,11 +168,16 @@ export class Pinchtab {const timeoutId = setTimeout(() => controller.abort(), this.timeout);try {+ const headers: Record<string, string> = {+ 'Content-Type': 'application/json',+ };+ if (this.token) {+ headers.Authorization = `Bearer ${this.token}`;+ }+const response = await fetch(url, {method: 'POST',- headers: {- 'Content-Type': 'application/json',- },+ headers,body: body ? JSON.stringify(body) : undefined,signal: controller.signal as AbortSignal,});@@ -140,14 +197,24 @@ export class Pinchtab {* Get the path to the Pinchtab binary*/private async getBinaryPathInternal(): Promise<string> {+ const checkoutBinaryPath = getCheckoutBinaryPath(__dirname);+ if (checkoutBinaryPath) {+ if (!fs.existsSync(checkoutBinaryPath)) {+ throw new Error(+ `Pinchtab source-checkout binary not found at ${checkoutBinaryPath}.\n` ++ `Build it first with: bash scripts/npm-dev-binary.sh`+ );+ }+ return checkoutBinaryPath;+ }+const platform = detectPlatform();const binaryName = getBinaryName(platform);// Try version-specific path firstlet version: string | undefined;try {- const pkg = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8');- version = JSON.parse(pkg).version;+ version = this.readPackageVersion();} catch (err) {console.warn(`Could not read version from package.json, falling back to unversioned binary. (${(err as Error).message})`@@ -165,6 +232,84 @@ export class Pinchtab {return binaryPath;}++ private createTempConfig(): string {+ this.cleanupTempConfig();++ const configDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pinchtab-npm-'));+ const configPath = path.join(configDir, 'config.json');+ const stateDir = path.join(configDir, 'state');+ const token = this.configuredToken || `npm-${process.pid}-${Date.now()}`;+ this.token = token;++ fs.writeFileSync(+ configPath,+ JSON.stringify(+ {+ server: {+ bind: '127.0.0.1',+ port: String(this.port),+ stateDir,+ token,+ },+ },+ null,+ 2+ )+ );++ this.tempConfigDir = configDir;+ return configPath;+ }++ private cleanupTempConfig(): void {+ if (!this.tempConfigDir) {+ return;+ }+ fs.rmSync(this.tempConfigDir, { recursive: true, force: true });+ this.tempConfigDir = null;+ }++ private async waitForServerReady(): Promise<void> {+ const deadline = Date.now() + 10000;++ while (Date.now() < deadline) {+ try {+ const response = await fetch(this.baseUrl);+ if (response.status > 0) {+ return;+ }+ } catch {+ // Server not ready yet.+ }++ await new Promise((resolve) => setTimeout(resolve, 250));+ }++ throw new Error(`Pinchtab did not become ready at ${this.baseUrl} within 10s`);+ }++ private readPackageVersion(): string {+ let dir = path.resolve(__dirname);++ while (dir) {+ const pkgPath = path.join(dir, 'package.json');+ if (fs.existsSync(pkgPath)) {+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));+ if (typeof pkg.version === 'string' && pkg.version.trim() !== '') {+ return pkg.version;+ }+ }++ const parent = path.dirname(dir);+ if (parent === dir) {+ break;+ }+ dir = parent;+ }++ throw new Error(`ENOENT: package.json not found above ${__dirname}`);+ }}export default Pinchtab;diff --git a/npm/src/platform.ts b/npm/src/platform.tsindex 8f2e725f..3e4c66e3 100644--- a/npm/src/platform.ts+++ b/npm/src/platform.ts@@ -1,4 +1,5 @@import * as path from 'path';+import * as fs from 'fs';export interface Platform {os: 'darwin' | 'linux' | 'windows';@@ -48,6 +49,35 @@ export function getBinDir(): string {return path.join(process.env.HOME || process.env.USERPROFILE || '', '.pinchtab', 'bin');}+export function findRepoRoot(fromDir: string): string | null {+ let dir = path.resolve(fromDir);++ while (dir) {+ if (+ fs.existsSync(path.join(dir, 'go.mod')) &&+ fs.existsSync(path.join(dir, 'cmd', 'pinchtab'))+ ) {+ return dir;+ }++ const parent = path.dirname(dir);+ if (parent === dir) {+ break;+ }+ dir = parent;+ }++ return null;+}++export function getCheckoutBinaryPath(fromDir: string): string | null {+ const repoRoot = findRepoRoot(fromDir);+ if (!repoRoot) {+ return null;+ }+ return path.join(repoRoot, 'pinchtab-dev');+}+export function getBinaryPath(binaryName: string, version?: string): string {// Version-specific path: ~/.pinchtab/bin/0.7.0/pinchtab-darwin-arm64// This allows multiple versions to coexist and prevents silent overwritesdiff --git a/npm/src/types.ts b/npm/src/types.tsindex 8f6bf67e..e5432cf6 100644--- a/npm/src/types.ts+++ b/npm/src/types.ts@@ -37,4 +37,5 @@ export interface PinchtabOptions {baseUrl?: string;timeout?: number;port?: number;+ token?: string;}diff --git a/npm/tests/integration.test.ts b/npm/tests/integration.test.tsindex d1dc07f5..c60cf4a2 100644--- a/npm/tests/integration.test.ts+++ b/npm/tests/integration.test.ts@@ -61,29 +61,6 @@ describe('Pinchtab npm Integration Tests', () => {assert.strictEqual(typeof pinch.createTab, 'function');});- test('should start server (requires binary)', async () => {- const client = new Pinchtab({ port: testPort });-- try {- await client.start();- // Give server a moment to be ready- await new Promise((r) => setTimeout(r, 1000));-- // Try a simple health check- const response = await fetch(`http://localhost:${testPort}/`);- assert.ok(response.status !== undefined);-- await client.stop();- } catch (err) {- const errorMsg = (err as Error).message;- if (errorMsg.includes('ENOENT') || errorMsg.includes('not found')) {- console.log('⊘ Binary not available — skipping start test');- } else {- throw err;- }- }- });-test('should handle missing binary gracefully', async () => {const client = new Pinchtab({ port: 9998 });diff --git a/npm/tests/platform-detection.test.ts b/npm/tests/platform-detection.test.tsindex d2e381ad..d5f9ce35 100644--- a/npm/tests/platform-detection.test.ts+++ b/npm/tests/platform-detection.test.ts@@ -17,6 +17,30 @@import { test, describe } from 'node:test';import * as assert from 'node:assert';+import * as path from 'node:path';+import * as fs from 'node:fs';+import { findRepoRoot, getCheckoutBinaryPath } from '../src/platform';++function getTestRepoRoot(): string {+ let dir = path.resolve(__dirname);++ while (dir) {+ if (+ fs.existsSync(path.join(dir, 'go.mod')) &&+ fs.existsSync(path.join(dir, 'cmd', 'pinchtab'))+ ) {+ return dir;+ }++ const parent = path.dirname(dir);+ if (parent === dir) {+ break;+ }+ dir = parent;+ }++ throw new Error(`Could not find repo root from ${__dirname}`);+}/*** Extracted detectPlatform logic from postinstall.js@@ -63,6 +87,22 @@ function getBinaryName(platform: PlatformResult): string {}describe('Platform Detection', () => {+ describe('source-checkout binary lookup', () => {+ const repoRoot = getTestRepoRoot();++ test('finds repo root from npm/bin', () => {+ const fromDir = path.join(repoRoot, 'npm', 'bin');+ assert.strictEqual(findRepoRoot(fromDir), repoRoot);+ assert.strictEqual(getCheckoutBinaryPath(fromDir), path.join(repoRoot, 'pinchtab-dev'));+ });++ test('finds repo root from built SDK output under npm/dist/src', () => {+ const fromDir = path.join(repoRoot, 'npm', 'dist', 'src');+ assert.strictEqual(findRepoRoot(fromDir), repoRoot);+ assert.strictEqual(getCheckoutBinaryPath(fromDir), path.join(repoRoot, 'pinchtab-dev'));+ });+ });+describe('detectPlatform', () => {test('darwin + x64 → darwin-amd64', () => {const platform = detectPlatform('darwin', 'x64');diff --git a/npm/tests/wrapper-checkout-binary.test.ts b/npm/tests/wrapper-checkout-binary.test.tsnew file mode 100644index 00000000..d2b6dc57--- /dev/null+++ b/npm/tests/wrapper-checkout-binary.test.ts@@ -0,0 +1,98 @@+import { afterEach, describe, test } from 'node:test';+import * as assert from 'node:assert';+import { spawnSync } from 'node:child_process';+import * as fs from 'node:fs';+import * as path from 'node:path';+import * as os from 'node:os';++function getTestRepoRoot(): string {+ let dir = path.resolve(__dirname);++ while (dir) {+ if (+ fs.existsSync(path.join(dir, 'go.mod')) &&+ fs.existsSync(path.join(dir, 'cmd', 'pinchtab'))+ ) {+ return dir;+ }++ const parent = path.dirname(dir);+ if (parent === dir) {+ break;+ }+ dir = parent;+ }++ throw new Error(`Could not find repo root from ${__dirname}`);+}++const repoRoot = getTestRepoRoot();+const sourceWrapperPath = path.join(repoRoot, 'npm', 'bin', 'pinchtab');+const tempRoots: string[] = [];++function createFakeCheckout(stdoutText: string, recordPath: string) {+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'pinchtab-wrapper-test-'));+ tempRoots.push(tempRoot);++ fs.mkdirSync(path.join(tempRoot, 'cmd', 'pinchtab'), { recursive: true });+ fs.mkdirSync(path.join(tempRoot, 'npm', 'bin'), { recursive: true });+ fs.writeFileSync(path.join(tempRoot, 'go.mod'), 'module test/pinchtab\n');+ fs.copyFileSync(sourceWrapperPath, path.join(tempRoot, 'npm', 'bin', 'pinchtab'));++ const contents = `#!/usr/bin/env node+const fs = require('fs');+fs.writeFileSync(${JSON.stringify(recordPath)}, JSON.stringify({+ argv: process.argv.slice(2),+}, null, 2));+process.stdout.write(${JSON.stringify(stdoutText)});+`;+ fs.writeFileSync(path.join(tempRoot, 'pinchtab-dev'), contents, { mode: 0o755 });+ fs.chmodSync(path.join(tempRoot, 'npm', 'bin', 'pinchtab'), 0o755);++ return {+ repoRoot: tempRoot,+ wrapperPath: path.join(tempRoot, 'npm', 'bin', 'pinchtab'),+ };+}++afterEach(() => {+ while (tempRoots.length > 0) {+ fs.rmSync(tempRoots.pop()!, { recursive: true, force: true });+ }+});++describe('wrapper source-checkout binary path', () => {+ test('uses pinchtab-dev for standard subcommands', () => {+ const recordPath = path.join(repoRoot, 'npm', 'wrapper-standard.json');+ const checkout = createFakeCheckout('standard-ok\n', recordPath);++ const result = spawnSync('node', [checkout.wrapperPath, '--version'], {+ cwd: checkout.repoRoot,+ encoding: 'utf-8',+ });++ assert.strictEqual(result.status, 0, result.stderr);+ assert.match(result.stdout, /standard-ok/);++ const recorded = JSON.parse(fs.readFileSync(recordPath, 'utf-8'));+ fs.rmSync(recordPath, { force: true });+ assert.deepStrictEqual(recorded.argv, ['--version']);+ });++ test('uses pinchtab-dev for the mcp subcommand path', () => {+ const recordPath = path.join(repoRoot, 'npm', 'wrapper-mcp.json');+ const checkout = createFakeCheckout('mcp-ok\n', recordPath);++ const result = spawnSync('node', [checkout.wrapperPath, 'mcp'], {+ cwd: checkout.repoRoot,+ encoding: 'utf-8',+ });++ assert.strictEqual(result.status, 0, result.stderr);+ assert.match(result.stdout, /mcp-ok/);++ const recorded = JSON.parse(fs.readFileSync(recordPath, 'utf-8'));+ fs.rmSync(recordPath, { force: true });+ assert.deepStrictEqual(recorded.argv, ['mcp']);+ });+});diff --git a/scripts/README.md b/scripts/README.mdindex 40e60889..035e322a 100644--- a/scripts/README.md+++ b/scripts/README.md@@ -25,6 +25,7 @@ Development and CI scripts for PinchTab.| `build-dashboard.sh` | Generate TS types (tygo) + build React dashboard + copy to Go embed || `dev.sh` | Full build (dashboard + Go) and run || `docker-smoke.sh` | Smoke-test a Docker image bootstrap path (defaults to `pinchtab-local:test`) |+| `npm-dev-binary.sh` | Build the canonical `./pinchtab-dev` binary for source-checkout npm-package testing || `run.sh` | Run the existing `./pinchtab` binary |## Setupdiff --git a/scripts/check-npm.sh b/scripts/check-npm.shindex 0b979f2b..49e57571 100644--- a/scripts/check-npm.sh+++ b/scripts/check-npm.sh@@ -1,10 +1,14 @@#!/usr/bin/env bashset -euo pipefail-cd "$(dirname "$0")/../npm"+ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"+cd "$ROOT_DIR/npm"echo "Verifying npm package..."+echo "Building source-checkout npm binary..."+(cd "$ROOT_DIR" && go build -o pinchtab-dev ./cmd/pinchtab)+DESIRED_VERSION="${1:-}"if [ -n "$DESIRED_VERSION" ]; thenCURRENT_VERSION="$(jq -r .version package.json)"@@ -65,6 +69,7 @@ for file in "${REQUIRED[@]}"; dodonenode -c scripts/postinstall.js+node -c scripts/stage-skills.jsnode -c scripts/sync-skills.jsnode -e "diff --git a/scripts/npm-dev-binary.sh b/scripts/npm-dev-binary.shnew file mode 100644index 00000000..5e0189a7--- /dev/null+++ b/scripts/npm-dev-binary.sh@@ -0,0 +1,22 @@+#!/usr/bin/env bash+set -euo pipefail++ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+OUT_PATH="${1:-$ROOT_DIR/pinchtab-dev}"++echo "Building local PinchTab binary at $OUT_PATH"+(cd "$ROOT_DIR" && go build -o "$OUT_PATH" ./cmd/pinchtab)++cat <<EOF++Built local binary:+ $OUT_PATH++Canonical local npm path:+ $ROOT_DIR/pinchtab-dev++Use it with the npm package:+ cd "$ROOT_DIR/npm"+ npm install+ node bin/pinchtab --version+EOFdiff --git a/skills/pinchtab/SKILL.md b/skills/pinchtab/SKILL.mdindex dc526719..2d980b66 100644--- a/skills/pinchtab/SKILL.md+++ b/skills/pinchtab/SKILL.md@@ -11,9 +11,6 @@ metadata:- google-chrome-stable- chromium- chromium-browser- env:- - PINCHTAB_TOKEN- - PINCHTAB_CONFIGhomepage: https://github.com/pinchtab/pinchtabinstall:- kind: brewdiff --git a/skills/pinchtab/TRUST.md b/skills/pinchtab/TRUST.mdindex d378a42a..452d647c 100644--- a/skills/pinchtab/TRUST.md+++ b/skills/pinchtab/TRUST.md@@ -36,7 +36,6 @@ Binaries are built automatically from tagged commits via GitHub Actions (publicl- **Source**: https://github.com/pinchtab/pinchtab (MIT)- **Releases**: https://github.com/pinchtab/pinchtab/releases-- **Latest**: v0.8.4 (Mar 2026)If you're concerned, audit the source—it's ~15MB, zero external dependencies, mostly Go stdlib.@@ -66,15 +65,15 @@ Use `profiles.baseDir`, `profiles.defaultProfile`, or `PINCHTAB_CONFIG` if you n## Security History-| CVE | Severity | Affected | Fixed In | Endpoint |-| --- | --- | --- | --- | --- |-| [CVE-2026-30834](https://github.com/advisories/GHSA-rw8p-c6hf-q3pg) | High (7.5) | < 0.7.7 | 0.7.7 | `/download` |--**Type:** Server-Side Request Forgery (SSRF) — allowed exfiltration of internal files and network probing via crafted download URLs.--**Fix PRs:** [#135](https://github.com/pinchtab/pinchtab/pull/135) (SafePath validation), [#288](https://github.com/pinchtab/pinchtab/pull/288) (expanded URL validation).--**Minimum recommended version:** 0.8.3+ (includes full SSRF hardening).+| Advisory | Severity | Fixed In |+| --- | --- | --- |+| [GHSA-p8mm-644p-phmh / CVE-2026-33623](https://github.com/advisories/GHSA-p8mm-644p-phmh) | Medium | 0.8.5 |+| [GHSA-w5pc-m664-r62v / CVE-2026-33622](https://github.com/advisories/GHSA-w5pc-m664-r62v) | Medium | 0.8.5 |+| [GHSA-j65m-hv65-r264 / CVE-2026-33621](https://github.com/advisories/GHSA-j65m-hv65-r264) | Medium | 0.8.4 |+| [GHSA-mrqc-3276-74f8 / CVE-2026-33620](https://github.com/advisories/GHSA-mrqc-3276-74f8) | Medium | 0.8.4 |+| [GHSA-xqq2-4j46-vwp7 / CVE-2026-33619](https://github.com/advisories/GHSA-xqq2-4j46-vwp7) | Medium | 0.8.4 |+| [GHSA-qwxp-6qf9-wr4m / CVE-2026-33081](https://github.com/advisories/GHSA-qwxp-6qf9-wr4m) | Medium | v0.8.3 |+| [GHSA-rw8p-c6hf-q3pg / CVE-2026-30834](https://github.com/advisories/GHSA-rw8p-c6hf-q3pg) | High | v0.7.7 |## Questions?