Add sandboxed step executor with VFS-backed I/O#25
Merged
Conversation
Update actions/upload-artifact and actions/download-artifact from v4 to v5. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extend the in-memory VFS with directory semantics needed by the ShellEnv bridge: remove deletes a key, mkdir creates a directory marker, is_dir checks for markers or child-key prefixes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce src/browser/ as a target-agnostic sandbox execution layer: - vfs_shell_bridge: wires VirtualFs into ShellEnv DI callbacks - step_executor: runs shell steps entirely in-memory, parses GITHUB_OUTPUT/GITHUB_ENV from VFS - api_js: JS binding example that registers plan/executeShellStep/ executeWasmStep on globalThis._actrun_browser The core layer (vfs_shell_bridge + step_executor) builds with any target (native/js/wasm/wasm-gc). The JS binding demonstrates how to expose it to a browser environment with pre-compiled WebAssembly.Module support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The package is a target-agnostic I/O sandbox layer, not browser-specific. - BrowserStepResult → StepResult - register_browser_api → register_api - globalThis._actrun_browser → globalThis._actrun_sandbox - justfile: build-browser → build-sandbox Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce trait Fs as the filesystem abstraction for sandbox execution. Callers inject their own implementation instead of depending on VirtualFs. - Add Fs trait with fs_write/fs_read/fs_exists/fs_is_dir/fs_mkdir/fs_remove - Add MemFs as the default in-memory implementation - Rename vfs_shell_bridge → fs_shell_bridge (accepts &Fs) - step_executor now takes &Fs parameter - Remove wasi_runner import from sandbox/moon.pkg - parse_key_values operates on &Fs instead of VirtualFs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Drop fs_ prefix from Fs trait methods (write/read/exists/is_dir/mkdir/remove) - Fix duplicate dir_key/prefix computation in MemFs.is_dir and VirtualFs.is_dir - Merge double JSON match blocks in exec_shell_handler and exec_wasm_handler - Replace manual to_upper with stdlib String::to_upper() - Add 16 direct unit tests for MemFs and parse_key_values edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove TOCTOU exists-before-write in step_executor (write is idempotent) - Simplify MemFs.remove to single map lookup - Extract extract_string_map/extract_workdir helpers in api_js - Remove restating doc comments from fs.mbt, memfs.mbt, fs_shell_bridge.mbt Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
src/sandbox/— a target-agnostic sandboxed execution layer withtrait Fsfor DIremove/mkdir/is_dirto VirtualFs for directory semanticsDesign
The sandbox package defines a
trait Fsfilesystem abstraction. Callers inject any implementation — no dependency onwasi_runner. Ships withMemFsas the default in-memory implementation.Builds with any target (
--target native/js/wasm/wasm-gc).Test plan
moon test src/sandbox— 31/31 passmoon test --target native— 852/852 pass (no regressions)moon check src/sandbox --target js— JS target compiles OKjust build-sandbox— build succeeds🤖 Generated with Claude Code