You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shared OS layer. Platform-agnostic — no Node.js or browser APIs. All runtimes make "syscalls" to the kernel for filesystem, process, pipe, and FD operations.
48
-
49
-
-`createKernel(options)` — creates a kernel with a VFS backend and optional permissions
50
-
-`kernel.mount(driver)` — mounts a runtime driver, registers its commands
51
-
-`kernel.exec(command)` — executes through the shell (requires WasmVM runtime)
52
-
-`kernel.spawn(command, args)` — spawns a process directly via command registry
53
-
54
-
### Kernel Components
55
-
56
-
-**VFS** (`vfs.ts`) — POSIX-complete `VirtualFileSystem` interface with symlinks, links, chmod/chown/utimes/truncate
57
-
-**FD Table** (`fd-table.ts`) — Per-PID file descriptors with shared FileDescriptions (cursor sharing via dup/dup2)
58
-
-**Process Table** (`process-table.ts`) — PID allocation, parent-child, waitpid, signal routing across runtimes
- Worker-based process model with SharedArrayBuffer + Atomics synchronization
104
-
- Ring buffers for WASM-to-WASM pipeline optimization
105
-
106
-
## Existing Runtime Architecture
107
-
108
-
The runtime is split across `@secure-exec/core` (shared types and runtime classes), `@secure-exec/node`, `@secure-exec/browser`, and `@secure-exec/python`. The `secure-exec` barrel package re-exports everything. The kernel is additive.
> **Kernel packages** (`packages/kernel/`, `packages/runtime/`, `packages/os/`) are experimental and not part of the public API. See `wasmvm/CLAUDE.md` for kernel and WasmVM architecture details.
-**Kernel** — the shared OS layer (`packages/kernel/`). Provides VFS, FD table, process table, device layer, pipes, command registry, and permissions. All runtimes share the same kernel instance.
4
-
-**Runtime Driver** — a pluggable execution engine (WasmVM, Node, Python) that implements the `RuntimeDriver` interface and mounts into the kernel. Registers commands and spawns processes.
5
-
-**WasmVM** — the BusyBox-style WASM binary runtime. Contains 90+ Unix commands compiled from Rust. Runs in Web Workers with WASI polyfill.
6
-
-**Isolate** — a V8 isolate. The unit of code execution and memory isolation. Each sandbox execution gets its own isolate.
7
-
-**Runtime** — the sandbox. The full `secure-exec` execution environment including the isolate, bridge, and resource controls.
3
+
-**Isolate** — a V8 isolate (Node/Bun) or Web Worker (browser). The unit of code execution and memory isolation. Each execution gets its own isolate.
4
+
-**Runtime** — the full `secure-exec` execution environment including the isolate, bridge, and resource controls. `NodeRuntime` and `PythonRuntime` are the public entry points.
8
5
-**Bridge** — the narrow layer between the isolate and the host that mediates all privileged operations. Untrusted code can only reach host capabilities through the bridge.
9
-
-**Driver** — a host-side capability provider (filesystem, network, process, env) that the bridge delegates to. Drivers are configured per-sandbox and enforce permission checks.
10
-
-**VFS** — virtual filesystem. The kernel's `VirtualFileSystem` interface, implemented by platform-specific backends (NodeFileSystem, InMemoryFileSystem).
11
-
-**FD Table** — per-PID file descriptor table. Maps FD numbers to `FileDescription` objects with shared cursor positions via dup/dup2.
12
-
-**Process Table** — tracks all processes across runtimes. Owns PID allocation, parent-child relationships, waitpid, and signal routing.
13
-
-**Command Registry** — maps command names to runtime drivers. Enables shell PATH lookup and cross-runtime command execution.
14
-
-**Device Layer** — intercepts `/dev/*` paths before they reach the VFS backend. Handles `/dev/null`, `/dev/zero`, `/dev/urandom`, `/dev/stdin`, `/dev/stdout`, `/dev/stderr`.
6
+
-**SystemDriver** — config object that bundles what the isolate can access (filesystem, network, command executor, permissions). Deny-by-default. Built by `createNodeDriver()` or `createBrowserDriver()`.
7
+
-**Execution Driver** — host-side engine that owns the isolate lifecycle. `NodeExecutionDriver` (V8 via `isolated-vm`), `BrowserRuntimeDriver` (Web Worker), `PyodideRuntimeDriver` (Pyodide in a Node worker).
0 commit comments