ADR-012: Browser as First-Class Node

Status

Exploring

Context

The browser should not be a lite client that talks to a server. It should run the same engine — same parser, same execution. This means both kern (OCaml) and the Rust engine need to compile to WASM and run in the browser.

The problem

kern (OCaml) compiles to WASM via wasm_of_ocaml, which outputs WasmGC instructions. The Rust engine compiles to WASM via wasm-bindgen. Both need to run in the browser and talk to each other.

WasmGC support

This is why the browser path works but the Go server path doesn't for OCaml WASM.

Composition

Two WASM modules (kern + Rust engine) need to call each other in the browser. The WASM Component Model (Wasm 3.0, September 2025) is designed for this — typed interfaces between modules. Whether this is the right mechanism needs investigation.

Open questions