Repository navigation
feat(sandbox): add @codev/sandbox package for sandbox Phase 0 - #196
Merged
Merged
Conversation
Platform-neutral core for the desktop sandbox that will run the codev sidecar inside a VM/container per platform (Virtualization.framework on macOS, a managed WSL2 distro on Windows, bubblewrap on Ubuntu): - SandboxProvider contract and sandbox:<name> server id - lifecycle controller generalized from the desktop WSL servers controller (runtime states, single-flight jobs, stale-start guards) - OS policies: hard block below macOS 12, warn-never-block Windows tiers - pinned manifest parsing + content-addressed sha256-verified staging of guest images and the mirrored WSL installer - egress broker skeleton: host-side proxy that forwards only to configured upstreams (default LLM gateway), deny by default - guest boot contract shared with the WSL sidecar Fork-only package; no upstream files touched, so no DIVERGENCES.md rows. Co-Authored-By: Claude Fable 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.
Summary
Phase 0 of the desktop sandbox feature: a new fork-only package
@codev/sandboxwith the platform-neutral core for running the whole codev sidecar server inside an isolated environment per platform — Virtualization.framework on macOS, a codev-managed WSL2 distro on Windows, bubblewrap on Ubuntu. Later phases add the per-platform providers, desktop main-process wiring, andpackages/appUI.What's included
provider.ts— theSandboxProvidercontract (create/start/destroy/reset, availability) and thesandbox:<name>server id, mirroring thewsl:<distro>connection convention.controller.ts— lifecycle state machine generalized frompackages/desktop/src/main/wsl/servers.ts:starting|ready|failed|stoppedruntimes, single-flight jobs with abort, stale-start-attempt guards, injected persistence.policy.ts— OS gates per the agreed plan: hard block below macOS 12 (Virtualization.framework/virtio-fs requirement) with an explanatory message; Windows is warn-never-block (no warning on Win11, warning on Win10 22H2, stronger warning below).manifest.ts/image.ts— pinned sandbox manifest (guest images + mirrored WSL MSI installer, one manifest so pins move together) and content-addressed SHA-256-verified download staging.broker.ts— the sandbox's only egress path: host-side proxy forwarding exclusively to configured upstreams (default: the LLM gateway). Deny by default; deliberately no full-outbound mode.boot.ts— guest boot contract shared with the WSL sidecar (env, serve args, credentials, health polling).const.ts— storage-bucket URLs (base64-obfuscated per@codev/brand/ codev-gateway convention).Notes
DIVERGENCES.mdrows (per divergence policy, fork-only files are untracked).CHANGELOG.mdentry: nothing user-facing ships yet; the entry comes with the first wired-up provider.Testing
bun testinpackages/codev-sandbox: 31 tests / 77 assertions across policy, manifest, image staging (real HTTP server, corruption + truncation cases), broker (end-to-end proxy + deny + 502), controller (ready/failed/exit/stale-restart/remove/reset/stopAll), and boot.bun typecheckinpackages/codev-sandbox: clean.🤖 Generated with Claude Code