@remnic/core 9.29.1 → 9.30.1

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 (358) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +19 -18
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +20 -19
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +19 -18
  7. package/dist/access-citation-namespace.js +2 -2
  8. package/dist/access-cli.js +45 -44
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-health-types.d.ts +1 -1
  11. package/dist/access-http-lcm-compaction.d.ts +11 -11
  12. package/dist/access-http.d.ts +11 -11
  13. package/dist/access-http.js +25 -24
  14. package/dist/access-identity-continuity-surface.d.ts +8 -8
  15. package/dist/access-identity-continuity-surface.js +19 -18
  16. package/dist/access-lcm-surface.d.ts +10 -10
  17. package/dist/access-lcm-surface.js +19 -18
  18. package/dist/access-mcp.d.ts +11 -11
  19. package/dist/access-mcp.js +23 -22
  20. package/dist/access-memory-search-fanout.d.ts +2 -2
  21. package/dist/{access-namespace-preflight-DCXBkDp0.d.ts → access-namespace-preflight-VfXssvoI.d.ts} +1 -1
  22. package/dist/access-namespace-preflight.d.ts +3 -3
  23. package/dist/access-namespace-preflight.js +19 -18
  24. package/dist/access-observe-write-surface.d.ts +10 -10
  25. package/dist/access-observe-write-surface.js +19 -18
  26. package/dist/access-operations-batch.js +20 -19
  27. package/dist/access-operations.d.ts +11 -11
  28. package/dist/access-operations.js +22 -21
  29. package/dist/access-recall-concurrency.d.ts +11 -11
  30. package/dist/access-recall-concurrency.js +19 -18
  31. package/dist/access-recall-response.d.ts +10 -10
  32. package/dist/access-recall-response.js +19 -18
  33. package/dist/access-recall-surface.d.ts +10 -10
  34. package/dist/access-recall-surface.js +19 -18
  35. package/dist/access-schema.js +3 -3
  36. package/dist/{access-service-DvPW_M5j.d.ts → access-service-B5RwVsTV.d.ts} +7 -7
  37. package/dist/access-service.d.ts +11 -11
  38. package/dist/access-service.js +19 -18
  39. package/dist/access-surface-catalog.d.ts +11 -11
  40. package/dist/access-wearables-meetings-surface.d.ts +4 -3
  41. package/dist/action-confidence.d.ts +1 -1
  42. package/dist/active-memory-bridge.d.ts +1 -1
  43. package/dist/active-recall.d.ts +1 -1
  44. package/dist/active-recall.js +3 -3
  45. package/dist/behavior-learner.d.ts +1 -1
  46. package/dist/behavior-signals.d.ts +1 -1
  47. package/dist/bootstrap.d.ts +8 -8
  48. package/dist/briefing.d.ts +3 -2
  49. package/dist/briefing.js +10 -9
  50. package/dist/buffer-surprise-report.d.ts +1 -1
  51. package/dist/buffer.d.ts +3 -2
  52. package/dist/bulk-import/index.d.ts +3 -3
  53. package/dist/calibration.d.ts +1 -1
  54. package/dist/capabilities.d.ts +1 -1
  55. package/dist/{catalog-BIVgftWu.d.ts → catalog-V7inUQdp.d.ts} +1 -1
  56. package/dist/causal-behavior.d.ts +1 -1
  57. package/dist/causal-consolidation.d.ts +1 -1
  58. package/dist/causal-consolidation.js +11 -10
  59. package/dist/causal-consolidation.js.map +1 -1
  60. package/dist/causal-trajectory-graph.d.ts +1 -1
  61. package/dist/{chunk-FZRQZW4H.js → chunk-2EUVEDF5.js} +2 -2
  62. package/dist/{chunk-PBUZNGMX.js → chunk-4WKA6I65.js} +20 -20
  63. package/dist/{chunk-PBUZNGMX.js.map → chunk-4WKA6I65.js.map} +1 -1
  64. package/dist/{chunk-AIK5W3IW.js → chunk-5TFP4CUL.js} +68 -2
  65. package/dist/chunk-5TFP4CUL.js.map +1 -0
  66. package/dist/{chunk-3JNDOAQ2.js → chunk-5W4ZLBEZ.js} +9 -9
  67. package/dist/{chunk-5ZCUDWD4.js → chunk-62U4J2GN.js} +2 -2
  68. package/dist/{chunk-IGPEJVBY.js → chunk-66772WBP.js} +2 -2
  69. package/dist/{chunk-EP5BVCRI.js → chunk-6BNE62PM.js} +2 -2
  70. package/dist/{chunk-AAP5T6QG.js → chunk-6DNMUYEE.js} +2 -2
  71. package/dist/{chunk-35DL7IOI.js → chunk-6FUPCJUL.js} +7 -7
  72. package/dist/{chunk-JP3YPDAW.js → chunk-6U7F52DE.js} +19 -19
  73. package/dist/{chunk-E4OCKU67.js → chunk-7XC2HX75.js} +2 -2
  74. package/dist/{chunk-OVRQLAYR.js → chunk-AZ5BTEKX.js} +2 -2
  75. package/dist/{chunk-2AXMQWCN.js → chunk-CZRYLSSW.js} +3 -3
  76. package/dist/chunk-FBUE6PD3.js +1769 -0
  77. package/dist/chunk-FBUE6PD3.js.map +1 -0
  78. package/dist/{chunk-PTSNLEXK.js → chunk-FDAMS4PK.js} +2 -2
  79. package/dist/{chunk-WL5EBRDH.js → chunk-FFAZ2XFU.js} +9 -8
  80. package/dist/chunk-FFAZ2XFU.js.map +1 -0
  81. package/dist/{chunk-2GXM5N5A.js → chunk-GIBMDSJ2.js} +2 -2
  82. package/dist/{chunk-E5OBR6CJ.js → chunk-H5CPS5JP.js} +3 -3
  83. package/dist/{chunk-2D7FEUCK.js → chunk-I5NLEENJ.js} +2 -2
  84. package/dist/{chunk-DRBXHRXE.js → chunk-IB26HVAJ.js} +2 -2
  85. package/dist/{chunk-QDKK63Y7.js → chunk-IC6CBHCA.js} +3 -3
  86. package/dist/{chunk-IAEAFLF2.js → chunk-JCBWCYEJ.js} +2 -2
  87. package/dist/{chunk-3PDOVUHC.js → chunk-KXB4VXHY.js} +2 -2
  88. package/dist/{chunk-WU7TTVOD.js → chunk-LBOD4U5B.js} +7 -7
  89. package/dist/{chunk-UBKEQOTD.js → chunk-LGHKJABJ.js} +3 -3
  90. package/dist/{chunk-VSURVXKY.js → chunk-M3C2V3PV.js} +10 -10
  91. package/dist/{chunk-OFHFH655.js → chunk-MJCGLM25.js} +8 -8
  92. package/dist/{chunk-OYJKSZIQ.js → chunk-NHWB6HG2.js} +2 -2
  93. package/dist/{chunk-TC3VNKGX.js → chunk-NM2WP3B7.js} +4 -4
  94. package/dist/{chunk-GAWOEQEQ.js → chunk-P5PXWTW7.js} +2 -2
  95. package/dist/chunk-PH3ZWL3W.js +786 -0
  96. package/dist/chunk-PH3ZWL3W.js.map +1 -0
  97. package/dist/{chunk-2QMKMVHH.js → chunk-QNWXCJ76.js} +2 -2
  98. package/dist/{chunk-JMQUBRV6.js → chunk-RGIWINDN.js} +340 -771
  99. package/dist/chunk-RGIWINDN.js.map +1 -0
  100. package/dist/{chunk-WRFBW2TT.js → chunk-SPJXKAVF.js} +3 -3
  101. package/dist/{chunk-HKJCMOT6.js → chunk-TH2LSRMG.js} +2 -2
  102. package/dist/{chunk-CW4AGY3G.js → chunk-VI2JQPNQ.js} +2 -2
  103. package/dist/{chunk-OP6F6L3S.js → chunk-W5EG6LE3.js} +2 -2
  104. package/dist/{chunk-DEBHXHJR.js → chunk-WIPEXG6R.js} +2 -2
  105. package/dist/{chunk-SH6YO3LT.js → chunk-WVO4G37W.js} +2 -2
  106. package/dist/{chunk-FUYEVEX7.js → chunk-YNQBRLC5.js} +24 -22
  107. package/dist/chunk-YNQBRLC5.js.map +1 -0
  108. package/dist/{chunk-7L45JFPW.js → chunk-YTQNQ4KB.js} +14 -14
  109. package/dist/{chunk-PKRIQL3V.js → chunk-YTSNAUXN.js} +2 -2
  110. package/dist/{chunk-5QDRGWT2.js → chunk-ZPSVBSOF.js} +4 -4
  111. package/dist/{cli-CxoSOiG0.d.ts → cli-C4GbETPC.d.ts} +5 -5
  112. package/dist/cli.d.ts +13 -13
  113. package/dist/cli.js +36 -35
  114. package/dist/compounding/engine.d.ts +3 -2
  115. package/dist/compounding/engine.js +10 -9
  116. package/dist/compounding/preference-consolidator.d.ts +1 -1
  117. package/dist/compression-optimizer.d.ts +1 -1
  118. package/dist/config.d.ts +1 -1
  119. package/dist/config.js +3 -3
  120. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  121. package/dist/connectors/codex-materialize-runner.js +10 -9
  122. package/dist/connectors/codex-materialize.d.ts +1 -1
  123. package/dist/connectors/index.d.ts +1 -1
  124. package/dist/connectors/index.js +10 -9
  125. package/dist/consolidation-provenance-check.d.ts +3 -2
  126. package/dist/consolidation-undo.d.ts +3 -2
  127. package/dist/contradiction/index.d.ts +3 -2
  128. package/dist/conversation-index/backend.d.ts +1 -1
  129. package/dist/conversation-index/chunker.d.ts +1 -1
  130. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  131. package/dist/conversation-index/indexer.d.ts +1 -1
  132. package/dist/conversation-index/search.d.ts +1 -1
  133. package/dist/corpus-watermark.d.ts +1 -1
  134. package/dist/corpus-watermark.js +12 -11
  135. package/dist/day-summary.d.ts +1 -1
  136. package/dist/delinearize.d.ts +1 -1
  137. package/dist/direct-answer-wiring.d.ts +1 -1
  138. package/dist/direct-answer.d.ts +1 -1
  139. package/dist/embedding-fallback.d.ts +1 -1
  140. package/dist/enrichment/index.d.ts +1 -1
  141. package/dist/entity-retrieval.d.ts +3 -2
  142. package/dist/entity-retrieval.js +10 -9
  143. package/dist/entity-schema.d.ts +1 -1
  144. package/dist/explicit-capture.d.ts +52 -10
  145. package/dist/explicit-capture.js +13 -1
  146. package/dist/extraction-error-classification.d.ts +1 -1
  147. package/dist/extraction-faithfulness.d.ts +1 -1
  148. package/dist/extraction-judge-telemetry.d.ts +1 -1
  149. package/dist/extraction-judge-training.d.ts +1 -1
  150. package/dist/extraction-judge.d.ts +1 -1
  151. package/dist/extraction-liveness.d.ts +1 -1
  152. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  153. package/dist/extraction-source-grounding.d.ts +1 -1
  154. package/dist/extraction.d.ts +1 -1
  155. package/dist/fallback-llm.d.ts +1 -1
  156. package/dist/{forget-HRPLVB3W.js → forget-4UY2EOKH.js} +3 -3
  157. package/dist/graph-dashboard-diff.d.ts +1 -1
  158. package/dist/graph-dashboard-key.d.ts +1 -1
  159. package/dist/graph-dashboard-parser.d.ts +1 -1
  160. package/dist/graph-edge-reinforcement.d.ts +1 -1
  161. package/dist/graph-snapshot.d.ts +1 -1
  162. package/dist/graph.d.ts +1 -1
  163. package/dist/importance.d.ts +1 -1
  164. package/dist/importers/index.d.ts +1 -1
  165. package/dist/in-flight-reads.d.ts +1 -1
  166. package/dist/index.d.ts +19 -19
  167. package/dist/index.js +47 -45
  168. package/dist/intent.d.ts +1 -1
  169. package/dist/lcm/engine.d.ts +1 -1
  170. package/dist/lcm/index.d.ts +1 -1
  171. package/dist/lcm/tools.d.ts +1 -1
  172. package/dist/lifecycle.d.ts +1 -1
  173. package/dist/live-connectors-runner.d.ts +1 -1
  174. package/dist/local-llm.d.ts +1 -1
  175. package/dist/local-model-endpoint.d.ts +1 -1
  176. package/dist/maintenance/memory-governance.d.ts +1 -1
  177. package/dist/maintenance/memory-governance.js +10 -9
  178. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  179. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
  180. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  181. package/dist/maintenance/rebuild-memory-projection.js +11 -10
  182. package/dist/{maintenance-Cb-PjxQd.d.ts → maintenance-CL30NWtc.d.ts} +3 -3
  183. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  184. package/dist/memory-action-policy.d.ts +1 -1
  185. package/dist/memory-cache.d.ts +1 -1
  186. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  187. package/dist/memory-projection-store.d.ts +1 -1
  188. package/dist/memory-provenance.d.ts +1 -1
  189. package/dist/memory-worth-outcomes.d.ts +3 -2
  190. package/dist/models-json.d.ts +1 -1
  191. package/dist/namespaces/migrate.d.ts +4 -3
  192. package/dist/namespaces/migrate.js +11 -10
  193. package/dist/namespaces/principal.d.ts +1 -1
  194. package/dist/namespaces/search.d.ts +1 -1
  195. package/dist/namespaces/storage.d.ts +4 -3
  196. package/dist/namespaces/storage.js +10 -9
  197. package/dist/native-knowledge.d.ts +1 -1
  198. package/dist/offline-sync-impression-drain.d.ts +1 -1
  199. package/dist/offline-sync-impression-drain.js +5 -5
  200. package/dist/offline-sync.js +2 -2
  201. package/dist/operator-doctor-corpus.d.ts +1 -1
  202. package/dist/operator-doctor-corpus.js +13 -12
  203. package/dist/operator-doctor-replica.d.ts +1 -1
  204. package/dist/operator-toolkit.d.ts +4 -3
  205. package/dist/operator-toolkit.js +18 -17
  206. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  207. package/dist/orchestration/maintenance.d.ts +5 -4
  208. package/dist/orchestration/maintenance.js +15 -14
  209. package/dist/{orchestrator-5GKqb_HL.d.ts → orchestrator-CKTCRwWV.d.ts} +7 -7
  210. package/dist/orchestrator.d.ts +8 -8
  211. package/dist/orchestrator.js +45 -44
  212. package/dist/patterns-cli.d.ts +1 -1
  213. package/dist/{pipeline-3Qi1TpRo.d.ts → pipeline-B7wj4rRZ.d.ts} +1 -1
  214. package/dist/policy-runtime.d.ts +1 -1
  215. package/dist/proactive-contention.d.ts +1 -1
  216. package/dist/provenance.d.ts +1 -1
  217. package/dist/{purge-YSGX5BOG.js → purge-533FZLS4.js} +16 -9
  218. package/dist/purge-533FZLS4.js.map +1 -0
  219. package/dist/qmd-preflight.d.ts +2 -2
  220. package/dist/{qmd-D9JqzzRX.d.ts → qmd-q9tg4dHp.d.ts} +1 -1
  221. package/dist/qmd-recall-cache.d.ts +1 -1
  222. package/dist/qmd.d.ts +2 -2
  223. package/dist/recall-concurrency-config.d.ts +1 -1
  224. package/dist/recall-disclosure-escalation.d.ts +1 -1
  225. package/dist/recall-explain-renderer.d.ts +1 -1
  226. package/dist/recall-memory-map.d.ts +1 -1
  227. package/dist/recall-planner-llm.d.ts +1 -1
  228. package/dist/recall-state.d.ts +1 -1
  229. package/dist/recall-state.js +2 -2
  230. package/dist/recall-tag-filter.d.ts +1 -1
  231. package/dist/recall-timings.d.ts +1 -1
  232. package/dist/recall-xray-cli.d.ts +1 -1
  233. package/dist/recall-xray-renderer.d.ts +1 -1
  234. package/dist/recall-xray.d.ts +1 -1
  235. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  236. package/dist/replay/normalizers/claude.d.ts +1 -1
  237. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  238. package/dist/replay/normalizers/shared.d.ts +1 -1
  239. package/dist/replay/runner.d.ts +1 -1
  240. package/dist/replay/types.d.ts +1 -1
  241. package/dist/replica-divergence.d.ts +1 -1
  242. package/dist/replica-peers-config.d.ts +1 -1
  243. package/dist/resolve-auth-token.d.ts +1 -1
  244. package/dist/resume-bundles.js +4 -4
  245. package/dist/retrieval-agents.d.ts +2 -2
  246. package/dist/retrieval-tiers.d.ts +1 -1
  247. package/dist/routing/engine.d.ts +1 -1
  248. package/dist/routing/store.d.ts +1 -1
  249. package/dist/salvage-envelope.d.ts +1 -1
  250. package/dist/{scope-profiles-C4g6_UdP.d.ts → scope-profiles-CWDyglPM.d.ts} +1 -1
  251. package/dist/search/embed-helper.d.ts +1 -1
  252. package/dist/search/factory.d.ts +1 -1
  253. package/dist/search/index.d.ts +1 -1
  254. package/dist/search/lancedb-backend.d.ts +1 -1
  255. package/dist/search/meilisearch-backend.d.ts +1 -1
  256. package/dist/search/noop-backend.d.ts +1 -1
  257. package/dist/search/orama-backend.d.ts +1 -1
  258. package/dist/search/port.d.ts +1 -1
  259. package/dist/search/remote-backend.d.ts +1 -1
  260. package/dist/secure-store/index.js +2 -2
  261. package/dist/{semantic-consolidation-BrxqnzTW.d.ts → semantic-consolidation-BUE3deLn.d.ts} +1 -1
  262. package/dist/semantic-consolidation.d.ts +2 -2
  263. package/dist/semantic-consolidation.js +11 -10
  264. package/dist/semantic-rule-promotion.js +10 -9
  265. package/dist/semantic-rule-verifier.d.ts +1 -1
  266. package/dist/semantic-rule-verifier.js +10 -9
  267. package/dist/{service-Bi1JgxdP.d.ts → service-CXgM0bQG.d.ts} +2 -2
  268. package/dist/session-observer-bands.d.ts +1 -1
  269. package/dist/session-observer-state.d.ts +1 -1
  270. package/dist/shared-context/manager.d.ts +1 -1
  271. package/dist/signal.d.ts +1 -1
  272. package/dist/{storage-CcH6yPk2.d.ts → storage-DysJq-XH.d.ts} +163 -27
  273. package/dist/storage.d.ts +3 -2
  274. package/dist/storage.js +12 -10
  275. package/dist/summarizer.d.ts +1 -1
  276. package/dist/summarizer.js +3 -3
  277. package/dist/summary-snapshot.d.ts +1 -1
  278. package/dist/summary-snapshot.js +2 -2
  279. package/dist/temporal-supersession.d.ts +3 -2
  280. package/dist/temporal-timeline-recall.d.ts +1 -1
  281. package/dist/temporal-validity.d.ts +1 -1
  282. package/dist/threading.d.ts +1 -1
  283. package/dist/tier-migration.d.ts +3 -2
  284. package/dist/tier-routing.d.ts +1 -1
  285. package/dist/topics.d.ts +1 -1
  286. package/dist/transcript.d.ts +1 -1
  287. package/dist/trust-score-stage.d.ts +1 -1
  288. package/dist/trust-score.d.ts +1 -1
  289. package/dist/{types-Dg0w9ADr.d.ts → types-aPPzhnjT.d.ts} +1 -1
  290. package/dist/types.d.ts +1 -1
  291. package/dist/utility-runtime.d.ts +1 -1
  292. package/dist/utils/serialize-mutations.d.ts +11 -7
  293. package/dist/utils/serialize-mutations.js +1 -1
  294. package/dist/verified-recall.js +10 -9
  295. package/dist/write-envelope.d.ts +1 -1
  296. package/package.json +2 -2
  297. package/src/access-observe-write-surface.ts +1 -1
  298. package/src/access-service-coding-write.test.ts +40 -0
  299. package/src/explicit-capture.test.ts +1110 -1
  300. package/src/explicit-capture.ts +534 -135
  301. package/src/maintenance/purge.test.ts +157 -1
  302. package/src/maintenance/purge.ts +15 -9
  303. package/src/orchestration/recall-internal-deps.ts +385 -0
  304. package/src/orchestration/recall-internal.ts +16 -375
  305. package/src/secure-store/secure-fs.ts +78 -1
  306. package/src/storage/content-hash-index.ts +43 -17
  307. package/src/storage/tombstone-blocked-capture-index.ts +562 -0
  308. package/src/storage/tombstone-blocked-capture-mutation.ts +284 -0
  309. package/src/storage/tombstone-blocked-capture-sync.ts +872 -0
  310. package/src/storage-fact-hash-index-defer.test.ts +2900 -57
  311. package/src/storage.ts +266 -265
  312. package/src/testing/subjects/tombstone-blocked-capture.test.ts +181 -0
  313. package/src/utils/serialize-mutations.test.ts +4 -1
  314. package/src/utils/serialize-mutations.ts +26 -27
  315. package/dist/chunk-55MDBZLC.js +0 -490
  316. package/dist/chunk-55MDBZLC.js.map +0 -1
  317. package/dist/chunk-AIK5W3IW.js.map +0 -1
  318. package/dist/chunk-FUYEVEX7.js.map +0 -1
  319. package/dist/chunk-JMQUBRV6.js.map +0 -1
  320. package/dist/chunk-WL5EBRDH.js.map +0 -1
  321. package/dist/purge-YSGX5BOG.js.map +0 -1
  322. /package/dist/{chunk-FZRQZW4H.js.map → chunk-2EUVEDF5.js.map} +0 -0
  323. /package/dist/{chunk-3JNDOAQ2.js.map → chunk-5W4ZLBEZ.js.map} +0 -0
  324. /package/dist/{chunk-5ZCUDWD4.js.map → chunk-62U4J2GN.js.map} +0 -0
  325. /package/dist/{chunk-IGPEJVBY.js.map → chunk-66772WBP.js.map} +0 -0
  326. /package/dist/{chunk-EP5BVCRI.js.map → chunk-6BNE62PM.js.map} +0 -0
  327. /package/dist/{chunk-AAP5T6QG.js.map → chunk-6DNMUYEE.js.map} +0 -0
  328. /package/dist/{chunk-35DL7IOI.js.map → chunk-6FUPCJUL.js.map} +0 -0
  329. /package/dist/{chunk-JP3YPDAW.js.map → chunk-6U7F52DE.js.map} +0 -0
  330. /package/dist/{chunk-E4OCKU67.js.map → chunk-7XC2HX75.js.map} +0 -0
  331. /package/dist/{chunk-OVRQLAYR.js.map → chunk-AZ5BTEKX.js.map} +0 -0
  332. /package/dist/{chunk-2AXMQWCN.js.map → chunk-CZRYLSSW.js.map} +0 -0
  333. /package/dist/{chunk-PTSNLEXK.js.map → chunk-FDAMS4PK.js.map} +0 -0
  334. /package/dist/{chunk-2GXM5N5A.js.map → chunk-GIBMDSJ2.js.map} +0 -0
  335. /package/dist/{chunk-E5OBR6CJ.js.map → chunk-H5CPS5JP.js.map} +0 -0
  336. /package/dist/{chunk-2D7FEUCK.js.map → chunk-I5NLEENJ.js.map} +0 -0
  337. /package/dist/{chunk-DRBXHRXE.js.map → chunk-IB26HVAJ.js.map} +0 -0
  338. /package/dist/{chunk-QDKK63Y7.js.map → chunk-IC6CBHCA.js.map} +0 -0
  339. /package/dist/{chunk-IAEAFLF2.js.map → chunk-JCBWCYEJ.js.map} +0 -0
  340. /package/dist/{chunk-3PDOVUHC.js.map → chunk-KXB4VXHY.js.map} +0 -0
  341. /package/dist/{chunk-WU7TTVOD.js.map → chunk-LBOD4U5B.js.map} +0 -0
  342. /package/dist/{chunk-UBKEQOTD.js.map → chunk-LGHKJABJ.js.map} +0 -0
  343. /package/dist/{chunk-VSURVXKY.js.map → chunk-M3C2V3PV.js.map} +0 -0
  344. /package/dist/{chunk-OFHFH655.js.map → chunk-MJCGLM25.js.map} +0 -0
  345. /package/dist/{chunk-OYJKSZIQ.js.map → chunk-NHWB6HG2.js.map} +0 -0
  346. /package/dist/{chunk-TC3VNKGX.js.map → chunk-NM2WP3B7.js.map} +0 -0
  347. /package/dist/{chunk-GAWOEQEQ.js.map → chunk-P5PXWTW7.js.map} +0 -0
  348. /package/dist/{chunk-2QMKMVHH.js.map → chunk-QNWXCJ76.js.map} +0 -0
  349. /package/dist/{chunk-WRFBW2TT.js.map → chunk-SPJXKAVF.js.map} +0 -0
  350. /package/dist/{chunk-HKJCMOT6.js.map → chunk-TH2LSRMG.js.map} +0 -0
  351. /package/dist/{chunk-CW4AGY3G.js.map → chunk-VI2JQPNQ.js.map} +0 -0
  352. /package/dist/{chunk-OP6F6L3S.js.map → chunk-W5EG6LE3.js.map} +0 -0
  353. /package/dist/{chunk-DEBHXHJR.js.map → chunk-WIPEXG6R.js.map} +0 -0
  354. /package/dist/{chunk-SH6YO3LT.js.map → chunk-WVO4G37W.js.map} +0 -0
  355. /package/dist/{chunk-7L45JFPW.js.map → chunk-YTQNQ4KB.js.map} +0 -0
  356. /package/dist/{chunk-PKRIQL3V.js.map → chunk-YTSNAUXN.js.map} +0 -0
  357. /package/dist/{chunk-5QDRGWT2.js.map → chunk-ZPSVBSOF.js.map} +0 -0
  358. /package/dist/{forget-HRPLVB3W.js.map → forget-4UY2EOKH.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
- import { access, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
2
+ import { access, mkdir, mkdtemp, readFile, rm, unlink, writeFile } from "node:fs/promises";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import test from "node:test";
@@ -9,6 +9,7 @@ import { rebuildMemoryProjection } from "./rebuild-memory-projection.js";
9
9
  import { readProjectedMemoryBrowse } from "../memory-projection-store.js";
10
10
  import { StorageManager } from "../storage.js";
11
11
  import type { MemoryFile } from "../types.js";
12
+ import { buildExplicitCaptureDedupKey } from "../storage/tombstone-blocked-capture-index.js";
12
13
 
13
14
  test("purgeMemories records audit errors without blocking hard delete", async () => {
14
15
  const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-purge-"));
@@ -38,6 +39,10 @@ test("purgeMemories records audit errors without blocking hard delete", async ()
38
39
  readAllMemories: async () => [],
39
40
  readAllColdMemories: async () => [memory],
40
41
  readArchivedMemories: async () => [],
42
+ deleteMemoryForMaintenance: async (candidate: MemoryFile) => {
43
+ await unlink(candidate.path);
44
+ return candidate;
45
+ },
41
46
  };
42
47
 
43
48
  const result = await purgeMemories({
@@ -108,6 +113,10 @@ test("purgeMemories invalidates projection rows for already-absent files but not
108
113
  dir,
109
114
  readAllMemories: async () => [firstMemory, secondMemory],
110
115
  readAllColdMemories: async () => [],
116
+ deleteMemoryForMaintenance: async (candidate: MemoryFile) => {
117
+ await unlink(candidate.path);
118
+ return candidate;
119
+ },
111
120
  readArchivedMemories: async () => [],
112
121
  };
113
122
  const future = () => new Date(Date.now() + 86_400_000);
@@ -130,6 +139,153 @@ test("purgeMemories invalidates projection rows for already-absent files but not
130
139
  }
131
140
  });
132
141
 
142
+ test("cleanExpiredCommitments coordinates blocked capture deletion", async () => {
143
+ const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-commitment-delete-lock-"));
144
+ try {
145
+ const storage = new StorageManager(dir);
146
+ await storage.ensureDirectories();
147
+ storage.setTombstonesConfig({
148
+ enabled: true,
149
+ semanticMatch: false,
150
+ semanticThreshold: 0.9,
151
+ namespace: "default",
152
+ });
153
+ const content = "A blocked commitment must not disappear under a concurrent capture.";
154
+ const tombstoneId = await storage.appendTombstone({
155
+ reason: "correction",
156
+ createdBy: "user_correction",
157
+ sourceMemoryId: "commitment-delete-lock",
158
+ rawContent: content,
159
+ });
160
+ assert.ok(tombstoneId);
161
+ const result = await storage.writeMemory("fact", content, {
162
+ source: "test",
163
+ sourceConnector: "provider-a",
164
+ });
165
+ assert.equal(result.tombstoneBlocked, true);
166
+ const blocked = await storage.getMemoryById(result.id);
167
+ assert.ok(blocked);
168
+ assert.equal(
169
+ await storage.writeMemoryFrontmatter(blocked, {
170
+ category: "commitment",
171
+ tags: ["fulfilled"],
172
+ }),
173
+ true,
174
+ );
175
+ const identity = buildExplicitCaptureDedupKey(content, "commitment", "provider-a");
176
+ const release = Promise.withResolvers<void>();
177
+ const entered = Promise.withResolvers<void>();
178
+ const held = storage.withTombstoneBlockedCaptureWriteLock(async () => {
179
+ entered.resolve();
180
+ await release.promise;
181
+ }, identity);
182
+ await entered.promise;
183
+
184
+ let completed = false;
185
+ const pending = storage.cleanExpiredCommitments(-1).then((deleted) => {
186
+ completed = true;
187
+ return deleted;
188
+ });
189
+ await new Promise((resolve) => setTimeout(resolve, 50));
190
+ assert.equal(completed, false, "commitment cleanup must wait for the blocked capture identity lock");
191
+ release.resolve();
192
+ await held;
193
+ const deleted = await pending;
194
+ assert.equal(deleted.length, 1);
195
+ assert.equal(deleted[0]?.frontmatter.id, result.id);
196
+ } finally {
197
+ await rm(dir, { recursive: true, force: true });
198
+ }
199
+ });
200
+
201
+ test("purgeMemories coordinates blocked capture deletion", async () => {
202
+ const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-purge-delete-lock-"));
203
+ try {
204
+ const storage = new StorageManager(dir);
205
+ await storage.ensureDirectories();
206
+ storage.setTombstonesConfig({
207
+ enabled: true,
208
+ semanticMatch: false,
209
+ semanticThreshold: 0.9,
210
+ namespace: "default",
211
+ });
212
+ const content = "A blocked memory must not disappear under a concurrent capture.";
213
+ const tombstoneId = await storage.appendTombstone({
214
+ reason: "correction",
215
+ createdBy: "user_correction",
216
+ sourceMemoryId: "purge-delete-lock",
217
+ rawContent: content,
218
+ });
219
+ assert.ok(tombstoneId);
220
+ const result = await storage.writeMemory("fact", content, {
221
+ source: "test",
222
+ sourceConnector: "provider-a",
223
+ });
224
+ assert.equal(result.tombstoneBlocked, true);
225
+ const blocked = await storage.getMemoryById(result.id);
226
+ assert.ok(blocked);
227
+ const identity = buildExplicitCaptureDedupKey(content, "fact", "provider-a");
228
+ const release = Promise.withResolvers<void>();
229
+ const entered = Promise.withResolvers<void>();
230
+ const held = storage.withTombstoneBlockedCaptureWriteLock(async () => {
231
+ entered.resolve();
232
+ await release.promise;
233
+ }, identity);
234
+ await entered.promise;
235
+
236
+ let completed = false;
237
+ const pending = purgeMemories({
238
+ storage,
239
+ olderThanMs: 1,
240
+ tier: "all",
241
+ dryRun: false,
242
+ now: () => new Date(Date.now() + 86_400_000),
243
+ }).then((purged) => {
244
+ completed = true;
245
+ return purged;
246
+ });
247
+ await new Promise((resolve) => setTimeout(resolve, 50));
248
+ assert.equal(completed, false, "purge must wait for the blocked capture identity lock");
249
+ release.resolve();
250
+ await held;
251
+ const purged = await pending;
252
+ assert.equal(purged.purgedCount, 1);
253
+ assert.equal(await fileExists(blocked.path), false);
254
+ } finally {
255
+ await rm(dir, { recursive: true, force: true });
256
+ }
257
+ });
258
+
259
+ test("maintenance deletion prefers the candidate path when IDs overlap across tiers", async () => {
260
+ const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-delete-tier-path-"));
261
+ try {
262
+ StorageManager.clearAllStaticCaches();
263
+ const storage = new StorageManager(dir);
264
+ await storage.ensureDirectories();
265
+ const content = "The cold candidate path must win when a hot copy shares its ID.";
266
+ const result = await storage.writeMemory("fact", content, {
267
+ source: "test",
268
+ sourceConnector: "provider-a",
269
+ });
270
+ const hot = await storage.getMemoryById(result.id);
271
+ assert.ok(hot);
272
+ const coldPath = storage.buildTierMemoryPath(hot, "cold");
273
+ await mkdir(path.dirname(coldPath), { recursive: true });
274
+ await writeFile(coldPath, await readFile(hot.path));
275
+ StorageManager.clearAllStaticCaches();
276
+
277
+ const cold = (await storage.readAllColdMemories()).find((memory) => memory.frontmatter.id === result.id);
278
+ assert.ok(cold);
279
+ const removed = await storage.deleteMemoryForMaintenance(cold);
280
+ assert.equal(removed?.path, coldPath);
281
+ assert.equal(await fileExists(coldPath), false);
282
+ assert.equal(await fileExists(hot.path), true);
283
+ } finally {
284
+ StorageManager.clearAllStaticCaches();
285
+ await rm(dir, { recursive: true, force: true });
286
+ }
287
+ });
288
+
133
289
  async function fileExists(filePath: string): Promise<boolean> {
134
290
  try {
135
291
  await access(filePath);
@@ -20,7 +20,7 @@
20
20
  */
21
21
 
22
22
  import path from "node:path";
23
- import { appendFile, mkdir, unlink } from "node:fs/promises";
23
+ import { appendFile, mkdir } from "node:fs/promises";
24
24
  import type { StorageManager } from "../storage.js";
25
25
  import type { MemoryFile } from "../types.js";
26
26
  import { markProjectedMemoryPathInvalid } from "../memory-projection-store.js";
@@ -168,7 +168,7 @@ export async function purgeMemories(
168
168
 
169
169
  // Build candidate list
170
170
  const candidates: PurgeCandidate[] = [];
171
- const candidateMemoriesById = new Map<string, MemoryFile>();
171
+ const candidateMemoriesByPath = new Map<string, MemoryFile>();
172
172
  for (const { memory, resolvedTier } of poolEntries) {
173
173
  const ts = resolveTimestamp(memory);
174
174
  if (ts.length === 0) continue;
@@ -193,7 +193,7 @@ export async function purgeMemories(
193
193
  updatedOrCreated: ts,
194
194
  ageMs,
195
195
  });
196
- candidateMemoriesById.set(memory.frontmatter.id, memory);
196
+ candidateMemoriesByPath.set(memory.path, memory);
197
197
  }
198
198
 
199
199
  if (dryRun) {
@@ -234,13 +234,19 @@ export async function purgeMemories(
234
234
 
235
235
  for (const candidate of candidates) {
236
236
  try {
237
- await unlink(candidate.path);
238
- actuallyPurged.push(candidate);
239
- addCollectionForCandidate(candidate);
240
- markProjectedMemoryPathInvalid(storage.dir, candidate.id);
237
+ const memory = candidateMemoriesByPath.get(candidate.path);
238
+ if (!memory) throw new Error(`purge candidate memory missing: ${candidate.id}`);
239
+ const removed = await storage.deleteMemoryForMaintenance(memory);
240
+ if (removed) {
241
+ actuallyPurged.push(candidate);
242
+ addCollectionForCandidate(candidate);
243
+ } else {
244
+ alreadyAbsent.push(candidate);
245
+ addCollectionForCandidate(candidate);
246
+ markProjectedMemoryPathInvalid(storage.dir, candidate.id);
247
+ }
241
248
  } catch (err) {
242
249
  const message = err instanceof Error ? err.message : String(err);
243
- // ENOENT is fine — already gone
244
250
  if (hasErrorCode(err, "ENOENT")) {
245
251
  alreadyAbsent.push(candidate);
246
252
  addCollectionForCandidate(candidate);
@@ -302,7 +308,7 @@ export async function purgeMemories(
302
308
  }
303
309
 
304
310
  const purgedFactMemories = resolvedPurges
305
- .map((candidate) => candidateMemoriesById.get(candidate.id))
311
+ .map((candidate) => candidateMemoriesByPath.get(candidate.path))
306
312
  .filter((memory): memory is MemoryFile => memory?.frontmatter.category === "fact");
307
313
  if (purgedFactMemories.length > 0) {
308
314
  const removeFactHashes = (
@@ -0,0 +1,385 @@
1
+ /**
2
+ * recall-internal-deps.ts — the `RecallInternalDeps` contract (issue #1526
3
+ * seam 18), extracted from recall-internal.ts so that file can stay under
4
+ * its frozen ratchet ceiling while recall work proceeds (#2183). Pure type
5
+ * relocation: no behavior change, no renames, no member reordering.
6
+ */
7
+
8
+ import type { BoxBuilder } from "../boxes.js";
9
+ import type { CapabilitySet, GraphConstructionCapabilitySet } from "../capabilities.js";
10
+ import type { CausalTrajectorySearchResult } from "../causal-trajectory.js";
11
+ import type { CompoundingEngine } from "../compounding/engine.js";
12
+ import type { EvalShadowRecallRecord } from "../evals.js";
13
+ import type { HarmonicRetrievalResult } from "../harmonic-retrieval.js";
14
+ import type { StorageManager } from "../index.js";
15
+ import type { LcmEngine } from "../lcm/index.js";
16
+ import type { NamespaceCatalog } from "../namespaces/catalog.js";
17
+ import type { NamespaceStorageRouter } from "../namespaces/storage.js";
18
+ import type { ObjectiveStateSearchResult } from "../objective-state.js";
19
+ import type { IntentDebugSnapshot, QmdRecallSnapshot, QueryAwarePrefilter } from "../orchestrator.js";
20
+ import type { ProfilingCollector } from "../profiling.js";
21
+ import type { GraphRecallExpandedEntry, LastRecallBudgetSummary, LastRecallStore, RecallHandleHistoryStore } from "../recall-state.js";
22
+ import type { RecallXraySnapshot } from "../recall-xray.js";
23
+ import type { RerankCache } from "../rerank.js";
24
+ import type { SearchBackend, SearchDegradation, SearchQueryOptions } from "../search/port.js";
25
+ import type { VerifiedSemanticRuleResult } from "../semantic-rule-verifier.js";
26
+ import type { SharedContextManager } from "../shared-context/manager.js";
27
+ import type { HourlySummarizer } from "../summarizer.js";
28
+ import type { isValidAsOf } from "../temporal-validity.js";
29
+ import type { TmtBuilder } from "../tmt.js";
30
+ import type { TranscriptManager } from "../transcript.js";
31
+ import type { TrustStageResultItem } from "../trust-score-stage.js";
32
+ import type { TrustZoneSearchResult } from "../trust-zones.js";
33
+ import type { CodingContext, EngramTraceEvent, IdentityInjectionMode, MemoryFile, MemoryIntent, PluginConfig, QmdSearchResult, RecallPlanMode, RecallSectionConfig } from "../types.js";
34
+ import type { VerifiedEpisodeResult } from "../verified-recall.js";
35
+ import type { WorkProductLedgerSearchResult } from "../work-product-ledger.js";
36
+ import type { GraphRecallRankedResult, GraphRecallShadowComparison } from "./graph-recall-coordinator.js";
37
+ import type { RecallSectionAppendOptions, RecallSectionBuckets } from "./recall-section-coordinator.js";
38
+
39
+ export interface RecallInternalDeps {
40
+ readonly _recallWorkspaceOverrides: Map<string, string>;
41
+ appendRecallSection(
42
+ sectionBuckets: RecallSectionBuckets,
43
+ sectionId: string,
44
+ content: string,
45
+ options?: RecallSectionAppendOptions,
46
+ ): boolean;
47
+ applyColdFallbackPipeline(options: {
48
+ prompt: string;
49
+ recallNamespaces: string[];
50
+ recallResultLimit: number;
51
+ recallMode: RecallPlanMode;
52
+ /**
53
+ * Recall-operation capability gates resolved once at recall entry (#1523).
54
+ * OPTIONAL and additive: the recall pipeline threads a resolved set, but
55
+ * callers that omit it (e.g. direct unit-test invocations) get an
56
+ * equivalent config-derived set — behavior-preserving.
57
+ */
58
+ caps?: CapabilitySet;
59
+ /** Graph-construction gates resolved at recall entry (#1566 Cluster A). */
60
+ graphCaps?: GraphConstructionCapabilitySet;
61
+ queryAwarePrefilter?: QueryAwarePrefilter;
62
+ abortSignal?: AbortSignal;
63
+ /** Backend degradation observer — cold-tier QMD must report like hot (#1536). */
64
+ onDegradation?: (degradation: SearchDegradation) => void;
65
+ /** Issue #680 — historical recall point in ms-since-epoch. */
66
+ asOfMs?: number;
67
+ /**
68
+ * Optional out-parameter that receives the pre-MMR / pre-truncation
69
+ * pool size captured inside the pipeline (issue #570 PR 1). The
70
+ * X-ray capture block in `recallInternal` passes a small sink so
71
+ * the cold-fallback branch's pre-truncation pool size can be
72
+ * attributed back to the branch when `recallSource === "cold_fallback"`.
73
+ * Unset by default so existing call sites are unaffected.
74
+ */
75
+ xrayPoolSizeSink?: { size: number };
76
+ /**
77
+ * Issue #1577 — out-parameter that receives the TrustScore stage's
78
+ * per-path trust map (admitted + quarantined) when the cold path runs
79
+ * trust scoring. Mirrors the xrayPoolSizeSink pattern so recallInternal
80
+ can propagate trust data for epistemic rendering and X-ray visibility
81
+ without changing the cold pipeline's return type.
82
+ */
83
+ trustByPathSink?: { trustByPath: Map<string, TrustStageResultItem> | null };
84
+ deadlineAtMs?: number | null;
85
+ /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
86
+ includeLowConfidence?: boolean;
87
+ }): Promise<QmdSearchResult[]>;
88
+ applyTrustScoreToBranch(
89
+ results: QmdSearchResult[],
90
+ namespaces: string[],
91
+ caps: CapabilitySet,
92
+ label: string,
93
+ preloadedFrontmatter?: ReadonlyMap<string, MemoryFile>,
94
+ abortSignal?: AbortSignal,
95
+ ): Promise<{
96
+ results: QmdSearchResult[];
97
+ trustByPath: Map<string, TrustStageResultItem> | null;
98
+ }>;
99
+ assembleRecallSections(
100
+ sectionBuckets: RecallSectionBuckets,
101
+ budgetOverride?: number,
102
+ ): {
103
+ sections: string[];
104
+ includedIds: string[];
105
+ omittedIds: string[];
106
+ truncated: boolean;
107
+ finalChars: number;
108
+ includedMemoryIds: string[];
109
+ includedMemoryPaths: string[];
110
+ includedMemoryNamespaces: Array<string | undefined>;
111
+ omittedMemoryIds: string[];
112
+ };
113
+ boostSearchResults(
114
+ results: QmdSearchResult[],
115
+ _recallNamespaces: string[],
116
+ prompt?: string,
117
+ preloadedMemoryMap?: Map<string, MemoryFile>,
118
+ options?: {
119
+ allowLifecycleFiltered?: boolean;
120
+ allowDedicatedSurface?: boolean;
121
+ /**
122
+ * Historical recall point in ms-since-epoch (issue #680). When
123
+ * set, drops candidates that were not authoritative at this
124
+ * instant per `temporal-validity.isValidAsOf`. Caller is
125
+ * responsible for parsing/validating the user-supplied ISO
126
+ * string at the input boundary (CLI / HTTP / MCP).
127
+ */
128
+ asOfMs?: number;
129
+ },
130
+ ): Promise<QmdSearchResult[]>;
131
+ boxBuilderFor(storage: StorageManager): BoxBuilder;
132
+ buildCompressionGuidelineRecallSection(): Promise<string | null>;
133
+ buildConfiguredQmdSearchOptions(
134
+ queryText: string,
135
+ ): SearchQueryOptions | undefined;
136
+ buildGraphRecallRankedResults(
137
+ results: QmdSearchResult[],
138
+ sourceLabelResolver: (path: string) => string[],
139
+ limit?: number,
140
+ ): GraphRecallRankedResult[];
141
+ buildIdentityContinuitySection(options: {
142
+ storage: StorageManager;
143
+ recallMode: RecallPlanMode;
144
+ prompt: string;
145
+ }): Promise<{
146
+ section: string;
147
+ mode: IdentityInjectionMode;
148
+ injectedChars: number;
149
+ truncated: boolean;
150
+ } | null>;
151
+ buildLastRecallBudgetSummary(options: {
152
+ requestedTopK?: number;
153
+ recallResultLimit: number;
154
+ qmdFetchLimit: number;
155
+ qmdHybridFetchLimit: number;
156
+ finalContextChars?: number;
157
+ truncated?: boolean;
158
+ includedSections?: string[];
159
+ omittedSections?: string[];
160
+ includedMemoryIds?: string[];
161
+ includedMemoryPaths?: string[];
162
+ includedMemoryNamespaces?: Array<string | undefined>;
163
+ omittedMemoryIds?: string[];
164
+ }): LastRecallBudgetSummary;
165
+ buildQueryAwarePrefilter(
166
+ prompt: string,
167
+ recallNamespaces: string[],
168
+ ): Promise<QueryAwarePrefilter>;
169
+ collectLastRecallSources(
170
+ sectionBuckets: RecallSectionBuckets,
171
+ recallSource:
172
+ | "none"
173
+ | "hot_qmd"
174
+ | "hot_embedding"
175
+ | "cold_fallback"
176
+ | "recent_scan",
177
+ ): string[];
178
+ readonly compounding?: CompoundingEngine;
179
+ readonly config: PluginConfig;
180
+ currentPolicyVersion(): string;
181
+ diversifyAndLimitRecallResults(
182
+ sectionId: string,
183
+ results: QmdSearchResult[],
184
+ limit: number,
185
+ retrievalQuery?: string,
186
+ caps?: CapabilitySet,
187
+ ): QmdSearchResult[];
188
+ effectiveCronRecallInstructionHeavyTokenCap(): number;
189
+ emitTrace(event: EngramTraceEvent): void;
190
+ expandResultsViaGraph(options: {
191
+ memoryResults: QmdSearchResult[];
192
+ recallNamespaces: string[];
193
+ recallResultLimit: number;
194
+ deadlineAtMs?: number | null;
195
+ includeLowConfidence?: boolean;
196
+ }): Promise<{
197
+ merged: QmdSearchResult[];
198
+ seedPaths: string[];
199
+ expandedPaths: GraphRecallExpandedEntry[];
200
+ seedResults: QmdSearchResult[];
201
+ }>;
202
+ extractMemoryIdsFromResults(results: QmdSearchResult[]): string[];
203
+ readonly fastLlmForRerank: {
204
+ chatCompletion: (
205
+ messages: Array<{ role: string; content: string }>,
206
+ options?: { maxTokens?: number; temperature?: number; timeoutMs?: number; operation?: string; priority?: "recall-critical" | "background" },
207
+ ) => Promise<{ content: string } | null>;
208
+ };
209
+ fetchQmdMemoryResultsWithArtifactTopUp(
210
+ prompt: string,
211
+ qmdFetchLimit: number,
212
+ qmdHybridFetchLimit: number,
213
+ options: {
214
+ namespacesEnabled: boolean;
215
+ recallNamespaces: string[];
216
+ resolveNamespace: (path: string) => string;
217
+ collection?: string;
218
+ queryAwarePrefilter?: QueryAwarePrefilter;
219
+ searchOptions?: SearchQueryOptions;
220
+ onDebugSnapshot?: (snapshot: QmdRecallSnapshot) => Promise<void>;
221
+ /** Backend degradation observer, threaded into every QMD call (#1536). */
222
+ onDegradation?: (degradation: SearchDegradation) => void;
223
+ abortSignal?: AbortSignal;
224
+ },
225
+ ): Promise<QmdSearchResult[]>;
226
+ filterSearchResultsForRecall(
227
+ results: QmdSearchResult[],
228
+ preloadedMemoryMap?: Map<string, MemoryFile>,
229
+ options?: {
230
+ allowLifecycleFiltered?: boolean;
231
+ allowDedicatedSurface?: boolean;
232
+ asOfMs?: number;
233
+ deadlineAtMs?: number | null;
234
+ abortSignal?: AbortSignal;
235
+ dropUnresolved?: boolean;
236
+ recallNamespaces?: readonly string[];
237
+ },
238
+ ): Promise<{ results: QmdSearchResult[]; memoryByPath: Map<string, MemoryFile> }>;
239
+ formatCausalTrajectoryResults(
240
+ results: CausalTrajectorySearchResult[],
241
+ ): string;
242
+ formatConversationRecallSection(
243
+ results: Array<{ path: string; snippet: string; score: number }>,
244
+ maxChars: number,
245
+ ): string | null;
246
+ formatHarmonicRetrievalResults(
247
+ results: HarmonicRetrievalResult[],
248
+ ): string;
249
+ formatObjectiveStateResults(
250
+ results: ObjectiveStateSearchResult[],
251
+ ): string;
252
+ formatQmdResults(
253
+ title: string,
254
+ results: QmdSearchResult[],
255
+ sessionKey?: string,
256
+ trustByPath?: Map<string, TrustStageResultItem> | null,
257
+ ): string;
258
+ formatTrustZoneResults(results: TrustZoneSearchResult[]): string;
259
+ formatVerifiedEpisodeResults(
260
+ results: VerifiedEpisodeResult[],
261
+ ): string;
262
+ formatVerifiedSemanticRuleResults(
263
+ results: VerifiedSemanticRuleResult[],
264
+ ): string;
265
+ formatWorkProductResults(
266
+ results: WorkProductLedgerSearchResult[],
267
+ ): string;
268
+ getCodingContextForSession(sessionKey: string | undefined): CodingContext | null;
269
+ getPeerIdForSession(sessionKey: string | undefined): string | null;
270
+ getRecallBudgetChars(override?: number): number;
271
+ getRecallSectionEntry(
272
+ sectionId: string,
273
+ ): RecallSectionConfig | undefined;
274
+ getRecallSectionMaxChars(
275
+ sectionId: string,
276
+ ): number | null | undefined;
277
+ getRecallSectionNumber(
278
+ sectionId: string,
279
+ key: keyof RecallSectionConfig,
280
+ ): number | undefined;
281
+ getStorage(namespace?: string): Promise<StorageManager>;
282
+ readonly handleHistory: RecallHandleHistoryStore;
283
+ trackMemoryAccess(
284
+ memoryIds: string[],
285
+ memoryPaths?: string[],
286
+ memoryNamespaces?: Array<string | undefined>,
287
+ ): void;
288
+ trackRecallBackgroundWrite(promise: Promise<void>, label: string): void;
289
+ isRecallSectionEnabled(
290
+ sectionId: string,
291
+ defaultEnabled?: boolean,
292
+ ): boolean;
293
+ isSpecializedRecallSectionEnabled(
294
+ sectionId: string,
295
+ topLevelEnabled: boolean,
296
+ ): boolean;
297
+ lastQmdReprobeAtMs: number;
298
+ readonly lastRecall: LastRecallStore;
299
+ lastXraySnapshot: RecallXraySnapshot | null;
300
+ readonly lcmEngine: LcmEngine | null;
301
+ readonly namespaceCatalog: NamespaceCatalog;
302
+ namespaceFromPath(p: string): string;
303
+ readonly profiler: ProfilingCollector;
304
+ publishRecallResults(options: {
305
+ title: string;
306
+ results: QmdSearchResult[];
307
+ sectionBuckets: RecallSectionBuckets;
308
+ retrievalQuery: string;
309
+ sessionKey: string | undefined;
310
+ identityInjection?: {
311
+ mode: IdentityInjectionMode | "none";
312
+ injectedChars: number;
313
+ truncated: boolean;
314
+ };
315
+ /**
316
+ * Issue #1577 — per-recall trust map. When present, quarantined items
317
+ * are filtered from injection on EVERY recall path (hot QMD, embedding
318
+ * fallback, cold archive, recent) so a faithfulness-contradicted memory
319
+ * cannot sneak in via a branch that bypasses trust scoring (review:
320
+ * fallback paths bypass trust). The map is also threaded to
321
+ * formatQmdResults for the epistemic hedge.
322
+ */
323
+ trustByPath?: Map<string, TrustStageResultItem> | null;
324
+ }): void;
325
+ readonly qmd: SearchBackend;
326
+ queueEvalShadowRecall(
327
+ record: Omit<EvalShadowRecallRecord, "schemaVersion">,
328
+ ): void;
329
+ readAllMemoriesForNamespaces(
330
+ namespaces: string[],
331
+ ): Promise<MemoryFile[]>;
332
+ recallArtifactsAcrossNamespaces(
333
+ prompt: string,
334
+ recallNamespaces: string[],
335
+ targetCount: number,
336
+ ): Promise<MemoryFile[]>;
337
+ recallAssemblyClockMs(): number;
338
+ recordLastGraphRecallSnapshot(options: {
339
+ storage: StorageManager;
340
+ prompt: string;
341
+ recallMode: RecallPlanMode;
342
+ recallNamespaces: string[];
343
+ seedPaths: string[];
344
+ expandedPaths: GraphRecallExpandedEntry[];
345
+ status: "completed" | "skipped" | "aborted";
346
+ reason?: string;
347
+ shadowMode?: boolean;
348
+ queryIntent: MemoryIntent;
349
+ seedResults?: GraphRecallRankedResult[];
350
+ finalResults?: GraphRecallRankedResult[];
351
+ shadowComparison?: GraphRecallShadowComparison;
352
+ }): Promise<void>;
353
+ recordLastIntentSnapshot(options: {
354
+ storage: StorageManager;
355
+ snapshot: IntentDebugSnapshot;
356
+ }): Promise<void>;
357
+ recordLastIntentSnapshotForNamespace(options: {
358
+ namespace: string;
359
+ snapshot: IntentDebugSnapshot;
360
+ }): Promise<void>;
361
+ recordLastQmdRecallSnapshot(options: {
362
+ storage: StorageManager;
363
+ snapshot: QmdRecallSnapshot;
364
+ }): Promise<void>;
365
+ readonly rerankCache: RerankCache;
366
+ searchConversationRecallResults(
367
+ retrievalQuery: string,
368
+ topK: number,
369
+ ): Promise<Array<{ path: string; snippet: string; score: number }>>;
370
+ searchEmbeddingFallback(
371
+ query: string,
372
+ limit: number,
373
+ ): Promise<QmdSearchResult[]>;
374
+ readonly sharedContext?: SharedContextManager;
375
+ readonly storage: StorageManager;
376
+ readonly storageRouter: NamespaceStorageRouter;
377
+ readonly summarizer: HourlySummarizer;
378
+ readonly tmtBuilder: TmtBuilder;
379
+ readonly transcript: TranscriptManager;
380
+ truncateArtifactForRecall(text: string, maxChars?: number): string;
381
+ truncateRecallSectionToBudget(
382
+ content: string,
383
+ maxChars: number,
384
+ ): string;
385
+ }