Skip to content

feat(ai-autopilot): WebContainerRunner (in-browser sandboxed runner)#223

Merged
suleimansh merged 1 commit into
mainfrom
suleimansh/feat/109-webcontainer-runner
Jul 4, 2026
Merged

feat(ai-autopilot): WebContainerRunner (in-browser sandboxed runner)#223
suleimansh merged 1 commit into
mainfrom
suleimansh/feat/109-webcontainer-runner

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Third real Runner adapter after Local and Docker, wrapping @webcontainer/api. Untrusted agent code runs entirely in a browser tab (in-browser Node, isolated fs, instant preview() URL), nothing touches the host.

The honest-verification part. WebContainer only boots in a cross-origin-isolated browser, so it can't be tested from node --test like Docker. I checked whether a real boot proof was even feasible before writing the adapter: yes. There's a headless-Chromium harness under harness/webcontainer/ that drives the compiled adapter end to end and it passes 15/15 locally (boot, fs, exec incl. timeout kill, start, a real *.webcontainer-api.io preview URL, an in-container serve check, dispose, reboot). So this ships verified, not on faith.

Shape

  • @webcontainer/api is an optional peer, imported lazily (dynamic import), so loading the package in Node never pulls it in.
  • New webContainerAvailable() guard; boot() throws a clear error in Node. Both covered by the default suite (288 pass).
  • Harness is opt-in (needs a browser + network for the runtime download), not wired into pnpm test. README explains how to run it.

Part of #109. Flue stays gated on a live Flue env.

…runner

Third real Runner adapter after LocalRunner and DockerRunner, wrapping
StackBlitz's @webcontainer/api. Runs untrusted agent code inside a browser
tab: in-browser Node runtime, isolated fs, instant preview() URL, nothing
touches the host.

Browser-only by construction (needs SharedArrayBuffer + cross-origin
isolation), so @webcontainer/api is an optional peer imported lazily; loading
the package in Node never pulls it in. New webContainerAvailable() guards it.

WebContainer cannot boot in Node, so boot-and-serve is proven by a headless
Chromium harness under harness/webcontainer/ that drives the compiled adapter
end to end (boot, fs, exec incl. timeout kill, start, real preview URL,
in-container serve check, dispose, reboot). Node-only guards covered by the
default suite.

Part of #109.
@suleimansh suleimansh added enhancement New feature or request priority: medium Worth doing, not urgent labels Jul 4, 2026
@suleimansh suleimansh self-assigned this Jul 4, 2026
@suleimansh suleimansh merged commit 6f7e7e3 into main Jul 4, 2026
2 checks passed
@suleimansh suleimansh deleted the suleimansh/feat/109-webcontainer-runner branch July 4, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Worth doing, not urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant