Skip to content

feat(vision): write a capture to a file, at a size, of the whole page - #5

Merged
trancong12102 merged 2 commits into
mainfrom
feat/vision-file-capture
Nov 18, 2026
Merged

trancong12102 merged 2 commits into
mainfrom
feat/vision-file-capture

Conversation

@trancong12102

Copy link
Copy Markdown

Summary

vision can now write a PNG to a file, at an exact size, of the whole page, so an agent has no reason to start its own headless Chrome for a screenshot.

Type

  • fix
  • feat
  • stealth
  • perf
  • docs
  • chore

What changed

Agents with these tools still launched a headless shell for three jobs: a PNG deliverable, a capture at a fixed size, and a full-page reference. vision returned only an inline image of the viewport.

  • path writes the PNG to a file and returns the path and pixel size, with no image block. The file is written beside its target under a name of its own and renamed over it. A relative CLI path is the caller's, not the daemon's.
  • size (WxH[@scale]) sets the viewport for that capture only and hands it back after, including when the capture fails. The image is exactly that size on any display, and the result says so when it is not.
  • full captures the whole page. It is measured in the pixels a clip uses, so a zoomed page is not cut short, and it is cut with a note where one capture cannot hold it.
  • run takes vision steps, which always save to a file.
  • A capture is at most 16,384 px on a side and 40 megapixels. The CDP message cap goes from 64 to 224 MiB so a reply carrying one never closes the browser connection.
  • A host's note now stands in place of the attached-browser note in the MCP instructions. A host on the real lane with a saved attach mode got both, and they contradicted each other.

This changes the vision and run tool schemas, at the maintainer's request. The tool count stays at 5. CHANGELOG.md is left for the release.

Checklist

  • cargo clippy --release --all-targets -- -D warnings passes
  • cargo test --profile gate passes
  • cargo build --release produces a clean binary (built with --profile gate locally; CI builds release)
  • Commit message follows conventional commits (feat: / fix: / stealth: / docs:)
  • No new tools added (surface stays at 5: act/see/state/run/vision)
  • No LLM inference added inside the driver

How it was verified

  • cargo fmt --check, clippy with -D warnings, cargo test --profile gate (502 lib tests plus the others), and the rename check all pass.
  • Standalone against Chrome for Testing: 1920x1080, 3840x2160 (@2), 1170x2532 and a full page came back at the exact pixel size, and the viewport was back to its old size after each one, including after a capture that failed.
  • Inside Onicode's Browser panel with this build: the same sizes on a visible and a minimized window, a full page at 125% zoom with its last section present, and size together with full.

Stealth changes (if applicable)

Not touched.

🤖 Generated with Claude Code

trancong12102 and others added 2 commits November 19, 2026 02:48
Agents kept starting their own headless Chrome for screenshots: `vision`
returned only an inline image of the viewport, so a PNG deliverable, a
capture at a fixed size or a full-page reference had no tool.

- `path` writes the PNG to a file and returns the path and pixel size,
  with no image block. The file is written beside its target and renamed
  over it; a relative CLI path is the caller's, not the daemon's.
- `size` (`WxH[@scale]`) sets the viewport for that capture only and
  hands it back after, including when the capture fails. The image is
  exactly that size on any display, and the result says so when it is
  not.
- `full` captures the whole page, measured in the pixels a clip uses so
  a zoomed page is not cut short, and cut with a note where one capture
  cannot hold it.
- `run` takes `vision` steps, which always save to a file.
- A capture is at most 16,384 px on a side and 40 megapixels. The CDP
  message cap goes from 64 to 224 MiB so that a reply carrying one never
  closes the browser connection.
- A host's note stands in place of the attached-browser note in the MCP
  instructions; a host on the real lane with a saved attach mode got
  both, and they contradicted each other.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Chromium reports a page's CSS size rounded down, so at a pixel ratio
other than 1 a full capture left out the page's last drawn row or
column: a 1000.5px page at a ratio of 2 came back 2000 px tall, not
2001. The clip is now sized from the size the page is drawn at, where
the page's ratio accounts for it. Under an emulated ratio the drawn size
is not scaled, and the CSS size stands as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@trancong12102
trancong12102 merged commit a1e34db into main Nov 18, 2026
16 checks passed
@trancong12102
trancong12102 deleted the feat/vision-file-capture branch November 18, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant