@remnic/core 9.3.650 → 9.3.652

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 (193) hide show
  1. package/dist/access-cli.js +39 -38
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.d.ts +3 -2
  4. package/dist/access-http.js +19 -19
  5. package/dist/access-mcp.d.ts +3 -2
  6. package/dist/access-mcp.js +18 -18
  7. package/dist/access-schema.js +3 -3
  8. package/dist/{access-service-DIZRHQ7Q.d.ts → access-service-CdJFd3_b.d.ts} +23 -2
  9. package/dist/access-service.d.ts +3 -2
  10. package/dist/access-service.js +16 -16
  11. package/dist/{auto-sync-54QQHOG5.js → auto-sync-5CJBJMPZ.js} +5 -5
  12. package/dist/bootstrap.d.ts +2 -1
  13. package/dist/briefing.js +3 -3
  14. package/dist/calibration.js +2 -2
  15. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  16. package/dist/causal-consolidation.js +6 -6
  17. package/dist/{chunk-QT4THOLT.js → chunk-2DGQLOOM.js} +1 -1
  18. package/dist/chunk-2DGQLOOM.js.map +1 -0
  19. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  20. package/dist/{chunk-OAZ5MFUB.js → chunk-3XGWCZ63.js} +45 -28
  21. package/dist/chunk-3XGWCZ63.js.map +1 -0
  22. package/dist/{chunk-QKE4LHNR.js → chunk-4HYSMH7D.js} +2 -2
  23. package/dist/{chunk-DDRNDPX4.js → chunk-4SKKVWLQ.js} +2 -2
  24. package/dist/chunk-5FOCXX5E.js +34 -0
  25. package/dist/chunk-5FOCXX5E.js.map +1 -0
  26. package/dist/{chunk-YAFSTKTH.js → chunk-5V3TAB7D.js} +184 -12
  27. package/dist/chunk-5V3TAB7D.js.map +1 -0
  28. package/dist/{chunk-DB5A3NHS.js → chunk-7LWRCOP7.js} +9 -2
  29. package/dist/chunk-7LWRCOP7.js.map +1 -0
  30. package/dist/{chunk-FOVPSMGI.js → chunk-7WEB3FLJ.js} +2 -2
  31. package/dist/{chunk-APJQ6UEA.js → chunk-AGNBY3VG.js} +4 -4
  32. package/dist/{chunk-4BISW7RX.js → chunk-AJE7FJVE.js} +2 -2
  33. package/dist/{chunk-ZXWAQFDE.js → chunk-CFOCZPIQ.js} +2 -2
  34. package/dist/{chunk-NT5TINK5.js → chunk-DHGSZ3UD.js} +2 -2
  35. package/dist/{chunk-OTC2KOZ2.js → chunk-EHQLDFSH.js} +2 -2
  36. package/dist/{chunk-RRRCNIPK.js → chunk-GI45G4BK.js} +4 -4
  37. package/dist/{chunk-AMACWKM4.js → chunk-IJHLC5CH.js} +2 -2
  38. package/dist/{chunk-OR7R6M5Z.js → chunk-IVYSVAC6.js} +2 -2
  39. package/dist/{chunk-76QTEJ2Q.js → chunk-JBHXMCYN.js} +2 -2
  40. package/dist/{chunk-UMKPSD35.js → chunk-JF7SFXTG.js} +2 -2
  41. package/dist/{chunk-NMIOW7XG.js → chunk-JVRPJ7D4.js} +126 -26
  42. package/dist/chunk-JVRPJ7D4.js.map +1 -0
  43. package/dist/{chunk-TQUWNX7C.js → chunk-JX2RINDR.js} +2 -2
  44. package/dist/{chunk-MCYT2RNT.js → chunk-KJDKZVF3.js} +3 -3
  45. package/dist/{chunk-BUKK5SWA.js → chunk-KQAFEZQX.js} +2 -2
  46. package/dist/{chunk-PQFUUXWK.js → chunk-KWM33SPU.js} +2 -2
  47. package/dist/{chunk-A3BS64GV.js → chunk-LCC5EZTT.js} +4 -4
  48. package/dist/{chunk-TVOPSKOK.js → chunk-MGGNV3H2.js} +4 -4
  49. package/dist/{chunk-D6WVJIS3.js → chunk-ORGWWNJG.js} +2 -2
  50. package/dist/{chunk-Z3PZRDLW.js → chunk-PRQXUSQV.js} +2 -2
  51. package/dist/{chunk-VWT3F4IV.js → chunk-PS3SYNHP.js} +12 -4
  52. package/dist/chunk-PS3SYNHP.js.map +1 -0
  53. package/dist/{chunk-I4COC5XW.js → chunk-PYWNNF2I.js} +47 -9
  54. package/dist/chunk-PYWNNF2I.js.map +1 -0
  55. package/dist/{chunk-IMWFHBG2.js → chunk-QWRC7GIO.js} +2 -2
  56. package/dist/{chunk-U3GQ33JC.js → chunk-SLTKP5WJ.js} +2 -2
  57. package/dist/{chunk-23RYLGYA.js → chunk-TCX4WLKK.js} +104 -112
  58. package/dist/chunk-TCX4WLKK.js.map +1 -0
  59. package/dist/{chunk-6NKAQ74D.js → chunk-UU6MVCJ6.js} +1 -1
  60. package/dist/chunk-UU6MVCJ6.js.map +1 -0
  61. package/dist/{chunk-WEPMT6SC.js → chunk-V25ZAOSB.js} +5 -5
  62. package/dist/{chunk-UMTG2BN2.js → chunk-V4UDXYGG.js} +2 -2
  63. package/dist/{chunk-TUMH6EDV.js → chunk-WSFNYPAT.js} +26 -26
  64. package/dist/{chunk-ZT6R3WR3.js → chunk-WTI35CVJ.js} +4 -4
  65. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  66. package/dist/{chunk-OZKZ2TRP.js → chunk-XBIACVCO.js} +9 -2
  67. package/dist/chunk-XBIACVCO.js.map +1 -0
  68. package/dist/{chunk-ALUZN7BE.js → chunk-XMN6MMTU.js} +2 -2
  69. package/dist/{chunk-A4BTPHIN.js → chunk-Y7NWBBHV.js} +6 -6
  70. package/dist/{chunk-WPCCNSWO.js → chunk-YM3LR4LS.js} +7 -7
  71. package/dist/{chunk-3IJEQWQX.js → chunk-YOVKPOMD.js} +4 -4
  72. package/dist/{chunk-M75TBFKQ.js → chunk-Z2OXSMZK.js} +2 -2
  73. package/dist/{cli-BG4ybtJr.d.ts → cli-DDo7Qgs-.d.ts} +2 -2
  74. package/dist/cli.d.ts +4 -3
  75. package/dist/cli.js +34 -34
  76. package/dist/compounding/engine.js +3 -3
  77. package/dist/connectors/codex-materialize-runner.js +3 -3
  78. package/dist/connectors/index.js +3 -3
  79. package/dist/entity-retrieval.js +3 -3
  80. package/dist/event-order-recall.js +1 -1
  81. package/dist/explicit-capture.d.ts +2 -1
  82. package/dist/explicit-cue-recall.d.ts +7 -0
  83. package/dist/explicit-cue-recall.js +2 -1
  84. package/dist/extraction-judge.js +3 -3
  85. package/dist/extraction.js +3 -3
  86. package/dist/fallback-llm.js +2 -2
  87. package/dist/focused-list-recall.d.ts +6 -0
  88. package/dist/focused-list-recall.js +2 -1
  89. package/dist/index.d.ts +5 -4
  90. package/dist/index.js +87 -86
  91. package/dist/index.js.map +1 -1
  92. package/dist/lcm/engine.js +2 -2
  93. package/dist/lcm/index.js +5 -5
  94. package/dist/lcm-fallback-read.d.ts +71 -0
  95. package/dist/lcm-fallback-read.js +10 -0
  96. package/dist/lcm-fallback-read.js.map +1 -0
  97. package/dist/maintenance/memory-governance.js +3 -3
  98. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  99. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  100. package/dist/mcp-memory-inspector-app.d.ts +3 -2
  101. package/dist/namespaces/migrate.js +11 -11
  102. package/dist/namespaces/search.d.ts +18 -1
  103. package/dist/namespaces/search.js +7 -7
  104. package/dist/namespaces/storage.js +3 -3
  105. package/dist/operator-toolkit.js +13 -13
  106. package/dist/{orchestrator-CX-oqwJq.d.ts → orchestrator-8fTZsa0y.d.ts} +2 -0
  107. package/dist/orchestrator.d.ts +2 -1
  108. package/dist/orchestrator.js +33 -32
  109. package/dist/qmd.d.ts +2 -1
  110. package/dist/qmd.js +2 -2
  111. package/dist/recall-planner-llm.js +2 -2
  112. package/dist/response-guidance-recall.d.ts +6 -0
  113. package/dist/response-guidance-recall.js +2 -1
  114. package/dist/search/factory.js +6 -6
  115. package/dist/search/index.js +8 -8
  116. package/dist/search/lancedb-backend.js +2 -2
  117. package/dist/search/meilisearch-backend.js +2 -2
  118. package/dist/search/orama-backend.js +2 -2
  119. package/dist/search/port.d.ts +6 -0
  120. package/dist/search/port.js +1 -1
  121. package/dist/semantic-consolidation.js +4 -4
  122. package/dist/semantic-rule-promotion.js +3 -3
  123. package/dist/semantic-rule-verifier.js +3 -3
  124. package/dist/storage.js +2 -2
  125. package/dist/summarizer.js +3 -3
  126. package/dist/targeted-fact-recall.d.ts +6 -0
  127. package/dist/targeted-fact-recall.js +2 -1
  128. package/dist/transfer/backup.js +2 -2
  129. package/dist/transfer/capsule-export.js +2 -2
  130. package/dist/transfer/capsule-import.js +2 -2
  131. package/dist/transfer/import-sqlite.js +2 -2
  132. package/dist/verified-recall.js +3 -3
  133. package/package.json +1 -1
  134. package/src/access-service-health.test.ts +402 -0
  135. package/src/access-service.ts +274 -2
  136. package/src/event-order-recall.ts +8 -0
  137. package/src/explicit-cue-recall.ts +70 -29
  138. package/src/focused-list-recall.ts +23 -1
  139. package/src/lcm-fallback-read.ts +113 -0
  140. package/src/namespaces/search.test.ts +258 -3
  141. package/src/namespaces/search.ts +184 -30
  142. package/src/orchestrator.ts +179 -122
  143. package/src/qmd.test.ts +102 -0
  144. package/src/qmd.ts +54 -7
  145. package/src/response-guidance-recall.ts +21 -1
  146. package/src/search/port.ts +6 -0
  147. package/src/targeted-fact-recall.ts +24 -3
  148. package/dist/chunk-23RYLGYA.js.map +0 -1
  149. package/dist/chunk-6NKAQ74D.js.map +0 -1
  150. package/dist/chunk-DB5A3NHS.js.map +0 -1
  151. package/dist/chunk-I4COC5XW.js.map +0 -1
  152. package/dist/chunk-NMIOW7XG.js.map +0 -1
  153. package/dist/chunk-OAZ5MFUB.js.map +0 -1
  154. package/dist/chunk-OZKZ2TRP.js.map +0 -1
  155. package/dist/chunk-QT4THOLT.js.map +0 -1
  156. package/dist/chunk-VWT3F4IV.js.map +0 -1
  157. package/dist/chunk-YAFSTKTH.js.map +0 -1
  158. /package/dist/{auto-sync-54QQHOG5.js.map → auto-sync-5CJBJMPZ.js.map} +0 -0
  159. /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  160. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  161. /package/dist/{chunk-QKE4LHNR.js.map → chunk-4HYSMH7D.js.map} +0 -0
  162. /package/dist/{chunk-DDRNDPX4.js.map → chunk-4SKKVWLQ.js.map} +0 -0
  163. /package/dist/{chunk-FOVPSMGI.js.map → chunk-7WEB3FLJ.js.map} +0 -0
  164. /package/dist/{chunk-APJQ6UEA.js.map → chunk-AGNBY3VG.js.map} +0 -0
  165. /package/dist/{chunk-4BISW7RX.js.map → chunk-AJE7FJVE.js.map} +0 -0
  166. /package/dist/{chunk-ZXWAQFDE.js.map → chunk-CFOCZPIQ.js.map} +0 -0
  167. /package/dist/{chunk-NT5TINK5.js.map → chunk-DHGSZ3UD.js.map} +0 -0
  168. /package/dist/{chunk-OTC2KOZ2.js.map → chunk-EHQLDFSH.js.map} +0 -0
  169. /package/dist/{chunk-RRRCNIPK.js.map → chunk-GI45G4BK.js.map} +0 -0
  170. /package/dist/{chunk-AMACWKM4.js.map → chunk-IJHLC5CH.js.map} +0 -0
  171. /package/dist/{chunk-OR7R6M5Z.js.map → chunk-IVYSVAC6.js.map} +0 -0
  172. /package/dist/{chunk-76QTEJ2Q.js.map → chunk-JBHXMCYN.js.map} +0 -0
  173. /package/dist/{chunk-UMKPSD35.js.map → chunk-JF7SFXTG.js.map} +0 -0
  174. /package/dist/{chunk-TQUWNX7C.js.map → chunk-JX2RINDR.js.map} +0 -0
  175. /package/dist/{chunk-MCYT2RNT.js.map → chunk-KJDKZVF3.js.map} +0 -0
  176. /package/dist/{chunk-BUKK5SWA.js.map → chunk-KQAFEZQX.js.map} +0 -0
  177. /package/dist/{chunk-PQFUUXWK.js.map → chunk-KWM33SPU.js.map} +0 -0
  178. /package/dist/{chunk-A3BS64GV.js.map → chunk-LCC5EZTT.js.map} +0 -0
  179. /package/dist/{chunk-TVOPSKOK.js.map → chunk-MGGNV3H2.js.map} +0 -0
  180. /package/dist/{chunk-D6WVJIS3.js.map → chunk-ORGWWNJG.js.map} +0 -0
  181. /package/dist/{chunk-Z3PZRDLW.js.map → chunk-PRQXUSQV.js.map} +0 -0
  182. /package/dist/{chunk-IMWFHBG2.js.map → chunk-QWRC7GIO.js.map} +0 -0
  183. /package/dist/{chunk-U3GQ33JC.js.map → chunk-SLTKP5WJ.js.map} +0 -0
  184. /package/dist/{chunk-WEPMT6SC.js.map → chunk-V25ZAOSB.js.map} +0 -0
  185. /package/dist/{chunk-UMTG2BN2.js.map → chunk-V4UDXYGG.js.map} +0 -0
  186. /package/dist/{chunk-TUMH6EDV.js.map → chunk-WSFNYPAT.js.map} +0 -0
  187. /package/dist/{chunk-ZT6R3WR3.js.map → chunk-WTI35CVJ.js.map} +0 -0
  188. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  189. /package/dist/{chunk-ALUZN7BE.js.map → chunk-XMN6MMTU.js.map} +0 -0
  190. /package/dist/{chunk-A4BTPHIN.js.map → chunk-Y7NWBBHV.js.map} +0 -0
  191. /package/dist/{chunk-WPCCNSWO.js.map → chunk-YM3LR4LS.js.map} +0 -0
  192. /package/dist/{chunk-3IJEQWQX.js.map → chunk-YOVKPOMD.js.map} +0 -0
  193. /package/dist/{chunk-M75TBFKQ.js.map → chunk-Z2OXSMZK.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isValidCapsuleSince
3
- } from "./chunk-BUKK5SWA.js";
3
+ } from "./chunk-KQAFEZQX.js";
4
4
  import {
5
5
  CAPSULE_ID_PATTERN
6
6
  } from "./chunk-WEHSQBFR.js";
@@ -432,4 +432,4 @@ export {
432
432
  actionConfidenceRequestSchema,
433
433
  validateRequest
434
434
  };
435
- //# sourceMappingURL=chunk-QKE4LHNR.js.map
435
+ //# sourceMappingURL=chunk-4HYSMH7D.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getVerdictKind
3
- } from "./chunk-M75TBFKQ.js";
3
+ } from "./chunk-Z2OXSMZK.js";
4
4
  import {
5
5
  scoreImportance
6
6
  } from "./chunk-JXS5PDQ7.js";
@@ -1161,4 +1161,4 @@ export {
1161
1161
  syncWearableSource,
1162
1162
  defaultTimezone
1163
1163
  };
1164
- //# sourceMappingURL=chunk-DDRNDPX4.js.map
1164
+ //# sourceMappingURL=chunk-4SKKVWLQ.js.map
@@ -0,0 +1,34 @@
1
+ // src/lcm-fallback-read.ts
2
+ var UNDEFINED_SESSION_SENTINEL = " <lcm-sessionless>";
3
+ function resolveLcmReadSessionIds(target) {
4
+ const source = target.sessionIds && target.sessionIds.length > 0 ? target.sessionIds : [target.sessionId];
5
+ const seen = /* @__PURE__ */ new Set();
6
+ const out = [];
7
+ for (const sessionId of source) {
8
+ const key = sessionId === void 0 ? UNDEFINED_SESSION_SENTINEL : sessionId;
9
+ if (seen.has(key)) continue;
10
+ seen.add(key);
11
+ out.push(sessionId);
12
+ }
13
+ return out.length > 0 ? out : [target.sessionId];
14
+ }
15
+ async function gatherAcrossReadSessions(sessionIds, gather) {
16
+ if (sessionIds.length <= 1) {
17
+ for (const sessionId of sessionIds) {
18
+ await gather(sessionId);
19
+ }
20
+ return;
21
+ }
22
+ for (const sessionId of sessionIds) {
23
+ try {
24
+ await gather(sessionId);
25
+ } catch {
26
+ }
27
+ }
28
+ }
29
+
30
+ export {
31
+ resolveLcmReadSessionIds,
32
+ gatherAcrossReadSessions
33
+ };
34
+ //# sourceMappingURL=chunk-5FOCXX5E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lcm-fallback-read.ts"],"sourcesContent":["/**\n * Shared helper for reading LCM-backed recall sections across the ordered,\n * read-authorized fallback key set (#1505 codex P2 \"Merge LCM fallback reads\n * instead of short-circuiting\").\n *\n * Background: a branch-scoped session archives its LCM rows under whichever\n * coding-overlay namespace was effective at write time, so its evidence can be\n * split across the primary overlay key AND the project / root fallback keys.\n * Normal QMD/file recall already searches the primary namespace PLUS\n * `codingOverlay.readFallbacks` and MERGES the rows. The LCM read path must do\n * the same: query EVERY authorized read key and merge the candidate evidence\n * into each section's existing dedupe + rank + budget pass, instead of stopping\n * at the first key that happens to yield a (possibly weak) hit.\n *\n * Each section already owns a section-appropriate dedupe (a `seen` set or a\n * `rankAndDedupe…` step), so the fan-out only needs to resolve the ordered,\n * deduped read-key set and UNION the per-key candidates into that existing\n * pipeline — the budget is then applied exactly once to the union. Centralizing\n * the key-set resolution here (rather than re-implementing per builder) follows\n * CLAUDE.md rule 22 (scope resolution must be deduplicated).\n */\n\n/** A recall section's LCM read target: either a single key or an ordered set. */\nexport interface LcmReadSessionTarget {\n /**\n * The single LCM read `session_id` (pre-#1505 behavior). `undefined` means a\n * sessionless, archive-wide read with no `session_id` filter.\n */\n sessionId?: string;\n /**\n * The ordered, read-authorized LCM read key set (primary overlay key first,\n * then project / root fallbacks) the orchestrator derived from the same\n * readable namespace set normal recall searches. When present and non-empty,\n * it supersedes `sessionId`.\n */\n sessionIds?: readonly (string | undefined)[];\n}\n\n// `undefined` (a sessionless, archive-wide read) is a distinct, legitimate read\n// target, so it needs a non-string sentinel in the dedupe set. A leading space\n// keeps it disjoint from every real session key / namespaced LCM key (which are\n// `[A-Za-z0-9._-]` plus the U+001F namespace sentinel, never leading-space).\nconst UNDEFINED_SESSION_SENTINEL = \" <lcm-sessionless>\";\n\n/**\n * Resolve the ordered, deduped set of LCM read `session_id`s a recall section\n * must query.\n *\n * When `sessionIds` is provided (the #1505 fallback unification), it is used\n * verbatim, deduped while preserving first-seen order so the caller queries\n * keys in priority order (primary overlay → fallbacks) without re-querying an\n * identical key (e.g. when two namespaces both collapse to the default store).\n * Otherwise the section reads under the single `sessionId`, so the result is\n * `[sessionId]` — byte-for-byte the pre-#1505 single-key behavior, including a\n * single `undefined` for a sessionless archive-wide read.\n */\nexport function resolveLcmReadSessionIds(\n target: LcmReadSessionTarget,\n): Array<string | undefined> {\n const source =\n target.sessionIds && target.sessionIds.length > 0\n ? target.sessionIds\n : [target.sessionId];\n const seen = new Set<string>();\n const out: Array<string | undefined> = [];\n for (const sessionId of source) {\n const key = sessionId === undefined ? UNDEFINED_SESSION_SENTINEL : sessionId;\n if (seen.has(key)) continue;\n seen.add(key);\n out.push(sessionId);\n }\n // Defensive: an all-empty `sessionIds` still collapses to the single-key path.\n return out.length > 0 ? out : [target.sessionId];\n}\n\n/**\n * Run a per-key LCM `gather` across the resolved read-key set with FAULT\n * ISOLATION across keys (#1505 codex P2 review follow-up).\n *\n * A recall section that reads every key in a bare `for…await` loop loses the\n * WHOLE section if any one key throws (e.g. a `SqliteError` from a corrupt or\n * locked fallback index) — even when the primary overlay key already gathered\n * evidence. The pre-#1505 first-non-empty read never had this problem: it\n * returned the primary key's non-empty result without ever touching a failing\n * fallback. This helper restores that resilience for the merged path: when more\n * than one key is read, a per-key failure is contained so the other keys'\n * evidence survives (best-effort recall — a total failure degrades to an empty\n * section, which the orchestrator already treats as \"no evidence\").\n *\n * SINGLE-KEY is byte-for-byte the pre-#1505 behavior: the gather runs directly,\n * so a failure PROPAGATES exactly as before (the caller / orchestrator catch\n * still logs it). Fault isolation only engages once there is a fallback key that\n * could fail independently of the primary.\n */\nexport async function gatherAcrossReadSessions(\n sessionIds: ReadonlyArray<string | undefined>,\n gather: (sessionId: string | undefined) => Promise<void>,\n): Promise<void> {\n if (sessionIds.length <= 1) {\n for (const sessionId of sessionIds) {\n await gather(sessionId);\n }\n return;\n }\n for (const sessionId of sessionIds) {\n try {\n await gather(sessionId);\n } catch {\n // One read key failed; keep the evidence already gathered from the other\n // keys instead of discarding the whole section.\n }\n }\n}\n"],"mappings":";AA0CA,IAAM,6BAA6B;AAc5B,SAAS,yBACd,QAC2B;AAC3B,QAAM,SACJ,OAAO,cAAc,OAAO,WAAW,SAAS,IAC5C,OAAO,aACP,CAAC,OAAO,SAAS;AACvB,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,MAAiC,CAAC;AACxC,aAAW,aAAa,QAAQ;AAC9B,UAAM,MAAM,cAAc,SAAY,6BAA6B;AACnE,QAAI,KAAK,IAAI,GAAG,EAAG;AACnB,SAAK,IAAI,GAAG;AACZ,QAAI,KAAK,SAAS;AAAA,EACpB;AAEA,SAAO,IAAI,SAAS,IAAI,MAAM,CAAC,OAAO,SAAS;AACjD;AAqBA,eAAsB,yBACpB,YACA,QACe;AACf,MAAI,WAAW,UAAU,GAAG;AAC1B,eAAW,aAAa,YAAY;AAClC,YAAM,OAAO,SAAS;AAAA,IACxB;AACA;AAAA,EACF;AACA,aAAW,aAAa,YAAY;AAClC,QAAI;AACF,YAAM,OAAO,SAAS;AAAA,IACxB,QAAQ;AAAA,IAGR;AAAA,EACF;AACF;","names":[]}
@@ -8,7 +8,10 @@ import {
8
8
  } from "./chunk-GDB4J2H3.js";
9
9
  import {
10
10
  importCapsule
11
- } from "./chunk-NT5TINK5.js";
11
+ } from "./chunk-DHGSZ3UD.js";
12
+ import {
13
+ decideDisclosureEscalation
14
+ } from "./chunk-H7XKCNR6.js";
12
15
  import {
13
16
  toRecallExplainJson
14
17
  } from "./chunk-IENGGY2C.js";
@@ -17,9 +20,6 @@ import {
17
20
  normalizeTags,
18
21
  parseTagMatch
19
22
  } from "./chunk-BT7NVCML.js";
20
- import {
21
- decideDisclosureEscalation
22
- } from "./chunk-H7XKCNR6.js";
23
23
  import {
24
24
  buildProposedActions,
25
25
  buildQualityScore,
@@ -27,7 +27,7 @@ import {
27
27
  listMemoryGovernanceRuns,
28
28
  readMemoryGovernanceRunArtifact,
29
29
  runMemoryGovernance
30
- } from "./chunk-UMTG2BN2.js";
30
+ } from "./chunk-V4UDXYGG.js";
31
31
  import {
32
32
  clusterByKey,
33
33
  combineNamespaces,
@@ -53,7 +53,7 @@ import {
53
53
  } from "./chunk-BEMWL2FZ.js";
54
54
  import {
55
55
  namespaceCollectionName
56
- } from "./chunk-NMIOW7XG.js";
56
+ } from "./chunk-JVRPJ7D4.js";
57
57
  import {
58
58
  namespaceIdentityFromToken
59
59
  } from "./chunk-ZFXCQPNO.js";
@@ -92,10 +92,10 @@ import {
92
92
  buildBriefing,
93
93
  parseBriefingFocus,
94
94
  parseBriefingWindow
95
- } from "./chunk-AMACWKM4.js";
95
+ } from "./chunk-IJHLC5CH.js";
96
96
  import {
97
97
  parseEntityFile
98
- } from "./chunk-A4BTPHIN.js";
98
+ } from "./chunk-Y7NWBBHV.js";
99
99
  import {
100
100
  DEFAULT_RECALL_DISCLOSURE,
101
101
  isRecallDisclosure
@@ -111,6 +111,9 @@ import {
111
111
  import {
112
112
  getMemoryProjectionPath
113
113
  } from "./chunk-MB5RSUW6.js";
114
+ import {
115
+ displayErrorDetail
116
+ } from "./chunk-6KYMPV2O.js";
114
117
  import {
115
118
  defaultCapsulesDir
116
119
  } from "./chunk-ZY2MNJR6.js";
@@ -137,7 +140,7 @@ import {
137
140
  } from "./chunk-VFUEZZBS.js";
138
141
  import {
139
142
  exportCapsule
140
- } from "./chunk-BUKK5SWA.js";
143
+ } from "./chunk-KQAFEZQX.js";
141
144
  import {
142
145
  OFFLINE_SYNC_SNAPSHOT_FORMAT,
143
146
  applyOfflineSyncChangeset,
@@ -1471,6 +1474,8 @@ var EngramAccessService = class {
1471
1474
  async health(namespace) {
1472
1475
  const resolvedNamespace = this.resolveNamespace(namespace);
1473
1476
  const storage = await this.orchestrator.getStorage(resolvedNamespace);
1477
+ const searchBackend = this.orchestrator.config.searchBackend ?? "qmd";
1478
+ const qmdEnabled = this.orchestrator.config.qmdEnabled === true;
1474
1479
  let projectionAvailable = false;
1475
1480
  try {
1476
1481
  await stat2(getMemoryProjectionPath(storage.dir));
@@ -1483,12 +1488,179 @@ var EngramAccessService = class {
1483
1488
  memoryDir: storage.dir,
1484
1489
  namespacesEnabled: this.orchestrator.config.namespacesEnabled === true,
1485
1490
  defaultNamespace: this.orchestrator.config.defaultNamespace,
1486
- searchBackend: this.orchestrator.config.searchBackend ?? "qmd",
1487
- qmdEnabled: this.orchestrator.config.qmdEnabled === true,
1491
+ searchBackend,
1492
+ qmdEnabled,
1493
+ qmd: await this.qmdHealth(
1494
+ searchBackend,
1495
+ qmdEnabled,
1496
+ resolvedNamespace,
1497
+ this.qmdCollectionForHealth(resolvedNamespace, storage.dir)
1498
+ ),
1488
1499
  nativeKnowledgeEnabled: this.orchestrator.config.nativeKnowledge?.enabled === true,
1489
1500
  projectionAvailable
1490
1501
  };
1491
1502
  }
1503
+ qmdCollectionForHealth(namespace, storageDir) {
1504
+ if (this.orchestrator.config.namespacesEnabled !== true) {
1505
+ return this.orchestrator.config.qmdCollection;
1506
+ }
1507
+ const useLegacyDefaultCollection = namespace === this.orchestrator.config.defaultNamespace && storageDir === this.orchestrator.config.memoryDir;
1508
+ return namespaceCollectionName(this.orchestrator.config.qmdCollection, namespace, {
1509
+ defaultNamespace: this.orchestrator.config.defaultNamespace,
1510
+ useLegacyDefaultCollection
1511
+ });
1512
+ }
1513
+ async qmdHealth(searchBackend, qmdEnabled, namespace, collection) {
1514
+ if (searchBackend !== "qmd" || !qmdEnabled) {
1515
+ return {
1516
+ enabled: qmdEnabled,
1517
+ active: false,
1518
+ degraded: false,
1519
+ mode: searchBackend !== "qmd" ? "not-selected" : "disabled",
1520
+ collection,
1521
+ collectionState: "skipped",
1522
+ installedVersion: null,
1523
+ supportedVersion: null,
1524
+ supported: null,
1525
+ upgradeAvailable: null,
1526
+ doctorAvailable: null,
1527
+ debugStatus: searchBackend !== "qmd" ? `backend=${searchBackend}` : "backend=disabled"
1528
+ };
1529
+ }
1530
+ if (this.orchestrator.config.namespacesEnabled === true) {
1531
+ const namespaceHealth = await this.namespaceQmdHealth(searchBackend, qmdEnabled, namespace, collection);
1532
+ if (namespaceHealth) return namespaceHealth;
1533
+ }
1534
+ const qmd = this.orchestrator.qmd;
1535
+ if (!qmd) {
1536
+ return {
1537
+ enabled: true,
1538
+ active: false,
1539
+ degraded: true,
1540
+ mode: "fallback",
1541
+ collection,
1542
+ collectionState: "unknown",
1543
+ installedVersion: null,
1544
+ supportedVersion: null,
1545
+ supported: null,
1546
+ upgradeAvailable: null,
1547
+ doctorAvailable: null,
1548
+ debugStatus: "backend=unavailable"
1549
+ };
1550
+ }
1551
+ const diagnosticAvailable = await this.qmdProbeAvailable(searchBackend, qmdEnabled);
1552
+ const operationalAvailable = diagnosticAvailable || qmd.isAvailable();
1553
+ const collectionState = diagnosticAvailable ? await this.qmdCollectionState(searchBackend, qmdEnabled, collection) : "unknown";
1554
+ const active = operationalAvailable && collectionState !== "missing";
1555
+ const degraded = searchBackend === "qmd" && qmdEnabled && (!active || !diagnosticAvailable || collectionState === "unknown");
1556
+ const debugStatus = qmd.debugStatus();
1557
+ const versionStatus = "getVersionStatus" in qmd && typeof qmd.getVersionStatus === "function" ? qmd.getVersionStatus() : null;
1558
+ const daemonMode = "isDaemonMode" in qmd && typeof qmd.isDaemonMode === "function" ? qmd.isDaemonMode() === true : false;
1559
+ const mode = searchBackend !== "qmd" ? "not-selected" : !qmdEnabled ? "disabled" : !active ? "fallback" : daemonMode ? "daemon" : "cli";
1560
+ return {
1561
+ enabled: qmdEnabled,
1562
+ active,
1563
+ degraded,
1564
+ mode,
1565
+ collection,
1566
+ collectionState,
1567
+ installedVersion: versionStatus?.installedVersion ?? null,
1568
+ supportedVersion: versionStatus?.supportedVersion ?? null,
1569
+ supported: versionStatus?.supported ?? null,
1570
+ upgradeAvailable: versionStatus?.upgradeAvailable ?? null,
1571
+ doctorAvailable: versionStatus?.capabilities?.doctor ?? null,
1572
+ debugStatus
1573
+ };
1574
+ }
1575
+ async namespaceQmdHealth(searchBackend, qmdEnabled, namespace, fallbackCollection) {
1576
+ if (searchBackend !== "qmd" || !qmdEnabled) return null;
1577
+ const searchHealthForNamespace = this.orchestrator.searchHealthForNamespace;
1578
+ if (typeof searchHealthForNamespace !== "function") return null;
1579
+ const controller = new AbortController();
1580
+ const timer = setTimeout(() => controller.abort(), 2e3);
1581
+ timer.unref?.();
1582
+ try {
1583
+ const health = await searchHealthForNamespace.call(this.orchestrator, namespace, {
1584
+ signal: controller.signal
1585
+ });
1586
+ const active = health.available && health.collectionState !== "missing";
1587
+ const degraded = !active || health.collectionState === "unknown";
1588
+ const mode = !active ? "fallback" : health.daemonMode === true ? "daemon" : "cli";
1589
+ return {
1590
+ enabled: true,
1591
+ active,
1592
+ degraded,
1593
+ mode,
1594
+ collection: health.collection || fallbackCollection,
1595
+ collectionState: health.collectionState,
1596
+ installedVersion: health.installedVersion,
1597
+ supportedVersion: health.supportedVersion,
1598
+ supported: health.supported,
1599
+ upgradeAvailable: health.upgradeAvailable,
1600
+ doctorAvailable: health.doctorAvailable,
1601
+ debugStatus: health.debugStatus
1602
+ };
1603
+ } catch (error) {
1604
+ const detail = displayErrorDetail(error) || "unknown";
1605
+ return {
1606
+ enabled: true,
1607
+ active: false,
1608
+ degraded: true,
1609
+ mode: "fallback",
1610
+ collection: fallbackCollection,
1611
+ collectionState: "unknown",
1612
+ installedVersion: null,
1613
+ supportedVersion: null,
1614
+ supported: null,
1615
+ upgradeAvailable: null,
1616
+ doctorAvailable: null,
1617
+ debugStatus: `backend=namespace-unavailable error=${detail}`
1618
+ };
1619
+ } finally {
1620
+ clearTimeout(timer);
1621
+ }
1622
+ }
1623
+ async qmdCollectionState(searchBackend, qmdEnabled, collection) {
1624
+ if (searchBackend !== "qmd" || !qmdEnabled) return "skipped";
1625
+ const qmd = this.orchestrator.qmd;
1626
+ if (!qmd.isAvailable()) return "unknown";
1627
+ if (!qmd.checkCollection) return "skipped";
1628
+ const controller = new AbortController();
1629
+ const timer = setTimeout(() => controller.abort(), 2e3);
1630
+ timer.unref?.();
1631
+ try {
1632
+ return await qmd.checkCollection(collection, {
1633
+ signal: controller.signal
1634
+ });
1635
+ } catch {
1636
+ return "unknown";
1637
+ } finally {
1638
+ clearTimeout(timer);
1639
+ }
1640
+ }
1641
+ async qmdProbeAvailable(searchBackend, qmdEnabled) {
1642
+ if (searchBackend !== "qmd" || !qmdEnabled) return false;
1643
+ const qmd = this.orchestrator.qmd;
1644
+ if (!qmd) return false;
1645
+ const controller = new AbortController();
1646
+ const timer = setTimeout(() => controller.abort(), 2e3);
1647
+ timer.unref?.();
1648
+ try {
1649
+ return await new Promise((resolve2) => {
1650
+ const onAbort = () => {
1651
+ controller.signal.removeEventListener("abort", onAbort);
1652
+ resolve2(false);
1653
+ };
1654
+ controller.signal.addEventListener("abort", onAbort, { once: true });
1655
+ const probe = typeof qmd.checkAvailability === "function" ? qmd.checkAvailability({ signal: controller.signal }) : qmd.probe();
1656
+ probe.then(resolve2, () => resolve2(false)).finally(() => {
1657
+ controller.signal.removeEventListener("abort", onAbort);
1658
+ });
1659
+ });
1660
+ } finally {
1661
+ clearTimeout(timer);
1662
+ }
1663
+ }
1492
1664
  async actionConfidence(request = {}) {
1493
1665
  return evaluateActionConfidence(request);
1494
1666
  }
@@ -5177,4 +5349,4 @@ export {
5177
5349
  shapeMemorySummary,
5178
5350
  EngramAccessService
5179
5351
  };
5180
- //# sourceMappingURL=chunk-YAFSTKTH.js.map
5352
+ //# sourceMappingURL=chunk-5V3TAB7D.js.map