@remnic/core 9.62.1 → 9.63.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 (484) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +26 -26
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.d.ts +11 -11
  5. package/dist/access-authorization-probe.js +27 -27
  6. package/dist/access-boundary.d.ts +11 -11
  7. package/dist/access-boundary.js +26 -26
  8. package/dist/access-cli.js +88 -86
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-coding-context-resolution.d.ts +1 -1
  11. package/dist/access-extraction-force-flush.d.ts +11 -11
  12. package/dist/access-extraction-force-flush.js +26 -26
  13. package/dist/access-health-types.d.ts +1 -1
  14. package/dist/access-http-lcm-compaction.d.ts +11 -11
  15. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  16. package/dist/access-http-offline-stream.d.ts +11 -11
  17. package/dist/access-http-query.js +26 -26
  18. package/dist/access-http.d.ts +12 -12
  19. package/dist/access-http.js +36 -36
  20. package/dist/access-identity-continuity-surface.d.ts +9 -9
  21. package/dist/access-identity-continuity-surface.js +26 -26
  22. package/dist/access-lcm-surface.d.ts +11 -11
  23. package/dist/access-lcm-surface.js +26 -26
  24. package/dist/access-mcp.d.ts +11 -11
  25. package/dist/access-mcp.js +31 -31
  26. package/dist/access-memory-search-fanout.d.ts +2 -2
  27. package/dist/{access-namespace-preflight-EMvicnrb.d.ts → access-namespace-preflight-yO4LMGFH.d.ts} +1 -1
  28. package/dist/access-namespace-preflight.d.ts +3 -3
  29. package/dist/access-namespace-preflight.js +26 -26
  30. package/dist/access-observe-write-surface.d.ts +11 -11
  31. package/dist/access-observe-write-surface.js +26 -26
  32. package/dist/access-offline-manifest.d.ts +9 -9
  33. package/dist/access-offline-manifest.js +2 -2
  34. package/dist/access-operations-batch.js +27 -27
  35. package/dist/access-operations.d.ts +11 -11
  36. package/dist/access-operations.js +30 -30
  37. package/dist/access-recall-concurrency.d.ts +11 -11
  38. package/dist/access-recall-concurrency.js +26 -26
  39. package/dist/access-recall-response.d.ts +11 -11
  40. package/dist/access-recall-response.js +26 -26
  41. package/dist/access-recall-surface.d.ts +11 -11
  42. package/dist/access-recall-surface.js +26 -26
  43. package/dist/{access-service-BeDYQQ62.d.ts → access-service-M4LgO141.d.ts} +7 -7
  44. package/dist/access-service-helpers.d.ts +11 -11
  45. package/dist/access-service.d.ts +11 -11
  46. package/dist/access-service.js +26 -26
  47. package/dist/access-surface-catalog.d.ts +11 -11
  48. package/dist/access-surface-catalog.js +28 -28
  49. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  50. package/dist/action-confidence.d.ts +1 -1
  51. package/dist/active-memory-bridge.d.ts +1 -1
  52. package/dist/active-recall.d.ts +1 -1
  53. package/dist/active-recall.js +1 -1
  54. package/dist/ambient-provenance.d.ts +1 -1
  55. package/dist/artifact-search.d.ts +1 -1
  56. package/dist/{auto-sync-FMWQQB3J.js → auto-sync-Z52VWMNC.js} +3 -3
  57. package/dist/behavior-learner.d.ts +1 -1
  58. package/dist/behavior-learner.js +2 -2
  59. package/dist/behavior-signals.d.ts +1 -1
  60. package/dist/bootstrap.d.ts +9 -9
  61. package/dist/briefing-window.d.ts +2 -2
  62. package/dist/briefing.d.ts +2 -2
  63. package/dist/briefing.js +11 -10
  64. package/dist/buffer-surprise-report.d.ts +1 -1
  65. package/dist/buffer-turn-helpers.d.ts +1 -1
  66. package/dist/buffer.d.ts +2 -2
  67. package/dist/bulk-import/index.d.ts +3 -3
  68. package/dist/calibration.d.ts +1 -1
  69. package/dist/capabilities.d.ts +1 -1
  70. package/dist/{catalog-B2SxZ6LU.d.ts → catalog-CyYTf_ok.d.ts} +1 -1
  71. package/dist/causal-behavior.d.ts +1 -1
  72. package/dist/causal-behavior.js +3 -3
  73. package/dist/causal-chain.js +3 -3
  74. package/dist/causal-consolidation.d.ts +1 -1
  75. package/dist/causal-consolidation.js +14 -14
  76. package/dist/causal-retrieval.js +3 -3
  77. package/dist/causal-trajectory-graph.d.ts +1 -1
  78. package/dist/causal-trajectory.js +2 -2
  79. package/dist/{chunk-B2QHVLJO.js → chunk-256FBCVX.js} +22 -10
  80. package/dist/chunk-256FBCVX.js.map +1 -0
  81. package/dist/{chunk-QP2IZTUR.js → chunk-2TYIAKU5.js} +2 -2
  82. package/dist/{chunk-QNMNNFKD.js → chunk-347ZR6D4.js} +2 -2
  83. package/dist/{chunk-76YNCJ5H.js → chunk-3F3CVVDS.js} +2 -2
  84. package/dist/{chunk-KCFZOSR6.js → chunk-3MA7JVXN.js} +4 -4
  85. package/dist/{chunk-KHQ57QLJ.js → chunk-46WM6JX2.js} +7 -3
  86. package/dist/chunk-46WM6JX2.js.map +1 -0
  87. package/dist/chunk-47DU4SGJ.js +92 -0
  88. package/dist/chunk-47DU4SGJ.js.map +1 -0
  89. package/dist/{chunk-HKYNBEL4.js → chunk-4FFROSFG.js} +37 -14
  90. package/dist/{chunk-HKYNBEL4.js.map → chunk-4FFROSFG.js.map} +1 -1
  91. package/dist/{chunk-TLUSSS2F.js → chunk-4HO3542O.js} +2 -2
  92. package/dist/{chunk-4E67XCT2.js → chunk-4IZ2IT7D.js} +3 -3
  93. package/dist/{chunk-33JBK2XP.js → chunk-5F6HMNMZ.js} +2 -2
  94. package/dist/{chunk-5WQMORU5.js → chunk-5PFGMO33.js} +2 -2
  95. package/dist/{chunk-6HEM6HTQ.js → chunk-6GGTATZF.js} +2 -2
  96. package/dist/{chunk-UIRU3MIJ.js → chunk-7BJYTX6Q.js} +2 -2
  97. package/dist/{chunk-2GRLJMKJ.js → chunk-7DRSWPUV.js} +3 -3
  98. package/dist/{chunk-TVVEYCNW.js → chunk-7K5Q6COX.js} +4 -4
  99. package/dist/{chunk-HXXGZ4KV.js → chunk-ALNZEWGN.js} +2 -2
  100. package/dist/{chunk-5WVUO6QT.js → chunk-AR253JBM.js} +1 -1
  101. package/dist/chunk-AR253JBM.js.map +1 -0
  102. package/dist/{chunk-67MKNKJQ.js → chunk-AYIHDC5S.js} +2 -2
  103. package/dist/{chunk-IXJ5U6ZL.js → chunk-BBHFAVMP.js} +8 -8
  104. package/dist/{chunk-IIRK5V5Z.js → chunk-BHO6RHE5.js} +3 -3
  105. package/dist/{chunk-WANOCU3K.js → chunk-BP6WMYLP.js} +3 -3
  106. package/dist/{chunk-ZJKLGS76.js → chunk-CALURYWR.js} +283 -248
  107. package/dist/chunk-CALURYWR.js.map +1 -0
  108. package/dist/{chunk-JLMH5YMU.js → chunk-CH627RRV.js} +2 -2
  109. package/dist/{chunk-XIABRKF6.js → chunk-CLJ5QS6J.js} +239 -47
  110. package/dist/chunk-CLJ5QS6J.js.map +1 -0
  111. package/dist/{chunk-YLHM5BQQ.js → chunk-DCUMFQYM.js} +171 -8
  112. package/dist/chunk-DCUMFQYM.js.map +1 -0
  113. package/dist/{chunk-ZBJMUXZH.js → chunk-DJ7HMNSL.js} +15 -8
  114. package/dist/chunk-DJ7HMNSL.js.map +1 -0
  115. package/dist/{chunk-WTMG5GAK.js → chunk-DROAPP6N.js} +3 -3
  116. package/dist/{chunk-PBH2Z2NY.js → chunk-DTLF2SLZ.js} +2 -2
  117. package/dist/{chunk-7JAXC526.js → chunk-EFWHCTYJ.js} +2 -2
  118. package/dist/{chunk-3XG4QEA2.js → chunk-FF6E6HOT.js} +39 -39
  119. package/dist/{chunk-NP7FLVZW.js → chunk-G2FCSILA.js} +2 -2
  120. package/dist/{chunk-7PVTOZR4.js → chunk-H23GIXJC.js} +2 -2
  121. package/dist/{chunk-WT6UL3UA.js → chunk-H7PRHUBD.js} +2 -2
  122. package/dist/{chunk-ETCVSZLG.js → chunk-HSBQJRV2.js} +2 -2
  123. package/dist/{chunk-GZRDOVQN.js → chunk-HVKMJAEF.js} +2 -2
  124. package/dist/{chunk-CSOYVTRX.js → chunk-IIPJKCZB.js} +3 -3
  125. package/dist/{chunk-E57E5SCS.js → chunk-IRLH4NM2.js} +3 -3
  126. package/dist/{chunk-4G45LJJP.js → chunk-IZRNVNPV.js} +2 -2
  127. package/dist/{chunk-YSUSUZR4.js → chunk-JCJGYNIS.js} +3 -3
  128. package/dist/{chunk-EU74U4GT.js → chunk-JDI7G6EA.js} +2 -2
  129. package/dist/{chunk-QWPAQLYV.js → chunk-JFLKSD5V.js} +2 -2
  130. package/dist/{chunk-KQS72GCR.js → chunk-LJOIZPJH.js} +2 -2
  131. package/dist/{chunk-U27G4E5G.js → chunk-LLGDVG52.js} +3 -3
  132. package/dist/{chunk-7N7DB4L5.js → chunk-LTJTP5YQ.js} +10 -9
  133. package/dist/chunk-LTJTP5YQ.js.map +1 -0
  134. package/dist/{chunk-XL3TATMJ.js → chunk-OQIRBGUU.js} +21 -12
  135. package/dist/chunk-OQIRBGUU.js.map +1 -0
  136. package/dist/{chunk-JGW2EUCQ.js → chunk-PMRUMGK6.js} +2 -2
  137. package/dist/{chunk-3G6YU5YD.js → chunk-PSNN25DW.js} +2 -2
  138. package/dist/{chunk-LRGSLV7M.js → chunk-PYHOAXTI.js} +4 -4
  139. package/dist/{chunk-75U2FR7U.js → chunk-QCI73Z7C.js} +2 -2
  140. package/dist/{chunk-EHMMRZOZ.js → chunk-QICOU4RY.js} +2 -2
  141. package/dist/{chunk-K4WIUTNH.js → chunk-RFH7U5LT.js} +2 -2
  142. package/dist/{chunk-4SGDYYWV.js → chunk-RPKJHYVE.js} +2 -2
  143. package/dist/{chunk-BHO3IVAN.js → chunk-RYST72N5.js} +12 -1
  144. package/dist/chunk-RYST72N5.js.map +1 -0
  145. package/dist/chunk-T3GIETKV.js +152 -0
  146. package/dist/chunk-T3GIETKV.js.map +1 -0
  147. package/dist/{chunk-DYDACAK2.js → chunk-TGSMU3F2.js} +3 -3
  148. package/dist/{chunk-MJFDJTDC.js → chunk-TIRJV2LW.js} +2 -2
  149. package/dist/{chunk-QRA3XVJX.js → chunk-UDTME32W.js} +2 -2
  150. package/dist/{chunk-LAM6UDFV.js → chunk-WMOJIOIG.js} +2 -2
  151. package/dist/{chunk-LLLY5IBK.js → chunk-WR2YKUIW.js} +2 -2
  152. package/dist/{chunk-KYI3CM42.js → chunk-X6E7TT3A.js} +2 -2
  153. package/dist/{chunk-QN7XQEIT.js → chunk-YIIC5IDU.js} +2 -2
  154. package/dist/{chunk-JDJOAL4B.js → chunk-YSR3DXGC.js} +2 -2
  155. package/dist/{chunk-LBJBNWS2.js → chunk-YTHQHH5U.js} +2 -2
  156. package/dist/{chunk-JF6YSHJM.js → chunk-ZPGHA7EO.js} +12 -12
  157. package/dist/{chunk-VUDALPI5.js → chunk-ZQKXRKMR.js} +19 -5
  158. package/dist/chunk-ZQKXRKMR.js.map +1 -0
  159. package/dist/{chunk-YG56A6XY.js → chunk-ZS4JADYY.js} +3 -3
  160. package/dist/{cli-DB_uakTc.d.ts → cli-Bw9z-KqX.d.ts} +5 -5
  161. package/dist/cli.d.ts +13 -13
  162. package/dist/cli.js +60 -60
  163. package/dist/coding/pre-action-gate.d.ts +1 -1
  164. package/dist/coding/pre-action-gate.js +3 -3
  165. package/dist/compounding/engine.d.ts +2 -2
  166. package/dist/compounding/engine.js +11 -10
  167. package/dist/compounding/preference-consolidator.d.ts +1 -1
  168. package/dist/compression-optimizer.d.ts +1 -1
  169. package/dist/config.d.ts +1 -1
  170. package/dist/config.js +1 -1
  171. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  172. package/dist/connectors/codex-materialize-runner.js +11 -10
  173. package/dist/connectors/codex-materialize.d.ts +1 -1
  174. package/dist/connectors/index.d.ts +1 -1
  175. package/dist/connectors/index.js +11 -10
  176. package/dist/consolidation-provenance-check.d.ts +2 -2
  177. package/dist/consolidation-undo.d.ts +2 -2
  178. package/dist/contradiction/index.d.ts +2 -2
  179. package/dist/converge-config.d.ts +1 -1
  180. package/dist/convergence-refresh.d.ts +2 -2
  181. package/dist/convergence-refresh.js +13 -12
  182. package/dist/conversation-index/backend.d.ts +1 -1
  183. package/dist/conversation-index/chunker.d.ts +1 -1
  184. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  185. package/dist/conversation-index/indexer.d.ts +1 -1
  186. package/dist/conversation-index/search.d.ts +1 -1
  187. package/dist/corpus-watermark.d.ts +1 -1
  188. package/dist/corpus-watermark.js +13 -12
  189. package/dist/day-summary.d.ts +1 -1
  190. package/dist/delinearize.d.ts +1 -1
  191. package/dist/dependency-propagation-config.d.ts +1 -1
  192. package/dist/{dependency-propagation-delivery-DcOVpK3y.d.ts → dependency-propagation-delivery-BxhvAppj.d.ts} +1 -1
  193. package/dist/direct-answer-wiring.d.ts +1 -1
  194. package/dist/direct-answer-wiring.js +3 -3
  195. package/dist/direct-answer.d.ts +1 -1
  196. package/dist/direct-answer.js +2 -2
  197. package/dist/embedding-fallback.d.ts +1 -1
  198. package/dist/enrichment/index.d.ts +1 -1
  199. package/dist/entity-origin-fields.d.ts +1 -1
  200. package/dist/entity-retrieval.d.ts +2 -2
  201. package/dist/entity-retrieval.js +11 -10
  202. package/dist/entity-schema.d.ts +1 -1
  203. package/dist/episodic-context.d.ts +92 -0
  204. package/dist/episodic-context.js +16 -0
  205. package/dist/episodic-context.js.map +1 -0
  206. package/dist/explicit-capture.d.ts +9 -9
  207. package/dist/external-wiki-access.d.ts +11 -11
  208. package/dist/external-wiki-access.js +27 -27
  209. package/dist/external-wiki-collection-registration.d.ts +1 -1
  210. package/dist/external-wiki-collection.d.ts +1 -1
  211. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  212. package/dist/extraction-error-classification.d.ts +1 -1
  213. package/dist/extraction-faithfulness.d.ts +1 -1
  214. package/dist/extraction-judge-telemetry.d.ts +1 -1
  215. package/dist/extraction-judge-training.d.ts +1 -1
  216. package/dist/extraction-judge.d.ts +1 -1
  217. package/dist/extraction-liveness.d.ts +1 -1
  218. package/dist/extraction-normalization.d.ts +1 -1
  219. package/dist/extraction-normalization.js +2 -2
  220. package/dist/extraction-prompt.d.ts +1 -1
  221. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  222. package/dist/extraction-source-grounding.d.ts +1 -1
  223. package/dist/extraction.d.ts +1 -1
  224. package/dist/extraction.js +14 -14
  225. package/dist/fallback-llm.d.ts +1 -1
  226. package/dist/{forget-5TWK7CZT.js → forget-SZ2BXDGF.js} +2 -2
  227. package/dist/graph-dashboard-diff.d.ts +1 -1
  228. package/dist/graph-dashboard-key.d.ts +1 -1
  229. package/dist/graph-dashboard-parser.d.ts +1 -1
  230. package/dist/graph-edge-reinforcement.d.ts +1 -1
  231. package/dist/graph-path-reconstruction.d.ts +1 -1
  232. package/dist/graph-path-scoring.d.ts +1 -1
  233. package/dist/graph-snapshot.d.ts +1 -1
  234. package/dist/graph.d.ts +1 -1
  235. package/dist/harmonic-construction.js +2 -2
  236. package/dist/harmonic-retrieval.js +2 -2
  237. package/dist/importance.d.ts +1 -1
  238. package/dist/importers/index.d.ts +1 -1
  239. package/dist/in-flight-reads.d.ts +1 -1
  240. package/dist/index.d.ts +21 -21
  241. package/dist/index.js +100 -98
  242. package/dist/intent.d.ts +1 -1
  243. package/dist/lcm/engine.d.ts +8 -2
  244. package/dist/lcm/engine.js +4 -4
  245. package/dist/lcm/index.d.ts +1 -1
  246. package/dist/lcm/index.js +9 -9
  247. package/dist/lcm/tools.d.ts +1 -1
  248. package/dist/lifecycle.d.ts +1 -1
  249. package/dist/live-connectors-runner.d.ts +1 -1
  250. package/dist/local-llm.d.ts +1 -1
  251. package/dist/local-model-endpoint.d.ts +1 -1
  252. package/dist/maintenance/memory-governance.d.ts +1 -1
  253. package/dist/maintenance/memory-governance.js +11 -10
  254. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  255. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -10
  256. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  257. package/dist/maintenance/rebuild-memory-projection.js +12 -11
  258. package/dist/{maintenance-5c1olVtB.d.ts → maintenance-uJb74j64.d.ts} +3 -3
  259. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  260. package/dist/memory-action-policy.d.ts +1 -1
  261. package/dist/memory-cache.d.ts +1 -1
  262. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  263. package/dist/memory-projection-store.d.ts +1 -1
  264. package/dist/memory-provenance.d.ts +1 -1
  265. package/dist/memory-snapshot.d.ts +1 -1
  266. package/dist/memory-worth-outcomes.d.ts +2 -2
  267. package/dist/models-json.d.ts +1 -1
  268. package/dist/namespaces/migrate.d.ts +3 -3
  269. package/dist/namespaces/migrate.js +12 -11
  270. package/dist/namespaces/principal.d.ts +1 -1
  271. package/dist/namespaces/search.d.ts +1 -1
  272. package/dist/namespaces/search.js +6 -5
  273. package/dist/namespaces/storage.d.ts +3 -3
  274. package/dist/namespaces/storage.js +11 -10
  275. package/dist/native-knowledge.d.ts +1 -1
  276. package/dist/offline-sync-impression-drain.d.ts +1 -1
  277. package/dist/operator-doctor-corpus.d.ts +1 -1
  278. package/dist/operator-doctor-corpus.js +14 -13
  279. package/dist/operator-doctor-replica.d.ts +1 -1
  280. package/dist/operator-toolkit.d.ts +3 -3
  281. package/dist/operator-toolkit.js +19 -18
  282. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  283. package/dist/orchestration/maintenance.d.ts +4 -4
  284. package/dist/orchestration/maintenance.js +16 -15
  285. package/dist/{orchestrator-HPuY6I4i.d.ts → orchestrator-CFi-5JSR.d.ts} +23 -8
  286. package/dist/orchestrator.d.ts +9 -9
  287. package/dist/orchestrator.js +88 -86
  288. package/dist/patterns-cli.d.ts +1 -1
  289. package/dist/{pipeline-CvVe1Q2_.d.ts → pipeline-BdF3ferY.d.ts} +1 -1
  290. package/dist/policy-runtime.d.ts +1 -1
  291. package/dist/policy-runtime.js +3 -3
  292. package/dist/proactive-contention.d.ts +1 -1
  293. package/dist/provenance.d.ts +1 -1
  294. package/dist/{public-http-D0JKFkyf.d.ts → public-http-DK-QwaBu.d.ts} +1 -1
  295. package/dist/{qmd-Bd0Tp76_.d.ts → qmd-D_62bYNl.d.ts} +1 -1
  296. package/dist/qmd-preflight.d.ts +2 -2
  297. package/dist/qmd-recall-cache.d.ts +1 -1
  298. package/dist/qmd.d.ts +2 -2
  299. package/dist/recall-concurrency-config.d.ts +1 -1
  300. package/dist/recall-disclosure-escalation.d.ts +1 -1
  301. package/dist/recall-explain-renderer.d.ts +1 -1
  302. package/dist/recall-explain-renderer.js +3 -3
  303. package/dist/recall-memory-map.d.ts +1 -1
  304. package/dist/recall-planner-llm.d.ts +1 -1
  305. package/dist/recall-query-policy.js +2 -2
  306. package/dist/recall-state.d.ts +1 -1
  307. package/dist/recall-tag-filter.d.ts +1 -1
  308. package/dist/recall-timings.d.ts +1 -1
  309. package/dist/recall-tokenization.d.ts +3 -1
  310. package/dist/recall-tokenization.js +5 -1
  311. package/dist/recall-xray-cli.d.ts +1 -1
  312. package/dist/recall-xray-cli.js +4 -4
  313. package/dist/recall-xray-renderer.d.ts +1 -1
  314. package/dist/recall-xray-renderer.js +3 -3
  315. package/dist/recall-xray.d.ts +1 -1
  316. package/dist/recall-xray.js +2 -2
  317. package/dist/reconcile/cursor.d.ts +1 -1
  318. package/dist/reconcile/manifest.d.ts +10 -1
  319. package/dist/reconcile/manifest.js +1 -1
  320. package/dist/reconcile/plan.d.ts +1 -1
  321. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  322. package/dist/replay/normalizers/claude.d.ts +1 -1
  323. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  324. package/dist/replay/normalizers/shared.d.ts +1 -1
  325. package/dist/replay/runner.d.ts +1 -1
  326. package/dist/replay/types.d.ts +1 -1
  327. package/dist/replica-divergence.d.ts +1 -1
  328. package/dist/replica-peers-config.d.ts +1 -1
  329. package/dist/resolve-auth-token.d.ts +1 -1
  330. package/dist/resume-bundles.js +4 -4
  331. package/dist/retrieval-agents.d.ts +2 -2
  332. package/dist/retrieval-tiers.d.ts +1 -1
  333. package/dist/routing/engine.d.ts +1 -1
  334. package/dist/routing/store.d.ts +1 -1
  335. package/dist/salvage-envelope.d.ts +1 -1
  336. package/dist/{scope-profiles-ClLtm9gK.d.ts → scope-profiles-CeMv7pP0.d.ts} +1 -1
  337. package/dist/search/embed-helper.d.ts +1 -1
  338. package/dist/search/factory.d.ts +1 -1
  339. package/dist/search/factory.js +5 -4
  340. package/dist/search/index.d.ts +1 -1
  341. package/dist/search/index.js +9 -8
  342. package/dist/search/lancedb-backend.d.ts +14 -1
  343. package/dist/search/lancedb-backend.js +1 -1
  344. package/dist/search/meilisearch-backend.d.ts +1 -1
  345. package/dist/search/noop-backend.d.ts +1 -1
  346. package/dist/search/orama-backend.d.ts +22 -1
  347. package/dist/search/orama-backend.js +2 -1
  348. package/dist/search/port.d.ts +1 -1
  349. package/dist/search/remote-backend.d.ts +1 -1
  350. package/dist/{semantic-consolidation-B1EkeEDj.d.ts → semantic-consolidation-B-85brYj.d.ts} +1 -1
  351. package/dist/semantic-consolidation.d.ts +2 -2
  352. package/dist/semantic-consolidation.js +12 -12
  353. package/dist/semantic-rule-promotion.js +11 -10
  354. package/dist/semantic-rule-verifier.d.ts +1 -1
  355. package/dist/semantic-rule-verifier.js +11 -11
  356. package/dist/{service-Cf3ANQj9.d.ts → service-CoO0HA2E.d.ts} +2 -2
  357. package/dist/session-observer-bands.d.ts +1 -1
  358. package/dist/session-observer-state.d.ts +1 -1
  359. package/dist/shared-context/manager.d.ts +1 -1
  360. package/dist/signal.d.ts +1 -1
  361. package/dist/source-agent-qualifier.d.ts +1 -1
  362. package/dist/source-agent-qualifier.js +11 -10
  363. package/dist/{storage-DS2O_6Qt.d.ts → storage-BVAVitkO.d.ts} +1 -1
  364. package/dist/storage.d.ts +2 -2
  365. package/dist/storage.js +10 -9
  366. package/dist/summarizer.d.ts +1 -1
  367. package/dist/summary-snapshot.d.ts +1 -1
  368. package/dist/support-passport/index.d.ts +14 -14
  369. package/dist/support-passport/index.js +29 -29
  370. package/dist/temporal-supersession.d.ts +2 -2
  371. package/dist/temporal-timeline-recall.d.ts +1 -1
  372. package/dist/temporal-validity.d.ts +1 -1
  373. package/dist/threading.d.ts +1 -1
  374. package/dist/tier-migration.d.ts +2 -2
  375. package/dist/tier-routing.d.ts +1 -1
  376. package/dist/topics.d.ts +1 -1
  377. package/dist/transcript.d.ts +1 -1
  378. package/dist/transfer/import-sqlite.js +2 -2
  379. package/dist/trust-score-stage.d.ts +1 -1
  380. package/dist/trust-score.d.ts +1 -1
  381. package/dist/trust-zones.js +2 -2
  382. package/dist/{types-BOANGhCJ.d.ts → types-DWHOxlZP.d.ts} +3 -0
  383. package/dist/types.d.ts +1 -1
  384. package/dist/types.js +1 -1
  385. package/dist/user-message-cleaning.d.ts +23 -0
  386. package/dist/user-message-cleaning.js +10 -0
  387. package/dist/user-message-cleaning.js.map +1 -0
  388. package/dist/utility-runtime.d.ts +1 -1
  389. package/dist/verified-recall.js +11 -11
  390. package/dist/work-product-ledger.js +2 -2
  391. package/dist/write-envelope.d.ts +1 -1
  392. package/package.json +12 -2
  393. package/src/access-service-offline-file-content.test.ts +1 -0
  394. package/src/config.ts +11 -0
  395. package/src/episodic-context-recall.integration.test.ts +169 -0
  396. package/src/episodic-context.test.ts +266 -0
  397. package/src/episodic-context.ts +274 -0
  398. package/src/lcm/engine.ts +18 -1
  399. package/src/lifecycle/tombstones.test.ts +134 -0
  400. package/src/lifecycle/tombstones.ts +29 -2
  401. package/src/orchestration/episodic-context-section.ts +255 -0
  402. package/src/orchestration/recall-internal-deps.ts +2 -0
  403. package/src/orchestration/recall-internal.ts +40 -25
  404. package/src/orchestration/recall-result-formatter.ts +37 -0
  405. package/src/recall-tokenization.ts +14 -8
  406. package/src/reconcile/manifest.test.ts +133 -4
  407. package/src/reconcile/manifest.ts +43 -7
  408. package/src/search/factory.ts +1 -0
  409. package/src/search/lancedb-backend.ts +24 -16
  410. package/src/search/orama-backend.test.ts +208 -1
  411. package/src/search/orama-backend.ts +133 -18
  412. package/src/search/orama-cjk-tokenizer.test.ts +108 -0
  413. package/src/search/orama-cjk-tokenizer.ts +143 -0
  414. package/src/storage/tombstone-migration-sources.test.ts +116 -0
  415. package/src/storage/tombstone-migration-sources.ts +90 -0
  416. package/src/storage.ts +13 -34
  417. package/src/types.ts +3 -3
  418. package/src/user-message-cleaning.ts +139 -0
  419. package/dist/chunk-5WVUO6QT.js.map +0 -1
  420. package/dist/chunk-7N7DB4L5.js.map +0 -1
  421. package/dist/chunk-B2QHVLJO.js.map +0 -1
  422. package/dist/chunk-BHO3IVAN.js.map +0 -1
  423. package/dist/chunk-KHQ57QLJ.js.map +0 -1
  424. package/dist/chunk-VUDALPI5.js.map +0 -1
  425. package/dist/chunk-XIABRKF6.js.map +0 -1
  426. package/dist/chunk-XL3TATMJ.js.map +0 -1
  427. package/dist/chunk-YLHM5BQQ.js.map +0 -1
  428. package/dist/chunk-ZBJMUXZH.js.map +0 -1
  429. package/dist/chunk-ZJKLGS76.js.map +0 -1
  430. /package/dist/{auto-sync-FMWQQB3J.js.map → auto-sync-Z52VWMNC.js.map} +0 -0
  431. /package/dist/{chunk-QP2IZTUR.js.map → chunk-2TYIAKU5.js.map} +0 -0
  432. /package/dist/{chunk-QNMNNFKD.js.map → chunk-347ZR6D4.js.map} +0 -0
  433. /package/dist/{chunk-76YNCJ5H.js.map → chunk-3F3CVVDS.js.map} +0 -0
  434. /package/dist/{chunk-KCFZOSR6.js.map → chunk-3MA7JVXN.js.map} +0 -0
  435. /package/dist/{chunk-TLUSSS2F.js.map → chunk-4HO3542O.js.map} +0 -0
  436. /package/dist/{chunk-4E67XCT2.js.map → chunk-4IZ2IT7D.js.map} +0 -0
  437. /package/dist/{chunk-33JBK2XP.js.map → chunk-5F6HMNMZ.js.map} +0 -0
  438. /package/dist/{chunk-5WQMORU5.js.map → chunk-5PFGMO33.js.map} +0 -0
  439. /package/dist/{chunk-6HEM6HTQ.js.map → chunk-6GGTATZF.js.map} +0 -0
  440. /package/dist/{chunk-UIRU3MIJ.js.map → chunk-7BJYTX6Q.js.map} +0 -0
  441. /package/dist/{chunk-2GRLJMKJ.js.map → chunk-7DRSWPUV.js.map} +0 -0
  442. /package/dist/{chunk-TVVEYCNW.js.map → chunk-7K5Q6COX.js.map} +0 -0
  443. /package/dist/{chunk-HXXGZ4KV.js.map → chunk-ALNZEWGN.js.map} +0 -0
  444. /package/dist/{chunk-67MKNKJQ.js.map → chunk-AYIHDC5S.js.map} +0 -0
  445. /package/dist/{chunk-IXJ5U6ZL.js.map → chunk-BBHFAVMP.js.map} +0 -0
  446. /package/dist/{chunk-IIRK5V5Z.js.map → chunk-BHO6RHE5.js.map} +0 -0
  447. /package/dist/{chunk-WANOCU3K.js.map → chunk-BP6WMYLP.js.map} +0 -0
  448. /package/dist/{chunk-JLMH5YMU.js.map → chunk-CH627RRV.js.map} +0 -0
  449. /package/dist/{chunk-WTMG5GAK.js.map → chunk-DROAPP6N.js.map} +0 -0
  450. /package/dist/{chunk-PBH2Z2NY.js.map → chunk-DTLF2SLZ.js.map} +0 -0
  451. /package/dist/{chunk-7JAXC526.js.map → chunk-EFWHCTYJ.js.map} +0 -0
  452. /package/dist/{chunk-3XG4QEA2.js.map → chunk-FF6E6HOT.js.map} +0 -0
  453. /package/dist/{chunk-NP7FLVZW.js.map → chunk-G2FCSILA.js.map} +0 -0
  454. /package/dist/{chunk-7PVTOZR4.js.map → chunk-H23GIXJC.js.map} +0 -0
  455. /package/dist/{chunk-WT6UL3UA.js.map → chunk-H7PRHUBD.js.map} +0 -0
  456. /package/dist/{chunk-ETCVSZLG.js.map → chunk-HSBQJRV2.js.map} +0 -0
  457. /package/dist/{chunk-GZRDOVQN.js.map → chunk-HVKMJAEF.js.map} +0 -0
  458. /package/dist/{chunk-CSOYVTRX.js.map → chunk-IIPJKCZB.js.map} +0 -0
  459. /package/dist/{chunk-E57E5SCS.js.map → chunk-IRLH4NM2.js.map} +0 -0
  460. /package/dist/{chunk-4G45LJJP.js.map → chunk-IZRNVNPV.js.map} +0 -0
  461. /package/dist/{chunk-YSUSUZR4.js.map → chunk-JCJGYNIS.js.map} +0 -0
  462. /package/dist/{chunk-EU74U4GT.js.map → chunk-JDI7G6EA.js.map} +0 -0
  463. /package/dist/{chunk-QWPAQLYV.js.map → chunk-JFLKSD5V.js.map} +0 -0
  464. /package/dist/{chunk-KQS72GCR.js.map → chunk-LJOIZPJH.js.map} +0 -0
  465. /package/dist/{chunk-U27G4E5G.js.map → chunk-LLGDVG52.js.map} +0 -0
  466. /package/dist/{chunk-JGW2EUCQ.js.map → chunk-PMRUMGK6.js.map} +0 -0
  467. /package/dist/{chunk-3G6YU5YD.js.map → chunk-PSNN25DW.js.map} +0 -0
  468. /package/dist/{chunk-LRGSLV7M.js.map → chunk-PYHOAXTI.js.map} +0 -0
  469. /package/dist/{chunk-75U2FR7U.js.map → chunk-QCI73Z7C.js.map} +0 -0
  470. /package/dist/{chunk-EHMMRZOZ.js.map → chunk-QICOU4RY.js.map} +0 -0
  471. /package/dist/{chunk-K4WIUTNH.js.map → chunk-RFH7U5LT.js.map} +0 -0
  472. /package/dist/{chunk-4SGDYYWV.js.map → chunk-RPKJHYVE.js.map} +0 -0
  473. /package/dist/{chunk-DYDACAK2.js.map → chunk-TGSMU3F2.js.map} +0 -0
  474. /package/dist/{chunk-MJFDJTDC.js.map → chunk-TIRJV2LW.js.map} +0 -0
  475. /package/dist/{chunk-QRA3XVJX.js.map → chunk-UDTME32W.js.map} +0 -0
  476. /package/dist/{chunk-LAM6UDFV.js.map → chunk-WMOJIOIG.js.map} +0 -0
  477. /package/dist/{chunk-LLLY5IBK.js.map → chunk-WR2YKUIW.js.map} +0 -0
  478. /package/dist/{chunk-KYI3CM42.js.map → chunk-X6E7TT3A.js.map} +0 -0
  479. /package/dist/{chunk-QN7XQEIT.js.map → chunk-YIIC5IDU.js.map} +0 -0
  480. /package/dist/{chunk-JDJOAL4B.js.map → chunk-YSR3DXGC.js.map} +0 -0
  481. /package/dist/{chunk-LBJBNWS2.js.map → chunk-YTHQHH5U.js.map} +0 -0
  482. /package/dist/{chunk-JF6YSHJM.js.map → chunk-ZPGHA7EO.js.map} +0 -0
  483. /package/dist/{chunk-YG56A6XY.js.map → chunk-ZS4JADYY.js.map} +0 -0
  484. /package/dist/{forget-5TWK7CZT.js.map → forget-SZ2BXDGF.js.map} +0 -0
@@ -0,0 +1,152 @@
1
+ // src/episodic-context.ts
2
+ var TURN_FIELD_SEPARATOR = String.fromCharCode(1);
3
+ function resolveProvenanceTurnIndex(turnId) {
4
+ if (typeof turnId !== "string" || turnId.length === 0) return null;
5
+ const lastField = turnId.includes(TURN_FIELD_SEPARATOR) ? turnId.split(TURN_FIELD_SEPARATOR).pop() : turnId;
6
+ if (!/^\d+$/.test(lastField)) return null;
7
+ const parsed = Number.parseInt(lastField, 10);
8
+ return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
9
+ }
10
+ function windowForTurn(sessionKey, turn, rank, memoryId) {
11
+ const fromTurn = Math.max(0, turn - 1);
12
+ return {
13
+ sessionKey,
14
+ fromTurn,
15
+ toTurn: turn + 2,
16
+ factRank: rank,
17
+ bestTurn: turn,
18
+ memoryIds: /* @__PURE__ */ new Set([memoryId])
19
+ };
20
+ }
21
+ function mergeDrafts(drafts, maxTurnsPerEpisode) {
22
+ const bySession = /* @__PURE__ */ new Map();
23
+ for (const draft of drafts) {
24
+ const list = bySession.get(draft.sessionKey);
25
+ if (list) list.push(draft);
26
+ else bySession.set(draft.sessionKey, [draft]);
27
+ }
28
+ const windows = [];
29
+ for (const [, sessionDrafts] of bySession) {
30
+ sessionDrafts.sort(
31
+ (a, b) => a.fromTurn - b.fromTurn || a.toTurn - b.toTurn
32
+ );
33
+ let current = null;
34
+ const flush = () => {
35
+ if (!current) return;
36
+ windows.push(finalizeWindow(current, maxTurnsPerEpisode));
37
+ current = null;
38
+ };
39
+ for (const draft of sessionDrafts) {
40
+ if (current && draft.fromTurn <= current.toTurn) {
41
+ current.toTurn = Math.max(current.toTurn, draft.toTurn);
42
+ if (draft.factRank < current.factRank) {
43
+ current.factRank = draft.factRank;
44
+ current.bestTurn = draft.bestTurn;
45
+ }
46
+ for (const id of draft.memoryIds) current.memoryIds.add(id);
47
+ } else {
48
+ flush();
49
+ current = { ...draft, memoryIds: new Set(draft.memoryIds) };
50
+ }
51
+ }
52
+ flush();
53
+ }
54
+ return windows;
55
+ }
56
+ function finalizeWindow(draft, maxTurnsPerEpisode) {
57
+ let { fromTurn, toTurn } = draft;
58
+ const span = toTurn - fromTurn;
59
+ if (maxTurnsPerEpisode > 0 && span > maxTurnsPerEpisode) {
60
+ fromTurn = Math.min(
61
+ Math.max(draft.bestTurn - 1, draft.fromTurn),
62
+ draft.toTurn - maxTurnsPerEpisode
63
+ );
64
+ if (fromTurn + maxTurnsPerEpisode <= draft.bestTurn) {
65
+ fromTurn = Math.min(draft.bestTurn, draft.toTurn - maxTurnsPerEpisode);
66
+ }
67
+ toTurn = fromTurn + maxTurnsPerEpisode;
68
+ }
69
+ return {
70
+ sessionKey: draft.sessionKey,
71
+ fromTurn,
72
+ toTurn,
73
+ factRank: draft.factRank,
74
+ memoryIds: [...draft.memoryIds].sort()
75
+ };
76
+ }
77
+ function compareEpisodeWindows(left, right) {
78
+ const leftIds = left.memoryIds.join("\0");
79
+ const rightIds = right.memoryIds.join("\0");
80
+ return left.factRank - right.factRank || (left.sessionKey < right.sessionKey ? -1 : left.sessionKey > right.sessionKey ? 1 : 0) || left.fromTurn - right.fromTurn || left.toTurn - right.toTurn || (leftIds < rightIds ? -1 : leftIds > rightIds ? 1 : 0);
81
+ }
82
+ function planEpisodeWindows(options) {
83
+ if (options.maxEpisodes <= 0 || options.maxTurnsPerEpisode <= 0) return [];
84
+ const drafts = [];
85
+ for (const fact of options.recalledFacts) {
86
+ if (!fact || !Array.isArray(fact.sources)) continue;
87
+ for (const source of fact.sources) {
88
+ if (!source || typeof source.sessionKey !== "string" || source.sessionKey.length === 0) {
89
+ continue;
90
+ }
91
+ const turn = resolveProvenanceTurnIndex(source.turnId);
92
+ if (turn === null) continue;
93
+ drafts.push(
94
+ windowForTurn(source.sessionKey, turn, fact.rank, fact.memoryId)
95
+ );
96
+ }
97
+ }
98
+ if (drafts.length === 0) return [];
99
+ const windows = mergeDrafts(drafts, options.maxTurnsPerEpisode);
100
+ return windows.sort(compareEpisodeWindows).slice(0, options.maxEpisodes);
101
+ }
102
+ function factsNeedingQuoteFallback(recalledFacts) {
103
+ return recalledFacts.filter(
104
+ (fact) => fact && Array.isArray(fact.sources) && fact.sources.length > 0 && fact.sources.some((source) => typeof source?.quote === "string" && source.quote.length > 0) && !fact.sources.some((source) => resolveProvenanceTurnIndex(source?.turnId) !== null)
105
+ );
106
+ }
107
+ async function planEpisodeWindowsWithFallback(options) {
108
+ const facts = [...options.recalledFacts];
109
+ const locator = options.locateQuote;
110
+ if (locator && facts.length > 0) {
111
+ for (const fact of factsNeedingQuoteFallback(options.recalledFacts)) {
112
+ for (const source of fact.sources ?? []) {
113
+ if (typeof source?.quote !== "string" || source.quote.length === 0) continue;
114
+ if (typeof source.sessionKey !== "string" || source.sessionKey.length === 0) continue;
115
+ let turn = null;
116
+ try {
117
+ turn = await locator(source.quote, source.sessionKey);
118
+ } catch {
119
+ turn = null;
120
+ }
121
+ if (turn === null || !Number.isSafeInteger(turn) || turn < 0) continue;
122
+ facts.push({
123
+ memoryId: fact.memoryId,
124
+ rank: fact.rank,
125
+ sources: [
126
+ {
127
+ sessionKey: source.sessionKey,
128
+ turnId: String(turn),
129
+ observedAt: source.observedAt,
130
+ quote: source.quote
131
+ }
132
+ ]
133
+ });
134
+ break;
135
+ }
136
+ }
137
+ }
138
+ return planEpisodeWindows({
139
+ recalledFacts: facts,
140
+ maxEpisodes: options.maxEpisodes,
141
+ maxTurnsPerEpisode: options.maxTurnsPerEpisode
142
+ });
143
+ }
144
+
145
+ export {
146
+ resolveProvenanceTurnIndex,
147
+ compareEpisodeWindows,
148
+ planEpisodeWindows,
149
+ factsNeedingQuoteFallback,
150
+ planEpisodeWindowsWithFallback
151
+ };
152
+ //# sourceMappingURL=chunk-T3GIETKV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/episodic-context.ts"],"sourcesContent":["/**\n * Episodic context planning (issue #2331, harmonic-memory P3).\n *\n * Turns the structured `sources` provenance on recalled facts into episode\n * windows over the LCM archive: resolve each source's turn, group overlapping\n * turn ranges within a session into merged episodes, and cap the episode\n * count/span. Pure planning — no archive access — plus an async wrapper that\n * applies the single documented fallback (quote lookup) through an injected\n * locator so the planner stays testable without SQLite.\n *\n * Window bounds are `[start, end)` throughout (`toTurn` exclusive); the\n * archive's `getMessages` bounds are inclusive, so the fetch site passes\n * `toTurn - 1`.\n */\n\nimport type { ProvenanceSource } from \"./types.js\";\n\n/** One fact contributing to episodic planning, with its final recall rank. */\nexport interface EpisodicFactInput {\n memoryId: string;\n /** Final recall rank of the fact (0 = best). Lower wins. */\n rank: number;\n sources?: ProvenanceSource[];\n}\n\n/** A merged, fetch-ready episode window. */\nexport interface EpisodeWindow {\n sessionKey: string;\n /** Inclusive first turn. */\n fromTurn: number;\n /** EXCLUSIVE end turn (`[start, end)` semantics). */\n toTurn: number;\n /** Best (lowest) rank among contributing facts — drives ordering. */\n factRank: number;\n /** Sorted, deduplicated contributing memory ids (citation line). */\n memoryIds: string[];\n}\n\n/** Locates a quote's turn index within a session, or null on a miss. */\nexport type QuoteLocator = (\n quote: string,\n sessionKey: string,\n) => Promise<number | null>;\n\nconst TURN_FIELD_SEPARATOR = String.fromCharCode(1);\n\n/**\n * Resolve a provenance `turnId` to a numeric LCM turn index, or null.\n *\n * Extraction writes `turnId` as the host turn fingerprint\n * (`buildTurnFingerprint`: `role␁content␁thread␁turnIndex`), so the numeric\n * LCM turn index is the LAST `␁`-separated field. A bare integer string is\n * also accepted. Anything else is unresolvable — skip, never guess.\n */\nexport function resolveProvenanceTurnIndex(turnId: unknown): number | null {\n if (typeof turnId !== \"string\" || turnId.length === 0) return null;\n const lastField = turnId.includes(TURN_FIELD_SEPARATOR)\n ? turnId.split(TURN_FIELD_SEPARATOR).pop()!\n : turnId;\n if (!/^\\d+$/.test(lastField)) return null;\n const parsed = Number.parseInt(lastField, 10);\n return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;\n}\n\ninterface DraftWindow {\n sessionKey: string;\n fromTurn: number;\n toTurn: number;\n factRank: number;\n bestTurn: number;\n memoryIds: Set<string>;\n}\n\nfunction windowForTurn(\n sessionKey: string,\n turn: number,\n rank: number,\n memoryId: string,\n): DraftWindow {\n const fromTurn = Math.max(0, turn - 1);\n return {\n sessionKey,\n fromTurn,\n toTurn: turn + 2,\n factRank: rank,\n bestTurn: turn,\n memoryIds: new Set([memoryId]),\n };\n}\n\nfunction mergeDrafts(drafts: DraftWindow[], maxTurnsPerEpisode: number): EpisodeWindow[] {\n const bySession = new Map<string, DraftWindow[]>();\n for (const draft of drafts) {\n const list = bySession.get(draft.sessionKey);\n if (list) list.push(draft);\n else bySession.set(draft.sessionKey, [draft]);\n }\n\n const windows: EpisodeWindow[] = [];\n for (const [, sessionDrafts] of bySession) {\n // Sort by fromTurn, then toTurn, so a shuffle cannot change merge results.\n sessionDrafts.sort(\n (a, b) => a.fromTurn - b.fromTurn || a.toTurn - b.toTurn,\n );\n let current: DraftWindow | null = null;\n const flush = () => {\n if (!current) return;\n windows.push(finalizeWindow(current, maxTurnsPerEpisode));\n current = null;\n };\n for (const draft of sessionDrafts) {\n if (current && draft.fromTurn <= current.toTurn) {\n // Overlapping or adjacent ([a,b) + [b,c) share no turn but read as one\n // continuous episode): merge. Merged bounds stay [start, end).\n current.toTurn = Math.max(current.toTurn, draft.toTurn);\n if (draft.factRank < current.factRank) {\n current.factRank = draft.factRank;\n current.bestTurn = draft.bestTurn;\n }\n for (const id of draft.memoryIds) current.memoryIds.add(id);\n } else {\n flush();\n current = { ...draft, memoryIds: new Set(draft.memoryIds) };\n }\n }\n flush();\n }\n return windows;\n}\n\nfunction finalizeWindow(draft: DraftWindow, maxTurnsPerEpisode: number): EpisodeWindow {\n let { fromTurn, toTurn } = draft;\n const span = toTurn - fromTurn;\n if (maxTurnsPerEpisode > 0 && span > maxTurnsPerEpisode) {\n // Trim the tail but keep the highest-ranked fact's turn inside: anchor one\n // turn of leading context on the best turn, clamped to the merged range.\n fromTurn = Math.min(\n Math.max(draft.bestTurn - 1, draft.fromTurn),\n draft.toTurn - maxTurnsPerEpisode,\n );\n // maxTurnsPerEpisode === 1 (or a clamp collision) can push the anchor\n // above the best turn; slide back down so the best turn stays included.\n if (fromTurn + maxTurnsPerEpisode <= draft.bestTurn) {\n fromTurn = Math.min(draft.bestTurn, draft.toTurn - maxTurnsPerEpisode);\n }\n toTurn = fromTurn + maxTurnsPerEpisode;\n }\n return {\n sessionKey: draft.sessionKey,\n fromTurn,\n toTurn,\n factRank: draft.factRank,\n memoryIds: [...draft.memoryIds].sort(),\n };\n}\n\n/** Total, stable ordering: rank asc, sessionKey asc, fromTurn asc, then residual identity. */\nexport function compareEpisodeWindows(\n left: EpisodeWindow,\n right: EpisodeWindow,\n): number {\n const leftIds = left.memoryIds.join(\"\\u{0}\");\n const rightIds = right.memoryIds.join(\"\\u{0}\");\n return (\n left.factRank - right.factRank ||\n (left.sessionKey < right.sessionKey ? -1 : left.sessionKey > right.sessionKey ? 1 : 0) ||\n left.fromTurn - right.fromTurn ||\n left.toTurn - right.toTurn ||\n (leftIds < rightIds ? -1 : leftIds > rightIds ? 1 : 0)\n );\n}\n\n/**\n * Plan episode windows from recalled facts' structured provenance.\n *\n * Pure: no archive access. Facts without a structured `sources` array are\n * skipped (no legacy scalar `source` parsing). Sources whose `turnId` does\n * not resolve to a number are skipped — the caller decides whether to attempt\n * the quote fallback for facts that lost every source.\n *\n * `maxEpisodes` or `maxTurnsPerEpisode` of 0 disables the section: returns\n * `[]` before any work (zero semantics, checklist item 33).\n */\nexport function planEpisodeWindows(options: {\n recalledFacts: ReadonlyArray<EpisodicFactInput>;\n maxEpisodes: number;\n maxTurnsPerEpisode: number;\n}): EpisodeWindow[] {\n if (options.maxEpisodes <= 0 || options.maxTurnsPerEpisode <= 0) return [];\n const drafts: DraftWindow[] = [];\n for (const fact of options.recalledFacts) {\n if (!fact || !Array.isArray(fact.sources)) continue;\n for (const source of fact.sources) {\n if (!source || typeof source.sessionKey !== \"string\" || source.sessionKey.length === 0) {\n continue;\n }\n const turn = resolveProvenanceTurnIndex(source.turnId);\n if (turn === null) continue;\n drafts.push(\n windowForTurn(source.sessionKey, turn, fact.rank, fact.memoryId),\n );\n }\n }\n if (drafts.length === 0) return [];\n const windows = mergeDrafts(drafts, options.maxTurnsPerEpisode);\n return windows.sort(compareEpisodeWindows).slice(0, options.maxEpisodes);\n}\n\n/**\n * Facts whose sources all failed turn resolution but that carry a quote.\n * These are the ONLY candidates for the quote-lookup fallback.\n */\nexport function factsNeedingQuoteFallback(\n recalledFacts: ReadonlyArray<EpisodicFactInput>,\n): EpisodicFactInput[] {\n return recalledFacts.filter(\n (fact) =>\n fact &&\n Array.isArray(fact.sources) &&\n fact.sources.length > 0 &&\n fact.sources.some((source) => typeof source?.quote === \"string\" && source.quote.length > 0) &&\n !fact.sources.some((source) => resolveProvenanceTurnIndex(source?.turnId) !== null),\n );\n}\n\n/**\n * Plan episode windows, applying the single documented fallback: for a fact\n * whose turnIds ALL failed resolution but that has a quote, locate the quote\n * in the archive and window around the located turn. A locator miss means the\n * fact contributes no episode. Falls back to the pure plan when no locator is\n * supplied.\n */\nexport async function planEpisodeWindowsWithFallback(options: {\n recalledFacts: ReadonlyArray<EpisodicFactInput>;\n maxEpisodes: number;\n maxTurnsPerEpisode: number;\n locateQuote?: QuoteLocator;\n}): Promise<EpisodeWindow[]> {\n const facts = [...options.recalledFacts];\n const locator = options.locateQuote;\n if (locator && facts.length > 0) {\n for (const fact of factsNeedingQuoteFallback(options.recalledFacts)) {\n for (const source of fact.sources ?? []) {\n if (typeof source?.quote !== \"string\" || source.quote.length === 0) continue;\n if (typeof source.sessionKey !== \"string\" || source.sessionKey.length === 0) continue;\n let turn: number | null = null;\n try {\n turn = await locator(source.quote, source.sessionKey);\n } catch {\n turn = null;\n }\n if (turn === null || !Number.isSafeInteger(turn) || turn < 0) continue;\n facts.push({\n memoryId: fact.memoryId,\n rank: fact.rank,\n sources: [\n {\n sessionKey: source.sessionKey,\n turnId: String(turn),\n observedAt: source.observedAt,\n quote: source.quote,\n },\n ],\n });\n break; // one located quote per fact is enough to window it\n }\n }\n }\n return planEpisodeWindows({\n recalledFacts: facts,\n maxEpisodes: options.maxEpisodes,\n maxTurnsPerEpisode: options.maxTurnsPerEpisode,\n });\n}\n"],"mappings":";AA4CA,IAAM,uBAAuB,OAAO,aAAa,CAAC;AAU3C,SAAS,2BAA2B,QAAgC;AACzE,MAAI,OAAO,WAAW,YAAY,OAAO,WAAW,EAAG,QAAO;AAC9D,QAAM,YAAY,OAAO,SAAS,oBAAoB,IAClD,OAAO,MAAM,oBAAoB,EAAE,IAAI,IACvC;AACJ,MAAI,CAAC,QAAQ,KAAK,SAAS,EAAG,QAAO;AACrC,QAAM,SAAS,OAAO,SAAS,WAAW,EAAE;AAC5C,SAAO,OAAO,cAAc,MAAM,KAAK,UAAU,IAAI,SAAS;AAChE;AAWA,SAAS,cACP,YACA,MACA,MACA,UACa;AACb,QAAM,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC;AACrC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,QAAQ,OAAO;AAAA,IACf,UAAU;AAAA,IACV,UAAU;AAAA,IACV,WAAW,oBAAI,IAAI,CAAC,QAAQ,CAAC;AAAA,EAC/B;AACF;AAEA,SAAS,YAAY,QAAuB,oBAA6C;AACvF,QAAM,YAAY,oBAAI,IAA2B;AACjD,aAAW,SAAS,QAAQ;AAC1B,UAAM,OAAO,UAAU,IAAI,MAAM,UAAU;AAC3C,QAAI,KAAM,MAAK,KAAK,KAAK;AAAA,QACpB,WAAU,IAAI,MAAM,YAAY,CAAC,KAAK,CAAC;AAAA,EAC9C;AAEA,QAAM,UAA2B,CAAC;AAClC,aAAW,CAAC,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,QAAQ,MAAM,MAAM,IAAI;AAAA,EACtF;AACF;AASA,eAAsB,+BAA+B,SAKxB;AAC3B,QAAM,QAAQ,CAAC,GAAG,QAAQ,aAAa;AACvC,QAAM,UAAU,QAAQ;AACxB,MAAI,WAAW,MAAM,SAAS,GAAG;AAC/B,eAAW,QAAQ,0BAA0B,QAAQ,aAAa,GAAG;AACnE,iBAAW,UAAU,KAAK,WAAW,CAAC,GAAG;AACvC,YAAI,OAAO,QAAQ,UAAU,YAAY,OAAO,MAAM,WAAW,EAAG;AACpE,YAAI,OAAO,OAAO,eAAe,YAAY,OAAO,WAAW,WAAW,EAAG;AAC7E,YAAI,OAAsB;AAC1B,YAAI;AACF,iBAAO,MAAM,QAAQ,OAAO,OAAO,OAAO,UAAU;AAAA,QACtD,QAAQ;AACN,iBAAO;AAAA,QACT;AACA,YAAI,SAAS,QAAQ,CAAC,OAAO,cAAc,IAAI,KAAK,OAAO,EAAG;AAC9D,cAAM,KAAK;AAAA,UACT,UAAU,KAAK;AAAA,UACf,MAAM,KAAK;AAAA,UACX,SAAS;AAAA,YACP;AAAA,cACE,YAAY,OAAO;AAAA,cACnB,QAAQ,OAAO,IAAI;AAAA,cACnB,YAAY,OAAO;AAAA,cACnB,OAAO,OAAO;AAAA,YAChB;AAAA,UACF;AAAA,QACF,CAAC;AACD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO,mBAAmB;AAAA,IACxB,eAAe;AAAA,IACf,aAAa,QAAQ;AAAA,IACrB,oBAAoB,QAAQ;AAAA,EAC9B,CAAC;AACH;","names":[]}
@@ -5,14 +5,14 @@ import {
5
5
  } from "./chunk-5JMAGU26.js";
6
6
  import {
7
7
  runPostConsolidationMaterialize
8
- } from "./chunk-PBH2Z2NY.js";
8
+ } from "./chunk-DTLF2SLZ.js";
9
9
  import {
10
10
  isSemanticConsolidationLlmOperator
11
11
  } from "./chunk-G7D6GZ5J.js";
12
12
  import {
13
13
  countRecallTokenOverlap,
14
14
  normalizeRecallTokens
15
- } from "./chunk-ZBJMUXZH.js";
15
+ } from "./chunk-DJ7HMNSL.js";
16
16
  import {
17
17
  resolvePipelineProcessingCapabilities
18
18
  } from "./chunk-JUOZ62Y7.js";
@@ -220,4 +220,4 @@ export {
220
220
  buildExtensionsBlockForConsolidation,
221
221
  materializeAfterSemanticConsolidation
222
222
  };
223
- //# sourceMappingURL=chunk-DYDACAK2.js.map
223
+ //# sourceMappingURL=chunk-TGSMU3F2.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-KJTKLXTH.js";
4
4
  import {
5
5
  StorageManager
6
- } from "./chunk-ZJKLGS76.js";
6
+ } from "./chunk-CALURYWR.js";
7
7
  import {
8
8
  copyExistingFileToBackup,
9
9
  writeFileAtomically
@@ -260,4 +260,4 @@ export {
260
260
  backupExistingLedger,
261
261
  rebuildMemoryLifecycleLedger
262
262
  };
263
- //# sourceMappingURL=chunk-MJFDJTDC.js.map
263
+ //# sourceMappingURL=chunk-TIRJV2LW.js.map
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-7ZNJN5WZ.js";
20
20
  import {
21
21
  compareEntityTimestamps
22
- } from "./chunk-ZJKLGS76.js";
22
+ } from "./chunk-CALURYWR.js";
23
23
  import {
24
24
  normalizeEntityName
25
25
  } from "./chunk-YXZG5TVN.js";
@@ -929,4 +929,4 @@ export {
929
929
  entityIndexVersion,
930
930
  entityRecentTranscriptLookbackHours
931
931
  };
932
- //# sourceMappingURL=chunk-QRA3XVJX.js.map
932
+ //# sourceMappingURL=chunk-UDTME32W.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveCorpusNamespaceRoots
3
- } from "./chunk-7JAXC526.js";
3
+ } from "./chunk-EFWHCTYJ.js";
4
4
  import {
5
5
  capabilityAllowsNamespace
6
6
  } from "./chunk-MZWSOLMT.js";
@@ -200,4 +200,4 @@ async function readAggregateExtractionWatermark(options) {
200
200
  export {
201
201
  readAggregateExtractionWatermark
202
202
  };
203
- //# sourceMappingURL=chunk-LAM6UDFV.js.map
203
+ //# sourceMappingURL=chunk-WMOJIOIG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SUPPORT_PASSPORT_DRAFT_MAX_CONTENT_CHARACTERS,
3
3
  SUPPORT_PASSPORT_DRAFT_MAX_MEMORIES
4
- } from "./chunk-HKYNBEL4.js";
4
+ } from "./chunk-4FFROSFG.js";
5
5
  import {
6
6
  SUPPORT_PASSPORT_SOURCE_MEMORY_ID_MAX_LENGTH
7
7
  } from "./chunk-XDL5CYZN.js";
@@ -343,4 +343,4 @@ export {
343
343
  parseSupportPassportModelJob,
344
344
  SupportPassportModelBridge
345
345
  };
346
- //# sourceMappingURL=chunk-LLLY5IBK.js.map
346
+ //# sourceMappingURL=chunk-WR2YKUIW.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SupportPassportCreateGrantRequestSchema,
3
3
  defineOperation
4
- } from "./chunk-HKYNBEL4.js";
4
+ } from "./chunk-4FFROSFG.js";
5
5
  import {
6
6
  SupportPassportCardCategorySchema,
7
7
  SupportPassportMemoryIdSchema,
@@ -220,4 +220,4 @@ var supportPassportGrantAskOperation = defineOperation({
220
220
  result: await ctx.service.supportPassportAskGrant(grantId, secret, question, ctx.abortSignal)
221
221
  })
222
222
  });
223
- //# sourceMappingURL=chunk-KYI3CM42.js.map
223
+ //# sourceMappingURL=chunk-X6E7TT3A.js.map
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  countRecallTokenOverlap,
18
18
  normalizeRecallTokens
19
- } from "./chunk-ZBJMUXZH.js";
19
+ } from "./chunk-DJ7HMNSL.js";
20
20
  import {
21
21
  inferMemoryStatus,
22
22
  toMemoryPathRel
@@ -296,4 +296,4 @@ async function searchHarmonicRetrieval(options) {
296
296
  export {
297
297
  searchHarmonicRetrieval
298
298
  };
299
- //# sourceMappingURL=chunk-QN7XQEIT.js.map
299
+ //# sourceMappingURL=chunk-YIIC5IDU.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UYCIS6V5.js";
8
8
  import {
9
9
  StorageManager
10
- } from "./chunk-ZJKLGS76.js";
10
+ } from "./chunk-CALURYWR.js";
11
11
  import {
12
12
  parseContinuityImprovementLoops
13
13
  } from "./chunk-LDXUBPMO.js";
@@ -1283,4 +1283,4 @@ export {
1283
1283
  defaultTierMigrationCycleBudget,
1284
1284
  CompoundingEngine
1285
1285
  };
1286
- //# sourceMappingURL=chunk-JDJOAL4B.js.map
1286
+ //# sourceMappingURL=chunk-YSR3DXGC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeRecallTokens
3
- } from "./chunk-ZBJMUXZH.js";
3
+ } from "./chunk-DJ7HMNSL.js";
4
4
 
5
5
  // src/recall-query-policy.ts
6
6
  var DEFAULT_STOPWORDS = [
@@ -188,4 +188,4 @@ export {
188
188
  clampInstructionHeavyTokenCap,
189
189
  buildRecallQueryPolicy
190
190
  };
191
- //# sourceMappingURL=chunk-LBJBNWS2.js.map
191
+ //# sourceMappingURL=chunk-YTHQHH5U.js.map
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  WearablesInputError
3
3
  } from "./chunk-V7IZKJI3.js";
4
- import {
5
- WriteRateLimiter
6
- } from "./chunk-TB6CBZ5V.js";
7
4
  import {
8
5
  AdapterRegistry
9
6
  } from "./chunk-JBPKEARU.js";
7
+ import {
8
+ WriteRateLimiter
9
+ } from "./chunk-TB6CBZ5V.js";
10
10
  import {
11
11
  serializeInlineScriptValue
12
12
  } from "./chunk-3HSRWJTC.js";
13
13
  import {
14
14
  handleSupportPassportOwnerHttp
15
- } from "./chunk-EU74U4GT.js";
15
+ } from "./chunk-JDI7G6EA.js";
16
16
  import {
17
17
  buildSupportPassportPublicRequestHandler
18
- } from "./chunk-3G6YU5YD.js";
18
+ } from "./chunk-PSNN25DW.js";
19
19
  import {
20
20
  nonEmptyQueryParam,
21
21
  optionalQueryString,
@@ -30,10 +30,10 @@ import {
30
30
  processChatMessage,
31
31
  sessionBelongsToPrincipal,
32
32
  subscribeChatTranscript
33
- } from "./chunk-ETCVSZLG.js";
33
+ } from "./chunk-HSBQJRV2.js";
34
34
  import {
35
35
  RelayMissionStoreError
36
- } from "./chunk-YSUSUZR4.js";
36
+ } from "./chunk-JCJGYNIS.js";
37
37
  import {
38
38
  validateRequest
39
39
  } from "./chunk-JKW663ZN.js";
@@ -60,21 +60,21 @@ import {
60
60
  authorizationProbeNamespaces,
61
61
  authorizationProbeRequiresPrincipalNamespace,
62
62
  probeOperationAuthorization
63
- } from "./chunk-75U2FR7U.js";
63
+ } from "./chunk-QCI73Z7C.js";
64
64
  import {
65
65
  CorrectionContractError,
66
66
  getOperation,
67
67
  resolveQueryNamespaceWritablePreflight
68
- } from "./chunk-HKYNBEL4.js";
68
+ } from "./chunk-4FFROSFG.js";
69
69
  import {
70
70
  isTrustZoneName
71
- } from "./chunk-KQS72GCR.js";
71
+ } from "./chunk-LJOIZPJH.js";
72
72
  import {
73
73
  subscribeGraphEvents
74
74
  } from "./chunk-DEUNUKTD.js";
75
75
  import {
76
76
  isRecallDisclosure
77
- } from "./chunk-5WVUO6QT.js";
77
+ } from "./chunk-AR253JBM.js";
78
78
  import {
79
79
  OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
80
80
  OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
@@ -3397,4 +3397,4 @@ export {
3397
3397
  resolveDefaultAdminConsolePublicDir,
3398
3398
  EngramAccessHttpServer
3399
3399
  };
3400
- //# sourceMappingURL=chunk-JF6YSHJM.js.map
3400
+ //# sourceMappingURL=chunk-ZPGHA7EO.js.map
@@ -12,7 +12,8 @@ import {
12
12
  ContentHashIndex
13
13
  } from "./chunk-NRFU5MVH.js";
14
14
  import {
15
- computeLegacyContentHash
15
+ computeLegacyContentHash,
16
+ normalizeLegacyContent
16
17
  } from "./chunk-5FVVY2EB.js";
17
18
  import {
18
19
  storedContentIdentityCandidates
@@ -26,6 +27,7 @@ import { createHash } from "crypto";
26
27
  var RECONCILE_MANIFEST_FORMAT = "remnic-reconcile-manifest";
27
28
  var RECONCILE_MANIFEST_SCHEMA_VERSION = 1;
28
29
  var CONTENT_HASH_NORMALIZER_VERSION = 4;
30
+ var IDENTITY_RESOLUTION_VERSION = 2;
29
31
  var SHA256_PATTERN = /^[a-f0-9]{64}$/i;
30
32
  var MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);
31
33
  function isMemoryPath(filePath) {
@@ -51,12 +53,24 @@ function parsedMemoryIdentity(filePath, raw, parseMemory, citationTemplate) {
51
53
  const legacyMatch = [...candidates].reverse().find(
52
54
  (content) => computeLegacyContentHash(content) === storedHash
53
55
  );
54
- const contentHash = currentMatch ? ContentHashIndex.computeHash(currentMatch) : legacyMatch ? ContentHashIndex.computeHash(legacyMatch) : storedHash ?? bodyHash;
56
+ let contentHash;
57
+ let contentHashAliases;
58
+ if (currentMatch) {
59
+ contentHash = ContentHashIndex.computeHash(currentMatch);
60
+ } else if (legacyMatch && normalizeLegacyContent(legacyMatch).length > 0) {
61
+ contentHash = storedHash ?? bodyHash;
62
+ const recovered = ContentHashIndex.computeHash(legacyMatch);
63
+ if (recovered !== contentHash) contentHashAliases = [recovered];
64
+ } else {
65
+ contentHash = legacyMatch ? ContentHashIndex.computeHash(legacyMatch) : storedHash ?? bodyHash;
66
+ }
55
67
  return {
56
68
  id: parsed.frontmatter.id,
57
69
  category: parsed.frontmatter.category,
58
70
  contentHash,
71
+ ...contentHashAliases ? { contentHashAliases } : {},
59
72
  normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,
73
+ identityResolutionVersion: IDENTITY_RESOLUTION_VERSION,
60
74
  status: inferMemoryStatus(parsed.frontmatter, filePath)
61
75
  };
62
76
  }
@@ -83,7 +97,7 @@ async function buildReconcileManifest(options) {
83
97
  const files = [];
84
98
  for (const file of options.files) {
85
99
  const cached = cachedByPath.get(file.path);
86
- if (cached?.sha256.toLowerCase() === file.sha256.toLowerCase() && (cached.memory === void 0 || cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION)) {
100
+ if (cached?.sha256.toLowerCase() === file.sha256.toLowerCase() && (cached.memory === void 0 || cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION && cached.memory.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION)) {
87
101
  files.push({ ...file, ...cached.memory ? { memory: cached.memory } : {} });
88
102
  continue;
89
103
  }
@@ -111,7 +125,7 @@ function activeFactByPath(manifest) {
111
125
  return result;
112
126
  }
113
127
  function memoryIdentityHashes(memory) {
114
- return [memory.contentHash];
128
+ return [memory.contentHash, ...memory.contentHashAliases ?? []];
115
129
  }
116
130
  function contentHashRows(files, contentHash) {
117
131
  const rows = [];
@@ -284,4 +298,4 @@ export {
284
298
  buildReconcileManifest,
285
299
  collapseActiveFactDuplicates
286
300
  };
287
- //# sourceMappingURL=chunk-VUDALPI5.js.map
301
+ //# sourceMappingURL=chunk-ZQKXRKMR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reconcile/manifest.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { computeLegacyContentHash, normalizeLegacyContent } from \"../content-hash.js\";\nimport { inferMemoryStatus } from \"../memory-lifecycle-ledger-utils.js\";\nimport { ContentHashIndex, type ContentHashPathEntry } from \"../storage/content-hash-index.js\";\nimport { DEFAULT_CITATION_FORMAT, stripCitationForTemplate } from \"../source-attribution.js\";\nimport { storedContentIdentityCandidates } from \"../structured-attributes.js\";\nimport type { MemoryFrontmatter, MemoryStatus } from \"../types.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport {\n type ReconcileFileState,\n type ReconcilePlan,\n type ReconcilePlanEntry,\n type ReconcileSemanticAgreement,\n type ReconcileSemanticChange,\n summarizeReconcilePlan,\n} from \"./plan.js\";\n\nexport const RECONCILE_MANIFEST_FORMAT = \"remnic-reconcile-manifest\";\nexport const RECONCILE_MANIFEST_SCHEMA_VERSION = 1;\nconst CONTENT_HASH_NORMALIZER_VERSION = 4;\n/**\n * Version of the identity-resolution LOGIC (alias recovery, candidate\n * ordering), independent of the content normalizer: a cached manifest entry\n * written before an identity-resolution change carries an older value and is\n * reparsed even when its normalizerVersion still matches (issue #2367\n * review round 2). Bump when parsedMemoryIdentity's output shape or\n * semantics change.\n */\nconst IDENTITY_RESOLUTION_VERSION = 2;\n\nexport interface ReconcileMemoryIdentity {\n id: string;\n category: string;\n contentHash: string;\n /**\n * Recovered current-normalizer identities for a record whose persisted hash\n * is ambiguous under the legacy normalizer (issue #2367). The persisted\n * hash stays primary; these participate in duplicate bucketing so a\n * replica carrying the current form of the same fact still collapses.\n */\n contentHashAliases?: readonly string[];\n /** See IDENTITY_RESOLUTION_VERSION; absent on pre-versioning cache entries. */\n normalizerVersion?: number;\n identityResolutionVersion?: number;\n status: MemoryStatus;\n}\n\nexport interface ReconcileManifestFile extends ReconcileFileState {\n memory?: ReconcileMemoryIdentity;\n}\n\ntype ActiveFactManifestFile = ReconcileManifestFile & { memory: ReconcileMemoryIdentity };\n\nexport interface ReconcileManifest {\n format: typeof RECONCILE_MANIFEST_FORMAT;\n schemaVersion: typeof RECONCILE_MANIFEST_SCHEMA_VERSION;\n files: ReconcileManifestFile[];\n}\n\nexport type ReconcileMemoryParser = (\n raw: string,\n) => { frontmatter: MemoryFrontmatter; content: string } | null;\n\nexport interface BuildReconcileManifestOptions {\n files: Iterable<ReconcileFileState>;\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>;\n parseMemory: ReconcileMemoryParser;\n cachedFiles?: Iterable<ReconcileManifestFile>;\n citationTemplate?: string;\n}\n\nconst SHA256_PATTERN = /^[a-f0-9]{64}$/i;\nconst MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);\n\nfunction isMemoryPath(filePath: string): boolean {\n if (!filePath.endsWith(\".md\")) return false;\n const segments = filePath.split(\"/\");\n let index = 0;\n if (segments[index] === \"cold\" || segments[index] === \"archive\") index += 1;\n return MEMORY_DIRS.has(segments[index] ?? \"\");\n}\n\n\nfunction parsedMemoryIdentity(\n filePath: string,\n raw: Buffer | string,\n parseMemory: ReconcileMemoryParser,\n citationTemplate: string,\n): ReconcileMemoryIdentity | undefined {\n if (!isMemoryPath(filePath)) return undefined;\n const parsed = parseMemory(Buffer.isBuffer(raw) ? raw.toString(\"utf8\") : raw);\n if (!parsed?.frontmatter.id) return undefined;\n\n const storedHash =\n parsed.frontmatter.contentHash &&\n SHA256_PATTERN.test(parsed.frontmatter.contentHash)\n ? parsed.frontmatter.contentHash.toLowerCase()\n : undefined;\n const candidates = storedContentIdentityCandidates(parsed.content, (content) =>\n stripCitationForTemplate(content, citationTemplate)\n );\n const bodyHash = ContentHashIndex.computeHash(candidates[0] ?? \"\");\n const currentMatch = candidates.find(\n (content) => ContentHashIndex.computeHash(content) === storedHash\n );\n const legacyMatch = [...candidates].reverse().find(\n (content) => computeLegacyContentHash(content) === storedHash\n );\n let contentHash: string;\n let contentHashAliases: string[] | undefined;\n if (currentMatch) {\n contentHash = ContentHashIndex.computeHash(currentMatch);\n } else if (legacyMatch && normalizeLegacyContent(legacyMatch).length > 0) {\n // A non-empty legacy equality is ambiguous (issue #2367): the persisted\n // hash may be an explicit contentHashSource identity that merely collides\n // with the body's ASCII skeleton under the lossy legacy normalizer, and\n // nothing in the record proves which it is. Keep the persisted hash as\n // the primary identity and expose the recovered current identity as an\n // alias so replicas carrying either form still collapse.\n contentHash = storedHash ?? bodyHash;\n const recovered = ContentHashIndex.computeHash(legacyMatch);\n if (recovered !== contentHash) contentHashAliases = [recovered];\n } else {\n // An EMPTY legacy skeleton identifies nothing (every non-ASCII body maps\n // to it), so preserving it would collapse unrelated records. Recovering\n // the current identity here is repair, not replacement.\n contentHash = legacyMatch ? ContentHashIndex.computeHash(legacyMatch) : storedHash ?? bodyHash;\n }\n\n return {\n id: parsed.frontmatter.id,\n category: parsed.frontmatter.category,\n contentHash,\n ...(contentHashAliases ? { contentHashAliases } : {}),\n normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,\n identityResolutionVersion: IDENTITY_RESOLUTION_VERSION,\n status: inferMemoryStatus(parsed.frontmatter, filePath),\n };\n}\n\nexport async function buildReconcileManifestFile(\n file: ReconcileFileState,\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>,\n parseMemory: ReconcileMemoryParser,\n citationTemplate = DEFAULT_CITATION_FORMAT,\n): Promise<ReconcileManifestFile> {\n let raw: Buffer | string | null = null;\n if (isMemoryPath(file.path)) {\n try {\n raw = await readFile(file);\n } catch {\n raw = null;\n }\n }\n if (raw !== null && createHash(\"sha256\").update(raw).digest(\"hex\") !== file.sha256.toLowerCase()) {\n raw = null;\n }\n const memory = raw === null ? undefined : parsedMemoryIdentity(file.path, raw, parseMemory, citationTemplate);\n return { ...file, ...(memory ? { memory } : {}) };\n}\n\nexport async function buildReconcileManifest(options: BuildReconcileManifestOptions): Promise<ReconcileManifest> {\n const cachedByPath = new Map<string, ReconcileManifestFile>();\n for (const cached of options.cachedFiles ?? []) {\n cachedByPath.set(cached.path, cached);\n }\n\n const files: ReconcileManifestFile[] = [];\n for (const file of options.files) {\n const cached = cachedByPath.get(file.path);\n if (\n cached?.sha256.toLowerCase() === file.sha256.toLowerCase() &&\n (cached.memory === undefined ||\n (cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION &&\n cached.memory.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION))\n ) {\n files.push({ ...file, ...(cached.memory ? { memory: cached.memory } : {}) });\n continue;\n }\n\n files.push(await buildReconcileManifestFile(\n file,\n options.readFile,\n options.parseMemory,\n options.citationTemplate,\n ));\n }\n files.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0));\n return {\n format: RECONCILE_MANIFEST_FORMAT,\n schemaVersion: RECONCILE_MANIFEST_SCHEMA_VERSION,\n files,\n };\n}\n\nfunction activeFactByPath(manifest: ReconcileManifest | undefined): Map<string, ActiveFactManifestFile> {\n const result = new Map<string, ActiveFactManifestFile>();\n for (const file of manifest?.files ?? []) {\n if (file.memory?.category === \"fact\" && file.memory.status === \"active\") {\n result.set(file.path, file as ActiveFactManifestFile);\n }\n }\n return result;\n}\n\nfunction memoryIdentityHashes(memory: ReconcileMemoryIdentity): string[] {\n return [memory.contentHash, ...(memory.contentHashAliases ?? [])];\n}\n\nfunction contentHashRows(\n files: Iterable<ActiveFactManifestFile>,\n contentHash: string,\n): ContentHashPathEntry[] {\n const rows: ContentHashPathEntry[] = [];\n for (const file of files) {\n rows.push({ path: file.path, contentHash });\n }\n return rows;\n}\n\nfunction comparePlanEntries(left: ReconcilePlanEntry, right: ReconcilePlanEntry): number {\n if (left.namespace !== right.namespace) return left.namespace < right.namespace ? -1 : 1;\n return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;\n}\n\nfunction semanticAgreementKey(agreement: ReconcileSemanticAgreement): string {\n return `${agreement.local.path}\\0${agreement.peer.path}`;\n}\n\nfunction classifySemanticChange(\n current: ReconcileSemanticAgreement,\n prior: ReconcileSemanticAgreement | undefined\n): ReconcileSemanticChange {\n if (!prior) return \"unchanged\";\n const localChanged = current.local.sha256 !== prior.local.sha256;\n const peerChanged = current.peer.sha256 !== prior.peer.sha256;\n if (localChanged && peerChanged) return \"both_modified\";\n if (localChanged) return \"local_changed\";\n if (peerChanged) return \"peer_changed\";\n return \"unchanged\";\n}\n\nexport function collapseActiveFactDuplicates(\n plan: ReconcilePlan,\n localManifests: ReadonlyMap<string, ReconcileManifest>,\n peerManifests: ReadonlyMap<string, ReconcileManifest>,\n priorSemanticAgreements?: ReadonlyMap<string, readonly ReconcileSemanticAgreement[]>,\n): ReconcilePlan {\n const entriesByNamespace = new Map<string, ReconcilePlanEntry[]>();\n for (const entry of plan.entries) {\n const entries = entriesByNamespace.get(entry.namespace) ?? [];\n entries.push({ ...entry });\n entriesByNamespace.set(entry.namespace, entries);\n }\n\n let changed = false;\n for (const namespace of new Set([...localManifests.keys(), ...peerManifests.keys()])) {\n const entries = entriesByNamespace.get(namespace) ?? [];\n const localManifest = localManifests.get(namespace);\n const peerManifest = peerManifests.get(namespace);\n const localByPath = activeFactByPath(localManifest);\n const peerByPath = activeFactByPath(peerManifest);\n const localFilesByPath = new Map((localManifest?.files ?? []).map((file) => [file.path, file]));\n const peerFilesByPath = new Map((peerManifest?.files ?? []).map((file) => [file.path, file]));\n const priorSemanticByPathPair = new Map(\n (priorSemanticAgreements?.get(namespace) ?? []).map((agreement) => [\n semanticAgreementKey(agreement),\n agreement,\n ])\n );\n const localByHash = new Map<string, ActiveFactManifestFile[]>();\n const peerByHash = new Map<string, ActiveFactManifestFile[]>();\n\n for (const file of localByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = localByHash.get(hash) ?? [];\n bucket.push(file);\n localByHash.set(hash, bucket);\n }\n }\n for (const file of peerByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = peerByHash.get(hash) ?? [];\n bucket.push(file);\n peerByHash.set(hash, bucket);\n }\n }\n\n const removed = new Set<ReconcilePlanEntry>();\n const replacements: ReconcilePlanEntry[] = [];\n const processedPathPairs = new Set<string>();\n for (const hash of new Set([...localByHash.keys(), ...peerByHash.keys()])) {\n const localCandidates = (localByHash.get(hash) ?? []).filter((file) => {\n const opposite = peerFilesByPath.get(file.path);\n const activeOpposite = peerByPath.get(file.path);\n return opposite === undefined || (\n activeOpposite !== undefined &&\n memoryIdentityHashes(activeOpposite.memory).includes(hash)\n );\n });\n const peerCandidates = (peerByHash.get(hash) ?? []).filter((file) => {\n const opposite = localFilesByPath.get(file.path);\n const activeOpposite = localByPath.get(file.path);\n return opposite === undefined || (\n activeOpposite !== undefined &&\n memoryIdentityHashes(activeOpposite.memory).includes(hash)\n );\n });\n const localPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(localCandidates, hash));\n const peerPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(peerCandidates, hash));\n\n if (localPath && peerPath && localPath !== peerPath) {\n const pathPair = `${localPath}\\0${peerPath}`;\n if (processedPathPairs.has(pathPair)) continue;\n processedPathPairs.add(pathPair);\n const localFile = localByPath.get(localPath);\n const peerFile = peerByPath.get(peerPath);\n if (!localFile || !peerFile) continue;\n const duplicatePaths = new Set([\n ...localCandidates.map((file) => file.path),\n ...peerCandidates.map((file) => file.path),\n ]);\n const authoritativeSamePathEntries = new Set(entries.filter(\n (entry) =>\n duplicatePaths.has(entry.path)\n && localFilesByPath.has(entry.path)\n && peerFilesByPath.has(entry.path)\n && entry.action !== \"identical\"\n ));\n if (authoritativeSamePathEntries.size > 0) {\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path)\n && !authoritativeSamePathEntries.has(entry)\n && (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n changed = true;\n }\n }\n continue;\n }\n const unsafeEntry = entries.some(\n (entry) => duplicatePaths.has(entry.path) && (entry.action === \"suppress\" || entry.action === \"conflict\")\n );\n if (unsafeEntry) continue;\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path) &&\n (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n }\n }\n const semanticAgreement: ReconcileSemanticAgreement = {\n local: { path: localPath, sha256: localFile.sha256 },\n peer: { path: peerPath, sha256: peerFile.sha256 },\n };\n replacements.push({\n path: localPath < peerPath ? localPath : peerPath,\n namespace,\n action: \"identical\",\n reason: \"semantic_duplicate\",\n semanticAgreement,\n semanticChange: classifySemanticChange(\n semanticAgreement,\n priorSemanticByPathPair.get(semanticAgreementKey(semanticAgreement))\n ),\n });\n changed = true;\n continue;\n }\n\n const sameSideEntries = entries.filter((entry) => {\n if (localPath && entry.reason === \"local_only\") {\n return localCandidates.some((file) => file.path === entry.path);\n }\n if (peerPath && entry.reason === \"peer_only\") {\n return peerCandidates.some((file) => file.path === entry.path);\n }\n return false;\n });\n const canonicalPath = localPath ?? peerPath;\n const hasSharedCanonical = localPath !== undefined && localPath === peerPath;\n if (!canonicalPath || sameSideEntries.length === 0 || (!hasSharedCanonical && sameSideEntries.length < 2)) {\n continue;\n }\n for (const entry of sameSideEntries) {\n if (entry.path !== canonicalPath) {\n removed.add(entry);\n changed = true;\n }\n }\n }\n\n if (removed.size > 0 || replacements.length > 0) {\n entriesByNamespace.set(\n namespace,\n [...entries.filter((entry) => !removed.has(entry)), ...replacements].sort(comparePlanEntries)\n );\n }\n }\n\n if (!changed) return plan;\n const entries = [...entriesByNamespace.values()].flat().sort(comparePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),\n converged: entries.every((entry) => entry.action === \"identical\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAiBpB,IAAM,4BAA4B;AAClC,IAAM,oCAAoC;AACjD,IAAM,kCAAkC;AASxC,IAAM,8BAA8B;AA2CpC,IAAM,iBAAiB;AACvB,IAAM,cAAc,IAAI,IAAI,oBAAoB;AAEhD,SAAS,aAAa,UAA2B;AAC/C,MAAI,CAAC,SAAS,SAAS,KAAK,EAAG,QAAO;AACtC,QAAM,WAAW,SAAS,MAAM,GAAG;AACnC,MAAI,QAAQ;AACZ,MAAI,SAAS,KAAK,MAAM,UAAU,SAAS,KAAK,MAAM,UAAW,UAAS;AAC1E,SAAO,YAAY,IAAI,SAAS,KAAK,KAAK,EAAE;AAC9C;AAGA,SAAS,qBACP,UACA,KACA,aACA,kBACqC;AACrC,MAAI,CAAC,aAAa,QAAQ,EAAG,QAAO;AACpC,QAAM,SAAS,YAAY,OAAO,SAAS,GAAG,IAAI,IAAI,SAAS,MAAM,IAAI,GAAG;AAC5E,MAAI,CAAC,QAAQ,YAAY,GAAI,QAAO;AAEpC,QAAM,aACJ,OAAO,YAAY,eACnB,eAAe,KAAK,OAAO,YAAY,WAAW,IAC9C,OAAO,YAAY,YAAY,YAAY,IAC3C;AACN,QAAM,aAAa;AAAA,IAAgC,OAAO;AAAA,IAAS,CAAC,YAClE,yBAAyB,SAAS,gBAAg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a,cAAc;AACpE,UAAI,CAAC,iBAAiB,gBAAgB,WAAW,KAAM,CAAC,sBAAsB,gBAAgB,SAAS,GAAI;AACzG;AAAA,MACF;AACA,iBAAW,SAAS,iBAAiB;AACnC,YAAI,MAAM,SAAS,eAAe;AAChC,kBAAQ,IAAI,KAAK;AACjB,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAEA,QAAI,QAAQ,OAAO,KAAK,aAAa,SAAS,GAAG;AAC/C,yBAAmB;AAAA,QACjB;AAAA,QACA,CAAC,GAAGA,SAAQ,OAAO,CAAC,UAAU,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,GAAG,YAAY,EAAE,KAAK,kBAAkB;AAAA,MAC9F;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,UAAU,CAAC,GAAG,mBAAmB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,kBAAkB;AAC/E,SAAO;AAAA,IACL;AAAA,IACA,aAAa,uBAAuB,OAAO;AAAA,IAC3C,WAAW,QAAQ,MAAM,CAAC,UAAU,MAAM,WAAW,WAAW;AAAA,EAClE;AACF;","names":["entries"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveWorkProductLedgerDir,
3
3
  validateWorkProductLedgerEntry
4
- } from "./chunk-WT6UL3UA.js";
4
+ } from "./chunk-H7PRHUBD.js";
5
5
  import {
6
6
  TranscriptManager
7
7
  } from "./chunk-AM4T6CHX.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-NOB2T2FC.js";
12
12
  import {
13
13
  parseConfig
14
- } from "./chunk-BHO3IVAN.js";
14
+ } from "./chunk-RYST72N5.js";
15
15
  import {
16
16
  resolveObjectiveStateStoreDir,
17
17
  validateObjectiveStateSnapshot
@@ -268,4 +268,4 @@ export {
268
268
  recordResumeBundle,
269
269
  getResumeBundleStatus
270
270
  };
271
- //# sourceMappingURL=chunk-YG56A6XY.js.map
271
+ //# sourceMappingURL=chunk-ZS4JADYY.js.map
@@ -1,16 +1,16 @@
1
1
  import { CompoundingPromotionReport } from './compounding/engine.js';
2
2
  import { ConversationIndexBackendInspection } from './conversation-index/backend.js';
3
3
  import { MigrateObservationsResult } from './maintenance/migrate-observations.js';
4
- import { M as MemoryFile, l as MemoryFrontmatter, y as MemoryStatus, a6 as BehaviorSignalEvent, Q as QmdSearchResult, ab as BulkImportResult, ag as MemoryActionEvent, J as MemoryLifecycleEvent } from './types-BOANGhCJ.js';
5
- import { C as ConversationIndexCoordinator, T as TierMigrationCoordinator, O as Orchestrator } from './orchestrator-HPuY6I4i.js';
6
- import { S as StorageManager } from './storage-DS2O_6Qt.js';
4
+ import { M as MemoryFile, l as MemoryFrontmatter, y as MemoryStatus, a6 as BehaviorSignalEvent, Q as QmdSearchResult, ab as BulkImportResult, ag as MemoryActionEvent, J as MemoryLifecycleEvent } from './types-DWHOxlZP.js';
5
+ import { C as ConversationIndexCoordinator, T as TierMigrationCoordinator, O as Orchestrator } from './orchestrator-CFi-5JSR.js';
6
+ import { S as StorageManager } from './storage-BVAVitkO.js';
7
7
  import { TrustZoneDemoSeedResult, TrustZoneName, TrustZonePromotionResult, TrustZoneStoreStatus } from './trust-zones.js';
8
- import { f as EngramAccessService } from './access-service-BeDYQQ62.js';
8
+ import { f as EngramAccessService } from './access-service-M4LgO141.js';
9
9
  import { Writable, Readable } from 'node:stream';
10
10
  import { ResolveSecretRefFn } from './resolve-auth-token.js';
11
11
  import { CausalTrajectoryStoreStatus } from './causal-trajectory.js';
12
12
  import { C as ConnectorRunResult, a as ConnectorsOutputFormat } from './connectors-cli-2iaQ5tX2.js';
13
- import { P as ProcessBatchFn } from './pipeline-CvVe1Q2_.js';
13
+ import { P as ProcessBatchFn } from './pipeline-BdF3ferY.js';
14
14
  import { MemoryGovernanceRunResult, MemoryGovernanceSummary, MemoryGovernanceMetrics, MemoryGovernanceQualityScore, MemoryGovernanceReviewQueueEntry, MemoryGovernanceAppliedAction, MemoryGovernanceTransitionReport, MemoryGovernanceManifest, MemoryGovernanceRestoreManifest, RestoreMemoryGovernanceRunResult } from './maintenance/memory-governance.js';
15
15
  import { RebuildMemoryProjectionResult, RepairMemoryProjectionResult, VerifyMemoryProjectionResult } from './maintenance/rebuild-memory-projection.js';
16
16
  import { RebuildObservationsResult } from './maintenance/rebuild-observations.js';