- Removed multiple test files and cases that relied on brittle source string matching for validation.
- Updated project architecture documentation to explicitly prohibit source-grep style testing patterns.
- Eliminated legacy reproduction tests for issues that reached project maturity.
After `shutdownMnemopiEmbedClient()` clears `#worker` (session dispose, or
worker crash), mnemopi still holds the cached `LocalEmbeddingModel` wrapper.
The next embed re-spawned a fresh subprocess that had never received
`init`, and the bare `embed` request tripped the "embed before init" guard,
breaking local embeddings for the rest of the process.
- Carry `model` + `cacheDir` in every `embed` IPC; bind both into the
`MnemopiSubprocessEmbeddingModel` closure when the wrapper is created.
- Worker calls `ensureLoaded(model, cacheDir)` in `handleEmbed` (idempotent
for the same key, so steady-state embeds pay nothing). Drops the
"embed before init" guard — `embed` self-initializes.
- Promotes the internal `WorkerHandle` interface to `MnemopiEmbedWorkerHandle`
so the test seam can construct a fake worker.
- New regression test drives a fake worker, terminates + re-embeds the SAME
cached wrapper, and asserts every embed message still carries the bound
`(model, cacheDir)`.
Per review on #3034.
Moved mnemopi's local embedding provider out of the main agent process by
spawning a dedicated `Bun.spawn` child for fastembed + onnxruntime-node. The
agent CLI gains a hidden `__omp_worker_mnemopi_embed` dispatch; `loadMnemopi`
/ `loadMnemopiCore` install the subprocess-backed initializer through the
newly-exposed `setLocalModelInitializer` seam so every `embed()` call
round-trips through IPC instead of loading the NAPI module. The parent
SIGKILLs the child on dispose so the destructor that segfaults Bun on
Windows shutdown (NAPI finalizer at exit on npm installs, `process.dlopen`
constructor at session start on standalone binaries) never runs in any
address space the agent owns. Mirrors the tiny-model fix from #1607.
Adds `smokeTestMnemopiEmbedWorker` to `omp --smoke-test`, a new
`test/issue-3031-repro.test.ts` that pins the spawn/dispatch/signal-exit
contract and forbids re-importing `fastembed-runtime` from the agent surface,
and changelog entries.
Fixes#3031