Repository navigation
feat(cli): cuttle jev-browse - autonomous browsing loop on the bundled driver - #66
Merged
Merged
Conversation
tenequm
marked this pull request as ready for review
September 18, 2026 16:39
tenequm
enabled auto-merge (squash)
September 18, 2026 16:39
Adds packages/jev-step, a standalone binary that takes one browsing
decision per invocation: it snapshots the page with playwright-cli, sends
only the interactive elements' ids, roles and labels to TypeSafe's Jev,
and performs the typed action it gets back. The exit code is the result
(0 step taken, 2 goal reached, 3 escalate), so the caller branches on it
rather than parsing output.
Fill values come from plan.json verbatim, including {{cuttle:NAME}}
sentinels, and never reach the model: Jev chooses among the fill NAMES
and the value is looked up afterwards, locally.
The Jev client sits behind a small interface with a --mock backend, so
the whole loop runs end to end while API access is still waitlisted.
Nothing in the daemon imports this, and ops/docker/Dockerfile is
untouched: image integration lands after the playwright-cli bundling PR.
Three things could reach the page or end a run without clearing a check. A step-completion answer is a noul, and a noul carries no confidence field of its own - the probability IS the confidence. It was being read as a bare `> 0.5` boolean and short-circuited the loop before the threshold test, so a 0.51 coin flip could skip a step or exit 2 "goal reached". The probability now clears --confidence-threshold like every other answer. The chosen target was passed straight to `click`/`fill` without checking it was one of the elements this page actually offered, so a malformed answer - or the empty string a missing field decodes to - aimed a prepared value at nothing. It now escalates instead. In non-loop mode a finished step returned 0, the same code as "an action was taken", and the step index it advanced lived on a copy that was discarded. A bash caller following the documented contract re-ran the same --step forever without acting. Finished-step now has its own exit code, 4. Also: --max-steps counts actions, as it always claimed to; a failed call quotes TypeSafe's own body instead of a bare `http 422`; responses are drained so the connection is reused across a --loop run; the driver shell-out gets a deadline and a WaitDelay so a wedged playwright-cli cannot hang the tool; and the README stops presenting a third-party benchmark as first-party fact, names the 255 element cap and the un-enforced half of the privacy guarantee, and says that --mock still clicks the live page.
The module root moved to packages/cuttle while this branch was open, which left packages/jev-step outside every module: `go build ./packages/jev-step` from the repo root could not find a go.mod, and `just check` and CI both run with working-directory packages/cuttle, so nothing would have linted, built or tested it again - silently, with CI still green. Sitting beside cmd/cuttle restores every property the split was for: one module, `./...` covers it, no CI change. goreleaser names ./cmd/cuttle explicitly and the Dockerfile builds only that, so a second cmd does not start shipping in releases or in the image.
…d driver One command that browses toward a task on its own, with no LLM in the loop: each step reads the page's aria snapshot, offers the pruned action space to TypeSafe's System-One model as one bundled request (a `done` noul, a `blocked` noul, and the element pick), and performs the answer with the same bundled playwright-cli `cuttle pw` runs. The driver seam is `newPlaywrightRunner` in internal/cli/playwright.go: it reuses the existing resolve/exec/auto-attach machinery and captures output instead of streaming it, so the loop shares `cuttle pw`'s driver session and a stopped run can be picked up mid-state. This absorbs cmd/jev-step, which is deleted. Salvaged: the snapshot parser and its fixtures, fill-names-not-values, the min() confidence chain, the offered() refusal, modal escalation, the --mock transport and the 1/3 exit codes. Added: per-step history with label dedup and route pruning, grouped choices with a runoff, settle-until-stable instead of fixed sleeps, one re-aimed retry on a stale ref, `--extract`, `--json`, and a request-shape golden.
Playwright renders a field's value in the aria snapshot in full, password
fields included, so pageLines turned
into a page line and --extract sent it to the API. After a
`{{cuttle:NAME}}` fill that value is the substituted secret itself.
With --max-steps 0 the loop never entered its body: it read no page, took no action, and still printed a handoff brief naming an empty URL before exiting 4. A budget below one is a usage error, so say so and exit 1.
The budget runs out by acting, so the snapshot the loop still held was taken before the last click. Live run: the brief said example.com while the session sat on iana.org, under the line promising it was live at exactly that page. Read once more before promising.
ParseSnapshot documents that the last block of each kind wins, and the snapshot block resets on the header to make that true. The modal block did not, so the FIRST dialog in a multi-verb capture won - a dialog raised and then cleared would park the loop on a modal nothing clears.
Its comment claimed it gated what gets clicked or filled. It did not: the loop checks the model answer against the action space, which is what the model was actually offered. Tests now use element, and the settle comment no longer claims a still page costs no waiting - it costs one poll, as its own test asserts.
A capture parked behind an alert carries the modal block and nothing else - no Page URL line at all - so the blocked handoff read "page: <>" under the line promising the session is live at exactly that page. Fall back to the page the action that raised the dialog was taken on, and say nothing when there is no history either.
An OpenRouter key works in CUTTLE_TYPESAFE_API_KEY with nothing else to set: a key beginning sk-or- routes itself to OpenRouter's decisions endpoint and its pinned typesafe/jev-1.13, and every other key goes to the first-party API as before. The request body is identical across the two - only the URL, the auth and the model name differ - which the second golden pins, and the transport stamps its own model so one request builder serves both. Verified against the live API: the answers decode as they stand, and the probability distribution OpenRouter adds to a choice is read only as the confidence when none was sent. ## Release notes `cuttle jev-browse` now accepts an OpenRouter key in CUTTLE_TYPESAFE_API_KEY - any key beginning `sk-or-` is routed to OpenRouter's pinned Jev model instead of the first-party API, with no flag and nothing else to configure.
The verbatim probability distribution put a `password` option key one line away from another option key, which is exactly the shape this repo's own gitleaks rule exists to catch - so the pre-commit scan flagged a response body that holds nothing. Dropping the options the model gave a probability of zero keeps everything the test reads and leaves no label-next-to-entropy line behind.
After `go-back`, @playwright/cli 0.1.20 keeps emitting refs from the pre-navigation frame generation and rejects every click on one. `back` is offered on every page, so one back would brick the rest of the run. The loop now reads where the back landed and re-gotos that URL, which re-mints the refs.
…eanups Fail a runoff that would exceed the 255-option Choice cap by count instead of sending it. Cut labels on a rune boundary. Refuse --extract with --mock, which never answers done. Keep the capture's framing and link targets out of the extract's page lines, name the extract threshold, and correct decide()'s comment on a key another group offered.
--extract is an item picker, not a prose reader: the help and OPERATING.md now
say it prints matching lines verbatim and suits list-shaped answers. Also note
that --text values are argv, visible in the host's ps, and that a
{{cuttle:NAME}} sentinel keeps a secret out of it.
Replace the pending placeholder with microsoft/playwright#42777, record the standalone repro and its frame-qualified-refs condition, and name the pin tripwire test.
…ety, extract bounds A failed verb reported only "exit status 1": the driver's own message is now kept on the error. A question the API did not answer is a protocol failure rather than a verdict about the page. A retry no longer repeats an action the page moved under, and a failed action reaches --json readers. An extract is bounded by page lines, and an unnamed box stays addressable instead of collapsing into another one.
…its flag playwrightArgv indexed args[0] with no length check, which the loop's runner reaches without the help guard cuttle pw has. The --text parse error follows the package's feature-prefixed naming, the help stops splitting a code span across lines, and --max-steps says it counts decisions.
The secrets section claimed a value never travels in argv, which jev-browse --text now makes untrue, and a value typed into a GET search box ends up in the page URL the step log prints.
`cuttle jev-browse "find X"` is now sugar for --task, which stays canonical. Giving both is refused by name rather than resolved by a precedence rule nobody would remember.
A run with no --url on a fresh session read a blank tab and spent a step and a request to learn nothing; it now exits 1 saying to pass --url or navigate first. A 'none' with no --text values now says so in the brief, since without values the action space holds no typable option at all.
OpenRouter resolves typesafe/jev-1.13 to a dated snapshot, so it moves when TypeSafe ships a new one. The comment claimed an exact version.
tenequm
force-pushed
the
feat/jev-step
branch
from
September 18, 2026 16:43
178df0e to
e3478ac
Compare
This was referenced Sep 18, 2026
tenequm
added a commit
that referenced
this pull request
Sep 18, 2026
…plete THIRD-PARTY (#76) Docs-only follow-up to the jev-browse, lease and `--name`/`--context` merges (#66, #67, #69, #70, #71, #74). Fixes statements that are wrong on `main` today and fills the redistribution gaps in `docs/THIRD-PARTY.md`. No code, no SKILL.md, no CLI help text (those are a separate PR). Deliberately untouched: README's `--idle-timeout` wording (owned by #73), and nothing here documents #72 masking or #73 idle stop. ## Changes, each checked against the code **README.md** - `cuttle open` does not hold until Ctrl-C: it returns unless `--wait`/`--until` is given. Evidence: `packages/cuttle/internal/cli/commands.go` `newOpenCmd` Short/Long and the `runOpen` doc comment ("then returns"). Fixed in the quickstart comment and the contexts bullet. - "The Dockerfile is Python-free" was false. `ops/docker/Dockerfile:10-13` (openbox depends on `python3-minimal`) and AGENTS.md say so; the image also ships Node for the bundled driver (`Dockerfile:345-348`). Replaced with the accurate wording. - Driver line now leads with the bundled playwright-cli and says any other CDP client can attach, instead of naming agent-browser/browser-use (the image never shipped either; `Dockerfile:67-81` installs only `@playwright/cli`). - jev-browse is marked experimental. The anchor `#autonomous-browsing-loop-jev-browse` still resolves, since the OPERATING heading is unchanged. - Licensing paragraph lists playwright-cli (Apache-2.0), Node.js (MIT) and the persona fonts. **docs/THIRD-PARTY.md** - New: `@playwright/cli` 0.1.20 plus `playwright` and `playwright-core` 1.64.0-alpha-2026-09-14. Read from the installed `package.json` files in a locally built image: all `"license": "Apache-2.0"`, author Microsoft Corporation. The image ships each package's `LICENSE`, and `playwright`/`playwright-core` also ship `NOTICE` (quoted verbatim) and `ThirdPartyNotices.txt`. - New: Node.js, the `node` binary copied from `node:22-trixie-slim` (`Dockerfile:73,345`). MIT for Node itself, from the v22 `LICENSE`, plus its bundled dependencies. The image carries the binary but not Node's LICENSE file (checked: it is absent from both `node:22-trixie-slim` and the cuttle image), so the doc links the full text. - Replaced "Windows font pack (OFL 1.1)" with "Persona font packs". The old section claimed OFL for everything, but the packs (`Dockerfile:97-190`) also include WenQuanYi Zen Hei (GPL-2 with font embedding exception, plus the M+ FONTS License), IPAGothic (IPA Font License 1.0), Loma (GPL-2+ with font exception) and, in the macOS pack, DejaVu (Bitstream Vera license). Every license was read from `/usr/share/doc/<pkg>/copyright` after installing the exact Debian trixie packages the `fontbase` stage installs. The old section also pointed at font files "under `ops/docker/winfonts/`", which has held only a README since the pack moved to build time. - The claim that copyright and license records survive renaming is backed by `scripts/rename-fonts.py:44-52`, which rewrites only name IDs 1, 3, 4, 6 and 16. - New short "Debian packages" section. Their copyright files ship at `/usr/share/doc/<pkg>/copyright` (checked in the image: 343 entries, openbox and kasmvncserver included). **ops/docker/winfonts/README.md** - Stale paths and stage names fixed: `/opt/winfonts` and `fontpack` became `/opt/personafonts` and `personafonts-amd64` (`Dockerfile:112,304,319`). The old `docker build --target fontpack` no longer works. License column corrected for WQY and Loma to match the Debian copyright files. **docs/OPERATING.md** - Driver section: `cuttle pw --help` is the wrapper's help, and `cuttle pw <verb> --help` passes through to the driver. Evidence: `cli/playwright.go` `runPlaywright` intercepts a leading `-h`/`--help`; `playwrightReadOnly` passes help through the lease gate. playwright-cli 0.1.20 has no `help` verb: `playwright-cli help` prints `Unknown command: help`. - Driver section: never re-run `attach`/`open` mid-session. Both call `startSession`, which stops the existing session, and `open` with no URL goes to `about:blank` (playwright-core `lib/tools/cli-client/program.js`, `startSession` and `case "open"`). - jev-browse: marked experimental. Also documents: the positional task as sugar for `--task` (`cli/jevbrowse.go` `jevTask`); `--url` required on a blank session (`jev/loop.go` `errNoStartPage` and its `step == 1 && l.URL == ""` check); `--extract` runs on every ending (`jev/loop.go` `stop`); and phrasing tasks as reaching a page, because a run ends done only at `dec.Done >= doneThreshold` (0.8, `jev/decide.go`); the handoff keeps the same `--name`/`--context`. - Lease: `cuttle pw` never takes the lease itself. `gatePlaywright` in `cli/lease.go` only reads it or force-releases on `--takeover`, so concurrent `cuttle pw` agents are not serialized. - Secrets: `cuttle --name staging secret ls` replaces the redundant `--cdp-port 9333`. `--name` is a root persistent flag (`cli/commands.go` `addInstanceFlags`), and secret verbs go through `sessionEndpoint` then `resolveRunning`, which discovers published ports. - Ports: the auto-discovering verbs are now listed completely (`status`, `open`, `downloads`, `secret`, `auth`, `grab`, `down`, which are all `resolveRunning` callers), and `pw`/`jev-browse` exec in the container with no host port (`playwrightExecer`). **AGENTS.md** - Layout listed a nonexistent "profile store" package. It now matches `packages/cuttle/internal/`: atomicfile, backend, cdp, cli, config, fingerprint, jev, mask, serve and xdg. `docs/plans/` added. **docs/knowledge (OKF, hand-indexed; descriptions unchanged, so `index.md` is unchanged)** - `references/jev-browser-cli-surfaces.md` said "`--task` (required)" and "no positional sugar". Both are contradicted by `cli/jevbrowse.go` (`Use: "jev-browse [task]"`, `jevTask`). Rewritten, `--takeover` added with a link to the lease decision, and `generated` bumped. - `findings/playwright-cli-attach-model.md`: added that `open` restarts the session like `attach` and goes to `about:blank` with no URL, and that there is no `help`/`docs` verb. New source `core` (playwright-core at the pinned version); `generated` bumped. **Polish pass (ba328ba)** - `findings/playwright-cli-attach-model.md` said `attach` discards tabs. A live re-attach and `open` against the pinned playwright-cli in the image kept all three tabs (reordered); only refs and the current-tab selection reset. Corrected; OPERATING now says `open` with no URL navigates the *current tab* to `about:blank`. - README: `--wait` holds until the page leaves the URL's origin, `--until` until its condition (was "reaches a condition" for both). - Comment-only, out of the docs tree: `ops/docker/Dockerfile` (two comments) and `packages/browser/validate/smoke.py` still named the removed `fontpack` stage and `/opt/winfonts`. ## Verification - `just check` green (lint, version-files, 725 tests). Commit is signed. - All changed files are ASCII-only. The license URLs return 200. - Knowledge frontmatter parses with `type`/`description`/`generated` present, and the new bundle-relative link resolves. ## Release notes Docs: README no longer says `cuttle open` holds until Ctrl-C or that the image is Python-free, jev-browse is marked experimental, and THIRD-PARTY now covers the bundled playwright-cli, Node.js and every persona font license.
tenequm
added a commit
that referenced
this pull request
Sep 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.15.0](v0.14.2...v0.15.0) (2026-09-21) ### Features * bundle playwright-cli into the image with a cuttle pw passthrough ([#67](#67)) ([28d9846](28d9846)) * **cli:** center the skill and briefing on cuttle pw, drop host driver routing ([#75](#75)) ([33eca16](33eca16)) * **cli:** colored jev-browse output ([#70](#70)) ([cf6f109](cf6f109)) * **cli:** cuttle jev-browse - autonomous browsing loop on the bundled driver ([#66](#66)) ([0496957](0496957)) * **cli:** deliver pw action snapshots as a host file, secrets masked ([#103](#103)) ([78adbbb](78adbbb)) * **cli:** make --context/--name global so pw and jev-browse reach any instance ([#74](#74)) ([9df5c33](9df5c33)) * **cli:** zero-ceremony cuttle pw - auto-attach on demand, allow open ([a7e6491](a7e6491)) * **jev:** withhold write actions and halve jev-browse run time ([#102](#102)) ([9ca9386](9ca9386)) * **serve:** mask password field values in /snapshot ([#109](#109)) ([2a352b5](2a352b5)) * **serve:** session lease - one driver at a time, with takeover ([#69](#69)) ([87724c8](87724c8)) ### Bug Fixes * **backend:** keep profile cleanup and remote argv from reaching past their own ([#92](#92)) ([f52cfd3](f52cfd3)) * **cli:** close the gaps a review of the lifecycle fixes found ([#90](#90)) ([c46aa5e](c46aa5e)) * **cli:** close the lifecycle gaps a stress run left open ([#88](#88)) ([899a535](899a535)) * **cli:** discarding the profile removes the instance's host snapshot dir ([#113](#113)) ([57cd07a](57cd07a)) * **cli:** downloads --wait accepts a finished download, logs drops D-Bus spam ([#111](#111)) ([dcc2f46](dcc2f46)) * **cli:** name the in-page dialog behind a pw click timeout ([#99](#99)) ([11beeeb](11beeeb)) * **cli:** never fall back to another instance when the selected one is stopped ([#78](#78)) ([a1df361](a1df361)) * **cli:** re-attach the driver after a restart leaves a stale session ([#77](#77)) ([bbeb0f0](bbeb0f0)) * **cli:** run --extract on every ending, not only done ([#71](#71)) ([4954195](4954195)) * **jev:** judge done on the page that landed, and end done on a none above even odds ([#108](#108)) ([a9cb5a8](a9cb5a8)) * **jev:** offer filter-apply controls the write gate withheld ([#114](#114)) ([bdf440a](bdf440a)) * **jev:** read quoted snapshot lines and keep field values out of --extract ([#89](#89)) ([09111a2](09111a2)) * **pw:** compact find output, downloads into a directory, quieter logs ([#116](#116)) ([62f2ca8](62f2ca8)) * **pw:** snapshot links a host file like an action, and the console log line names its verb ([#110](#110)) ([c902c58](c902c58)) * **serve:** dismiss a native dialog the driver leaves open ([#87](#87)) ([14f24cb](14f24cb)) * **serve:** keep the default seed's downloads across browser relaunch ([aac8e40](aac8e40)) * **serve:** keep the dialog watch alive through a signal shutdown ([#94](#94)) ([4f4f1d0](4f4f1d0)) * **serve:** pool-mode reaping, capture tab, hung tabs and launch bursts ([#86](#86)) ([3b42ea2](3b42ea2)) * **serve:** skip an idle reap whose timer a launch has since re-armed ([#93](#93)) ([c667868](c667868)) * **smoke:** never exec into a container the run was not pointed at ([#79](#79)) ([9075244](9075244)) * **viewer:** keep websocket inside proxy prefix ([#62](#62)) ([3b10ba7](3b10ba7)) ### Performance Improvements * **cli:** run a pw verb in one docker exec, lease check included ([#100](#100)) ([a9c3c90](a9c3c90)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed title:
feat(cli): cuttle jev-browse - autonomous browsing loop on the bundled driverWhat this is
cuttle jev-browse --task "..."drives cuttle's browser toward a goal on its own, oneaction at a time, with no LLM in the loop. Each step reads the page with the same
bundled playwright-cli that
cuttle pwruns, offers its interactive elements toTypeSafe's Jev (a System-One model that only ever CHOOSES - it generates no text), and
performs the element it picks. A decision comes back in a few hundred milliseconds and
costs a fraction of asking an LLM which button to press next.
It replaces the
cmd/jev-stepexperiment this PR started as: the plan file, theper-invocation exit-code protocol and the standalone binary are gone. One command, one
required flag, and the loop lives inside cuttle where the driver and the browser
already are.
Why
The two-week session audit in
docs/2608-18-improvements-issues-research/is theprovenance. Across the window agents issued 2,749 driver invocations and 592 snapshots,
and one session ran snapshot-to-click at exactly 1:1 (261:261) - a full model round trip
for every single click, on pages where the next element is obvious from the
accessibility tree. The audit's other half, the upstream sweep, found the same shape
solved out in the ecosystem by loop-style browsing agents, but always bundled with their
own browser and their own stealth story, which is precisely the part cuttle already
owns. So the piece worth building was only the decision loop: keep cuttle's browser,
keep the bundled driver, keep humanized input and the human handoff, and take the
"which element next" question off the LLM's critical path.
Design
elements -> one request that asks every question at once (which action, which element,
which prepared value, is the task done, is it blocked) -> execute through
playwright-cli -> snapshot again. The reported confidence is the weakest of the
answers the chosen action actually depends on.
cuttle pw. The loop is a client of the same in-containersession daemon, so whatever the outcome the browser is left on exactly the page it
stopped at, with its tabs and refs intact. Exit
3(blocked) or4(out of steps) isa handoff, not a dead end:
cuttle pw snapshotand manual verbs continue from there,nothing to re-navigate and nothing to re-authenticate.
other driver action, with no fast path - that is the value proposition, not a cost to
optimize away (
docs/knowledge/decisions/humanize-over-speed.md).--text name=valuesupplies what may be typed; only theNAMES are sent to the model, and the value is looked up locally afterwards and handed
to the driver verbatim - which is what lets a
{{cuttle:NAME}}sentinel fromcuttle secret setpass through untouched and be substituted inside cuttle's CDP frame. Pagetext and element labels are data throughout: quoted into the log, offered as choices,
never followed as instructions.
CUTTLE_TYPESAFE_API_KEYisread on the host, never a flag and never a config key, so it cannot reach argv or
config.toml, and the container never sees it.How to try it
Keyless, to see the machinery end to end (
--mockdecides locally, without judgement,but still clicks and types the live page - point it somewhere you are happy to have the
first button pressed):
cuttle up cuttle jev-browse --task 'find the contact page' --url https://example.com --mockLive:
When it stops blocked, carry on by hand against the live page:
Docs in this PR
internal/cli/SKILL.md- a "goal-shaped task? run the loop first" rule, plus thecuttle pwwording sharpened to say what it is: transparent passthrough to thebundled playwright-cli, where any playwright-cli knowledge applies verbatim and
cuttle pw --helpis the driver's own help. The file stays inside its 16 KiB budget;existing rules were tightened to pay for the new ones.
blocked ->
cuttle pwhandoff named.docs/OPERATING.mdgains an "Autonomous browsing loop (jev-browse)" section: the key,--mock, exit codes, the shared session, and an honest note that what is fast is thedecision, not the action - a 20-step run's wall clock is still dominated by the
browser.
README.mdgets two sentences beside the existing bundled-driver paragraph.Release notes
New
cuttle jev-browse --task "..."drives the browser toward a goal itself: a fast decision model picks each next element and the bundled playwright-cli acts, in thecuttle pwsession. Set CUTTLE_TYPESAFE_API_KEY (TypeSafe or OpenRouter key) or pass --mock; finish blocked runs withcuttle pw.