Bundle Entry:
docs/spec/HOST_RUNTIME_BUNDLE_v0.1.mdLegacy Split Doc: Prefer the bundle entrypoint for agent retrieval; this file retains detailed, topic-local semantics.
WASI Tooling Build v0.2 (Rust Bootstrap -> genesis.wasm)
Goal: run GenesisCode tooling “on top of wasm” using WASI (wasm32-wasip1), without depending on JS bindings. This is the shortest path toward a wasm-first, eventually self-hosted toolchain.
This build is outside the kernel purity boundary: it does filesystem I/O to read .gc files and print results, but kernel evaluation remains pure.
Crate
crates/gc_wasi_clibuilds a WASI CLI binary:genesis_wasi.wasm.- Current command surface mirrors the native CLI for wasm-safe workflows:
genesis fmt <file> [--check] [--engine rust|selfhost]genesis eval <file> [--engine rust|selfhost] [--stage1-pipeline] [--stage1-gate] [--stage2-gate]genesis explain <file> --contract <expr-or-symbol> --msg <coreform> [--engine rust|selfhost]genesis optimize <file> [--engine rust|selfhost]genesis typecheck --pkg <package.toml>genesis apply-patch <patch.gcpatch> --pkg <package.toml>genesis semantic-edit ...genesis pack --pkg <package.toml>genesis test --pkg <package.toml> [--caps <caps.toml>]genesis verify --pkg <package.toml>genesis keygen --out <key.toml>genesis sign --pkg <package.toml> --key <key.toml> [--acceptance <hex>] [--signatures <file>]genesis transparency-verify --pkg <package.toml>genesis selfhost-artifact --out <file> [--min-stage2-supported-modules <N>] [--min-stage2-validated-modules <N>]genesis selfhost-dashboard [--markdown <file>] [--store <dir>]genesis warmgenesis run <file> --caps <caps.toml> [--log <out.gclog>](local effects only)genesis replay <file> --log <log.gclog> [--store <dir>]genesis store --caps <caps.toml> [--log <out.gclog>] {put|get|has|verify} ...genesis refs --caps <caps.toml> [--log <out.gclog>] {get|list|set|delete} ...(local refs only)genesis pkg|gcpm --caps <caps.toml> [--log <out.gclog>] {...}(init/new/scaffold/add/remove/lock/update/install/verify/list/info/doctor/abi/snapshot/export/import/publish/env/migrate/run/test/self-optimize)genesis policy ...genesis sync ...genesis gc ...genesis vcs ...(hash/diff/apply/log/blame/why/merge3/resolve-conflict)
The interface mirrors the native genesis CLI for these commands: - stable exit codes (see docs/spec/CLI.md) - --json envelope support - strict selfhost gate available via --selfhost-only (or GENESIS_SELFHOST_ONLY=1) - requires --engine selfhost on frontend commands - requires --selfhost-bootstrap artifact-only - rejects commands outside the routed selfhost command groups with exit code 50 - docs/status/SELFHOST_CUTOVER.md (generated by genesis selfhost-dashboard) is the canonical routed/default command-coverage source; semantic implementation/authority maturity is reported separately in docs/status/SELFHOST_AUTHORITY_v0.1.md. - current WASI routed set: fmt, eval, explain, run, replay, optimize, typecheck, test, apply-patch, semantic-edit, pack, verify, selfhost-artifact, selfhost-dashboard, keygen, sign, transparency-verify, store/*, refs/*, pkg/* (alias gcpm/*), policy/*, sync/*, gc/*, vcs/* - for fmt/eval (and vcs hash), when --engine is omitted the engine defaults to selfhost - --engine rust remains available only in development/debug parity workflows through genesis_wasi_parity - release builds reject --engine rust unconditionally - production WASI runs require explicit selfhost artifact pinning: - --selfhost-artifact - GENESIS_SELFHOST_TOOLCHAIN_ARTIFACT - genesis.workspace.toml -> [defaults].toolchain - implicit filesystem discovery (./.genesis/selfhost/toolchain.gc, selfhost/toolchain.gc) is parity-harness-only and excluded from production workflows.
Notes: - WASI transport profile is explicit and deny-by-default: - Default profile (wasi_network_profile unset / none) rejects remote network access. - file:// and inproc:// remotes are supported for store/refs/sync workflows when capability policy allowlists them. - wasi_network_profile = "local" allows: - file:// and inproc:// remotes directly. - http(s) remotes through deterministic HTTP bridge adapter roots: - explicit root via GENESIS_WASI_HTTP_BRIDGE_ROOT - or auto-discovered workspace runtime root at .genesis/runtime/wasi-http-bridge/<scheme>/<host>_<port>/v1 (materialized by gcpm env). policy allowlist checks are still enforced. - wasi_network_profile = "preview2" permits policy-allowlisted http(s) remotes (plus file:// / inproc://), while remaining deny-by-default without explicit allowlist and profile grants. - op-level wasi_network_profile policy must explicitly permit the selected remote profile. - genesis_wasi enforces this profile in parity test runs as well (even when executed on non-WASI hosts), so CI/runtime behavior matches wasm32-wasip1 policy semantics. - Policy gates for refs, pkg publish, and pkg install --strict are shared across native/WASI CLI surfaces. - Signature-required tag refs and obligation/evidence verification behavior must remain parity-tested in both suites.
Build
rustup target add wasm32-wasip1
cargo build -p gc_wasi_cli --target wasm32-wasip1 --releaseArchived legacy convenience wrappers live under old_bootstrap/ (see docs/spec/BOOTSTRAP_OLD.md).
Run (wasmtime)
The WASI module needs a preopened directory to read/write files:
wasmtime --dir . target/wasm32-wasip1/release/genesis_wasi.wasm --help
wasmtime --dir . target/wasm32-wasip1/release/genesis_wasi.wasm fmt tests/spec/coreform/app_sugar.in.gc --checkSmoke / Equivalence
Run the deterministic smoke test, which asserts equivalence with the native genesis CLI:
wasmtime --version
bash scripts/wasi_smoke.sh