WASM (Phases 0–3)
Phase 0 adds a build+run loop for solve-pure X07 programs as WASM modules, without introducing a new compiler backend.
Phase 1 adds WASI 0.2 components (HTTP + CLI runnable targets) on top of Phase 0.
Phase 2 adds a Web UI loop (web-ui build|serve|test) on top of Phase 0/1.
Phase 3 adds a full-stack app bundle loop (app build|serve|test) that combines Phase 2 (frontend) and Phase 1 (backend).
Phases 0–3 are implemented by the x07-wasm tool (repo: x07-wasm-backend).
Delegation model
The core toolchain delegates WASM commands:
x07 wasm ...delegates tox07-wasm ...on PATH.- If
x07-wasmis not installed/discoverable, delegated commands exit with code2.
Install
Install x07-wasm from the x07-wasm-backend repo:
cargo install --locked --git https://github.com/x07lang/x07-wasm-backend.git x07-wasm
Phase 1 also requires additional tools on PATH (checked by x07 wasm doctor):
wasm-toolswit-bindgenwacwasmtime
Phase 2 (component+ESM builds) also uses:
nodejco(component transpile)
Profiles (contracts-as-data)
x07-wasm consumes a pinned profile registry by default:
arch/wasm/index.x07wasm.jsonarch/wasm/profiles/*.json
Validate these files in CI:
x07 wasm profile validate --json
If you need to bypass the registry (e.g. experimentation), use --profile-file.
Build
x07 wasm build:
- calls
x07 build --freestanding --emit-c-header … - compiles the emitted C to
wasm32viaclang - links a reactor-style module via
wasm-ld --no-entry - emits a wasm artifact manifest and a machine report
Example:
x07 wasm build \
--project ./x07.json \
--profile wasm_release \
--out dist/app.wasm \
--artifact-out dist/app.wasm.manifest.json \
--json
Run
x07 wasm run instantiates the module under Wasmtime and calls x07_solve_v2 using the WASM Basic C ABI sret convention.
On failures, it writes a deterministic incident bundle under .x07-wasm/incidents/… containing:
input.binrun.report.jsonwasm.manifest.json(if discoverable next to the wasm path)
Machine discovery
Agents should use:
x07 wasm --cli-specrowsx07 wasm cli specrows check
Phase 1: components (WASI 0.2)
Phase 1 introduces a component pipeline:
- WIT registry:
arch/wit/index.x07wit.json(vendored, pinned) - Component profile registry:
arch/wasm/component/index.x07wasm.component.json
Validate (offline, no external validators):
x07 wasm wit validate --json
x07 wasm component profile validate --json
Build + compose:
x07 wasm component build --project examples/http_echo/x07.json --emit all --json
x07 wasm component compose --adapter http --solve target/x07-wasm/component/solve.component.wasm --out dist/app.http.component.wasm --json
x07 wasm component targets --component dist/app.http.component.wasm --wit wit/deps/wasi/http/0.2.8/proxy.wit --world proxy --json
Run:
x07 wasm serve --mode canary --component dist/app.http.component.wasm --request-body @examples/http_echo/tests/fixtures/request_body.bin --json
x07 wasm component run --component dist/app.cli.component.wasm --stdin examples/solve_pure_echo/tests/fixtures/in_hello.bin --stdout-out dist/stdout.bin --json
Phase 2: web-ui (browser host)
Phase 2 adds a browser host loop for X07 reducers that consume x07.web_ui.dispatch@0.1.0 and emit x07.web_ui.frame@0.1.0 as UTF-8 JSON bytes.
The canonical std-web-ui package, browser host assets, and WIT contracts live in the x07-web-ui repo.
Validate contracts + profile registry (offline):
x07 wasm web-ui contracts validate --json
x07 wasm web-ui profile validate --json
Build + serve + test (example from x07-web-ui):
git clone https://github.com/x07lang/x07-web-ui.git
cd x07-web-ui
x07 wasm web-ui build --project examples/web_ui_counter/x07.json --profile web_ui_debug --out-dir dist --json
x07 wasm web-ui serve --dir dist --mode listen --strict-mime --json
x07 wasm web-ui test --dist-dir dist --case examples/web_ui_counter/tests/counter.trace.json --json
Component build (transpiled for the browser via jco transpile):
x07 wasm web-ui build --project examples/web_ui_counter/x07.json --profile web_ui_debug --out-dir dist --format component --json
Phase 3: app bundle (full stack)
Phase 3 introduces an app-bundle registry (arch/app/*) and a single closed loop:
- app profile → app build → app serve → app test → incident → regression
Validate (offline):
x07 wasm app contracts validate --json
x07 wasm app profile validate --json
Build + serve + test (example from x07-wasm-backend):
git clone https://github.com/x07lang/x07-wasm-backend.git
cd x07-wasm-backend
x07 wasm app build --profile app_dev --out-dir dist/app --clean --json
x07 wasm app serve --dir dist/app --mode smoke --strict-mime --json
x07 wasm app test --dir dist/app --trace examples/app_fullstack_hello/tests/trace_0001.json --json