@remnic/core 10.0.36 → 10.0.37

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 (364) hide show
  1. package/dist/access-admin-ops-surface.js +77 -77
  2. package/dist/access-authorization-probe.js +78 -78
  3. package/dist/access-boundary.js +77 -77
  4. package/dist/access-citation-namespace.js +2 -2
  5. package/dist/access-cli.js +168 -166
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-extraction-force-flush.js +77 -77
  8. package/dist/access-http-briefing.js +78 -78
  9. package/dist/access-http-query.js +79 -79
  10. package/dist/access-http.js +100 -100
  11. package/dist/access-identity-continuity-surface.js +77 -77
  12. package/dist/access-lcm-surface.js +77 -77
  13. package/dist/access-mcp.js +89 -89
  14. package/dist/access-namespace-preflight.js +77 -77
  15. package/dist/access-observe-write-category.js +13 -13
  16. package/dist/access-observe-write-surface.js +77 -77
  17. package/dist/access-offline-manifest.js +12 -12
  18. package/dist/access-operations-batch.js +81 -81
  19. package/dist/access-operations.js +88 -88
  20. package/dist/access-recall-concurrency.js +77 -77
  21. package/dist/access-recall-response.js +77 -77
  22. package/dist/access-recall-surface.js +77 -77
  23. package/dist/access-schema.js +8 -8
  24. package/dist/access-service.js +77 -77
  25. package/dist/access-surface-catalog.js +79 -79
  26. package/dist/active-recall.js +40 -40
  27. package/dist/adapters/index.js +7 -7
  28. package/dist/adapters/registry.js +3 -3
  29. package/dist/{auto-sync-VPHR3FBI.js → auto-sync-R3XGJL5I.js} +7 -7
  30. package/dist/briefing.js +29 -29
  31. package/dist/buffer-eviction.d.ts +16 -0
  32. package/dist/buffer-eviction.d.ts.map +1 -0
  33. package/dist/buffer-eviction.js +8 -0
  34. package/dist/buffer-persistence.d.ts +45 -0
  35. package/dist/buffer-persistence.d.ts.map +1 -0
  36. package/dist/buffer-persistence.js +8 -0
  37. package/dist/buffer.d.ts +5 -2
  38. package/dist/buffer.d.ts.map +1 -1
  39. package/dist/buffer.js +13 -11
  40. package/dist/causal-behavior.js +2 -2
  41. package/dist/causal-chain.js +2 -2
  42. package/dist/causal-consolidation.js +32 -32
  43. package/dist/causal-retrieval.js +2 -2
  44. package/dist/causal-trajectory-graph.js +2 -2
  45. package/dist/causal-trajectory.js +1 -1
  46. package/dist/{chunk-NIANATGL.js → chunk-2RJO7VS4.js} +2 -2
  47. package/dist/{chunk-YLF42JQ7.js → chunk-3BPMYMPX.js} +2 -2
  48. package/dist/{chunk-GAARPWMN.js → chunk-3L5WH6CV.js} +2 -2
  49. package/dist/{chunk-XVZA6VXC.js → chunk-3SL52JKD.js} +4 -4
  50. package/dist/chunk-4OFXLQJD.js +58 -0
  51. package/dist/chunk-4OFXLQJD.js.map +1 -0
  52. package/dist/{chunk-S2PDFSXS.js → chunk-4P4VLPGB.js} +1 -1
  53. package/dist/{chunk-2ZYIAUYU.js → chunk-5CWH2LKL.js} +4 -4
  54. package/dist/{chunk-VKB2FGNW.js → chunk-5U3NUHMA.js} +85 -85
  55. package/dist/{chunk-PDYP7SUC.js → chunk-5UWP5X3T.js} +2 -2
  56. package/dist/{chunk-G3T6YMBO.js → chunk-64S6X4IU.js} +7 -7
  57. package/dist/{chunk-NHB4RC3G.js → chunk-6QOL4G76.js} +2 -2
  58. package/dist/{chunk-NBH7IRME.js → chunk-6R6CU3MR.js} +51 -51
  59. package/dist/{chunk-4ISHIPOC.js → chunk-7PG7QBWD.js} +2 -2
  60. package/dist/{chunk-A4B7WL5N.js → chunk-7ZBANI3M.js} +2 -2
  61. package/dist/{chunk-DG5UKN2Y.js → chunk-A23DPFFI.js} +2 -2
  62. package/dist/{chunk-77ZK533I.js → chunk-ARFT6ZBE.js} +2 -2
  63. package/dist/{chunk-V44DWTFA.js → chunk-AYXRK264.js} +6 -6
  64. package/dist/{chunk-XO4HOBM2.js → chunk-BPBUUGAO.js} +2 -2
  65. package/dist/{chunk-DFP37GUN.js → chunk-CCYXCT4B.js} +2 -2
  66. package/dist/{chunk-IKCGNTGS.js → chunk-CNQQNYJ2.js} +2 -2
  67. package/dist/{chunk-QZP3RMYP.js → chunk-CU7WDDPV.js} +4 -4
  68. package/dist/{chunk-GY4R4P2A.js → chunk-CUWOSRCS.js} +2 -2
  69. package/dist/{chunk-CJKHLACF.js → chunk-D2AKUKAQ.js} +2 -2
  70. package/dist/{chunk-BRZRP5WD.js → chunk-DK5VMJL3.js} +2 -2
  71. package/dist/{chunk-77IXBNV6.js → chunk-E24RUQEN.js} +2 -2
  72. package/dist/{chunk-PTQZPVRQ.js → chunk-E5PVMB3I.js} +2 -2
  73. package/dist/{chunk-AHS3QEEA.js → chunk-EEOYF3IB.js} +2 -2
  74. package/dist/{chunk-PH33R7GN.js → chunk-EHIKY2IA.js} +2 -2
  75. package/dist/{chunk-LJSBF6PW.js → chunk-EVVCE7S2.js} +2 -2
  76. package/dist/{chunk-FQ52AJXX.js → chunk-FBAHBFT5.js} +2 -2
  77. package/dist/{chunk-NDJ42GKB.js → chunk-FO5AFCRI.js} +5 -5
  78. package/dist/{chunk-5LWODP5R.js → chunk-FRAL3EU4.js} +2 -2
  79. package/dist/{chunk-AAANTXCQ.js → chunk-FZVZYU5C.js} +2 -2
  80. package/dist/{chunk-OHMGR6QN.js → chunk-G2SRB62M.js} +2 -2
  81. package/dist/{chunk-ORWDCX5Q.js → chunk-G6PPA4TH.js} +11 -11
  82. package/dist/{chunk-VNAIUNXI.js → chunk-GCVUBVEN.js} +10 -10
  83. package/dist/{chunk-TGAXRT7N.js → chunk-GFYFKXWZ.js} +2 -2
  84. package/dist/{chunk-ZABEDRGQ.js → chunk-HIMXDRSQ.js} +2 -2
  85. package/dist/{chunk-GDYLZ6FR.js → chunk-HJ3UTGIW.js} +3 -3
  86. package/dist/{chunk-AD3ZB72W.js → chunk-HKEK27M4.js} +2 -2
  87. package/dist/{chunk-X3IFRQKS.js → chunk-I73ZSORJ.js} +4 -4
  88. package/dist/{chunk-XUB4I2N6.js → chunk-JFI3ATK4.js} +2 -2
  89. package/dist/{chunk-R4SATHCV.js → chunk-JH2ALMPR.js} +2 -2
  90. package/dist/{chunk-TKBW4YLS.js → chunk-JH4FCVWJ.js} +2 -2
  91. package/dist/{chunk-UAYA4NJN.js → chunk-JWTUJVIF.js} +28 -36
  92. package/dist/chunk-JWTUJVIF.js.map +1 -0
  93. package/dist/chunk-KASJJGRG.js +29 -0
  94. package/dist/chunk-KASJJGRG.js.map +1 -0
  95. package/dist/{chunk-X73SCHKR.js → chunk-KC5SVCUJ.js} +2 -2
  96. package/dist/{chunk-6NXHX6MI.js → chunk-KOY25HUB.js} +2 -2
  97. package/dist/{chunk-TRW7N4FS.js → chunk-L2JQSG5M.js} +2 -2
  98. package/dist/{chunk-SIIWHIBK.js → chunk-L46Y5FPE.js} +2 -2
  99. package/dist/{chunk-CIJRM6SQ.js → chunk-LAQS5HYU.js} +2 -2
  100. package/dist/{chunk-TYT4TEQV.js → chunk-LDWE7OZS.js} +6 -2
  101. package/dist/chunk-LDWE7OZS.js.map +1 -0
  102. package/dist/{chunk-23VGZ65V.js → chunk-LHBOFROT.js} +2 -2
  103. package/dist/{chunk-LO775P3S.js → chunk-LRJKHXU4.js} +2 -2
  104. package/dist/{chunk-QISYYK4L.js → chunk-LSSCMZQ2.js} +3 -3
  105. package/dist/{chunk-PCIIKQXW.js → chunk-MBMT5FUQ.js} +2 -2
  106. package/dist/{chunk-XFDHL252.js → chunk-MGXFJOUR.js} +3 -3
  107. package/dist/{chunk-7WTTE5FW.js → chunk-MH3LC7KB.js} +2 -2
  108. package/dist/{chunk-ERMT5WQM.js → chunk-MKE5DP3S.js} +2 -2
  109. package/dist/{chunk-DJMC4W6N.js → chunk-MNDHKZZQ.js} +2 -2
  110. package/dist/{chunk-7FG2JSU6.js → chunk-NMKETOAX.js} +2 -2
  111. package/dist/{chunk-RYUSWAAU.js → chunk-NQOM6PHO.js} +6 -6
  112. package/dist/{chunk-AI2VXOSO.js → chunk-NSQSOLCE.js} +2 -2
  113. package/dist/{chunk-UR25IQVT.js → chunk-P5CUEB2Q.js} +8 -8
  114. package/dist/{chunk-FXO43NBW.js → chunk-PSQ2P2T3.js} +3 -3
  115. package/dist/{chunk-X544TW54.js → chunk-PTRPOJ7U.js} +2 -2
  116. package/dist/{chunk-4YYIZ475.js → chunk-QEGE5QCL.js} +45 -45
  117. package/dist/{chunk-KQUN4RSX.js → chunk-QIC7YZ3D.js} +16 -16
  118. package/dist/{chunk-KRAMCBIW.js → chunk-QKXPOLQD.js} +4 -4
  119. package/dist/{chunk-O3VKQMWC.js → chunk-R6TCM47S.js} +364 -166
  120. package/dist/chunk-R6TCM47S.js.map +1 -0
  121. package/dist/{chunk-G5UR4DXQ.js → chunk-RBC4GIZU.js} +2 -2
  122. package/dist/{chunk-65JLKIVA.js → chunk-RVYXSS3Q.js} +7 -7
  123. package/dist/{chunk-G7XAZU2L.js → chunk-RWWYBE7E.js} +3 -3
  124. package/dist/{chunk-HJM23E65.js → chunk-S53WZWGL.js} +2 -2
  125. package/dist/{chunk-3ODEGTVV.js → chunk-TDCR6PQL.js} +2 -2
  126. package/dist/{chunk-QCP75JGO.js → chunk-TFA6HPOA.js} +5 -5
  127. package/dist/{chunk-SE3JAD22.js → chunk-TPKB7T6Z.js} +2 -2
  128. package/dist/{chunk-6VYY2XFK.js → chunk-TVIGN3XZ.js} +19 -19
  129. package/dist/{chunk-ZG3HZZ6K.js → chunk-TYGLV6ZG.js} +5 -1
  130. package/dist/{chunk-ZG3HZZ6K.js.map → chunk-TYGLV6ZG.js.map} +1 -1
  131. package/dist/{chunk-K567EIW3.js → chunk-U4JXQCJ3.js} +2 -2
  132. package/dist/{chunk-WI6MIJYK.js → chunk-U7HJBODU.js} +5 -5
  133. package/dist/{chunk-IS4HKNWP.js → chunk-UBN5AOLT.js} +2 -2
  134. package/dist/{chunk-7VJEZQYF.js → chunk-UFBIOF7C.js} +3 -3
  135. package/dist/{chunk-JNELS2TW.js → chunk-UJDTXWMT.js} +2 -2
  136. package/dist/{chunk-M3GKSCFN.js → chunk-ULUX6Q7R.js} +4 -4
  137. package/dist/{chunk-V3JZZJ2E.js → chunk-UMFBHYPW.js} +11 -11
  138. package/dist/{chunk-GKNX4QO3.js → chunk-UQWA5QDT.js} +3 -3
  139. package/dist/{chunk-4Z7O2QVJ.js → chunk-USOXPN5H.js} +2 -2
  140. package/dist/{chunk-XA32GZ6B.js → chunk-UXXVOA4D.js} +3 -3
  141. package/dist/{chunk-5XTSIZ3L.js → chunk-V5RJCXLG.js} +6 -6
  142. package/dist/{chunk-A2D3WICT.js → chunk-VGFNTY3Y.js} +2 -2
  143. package/dist/{chunk-EH6KLYIE.js → chunk-VKTP3TZB.js} +4 -4
  144. package/dist/{chunk-CSGFGQBI.js → chunk-VPO53QMG.js} +2 -2
  145. package/dist/{chunk-ZSAQSLKL.js → chunk-WADPRAZE.js} +2 -2
  146. package/dist/{chunk-IVYAPAHG.js → chunk-WRDFYSUC.js} +2 -2
  147. package/dist/{chunk-F2JLBXMG.js → chunk-WSLNC5AL.js} +8 -8
  148. package/dist/{chunk-C6S2Y7HE.js → chunk-XKDQTDXN.js} +4 -4
  149. package/dist/{chunk-4AHKNZW7.js → chunk-XLEP7SS3.js} +2 -2
  150. package/dist/{chunk-B6L7BKA7.js → chunk-XRFLR3XF.js} +4 -4
  151. package/dist/{chunk-H7QC7WCU.js → chunk-XTBEXZFN.js} +4 -4
  152. package/dist/{chunk-S2S4U4G3.js → chunk-Y6Y3TRBN.js} +4 -4
  153. package/dist/{chunk-H6SKBCNI.js → chunk-YC2C67F7.js} +2 -2
  154. package/dist/{chunk-6FIFEXFF.js → chunk-YGYT7S3G.js} +7 -7
  155. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  156. package/dist/{chunk-YOL56HY5.js → chunk-YQ6SLFNZ.js} +3 -3
  157. package/dist/{chunk-G22A6WJQ.js → chunk-Z2T5BPOZ.js} +2 -2
  158. package/dist/{chunk-IHTKBQBS.js → chunk-Z5AQZRHF.js} +2 -2
  159. package/dist/{chunk-QQ4T622E.js → chunk-Z5QWUR3Y.js} +2 -2
  160. package/dist/cli.js +127 -127
  161. package/dist/coding/export-okf-codegraph.js +30 -30
  162. package/dist/coding/pre-action-gate.js +2 -2
  163. package/dist/compounding/engine.js +31 -31
  164. package/dist/config.js +40 -40
  165. package/dist/connectors/codex-materialize-runner.js +29 -29
  166. package/dist/connectors/index.js +29 -29
  167. package/dist/contradiction/index.js +5 -5
  168. package/dist/convergence-refresh.js +31 -31
  169. package/dist/conversation-index/backend.js +2 -2
  170. package/dist/corpus-watermark.js +31 -31
  171. package/dist/dashboard-runtime.js +2 -2
  172. package/dist/deep-recall-http-glue.js +9 -9
  173. package/dist/entity-retrieval.js +31 -31
  174. package/dist/explicit-capture.js +7 -7
  175. package/dist/external-wiki-access.js +78 -78
  176. package/dist/extraction-span-materialize.js +2 -2
  177. package/dist/extraction.js +44 -44
  178. package/dist/{graph-edge-decay-IU75NV42.js → graph-edge-decay-2BZTY2IM.js} +5 -5
  179. package/dist/graph-edge-decay-2BZTY2IM.js.map +1 -0
  180. package/dist/graph-jsonl.js +3 -3
  181. package/dist/graph-snapshot.js +3 -3
  182. package/dist/graph.js +2 -2
  183. package/dist/harmonic-retrieval.js +30 -30
  184. package/dist/harmonic-source-lookup.js +2 -2
  185. package/dist/index.js +225 -223
  186. package/dist/lcm/index.js +3 -3
  187. package/dist/location/index.js +32 -32
  188. package/dist/maintenance/memory-governance.js +29 -29
  189. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +29 -29
  190. package/dist/maintenance/rebuild-memory-projection-runner.js +31 -31
  191. package/dist/maintenance/rebuild-memory-projection.js +30 -30
  192. package/dist/memory-browse-operations.js +78 -78
  193. package/dist/memory-browse.js +5 -5
  194. package/dist/memory-subject.js +3 -3
  195. package/dist/namespaces/migrate.js +30 -30
  196. package/dist/namespaces/search.js +11 -11
  197. package/dist/namespaces/storage.js +29 -29
  198. package/dist/offline-sync-changeset-generations.js +3 -3
  199. package/dist/offline-sync-embedding-generation.js +2 -2
  200. package/dist/offline-sync-file-io.js +2 -2
  201. package/dist/offline-sync-impression-drain.js +3 -3
  202. package/dist/offline-sync-runtime-state.d.ts.map +1 -1
  203. package/dist/offline-sync-runtime-state.js +1 -1
  204. package/dist/offline-sync-snapshot-stream.js +8 -8
  205. package/dist/offline-sync-upload-staging.js +3 -3
  206. package/dist/offline-sync.js +8 -8
  207. package/dist/operator-doctor-corpus.js +32 -32
  208. package/dist/operator-toolkit.js +51 -51
  209. package/dist/orchestration/maintenance.js +41 -41
  210. package/dist/orchestrator.js +173 -171
  211. package/dist/qmd.js +4 -4
  212. package/dist/recall-navigation-operations.js +78 -78
  213. package/dist/recall-navigation.js +77 -77
  214. package/dist/recall-state-view-admission.js +5 -5
  215. package/dist/recall-why-service.js +5 -5
  216. package/dist/reconcile/manifest.js +3 -3
  217. package/dist/{resolution-V6JBMW7U.js → resolution-4ZEQPXUZ.js} +6 -6
  218. package/dist/resolution-4ZEQPXUZ.js.map +1 -0
  219. package/dist/resume-bundles.js +41 -41
  220. package/dist/retrieval-agents.js +2 -2
  221. package/dist/salvage-envelope.js +5 -5
  222. package/dist/search/factory.js +10 -10
  223. package/dist/search/index.js +14 -14
  224. package/dist/search/lancedb-backend.js +2 -2
  225. package/dist/search/meilisearch-backend.js +2 -2
  226. package/dist/search/orama-backend.js +2 -2
  227. package/dist/secure-store/index.js +2 -2
  228. package/dist/semantic-consolidation.js +30 -30
  229. package/dist/semantic-rule-promotion.js +29 -29
  230. package/dist/semantic-rule-verifier.js +29 -29
  231. package/dist/source-agent-qualifier.js +34 -34
  232. package/dist/standup/build.js +29 -29
  233. package/dist/storage/buffer-session-files.d.ts +69 -0
  234. package/dist/storage/buffer-session-files.d.ts.map +1 -0
  235. package/dist/storage.d.ts +5 -1
  236. package/dist/storage.d.ts.map +1 -1
  237. package/dist/storage.js +28 -28
  238. package/dist/subject-config.js +4 -4
  239. package/dist/support-passport/index.js +80 -80
  240. package/dist/transfer/export-okf.js +30 -30
  241. package/dist/verified-recall.js +29 -29
  242. package/dist/who-knows-cli.js +30 -30
  243. package/dist/who-knows.js +29 -29
  244. package/dist/write-envelope.js +4 -4
  245. package/package.json +2 -2
  246. package/src/buffer-eviction.ts +51 -0
  247. package/src/buffer-incremental-persistence.test.ts +256 -0
  248. package/src/buffer-persistence.ts +89 -0
  249. package/src/buffer.ts +32 -61
  250. package/src/offline-sync-runtime-state.ts +24 -2
  251. package/src/offline-sync.test.ts +9 -0
  252. package/src/secure-store/secure-fs.ts +11 -0
  253. package/src/secure-store/secure-store.test.ts +22 -0
  254. package/src/storage/buffer-session-files.ts +249 -0
  255. package/src/storage-buffer-sessions.test.ts +369 -0
  256. package/src/storage.ts +11 -16
  257. package/dist/chunk-O3VKQMWC.js.map +0 -1
  258. package/dist/chunk-TYT4TEQV.js.map +0 -1
  259. package/dist/chunk-UAYA4NJN.js.map +0 -1
  260. /package/dist/{auto-sync-VPHR3FBI.js.map → auto-sync-R3XGJL5I.js.map} +0 -0
  261. /package/dist/{graph-edge-decay-IU75NV42.js.map → buffer-eviction.js.map} +0 -0
  262. /package/dist/{resolution-V6JBMW7U.js.map → buffer-persistence.js.map} +0 -0
  263. /package/dist/{chunk-NIANATGL.js.map → chunk-2RJO7VS4.js.map} +0 -0
  264. /package/dist/{chunk-YLF42JQ7.js.map → chunk-3BPMYMPX.js.map} +0 -0
  265. /package/dist/{chunk-GAARPWMN.js.map → chunk-3L5WH6CV.js.map} +0 -0
  266. /package/dist/{chunk-XVZA6VXC.js.map → chunk-3SL52JKD.js.map} +0 -0
  267. /package/dist/{chunk-S2PDFSXS.js.map → chunk-4P4VLPGB.js.map} +0 -0
  268. /package/dist/{chunk-2ZYIAUYU.js.map → chunk-5CWH2LKL.js.map} +0 -0
  269. /package/dist/{chunk-VKB2FGNW.js.map → chunk-5U3NUHMA.js.map} +0 -0
  270. /package/dist/{chunk-PDYP7SUC.js.map → chunk-5UWP5X3T.js.map} +0 -0
  271. /package/dist/{chunk-G3T6YMBO.js.map → chunk-64S6X4IU.js.map} +0 -0
  272. /package/dist/{chunk-NHB4RC3G.js.map → chunk-6QOL4G76.js.map} +0 -0
  273. /package/dist/{chunk-NBH7IRME.js.map → chunk-6R6CU3MR.js.map} +0 -0
  274. /package/dist/{chunk-4ISHIPOC.js.map → chunk-7PG7QBWD.js.map} +0 -0
  275. /package/dist/{chunk-A4B7WL5N.js.map → chunk-7ZBANI3M.js.map} +0 -0
  276. /package/dist/{chunk-DG5UKN2Y.js.map → chunk-A23DPFFI.js.map} +0 -0
  277. /package/dist/{chunk-77ZK533I.js.map → chunk-ARFT6ZBE.js.map} +0 -0
  278. /package/dist/{chunk-V44DWTFA.js.map → chunk-AYXRK264.js.map} +0 -0
  279. /package/dist/{chunk-XO4HOBM2.js.map → chunk-BPBUUGAO.js.map} +0 -0
  280. /package/dist/{chunk-DFP37GUN.js.map → chunk-CCYXCT4B.js.map} +0 -0
  281. /package/dist/{chunk-IKCGNTGS.js.map → chunk-CNQQNYJ2.js.map} +0 -0
  282. /package/dist/{chunk-QZP3RMYP.js.map → chunk-CU7WDDPV.js.map} +0 -0
  283. /package/dist/{chunk-GY4R4P2A.js.map → chunk-CUWOSRCS.js.map} +0 -0
  284. /package/dist/{chunk-CJKHLACF.js.map → chunk-D2AKUKAQ.js.map} +0 -0
  285. /package/dist/{chunk-BRZRP5WD.js.map → chunk-DK5VMJL3.js.map} +0 -0
  286. /package/dist/{chunk-77IXBNV6.js.map → chunk-E24RUQEN.js.map} +0 -0
  287. /package/dist/{chunk-PTQZPVRQ.js.map → chunk-E5PVMB3I.js.map} +0 -0
  288. /package/dist/{chunk-AHS3QEEA.js.map → chunk-EEOYF3IB.js.map} +0 -0
  289. /package/dist/{chunk-PH33R7GN.js.map → chunk-EHIKY2IA.js.map} +0 -0
  290. /package/dist/{chunk-LJSBF6PW.js.map → chunk-EVVCE7S2.js.map} +0 -0
  291. /package/dist/{chunk-FQ52AJXX.js.map → chunk-FBAHBFT5.js.map} +0 -0
  292. /package/dist/{chunk-NDJ42GKB.js.map → chunk-FO5AFCRI.js.map} +0 -0
  293. /package/dist/{chunk-5LWODP5R.js.map → chunk-FRAL3EU4.js.map} +0 -0
  294. /package/dist/{chunk-AAANTXCQ.js.map → chunk-FZVZYU5C.js.map} +0 -0
  295. /package/dist/{chunk-OHMGR6QN.js.map → chunk-G2SRB62M.js.map} +0 -0
  296. /package/dist/{chunk-ORWDCX5Q.js.map → chunk-G6PPA4TH.js.map} +0 -0
  297. /package/dist/{chunk-VNAIUNXI.js.map → chunk-GCVUBVEN.js.map} +0 -0
  298. /package/dist/{chunk-TGAXRT7N.js.map → chunk-GFYFKXWZ.js.map} +0 -0
  299. /package/dist/{chunk-ZABEDRGQ.js.map → chunk-HIMXDRSQ.js.map} +0 -0
  300. /package/dist/{chunk-GDYLZ6FR.js.map → chunk-HJ3UTGIW.js.map} +0 -0
  301. /package/dist/{chunk-AD3ZB72W.js.map → chunk-HKEK27M4.js.map} +0 -0
  302. /package/dist/{chunk-X3IFRQKS.js.map → chunk-I73ZSORJ.js.map} +0 -0
  303. /package/dist/{chunk-XUB4I2N6.js.map → chunk-JFI3ATK4.js.map} +0 -0
  304. /package/dist/{chunk-R4SATHCV.js.map → chunk-JH2ALMPR.js.map} +0 -0
  305. /package/dist/{chunk-TKBW4YLS.js.map → chunk-JH4FCVWJ.js.map} +0 -0
  306. /package/dist/{chunk-X73SCHKR.js.map → chunk-KC5SVCUJ.js.map} +0 -0
  307. /package/dist/{chunk-6NXHX6MI.js.map → chunk-KOY25HUB.js.map} +0 -0
  308. /package/dist/{chunk-TRW7N4FS.js.map → chunk-L2JQSG5M.js.map} +0 -0
  309. /package/dist/{chunk-SIIWHIBK.js.map → chunk-L46Y5FPE.js.map} +0 -0
  310. /package/dist/{chunk-CIJRM6SQ.js.map → chunk-LAQS5HYU.js.map} +0 -0
  311. /package/dist/{chunk-23VGZ65V.js.map → chunk-LHBOFROT.js.map} +0 -0
  312. /package/dist/{chunk-LO775P3S.js.map → chunk-LRJKHXU4.js.map} +0 -0
  313. /package/dist/{chunk-QISYYK4L.js.map → chunk-LSSCMZQ2.js.map} +0 -0
  314. /package/dist/{chunk-PCIIKQXW.js.map → chunk-MBMT5FUQ.js.map} +0 -0
  315. /package/dist/{chunk-XFDHL252.js.map → chunk-MGXFJOUR.js.map} +0 -0
  316. /package/dist/{chunk-7WTTE5FW.js.map → chunk-MH3LC7KB.js.map} +0 -0
  317. /package/dist/{chunk-ERMT5WQM.js.map → chunk-MKE5DP3S.js.map} +0 -0
  318. /package/dist/{chunk-DJMC4W6N.js.map → chunk-MNDHKZZQ.js.map} +0 -0
  319. /package/dist/{chunk-7FG2JSU6.js.map → chunk-NMKETOAX.js.map} +0 -0
  320. /package/dist/{chunk-RYUSWAAU.js.map → chunk-NQOM6PHO.js.map} +0 -0
  321. /package/dist/{chunk-AI2VXOSO.js.map → chunk-NSQSOLCE.js.map} +0 -0
  322. /package/dist/{chunk-UR25IQVT.js.map → chunk-P5CUEB2Q.js.map} +0 -0
  323. /package/dist/{chunk-FXO43NBW.js.map → chunk-PSQ2P2T3.js.map} +0 -0
  324. /package/dist/{chunk-X544TW54.js.map → chunk-PTRPOJ7U.js.map} +0 -0
  325. /package/dist/{chunk-4YYIZ475.js.map → chunk-QEGE5QCL.js.map} +0 -0
  326. /package/dist/{chunk-KQUN4RSX.js.map → chunk-QIC7YZ3D.js.map} +0 -0
  327. /package/dist/{chunk-KRAMCBIW.js.map → chunk-QKXPOLQD.js.map} +0 -0
  328. /package/dist/{chunk-G5UR4DXQ.js.map → chunk-RBC4GIZU.js.map} +0 -0
  329. /package/dist/{chunk-65JLKIVA.js.map → chunk-RVYXSS3Q.js.map} +0 -0
  330. /package/dist/{chunk-G7XAZU2L.js.map → chunk-RWWYBE7E.js.map} +0 -0
  331. /package/dist/{chunk-HJM23E65.js.map → chunk-S53WZWGL.js.map} +0 -0
  332. /package/dist/{chunk-3ODEGTVV.js.map → chunk-TDCR6PQL.js.map} +0 -0
  333. /package/dist/{chunk-QCP75JGO.js.map → chunk-TFA6HPOA.js.map} +0 -0
  334. /package/dist/{chunk-SE3JAD22.js.map → chunk-TPKB7T6Z.js.map} +0 -0
  335. /package/dist/{chunk-6VYY2XFK.js.map → chunk-TVIGN3XZ.js.map} +0 -0
  336. /package/dist/{chunk-K567EIW3.js.map → chunk-U4JXQCJ3.js.map} +0 -0
  337. /package/dist/{chunk-WI6MIJYK.js.map → chunk-U7HJBODU.js.map} +0 -0
  338. /package/dist/{chunk-IS4HKNWP.js.map → chunk-UBN5AOLT.js.map} +0 -0
  339. /package/dist/{chunk-7VJEZQYF.js.map → chunk-UFBIOF7C.js.map} +0 -0
  340. /package/dist/{chunk-JNELS2TW.js.map → chunk-UJDTXWMT.js.map} +0 -0
  341. /package/dist/{chunk-M3GKSCFN.js.map → chunk-ULUX6Q7R.js.map} +0 -0
  342. /package/dist/{chunk-V3JZZJ2E.js.map → chunk-UMFBHYPW.js.map} +0 -0
  343. /package/dist/{chunk-GKNX4QO3.js.map → chunk-UQWA5QDT.js.map} +0 -0
  344. /package/dist/{chunk-4Z7O2QVJ.js.map → chunk-USOXPN5H.js.map} +0 -0
  345. /package/dist/{chunk-XA32GZ6B.js.map → chunk-UXXVOA4D.js.map} +0 -0
  346. /package/dist/{chunk-5XTSIZ3L.js.map → chunk-V5RJCXLG.js.map} +0 -0
  347. /package/dist/{chunk-A2D3WICT.js.map → chunk-VGFNTY3Y.js.map} +0 -0
  348. /package/dist/{chunk-EH6KLYIE.js.map → chunk-VKTP3TZB.js.map} +0 -0
  349. /package/dist/{chunk-CSGFGQBI.js.map → chunk-VPO53QMG.js.map} +0 -0
  350. /package/dist/{chunk-ZSAQSLKL.js.map → chunk-WADPRAZE.js.map} +0 -0
  351. /package/dist/{chunk-IVYAPAHG.js.map → chunk-WRDFYSUC.js.map} +0 -0
  352. /package/dist/{chunk-F2JLBXMG.js.map → chunk-WSLNC5AL.js.map} +0 -0
  353. /package/dist/{chunk-C6S2Y7HE.js.map → chunk-XKDQTDXN.js.map} +0 -0
  354. /package/dist/{chunk-4AHKNZW7.js.map → chunk-XLEP7SS3.js.map} +0 -0
  355. /package/dist/{chunk-B6L7BKA7.js.map → chunk-XRFLR3XF.js.map} +0 -0
  356. /package/dist/{chunk-H7QC7WCU.js.map → chunk-XTBEXZFN.js.map} +0 -0
  357. /package/dist/{chunk-S2S4U4G3.js.map → chunk-Y6Y3TRBN.js.map} +0 -0
  358. /package/dist/{chunk-H6SKBCNI.js.map → chunk-YC2C67F7.js.map} +0 -0
  359. /package/dist/{chunk-6FIFEXFF.js.map → chunk-YGYT7S3G.js.map} +0 -0
  360. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
  361. /package/dist/{chunk-YOL56HY5.js.map → chunk-YQ6SLFNZ.js.map} +0 -0
  362. /package/dist/{chunk-G22A6WJQ.js.map → chunk-Z2T5BPOZ.js.map} +0 -0
  363. /package/dist/{chunk-IHTKBQBS.js.map → chunk-Z5AQZRHF.js.map} +0 -0
  364. /package/dist/{chunk-QQ4T622E.js.map → chunk-Z5QWUR3Y.js.map} +0 -0
@@ -1,9 +1,3 @@
1
- import {
2
- TombstoneStore,
3
- applyTombstoneResurrectionGate,
4
- buildRetiredFactTombstoneInputs,
5
- collectRetiredMemoriesForRebuild
6
- } from "./chunk-DM5QZ3YU.js";
7
1
  import {
8
2
  WEARABLES_DIR_NAME,
9
3
  escapeSegmentText,
@@ -15,6 +9,12 @@ import {
15
9
  unescapeSegmentText,
16
10
  unescapeSpeakerLabel
17
11
  } from "./chunk-UHVXE24Y.js";
12
+ import {
13
+ TombstoneStore,
14
+ applyTombstoneResurrectionGate,
15
+ buildRetiredFactTombstoneInputs,
16
+ collectRetiredMemoriesForRebuild
17
+ } from "./chunk-DM5QZ3YU.js";
18
18
  import {
19
19
  getFingerprint,
20
20
  migrateLegacyEntityCanonicalIds,
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-VY6BD5KB.js";
23
23
  import {
24
24
  normalizeQmdResultPath
25
- } from "./chunk-23VGZ65V.js";
25
+ } from "./chunk-LHBOFROT.js";
26
26
  import {
27
27
  withholdToolScopedFromSharedNamespace
28
28
  } from "./chunk-S2V7RUCL.js";
@@ -33,13 +33,13 @@ import {
33
33
  import {
34
34
  parseOfflineSyncDigestCache
35
35
  } from "./chunk-X3724WL4.js";
36
- import {
37
- createMemorySnapshot
38
- } from "./chunk-S2HLHAZ4.js";
39
36
  import {
40
37
  rewriteProjectedEntityReferences,
41
38
  rewriteProjectedMemoryEntityReference
42
39
  } from "./chunk-MRPOZBJC.js";
40
+ import {
41
+ createMemorySnapshot
42
+ } from "./chunk-S2HLHAZ4.js";
43
43
  import {
44
44
  rotateMarkdownFileToArchive
45
45
  } from "./chunk-DM2T26WE.js";
@@ -69,7 +69,7 @@ import {
69
69
  invalidationCommitFingerprint,
70
70
  parseTombstoneBlockedOfflineSyncMemory,
71
71
  withCasCommitReceipt
72
- } from "./chunk-YOL56HY5.js";
72
+ } from "./chunk-YQ6SLFNZ.js";
73
73
  import {
74
74
  matchEntitySchemaSection,
75
75
  normalizeEntityStructuredSection,
@@ -130,11 +130,8 @@ import {
130
130
  entityMentionEpoch
131
131
  } from "./chunk-7CT3AI52.js";
132
132
  import {
133
- buildCapturePathLockIdentity,
134
- buildExplicitCaptureDedupKey,
135
- isQueuedReviewMemory,
136
- tombstoneBlocked
137
- } from "./chunk-UUZ7KZAO.js";
133
+ parseOriginClass
134
+ } from "./chunk-23G5P7TA.js";
138
135
  import {
139
136
  clearMemoryCache,
140
137
  getCachedEntities,
@@ -149,8 +146,11 @@ import {
149
146
  updateCacheOnWrite
150
147
  } from "./chunk-C64XATK7.js";
151
148
  import {
152
- parseOriginClass
153
- } from "./chunk-23G5P7TA.js";
149
+ buildCapturePathLockIdentity,
150
+ buildExplicitCaptureDedupKey,
151
+ isQueuedReviewMemory,
152
+ tombstoneBlocked
153
+ } from "./chunk-UUZ7KZAO.js";
154
154
  import {
155
155
  selectArtifactMatches
156
156
  } from "./chunk-HADD45AR.js";
@@ -168,7 +168,7 @@ import {
168
168
  composeMemoryEnvelope,
169
169
  isSealedMemoryEnvelope,
170
170
  sealedWriteToLegacyArgs
171
- } from "./chunk-3ODEGTVV.js";
171
+ } from "./chunk-TDCR6PQL.js";
172
172
  import {
173
173
  DEFAULT_CITATION_FORMAT,
174
174
  hasCitationForTemplate,
@@ -189,7 +189,7 @@ import {
189
189
  readMemoryActionEventRowsFromLines,
190
190
  readProjectionRebuiltAt,
191
191
  serializeLifecycleAppendPayload
192
- } from "./chunk-JNELS2TW.js";
192
+ } from "./chunk-UJDTXWMT.js";
193
193
  import {
194
194
  assertMemoryFrontmatterId,
195
195
  warnProjectionFallback
@@ -214,7 +214,7 @@ import {
214
214
  CONTENT_HASH_INDEX_RETRY_MAX_DELAY_MS,
215
215
  ContentHashIndex,
216
216
  FactHashIndexNotAuthoritativeError
217
- } from "./chunk-IS4HKNWP.js";
217
+ } from "./chunk-UBN5AOLT.js";
218
218
  import {
219
219
  computeLegacyContentHash
220
220
  } from "./chunk-5FVVY2EB.js";
@@ -257,7 +257,7 @@ import {
257
257
  readMaybeEncryptedFile,
258
258
  readMaybeEncryptedFileBuffer,
259
259
  writeMaybeEncryptedFile
260
- } from "./chunk-ZG3HZZ6K.js";
260
+ } from "./chunk-TYGLV6ZG.js";
261
261
  import {
262
262
  assertPathInsideRoot,
263
263
  pathIsInside
@@ -277,19 +277,19 @@ import {
277
277
 
278
278
  // src/storage.ts
279
279
  import {
280
- lstat as lstat3,
281
- readdir as readdir5,
280
+ lstat as lstat4,
281
+ readdir as readdir6,
282
282
  readFile,
283
283
  realpath as realpath3,
284
284
  stat as stat3,
285
285
  writeFile,
286
286
  mkdir,
287
- unlink as unlink3,
287
+ unlink as unlink4,
288
288
  appendFile,
289
289
  open
290
290
  } from "fs/promises";
291
291
  import { appendFileSync, createReadStream, mkdirSync, statSync as statSync2 } from "fs";
292
- import { createHash as createHash5 } from "crypto";
292
+ import { createHash as createHash6 } from "crypto";
293
293
 
294
294
  // src/preferences/drift-types.ts
295
295
  function serializeDriftProvenance(fm) {
@@ -313,7 +313,7 @@ function parseDriftProvenance(fm) {
313
313
  }
314
314
 
315
315
  // src/storage.ts
316
- import path12 from "path";
316
+ import path13 from "path";
317
317
 
318
318
  // src/storage/tombstone-migration-sources.ts
319
319
  import { statSync } from "fs";
@@ -4819,13 +4819,209 @@ var MeetingRecordStore = class {
4819
4819
  };
4820
4820
  var SORT_STR = (a, b) => a < b ? -1 : a > b ? 1 : 0;
4821
4821
 
4822
- // src/storage/supersession-audit.ts
4823
- import { readdir as readdir4 } from "fs/promises";
4822
+ // src/storage/buffer-session-files.ts
4823
+ import { createHash as createHash4 } from "crypto";
4824
+ import { lstat as lstat3, readdir as readdir4, unlink as unlink3 } from "fs/promises";
4824
4825
  import path11 from "path";
4826
+ function isMissing(err) {
4827
+ return err?.code === "ENOENT";
4828
+ }
4829
+ function asFsError(err) {
4830
+ return err;
4831
+ }
4832
+ function bufferSessionFileName(key) {
4833
+ return `s-${createHash4("sha256").update(key).digest("hex")}.json`;
4834
+ }
4835
+ function legacyStateToEntries(state) {
4836
+ const entries = /* @__PURE__ */ new Map();
4837
+ for (const [key, value] of Object.entries(state.entries ?? {})) {
4838
+ if (value && Array.isArray(value.turns)) entries.set(key, value);
4839
+ }
4840
+ if (!entries.has("default")) {
4841
+ entries.set("default", {
4842
+ turns: Array.isArray(state.turns) ? state.turns : [],
4843
+ lastExtractionAt: state.lastExtractionAt ?? null,
4844
+ extractionCount: Number.isFinite(state.extractionCount) ? state.extractionCount : 0
4845
+ });
4846
+ }
4847
+ return entries;
4848
+ }
4849
+ function entryFromBody(body) {
4850
+ if (!body || !Array.isArray(body.turns) || (body.key?.length ?? 0) === 0) return null;
4851
+ const entry = {
4852
+ turns: body.turns,
4853
+ lastExtractionAt: body.lastExtractionAt ?? null,
4854
+ extractionCount: Number.isFinite(body.extractionCount) ? Number(body.extractionCount) : 0
4855
+ };
4856
+ if (Array.isArray(body.retainedTurns)) entry.retainedTurns = body.retainedTurns;
4857
+ return { key: String(body.key), entry };
4858
+ }
4859
+ var BufferSessionFiles = class {
4860
+ constructor(stateDir, io) {
4861
+ this.stateDir = stateDir;
4862
+ this.io = io;
4863
+ }
4864
+ stateDir;
4865
+ io;
4866
+ dirVerified = false;
4867
+ get dir() {
4868
+ return path11.join(this.stateDir, "buffer");
4869
+ }
4870
+ fileFor(key) {
4871
+ return path11.join(this.dir, bufferSessionFileName(key));
4872
+ }
4873
+ /**
4874
+ * Refuse a symlinked buffer directory: following it would send buffered
4875
+ * conversation data (and deletions) outside the memory root. One lstat of
4876
+ * one directory, cached after it passes, so the observe path pays nothing
4877
+ * per write; the cache is dropped on any failure.
4878
+ */
4879
+ async assertDirSafe() {
4880
+ if (this.dirVerified) return;
4881
+ let stat4 = null;
4882
+ try {
4883
+ stat4 = await lstat3(this.dir);
4884
+ } catch (err) {
4885
+ if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
4886
+ }
4887
+ if (stat4 && (stat4.isSymbolicLink() || !stat4.isDirectory())) {
4888
+ throw new Error(`buffer session directory must be a real directory, not a symlink or file: ${this.dir}`);
4889
+ }
4890
+ this.dirVerified = stat4 !== null;
4891
+ }
4892
+ /** Persist ONE session atomically. Compact JSON: machine-read state, and
4893
+ * pretty-printing a large buffer costs CPU and bytes on every observe. */
4894
+ async save(key, entry) {
4895
+ await this.assertDirSafe();
4896
+ await this.io.write(this.fileFor(key), JSON.stringify({ key, ...entry }));
4897
+ }
4898
+ /** Remove one session's file. Idempotent: an absent file is fine. */
4899
+ async remove(key) {
4900
+ await this.assertDirSafe();
4901
+ try {
4902
+ await unlink3(this.fileFor(key));
4903
+ } catch (err) {
4904
+ if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
4905
+ }
4906
+ }
4907
+ async listFiles() {
4908
+ await this.assertDirSafe();
4909
+ try {
4910
+ const dirents = await readdir4(this.dir, { withFileTypes: true });
4911
+ return dirents.filter((d) => d.isFile() && d.name.endsWith(".json")).map((d) => d.name);
4912
+ } catch (err) {
4913
+ if (err instanceof Error && isMissing(asFsError(err))) return [];
4914
+ throw err;
4915
+ }
4916
+ }
4917
+ /** Read every per-session file. Corrupt files are skipped (and logged) so
4918
+ * one bad file cannot nuke the other sessions' buffered turns. */
4919
+ async readAll() {
4920
+ const names = await this.listFiles();
4921
+ const entries = /* @__PURE__ */ new Map();
4922
+ for (const name of names) {
4923
+ try {
4924
+ const body = JSON.parse(await this.io.read(path11.join(this.dir, name)));
4925
+ const parsed = entryFromBody(body);
4926
+ if (!parsed) throw new Error("invalid buffer session file shape");
4927
+ if (entries.has(parsed.key)) {
4928
+ log.warn(`buffer: duplicate session file for key ${parsed.key} (${name}); keeping the first`);
4929
+ continue;
4930
+ }
4931
+ entries.set(parsed.key, parsed.entry);
4932
+ } catch (err) {
4933
+ if (err instanceof SecureStoreLockedError || err instanceof SecureStoreDecryptError) throw err;
4934
+ log.warn(`buffer: skipping unreadable per-session buffer file ${name}: ${err instanceof Error ? err.message : String(err)}`);
4935
+ }
4936
+ }
4937
+ return { entries, fileCount: names.length };
4938
+ }
4939
+ /**
4940
+ * Read the legacy single-file buffer.json for migration. Null when absent,
4941
+ * or unreadable while session files exist (they are authoritative; a
4942
+ * corrupt leftover must not block startup). With no session files a corrupt
4943
+ * legacy file THROWS, preserving the old contract so callers can reset it.
4944
+ */
4945
+ async readLegacy(hasSessionFiles) {
4946
+ let raw;
4947
+ try {
4948
+ raw = await this.io.read(path11.join(this.stateDir, "buffer.json"));
4949
+ } catch (err) {
4950
+ if (err instanceof SecureStoreLockedError) throw err;
4951
+ if (err instanceof Error && isMissing(asFsError(err))) return null;
4952
+ throw err;
4953
+ }
4954
+ try {
4955
+ const legacy = JSON.parse(raw);
4956
+ return legacy;
4957
+ } catch (err) {
4958
+ if (!hasSessionFiles) throw err;
4959
+ log.warn(
4960
+ `buffer: legacy buffer.json is unreadable but per-session buffer files exist; ignoring the legacy file (${err instanceof Error ? err.message : String(err)})`
4961
+ );
4962
+ return null;
4963
+ }
4964
+ }
4965
+ /**
4966
+ * Load the whole buffer, migrating a legacy buffer.json once. A per-session
4967
+ * file that parsed wins over the legacy snapshot (a crash mid-migration
4968
+ * leaves exactly that pair); legacy entries without a usable file are
4969
+ * written out, then the legacy file is retired. Both steps are idempotent.
4970
+ */
4971
+ async load() {
4972
+ const { entries, fileCount } = await this.readAll();
4973
+ const legacy = await this.readLegacy(fileCount > 0);
4974
+ if (legacy !== null) {
4975
+ for (const [key, entry] of legacyStateToEntries(legacy)) {
4976
+ if (entries.has(key)) continue;
4977
+ entries.set(key, entry);
4978
+ await this.save(key, entry);
4979
+ }
4980
+ try {
4981
+ await unlink3(path11.join(this.stateDir, "buffer.json"));
4982
+ } catch (err) {
4983
+ if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
4984
+ }
4985
+ }
4986
+ const out = /* @__PURE__ */ Object.create(null);
4987
+ for (const [key, entry] of entries) out[key] = entry;
4988
+ const def = entries.get("default");
4989
+ return {
4990
+ turns: def?.turns ?? [],
4991
+ lastExtractionAt: def?.lastExtractionAt ?? null,
4992
+ extractionCount: def?.extractionCount ?? 0,
4993
+ entries: out
4994
+ };
4995
+ }
4996
+ /**
4997
+ * Reconcile the files with a WHOLE buffer state: write every entry, then
4998
+ * delete files for keys no longer present. Writes first, deletes last: a
4999
+ * crash leaves stale extra files (removed by the next reconcile) but never
5000
+ * loses sessions the state says exist. Not on the observe hot path.
5001
+ */
5002
+ async reconcile(state) {
5003
+ const entries = legacyStateToEntries(state);
5004
+ const existing = await this.listFiles();
5005
+ for (const [key, entry] of entries) await this.save(key, entry);
5006
+ const live = new Set([...entries.keys()].map((key) => bufferSessionFileName(key)));
5007
+ for (const name of existing) {
5008
+ if (live.has(name)) continue;
5009
+ try {
5010
+ await unlink3(path11.join(this.dir, name));
5011
+ } catch (err) {
5012
+ if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
5013
+ }
5014
+ }
5015
+ }
5016
+ };
5017
+
5018
+ // src/storage/supersession-audit.ts
5019
+ import { readdir as readdir5 } from "fs/promises";
5020
+ import path12 from "path";
4825
5021
  async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody, structuredAttributes) {
4826
5022
  let entries;
4827
5023
  try {
4828
- entries = await readdir4(lookup.correctionsDir, { withFileTypes: true });
5024
+ entries = await readdir5(lookup.correctionsDir, { withFileTypes: true });
4829
5025
  } catch (error) {
4830
5026
  if (isErrnoCode(error, "ENOENT")) return false;
4831
5027
  throw error;
@@ -4833,7 +5029,7 @@ async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody,
4833
5029
  for (const entry of entries) {
4834
5030
  if (isMacOsReplicationJunkBasename(entry.name)) continue;
4835
5031
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
4836
- const memory = await lookup.readMemoryByPath(path11.join(lookup.correctionsDir, entry.name));
5032
+ const memory = await lookup.readMemoryByPath(path12.join(lookup.correctionsDir, entry.name));
4837
5033
  if (memory?.frontmatter.category === "correction" && (memory.frontmatter.sourceMemoryId === oldMemoryId || memory.frontmatter.sourceMemoryId === void 0 && memory.frontmatter.lineage?.includes(oldMemoryId)) && memory.frontmatter.lineage?.includes(newMemoryId) && stripAttributesSuffix(memory.content) === auditBody && (structuredAttributes === void 0 || Object.entries(structuredAttributes).every(
4838
5034
  ([key, value]) => memory.frontmatter.structuredAttributes?.[key] === value
4839
5035
  ))) {
@@ -4923,7 +5119,7 @@ Reason: ${reason}`;
4923
5119
  }
4924
5120
 
4925
5121
  // src/storage/entity-timeline.ts
4926
- import { createHash as createHash4 } from "crypto";
5122
+ import { createHash as createHash5 } from "crypto";
4927
5123
  var ENTITY_TIMELINE_METADATA_MARKER = "remnic-meta-v1";
4928
5124
  function parseEntityTimelineBullet(bullet, fallbackTimestamp) {
4929
5125
  const trimmed = bullet.trim();
@@ -5365,7 +5561,7 @@ function fingerprintEntityStructuredFacts(entity) {
5365
5561
  (left, right) => left.key.localeCompare(right.key) || left.title.localeCompare(right.title) || left.facts.join("\n").localeCompare(right.facts.join("\n"))
5366
5562
  );
5367
5563
  if (normalizedSections.length === 0) return void 0;
5368
- return createHash4("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5564
+ return createHash5("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5369
5565
  }
5370
5566
  function isEntitySynthesisStale(entity) {
5371
5567
  const structuredFactCount = countEntityStructuredFacts(entity);
@@ -5922,17 +6118,17 @@ function inferEntityTypeFromContent(content) {
5922
6118
  }
5923
6119
  var KNOWN_ENTITY_FILENAME_PREFIXES = /* @__PURE__ */ new Set(["company", "other", "person", "place", "project", "tool", "topic"]);
5924
6120
  function inferEntityTypeFromFilename(pathRel) {
5925
- const basename = path12.basename(pathRel, ".md").toLowerCase();
6121
+ const basename = path13.basename(pathRel, ".md").toLowerCase();
5926
6122
  const separator = basename.indexOf("-");
5927
6123
  if (separator <= 0) return void 0;
5928
6124
  const candidate = basename.slice(0, separator);
5929
6125
  return KNOWN_ENTITY_FILENAME_PREFIXES.has(candidate) ? candidate : void 0;
5930
6126
  }
5931
6127
  function normalizeFrontmatterForPath(frontmatter, pathRel, content = "") {
5932
- const normalizedPath = pathRel.split(path12.sep).join("/");
6128
+ const normalizedPath = pathRel.split(path13.sep).join("/");
5933
6129
  let normalizedFrontmatter = frontmatter;
5934
6130
  if (normalizedPath === "entities" || normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/")) {
5935
- const basename = path12.basename(pathRel, ".md");
6131
+ const basename = path13.basename(pathRel, ".md");
5936
6132
  const inferredType = inferEntityTypeFromContent(content) || inferEntityTypeFromFilename(pathRel) || "entity";
5937
6133
  const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
5938
6134
  normalizedFrontmatter = {
@@ -6405,9 +6601,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6405
6601
  this.entitySchemas = entitySchemas;
6406
6602
  this.deletionRevisionStore = new DeletionRevisionStore({
6407
6603
  baseDir,
6408
- deletionRevisionMetadataPath: path12.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6409
- invalidationCommitMetadataPath: path12.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6410
- deletionRevisionLockPath: path12.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6604
+ deletionRevisionMetadataPath: path13.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6605
+ invalidationCommitMetadataPath: path13.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6606
+ deletionRevisionLockPath: path13.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6411
6607
  assertManagedStoragePath: (filePath, method) => this.assertManagedStoragePath(filePath, method)
6412
6608
  });
6413
6609
  this.casRevisions = new CasRevisionHost(baseDir);
@@ -6593,8 +6789,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6593
6789
  }
6594
6790
  /** Whether `filePath` resolves to `stateDir` itself or a path contained in it. */
6595
6791
  isStateFilePath(filePath) {
6596
- const rel = path12.relative(this.stateDir, path12.resolve(filePath));
6597
- return rel === "" || !rel.startsWith("..") && !path12.isAbsolute(rel);
6792
+ const rel = path13.relative(this.stateDir, path13.resolve(filePath));
6793
+ return rel === "" || !rel.startsWith("..") && !path13.isAbsolute(rel);
6598
6794
  }
6599
6795
  // ── Tombstone store (issue #1579) ───────────────────────────────────────
6600
6796
  // Instance-scoped (rule 11) + namespace-scoped (rule 42) tombstone index.
@@ -6709,8 +6905,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6709
6905
  * /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
6710
6906
  */
6711
6907
  isColdOrArchiveTierPath(p) {
6712
- const rel = path12.relative(this.baseDir, p);
6713
- return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path12.sep}`) || rel.startsWith(`archive${path12.sep}`);
6908
+ const rel = path13.relative(this.baseDir, p);
6909
+ return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path13.sep}`) || rel.startsWith(`archive${path13.sep}`);
6714
6910
  }
6715
6911
  /**
6716
6912
  * Mark the secure-store as required for this storage instance.
@@ -6797,7 +6993,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6797
6993
  void 0,
6798
6994
  this.baseDir
6799
6995
  );
6800
- const rel = path12.relative(this.baseDir, filePath).split(path12.sep).join("/");
6996
+ const rel = path13.relative(this.baseDir, filePath).split(path13.sep).join("/");
6801
6997
  return `${rel}:${version.versionId}`;
6802
6998
  } catch (err) {
6803
6999
  log.warn(
@@ -6842,10 +7038,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6842
7038
  _StorageManager.okfConformanceByDir.set(memoryDir, enabled !== false);
6843
7039
  }
6844
7040
  okfConformanceEnabled() {
6845
- for (let dir = this.baseDir; ; dir = path12.dirname(dir)) {
7041
+ for (let dir = this.baseDir; ; dir = path13.dirname(dir)) {
6846
7042
  const registered = _StorageManager.okfConformanceByDir.get(dir);
6847
7043
  if (registered !== void 0) return registered;
6848
- if (dir === path12.dirname(dir)) return true;
7044
+ if (dir === path13.dirname(dir)) return true;
6849
7045
  }
6850
7046
  }
6851
7047
  /**
@@ -6889,12 +7085,12 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6889
7085
  }
6890
7086
  identityFilePath(workspaceDir, namespace) {
6891
7087
  const rawNamespace = typeof namespace === "string" ? namespace.trim() : "";
6892
- if (!rawNamespace) return path12.join(workspaceDir, "IDENTITY.md");
7088
+ if (!rawNamespace) return path13.join(workspaceDir, "IDENTITY.md");
6893
7089
  const safeNamespace = rawNamespace.replace(/[^a-zA-Z0-9._-]/g, "-");
6894
- return path12.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
7090
+ return path13.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
6895
7091
  }
6896
7092
  versionFilePath(kind) {
6897
- return path12.join(this.stateDir, `.${kind}-version.log`);
7093
+ return path13.join(this.stateDir, `.${kind}-version.log`);
6898
7094
  }
6899
7095
  bumpSharedVersion(kind, fallbackMap) {
6900
7096
  const filePath = this.versionFilePath(kind);
@@ -7001,7 +7197,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7001
7197
  // memories.
7002
7198
  // -------------------------------------------------------------------------
7003
7199
  get wearablesDir() {
7004
- return path12.join(this.baseDir, WEARABLES_DIR_NAME);
7200
+ return path13.join(this.baseDir, WEARABLES_DIR_NAME);
7005
7201
  }
7006
7202
  /**
7007
7203
  * Resolve the on-disk path for a source/day transcript. Throws on
@@ -7017,7 +7213,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7017
7213
  if (!isValidTranscriptDate(date)) {
7018
7214
  throw new Error(`invalid wearable transcript date '${String(date)}' \u2014 expected YYYY-MM-DD`);
7019
7215
  }
7020
- return path12.join(this.wearablesDir, sourceId, `${date}.md`);
7216
+ return path13.join(this.wearablesDir, sourceId, `${date}.md`);
7021
7217
  }
7022
7218
  async writeWearableDayTranscript(sourceId, date, serialized) {
7023
7219
  const targetPath = this.wearableTranscriptPath(sourceId, date);
@@ -7043,10 +7239,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7043
7239
  return this._fusionStore = new FusionArtifactStore(this.wearablesDir, this.baseDir, {
7044
7240
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7045
7241
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7046
- readDir: (d) => readdir5(d),
7047
- deleteFile: (p) => unlink3(p),
7242
+ readDir: (d) => readdir6(d),
7243
+ deleteFile: (p) => unlink4(p),
7048
7244
  realpath: (p) => realpath3(p),
7049
- lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7245
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7050
7246
  });
7051
7247
  }
7052
7248
  _meetingRecordStore;
@@ -7061,10 +7257,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7061
7257
  return this._meetingRecordStore = new MeetingRecordStore(this.baseDir, {
7062
7258
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7063
7259
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7064
- readDir: (d) => readdir5(d),
7065
- deleteFile: (p) => unlink3(p),
7260
+ readDir: (d) => readdir6(d),
7261
+ deleteFile: (p) => unlink4(p),
7066
7262
  realpath: (p) => realpath3(p),
7067
- lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7263
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7068
7264
  });
7069
7265
  }
7070
7266
  /**
@@ -7131,25 +7327,25 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7131
7327
  });
7132
7328
  }
7133
7329
  get factsDir() {
7134
- return path12.join(this.baseDir, "facts");
7330
+ return path13.join(this.baseDir, "facts");
7135
7331
  }
7136
7332
  get correctionsDir() {
7137
- return path12.join(this.baseDir, "corrections");
7333
+ return path13.join(this.baseDir, "corrections");
7138
7334
  }
7139
7335
  get proceduresDir() {
7140
- return path12.join(this.baseDir, "procedures");
7336
+ return path13.join(this.baseDir, "procedures");
7141
7337
  }
7142
7338
  get reasoningTracesDir() {
7143
- return path12.join(this.baseDir, "reasoning-traces");
7339
+ return path13.join(this.baseDir, "reasoning-traces");
7144
7340
  }
7145
7341
  get entitiesDir() {
7146
- return path12.join(this.baseDir, "entities");
7342
+ return path13.join(this.baseDir, "entities");
7147
7343
  }
7148
7344
  resolveEntityFilePath(name) {
7149
7345
  if (typeof name !== "string") return null;
7150
- const filePath = path12.resolve(this.entitiesDir, `${name}.md`);
7151
- const relative2 = path12.relative(this.entitiesDir, filePath);
7152
- if (relative2 === "" || relative2.startsWith("..") || path12.isAbsolute(relative2)) {
7346
+ const filePath = path13.resolve(this.entitiesDir, `${name}.md`);
7347
+ const relative2 = path13.relative(this.entitiesDir, filePath);
7348
+ if (relative2 === "" || relative2.startsWith("..") || path13.isAbsolute(relative2)) {
7153
7349
  return null;
7154
7350
  }
7155
7351
  return filePath;
@@ -7160,7 +7356,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7160
7356
  async readDependencyPropagationQueueFile(filePath) {
7161
7357
  const target = await resolveSafeStoragePath(
7162
7358
  this.baseDir,
7163
- path12.relative(
7359
+ path13.relative(
7164
7360
  this.baseDir,
7165
7361
  this.assertManagedStoragePath(filePath, "storage.readDependencyPropagationQueueFile")
7166
7362
  )
@@ -7170,7 +7366,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7170
7366
  async writeDependencyPropagationQueueFile(filePath, content) {
7171
7367
  const target = await resolveSafeStoragePath(
7172
7368
  this.baseDir,
7173
- path12.relative(
7369
+ path13.relative(
7174
7370
  this.baseDir,
7175
7371
  this.assertManagedStoragePath(filePath, "storage.writeDependencyPropagationQueueFile")
7176
7372
  )
@@ -7185,10 +7381,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7185
7381
  });
7186
7382
  }
7187
7383
  assertManagedStoragePath(filePath, method) {
7188
- const resolved = path12.resolve(filePath);
7189
- const base = path12.resolve(this.baseDir);
7190
- const rel = path12.relative(base, resolved);
7191
- if (rel === "" || rel === ".." || rel.startsWith(`..${path12.sep}`) || path12.isAbsolute(rel)) {
7384
+ const resolved = path13.resolve(filePath);
7385
+ const base = path13.resolve(this.baseDir);
7386
+ const rel = path13.relative(base, resolved);
7387
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path13.sep}`) || path13.isAbsolute(rel)) {
7192
7388
  throw new Error(`${method}: file path escapes memory dir`);
7193
7389
  }
7194
7390
  return resolved;
@@ -7225,7 +7421,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7225
7421
  async digestOfflineSyncFile(filePath) {
7226
7422
  const target = this.assertManagedStoragePath(filePath, "storage.digestOfflineSyncFile");
7227
7423
  const st = await stat3(target);
7228
- const relPath = path12.relative(this.baseDir, target).split(path12.sep).join("/");
7424
+ const relPath = path13.relative(this.baseDir, target).split(path13.sep).join("/");
7229
7425
  const cache = await this.loadOfflineSyncDigestCache();
7230
7426
  const cached = cache.get(relPath);
7231
7427
  if (cached && cached.statBytes === st.size && cached.mtimeMs === st.mtimeMs && cached.ctimeMs === st.ctimeMs && !cached.encrypted) {
@@ -7239,11 +7435,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7239
7435
  if (encrypted) {
7240
7436
  const content = await readMaybeEncryptedFileBuffer(target, this._secureStoreKey, this.baseDir);
7241
7437
  digest = {
7242
- sha256: createHash5("sha256").update(content).digest("hex"),
7438
+ sha256: createHash6("sha256").update(content).digest("hex"),
7243
7439
  bytes: content.byteLength
7244
7440
  };
7245
7441
  } else {
7246
- const hash = createHash5("sha256");
7442
+ const hash = createHash6("sha256");
7247
7443
  let bytes = 0;
7248
7444
  for await (const rawChunk of createReadStream(target)) {
7249
7445
  const chunk = Buffer.isBuffer(rawChunk) ? rawChunk : Buffer.from(rawChunk);
@@ -7310,7 +7506,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7310
7506
  const cache = this.offlineSyncDigestCache;
7311
7507
  if (!cache) return;
7312
7508
  const entries = [...cache.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([entryPath, entry]) => ({ path: entryPath, ...entry }));
7313
- await mkdir(path12.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7509
+ await mkdir(path13.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7314
7510
  await writeFile(this.offlineSyncDigestCachePath, `${JSON.stringify({ version: 1, entries })}
7315
7511
  `, "utf-8");
7316
7512
  }).catch((err) => {
@@ -7411,7 +7607,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7411
7607
  }
7412
7608
  async appendStorageSecureFileUnlocked(filePath, content) {
7413
7609
  const writeKey = this.resolveWriteKey();
7414
- await mkdir(path12.dirname(filePath), { recursive: true });
7610
+ await mkdir(path13.dirname(filePath), { recursive: true });
7415
7611
  if (writeKey === null) {
7416
7612
  try {
7417
7613
  if (await this.isEncryptedFileHeader(filePath)) {
@@ -7437,13 +7633,13 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7437
7633
  this.notifyCatalogWriteForPath(filePath);
7438
7634
  }
7439
7635
  get stateDir() {
7440
- return path12.join(this.baseDir, "state");
7636
+ return path13.join(this.baseDir, "state");
7441
7637
  }
7442
7638
  get offlineSyncDigestCachePath() {
7443
- return path12.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
7639
+ return path13.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
7444
7640
  }
7445
7641
  get entitySynthesisQueuePath() {
7446
- return path12.join(this.stateDir, "entity-synthesis-queue.json");
7642
+ return path13.join(this.stateDir, "entity-synthesis-queue.json");
7447
7643
  }
7448
7644
  // ── Tombstone store access (issue #1579) ─────────────────────────────────
7449
7645
  /**
@@ -7453,7 +7649,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7453
7649
  * helpers are injected into the store).
7454
7650
  */
7455
7651
  get tombstonesPath() {
7456
- return path12.join(this.stateDir, "tombstones.jsonl");
7652
+ return path13.join(this.stateDir, "tombstones.jsonl");
7457
7653
  }
7458
7654
  /**
7459
7655
  * Configure the tombstone invariant for this storage instance. Installed
@@ -7766,55 +7962,55 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7766
7962
  return legacyMatches.length > 0 ? [...new Set(legacyMatches.map((content) => ContentHashIndex.computeHash(content)))] : [persistedHash];
7767
7963
  }
7768
7964
  get questionsDir() {
7769
- return path12.join(this.baseDir, "questions");
7965
+ return path13.join(this.baseDir, "questions");
7770
7966
  }
7771
7967
  get artifactsDir() {
7772
- return path12.join(this.baseDir, "artifacts");
7968
+ return path13.join(this.baseDir, "artifacts");
7773
7969
  }
7774
7970
  get identityDir() {
7775
- return path12.join(this.baseDir, "identity");
7971
+ return path13.join(this.baseDir, "identity");
7776
7972
  }
7777
7973
  get identityAnchorPath() {
7778
- return path12.join(this.identityDir, "identity-anchor.md");
7974
+ return path13.join(this.identityDir, "identity-anchor.md");
7779
7975
  }
7780
7976
  get identityIncidentsDir() {
7781
- return path12.join(this.identityDir, "incidents");
7977
+ return path13.join(this.identityDir, "incidents");
7782
7978
  }
7783
7979
  get identityAuditsWeeklyDir() {
7784
- return path12.join(this.identityDir, "audits", "weekly");
7980
+ return path13.join(this.identityDir, "audits", "weekly");
7785
7981
  }
7786
7982
  get identityAuditsMonthlyDir() {
7787
- return path12.join(this.identityDir, "audits", "monthly");
7983
+ return path13.join(this.identityDir, "audits", "monthly");
7788
7984
  }
7789
7985
  get identityImprovementLoopsPath() {
7790
- return path12.join(this.identityDir, "improvement-loops.md");
7986
+ return path13.join(this.identityDir, "improvement-loops.md");
7791
7987
  }
7792
7988
  get identityReflectionsPath() {
7793
- return path12.join(this.identityDir, "reflections.md");
7989
+ return path13.join(this.identityDir, "reflections.md");
7794
7990
  }
7795
7991
  get profilePath() {
7796
- return path12.join(this.baseDir, "profile.md");
7992
+ return path13.join(this.baseDir, "profile.md");
7797
7993
  }
7798
7994
  get memoryActionsPath() {
7799
- return path12.join(this.stateDir, "memory-actions.jsonl");
7995
+ return path13.join(this.stateDir, "memory-actions.jsonl");
7800
7996
  }
7801
7997
  get memoryLifecycleLedgerPath() {
7802
- return path12.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
7998
+ return path13.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
7803
7999
  }
7804
8000
  get compressionGuidelinesPath() {
7805
- return path12.join(this.stateDir, "compression-guidelines.md");
8001
+ return path13.join(this.stateDir, "compression-guidelines.md");
7806
8002
  }
7807
8003
  get compressionGuidelineDraftPath() {
7808
- return path12.join(this.stateDir, "compression-guidelines.draft.md");
8004
+ return path13.join(this.stateDir, "compression-guidelines.draft.md");
7809
8005
  }
7810
8006
  get compressionGuidelineStatePath() {
7811
- return path12.join(this.stateDir, "compression-guideline-state.json");
8007
+ return path13.join(this.stateDir, "compression-guideline-state.json");
7812
8008
  }
7813
8009
  get compressionGuidelineDraftStatePath() {
7814
- return path12.join(this.stateDir, "compression-guideline-draft-state.json");
8010
+ return path13.join(this.stateDir, "compression-guideline-draft-state.json");
7815
8011
  }
7816
8012
  get behaviorSignalsPath() {
7817
- return path12.join(this.stateDir, "behavior-signals.jsonl");
8013
+ return path13.join(this.stateDir, "behavior-signals.jsonl");
7818
8014
  }
7819
8015
  /**
7820
8016
  * In-memory dedup key set for behavior-signals appends (issue #1909),
@@ -7846,7 +8042,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7846
8042
  * governance sweeps can treat it uniformly.
7847
8043
  */
7848
8044
  get bufferSurpriseLedgerPath() {
7849
- return path12.join(this.stateDir, "buffer-surprise-ledger.jsonl");
8045
+ return path13.join(this.stateDir, "buffer-surprise-ledger.jsonl");
7850
8046
  }
7851
8047
  /**
7852
8048
  * Entity alias table loaded from THIS store's config/aliases.json.
@@ -7909,7 +8105,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7909
8105
  this.loadAliasesSync();
7910
8106
  }
7911
8107
  loadAliasesSync() {
7912
- const aliasPath = path12.join(this.baseDir, "config", "aliases.json");
8108
+ const aliasPath = path13.join(this.baseDir, "config", "aliases.json");
7913
8109
  this.userAliases = {};
7914
8110
  const raw = readEntityAliasConfigSync(this.baseDir);
7915
8111
  if (raw === void 0) return;
@@ -7947,9 +8143,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7947
8143
  await mkdir(this.baseDir, { recursive: true });
7948
8144
  await validateRoots(this.baseDir, this.entitiesDir, this.stateDir, this.archiveDir);
7949
8145
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
7950
- await mkdir(path12.join(this.factsDir, today), { recursive: true });
7951
- await mkdir(path12.join(this.proceduresDir, today), { recursive: true });
7952
- await mkdir(path12.join(this.reasoningTracesDir, today), { recursive: true });
8146
+ await mkdir(path13.join(this.factsDir, today), { recursive: true });
8147
+ await mkdir(path13.join(this.proceduresDir, today), { recursive: true });
8148
+ await mkdir(path13.join(this.reasoningTracesDir, today), { recursive: true });
7953
8149
  await mkdir(this.correctionsDir, { recursive: true });
7954
8150
  await mkdir(this.entitiesDir, { recursive: true });
7955
8151
  await mkdir(this.stateDir, { recursive: true });
@@ -7959,7 +8155,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7959
8155
  await mkdir(this.identityIncidentsDir, { recursive: true });
7960
8156
  await mkdir(this.identityAuditsWeeklyDir, { recursive: true });
7961
8157
  await mkdir(this.identityAuditsMonthlyDir, { recursive: true });
7962
- await mkdir(path12.join(this.baseDir, "config"), { recursive: true });
8158
+ await mkdir(path13.join(this.baseDir, "config"), { recursive: true });
7963
8159
  await this.entityCanonicalIdMigration.begin(options.waitForEntityMigration !== false, this.entitiesDir);
7964
8160
  if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
7965
8161
  this.bumpMemoryCorpusVersion();
@@ -7982,11 +8178,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7982
8178
  async resolveCategoryWritePath(category, id, today) {
7983
8179
  if (category === "correction") {
7984
8180
  await mkdir(this.correctionsDir, { recursive: true });
7985
- return path12.join(this.correctionsDir, `${id}.md`);
8181
+ return path13.join(this.correctionsDir, `${id}.md`);
7986
8182
  }
7987
- const datedDir = path12.join(getCategoryDir(this.baseDir, category), today);
8183
+ const datedDir = path13.join(getCategoryDir(this.baseDir, category), today);
7988
8184
  await mkdir(datedDir, { recursive: true });
7989
- return path12.join(datedDir, `${id}.md`);
8185
+ return path13.join(datedDir, `${id}.md`);
7990
8186
  }
7991
8187
  async findExistingTombstoneBlockedMemory(content, category, sourceConnector) {
7992
8188
  const identity = buildExplicitCaptureDedupKey(content, category, sourceConnector);
@@ -8157,7 +8353,7 @@ ${sanitized.text}
8157
8353
  }
8158
8354
  });
8159
8355
  } catch (err) {
8160
- await unlink3(filePath).catch(() => void 0);
8356
+ await unlink4(filePath).catch(() => void 0);
8161
8357
  this.invalidateAllMemoriesCache();
8162
8358
  await this.rebuildTombstoneBlockedCaptureAfterInvalidationForPath(filePath);
8163
8359
  throw err;
@@ -8365,7 +8561,7 @@ ${sanitized.text}
8365
8561
  await this.ensureDirectories();
8366
8562
  const now = /* @__PURE__ */ new Date();
8367
8563
  const day = now.toISOString().slice(0, 10);
8368
- const dir = path12.join(this.artifactsDir, day);
8564
+ const dir = path13.join(this.artifactsDir, day);
8369
8565
  await mkdir(dir, { recursive: true });
8370
8566
  const id = `artifact-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
8371
8567
  const fm = {
@@ -8392,7 +8588,7 @@ ${sanitized.text}
8392
8588
  log.warn(`artifact content rejected for ${id}; violations=${sanitized.violations.join(", ")}`);
8393
8589
  return "";
8394
8590
  }
8395
- const filePath = path12.join(dir, `${id}.md`);
8591
+ const filePath = path13.join(dir, `${id}.md`);
8396
8592
  await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(this.withOkfType(fm))}
8397
8593
 
8398
8594
  ${sanitized.text}
@@ -8686,7 +8882,7 @@ ${sanitized.text}
8686
8882
  * per-process in-memory cache safe across process boundaries.
8687
8883
  */
8688
8884
  invalidateColdMemoriesCache() {
8689
- const coldRoot = path12.join(this.baseDir, "cold");
8885
+ const coldRoot = path13.join(this.baseDir, "cold");
8690
8886
  _StorageManager.coldMemoriesCache.delete(coldRoot);
8691
8887
  this.bumpColdWriteVersion();
8692
8888
  invalidateAllForDir(this.baseDir);
@@ -8804,7 +9000,7 @@ ${sanitized.text}
8804
9000
  const correctionPaths = [];
8805
9001
  const factPaths = [];
8806
9002
  for (const filePath of filePaths) {
8807
- if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path12.sep}`)) {
9003
+ if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path13.sep}`)) {
8808
9004
  correctionPaths.push(filePath);
8809
9005
  } else {
8810
9006
  factPaths.push(filePath);
@@ -8867,10 +9063,10 @@ ${sanitized.text}
8867
9063
  const root = this.archiveDir;
8868
9064
  const readDir = async (dir) => {
8869
9065
  try {
8870
- const entries = (await readdir5(dir, { withFileTypes: true })).filter((e) => !isMacOsReplicationJunkBasename(e.name));
9066
+ const entries = (await readdir6(dir, { withFileTypes: true })).filter((e) => !isMacOsReplicationJunkBasename(e.name));
8871
9067
  for (const entry of entries) {
8872
9068
  checkCorpusReadAbort(options);
8873
- const fullPath = path12.join(dir, entry.name);
9069
+ const fullPath = path13.join(dir, entry.name);
8874
9070
  if (entry.isDirectory()) {
8875
9071
  await readDir(fullPath);
8876
9072
  } else if (entry.name.endsWith(".md")) {
@@ -8910,7 +9106,7 @@ ${sanitized.text}
8910
9106
  return this.rememberMemorySnapshot(await this.memoryReadStore.readMemoryByPath(filePath));
8911
9107
  }
8912
9108
  resolveTierRootDir(tier) {
8913
- return tier === "cold" ? path12.join(this.baseDir, "cold") : this.baseDir;
9109
+ return tier === "cold" ? path13.join(this.baseDir, "cold") : this.baseDir;
8914
9110
  }
8915
9111
  resolveMemoryDateDir(memory) {
8916
9112
  const preferred = memory.frontmatter.created || memory.frontmatter.updated;
@@ -8925,13 +9121,13 @@ ${sanitized.text}
8925
9121
  buildTierMemoryPath(memory, tier) {
8926
9122
  const root = this.resolveTierRootDir(tier);
8927
9123
  if (this.isArtifactMemory(memory)) {
8928
- return path12.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9124
+ return path13.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
8929
9125
  }
8930
9126
  if (memory.frontmatter.category === "correction") {
8931
- return path12.join(root, "corrections", `${memory.frontmatter.id}.md`);
9127
+ return path13.join(root, "corrections", `${memory.frontmatter.id}.md`);
8932
9128
  }
8933
9129
  const dir = categoryDirName(memory.frontmatter.category);
8934
- return path12.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9130
+ return path13.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
8935
9131
  }
8936
9132
  async writeMemoryFileAtomic(targetPath, memory) {
8937
9133
  assertNotOkfReservedBasename(targetPath);
@@ -8963,7 +9159,7 @@ ${memory.content}
8963
9159
  });
8964
9160
  } catch (err) {
8965
9161
  if (priorDest === null) {
8966
- await unlink3(targetPath).catch(() => void 0);
9162
+ await unlink4(targetPath).catch(() => void 0);
8967
9163
  } else {
8968
9164
  await writeFile(targetPath, priorDest).catch(() => void 0);
8969
9165
  }
@@ -9010,8 +9206,8 @@ ${memory.content}
9010
9206
  memory.frontmatter.entityRef = current.frontmatter.entityRef;
9011
9207
  }
9012
9208
  durable = true;
9013
- const sourcePath = path12.resolve(current.path);
9014
- const destPath = path12.resolve(targetPath);
9209
+ const sourcePath = path13.resolve(current.path);
9210
+ const destPath = path13.resolve(targetPath);
9015
9211
  if (sourcePath !== destPath) {
9016
9212
  await recordArchiveDelete2(this.baseDir, current.path, () => this.deleteManagedStorageFile(current.path));
9017
9213
  this.invalidateAllMemoriesCache();
@@ -9035,8 +9231,8 @@ ${memory.content}
9035
9231
  }
9036
9232
  async migrateMemoryToTier(memory, targetTier) {
9037
9233
  const targetPath = this.buildTierMemoryPath(memory, targetTier);
9038
- const sourcePath = path12.resolve(memory.path);
9039
- const destPath = path12.resolve(targetPath);
9234
+ const sourcePath = path13.resolve(memory.path);
9235
+ const destPath = path13.resolve(targetPath);
9040
9236
  if (sourcePath === destPath) {
9041
9237
  return { changed: false, targetPath };
9042
9238
  }
@@ -9046,7 +9242,7 @@ ${memory.content}
9046
9242
  return { changed, targetPath };
9047
9243
  }
9048
9244
  get archiveDir() {
9049
- return path12.join(this.baseDir, "archive");
9245
+ return path13.join(this.baseDir, "archive");
9050
9246
  }
9051
9247
  /**
9052
9248
  * Archive a memory by moving it from facts/ to archive/YYYY-MM-DD/.
@@ -9059,7 +9255,7 @@ ${memory.content}
9059
9255
  try {
9060
9256
  const now = lifecycle?.at ?? /* @__PURE__ */ new Date();
9061
9257
  const today = now.toISOString().slice(0, 10);
9062
- const destDir = path12.join(this.archiveDir, today);
9258
+ const destDir = path13.join(this.archiveDir, today);
9063
9259
  await mkdir(destDir, { recursive: true });
9064
9260
  const refIdsAtWrite = this.currentHistoricalIds();
9065
9261
  const updatedFm = canonicalizeEntityRefOption(
@@ -9075,7 +9271,7 @@ ${memory.content}
9075
9271
 
9076
9272
  ${current.content}
9077
9273
  `;
9078
- const destPath = path12.join(destDir, path12.basename(current.path));
9274
+ const destPath = path13.join(destDir, path13.basename(current.path));
9079
9275
  const priorDest = await this.readStorageSecureFile(destPath).catch(() => null);
9080
9276
  await recordArchiveWrite(this.baseDir, destPath, () => this.writeStorageSecureFile(destPath, fileContent));
9081
9277
  if (typeof current.frontmatter.entityRef === "string") {
@@ -9092,7 +9288,7 @@ ${current.content}
9092
9288
  await recordArchiveDelete2(
9093
9289
  this.baseDir,
9094
9290
  destPath,
9095
- () => unlink3(destPath).then(
9291
+ () => unlink4(destPath).then(
9096
9292
  () => true,
9097
9293
  () => false
9098
9294
  )
@@ -9309,7 +9505,7 @@ ${memory.content}
9309
9505
  `;
9310
9506
  await this.writeTombstoneBlockedFrontmatter(memory, fileContent, updated, async () => {
9311
9507
  this.invalidateAllMemoriesCache();
9312
- if (memory.path.includes(`${path12.sep}cold${path12.sep}`)) {
9508
+ if (memory.path.includes(`${path13.sep}cold${path13.sep}`)) {
9313
9509
  this.invalidateColdMemoriesCache();
9314
9510
  }
9315
9511
  });
@@ -9321,7 +9517,7 @@ ${memory.content}
9321
9517
  }
9322
9518
  if (mentionReentry && !entityMentionEpoch.neutral(memory.frontmatter, updated)) entityMentionEpoch.bump(this.baseDir);
9323
9519
  await this.patchHotMemoriesCache({ addedPath: memory.path });
9324
- if (memory.path.includes(`${path12.sep}cold${path12.sep}`)) {
9520
+ if (memory.path.includes(`${path13.sep}cold${path13.sep}`)) {
9325
9521
  this.invalidateColdMemoriesCache();
9326
9522
  }
9327
9523
  try {
@@ -9401,24 +9597,26 @@ ${memory.content}
9401
9597
  }
9402
9598
  return deleted;
9403
9599
  }
9600
+ // Buffer persistence: one file per session (storage/buffer-session-files.ts).
9601
+ bufferFiles;
9602
+ bufferSessionFiles() {
9603
+ const io = { read: (p) => this.readStorageSecureFile(p), write: (p, c) => this.writeStorageSecureFile(p, c) };
9604
+ return this.bufferFiles ??= new BufferSessionFiles(this.stateDir, io);
9605
+ }
9404
9606
  async loadBuffer() {
9405
- const bufferPath = path12.join(this.stateDir, "buffer.json");
9406
- try {
9407
- const raw = await this.readStorageSecureFile(bufferPath);
9408
- return JSON.parse(raw);
9409
- } catch (err) {
9410
- if (err instanceof SecureStoreLockedError) throw err;
9411
- if (!isErrnoCode(err, "ENOENT")) throw err;
9412
- return { turns: [], lastExtractionAt: null, extractionCount: 0 };
9413
- }
9607
+ return this.bufferSessionFiles().load();
9414
9608
  }
9415
9609
  async saveBuffer(state) {
9416
- await this.ensureDirectories();
9417
- const bufferPath = path12.join(this.stateDir, "buffer.json");
9418
- await this.writeStorageSecureFile(bufferPath, JSON.stringify(state, null, 2));
9610
+ await this.bufferSessionFiles().reconcile(state);
9611
+ }
9612
+ async saveBufferSession(key, entry) {
9613
+ await this.bufferSessionFiles().save(key, entry);
9614
+ }
9615
+ async deleteBufferSession(key) {
9616
+ await this.bufferSessionFiles().remove(key);
9419
9617
  }
9420
9618
  async loadMeta() {
9421
- const metaPath = path12.join(this.stateDir, "meta.json");
9619
+ const metaPath = path13.join(this.stateDir, "meta.json");
9422
9620
  try {
9423
9621
  const raw = await this.readStorageSecureFile(metaPath);
9424
9622
  const parsed = JSON.parse(raw);
@@ -9451,7 +9649,7 @@ ${memory.content}
9451
9649
  }
9452
9650
  async saveMeta(state) {
9453
9651
  await this.ensureDirectories();
9454
- const metaPath = path12.join(this.stateDir, "meta.json");
9652
+ const metaPath = path13.join(this.stateDir, "meta.json");
9455
9653
  await this.writeStorageSecureFile(metaPath, JSON.stringify(state, null, 2));
9456
9654
  }
9457
9655
  async appendMemoryActionEvents(events) {
@@ -9521,7 +9719,7 @@ ${memory.content}
9521
9719
  },
9522
9720
  (payload) => this.appendStorageSecureFile(target, payload),
9523
9721
  async () => {
9524
- await mkdir(path12.dirname(target), { recursive: true });
9722
+ await mkdir(path13.dirname(target), { recursive: true });
9525
9723
  }
9526
9724
  );
9527
9725
  }
@@ -9619,7 +9817,7 @@ ${memory.content}
9619
9817
  async appendReextractJobs(events) {
9620
9818
  if (events.length === 0) return 0;
9621
9819
  await this.ensureDirectories();
9622
- const filePath = path12.join(this.stateDir, "reextract-jobs.jsonl");
9820
+ const filePath = path13.join(this.stateDir, "reextract-jobs.jsonl");
9623
9821
  const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
9624
9822
  try {
9625
9823
  await this.appendStorageSecureFile(filePath, lines);
@@ -9632,7 +9830,7 @@ ${memory.content}
9632
9830
  }
9633
9831
  async readReextractJobs(limit = 200) {
9634
9832
  const safeLimit = Number.isFinite(limit) ? Math.max(1, Math.min(1e3, Math.floor(limit))) : 200;
9635
- const filePath = path12.join(this.stateDir, "reextract-jobs.jsonl");
9833
+ const filePath = path13.join(this.stateDir, "reextract-jobs.jsonl");
9636
9834
  try {
9637
9835
  const raw = await this.readStorageSecureFile(filePath);
9638
9836
  const lines = raw.split("\n").filter((line) => line.trim().length > 0);
@@ -9788,7 +9986,7 @@ ${memory.content}
9788
9986
  return false;
9789
9987
  }
9790
9988
  if (draftState.contentHash) {
9791
- const contentHash = createHash5("sha256").update(draftContent).digest("hex");
9989
+ const contentHash = createHash6("sha256").update(draftContent).digest("hex");
9792
9990
  if (contentHash !== draftState.contentHash) return false;
9793
9991
  }
9794
9992
  await this.writeCompressionGuidelines(draftContent);
@@ -9797,8 +9995,8 @@ ${memory.content}
9797
9995
  activationState: "active"
9798
9996
  });
9799
9997
  await Promise.all([
9800
- unlink3(this.compressionGuidelineDraftPath).catch(() => void 0),
9801
- unlink3(this.compressionGuidelineDraftStatePath).catch(() => void 0)
9998
+ unlink4(this.compressionGuidelineDraftPath).catch(() => void 0),
9999
+ unlink4(this.compressionGuidelineDraftStatePath).catch(() => void 0)
9802
10000
  ]);
9803
10001
  return true;
9804
10002
  }
@@ -9867,7 +10065,7 @@ ${question}
9867
10065
 
9868
10066
  **Context:** ${context}
9869
10067
  `;
9870
- const filePath = path12.join(this.questionsDir, `${id}.md`);
10068
+ const filePath = path13.join(this.questionsDir, `${id}.md`);
9871
10069
  await this.writeStorageSecureFile(filePath, content);
9872
10070
  log.debug(`wrote question ${id} to ${filePath}`);
9873
10071
  this.invalidateQuestionsCache();
@@ -9926,11 +10124,11 @@ ${question}
9926
10124
  } catch {
9927
10125
  }
9928
10126
  const hygiene = opts?.hygiene;
9929
- const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path12.basename(identityPath));
10127
+ const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path13.basename(identityPath));
9930
10128
  if (rotateEnabled) {
9931
10129
  const maxBytes = hygiene.rotateMaxBytes;
9932
10130
  if (existing.length > maxBytes) {
9933
- const archiveDir = path12.join(workspaceDir, hygiene.archiveDir);
10131
+ const archiveDir = path13.join(workspaceDir, hygiene.archiveDir);
9934
10132
  const { newContent } = await rotateMarkdownFileToArchive({
9935
10133
  filePath: identityPath,
9936
10134
  archiveDir,
@@ -10190,7 +10388,7 @@ ${reflection}
10190
10388
  if (entries.length === 0) return 0;
10191
10389
  const memories = await this.readAllMemories();
10192
10390
  const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
10193
- const memoryPathMap = new Map(memories.map((m) => [path12.resolve(m.path), m]));
10391
+ const memoryPathMap = new Map(memories.map((m) => [path13.resolve(m.path), m]));
10194
10392
  let updated = 0;
10195
10393
  const prevVersion = this.getMemoryCorpusVersion();
10196
10394
  let entityRefMoved = false;
@@ -10198,7 +10396,7 @@ ${reflection}
10198
10396
  const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
10199
10397
  const appliedPatches = /* @__PURE__ */ new Map();
10200
10398
  for (const entry of entries) {
10201
- const memory = entry.memoryPath ? memoryPathMap.get(path12.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10399
+ const memory = entry.memoryPath ? memoryPathMap.get(path13.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10202
10400
  if (!memory) continue;
10203
10401
  try {
10204
10402
  const applied = await this.withTombstoneBlockedMemoryPathLock(memory.path, async (current) => {
@@ -10230,7 +10428,7 @@ ${current.content}
10230
10428
  if (warm) {
10231
10429
  updateCacheOnWrite(this.baseDir, { ...applied.current, frontmatter: applied.newFm }, keyId);
10232
10430
  }
10233
- appliedPatches.set(path12.resolve(memory.path), {
10431
+ appliedPatches.set(path13.resolve(memory.path), {
10234
10432
  accessCount: entry.newCount,
10235
10433
  lastAccessed: entry.lastAccessed
10236
10434
  });
@@ -10248,7 +10446,7 @@ ${current.content}
10248
10446
  const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
10249
10447
  if (cur) {
10250
10448
  const reapplied = cur.map((m) => {
10251
- const patch = appliedPatches.get(path12.resolve(m.path));
10449
+ const patch = appliedPatches.get(path13.resolve(m.path));
10252
10450
  return patch ? {
10253
10451
  ...m,
10254
10452
  frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed }
@@ -10278,7 +10476,7 @@ ${current.content}
10278
10476
  const pathsById = /* @__PURE__ */ new Map();
10279
10477
  const filePathsById = /* @__PURE__ */ new Map();
10280
10478
  for (const filePath of filePaths) {
10281
- const memoryId = path12.basename(filePath, ".md");
10479
+ const memoryId = path13.basename(filePath, ".md");
10282
10480
  if (!wantedIds.has(memoryId)) continue;
10283
10481
  const paths = filePathsById.get(memoryId) ?? [];
10284
10482
  paths.push(filePath);
@@ -10290,7 +10488,7 @@ ${current.content}
10290
10488
  const preferredMatches = [];
10291
10489
  for (const preferredPath of preferred) {
10292
10490
  const directCandidates = new Set(qmdResultPathCandidates(this.baseDir, preferredPath));
10293
- const directMatch = existingPaths.find((filePath) => directCandidates.has(path12.resolve(filePath)));
10491
+ const directMatch = existingPaths.find((filePath) => directCandidates.has(path13.resolve(filePath)));
10294
10492
  if (directMatch) {
10295
10493
  preferredMatches.push(directMatch);
10296
10494
  continue;
@@ -10302,7 +10500,7 @@ ${current.content}
10302
10500
  candidates.add(candidate);
10303
10501
  }
10304
10502
  }
10305
- const match = existingPaths.find((filePath) => candidates.has(path12.resolve(filePath)));
10503
+ const match = existingPaths.find((filePath) => candidates.has(path13.resolve(filePath)));
10306
10504
  if (match) preferredMatches.push(match);
10307
10505
  }
10308
10506
  if (preferredMatches.length > 0) {
@@ -10493,7 +10691,7 @@ ${sanitized.text}
10493
10691
  }
10494
10692
  if (!oldMemory) return false;
10495
10693
  const requireActiveAtWrite = options.requireActive === true || inferMemoryStatus(oldMemory.frontmatter, toMemoryPathRel(this.baseDir, oldMemory.path)) === "active";
10496
- const operationId = createHash5("sha256").update(
10694
+ const operationId = createHash6("sha256").update(
10497
10695
  JSON.stringify({
10498
10696
  oldMemoryId,
10499
10697
  newMemoryId,
@@ -10624,21 +10822,21 @@ ${current.content}
10624
10822
  }
10625
10823
  }
10626
10824
  get summariesDir() {
10627
- return path12.join(this.baseDir, "summaries");
10825
+ return path13.join(this.baseDir, "summaries");
10628
10826
  }
10629
10827
  async writeSummary(summary) {
10630
10828
  await mkdir(this.summariesDir, { recursive: true });
10631
- const filePath = path12.join(this.summariesDir, `${summary.id}.json`);
10829
+ const filePath = path13.join(this.summariesDir, `${summary.id}.json`);
10632
10830
  await this.writeStorageSecureFile(filePath, JSON.stringify(summary, null, 2));
10633
10831
  log.debug(`wrote summary ${summary.id}`);
10634
10832
  }
10635
10833
  async readSummaries() {
10636
10834
  try {
10637
- const files = await readdir5(this.summariesDir);
10835
+ const files = await readdir6(this.summariesDir);
10638
10836
  const summaries = [];
10639
10837
  for (const file of files) {
10640
10838
  if (isMacOsReplicationJunkBasename(file) || !file.endsWith(".json")) continue;
10641
- const filePath = path12.join(this.summariesDir, file);
10839
+ const filePath = path13.join(this.summariesDir, file);
10642
10840
  const raw = await this.readStorageSecureFile(filePath);
10643
10841
  summaries.push(JSON.parse(raw));
10644
10842
  }
@@ -10708,7 +10906,7 @@ ${current.content}
10708
10906
  return archived;
10709
10907
  }
10710
10908
  async saveTopics(topics) {
10711
- const metaPath = path12.join(this.stateDir, "topics.json");
10909
+ const metaPath = path13.join(this.stateDir, "topics.json");
10712
10910
  await mkdir(this.stateDir, { recursive: true });
10713
10911
  await this.writeStorageSecureFile(
10714
10912
  metaPath,
@@ -10717,7 +10915,7 @@ ${current.content}
10717
10915
  log.debug(`saved ${topics.length} topic scores`);
10718
10916
  }
10719
10917
  async loadTopics() {
10720
- const metaPath = path12.join(this.stateDir, "topics.json");
10918
+ const metaPath = path13.join(this.stateDir, "topics.json");
10721
10919
  try {
10722
10920
  const raw = await this.readStorageSecureFile(metaPath);
10723
10921
  return JSON.parse(raw);
@@ -10836,4 +11034,4 @@ export {
10836
11034
  isValidBufferSurpriseEvent,
10837
11035
  StorageManager3 as StorageManager
10838
11036
  };
10839
- //# sourceMappingURL=chunk-O3VKQMWC.js.map
11037
+ //# sourceMappingURL=chunk-R6TCM47S.js.map