Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: skill change and cleanup of things to do

Mario5c160c001d31
diff --git a/skills/pinchtab/SKILL.md b/skills/pinchtab/SKILL.md
index 9e789120..26dfd688 100644
--- a/skills/pinchtab/SKILL.md
+++ b/skills/pinchtab/SKILL.md
@@ -120,13 +120,28 @@ pinchtab tab close <tab-id> # Close a tab — use this t
pinchtab instance navigate <instance-id> <url>
```
-**Tab workflow** - Capture tab ID once, reuse for all commands:
+**Tab workflow** — most commands target the active tab by default, so single-tab flows need no plumbing:
```bash
-export PINCHTAB_TAB=$(pinchtab nav http://example.com)
-pinchtab snap -i -c # Uses PINCHTAB_TAB automatically
-pinchtab click e5 # Same tab
-pinchtab text # Same tab
+pinchtab nav http://example.com
+pinchtab snap -i -c # active tab
+pinchtab click e5 # active tab
+pinchtab text # active tab
```
+
+When you need to pin to a specific tab (parallel tabs, long-running flows, or shell-isolated
+runners like agent tool calls where env vars don't persist across invocations), capture the
+tab ID with `--print-tab-id` and pass `--tab` on every subsequent command:
+```bash
+TAB_ID=$(pinchtab nav http://example.com --print-tab-id)
+pinchtab --tab "$TAB_ID" snap -i -c
+pinchtab --tab "$TAB_ID" click e5
+pinchtab --tab "$TAB_ID" text
+```
+
+Within a single shell session you can also `export PINCHTAB_TAB=$(pinchtab nav URL --print-tab-id)`
+and drop the `--tab` flag. This does **not** survive across separate shell invocations (each
+`Bash` tool call in an agent runs a fresh shell), so prefer explicit `--tab` for agent workflows.
+
Priority: `--tab <id>` flag > `PINCHTAB_TAB` env var > active tab.
### Observation
@@ -152,7 +167,11 @@ 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.
+- **`pinchtab find <query>`** is the direct route when you already know the semantic target
+ (e.g. "login button", "email input", "accept cookies link") — skips the full snapshot and
+ returns a ranked match with its ref. Pair with `--ref-only` on large/dense pages to get just
+ the ref string for piping straight into `click` / `fill` / `type`. Prefer `find` over
+ `snap -i -c` + visual scan whenever you can describe the target in a phrase.
- Refs from `snap -i` and full `snap` use different numbering. Do not mix them — if you snapshot with `-i`, use those refs. If you re-snapshot without `-i`, get fresh refs before acting.
### Interaction
@@ -247,6 +266,12 @@ Use curl when CLI unavailable. Key endpoints on instance port (e.g. 9867):
- `POST /navigate` with `{"url":"..."}`
- `GET /snapshot?filter=interactive&format=compact`
- `POST /action` with `{"kind":"fill","selector":"e3","text":"..."}`
+- `POST /actions` with a batch of actions — runs them in one round-trip. Body accepts either
+ an array `[{"kind":"fill",...},{"kind":"click",...}]` or an envelope
+ `{"actions":[...],"stopOnError":true,"tabId":"..."}`. Use this for tight form flows (fill +
+ fill + click submit) to cut round-trip latency. Set `stopOnError:true` to halt on the first
+ failure; the response contains a per-step `{index, success, result?, error?}` array.
+ Tab-scoped variant: `POST /tabs/TAB_ID/actions`.
- `GET /text`
- `POST /solve` with `{"maxAttempts": 3}`
diff --git a/tests/benchmark/benchmark-coverage-plan.md b/tests/benchmark/benchmark-coverage-plan.md
index 5aed32ad..9fc9cc4f 100644
--- a/tests/benchmark/benchmark-coverage-plan.md
+++ b/tests/benchmark/benchmark-coverage-plan.md
@@ -1,11 +1,11 @@
# Benchmark Coverage Plan — Weaknesses & Gaps
Living inventory of PinchTab weaknesses that fall outside the iframe roadmap
-(see that separately). Compiled from 16 continuous optimization loops of
-agent + baseline feedback. Rank is by *agent pain per loop* × *tractability*.
+(see that separately). Compiled from continuous optimization loops of agent +
+baseline feedback. Rank is by *agent pain per loop* × *tractability*.
-Update each entry as loops land fixes. When an item reaches "resolved", move
-it to the bottom of the file with the loop number that closed it.
+Update each entry as loops land fixes. Delete entries once they are closed —
+this file is a TODO, not an archive.
---
@@ -23,11 +23,9 @@ it to the bottom of the file with the loop number that closed it.
| ID | Missing | Impact | Effort | Status |
|----|---------|:------:|:------:|--------|
-| B1 | ~~**`pinchtab download --output <path>`**~~ — **Already implemented.** `-o` flag exists. | 🟡 mid | 🟢 easy | **closed** |
| B2 | **Screenshot / PDF `-o` paths write inside container, not host.** Benchmark-wrapper issue; production installs are fine. Needs wrapper `docker cp` or `--host-path` flag. | 🟡 mid | 🟢 easy | open |
| B3 | **`<select multiple>` not supported.** `SelectByNodeID` sets `this.value = v` which is single-select only. Real bug. | 🟡 mid | 🟡 medium | open |
| B4 | **No viewport resize / mobile emulation.** Can't test responsive layouts or mobile-only UI. | 🟡 mid | 🟡 medium | open |
-| B5 | ~~**No `wait --not-text`**~~ — **implemented.** `wait --not-text "Loading..."` waits for text to disappear. `wait <selector> --state hidden` already handled element disappearance. | 🟢 low | 🟢 easy | **closed** |
| B6 | **No request interception** — `--block-images` / `--block-ads` work but no arbitrary URL pattern blocking or response mocking. | 🟡 mid | 🔴 hard | open |
| B7 | **No mobile-gesture primitives** — pinch, long-press, two-finger scroll. Niche but will matter. | 🟢 low | 🟡 medium | open |
@@ -47,8 +45,6 @@ they actually work for agents in practice.
| C5 | **`pinchtab console`** JS error/warning capture | 🟡 mid | Add `console.html` fixture that logs + throws |
| C6 | **`pinchtab upload`** file upload via sandboxed path | 🔴 high | Add `upload.html` fixture + sandbox-path task |
| C7 | **`pinchtab find`** natural-language element discovery — agents don't know it exists | 🟡 mid | Add 1 task per existing fixture that uses `find` instead of snap+ref |
-| C8 | **`pinchtab handoff`** session handoff between agents | 🟢 low | Niche; defer |
-| C9 | **`pinchtab solve`** CAPTCHA solving | 🟢 low | Needs real sites; defer |
---
@@ -66,14 +62,13 @@ fixture suite. Ranked by frequency in real sites.
| D5 | **Autocomplete / combobox with suggestions** | high | Google search, Slack picker. |
| D6 | **Date picker** | high | Booking sites. Native `<input type="date">` vs custom. |
| D7 | **Draggable list reorder** | medium | Trello, Notion. Current `drag.html` is zone-drop, not list-reorder. |
-| D8 | **Toast / snackbar notifications** | high | Transient content — requires B5. |
+| D8 | **Toast / snackbar notifications** | high | Transient content — pairs with `wait --not-text`. |
| D9 | **Tooltips on keyboard focus** | medium | Accessibility-first UIs; current `hovers.html` only tests hover. |
| D10 | **Virtual scrolling** | medium | AG Grid, React Virtualized — off-screen rows not in DOM. |
| D11 | **Inline async form validation** | high | "Checking username availability..." — wait+re-snap cycle. |
| D12 | **Modal with backdrop click-to-close** | high | React-style modals, not JS `alert`. |
| D13 | **Sticky header + table scroll** | medium | Dashboards — scroll-into-view lands under sticky header. |
| D14 | **Copy-to-clipboard button** | high | Ties to C1. |
-| D15 | **`window.print()` dialog** | low | Edge case but exists. |
---
@@ -83,11 +78,9 @@ Agents cost 1–2 extra tool calls per run because of these.
| ID | Gap | Fix |
|----|-----|-----|
-| E1 | `pinchtab scroll <pixels>` positional form absent from the short `Use:` string; agents glance there first. | Update `Use:` to `scroll <pixels\|direction\|selector>`. |
| E2 | `pinchtab tab list` is wrong — it's bare `pinchtab tab`. Agents keep guessing. | Add "list" alias or a SKILL.md note. |
| E3 | `text --full` vs default Readability trap — agents still default to `text`. | Consider making default retry raw when Readability returns < N chars. |
| E4 | Container-vs-host paths for `-o` flags — no note in `--help`. | Add note to `screenshot` / `pdf` / `download` help text. |
-| E5 | `pinchtab find` command is invisible. | Surface in SKILL.md "when to use" cheatsheet. |
| E6 | Error code reference — `-32000`, `409`, `412` show up without context. | Create `skills/pinchtab/references/errors.md`. |
---
@@ -100,7 +93,6 @@ Not bugs — friction that wrapper / docs could eliminate.
|----|-----|----------|
| F1 | No "warm start" hint — agents always do `snap -i -c` first. | SKILL.md: recommend `pinchtab quick <url>` for one-shot tasks. |
| F2 | No "here's what changed" primitive beyond `snap -d`. | `pinchtab wait-and-diff` as a single call. |
-| F3 | No atomic action batches from CLI. `actions --file batch.json` exists but is invisible. | Surface in SKILL.md. |
| F4 | Agent re-snapshots after every action — ~half the tool calls. | A `click --then-text` / `click --snap-after` one-shot. |
---
@@ -118,7 +110,7 @@ When picking the next continuous-loop target, sort by `(agent pain × value) / e
7. **C6 — file upload fixture + sandbox-path integration**
8. **D4 — infinite-scroll fixture**
9. **C3–C5** — storage / network / console coverage
-10. **D5–D15** — remaining real-world patterns
+10. **D5–D14** — remaining real-world patterns
Below that threshold: everything is incremental coverage / doc polish.
@@ -127,30 +119,7 @@ Below that threshold: everything is incremental coverage / doc polish.
## Iframe coverage — separate roadmap
Covered by the `pinchtab frame` command (landed upstream in PR #471, merged
-into this branch). Current benchmark coverage below; for the full iframe
-functionality roadmap see the user's earlier survey (§1–11).
-
-### Landed
-
-- `pinchtab frame <target|main>` stateful scope.
-- Same-origin iframe scoping (CSS selector, ref, frame name, frame URL).
-- Nested iframe support via successive `frame` hops (verified to 3 levels).
-- `srcdoc` iframes work (same-origin by inheritance).
-- `sandbox="allow-scripts allow-same-origin"` iframes work.
-- Dynamic iframes inserted after page load — paired with `wait --text`.
-- Refs emitted by a full (non-interactive) `snap` carry frame context, so
- ref-based actions cross the boundary without an explicit scope set.
-
-### Benchmark coverage (77-task suite, Groups 19 + 31-34)
-
-| Group | Scenario | Status |
-|-------|----------|:------:|
-| 19.1 | Read same-origin iframe via full `snap` | ✅ |
-| 19.2 | Interact inside iframe via `frame` scope + selectors | ✅ |
-| 31 | Nested iframes (3 levels) | ✅ |
-| 32 | Dynamic iframe (inserted after load) | ✅ |
-| 33 | `srcdoc` iframe (inline HTML) | ✅ |
-| 34 | Sandboxed iframe (`allow-scripts allow-same-origin`) | ✅ |
+into this branch).
### Still missing
@@ -162,36 +131,7 @@ functionality roadmap see the user's earlier survey (§1–11).
independently. `Page.navigate` with a `frameId` isn't exposed.
- **Frame discovery command** — no `pinchtab frames` listing; agents must
know frame names/URLs in advance.
-- ~~**`text --full` doesn't pierce iframes**~~ — **resolved**.
- `pinchtab text` now honors the active `frame` scope and accepts an
- explicit `--frame <frameId>` flag for one-shot reads. Top-level calls are
- unchanged. See `docs/reference/frame.md` / SKILL.md.
- **`snap -i -c` still filters iframe children** — full `snap` works but
adds tokens. A frame-aware interactive filter would be nicer.
- **Sandboxed iframes without `allow-same-origin`** — opaque origin, out
of reach. Same gap as cross-origin.
-
-### Resolved (archive)
-
-- **[Loop #30]** — **A1 missing-CSS 30s hang + A2 text: selector reliability.** Both root causes fixed in `internal/bridge/action_common.go` (fast-fail via `chromedp.AtLeast(0)`), `internal/bridge/action_resolve.go` (textContent + 3s cap + leaf-most wins), and `internal/cli/actions/actions_element.go` (stop stripping the selector kind prefix). Baseline 85/85 green; Loop #30 agent used `text:` on 10+ cases with zero failures. Missing-CSS click now 87ms wall-clock (was ~30s).
-- **[Loop #17 batch — same session as coverage plan creation]** — Adopted
- native `pinchtab frame` in Group 19.2 (replacing the `eval +
- contentDocument` workaround), added Groups 31–34 covering nested /
- dynamic / srcdoc / sandboxed iframes, added six new fixtures
- (`iframe-nested.html`, `iframe-nested-2.html`, `iframe-nested-3.html`,
- `iframe-dynamic.html`, `iframe-srcdoc.html`, `iframe-sandbox.html`,
- `iframe-sandbox-content.html`). Baseline 77/77 on the expanded suite.
- Updated SKILL.md to replace the iframe-eval workaround rule with the
- native `frame` flow.
-
----
-
-## Resolved (archive — non-iframe)
-
-Populated as loops close items. Each entry: `- [Loop #N] <id> — <one-line
-description>`.
-
-- [Loop #30] A1 — Missing CSS selector hangs (now fast-fail <100ms via `chromedp.AtLeast(0)`)
-- [Loop #30] A2 — `text:<value>` selector reliability (fixed prefix stripping + `textContent`)
-- B1 — `download --output <path>` already implemented (`-o` flag exists)
-- B5 — `wait --not-text "..."` added; `--state hidden` already handled elements
diff --git a/tests/benchmark/scripts/pt b/tests/benchmark/scripts/pt
index 19c06143..acc8db0c 100755
--- a/tests/benchmark/scripts/pt
+++ b/tests/benchmark/scripts/pt
@@ -1,24 +1,64 @@
#!/usr/bin/env bash
#
-# Thin wrapper around `pinchtab` for the benchmark harness.
-# Handles Docker exec prefix only - NO tab management.
-# Agent must handle tabs via PINCHTAB_TAB env var per skill docs.
+# ./scripts/pt — transparent wrapper around `pinchtab` for the benchmark harness.
+#
+# It only does one thing: run the native `pinchtab` CLI inside the benchmark
+# Docker container (default `benchmark-pinchtab-1`) with the host-selected
+# environment. Every argument is forwarded as-is, so any
+# `pinchtab <subcommand> [args...]` invocation behaves exactly like the
+# installed CLI. Exit codes and stdout/stderr are preserved.
+#
+# The only abstraction this script provides is the Docker exec boundary:
+# - container selection via $PINCHTAB_CONTAINER
+# - auth + endpoint + tab + session env forwarded into the container
+# - stdin forwarding so pipes, heredocs, and process substitution work
+# (needed for e.g. uploads, piped eval expressions)
+#
+# Env inputs (all optional):
+# PINCHTAB_CONTAINER Docker container name (default: benchmark-pinchtab-1)
+# PINCHTAB_SERVER Pinchtab server URL (default: http://localhost:9867)
+# PINCHTAB_TOKEN Bearer token (default: benchmark-token;
+# set to "" for no auth header)
+# PINCHTAB_TAB Tab ID to target (default: active tab)
+# PINCHTAB_SESSION Agent session token (default: unset)
+#
+# Usage examples:
+# ./scripts/pt nav https://example.com
+# ./scripts/pt snap -i -c
+# TAB=$(./scripts/pt nav URL --print-tab-id)
+# ./scripts/pt --tab "$TAB" click e5
+# ./scripts/pt eval 'document.title'
+#
+# NOTE on shell-isolated callers (e.g. agent Bash tool calls where each
+# invocation is a fresh shell): `export PINCHTAB_TAB=$(./scripts/pt nav URL
+# --print-tab-id)` will NOT carry into the next call. Use `--tab "$TAB_ID"`
+# explicitly on every call that must pin to a specific tab, or rely on the
+# active-tab default for single-tab workflows.
set -euo pipefail
: "${PINCHTAB_CONTAINER:=benchmark-pinchtab-1}"
-# Use = (not :=) for TOKEN so that PINCHTAB_TOKEN="" sends no auth header —
-# needed for step 0.2 which tests unauthenticated access (401 expected).
+# Use = (not :=) so PINCHTAB_TOKEN="" means "send no auth header" —
+# benchmark step 0.2 uses this to test unauthenticated access (401 expected).
: "${PINCHTAB_TOKEN=benchmark-token}"
: "${PINCHTAB_SERVER:=http://localhost:9867}"
args=(docker exec
+ # -i keeps stdin open so pipes/heredocs/<() flow through to pinchtab.
+ # Safe for commands that don't read stdin: the child sees EOF immediately.
+ -i
-e "PINCHTAB_TOKEN=${PINCHTAB_TOKEN}"
- -e "PINCHTAB_SERVER=${PINCHTAB_SERVER}")
+ -e "PINCHTAB_SERVER=${PINCHTAB_SERVER}"
+)
+# Forward optional env vars only when set, so an empty value in the host doesn't
+# clobber a default inside the container.
if [[ -n "${PINCHTAB_TAB:-}" ]]; then
args+=(-e "PINCHTAB_TAB=${PINCHTAB_TAB}")
fi
+if [[ -n "${PINCHTAB_SESSION:-}" ]]; then
+ args+=(-e "PINCHTAB_SESSION=${PINCHTAB_SESSION}")
+fi
args+=("${PINCHTAB_CONTAINER}" pinchtab "$@")