Repository navigation
feat(plugin): add bounded scanLines to the sandbox filesystem - #55
Merged
Merged
Conversation
Required on every backend: a window of a file's lines, bounded by maxBytes, in one pass and without holding more than the window. LineScanner is the streaming implementation the local VFS uses through positional reads; a POSIX sh + awk script with the same rules runs inside remote sandboxes so only the window crosses the network (Scan.viaShell). The scan is bounded by the file size seen when it starts, so a growing file cannot extend it. A shared corpus checks the scanner, the script and an independent reference against each other, every local backend, and live remote sandboxes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match the rest of the codebase, which uses TypeScript `private` rather than `#` fields; nothing outside the class reads them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sanchitrk
force-pushed
the
claude/sandbox-scan-lines
branch
from
October 9, 2026 14:13
84a10d9 to
20997b4
Compare
sanchitrk
added this pull request to stack #58
October 9, 2026 14:14
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.
Second of three stacked PRs — based on #54. Merge that first.
What
SandboxFileSystem.scanLines(path, { startLine, endLine?, maxBytes })— required on every backend'sProviderand onInterface. Returns a window of the file's lines bounded bymaxBytes, plus total lines/bytes and the first selected line's size, in one pass without holding more than the window.Scan.LineScanner: the streaming implementation. The local VFS feeds it through positional reads (vfs.open/read), since the VFS read stream loads the whole file and stalls before open.Scan.script+Scan.viaShell: the same rules as a POSIXsh+awkscript run inside remote sandboxes (Daytona, Vercel, and the vendored third-party Vercel driver), so only the window crosses the network.Rules
Lines split on
\n; a trailing newline ends the last line rather than starting one. A UTF-8 BOM at the start of the file is not part of the first line; one later in the file is text. Lengths are bytes.Testing
test/sandbox.scan.test.ts: a shared corpus (empty, BOM variants, CRLF, multibyte, blank lines,%/\nin text, trailing spaces, a file larger than one 64 KiB read, …) checked across an independent reference, the scanner fed byte-by-byte and whole, and the shell script under the host'ssh/awk. Artifact:__artifacts__/sandbox.scan.json.filesystemSpec) and live remote sandboxes (remote.spec); live Daytona and Vercel pass.🤖 Generated with Claude Code