--- name: vibesurfer version: 0.2.22 binary: vs description: Agent-native headless browser. A CLI and an MCP server over one local-socket wire protocol. Real WKWebView (macOS), WebKitGTK 6 (Linux), or WebView2 (Windows) — all three engines verified per-commit by a real-browser integration suite. Optimistic concurrency via state tokens; tree-delta wire format; durable session/page/auth state in SQLite. --- # vibesurfer (binary: `vs`) `vs` is a stateless CLI that talks to a daemon (`vs serve`, auto-spawned on first call) over a Unix socket. Not installed? `npx vibesurfer ` runs the same binary (downloaded and cached on first use); `vs skill install` wires it into every detected agent. The daemon owns one long-lived browser engine on the OS main thread and a SQLite store at `~/.vibesurfer/state.db`. Every primitive writes one audit row before returning — there's no opt-out, no untracked operation. ## Short forms are the default in agent contexts Every primitive has a short alias. Long forms exist for human-readable documentation; agent invocations should use the shorter form to save tokens. `vs o https://...` is the canonical shape for `vs open https://...`, not the other way around. The 19-primitive tables below lead with the short form and show the long form in parens; both work identically. Frequent flags also have short forms: `-S` (`--session`), `-j` (`--json`), `-F` (`--full`), `-s` (`--since`), `-n` (`--limit`), `-P` (`--page`). The `--token` flag stays verbose because it's never typed by hand — you paste it from the previous read. ## Use this tool when - You need to drive a real browser to read or interact with a web app (login, scrape behind auth, click through SPA state). - You need stable refs across snapshots so you can plan a multi-step interaction without scraping coordinates. - You want persistent auth (cookies + storage) that survives across sessions, encrypted at rest. - You want every action audited automatically — for replay, debugging, or compliance. ## Don't use this tool for - One-shot HTTP fetches with no DOM (use `curl`). - Anything where you'd be parsing the rendered HTML by string matching — `vs_view` already gives you a typed accessibility tree with stable refs. - Headless screenshots of fixed URLs with no interaction (overkill — though you can; see `vs capture`). ## Primitives Wire form is `vs_` (over the socket); CLI subcommand is `` with hyphens. Every command an agent uses is also an MCP tool of the same `vs_` (`vs net ` is `vs_net` with `op`; `vs record start|stop` is `vs_record_start`/`vs_record_stop`). `vs flow` is CLI only: over MCP each step is its own call. Each call returns a state envelope (`@` success, `! CODE` error, `? warning` lines before the envelope). ### Lifecycle (1–4) | # | CLI | What | |---|-----|------| | 1 | `vs session-open [--policy=NAME] [--isolated] [--intercept] [--popups]` | Create a session. Writes `~/.vibesurfer/active-session`. `--isolated`: own in-memory cookie/storage jar, shared by the session's pages only, gone on close or daemon restart. Default sessions share the persistent jar (logins persist). `--intercept`: route the pages through a daemon HTTP proxy for `vs net` (implies an own jar). `--popups`: `target=_blank`/`window.open()` open a new page in the session instead of in place; `vs status` lists it. | | 2 | `vs session-close [--all\|--idle-for=2h]` | Close the active session, or sweep the workspace: `--all`, or only what has been untouched that long. | | 3 | `vs open ` | Open a page in the session. | | - | `vs goto ` (`g`) | Navigate an existing page in place. Reuses the web view, so it skips browser spin-up and is much faster than open for successive navigations. Refs are fresh afterward. `--html FILE` loads that document under URL without fetching it. | | - | `vs flow run ` | Run a declarative flow: a JSON array of steps, each an array of `vs` args. Runs in one session; `$page` expands to the last opened/navigated page, `$token` to its current token (fetched as needed). Stops at the first failing step. | | - | `vs init-script ` | Run JavaScript at document start in every later document of the page, before its own scripts (Playwright's `addInitScript`). The current document is not touched. | | 4 | `vs close ` | Close a page. | ### Read (5–6, 13–14) | # | CLI | What | |---|-----|------| | 5 | `vs view [--full]` | A11y tree. First call after `open` is full; subsequent calls are deltas. | | 6 | `vs read ` | Full text of one ref. | | 13 | `vs status` | Sessions, pages, and `live=` — how many still hold a web view. `live` is the number that costs memory and processes. | | 14 | `vs log [--page=

] [--group=] [--since=] [--limit=N]` | Audit log slice. | | - | `vs inspect eval --frame=` | Evaluate inside one subframe, cross-origin too. `#0` is the newest frame. | | - | `vs inspect response` (`i res`) | Main document's HTTP response from the last navigation: `url=`, `status=`, `status_text=`, then `h : ` per header. `none` for `data:`, `about:blank`, `file:`, or a failed load. | ### Mutate (7, 9–12, 17) | # | CLI | What | |---|-----|------| | 7 | `vs act [VALUE] --token= [--group=

` (`pfw`). | When you need a secret the HUMAN holds — their real login, a TAN, a card number, anything you must never see — do not `vs act fill` it. Route it through the human: `vs prompt-input --message="" --secret --token=` (one field) or `vs prompt-form` (a whole login), so the value goes human -> daemon -> page and never enters your context. Include enough context in the message that they know which field they're filling. But a credential YOU own is not a secret to protect from yourself: a test user you just created, a seeded fixture account, a value from your own env/config. Fill those directly with `vs act fill` (plain inputs) or `vs type` (rich-text/framework inputs) — do NOT bounce them through `prompt-input`. Asking a human to type back a password you invented is pure friction, not security. **No tty — MCP or non-interactive CLI (v0.1.12+ MCP, v0.1.20+ CLI):** without a controlling tty (`vs mcp`, or `vs prompt-input` from an agent's shell), the call enqueues a pending entry on the daemon and parks waiting for the value. The local user runs `vs pending list` (alias `pe ls`) to see what's queued and `vs pending fulfill []` (`pe f`) to type the value at their local tty — `vs pending fulfill` with no id auto-picks the single pending entry. `vs pending cancel ` (`pe c`) aborts. Once fulfilled, the agent's MCP tool call returns the new state token exactly as it would have for the local-CLI path. `vs prompt-scan [--open]` (alias `ps`) shows the human a live view of the headless page (a QR code, a 2FA screen) and blocks until they press Enter, so out-of-band steps like scanning a TOTP enrollment QR work. Over MCP, compose the existing tools instead: call `vs_watch` for the live URL, relay it, then `vs_prompt_confirm` to wait. **Browser entry (v0.1.23+):** the human alternative to the tty. `vs pending url` (`pe u`) mints a single-use loopback URL; the page lists every pending entry as one form (secret fields masked, password managers can autofill), and one submit fulfills them all. `vs prompt-form` prints its own URL, scoped to that form's fields. Whole-login flow over MCP: call `vs_prompt_form` with all fields (`[{ref, label, secret}]`) — it returns `form` + `url` immediately; relay the URL to the user verbatim; then call `vs_prompt_form_wait` with the form id, which parks until submit and fills every ref in order. Values go browser → daemon → page; the agent never sees them. URLs are 127.0.0.1-only, 256-bit-nonce capability links, valid 10 minutes, spent by the submit and not by a GET — opening, reloading or previewing the link is safe. If the wait comes back `! TIMEOUT ... still waiting`, the form is live and the human is not done: call `vs_prompt_form_wait` (CLI: `vs pfw `) again with the same form id. Only `was cancelled` and `unknown` are dead. A fill that errors (`WRONG_SESSION`, `NOT_FOUND`) puts the values back: fix what the error names and call wait again — never ask the human to retype. A password field masks to `***` in the tree whatever its value, so empty → filled moves the state token but filled → *different* value does not: the masked tree is byte-identical. That is not a stale view. To confirm a secret landed, check the field went from placeholder to `***`, or use `cap`. Nothing value-derived goes in the tree — a hash would be brute-forceable for a short secret and a length leaks the length. ### Search / extract (8, 10, 18) | # | CLI | What | |---|-----|------| | 8 | `vs find ` | Substring search across all open pages in the session. | | 10 | `vs extract --token=` | `list` / `table` (rest are `BAD_REQUEST` until written). | | 18 | `vs layout ...` | `getBoundingClientRect` per ref. | ### Capture / persist (15–16, 19) | # | CLI | What | |---|-----|------| | 15 | `vs skill list \| show ` | List or show installed skill bundles. | | 16 | `vs capture [] [--full-page] [--base64]` | PNG to `~/.vibesurfer/captures/`. With `--base64` (`--b64`) the response body carries `base64=` + `path=…` (default ON over MCP, where the pixels arrive as a proper image content block, not text). The dir is auto-capped (newest 200 / 30 days) after each shot; `vs capture clean [--all] [--older-than 7d] [--keep 50]` prunes it on demand. | | 16b | `vs download [] [--dest=

] [--list] [--id=N]` | Save a file out of the page to `~/.vibesurfer/downloads/`. Alias `dl`. | **Downloads (v0.2.1+).** A headless web view has no download UI, so a file the page tries to save has nowhere to go. `vs download` is the way out, in two modes: - **You know the URL** — `vs download ` reads it *from inside the page*, so session cookies, referer, and same-origin rules apply. This is how you get a PDF that only an authenticated session may fetch. Relative URLs resolve against the current document. - **The page saved it itself** — `vs download ` with no URL drains the newest download the page started: a `download` link, a viewer's Save button, a `blob:` navigation, an export form or iframe whose response is an attachment (v0.2.14+). Those are captured as they happen (bytes and all, even when the page revokes the object URL a tick later), so click Save first, then call `vs download`. `--list` shows what is waiting; `--id=N` picks one entry instead of the newest. A `TIMEOUT` leaves the capture in place, so call again. The response body is `path` / `size` / `mime` / `url` rows — bytes never cross the wire. A failed read (401, revoked blob, over the 64 MiB cap) comes back as an error saying why, not as silence. Files are named from `Content-Disposition` or the `download` attribute, sanitized to a single path component; a repeat download gets a `-1`, `-2`, … suffix rather than overwriting. `--dest` overrides the name (relative paths stay inside the downloads dir). **Request interception (`--intercept` sessions).** Every request the pages make (documents, iframes, scripts, images, fetch) passes a per-session proxy. `vs net poll [--wait-ms=N]` prints and clears events: `req type= nav=<0|1> [frame=main|sub]`, `res `, `fin size=`, `fail `, `sw ` (a response a service worker built or took from its cache), `crash ` (the page's web content process died); `req`/`res` lines are followed by `h : ` lines, a request body by `body `. `vs net route on` holds each request until `vs net continue [--url U] [--method M] [--header 'k: v']... [--body-b64 B]`, `fulfill [--status N] [--header ...] [--body-b64 B]`, `abort [--error NAME]`; 30 s without an answer continues it. `vs net fetch ` performs a held request and prints the response without delivering it. `vs net body ` prints a kept response body (newest 16 MiB). `--header` replaces all headers. https is intercepted too (the daemon's CA, `~/.vibesurfer/intercept-ca.pem`, is trusted by intercept pages only); a fulfilled request never touches upstream. macOS WebKit never proxies `127.0.0.1`/`localhost`, so address local servers as `.localhost`. With `--popups`, poll also prints `page ` (before the popup's first request), `close `, and `dialog `; answer with `vs net dialog accept|dismiss [--text T]` (10 s, then dismissed). Answering a dialog that is no longer open (already answered, or dismissed) is `! NOT_FOUND`: the page did not get that answer. An `