WASM/TS distribution surface
Status: open/draft
Ship the single WASM boundary: graduate markdown-contract PR #249 from spike to
published package, then widen it as the CST core lands. One wasm-bindgen build,
tsify-generated types, oxc-style conditional node/browser packaging. First shippable
slice is the declarative validation plane (it exists in Rust today); the typed
document model and edit descriptions follow M-C6XN-lossless-cst-core.
Success criteria
Section titled “Success criteria”- A published npm package exposes declarative-plane validation via WASM: sync Node
init, async browser init,
Finding[]JSON boundary, generated.d.ts. - One production consumer runs on it: polish’s browser-side validation preview or an sdlc check path.
- TS engine and WASM engine run the shared fixture corpus in CI; parity is a release gate.
- Package size and init cost are budgeted and tracked (spike baseline: 404 KiB brotli).
- A written flip plan for the TS
markdown-contractinternals (canonical→wrapper), gated on parity plus one consumer release cycle.
Deliverables
Section titled “Deliverables”- WASM packaging pipeline in the
markdown-contractrepo (wasm-pack/wasm-opt, loader shim, exports map). - Typed wrapper package with generated types.
- Parity CI job.
- Consumer integration PR in this monorepo.
Out of scope
Section titled “Out of scope”- napi-rs bindings — admitted only on demonstrated perf need.
- Porting the full TS combinator/Zod surface to Rust — the flip plan defines that boundary (see D-9WKF-contract-authoring-and-runtime-ownership).
- Vault operations over WASM. Validation-in/findings-out is the proven slice; vault walking, watching, CAS writes, jobs, and incremental indexes require a host-capability protocol (async reads, bounded batching/streaming, cancellation, change events, write preconditions, trust) defined before they cross the boundary (review R-4).