Skip to content

feat(sandbox): add @codev/sandbox package for sandbox Phase 0 - #196

Merged
quickbeard merged 1 commit into
mainfrom
sandbox-phase-zero
Aug 11, 2026
Merged

quickbeard merged 1 commit into
mainfrom
sandbox-phase-zero

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Summary

Phase 0 of the desktop sandbox feature: a new fork-only package @codev/sandbox with 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, and packages/app UI.

What's included

  • provider.ts — the SandboxProvider contract (create/start/destroy/reset, availability) and the sandbox:<name> server id, mirroring the wsl:<distro> connection convention.
  • controller.ts — lifecycle state machine generalized from packages/desktop/src/main/wsl/servers.ts: starting|ready|failed|stopped runtimes, 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

  • Fork-only new package: no upstream files touched, so no DIVERGENCES.md rows (per divergence policy, fork-only files are untracked).
  • No CHANGELOG.md entry: nothing user-facing ships yet; the entry comes with the first wired-up provider.
  • Runtime code uses Node APIs only (no Bun-only calls) so it can run in the Electron main process; tests use Bun.

Testing

  • bun test in packages/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 typecheck in packages/codev-sandbox: clean.

🤖 Generated with Claude Code

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>
@quickbeard
quickbeard merged commit bf9e4c9 into main Aug 11, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the sandbox-phase-zero branch August 11, 2026 18:49
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