From 29dc88be3a210655759fa84d455641955d69e0c8 Mon Sep 17 00:00:00 2001 From: monkey-w1n5t0n Date: Mon, 13 Jul 2026 23:14:23 +0200 Subject: [PATCH] =?UTF-8?q?chore(build):=20P0=20plumbing=20=E2=80=94=20WAS?= =?UTF-8?q?M=20build/parity=20retarget=20to=20manifold/public?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-wasm.sh emits to manifold/public/ (transitional copy to playground/public/ until P1 retires the playground) - parity-check.sh + parity_wasm.mjs read the manifold artifact - fix stale MLP<2,...> arity in AGENT-REFERENCE.md + nisps/wasm/README.md - gitignore .claude/worktrees/ - plan one-core-engine-refactor.md: P0 marked landed Gate: run-all-tests green; parity PASS from manifold artifact (2.4e-7); manifold builds against freshly-built nisps.wasm. --- .gitignore | 3 +++ MAP.md | 4 ++-- docs/AGENT-REFERENCE.md | 4 ++-- docs/specs/plans/one-core-engine-refactor.md | 12 ++++++------ manifold/public/nisps.wasm | Bin 102739 -> 102867 bytes nisps/wasm/README.md | 16 +++++++++------- playground/public/nisps.wasm | Bin 102739 -> 102867 bytes scripts/build-wasm.sh | 18 ++++++++++++++---- scripts/parity-check.sh | 6 +++--- tests/cpp/parity_wasm.mjs | 8 ++++---- 10 files changed, 43 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index ffa6182..6f59050 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ node_modules/ bun.lock playwright-report/ test-results/ + +# Agent worktrees +.claude/worktrees/ diff --git a/MAP.md b/MAP.md index 4a98d78..335f354 100644 --- a/MAP.md +++ b/MAP.md @@ -40,7 +40,7 @@ MEMLNaut-NISPS — Neural Interactive Shaping of Parameter Spaces. One C++20 cod - `playground/src/input/pipeline.ts`, `playground/src/output/pipeline.ts`, `playground/src/output/curves.ts` — pure-fn pipelines (deadzone→zoom→curve→smoothing→momentum, then global curve→smoothing→slew→freeze). - `playground/src/features/` — additional feature modules (heatmap sampling, snapshot stack, A/B compare, region pin, param pin, trail, weight health, etc.). - `playground/src/debug/probe.ts` — synchronous `window.__nisps` debug probe for Playwright. -- `playground/public/nisps.{wasm,js}`, `c15.wasm`, `c15-glue.js` — compiled WASM artifacts (built by `scripts/build-wasm.sh`). +- `playground/public/nisps.{wasm,js}`, `c15.wasm`, `c15-glue.js` — WASM artifacts. `nisps.*` are a transitional copy from `scripts/build-wasm.sh` (canonical output is `manifold/public/`; copy dies with playground at P1). - `playground/tests/e2e/` — Playwright specs (`ml-engine`, `modes`, `persistence`, `ui-interactions`) + `helpers.ts`. - `playground/playwright.config.ts` — Vite preview server setup. @@ -113,7 +113,7 @@ the "BUILD DELTAS" block at the top of `docs/specs/vcv-module.md`). `src/MEMLNau ### `scripts/` — build + verify entry points - `build-firmware.sh`, `flash-firmware.sh`, `build-and-flash-firmware.sh`, `firmware-common.sh` — Arduino-CLI wrapper for RP2350 target with C++20 flag. -- `build-wasm.sh` — Emscripten compile producing `playground/public/nisps.{wasm,js}`. +- `build-wasm.sh` — Emscripten compile producing `manifold/public/nisps.{wasm,js}` (+ transitional copy to `playground/public/` until P1). - `build-cpp-tests.sh` — CMake configure + build + ctest (Ninja). - `parity-check.sh` — runs native + WASM and diffs binary outputs. - `lint-cpp.sh` — `.f` literal warn + heap/`Arduino.h` violation fail. diff --git a/docs/AGENT-REFERENCE.md b/docs/AGENT-REFERENCE.md index 9d99966..bb5acd7 100644 --- a/docs/AGENT-REFERENCE.md +++ b/docs/AGENT-REFERENCE.md @@ -124,9 +124,9 @@ Two WASM instances at runtime: 1. **Main thread** (`playground/src/ml/wasm-iml.ts`): ML inference + sync training + RL primitives. Update store after each call. Async training via disposable Web Worker (`wasm-worker.ts`). 2. **AudioWorklet** (`playground/src/audio/worklet/nisps-processor.ts`): runs engine `process_block` per audio block. Loads `nisps.wasm` directly via `WebAssembly.compile` (no Emscripten glue in worklet). Bytes posted from main thread. -C API is in `nisps/wasm/bindings.cpp`. Build: `bash scripts/build-wasm.sh` (~94KB output to `playground/public/`). +C API is in `nisps/wasm/bindings.cpp`. Build: `bash scripts/build-wasm.sh` (~94KB output to `manifold/public/`, transitional copy to `playground/public/` until P1). -The WASM target is fixed at `MLP<2, 10, 14, 18, 126>`. Modes with smaller `output_size` use the first N outputs only. +The WASM target is fixed at `MLP<32u, 10u, 14u, 18u, 126u>` (`nisps_ml_create` ignores requested dims — see `docs/specs/plans/one-core-engine-refactor.md` P2). Modes with smaller `input_size`/`output_size` use a slice. ### Known limitations diff --git a/docs/specs/plans/one-core-engine-refactor.md b/docs/specs/plans/one-core-engine-refactor.md index 7547f16..8bbbd4e 100644 --- a/docs/specs/plans/one-core-engine-refactor.md +++ b/docs/specs/plans/one-core-engine-refactor.md @@ -74,13 +74,13 @@ skin) still applies inside manifold; this plan adds the vertical one. Each phase ends green on its test gate and is independently landable. File phases as **ergo** tasks (one per phase, sub-tasks per bullet); do not start a phase before its predecessor's gate is green. -### P0 — Plumbing hygiene (hours, no behaviour change) +### P0 — Plumbing hygiene (hours, no behaviour change) — ✅ landed 2026-07-13 -- `scripts/build-wasm.sh` emits to `manifold/public/` (keep `playground/public/` copy only until P1 lands). -- `scripts/parity-check.sh` reads the manifold artifact. -- Fix stale doc: `MAP.md` §WASM still says `MLP<2,…>`; code is `MLP<32u,10u,14u,18u,126u>`. -- Delete `ml-debug.log`, `graphify-out/` from tree root; gitignore `.claude/worktrees/`. -- **Gate:** `run-all-tests.sh` green; manifold builds against a freshly-built (not copied) `nisps.wasm`. +- ✅ `scripts/build-wasm.sh` emits to `manifold/public/` (keep `playground/public/` copy only until P1 lands). +- ✅ `scripts/parity-check.sh` (and `tests/cpp/parity_wasm.mjs`) read the manifold artifact. +- ✅ Fix stale doc: the `MLP<2,…>` line was in `docs/AGENT-REFERENCE.md` + `nisps/wasm/README.md` (MAP.md was already correct); both now say `MLP<32u,10u,14u,18u,126u>`. +- ✅ `ml-debug.log`/`graphify-out/` were already absent from the tree; `.claude/worktrees/` gitignored. +- **Gate met:** `run-all-tests.sh` green (Playwright leg via the BUILD-PLAN non-snap-node VPS runner); parity PASS reading `manifold/public/` (max delta 2.4e-7); manifold typecheck+build green against the freshly-built artifact. ### P1 — Retire playground, single TS home (≈1 day) diff --git a/manifold/public/nisps.wasm b/manifold/public/nisps.wasm index 9ee47b2fee54b38884064c95cae148f400b7b4a1..cf9dbdb0eed86d7a75d7569fa7682afa86ab2907 100755 GIT binary patch delta 315 zcmcb-i0$%Xwhc;5jQ^XJnYJr4G1@sX2QxBG=W}J0F=KM)WpHFvWK>{KV9;e)I*Zeh z(T$~Efx(f%is9Ef4hRDz%)si%$Zf^2Vj3qmcg^(so{VbSx41BV;bh#meWf2`CQAT2 zvx5So0;?lai4t3u0-FMRmKGC(1rq~Mkj;^$NQom$fn9+ES&##pAWsog`}Ff6jH27i zgBh1GDkw1OGOW#pIE@kHG$sWw1r!6jYr1?W<5i|+rs>~88KaefQb1`IPiaL)CI^tW zfR1+MMfRY>^oB4-c@AsFC9^nr7`dm*g)z!bFAHNd-o7!6Q9+aO*Y->GjE#Z-mZwB8 delta 199 zcmcb-nCjlk z9TXT9*c_Qkl-RQrSQXf_w3rwym>7V9?2ar&N*o|T4rD + nisps::ml::MLP<32, 10, 14, 18, 126> -That serves the playground use case (2-D joystick → up to 126 synth +That serves the browser use case (up to 32 input axes → up to 126 synth parameters). `nisps_ml_create()` accepts caller-supplied dimensions for forward compatibility but currently ignores them — see comment at the top of `bindings.cpp`. The schemas in `schemas/modes/*.json` use up to diff --git a/playground/public/nisps.wasm b/playground/public/nisps.wasm index 9ee47b2fee54b38884064c95cae148f400b7b4a1..cf9dbdb0eed86d7a75d7569fa7682afa86ab2907 100755 GIT binary patch delta 315 zcmcb-i0$%Xwhc;5jQ^XJnYJr4G1@sX2QxBG=W}J0F=KM)WpHFvWK>{KV9;e)I*Zeh z(T$~Efx(f%is9Ef4hRDz%)si%$Zf^2Vj3qmcg^(so{VbSx41BV;bh#meWf2`CQAT2 zvx5So0;?lai4t3u0-FMRmKGC(1rq~Mkj;^$NQom$fn9+ES&##pAWsog`}Ff6jH27i zgBh1GDkw1OGOW#pIE@kHG$sWw1r!6jYr1?W<5i|+rs>~88KaefQb1`IPiaL)CI^tW zfR1+MMfRY>^oB4-c@AsFC9^nr7`dm*g)z!bFAHNd-o7!6Q9+aO*Y->GjE#Z-mZwB8 delta 199 zcmcb-nCjlk z9TXT9*c_Qkl-RQrSQXf_w3rwym>7V9?2ar&N*o|T4rD ...)(); // if (typeof exports==='object' && typeof module==='object') module.exports = ...; - // It lives in playground/public/, which is a sub-package with + // It lives in manifold/public/, which is a sub-package with // "type":"module" in its parent package.json — so neither `require()` nor // `import()` can extract the factory cleanly. We work around this by // reading the file as text and evaluating it inside a thin shim that @@ -77,7 +77,7 @@ async function loadWasm() { console.error('[parity_wasm] could not locate createNispsModule in glue'); process.exit(2); } - const wasmBinaryPath = resolve(repoRoot, 'playground', 'public', 'nisps.wasm'); + const wasmBinaryPath = resolve(repoRoot, 'manifold', 'public', 'nisps.wasm'); const wasmBinary = await readFile(wasmBinaryPath); const Module = await factory({ wasmBinary }); return Module;