Sandbox script-API: binary readFile, uploadFile(), domCua ids/errors, addInitScript guard - #121
Open
ao-kamal wants to merge 4 commits into
Open
Sandbox script-API: binary readFile, uploadFile(), domCua ids/errors, addInitScript guard#121ao-kamal wants to merge 4 commits into
ao-kamal wants to merge 4 commits into
Conversation
readFile() hardcoded UTF-8 decoding, silently corrupting binary (a screenshot
read back became replacement chars). Add an { encoding: "base64" } option
threaded through the sandbox bridge to temp-files, returning raw bytes as
base64 for lossless round-trips. Default remains utf8.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 9b5802f)
…help (P1-2, P2-2) skills/dev-browser/SKILL.md: replace the 19-line "run --help" stub with a condensed agent guide (method ladder, timeout clocks, named-page/daemon rules, sandbox limits). cli/llm-guide.txt: note DOM globals exist only inside page.evaluate(); add an exceptions block for setInputFiles/addInitScript with the canvas-inject upload workaround. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 16928a3)
…ch fs limits (P2-3, P2-4)
- domCua node ids now start small and sequential (1,2,3…) matching --help,
via a navigation-proof per-document seed block so cross-document ids never
collide (a naive seed=1 would silently resolve stale ids to wrong elements).
- Split the one collapsed "DOM node N is stale" error into four actionable
messages (unknown id / frame gone / element gone / scroll timeout).
- Authored error for the sandbox fs/path stubs (setInputFiles(path),
addInitScript({path})) naming the limitation and the canvas-inject / {content}
workarounds, replacing the opaque failure.
- Skip (not fail) the symlink test when the host can't create symlinks.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit f0a85ed)
…st (P2-1, P2-3)
- uploadFile(pageName, selector, { name, mimeType, base64|buffer }) — a daemon-side
host helper that calls real Playwright setInputFiles with a FilePayload buffer
(which works; only the host-path form fails in the sandbox). Verified landing a
real file on a real page. Ends the hand-rolled canvas-inject dance for uploads.
- addInitScript() now fails fast with an authored error for ALL forms
(function/string/content/path) — every form is unworkable in the sandbox; inject
via page.evaluate() after navigation instead.
- Shipped skill: note readFile(name, "base64") for binary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 11867a6)
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.
Script-API ergonomics fixes from an agent-ergonomics review.
readFile()binary mode — hardcoded UTF-8 silently corrupted binary (a screenshot read back became replacement chars). AddsreadFile(name, "base64")for lossless round-trips; default unchanged.uploadFile()helper — uploads required hand-rolling canvas→File→DataTransfer becausesetInputFiles({path})fails in the sandbox. Adds a daemon-side helper that calls real PlaywrightsetInputFileswith aFilePayloadbuffer (which works). Verified landing a real file on a real page.--helpexamples, via a navigation-proof per-document seed so cross-document ids never collide.addInitScript()now fails fast with an authored message for all forms (unworkable in the sandbox — inject viapage.evaluate()after navigation).--helpguide (sandbox exceptions to "full Playwright Page objects").New vitest coverage; full daemon suite green.