Dedicated Linux OS sandboxes (Namespaces, Landlock, Seccomp, cgroup v2) powered by Zero-JIT quickjs-turbo — sub-20 MiB serving PSS, scale-to-zero elastic pools, and Dual-Runtime Trusted Bindings (v0.4.0) that keep secrets and sockets out of untrusted JS.
// Self-contained ESM — zero ambient fs, env, net, or FFI export default { async fetch(request) { const url = new URL(request.url); return Response.json({ ok: true, path: url.pathname, sandbox: "namespaces + landlock + seccomp", }); }, };
// Untrusted app calls a Host-installed Binding — zero secrets in user JS import vault from "capsid:binding/vault"; export default { async fetch(req) { const signer = await vault.open(null, { timeoutMs: 1000 }); try { const sig = await signer.sign(await req.text()); return Response.json({ sig }); } finally { signer.dispose(); // RpcTarget (+ lease & GC fallback) } }, };
// Full-duplex WebSocketPair over FetchRPC v4 byte-credit channels export default { fetch(request) { const [client, server] = Object.values(new WebSocketPair()); server.accept({ allowHalfOpen: true }); server.binaryType = "arraybuffer"; server.addEventListener("message", (e) => server.send(e.data)); server.addEventListener("close", () => server.close(1000, "bye")); return new Response(null, { status: 101, webSocket: client }); }, };
// Embed directly in your C/C++ Host (ABI v8, non-blocking IPC) #include <capsid/runtime.hpp> capsid_worker_config cfg; capsid_worker_config_init(&cfg); cfg.strict_sandbox = 1; // NS + Landlock + Seccomp cfg.egress_policy = nullptr; // default-deny all outbound cfg.request_timeout_ms = 5000; // Host-enforced deadline
Dedicated OS process per worker fenced by NS, Landlock, Seccomp, and cgroup v2 — deny-by-default egress, zero FFI/RWX.
Idle apps drop to 0 processes (0 B RAM), wake on quickjs-turbo bytecode, and return 100% of private pages on exit.
Two-stage tenant-fair eviction, delegated cgroup v2 memory.max, and bounded-drain blue-green rollouts.
Scale-to-zero Linux worker processes (v0.4.0) — sub-10 ms C ABI cold starts, tenant-fair LRU, and 100% kernel page reclamation on exit.
Host-provisioned capsid/binding-v1 packages (databases, SQLite, secret vaults, internal APIs) execute in isolated QuickJS heaps inside the same OS-sandboxed worker — zero shared JS memory, zero cost when unused, and Web-native RPC proxies (v0.4.0). In managed production (capsid/host-v2), only the Host installs packages and secrets under paths.bindings / paths.secrets; untrusted apps can only reference approved IDs and narrow permissions.
// manifest.json (Host-approved ceiling under paths.bindings) { "apiVersion": "capsid/binding-v1", "permissions": { "modules": [ "capsid:hashing", "capsid:internal/core" ] } } // index.js (isolated Binding Runtime — holds Host valueFrom secrets) import { createHash } from "capsid:hashing"; class Signer extends RpcTarget { constructor(key) { super({ leaseMs: 5000 }); this.key = key; } sign(text) { return createHash("sha256") .update(`${this.key}:${text}`) .digest(); } } export default ({ secrets }) => ({ open() { return new Signer(secrets.signingKey); }, });
// capsid.json (App references Host Binding ID & valueFrom — cannot supply Bindings) { "apiVersion": "capsid/app-v2", "bindings": { "vault": { "secrets": { "signingKey": { "valueFrom": "signing-key" } } } } } // bundle.mjs (untrusted User Runtime — receives frozen RpcTarget stub) import vault from "capsid:binding/vault"; export default { async fetch(request) { const signer = await vault.open(null, { timeoutMs: 1000 }); try { const sig = await signer.sign(await request.text()); return Response.json({ sig }); } finally { signer.dispose(); } }, };
Execute LLM-generated JS tools in kernel-enforced sandboxes with explicit egress allowlists and instant teardown.
Run custom tenant hooks without per-tenant containers — fair eviction, delegated cgroup v2, and isolated Binding RPC v2 (RpcTarget + credit streams) keep secrets out of tenant JS.
Scale idle apps to zero OS processes, wake on demand with cold queueing, and keep active SSE/WS streams exempt from idle eviction.
Drop <capsid/runtime.h> (ABI v8) into gateways or databases with Host-owned TLS, credits, and credential Bindings.
Generated directly from 4,533 replay-verified archive files across three fair reference tiers.
Unified Config v2 (capsid/app-v2), Elastic Pools, and Trusted Bindings (RPC v2) on Linux, macOS, and Windows. Official five-platform release: v0.4.0.
Downloads & SHA-256 verifies capsid-host, capsid-worker, bytecode compiler, and ABI v8 SDK. All 5 packages · Build from source.
curl -fsSL https://github.com/rowanellis-113/capsid/releases/download/v0.4.0/install.sh \ | CAPSID_REPO=rowanellis-113/capsid bash -s -- v0.4.0 export PATH="$HOME/.local/bin:$PATH"
$base = 'https://github.com/rowanellis-113/capsid/releases/download/v0.4.0'
Invoke-WebRequest "$base/capsid-0.4.0-windows-x86_64.zip" -OutFile capsid.zip
Invoke-WebRequest "$base/capsid-0.4.0-windows-x86_64.zip.sha256" -OutFile capsid.zip.sha256
$exp = ((Get-Content capsid.zip.sha256 -Raw).Trim() -split '\s+')[0]
if ((Get-FileHash capsid.zip -Algorithm SHA256).Hash -ine $exp) { throw 'SHA-256 mismatch' }
Expand-Archive capsid.zip "$HOME\capsid-0.4.0" -Force
$env:PATH = "$HOME\capsid-0.4.0\capsid-0.4.0-windows-x86_64\bin;$env:PATH"
Self-contained bundle.mjs + default-deny capsid.json (zero ambient modules or egress).
mkdir -p ~/capsid-hello && cd ~/capsid-hello
cat > bundle.mjs <<'EOF'
export default {
fetch(req) {
return Response.json({
hello: "from Capsid",
path: new URL(req.url).pathname,
});
},
};
EOF
cat > capsid.json <<'EOF'
{
"apiVersion": "capsid/app-v2"
}
EOF
New-Item -ItemType Directory -Force "$HOME\capsid-hello" | Out-Null
Set-Location "$HOME\capsid-hello"
$utf8 = New-Object System.Text.UTF8Encoding($false)
[IO.File]::WriteAllText("$PWD\bundle.mjs", @'
export default {
fetch(req) {
return Response.json({
hello: "from Capsid",
path: new URL(req.url).pathname,
});
},
};
'@, $utf8)
[IO.File]::WriteAllText("$PWD\capsid.json", @'
{
"apiVersion": "capsid/app-v2"
}
'@, $utf8)
Auto-discovers capsid-worker and mounts at / once capsid-host-ready-v1 prints.
capsid-host --app-dir . --listen 127.0.0.1:8080 --ready-fd 1
capsid-host.exe --app-dir . --listen 127.0.0.1:8080 --ready-fd 1
curl http://127.0.0.1:8080/ping
# => {"hello":"from Capsid","path":"/ping"}
curl.exe http://127.0.0.1:8080/ping
# => {"hello":"from Capsid","path":"/ping"}
Add pool.minReady: 0 for scale-to-zero, attach isolated Trusted Bindings with narrowed permissions & valueFrom secrets, bundle npm apps with esbuild, or precompile trusted quickjs-turbo bytecode (Host config).
{
"apiVersion": "capsid/app-v2",
"entry": "bundle.mjs",
"worker": {
"memoryMax": "256MiB",
"jsHeap": "64MiB"
},
"pool": {
"minReady": 0,
"maxWorkers": 8,
"idleTimeout": "60s",
"queueRequests": 64,
"queueTimeout": "5s"
}
}
{
"apiVersion": "capsid/app-v2",
"entry": "bundle.mjs",
"bindings": {
"orders": {
"permissions": {
"net": {
"allow": [
"db.internal:5432"
]
}
},
"config": {
"database": "orders",
"tls": true
},
"secrets": {
"dbPassword": {
"valueFrom": "orders-db-pass"
}
}
}
}
}
capsid-bytecode-compile \ --source ./bundle.mjs \ --source-name "file://$PWD/bundle.mjs" \ --application hello --version v1 --key-id release-key-1 \ --bytecode-out ./bundle.qjsb \ --attestation-out ./bytecode.json \ --signing-message-out ./message.bin
$bundle = (Resolve-Path -LiteralPath '.\bundle.mjs').Path capsid-bytecode-compile.exe ` --source $bundle --source-name ([System.Uri]$bundle).AbsoluteUri ` --application hello --version v1 --key-id release-key-1 ` --bytecode-out .\bundle.qjsb ` --attestation-out .\bytecode.json ` --signing-message-out .\message.bin
npx esbuild src/index.ts \ --bundle --format=esm --target=es2022 \ --outfile=bundle.mjs
Sealed lane logs, exact-body checks, smaps_rollup snapshots, and SHA-256 manifests for every verified point.