Skip to content

provider sandbox#15311

Draft
lgrammel wants to merge 1 commit into
mainfrom
lg/sKqAqnE
Draft

provider sandbox#15311
lgrammel wants to merge 1 commit into
mainfrom
lg/sKqAqnE

Conversation

@lgrammel
Copy link
Copy Markdown
Collaborator

Background

Summary

Manual Verification

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

Related Issues

felixarntz added a commit that referenced this pull request May 18, 2026
… wrappers to `Experimental_Sandbox` abstraction (#15345)

## Background

`Experimental_Sandbox` (previous: #14949, #15253, #15301) only exposed
`description` and `runCommand`, so tools that needed file I/O had to
wrap every read/write in a shell command (`cat`, `tee`, `echo > …`).
That is fragile for binary content and impossible to type properly.

## Summary

- Adds six file methods to `Experimental_Sandbox`: streaming
`readFile`/`writeFile` as the foundation, plus
`readBinaryFile`/`readTextFile` and `writeBinaryFile`/`writeTextFile` as
convenience wrappers.
- All methods take a single options object so additional fields can be
added without breaking the signature.
- Using a stream for the foundation is the most low-level and
future-proof primitive, plus it handles large files better.
- In a follow up PR, we'll add another reduced abstraction surface,
because technically a sandbox provider shouldn't have to implement the
convenience wrappers `readTextFile`, `writeTextFile`, etc. This can take
inspiration from (or continue with) #15311.
- Updates the three example sandbox implementations (`LocalSandbox`,
`JustBashSandbox`, both `VercelSandbox` copies) to implement the new
methods, using streaming `readFile`/`writeFile` as the foundation that
the binary and text variants delegate to.

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

See above: We'll need to add that reduced abstraction surface so that
only essential methods _have_ to be implemented by the provider. We can
provide a helper function to fill in the convenience wrappers
automatically.
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