@remnic/core 9.50.2 → 9.51.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 (483) hide show
  1. package/dist/access-admin-ops-surface.d.ts +13 -11
  2. package/dist/access-admin-ops-surface.js +41 -39
  3. package/dist/access-authorization-probe.d.ts +13 -11
  4. package/dist/access-authorization-probe.js +42 -40
  5. package/dist/access-boundary.d.ts +13 -11
  6. package/dist/access-boundary.js +41 -39
  7. package/dist/access-cli.js +109 -104
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +3 -1
  10. package/dist/access-extraction-force-flush.d.ts +13 -11
  11. package/dist/access-extraction-force-flush.js +41 -39
  12. package/dist/access-health-types.d.ts +3 -1
  13. package/dist/access-http-lcm-compaction.d.ts +13 -11
  14. package/dist/access-http-lifecycle-flush.d.ts +13 -11
  15. package/dist/access-http-offline-stream.d.ts +13 -11
  16. package/dist/access-http-query.js +41 -39
  17. package/dist/access-http.d.ts +13 -11
  18. package/dist/access-http.js +52 -50
  19. package/dist/access-identity-continuity-surface.d.ts +11 -9
  20. package/dist/access-identity-continuity-surface.js +41 -39
  21. package/dist/access-lcm-surface.d.ts +13 -11
  22. package/dist/access-lcm-surface.js +41 -39
  23. package/dist/access-mcp.d.ts +13 -11
  24. package/dist/access-mcp.js +47 -45
  25. package/dist/access-memory-search-fanout.d.ts +4 -2
  26. package/dist/{access-namespace-preflight-Dj2QolFE.d.ts → access-namespace-preflight-Ds6CGlCP.d.ts} +1 -1
  27. package/dist/access-namespace-preflight.d.ts +5 -3
  28. package/dist/access-namespace-preflight.js +41 -39
  29. package/dist/access-observe-write-surface.d.ts +13 -11
  30. package/dist/access-observe-write-surface.js +41 -39
  31. package/dist/access-offline-manifest.d.ts +11 -9
  32. package/dist/access-operations-batch.js +43 -41
  33. package/dist/access-operations.d.ts +13 -11
  34. package/dist/access-operations.js +46 -44
  35. package/dist/access-recall-concurrency.d.ts +13 -11
  36. package/dist/access-recall-concurrency.js +41 -39
  37. package/dist/access-recall-response.d.ts +13 -11
  38. package/dist/access-recall-response.js +41 -39
  39. package/dist/access-recall-surface.d.ts +13 -11
  40. package/dist/access-recall-surface.js +41 -39
  41. package/dist/access-schema.js +3 -3
  42. package/dist/{access-service-DesbnTSa.d.ts → access-service-BY0KJ44c.d.ts} +7 -7
  43. package/dist/access-service-helpers.d.ts +13 -11
  44. package/dist/access-service.d.ts +13 -11
  45. package/dist/access-service.js +41 -39
  46. package/dist/access-surface-catalog.d.ts +13 -11
  47. package/dist/access-wearables-meetings-surface.d.ts +5 -3
  48. package/dist/action-confidence.d.ts +3 -1
  49. package/dist/active-memory-bridge.d.ts +3 -1
  50. package/dist/active-recall.d.ts +3 -1
  51. package/dist/active-recall.js +5 -3
  52. package/dist/active-recall.js.map +1 -1
  53. package/dist/adapters/index.js +4 -4
  54. package/dist/adapters/registry.js +2 -2
  55. package/dist/ambient-provenance.d.ts +3 -1
  56. package/dist/archive-mutation-version.d.ts +9 -0
  57. package/dist/archive-mutation-version.js +20 -0
  58. package/dist/artifact-search.d.ts +3 -1
  59. package/dist/behavior-learner.d.ts +3 -1
  60. package/dist/behavior-signals.d.ts +3 -1
  61. package/dist/bootstrap.d.ts +11 -9
  62. package/dist/briefing.d.ts +4 -2
  63. package/dist/briefing.js +10 -9
  64. package/dist/buffer-surprise-report.d.ts +3 -1
  65. package/dist/buffer-turn-helpers.d.ts +3 -1
  66. package/dist/buffer.d.ts +4 -2
  67. package/dist/buffer.js +5 -5
  68. package/dist/bulk-import/index.d.ts +5 -3
  69. package/dist/calibration.d.ts +3 -1
  70. package/dist/capabilities.d.ts +3 -1
  71. package/dist/{catalog-D-G7RgXR.d.ts → catalog-D3B4RDy1.d.ts} +1 -1
  72. package/dist/causal-behavior.d.ts +3 -1
  73. package/dist/causal-behavior.js +2 -2
  74. package/dist/causal-chain.js +2 -2
  75. package/dist/causal-consolidation.d.ts +3 -1
  76. package/dist/causal-consolidation.js +13 -12
  77. package/dist/causal-consolidation.js.map +1 -1
  78. package/dist/causal-retrieval.js +2 -2
  79. package/dist/causal-trajectory-graph.d.ts +4 -2
  80. package/dist/causal-trajectory-graph.js +2 -1
  81. package/dist/causal-trajectory-graph.js.map +1 -1
  82. package/dist/causal-trajectory.js +1 -1
  83. package/dist/{chunk-KDG2KTWW.js → chunk-33SV3E43.js} +4 -4
  84. package/dist/{chunk-2HGUDBRJ.js → chunk-37ZO6LLJ.js} +2 -2
  85. package/dist/{chunk-QW3WFHKU.js → chunk-45BRYON6.js} +2 -2
  86. package/dist/{chunk-GZICBRWK.js → chunk-4F6X3RXW.js} +2 -2
  87. package/dist/{chunk-7BAYBYY5.js → chunk-4PC4PRJE.js} +2 -2
  88. package/dist/{chunk-VJXY5ZCT.js → chunk-52UKFTUK.js} +2 -2
  89. package/dist/{chunk-ESG7Z255.js → chunk-5UDMFE3Q.js} +2 -2
  90. package/dist/{chunk-JPHEOE6Z.js → chunk-6MTSFX7A.js} +15 -15
  91. package/dist/chunk-6ZN34ISG.js +44 -0
  92. package/dist/chunk-6ZN34ISG.js.map +1 -0
  93. package/dist/{chunk-M4MP34AQ.js → chunk-AHZOMHWN.js} +1 -1
  94. package/dist/{chunk-Z3RHPGSY.js → chunk-AIUBBHSF.js} +3 -3
  95. package/dist/{chunk-S3AYIQCU.js → chunk-AXIDQG5A.js} +12 -12
  96. package/dist/{chunk-QN7NTKRC.js → chunk-AZ2QBGYB.js} +1 -1
  97. package/dist/{chunk-47J4EDGR.js → chunk-AZM4CCAC.js} +8 -8
  98. package/dist/{chunk-IXXABW5A.js → chunk-BHXYAVUM.js} +11 -5
  99. package/dist/chunk-BHXYAVUM.js.map +1 -0
  100. package/dist/{chunk-L2DPF4DF.js → chunk-BIJAWZYW.js} +54 -12
  101. package/dist/chunk-BIJAWZYW.js.map +1 -0
  102. package/dist/{chunk-LEJPSMKM.js → chunk-C5QLI33R.js} +3 -3
  103. package/dist/{chunk-SV3PSA7Y.js → chunk-CV6BBVYV.js} +5 -5
  104. package/dist/{chunk-V7X767RT.js → chunk-DCZBSE4F.js} +52 -52
  105. package/dist/chunk-FC67T4E6.js +70 -0
  106. package/dist/chunk-FC67T4E6.js.map +1 -0
  107. package/dist/{chunk-7PKFPLLZ.js → chunk-FXTYIA46.js} +2 -2
  108. package/dist/{chunk-64BHFFKZ.js → chunk-HLYR2TQL.js} +5 -5
  109. package/dist/{chunk-5C2HNJMO.js → chunk-J5LLX6IL.js} +32 -32
  110. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  111. package/dist/{chunk-PLKFO2HJ.js → chunk-JL43BVDE.js} +2 -2
  112. package/dist/{chunk-2S72LWKX.js → chunk-JYL3BVVZ.js} +2 -2
  113. package/dist/{chunk-IPLYGWQF.js → chunk-KQAFEZQX.js} +5 -5
  114. package/dist/chunk-LXY5VVGM.js +61 -0
  115. package/dist/chunk-LXY5VVGM.js.map +1 -0
  116. package/dist/{chunk-PYKKWQZ2.js → chunk-M7BXDKPR.js} +6 -6
  117. package/dist/{chunk-Z54EM5YZ.js → chunk-MAXVH44E.js} +7 -7
  118. package/dist/{chunk-LYMNZZIM.js → chunk-NIS256NW.js} +2 -2
  119. package/dist/{chunk-67QG75MJ.js → chunk-NLK2VZYZ.js} +2 -2
  120. package/dist/{chunk-A4QMKFFO.js → chunk-O5FFBO2M.js} +14 -28
  121. package/dist/chunk-O5FFBO2M.js.map +1 -0
  122. package/dist/{chunk-JYIFGGEM.js → chunk-OUKBMQ2O.js} +2 -2
  123. package/dist/{chunk-75XOWNRS.js → chunk-OYESWJ43.js} +4 -4
  124. package/dist/{chunk-TS4AJ2GI.js → chunk-PA45XCUD.js} +3 -3
  125. package/dist/{chunk-BJYET5TX.js → chunk-PRDJMOST.js} +7 -1
  126. package/dist/chunk-PRDJMOST.js.map +1 -0
  127. package/dist/{chunk-4MBPIL4V.js → chunk-PUSLMZBQ.js} +2 -2
  128. package/dist/{chunk-RVO6TCTU.js → chunk-QCECHYZL.js} +6 -6
  129. package/dist/{chunk-GFIKG4FR.js → chunk-QGR6OVGT.js} +2 -2
  130. package/dist/{chunk-NSGU76YO.js → chunk-QHFV6VNU.js} +6 -2
  131. package/dist/chunk-QHFV6VNU.js.map +1 -0
  132. package/dist/{chunk-PDEKQWDV.js → chunk-QT2FRYI4.js} +18 -2
  133. package/dist/chunk-QT2FRYI4.js.map +1 -0
  134. package/dist/{chunk-HNZKVLAN.js → chunk-S354QO4R.js} +2 -2
  135. package/dist/{chunk-NO37MR45.js → chunk-SOEN6KCF.js} +2 -2
  136. package/dist/{chunk-FXX6RQYC.js → chunk-TPTECFWR.js} +2 -2
  137. package/dist/{chunk-GDDGZVFI.js → chunk-UEVLYVNW.js} +2 -2
  138. package/dist/{chunk-YQ4IQ2GA.js → chunk-UT5BV5OG.js} +2 -2
  139. package/dist/{chunk-LAQ33B5D.js → chunk-UU3G6GUP.js} +1 -1
  140. package/dist/chunk-UU3G6GUP.js.map +1 -0
  141. package/dist/{chunk-LNTUXKBT.js → chunk-UYYW2KPU.js} +2 -2
  142. package/dist/{chunk-BOFVT6P3.js → chunk-VBHPOWBJ.js} +175 -98
  143. package/dist/chunk-VBHPOWBJ.js.map +1 -0
  144. package/dist/{chunk-QSYL5CXK.js → chunk-VKXWK44Q.js} +3 -3
  145. package/dist/{chunk-KMWYZTIE.js → chunk-VMMQDEN5.js} +2 -2
  146. package/dist/{chunk-JB6D7EFB.js → chunk-VVG2BOKA.js} +2 -2
  147. package/dist/chunk-W5BIQOAJ.js +69 -0
  148. package/dist/chunk-W5BIQOAJ.js.map +1 -0
  149. package/dist/{chunk-V5H6OJCR.js → chunk-W5XVQFLM.js} +2 -2
  150. package/dist/{chunk-OIOZ6MOP.js → chunk-W6FNX2LP.js} +2 -2
  151. package/dist/{chunk-6QPHF6RR.js → chunk-WQM326GS.js} +2 -2
  152. package/dist/{chunk-TQFHQPWD.js → chunk-XADV5IZ3.js} +8 -8
  153. package/dist/{chunk-DATDLJAO.js → chunk-XAPMEU3K.js} +2 -2
  154. package/dist/chunk-XXSOVESA.js +42 -0
  155. package/dist/chunk-XXSOVESA.js.map +1 -0
  156. package/dist/{chunk-IK6X5QPO.js → chunk-ZHY5TMJG.js} +1193 -443
  157. package/dist/chunk-ZHY5TMJG.js.map +1 -0
  158. package/dist/{chunk-N3LL5NEU.js → chunk-ZMYDYNI4.js} +2 -2
  159. package/dist/{cli-D4vvtxjY.d.ts → cli-CnOkH9hA.d.ts} +6 -6
  160. package/dist/cli.d.ts +15 -13
  161. package/dist/cli.js +74 -70
  162. package/dist/coding/pre-action-gate.d.ts +3 -1
  163. package/dist/coding/pre-action-gate.js +2 -2
  164. package/dist/compounding/engine.d.ts +4 -2
  165. package/dist/compounding/engine.js +10 -9
  166. package/dist/compounding/preference-consolidator.d.ts +3 -1
  167. package/dist/compression-optimizer.d.ts +3 -1
  168. package/dist/config.d.ts +3 -1
  169. package/dist/config.js +5 -3
  170. package/dist/connectors/codex-materialize-runner.d.ts +3 -1
  171. package/dist/connectors/codex-materialize-runner.js +10 -9
  172. package/dist/connectors/codex-materialize.d.ts +3 -1
  173. package/dist/connectors/index.d.ts +3 -1
  174. package/dist/connectors/index.js +10 -9
  175. package/dist/consolidation-provenance-check.d.ts +4 -2
  176. package/dist/consolidation-undo.d.ts +4 -2
  177. package/dist/contradiction/index.d.ts +4 -2
  178. package/dist/contradiction-config.d.ts +29 -0
  179. package/dist/contradiction-config.js +12 -0
  180. package/dist/contradiction-config.js.map +1 -0
  181. package/dist/converge-config.d.ts +3 -1
  182. package/dist/convergence-refresh.d.ts +4 -2
  183. package/dist/convergence-refresh.js +12 -11
  184. package/dist/conversation-index/backend.d.ts +3 -1
  185. package/dist/conversation-index/chunker.d.ts +3 -1
  186. package/dist/conversation-index/faiss-adapter.d.ts +3 -1
  187. package/dist/conversation-index/indexer.d.ts +3 -1
  188. package/dist/conversation-index/search.d.ts +3 -1
  189. package/dist/corpus-watermark.d.ts +3 -1
  190. package/dist/corpus-watermark.js +21 -20
  191. package/dist/day-summary.d.ts +3 -1
  192. package/dist/delinearize.d.ts +3 -1
  193. package/dist/dependency-propagation-config.d.ts +3 -1
  194. package/dist/direct-answer-wiring.d.ts +3 -1
  195. package/dist/direct-answer.d.ts +3 -1
  196. package/dist/embedding-fallback.d.ts +3 -1
  197. package/dist/enrichment/index.d.ts +3 -1
  198. package/dist/entity-retrieval.d.ts +4 -2
  199. package/dist/entity-retrieval.js +10 -9
  200. package/dist/entity-schema.d.ts +3 -1
  201. package/dist/explicit-capture.d.ts +11 -9
  202. package/dist/explicit-capture.js +3 -2
  203. package/dist/external-wiki-access.d.ts +13 -11
  204. package/dist/external-wiki-access.js +42 -40
  205. package/dist/external-wiki-collection-registration.d.ts +3 -1
  206. package/dist/external-wiki-collection.d.ts +3 -1
  207. package/dist/external-wiki-mcp-tools.d.ts +13 -11
  208. package/dist/extraction-error-classification.d.ts +3 -1
  209. package/dist/extraction-faithfulness.d.ts +3 -1
  210. package/dist/extraction-judge-telemetry.d.ts +3 -1
  211. package/dist/extraction-judge-training.d.ts +3 -1
  212. package/dist/extraction-judge.d.ts +3 -1
  213. package/dist/extraction-liveness.d.ts +3 -1
  214. package/dist/extraction-normalization.d.ts +3 -1
  215. package/dist/extraction-prompt.d.ts +3 -1
  216. package/dist/extraction-source-grounding-rules.d.ts +3 -1
  217. package/dist/extraction-source-grounding.d.ts +3 -1
  218. package/dist/extraction.d.ts +3 -1
  219. package/dist/extraction.js +22 -21
  220. package/dist/fallback-llm.d.ts +3 -1
  221. package/dist/graph-444E-DrF.d.ts +349 -0
  222. package/dist/graph-dashboard-diff.d.ts +4 -2
  223. package/dist/graph-dashboard-key.d.ts +4 -2
  224. package/dist/graph-dashboard-parser.d.ts +4 -2
  225. package/dist/{graph-edge-decay-Z6ENALU2.js → graph-edge-decay-65KMOJWY.js} +4 -3
  226. package/dist/graph-edge-decay-65KMOJWY.js.map +1 -0
  227. package/dist/graph-edge-reinforcement.d.ts +4 -2
  228. package/dist/graph-path-reconstruction.d.ts +10 -0
  229. package/dist/graph-path-reconstruction.js +12 -0
  230. package/dist/graph-path-reconstruction.js.map +1 -0
  231. package/dist/graph-path-scoring-config.d.ts +8 -0
  232. package/dist/graph-path-scoring-config.js +10 -0
  233. package/dist/graph-path-scoring-config.js.map +1 -0
  234. package/dist/graph-path-scoring.d.ts +36 -0
  235. package/dist/graph-path-scoring.js +11 -0
  236. package/dist/graph-path-scoring.js.map +1 -0
  237. package/dist/graph-snapshot.d.ts +4 -2
  238. package/dist/graph-snapshot.js +3 -2
  239. package/dist/graph.d.ts +5 -318
  240. package/dist/graph.js +5 -1
  241. package/dist/harmonic-retrieval.js +1 -1
  242. package/dist/importance.d.ts +3 -1
  243. package/dist/importers/index.d.ts +3 -1
  244. package/dist/in-flight-reads.d.ts +3 -1
  245. package/dist/index.d.ts +22 -20
  246. package/dist/index.js +149 -144
  247. package/dist/intent.d.ts +3 -1
  248. package/dist/lcm/engine.d.ts +3 -1
  249. package/dist/lcm/engine.js +3 -3
  250. package/dist/lcm/index.d.ts +3 -1
  251. package/dist/lcm/index.js +6 -6
  252. package/dist/lcm/tools.d.ts +3 -1
  253. package/dist/lifecycle.d.ts +3 -1
  254. package/dist/live-connectors-runner.d.ts +3 -1
  255. package/dist/local-llm.d.ts +3 -1
  256. package/dist/local-model-endpoint.d.ts +3 -1
  257. package/dist/maintenance/memory-governance.d.ts +3 -1
  258. package/dist/maintenance/memory-governance.js +10 -9
  259. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +4 -2
  260. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
  261. package/dist/maintenance/rebuild-memory-projection.d.ts +4 -2
  262. package/dist/maintenance/rebuild-memory-projection.js +11 -10
  263. package/dist/{maintenance-ClmUVpGI.d.ts → maintenance-CKwxpdRx.d.ts} +3 -3
  264. package/dist/mcp-memory-inspector-app.d.ts +13 -11
  265. package/dist/memory-action-policy.d.ts +3 -1
  266. package/dist/memory-cache.d.ts +3 -1
  267. package/dist/memory-lifecycle-ledger-utils.d.ts +3 -1
  268. package/dist/memory-projection-store.d.ts +3 -1
  269. package/dist/memory-provenance.d.ts +3 -1
  270. package/dist/memory-snapshot.d.ts +3 -1
  271. package/dist/memory-worth-outcomes.d.ts +4 -2
  272. package/dist/models-json.d.ts +3 -1
  273. package/dist/namespaces/migrate.d.ts +5 -3
  274. package/dist/namespaces/migrate.js +20 -19
  275. package/dist/namespaces/principal.d.ts +3 -1
  276. package/dist/namespaces/search.d.ts +3 -1
  277. package/dist/namespaces/search.js +7 -7
  278. package/dist/namespaces/storage.d.ts +5 -3
  279. package/dist/namespaces/storage.js +10 -9
  280. package/dist/native-knowledge.d.ts +3 -1
  281. package/dist/offline-sync-impression-drain.d.ts +3 -1
  282. package/dist/operator-doctor-corpus.d.ts +3 -1
  283. package/dist/operator-doctor-corpus.js +22 -21
  284. package/dist/operator-doctor-replica.d.ts +3 -1
  285. package/dist/operator-toolkit.d.ts +6 -4
  286. package/dist/operator-toolkit.js +33 -29
  287. package/dist/orchestration/compression-guideline-coordinator.d.ts +4 -2
  288. package/dist/orchestration/maintenance.d.ts +6 -4
  289. package/dist/orchestration/maintenance.js +15 -14
  290. package/dist/{orchestrator-qJ07zI8H.d.ts → orchestrator-BshGam-o.d.ts} +45 -19
  291. package/dist/orchestrator.d.ts +11 -9
  292. package/dist/orchestrator.js +109 -104
  293. package/dist/patterns-cli.d.ts +3 -1
  294. package/dist/{pipeline-WFCxhHOn.d.ts → pipeline-D21Rs6gW.d.ts} +1 -1
  295. package/dist/policy-runtime.d.ts +3 -1
  296. package/dist/proactive-contention.d.ts +3 -1
  297. package/dist/provenance.d.ts +3 -1
  298. package/dist/{qmd-5tzkQ44y.d.ts → qmd-Dhle1P4X.d.ts} +1 -1
  299. package/dist/qmd-preflight.d.ts +4 -2
  300. package/dist/qmd-recall-cache.d.ts +3 -1
  301. package/dist/qmd.d.ts +4 -2
  302. package/dist/qmd.js +4 -4
  303. package/dist/recall-concurrency-config.d.ts +3 -1
  304. package/dist/recall-disclosure-escalation.d.ts +3 -1
  305. package/dist/recall-explain-renderer.d.ts +3 -1
  306. package/dist/recall-explain-renderer.js +3 -3
  307. package/dist/recall-memory-map.d.ts +3 -1
  308. package/dist/recall-planner-llm.d.ts +3 -1
  309. package/dist/recall-planner-llm.js +3 -3
  310. package/dist/recall-state.d.ts +7 -1
  311. package/dist/recall-state.js +1 -1
  312. package/dist/recall-tag-filter.d.ts +3 -1
  313. package/dist/recall-timings.d.ts +3 -1
  314. package/dist/recall-xray-cli.d.ts +3 -1
  315. package/dist/recall-xray-cli.js +4 -4
  316. package/dist/recall-xray-renderer.d.ts +3 -1
  317. package/dist/recall-xray-renderer.js +3 -3
  318. package/dist/recall-xray.d.ts +7 -1
  319. package/dist/recall-xray.js +2 -2
  320. package/dist/reconcile/cursor.d.ts +3 -1
  321. package/dist/reconcile/manifest.d.ts +3 -1
  322. package/dist/reconcile/plan.d.ts +3 -1
  323. package/dist/replay/normalizers/chatgpt.d.ts +3 -1
  324. package/dist/replay/normalizers/claude.d.ts +3 -1
  325. package/dist/replay/normalizers/openclaw.d.ts +3 -1
  326. package/dist/replay/normalizers/shared.d.ts +3 -1
  327. package/dist/replay/runner.d.ts +3 -1
  328. package/dist/replay/types.d.ts +3 -1
  329. package/dist/replica-divergence.d.ts +3 -1
  330. package/dist/replica-peers-config.d.ts +3 -1
  331. package/dist/resolve-auth-token.d.ts +3 -1
  332. package/dist/resume-bundles.js +6 -4
  333. package/dist/retrieval-agents.d.ts +4 -2
  334. package/dist/retrieval-tiers.d.ts +3 -1
  335. package/dist/routing/engine.d.ts +3 -1
  336. package/dist/routing/store.d.ts +3 -1
  337. package/dist/salvage-envelope.d.ts +3 -1
  338. package/dist/{scope-profiles--vfXPl3X.d.ts → scope-profiles-NzGPDXLn.d.ts} +1 -1
  339. package/dist/search/embed-helper.d.ts +3 -1
  340. package/dist/search/factory.d.ts +3 -1
  341. package/dist/search/factory.js +6 -6
  342. package/dist/search/index.d.ts +3 -1
  343. package/dist/search/index.js +12 -12
  344. package/dist/search/lancedb-backend.d.ts +3 -1
  345. package/dist/search/meilisearch-backend.d.ts +3 -1
  346. package/dist/search/noop-backend.d.ts +3 -1
  347. package/dist/search/orama-backend.d.ts +3 -1
  348. package/dist/search/port.d.ts +3 -1
  349. package/dist/search/remote-backend.d.ts +3 -1
  350. package/dist/{semantic-consolidation-BBDuP9nJ.d.ts → semantic-consolidation-DLDKvyy5.d.ts} +1 -1
  351. package/dist/semantic-consolidation.d.ts +4 -2
  352. package/dist/semantic-consolidation.js +11 -10
  353. package/dist/semantic-rule-promotion.js +10 -9
  354. package/dist/semantic-rule-verifier.d.ts +3 -1
  355. package/dist/semantic-rule-verifier.js +10 -9
  356. package/dist/{service-B8DtbpCM.d.ts → service-BIgVM7fL.d.ts} +2 -2
  357. package/dist/session-observer-bands.d.ts +3 -1
  358. package/dist/session-observer-state.d.ts +3 -1
  359. package/dist/shared-context/manager.d.ts +3 -1
  360. package/dist/signal.d.ts +3 -1
  361. package/dist/source-agent-qualifier.d.ts +3 -1
  362. package/dist/source-agent-qualifier.js +18 -17
  363. package/dist/{storage-BkYN1RIy.d.ts → storage-CVfGWqCI.d.ts} +7 -6
  364. package/dist/storage.d.ts +4 -2
  365. package/dist/storage.js +9 -8
  366. package/dist/summarizer.d.ts +3 -1
  367. package/dist/summary-snapshot.d.ts +3 -1
  368. package/dist/temporal-supersession.d.ts +4 -2
  369. package/dist/temporal-timeline-recall.d.ts +3 -1
  370. package/dist/temporal-validity.d.ts +3 -1
  371. package/dist/threading.d.ts +3 -1
  372. package/dist/tier-migration.d.ts +4 -2
  373. package/dist/tier-routing.d.ts +3 -1
  374. package/dist/topics.d.ts +3 -1
  375. package/dist/transcript.d.ts +3 -1
  376. package/dist/transfer/autodetect.js +1 -1
  377. package/dist/transfer/backup.js +1 -1
  378. package/dist/transfer/capsule-export.js +2 -2
  379. package/dist/trust-score-stage.d.ts +3 -1
  380. package/dist/trust-score.d.ts +3 -1
  381. package/dist/{types-u2s9j1uD.d.ts → types-CkiDUorT.d.ts} +10 -16
  382. package/dist/types.d.ts +3 -1
  383. package/dist/types.js +1 -1
  384. package/dist/utility-runtime.d.ts +3 -1
  385. package/dist/verified-recall.js +10 -9
  386. package/dist/write-envelope.d.ts +3 -1
  387. package/package.json +2 -2
  388. package/src/archive-mutation-version.ts +59 -0
  389. package/src/config.test.ts +45 -0
  390. package/src/config.ts +10 -30
  391. package/src/contradiction/contradiction.test.ts +86 -1
  392. package/src/contradiction-config.ts +92 -0
  393. package/src/graph-path-reconstruction.ts +91 -0
  394. package/src/graph-path-scoring-config.ts +55 -0
  395. package/src/graph-path-scoring.test.ts +238 -0
  396. package/src/graph-path-scoring.ts +77 -0
  397. package/src/graph.test.ts +225 -5
  398. package/src/graph.ts +72 -5
  399. package/src/orchestration/contradiction-linking-coordinator.ts +246 -76
  400. package/src/orchestration/contradiction-localization.integration.test.ts +1953 -0
  401. package/src/orchestration/extraction-anchor-snapshot.ts +83 -0
  402. package/src/orchestration/extraction-persist-deps.ts +8 -2
  403. package/src/orchestration/extraction-persist.ts +43 -34
  404. package/src/orchestration/graph-path-state-loader.test.ts +801 -0
  405. package/src/orchestration/graph-path-state-loader.ts +318 -0
  406. package/src/orchestration/graph-recall-coordinator.integration.test.ts +1163 -0
  407. package/src/orchestration/graph-recall-coordinator.ts +206 -29
  408. package/src/orchestration/graph-recall-seam.ts +19 -0
  409. package/src/orchestration/recall-internal-deps.ts +7 -13
  410. package/src/orchestration/recall-internal.ts +5 -0
  411. package/src/orchestration/recall-introspection.ts +9 -1
  412. package/src/orchestration/recall-search-pipeline.ts +8 -13
  413. package/src/orchestration/update-localization.test.ts +784 -0
  414. package/src/orchestration/update-localization.ts +173 -0
  415. package/src/orchestrator.ts +19 -18
  416. package/src/recall-state.test.ts +29 -1
  417. package/src/recall-state.ts +13 -0
  418. package/src/recall-xray-renderer.test.ts +45 -0
  419. package/src/recall-xray-renderer.ts +16 -0
  420. package/src/recall-xray.ts +13 -0
  421. package/src/storage/supersession-side-effects.ts +97 -0
  422. package/src/storage/tombstone-blocked-capture-sync.ts +13 -5
  423. package/src/storage-contract/cache-coherence.test.ts +299 -0
  424. package/src/storage.ts +86 -88
  425. package/src/types.ts +12 -15
  426. package/dist/chunk-A4QMKFFO.js.map +0 -1
  427. package/dist/chunk-BJYET5TX.js.map +0 -1
  428. package/dist/chunk-BOFVT6P3.js.map +0 -1
  429. package/dist/chunk-IK6X5QPO.js.map +0 -1
  430. package/dist/chunk-IXXABW5A.js.map +0 -1
  431. package/dist/chunk-L2DPF4DF.js.map +0 -1
  432. package/dist/chunk-LAQ33B5D.js.map +0 -1
  433. package/dist/chunk-NSGU76YO.js.map +0 -1
  434. package/dist/chunk-PDEKQWDV.js.map +0 -1
  435. /package/dist/{graph-edge-decay-Z6ENALU2.js.map → archive-mutation-version.js.map} +0 -0
  436. /package/dist/{chunk-KDG2KTWW.js.map → chunk-33SV3E43.js.map} +0 -0
  437. /package/dist/{chunk-2HGUDBRJ.js.map → chunk-37ZO6LLJ.js.map} +0 -0
  438. /package/dist/{chunk-QW3WFHKU.js.map → chunk-45BRYON6.js.map} +0 -0
  439. /package/dist/{chunk-GZICBRWK.js.map → chunk-4F6X3RXW.js.map} +0 -0
  440. /package/dist/{chunk-7BAYBYY5.js.map → chunk-4PC4PRJE.js.map} +0 -0
  441. /package/dist/{chunk-VJXY5ZCT.js.map → chunk-52UKFTUK.js.map} +0 -0
  442. /package/dist/{chunk-ESG7Z255.js.map → chunk-5UDMFE3Q.js.map} +0 -0
  443. /package/dist/{chunk-JPHEOE6Z.js.map → chunk-6MTSFX7A.js.map} +0 -0
  444. /package/dist/{chunk-M4MP34AQ.js.map → chunk-AHZOMHWN.js.map} +0 -0
  445. /package/dist/{chunk-Z3RHPGSY.js.map → chunk-AIUBBHSF.js.map} +0 -0
  446. /package/dist/{chunk-S3AYIQCU.js.map → chunk-AXIDQG5A.js.map} +0 -0
  447. /package/dist/{chunk-QN7NTKRC.js.map → chunk-AZ2QBGYB.js.map} +0 -0
  448. /package/dist/{chunk-47J4EDGR.js.map → chunk-AZM4CCAC.js.map} +0 -0
  449. /package/dist/{chunk-LEJPSMKM.js.map → chunk-C5QLI33R.js.map} +0 -0
  450. /package/dist/{chunk-SV3PSA7Y.js.map → chunk-CV6BBVYV.js.map} +0 -0
  451. /package/dist/{chunk-V7X767RT.js.map → chunk-DCZBSE4F.js.map} +0 -0
  452. /package/dist/{chunk-7PKFPLLZ.js.map → chunk-FXTYIA46.js.map} +0 -0
  453. /package/dist/{chunk-64BHFFKZ.js.map → chunk-HLYR2TQL.js.map} +0 -0
  454. /package/dist/{chunk-5C2HNJMO.js.map → chunk-J5LLX6IL.js.map} +0 -0
  455. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  456. /package/dist/{chunk-PLKFO2HJ.js.map → chunk-JL43BVDE.js.map} +0 -0
  457. /package/dist/{chunk-2S72LWKX.js.map → chunk-JYL3BVVZ.js.map} +0 -0
  458. /package/dist/{chunk-IPLYGWQF.js.map → chunk-KQAFEZQX.js.map} +0 -0
  459. /package/dist/{chunk-PYKKWQZ2.js.map → chunk-M7BXDKPR.js.map} +0 -0
  460. /package/dist/{chunk-Z54EM5YZ.js.map → chunk-MAXVH44E.js.map} +0 -0
  461. /package/dist/{chunk-LYMNZZIM.js.map → chunk-NIS256NW.js.map} +0 -0
  462. /package/dist/{chunk-67QG75MJ.js.map → chunk-NLK2VZYZ.js.map} +0 -0
  463. /package/dist/{chunk-JYIFGGEM.js.map → chunk-OUKBMQ2O.js.map} +0 -0
  464. /package/dist/{chunk-75XOWNRS.js.map → chunk-OYESWJ43.js.map} +0 -0
  465. /package/dist/{chunk-TS4AJ2GI.js.map → chunk-PA45XCUD.js.map} +0 -0
  466. /package/dist/{chunk-4MBPIL4V.js.map → chunk-PUSLMZBQ.js.map} +0 -0
  467. /package/dist/{chunk-RVO6TCTU.js.map → chunk-QCECHYZL.js.map} +0 -0
  468. /package/dist/{chunk-GFIKG4FR.js.map → chunk-QGR6OVGT.js.map} +0 -0
  469. /package/dist/{chunk-HNZKVLAN.js.map → chunk-S354QO4R.js.map} +0 -0
  470. /package/dist/{chunk-NO37MR45.js.map → chunk-SOEN6KCF.js.map} +0 -0
  471. /package/dist/{chunk-FXX6RQYC.js.map → chunk-TPTECFWR.js.map} +0 -0
  472. /package/dist/{chunk-GDDGZVFI.js.map → chunk-UEVLYVNW.js.map} +0 -0
  473. /package/dist/{chunk-YQ4IQ2GA.js.map → chunk-UT5BV5OG.js.map} +0 -0
  474. /package/dist/{chunk-LNTUXKBT.js.map → chunk-UYYW2KPU.js.map} +0 -0
  475. /package/dist/{chunk-QSYL5CXK.js.map → chunk-VKXWK44Q.js.map} +0 -0
  476. /package/dist/{chunk-KMWYZTIE.js.map → chunk-VMMQDEN5.js.map} +0 -0
  477. /package/dist/{chunk-JB6D7EFB.js.map → chunk-VVG2BOKA.js.map} +0 -0
  478. /package/dist/{chunk-V5H6OJCR.js.map → chunk-W5XVQFLM.js.map} +0 -0
  479. /package/dist/{chunk-OIOZ6MOP.js.map → chunk-W6FNX2LP.js.map} +0 -0
  480. /package/dist/{chunk-6QPHF6RR.js.map → chunk-WQM326GS.js.map} +0 -0
  481. /package/dist/{chunk-TQFHQPWD.js.map → chunk-XADV5IZ3.js.map} +0 -0
  482. /package/dist/{chunk-DATDLJAO.js.map → chunk-XAPMEU3K.js.map} +0 -0
  483. /package/dist/{chunk-N3LL5NEU.js.map → chunk-ZMYDYNI4.js.map} +0 -0
@@ -0,0 +1,173 @@
1
+ import type { MemoryFile, MemoryStatus } from "../types.js";
2
+ import { inferMemoryStatus, isActiveMemoryStatus, toMemoryPathRel } from "../memory-lifecycle-ledger-utils.js";
3
+ import { lookupAttributeByNormalizedKey, normalizeSupersessionKey } from "../temporal-supersession.js";
4
+
5
+ export interface UpdateLocalizationStorage {
6
+ dir?: string;
7
+ readAllMemories(): Promise<MemoryFile[]>;
8
+ readAllColdMemories?: () => Promise<MemoryFile[]>;
9
+ }
10
+
11
+ export function mergeMemorySnapshots(
12
+ hot: MemoryFile[],
13
+ cold: MemoryFile[],
14
+ storageDir?: string,
15
+ ): MemoryFile[] {
16
+ const merged: MemoryFile[] = [];
17
+ const indexById = new Map<string, number>();
18
+ for (const memory of [...hot, ...cold]) {
19
+ const id = memory.frontmatter.id;
20
+ const existingIndex = indexById.get(id);
21
+ if (existingIndex === undefined) {
22
+ indexById.set(id, merged.length);
23
+ merged.push(memory);
24
+ continue;
25
+ }
26
+ const existing = merged[existingIndex];
27
+ if (
28
+ !isActiveMemoryStatus(inferLocalizationMemoryStatus(existing, storageDir)) &&
29
+ isActiveMemoryStatus(inferLocalizationMemoryStatus(memory, storageDir))
30
+ ) {
31
+ merged[existingIndex] = memory;
32
+ }
33
+ }
34
+ return merged;
35
+ }
36
+
37
+ export interface UpdateAnchor {
38
+ entityRef?: string;
39
+ category: string;
40
+ attributes?: Record<string, string>;
41
+ }
42
+
43
+ export interface UpdateLocalizationSearchHit {
44
+ id: string;
45
+ content: string;
46
+ category: string;
47
+ score: number;
48
+ }
49
+
50
+ export interface LocalizedCandidate {
51
+ id: string;
52
+ content: string;
53
+ category: string;
54
+ source: "anchor" | "search";
55
+ score: number;
56
+ }
57
+
58
+ export interface UpdateLocalizationOptions {
59
+ anchorCandidates: number;
60
+ searchCandidates: number;
61
+ maxCandidates: number;
62
+ }
63
+
64
+ export interface UpdateLocalizationDeps {
65
+ storage: UpdateLocalizationStorage;
66
+ qmdSearch: (query: string, limit: number) => Promise<UpdateLocalizationSearchHit[]>;
67
+ }
68
+
69
+ function cap(value: number): number {
70
+ return Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0;
71
+ }
72
+
73
+ function normalizeEntityRef(value: unknown): string | undefined {
74
+ if (typeof value !== "string") return undefined;
75
+ const normalized = normalizeSupersessionKey(value);
76
+ return normalized.length > 0 ? normalized : undefined;
77
+ }
78
+
79
+ function compareCandidates(left: LocalizedCandidate, right: LocalizedCandidate): number {
80
+ const leftScore = Number.isFinite(left.score) ? left.score : Number.NEGATIVE_INFINITY;
81
+ const rightScore = Number.isFinite(right.score) ? right.score : Number.NEGATIVE_INFINITY;
82
+ if (leftScore !== rightScore) return leftScore > rightScore ? -1 : 1;
83
+ return left.id < right.id ? -1 : left.id > right.id ? 1 : 0;
84
+ }
85
+
86
+ function anchorScore(memory: MemoryFile, anchor: UpdateAnchor): number {
87
+ const attributes = anchor.attributes;
88
+ if (attributes && Object.keys(attributes).length > 0) {
89
+ const candidateAttributes = memory.frontmatter.structuredAttributes;
90
+ if (!candidateAttributes) return 0;
91
+ let overlap = 0;
92
+ for (const key of Object.keys(attributes)) {
93
+ if (lookupAttributeByNormalizedKey(candidateAttributes, key) !== undefined) overlap++;
94
+ }
95
+ return overlap;
96
+ }
97
+
98
+ const created = Date.parse(memory.frontmatter.created);
99
+ return Number.isFinite(created) ? created : 0;
100
+ }
101
+
102
+ function toAnchorCandidate(memory: MemoryFile, anchor: UpdateAnchor): LocalizedCandidate {
103
+ return {
104
+ id: memory.frontmatter.id,
105
+ content: memory.content,
106
+ category: memory.frontmatter.category,
107
+ source: "anchor",
108
+ score: anchorScore(memory, anchor),
109
+ };
110
+ }
111
+
112
+ export function inferLocalizationMemoryStatus(
113
+ memory: MemoryFile,
114
+ storageDir?: string,
115
+ ): MemoryStatus {
116
+ const pathRel = storageDir ? toMemoryPathRel(storageDir, memory.path) : memory.path;
117
+ return inferMemoryStatus(memory.frontmatter, pathRel);
118
+ }
119
+
120
+ export async function localizeUpdateCandidates(
121
+ deps: UpdateLocalizationDeps,
122
+ anchor: UpdateAnchor,
123
+ newContent: string,
124
+ options: UpdateLocalizationOptions,
125
+ ): Promise<LocalizedCandidate[]> {
126
+ const maxCandidates = cap(options.maxCandidates);
127
+ if (maxCandidates === 0) return [];
128
+
129
+ const anchorLimit = cap(options.anchorCandidates);
130
+ const searchLimit = cap(options.searchCandidates);
131
+ const anchorCandidates: LocalizedCandidate[] = [];
132
+ const normalizedAnchorEntityRef = normalizeEntityRef(anchor.entityRef);
133
+ if (normalizedAnchorEntityRef !== undefined && anchorLimit > 0) {
134
+ const hot = await deps.storage.readAllMemories();
135
+ const cold = deps.storage.readAllColdMemories ? await deps.storage.readAllColdMemories() : [];
136
+ const memories = mergeMemorySnapshots(hot, cold, deps.storage.dir);
137
+ for (const memory of memories) {
138
+ if (inferLocalizationMemoryStatus(memory, deps.storage.dir) !== "active") continue;
139
+ const normalizedCandidateEntityRef = normalizeEntityRef(memory.frontmatter.entityRef);
140
+ if (normalizedCandidateEntityRef !== normalizedAnchorEntityRef) continue;
141
+ if (memory.frontmatter.category !== anchor.category) continue;
142
+ anchorCandidates.push(toAnchorCandidate(memory, anchor));
143
+ }
144
+ anchorCandidates.sort(compareCandidates);
145
+ anchorCandidates.splice(anchorLimit);
146
+ }
147
+
148
+ const searchCandidates: LocalizedCandidate[] = [];
149
+ if (searchLimit > 0) {
150
+ const searchHits = await deps.qmdSearch(newContent, searchLimit);
151
+ for (const hit of searchHits) {
152
+ searchCandidates.push({
153
+ id: hit.id,
154
+ content: hit.content,
155
+ category: hit.category,
156
+ source: "search",
157
+ score: hit.score,
158
+ });
159
+ }
160
+ searchCandidates.sort(compareCandidates);
161
+ searchCandidates.splice(searchLimit);
162
+ }
163
+
164
+ const merged: LocalizedCandidate[] = [];
165
+ const seen = new Set<string>();
166
+ for (const candidate of [...anchorCandidates, ...searchCandidates]) {
167
+ if (seen.has(candidate.id)) continue;
168
+ seen.add(candidate.id);
169
+ merged.push(candidate);
170
+ if (merged.length >= maxCandidates) break;
171
+ }
172
+ return merged;
173
+ }
@@ -111,7 +111,10 @@ import {
111
111
  type RecallSectionBuckets,
112
112
  } from "./orchestration/recall-section-coordinator.js";
113
113
  import { QmdResultResolver, qmdCollectionPathParts, qmdResultPathCandidates } from "./orchestration/qmd-result-resolver.js";
114
- import { ContradictionLinkingCoordinator } from "./orchestration/contradiction-linking-coordinator.js";
114
+ import {
115
+ ContradictionLinkingCoordinator,
116
+ type ContradictionResolveOutcome,
117
+ } from "./orchestration/contradiction-linking-coordinator.js";
115
118
  import {
116
119
  ExtractionRunCoordinator,
117
120
  type ExtractionRunResult,
@@ -121,6 +124,7 @@ import { ConsolidationRunCoordinator } from "./orchestration/consolidation-run.j
121
124
  import { ExtractionPersistCoordinator } from "./orchestration/extraction-persist.js";
122
125
  import { RecallInternalCoordinator } from "./orchestration/recall-internal.js";
123
126
  import { RecallSearchPipelineCoordinator } from "./orchestration/recall-search-pipeline.js";
127
+ import type { GraphRecallExpansionOptions, GraphRecallExpansionResult } from "./orchestration/graph-recall-seam.js";
124
128
  import type { ArtifactRecallOptions } from "./orchestration/recall-search-prefilter.js";
125
129
  import type { CorpusReadOptions } from "./corpus-read-cancellation.js";
126
130
  import { TurnIngestionCoordinator, type TurnIngestionOptions } from "./orchestration/turn-ingestion.js";
@@ -845,8 +849,8 @@ export class Orchestrator {
845
849
  routeEngineOptions: () => this.routeEngineOptions(),
846
850
  semanticDedupLookup: (content, limit, targetStorage) =>
847
851
  this.semanticDedupLookup(content, limit, targetStorage),
848
- checkForContradiction: (content, category, namespaceScope) =>
849
- this.checkForContradiction(content, category, namespaceScope),
852
+ checkForContradiction: (content, category, namespaceScope, anchor) =>
853
+ this.checkForContradiction(content, category, namespaceScope, anchor),
850
854
  applyDeferredContradictionResolve: (contradiction, storage, newMemoryId, postWriteGuard) =>
851
855
  this.applyDeferredContradictionResolve(contradiction, storage, newMemoryId, postWriteGuard),
852
856
  suggestLinksForMemory: (content, category, namespaceScope) =>
@@ -2550,22 +2554,14 @@ export class Orchestrator {
2550
2554
  }
2551
2555
 
2552
2556
  // Issue #1526 (seam 14): graph-recall expansion moved to
2553
- // GraphRecallCoordinator. Thin delegation keeps the private API stable
2554
- // for callers (recallInternal, cold-fallback pipeline) + tests.
2555
- private async expandResultsViaGraph(options: {
2556
- memoryResults: QmdSearchResult[];
2557
- recallNamespaces: string[];
2558
- recallResultLimit: number;
2559
- deadlineAtMs?: number | null;
2560
- includeLowConfidence?: boolean;
2561
- }): Promise<{
2562
- merged: QmdSearchResult[];
2563
- seedPaths: string[];
2564
- expandedPaths: GraphRecallExpandedEntry[];
2565
- seedResults: QmdSearchResult[];
2566
- }> {
2557
+ // GraphRecallCoordinator. Keep this public seam so callers and tests can
2558
+ // override graph expansion on the orchestrator instance.
2559
+ async expandResultsViaGraph(
2560
+ options: GraphRecallExpansionOptions,
2561
+ ): Promise<GraphRecallExpansionResult> {
2567
2562
  return this.graphRecallCoordinator.expandResultsViaGraph(options);
2568
2563
  }
2564
+
2569
2565
  private async recordLastGraphRecallSnapshot(options: {
2570
2566
  storage: StorageManager;
2571
2567
  prompt: string;
@@ -3875,6 +3871,10 @@ export class Orchestrator {
3875
3871
  content: string,
3876
3872
  category: string,
3877
3873
  namespaceScope: string,
3874
+ anchor?: {
3875
+ entityRef?: string;
3876
+ structuredAttributes?: Record<string, string>;
3877
+ },
3878
3878
  ): Promise<{
3879
3879
  supersededId: string;
3880
3880
  confidence: number;
@@ -3887,6 +3887,7 @@ export class Orchestrator {
3887
3887
  content,
3888
3888
  category,
3889
3889
  namespaceScope,
3890
+ anchor,
3890
3891
  );
3891
3892
  }
3892
3893
 
@@ -3909,7 +3910,7 @@ export class Orchestrator {
3909
3910
  storage: StorageManager,
3910
3911
  newMemoryId: string,
3911
3912
  postWriteGuard: boolean,
3912
- ): Promise<void> {
3913
+ ): Promise<ContradictionResolveOutcome> {
3913
3914
  return this.contradictionLinkingCoordinator.applyDeferredContradictionResolve(
3914
3915
  contradiction,
3915
3916
  storage,
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, wri
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
6
 
7
- import { LastRecallStore } from "./recall-state.js";
7
+ import { clampGraphRecallExpandedEntries, LastRecallStore } from "./recall-state.js";
8
8
  import type { RecallTierExplain } from "./types.js";
9
9
  import { listContainedSpillFiles } from "./utils/path-containment.js";
10
10
 
@@ -15,6 +15,34 @@ async function freshStore() {
15
15
  return { store, dir };
16
16
  }
17
17
 
18
+
19
+ test("clampGraphRecallExpandedEntries caps path provenance and preserves legacy omission", () => {
20
+ const pathNodeIds = Array.from({ length: 80 }, (_, index) => `node-${index}`);
21
+ const [current, legacy] = clampGraphRecallExpandedEntries([
22
+ {
23
+ path: "current.md",
24
+ score: 1,
25
+ namespace: "default",
26
+ seed: "seed",
27
+ hopDepth: 1,
28
+ decayedWeight: 1,
29
+ graphType: "entity",
30
+ pathNodeIds,
31
+ },
32
+ {
33
+ path: "legacy.md",
34
+ score: 1,
35
+ namespace: "default",
36
+ seed: "seed",
37
+ hopDepth: 1,
38
+ decayedWeight: 1,
39
+ graphType: "entity",
40
+ },
41
+ ]);
42
+ assert.equal(current?.pathNodeIds?.length, 64);
43
+ assert.deepEqual(current?.pathNodeIds, pathNodeIds.slice(0, 64));
44
+ assert.equal("pathNodeIds" in (legacy ?? {}), false);
45
+ });
18
46
  // ── Tier-explain field is optional and absent by default ───────────────────
19
47
 
20
48
  test("LastRecallStore.record omits tierExplain when caller did not provide it", async () => {
@@ -93,6 +93,10 @@ export interface GraphRecallExpandedEntry {
93
93
  * round-trip through `clampGraphRecallExpandedEntries` without dropping.
94
94
  */
95
95
  edgeConfidence?: number;
96
+ /** Graph-relative activation path node ids when provenance is enabled. */
97
+ pathNodeIds?: string[];
98
+ /** True when a graph path penalty was applied. */
99
+ pathPenaltyApplied?: boolean;
96
100
  }
97
101
 
98
102
  export function clampGraphRecallExpandedEntries(
@@ -132,6 +136,15 @@ export function clampGraphRecallExpandedEntries(
132
136
  ) {
133
137
  out.edgeConfidence = Math.min(1, Math.max(0, item.edgeConfidence));
134
138
  }
139
+ if (
140
+ Array.isArray(item.pathNodeIds) &&
141
+ item.pathNodeIds.every((value): value is string => typeof value === "string")
142
+ ) {
143
+ out.pathNodeIds = item.pathNodeIds.slice(0, 64);
144
+ }
145
+ if (typeof item.pathPenaltyApplied === "boolean") {
146
+ out.pathPenaltyApplied = item.pathPenaltyApplied;
147
+ }
135
148
  return out;
136
149
  })
137
150
  .filter((item) => item.path.length > 0 && item.namespace.length > 0)
@@ -191,6 +191,51 @@ test("renderXrayText matches golden output for a full snapshot", () => {
191
191
  assert.equal(out, expected);
192
192
  });
193
193
 
194
+ test("renderers omit disabled graph path penalty and node fields", () => {
195
+ const snap = fullSnapshot();
196
+ const text = renderXrayText(snap);
197
+ const markdown = renderXrayMarkdown(snap);
198
+ assert.ok(text.includes("graph-path: mem-root -> mem-1"));
199
+ assert.ok(markdown.includes("**Graph path:** `mem-root` → `mem-1`"));
200
+ for (const output of [text, markdown]) {
201
+ assert.equal(output.includes("path-penalty"), false);
202
+ assert.equal(output.includes("path-node-ids"), false);
203
+ assert.equal(output.includes("Path penalty"), false);
204
+ assert.equal(output.includes("Path node ids"), false);
205
+ }
206
+ });
207
+
208
+ test("renderers emit path provenance fields when enabled", () => {
209
+ const snap = fullSnapshot();
210
+ const withPathProvenance: RecallXraySnapshot = {
211
+ ...snap,
212
+ results: [
213
+ {
214
+ ...snap.results[0],
215
+ pathPenaltyApplied: true,
216
+ pathNodeIds: ["activation-root", "activation-mid", "mem-1"],
217
+ },
218
+ ...snap.results.slice(1),
219
+ ],
220
+ };
221
+
222
+ const text = renderXrayText(withPathProvenance);
223
+ assert.ok(text.includes(" path-penalty: yes"));
224
+ assert.ok(
225
+ text.includes(
226
+ " path-node-ids: activation-root -> activation-mid -> mem-1",
227
+ ),
228
+ );
229
+
230
+ const markdown = renderXrayMarkdown(withPathProvenance);
231
+ assert.ok(markdown.includes("- **Path penalty applied:** `yes`"));
232
+ assert.ok(
233
+ markdown.includes(
234
+ "- **Path node ids:** `activation-root` → `activation-mid` → `mem-1`",
235
+ ),
236
+ );
237
+ });
238
+
194
239
  test("renderXrayText handles the minimal/empty case", () => {
195
240
  const out = renderXrayText(minimalSnapshot());
196
241
  const expected = [
@@ -203,6 +203,12 @@ function renderResultTextLines(
203
203
  );
204
204
  }
205
205
  }
206
+ if (result.pathPenaltyApplied !== undefined) {
207
+ lines.push(` path-penalty: ${result.pathPenaltyApplied ? "yes" : "no"}`);
208
+ }
209
+ if (result.pathNodeIds && result.pathNodeIds.length > 0) {
210
+ lines.push(` path-node-ids: ${result.pathNodeIds.join(" -> ")}`);
211
+ }
206
212
  if (result.auditEntryId) {
207
213
  lines.push(` audit-entry: ${result.auditEntryId}`);
208
214
  }
@@ -414,6 +420,16 @@ function renderResultMarkdownLines(
414
420
  );
415
421
  }
416
422
  }
423
+ if (result.pathPenaltyApplied !== undefined) {
424
+ lines.push(
425
+ `- **Path penalty applied:** ${mdInlineCode(result.pathPenaltyApplied ? "yes" : "no")}`,
426
+ );
427
+ }
428
+ if (result.pathNodeIds && result.pathNodeIds.length > 0) {
429
+ lines.push(
430
+ `- **Path node ids:** ${result.pathNodeIds.map(mdInlineCode).join(" → ")}`,
431
+ );
432
+ }
417
433
  if (result.auditEntryId) {
418
434
  lines.push(`- **Audit entry:** \`${result.auditEntryId}\``);
419
435
  }
@@ -130,6 +130,10 @@ export interface RecallXrayResult {
130
130
  * empty or absent so legacy snapshots round-trip cleanly.
131
131
  */
132
132
  graphEdgeConfidences?: number[];
133
+ /** Graph activation node ids recorded for path-scoring provenance. */
134
+ pathNodeIds?: string[];
135
+ /** True when a graph path penalty was applied. */
136
+ pathPenaltyApplied?: boolean;
133
137
  auditEntryId?: string;
134
138
  /** Human-readable list of filters the candidate *passed*. */
135
139
  admittedBy: string[];
@@ -518,6 +522,13 @@ function cloneResult(result: RecallXrayResult): RecallXrayResult {
518
522
  }
519
523
  }
520
524
  }
525
+ const pathNodeIds = Array.isArray(result.pathNodeIds)
526
+ ? result.pathNodeIds.filter((x): x is string => typeof x === "string")
527
+ : undefined;
528
+ const pathPenaltyApplied =
529
+ typeof result.pathPenaltyApplied === "boolean"
530
+ ? result.pathPenaltyApplied
531
+ : undefined;
521
532
  const auditEntryId = nonEmptyString(result.auditEntryId);
522
533
  const rejectedBy = nonEmptyString(result.rejectedBy);
523
534
  const scoreDecomposition = cloneScoreDecomposition(result.scoreDecomposition);
@@ -532,6 +543,8 @@ function cloneResult(result: RecallXrayResult): RecallXrayResult {
532
543
  if (graphEdgeConfidences !== undefined) {
533
544
  out.graphEdgeConfidences = graphEdgeConfidences;
534
545
  }
546
+ if (pathNodeIds !== undefined) out.pathNodeIds = pathNodeIds;
547
+ if (pathPenaltyApplied !== undefined) out.pathPenaltyApplied = pathPenaltyApplied;
535
548
  if (auditEntryId !== undefined) out.auditEntryId = auditEntryId;
536
549
  if (rejectedBy !== undefined) out.rejectedBy = rejectedBy;
537
550
  // Disclosure + token telemetry (issue #677 PR 3/4). Only attach when
@@ -0,0 +1,97 @@
1
+ import {
2
+ buildRetiredFactTombstoneInputs,
3
+ type TombstoneCreatedBy,
4
+ type TombstoneReason,
5
+ } from "../lifecycle/tombstones.js";
6
+ import { supersessionKeysForFact } from "../temporal-supersession.js";
7
+ import { stripCitationForTemplate } from "../source-attribution.js";
8
+ import type { MemoryFile, MemoryFrontmatter } from "../types.js";
9
+ import { composeMemoryEnvelope, type SealedMemoryEnvelope } from "../write-envelope.js";
10
+ import { log } from "../logger.js";
11
+
12
+ type TombstoneInput = {
13
+ reason: TombstoneReason;
14
+ createdBy: TombstoneCreatedBy;
15
+ sourceMemoryId: string;
16
+ rawContent: string;
17
+ entityRef?: string;
18
+ supersessionKey?: string;
19
+ createdAt?: string;
20
+ contentHash?: string;
21
+ };
22
+
23
+ export interface SupersessionSideEffectOptions {
24
+ oldMemoryId: string;
25
+ newMemoryId: string;
26
+ reason: string;
27
+ now: string;
28
+ currentBefore: MemoryFile;
29
+ updatedFm: MemoryFrontmatter;
30
+ citationTemplate: string;
31
+ isColdOrArchiveTierPath: (memoryPath: string) => boolean;
32
+ invalidateColdMemoriesCache: () => void;
33
+ bumpMemoryCorpusVersion: () => void;
34
+ appendLifecycleEvent: () => Promise<void>;
35
+ bumpMemoryStatusVersion: () => void;
36
+ appendTombstone: (input: TombstoneInput) => Promise<string | null>;
37
+ writeSealedMemory: (envelope: SealedMemoryEnvelope, extras: { lineage: [string, string] }) => Promise<unknown>;
38
+ }
39
+
40
+ export async function runSupersessionSideEffects(options: SupersessionSideEffectOptions): Promise<void> {
41
+ const {
42
+ oldMemoryId,
43
+ newMemoryId,
44
+ reason,
45
+ now,
46
+ currentBefore,
47
+ updatedFm,
48
+ citationTemplate,
49
+ isColdOrArchiveTierPath,
50
+ invalidateColdMemoriesCache,
51
+ bumpMemoryCorpusVersion,
52
+ appendLifecycleEvent,
53
+ bumpMemoryStatusVersion,
54
+ appendTombstone,
55
+ writeSealedMemory,
56
+ } = options;
57
+ try {
58
+ if (isColdOrArchiveTierPath(currentBefore.path)) invalidateColdMemoriesCache();
59
+ bumpMemoryCorpusVersion();
60
+ await appendLifecycleEvent();
61
+ bumpMemoryStatusVersion();
62
+ log.debug(`superseded memory ${oldMemoryId} by ${newMemoryId}: ${reason}`);
63
+
64
+ if (currentBefore.frontmatter.category === "fact") {
65
+ for (const input of buildRetiredFactTombstoneInputs(
66
+ {
67
+ id: oldMemoryId,
68
+ content: stripCitationForTemplate(currentBefore.content, citationTemplate),
69
+ contentHash: currentBefore.frontmatter.contentHash,
70
+ entityRef: updatedFm.entityRef,
71
+ structuredAttributes: currentBefore.frontmatter.structuredAttributes,
72
+ },
73
+ {
74
+ reason: "contradiction_resolution",
75
+ createdBy: "contradiction_resolution",
76
+ createdAt: now,
77
+ supersessionKeysForFact,
78
+ },
79
+ )) {
80
+ await appendTombstone(input);
81
+ }
82
+ }
83
+
84
+ const auditEnvelope = composeMemoryEnvelope(
85
+ {
86
+ content: `Superseded: ${currentBefore.content}\n\nReason: ${reason}`,
87
+ category: "correction",
88
+ confidence: 1.0,
89
+ tags: ["supersession", "auto-resolved"],
90
+ },
91
+ { source: "contradiction-detection" },
92
+ );
93
+ await writeSealedMemory(auditEnvelope, { lineage: [oldMemoryId, newMemoryId] });
94
+ } catch (err) {
95
+ log.error(`failed to supersede memory ${oldMemoryId}:`, err);
96
+ }
97
+ }
@@ -10,6 +10,7 @@ import { isErrnoCode } from "../utils/errno.js";
10
10
  import { pathMayCarryEntityRefs, requestEntityCanonicalIdReconcile } from "./entity-canonical-id-references.js";
11
11
  import { withRawEntityPageMutation } from "./entity-canonical-id-lock.js";
12
12
  import { readMaybeEncryptedFileFromChunks, writeMaybeEncryptedFileFromChunks } from "../secure-store/secure-fs.js";
13
+ import * as archiveMutation from "../archive-mutation-version.js";
13
14
  import {
14
15
  buildExplicitCaptureDedupKey,
15
16
  buildCapturePathLockIdentity,
@@ -455,7 +456,11 @@ export abstract class TombstoneBlockedCaptureIndexHost {
455
456
  : before.content === incoming.content && isDeepStrictEqual(before.frontmatter, incoming.frontmatter);
456
457
  }
457
458
 
458
- private async invalidateAfterOfflineSyncMutation(filePath: string, ownedMarker?: string): Promise<void> {
459
+ private async invalidateAfterOfflineSyncMutation(
460
+ filePath: string,
461
+ ownedMarker?: string,
462
+ archiveChanged = true
463
+ ): Promise<void> {
459
464
  this.invalidateAllMemoriesCache();
460
465
  this.invalidateKnowledgeIndexCache();
461
466
  this.markFactHashIndexNotAuthoritative();
@@ -466,6 +471,8 @@ export abstract class TombstoneBlockedCaptureIndexHost {
466
471
  if (filePath.includes(`${path.sep}artifacts${path.sep}`)) {
467
472
  this.bumpArtifactWriteVersion();
468
473
  }
474
+ const memoryDir = this.tombstoneBlockedCaptureIndexOptions().memoryDir;
475
+ archiveMutation.bumpArchiveMutationForPath(memoryDir, archiveChanged, filePath);
469
476
  this.bumpMemoryStatusVersion();
470
477
  }
471
478
 
@@ -571,6 +578,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
571
578
  markDurable();
572
579
  deleted = current;
573
580
  const memoryDir = this.tombstoneBlockedCaptureIndexOptions().memoryDir;
581
+ archiveMutation.bumpArchiveMutationForPath(memoryDir, true, current.path);
574
582
  markProjectedMemoryPathInvalid(memoryDir, current.frontmatter.id);
575
583
  this.invalidateAllMemoriesCache();
576
584
  if (current.path.includes(`${path.sep}cold${path.sep}`)) {
@@ -590,7 +598,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
590
598
  protected async runTombstoneBlockedOfflineSyncMutation(
591
599
  target: string,
592
600
  after: MemoryFile | null,
593
- write: () => Promise<void>,
601
+ write: () => Promise<boolean | void>,
594
602
  coordinate = false,
595
603
  streamedIdentity?: StreamedOfflineSyncIdentity
596
604
  ): Promise<void> {
@@ -626,7 +634,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
626
634
  const marker = affectsBlockedIndex ? await this.getTombstoneBlockedCaptureIndex().prepareWrite() : undefined;
627
635
  let durable = false;
628
636
  try {
629
- await write();
637
+ const changed = await write();
630
638
  durable = true;
631
639
  if (marker) {
632
640
  try {
@@ -636,7 +644,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
636
644
  log.warn(`storage.offlineSyncFile committed write marker failed: ${err}`);
637
645
  }
638
646
  }
639
- await this.invalidateAfterOfflineSyncMutation(target, marker);
647
+ await this.invalidateAfterOfflineSyncMutation(target, marker, changed !== false);
640
648
  } catch (err) {
641
649
  if (marker && !durable) {
642
650
  try {
@@ -901,7 +909,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
901
909
  const stateDir = this.tombstoneBlockedCaptureIndexOptions().stateDir;
902
910
  await withRawEntityPageMutation(path.dirname(stateDir), target, async () => {
903
911
  await this.runTombstoneBlockedOfflineSyncMutation(target, null, async () => {
904
- await this.deleteManagedStorageFile(target, deletionMtimeMs);
912
+ return await this.deleteManagedStorageFile(target, deletionMtimeMs);
905
913
  });
906
914
  });
907
915
  }