@linxiraos/pi-mnemopi 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +2 -252
  2. package/LICENSE +22 -0
  3. package/package.json +106 -107
  4. package/src/cli.ts +0 -0
  5. package/src/core/episodic-graph.ts +9 -2
  6. package/src/core/extraction.ts +4 -1
  7. package/src/core/local-llm.ts +1 -0
  8. package/src/core/runtime-options.ts +6 -0
  9. package/dist/types/cli.d.ts +0 -35
  10. package/dist/types/config.d.ts +0 -108
  11. package/dist/types/core/aaak.d.ts +0 -55
  12. package/dist/types/core/annotations.d.ts +0 -75
  13. package/dist/types/core/banks.d.ts +0 -33
  14. package/dist/types/core/beam/consolidate.d.ts +0 -38
  15. package/dist/types/core/beam/helpers.d.ts +0 -69
  16. package/dist/types/core/beam/index.d.ts +0 -59
  17. package/dist/types/core/beam/recall.d.ts +0 -52
  18. package/dist/types/core/beam/schema.d.ts +0 -2
  19. package/dist/types/core/beam/store.d.ts +0 -57
  20. package/dist/types/core/beam/types.d.ts +0 -268
  21. package/dist/types/core/binary-vectors.d.ts +0 -54
  22. package/dist/types/core/chat-normalize.d.ts +0 -13
  23. package/dist/types/core/content-sanitizer.d.ts +0 -18
  24. package/dist/types/core/cost-log.d.ts +0 -13
  25. package/dist/types/core/embeddings.d.ts +0 -93
  26. package/dist/types/core/entities.d.ts +0 -9
  27. package/dist/types/core/episodic-graph.d.ts +0 -89
  28. package/dist/types/core/extraction/client.d.ts +0 -35
  29. package/dist/types/core/extraction/diagnostics.d.ts +0 -51
  30. package/dist/types/core/extraction/prompts.d.ts +0 -2
  31. package/dist/types/core/extraction.d.ts +0 -34
  32. package/dist/types/core/fastembed-model-cache.d.ts +0 -2
  33. package/dist/types/core/fastembed-runtime.d.ts +0 -41
  34. package/dist/types/core/index.d.ts +0 -6
  35. package/dist/types/core/llm-backends.d.ts +0 -23
  36. package/dist/types/core/local-llm.d.ts +0 -20
  37. package/dist/types/core/memory.d.ts +0 -186
  38. package/dist/types/core/migrations/e6-triplestore-split.d.ts +0 -17
  39. package/dist/types/core/migrations/index.d.ts +0 -1
  40. package/dist/types/core/mmr.d.ts +0 -8
  41. package/dist/types/core/orchestrator.d.ts +0 -20
  42. package/dist/types/core/patterns.d.ts +0 -61
  43. package/dist/types/core/plugins.d.ts +0 -109
  44. package/dist/types/core/polyphonic-recall.d.ts +0 -66
  45. package/dist/types/core/query-cache.d.ts +0 -45
  46. package/dist/types/core/query-intent.d.ts +0 -20
  47. package/dist/types/core/recall-diagnostics.d.ts +0 -48
  48. package/dist/types/core/runtime-options.d.ts +0 -76
  49. package/dist/types/core/shmr.d.ts +0 -62
  50. package/dist/types/core/streaming.d.ts +0 -136
  51. package/dist/types/core/synonyms.d.ts +0 -46
  52. package/dist/types/core/temporal-parser.d.ts +0 -16
  53. package/dist/types/core/token-counter.d.ts +0 -8
  54. package/dist/types/core/triples.d.ts +0 -63
  55. package/dist/types/core/typed-memory.d.ts +0 -39
  56. package/dist/types/core/vector-index.d.ts +0 -16
  57. package/dist/types/core/vector-math.d.ts +0 -1
  58. package/dist/types/core/veracity-consolidation.d.ts +0 -60
  59. package/dist/types/core/weibull.d.ts +0 -96
  60. package/dist/types/db.d.ts +0 -18
  61. package/dist/types/diagnose.d.ts +0 -24
  62. package/dist/types/dr/index.d.ts +0 -1
  63. package/dist/types/dr/recovery.d.ts +0 -68
  64. package/dist/types/index.d.ts +0 -6
  65. package/dist/types/mcp-server.d.ts +0 -40
  66. package/dist/types/mcp-tools.d.ts +0 -484
  67. package/dist/types/migrations/e6-triplestore-split.d.ts +0 -1
  68. package/dist/types/migrations/index.d.ts +0 -1
  69. package/dist/types/types.d.ts +0 -145
  70. package/dist/types/util/datetime.d.ts +0 -8
  71. package/dist/types/util/env.d.ts +0 -10
  72. package/dist/types/util/ids.d.ts +0 -3
  73. package/dist/types/util/lru.d.ts +0 -12
  74. package/dist/types/util/regex.d.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -2,261 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## [1.0.9] - 2026-08-19
6
-
7
- ## [17.3.5] - 2026-08-16
8
-
9
- ### Fixed
10
-
11
- - Fixed an issue where transient provider failures (such as Anthropic overload or rate limit errors) were incorrectly treated as empty responses; these failures are now retried automatically before falling back.
12
-
13
- ## [17.3.4] - 2026-08-14
14
-
15
- ### Fixed
16
-
17
- - Fixed `recall()` silently dropping `scope='global'` rows whenever a `channelId` filter was active: `buildWhere()` appended a redundant hard `channel_id = ?` clause on top of the `(session_id = ? OR scope = 'global' OR channel_id = ?)` visibility clause, so global rows whose `channel_id` didn't match (e.g. imported rows with `channel_id NULL`) were excluded. Channel isolation is preserved by the visibility clause alone. This made imported/global episodic memory permanently unrecallable through callers that always pass a channel (such as the coding-agent memory backend). ([#8525](https://github.com/can1357/oh-my-pi/issues/8525))
18
-
19
- ## [17.2.11] - 2026-08-07
20
-
21
- ### Fixed
22
-
23
- - Fixed an issue where an interrupted local embedding model download could permanently corrupt the cache and silently disable semantic recall. The system now automatically detects incomplete model files, clears the corrupted cache, and retries the download.
24
-
25
- ## [17.2.10] - 2026-08-06
26
-
27
- ### Changed
28
-
29
- - Updated internal LRU cache implementation.
30
-
31
- ## [17.2.6] - 2026-08-03
32
-
33
- ### Added
34
-
35
- - Added opt-in SQLite page-size configuration for file-backed databases, configurable via the `MNEMOPI_DB_PAGE_SIZE` environment variable or the `pageSize` option in `openDatabase`. Existing databases retain their original page size.
36
-
37
- ## [17.2.3] - 2026-08-01
38
-
39
- ### Fixed
40
-
41
- - Stripped `<think>…</think>` reasoning blocks from remote LLM output in `cleanOutput`, so reasoning-model responses no longer leak into consolidated memories or corrupt fact extraction (the reasoning wrapper previously survived parsing and every stored fact became reasoning prose). ([#7231](https://github.com/can1357/oh-my-pi/issues/7231))
42
-
43
- ## [17.2.2] - 2026-07-31
44
-
45
- ### Fixed
46
-
47
- - Fixed a resource leak where SQLite prepared statements were not properly released, keeping the database connection alive after calling close(). This resolves file locking issues on Windows (which prevented deleting, moving, or rotating database files) and silent file handle leaks on POSIX systems.
48
-
49
- ## [17.0.8] - 2026-07-22
50
-
51
- ### Changed
52
-
53
- - Optimized vector operations (exact vector-index search, SHMR similarity clustering, and default-similarity MMR rerank) by migrating hot loops to native batch kernels, resulting in significant performance improvements (up to 1.8x faster top-K search, 2.4x faster pairwise clustering, and 22-36x faster MMR reranking).
54
-
55
- ## [17.0.4] - 2026-07-18
56
-
57
- ### Fixed
58
-
59
- - Fixed a corrupt cached embedding model (truncated `model_optimized.onnx`, `Protobuf parsing failed` on load) permanently disabling local embeddings: init now quarantines the broken cache file (rename to `*.corrupt-<ts>`, only when the path resolves inside the fastembed cache directory) and retries once so the model re-downloads.
60
-
61
- ## [17.0.1] - 2026-07-16
62
-
63
- ### Fixed
64
-
65
- - Fixed working-memory TTL trim silently deleting restored or imported durable rows: rows keeping `consolidated_at = NULL` with an old `timestamp` are no longer trimmed when flagged `IMPORTED`, `importFromDict` stamps imported rows as consolidated, and every working-memory delete path (trim, `forgetWorking`, force-import overwrite) now cascades linked annotations, embeddings, facts, memoria projections, gists, and graph edges instead of leaving orphans. ([#4819](https://github.com/can1357/oh-my-pi/issues/4819))
66
- - Fixed Mnemopi local embeddings on Windows loading an unrelated `onnxruntime.dll` from the inherited system path instead of fastembed's cached ORT runtime. ([#4849](https://github.com/can1357/oh-my-pi/issues/4849))
67
-
68
- ## [16.3.9] - 2026-07-06
69
-
70
- ### Fixed
71
-
72
- - Fixed extractor JSON parsing to correctly unwrap object-shaped facts, instructions, preferences, and timeline items from known text fields instead of persisting literal `[object Object]` rows.
73
-
74
- ## [16.3.7] - 2026-07-05
75
-
76
- ### Added
77
-
78
- - Added `RecallOptions.contentPreviewChars` to allow customizing or disabling the content preview cap (default is 500, set to 0 for full content).
79
- - Added `RecallResult.truncated` and `RecallResult.full_length` properties to easily identify clipped previews without parsing trailing markers.
80
-
81
- ### Fixed
82
-
83
- - Fixed background LLM fact extraction to preserve specific extractor categories (`instructions`, `preferences`, `timelines`, and `kg` triples) in MEMORIA tables and graph triples instead of flattening them into generic `fact/entity` rows.
84
- - Improved recall previews and `factLine` context to append a trailing ellipsis (`…`) when content is clipped, preventing mid-word truncation without a marker.
85
-
86
- ## [16.3.5] - 2026-07-04
87
-
88
- ### Fixed
89
-
90
- - Fixed `remember(..., { embedText })` so hosts can store full transcripts while embedding, FTS-indexing, and rebuild-reembedding a marker-free projection. ([#4395](https://github.com/can1357/oh-my-pi/issues/4395))
91
-
92
- ## [16.2.2] - 2026-06-27
93
-
94
- ### Fixed
95
-
96
- - Improved resilience during API extraction calls by enhancing the handling of rate limits and transient errors.
97
-
98
- ## [16.1.17] - 2026-06-24
99
-
100
- ### Fixed
101
-
102
- - Fixed `remember(..., { extract: true })` fact/entity extraction accepting an `extractText` override so hosts can store full transcripts while mining facts from a safer projection; also tightened deterministic `Instruction:` extraction to require an explicit `I`/`you` subject instead of treating every `always`/`never` clause as a user instruction. ([#3372](https://github.com/can1357/oh-my-pi/issues/3372))
103
-
104
- ## [16.1.8] - 2026-06-20
105
-
106
- ### Fixed
107
-
108
- - Capped per-input length in `embed()` at `MNEMOPI_EMBEDDING_MAX_INPUT_CHARS` (default 8192 chars, override via the env var or `embeddings.maxInputChars` runtime option; `0` disables) so a long retention transcript can no longer overflow the embedding model's context window. Oversized inputs are clipped with a head/tail split so chronological transcripts keep both the opening setup and the most recent turns instead of losing the latest content under a naive prefix slice. llama.cpp's `/embeddings` server used to reject the request with `request (N tokens) exceeds the available context size`, silently dropping vector recall for that memory ([#3126](https://github.com/can1357/oh-my-pi/issues/3126)).
109
- - Fixed the proactive-linking write path ignoring host configuration: `proactiveLinkIfEnabled` read `MNEMOPI_PROACTIVE_LINKING` directly, so a host that enabled proactive linking through `configureRecallFeatures()` had no effect unless the environment variable was also set. `proactiveLinking` is now a `RecallFeatureFlags` option resolved through a `proactiveLinkingEnabled()` fallback, matching the existing polyphonic and enhanced recall flags, with the `MNEMOPI_PROACTIVE_LINKING` environment variable still taking precedence whenever it is set. ([#2440](https://github.com/can1357/oh-my-pi/issues/2440))
110
-
111
- ## [16.1.3] - 2026-06-19
112
-
113
- ### Added
114
-
115
- - Exposed `setLocalModelInitializer` (and the `LocalEmbeddingModel`, `LocalModelInitializer`, `LocalModelInitOptions`, `StandardEmbeddingModel` types) so hosts can route fastembed loads through a dedicated subprocess and keep `onnxruntime-node`'s NAPI constructor + finalizer out of their own address space. Same wipe semantics as the existing `setLocalModelInitializerForTests` seam; the agent CLI uses it to crash-proof Windows when `memory.backend: mnemopi` is enabled ([#3031](https://github.com/can1357/oh-my-pi/issues/3031)).
116
-
117
- ### Fixed
118
-
119
- - Fixed background fact extraction skipping runtime-configured remote LLM endpoints when `MNEMOPI_LLM_BASE_URL` was unset, so `remember(..., { extract: true })` now stores remote-distilled facts from `mnemopi.llm` config instead of falling back to regex heuristics. ([#3041](https://github.com/can1357/oh-my-pi/issues/3041))
120
- - Fixed local fastembed startup on macOS ARM64 by letting `fastembed@2.1.0` install its matching `onnxruntime-node@1.21.0` native runtime instead of forcing `1.26.0`, and by repairing missing tokenizer sidecars from the upstream Hugging Face model cache when a stale fastembed archive lacks them. ([#3054](https://github.com/can1357/oh-my-pi/issues/3054))
121
-
122
- ## [16.0.6] - 2026-06-18
123
-
124
- ### Fixed
125
-
126
- - Forced the on-demand fastembed runtime install to override fastembed's archived `onnxruntime-node@1.21.0` transitive pin with Mnemopi's `onnxruntime-node@1.26.0` pin, fixing local embedding startup on macOS ARM64. ([#2920](https://github.com/can1357/oh-my-pi/issues/2920))
127
-
128
- ### Changed
129
-
130
- - Updated OpenRouter request headers to use standard shared headers from the pi-ai package
131
-
132
- ## [16.0.5] - 2026-06-17
133
-
134
- ### Fixed
135
-
136
- - Capped `sleep_consolidation` episodic rows at `maxEpisodeChars` (default 100KB, `MNEMOPI_MAX_EPISODE_CHARS`) so raw session transcripts cannot be stored and extracted as multi-megabyte episodes. ([#2869](https://github.com/can1357/oh-my-pi/issues/2869))
137
- - Skipped regex-only entity and pattern fact extraction for oversized raw transcripts so progress/log noise cannot flood MEMORIA with junk facts. ([#2868](https://github.com/can1357/oh-my-pi/issues/2868))
138
-
139
- ## [15.13.1] - 2026-06-15
140
-
141
- ### Added
142
-
143
- - Added a wipe-and-rebuild reconcile (`reconcileEmbeddingModel`) that runs when the configured embedding model changes. At store open, if the model stamped on stored `memory_embeddings` rows differs from the active `currentEmbeddingModel()`, the stale embeddings and their binary vectors are dropped and every existing memory is enqueued for background re-embedding (in bounded batches) at the new model/dimension. The destructive wipe is skipped whenever it could not be rebuilt — embeddings disabled via the runtime option or the `MNEMOPI_NO_EMBEDDINGS` env, an unresolved (empty) active model, or a read-only open (`reconcile: false`, used by ephemeral stats readers that would exit before the async rebuild finished) — so a stale-but-valid corpus is never destroyed without a replacement. Recall degrades gracefully (FTS-only) for memories whose vectors are not yet rebuilt ([#2476](https://github.com/can1357/oh-my-pi/issues/2476))
144
-
145
- ### Fixed
146
-
147
- - Normalized enhanced recall fact scoring against lexical coverage so high-confidence facts that only match generic query tokens no longer outrank exact working-memory hits. ([#2441](https://github.com/can1357/oh-my-pi/issues/2441))
148
-
149
- ## [15.12.4] - 2026-06-13
150
-
151
- ### Fixed
152
-
153
- - Fixed `consolidateToEpisodic` (the function backing `sleep` / `sleepAllSessions`) never populating the episodic graph: the `gists` and `graph_edges` tables stayed at 0 rows across every bank even after multiple consolidation cycles, so Polyphonic Recall's `graph` voice (BFS over `findGistsByParticipant` / `findRelatedMemories`) always returned nothing. Consolidation now best-effort ingests the new episodic memory into `EpisodicGraph` so the gist row, gist→memory `ctx` edge, fact edges, and cross-memory similarity/entity/temporal edges land alongside the episodic row. Independent of the existing `MNEMOPI_PROACTIVE_LINKING` flag, which still gates the same enrichment on the `remember()` write path. ([#2435](https://github.com/can1357/oh-my-pi/issues/2435))
154
-
155
- ## [15.12.0] - 2026-06-12
5
+ ## [1.1.0] - 2026-08-25
156
6
 
157
7
  ### Changed
158
8
 
159
- - Moved `fastembed` and `onnxruntime-node` from `dependencies` to optional `peerDependencies` pinned to exact versions. When the peers are absent (bundled CLI, compiled binary, or installs that skip optional peers), the local embedding path `bun install`s the pinned pair into `~/.omp/cache/fastembed-runtime/<version-key>` on first use and loads fastembed from there — restoring local embeddings in bundled distributions and removing ~270MB of eager native downloads from default installs ([#2389](https://github.com/can1357/oh-my-pi/issues/2389))
160
-
161
- ## [15.11.4] - 2026-06-12
162
-
163
- ### Added
164
-
165
- - Added `configureRecallFeatures()` (exported from the package root, `core`, and `config`) so hosts can enable the polyphonic recall engine and the enhanced recall query cache programmatically. `polyphonicRecallEnabled()`, `enhancedRecallEnabled()`, and `isEnhancedRecallEnabled()` now fall back to these configured defaults, with the `MNEMOPI_POLYPHONIC_RECALL` / `MNEMOPI_ENHANCED_RECALL` environment variables still taking precedence whenever they are set. ([#2323](https://github.com/can1357/oh-my-pi/issues/2323))
166
-
167
- ### Fixed
168
-
169
- - Fixed the embedding pipeline's silent `catch {}` blocks (`runEmbedding()`, `getLocalModel()`, and the local-model path of `embed()`) swallowing failures with zero diagnostics. These best-effort paths still degrade gracefully (return `null` / skip the write), but now emit structured `logger.debug` entries with the error and per-site context (item count, model name). The `mnemopi.debug` config flag now propagates into the core library via runtime options (`MnemopiOptions.debug` → `ResolvedMnemopiRuntimeOptions.debug`) and escalates these logs to `warn` so they surface at the default log level. ([#2322](https://github.com/can1357/oh-my-pi/issues/2322))
170
-
171
- ### Changed
172
-
173
- - Extraction, embedding, and remote-LLM clients now accept an `ApiKey` (static string or resolver) and resolve it per request through `withAuth`, so 401s force-refresh and rotate credentials via the central auth-retry policy instead of failing with a stale key. Empty-key setups (local/proxy endpoints without `Authorization`) and pinned literal keys behave exactly as before.
174
- - Embedding and remote-LLM 401 errors now throw pi-ai's typed `ProviderHttpError` instead of `Object.assign`-patched `Error`s, keeping the same structural `.status` contract for the auth-retry classifier.
175
- - SHMR consolidation clustering (`core/shmr`) now uses the real embedding provider when one is configured instead of always hashing: `embed()`, the new `embedBatch()`, `clusterBySimilarity()`, `computeHarmonyScore()`, `harmonize()`, and `recallBeliefs()` are now async, batch-embed candidate texts in a single provider call, and reuse precomputed vectors from `memory_embeddings` for episodic candidates. The SHA1 bag-of-words hash remains as the deterministic fallback when no provider is available or embedding fails. ([#2324](https://github.com/can1357/oh-my-pi/issues/2324))
176
-
177
- ## [15.10.12] - 2026-06-10
178
-
179
- ### Changed
180
-
181
- - Reworked the in-memory fallback vector search to build a normalized exact vector index per query, matching the shape needed for future quantized or TurboVec-style backends without adding a new dependency yet.
182
-
183
- ## [15.10.11] - 2026-06-10
184
-
185
- ### Fixed
186
-
187
- - Fixed embedding provider detection to match `openrouter` by URL host, so custom embedding endpoints are now recognized correctly instead of being misclassified by substring matching
188
- - Fixed the check for OpenRouter base URLs so only true `openrouter` hosts are treated as non-custom
189
-
190
- ## [15.10.8] - 2026-06-09
191
-
192
- ### Added
193
-
194
- - Added a `fetch` option to `ExtractionClient` to inject a custom fetch implementation for remote LLM requests
195
- - Added an optional `fetch` option to `extractFacts` to control the transport used for remote extraction calls
196
- - Added support for passing a custom `fetch` implementation through `complete` and `summarizeMemories` via remote LLM options
197
-
198
- ## [15.9.1] - 2026-06-04
199
-
200
- ### Breaking Changes
201
-
202
- - Changed `Mnemopi.recall()`, `Mnemopi.recallEnhanced()`, `Mnemopi.search()`, `Mnemopi.query()`, the module-level `recall`/`recallEnhanced`/`search`/`query` exports, the `BeamMemory.recall`/`recallEnhanced` methods, the free `recall`/`recallEnhanced` functions in `core/beam/recall`, and `orchestrateRecall` to return `Promise<RecallResult[]>` so the recall pipeline can auto-derive `queryEmbedding` from the query text via `embedQuery`. Callers must `await` recall calls; pass `queryEmbedding: null` to opt out of auto-embedding and stay on FTS-only.
203
- - Changed the MCP entrypoints `handleToolCall`, `callToolJson`, and `handleJsonRpc` in `mcp-server`/`mcp-tools` to async so the recall/shared-recall handlers can await the new `Promise<ToolResult[]>` shape; external MCP transports must `await` these.
204
-
205
- ### Fixed
206
-
207
- - Fixed `memory_embeddings` never being populated by the production `remember`/`rememberBatch`/`updateWorking`/`consolidateToEpisodic` paths; embedding generation is now scheduled as a background task on `beam.pendingExtractions` (mirroring `scheduleFactExtraction`), so configured providers (fastembed, OpenAI-compatible API, custom) actually run and rows land in `memory_embeddings(memory_id, embedding_json, model)`. ([#1832](https://github.com/can1357/oh-my-pi/issues/1832))
208
- - Fixed `recall()`/`recallEnhanced()` never deriving a query embedding from the query text, which silently degraded every deployment to FTS-only regardless of provider configuration. The recall pipeline now auto-calls `embedQuery(query)` when `options.queryEmbedding` is undefined; pass `null` to keep the old FTS-only behaviour. ([#1832](https://github.com/can1357/oh-my-pi/issues/1832))
209
- - Fixed `toRecallOptions` dropping `queryEmbedding` between the `Mnemopi` facade and the beam layer, so callers can now explicitly pin or disable the query vector through the public API.
210
- - Fixed `withMemory` (CLI) and `withBeam`/`withSharedBeam` (MCP) closing the SQLite handle before background fact-extraction and embedding tasks finished, so short-lived `mnemopi store`/`mnemopi sleep` and MCP `remember`/`update` paths now drain `flushExtractions` before close instead of silently dropping `memory_embeddings` rows. CLI handlers and MCP `handleRemember`/`handleUpdate`/`handleSleep`/etc. are async as a result. ([#1832](https://github.com/can1357/oh-my-pi/issues/1832), follow-up to [#1833](https://github.com/can1357/oh-my-pi/pull/1833) review)
211
- - Fixed the process-wide `embedQuery()` cache in `core/embeddings.ts` keying by query text alone, which let two `Mnemopi` instances in the same process with different providers/models cross-contaminate their `dense_score` rankings. The cache key now includes a WeakMap-assigned provider identity, the resolved model name, and the configured `apiUrl`, so disjoint runtimes never read each other's cached vectors. ([#1832](https://github.com/can1357/oh-my-pi/issues/1832), follow-up to [#1833](https://github.com/can1357/oh-my-pi/pull/1833) review)
212
-
213
- ## [15.7.4] - 2026-05-31
214
-
215
- ### Fixed
216
-
217
- - Fixed the `darwin-x64` release build failing in `bun build --compile` because the Windows ORT 1.24 preload pulled `onnxruntime-node` into the static graph and there is no `darwin/x64` prebuilt for that line. The preload is now guarded behind a `process.platform === "win32"` literal that Bun dead-code-eliminates on non-Windows targets; macOS/Linux load fastembed's bundled ORT 1.21 binding as before.
218
-
219
- ## [15.7.3] - 2026-05-31
220
-
221
- ### Changed
222
-
223
- - Changed embedding result normalization to return `Float32Array` vectors so `embed` and `embedQuery` now cache and emit float32 rows
224
- - Changed the embedding provider contract to a single typed `EmbeddingOutput` (`AsyncIterable<number[][]>`) instead of `unknown`, matching fastembed's `embed()`, so `EmbeddingProvider.embed` and the `provider` runtime option stream the embedding matrix as async batches (`async *embed(texts) { yield texts.map(embedOne); }`)
225
- - Changed local model cache directory resolution for `fastembed` to use `getFastembedCacheDir` instead of the hard-coded `~/.hermes/cache/fastembed` path
226
-
227
- ### Fixed
228
-
229
- - Fixed cosine similarity behavior across retrieval, clustering, and caching to consistently handle mismatched vector lengths as zero-padded and ignore non-finite values
230
- - Fixed embedding API requests to retry transient failures with backoff via shared retry logic before returning null
231
- - Fixed compiled `omp` binaries losing local Mnemopi embeddings by keeping `fastembed` and `onnxruntime-node` reachable to Bun's static compiler while preserving lazy runtime loading.
232
-
233
- ## [15.7.2] - 2026-05-31
234
-
235
- ### Fixed
236
-
237
- - Fixed Windows startup crashes by keeping fastembed's older ONNX Runtime binding lazy until local embeddings are used.
238
- - Fixed a segfault at startup from eagerly loading fastembed: importing the embeddings module pulled in `fastembed`, which eagerly loads the `onnxruntime-node` native addon. The import is now deferred until a local fastembed model is actually initialized, so API-model, disabled-embeddings, and test runtimes never load the native addon.
239
-
240
- ## [15.6.0] - 2026-05-30
241
-
242
- ### Added
243
-
244
- - Added `llm.extractionPrompt` runtime option to override the fact-extraction prompt template using `{text}` and `{lang}` placeholders
245
- - Added `llm.consolidationPrompt` runtime option to override the consolidation sleep prompt template using `{memories}`, `{source}`, and `{memory_count}` placeholders
246
- - Published `@linxiraos/pi-mnemopi` to npm: the local SQLite memory engine is now built, checked, tested, and released through the monorepo CI pipeline alongside the other workspace packages.
247
- - Exported the diagnostic inspector as the `@linxiraos/pi-mnemopi/diagnose` subpath for coding-agent memory maintenance commands.
248
- - Added `flushExtractions()` (on `Mnemopi`, `BeamMemory`, and as a module-level export) to drain in-flight background fact extraction; used by tests and graceful shutdown so facts are persisted before the database closes.
249
-
250
- ### Changed
251
-
252
- - Changed fact extraction to prefer a configured runtime LLM completion path before host extraction, with automatic fallback when the configured completion returns no output or fails
253
-
254
- ### Fixed
255
-
256
- - Fixed `rememberBatch(..., { extract: true })` to run background fact extraction for batch uploads (including per-item `extract` flags) so extracted facts are generated and recallable after extraction
257
- - Fixed `extract: true` fact extraction to continue safely when no LLM is configured by turning extraction failures into no-op background tasks
258
- - Fixed configured LLM fact extraction by using temperature 0 so re-ingesting the same text is deterministic and avoids near-duplicate extractions
259
- - Fixed `remember(..., { extract: true })` silently dropping the flag: it now schedules the LLM fact extractor (`extractFactsSafe`) over the stored content and persists the extracted facts so they become recallable. Previously the LLM extractor had no production callers and `extract` was dead.
9
+ - 同步上游 OMP v18.0.3 / v18.0.4(内部运行时与构建改进,无独立用户可见变更)。
260
10
 
261
11
  ## [1.0.0] - 2026-08-13
262
12
 
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Can Bölük
4
+ Copyright (c) 2026 Stencil Labs, Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/package.json CHANGED
@@ -1,108 +1,107 @@
1
1
  {
2
- "type": "module",
3
- "name": "@linxiraos/pi-mnemopi",
4
- "version": "1.0.9",
5
- "description": "Local SQLite memory engine for Oh My Pi agents",
6
- "homepage": "https://linxira-os.github.io",
7
- "author": "Can Boluk",
8
- "contributors": [
9
- "Abdias J"
10
- ],
11
- "license": "MIT",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
15
- "directory": "packages/mnemopi"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/can1357/oh-my-pi/issues"
19
- },
20
- "keywords": [
21
- "memory",
22
- "sqlite",
23
- "agent",
24
- "embeddings",
25
- "mcp"
26
- ],
27
- "main": "./src/index.ts",
28
- "module": "./src/index.ts",
29
- "types": "./dist/types/index.d.ts",
30
- "bin": {
31
- "mnemopi": "src/cli.ts"
32
- },
33
- "scripts": {
34
- "check": "biome check . && bun run check:types",
35
- "check:types": "tsgo -p tsconfig.json --noEmit",
36
- "lint": "biome lint .",
37
- "test": "bun test --parallel",
38
- "fix": "biome check --write --unsafe .",
39
- "fmt": "biome format --write ."
40
- },
41
- "dependencies": {
42
- "@linxiraos/pi-ai": "1.0.9",
43
- "@linxiraos/pi-catalog": "1.0.9",
44
- "@linxiraos/pi-natives": "1.0.9",
45
- "@linxiraos/pi-utils": "1.0.9"
46
- },
47
- "peerDependencies": {
48
- "fastembed": "2.1.0",
49
- "onnxruntime-node": "1.21.0"
50
- },
51
- "peerDependenciesMeta": {
52
- "fastembed": {
53
- "optional": true
54
- },
55
- "onnxruntime-node": {
56
- "optional": true
57
- }
58
- },
59
- "devDependencies": {
60
- "@types/bun": "^1.3.14",
61
- "fastembed": "2.1.0",
62
- "onnxruntime-node": "1.26.0"
63
- },
64
- "engines": {
65
- "bun": ">=1.3.14"
66
- },
67
- "files": [
68
- "src",
69
- "README.md",
70
- "CHANGELOG.md",
71
- "dist/types"
72
- ],
73
- "exports": {
74
- ".": {
75
- "types": "./dist/types/index.d.ts",
76
- "import": "./src/index.ts"
77
- },
78
- "./core": {
79
- "types": "./dist/types/core/index.d.ts",
80
- "import": "./src/core/index.ts"
81
- },
82
- "./core/beam": {
83
- "types": "./dist/types/core/beam/index.d.ts",
84
- "import": "./src/core/beam/index.ts"
85
- },
86
- "./beam": {
87
- "types": "./dist/types/core/beam/index.d.ts",
88
- "import": "./src/core/beam/index.ts"
89
- },
90
- "./diagnose": {
91
- "types": "./dist/types/diagnose.d.ts",
92
- "import": "./src/diagnose.ts"
93
- },
94
- "./mcp": {
95
- "types": "./dist/types/mcp-tools.d.ts",
96
- "import": "./src/mcp-tools.ts"
97
- },
98
- "./cli": {
99
- "types": "./dist/types/cli.d.ts",
100
- "import": "./src/cli.ts"
101
- },
102
- "./*": {
103
- "types": "./dist/types/*.d.ts",
104
- "import": "./src/*.ts"
105
- },
106
- "./*.js": "./src/*.ts"
107
- }
108
- }
2
+ "type": "module",
3
+ "name": "@linxiraos/pi-mnemopi",
4
+ "version": "1.1.0",
5
+ "description": "Local SQLite memory engine for Oh My Pi agents",
6
+ "homepage": "https://linxira-os.github.io/zeta/",
7
+ "author": "Can Boluk",
8
+ "contributors": [
9
+ "Abdias J"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
15
+ "directory": "packages/mnemopi"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
19
+ },
20
+ "keywords": [
21
+ "memory",
22
+ "sqlite",
23
+ "agent",
24
+ "embeddings",
25
+ "mcp"
26
+ ],
27
+ "main": "./src/index.ts",
28
+ "module": "./src/index.ts",
29
+ "types": "./src/index.ts",
30
+ "bin": {
31
+ "mnemopi": "src/cli.ts"
32
+ },
33
+ "scripts": {
34
+ "check": "biome check . && bun run check:types",
35
+ "check:types": "tsgo -p tsconfig.json --noEmit",
36
+ "lint": "biome lint .",
37
+ "test": "bun test --parallel",
38
+ "fix": "biome check --write --unsafe .",
39
+ "fmt": "biome format --write ."
40
+ },
41
+ "dependencies": {
42
+ "@linxiraos/pi-ai": "catalog:",
43
+ "@linxiraos/pi-catalog": "catalog:",
44
+ "@linxiraos/pi-natives": "catalog:",
45
+ "@linxiraos/pi-utils": "catalog:"
46
+ },
47
+ "peerDependencies": {
48
+ "fastembed": "2.1.0",
49
+ "onnxruntime-node": "1.21.0"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "fastembed": {
53
+ "optional": true
54
+ },
55
+ "onnxruntime-node": {
56
+ "optional": true
57
+ }
58
+ },
59
+ "devDependencies": {
60
+ "@types/bun": "catalog:",
61
+ "fastembed": "catalog:",
62
+ "onnxruntime-node": "catalog:"
63
+ },
64
+ "engines": {
65
+ "bun": ">=1.3.14"
66
+ },
67
+ "files": [
68
+ "src",
69
+ "README.md",
70
+ "CHANGELOG.md"
71
+ ],
72
+ "exports": {
73
+ ".": {
74
+ "types": "./src/index.ts",
75
+ "import": "./src/index.ts"
76
+ },
77
+ "./core": {
78
+ "types": "./src/core/index.ts",
79
+ "import": "./src/core/index.ts"
80
+ },
81
+ "./core/beam": {
82
+ "types": "./src/core/beam/index.ts",
83
+ "import": "./src/core/beam/index.ts"
84
+ },
85
+ "./beam": {
86
+ "types": "./src/core/beam/index.ts",
87
+ "import": "./src/core/beam/index.ts"
88
+ },
89
+ "./diagnose": {
90
+ "types": "./src/diagnose.ts",
91
+ "import": "./src/diagnose.ts"
92
+ },
93
+ "./mcp": {
94
+ "types": "./src/mcp-tools.ts",
95
+ "import": "./src/mcp-tools.ts"
96
+ },
97
+ "./cli": {
98
+ "types": "./src/cli.ts",
99
+ "import": "./src/cli.ts"
100
+ },
101
+ "./*": {
102
+ "types": "./src/*.ts",
103
+ "import": "./src/*.ts"
104
+ },
105
+ "./*.js": "./src/*.ts"
106
+ }
107
+ }
package/src/cli.ts CHANGED
File without changes
@@ -565,7 +565,14 @@ export class EpisodicGraph {
565
565
  }
566
566
 
567
567
  private extractParticipants(content: string): string[] {
568
- const names = Array.from(content.matchAll(/\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+)?)\b/g), match => match[1] ?? "");
568
+ // Match capitalized proper nouns across cased scripts (Latin, Greek, Cyrillic, …).
569
+ // `[A-Z][a-z]+` plus ASCII `\b` matched no non-Latin token, so any non-English
570
+ // memory produced zero participants (issue #7918). Unicode property escapes with
571
+ // the `u` flag, and `\p{L}`-based lookaround boundaries in place of `\b`, fix that.
572
+ const names = Array.from(
573
+ content.matchAll(/(?<![\p{L}\p{N}_])(\p{Lu}\p{Ll}+(?:\s+\p{Lu}\p{Ll}+)?)(?![\p{L}\p{N}_])/gu),
574
+ match => match[1] ?? "",
575
+ );
569
576
  const pronouns = Array.from(
570
577
  content.matchAll(/\b(I|you|we|they|he|she|it|me|us|them|him|her)\b/gi),
571
578
  match => match[1] ?? "",
@@ -590,7 +597,7 @@ export class EpisodicGraph {
590
597
 
591
598
  private extractLocation(content: string): string | null {
592
599
  const properPlace =
593
- /\b(?:at|in|from)\s+([A-Z][a-zA-Z\s]+?)(?:\s+(?:yesterday|today|tomorrow|now|last|next|on|at)\b|$)/i.exec(
600
+ /\b(?:at|in|from)\s+([A-Z][a-zA-Z\s]+?)(?:\s+(?:yesterday|today|tomorrow|now|last|next|on|at)\b|$)/.exec(
594
601
  content,
595
602
  );
596
603
  if (properPlace?.[1] !== undefined) return properPlace[1].trim();
@@ -387,7 +387,10 @@ export async function extractFactCategories(
387
387
  if (configuredLlmWillHandleCall()) {
388
388
  diag.recordAttempt("host");
389
389
  try {
390
- const raw = await callConfiguredCompletion(prompt, 0, { maxTokens: llmMaxTokens() });
390
+ const raw = await callConfiguredCompletion(prompt, 0, {
391
+ maxTokens: llmMaxTokens(),
392
+ task: { kind: "memory-extraction", input: text },
393
+ });
391
394
  if (typeof raw === "string" && raw.trim() !== "") {
392
395
  const extracted = parseExtractedFactCategories(raw);
393
396
  const count = countExtractedFactCategories(extracted);
@@ -180,6 +180,7 @@ export async function callConfiguredCompletion(
180
180
  timeout: opts.timeout,
181
181
  provider: opts.provider,
182
182
  model: opts.model,
183
+ task: opts.task,
183
184
  });
184
185
  return typeof raw === "string" ? raw : null;
185
186
  }
@@ -1,12 +1,18 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import type { Api, ApiKey, Model } from "@linxiraos/pi-ai";
3
3
 
4
+ export type MnemopiLlmCompletionTask = {
5
+ kind: "memory-extraction";
6
+ input: string;
7
+ };
8
+
4
9
  export interface MnemopiLlmCompleteOptions {
5
10
  maxTokens?: number;
6
11
  temperature?: number;
7
12
  timeout?: number;
8
13
  provider?: string | null;
9
14
  model?: string | null;
15
+ task?: MnemopiLlmCompletionTask;
10
16
  }
11
17
 
12
18
  export type MnemopiLlmCompletion = (
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { BeamMemory } from "./core/beam/index.js";
3
- export interface CliIo {
4
- write(data: string): void;
5
- }
6
- export interface CliContext {
7
- readonly dataDir?: string;
8
- readonly dbPath?: string;
9
- readonly memory?: BeamMemory;
10
- readonly createMemory?: () => BeamMemory;
11
- readonly stdout?: CliIo;
12
- readonly stderr?: CliIo;
13
- }
14
- export declare class CliError extends Error {
15
- readonly exitCode: number;
16
- constructor(message: string, exitCode?: number);
17
- }
18
- type CommandHandler = (args: readonly string[], context?: CliContext) => number | Promise<number>;
19
- export declare function memoryStats(memory: BeamMemory, dataDir?: string): Record<string, unknown>;
20
- export declare const cmdExport: CommandHandler;
21
- export declare const cmdImport: CommandHandler;
22
- export declare const cmdMcp: CommandHandler;
23
- export declare const cmdRemember: CommandHandler;
24
- export declare const cmdRecall: CommandHandler;
25
- export declare const cmdUpdate: CommandHandler;
26
- export declare const cmdDelete: CommandHandler;
27
- export declare const cmdStats: CommandHandler;
28
- export declare const cmdSleep: CommandHandler;
29
- export declare const cmdScratchpad: CommandHandler;
30
- export declare const cmdBank: CommandHandler;
31
- export declare const cmdDiagnose: CommandHandler;
32
- export declare const COMMANDS: Readonly<Record<string, CommandHandler>>;
33
- export declare function printHelp(context?: CliContext): void;
34
- export declare function runCli(args?: readonly string[], context?: CliContext): Promise<number>;
35
- export {};