Skip to content

feat(desktop): wire sandboxes into the desktop app - #203

Merged
quickbeard merged 3 commits into
mainfrom
sandbox-desktop-wiring
Aug 12, 2026
Merged

quickbeard merged 3 commits into
mainfrom
sandbox-desktop-wiring

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

The desktop wiring for the sandbox backends (post-Phase-3 integration): three commits taking @codev/sandbox from zero consumers to a usable feature — packaged server bundle → main-process controller + IPC → renderer/settings UI. Mirrors the WSL servers vertical slice one-for-one so upstream conflicts resolve the same way in both.

Commit 1 — ship the server bundle as a mountable resource

Every provider bind-mounts a real dist/node directory into its guest; the copy inlined via virtual:codev-server can't serve that. Packaged builds now carry server-bundle as an extraResource (node.js + *.wasm only — the 54MB sourcemap outweighs the bundle and is excluded), and the fork-only serverBundleDir() resolves it under process.resourcesPath, falling back to the workspace build in dev. Both stay version-locked to the running app. Covered by a new builder-config test.

Commit 2 — main-process controller + IPC

Fork-only src/main/sandbox/{controller,ipc}.ts: platform dispatch (darwin → vz, win32 → wsl, linux → bwrap), createSandboxController with store-backed persistence (sandboxes key), resolveImage via the manifest. WSL resolves the bwrap-* manifest asset — the manifest only publishes bwrap/vz images and WSL boots the same rootfs tarball. sandbox-* IPC channels registered beside the WSL ones; no unavailable-stub split because availability() itself carries the unsupported message or the warn-never-block Windows warnings.

Commit 3 — renderer + settings

  • App-owned wire types (packages/app/src/sandbox/types.ts, exported as ./sandbox/types like ./wsl/types), SandboxesProvider context with state + availability queries, preload api.sandboxes.
  • Third ServerConnection.Sidecar variant { variant: "sandbox"; name } keyed sandbox:<name>; ready sandboxes appear in the server list, and a fork-only startupServer wrapper keeps a persisted sandbox: default from blocking launch until the sandbox is ready (same rule the WSL slice applies to wsl: keys).
  • Settings → Servers: sandbox rows (status/job meta, start, reset, set-default, delete) beside the WSL section, and an Add sandbox dialog with native folder picker and the availability banner — unsupported blocks creation, the Win10 warning is shown but never blocks.
  • handleRemove routes sandbox: keys to the controller so delete actually unregisters the VM/distro; en+es strings added.

Verification

  • Desktop: 75 tests pass (3 new connection tests, 1 new builder-config test); app: 657 pass; full-repo typecheck green.
  • DIVERGENCES rows added for all upstream-file edits (main wiring, renderer slice); CHANGELOG entry under Unreleased.
  • Not verified end-to-end in a running app: needs a published image + the packaged codev-vmm extraResource (tracked follow-ups) — dev-mode vz/bwrap paths can be exercised once a local image is staged.

🤖 Generated with Claude Code

quickbeard and others added 3 commits August 12, 2026 18:52
The sandbox providers bind-mount a real dist/node directory into the
guest, which the server copy inlined via virtual:codev-server cannot
provide. Packaged builds now carry it as the server-bundle
extraResource (node.js + wasm only; the sourcemap outweighs the
bundle), and serverBundleDir() resolves it there or falls back to the
workspace build in dev, keeping both version-locked to the running app.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Builds the per-platform provider (macOS vz, Windows wsl, Linux bwrap;
wsl and bwrap share the bwrap rootfs asset, only vz has its own image),
feeds it into createSandboxController with store-backed persistence,
and registers the sandbox-* IPC channels beside the WSL ones. No
unavailable-stub split: the controller exists everywhere and
availability() carries the unsupported message or the warn-never-block
Windows warnings to the renderer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the renderer slice over the sandbox controller: app-owned wire
types (mirroring wsl/types), a SandboxesProvider context with state and
availability queries, preload api.sandboxes over the sandbox-* channels,
a third ServerConnection.Sidecar variant "sandbox" keyed sandbox:<name>,
ready-sandbox connections in the server list with a startup fallback so
a persisted sandbox default never blocks launch, and a settings section
with add dialog (native folder picker, warn-never-block availability
banner), start/reset/default/delete actions, and en+es strings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 2c8dccc into main Aug 12, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the sandbox-desktop-wiring branch August 12, 2026 12:12
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