@remnic/core 10.0.59 → 10.0.61

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 (370) hide show
  1. package/dist/access-admin-ops-surface.js +53 -50
  2. package/dist/access-authorization-probe.js +54 -51
  3. package/dist/access-boundary.js +53 -50
  4. package/dist/access-cli.js +143 -140
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-extraction-force-flush.js +53 -50
  7. package/dist/access-http-briefing.js +54 -51
  8. package/dist/access-http-query.js +55 -52
  9. package/dist/access-http.js +76 -73
  10. package/dist/access-identity-continuity-surface.js +53 -50
  11. package/dist/access-lcm-surface.js +53 -50
  12. package/dist/access-mcp.js +64 -61
  13. package/dist/access-namespace-preflight.js +53 -50
  14. package/dist/access-observe-write-category.js +10 -10
  15. package/dist/access-observe-write-surface.js +53 -50
  16. package/dist/access-offline-manifest.js +7 -7
  17. package/dist/access-operations-batch.js +56 -53
  18. package/dist/access-operations.js +63 -60
  19. package/dist/access-recall-concurrency.js +53 -50
  20. package/dist/access-recall-response.js +53 -50
  21. package/dist/access-recall-surface.js +53 -50
  22. package/dist/access-schema.js +9 -9
  23. package/dist/access-service.js +53 -50
  24. package/dist/access-surface-catalog.js +55 -52
  25. package/dist/access-surface-catalog.js.map +1 -1
  26. package/dist/active-recall.js +24 -20
  27. package/dist/active-recall.js.map +1 -1
  28. package/dist/adapters/index.js +7 -7
  29. package/dist/adapters/registry.js +3 -3
  30. package/dist/briefing.js +16 -12
  31. package/dist/buffer-persistence.d.ts +14 -3
  32. package/dist/buffer-persistence.d.ts.map +1 -1
  33. package/dist/buffer-persistence.js +1 -1
  34. package/dist/buffer-turn-helpers.d.ts +7 -0
  35. package/dist/buffer-turn-helpers.d.ts.map +1 -1
  36. package/dist/buffer-turn-helpers.js +5 -3
  37. package/dist/buffer.d.ts +2 -0
  38. package/dist/buffer.d.ts.map +1 -1
  39. package/dist/buffer.js +7 -7
  40. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-GWVG7LGC.js} +2 -2
  41. package/dist/causal-behavior.js +2 -2
  42. package/dist/causal-chain.js +2 -2
  43. package/dist/causal-consolidation.js +19 -15
  44. package/dist/causal-consolidation.js.map +1 -1
  45. package/dist/causal-retrieval.js +2 -2
  46. package/dist/causal-trajectory-graph.js +2 -2
  47. package/dist/causal-trajectory.js +1 -1
  48. package/dist/{chunk-ZAZZOQAQ.js → chunk-23OEPU3K.js} +2 -2
  49. package/dist/{chunk-XDKEHZUC.js → chunk-264B57GV.js} +2 -2
  50. package/dist/{chunk-5U2BBF7E.js → chunk-46U6L5DM.js} +20 -10
  51. package/dist/chunk-46U6L5DM.js.map +1 -0
  52. package/dist/chunk-4LZ7SVKM.js +211 -0
  53. package/dist/chunk-4LZ7SVKM.js.map +1 -0
  54. package/dist/{chunk-NRGQ5HJO.js → chunk-4P4VLPGB.js} +1 -1
  55. package/dist/{chunk-GIRWNTMV.js → chunk-4PG5R6BJ.js} +2 -2
  56. package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
  57. package/dist/{chunk-RG3I2663.js → chunk-64JLBFCQ.js} +2 -2
  58. package/dist/{chunk-G3T6YMBO.js → chunk-64S6X4IU.js} +7 -7
  59. package/dist/{chunk-WASVDS6G.js → chunk-6HTEPYOI.js} +4 -4
  60. package/dist/{chunk-6AEKSOWV.js → chunk-6I6DFULH.js} +8 -8
  61. package/dist/{chunk-DJR37Q37.js → chunk-6T4CMKNP.js} +2 -2
  62. package/dist/{chunk-RHJ5VGB3.js → chunk-73A2DDDR.js} +2 -2
  63. package/dist/{chunk-4B73TQQV.js → chunk-7AKPLEJV.js} +2 -2
  64. package/dist/{chunk-UHH67NLU.js → chunk-7OKYO2UC.js} +2 -2
  65. package/dist/{chunk-KAL5SXPP.js → chunk-7ULSP7AU.js} +6 -6
  66. package/dist/{chunk-USNU3BEQ.js → chunk-A4FZLM6Q.js} +2 -2
  67. package/dist/{chunk-VV73XT3A.js → chunk-BJLCV2P3.js} +2 -2
  68. package/dist/{chunk-KQAFEZQX.js → chunk-BUKK5SWA.js} +2 -2
  69. package/dist/{chunk-DJFULNXK.js → chunk-C2AYUXEF.js} +2 -2
  70. package/dist/{chunk-QY24FSXT.js → chunk-D3BYJSHX.js} +51 -51
  71. package/dist/{chunk-JZRQY7ZQ.js → chunk-D4WR56FR.js} +2 -2
  72. package/dist/{chunk-3E3Z6UA3.js → chunk-DMYNM3WG.js} +124 -97
  73. package/dist/chunk-DMYNM3WG.js.map +1 -0
  74. package/dist/{chunk-FB4JQEFS.js → chunk-DP22K7IC.js} +2 -2
  75. package/dist/{chunk-EJFOGYF3.js → chunk-DTQJ7BRN.js} +3 -3
  76. package/dist/{chunk-MLUPSZFK.js → chunk-DZL5PBEJ.js} +2 -2
  77. package/dist/{chunk-JD5F5MYN.js → chunk-EGCC5OJE.js} +3 -3
  78. package/dist/{chunk-IQSRVR6Z.js → chunk-EJ4RS7I7.js} +2 -2
  79. package/dist/{chunk-WBN66HPI.js → chunk-ELHJK7LM.js} +6 -6
  80. package/dist/{chunk-EH46DHBU.js → chunk-ENAPZQA6.js} +2 -2
  81. package/dist/{chunk-LLG5VNK7.js → chunk-F2UAAI6B.js} +2 -2
  82. package/dist/{chunk-YZNTAOPZ.js → chunk-FKNNWH7P.js} +2 -2
  83. package/dist/{chunk-AAANTXCQ.js → chunk-FZVZYU5C.js} +2 -2
  84. package/dist/{chunk-ON77FQXH.js → chunk-G6GMZJQ4.js} +2 -2
  85. package/dist/{chunk-OL7A7NKH.js → chunk-GNP4BV4Z.js} +2 -2
  86. package/dist/{chunk-GDYLZ6FR.js → chunk-HJ3UTGIW.js} +3 -3
  87. package/dist/{chunk-CCL2OXFO.js → chunk-HSHLDSPX.js} +3 -3
  88. package/dist/{chunk-R4BR62UO.js → chunk-HWMGQDZI.js} +2 -2
  89. package/dist/{chunk-BPIAXMGC.js → chunk-IIUEHIQ2.js} +2 -2
  90. package/dist/{chunk-RTJJPW3C.js → chunk-ILMB3X4X.js} +5 -5
  91. package/dist/{chunk-RFT4OPYI.js → chunk-IPN67KVR.js} +2 -2
  92. package/dist/chunk-JCL7RO2G.js +674 -0
  93. package/dist/chunk-JCL7RO2G.js.map +1 -0
  94. package/dist/{chunk-IEW6NDHX.js → chunk-JGSWWD33.js} +9 -9
  95. package/dist/{chunk-A3UFV4K3.js → chunk-JIYJIH5N.js} +2 -2
  96. package/dist/{chunk-4G2A7MH3.js → chunk-JKUVPVKR.js} +3 -3
  97. package/dist/{chunk-YJHOVA42.js → chunk-JL5FHZ7O.js} +30 -6
  98. package/dist/chunk-JL5FHZ7O.js.map +1 -0
  99. package/dist/{chunk-VCLNU6MY.js → chunk-L2HSSVVD.js} +2 -2
  100. package/dist/{chunk-U2A56LLF.js → chunk-L334PSLW.js} +8 -8
  101. package/dist/{chunk-HQUYENKK.js → chunk-LIUI46BX.js} +3 -3
  102. package/dist/{chunk-ERMT5WQM.js → chunk-MKE5DP3S.js} +2 -2
  103. package/dist/{chunk-4OFXLQJD.js → chunk-MPDLLLOG.js} +8 -3
  104. package/dist/chunk-MPDLLLOG.js.map +1 -0
  105. package/dist/{chunk-6BO27AWQ.js → chunk-MPJ7VHHA.js} +2 -2
  106. package/dist/{chunk-WXBVGKS6.js → chunk-N7RAABFM.js} +182 -421
  107. package/dist/chunk-N7RAABFM.js.map +1 -0
  108. package/dist/{chunk-KMJDH4KX.js → chunk-NSUGAIIB.js} +16 -16
  109. package/dist/{chunk-7NT3FKAF.js → chunk-NXHBQC2O.js} +2 -2
  110. package/dist/{chunk-JEX2JL3U.js → chunk-OH55F76C.js} +2 -2
  111. package/dist/{chunk-37VTMUAL.js → chunk-OUJ4DVR5.js} +2 -2
  112. package/dist/{chunk-2NLLXCJG.js → chunk-OWHERGF2.js} +2 -2
  113. package/dist/{chunk-2IVK5IDY.js → chunk-P5F7ISLV.js} +2 -2
  114. package/dist/{chunk-PM4PKC3Y.js → chunk-PNVQNAJM.js} +3 -3
  115. package/dist/{chunk-FXWX7VD3.js → chunk-PRYDNBCO.js} +12 -12
  116. package/dist/{chunk-YDDLSGYE.js → chunk-PUTH5REB.js} +2 -2
  117. package/dist/{chunk-GFAEKSFR.js → chunk-QBK3IM6W.js} +5 -5
  118. package/dist/{chunk-KRAMCBIW.js → chunk-QKXPOLQD.js} +4 -4
  119. package/dist/{chunk-YDT3OEYF.js → chunk-R4ZHF4K2.js} +2 -2
  120. package/dist/{chunk-ISNPYOXR.js → chunk-RBUR6USI.js} +5 -5
  121. package/dist/{chunk-WZYAXOGO.js → chunk-RZSHIJYY.js} +2 -2
  122. package/dist/{chunk-TYSD7UQO.js → chunk-SVTIWBSA.js} +2 -2
  123. package/dist/{chunk-AMKIIRLL.js → chunk-TBFAQHQZ.js} +2 -2
  124. package/dist/{chunk-ZE5N4JSY.js → chunk-TKCJI7WA.js} +2 -2
  125. package/dist/{chunk-RYB553SS.js → chunk-TLOAAOT3.js} +2 -2
  126. package/dist/{chunk-RKRX4C4H.js → chunk-TPKB7T6Z.js} +2 -2
  127. package/dist/{chunk-JZCBMKR5.js → chunk-TUCEP2LS.js} +5 -5
  128. package/dist/{chunk-KZMRMKC7.js → chunk-U7MIMS2Y.js} +11 -1
  129. package/dist/chunk-U7MIMS2Y.js.map +1 -0
  130. package/dist/{chunk-OMWQO7H6.js → chunk-UEDC2VGP.js} +2 -2
  131. package/dist/{chunk-X7Y7WX73.js → chunk-UVYI6VIX.js} +1 -1
  132. package/dist/{chunk-JY2BGCYN.js → chunk-VCYH2XUY.js} +2 -2
  133. package/dist/{chunk-NGH74LDV.js → chunk-WD2QH3JM.js} +9 -9
  134. package/dist/{chunk-G6A3SGCE.js → chunk-WVEEVYMH.js} +8 -25
  135. package/dist/chunk-WVEEVYMH.js.map +1 -0
  136. package/dist/{chunk-UGTYADB4.js → chunk-WWSJQ7MP.js} +3 -3
  137. package/dist/{chunk-UQBOPCDK.js → chunk-X4PAATLA.js} +2 -2
  138. package/dist/{chunk-KBOQQEVC.js → chunk-XAFSZ4DP.js} +2 -2
  139. package/dist/{chunk-2S6JADBB.js → chunk-XICJL56Z.js} +2 -2
  140. package/dist/{chunk-Y5KESB7T.js → chunk-XJDSZFBZ.js} +45 -45
  141. package/dist/{chunk-24SIB3EW.js → chunk-XWE3EOWX.js} +2 -2
  142. package/dist/{chunk-Y77FXULH.js → chunk-XWXBXBOX.js} +2 -2
  143. package/dist/{chunk-VKQI47DJ.js → chunk-Y7427SL7.js} +4 -4
  144. package/dist/{chunk-TEH5MDX5.js → chunk-YH7HJNWV.js} +22 -22
  145. package/dist/chunk-YHTG64XV.js +117 -0
  146. package/dist/chunk-YHTG64XV.js.map +1 -0
  147. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  148. package/dist/{chunk-2M36PR7R.js → chunk-Z2T5BPOZ.js} +2 -2
  149. package/dist/cli.js +100 -97
  150. package/dist/coding/export-okf-codegraph.js +15 -11
  151. package/dist/coding/export-okf-codegraph.js.map +1 -1
  152. package/dist/coding/pre-action-gate.js +2 -2
  153. package/dist/compounding/engine.js +17 -13
  154. package/dist/config.js +24 -20
  155. package/dist/connectors/codex-materialize-runner.js +16 -12
  156. package/dist/connectors/index.js +16 -12
  157. package/dist/convergence-refresh.js +18 -14
  158. package/dist/corpus-scan-worker-host.d.ts +109 -0
  159. package/dist/corpus-scan-worker-host.d.ts.map +1 -0
  160. package/dist/corpus-scan-worker-host.js +15 -0
  161. package/dist/corpus-scan-worker.entry.d.ts +21 -0
  162. package/dist/corpus-scan-worker.entry.d.ts.map +1 -0
  163. package/dist/corpus-scan-worker.entry.js +60 -0
  164. package/dist/corpus-scan-worker.entry.js.map +1 -0
  165. package/dist/corpus-scan-worker.entry.mjs +176 -0
  166. package/dist/corpus-scan.d.ts +71 -0
  167. package/dist/corpus-scan.d.ts.map +1 -0
  168. package/dist/corpus-scan.js +16 -0
  169. package/dist/corpus-watermark.d.ts.map +1 -1
  170. package/dist/corpus-watermark.js +18 -14
  171. package/dist/dashboard-runtime.js +2 -2
  172. package/dist/deep-recall-http-glue.js +10 -10
  173. package/dist/embedding-fallback.js +2 -2
  174. package/dist/{entity-canonical-id-migration-F3JVG6K6.js → entity-canonical-id-migration-CUDCKWPF.js} +4 -2
  175. package/dist/entity-canonical-id-migration-CUDCKWPF.js.map +1 -0
  176. package/dist/entity-retrieval.js +18 -14
  177. package/dist/event-order-recall.js +3 -3
  178. package/dist/external-wiki-access.js +54 -51
  179. package/dist/extraction.js +21 -17
  180. package/dist/{graph-edge-decay-IU75NV42.js → graph-edge-decay-2BZTY2IM.js} +5 -5
  181. package/dist/graph-edge-decay-2BZTY2IM.js.map +1 -0
  182. package/dist/graph-jsonl.js +3 -3
  183. package/dist/graph-snapshot.js +3 -3
  184. package/dist/graph.js +2 -2
  185. package/dist/harmonic-retrieval.js +16 -12
  186. package/dist/index.d.ts +1 -1
  187. package/dist/index.d.ts.map +1 -1
  188. package/dist/index.js +174 -169
  189. package/dist/lcm/engine.js +2 -2
  190. package/dist/lcm/index.js +5 -5
  191. package/dist/location/index.js +18 -14
  192. package/dist/maintenance/memory-governance.js +16 -12
  193. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +16 -12
  194. package/dist/maintenance/rebuild-memory-projection-runner.js +18 -14
  195. package/dist/maintenance/rebuild-memory-projection.js +17 -13
  196. package/dist/memory-browse-operations.js +54 -51
  197. package/dist/memory-browse.js +5 -5
  198. package/dist/namespaces/migrate.js +17 -13
  199. package/dist/namespaces/search.js +7 -7
  200. package/dist/namespaces/storage.js +16 -12
  201. package/dist/offline-sync-changeset-generations.js +4 -4
  202. package/dist/offline-sync-embedding-generation.js +3 -3
  203. package/dist/offline-sync-snapshot-stream.js +7 -7
  204. package/dist/offline-sync.js +6 -6
  205. package/dist/operator-doctor-corpus.js +19 -15
  206. package/dist/operator-toolkit.js +35 -31
  207. package/dist/orchestration/buffer-drain-gate.d.ts +21 -0
  208. package/dist/orchestration/buffer-drain-gate.d.ts.map +1 -0
  209. package/dist/orchestration/buffer-drain-runner.d.ts +79 -0
  210. package/dist/orchestration/buffer-drain-runner.d.ts.map +1 -0
  211. package/dist/orchestration/buffer-drain-runner.js +780 -0
  212. package/dist/orchestration/buffer-drain-runner.js.map +1 -0
  213. package/dist/orchestration/buffer-swap.d.ts +12 -0
  214. package/dist/orchestration/buffer-swap.d.ts.map +1 -0
  215. package/dist/orchestration/maintenance.js +26 -22
  216. package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
  217. package/dist/orchestrator.d.ts +4 -1
  218. package/dist/orchestrator.d.ts.map +1 -1
  219. package/dist/orchestrator.js +143 -140
  220. package/dist/qmd.js +4 -4
  221. package/dist/recall-navigation-operations.js +54 -51
  222. package/dist/recall-navigation.js +53 -50
  223. package/dist/recall-state-view-admission.js +5 -5
  224. package/dist/recall-why-service.js +5 -5
  225. package/dist/resume-bundles.js +25 -21
  226. package/dist/search/factory.js +6 -6
  227. package/dist/search/index.js +12 -12
  228. package/dist/semantic-consolidation.js +17 -13
  229. package/dist/semantic-rule-promotion.js +16 -12
  230. package/dist/semantic-rule-verifier.js +16 -12
  231. package/dist/source-agent-qualifier.js +19 -15
  232. package/dist/standup/build.js +16 -12
  233. package/dist/storage/buffer-drain-claims.d.ts +159 -0
  234. package/dist/storage/buffer-drain-claims.d.ts.map +1 -0
  235. package/dist/storage/buffer-drain-claims.js +18 -0
  236. package/dist/storage/buffer-drain-claims.js.map +1 -0
  237. package/dist/storage/buffer-session-files.d.ts +14 -2
  238. package/dist/storage/buffer-session-files.d.ts.map +1 -1
  239. package/dist/storage/buffer-session-files.js +22 -0
  240. package/dist/storage/buffer-session-files.js.map +1 -0
  241. package/dist/storage/entity-canonical-id-migration.d.ts.map +1 -1
  242. package/dist/storage/memory-read-store.d.ts +5 -9
  243. package/dist/storage/memory-read-store.d.ts.map +1 -1
  244. package/dist/storage.d.ts +6 -1
  245. package/dist/storage.d.ts.map +1 -1
  246. package/dist/storage.js +17 -13
  247. package/dist/support-passport/index.js +56 -53
  248. package/dist/transfer/backup.js +2 -2
  249. package/dist/transfer/capsule-export.js +2 -2
  250. package/dist/transfer/capsule-import.js +2 -2
  251. package/dist/transfer/export-okf.js +16 -12
  252. package/dist/verified-recall.js +16 -12
  253. package/dist/who-knows-cli.js +17 -13
  254. package/dist/who-knows.js +16 -12
  255. package/package.json +32 -2
  256. package/scripts/build-with-heap.mjs +8 -0
  257. package/src/buffer-drain-handover.test.ts +307 -0
  258. package/src/buffer-persistence.ts +27 -5
  259. package/src/buffer-turn-helpers.ts +16 -0
  260. package/src/buffer.ts +32 -2
  261. package/src/corpus-scan-worker-host.ts +314 -0
  262. package/src/corpus-scan-worker.entry.mjs +176 -0
  263. package/src/corpus-scan-worker.entry.ts +95 -0
  264. package/src/corpus-scan.ts +215 -0
  265. package/src/corpus-watermark.ts +28 -12
  266. package/src/index.ts +1 -1
  267. package/src/orchestration/buffer-drain-gate.test.ts +40 -0
  268. package/src/orchestration/buffer-drain-gate.ts +38 -0
  269. package/src/orchestration/buffer-drain-runner.ts +312 -0
  270. package/src/orchestration/buffer-swap.ts +27 -0
  271. package/src/orchestration/turn-ingestion.ts +2 -0
  272. package/src/orchestrator.ts +9 -6
  273. package/src/storage/buffer-drain-claims.test.ts +448 -0
  274. package/src/storage/buffer-drain-claims.ts +593 -0
  275. package/src/storage/buffer-session-files.ts +50 -3
  276. package/src/storage/entity-canonical-id-migration.ts +4 -26
  277. package/src/storage/memory-read-store.ts +17 -99
  278. package/src/storage.ts +8 -11
  279. package/src/testing/subjects/extraction-lifecycle.test.ts +34 -0
  280. package/dist/chunk-3E3Z6UA3.js.map +0 -1
  281. package/dist/chunk-4OFXLQJD.js.map +0 -1
  282. package/dist/chunk-5U2BBF7E.js.map +0 -1
  283. package/dist/chunk-G6A3SGCE.js.map +0 -1
  284. package/dist/chunk-KZMRMKC7.js.map +0 -1
  285. package/dist/chunk-WXBVGKS6.js.map +0 -1
  286. package/dist/chunk-YJHOVA42.js.map +0 -1
  287. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-GWVG7LGC.js.map} +0 -0
  288. /package/dist/{chunk-ZAZZOQAQ.js.map → chunk-23OEPU3K.js.map} +0 -0
  289. /package/dist/{chunk-XDKEHZUC.js.map → chunk-264B57GV.js.map} +0 -0
  290. /package/dist/{chunk-NRGQ5HJO.js.map → chunk-4P4VLPGB.js.map} +0 -0
  291. /package/dist/{chunk-GIRWNTMV.js.map → chunk-4PG5R6BJ.js.map} +0 -0
  292. /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
  293. /package/dist/{chunk-RG3I2663.js.map → chunk-64JLBFCQ.js.map} +0 -0
  294. /package/dist/{chunk-G3T6YMBO.js.map → chunk-64S6X4IU.js.map} +0 -0
  295. /package/dist/{chunk-WASVDS6G.js.map → chunk-6HTEPYOI.js.map} +0 -0
  296. /package/dist/{chunk-6AEKSOWV.js.map → chunk-6I6DFULH.js.map} +0 -0
  297. /package/dist/{chunk-DJR37Q37.js.map → chunk-6T4CMKNP.js.map} +0 -0
  298. /package/dist/{chunk-RHJ5VGB3.js.map → chunk-73A2DDDR.js.map} +0 -0
  299. /package/dist/{chunk-4B73TQQV.js.map → chunk-7AKPLEJV.js.map} +0 -0
  300. /package/dist/{chunk-UHH67NLU.js.map → chunk-7OKYO2UC.js.map} +0 -0
  301. /package/dist/{chunk-KAL5SXPP.js.map → chunk-7ULSP7AU.js.map} +0 -0
  302. /package/dist/{chunk-USNU3BEQ.js.map → chunk-A4FZLM6Q.js.map} +0 -0
  303. /package/dist/{chunk-VV73XT3A.js.map → chunk-BJLCV2P3.js.map} +0 -0
  304. /package/dist/{chunk-KQAFEZQX.js.map → chunk-BUKK5SWA.js.map} +0 -0
  305. /package/dist/{chunk-DJFULNXK.js.map → chunk-C2AYUXEF.js.map} +0 -0
  306. /package/dist/{chunk-QY24FSXT.js.map → chunk-D3BYJSHX.js.map} +0 -0
  307. /package/dist/{chunk-JZRQY7ZQ.js.map → chunk-D4WR56FR.js.map} +0 -0
  308. /package/dist/{chunk-FB4JQEFS.js.map → chunk-DP22K7IC.js.map} +0 -0
  309. /package/dist/{chunk-EJFOGYF3.js.map → chunk-DTQJ7BRN.js.map} +0 -0
  310. /package/dist/{chunk-MLUPSZFK.js.map → chunk-DZL5PBEJ.js.map} +0 -0
  311. /package/dist/{chunk-JD5F5MYN.js.map → chunk-EGCC5OJE.js.map} +0 -0
  312. /package/dist/{chunk-IQSRVR6Z.js.map → chunk-EJ4RS7I7.js.map} +0 -0
  313. /package/dist/{chunk-WBN66HPI.js.map → chunk-ELHJK7LM.js.map} +0 -0
  314. /package/dist/{chunk-EH46DHBU.js.map → chunk-ENAPZQA6.js.map} +0 -0
  315. /package/dist/{chunk-LLG5VNK7.js.map → chunk-F2UAAI6B.js.map} +0 -0
  316. /package/dist/{chunk-YZNTAOPZ.js.map → chunk-FKNNWH7P.js.map} +0 -0
  317. /package/dist/{chunk-AAANTXCQ.js.map → chunk-FZVZYU5C.js.map} +0 -0
  318. /package/dist/{chunk-ON77FQXH.js.map → chunk-G6GMZJQ4.js.map} +0 -0
  319. /package/dist/{chunk-OL7A7NKH.js.map → chunk-GNP4BV4Z.js.map} +0 -0
  320. /package/dist/{chunk-GDYLZ6FR.js.map → chunk-HJ3UTGIW.js.map} +0 -0
  321. /package/dist/{chunk-CCL2OXFO.js.map → chunk-HSHLDSPX.js.map} +0 -0
  322. /package/dist/{chunk-R4BR62UO.js.map → chunk-HWMGQDZI.js.map} +0 -0
  323. /package/dist/{chunk-BPIAXMGC.js.map → chunk-IIUEHIQ2.js.map} +0 -0
  324. /package/dist/{chunk-RTJJPW3C.js.map → chunk-ILMB3X4X.js.map} +0 -0
  325. /package/dist/{chunk-RFT4OPYI.js.map → chunk-IPN67KVR.js.map} +0 -0
  326. /package/dist/{chunk-IEW6NDHX.js.map → chunk-JGSWWD33.js.map} +0 -0
  327. /package/dist/{chunk-A3UFV4K3.js.map → chunk-JIYJIH5N.js.map} +0 -0
  328. /package/dist/{chunk-4G2A7MH3.js.map → chunk-JKUVPVKR.js.map} +0 -0
  329. /package/dist/{chunk-VCLNU6MY.js.map → chunk-L2HSSVVD.js.map} +0 -0
  330. /package/dist/{chunk-U2A56LLF.js.map → chunk-L334PSLW.js.map} +0 -0
  331. /package/dist/{chunk-HQUYENKK.js.map → chunk-LIUI46BX.js.map} +0 -0
  332. /package/dist/{chunk-ERMT5WQM.js.map → chunk-MKE5DP3S.js.map} +0 -0
  333. /package/dist/{chunk-6BO27AWQ.js.map → chunk-MPJ7VHHA.js.map} +0 -0
  334. /package/dist/{chunk-KMJDH4KX.js.map → chunk-NSUGAIIB.js.map} +0 -0
  335. /package/dist/{chunk-7NT3FKAF.js.map → chunk-NXHBQC2O.js.map} +0 -0
  336. /package/dist/{chunk-JEX2JL3U.js.map → chunk-OH55F76C.js.map} +0 -0
  337. /package/dist/{chunk-37VTMUAL.js.map → chunk-OUJ4DVR5.js.map} +0 -0
  338. /package/dist/{chunk-2NLLXCJG.js.map → chunk-OWHERGF2.js.map} +0 -0
  339. /package/dist/{chunk-2IVK5IDY.js.map → chunk-P5F7ISLV.js.map} +0 -0
  340. /package/dist/{chunk-PM4PKC3Y.js.map → chunk-PNVQNAJM.js.map} +0 -0
  341. /package/dist/{chunk-FXWX7VD3.js.map → chunk-PRYDNBCO.js.map} +0 -0
  342. /package/dist/{chunk-YDDLSGYE.js.map → chunk-PUTH5REB.js.map} +0 -0
  343. /package/dist/{chunk-GFAEKSFR.js.map → chunk-QBK3IM6W.js.map} +0 -0
  344. /package/dist/{chunk-KRAMCBIW.js.map → chunk-QKXPOLQD.js.map} +0 -0
  345. /package/dist/{chunk-YDT3OEYF.js.map → chunk-R4ZHF4K2.js.map} +0 -0
  346. /package/dist/{chunk-ISNPYOXR.js.map → chunk-RBUR6USI.js.map} +0 -0
  347. /package/dist/{chunk-WZYAXOGO.js.map → chunk-RZSHIJYY.js.map} +0 -0
  348. /package/dist/{chunk-TYSD7UQO.js.map → chunk-SVTIWBSA.js.map} +0 -0
  349. /package/dist/{chunk-AMKIIRLL.js.map → chunk-TBFAQHQZ.js.map} +0 -0
  350. /package/dist/{chunk-ZE5N4JSY.js.map → chunk-TKCJI7WA.js.map} +0 -0
  351. /package/dist/{chunk-RYB553SS.js.map → chunk-TLOAAOT3.js.map} +0 -0
  352. /package/dist/{chunk-RKRX4C4H.js.map → chunk-TPKB7T6Z.js.map} +0 -0
  353. /package/dist/{chunk-JZCBMKR5.js.map → chunk-TUCEP2LS.js.map} +0 -0
  354. /package/dist/{chunk-OMWQO7H6.js.map → chunk-UEDC2VGP.js.map} +0 -0
  355. /package/dist/{chunk-X7Y7WX73.js.map → chunk-UVYI6VIX.js.map} +0 -0
  356. /package/dist/{chunk-JY2BGCYN.js.map → chunk-VCYH2XUY.js.map} +0 -0
  357. /package/dist/{chunk-NGH74LDV.js.map → chunk-WD2QH3JM.js.map} +0 -0
  358. /package/dist/{chunk-UGTYADB4.js.map → chunk-WWSJQ7MP.js.map} +0 -0
  359. /package/dist/{chunk-UQBOPCDK.js.map → chunk-X4PAATLA.js.map} +0 -0
  360. /package/dist/{chunk-KBOQQEVC.js.map → chunk-XAFSZ4DP.js.map} +0 -0
  361. /package/dist/{chunk-2S6JADBB.js.map → chunk-XICJL56Z.js.map} +0 -0
  362. /package/dist/{chunk-Y5KESB7T.js.map → chunk-XJDSZFBZ.js.map} +0 -0
  363. /package/dist/{chunk-24SIB3EW.js.map → chunk-XWE3EOWX.js.map} +0 -0
  364. /package/dist/{chunk-Y77FXULH.js.map → chunk-XWXBXBOX.js.map} +0 -0
  365. /package/dist/{chunk-VKQI47DJ.js.map → chunk-Y7427SL7.js.map} +0 -0
  366. /package/dist/{chunk-TEH5MDX5.js.map → chunk-YH7HJNWV.js.map} +0 -0
  367. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
  368. /package/dist/{chunk-2M36PR7R.js.map → chunk-Z2T5BPOZ.js.map} +0 -0
  369. /package/dist/{entity-canonical-id-migration-F3JVG6K6.js.map → corpus-scan-worker-host.js.map} +0 -0
  370. /package/dist/{graph-edge-decay-IU75NV42.js.map → corpus-scan.js.map} +0 -0
@@ -19,11 +19,14 @@ import {
19
19
  getFingerprint,
20
20
  migrateLegacyEntityCanonicalIds,
21
21
  validateRoots
22
- } from "./chunk-G6A3SGCE.js";
22
+ } from "./chunk-WVEEVYMH.js";
23
+ import {
24
+ BufferSessionFiles
25
+ } from "./chunk-JCL7RO2G.js";
23
26
  import {
24
27
  normalizeQmdResultPath,
25
28
  resolveNamespaceResultPath
26
- } from "./chunk-JEX2JL3U.js";
29
+ } from "./chunk-OH55F76C.js";
27
30
  import {
28
31
  withholdToolScopedFromSharedNamespace
29
32
  } from "./chunk-S2V7RUCL.js";
@@ -34,13 +37,13 @@ import {
34
37
  import {
35
38
  parseOfflineSyncDigestCache
36
39
  } from "./chunk-X3724WL4.js";
37
- import {
38
- createMemorySnapshot
39
- } from "./chunk-S2HLHAZ4.js";
40
40
  import {
41
41
  rewriteProjectedEntityReferences,
42
42
  rewriteProjectedMemoryEntityReference
43
43
  } from "./chunk-MRPOZBJC.js";
44
+ import {
45
+ createMemorySnapshot
46
+ } from "./chunk-S2HLHAZ4.js";
44
47
  import {
45
48
  rotateMarkdownFileToArchive
46
49
  } from "./chunk-DM2T26WE.js";
@@ -76,6 +79,9 @@ import {
76
79
  normalizeEntityStructuredSection,
77
80
  sortStructuredSectionsBySchema
78
81
  } from "./chunk-ZIKENA2C.js";
82
+ import {
83
+ normalizeEntityName
84
+ } from "./chunk-YXZG5TVN.js";
79
85
  import {
80
86
  OKF_QUESTION_TYPE,
81
87
  assertNotOkfReservedBasename,
@@ -88,15 +94,15 @@ import {
88
94
  normalizeProjectionPreview,
89
95
  normalizeProjectionTags
90
96
  } from "./chunk-SCU65EZI.js";
91
- import {
92
- normalizeEntityName
93
- } from "./chunk-YXZG5TVN.js";
94
97
  import {
95
98
  detectLanguageHint
96
99
  } from "./chunk-3WU7XOFN.js";
97
100
  import {
98
101
  checkCorpusReadAbort
99
102
  } from "./chunk-P4GUQSK3.js";
103
+ import {
104
+ corpusScanWorker
105
+ } from "./chunk-4LZ7SVKM.js";
100
106
  import {
101
107
  createVersion
102
108
  } from "./chunk-564YP3DW.js";
@@ -286,19 +292,19 @@ import {
286
292
 
287
293
  // src/storage.ts
288
294
  import {
289
- lstat as lstat5,
290
- readdir as readdir7,
295
+ lstat as lstat4,
296
+ readdir as readdir6,
291
297
  readFile,
292
- realpath as realpath3,
298
+ realpath as realpath2,
293
299
  stat as stat3,
294
300
  writeFile as writeFile2,
295
301
  mkdir as mkdir2,
296
- unlink as unlink5,
302
+ unlink as unlink4,
297
303
  appendFile,
298
304
  open
299
305
  } from "fs/promises";
300
306
  import { appendFileSync, createReadStream, mkdirSync, statSync as statSync2 } from "fs";
301
- import { createHash as createHash6 } from "crypto";
307
+ import { createHash as createHash5 } from "crypto";
302
308
 
303
309
  // src/preferences/drift-types.ts
304
310
  function serializeDriftProvenance(fm) {
@@ -322,7 +328,7 @@ function parseDriftProvenance(fm) {
322
328
  }
323
329
 
324
330
  // src/storage.ts
325
- import path16 from "path";
331
+ import path15 from "path";
326
332
 
327
333
  // src/storage/tombstone-migration-sources.ts
328
334
  import { statSync } from "fs";
@@ -384,7 +390,7 @@ function createTombstoneMigrationSourceContents(deps) {
384
390
  }
385
391
 
386
392
  // src/storage/memory-read-store.ts
387
- import { lstat, readdir, realpath, stat as stat2 } from "fs/promises";
393
+ import { readdir, stat as stat2 } from "fs/promises";
388
394
  import path3 from "path";
389
395
 
390
396
  // src/storage/memory-frontmatter-metadata.ts
@@ -452,10 +458,6 @@ function orderWindowMemories(memories, baseDir) {
452
458
  }
453
459
 
454
460
  // src/storage/memory-read-store.ts
455
- function isPropagatableReadError(err) {
456
- const code = err.code;
457
- return typeof code === "string" && code !== "ENOENT";
458
- }
459
461
  function isStoreEntityMarkdown(baseDir, filePath) {
460
462
  if (!filePath.endsWith(".md")) return false;
461
463
  const relative2 = path3.relative(baseDir, filePath);
@@ -562,67 +564,24 @@ var MemoryReadStore = class {
562
564
  * escape: a category dir symlinked outside memoryDir (e.g. decisions/ -> an
563
565
  * external dir) must NOT pull out-of-store files into a scan (info leak).
564
566
  *
565
- * Containment is established once, not per file: the memory root is resolved
566
- * with a single `realpath`, every directory the walk enters is `lstat`ed (a
567
- * symlinked or non-directory entry is never followed), and the entry TYPE
568
- * comes from `readdir(withFileTypes)` — so a symlinked entry, file or
569
- * directory, is skipped without a per-entry `realpath`. The old per-entry
570
- * `realpath` cost one syscall per markdown file (hundreds of thousands per
571
- * corpus scan) to re-derive a fact the directory-level checks already
572
- * establish; reads refuse symlinked files at open time with `O_NOFOLLOW`, so
573
- * a path swapped to a symlink mid-scan is refused rather than followed.
567
+ * The walk runs in the corpus-scan worker: it is one `readdir` + `lstat` per
568
+ * directory over the whole corpus, and on the main event loop that starves
569
+ * observe, recall and the extraction queue behind it. The implementation is
570
+ * shared (src/corpus-scan.ts) and the host runs it inline when no worker
571
+ * can start, so the collected path set is the same either way.
574
572
  * Paths only — no frontmatter parse.
575
573
  */
576
574
  async collectContainedMarkdownPaths(startDirs, propagateReadErrors = false, options) {
577
- const filePaths = [];
578
- try {
579
- await realpath(this.deps.baseDir);
580
- } catch (err) {
581
- if (propagateReadErrors && isPropagatableReadError(err)) throw err;
582
- return filePaths;
583
- }
584
- const collectPaths = async (dir) => {
585
- checkCorpusReadAbort(options);
586
- let dirStat;
587
- try {
588
- dirStat = await lstat(dir);
589
- } catch (err) {
590
- if (propagateReadErrors && isPropagatableReadError(err)) throw err;
591
- return;
592
- }
593
- if (dirStat.isSymbolicLink()) return;
594
- if (!dirStat.isDirectory()) {
595
- if (propagateReadErrors) {
596
- throw new Error(`corpus scan: expected a directory but found a non-directory at ${dir}`);
597
- }
598
- return;
599
- }
600
- let entries;
601
- try {
602
- entries = await readdir(dir, { withFileTypes: true });
603
- } catch (err) {
604
- if (propagateReadErrors && isPropagatableReadError(err)) throw err;
605
- return;
606
- }
607
- const subdirs = [];
608
- for (const entry of entries) {
609
- checkCorpusReadAbort(options);
610
- if (entry.isSymbolicLink()) continue;
611
- if (isMacOsReplicationJunkBasename(entry.name)) continue;
612
- const fullPath = path3.join(dir, entry.name);
613
- if (entry.isDirectory()) {
614
- subdirs.push(fullPath);
615
- } else if (entry.name.endsWith(".md")) {
616
- filePaths.push(fullPath);
617
- }
618
- }
619
- for (const subdir of subdirs) {
620
- await collectPaths(subdir);
621
- }
622
- };
623
- for (const dir of startDirs) {
624
- await collectPaths(dir);
625
- }
575
+ checkCorpusReadAbort(options);
576
+ const filePaths = await corpusScanWorker.request(
577
+ {
578
+ kind: "walk",
579
+ baseDir: this.deps.baseDir,
580
+ startDirs: [...startDirs],
581
+ propagateReadErrors
582
+ },
583
+ options?.abortSignal
584
+ );
626
585
  checkCorpusReadAbort(options);
627
586
  return filePaths;
628
587
  }
@@ -1772,7 +1731,7 @@ import { lstat as lstat3, readdir as readdir2, unlink } from "fs/promises";
1772
1731
  import path6 from "path";
1773
1732
 
1774
1733
  // src/storage/entity-migration-completion-cache.ts
1775
- import { lstat as lstat2, realpath as realpath2 } from "fs/promises";
1734
+ import { lstat as lstat2, realpath } from "fs/promises";
1776
1735
  import path5 from "path";
1777
1736
  async function isTrustedEntitiesRoot(baseDir, entitiesDir) {
1778
1737
  let rootStat;
@@ -1786,8 +1745,8 @@ async function isTrustedEntitiesRoot(baseDir, entitiesDir) {
1786
1745
  let memoryRoot;
1787
1746
  let entitiesReal;
1788
1747
  try {
1789
- memoryRoot = await realpath2(baseDir);
1790
- entitiesReal = await realpath2(entitiesDir);
1748
+ memoryRoot = await realpath(baseDir);
1749
+ entitiesReal = await realpath(entitiesDir);
1791
1750
  } catch (err) {
1792
1751
  if (isErrnoCode(err, "ENOENT")) return false;
1793
1752
  throw err;
@@ -3084,7 +3043,7 @@ var EntityCanonicalIdMigrationRunner = class {
3084
3043
  await this.ensure();
3085
3044
  return;
3086
3045
  }
3087
- const { readSafeEntityEntries } = await import("./entity-canonical-id-migration-F3JVG6K6.js");
3046
+ const { readSafeEntityEntries } = await import("./entity-canonical-id-migration-CUDCKWPF.js");
3088
3047
  await readSafeEntityEntries(entitiesDir);
3089
3048
  }
3090
3049
  /**
@@ -5001,209 +4960,13 @@ var MeetingRecordStore = class {
5001
4960
  };
5002
4961
  var SORT_STR = (a, b) => a < b ? -1 : a > b ? 1 : 0;
5003
4962
 
5004
- // src/storage/buffer-session-files.ts
5005
- import { createHash as createHash4 } from "crypto";
5006
- import { lstat as lstat4, readdir as readdir5, unlink as unlink4 } from "fs/promises";
5007
- import path13 from "path";
5008
- function isMissing(err) {
5009
- return err?.code === "ENOENT";
5010
- }
5011
- function asFsError(err) {
5012
- return err;
5013
- }
5014
- function bufferSessionFileName(key) {
5015
- return `s-${createHash4("sha256").update(key).digest("hex")}.json`;
5016
- }
5017
- function legacyStateToEntries(state) {
5018
- const entries = /* @__PURE__ */ new Map();
5019
- for (const [key, value] of Object.entries(state.entries ?? {})) {
5020
- if (value && Array.isArray(value.turns)) entries.set(key, value);
5021
- }
5022
- if (!entries.has("default")) {
5023
- entries.set("default", {
5024
- turns: Array.isArray(state.turns) ? state.turns : [],
5025
- lastExtractionAt: state.lastExtractionAt ?? null,
5026
- extractionCount: Number.isFinite(state.extractionCount) ? state.extractionCount : 0
5027
- });
5028
- }
5029
- return entries;
5030
- }
5031
- function entryFromBody(body) {
5032
- if (!body || !Array.isArray(body.turns) || (body.key?.length ?? 0) === 0) return null;
5033
- const entry = {
5034
- turns: body.turns,
5035
- lastExtractionAt: body.lastExtractionAt ?? null,
5036
- extractionCount: Number.isFinite(body.extractionCount) ? Number(body.extractionCount) : 0
5037
- };
5038
- if (Array.isArray(body.retainedTurns)) entry.retainedTurns = body.retainedTurns;
5039
- return { key: String(body.key), entry };
5040
- }
5041
- var BufferSessionFiles = class {
5042
- constructor(stateDir, io) {
5043
- this.stateDir = stateDir;
5044
- this.io = io;
5045
- }
5046
- stateDir;
5047
- io;
5048
- dirVerified = false;
5049
- get dir() {
5050
- return path13.join(this.stateDir, "buffer");
5051
- }
5052
- fileFor(key) {
5053
- return path13.join(this.dir, bufferSessionFileName(key));
5054
- }
5055
- /**
5056
- * Refuse a symlinked buffer directory: following it would send buffered
5057
- * conversation data (and deletions) outside the memory root. One lstat of
5058
- * one directory, cached after it passes, so the observe path pays nothing
5059
- * per write; the cache is dropped on any failure.
5060
- */
5061
- async assertDirSafe() {
5062
- if (this.dirVerified) return;
5063
- let stat4 = null;
5064
- try {
5065
- stat4 = await lstat4(this.dir);
5066
- } catch (err) {
5067
- if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
5068
- }
5069
- if (stat4 && (stat4.isSymbolicLink() || !stat4.isDirectory())) {
5070
- throw new Error(`buffer session directory must be a real directory, not a symlink or file: ${this.dir}`);
5071
- }
5072
- this.dirVerified = stat4 !== null;
5073
- }
5074
- /** Persist ONE session atomically. Compact JSON: machine-read state, and
5075
- * pretty-printing a large buffer costs CPU and bytes on every observe. */
5076
- async save(key, entry) {
5077
- await this.assertDirSafe();
5078
- await this.io.write(this.fileFor(key), JSON.stringify({ key, ...entry }));
5079
- }
5080
- /** Remove one session's file. Idempotent: an absent file is fine. */
5081
- async remove(key) {
5082
- await this.assertDirSafe();
5083
- try {
5084
- await unlink4(this.fileFor(key));
5085
- } catch (err) {
5086
- if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
5087
- }
5088
- }
5089
- async listFiles() {
5090
- await this.assertDirSafe();
5091
- try {
5092
- const dirents = await readdir5(this.dir, { withFileTypes: true });
5093
- return dirents.filter((d) => d.isFile() && d.name.endsWith(".json")).map((d) => d.name);
5094
- } catch (err) {
5095
- if (err instanceof Error && isMissing(asFsError(err))) return [];
5096
- throw err;
5097
- }
5098
- }
5099
- /** Read every per-session file. Corrupt files are skipped (and logged) so
5100
- * one bad file cannot nuke the other sessions' buffered turns. */
5101
- async readAll() {
5102
- const names = await this.listFiles();
5103
- const entries = /* @__PURE__ */ new Map();
5104
- for (const name of names) {
5105
- try {
5106
- const body = JSON.parse(await this.io.read(path13.join(this.dir, name)));
5107
- const parsed = entryFromBody(body);
5108
- if (!parsed) throw new Error("invalid buffer session file shape");
5109
- if (entries.has(parsed.key)) {
5110
- log.warn(`buffer: duplicate session file for key ${parsed.key} (${name}); keeping the first`);
5111
- continue;
5112
- }
5113
- entries.set(parsed.key, parsed.entry);
5114
- } catch (err) {
5115
- if (err instanceof SecureStoreLockedError || err instanceof SecureStoreDecryptError) throw err;
5116
- log.warn(`buffer: skipping unreadable per-session buffer file ${name}: ${err instanceof Error ? err.message : String(err)}`);
5117
- }
5118
- }
5119
- return { entries, fileCount: names.length };
5120
- }
5121
- /**
5122
- * Read the legacy single-file buffer.json for migration. Null when absent,
5123
- * or unreadable while session files exist (they are authoritative; a
5124
- * corrupt leftover must not block startup). With no session files a corrupt
5125
- * legacy file THROWS, preserving the old contract so callers can reset it.
5126
- */
5127
- async readLegacy(hasSessionFiles) {
5128
- let raw;
5129
- try {
5130
- raw = await this.io.read(path13.join(this.stateDir, "buffer.json"));
5131
- } catch (err) {
5132
- if (err instanceof SecureStoreLockedError) throw err;
5133
- if (err instanceof Error && isMissing(asFsError(err))) return null;
5134
- throw err;
5135
- }
5136
- try {
5137
- const legacy = JSON.parse(raw);
5138
- return legacy;
5139
- } catch (err) {
5140
- if (!hasSessionFiles) throw err;
5141
- log.warn(
5142
- `buffer: legacy buffer.json is unreadable but per-session buffer files exist; ignoring the legacy file (${err instanceof Error ? err.message : String(err)})`
5143
- );
5144
- return null;
5145
- }
5146
- }
5147
- /**
5148
- * Load the whole buffer, migrating a legacy buffer.json once. A per-session
5149
- * file that parsed wins over the legacy snapshot (a crash mid-migration
5150
- * leaves exactly that pair); legacy entries without a usable file are
5151
- * written out, then the legacy file is retired. Both steps are idempotent.
5152
- */
5153
- async load() {
5154
- const { entries, fileCount } = await this.readAll();
5155
- const legacy = await this.readLegacy(fileCount > 0);
5156
- if (legacy !== null) {
5157
- for (const [key, entry] of legacyStateToEntries(legacy)) {
5158
- if (entries.has(key)) continue;
5159
- entries.set(key, entry);
5160
- await this.save(key, entry);
5161
- }
5162
- try {
5163
- await unlink4(path13.join(this.stateDir, "buffer.json"));
5164
- } catch (err) {
5165
- if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
5166
- }
5167
- }
5168
- const out = /* @__PURE__ */ Object.create(null);
5169
- for (const [key, entry] of entries) out[key] = entry;
5170
- const def = entries.get("default");
5171
- return {
5172
- turns: def?.turns ?? [],
5173
- lastExtractionAt: def?.lastExtractionAt ?? null,
5174
- extractionCount: def?.extractionCount ?? 0,
5175
- entries: out
5176
- };
5177
- }
5178
- /**
5179
- * Reconcile the files with a WHOLE buffer state: write every entry, then
5180
- * delete files for keys no longer present. Writes first, deletes last: a
5181
- * crash leaves stale extra files (removed by the next reconcile) but never
5182
- * loses sessions the state says exist. Not on the observe hot path.
5183
- */
5184
- async reconcile(state) {
5185
- const entries = legacyStateToEntries(state);
5186
- const existing = await this.listFiles();
5187
- for (const [key, entry] of entries) await this.save(key, entry);
5188
- const live = new Set([...entries.keys()].map((key) => bufferSessionFileName(key)));
5189
- for (const name of existing) {
5190
- if (live.has(name)) continue;
5191
- try {
5192
- await unlink4(path13.join(this.dir, name));
5193
- } catch (err) {
5194
- if (!(err instanceof Error) || !isMissing(asFsError(err))) throw err;
5195
- }
5196
- }
5197
- }
5198
- };
5199
-
5200
4963
  // src/storage/supersession-audit.ts
5201
- import { readdir as readdir6 } from "fs/promises";
5202
- import path14 from "path";
4964
+ import { readdir as readdir5 } from "fs/promises";
4965
+ import path13 from "path";
5203
4966
  async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody, structuredAttributes) {
5204
4967
  let entries;
5205
4968
  try {
5206
- entries = await readdir6(lookup.correctionsDir, { withFileTypes: true });
4969
+ entries = await readdir5(lookup.correctionsDir, { withFileTypes: true });
5207
4970
  } catch (error) {
5208
4971
  if (isErrnoCode(error, "ENOENT")) return false;
5209
4972
  throw error;
@@ -5211,7 +4974,7 @@ async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody,
5211
4974
  for (const entry of entries) {
5212
4975
  if (isMacOsReplicationJunkBasename(entry.name)) continue;
5213
4976
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
5214
- const memory = await lookup.readMemoryByPath(path14.join(lookup.correctionsDir, entry.name));
4977
+ const memory = await lookup.readMemoryByPath(path13.join(lookup.correctionsDir, entry.name));
5215
4978
  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(
5216
4979
  ([key, value]) => memory.frontmatter.structuredAttributes?.[key] === value
5217
4980
  ))) {
@@ -5303,19 +5066,19 @@ Reason: ${reason}`;
5303
5066
  // src/storage/dropped-extraction-chunk.ts
5304
5067
  import { randomUUID as randomUUID2 } from "crypto";
5305
5068
  import { mkdir } from "fs/promises";
5306
- import path15 from "path";
5069
+ import path14 from "path";
5307
5070
  async function saveDroppedExtractionChunk(stateDir, writeSecureFile, bufferKey, reason, turns) {
5308
- const droppedDir = path15.join(stateDir, "dropped");
5071
+ const droppedDir = path14.join(stateDir, "dropped");
5309
5072
  await mkdir(droppedDir, { recursive: true });
5310
5073
  const safeKey = bufferKey.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 80) || "default";
5311
- const filePath = path15.join(droppedDir, `${Date.now()}-${randomUUID2().slice(0, 8)}-${safeKey}.json`);
5074
+ const filePath = path14.join(droppedDir, `${Date.now()}-${randomUUID2().slice(0, 8)}-${safeKey}.json`);
5312
5075
  const payload = { bufferKey, reason, droppedAt: (/* @__PURE__ */ new Date()).toISOString(), turns };
5313
5076
  await writeSecureFile(filePath, JSON.stringify(payload, null, 2));
5314
5077
  return filePath;
5315
5078
  }
5316
5079
 
5317
5080
  // src/storage/entity-timeline.ts
5318
- import { createHash as createHash5 } from "crypto";
5081
+ import { createHash as createHash4 } from "crypto";
5319
5082
  var ENTITY_TIMELINE_METADATA_MARKER = "remnic-meta-v1";
5320
5083
  function parseEntityTimelineBullet(bullet, fallbackTimestamp) {
5321
5084
  const trimmed = bullet.trim();
@@ -5757,7 +5520,7 @@ function fingerprintEntityStructuredFacts(entity) {
5757
5520
  (left, right) => left.key.localeCompare(right.key) || left.title.localeCompare(right.title) || left.facts.join("\n").localeCompare(right.facts.join("\n"))
5758
5521
  );
5759
5522
  if (normalizedSections.length === 0) return void 0;
5760
- return createHash5("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5523
+ return createHash4("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5761
5524
  }
5762
5525
  function isEntitySynthesisStale(entity) {
5763
5526
  const structuredFactCount = countEntityStructuredFacts(entity);
@@ -6314,17 +6077,17 @@ function inferEntityTypeFromContent(content) {
6314
6077
  }
6315
6078
  var KNOWN_ENTITY_FILENAME_PREFIXES = /* @__PURE__ */ new Set(["company", "other", "person", "place", "project", "tool", "topic"]);
6316
6079
  function inferEntityTypeFromFilename(pathRel) {
6317
- const basename = path16.basename(pathRel, ".md").toLowerCase();
6080
+ const basename = path15.basename(pathRel, ".md").toLowerCase();
6318
6081
  const separator = basename.indexOf("-");
6319
6082
  if (separator <= 0) return void 0;
6320
6083
  const candidate = basename.slice(0, separator);
6321
6084
  return KNOWN_ENTITY_FILENAME_PREFIXES.has(candidate) ? candidate : void 0;
6322
6085
  }
6323
6086
  function normalizeFrontmatterForPath(frontmatter, pathRel, content = "") {
6324
- const normalizedPath = pathRel.split(path16.sep).join("/");
6087
+ const normalizedPath = pathRel.split(path15.sep).join("/");
6325
6088
  let normalizedFrontmatter = frontmatter;
6326
6089
  if (normalizedPath === "entities" || normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/")) {
6327
- const basename = path16.basename(pathRel, ".md");
6090
+ const basename = path15.basename(pathRel, ".md");
6328
6091
  const inferredType = inferEntityTypeFromContent(content) || inferEntityTypeFromFilename(pathRel) || "entity";
6329
6092
  const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
6330
6093
  normalizedFrontmatter = {
@@ -6797,9 +6560,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6797
6560
  this.entitySchemas = entitySchemas;
6798
6561
  this.deletionRevisionStore = new DeletionRevisionStore({
6799
6562
  baseDir,
6800
- deletionRevisionMetadataPath: path16.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6801
- invalidationCommitMetadataPath: path16.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6802
- deletionRevisionLockPath: path16.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6563
+ deletionRevisionMetadataPath: path15.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6564
+ invalidationCommitMetadataPath: path15.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6565
+ deletionRevisionLockPath: path15.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6803
6566
  assertManagedStoragePath: (filePath, method) => this.assertManagedStoragePath(filePath, method)
6804
6567
  });
6805
6568
  this.casRevisions = new CasRevisionHost(baseDir);
@@ -6987,8 +6750,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6987
6750
  }
6988
6751
  /** Whether `filePath` resolves to `stateDir` itself or a path contained in it. */
6989
6752
  isStateFilePath(filePath) {
6990
- const rel = path16.relative(this.stateDir, path16.resolve(filePath));
6991
- return rel === "" || !rel.startsWith("..") && !path16.isAbsolute(rel);
6753
+ const rel = path15.relative(this.stateDir, path15.resolve(filePath));
6754
+ return rel === "" || !rel.startsWith("..") && !path15.isAbsolute(rel);
6992
6755
  }
6993
6756
  // ── Tombstone store (issue #1579) ───────────────────────────────────────
6994
6757
  // Instance-scoped (rule 11) + namespace-scoped (rule 42) tombstone index.
@@ -7103,8 +6866,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7103
6866
  * /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
7104
6867
  */
7105
6868
  isColdOrArchiveTierPath(p) {
7106
- const rel = path16.relative(this.baseDir, p);
7107
- return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path16.sep}`) || rel.startsWith(`archive${path16.sep}`);
6869
+ const rel = path15.relative(this.baseDir, p);
6870
+ return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path15.sep}`) || rel.startsWith(`archive${path15.sep}`);
7108
6871
  }
7109
6872
  /**
7110
6873
  * Mark the secure-store as required for this storage instance.
@@ -7191,7 +6954,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7191
6954
  void 0,
7192
6955
  this.baseDir
7193
6956
  );
7194
- const rel = path16.relative(this.baseDir, filePath).split(path16.sep).join("/");
6957
+ const rel = path15.relative(this.baseDir, filePath).split(path15.sep).join("/");
7195
6958
  return `${rel}:${version.versionId}`;
7196
6959
  } catch (err) {
7197
6960
  log.warn(
@@ -7236,10 +6999,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7236
6999
  _StorageManager.okfConformanceByDir.set(memoryDir, enabled !== false);
7237
7000
  }
7238
7001
  okfConformanceEnabled() {
7239
- for (let dir = this.baseDir; ; dir = path16.dirname(dir)) {
7002
+ for (let dir = this.baseDir; ; dir = path15.dirname(dir)) {
7240
7003
  const registered = _StorageManager.okfConformanceByDir.get(dir);
7241
7004
  if (registered !== void 0) return registered;
7242
- if (dir === path16.dirname(dir)) return true;
7005
+ if (dir === path15.dirname(dir)) return true;
7243
7006
  }
7244
7007
  }
7245
7008
  /**
@@ -7283,12 +7046,12 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7283
7046
  }
7284
7047
  identityFilePath(workspaceDir, namespace) {
7285
7048
  const rawNamespace = typeof namespace === "string" ? namespace.trim() : "";
7286
- if (!rawNamespace) return path16.join(workspaceDir, "IDENTITY.md");
7049
+ if (!rawNamespace) return path15.join(workspaceDir, "IDENTITY.md");
7287
7050
  const safeNamespace = rawNamespace.replace(/[^a-zA-Z0-9._-]/g, "-");
7288
- return path16.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
7051
+ return path15.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
7289
7052
  }
7290
7053
  versionFilePath(kind) {
7291
- return path16.join(this.stateDir, `.${kind}-version.log`);
7054
+ return path15.join(this.stateDir, `.${kind}-version.log`);
7292
7055
  }
7293
7056
  bumpSharedVersion(kind, fallbackMap) {
7294
7057
  const filePath = this.versionFilePath(kind);
@@ -7395,7 +7158,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7395
7158
  // memories.
7396
7159
  // -------------------------------------------------------------------------
7397
7160
  get wearablesDir() {
7398
- return path16.join(this.baseDir, WEARABLES_DIR_NAME);
7161
+ return path15.join(this.baseDir, WEARABLES_DIR_NAME);
7399
7162
  }
7400
7163
  /**
7401
7164
  * Resolve the on-disk path for a source/day transcript. Throws on
@@ -7411,7 +7174,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7411
7174
  if (!isValidTranscriptDate(date)) {
7412
7175
  throw new Error(`invalid wearable transcript date '${String(date)}' \u2014 expected YYYY-MM-DD`);
7413
7176
  }
7414
- return path16.join(this.wearablesDir, sourceId, `${date}.md`);
7177
+ return path15.join(this.wearablesDir, sourceId, `${date}.md`);
7415
7178
  }
7416
7179
  async writeWearableDayTranscript(sourceId, date, serialized) {
7417
7180
  const targetPath = this.wearableTranscriptPath(sourceId, date);
@@ -7437,10 +7200,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7437
7200
  return this._fusionStore = new FusionArtifactStore(this.wearablesDir, this.baseDir, {
7438
7201
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7439
7202
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7440
- readDir: (d) => readdir7(d),
7441
- deleteFile: (p) => unlink5(p),
7442
- realpath: (p) => realpath3(p),
7443
- lstat: (p) => lstat5(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7203
+ readDir: (d) => readdir6(d),
7204
+ deleteFile: (p) => unlink4(p),
7205
+ realpath: (p) => realpath2(p),
7206
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7444
7207
  });
7445
7208
  }
7446
7209
  _meetingRecordStore;
@@ -7455,10 +7218,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7455
7218
  return this._meetingRecordStore = new MeetingRecordStore(this.baseDir, {
7456
7219
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7457
7220
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7458
- readDir: (d) => readdir7(d),
7459
- deleteFile: (p) => unlink5(p),
7460
- realpath: (p) => realpath3(p),
7461
- lstat: (p) => lstat5(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7221
+ readDir: (d) => readdir6(d),
7222
+ deleteFile: (p) => unlink4(p),
7223
+ realpath: (p) => realpath2(p),
7224
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7462
7225
  });
7463
7226
  }
7464
7227
  /**
@@ -7525,25 +7288,25 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7525
7288
  });
7526
7289
  }
7527
7290
  get factsDir() {
7528
- return path16.join(this.baseDir, "facts");
7291
+ return path15.join(this.baseDir, "facts");
7529
7292
  }
7530
7293
  get correctionsDir() {
7531
- return path16.join(this.baseDir, "corrections");
7294
+ return path15.join(this.baseDir, "corrections");
7532
7295
  }
7533
7296
  get proceduresDir() {
7534
- return path16.join(this.baseDir, "procedures");
7297
+ return path15.join(this.baseDir, "procedures");
7535
7298
  }
7536
7299
  get reasoningTracesDir() {
7537
- return path16.join(this.baseDir, "reasoning-traces");
7300
+ return path15.join(this.baseDir, "reasoning-traces");
7538
7301
  }
7539
7302
  get entitiesDir() {
7540
- return path16.join(this.baseDir, "entities");
7303
+ return path15.join(this.baseDir, "entities");
7541
7304
  }
7542
7305
  resolveEntityFilePath(name) {
7543
7306
  if (typeof name !== "string") return null;
7544
- const filePath = path16.resolve(this.entitiesDir, `${name}.md`);
7545
- const relative2 = path16.relative(this.entitiesDir, filePath);
7546
- if (relative2 === "" || relative2.startsWith("..") || path16.isAbsolute(relative2)) {
7307
+ const filePath = path15.resolve(this.entitiesDir, `${name}.md`);
7308
+ const relative2 = path15.relative(this.entitiesDir, filePath);
7309
+ if (relative2 === "" || relative2.startsWith("..") || path15.isAbsolute(relative2)) {
7547
7310
  return null;
7548
7311
  }
7549
7312
  return filePath;
@@ -7554,7 +7317,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7554
7317
  async readDependencyPropagationQueueFile(filePath) {
7555
7318
  const target = await resolveSafeStoragePath(
7556
7319
  this.baseDir,
7557
- path16.relative(
7320
+ path15.relative(
7558
7321
  this.baseDir,
7559
7322
  this.assertManagedStoragePath(filePath, "storage.readDependencyPropagationQueueFile")
7560
7323
  )
@@ -7564,7 +7327,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7564
7327
  async writeDependencyPropagationQueueFile(filePath, content) {
7565
7328
  const target = await resolveSafeStoragePath(
7566
7329
  this.baseDir,
7567
- path16.relative(
7330
+ path15.relative(
7568
7331
  this.baseDir,
7569
7332
  this.assertManagedStoragePath(filePath, "storage.writeDependencyPropagationQueueFile")
7570
7333
  )
@@ -7579,10 +7342,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7579
7342
  });
7580
7343
  }
7581
7344
  assertManagedStoragePath(filePath, method) {
7582
- const resolved = path16.resolve(filePath);
7583
- const base = path16.resolve(this.baseDir);
7584
- const rel = path16.relative(base, resolved);
7585
- if (rel === "" || rel === ".." || rel.startsWith(`..${path16.sep}`) || path16.isAbsolute(rel)) {
7345
+ const resolved = path15.resolve(filePath);
7346
+ const base = path15.resolve(this.baseDir);
7347
+ const rel = path15.relative(base, resolved);
7348
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path15.sep}`) || path15.isAbsolute(rel)) {
7586
7349
  throw new Error(`${method}: file path escapes memory dir`);
7587
7350
  }
7588
7351
  return resolved;
@@ -7619,7 +7382,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7619
7382
  async digestOfflineSyncFile(filePath) {
7620
7383
  const target = this.assertManagedStoragePath(filePath, "storage.digestOfflineSyncFile");
7621
7384
  const st = await stat3(target);
7622
- const relPath = path16.relative(this.baseDir, target).split(path16.sep).join("/");
7385
+ const relPath = path15.relative(this.baseDir, target).split(path15.sep).join("/");
7623
7386
  const cache = await this.loadOfflineSyncDigestCache();
7624
7387
  const cached = cache.get(relPath);
7625
7388
  if (cached && cached.statBytes === st.size && cached.mtimeMs === st.mtimeMs && cached.ctimeMs === st.ctimeMs && !cached.encrypted) {
@@ -7633,11 +7396,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7633
7396
  if (encrypted) {
7634
7397
  const content = await readMaybeEncryptedFileBuffer(target, this._secureStoreKey, this.baseDir);
7635
7398
  digest = {
7636
- sha256: createHash6("sha256").update(content).digest("hex"),
7399
+ sha256: createHash5("sha256").update(content).digest("hex"),
7637
7400
  bytes: content.byteLength
7638
7401
  };
7639
7402
  } else {
7640
- const hash = createHash6("sha256");
7403
+ const hash = createHash5("sha256");
7641
7404
  let bytes = 0;
7642
7405
  for await (const rawChunk of createReadStream(target)) {
7643
7406
  const chunk = Buffer.isBuffer(rawChunk) ? rawChunk : Buffer.from(rawChunk);
@@ -7704,7 +7467,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7704
7467
  const cache = this.offlineSyncDigestCache;
7705
7468
  if (!cache) return;
7706
7469
  const entries = [...cache.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([entryPath, entry]) => ({ path: entryPath, ...entry }));
7707
- await mkdir2(path16.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7470
+ await mkdir2(path15.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7708
7471
  await writeFile2(this.offlineSyncDigestCachePath, `${JSON.stringify({ version: 1, entries })}
7709
7472
  `, "utf-8");
7710
7473
  }).catch((err) => {
@@ -7805,7 +7568,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7805
7568
  }
7806
7569
  async appendStorageSecureFileUnlocked(filePath, content) {
7807
7570
  const writeKey = this.resolveWriteKey();
7808
- await mkdir2(path16.dirname(filePath), { recursive: true });
7571
+ await mkdir2(path15.dirname(filePath), { recursive: true });
7809
7572
  if (writeKey === null) {
7810
7573
  try {
7811
7574
  if (await this.isEncryptedFileHeader(filePath)) {
@@ -7831,13 +7594,13 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7831
7594
  this.notifyCatalogWriteForPath(filePath);
7832
7595
  }
7833
7596
  get stateDir() {
7834
- return path16.join(this.baseDir, "state");
7597
+ return path15.join(this.baseDir, "state");
7835
7598
  }
7836
7599
  get offlineSyncDigestCachePath() {
7837
- return path16.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
7600
+ return path15.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
7838
7601
  }
7839
7602
  get entitySynthesisQueuePath() {
7840
- return path16.join(this.stateDir, "entity-synthesis-queue.json");
7603
+ return path15.join(this.stateDir, "entity-synthesis-queue.json");
7841
7604
  }
7842
7605
  // ── Tombstone store access (issue #1579) ─────────────────────────────────
7843
7606
  /**
@@ -7847,7 +7610,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7847
7610
  * helpers are injected into the store).
7848
7611
  */
7849
7612
  get tombstonesPath() {
7850
- return path16.join(this.stateDir, "tombstones.jsonl");
7613
+ return path15.join(this.stateDir, "tombstones.jsonl");
7851
7614
  }
7852
7615
  /**
7853
7616
  * Configure the tombstone invariant for this storage instance. Installed
@@ -8160,55 +7923,55 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8160
7923
  return legacyMatches.length > 0 ? [...new Set(legacyMatches.map((content) => ContentHashIndex.computeHash(content)))] : [persistedHash];
8161
7924
  }
8162
7925
  get questionsDir() {
8163
- return path16.join(this.baseDir, "questions");
7926
+ return path15.join(this.baseDir, "questions");
8164
7927
  }
8165
7928
  get artifactsDir() {
8166
- return path16.join(this.baseDir, "artifacts");
7929
+ return path15.join(this.baseDir, "artifacts");
8167
7930
  }
8168
7931
  get identityDir() {
8169
- return path16.join(this.baseDir, "identity");
7932
+ return path15.join(this.baseDir, "identity");
8170
7933
  }
8171
7934
  get identityAnchorPath() {
8172
- return path16.join(this.identityDir, "identity-anchor.md");
7935
+ return path15.join(this.identityDir, "identity-anchor.md");
8173
7936
  }
8174
7937
  get identityIncidentsDir() {
8175
- return path16.join(this.identityDir, "incidents");
7938
+ return path15.join(this.identityDir, "incidents");
8176
7939
  }
8177
7940
  get identityAuditsWeeklyDir() {
8178
- return path16.join(this.identityDir, "audits", "weekly");
7941
+ return path15.join(this.identityDir, "audits", "weekly");
8179
7942
  }
8180
7943
  get identityAuditsMonthlyDir() {
8181
- return path16.join(this.identityDir, "audits", "monthly");
7944
+ return path15.join(this.identityDir, "audits", "monthly");
8182
7945
  }
8183
7946
  get identityImprovementLoopsPath() {
8184
- return path16.join(this.identityDir, "improvement-loops.md");
7947
+ return path15.join(this.identityDir, "improvement-loops.md");
8185
7948
  }
8186
7949
  get identityReflectionsPath() {
8187
- return path16.join(this.identityDir, "reflections.md");
7950
+ return path15.join(this.identityDir, "reflections.md");
8188
7951
  }
8189
7952
  get profilePath() {
8190
- return path16.join(this.baseDir, "profile.md");
7953
+ return path15.join(this.baseDir, "profile.md");
8191
7954
  }
8192
7955
  get memoryActionsPath() {
8193
- return path16.join(this.stateDir, "memory-actions.jsonl");
7956
+ return path15.join(this.stateDir, "memory-actions.jsonl");
8194
7957
  }
8195
7958
  get memoryLifecycleLedgerPath() {
8196
- return path16.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
7959
+ return path15.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
8197
7960
  }
8198
7961
  get compressionGuidelinesPath() {
8199
- return path16.join(this.stateDir, "compression-guidelines.md");
7962
+ return path15.join(this.stateDir, "compression-guidelines.md");
8200
7963
  }
8201
7964
  get compressionGuidelineDraftPath() {
8202
- return path16.join(this.stateDir, "compression-guidelines.draft.md");
7965
+ return path15.join(this.stateDir, "compression-guidelines.draft.md");
8203
7966
  }
8204
7967
  get compressionGuidelineStatePath() {
8205
- return path16.join(this.stateDir, "compression-guideline-state.json");
7968
+ return path15.join(this.stateDir, "compression-guideline-state.json");
8206
7969
  }
8207
7970
  get compressionGuidelineDraftStatePath() {
8208
- return path16.join(this.stateDir, "compression-guideline-draft-state.json");
7971
+ return path15.join(this.stateDir, "compression-guideline-draft-state.json");
8209
7972
  }
8210
7973
  get behaviorSignalsPath() {
8211
- return path16.join(this.stateDir, "behavior-signals.jsonl");
7974
+ return path15.join(this.stateDir, "behavior-signals.jsonl");
8212
7975
  }
8213
7976
  /**
8214
7977
  * In-memory dedup key set for behavior-signals appends (issue #1909),
@@ -8240,7 +8003,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8240
8003
  * governance sweeps can treat it uniformly.
8241
8004
  */
8242
8005
  get bufferSurpriseLedgerPath() {
8243
- return path16.join(this.stateDir, "buffer-surprise-ledger.jsonl");
8006
+ return path15.join(this.stateDir, "buffer-surprise-ledger.jsonl");
8244
8007
  }
8245
8008
  /**
8246
8009
  * Entity alias table loaded from THIS store's config/aliases.json.
@@ -8303,7 +8066,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8303
8066
  this.loadAliasesSync();
8304
8067
  }
8305
8068
  loadAliasesSync() {
8306
- const aliasPath = path16.join(this.baseDir, "config", "aliases.json");
8069
+ const aliasPath = path15.join(this.baseDir, "config", "aliases.json");
8307
8070
  this.userAliases = {};
8308
8071
  const raw = readEntityAliasConfigSync(this.baseDir);
8309
8072
  if (raw === void 0) return;
@@ -8341,9 +8104,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8341
8104
  await mkdir2(this.baseDir, { recursive: true });
8342
8105
  await validateRoots(this.baseDir, this.entitiesDir, this.stateDir, this.archiveDir);
8343
8106
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
8344
- await mkdir2(path16.join(this.factsDir, today), { recursive: true });
8345
- await mkdir2(path16.join(this.proceduresDir, today), { recursive: true });
8346
- await mkdir2(path16.join(this.reasoningTracesDir, today), { recursive: true });
8107
+ await mkdir2(path15.join(this.factsDir, today), { recursive: true });
8108
+ await mkdir2(path15.join(this.proceduresDir, today), { recursive: true });
8109
+ await mkdir2(path15.join(this.reasoningTracesDir, today), { recursive: true });
8347
8110
  await mkdir2(this.correctionsDir, { recursive: true });
8348
8111
  await mkdir2(this.entitiesDir, { recursive: true });
8349
8112
  await mkdir2(this.stateDir, { recursive: true });
@@ -8353,7 +8116,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8353
8116
  await mkdir2(this.identityIncidentsDir, { recursive: true });
8354
8117
  await mkdir2(this.identityAuditsWeeklyDir, { recursive: true });
8355
8118
  await mkdir2(this.identityAuditsMonthlyDir, { recursive: true });
8356
- await mkdir2(path16.join(this.baseDir, "config"), { recursive: true });
8119
+ await mkdir2(path15.join(this.baseDir, "config"), { recursive: true });
8357
8120
  await this.entityCanonicalIdMigration.begin(options.waitForEntityMigration !== false, this.entitiesDir);
8358
8121
  if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
8359
8122
  this.bumpMemoryCorpusVersion();
@@ -8376,11 +8139,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8376
8139
  async resolveCategoryWritePath(category, id, today) {
8377
8140
  if (category === "correction") {
8378
8141
  await mkdir2(this.correctionsDir, { recursive: true });
8379
- return path16.join(this.correctionsDir, `${id}.md`);
8142
+ return path15.join(this.correctionsDir, `${id}.md`);
8380
8143
  }
8381
- const datedDir = path16.join(getCategoryDir(this.baseDir, category), today);
8144
+ const datedDir = path15.join(getCategoryDir(this.baseDir, category), today);
8382
8145
  await mkdir2(datedDir, { recursive: true });
8383
- return path16.join(datedDir, `${id}.md`);
8146
+ return path15.join(datedDir, `${id}.md`);
8384
8147
  }
8385
8148
  async findExistingTombstoneBlockedMemory(content, category, sourceConnector) {
8386
8149
  const identity = buildExplicitCaptureDedupKey(content, category, sourceConnector);
@@ -8551,7 +8314,7 @@ ${sanitized.text}
8551
8314
  }
8552
8315
  });
8553
8316
  } catch (err) {
8554
- await unlink5(filePath).catch(() => void 0);
8317
+ await unlink4(filePath).catch(() => void 0);
8555
8318
  this.invalidateAllMemoriesCache();
8556
8319
  await this.rebuildTombstoneBlockedCaptureAfterInvalidationForPath(filePath);
8557
8320
  throw err;
@@ -8759,7 +8522,7 @@ ${sanitized.text}
8759
8522
  await this.ensureDirectories();
8760
8523
  const now = /* @__PURE__ */ new Date();
8761
8524
  const day = now.toISOString().slice(0, 10);
8762
- const dir = path16.join(this.artifactsDir, day);
8525
+ const dir = path15.join(this.artifactsDir, day);
8763
8526
  await mkdir2(dir, { recursive: true });
8764
8527
  const id = `artifact-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
8765
8528
  const fm = {
@@ -8786,7 +8549,7 @@ ${sanitized.text}
8786
8549
  log.warn(`artifact content rejected for ${id}; violations=${sanitized.violations.join(", ")}`);
8787
8550
  return "";
8788
8551
  }
8789
- const filePath = path16.join(dir, `${id}.md`);
8552
+ const filePath = path15.join(dir, `${id}.md`);
8790
8553
  await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(this.withOkfType(fm))}
8791
8554
 
8792
8555
  ${sanitized.text}
@@ -9080,7 +8843,7 @@ ${sanitized.text}
9080
8843
  * per-process in-memory cache safe across process boundaries.
9081
8844
  */
9082
8845
  invalidateColdMemoriesCache() {
9083
- const coldRoot = path16.join(this.baseDir, "cold");
8846
+ const coldRoot = path15.join(this.baseDir, "cold");
9084
8847
  _StorageManager.coldMemoriesCache.delete(coldRoot);
9085
8848
  this.bumpColdWriteVersion();
9086
8849
  invalidateAllForDir(this.baseDir);
@@ -9198,7 +8961,7 @@ ${sanitized.text}
9198
8961
  const correctionPaths = [];
9199
8962
  const factPaths = [];
9200
8963
  for (const filePath of filePaths) {
9201
- if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path16.sep}`)) {
8964
+ if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path15.sep}`)) {
9202
8965
  correctionPaths.push(filePath);
9203
8966
  } else {
9204
8967
  factPaths.push(filePath);
@@ -9262,10 +9025,10 @@ ${sanitized.text}
9262
9025
  const root = this.archiveDir;
9263
9026
  const readDir = async (dir) => {
9264
9027
  try {
9265
- const entries = (await readdir7(dir, { withFileTypes: true })).filter((e) => !isMacOsReplicationJunkBasename(e.name));
9028
+ const entries = (await readdir6(dir, { withFileTypes: true })).filter((e) => !isMacOsReplicationJunkBasename(e.name));
9266
9029
  for (const entry of entries) {
9267
9030
  checkCorpusReadAbort(options);
9268
- const fullPath = path16.join(dir, entry.name);
9031
+ const fullPath = path15.join(dir, entry.name);
9269
9032
  if (entry.isDirectory()) {
9270
9033
  await readDir(fullPath);
9271
9034
  } else if (entry.name.endsWith(".md")) {
@@ -9305,7 +9068,7 @@ ${sanitized.text}
9305
9068
  return this.rememberMemorySnapshot(await this.memoryReadStore.readMemoryByPath(filePath));
9306
9069
  }
9307
9070
  resolveTierRootDir(tier) {
9308
- return tier === "cold" ? path16.join(this.baseDir, "cold") : this.baseDir;
9071
+ return tier === "cold" ? path15.join(this.baseDir, "cold") : this.baseDir;
9309
9072
  }
9310
9073
  resolveMemoryDateDir(memory) {
9311
9074
  const preferred = memory.frontmatter.created || memory.frontmatter.updated;
@@ -9320,13 +9083,13 @@ ${sanitized.text}
9320
9083
  buildTierMemoryPath(memory, tier) {
9321
9084
  const root = this.resolveTierRootDir(tier);
9322
9085
  if (this.isArtifactMemory(memory)) {
9323
- return path16.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9086
+ return path15.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9324
9087
  }
9325
9088
  if (memory.frontmatter.category === "correction") {
9326
- return path16.join(root, "corrections", `${memory.frontmatter.id}.md`);
9089
+ return path15.join(root, "corrections", `${memory.frontmatter.id}.md`);
9327
9090
  }
9328
9091
  const dir = categoryDirName(memory.frontmatter.category);
9329
- return path16.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9092
+ return path15.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9330
9093
  }
9331
9094
  async writeMemoryFileAtomic(targetPath, memory) {
9332
9095
  assertNotOkfReservedBasename(targetPath);
@@ -9358,7 +9121,7 @@ ${memory.content}
9358
9121
  });
9359
9122
  } catch (err) {
9360
9123
  if (priorDest === null) {
9361
- await unlink5(targetPath).catch(() => void 0);
9124
+ await unlink4(targetPath).catch(() => void 0);
9362
9125
  } else {
9363
9126
  await writeFile2(targetPath, priorDest).catch(() => void 0);
9364
9127
  }
@@ -9405,8 +9168,8 @@ ${memory.content}
9405
9168
  memory.frontmatter.entityRef = current.frontmatter.entityRef;
9406
9169
  }
9407
9170
  durable = true;
9408
- const sourcePath = path16.resolve(current.path);
9409
- const destPath = path16.resolve(targetPath);
9171
+ const sourcePath = path15.resolve(current.path);
9172
+ const destPath = path15.resolve(targetPath);
9410
9173
  if (sourcePath !== destPath) {
9411
9174
  await recordArchiveDelete2(this.baseDir, current.path, () => this.deleteManagedStorageFile(current.path));
9412
9175
  this.invalidateAllMemoriesCache();
@@ -9430,8 +9193,8 @@ ${memory.content}
9430
9193
  }
9431
9194
  async migrateMemoryToTier(memory, targetTier) {
9432
9195
  const targetPath = this.buildTierMemoryPath(memory, targetTier);
9433
- const sourcePath = path16.resolve(memory.path);
9434
- const destPath = path16.resolve(targetPath);
9196
+ const sourcePath = path15.resolve(memory.path);
9197
+ const destPath = path15.resolve(targetPath);
9435
9198
  if (sourcePath === destPath) {
9436
9199
  return { changed: false, targetPath };
9437
9200
  }
@@ -9441,7 +9204,7 @@ ${memory.content}
9441
9204
  return { changed, targetPath };
9442
9205
  }
9443
9206
  get archiveDir() {
9444
- return path16.join(this.baseDir, "archive");
9207
+ return path15.join(this.baseDir, "archive");
9445
9208
  }
9446
9209
  /**
9447
9210
  * Archive a memory by moving it from facts/ to archive/YYYY-MM-DD/.
@@ -9454,7 +9217,7 @@ ${memory.content}
9454
9217
  try {
9455
9218
  const now = lifecycle?.at ?? /* @__PURE__ */ new Date();
9456
9219
  const today = now.toISOString().slice(0, 10);
9457
- const destDir = path16.join(this.archiveDir, today);
9220
+ const destDir = path15.join(this.archiveDir, today);
9458
9221
  await mkdir2(destDir, { recursive: true });
9459
9222
  const refIdsAtWrite = this.currentHistoricalIds();
9460
9223
  const updatedFm = canonicalizeEntityRefOption(
@@ -9470,7 +9233,7 @@ ${memory.content}
9470
9233
 
9471
9234
  ${current.content}
9472
9235
  `;
9473
- const destPath = path16.join(destDir, path16.basename(current.path));
9236
+ const destPath = path15.join(destDir, path15.basename(current.path));
9474
9237
  const priorDest = await this.readStorageSecureFile(destPath).catch(() => null);
9475
9238
  await recordArchiveWrite(this.baseDir, destPath, () => this.writeStorageSecureFile(destPath, fileContent));
9476
9239
  if (typeof current.frontmatter.entityRef === "string") {
@@ -9484,22 +9247,12 @@ ${current.content}
9484
9247
  );
9485
9248
  } catch (err) {
9486
9249
  if (priorDest === null) {
9487
- await recordArchiveDelete2(
9488
- this.baseDir,
9489
- destPath,
9490
- () => unlink5(destPath).then(
9491
- () => true,
9492
- () => false
9493
- )
9494
- );
9250
+ await recordArchiveDelete2(this.baseDir, destPath, () => unlink4(destPath).then(() => true, () => false));
9495
9251
  } else {
9496
9252
  await recordArchiveDelete2(
9497
9253
  this.baseDir,
9498
9254
  destPath,
9499
- () => this.writeStorageSecureFile(destPath, priorDest).then(
9500
- () => true,
9501
- () => false
9502
- )
9255
+ () => this.writeStorageSecureFile(destPath, priorDest).then(() => true, () => false)
9503
9256
  );
9504
9257
  }
9505
9258
  throw err;
@@ -9704,7 +9457,7 @@ ${memory.content}
9704
9457
  `;
9705
9458
  await this.writeTombstoneBlockedFrontmatter(memory, fileContent, updated, async () => {
9706
9459
  this.invalidateAllMemoriesCache();
9707
- if (memory.path.includes(`${path16.sep}cold${path16.sep}`)) {
9460
+ if (memory.path.includes(`${path15.sep}cold${path15.sep}`)) {
9708
9461
  this.invalidateColdMemoriesCache();
9709
9462
  }
9710
9463
  });
@@ -9716,7 +9469,7 @@ ${memory.content}
9716
9469
  }
9717
9470
  if (mentionReentry && !entityMentionEpoch.neutral(memory.frontmatter, updated)) entityMentionEpoch.bump(this.baseDir);
9718
9471
  await this.patchHotMemoriesCache({ addedPath: memory.path });
9719
- if (memory.path.includes(`${path16.sep}cold${path16.sep}`)) {
9472
+ if (memory.path.includes(`${path15.sep}cold${path15.sep}`)) {
9720
9473
  this.invalidateColdMemoriesCache();
9721
9474
  }
9722
9475
  try {
@@ -9809,16 +9562,24 @@ ${memory.content}
9809
9562
  await this.bufferSessionFiles().reconcile(state);
9810
9563
  }
9811
9564
  async saveBufferSession(key, entry) {
9812
- await this.bufferSessionFiles().save(key, entry);
9565
+ return await this.bufferSessionFiles().save(key, entry);
9813
9566
  }
9814
9567
  async deleteBufferSession(key) {
9815
9568
  await this.bufferSessionFiles().remove(key);
9816
9569
  }
9570
+ /** Sync gate check for the extraction queue: is this session claimed by a buffer drain? */
9571
+ isBufferSessionClaimed(key) {
9572
+ return this.bufferSessionFiles().isClaimed(key);
9573
+ }
9574
+ /** The drain-claim store for this memory root (CLI drain + worker). */
9575
+ bufferDrainClaims() {
9576
+ return this.bufferSessionFiles().claims;
9577
+ }
9817
9578
  saveDroppedExtractionChunk(bufferKey, reason, turns) {
9818
9579
  return saveDroppedExtractionChunk(this.stateDir, (file, content) => this.writeStorageSecureFile(file, content), bufferKey, reason, turns);
9819
9580
  }
9820
9581
  async loadMeta() {
9821
- const metaPath = path16.join(this.stateDir, "meta.json");
9582
+ const metaPath = path15.join(this.stateDir, "meta.json");
9822
9583
  try {
9823
9584
  const raw = await this.readStorageSecureFile(metaPath);
9824
9585
  const parsed = JSON.parse(raw);
@@ -9851,7 +9612,7 @@ ${memory.content}
9851
9612
  }
9852
9613
  async saveMeta(state) {
9853
9614
  await this.ensureDirectories();
9854
- await this.writeStorageSecureFile(path16.join(this.stateDir, "meta.json"), JSON.stringify(state, null, 2));
9615
+ await this.writeStorageSecureFile(path15.join(this.stateDir, "meta.json"), JSON.stringify(state, null, 2));
9855
9616
  }
9856
9617
  async appendMemoryActionEvents(events) {
9857
9618
  if (events.length === 0) return 0;
@@ -9920,7 +9681,7 @@ ${memory.content}
9920
9681
  },
9921
9682
  (payload) => this.appendStorageSecureFile(target, payload),
9922
9683
  async () => {
9923
- await mkdir2(path16.dirname(target), { recursive: true });
9684
+ await mkdir2(path15.dirname(target), { recursive: true });
9924
9685
  }
9925
9686
  );
9926
9687
  }
@@ -10018,7 +9779,7 @@ ${memory.content}
10018
9779
  async appendReextractJobs(events) {
10019
9780
  if (events.length === 0) return 0;
10020
9781
  await this.ensureDirectories();
10021
- const filePath = path16.join(this.stateDir, "reextract-jobs.jsonl");
9782
+ const filePath = path15.join(this.stateDir, "reextract-jobs.jsonl");
10022
9783
  const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
10023
9784
  try {
10024
9785
  await this.appendStorageSecureFile(filePath, lines);
@@ -10031,7 +9792,7 @@ ${memory.content}
10031
9792
  }
10032
9793
  async readReextractJobs(limit = 200) {
10033
9794
  const safeLimit = Number.isFinite(limit) ? Math.max(1, Math.min(1e3, Math.floor(limit))) : 200;
10034
- const filePath = path16.join(this.stateDir, "reextract-jobs.jsonl");
9795
+ const filePath = path15.join(this.stateDir, "reextract-jobs.jsonl");
10035
9796
  try {
10036
9797
  const raw = await this.readStorageSecureFile(filePath);
10037
9798
  const lines = raw.split("\n").filter((line) => line.trim().length > 0);
@@ -10187,7 +9948,7 @@ ${memory.content}
10187
9948
  return false;
10188
9949
  }
10189
9950
  if (draftState.contentHash) {
10190
- const contentHash = createHash6("sha256").update(draftContent).digest("hex");
9951
+ const contentHash = createHash5("sha256").update(draftContent).digest("hex");
10191
9952
  if (contentHash !== draftState.contentHash) return false;
10192
9953
  }
10193
9954
  await this.writeCompressionGuidelines(draftContent);
@@ -10196,8 +9957,8 @@ ${memory.content}
10196
9957
  activationState: "active"
10197
9958
  });
10198
9959
  await Promise.all([
10199
- unlink5(this.compressionGuidelineDraftPath).catch(() => void 0),
10200
- unlink5(this.compressionGuidelineDraftStatePath).catch(() => void 0)
9960
+ unlink4(this.compressionGuidelineDraftPath).catch(() => void 0),
9961
+ unlink4(this.compressionGuidelineDraftStatePath).catch(() => void 0)
10201
9962
  ]);
10202
9963
  return true;
10203
9964
  }
@@ -10266,7 +10027,7 @@ ${question}
10266
10027
 
10267
10028
  **Context:** ${context}
10268
10029
  `;
10269
- const filePath = path16.join(this.questionsDir, `${id}.md`);
10030
+ const filePath = path15.join(this.questionsDir, `${id}.md`);
10270
10031
  await this.writeStorageSecureFile(filePath, content);
10271
10032
  log.debug(`wrote question ${id} to ${filePath}`);
10272
10033
  this.invalidateQuestionsCache();
@@ -10325,11 +10086,11 @@ ${question}
10325
10086
  } catch {
10326
10087
  }
10327
10088
  const hygiene = opts?.hygiene;
10328
- const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path16.basename(identityPath));
10089
+ const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path15.basename(identityPath));
10329
10090
  if (rotateEnabled) {
10330
10091
  const maxBytes = hygiene.rotateMaxBytes;
10331
10092
  if (existing.length > maxBytes) {
10332
- const archiveDir = path16.join(workspaceDir, hygiene.archiveDir);
10093
+ const archiveDir = path15.join(workspaceDir, hygiene.archiveDir);
10333
10094
  const { newContent } = await rotateMarkdownFileToArchive({
10334
10095
  filePath: identityPath,
10335
10096
  archiveDir,
@@ -10589,7 +10350,7 @@ ${reflection}
10589
10350
  if (entries.length === 0) return 0;
10590
10351
  const memories = await this.readAllMemories();
10591
10352
  const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
10592
- const memoryPathMap = new Map(memories.map((m) => [path16.resolve(m.path), m]));
10353
+ const memoryPathMap = new Map(memories.map((m) => [path15.resolve(m.path), m]));
10593
10354
  let updated = 0;
10594
10355
  const prevVersion = this.getMemoryCorpusVersion();
10595
10356
  let entityRefMoved = false;
@@ -10597,7 +10358,7 @@ ${reflection}
10597
10358
  const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
10598
10359
  const appliedPatches = /* @__PURE__ */ new Map();
10599
10360
  for (const entry of entries) {
10600
- const memory = entry.memoryPath ? memoryPathMap.get(path16.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10361
+ const memory = entry.memoryPath ? memoryPathMap.get(path15.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10601
10362
  if (!memory) continue;
10602
10363
  try {
10603
10364
  const applied = await this.withTombstoneBlockedMemoryPathLock(memory.path, async (current) => {
@@ -10629,7 +10390,7 @@ ${current.content}
10629
10390
  if (warm) {
10630
10391
  updateCacheOnWrite(this.baseDir, { ...applied.current, frontmatter: applied.newFm }, keyId);
10631
10392
  }
10632
- appliedPatches.set(path16.resolve(memory.path), {
10393
+ appliedPatches.set(path15.resolve(memory.path), {
10633
10394
  accessCount: entry.newCount,
10634
10395
  lastAccessed: entry.lastAccessed
10635
10396
  });
@@ -10647,7 +10408,7 @@ ${current.content}
10647
10408
  const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
10648
10409
  if (cur) {
10649
10410
  const reapplied = cur.map((m) => {
10650
- const patch = appliedPatches.get(path16.resolve(m.path));
10411
+ const patch = appliedPatches.get(path15.resolve(m.path));
10651
10412
  return patch ? {
10652
10413
  ...m,
10653
10414
  frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed }
@@ -10677,7 +10438,7 @@ ${current.content}
10677
10438
  const pathsById = /* @__PURE__ */ new Map();
10678
10439
  const filePathsById = /* @__PURE__ */ new Map();
10679
10440
  for (const filePath of filePaths) {
10680
- const memoryId = path16.basename(filePath, ".md");
10441
+ const memoryId = path15.basename(filePath, ".md");
10681
10442
  if (!wantedIds.has(memoryId)) continue;
10682
10443
  const paths = filePathsById.get(memoryId) ?? [];
10683
10444
  paths.push(filePath);
@@ -10689,7 +10450,7 @@ ${current.content}
10689
10450
  const preferredMatches = [];
10690
10451
  for (const preferredPath of preferred) {
10691
10452
  const directCandidates = new Set(qmdResultPathCandidates(this.baseDir, preferredPath));
10692
- const directMatch = existingPaths.find((filePath) => directCandidates.has(path16.resolve(filePath)));
10453
+ const directMatch = existingPaths.find((filePath) => directCandidates.has(path15.resolve(filePath)));
10693
10454
  if (directMatch) {
10694
10455
  preferredMatches.push(directMatch);
10695
10456
  continue;
@@ -10701,7 +10462,7 @@ ${current.content}
10701
10462
  candidates.add(candidate);
10702
10463
  }
10703
10464
  }
10704
- const match = existingPaths.find((filePath) => candidates.has(path16.resolve(filePath)));
10465
+ const match = existingPaths.find((filePath) => candidates.has(path15.resolve(filePath)));
10705
10466
  if (match) preferredMatches.push(match);
10706
10467
  }
10707
10468
  if (preferredMatches.length > 0) {
@@ -10892,7 +10653,7 @@ ${sanitized.text}
10892
10653
  }
10893
10654
  if (!oldMemory) return false;
10894
10655
  const requireActiveAtWrite = options.requireActive === true || inferMemoryStatus(oldMemory.frontmatter, toMemoryPathRel(this.baseDir, oldMemory.path)) === "active";
10895
- const operationId = createHash6("sha256").update(
10656
+ const operationId = createHash5("sha256").update(
10896
10657
  JSON.stringify({
10897
10658
  oldMemoryId,
10898
10659
  newMemoryId,
@@ -11023,21 +10784,21 @@ ${current.content}
11023
10784
  }
11024
10785
  }
11025
10786
  get summariesDir() {
11026
- return path16.join(this.baseDir, "summaries");
10787
+ return path15.join(this.baseDir, "summaries");
11027
10788
  }
11028
10789
  async writeSummary(summary) {
11029
10790
  await mkdir2(this.summariesDir, { recursive: true });
11030
- const filePath = path16.join(this.summariesDir, `${summary.id}.json`);
10791
+ const filePath = path15.join(this.summariesDir, `${summary.id}.json`);
11031
10792
  await this.writeStorageSecureFile(filePath, JSON.stringify(summary, null, 2));
11032
10793
  log.debug(`wrote summary ${summary.id}`);
11033
10794
  }
11034
10795
  async readSummaries() {
11035
10796
  try {
11036
- const files = await readdir7(this.summariesDir);
10797
+ const files = await readdir6(this.summariesDir);
11037
10798
  const summaries = [];
11038
10799
  for (const file of files) {
11039
10800
  if (isMacOsReplicationJunkBasename(file) || !file.endsWith(".json")) continue;
11040
- const filePath = path16.join(this.summariesDir, file);
10801
+ const filePath = path15.join(this.summariesDir, file);
11041
10802
  const raw = await this.readStorageSecureFile(filePath);
11042
10803
  summaries.push(JSON.parse(raw));
11043
10804
  }
@@ -11107,13 +10868,13 @@ ${current.content}
11107
10868
  return archived;
11108
10869
  }
11109
10870
  async saveTopics(topics) {
11110
- const metaPath = path16.join(this.stateDir, "topics.json");
10871
+ const metaPath = path15.join(this.stateDir, "topics.json");
11111
10872
  await mkdir2(this.stateDir, { recursive: true });
11112
10873
  await this.writeStorageSecureFile(metaPath, JSON.stringify({ topics, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
11113
10874
  log.debug(`saved ${topics.length} topic scores`);
11114
10875
  }
11115
10876
  async loadTopics() {
11116
- const metaPath = path16.join(this.stateDir, "topics.json");
10877
+ const metaPath = path15.join(this.stateDir, "topics.json");
11117
10878
  try {
11118
10879
  const raw = await this.readStorageSecureFile(metaPath);
11119
10880
  return JSON.parse(raw);
@@ -11233,4 +10994,4 @@ export {
11233
10994
  isValidBufferSurpriseEvent,
11234
10995
  StorageManager3 as StorageManager
11235
10996
  };
11236
- //# sourceMappingURL=chunk-WXBVGKS6.js.map
10997
+ //# sourceMappingURL=chunk-N7RAABFM.js.map