# Ralph Progress Log

## Codebase Patterns
- Current branch: `04-29-chore_rivetkit_wasm_support`.
- The NAPI and wasm TypeScript adapters implement the shared `CoreRuntime` contract in `rivetkit-typescript/packages/rivetkit/src/registry/`.
- Keep raw `@rivetkit/rivetkit-napi` and `@rivetkit/rivetkit-wasm` imports inside runtime adapter modules (`napi-runtime.ts`, `wasm-runtime.ts`); enforced by `tests/runtime-import-guard.test.ts`.
- Wasm cannot use local SQLite. Valid SQLite runtime cells are native/local, native/remote, and wasm/remote.
- Cross-boundary error sanitization belongs in `rivetkit-core`. The TS bridge passes raw errors through; status code promotion should not live in `wasm-runtime.ts`.
- Use `rivetkit-typescript/packages/rivetkit/tests/shared-engine.ts` for any TS test that needs a local `rivet-engine`.
- The wasm crate uses `RuntimeSpawner::spawn` which maps to `tokio::task::spawn_local` under `wasm-runtime` and `tokio::spawn` otherwise.
- Bridged JS errors round-trip via `__RIVET_ERROR_JSON__:` prefix in the message string; decoded with `parse_bridge_rivet_error` and re-encoded with `anyhow_to_js_error`.
- Wasm `JsValue` callbacks are not Send/Sync; `WasmFunction` uses an unsafe Send/Sync impl because the wasm runtime is single-threaded.
