mirror of
https://github.com/ruvnet/RuView
synced 2026-07-29 18:31:44 +00:00
39ec05edcb
End-to-end implementation of the operator dashboard for the nvsim
NV-diamond magnetometer simulator. Vite 5 + TypeScript strict + Lit 3,
~93 KB gzipped JS budget, runs the *real* nvsim Rust crate compiled to
wasm32-unknown-unknown inside a dedicated Web Worker.
Validated end-to-end with `npx agent-browser`:
- WASM module boots, build version + magic 0xC51A_6E70 reported
- Reference witness verifies byte-identical to Proof::EXPECTED_WITNESS_HEX
cc8de9b01b0ff5bd97a6c17848a3f156c174ea7589d0888164a441584ec593b4
- Pipeline runs at ~1.88 kHz on x86_64 dev hardware (4500x over Cortex-A53)
- Zero browser console errors; only Lit dev-mode warning (expected)
## nvsim crate (additive)
- New `wasm` feature flag with wasm-bindgen 0.2 / serde-wasm-bindgen 0.6
- src/wasm.rs: WasmPipeline wrapper + referenceSceneJson +
expectedReferenceWitnessHex + referenceWitness + hexWitness exports
- crate-type = ["cdylib", "rlib"] so native + wasm both build
- rand = { default-features = false } drops getrandom OS-entropy path,
preserving the crate's WASM-ready posture
- Native: 50/50 tests still pass, witness unchanged
## dashboard/ (new package)
- Vite 5 + TypeScript strict, Lit 3 elements, signals-based store
- 12 Lit components mirroring the mockup zones (rail, topbar, sidebar,
scene SVG with draggable sources + NV crystal, inspector tabs
Signal/Frame/Witness, console with REPL + filter tabs, settings
drawer, modals, ⌘K command palette, debug HUD, toast, app-store)
- IndexedDB persistence (theme, density, motion, app activations)
- WasmClient → Web Worker → wasm-pack-built nvsim WASM module
- NvsimClient TS interface — same shape covers future WsClient transport
- MagFrame parser (60-byte LE layout matching nvsim::frame)
## App Store (ADR-092 §14a — added during impl)
- Catalog of all 65 wifi-densepose-wasm-edge modules + nvsim
- 13 categories with event-ID-range labels
- Per-app metadata: id/name/category/crate/summary/events/budget/
status/adr/tags
- Fuzzy search, category + status filters, IndexedDB-backed activation
- ADR-092 §14a documents the registry contract and per-app schema
## Build pipeline
- wasm-pack build crates/nvsim --target web outputs to
dashboard/public/nvsim-pkg/ (60 KB pkg, 162 KB unoptimized .wasm)
- npm run build → 93 KB gzip JS, well under 300 KB budget
- ts.config strict, npx tsc --noEmit clean
- Vite worker correctly loads WASM via dynamic import resolving
against worker origin
## E2E validation
- agent-browser open → 4-zone grid renders correctly in dark theme
- Run button → live B-vector trace, |B| readout updates, FPS counter
- App Store → all 66 apps listed with toggles, fuzzy search filters
to "Ghost hunter" on "ghost" query
- Witness verify → green check, console logs "determinism gate ✓"
- Console errors: zero (only expected Lit dev-mode warning)
Co-Authored-By: claude-flow <ruv@ruv.net>
65 lines
2.5 KiB
TOML
65 lines
2.5 KiB
TOML
[package]
|
|
name = "nvsim"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
authors.workspace = true
|
|
license.workspace = true
|
|
description = "Deterministic NV-diamond magnetometer pipeline simulator (source -> propagation -> NV ensemble -> ADC + lockin demod)"
|
|
repository.workspace = true
|
|
keywords = ["nv-diamond", "magnetometer", "simulator", "physics", "biot-savart"]
|
|
categories = ["science", "simulation"]
|
|
readme = "README.md"
|
|
|
|
[package.metadata.wasm-pack.profile.release]
|
|
# Skip wasm-opt locally — older wasm-opt versions reject bulk-memory ops
|
|
# rustc emits at 1.92. CI runs wasm-opt with a current binaryen.
|
|
wasm-opt = false
|
|
|
|
[lib]
|
|
# `cdylib` for wasm-bindgen's wasm32 build, `rlib` so other workspace
|
|
# crates and benchmarks can keep linking against nvsim natively.
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
# `nvsim` is a standalone leaf crate. It deliberately has NO internal RuView
|
|
# dependencies — see `docs/research/quantum-sensing/15-nvsim-implementation-plan.md`
|
|
# §1.1 for the rationale. RuView integration (frame format alignment with
|
|
# `wifi-densepose-core::FrameKind`, ruvector trace compression, etc.) is
|
|
# tracked as Optional Integrations in a follow-up section of the README and
|
|
# lands behind feature flags after the core simulator is shipping.
|
|
[dependencies]
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
tracing = { workspace = true }
|
|
|
|
# Pass 4: deterministic ChaCha20 PRNG for shot-noise sampling. Same
|
|
# `(scene, seed)` produces byte-identical outputs across runs and machines —
|
|
# the determinism commitment in plan §5. Default features off to drop the
|
|
# `getrandom` OS-entropy path; nvsim seeds from a caller-supplied u64 so
|
|
# OS entropy is never needed (this is also what makes nvsim WASM-ready).
|
|
rand = { version = "0.8", default-features = false }
|
|
rand_chacha = { version = "0.3", default-features = false }
|
|
|
|
# Pass 5: SHA-256 over concatenated MagFrame bytes is the simulator's
|
|
# content-addressable witness. Same scene + seed → same digest, the
|
|
# foundation of Pass 6's proof bundle.
|
|
sha2 = { workspace = true }
|
|
|
|
# ADR-092: optional wasm-bindgen surface for in-browser dashboard.
|
|
# Enable with `--features wasm` and target wasm32-unknown-unknown.
|
|
wasm-bindgen = { version = "0.2", optional = true }
|
|
serde-wasm-bindgen = { version = "0.6", optional = true }
|
|
js-sys = { version = "0.3", optional = true }
|
|
|
|
[features]
|
|
default = []
|
|
wasm = ["dep:wasm-bindgen", "dep:serde-wasm-bindgen", "dep:js-sys"]
|
|
|
|
[dev-dependencies]
|
|
approx = "0.5"
|
|
criterion = { workspace = true }
|
|
|
|
[[bench]]
|
|
name = "pipeline_throughput"
|
|
harness = false
|