Repository navigation
feat(harness): read built-in tool - #45
Merged
Merged
Conversation
…ion handling in read tool
Rewrite `read` to match Pi's read tool: Pi's parameters, description, prompt snippet and continuation notices; text read through `scanLines` so only the shown window leaves the sandbox; images detected by magic bytes (animated PNGs excluded), converted and resized with Photon on a worker thread with EXIF orientation applied; binary files reported as unsupported; macOS path spellings resolved. Add `readBytes` to the sandbox filesystem contract, with a base64 shell form for remote backends, and an optional `encodeDetails` on tool definitions so a payload carried in content is not stored twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Rewrites the built-in
readtool to match Pi's, and adds the contract pieces it needs.readpath,offset,limit), description, prompt snippet/guideline and continuation notices, verbatim.scanLines: only the shown window leaves the sandbox. Output is capped at 2000 lines / 50KB, and the cap also holds after invalid UTF-8 is decoded.GIFstays text. BMP is converted to PNG, EXIF orientation is applied, and images are resized to fit within 2000×2000 and 4.5MB using Photon on a worker thread (falling back to the current thread if no worker can start).Unsupported read <path>: binary file.@are normalised.Contract changes
SandboxFileSystem.readBytes(path, offset, length): bounded byte reads. Remote backends use a base64 shell script. Implemented in the local VFS, Daytona, Vercel and the extras Vercel driver.ToolDef.encodeDetails: optional; picks whichdetailsare stored, so an image carried in the content is not stored a second time.Tests
tools.read.test.ts: E2E through the harness with one parallel tool turn covering 30 cases, snapshotted to__artifacts__/tools.read.json.tools.read.differential.test.ts: ported from Pi. 400 random files × 4 offset/limit trials, compared against a whole-file reference read.readBytes, verified on real Daytona and Vercel sandboxes.Arguments are sampled strictly (
json_schema,prefer), as in Pi, now that aikit converts strict schemas (#61).🤖 Generated with Claude Code