@remnic/core 9.52.2 → 9.53.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 (255) hide show
  1. package/dist/access-admin-ops-surface.d.ts +5 -5
  2. package/dist/access-admin-ops-surface.js +22 -22
  3. package/dist/access-authorization-probe.d.ts +5 -5
  4. package/dist/access-authorization-probe.js +23 -23
  5. package/dist/access-boundary.d.ts +5 -5
  6. package/dist/access-boundary.js +22 -22
  7. package/dist/access-cli.js +54 -54
  8. package/dist/access-extraction-force-flush.d.ts +5 -5
  9. package/dist/access-extraction-force-flush.js +22 -22
  10. package/dist/access-http-lcm-compaction.d.ts +5 -5
  11. package/dist/access-http-lifecycle-flush.d.ts +5 -5
  12. package/dist/access-http-offline-stream.d.ts +5 -5
  13. package/dist/access-http-query.js +22 -22
  14. package/dist/access-http.d.ts +5 -5
  15. package/dist/access-http.js +29 -29
  16. package/dist/access-identity-continuity-surface.d.ts +4 -4
  17. package/dist/access-identity-continuity-surface.js +22 -22
  18. package/dist/access-lcm-surface.d.ts +5 -5
  19. package/dist/access-lcm-surface.js +22 -22
  20. package/dist/access-mcp.d.ts +5 -5
  21. package/dist/access-mcp.js +27 -27
  22. package/dist/access-namespace-preflight.js +22 -22
  23. package/dist/access-observe-write-surface.d.ts +5 -5
  24. package/dist/access-observe-write-surface.js +22 -22
  25. package/dist/access-offline-manifest.d.ts +4 -4
  26. package/dist/access-offline-manifest.js +8 -4
  27. package/dist/access-operations-batch.js +24 -24
  28. package/dist/access-operations.d.ts +8 -8
  29. package/dist/access-operations.js +26 -26
  30. package/dist/access-recall-concurrency.d.ts +5 -5
  31. package/dist/access-recall-concurrency.js +22 -22
  32. package/dist/access-recall-response.d.ts +5 -5
  33. package/dist/access-recall-response.js +22 -22
  34. package/dist/access-recall-surface.d.ts +5 -5
  35. package/dist/access-recall-surface.js +22 -22
  36. package/dist/access-schema.d.ts +88 -88
  37. package/dist/{access-service-Cbk3bNbD.d.ts → access-service-CgCjvbQu.d.ts} +3 -3
  38. package/dist/access-service-helpers.d.ts +5 -5
  39. package/dist/access-service.d.ts +5 -5
  40. package/dist/access-service.js +22 -22
  41. package/dist/access-surface-catalog.d.ts +5 -5
  42. package/dist/access-wearables-meetings-surface.d.ts +2 -2
  43. package/dist/active-recall.js +4 -4
  44. package/dist/{auto-sync-QFQGOEO2.js → auto-sync-JXEW7444.js} +6 -6
  45. package/dist/bootstrap.d.ts +4 -4
  46. package/dist/briefing.d.ts +1 -1
  47. package/dist/briefing.js +12 -12
  48. package/dist/buffer.d.ts +1 -1
  49. package/dist/causal-consolidation.js +13 -13
  50. package/dist/{chunk-MLXZD4WM.js → chunk-2GFK22OZ.js} +2 -2
  51. package/dist/{chunk-D5YOZ66N.js → chunk-3DWTDC54.js} +20 -20
  52. package/dist/{chunk-RANKJI5T.js → chunk-3JLPGJ43.js} +2 -2
  53. package/dist/chunk-5FVVY2EB.js +27 -0
  54. package/dist/chunk-5FVVY2EB.js.map +1 -0
  55. package/dist/{chunk-GXSOUIA4.js → chunk-5WQMORU5.js} +4 -4
  56. package/dist/{chunk-J272WKX2.js → chunk-6HPHEFXT.js} +2 -2
  57. package/dist/{chunk-B6LZ4IBH.js → chunk-6LAPLZOS.js} +2 -2
  58. package/dist/{chunk-WD5B5AIE.js → chunk-6R4G7N4S.js} +118 -173
  59. package/dist/chunk-6R4G7N4S.js.map +1 -0
  60. package/dist/{chunk-VXCNQYTC.js → chunk-APPFNGX6.js} +2 -2
  61. package/dist/{chunk-RMHMUUBW.js → chunk-AY43LBE4.js} +104 -48
  62. package/dist/{chunk-RMHMUUBW.js.map → chunk-AY43LBE4.js.map} +1 -1
  63. package/dist/{chunk-GXFSQ6SD.js → chunk-C4ZNGVK3.js} +2 -2
  64. package/dist/{chunk-JSEJH2YQ.js → chunk-CGVHPCP2.js} +2 -2
  65. package/dist/{chunk-BQIFZ2MP.js → chunk-CX5SW2EW.js} +41 -24
  66. package/dist/chunk-CX5SW2EW.js.map +1 -0
  67. package/dist/{chunk-TEMSWHQD.js → chunk-DZD576ZU.js} +5 -5
  68. package/dist/{chunk-AMTEYNYK.js → chunk-EVWWT3KE.js} +4 -4
  69. package/dist/{chunk-XAPMEU3K.js → chunk-FHFERRYE.js} +2 -2
  70. package/dist/{chunk-P2KBDJJ6.js → chunk-G2LUMAUF.js} +4 -3
  71. package/dist/{chunk-P2KBDJJ6.js.map → chunk-G2LUMAUF.js.map} +1 -1
  72. package/dist/{chunk-AXIDQG5A.js → chunk-G4T7L557.js} +5 -5
  73. package/dist/{chunk-7M6NYQWB.js → chunk-G7Z6EENO.js} +4 -4
  74. package/dist/{chunk-YXKVLYXU.js → chunk-HWRD23DW.js} +2 -2
  75. package/dist/{chunk-SOEN6KCF.js → chunk-IBKR2TFR.js} +2 -2
  76. package/dist/{chunk-R3DJVOSM.js → chunk-JDSVLVCG.js} +8 -1
  77. package/dist/chunk-JDSVLVCG.js.map +1 -0
  78. package/dist/{chunk-F4EU6VUC.js → chunk-JDZPNCMA.js} +2 -2
  79. package/dist/{chunk-DLG5V6ND.js → chunk-K4QS7LXU.js} +4 -7
  80. package/dist/chunk-K4QS7LXU.js.map +1 -0
  81. package/dist/{chunk-BAKXNQ3C.js → chunk-KRTY3ENI.js} +2 -2
  82. package/dist/{chunk-NK5RGJ65.js → chunk-L4DLLKPN.js} +2 -2
  83. package/dist/{chunk-VFSAWRMZ.js → chunk-LJS7KUPV.js} +2 -2
  84. package/dist/{chunk-JJRVPWFY.js → chunk-MLPTFODV.js} +166 -37
  85. package/dist/chunk-MLPTFODV.js.map +1 -0
  86. package/dist/{chunk-NOEMGE56.js → chunk-NH5IR2WM.js} +2 -2
  87. package/dist/{chunk-5V6IXHPI.js → chunk-NSVDUN76.js} +2 -2
  88. package/dist/{chunk-IARXXZU4.js → chunk-P7XI2AQ3.js} +2 -2
  89. package/dist/{chunk-W7Y5JDVB.js → chunk-PDDTI7IC.js} +4 -4
  90. package/dist/{chunk-QINJITDS.js → chunk-PX2LSHYM.js} +2 -2
  91. package/dist/{chunk-O5FFBO2M.js → chunk-QAVH6X2A.js} +2 -2
  92. package/dist/{chunk-HDIUYMSB.js → chunk-QWGE2PUH.js} +6 -6
  93. package/dist/{chunk-X57M2Q4I.js → chunk-RDJRFDJY.js} +3 -3
  94. package/dist/{chunk-RYLEDKQ2.js → chunk-RUMNY5DT.js} +3 -3
  95. package/dist/{chunk-BKIFTXHR.js → chunk-RZ4XGKOJ.js} +2 -2
  96. package/dist/{chunk-66SE3BNH.js → chunk-SUPEYLH2.js} +2 -2
  97. package/dist/{chunk-BF6SXNQJ.js → chunk-T2JHZWH6.js} +20 -20
  98. package/dist/{chunk-VHFXP27N.js → chunk-THPPCISA.js} +60 -23
  99. package/dist/chunk-THPPCISA.js.map +1 -0
  100. package/dist/{chunk-QPOHMO6M.js → chunk-UES4BHA2.js} +2 -2
  101. package/dist/{chunk-X7XEDOSL.js → chunk-VLL43QEQ.js} +8 -8
  102. package/dist/{chunk-QBSFOKY6.js → chunk-VOELBUS4.js} +4 -4
  103. package/dist/{chunk-2LY6GIIE.js → chunk-WDBX6VER.js} +2 -2
  104. package/dist/{chunk-BMEYMKWX.js → chunk-WM65LU67.js} +2 -2
  105. package/dist/{chunk-WLRD2TXF.js → chunk-WOPA3SGI.js} +4 -4
  106. package/dist/{chunk-5UZ6UCOZ.js → chunk-XUAMCLY4.js} +3 -3
  107. package/dist/{chunk-7HXZJAID.js → chunk-YGLY6QFV.js} +3 -3
  108. package/dist/{chunk-2OIQDTDC.js → chunk-ZPJ4QSGP.js} +2 -2
  109. package/dist/{chunk-3OY7KXHM.js → chunk-ZYLC7NFO.js} +3 -3
  110. package/dist/{cli-DMAFI0qt.d.ts → cli-D-HiEYhl.d.ts} +3 -3
  111. package/dist/cli.d.ts +6 -6
  112. package/dist/cli.js +41 -41
  113. package/dist/compounding/engine.d.ts +1 -1
  114. package/dist/compounding/engine.js +13 -13
  115. package/dist/config.js +4 -4
  116. package/dist/connectors/codex-materialize-runner.js +12 -12
  117. package/dist/connectors/index.js +12 -12
  118. package/dist/consolidation-provenance-check.d.ts +1 -1
  119. package/dist/consolidation-undo.d.ts +1 -1
  120. package/dist/content-hash.d.ts +12 -2
  121. package/dist/content-hash.js +9 -3
  122. package/dist/contradiction/index.d.ts +1 -1
  123. package/dist/contradiction/index.js +3 -3
  124. package/dist/convergence-refresh.d.ts +1 -1
  125. package/dist/convergence-refresh.js +14 -14
  126. package/dist/corpus-watermark.js +14 -14
  127. package/dist/entity-retrieval.d.ts +1 -1
  128. package/dist/entity-retrieval.js +12 -12
  129. package/dist/explicit-capture.d.ts +4 -4
  130. package/dist/explicit-capture.js +8 -8
  131. package/dist/external-wiki-access.d.ts +5 -5
  132. package/dist/external-wiki-access.js +23 -23
  133. package/dist/external-wiki-mcp-tools.d.ts +5 -5
  134. package/dist/extraction-normalization.js +2 -2
  135. package/dist/extraction-source-grounding.js +3 -3
  136. package/dist/extraction.js +16 -16
  137. package/dist/{forget-HDS4N6CG.js → forget-EHGGJZLX.js} +3 -2
  138. package/dist/{forget-HDS4N6CG.js.map → forget-EHGGJZLX.js.map} +1 -1
  139. package/dist/harmonic-construction.js +2 -2
  140. package/dist/harmonic-retrieval.js +4 -4
  141. package/dist/index.d.ts +684 -684
  142. package/dist/index.js +66 -66
  143. package/dist/maintenance/memory-governance.js +12 -12
  144. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
  145. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +12 -12
  146. package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
  147. package/dist/maintenance/rebuild-memory-projection.js +13 -13
  148. package/dist/{maintenance-kBII2qUI.d.ts → maintenance-CN_Ct-Hr.d.ts} +1 -1
  149. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  150. package/dist/memory-worth-outcomes.d.ts +1 -1
  151. package/dist/namespaces/migrate.d.ts +1 -1
  152. package/dist/namespaces/migrate.js +13 -13
  153. package/dist/namespaces/storage.d.ts +1 -1
  154. package/dist/namespaces/storage.js +12 -12
  155. package/dist/operator-doctor-corpus.js +15 -15
  156. package/dist/operator-toolkit.d.ts +1 -1
  157. package/dist/operator-toolkit.js +20 -20
  158. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  159. package/dist/orchestration/maintenance.d.ts +2 -2
  160. package/dist/orchestration/maintenance.js +17 -17
  161. package/dist/{orchestrator-DHy5LtTy.d.ts → orchestrator-B3Xe8qu0.d.ts} +3 -3
  162. package/dist/orchestrator.d.ts +4 -4
  163. package/dist/orchestrator.js +54 -54
  164. package/dist/provenance.js +2 -2
  165. package/dist/reconcile/manifest.d.ts +3 -1
  166. package/dist/reconcile/manifest.js +7 -3
  167. package/dist/{resolution-MDPNOEG6.js → resolution-MMOD5WC4.js} +4 -4
  168. package/dist/resume-bundles.js +5 -5
  169. package/dist/salvage-envelope.js +3 -3
  170. package/dist/schemas.d.ts +116 -116
  171. package/dist/semantic-consolidation.js +13 -13
  172. package/dist/semantic-rule-promotion.js +12 -12
  173. package/dist/semantic-rule-verifier.js +12 -12
  174. package/dist/{service-PT2_z7xm.d.ts → service-CQGEqL1g.d.ts} +1 -1
  175. package/dist/shared-context/manager.d.ts +8 -8
  176. package/dist/source-agent-qualifier.js +14 -14
  177. package/dist/{storage-BmVudhk4.d.ts → storage-DmkCjo0l.d.ts} +36 -32
  178. package/dist/storage.d.ts +1 -1
  179. package/dist/storage.js +14 -14
  180. package/dist/structured-attributes.d.ts +3 -1
  181. package/dist/structured-attributes.js +3 -1
  182. package/dist/tier-migration.d.ts +1 -1
  183. package/dist/transfer/types.d.ts +66 -66
  184. package/dist/verified-recall.js +12 -12
  185. package/dist/write-envelope.js +2 -2
  186. package/package.json +2 -2
  187. package/src/access-offline-manifest.ts +1 -0
  188. package/src/access-service-offline-file-content.test.ts +1 -0
  189. package/src/content-hash.ts +34 -1
  190. package/src/dedup/index.test.ts +56 -38
  191. package/src/dedup/index.ts +85 -38
  192. package/src/lifecycle/tombstones.test.ts +763 -16
  193. package/src/lifecycle/tombstones.ts +217 -50
  194. package/src/reconcile/manifest.test.ts +158 -1
  195. package/src/reconcile/manifest.ts +76 -22
  196. package/src/storage/content-hash-index.ts +56 -40
  197. package/src/storage/entity-ref-repair.ts +3 -3
  198. package/src/storage/memory-read-store.ts +9 -0
  199. package/src/storage/tombstone-blocked-capture-index.ts +4 -9
  200. package/src/storage-contract/content-hash.test.ts +13 -0
  201. package/src/storage-fact-hash-index-defer.test.ts +1 -1
  202. package/src/storage.ts +107 -93
  203. package/src/structured-attributes.ts +11 -0
  204. package/dist/chunk-BQIFZ2MP.js.map +0 -1
  205. package/dist/chunk-DLG5V6ND.js.map +0 -1
  206. package/dist/chunk-JJRVPWFY.js.map +0 -1
  207. package/dist/chunk-R3DJVOSM.js.map +0 -1
  208. package/dist/chunk-VHFXP27N.js.map +0 -1
  209. package/dist/chunk-W5H6ZRPT.js +0 -14
  210. package/dist/chunk-W5H6ZRPT.js.map +0 -1
  211. package/dist/chunk-WD5B5AIE.js.map +0 -1
  212. /package/dist/{auto-sync-QFQGOEO2.js.map → auto-sync-JXEW7444.js.map} +0 -0
  213. /package/dist/{chunk-MLXZD4WM.js.map → chunk-2GFK22OZ.js.map} +0 -0
  214. /package/dist/{chunk-D5YOZ66N.js.map → chunk-3DWTDC54.js.map} +0 -0
  215. /package/dist/{chunk-RANKJI5T.js.map → chunk-3JLPGJ43.js.map} +0 -0
  216. /package/dist/{chunk-GXSOUIA4.js.map → chunk-5WQMORU5.js.map} +0 -0
  217. /package/dist/{chunk-J272WKX2.js.map → chunk-6HPHEFXT.js.map} +0 -0
  218. /package/dist/{chunk-B6LZ4IBH.js.map → chunk-6LAPLZOS.js.map} +0 -0
  219. /package/dist/{chunk-VXCNQYTC.js.map → chunk-APPFNGX6.js.map} +0 -0
  220. /package/dist/{chunk-GXFSQ6SD.js.map → chunk-C4ZNGVK3.js.map} +0 -0
  221. /package/dist/{chunk-JSEJH2YQ.js.map → chunk-CGVHPCP2.js.map} +0 -0
  222. /package/dist/{chunk-TEMSWHQD.js.map → chunk-DZD576ZU.js.map} +0 -0
  223. /package/dist/{chunk-AMTEYNYK.js.map → chunk-EVWWT3KE.js.map} +0 -0
  224. /package/dist/{chunk-XAPMEU3K.js.map → chunk-FHFERRYE.js.map} +0 -0
  225. /package/dist/{chunk-AXIDQG5A.js.map → chunk-G4T7L557.js.map} +0 -0
  226. /package/dist/{chunk-7M6NYQWB.js.map → chunk-G7Z6EENO.js.map} +0 -0
  227. /package/dist/{chunk-YXKVLYXU.js.map → chunk-HWRD23DW.js.map} +0 -0
  228. /package/dist/{chunk-SOEN6KCF.js.map → chunk-IBKR2TFR.js.map} +0 -0
  229. /package/dist/{chunk-F4EU6VUC.js.map → chunk-JDZPNCMA.js.map} +0 -0
  230. /package/dist/{chunk-BAKXNQ3C.js.map → chunk-KRTY3ENI.js.map} +0 -0
  231. /package/dist/{chunk-NK5RGJ65.js.map → chunk-L4DLLKPN.js.map} +0 -0
  232. /package/dist/{chunk-VFSAWRMZ.js.map → chunk-LJS7KUPV.js.map} +0 -0
  233. /package/dist/{chunk-NOEMGE56.js.map → chunk-NH5IR2WM.js.map} +0 -0
  234. /package/dist/{chunk-5V6IXHPI.js.map → chunk-NSVDUN76.js.map} +0 -0
  235. /package/dist/{chunk-IARXXZU4.js.map → chunk-P7XI2AQ3.js.map} +0 -0
  236. /package/dist/{chunk-W7Y5JDVB.js.map → chunk-PDDTI7IC.js.map} +0 -0
  237. /package/dist/{chunk-QINJITDS.js.map → chunk-PX2LSHYM.js.map} +0 -0
  238. /package/dist/{chunk-O5FFBO2M.js.map → chunk-QAVH6X2A.js.map} +0 -0
  239. /package/dist/{chunk-HDIUYMSB.js.map → chunk-QWGE2PUH.js.map} +0 -0
  240. /package/dist/{chunk-X57M2Q4I.js.map → chunk-RDJRFDJY.js.map} +0 -0
  241. /package/dist/{chunk-RYLEDKQ2.js.map → chunk-RUMNY5DT.js.map} +0 -0
  242. /package/dist/{chunk-BKIFTXHR.js.map → chunk-RZ4XGKOJ.js.map} +0 -0
  243. /package/dist/{chunk-66SE3BNH.js.map → chunk-SUPEYLH2.js.map} +0 -0
  244. /package/dist/{chunk-BF6SXNQJ.js.map → chunk-T2JHZWH6.js.map} +0 -0
  245. /package/dist/{chunk-QPOHMO6M.js.map → chunk-UES4BHA2.js.map} +0 -0
  246. /package/dist/{chunk-X7XEDOSL.js.map → chunk-VLL43QEQ.js.map} +0 -0
  247. /package/dist/{chunk-QBSFOKY6.js.map → chunk-VOELBUS4.js.map} +0 -0
  248. /package/dist/{chunk-2LY6GIIE.js.map → chunk-WDBX6VER.js.map} +0 -0
  249. /package/dist/{chunk-BMEYMKWX.js.map → chunk-WM65LU67.js.map} +0 -0
  250. /package/dist/{chunk-WLRD2TXF.js.map → chunk-WOPA3SGI.js.map} +0 -0
  251. /package/dist/{chunk-5UZ6UCOZ.js.map → chunk-XUAMCLY4.js.map} +0 -0
  252. /package/dist/{chunk-7HXZJAID.js.map → chunk-YGLY6QFV.js.map} +0 -0
  253. /package/dist/{chunk-2OIQDTDC.js.map → chunk-ZPJ4QSGP.js.map} +0 -0
  254. /package/dist/{chunk-3OY7KXHM.js.map → chunk-ZYLC7NFO.js.map} +0 -0
  255. /package/dist/{resolution-MDPNOEG6.js.map → resolution-MMOD5WC4.js.map} +0 -0
@@ -14,15 +14,10 @@ import {
14
14
  applyTombstoneResurrectionGate,
15
15
  buildRetiredFactTombstoneInputs,
16
16
  collectRetiredMemoriesForRebuild
17
- } from "./chunk-JJRVPWFY.js";
17
+ } from "./chunk-MLPTFODV.js";
18
18
  import {
19
19
  withholdToolScopedFromSharedNamespace
20
20
  } from "./chunk-S2V7RUCL.js";
21
- import {
22
- DEFAULT_CITATION_FORMAT,
23
- hasCitation,
24
- stripCitationForTemplate
25
- } from "./chunk-J6A3CX5N.js";
26
21
  import {
27
22
  SPECULATIVE_TTL_DAYS,
28
23
  confidenceTier
@@ -61,16 +56,12 @@ import {
61
56
  isQueuedReviewMemory,
62
57
  parseTombstoneBlockedOfflineSyncMemory,
63
58
  tombstoneBlocked
64
- } from "./chunk-DLG5V6ND.js";
59
+ } from "./chunk-K4QS7LXU.js";
65
60
  import {
66
61
  composeMemoryEnvelope,
67
62
  isSealedMemoryEnvelope,
68
63
  sealedWriteToLegacyArgs
69
- } from "./chunk-5V6IXHPI.js";
70
- import {
71
- assemblePersistedBody,
72
- stripAttributesSuffix
73
- } from "./chunk-R3DJVOSM.js";
64
+ } from "./chunk-NSVDUN76.js";
74
65
  import {
75
66
  normalizeEntityName
76
67
  } from "./chunk-YXZG5TVN.js";
@@ -129,10 +120,7 @@ import {
129
120
  parseProvenanceTag,
130
121
  reconcileProvenanceRead,
131
122
  serializeProvenanceFields
132
- } from "./chunk-QBSFOKY6.js";
133
- import {
134
- sanitizeMemoryContent
135
- } from "./chunk-5GKPFL3S.js";
123
+ } from "./chunk-VOELBUS4.js";
136
124
  import {
137
125
  matchEntitySchemaSection,
138
126
  normalizeEntityStructuredSection,
@@ -147,6 +135,11 @@ import {
147
135
  import {
148
136
  selectArtifactMatches
149
137
  } from "./chunk-Z7L72ZHL.js";
138
+ import {
139
+ DEFAULT_CITATION_FORMAT,
140
+ hasCitationForTemplate,
141
+ stripCitationForTemplate
142
+ } from "./chunk-J6A3CX5N.js";
150
143
  import {
151
144
  ProjectionLedgerLagManager,
152
145
  appendLifecycleEventsSerialized,
@@ -181,7 +174,7 @@ import {
181
174
  CONTENT_HASH_INDEX_RETRY_MAX_DELAY_MS,
182
175
  ContentHashIndex,
183
176
  FactHashIndexNotAuthoritativeError
184
- } from "./chunk-BQIFZ2MP.js";
177
+ } from "./chunk-CX5SW2EW.js";
185
178
  import {
186
179
  markProjectedMemoryPathInvalid,
187
180
  readProjectedGovernanceRecord,
@@ -190,9 +183,20 @@ import {
190
183
  readProjectedMemoryTimeline,
191
184
  updateProjectedMemoryPath
192
185
  } from "./chunk-3CSX3ETE.js";
186
+ import {
187
+ assemblePersistedBody,
188
+ storedContentIdentityCandidates,
189
+ stripAttributesSuffix
190
+ } from "./chunk-JDSVLVCG.js";
193
191
  import {
194
192
  withHeldFileLock
195
193
  } from "./chunk-FFAZ2XFU.js";
194
+ import {
195
+ computeLegacyContentHash
196
+ } from "./chunk-5FVVY2EB.js";
197
+ import {
198
+ sanitizeMemoryContent
199
+ } from "./chunk-5GKPFL3S.js";
196
200
  import {
197
201
  parseFlexibleIsoTimestamp
198
202
  } from "./chunk-P7FMDTKL.js";
@@ -448,6 +452,14 @@ var MemoryReadStore = class {
448
452
  options
449
453
  );
450
454
  }
455
+ async collectTombstoneMigrationPaths() {
456
+ const tiers = await Promise.all([
457
+ this.collectActiveMemoryPaths(),
458
+ this.collectColdMemoryPaths(),
459
+ this.collectContainedMarkdownPaths([path.join(this.deps.baseDir, "archive")])
460
+ ]);
461
+ return tiers.flat();
462
+ }
451
463
  async readMemoriesWindow(options = {}) {
452
464
  const allPaths = await this.deps.collectActiveMemoryPaths();
453
465
  const sortedPaths = this.deps.orderWindowPaths(allPaths);
@@ -3469,13 +3481,13 @@ var EntityRefRepair = class {
3469
3481
  * #2213): fail-open, add-only; writeMemory's gate + chunk-repair re-gate
3470
3482
  * consult this one implementation (rule 43).
3471
3483
  */
3472
- async gate(fm, hashSource, structuredAttributes) {
3484
+ async gate(fm, canonicalBody, structuredAttributes) {
3473
3485
  if (!this.deps.tombstonesEnabled()) return null;
3474
3486
  try {
3475
3487
  const store = await this.deps.getTombstoneStore();
3476
3488
  const supersessionKeys = fm.entityRef && structuredAttributes ? supersessionKeysForFact({ entityRef: fm.entityRef, structuredAttributes }) : [];
3477
3489
  const match = applyTombstoneResurrectionGate(store, fm, {
3478
- normalizedText: ContentHashIndex.normalizeContent(hashSource),
3490
+ normalizedText: ContentHashIndex.normalizeContent(canonicalBody),
3479
3491
  supersessionKeys,
3480
3492
  namespace: this.deps.tombstonesNamespace()
3481
3493
  });
@@ -3502,7 +3514,7 @@ var EntityRefRepair = class {
3502
3514
  frontmatter: fm,
3503
3515
  rewrite: async () => {
3504
3516
  if (opts.regateFact && fm.category === "fact") {
3505
- await this.gate(fm, body, void 0);
3517
+ await this.gate(fm, body, fm.structuredAttributes);
3506
3518
  }
3507
3519
  await this.deps.writeTombstoneBlockedMemory(
3508
3520
  filePath,
@@ -5428,87 +5440,6 @@ var MeetingRecordStore = class {
5428
5440
  };
5429
5441
  var SORT_STR = (a, b) => a < b ? -1 : a > b ? 1 : 0;
5430
5442
 
5431
- // src/storage/citation-hash-source.ts
5432
- function trimTrailingSpacesAndTabs(value) {
5433
- let end = value.length;
5434
- while (end > 0 && (value[end - 1] === " " || value[end - 1] === " ")) {
5435
- end -= 1;
5436
- }
5437
- return end === value.length ? value : value.slice(0, end);
5438
- }
5439
- function trimLeadingSpacesAndTabs(value) {
5440
- let start = 0;
5441
- while (start < value.length && (value[start] === " " || value[start] === " ")) {
5442
- start += 1;
5443
- }
5444
- return start === 0 ? value : value.slice(start);
5445
- }
5446
- function stripDefaultCitationMarkersWithoutRegex(value) {
5447
- return stripCitationMarkersForHashRemoval(value, DEFAULT_CITATION_FORMAT);
5448
- }
5449
- function citationTemplateLiteralParts(template) {
5450
- const parts = [];
5451
- let cursor = 0;
5452
- while (cursor < template.length) {
5453
- const open3 = template.indexOf("{", cursor);
5454
- if (open3 === -1) {
5455
- parts.push(template.slice(cursor));
5456
- break;
5457
- }
5458
- parts.push(template.slice(cursor, open3));
5459
- const close = template.indexOf("}", open3 + 1);
5460
- if (close === -1) {
5461
- cursor = open3 + 1;
5462
- } else {
5463
- cursor = close + 1;
5464
- }
5465
- }
5466
- return parts.filter((part) => part.length > 0);
5467
- }
5468
- function stripCitationMarkersForHashRemoval(value, template) {
5469
- const parts = citationTemplateLiteralParts(template);
5470
- if (parts.length === 0) return value;
5471
- const first = parts[0];
5472
- const lowerValue = value.toLowerCase();
5473
- const lowerFirst = first.toLowerCase();
5474
- const lowerParts = parts.map((part) => part.toLowerCase());
5475
- if (!lowerValue.includes(lowerFirst)) return value;
5476
- let result = "";
5477
- let cursor = 0;
5478
- let removed = false;
5479
- while (cursor < value.length) {
5480
- const markerStart = lowerValue.indexOf(lowerFirst, cursor);
5481
- if (markerStart === -1) {
5482
- result += value.slice(cursor);
5483
- break;
5484
- }
5485
- const boundedEnd = first.startsWith("[") ? value.indexOf("]", markerStart + first.length) : -1;
5486
- if (first.startsWith("[") && boundedEnd === -1) {
5487
- result += value.slice(cursor);
5488
- break;
5489
- }
5490
- const searchLimit = boundedEnd === -1 ? value.length : boundedEnd + 1;
5491
- let markerEnd = markerStart + first.length;
5492
- let matched = true;
5493
- for (let i = 1; i < lowerParts.length; i += 1) {
5494
- const partIndex = lowerValue.indexOf(lowerParts[i], markerEnd);
5495
- if (partIndex === -1 || partIndex + parts[i].length > searchLimit) {
5496
- matched = false;
5497
- break;
5498
- }
5499
- markerEnd = partIndex + parts[i].length;
5500
- }
5501
- if (!matched) {
5502
- result += value.slice(cursor);
5503
- break;
5504
- }
5505
- result += trimTrailingSpacesAndTabs(value.slice(cursor, markerStart));
5506
- cursor = markerEnd;
5507
- removed = true;
5508
- }
5509
- return removed ? trimLeadingSpacesAndTabs(result) : value;
5510
- }
5511
-
5512
5443
  // src/storage/supersession-audit.ts
5513
5444
  import { readdir as readdir5 } from "fs/promises";
5514
5445
  import path10 from "path";
@@ -8059,22 +7990,50 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8059
7990
  }
8060
7991
  }
8061
7992
  buildTombstoneStore() {
7993
+ let sourcePathsPromise;
7994
+ let sourceContentsByIdPromise;
8062
7995
  const options = {
8063
7996
  enabled: this.tombstonesConfig.enabled,
8064
7997
  semanticMatch: this.tombstonesConfig.semanticMatch,
8065
7998
  semanticThreshold: this.tombstonesConfig.semanticThreshold,
8066
- // Wire the SAME helpers the dedup index uses (rule 23 / checklist §13):
8067
- // hashContent = ContentHashIndex.computeHash, normalizeText =
8068
- // ContentHashIndex.normalizeContent. Importing them here (not copying)
8069
- // guarantees the tombstone tiers can never drift from dedup.
8070
7999
  hashContent: ContentHashIndex.computeHash,
8071
- normalizeText: ContentHashIndex.normalizeContent
8000
+ normalizeText: ContentHashIndex.normalizeContent,
8001
+ sourceContentsForMemoryIds: async (sourceMemoryIds) => {
8002
+ const requested = new Set(sourceMemoryIds);
8003
+ const sourcePaths = await (sourcePathsPromise ??= this.memoryReadStore.collectTombstoneMigrationPaths());
8004
+ const directPaths = sourcePaths.filter(
8005
+ (filePath) => requested.has(path11.basename(filePath, ".md"))
8006
+ );
8007
+ const contents = /* @__PURE__ */ new Map();
8008
+ for (const memory of await this.readParsedMemoriesFromPaths(directPaths, 50)) {
8009
+ const id = memory.frontmatter.id;
8010
+ if (requested.has(id) && !contents.has(id)) {
8011
+ contents.set(id, this.storedContentIdentityCandidates(memory.content));
8012
+ }
8013
+ }
8014
+ if (contents.size === requested.size) return contents;
8015
+ sourceContentsByIdPromise ??= (async () => {
8016
+ const allContents2 = /* @__PURE__ */ new Map();
8017
+ for (const memory of await this.readParsedMemoriesFromPaths(sourcePaths, 50)) {
8018
+ const id = memory.frontmatter.id;
8019
+ if (!allContents2.has(id)) {
8020
+ allContents2.set(id, this.storedContentIdentityCandidates(memory.content));
8021
+ }
8022
+ }
8023
+ return allContents2;
8024
+ })();
8025
+ const allContents = await sourceContentsByIdPromise;
8026
+ for (const id of requested) {
8027
+ const content = allContents.get(id);
8028
+ if (content !== void 0) contents.set(id, content);
8029
+ }
8030
+ return contents;
8031
+ }
8072
8032
  };
8073
8033
  const io = {
8074
8034
  read: (filePath) => this.readStorageSecureFile(filePath),
8075
8035
  append: (filePath, content) => this.appendStorageSecureFile(filePath, content),
8076
8036
  write: (filePath, content) => this.writeStorageSecureFile(filePath, content),
8077
- // stat lets the store own its cross-process staleness probe (#1579).
8078
8037
  stat: (filePath) => statSync(filePath)
8079
8038
  };
8080
8039
  return new TombstoneStore(this.tombstonesPath, this.tombstonesConfig.namespace, options, io);
@@ -8270,7 +8229,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8270
8229
  const baseMs = this.factHashIndexLockOptions.retryBaseMs ?? FACT_HASH_INDEX_REBUILD_RETRY_BASE_MS;
8271
8230
  let published = false;
8272
8231
  for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
8273
- published = await factHashIndex.rebuildUnderLock(() => this.rebuildFactHashIndexFromCorpus(factHashIndex));
8232
+ published = await factHashIndex.rebuildUnderLock(
8233
+ () => this.rebuildFactHashIndexFromCorpus(factHashIndex)
8234
+ );
8274
8235
  if (published || attempt === maxAttempts - 1) break;
8275
8236
  const wait = Math.min(baseMs * 2 ** attempt, CONTENT_HASH_INDEX_RETRY_MAX_DELAY_MS);
8276
8237
  await new Promise((resolve3) => setTimeout(resolve3, wait));
@@ -8300,13 +8261,15 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8300
8261
  let legacyRecovered = 0;
8301
8262
  for (const memory of existing) {
8302
8263
  if (inferMemoryStatus(memory.frontmatter, memory.path) !== "active") continue;
8303
- const hash = this.corpusRegisteredHash(memory);
8304
- if (hash === null) {
8264
+ const hashes = this.corpusRegisteredHashes(memory);
8265
+ if (hashes.length === 0) {
8305
8266
  legacyRecovered++;
8306
8267
  continue;
8307
8268
  }
8308
- factHashIndex.addByHash(hash);
8309
- if (memory.frontmatter.category === "fact") this.factOnlyHashes.add(hash);
8269
+ for (const hash of hashes) {
8270
+ factHashIndex.addByHash(hash);
8271
+ if (memory.frontmatter.category === "fact") this.factOnlyHashes.add(hash);
8272
+ }
8310
8273
  }
8311
8274
  if (legacyRecovered > 0) {
8312
8275
  log.info(
@@ -8314,38 +8277,23 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8314
8277
  );
8315
8278
  }
8316
8279
  }
8317
- /**
8318
- * The content-hash the corpus rebuild registers for `memory`, or null when the
8319
- * body carries a citation from an unknown/custom template that cannot be
8320
- * safely stripped. Shared by the authoritative rebuild and the fact-only
8321
- * corpus confirmation (`hasFactContentHash`) so both derive the identical
8322
- * hash for a given stored body.
8323
- *
8324
- * Preference order:
8325
- * 1. frontmatter.contentHash — the raw pre-citation hash writeMemory records
8326
- * for facts (issue #369 round 8); matches hasFactContentHash(rawFact).
8327
- * 2. Reconstruct from the stored body: strip the "[Attributes: …]" suffix
8328
- * writeMemory appends for structuredAttributes (registration hashed the
8329
- * raw canonical content WITHOUT it — a no-op when absent), then strip a
8330
- * recognised citation and hash the bare body, or hash a citation-free
8331
- * body as-is.
8332
- * 3. A body with a citation from an unknown/custom template → null: a
8333
- * false-negative miss beats a wrong hash that would permanently suppress
8334
- * legitimate duplicate writes.
8335
- */
8336
- corpusRegisteredHash(memory) {
8337
- if (memory.frontmatter.contentHash) {
8338
- return memory.frontmatter.contentHash;
8339
- }
8340
- const content = stripAttributesSuffix(memory.content);
8341
- const stripped = stripCitationForTemplate(content, this.citationTemplate);
8342
- if (stripped !== content) {
8343
- return ContentHashIndex.computeHash(sanitizeMemoryContent(stripped).text);
8344
- }
8345
- if (!hasCitation(content)) {
8346
- return ContentHashIndex.computeHash(sanitizeMemoryContent(content).text);
8347
- }
8348
- return null;
8280
+ storedContentIdentityCandidates(content) {
8281
+ return storedContentIdentityCandidates(
8282
+ content,
8283
+ (value) => hasCitationForTemplate(value, this.citationTemplate) ? stripCitationForTemplate(value, this.citationTemplate) : value
8284
+ );
8285
+ }
8286
+ /** Returns the current body identity while preserving explicit external identities. */
8287
+ corpusRegisteredHashes(memory) {
8288
+ const persistedHash = memory.frontmatter.contentHash;
8289
+ const candidates = this.storedContentIdentityCandidates(memory.content).map((content) => sanitizeMemoryContent(content).text);
8290
+ const currentHashes = candidates.map((content) => ContentHashIndex.computeHash(content));
8291
+ if (persistedHash && currentHashes.includes(persistedHash)) return [persistedHash];
8292
+ if (!persistedHash) return [currentHashes[0] ?? ContentHashIndex.computeHash("")];
8293
+ const legacyMatches = candidates.filter(
8294
+ (content) => computeLegacyContentHash(content) === persistedHash
8295
+ );
8296
+ return legacyMatches.length > 0 ? [...new Set(legacyMatches.map((content) => ContentHashIndex.computeHash(content)))] : [persistedHash];
8349
8297
  }
8350
8298
  get questionsDir() {
8351
8299
  return path11.join(this.baseDir, "questions");
@@ -8680,7 +8628,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8680
8628
  }
8681
8629
  if (category !== "fact" || factHashSourceForTombstone === null) return;
8682
8630
  const statusBefore = fm.status;
8683
- const match = await this.entityRefRepair.gate(fm, factHashSourceForTombstone, options.structuredAttributes);
8631
+ const match = await this.entityRefRepair.gate(fm, sanitized.text, options.structuredAttributes);
8684
8632
  if (match) {
8685
8633
  gateRef = fm.entityRef;
8686
8634
  statusBeforeBlock = statusBefore;
@@ -8820,28 +8768,25 @@ ${sanitized.text}
8820
8768
  for (const memory of existing) {
8821
8769
  if (memory.frontmatter.category !== "fact") continue;
8822
8770
  if (inferMemoryStatus(memory.frontmatter, memory.path) !== "active") continue;
8823
- if (this.corpusRegisteredHash(memory) === targetHash) return true;
8771
+ if (this.corpusRegisteredHashes(memory).includes(targetHash)) return true;
8824
8772
  }
8825
8773
  return false;
8826
8774
  }
8827
- factContentHashForRemoval(memory) {
8828
- if (memory.frontmatter.category !== "fact") return null;
8829
- if (typeof memory.frontmatter.contentHash === "string" && memory.frontmatter.contentHash.length > 0) {
8830
- return memory.frontmatter.contentHash;
8831
- }
8832
- const configuredHashSource = stripCitationMarkersForHashRemoval(memory.content, this.citationTemplate);
8833
- const hashSource = configuredHashSource !== memory.content ? configuredHashSource : stripDefaultCitationMarkersWithoutRegex(memory.content);
8834
- return ContentHashIndex.computeHash(sanitizeMemoryContent(hashSource).text);
8775
+ factContentHashesForRemoval(memory) {
8776
+ if (memory.frontmatter.category !== "fact") return [];
8777
+ return this.corpusRegisteredHashes(memory);
8835
8778
  }
8836
8779
  async addActiveFactContentHash(memory) {
8837
8780
  if (memory.frontmatter.category !== "fact") return;
8838
8781
  if (inferMemoryStatus(memory.frontmatter, memory.path) !== "active") return;
8839
- const hash = this.factContentHashForRemoval(memory);
8840
- if (!hash) return;
8782
+ const hashes = this.factContentHashesForRemoval(memory);
8783
+ if (hashes.length === 0) return;
8841
8784
  await this.ensureFactHashIndexAuthoritative();
8842
8785
  const factHashIndex = await this.getFactHashIndex();
8843
- factHashIndex.addByHash(hash);
8844
- this.factOnlyHashes.add(hash);
8786
+ for (const hash of hashes) {
8787
+ factHashIndex.addByHash(hash);
8788
+ this.factOnlyHashes.add(hash);
8789
+ }
8845
8790
  await factHashIndex.saveMergingWithDisk();
8846
8791
  await factHashIndex.flushReconcileRetry();
8847
8792
  }
@@ -8863,15 +8808,16 @@ ${sanitized.text}
8863
8808
  }
8864
8809
  async syncFactHashIndexAfterRewrite(before, after) {
8865
8810
  if (before.frontmatter.category !== "fact" && after.frontmatter.category !== "fact") return;
8866
- const beforeHash = this.factContentHashForRemoval(before);
8867
- const afterHash = this.factContentHashForRemoval(after);
8811
+ const beforeHashes = this.factContentHashesForRemoval(before);
8812
+ const afterHashes = this.factContentHashesForRemoval(after);
8868
8813
  const beforeStatus = inferMemoryStatus(before.frontmatter, before.path);
8869
8814
  const afterStatus = inferMemoryStatus(after.frontmatter, after.path);
8870
- if (beforeHash === afterHash && beforeStatus === afterStatus) return;
8871
- if (beforeStatus === "active" && beforeHash && (beforeHash !== afterHash || afterStatus !== "active")) {
8815
+ const hashesChanged = beforeHashes.length !== afterHashes.length || beforeHashes.some((hash, index) => hash !== afterHashes[index]);
8816
+ if (!hashesChanged && beforeStatus === afterStatus) return;
8817
+ if (beforeStatus === "active" && beforeHashes.length > 0 && (hashesChanged || afterStatus !== "active")) {
8872
8818
  await this.removeFactContentHashesForMemories([before]);
8873
8819
  }
8874
- if (afterStatus === "active" && afterHash && (beforeHash !== afterHash || beforeStatus !== "active")) {
8820
+ if (afterStatus === "active" && afterHashes.length > 0 && (hashesChanged || beforeStatus !== "active")) {
8875
8821
  await this.addActiveFactContentHash(after);
8876
8822
  }
8877
8823
  }
@@ -8881,11 +8827,10 @@ ${sanitized.text}
8881
8827
  const removedIds = new Set(
8882
8828
  memories.map((memory) => memory.frontmatter.id).filter((id) => typeof id === "string" && id.length > 0)
8883
8829
  );
8884
- const removedHashes = /* @__PURE__ */ new Map();
8830
+ const removedHashes = /* @__PURE__ */ new Set();
8885
8831
  for (const memory of memories) {
8886
- const hash = this.factContentHashForRemoval(memory);
8887
- if (hash) {
8888
- removedHashes.set(memory, hash);
8832
+ for (const hash of this.factContentHashesForRemoval(memory)) {
8833
+ removedHashes.add(hash);
8889
8834
  }
8890
8835
  }
8891
8836
  if (removedHashes.size === 0) return;
@@ -8895,12 +8840,11 @@ ${sanitized.text}
8895
8840
  if (memory.frontmatter.category !== "fact") continue;
8896
8841
  if (removedIds.has(memory.frontmatter.id)) continue;
8897
8842
  if (inferMemoryStatus(memory.frontmatter, memory.path) !== "active") continue;
8898
- const hash = this.factContentHashForRemoval(memory);
8899
- if (hash) {
8843
+ for (const hash of this.factContentHashesForRemoval(memory)) {
8900
8844
  remainingActiveHashes.add(hash);
8901
8845
  }
8902
8846
  }
8903
- for (const hash of removedHashes.values()) {
8847
+ for (const hash of removedHashes) {
8904
8848
  if (!remainingActiveHashes.has(hash)) {
8905
8849
  factHashIndex.removeByHash(hash);
8906
8850
  this.factOnlyHashes.delete(hash);
@@ -8922,8 +8866,9 @@ ${sanitized.text}
8922
8866
  */
8923
8867
  removeFactOnlyHashForMemory(memory) {
8924
8868
  if (memory.frontmatter.category !== "fact") return;
8925
- const hash = this.factContentHashForRemoval(memory);
8926
- if (hash) this.factOnlyHashes.delete(hash);
8869
+ for (const hash of this.factContentHashesForRemoval(memory)) {
8870
+ this.factOnlyHashes.delete(hash);
8871
+ }
8927
8872
  }
8928
8873
  async isFactContentHashAuthoritative() {
8929
8874
  return await this.ensureFactHashIndexAuthoritative();
@@ -11387,4 +11332,4 @@ export {
11387
11332
  isValidBufferSurpriseEvent,
11388
11333
  StorageManager3 as StorageManager
11389
11334
  };
11390
- //# sourceMappingURL=chunk-WD5B5AIE.js.map
11335
+ //# sourceMappingURL=chunk-6R4G7N4S.js.map