The explorables (PR #39) are faithful JS ports of fugue's math — stated honestly on-page, but they are still mirrored routines that must be kept behaviorally in sync with the crate by hand. The docs should run the real thing.
Goal
Compile fugue to WASM and drive the docs' interactive widgets (and a full editable playground) with the actual crate — real Model, real handlers, real inference (adaptive MH, HMC, SMC), real seeded traces — so the docs can never drift from the library.
Sketch
fugue-wasm (or a wasm feature/crate) exposing wasm-bindgen entry points: build model from a small config or embedded DSL, run N steps of a chosen sampler with a seed, stream draws/diagnostics (R̂, ESS, log-evidence) back as typed arrays per animation frame.
- Incremental stepping API so widgets stay 60fps:
sampler.step(n) returning the new draws, not run-to-completion.
- Swap-in path for existing explorables: keep the current JS renderers (fugue-viz.js canvas layer), replace their math cores with WASM calls behind the same interface; JS fallback can remain for reduced-motion static frames.
- Full playground page: editable Rust-ish model source (or the
prob! subset), run in-browser, live plots.
- Precedent: fugue-evo already has a wasm crate precedent in-tree; fugue compiles cleanly — needs a bindings layer + build pipeline (wasm-pack in the Docs workflow, artifact served next to the book).
Companion issue for evo: alexnodeland/fugue-evo#13
🤖 Generated with Claude Code
https://claude.ai/code/session_018yo1jdkckG7yQ9eBqLbaDB
The explorables (PR #39) are faithful JS ports of fugue's math — stated honestly on-page, but they are still mirrored routines that must be kept behaviorally in sync with the crate by hand. The docs should run the real thing.
Goal
Compile fugue to WASM and drive the docs' interactive widgets (and a full editable playground) with the actual crate — real
Model, real handlers, real inference (adaptive MH, HMC, SMC), real seeded traces — so the docs can never drift from the library.Sketch
fugue-wasm(or awasmfeature/crate) exposing wasm-bindgen entry points: build model from a small config or embedded DSL, run N steps of a chosen sampler with a seed, stream draws/diagnostics (R̂, ESS, log-evidence) back as typed arrays per animation frame.sampler.step(n)returning the new draws, not run-to-completion.prob!subset), run in-browser, live plots.Companion issue for evo: alexnodeland/fugue-evo#13
🤖 Generated with Claude Code
https://claude.ai/code/session_018yo1jdkckG7yQ9eBqLbaDB