@remnic/core 9.54.5 → 9.54.7

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 (548) hide show
  1. package/dist/access-admin-ops-surface.d.ts +24 -24
  2. package/dist/access-admin-ops-surface.js +32 -29
  3. package/dist/access-authorization-probe.d.ts +25 -23
  4. package/dist/access-authorization-probe.js +35 -30
  5. package/dist/access-boundary.d.ts +26 -24
  6. package/dist/access-boundary.js +36 -31
  7. package/dist/access-cli.js +86 -80
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +1 -1
  10. package/dist/access-extraction-force-flush.d.ts +19 -19
  11. package/dist/access-extraction-force-flush.js +32 -29
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-lcm-compaction.d.ts +22 -22
  14. package/dist/access-http-lifecycle-flush.d.ts +22 -22
  15. package/dist/access-http-offline-stream.d.ts +18 -18
  16. package/dist/access-http-query.js +32 -29
  17. package/dist/access-http.d.ts +55 -37
  18. package/dist/access-http.js +52 -43
  19. package/dist/access-identity-continuity-surface.d.ts +9 -9
  20. package/dist/access-identity-continuity-surface.js +32 -29
  21. package/dist/access-lcm-surface.d.ts +21 -21
  22. package/dist/access-lcm-surface.js +32 -29
  23. package/dist/access-mcp.d.ts +22 -22
  24. package/dist/access-mcp.js +40 -36
  25. package/dist/access-memory-search-fanout.d.ts +2 -2
  26. package/dist/{access-namespace-preflight-BdHlGd_T.d.ts → access-namespace-preflight-CCNn_6NE.d.ts} +1 -1
  27. package/dist/access-namespace-preflight.d.ts +3 -3
  28. package/dist/access-namespace-preflight.js +32 -29
  29. package/dist/access-observe-write-surface.d.ts +22 -22
  30. package/dist/access-observe-write-surface.js +32 -29
  31. package/dist/access-offline-manifest.d.ts +9 -9
  32. package/dist/access-offline-manifest.js +2 -2
  33. package/dist/access-operations-batch.js +34 -31
  34. package/dist/access-operations.d.ts +23 -23
  35. package/dist/access-operations.js +38 -34
  36. package/dist/access-recall-concurrency.d.ts +21 -21
  37. package/dist/access-recall-concurrency.js +32 -29
  38. package/dist/access-recall-response.d.ts +19 -19
  39. package/dist/access-recall-response.js +32 -29
  40. package/dist/access-recall-surface.d.ts +19 -19
  41. package/dist/access-recall-surface.js +32 -29
  42. package/dist/access-schema.js +3 -3
  43. package/dist/{access-service-DL7X9hrg.d.ts → access-service-DK82xdNi.d.ts} +1314 -83
  44. package/dist/access-service-helpers.d.ts +22 -22
  45. package/dist/access-service.d.ts +31 -31
  46. package/dist/access-service.js +32 -29
  47. package/dist/access-surface-catalog.d.ts +22 -22
  48. package/dist/access-surface-catalog.js +209 -2
  49. package/dist/access-surface-catalog.js.map +1 -1
  50. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  51. package/dist/action-confidence.d.ts +1 -1
  52. package/dist/active-memory-bridge.d.ts +6 -5
  53. package/dist/active-memory-bridge.js +2 -2
  54. package/dist/active-recall.d.ts +1 -1
  55. package/dist/active-recall.js +2 -1
  56. package/dist/active-recall.js.map +1 -1
  57. package/dist/adapters/index.js +4 -4
  58. package/dist/adapters/registry.js +2 -2
  59. package/dist/admin-console/public/what-helps-me/app.js +1594 -0
  60. package/dist/admin-console/public/what-helps-me/index.html +339 -0
  61. package/dist/admin-console/public/what-helps-me/model.js +685 -0
  62. package/dist/admin-console/public/what-helps-me/what-helps-me.css +1296 -0
  63. package/dist/ambient-provenance.d.ts +1 -1
  64. package/dist/artifact-search.d.ts +1 -1
  65. package/dist/{auto-sync-TDHLZPVP.js → auto-sync-NR3GPCOA.js} +4 -4
  66. package/dist/behavior-learner.d.ts +1 -1
  67. package/dist/behavior-signals.d.ts +1 -1
  68. package/dist/bootstrap.d.ts +9 -9
  69. package/dist/briefing.d.ts +2 -2
  70. package/dist/briefing.js +14 -14
  71. package/dist/buffer-surprise-report.d.ts +1 -1
  72. package/dist/buffer-turn-helpers.d.ts +1 -1
  73. package/dist/buffer.d.ts +2 -2
  74. package/dist/buffer.js +2 -2
  75. package/dist/bulk-import/index.d.ts +3 -3
  76. package/dist/calibration.d.ts +1 -1
  77. package/dist/calibration.js +1 -1
  78. package/dist/capabilities.d.ts +1 -1
  79. package/dist/{catalog-B90is4d8.d.ts → catalog-DGFf8mD9.d.ts} +1 -1
  80. package/dist/causal-behavior.d.ts +1 -1
  81. package/dist/causal-consolidation.d.ts +1 -1
  82. package/dist/causal-consolidation.js +15 -15
  83. package/dist/causal-trajectory-graph.d.ts +1 -1
  84. package/dist/{chunk-CSY44OKU.js → chunk-26ZXBTYN.js} +4 -4
  85. package/dist/chunk-26ZXBTYN.js.map +1 -0
  86. package/dist/{chunk-LLJMAULE.js → chunk-2FKEIPIT.js} +5 -5
  87. package/dist/{chunk-AU7Q3LSC.js → chunk-2QSZNTDO.js} +4 -4
  88. package/dist/chunk-37DZZFFM.js +502 -0
  89. package/dist/chunk-37DZZFFM.js.map +1 -0
  90. package/dist/chunk-3HSRWJTC.js +9 -0
  91. package/dist/chunk-3HSRWJTC.js.map +1 -0
  92. package/dist/{chunk-TKFGFDPJ.js → chunk-3TIZPSJC.js} +4 -4
  93. package/dist/{chunk-B4T3FQMT.js → chunk-43SEBY2M.js} +1 -1
  94. package/dist/{chunk-LVKYLMSM.js → chunk-46SZBVDS.js} +2 -2
  95. package/dist/{chunk-YKZLOPTC.js → chunk-5FD7JMTX.js} +2 -2
  96. package/dist/{chunk-2PNXOQ4P.js → chunk-5NB726GV.js} +3 -7
  97. package/dist/chunk-5NB726GV.js.map +1 -0
  98. package/dist/chunk-62OKGIJA.js +39 -0
  99. package/dist/chunk-62OKGIJA.js.map +1 -0
  100. package/dist/{chunk-WM5LD6AT.js → chunk-6CYHUWCO.js} +2 -2
  101. package/dist/{chunk-BIF4SHMD.js → chunk-76JJSXK7.js} +1 -1
  102. package/dist/chunk-76JJSXK7.js.map +1 -0
  103. package/dist/{chunk-3SXLD5T3.js → chunk-7BD6O7ZV.js} +189 -4
  104. package/dist/chunk-7BD6O7ZV.js.map +1 -0
  105. package/dist/chunk-7TBXNYLO.js +346 -0
  106. package/dist/chunk-7TBXNYLO.js.map +1 -0
  107. package/dist/{chunk-YR65W7BV.js → chunk-BRR5EUTF.js} +3 -3
  108. package/dist/{chunk-JKW663ZN.js → chunk-CIAI24TQ.js} +2 -2
  109. package/dist/{chunk-3WGI7F4V.js → chunk-D3LBIUWV.js} +9219 -5233
  110. package/dist/chunk-D3LBIUWV.js.map +1 -0
  111. package/dist/{chunk-YDWPYDML.js → chunk-EKTP7MNS.js} +4 -4
  112. package/dist/{chunk-6LEIWWAF.js → chunk-F2JRDPON.js} +2 -2
  113. package/dist/{chunk-VYQ4URQB.js → chunk-FFRTNF3L.js} +2 -2
  114. package/dist/{chunk-TY6MKIWP.js → chunk-FONWBCVY.js} +3 -3
  115. package/dist/{chunk-XSV2YDCJ.js → chunk-FPLM2TKD.js} +2 -2
  116. package/dist/{chunk-VTU5IEKY.js → chunk-FTPONF6B.js} +2 -2
  117. package/dist/{chunk-6PZGKGAO.js → chunk-FWX7W5PM.js} +2 -2
  118. package/dist/{chunk-QPW3PAIH.js → chunk-G6DFSS6A.js} +2 -2
  119. package/dist/{chunk-2DD6ZHOM.js → chunk-GJ776BC2.js} +3 -3
  120. package/dist/{chunk-XKAR4RF6.js → chunk-GN3WRFJY.js} +6 -6
  121. package/dist/{chunk-RG426DJO.js → chunk-H7NAZ3UB.js} +2 -2
  122. package/dist/{chunk-BSXGTDVJ.js → chunk-HBUFQRIM.js} +2 -2
  123. package/dist/{chunk-FFEBSFVT.js → chunk-HGJ6NJ4E.js} +2 -2
  124. package/dist/{chunk-WB7JSQCP.js → chunk-HIEWDJ2O.js} +5 -2
  125. package/dist/{chunk-WB7JSQCP.js.map → chunk-HIEWDJ2O.js.map} +1 -1
  126. package/dist/{chunk-QTO6BMQZ.js → chunk-I3MSGFGD.js} +17 -6
  127. package/dist/chunk-I3MSGFGD.js.map +1 -0
  128. package/dist/{chunk-5JKUSBMX.js → chunk-IKP5OYQQ.js} +2 -2
  129. package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
  130. package/dist/{chunk-DBY26JJJ.js → chunk-IQ4NVWEF.js} +2 -2
  131. package/dist/{chunk-7Q7JWLQ4.js → chunk-JYG4OLWH.js} +2 -2
  132. package/dist/{chunk-3OTSVCPK.js → chunk-K26NWEOC.js} +4 -4
  133. package/dist/{chunk-WZWZRZ2V.js → chunk-K2UGPTYY.js} +484 -43
  134. package/dist/chunk-K2UGPTYY.js.map +1 -0
  135. package/dist/{chunk-L6CQ7WIW.js → chunk-KFBOPMF6.js} +11 -11
  136. package/dist/chunk-KFBOPMF6.js.map +1 -0
  137. package/dist/{chunk-HOIRB77A.js → chunk-L6Z5OAS4.js} +2 -2
  138. package/dist/{chunk-7RZJWZ46.js → chunk-LEPOP46W.js} +5 -5
  139. package/dist/{chunk-QQXWFDRD.js → chunk-M4YHAODQ.js} +270 -684
  140. package/dist/chunk-M4YHAODQ.js.map +1 -0
  141. package/dist/{chunk-NGT35IGQ.js → chunk-MIH3CJPN.js} +3 -3
  142. package/dist/{chunk-QPAQSG3F.js → chunk-MK5VEWCR.js} +2 -2
  143. package/dist/chunk-NISZQW72.js +140 -0
  144. package/dist/chunk-NISZQW72.js.map +1 -0
  145. package/dist/{chunk-L7RTUEDG.js → chunk-OCIP6YMD.js} +2 -2
  146. package/dist/{chunk-2INWPC6E.js → chunk-PG4QBPVG.js} +20 -10
  147. package/dist/chunk-PG4QBPVG.js.map +1 -0
  148. package/dist/{chunk-DDA55IVB.js → chunk-PT54WISF.js} +189 -55
  149. package/dist/chunk-PT54WISF.js.map +1 -0
  150. package/dist/{chunk-UWJNKGBA.js → chunk-QZLDRQ4I.js} +5 -5
  151. package/dist/{chunk-UYOXFFEY.js → chunk-RUNORG2P.js} +3 -3
  152. package/dist/{chunk-LC3FD4BV.js → chunk-RZQ6W2W4.js} +39 -39
  153. package/dist/{chunk-MRGJZ75M.js → chunk-SMNYAMJD.js} +3 -3
  154. package/dist/{chunk-MKQBXQKU.js → chunk-TB6CBZ5V.js} +22 -15
  155. package/dist/chunk-TB6CBZ5V.js.map +1 -0
  156. package/dist/{chunk-DN2IDKI5.js → chunk-TO7ZTWJW.js} +2 -2
  157. package/dist/{chunk-K2TDK7GG.js → chunk-TWTUGCTY.js} +2 -2
  158. package/dist/{chunk-CUTFSLSD.js → chunk-UCTS3DDH.js} +2 -2
  159. package/dist/{chunk-JYIJNNN3.js → chunk-UG6VXIOK.js} +2 -2
  160. package/dist/{chunk-QOQQMVR2.js → chunk-UKYS3NU5.js} +2 -2
  161. package/dist/{chunk-VZRFGJCH.js → chunk-UPLZNJKN.js} +2 -2
  162. package/dist/{chunk-C23BYTJV.js → chunk-UW5NPZJ2.js} +40 -12
  163. package/dist/chunk-UW5NPZJ2.js.map +1 -0
  164. package/dist/{chunk-DOOWFDWN.js → chunk-V6ERBR7U.js} +2 -2
  165. package/dist/{chunk-7HG7MGAP.js → chunk-W5ZKPI34.js} +462 -2673
  166. package/dist/chunk-W5ZKPI34.js.map +1 -0
  167. package/dist/{chunk-HNDIND7P.js → chunk-XX4HPFFM.js} +54 -15
  168. package/dist/chunk-XX4HPFFM.js.map +1 -0
  169. package/dist/{chunk-N7CXQ5TA.js → chunk-XZHE2DEN.js} +1 -1
  170. package/dist/chunk-YXQEKCZM.js +223 -0
  171. package/dist/chunk-YXQEKCZM.js.map +1 -0
  172. package/dist/{chunk-6NNNURLK.js → chunk-Z54EM5YZ.js} +4 -4
  173. package/dist/{chunk-F2Y6I74C.js → chunk-ZRZVLB7O.js} +2 -2
  174. package/dist/{chunk-CLKBV3Z3.js → chunk-ZUKIUXHQ.js} +9 -9
  175. package/dist/{cli-jfuZXixq.d.ts → cli-BPDUXnAl.d.ts} +5 -5
  176. package/dist/cli.d.ts +22 -22
  177. package/dist/cli.js +66 -58
  178. package/dist/coding/pre-action-gate.d.ts +1 -1
  179. package/dist/compounding/engine.d.ts +2 -2
  180. package/dist/compounding/engine.js +14 -14
  181. package/dist/compounding/preference-consolidator.d.ts +1 -1
  182. package/dist/compression-optimizer.d.ts +1 -1
  183. package/dist/config.d.ts +1 -1
  184. package/dist/config.js +2 -1
  185. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  186. package/dist/connectors/codex-materialize-runner.js +14 -14
  187. package/dist/connectors/codex-materialize.d.ts +1 -1
  188. package/dist/connectors/index.d.ts +1 -1
  189. package/dist/connectors/index.js +14 -14
  190. package/dist/consolidation-provenance-check.d.ts +2 -2
  191. package/dist/consolidation-undo.d.ts +2 -2
  192. package/dist/contradiction/index.d.ts +2 -2
  193. package/dist/contradiction/index.js +2 -2
  194. package/dist/{contradiction-scan-KCADHXPE.js → contradiction-scan-JDTBXRGW.js} +3 -3
  195. package/dist/converge-config.d.ts +1 -1
  196. package/dist/convergence-refresh.d.ts +2 -2
  197. package/dist/convergence-refresh.js +16 -16
  198. package/dist/conversation-index/backend.d.ts +1 -1
  199. package/dist/conversation-index/backend.js +2 -2
  200. package/dist/conversation-index/chunker.d.ts +1 -1
  201. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  202. package/dist/conversation-index/indexer.d.ts +1 -1
  203. package/dist/conversation-index/search.d.ts +1 -1
  204. package/dist/corpus-watermark.d.ts +1 -1
  205. package/dist/corpus-watermark.js +16 -16
  206. package/dist/day-summary.d.ts +1 -1
  207. package/dist/delinearize.d.ts +1 -1
  208. package/dist/dependency-propagation-config.d.ts +1 -1
  209. package/dist/{dependency-propagation-delivery-CTDuAVJc.d.ts → dependency-propagation-delivery-CzEfB31P.d.ts} +1 -1
  210. package/dist/direct-answer-wiring.d.ts +1 -1
  211. package/dist/direct-answer.d.ts +1 -1
  212. package/dist/embedding-fallback.d.ts +1 -1
  213. package/dist/enrichment/index.d.ts +1 -1
  214. package/dist/entity-retrieval.d.ts +2 -2
  215. package/dist/entity-retrieval.js +14 -14
  216. package/dist/entity-schema.d.ts +1 -1
  217. package/dist/explicit-capture.d.ts +9 -9
  218. package/dist/explicit-capture.js +4 -3
  219. package/dist/external-wiki-access.d.ts +22 -22
  220. package/dist/external-wiki-access.js +33 -30
  221. package/dist/external-wiki-collection-registration.d.ts +1 -1
  222. package/dist/external-wiki-collection.d.ts +1 -1
  223. package/dist/external-wiki-mcp-tools.d.ts +22 -22
  224. package/dist/extraction-error-classification.d.ts +1 -1
  225. package/dist/extraction-faithfulness.d.ts +1 -1
  226. package/dist/extraction-faithfulness.js +2 -2
  227. package/dist/extraction-judge-telemetry.d.ts +1 -1
  228. package/dist/extraction-judge-training.d.ts +1 -1
  229. package/dist/extraction-judge.d.ts +1 -1
  230. package/dist/extraction-judge.js +2 -2
  231. package/dist/extraction-liveness.d.ts +1 -1
  232. package/dist/extraction-normalization.d.ts +1 -1
  233. package/dist/extraction-prompt.d.ts +1 -1
  234. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  235. package/dist/extraction-source-grounding.d.ts +1 -1
  236. package/dist/extraction.d.ts +1 -1
  237. package/dist/extraction.js +20 -20
  238. package/dist/fallback-llm.d.ts +14 -1
  239. package/dist/fallback-llm.js +1 -1
  240. package/dist/{first-start-migration-LMMZFLKK.js → first-start-migration-CRZCZAJN.js} +5 -5
  241. package/dist/graph-dashboard-diff.d.ts +1 -1
  242. package/dist/graph-dashboard-key.d.ts +1 -1
  243. package/dist/graph-dashboard-parser.d.ts +1 -1
  244. package/dist/graph-edge-reinforcement.d.ts +1 -1
  245. package/dist/graph-path-reconstruction.d.ts +1 -1
  246. package/dist/graph-path-scoring.d.ts +1 -1
  247. package/dist/graph-snapshot.d.ts +1 -1
  248. package/dist/graph.d.ts +1 -1
  249. package/dist/harmonic-retrieval.js +1 -1
  250. package/dist/importance.d.ts +1 -1
  251. package/dist/importers/index.d.ts +1 -1
  252. package/dist/in-flight-reads.d.ts +1 -1
  253. package/dist/index.d.ts +30 -747
  254. package/dist/index.js +203 -118
  255. package/dist/inline-script.d.ts +3 -0
  256. package/dist/inline-script.js +8 -0
  257. package/dist/inline-script.js.map +1 -0
  258. package/dist/intent.d.ts +1 -1
  259. package/dist/lcm/engine.d.ts +1 -1
  260. package/dist/lcm/engine.js +2 -2
  261. package/dist/lcm/index.d.ts +1 -1
  262. package/dist/lcm/index.js +2 -2
  263. package/dist/lcm/tools.d.ts +1 -1
  264. package/dist/lifecycle.d.ts +1 -1
  265. package/dist/live-connectors-runner.d.ts +1 -1
  266. package/dist/local-llm.d.ts +2 -1
  267. package/dist/local-llm.js +2 -2
  268. package/dist/local-model-endpoint.d.ts +1 -1
  269. package/dist/maintenance/memory-governance.d.ts +1 -1
  270. package/dist/maintenance/memory-governance.js +14 -14
  271. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  272. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
  273. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  274. package/dist/maintenance/rebuild-memory-projection.js +15 -15
  275. package/dist/{maintenance-heMZSq7G.d.ts → maintenance-C8aRWfhq.d.ts} +3 -3
  276. package/dist/mcp-memory-inspector-app.d.ts +22 -22
  277. package/dist/mcp-read-only-tools.js +1 -1
  278. package/dist/memory-action-policy.d.ts +1 -1
  279. package/dist/memory-cache.d.ts +1 -1
  280. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  281. package/dist/memory-projection-store.d.ts +1 -1
  282. package/dist/memory-provenance.d.ts +1 -1
  283. package/dist/memory-snapshot.d.ts +1 -1
  284. package/dist/memory-worth-outcomes.d.ts +2 -2
  285. package/dist/models-json.d.ts +1 -1
  286. package/dist/namespaces/migrate.d.ts +3 -3
  287. package/dist/namespaces/migrate.js +15 -15
  288. package/dist/namespaces/principal.d.ts +1 -1
  289. package/dist/namespaces/search.d.ts +1 -1
  290. package/dist/namespaces/search.js +6 -6
  291. package/dist/namespaces/storage.d.ts +3 -3
  292. package/dist/namespaces/storage.js +14 -14
  293. package/dist/native-knowledge.d.ts +1 -1
  294. package/dist/offline-sync-impression-drain.d.ts +1 -1
  295. package/dist/operator-doctor-corpus.d.ts +1 -1
  296. package/dist/operator-doctor-corpus.js +17 -17
  297. package/dist/operator-doctor-replica.d.ts +1 -1
  298. package/dist/operator-toolkit.d.ts +3 -3
  299. package/dist/operator-toolkit.js +23 -22
  300. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  301. package/dist/orchestration/maintenance.d.ts +4 -4
  302. package/dist/orchestration/maintenance.js +19 -19
  303. package/dist/{orchestrator-BQQPsSjs.d.ts → orchestrator-D85CzDDY.d.ts} +8 -8
  304. package/dist/orchestrator.d.ts +9 -9
  305. package/dist/orchestrator.js +86 -80
  306. package/dist/patterns-cli.d.ts +1 -1
  307. package/dist/{pipeline-DFfmsnGk.d.ts → pipeline-DPcUifCO.d.ts} +1 -1
  308. package/dist/policy-runtime.d.ts +1 -1
  309. package/dist/proactive-contention.d.ts +1 -1
  310. package/dist/provenance.d.ts +1 -1
  311. package/dist/public-http-D3GBeII4.d.ts +25 -0
  312. package/dist/{qmd-BF5bcVRs.d.ts → qmd-dFCHp1r0.d.ts} +1 -1
  313. package/dist/qmd-preflight.d.ts +2 -2
  314. package/dist/qmd-recall-cache.d.ts +1 -1
  315. package/dist/qmd.d.ts +2 -2
  316. package/dist/recall-concurrency-config.d.ts +1 -1
  317. package/dist/recall-disclosure-escalation.d.ts +1 -1
  318. package/dist/recall-explain-renderer.d.ts +1 -1
  319. package/dist/recall-explain-renderer.js +3 -3
  320. package/dist/recall-memory-map.d.ts +1 -1
  321. package/dist/recall-planner-llm.d.ts +1 -1
  322. package/dist/recall-planner-llm.js +1 -1
  323. package/dist/recall-state.d.ts +1 -1
  324. package/dist/recall-tag-filter.d.ts +1 -1
  325. package/dist/recall-timings.d.ts +1 -1
  326. package/dist/recall-xray-cli.d.ts +1 -1
  327. package/dist/recall-xray-cli.js +4 -4
  328. package/dist/recall-xray-renderer.d.ts +1 -1
  329. package/dist/recall-xray-renderer.js +3 -3
  330. package/dist/recall-xray.d.ts +1 -1
  331. package/dist/recall-xray.js +2 -2
  332. package/dist/reconcile/cursor.d.ts +1 -1
  333. package/dist/reconcile/manifest.d.ts +1 -1
  334. package/dist/reconcile/plan.d.ts +1 -1
  335. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  336. package/dist/replay/normalizers/claude.d.ts +1 -1
  337. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  338. package/dist/replay/normalizers/shared.d.ts +1 -1
  339. package/dist/replay/runner.d.ts +1 -1
  340. package/dist/replay/types.d.ts +1 -1
  341. package/dist/replica-divergence.d.ts +1 -1
  342. package/dist/replica-peers-config.d.ts +1 -1
  343. package/dist/resolve-auth-token.d.ts +1 -1
  344. package/dist/resume-bundles.js +3 -2
  345. package/dist/retrieval-agents.d.ts +2 -2
  346. package/dist/retrieval-tiers.d.ts +1 -1
  347. package/dist/routing/engine.d.ts +1 -1
  348. package/dist/routing/store.d.ts +1 -1
  349. package/dist/salvage-envelope.d.ts +1 -1
  350. package/dist/{scope-profiles-CbUOsE_E.d.ts → scope-profiles-DICK7GtN.d.ts} +1 -1
  351. package/dist/search/embed-helper.d.ts +1 -1
  352. package/dist/search/factory.d.ts +1 -1
  353. package/dist/search/factory.js +5 -5
  354. package/dist/search/index.d.ts +1 -1
  355. package/dist/search/index.js +9 -9
  356. package/dist/search/lancedb-backend.d.ts +1 -1
  357. package/dist/search/meilisearch-backend.d.ts +1 -1
  358. package/dist/search/noop-backend.d.ts +1 -1
  359. package/dist/search/orama-backend.d.ts +1 -1
  360. package/dist/search/port.d.ts +1 -1
  361. package/dist/search/remote-backend.d.ts +1 -1
  362. package/dist/{semantic-consolidation-DAB3xdKM.d.ts → semantic-consolidation-BP7NAX0N.d.ts} +1 -1
  363. package/dist/semantic-consolidation.d.ts +2 -2
  364. package/dist/semantic-consolidation.js +15 -15
  365. package/dist/semantic-rule-promotion.js +14 -14
  366. package/dist/semantic-rule-verifier.d.ts +1 -1
  367. package/dist/semantic-rule-verifier.js +14 -14
  368. package/dist/{service-DGKg2O6r.d.ts → service-DT-pJyda.d.ts} +660 -660
  369. package/dist/session-observer-bands.d.ts +1 -1
  370. package/dist/session-observer-state.d.ts +1 -1
  371. package/dist/shared-context/manager.d.ts +1 -1
  372. package/dist/signal.d.ts +1 -1
  373. package/dist/source-agent-qualifier.d.ts +1 -1
  374. package/dist/source-agent-qualifier.js +16 -16
  375. package/dist/{storage-CC1jKcWg.d.ts → storage-qOnaJ1Lw.d.ts} +4 -1
  376. package/dist/storage.d.ts +2 -2
  377. package/dist/storage.js +13 -13
  378. package/dist/summarizer.d.ts +1 -1
  379. package/dist/summarizer.js +5 -5
  380. package/dist/summary-snapshot.d.ts +1 -1
  381. package/dist/support-passport/index.d.ts +518 -0
  382. package/dist/support-passport/index.js +357 -0
  383. package/dist/support-passport/index.js.map +1 -0
  384. package/dist/temporal-supersession.d.ts +2 -2
  385. package/dist/temporal-timeline-recall.d.ts +1 -1
  386. package/dist/temporal-validity.d.ts +1 -1
  387. package/dist/threading.d.ts +1 -1
  388. package/dist/tier-migration.d.ts +2 -2
  389. package/dist/tier-routing.d.ts +1 -1
  390. package/dist/tier-routing.js +2 -2
  391. package/dist/{tier-stats-JDN6HRNT.js → tier-stats-EXYSKSVN.js} +3 -3
  392. package/dist/topics.d.ts +1 -1
  393. package/dist/transcript.d.ts +1 -1
  394. package/dist/transfer/autodetect.js +1 -1
  395. package/dist/transfer/backup.js +1 -1
  396. package/dist/transfer/capsule-export.js +2 -2
  397. package/dist/transfer/types.d.ts +24 -24
  398. package/dist/trust-score-stage.d.ts +1 -1
  399. package/dist/trust-score.d.ts +1 -1
  400. package/dist/{types-BnQza1y8.d.ts → types-ed-SvS2t.d.ts} +7 -1
  401. package/dist/types.d.ts +1 -1
  402. package/dist/types.js +1 -1
  403. package/dist/utility-runtime.d.ts +1 -1
  404. package/dist/verified-recall.js +14 -14
  405. package/dist/write-envelope.d.ts +1 -1
  406. package/dist/write-rate-limiter.d.ts +11 -5
  407. package/dist/write-rate-limiter.js +1 -1
  408. package/package.json +12 -2
  409. package/scripts/build-with-heap.mjs +11 -1
  410. package/src/access-authorization-probe.ts +20 -2
  411. package/src/access-boundary.ts +32 -0
  412. package/src/access-http.test.ts +1940 -643
  413. package/src/access-http.ts +81 -74
  414. package/src/access-mcp.ts +3 -1
  415. package/src/access-operations.ts +2 -0
  416. package/src/access-service.ts +612 -845
  417. package/src/access-surface-catalog.test.ts +40 -10
  418. package/src/access-surface-catalog.ts +15 -0
  419. package/src/active-memory-bridge.ts +17 -19
  420. package/src/config.ts +18 -9
  421. package/src/fallback-llm.test.ts +54 -0
  422. package/src/fallback-llm.ts +54 -9
  423. package/src/inline-script.ts +6 -0
  424. package/src/local-llm-headers-timeout.test.ts +42 -0
  425. package/src/local-llm.ts +8 -8
  426. package/src/mcp-read-only-tools.ts +3 -0
  427. package/src/relay/mission-access.test.ts +11 -11
  428. package/src/relay/mission-ui.test.ts +3 -1
  429. package/src/storage/tombstone-blocked-capture-sync.ts +31 -0
  430. package/src/storage-contract/failure-semantics.test.ts +102 -0
  431. package/src/support-passport/access-http-base.ts +143 -0
  432. package/src/support-passport/access-http.ts +172 -0
  433. package/src/support-passport/access-operations.ts +272 -0
  434. package/src/support-passport/access-service-base.test.ts +193 -0
  435. package/src/support-passport/access-service-base.ts +176 -0
  436. package/src/support-passport/access-surface.test.ts +283 -0
  437. package/src/support-passport/access-surface.ts +286 -0
  438. package/src/support-passport/card-projection.test.ts +8 -0
  439. package/src/support-passport/card-projection.ts +77 -16
  440. package/src/support-passport/card-replacement.ts +126 -0
  441. package/src/support-passport/card-service-commit-forwarding.test.ts +160 -0
  442. package/src/support-passport/card-service.test.ts +533 -31
  443. package/src/support-passport/card-service.ts +506 -364
  444. package/src/support-passport/card-state.ts +158 -0
  445. package/src/support-passport/config-model-routing.test.ts +37 -0
  446. package/src/support-passport/config.test.ts +34 -0
  447. package/src/support-passport/config.ts +41 -0
  448. package/src/support-passport/contracts.test.ts +15 -2
  449. package/src/support-passport/contracts.ts +13 -0
  450. package/src/support-passport/errors.ts +6 -0
  451. package/src/support-passport/generated-batch.test.ts +185 -0
  452. package/src/support-passport/generated-batch.ts +338 -0
  453. package/src/support-passport/grant-contracts.ts +45 -1
  454. package/src/support-passport/grant-generated-batch-scope.test.ts +201 -0
  455. package/src/support-passport/grant-service-cache.test.ts +2 -2
  456. package/src/support-passport/grant-service-cancellation.test.ts +2 -0
  457. package/src/support-passport/grant-service-marker-cache.test.ts +62 -0
  458. package/src/support-passport/grant-service.test.ts +853 -239
  459. package/src/support-passport/grant-service.ts +206 -57
  460. package/src/support-passport/grant-store.ts +7 -3
  461. package/src/support-passport/index.ts +10 -0
  462. package/src/support-passport/mcp-tools.test.ts +222 -0
  463. package/src/support-passport/mcp-tools.ts +187 -0
  464. package/src/support-passport/model-adapter.test.ts +840 -0
  465. package/src/support-passport/model-adapter.ts +602 -0
  466. package/src/support-passport/model-audit-pinned-write.test.ts +59 -0
  467. package/src/support-passport/model-audit.ts +152 -0
  468. package/src/support-passport/model-bridge.test.ts +456 -0
  469. package/src/support-passport/model-bridge.ts +439 -0
  470. package/src/support-passport/model-contracts.ts +124 -0
  471. package/src/support-passport/model-service.test.ts +1731 -0
  472. package/src/support-passport/model-service.ts +399 -0
  473. package/src/support-passport/owner-http.test.ts +671 -0
  474. package/src/support-passport/owner-lock.ts +26 -9
  475. package/src/support-passport/private-file.test.ts +99 -0
  476. package/src/support-passport/private-file.ts +139 -12
  477. package/src/support-passport/public-http.test.ts +476 -0
  478. package/src/support-passport/public-http.ts +601 -0
  479. package/src/support-passport/ui.test.ts +181 -0
  480. package/src/types.ts +7 -0
  481. package/src/write-rate-limiter.test.ts +30 -6
  482. package/src/write-rate-limiter.ts +29 -18
  483. package/dist/chunk-2INWPC6E.js.map +0 -1
  484. package/dist/chunk-2PNXOQ4P.js.map +0 -1
  485. package/dist/chunk-3SXLD5T3.js.map +0 -1
  486. package/dist/chunk-3WGI7F4V.js.map +0 -1
  487. package/dist/chunk-7HG7MGAP.js.map +0 -1
  488. package/dist/chunk-BIF4SHMD.js.map +0 -1
  489. package/dist/chunk-C23BYTJV.js.map +0 -1
  490. package/dist/chunk-CSY44OKU.js.map +0 -1
  491. package/dist/chunk-DDA55IVB.js.map +0 -1
  492. package/dist/chunk-HNDIND7P.js.map +0 -1
  493. package/dist/chunk-L6CQ7WIW.js.map +0 -1
  494. package/dist/chunk-MKQBXQKU.js.map +0 -1
  495. package/dist/chunk-QQXWFDRD.js.map +0 -1
  496. package/dist/chunk-QTO6BMQZ.js.map +0 -1
  497. package/dist/chunk-WZWZRZ2V.js.map +0 -1
  498. /package/dist/{auto-sync-TDHLZPVP.js.map → auto-sync-NR3GPCOA.js.map} +0 -0
  499. /package/dist/{chunk-LLJMAULE.js.map → chunk-2FKEIPIT.js.map} +0 -0
  500. /package/dist/{chunk-AU7Q3LSC.js.map → chunk-2QSZNTDO.js.map} +0 -0
  501. /package/dist/{chunk-TKFGFDPJ.js.map → chunk-3TIZPSJC.js.map} +0 -0
  502. /package/dist/{chunk-B4T3FQMT.js.map → chunk-43SEBY2M.js.map} +0 -0
  503. /package/dist/{chunk-LVKYLMSM.js.map → chunk-46SZBVDS.js.map} +0 -0
  504. /package/dist/{chunk-YKZLOPTC.js.map → chunk-5FD7JMTX.js.map} +0 -0
  505. /package/dist/{chunk-WM5LD6AT.js.map → chunk-6CYHUWCO.js.map} +0 -0
  506. /package/dist/{chunk-YR65W7BV.js.map → chunk-BRR5EUTF.js.map} +0 -0
  507. /package/dist/{chunk-JKW663ZN.js.map → chunk-CIAI24TQ.js.map} +0 -0
  508. /package/dist/{chunk-YDWPYDML.js.map → chunk-EKTP7MNS.js.map} +0 -0
  509. /package/dist/{chunk-6LEIWWAF.js.map → chunk-F2JRDPON.js.map} +0 -0
  510. /package/dist/{chunk-VYQ4URQB.js.map → chunk-FFRTNF3L.js.map} +0 -0
  511. /package/dist/{chunk-TY6MKIWP.js.map → chunk-FONWBCVY.js.map} +0 -0
  512. /package/dist/{chunk-XSV2YDCJ.js.map → chunk-FPLM2TKD.js.map} +0 -0
  513. /package/dist/{chunk-VTU5IEKY.js.map → chunk-FTPONF6B.js.map} +0 -0
  514. /package/dist/{chunk-6PZGKGAO.js.map → chunk-FWX7W5PM.js.map} +0 -0
  515. /package/dist/{chunk-QPW3PAIH.js.map → chunk-G6DFSS6A.js.map} +0 -0
  516. /package/dist/{chunk-2DD6ZHOM.js.map → chunk-GJ776BC2.js.map} +0 -0
  517. /package/dist/{chunk-XKAR4RF6.js.map → chunk-GN3WRFJY.js.map} +0 -0
  518. /package/dist/{chunk-RG426DJO.js.map → chunk-H7NAZ3UB.js.map} +0 -0
  519. /package/dist/{chunk-BSXGTDVJ.js.map → chunk-HBUFQRIM.js.map} +0 -0
  520. /package/dist/{chunk-FFEBSFVT.js.map → chunk-HGJ6NJ4E.js.map} +0 -0
  521. /package/dist/{chunk-5JKUSBMX.js.map → chunk-IKP5OYQQ.js.map} +0 -0
  522. /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
  523. /package/dist/{chunk-DBY26JJJ.js.map → chunk-IQ4NVWEF.js.map} +0 -0
  524. /package/dist/{chunk-7Q7JWLQ4.js.map → chunk-JYG4OLWH.js.map} +0 -0
  525. /package/dist/{chunk-3OTSVCPK.js.map → chunk-K26NWEOC.js.map} +0 -0
  526. /package/dist/{chunk-HOIRB77A.js.map → chunk-L6Z5OAS4.js.map} +0 -0
  527. /package/dist/{chunk-7RZJWZ46.js.map → chunk-LEPOP46W.js.map} +0 -0
  528. /package/dist/{chunk-NGT35IGQ.js.map → chunk-MIH3CJPN.js.map} +0 -0
  529. /package/dist/{chunk-QPAQSG3F.js.map → chunk-MK5VEWCR.js.map} +0 -0
  530. /package/dist/{chunk-L7RTUEDG.js.map → chunk-OCIP6YMD.js.map} +0 -0
  531. /package/dist/{chunk-UWJNKGBA.js.map → chunk-QZLDRQ4I.js.map} +0 -0
  532. /package/dist/{chunk-UYOXFFEY.js.map → chunk-RUNORG2P.js.map} +0 -0
  533. /package/dist/{chunk-LC3FD4BV.js.map → chunk-RZQ6W2W4.js.map} +0 -0
  534. /package/dist/{chunk-MRGJZ75M.js.map → chunk-SMNYAMJD.js.map} +0 -0
  535. /package/dist/{chunk-DN2IDKI5.js.map → chunk-TO7ZTWJW.js.map} +0 -0
  536. /package/dist/{chunk-K2TDK7GG.js.map → chunk-TWTUGCTY.js.map} +0 -0
  537. /package/dist/{chunk-CUTFSLSD.js.map → chunk-UCTS3DDH.js.map} +0 -0
  538. /package/dist/{chunk-JYIJNNN3.js.map → chunk-UG6VXIOK.js.map} +0 -0
  539. /package/dist/{chunk-QOQQMVR2.js.map → chunk-UKYS3NU5.js.map} +0 -0
  540. /package/dist/{chunk-VZRFGJCH.js.map → chunk-UPLZNJKN.js.map} +0 -0
  541. /package/dist/{chunk-DOOWFDWN.js.map → chunk-V6ERBR7U.js.map} +0 -0
  542. /package/dist/{chunk-N7CXQ5TA.js.map → chunk-XZHE2DEN.js.map} +0 -0
  543. /package/dist/{chunk-6NNNURLK.js.map → chunk-Z54EM5YZ.js.map} +0 -0
  544. /package/dist/{chunk-F2Y6I74C.js.map → chunk-ZRZVLB7O.js.map} +0 -0
  545. /package/dist/{chunk-CLKBV3Z3.js.map → chunk-ZUKIUXHQ.js.map} +0 -0
  546. /package/dist/{contradiction-scan-KCADHXPE.js.map → contradiction-scan-JDTBXRGW.js.map} +0 -0
  547. /package/dist/{first-start-migration-LMMZFLKK.js.map → first-start-migration-CRZCZAJN.js.map} +0 -0
  548. /package/dist/{tier-stats-JDN6HRNT.js.map → tier-stats-EXYSKSVN.js.map} +0 -0
@@ -1,3 +1,9 @@
1
+ import {
2
+ TombstoneStore,
3
+ applyTombstoneResurrectionGate,
4
+ buildRetiredFactTombstoneInputs,
5
+ collectRetiredMemoriesForRebuild
6
+ } from "./chunk-MLPTFODV.js";
1
7
  import {
2
8
  WEARABLES_DIR_NAME,
3
9
  escapeSegmentText,
@@ -9,22 +15,16 @@ import {
9
15
  unescapeSegmentText,
10
16
  unescapeSpeakerLabel
11
17
  } from "./chunk-UHVXE24Y.js";
12
- import {
13
- TombstoneStore,
14
- applyTombstoneResurrectionGate,
15
- buildRetiredFactTombstoneInputs,
16
- collectRetiredMemoriesForRebuild
17
- } from "./chunk-MLPTFODV.js";
18
18
  import {
19
19
  normalizeQmdResultPath
20
- } from "./chunk-DN2IDKI5.js";
20
+ } from "./chunk-TO7ZTWJW.js";
21
21
  import {
22
22
  withholdToolScopedFromSharedNamespace
23
23
  } from "./chunk-S2V7RUCL.js";
24
24
  import {
25
25
  SPECULATIVE_TTL_DAYS,
26
26
  confidenceTier
27
- } from "./chunk-BIF4SHMD.js";
27
+ } from "./chunk-76JJSXK7.js";
28
28
  import {
29
29
  normalizeProjectionPreview,
30
30
  normalizeProjectionTags
@@ -51,15 +51,17 @@ import {
51
51
  import {
52
52
  parseFaithfulnessField,
53
53
  serializeFaithfulnessFields
54
- } from "./chunk-JYIJNNN3.js";
54
+ } from "./chunk-UG6VXIOK.js";
55
55
  import {
56
+ DeletionRevisionStore,
56
57
  TombstoneBlockedCaptureIndexHost,
57
58
  buildCapturePathLockIdentity,
58
59
  buildExplicitCaptureDedupKey,
60
+ invalidationCommitFingerprint,
59
61
  isQueuedReviewMemory,
60
62
  parseTombstoneBlockedOfflineSyncMemory,
61
63
  tombstoneBlocked
62
- } from "./chunk-WZWZRZ2V.js";
64
+ } from "./chunk-K2UGPTYY.js";
63
65
  import {
64
66
  composeMemoryEnvelope,
65
67
  isSealedMemoryEnvelope,
@@ -191,7 +193,7 @@ import {
191
193
  } from "./chunk-5FVVY2EB.js";
192
194
  import {
193
195
  isSupportPassportPrivateMemory
194
- } from "./chunk-HNDIND7P.js";
196
+ } from "./chunk-XX4HPFFM.js";
195
197
  import {
196
198
  namespaceIdentityFromToken
197
199
  } from "./chunk-EGGE52UU.js";
@@ -241,20 +243,20 @@ import {
241
243
 
242
244
  // src/storage.ts
243
245
  import {
244
- lstat as lstat4,
246
+ lstat as lstat3,
245
247
  readdir as readdir6,
246
- readFile as readFile3,
248
+ readFile as readFile2,
247
249
  realpath as realpath3,
248
250
  stat as stat2,
249
251
  writeFile as writeFile2,
250
- mkdir as mkdir2,
251
- unlink as unlink5,
252
+ mkdir,
253
+ unlink as unlink4,
252
254
  appendFile,
253
- open as open2
255
+ open
254
256
  } from "fs/promises";
255
257
  import { appendFileSync, createReadStream, mkdirSync, statSync } from "fs";
256
- import { createHash as createHash7 } from "crypto";
257
- import path11 from "path";
258
+ import { createHash as createHash6 } from "crypto";
259
+ import path10 from "path";
258
260
 
259
261
  // src/storage/memory-read-store.ts
260
262
  import { lstat, readdir, realpath, stat } from "fs/promises";
@@ -2087,425 +2089,9 @@ ${rows.join("\n")}
2087
2089
  }
2088
2090
  };
2089
2091
 
2090
- // src/storage/deletion-revision-store.ts
2091
- import { createHash, randomUUID } from "crypto";
2092
- import { lstat as lstat2, mkdir, open, readFile, rename, unlink as unlink2 } from "fs/promises";
2093
- import path3 from "path";
2094
- var DELETION_REVISION_MAX_MTIME_MS = 864e13;
2095
- var DELETION_REVISION_LOCK_STALE_MS = 6e4;
2096
- var DELETION_REVISION_LOCK_MAX_WAIT_MS = 12e4;
2097
- var INVALIDATION_COMMIT_MAX_TIMESTAMP_MS = 864e13;
2098
- var INVALIDATION_PROOF_QUARANTINE_MAX_IDS = 1024;
2099
- function canonicalizeInvalidationEvidence(value) {
2100
- if (Array.isArray(value)) return value.map((item) => canonicalizeInvalidationEvidence(item));
2101
- if (value && typeof value === "object") {
2102
- const result = {};
2103
- for (const key of Object.keys(value).sort()) {
2104
- result[key] = canonicalizeInvalidationEvidence(value[key]);
2105
- }
2106
- return result;
2107
- }
2108
- return value;
2109
- }
2110
- function invalidationCommitFingerprint(memory) {
2111
- const frontmatter = { ...memory.frontmatter };
2112
- delete frontmatter.accessCount;
2113
- delete frontmatter.lastAccessed;
2114
- return createHash("sha256").update(
2115
- JSON.stringify(
2116
- canonicalizeInvalidationEvidence({
2117
- content: memory.content,
2118
- frontmatter
2119
- })
2120
- )
2121
- ).digest("hex");
2122
- }
2123
- function isValidInvalidationCommitTimestamp(value) {
2124
- return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= INVALIDATION_COMMIT_MAX_TIMESTAMP_MS;
2125
- }
2126
- function isValidInvalidationCommitFingerprint(value) {
2127
- return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
2128
- }
2129
- function isValidMemoryId(value) {
2130
- return typeof value === "string" && value.length > 0 && !value.includes("\0");
2131
- }
2132
- function isValidDeletionRevisionPath(value) {
2133
- return typeof value === "string" && value.length > 0 && !value.includes("\\") && !value.includes("\0") && !path3.posix.isAbsolute(value) && path3.posix.normalize(value) === value && value !== "." && value !== ".." && !value.startsWith("../");
2134
- }
2135
- function deletionRevisionPathIdentity(value) {
2136
- return value.normalize("NFC").toUpperCase().toLowerCase();
2137
- }
2138
- var DeletionRevisionStore = class {
2139
- options;
2140
- invalidationProofQuarantine = /* @__PURE__ */ new Set();
2141
- invalidationProofQuarantineFull = false;
2142
- invalidationProofQuarantineFullAt = null;
2143
- constructor(options) {
2144
- this.options = options;
2145
- }
2146
- quarantineInvalidationProof(memoryId) {
2147
- if (this.invalidationProofQuarantineFull) {
2148
- const nextBoundary = Date.now() + 1;
2149
- this.invalidationProofQuarantineFullAt = Math.max(
2150
- this.invalidationProofQuarantineFullAt ?? 0,
2151
- nextBoundary
2152
- );
2153
- return;
2154
- }
2155
- if (this.invalidationProofQuarantine.has(memoryId)) return;
2156
- if (this.invalidationProofQuarantine.size >= INVALIDATION_PROOF_QUARANTINE_MAX_IDS) {
2157
- this.invalidationProofQuarantineFull = true;
2158
- this.invalidationProofQuarantineFullAt = Date.now() + 1;
2159
- return;
2160
- }
2161
- this.invalidationProofQuarantine.add(memoryId);
2162
- }
2163
- async resolveConfiguredStoragePath(targetPath) {
2164
- const baseDir = path3.resolve(this.options.baseDir);
2165
- const relativePath = path3.relative(baseDir, path3.resolve(targetPath));
2166
- return resolveSafeStoragePath(baseDir, relativePath);
2167
- }
2168
- async resolveManagedStoragePath(filePath, method) {
2169
- const assertedPath = this.options.assertManagedStoragePath(filePath, method);
2170
- const target = await this.resolveConfiguredStoragePath(assertedPath);
2171
- const relativePath = path3.relative(path3.resolve(this.options.baseDir), target).split(path3.sep).join("/");
2172
- return { target, relativePath };
2173
- }
2174
- parseDeletionRevisionMetadata(raw) {
2175
- let parsed;
2176
- try {
2177
- parsed = JSON.parse(raw);
2178
- } catch {
2179
- throw new Error("Deletion revision metadata is invalid.");
2180
- }
2181
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
2182
- throw new Error("Deletion revision metadata is invalid.");
2183
- }
2184
- const root = parsed;
2185
- if (Object.keys(root).sort().join(",") !== "deletions,version" || root.version !== 1 || !Array.isArray(root.deletions)) {
2186
- throw new Error("Deletion revision metadata is invalid.");
2187
- }
2188
- const revisions = /* @__PURE__ */ new Map();
2189
- const pathByIdentity = /* @__PURE__ */ new Map();
2190
- for (const rawEntry of root.deletions) {
2191
- if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
2192
- throw new Error("Deletion revision metadata is invalid.");
2193
- }
2194
- const entry = rawEntry;
2195
- if (Object.keys(entry).sort().join(",") !== "mtimeMs,path" || !isValidDeletionRevisionPath(entry.path) || typeof entry.mtimeMs !== "number" || !Number.isFinite(entry.mtimeMs) || entry.mtimeMs < 0 || entry.mtimeMs > DELETION_REVISION_MAX_MTIME_MS || revisions.has(entry.path)) {
2196
- throw new Error("Deletion revision metadata is invalid.");
2197
- }
2198
- const identity = deletionRevisionPathIdentity(entry.path);
2199
- if (pathByIdentity.has(identity)) {
2200
- throw new Error("Deletion revision metadata is invalid.");
2201
- }
2202
- pathByIdentity.set(identity, entry.path);
2203
- revisions.set(entry.path, entry.mtimeMs);
2204
- }
2205
- return new Map([...revisions.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0));
2206
- }
2207
- async readDeletionRevisionMetadata() {
2208
- const metadataPath = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
2209
- let raw;
2210
- try {
2211
- raw = await readFile(metadataPath, "utf8");
2212
- } catch (error) {
2213
- if (isErrnoCode(error, "ENOENT")) return /* @__PURE__ */ new Map();
2214
- throw new Error("Deletion revision metadata is unavailable.");
2215
- }
2216
- return this.parseDeletionRevisionMetadata(raw);
2217
- }
2218
- async writeDeletionRevisionMetadata(revisions, lock) {
2219
- const metadataPath = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
2220
- const deletions = [...revisions.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([entryPath, mtimeMs]) => ({ path: entryPath, mtimeMs }));
2221
- const metadata = { version: 1, deletions };
2222
- const temporaryPath = await this.resolveConfiguredStoragePath(
2223
- `${metadataPath}.${process.pid}.${randomUUID()}.tmp`
2224
- );
2225
- let handle = null;
2226
- try {
2227
- handle = await open(temporaryPath, "wx", 384);
2228
- await handle.writeFile(`${JSON.stringify(metadata)}
2229
- `, "utf8");
2230
- await handle.sync();
2231
- await handle.close();
2232
- handle = null;
2233
- if (!await lock.refresh()) {
2234
- throw new Error("Deletion revision metadata lock was lost.");
2235
- }
2236
- const renameTarget = await this.resolveConfiguredStoragePath(this.options.deletionRevisionMetadataPath);
2237
- await rename(temporaryPath, renameTarget);
2238
- } finally {
2239
- if (handle !== null) {
2240
- await handle.close().catch((error) => {
2241
- log.warn("failed to close deletion revision metadata temporary file", error);
2242
- });
2243
- }
2244
- const cleanupPath = await this.resolveConfiguredStoragePath(temporaryPath).catch((error) => {
2245
- log.warn("failed to resolve deletion revision metadata temporary file for cleanup", error);
2246
- return null;
2247
- });
2248
- if (cleanupPath !== null) {
2249
- await unlink2(cleanupPath).catch((error) => {
2250
- if (!isErrnoCode(error, "ENOENT")) {
2251
- log.warn("failed to clean up deletion revision metadata temporary file", error);
2252
- }
2253
- });
2254
- }
2255
- }
2256
- }
2257
- async withDeletionRevisionLock(task) {
2258
- const lockPath2 = await this.resolveConfiguredStoragePath(this.options.deletionRevisionLockPath);
2259
- return withHeldFileLock(
2260
- lockPath2,
2261
- {
2262
- staleMs: DELETION_REVISION_LOCK_STALE_MS,
2263
- maxWaitMs: DELETION_REVISION_LOCK_MAX_WAIT_MS
2264
- },
2265
- async (acquired, lock) => {
2266
- if (!acquired) throw new Error("Deletion revision metadata lock is unavailable.");
2267
- return task(lock);
2268
- }
2269
- );
2270
- }
2271
- async readDeletionRevisions() {
2272
- return this.withDeletionRevisionLock(async () => this.readDeletionRevisionMetadata());
2273
- }
2274
- parseInvalidationCommitMetadata(raw) {
2275
- let parsed;
2276
- try {
2277
- parsed = JSON.parse(raw);
2278
- } catch {
2279
- throw new Error("Invalidation commit metadata is invalid.");
2280
- }
2281
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
2282
- throw new Error("Invalidation commit metadata is invalid.");
2283
- }
2284
- const root = parsed;
2285
- if (Object.keys(root).sort().join(",") !== "commits,version" || root.version !== 1 || !Array.isArray(root.commits)) {
2286
- throw new Error("Invalidation commit metadata is invalid.");
2287
- }
2288
- const commits = /* @__PURE__ */ new Map();
2289
- for (const rawEntry of root.commits) {
2290
- if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) {
2291
- throw new Error("Invalidation commit metadata is invalid.");
2292
- }
2293
- const entry = rawEntry;
2294
- if (Object.keys(entry).sort().join(",") !== "committedAt,fingerprint,memoryId" || !isValidMemoryId(entry.memoryId) || !isValidInvalidationCommitFingerprint(entry.fingerprint) || !isValidInvalidationCommitTimestamp(entry.committedAt) || commits.has(entry.memoryId)) {
2295
- throw new Error("Invalidation commit metadata is invalid.");
2296
- }
2297
- commits.set(entry.memoryId, {
2298
- fingerprint: entry.fingerprint,
2299
- committedAt: entry.committedAt
2300
- });
2301
- }
2302
- return commits;
2303
- }
2304
- async readInvalidationCommitMetadata() {
2305
- const metadataPath = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
2306
- let raw;
2307
- try {
2308
- raw = await readFile(metadataPath, "utf8");
2309
- } catch (error) {
2310
- if (isErrnoCode(error, "ENOENT")) return /* @__PURE__ */ new Map();
2311
- throw new Error("Invalidation commit metadata is unavailable.");
2312
- }
2313
- return this.parseInvalidationCommitMetadata(raw);
2314
- }
2315
- async writeInvalidationCommitMetadata(commits, lock) {
2316
- const metadataPath = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
2317
- const entries = [...commits.entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([memoryId, value]) => ({
2318
- memoryId,
2319
- fingerprint: value.fingerprint,
2320
- committedAt: value.committedAt
2321
- }));
2322
- const metadata = { version: 1, commits: entries };
2323
- const temporaryPath = await this.resolveConfiguredStoragePath(
2324
- `${metadataPath}.${process.pid}.${randomUUID()}.tmp`
2325
- );
2326
- const metadataDir = await this.resolveConfiguredStoragePath(path3.dirname(metadataPath));
2327
- let handle = null;
2328
- let renamed = false;
2329
- try {
2330
- await mkdir(metadataDir, { recursive: true });
2331
- handle = await open(temporaryPath, "wx", 384);
2332
- await handle.writeFile(`${JSON.stringify(metadata)}
2333
- `, "utf8");
2334
- await handle.sync();
2335
- await handle.close();
2336
- handle = null;
2337
- if (!await lock.refresh()) {
2338
- throw new Error("Invalidation commit metadata lock was lost.");
2339
- }
2340
- const renameTarget = await this.resolveConfiguredStoragePath(this.options.invalidationCommitMetadataPath);
2341
- await rename(temporaryPath, renameTarget);
2342
- renamed = true;
2343
- } finally {
2344
- if (handle !== null) {
2345
- await handle.close().catch((error) => {
2346
- log.warn("failed to close invalidation commit metadata temporary file", error);
2347
- });
2348
- }
2349
- const cleanupPath = await this.resolveConfiguredStoragePath(temporaryPath).catch((error) => {
2350
- log.warn("failed to resolve invalidation commit metadata temporary file for cleanup", error);
2351
- return null;
2352
- });
2353
- if (cleanupPath !== null) {
2354
- await unlink2(cleanupPath).catch((error) => {
2355
- if (!isErrnoCode(error, "ENOENT")) {
2356
- log.warn(
2357
- `failed to clean up invalidation commit metadata temporary file after ${renamed ? "commit" : "failure"}`,
2358
- error
2359
- );
2360
- }
2361
- });
2362
- }
2363
- }
2364
- }
2365
- async hasCommittedInvalidation(memory) {
2366
- const memoryId = memory.frontmatter.id;
2367
- const fingerprint = invalidationCommitFingerprint(memory);
2368
- return this.withDeletionRevisionLock(async () => {
2369
- const entry = (await this.readInvalidationCommitMetadata()).get(memoryId);
2370
- if (entry?.fingerprint !== fingerprint) return false;
2371
- if (this.invalidationProofQuarantine.has(memoryId)) return false;
2372
- if (!this.invalidationProofQuarantineFull) return true;
2373
- const fullAt = this.invalidationProofQuarantineFullAt;
2374
- return fullAt !== null && entry.committedAt >= fullAt;
2375
- });
2376
- }
2377
- async recordCommittedInvalidation(memory) {
2378
- const fingerprint = invalidationCommitFingerprint(memory);
2379
- await this.withDeletionRevisionLock(async (lock) => {
2380
- const fullAt = this.invalidationProofQuarantineFullAt;
2381
- const committedAt = fullAt === null ? Date.now() : Math.max(Date.now(), fullAt + 1);
2382
- const commits = await this.readInvalidationCommitMetadata();
2383
- commits.set(memory.frontmatter.id, {
2384
- fingerprint,
2385
- committedAt
2386
- });
2387
- await this.writeInvalidationCommitMetadata(commits, lock);
2388
- this.invalidationProofQuarantine.delete(memory.frontmatter.id);
2389
- });
2390
- }
2391
- async clearCommittedInvalidation(memory) {
2392
- const memoryId = memory.frontmatter.id;
2393
- this.quarantineInvalidationProof(memoryId);
2394
- const fingerprint = invalidationCommitFingerprint(memory);
2395
- let cleared = false;
2396
- try {
2397
- await this.withDeletionRevisionLock(async (lock) => {
2398
- const commits = await this.readInvalidationCommitMetadata();
2399
- const current = commits.get(memoryId);
2400
- if (current?.fingerprint !== fingerprint) return;
2401
- commits.delete(memoryId);
2402
- await this.writeInvalidationCommitMetadata(commits, lock);
2403
- });
2404
- cleared = true;
2405
- } finally {
2406
- if (cleared) this.invalidationProofQuarantine.delete(memoryId);
2407
- }
2408
- }
2409
- async recordReplicatedDeletionRevision(filePath, mtimeMs) {
2410
- const { relativePath } = await this.resolveManagedStoragePath(
2411
- filePath,
2412
- "storage.recordReplicatedDeletionRevision"
2413
- );
2414
- if (typeof mtimeMs !== "number" || !Number.isFinite(mtimeMs) || mtimeMs < 0 || mtimeMs > DELETION_REVISION_MAX_MTIME_MS) {
2415
- throw new Error("Deletion revision timestamp is invalid.");
2416
- }
2417
- if (!isValidDeletionRevisionPath(relativePath)) {
2418
- throw new Error("Deletion revision path is invalid.");
2419
- }
2420
- await this.withDeletionRevisionLock(async (lock) => {
2421
- const revisions = await this.readDeletionRevisionMetadata();
2422
- const identity = deletionRevisionPathIdentity(relativePath);
2423
- let existingPath;
2424
- for (const candidatePath of revisions.keys()) {
2425
- if (deletionRevisionPathIdentity(candidatePath) === identity) {
2426
- existingPath = candidatePath;
2427
- break;
2428
- }
2429
- }
2430
- const existingMtimeMs = existingPath === void 0 ? void 0 : revisions.get(existingPath);
2431
- if (existingMtimeMs !== void 0 && existingMtimeMs >= mtimeMs) return;
2432
- const updated = new Map(revisions);
2433
- if (existingPath !== void 0) updated.delete(existingPath);
2434
- updated.set(relativePath, mtimeMs);
2435
- await this.writeDeletionRevisionMetadata(updated, lock);
2436
- });
2437
- }
2438
- async writeManagedStorageFile(filePath, write) {
2439
- const { relativePath } = await this.resolveManagedStoragePath(filePath, "storage.writeManagedStorageFile");
2440
- if (!isValidDeletionRevisionPath(relativePath)) {
2441
- throw new Error("Deletion revision path is invalid.");
2442
- }
2443
- await this.withDeletionRevisionLock(async (lock) => {
2444
- const before = await this.readDeletionRevisionMetadata();
2445
- const identity = deletionRevisionPathIdentity(relativePath);
2446
- const existingPath = [...before.keys()].find(
2447
- (candidatePath) => deletionRevisionPathIdentity(candidatePath) === identity
2448
- );
2449
- await write();
2450
- if (existingPath === void 0) return;
2451
- const updated = new Map(before);
2452
- updated.delete(existingPath);
2453
- await this.writeDeletionRevisionMetadata(updated, lock);
2454
- });
2455
- }
2456
- async deleteManagedStorageFile(filePath, deletionMtimeMs) {
2457
- const { target, relativePath } = await this.resolveManagedStoragePath(
2458
- filePath,
2459
- "storage.deleteManagedStorageFile"
2460
- );
2461
- if (deletionMtimeMs !== void 0 && deletionMtimeMs !== null && (typeof deletionMtimeMs !== "number" || !Number.isFinite(deletionMtimeMs) || deletionMtimeMs < 0 || deletionMtimeMs > DELETION_REVISION_MAX_MTIME_MS)) {
2462
- throw new Error("Deletion revision timestamp is invalid.");
2463
- }
2464
- return this.withDeletionRevisionLock(async (lock) => {
2465
- const safeTarget = await this.resolveConfiguredStoragePath(target);
2466
- try {
2467
- await lstat2(safeTarget);
2468
- } catch (error) {
2469
- if (isErrnoCode(error, "ENOENT")) return false;
2470
- throw error;
2471
- }
2472
- if (!isValidDeletionRevisionPath(relativePath)) {
2473
- throw new Error("Deletion revision path is invalid.");
2474
- }
2475
- const revision = deletionMtimeMs === null ? void 0 : deletionMtimeMs ?? Date.now();
2476
- const before = await this.readDeletionRevisionMetadata();
2477
- const identity = deletionRevisionPathIdentity(relativePath);
2478
- let existingPath;
2479
- for (const candidatePath of before.keys()) {
2480
- if (deletionRevisionPathIdentity(candidatePath) === identity) {
2481
- existingPath = candidatePath;
2482
- break;
2483
- }
2484
- }
2485
- const existing = existingPath === void 0 ? void 0 : before.get(existingPath);
2486
- const changed = existingPath !== void 0 && existingPath !== relativePath || (revision === void 0 ? existing !== void 0 : existing !== revision);
2487
- if (changed) {
2488
- const updated = new Map(before);
2489
- if (existingPath !== void 0) updated.delete(existingPath);
2490
- if (revision !== void 0) updated.set(relativePath, revision);
2491
- await this.writeDeletionRevisionMetadata(updated, lock);
2492
- }
2493
- try {
2494
- const unlinkTarget = await this.resolveConfiguredStoragePath(target);
2495
- await unlink2(unlinkTarget);
2496
- return true;
2497
- } catch (error) {
2498
- if (changed) await this.writeDeletionRevisionMetadata(before, lock);
2499
- if (isErrnoCode(error, "ENOENT")) return false;
2500
- throw error;
2501
- }
2502
- });
2503
- }
2504
- };
2505
-
2506
2092
  // src/storage/identity-continuity-store.ts
2507
2093
  import { readdir as readdir3 } from "fs/promises";
2508
- import path4 from "path";
2094
+ import path3 from "path";
2509
2095
  var IdentityContinuityStore = class {
2510
2096
  constructor(deps) {
2511
2097
  this.deps = deps;
@@ -2530,7 +2116,7 @@ var IdentityContinuityStore = class {
2530
2116
  const date = nowIso.slice(0, 10);
2531
2117
  const id = this.deps.generateId("incident");
2532
2118
  const incident = createContinuityIncidentRecord(id, input, nowIso);
2533
- const filePath = path4.join(this.deps.identityIncidentsDir, `${date}-${id}.md`);
2119
+ const filePath = path3.join(this.deps.identityIncidentsDir, `${date}-${id}.md`);
2534
2120
  await this.deps.writeStorageSecureFile(filePath, serializeContinuityIncident(incident));
2535
2121
  return { ...incident, filePath };
2536
2122
  }
@@ -2543,7 +2129,7 @@ var IdentityContinuityStore = class {
2543
2129
  const incidents = [];
2544
2130
  for (const file of candidates) {
2545
2131
  if (incidents.length >= cappedLimit) break;
2546
- const filePath = path4.join(this.deps.identityIncidentsDir, file);
2132
+ const filePath = path3.join(this.deps.identityIncidentsDir, file);
2547
2133
  try {
2548
2134
  const raw = await this.deps.readStorageSecureFile(filePath);
2549
2135
  const parsed = parseContinuityIncident(raw);
@@ -2574,7 +2160,7 @@ var IdentityContinuityStore = class {
2574
2160
  await this.deps.ensureDirectories();
2575
2161
  const safeKey = this.sanitizeIdentityAuditKey(key);
2576
2162
  const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
2577
- const filePath = path4.join(dir, `${safeKey}.md`);
2163
+ const filePath = path3.join(dir, `${safeKey}.md`);
2578
2164
  await this.deps.writeStorageSecureFile(filePath, content);
2579
2165
  return filePath;
2580
2166
  }
@@ -2582,7 +2168,7 @@ var IdentityContinuityStore = class {
2582
2168
  try {
2583
2169
  const safeKey = this.sanitizeIdentityAuditKey(key);
2584
2170
  const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
2585
- return await this.deps.readStorageSecureFile(path4.join(dir, `${safeKey}.md`));
2171
+ return await this.deps.readStorageSecureFile(path3.join(dir, `${safeKey}.md`));
2586
2172
  } catch (err) {
2587
2173
  if (err instanceof Error && err.message === "Invalid identity audit key") return null;
2588
2174
  if (!isErrnoCode(err, "ENOENT")) throw err;
@@ -2638,12 +2224,12 @@ var IdentityContinuityStore = class {
2638
2224
  const fileNames = await this.readContinuityIncidentFileNames();
2639
2225
  const directMatch = fileNames.find((name) => name.endsWith(`-${id}.md`));
2640
2226
  if (directMatch) {
2641
- const directPath = path4.join(this.deps.identityIncidentsDir, directMatch);
2227
+ const directPath = path3.join(this.deps.identityIncidentsDir, directMatch);
2642
2228
  const parsed = await this.readContinuityIncidentFile(directPath);
2643
2229
  if (parsed?.id === id) return directPath;
2644
2230
  }
2645
2231
  for (const fileName of fileNames) {
2646
- const filePath = path4.join(this.deps.identityIncidentsDir, fileName);
2232
+ const filePath = path3.join(this.deps.identityIncidentsDir, fileName);
2647
2233
  const parsed = await this.readContinuityIncidentFile(filePath);
2648
2234
  if (parsed?.id === id) return filePath;
2649
2235
  }
@@ -2659,19 +2245,19 @@ var IdentityContinuityStore = class {
2659
2245
  };
2660
2246
 
2661
2247
  // src/storage/entity-canonical-id-migration.ts
2662
- import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
2248
+ import { createHash, randomUUID } from "crypto";
2663
2249
  import {
2664
2250
  access,
2665
- lstat as lstat3,
2666
- readFile as readFile2,
2251
+ lstat as lstat2,
2252
+ readFile,
2667
2253
  readdir as readdir4,
2668
2254
  realpath as realpath2,
2669
- rename as rename2,
2255
+ rename,
2670
2256
  stat as statFile,
2671
- unlink as unlink3,
2257
+ unlink as unlink2,
2672
2258
  writeFile
2673
2259
  } from "fs/promises";
2674
- import path5 from "path";
2260
+ import path4 from "path";
2675
2261
  import { z } from "zod";
2676
2262
  var ENTITY_CANONICAL_ID_MIGRATION_VERSION = 1;
2677
2263
  var ENTITY_CANONICAL_ID_MIGRATION_LOCK_STALE_MS = 6e4;
@@ -2696,7 +2282,7 @@ var EntityCanonicalIdMigrationStateSchema = z.object({
2696
2282
  async function fingerprintPath(filePath) {
2697
2283
  let fileStat;
2698
2284
  try {
2699
- fileStat = await lstat3(filePath);
2285
+ fileStat = await lstat2(filePath);
2700
2286
  } catch (error) {
2701
2287
  if (!isErrnoCode(error, "ENOENT")) throw error;
2702
2288
  }
@@ -2705,16 +2291,16 @@ async function fingerprintPath(filePath) {
2705
2291
  async function fingerprintEntityEntries(entitiesDir) {
2706
2292
  let names;
2707
2293
  try {
2708
- names = (await readdir4(entitiesDir)).filter((name) => path5.extname(name) === ".md").sort();
2294
+ names = (await readdir4(entitiesDir)).filter((name) => path4.extname(name) === ".md").sort();
2709
2295
  } catch (error) {
2710
2296
  if (isErrnoCode(error, "ENOENT")) return "missing";
2711
2297
  throw error;
2712
2298
  }
2713
- const hash = createHash2("sha256");
2299
+ const hash = createHash("sha256");
2714
2300
  for (const name of names) {
2715
2301
  hash.update(`${name.length}:${name}:`);
2716
2302
  try {
2717
- const entry = await lstat3(path5.join(entitiesDir, name), { bigint: true });
2303
+ const entry = await lstat2(path4.join(entitiesDir, name), { bigint: true });
2718
2304
  hash.update(`${entry.dev}:${entry.ino}:${entry.size}:${entry.mtimeNs}:${entry.ctimeNs}`);
2719
2305
  } catch (error) {
2720
2306
  if (!isErrnoCode(error, "ENOENT")) throw error;
@@ -2734,9 +2320,9 @@ async function getFingerprint(baseDir, entitiesDir, getEntityMutationVersion) {
2734
2320
  ] = await Promise.all([
2735
2321
  fingerprintPath(entitiesDir),
2736
2322
  fingerprintEntityEntries(entitiesDir),
2737
- fingerprintPath(path5.join(baseDir, "config", "aliases.json")),
2738
- fingerprintPath(path5.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_MARKER)),
2739
- fingerprintPath(path5.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER))
2323
+ fingerprintPath(path4.join(baseDir, "config", "aliases.json")),
2324
+ fingerprintPath(path4.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_MARKER)),
2325
+ fingerprintPath(path4.join(baseDir, "state", ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER))
2740
2326
  ]);
2741
2327
  return [
2742
2328
  entityDirectoryFingerprint,
@@ -2750,7 +2336,7 @@ async function getFingerprint(baseDir, entitiesDir, getEntityMutationVersion) {
2750
2336
  async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2751
2337
  let baseStat;
2752
2338
  try {
2753
- baseStat = await lstat3(baseDir);
2339
+ baseStat = await lstat2(baseDir);
2754
2340
  } catch (error) {
2755
2341
  if (isErrnoCode(error, "ENOENT")) return;
2756
2342
  throw error;
@@ -2762,14 +2348,14 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2762
2348
  const roots = [
2763
2349
  entitiesDir,
2764
2350
  stateDir,
2765
- ...RECALL_FALLBACK_DIRS.map((directory) => path5.join(baseDir, directory)),
2766
- path5.join(baseDir, "cold"),
2351
+ ...RECALL_FALLBACK_DIRS.map((directory) => path4.join(baseDir, directory)),
2352
+ path4.join(baseDir, "cold"),
2767
2353
  archiveDir
2768
2354
  ];
2769
2355
  for (const root of roots) {
2770
2356
  let rootStat;
2771
2357
  try {
2772
- rootStat = await lstat3(root);
2358
+ rootStat = await lstat2(root);
2773
2359
  } catch (error) {
2774
2360
  if (isErrnoCode(error, "ENOENT")) continue;
2775
2361
  throw error;
@@ -2781,13 +2367,13 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2781
2367
  }
2782
2368
  }
2783
2369
  function statePath(deps) {
2784
- return path5.join(deps.stateDir, ENTITY_CANONICAL_ID_MIGRATION_FILE);
2370
+ return path4.join(deps.stateDir, ENTITY_CANONICAL_ID_MIGRATION_FILE);
2785
2371
  }
2786
2372
  async function assertSafeMigrationStateFile(deps) {
2787
2373
  const migrationStatePath = statePath(deps);
2788
2374
  let fileStat;
2789
2375
  try {
2790
- fileStat = await lstat3(migrationStatePath);
2376
+ fileStat = await lstat2(migrationStatePath);
2791
2377
  } catch (error) {
2792
2378
  if (isErrnoCode(error, "ENOENT")) return;
2793
2379
  throw error;
@@ -2806,7 +2392,7 @@ async function assertSafeMigrationStateFile(deps) {
2806
2392
  async function assertSafeTombstoneFile(deps, tombstonePath) {
2807
2393
  let fileStat;
2808
2394
  try {
2809
- fileStat = await lstat3(tombstonePath);
2395
+ fileStat = await lstat2(tombstonePath);
2810
2396
  } catch (error) {
2811
2397
  if (isErrnoCode(error, "ENOENT")) return false;
2812
2398
  throw error;
@@ -2824,13 +2410,13 @@ async function assertSafeTombstoneFile(deps, tombstonePath) {
2824
2410
  return true;
2825
2411
  }
2826
2412
  function lockPath(deps) {
2827
- return path5.join(deps.stateDir, "entity-canonical-id-migration.lock");
2413
+ return path4.join(deps.stateDir, "entity-canonical-id-migration.lock");
2828
2414
  }
2829
2415
  async function readState(deps) {
2830
2416
  await assertSafeMigrationStateFile(deps);
2831
2417
  let raw;
2832
2418
  try {
2833
- raw = await readFile2(statePath(deps), "utf-8");
2419
+ raw = await readFile(statePath(deps), "utf-8");
2834
2420
  } catch (error) {
2835
2421
  if (isErrnoCode(error, "ENOENT")) return null;
2836
2422
  throw error;
@@ -2853,13 +2439,13 @@ async function readState(deps) {
2853
2439
  }
2854
2440
  async function writeState(deps, state) {
2855
2441
  const destination = statePath(deps);
2856
- const temporary = `${destination}.${process.pid}.${randomUUID2()}.tmp`;
2442
+ const temporary = `${destination}.${process.pid}.${randomUUID()}.tmp`;
2857
2443
  try {
2858
2444
  await writeFile(temporary, `${JSON.stringify(state, null, 2)}
2859
2445
  `, "utf-8");
2860
- await rename2(temporary, destination);
2446
+ await rename(temporary, destination);
2861
2447
  } finally {
2862
- await unlink3(temporary).catch(() => void 0);
2448
+ await unlink2(temporary).catch(() => void 0);
2863
2449
  }
2864
2450
  }
2865
2451
  async function publishState(deps, state) {
@@ -2888,7 +2474,7 @@ async function sameFileIdentity(leftPath, rightPath) {
2888
2474
  async function assertNotSymlink(filePath, label) {
2889
2475
  let stat3;
2890
2476
  try {
2891
- stat3 = await lstat3(filePath);
2477
+ stat3 = await lstat2(filePath);
2892
2478
  } catch (error) {
2893
2479
  if (isErrnoCode(error, "ENOENT")) return;
2894
2480
  throw error;
@@ -2900,7 +2486,7 @@ async function assertNotSymlink(filePath, label) {
2900
2486
  async function assertNotMemorySymlink(filePath) {
2901
2487
  let stat3;
2902
2488
  try {
2903
- stat3 = await lstat3(filePath);
2489
+ stat3 = await lstat2(filePath);
2904
2490
  } catch (error) {
2905
2491
  if (isErrnoCode(error, "ENOENT")) return;
2906
2492
  throw error;
@@ -2916,13 +2502,13 @@ async function assertEntityContentUnchanged(deps, filePath, expectedContent, leg
2916
2502
  }
2917
2503
  }
2918
2504
  async function readSafeEntityEntries(entitiesDir) {
2919
- const rootStat = await lstat3(entitiesDir);
2505
+ const rootStat = await lstat2(entitiesDir);
2920
2506
  if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
2921
2507
  throw new Error("Refusing entity canonical-id migration through a symlinked or non-directory entities root.");
2922
2508
  }
2923
2509
  const entries = await readdir4(entitiesDir);
2924
2510
  for (const entry of entries) {
2925
- await assertNotSymlink(path5.join(entitiesDir, entry), entry);
2511
+ await assertNotSymlink(path4.join(entitiesDir, entry), entry);
2926
2512
  }
2927
2513
  return entries;
2928
2514
  }
@@ -2984,7 +2570,7 @@ async function rewriteReferences(deps, mappings, refreshLock) {
2984
2570
  const seenPaths = /* @__PURE__ */ new Set();
2985
2571
  let rewroteAny = false;
2986
2572
  for (const memory of [...hotMemories, ...coldMemories, ...archivedMemories]) {
2987
- const memoryPath = path5.resolve(memory.path);
2573
+ const memoryPath = path4.resolve(memory.path);
2988
2574
  if (seenPaths.has(memoryPath)) continue;
2989
2575
  seenPaths.add(memoryPath);
2990
2576
  const previousEntityRef = memory.frontmatter.entityRef;
@@ -3016,7 +2602,7 @@ async function rewriteReferences(deps, mappings, refreshLock) {
3016
2602
  latestCanonicalId
3017
2603
  );
3018
2604
  rewroteAny = true;
3019
- rewroteColdMemory ||= latestMemory.path.includes(`${path5.sep}cold${path5.sep}`);
2605
+ rewroteColdMemory ||= latestMemory.path.includes(`${path4.sep}cold${path4.sep}`);
3020
2606
  }
3021
2607
  if (!rewroteAny) return { rewroteColdMemory };
3022
2608
  }
@@ -3055,7 +2641,7 @@ function rewriteTombstoneLine(line, mappings, normalizedMappings) {
3055
2641
  return changed ? JSON.stringify(tombstone) : line;
3056
2642
  }
3057
2643
  async function rewriteTombstoneReferences(deps, mappings, refreshLock) {
3058
- const tombstonePath = path5.join(deps.stateDir, "tombstones.jsonl");
2644
+ const tombstonePath = path4.join(deps.stateDir, "tombstones.jsonl");
3059
2645
  const normalizedMappings = /* @__PURE__ */ new Map();
3060
2646
  for (const [legacyId, canonicalId] of Object.entries(mappings)) {
3061
2647
  const normalizedLegacyId = normalizeSupersessionKey(legacyId);
@@ -3064,7 +2650,7 @@ async function rewriteTombstoneReferences(deps, mappings, refreshLock) {
3064
2650
  }
3065
2651
  }
3066
2652
  await withHeldFileLock(
3067
- path5.join(deps.stateDir, "tombstones.lock"),
2653
+ path4.join(deps.stateDir, "tombstones.lock"),
3068
2654
  {
3069
2655
  staleMs: TOMBSTONE_LOCK_STALE_MS,
3070
2656
  maxWaitMs: TOMBSTONE_LOCK_MAX_WAIT_MS
@@ -3252,7 +2838,7 @@ async function migrateEntityFilePair(deps, legacyId, canonicalId, refreshMigrati
3252
2838
  await deps.snapshotBeforeWrite(legacyPath, "write");
3253
2839
  await assertNotSymlink(legacyPath, legacyId);
3254
2840
  await assertEntityContentUnchanged(deps, legacyPath, legacyContent, legacyId);
3255
- await unlink3(legacyPath);
2841
+ await unlink2(legacyPath);
3256
2842
  return { deferred: false, progressed: true };
3257
2843
  }
3258
2844
  if (!legacyExists) return { deferred: false, progressed: false };
@@ -3276,13 +2862,13 @@ async function migrateEntityFilePair(deps, legacyId, canonicalId, refreshMigrati
3276
2862
  await deps.snapshotBeforeWrite(legacyPath, "write");
3277
2863
  await assertNotSymlink(legacyPath, legacyId);
3278
2864
  await assertEntityContentUnchanged(deps, legacyPath, entityContent, legacyId);
3279
- await unlink3(legacyPath);
2865
+ await unlink2(legacyPath);
3280
2866
  } catch (error) {
3281
2867
  if (!canonicalExists && canonicalFingerprintAfterWrite !== null) {
3282
2868
  try {
3283
2869
  if (await fingerprintPath(canonicalPath) === canonicalFingerprintAfterWrite) {
3284
2870
  await assertNotSymlink(canonicalPath, canonicalId);
3285
- await unlink3(canonicalPath);
2871
+ await unlink2(canonicalPath);
3286
2872
  }
3287
2873
  } catch {
3288
2874
  }
@@ -3303,12 +2889,12 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3303
2889
  if (!acquired) throw new Error("Timed out waiting for active entity canonical-id migration.");
3304
2890
  await deps.validateMemoryScanRoots?.();
3305
2891
  await readSafeEntityEntries(deps.entitiesDir);
3306
- const reconcileMarkerPath = path5.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_MARKER);
3307
- const consumingMarkerPath = path5.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER);
2892
+ const reconcileMarkerPath = path4.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_MARKER);
2893
+ const consumingMarkerPath = path4.join(deps.stateDir, ENTITY_CANONICAL_ID_RECONCILE_CONSUMING_MARKER);
3308
2894
  let reconcileRequested = await fileExists(consumingMarkerPath);
3309
2895
  if (await fileExists(reconcileMarkerPath)) {
3310
2896
  try {
3311
- await rename2(reconcileMarkerPath, consumingMarkerPath);
2897
+ await rename(reconcileMarkerPath, consumingMarkerPath);
3312
2898
  reconcileRequested = true;
3313
2899
  } catch (error) {
3314
2900
  if (!isErrnoCode(error, "ENOENT")) throw error;
@@ -3331,7 +2917,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3331
2917
  );
3332
2918
  }
3333
2919
  if (reconcileRequested) {
3334
- await unlink3(consumingMarkerPath).catch((error) => {
2920
+ await unlink2(consumingMarkerPath).catch((error) => {
3335
2921
  if (!isErrnoCode(error, "ENOENT")) throw error;
3336
2922
  });
3337
2923
  }
@@ -3477,7 +3063,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3477
3063
  }
3478
3064
 
3479
3065
  // src/storage/entity-ref-repair.ts
3480
- import { unlink as unlink4 } from "fs/promises";
3066
+ import { unlink as unlink3 } from "fs/promises";
3481
3067
  var EntityRefRepair = class {
3482
3068
  constructor(deps) {
3483
3069
  this.deps = deps;
@@ -3539,7 +3125,7 @@ ${body}
3539
3125
  if (opts.onFailRestore) {
3540
3126
  await this.restore(opts.onFailRestore);
3541
3127
  } else if (opts.onFailRemove) {
3542
- await unlink4(opts.onFailRemove).catch(() => void 0);
3128
+ await unlink3(opts.onFailRemove).catch(() => void 0);
3543
3129
  this.deps.invalidateAllMemoriesCache();
3544
3130
  }
3545
3131
  throw err;
@@ -3700,7 +3286,7 @@ import {
3700
3286
  readFileSync,
3701
3287
  realpathSync
3702
3288
  } from "fs";
3703
- import path6 from "path";
3289
+ import path5 from "path";
3704
3290
  function resolveSafeAliasRoots(baseDir, configDir) {
3705
3291
  let baseStat;
3706
3292
  try {
@@ -3727,8 +3313,8 @@ function resolveSafeAliasRoots(baseDir, configDir) {
3727
3313
  return memoryRoot;
3728
3314
  }
3729
3315
  function readEntityAliasConfigSync(baseDir) {
3730
- const configDir = path6.join(baseDir, "config");
3731
- const aliasPath = path6.join(configDir, "aliases.json");
3316
+ const configDir = path5.join(baseDir, "config");
3317
+ const aliasPath = path5.join(configDir, "aliases.json");
3732
3318
  let memoryRoot = resolveSafeAliasRoots(baseDir, configDir);
3733
3319
  if (memoryRoot === void 0) return void 0;
3734
3320
  let aliasPreflight;
@@ -3789,7 +3375,7 @@ function decodeYamlScalar(value) {
3789
3375
  }
3790
3376
 
3791
3377
  // src/orchestration/qmd-result-resolver.ts
3792
- import path7 from "path";
3378
+ import path6 from "path";
3793
3379
  var INTERNAL_QMD_ROOTS = /* @__PURE__ */ new Set([
3794
3380
  ...ALL_CATEGORY_DIRS,
3795
3381
  "activity",
@@ -3810,7 +3396,7 @@ var INTERNAL_QMD_ROOTS = /* @__PURE__ */ new Set([
3810
3396
  ]);
3811
3397
  var PRIVATE_RESULT_RESOLUTION_CONCURRENCY = 16;
3812
3398
  function qmdCollectionPathParts(resultPath) {
3813
- if (!resultPath || path7.isAbsolute(resultPath)) return null;
3399
+ if (!resultPath || path6.isAbsolute(resultPath)) return null;
3814
3400
  if (resultPath.trim().startsWith("qmd://")) {
3815
3401
  try {
3816
3402
  const parsed = new URL(resultPath.trim());
@@ -3835,9 +3421,9 @@ function qmdCollectionPathParts(resultPath) {
3835
3421
  }
3836
3422
  function qmdResultPathCandidates(storageDir, resultPath) {
3837
3423
  const candidates = /* @__PURE__ */ new Set();
3838
- const storageRoot = path7.resolve(storageDir);
3424
+ const storageRoot = path6.resolve(storageDir);
3839
3425
  const addCandidate = (candidate) => {
3840
- const resolved = path7.resolve(candidate);
3426
+ const resolved = path6.resolve(candidate);
3841
3427
  if (isPathInsideStorageRoot(storageRoot, resolved)) {
3842
3428
  candidates.add(resolved);
3843
3429
  }
@@ -3845,18 +3431,18 @@ function qmdResultPathCandidates(storageDir, resultPath) {
3845
3431
  const addRelativeCandidates = (relativePath) => {
3846
3432
  const normalized = relativePath.replace(/\\/g, "/").replace(/^\/+/, "");
3847
3433
  if (!normalized) return;
3848
- addCandidate(path7.join(storageRoot, normalized));
3434
+ addCandidate(path6.join(storageRoot, normalized));
3849
3435
  if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
3850
- addCandidate(path7.join(storageRoot, "facts", normalized));
3436
+ addCandidate(path6.join(storageRoot, "facts", normalized));
3851
3437
  }
3852
3438
  };
3853
- if (path7.isAbsolute(resultPath)) {
3439
+ if (path6.isAbsolute(resultPath)) {
3854
3440
  addCandidate(resultPath);
3855
- const relative2 = path7.relative(storageRoot, path7.resolve(resultPath));
3856
- if (relative2 && !relative2.startsWith("..") && !path7.isAbsolute(relative2)) {
3857
- const normalized = relative2.split(path7.sep).join("/");
3441
+ const relative2 = path6.relative(storageRoot, path6.resolve(resultPath));
3442
+ if (relative2 && !relative2.startsWith("..") && !path6.isAbsolute(relative2)) {
3443
+ const normalized = relative2.split(path6.sep).join("/");
3858
3444
  if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
3859
- addCandidate(path7.join(storageRoot, "facts", normalized));
3445
+ addCandidate(path6.join(storageRoot, "facts", normalized));
3860
3446
  }
3861
3447
  }
3862
3448
  } else {
@@ -3892,7 +3478,7 @@ var QmdResultResolver = class {
3892
3478
  const seenStorageDirs = /* @__PURE__ */ new Set();
3893
3479
  const addStorage = (storage) => {
3894
3480
  const storageDir = storageDirOrNull(storage);
3895
- const storageKey = storageDir ? path7.resolve(storageDir) : `storage-without-dir-${storages.length}`;
3481
+ const storageKey = storageDir ? path6.resolve(storageDir) : `storage-without-dir-${storages.length}`;
3896
3482
  if (seenStorageDirs.has(storageKey)) return;
3897
3483
  seenStorageDirs.add(storageKey);
3898
3484
  storages.push(storage);
@@ -3922,7 +3508,7 @@ var QmdResultResolver = class {
3922
3508
  continue;
3923
3509
  }
3924
3510
  try {
3925
- const coldRoot = path7.join(storageDir, "cold");
3511
+ const coldRoot = path6.join(storageDir, "cold");
3926
3512
  for (const candidate of qmdResultPathCandidates(coldRoot, parts.relativePath)) {
3927
3513
  const memory = await storage.readMemoryByPath(candidate);
3928
3514
  if (memory) return memory;
@@ -3972,9 +3558,9 @@ var QmdResultResolver = class {
3972
3558
  error: err.message
3973
3559
  });
3974
3560
  }
3975
- if (!path7.isAbsolute(fallbackResultPath)) return null;
3561
+ if (!path6.isAbsolute(fallbackResultPath)) return null;
3976
3562
  }
3977
- if (path7.isAbsolute(fallbackResultPath)) {
3563
+ if (path6.isAbsolute(fallbackResultPath)) {
3978
3564
  if (!fallbackStorageDir) {
3979
3565
  return await fallbackStorage.readMemoryByPath(fallbackResultPath);
3980
3566
  }
@@ -4031,17 +3617,17 @@ var QmdResultResolver = class {
4031
3617
  if (!memory && parts && !collectionIsKnownInternal && !collectionIsConfigured) {
4032
3618
  memory = await this.readQmdResultMemory(parts.relativePath, fallbackStorage, namespaces, result.namespace);
4033
3619
  }
4034
- const absoluteInsideMemoryRoot = path7.isAbsolute(result.path) && isPathInsideStorageRoot(path7.resolve(config.memoryDir), path7.resolve(result.path));
3620
+ const absoluteInsideMemoryRoot = path6.isAbsolute(result.path) && isPathInsideStorageRoot(path6.resolve(config.memoryDir), path6.resolve(result.path));
4035
3621
  const hasExplicitQmdCollection = result.path.trim().startsWith("qmd://");
4036
3622
  const unresolvedInternalPath = !memory && (absoluteInsideMemoryRoot || collectionIsKnownInternal && (!preserveUnresolved || hasExplicitQmdCollection) || hasExplicitQmdCollection && collectionIsConfigured);
4037
- const unresolvedExternalCollection = !memory && (parts !== null && !collectionIsKnownInternal && !collectionIsConfigured || path7.isAbsolute(result.path) && !isPathInsideStorageRoot(path7.resolve(config.memoryDir), path7.resolve(result.path)));
3623
+ const unresolvedExternalCollection = !memory && (parts !== null && !collectionIsKnownInternal && !collectionIsConfigured || path6.isAbsolute(result.path) && !isPathInsideStorageRoot(path6.resolve(config.memoryDir), path6.resolve(result.path)));
4038
3624
  return memory !== null && !isSupportPassportPrivateMemory(memory) || !memory && !unresolvedInternalPath && (preserveUnresolved || unresolvedExternalCollection);
4039
3625
  }
4040
3626
  async resolveColdQmdResultForRecall(result, fallbackStorage, recallNamespaces = []) {
4041
3627
  const memory = await this.readQmdResultMemory(result.path, fallbackStorage, recallNamespaces, result.namespace);
4042
3628
  if (!memory) return null;
4043
3629
  let ownerNamespace = null;
4044
- if (path7.isAbsolute(memory.path)) {
3630
+ if (path6.isAbsolute(memory.path)) {
4045
3631
  const ownerStorage = await this.storageForAbsoluteQmdResultPath(memory.path, fallbackStorage, recallNamespaces);
4046
3632
  ownerNamespace = ownerStorage?.namespace ?? null;
4047
3633
  if (!ownerNamespace && resolveNamespaceCapabilities(this.getConfig()).namespaces) return null;
@@ -4061,17 +3647,17 @@ var QmdResultResolver = class {
4061
3647
  };
4062
3648
  }
4063
3649
  async storageForAbsoluteQmdResultPath(resultPath, fallbackStorage, recallNamespaces = []) {
4064
- const resolvedPath = path7.resolve(resultPath);
3650
+ const resolvedPath = path6.resolve(resultPath);
4065
3651
  const config = this.getConfig();
4066
- const memoryRoot = path7.resolve(config.memoryDir);
4067
- const namespacesRoot = path7.join(memoryRoot, "namespaces");
3652
+ const memoryRoot = path6.resolve(config.memoryDir);
3653
+ const namespacesRoot = path6.join(memoryRoot, "namespaces");
4068
3654
  const fallbackStorageDir = storageDirOrNull(fallbackStorage);
4069
3655
  const matches = [];
4070
3656
  const seenDirs = /* @__PURE__ */ new Set();
4071
3657
  const maybeAddStorage = (storage, namespace) => {
4072
3658
  const storageDir = storageDirOrNull(storage);
4073
3659
  if (!storageDir) return;
4074
- const candidateRoot = path7.resolve(storageDir);
3660
+ const candidateRoot = path6.resolve(storageDir);
4075
3661
  if (seenDirs.has(candidateRoot)) return;
4076
3662
  if (!isPathInsideStorageRoot(candidateRoot, resolvedPath)) return;
4077
3663
  if (candidateRoot === memoryRoot && isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
@@ -4089,7 +3675,7 @@ var QmdResultResolver = class {
4089
3675
  candidateNamespaces.add(ns);
4090
3676
  }
4091
3677
  if (isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
4092
- const relativeToNamespaces = path7.relative(namespacesRoot, resolvedPath);
3678
+ const relativeToNamespaces = path6.relative(namespacesRoot, resolvedPath);
4093
3679
  const [namespaceSegment] = relativeToNamespaces.split(/[\\/]/);
4094
3680
  if (namespaceSegment) {
4095
3681
  candidateNamespaces.add(namespaceIdentityFromToken(namespaceSegment) ?? namespaceSegment);
@@ -4630,7 +4216,7 @@ function collectSpeakers(tagged) {
4630
4216
  }
4631
4217
 
4632
4218
  // src/wearables/fusion/fuse.ts
4633
- import { createHash as createHash3 } from "crypto";
4219
+ import { createHash as createHash2 } from "crypto";
4634
4220
  var FUSION_ID_PREFIX = "fusion";
4635
4221
  var FUSION_ALGO_VERSION = "2026-07-12-1";
4636
4222
  function canonicalInputsKey(date, inputs) {
@@ -4659,7 +4245,7 @@ function canonicalInputsKey(date, inputs) {
4659
4245
  ])
4660
4246
  ])
4661
4247
  ];
4662
- return createHash3("sha256").update(JSON.stringify(record), "utf-8").digest("hex");
4248
+ return createHash2("sha256").update(JSON.stringify(record), "utf-8").digest("hex");
4663
4249
  }
4664
4250
  function configFingerprint(options, sources) {
4665
4251
  const proximityGapMs = options.proximityGapMs ?? DEFAULT_PROXIMITY_GAP_MS;
@@ -4674,7 +4260,7 @@ function canonicalDayKey(date, inputs, options, algoVersion = FUSION_ALGO_VERSIO
4674
4260
  options,
4675
4261
  inputs.map((conv) => conv.source)
4676
4262
  );
4677
- return createHash3("sha256").update(inputsKey).update("\n").update(fingerprint).update("\n").update(algoVersion).digest("hex");
4263
+ return createHash2("sha256").update(inputsKey).update("\n").update(fingerprint).update("\n").update(algoVersion).digest("hex");
4678
4264
  }
4679
4265
  function buildProvenance(cluster, proximityGapMs, windowToleranceMs) {
4680
4266
  return {
@@ -4734,11 +4320,11 @@ function fuseDay(date, inputs, options = {}) {
4734
4320
  }
4735
4321
 
4736
4322
  // src/wearables/fusion/store.ts
4737
- import { createHash as createHash4 } from "crypto";
4738
- import * as path8 from "path";
4323
+ import { createHash as createHash3 } from "crypto";
4324
+ import * as path7 from "path";
4739
4325
  var FUSION_KIND = "wearable-fusion";
4740
4326
  function hashFusionBody(conversations) {
4741
- return createHash4("sha256").update(JSON.stringify(conversations), "utf-8").digest("hex");
4327
+ return createHash3("sha256").update(JSON.stringify(conversations), "utf-8").digest("hex");
4742
4328
  }
4743
4329
  function composeFusionDayMeta(date, conversations, sources, contentHash, fusedAt) {
4744
4330
  return {
@@ -4922,7 +4508,7 @@ var FusionArtifactStore = class {
4922
4508
  `invalid wearable fusion date '${String(date)}' \u2014 expected YYYY-MM-DD`
4923
4509
  );
4924
4510
  }
4925
- return path8.join(this.wearablesDir, FUSION_DIR_NAME, `${date}.md`);
4511
+ return path7.join(this.wearablesDir, FUSION_DIR_NAME, `${date}.md`);
4926
4512
  }
4927
4513
  async writeFusedDay(date, serialized) {
4928
4514
  const filePath = this.fusedDayPath(date);
@@ -4959,7 +4545,7 @@ var FusionArtifactStore = class {
4959
4545
  }
4960
4546
  /** List dates with stored fused artifacts, newest first. */
4961
4547
  async listFusedDays() {
4962
- const fusionDir = path8.join(this.wearablesDir, FUSION_DIR_NAME);
4548
+ const fusionDir = path7.join(this.wearablesDir, FUSION_DIR_NAME);
4963
4549
  await this.assertPathContained(fusionDir);
4964
4550
  let entries;
4965
4551
  try {
@@ -5003,10 +4589,10 @@ var FusionArtifactStore = class {
5003
4589
  try {
5004
4590
  rootReal = await this.io.realpath(this.memoryDir);
5005
4591
  } catch {
5006
- rootReal = path8.resolve(this.memoryDir);
4592
+ rootReal = path7.resolve(this.memoryDir);
5007
4593
  }
5008
4594
  await this.assertNoEscape(rootReal, this.wearablesDir);
5009
- await this.assertNoEscape(rootReal, path8.dirname(targetPath));
4595
+ await this.assertNoEscape(rootReal, path7.dirname(targetPath));
5010
4596
  await this.assertNoEscape(rootReal, targetPath);
5011
4597
  await this.assertFusionDirNotSymlinked();
5012
4598
  }
@@ -5020,7 +4606,7 @@ var FusionArtifactStore = class {
5020
4606
  * (a fresh write creates a real directory lexically under the root).
5021
4607
  */
5022
4608
  async assertFusionDirNotSymlinked() {
5023
- const fusionDir = path8.join(this.wearablesDir, FUSION_DIR_NAME);
4609
+ const fusionDir = path7.join(this.wearablesDir, FUSION_DIR_NAME);
5024
4610
  let stat3;
5025
4611
  try {
5026
4612
  stat3 = await this.io.lstat(fusionDir);
@@ -5155,8 +4741,8 @@ function reconstructFusionInputs(date, dayTranscripts) {
5155
4741
  }
5156
4742
 
5157
4743
  // src/meetings/store.ts
5158
- import { createHash as createHash5 } from "crypto";
5159
- import * as path9 from "path";
4744
+ import { createHash as createHash4 } from "crypto";
4745
+ import * as path8 from "path";
5160
4746
  var MEETINGS_DIR_NAME = "meetings";
5161
4747
  var MEETING_KIND = "meeting";
5162
4748
  var MEETING_FORMAT_VERSION = 1;
@@ -5186,7 +4772,7 @@ function canonicalContent(base, fused) {
5186
4772
  });
5187
4773
  }
5188
4774
  function composeMeetingRecord(base, fused) {
5189
- const contentHash = createHash5("sha256").update(canonicalContent(base, fused), "utf-8").digest("hex");
4775
+ const contentHash = createHash4("sha256").update(canonicalContent(base, fused), "utf-8").digest("hex");
5190
4776
  return {
5191
4777
  ...base,
5192
4778
  ...fused,
@@ -5325,7 +4911,7 @@ var MeetingRecordStore = class {
5325
4911
  constructor(memoryDir, io) {
5326
4912
  this.memoryDir = memoryDir;
5327
4913
  this.io = io;
5328
- this.meetingsDir = path9.join(memoryDir, MEETINGS_DIR_NAME);
4914
+ this.meetingsDir = path8.join(memoryDir, MEETINGS_DIR_NAME);
5329
4915
  }
5330
4916
  memoryDir;
5331
4917
  io;
@@ -5341,7 +4927,7 @@ var MeetingRecordStore = class {
5341
4927
  if (idDate !== date) {
5342
4928
  throw new Error(`meeting id '${id}' does not belong to date '${date}'`);
5343
4929
  }
5344
- return path9.join(this.meetingsDir, date, `${id}.md`);
4930
+ return path8.join(this.meetingsDir, date, `${id}.md`);
5345
4931
  }
5346
4932
  /** Idempotently persist a record: skip the write when contentHash is unchanged. */
5347
4933
  async saveMeetingRecord(record) {
@@ -5372,7 +4958,7 @@ var MeetingRecordStore = class {
5372
4958
  if (!isValidTranscriptDate(date)) {
5373
4959
  throw new Error(`invalid meeting date '${String(date)}' \u2014 expected YYYY-MM-DD`);
5374
4960
  }
5375
- const dayDir = path9.join(this.meetingsDir, date);
4961
+ const dayDir = path8.join(this.meetingsDir, date);
5376
4962
  await this.assertPathContained(dayDir);
5377
4963
  let entries;
5378
4964
  try {
@@ -5440,10 +5026,10 @@ var MeetingRecordStore = class {
5440
5026
  try {
5441
5027
  rootReal = await this.io.realpath(this.memoryDir);
5442
5028
  } catch {
5443
- rootReal = path9.resolve(this.memoryDir);
5029
+ rootReal = path8.resolve(this.memoryDir);
5444
5030
  }
5445
5031
  await this.assertNoEscape(rootReal, this.meetingsDir);
5446
- await this.assertNoEscape(rootReal, path9.dirname(targetPath));
5032
+ await this.assertNoEscape(rootReal, path8.dirname(targetPath));
5447
5033
  await this.assertNoEscape(rootReal, targetPath);
5448
5034
  await this.assertNotSymlink(this.meetingsDir, "directory");
5449
5035
  const dayDir = this.dayDirWithin(targetPath);
@@ -5453,11 +5039,11 @@ var MeetingRecordStore = class {
5453
5039
  /** The `<meetings>/<date>` directory on the path to `targetPath`, or null when
5454
5040
  * `targetPath` is the meetings root itself. */
5455
5041
  dayDirWithin(targetPath) {
5456
- const rel = path9.relative(this.meetingsDir, targetPath);
5457
- if (rel === "" || rel.startsWith("..") || path9.isAbsolute(rel)) return null;
5458
- const first = rel.split(path9.sep)[0];
5042
+ const rel = path8.relative(this.meetingsDir, targetPath);
5043
+ if (rel === "" || rel.startsWith("..") || path8.isAbsolute(rel)) return null;
5044
+ const first = rel.split(path8.sep)[0];
5459
5045
  if (first === void 0 || first.length === 0) return null;
5460
- return path9.join(this.meetingsDir, first);
5046
+ return path8.join(this.meetingsDir, first);
5461
5047
  }
5462
5048
  async assertNotSymlink(target, kind) {
5463
5049
  let stat3;
@@ -5468,7 +5054,7 @@ var MeetingRecordStore = class {
5468
5054
  throw err;
5469
5055
  }
5470
5056
  if (stat3.isSymbolicLink) {
5471
- const label = path9.relative(this.memoryDir, target) || MEETINGS_DIR_NAME;
5057
+ const label = path8.relative(this.memoryDir, target) || MEETINGS_DIR_NAME;
5472
5058
  throw new Error(
5473
5059
  `meetings ${kind} '${label}' is a symbolic link \u2014 refusing to follow it even when it resolves inside the memory dir (AGENTS.md pattern #3)`
5474
5060
  );
@@ -5492,7 +5078,7 @@ var SORT_STR = (a, b) => a < b ? -1 : a > b ? 1 : 0;
5492
5078
 
5493
5079
  // src/storage/supersession-audit.ts
5494
5080
  import { readdir as readdir5 } from "fs/promises";
5495
- import path10 from "path";
5081
+ import path9 from "path";
5496
5082
  async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody, structuredAttributes) {
5497
5083
  let entries;
5498
5084
  try {
@@ -5503,7 +5089,7 @@ async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody,
5503
5089
  }
5504
5090
  for (const entry of entries) {
5505
5091
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
5506
- const memory = await lookup.readMemoryByPath(path10.join(lookup.correctionsDir, entry.name));
5092
+ const memory = await lookup.readMemoryByPath(path9.join(lookup.correctionsDir, entry.name));
5507
5093
  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(
5508
5094
  ([key, value]) => memory.frontmatter.structuredAttributes?.[key] === value
5509
5095
  ))) {
@@ -5593,7 +5179,7 @@ Reason: ${reason}`;
5593
5179
  }
5594
5180
 
5595
5181
  // src/storage/entity-timeline.ts
5596
- import { createHash as createHash6 } from "crypto";
5182
+ import { createHash as createHash5 } from "crypto";
5597
5183
  function parseEntityTimelineBullet(bullet, fallbackTimestamp) {
5598
5184
  const trimmed = bullet.trim();
5599
5185
  if (!trimmed) return null;
@@ -5965,7 +5551,7 @@ function fingerprintEntityStructuredFacts(entity) {
5965
5551
  (left, right) => left.key.localeCompare(right.key) || left.title.localeCompare(right.title) || left.facts.join("\n").localeCompare(right.facts.join("\n"))
5966
5552
  );
5967
5553
  if (normalizedSections.length === 0) return void 0;
5968
- return createHash6("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5554
+ return createHash5("sha256").update(JSON.stringify(normalizedSections)).digest("hex");
5969
5555
  }
5970
5556
  function isEntitySynthesisStale(entity) {
5971
5557
  const structuredFactCount = countEntityStructuredFacts(entity);
@@ -6512,17 +6098,17 @@ function inferEntityTypeFromContent(content) {
6512
6098
  }
6513
6099
  var KNOWN_ENTITY_FILENAME_PREFIXES = /* @__PURE__ */ new Set(["company", "other", "person", "place", "project", "tool", "topic"]);
6514
6100
  function inferEntityTypeFromFilename(pathRel) {
6515
- const basename = path11.basename(pathRel, ".md").toLowerCase();
6101
+ const basename = path10.basename(pathRel, ".md").toLowerCase();
6516
6102
  const separator = basename.indexOf("-");
6517
6103
  if (separator <= 0) return void 0;
6518
6104
  const candidate = basename.slice(0, separator);
6519
6105
  return KNOWN_ENTITY_FILENAME_PREFIXES.has(candidate) ? candidate : void 0;
6520
6106
  }
6521
6107
  function normalizeFrontmatterForPath(frontmatter, pathRel, content = "") {
6522
- const normalizedPath = pathRel.split(path11.sep).join("/");
6108
+ const normalizedPath = pathRel.split(path10.sep).join("/");
6523
6109
  let normalizedFrontmatter = frontmatter;
6524
6110
  if (normalizedPath === "entities" || normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/")) {
6525
- const basename = path11.basename(pathRel, ".md");
6111
+ const basename = path10.basename(pathRel, ".md");
6526
6112
  const inferredType = inferEntityTypeFromContent(content) || inferEntityTypeFromFilename(pathRel) || "entity";
6527
6113
  const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
6528
6114
  normalizedFrontmatter = {
@@ -6989,9 +6575,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
6989
6575
  this.entitySchemas = entitySchemas;
6990
6576
  this.deletionRevisionStore = new DeletionRevisionStore({
6991
6577
  baseDir,
6992
- deletionRevisionMetadataPath: path11.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6993
- invalidationCommitMetadataPath: path11.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6994
- deletionRevisionLockPath: path11.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6578
+ deletionRevisionMetadataPath: path10.join(baseDir, ".offline-sync", "deletion-revisions.v1.json"),
6579
+ invalidationCommitMetadataPath: path10.join(baseDir, ".offline-sync", "invalidation-commits.v1.json"),
6580
+ deletionRevisionLockPath: path10.join(baseDir, ".offline-sync", "deletion-revisions.v1.json.lock"),
6995
6581
  assertManagedStoragePath: (filePath, method) => this.assertManagedStoragePath(filePath, method)
6996
6582
  });
6997
6583
  this.hotMemoriesCacheEnabled = hotMemoriesCacheEnabledOverride ?? _StorageManager.hotMemoriesCacheDefaultByDir.get(baseDir) ?? _StorageManager.hotMemoriesCacheDefault;
@@ -7179,8 +6765,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7179
6765
  }
7180
6766
  /** Whether `filePath` resolves to `stateDir` itself or a path contained in it. */
7181
6767
  isStateFilePath(filePath) {
7182
- const rel = path11.relative(this.stateDir, path11.resolve(filePath));
7183
- return rel === "" || !rel.startsWith("..") && !path11.isAbsolute(rel);
6768
+ const rel = path10.relative(this.stateDir, path10.resolve(filePath));
6769
+ return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
7184
6770
  }
7185
6771
  // ── Tombstone store (issue #1579) ───────────────────────────────────────
7186
6772
  // Instance-scoped (rule 11) + namespace-scoped (rule 42) tombstone index.
@@ -7295,8 +6881,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7295
6881
  * /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
7296
6882
  */
7297
6883
  isColdOrArchiveTierPath(p) {
7298
- const rel = path11.relative(this.baseDir, p);
7299
- return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path11.sep}`) || rel.startsWith(`archive${path11.sep}`);
6884
+ const rel = path10.relative(this.baseDir, p);
6885
+ return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path10.sep}`) || rel.startsWith(`archive${path10.sep}`);
7300
6886
  }
7301
6887
  /**
7302
6888
  * Mark the secure-store as required for this storage instance.
@@ -7383,7 +6969,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7383
6969
  void 0,
7384
6970
  this.baseDir
7385
6971
  );
7386
- const rel = path11.relative(this.baseDir, filePath).split(path11.sep).join("/");
6972
+ const rel = path10.relative(this.baseDir, filePath).split(path10.sep).join("/");
7387
6973
  return `${rel}:${version.versionId}`;
7388
6974
  } catch (err) {
7389
6975
  log.warn(
@@ -7463,12 +7049,12 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7463
7049
  }
7464
7050
  identityFilePath(workspaceDir, namespace) {
7465
7051
  const rawNamespace = typeof namespace === "string" ? namespace.trim() : "";
7466
- if (!rawNamespace) return path11.join(workspaceDir, "IDENTITY.md");
7052
+ if (!rawNamespace) return path10.join(workspaceDir, "IDENTITY.md");
7467
7053
  const safeNamespace = rawNamespace.replace(/[^a-zA-Z0-9._-]/g, "-");
7468
- return path11.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
7054
+ return path10.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
7469
7055
  }
7470
7056
  versionFilePath(kind) {
7471
- return path11.join(this.stateDir, `.${kind}-version.log`);
7057
+ return path10.join(this.stateDir, `.${kind}-version.log`);
7472
7058
  }
7473
7059
  bumpSharedVersion(kind, fallbackMap) {
7474
7060
  const filePath = this.versionFilePath(kind);
@@ -7572,7 +7158,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7572
7158
  // memories.
7573
7159
  // -------------------------------------------------------------------------
7574
7160
  get wearablesDir() {
7575
- return path11.join(this.baseDir, WEARABLES_DIR_NAME);
7161
+ return path10.join(this.baseDir, WEARABLES_DIR_NAME);
7576
7162
  }
7577
7163
  /**
7578
7164
  * Resolve the on-disk path for a source/day transcript. Throws on
@@ -7588,7 +7174,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7588
7174
  if (!isValidTranscriptDate(date)) {
7589
7175
  throw new Error(`invalid wearable transcript date '${String(date)}' \u2014 expected YYYY-MM-DD`);
7590
7176
  }
7591
- return path11.join(this.wearablesDir, sourceId, `${date}.md`);
7177
+ return path10.join(this.wearablesDir, sourceId, `${date}.md`);
7592
7178
  }
7593
7179
  async writeWearableDayTranscript(sourceId, date, serialized) {
7594
7180
  const targetPath = this.wearableTranscriptPath(sourceId, date);
@@ -7615,9 +7201,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7615
7201
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7616
7202
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7617
7203
  readDir: (d) => readdir6(d),
7618
- deleteFile: (p) => unlink5(p),
7204
+ deleteFile: (p) => unlink4(p),
7619
7205
  realpath: (p) => realpath3(p),
7620
- lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7206
+ lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7621
7207
  });
7622
7208
  }
7623
7209
  _meetingRecordStore;
@@ -7633,9 +7219,9 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7633
7219
  writeFile: (p, c) => this.writeStorageSecureFile(p, c),
7634
7220
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7635
7221
  readDir: (d) => readdir6(d),
7636
- deleteFile: (p) => unlink5(p),
7222
+ deleteFile: (p) => unlink4(p),
7637
7223
  realpath: (p) => realpath3(p),
7638
- lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7224
+ lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7639
7225
  });
7640
7226
  }
7641
7227
  /**
@@ -7704,25 +7290,25 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7704
7290
  });
7705
7291
  }
7706
7292
  get factsDir() {
7707
- return path11.join(this.baseDir, "facts");
7293
+ return path10.join(this.baseDir, "facts");
7708
7294
  }
7709
7295
  get correctionsDir() {
7710
- return path11.join(this.baseDir, "corrections");
7296
+ return path10.join(this.baseDir, "corrections");
7711
7297
  }
7712
7298
  get proceduresDir() {
7713
- return path11.join(this.baseDir, "procedures");
7299
+ return path10.join(this.baseDir, "procedures");
7714
7300
  }
7715
7301
  get reasoningTracesDir() {
7716
- return path11.join(this.baseDir, "reasoning-traces");
7302
+ return path10.join(this.baseDir, "reasoning-traces");
7717
7303
  }
7718
7304
  get entitiesDir() {
7719
- return path11.join(this.baseDir, "entities");
7305
+ return path10.join(this.baseDir, "entities");
7720
7306
  }
7721
7307
  resolveEntityFilePath(name) {
7722
7308
  if (typeof name !== "string") return null;
7723
- const filePath = path11.resolve(this.entitiesDir, `${name}.md`);
7724
- const relative2 = path11.relative(this.entitiesDir, filePath);
7725
- if (relative2 === "" || relative2.startsWith("..") || path11.isAbsolute(relative2)) {
7309
+ const filePath = path10.resolve(this.entitiesDir, `${name}.md`);
7310
+ const relative2 = path10.relative(this.entitiesDir, filePath);
7311
+ if (relative2 === "" || relative2.startsWith("..") || path10.isAbsolute(relative2)) {
7726
7312
  return null;
7727
7313
  }
7728
7314
  return filePath;
@@ -7733,7 +7319,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7733
7319
  async readDependencyPropagationQueueFile(filePath) {
7734
7320
  const target = await resolveSafeStoragePath(
7735
7321
  this.baseDir,
7736
- path11.relative(
7322
+ path10.relative(
7737
7323
  this.baseDir,
7738
7324
  this.assertManagedStoragePath(filePath, "storage.readDependencyPropagationQueueFile")
7739
7325
  )
@@ -7743,7 +7329,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7743
7329
  async writeDependencyPropagationQueueFile(filePath, content) {
7744
7330
  const target = await resolveSafeStoragePath(
7745
7331
  this.baseDir,
7746
- path11.relative(
7332
+ path10.relative(
7747
7333
  this.baseDir,
7748
7334
  this.assertManagedStoragePath(filePath, "storage.writeDependencyPropagationQueueFile")
7749
7335
  )
@@ -7757,10 +7343,10 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7757
7343
  });
7758
7344
  }
7759
7345
  assertManagedStoragePath(filePath, method) {
7760
- const resolved = path11.resolve(filePath);
7761
- const base = path11.resolve(this.baseDir);
7762
- const rel = path11.relative(base, resolved);
7763
- if (rel === "" || rel === ".." || rel.startsWith(`..${path11.sep}`) || path11.isAbsolute(rel)) {
7346
+ const resolved = path10.resolve(filePath);
7347
+ const base = path10.resolve(this.baseDir);
7348
+ const rel = path10.relative(base, resolved);
7349
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path10.sep}`) || path10.isAbsolute(rel)) {
7764
7350
  throw new Error(`${method}: file path escapes memory dir`);
7765
7351
  }
7766
7352
  return resolved;
@@ -7793,7 +7379,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7793
7379
  async digestOfflineSyncFile(filePath) {
7794
7380
  const target = this.assertManagedStoragePath(filePath, "storage.digestOfflineSyncFile");
7795
7381
  const st = await stat2(target);
7796
- const relPath = path11.relative(this.baseDir, target).split(path11.sep).join("/");
7382
+ const relPath = path10.relative(this.baseDir, target).split(path10.sep).join("/");
7797
7383
  const cache = await this.loadOfflineSyncDigestCache();
7798
7384
  const cached = cache.get(relPath);
7799
7385
  if (cached && cached.statBytes === st.size && cached.mtimeMs === st.mtimeMs && cached.ctimeMs === st.ctimeMs && !cached.encrypted) {
@@ -7807,11 +7393,11 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7807
7393
  if (encrypted) {
7808
7394
  const content = await readMaybeEncryptedFileBuffer(target, this._secureStoreKey, this.baseDir);
7809
7395
  digest = {
7810
- sha256: createHash7("sha256").update(content).digest("hex"),
7396
+ sha256: createHash6("sha256").update(content).digest("hex"),
7811
7397
  bytes: content.byteLength
7812
7398
  };
7813
7399
  } else {
7814
- const hash = createHash7("sha256");
7400
+ const hash = createHash6("sha256");
7815
7401
  let bytes = 0;
7816
7402
  for await (const rawChunk of createReadStream(target)) {
7817
7403
  const chunk = Buffer.isBuffer(rawChunk) ? rawChunk : Buffer.from(rawChunk);
@@ -7839,7 +7425,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7839
7425
  async readOfflineSyncDigestCache() {
7840
7426
  const cache = /* @__PURE__ */ new Map();
7841
7427
  try {
7842
- const raw = await readFile3(this.offlineSyncDigestCachePath, "utf-8");
7428
+ const raw = await readFile2(this.offlineSyncDigestCachePath, "utf-8");
7843
7429
  const parsed = JSON.parse(raw);
7844
7430
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return cache;
7845
7431
  const entries = parsed.entries;
@@ -7854,7 +7440,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7854
7440
  const bytes = typeof record.bytes === "number" ? record.bytes : NaN;
7855
7441
  const sha256 = typeof record.sha256 === "string" ? record.sha256 : "";
7856
7442
  const encrypted = record.encrypted === true;
7857
- if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") || path11.isAbsolute(cachePath) || !Number.isFinite(statBytes) || !Number.isFinite(mtimeMs) || !Number.isFinite(ctimeMs) || !Number.isFinite(bytes) || !/^[a-f0-9]{64}$/i.test(sha256)) {
7443
+ if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") || path10.isAbsolute(cachePath) || !Number.isFinite(statBytes) || !Number.isFinite(mtimeMs) || !Number.isFinite(ctimeMs) || !Number.isFinite(bytes) || !/^[a-f0-9]{64}$/i.test(sha256)) {
7858
7444
  continue;
7859
7445
  }
7860
7446
  cache.set(cachePath, { statBytes, mtimeMs, ctimeMs, encrypted, sha256, bytes });
@@ -7896,7 +7482,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7896
7482
  const cache = this.offlineSyncDigestCache;
7897
7483
  if (!cache) return;
7898
7484
  const entries = [...cache.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([entryPath, entry]) => ({ path: entryPath, ...entry }));
7899
- await mkdir2(path11.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7485
+ await mkdir(path10.dirname(this.offlineSyncDigestCachePath), { recursive: true });
7900
7486
  await writeFile2(this.offlineSyncDigestCachePath, `${JSON.stringify({ version: 1, entries })}
7901
7487
  `, "utf-8");
7902
7488
  }).catch((err) => {
@@ -7906,7 +7492,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7906
7492
  });
7907
7493
  }
7908
7494
  async offlineSyncFileIsEncrypted(filePath) {
7909
- const handle = await open2(filePath, "r");
7495
+ const handle = await open(filePath, "r");
7910
7496
  try {
7911
7497
  const header = Buffer.alloc(MAGIC_HEADER_SIZE);
7912
7498
  const { bytesRead } = await handle.read(header, 0, header.length, 0);
@@ -7965,7 +7551,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7965
7551
  }
7966
7552
  let handle;
7967
7553
  try {
7968
- handle = await open2(filePath, "r");
7554
+ handle = await open(filePath, "r");
7969
7555
  } catch (err) {
7970
7556
  if (isErrnoCode(err, "ENOENT")) return false;
7971
7557
  throw err;
@@ -7985,7 +7571,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7985
7571
  }
7986
7572
  async appendStorageSecureFileUnlocked(filePath, content) {
7987
7573
  const writeKey = this.resolveWriteKey();
7988
- await mkdir2(path11.dirname(filePath), { recursive: true });
7574
+ await mkdir(path10.dirname(filePath), { recursive: true });
7989
7575
  if (writeKey === null) {
7990
7576
  try {
7991
7577
  if (await this.isEncryptedFileHeader(filePath)) {
@@ -8011,13 +7597,13 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8011
7597
  this.notifyCatalogWriteForPath(filePath);
8012
7598
  }
8013
7599
  get stateDir() {
8014
- return path11.join(this.baseDir, "state");
7600
+ return path10.join(this.baseDir, "state");
8015
7601
  }
8016
7602
  get offlineSyncDigestCachePath() {
8017
- return path11.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
7603
+ return path10.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
8018
7604
  }
8019
7605
  get entitySynthesisQueuePath() {
8020
- return path11.join(this.stateDir, "entity-synthesis-queue.json");
7606
+ return path10.join(this.stateDir, "entity-synthesis-queue.json");
8021
7607
  }
8022
7608
  // ── Tombstone store access (issue #1579) ─────────────────────────────────
8023
7609
  /**
@@ -8027,7 +7613,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8027
7613
  * helpers are injected into the store).
8028
7614
  */
8029
7615
  get tombstonesPath() {
8030
- return path11.join(this.stateDir, "tombstones.jsonl");
7616
+ return path10.join(this.stateDir, "tombstones.jsonl");
8031
7617
  }
8032
7618
  /**
8033
7619
  * Configure the tombstone invariant for this storage instance. Installed
@@ -8057,7 +7643,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8057
7643
  const requested = new Set(sourceMemoryIds);
8058
7644
  const sourcePaths = await (sourcePathsPromise ??= this.memoryReadStore.collectTombstoneMigrationPaths());
8059
7645
  const directPaths = sourcePaths.filter(
8060
- (filePath) => requested.has(path11.basename(filePath, ".md"))
7646
+ (filePath) => requested.has(path10.basename(filePath, ".md"))
8061
7647
  );
8062
7648
  const contents = /* @__PURE__ */ new Map();
8063
7649
  for (const memory of await this.readParsedMemoriesFromPaths(directPaths, 50)) {
@@ -8351,55 +7937,55 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8351
7937
  return legacyMatches.length > 0 ? [...new Set(legacyMatches.map((content) => ContentHashIndex.computeHash(content)))] : [persistedHash];
8352
7938
  }
8353
7939
  get questionsDir() {
8354
- return path11.join(this.baseDir, "questions");
7940
+ return path10.join(this.baseDir, "questions");
8355
7941
  }
8356
7942
  get artifactsDir() {
8357
- return path11.join(this.baseDir, "artifacts");
7943
+ return path10.join(this.baseDir, "artifacts");
8358
7944
  }
8359
7945
  get identityDir() {
8360
- return path11.join(this.baseDir, "identity");
7946
+ return path10.join(this.baseDir, "identity");
8361
7947
  }
8362
7948
  get identityAnchorPath() {
8363
- return path11.join(this.identityDir, "identity-anchor.md");
7949
+ return path10.join(this.identityDir, "identity-anchor.md");
8364
7950
  }
8365
7951
  get identityIncidentsDir() {
8366
- return path11.join(this.identityDir, "incidents");
7952
+ return path10.join(this.identityDir, "incidents");
8367
7953
  }
8368
7954
  get identityAuditsWeeklyDir() {
8369
- return path11.join(this.identityDir, "audits", "weekly");
7955
+ return path10.join(this.identityDir, "audits", "weekly");
8370
7956
  }
8371
7957
  get identityAuditsMonthlyDir() {
8372
- return path11.join(this.identityDir, "audits", "monthly");
7958
+ return path10.join(this.identityDir, "audits", "monthly");
8373
7959
  }
8374
7960
  get identityImprovementLoopsPath() {
8375
- return path11.join(this.identityDir, "improvement-loops.md");
7961
+ return path10.join(this.identityDir, "improvement-loops.md");
8376
7962
  }
8377
7963
  get identityReflectionsPath() {
8378
- return path11.join(this.identityDir, "reflections.md");
7964
+ return path10.join(this.identityDir, "reflections.md");
8379
7965
  }
8380
7966
  get profilePath() {
8381
- return path11.join(this.baseDir, "profile.md");
7967
+ return path10.join(this.baseDir, "profile.md");
8382
7968
  }
8383
7969
  get memoryActionsPath() {
8384
- return path11.join(this.stateDir, "memory-actions.jsonl");
7970
+ return path10.join(this.stateDir, "memory-actions.jsonl");
8385
7971
  }
8386
7972
  get memoryLifecycleLedgerPath() {
8387
- return path11.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
7973
+ return path10.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
8388
7974
  }
8389
7975
  get compressionGuidelinesPath() {
8390
- return path11.join(this.stateDir, "compression-guidelines.md");
7976
+ return path10.join(this.stateDir, "compression-guidelines.md");
8391
7977
  }
8392
7978
  get compressionGuidelineDraftPath() {
8393
- return path11.join(this.stateDir, "compression-guidelines.draft.md");
7979
+ return path10.join(this.stateDir, "compression-guidelines.draft.md");
8394
7980
  }
8395
7981
  get compressionGuidelineStatePath() {
8396
- return path11.join(this.stateDir, "compression-guideline-state.json");
7982
+ return path10.join(this.stateDir, "compression-guideline-state.json");
8397
7983
  }
8398
7984
  get compressionGuidelineDraftStatePath() {
8399
- return path11.join(this.stateDir, "compression-guideline-draft-state.json");
7985
+ return path10.join(this.stateDir, "compression-guideline-draft-state.json");
8400
7986
  }
8401
7987
  get behaviorSignalsPath() {
8402
- return path11.join(this.stateDir, "behavior-signals.jsonl");
7988
+ return path10.join(this.stateDir, "behavior-signals.jsonl");
8403
7989
  }
8404
7990
  /**
8405
7991
  * In-memory dedup key set for behavior-signals appends (issue #1909),
@@ -8431,7 +8017,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8431
8017
  * governance sweeps can treat it uniformly.
8432
8018
  */
8433
8019
  get bufferSurpriseLedgerPath() {
8434
- return path11.join(this.stateDir, "buffer-surprise-ledger.jsonl");
8020
+ return path10.join(this.stateDir, "buffer-surprise-ledger.jsonl");
8435
8021
  }
8436
8022
  /**
8437
8023
  * Entity alias table loaded from THIS store's config/aliases.json.
@@ -8492,7 +8078,7 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8492
8078
  this.loadAliasesSync();
8493
8079
  }
8494
8080
  loadAliasesSync() {
8495
- const aliasPath = path11.join(this.baseDir, "config", "aliases.json");
8081
+ const aliasPath = path10.join(this.baseDir, "config", "aliases.json");
8496
8082
  this.userAliases = {};
8497
8083
  const raw = readEntityAliasConfigSync(this.baseDir);
8498
8084
  if (raw === void 0) return;
@@ -8527,22 +8113,22 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8527
8113
  return completionFingerprint;
8528
8114
  }
8529
8115
  async ensureDirectories() {
8530
- await mkdir2(this.baseDir, { recursive: true });
8116
+ await mkdir(this.baseDir, { recursive: true });
8531
8117
  await validateRoots(this.baseDir, this.entitiesDir, this.stateDir, this.archiveDir);
8532
8118
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
8533
- await mkdir2(path11.join(this.factsDir, today), { recursive: true });
8534
- await mkdir2(path11.join(this.proceduresDir, today), { recursive: true });
8535
- await mkdir2(path11.join(this.reasoningTracesDir, today), { recursive: true });
8536
- await mkdir2(this.correctionsDir, { recursive: true });
8537
- await mkdir2(this.entitiesDir, { recursive: true });
8538
- await mkdir2(this.stateDir, { recursive: true });
8539
- await mkdir2(this.questionsDir, { recursive: true });
8540
- await mkdir2(this.artifactsDir, { recursive: true });
8541
- await mkdir2(this.identityDir, { recursive: true });
8542
- await mkdir2(this.identityIncidentsDir, { recursive: true });
8543
- await mkdir2(this.identityAuditsWeeklyDir, { recursive: true });
8544
- await mkdir2(this.identityAuditsMonthlyDir, { recursive: true });
8545
- await mkdir2(path11.join(this.baseDir, "config"), { recursive: true });
8119
+ await mkdir(path10.join(this.factsDir, today), { recursive: true });
8120
+ await mkdir(path10.join(this.proceduresDir, today), { recursive: true });
8121
+ await mkdir(path10.join(this.reasoningTracesDir, today), { recursive: true });
8122
+ await mkdir(this.correctionsDir, { recursive: true });
8123
+ await mkdir(this.entitiesDir, { recursive: true });
8124
+ await mkdir(this.stateDir, { recursive: true });
8125
+ await mkdir(this.questionsDir, { recursive: true });
8126
+ await mkdir(this.artifactsDir, { recursive: true });
8127
+ await mkdir(this.identityDir, { recursive: true });
8128
+ await mkdir(this.identityIncidentsDir, { recursive: true });
8129
+ await mkdir(this.identityAuditsWeeklyDir, { recursive: true });
8130
+ await mkdir(this.identityAuditsMonthlyDir, { recursive: true });
8131
+ await mkdir(path10.join(this.baseDir, "config"), { recursive: true });
8546
8132
  await this.entityCanonicalIdMigration.ensure();
8547
8133
  if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
8548
8134
  this.bumpMemoryCorpusVersion();
@@ -8563,12 +8149,12 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
8563
8149
  */
8564
8150
  async resolveCategoryWritePath(category, id, today) {
8565
8151
  if (category === "correction") {
8566
- await mkdir2(this.correctionsDir, { recursive: true });
8567
- return path11.join(this.correctionsDir, `${id}.md`);
8152
+ await mkdir(this.correctionsDir, { recursive: true });
8153
+ return path10.join(this.correctionsDir, `${id}.md`);
8568
8154
  }
8569
- const datedDir = path11.join(getCategoryDir(this.baseDir, category), today);
8570
- await mkdir2(datedDir, { recursive: true });
8571
- return path11.join(datedDir, `${id}.md`);
8155
+ const datedDir = path10.join(getCategoryDir(this.baseDir, category), today);
8156
+ await mkdir(datedDir, { recursive: true });
8157
+ return path10.join(datedDir, `${id}.md`);
8572
8158
  }
8573
8159
  async findExistingTombstoneBlockedMemory(content, category, sourceConnector) {
8574
8160
  const identity = buildExplicitCaptureDedupKey(content, category, sourceConnector);
@@ -8730,7 +8316,7 @@ ${sanitized.text}
8730
8316
  }
8731
8317
  });
8732
8318
  } catch (err) {
8733
- await unlink5(filePath).catch(() => void 0);
8319
+ await unlink4(filePath).catch(() => void 0);
8734
8320
  this.invalidateAllMemoriesCache();
8735
8321
  await this.rebuildTombstoneBlockedCaptureAfterInvalidationForPath(filePath);
8736
8322
  throw err;
@@ -8933,8 +8519,8 @@ ${sanitized.text}
8933
8519
  await this.ensureDirectories();
8934
8520
  const now = /* @__PURE__ */ new Date();
8935
8521
  const day = now.toISOString().slice(0, 10);
8936
- const dir = path11.join(this.artifactsDir, day);
8937
- await mkdir2(dir, { recursive: true });
8522
+ const dir = path10.join(this.artifactsDir, day);
8523
+ await mkdir(dir, { recursive: true });
8938
8524
  const id = `artifact-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
8939
8525
  const fm = {
8940
8526
  id,
@@ -8959,7 +8545,7 @@ ${sanitized.text}
8959
8545
  log.warn(`artifact content rejected for ${id}; violations=${sanitized.violations.join(", ")}`);
8960
8546
  return "";
8961
8547
  }
8962
- const filePath = path11.join(dir, `${id}.md`);
8548
+ const filePath = path10.join(dir, `${id}.md`);
8963
8549
  await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(fm)}
8964
8550
 
8965
8551
  ${sanitized.text}
@@ -9247,7 +8833,7 @@ ${sanitized.text}
9247
8833
  * per-process in-memory cache safe across process boundaries.
9248
8834
  */
9249
8835
  invalidateColdMemoriesCache() {
9250
- const coldRoot = path11.join(this.baseDir, "cold");
8836
+ const coldRoot = path10.join(this.baseDir, "cold");
9251
8837
  _StorageManager.coldMemoriesCache.delete(coldRoot);
9252
8838
  this.bumpColdWriteVersion();
9253
8839
  invalidateAllForDir(this.baseDir);
@@ -9367,7 +8953,7 @@ ${sanitized.text}
9367
8953
  const correctionPaths = [];
9368
8954
  const factPaths = [];
9369
8955
  for (const filePath of filePaths) {
9370
- if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path11.sep}`)) {
8956
+ if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path10.sep}`)) {
9371
8957
  correctionPaths.push(filePath);
9372
8958
  } else {
9373
8959
  factPaths.push(filePath);
@@ -9430,7 +9016,7 @@ ${sanitized.text}
9430
9016
  try {
9431
9017
  const entries = await readdir6(dir, { withFileTypes: true });
9432
9018
  for (const entry of entries) {
9433
- const fullPath = path11.join(dir, entry.name);
9019
+ const fullPath = path10.join(dir, entry.name);
9434
9020
  if (entry.isDirectory()) {
9435
9021
  await readDir(fullPath);
9436
9022
  } else if (entry.name.endsWith(".md")) {
@@ -9473,7 +9059,7 @@ ${sanitized.text}
9473
9059
  return this.rememberMemorySnapshot(await this.memoryReadStore.readMemoryByPath(filePath));
9474
9060
  }
9475
9061
  resolveTierRootDir(tier) {
9476
- return tier === "cold" ? path11.join(this.baseDir, "cold") : this.baseDir;
9062
+ return tier === "cold" ? path10.join(this.baseDir, "cold") : this.baseDir;
9477
9063
  }
9478
9064
  resolveMemoryDateDir(memory) {
9479
9065
  const preferred = memory.frontmatter.created || memory.frontmatter.updated;
@@ -9488,13 +9074,13 @@ ${sanitized.text}
9488
9074
  buildTierMemoryPath(memory, tier) {
9489
9075
  const root = this.resolveTierRootDir(tier);
9490
9076
  if (this.isArtifactMemory(memory)) {
9491
- return path11.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9077
+ return path10.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9492
9078
  }
9493
9079
  if (memory.frontmatter.category === "correction") {
9494
- return path11.join(root, "corrections", `${memory.frontmatter.id}.md`);
9080
+ return path10.join(root, "corrections", `${memory.frontmatter.id}.md`);
9495
9081
  }
9496
9082
  const dir = categoryDirName(memory.frontmatter.category);
9497
- return path11.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9083
+ return path10.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
9498
9084
  }
9499
9085
  async writeMemoryFileAtomic(targetPath, memory) {
9500
9086
  const refIdsAtWrite = this.currentHistoricalIds();
@@ -9510,7 +9096,7 @@ ${memory.content}
9510
9096
  {},
9511
9097
  this.baseDir
9512
9098
  );
9513
- const priorDest = await readFile3(targetPath).catch(() => null);
9099
+ const priorDest = await readFile2(targetPath).catch(() => null);
9514
9100
  await persist();
9515
9101
  if (typeof rawRef === "string") {
9516
9102
  const refBeforeRepair = frontmatter.entityRef;
@@ -9525,7 +9111,7 @@ ${memory.content}
9525
9111
  });
9526
9112
  } catch (err) {
9527
9113
  if (priorDest === null) {
9528
- await unlink5(targetPath).catch(() => void 0);
9114
+ await unlink4(targetPath).catch(() => void 0);
9529
9115
  } else {
9530
9116
  await writeFile2(targetPath, priorDest).catch(() => void 0);
9531
9117
  }
@@ -9572,8 +9158,8 @@ ${memory.content}
9572
9158
  memory.frontmatter.entityRef = current.frontmatter.entityRef;
9573
9159
  }
9574
9160
  durable = true;
9575
- const sourcePath = path11.resolve(current.path);
9576
- const destPath = path11.resolve(targetPath);
9161
+ const sourcePath = path10.resolve(current.path);
9162
+ const destPath = path10.resolve(targetPath);
9577
9163
  if (sourcePath !== destPath) {
9578
9164
  await recordArchiveDelete2(this.baseDir, current.path, () => this.deleteManagedStorageFile(current.path));
9579
9165
  this.invalidateAllMemoriesCache();
@@ -9597,8 +9183,8 @@ ${memory.content}
9597
9183
  }
9598
9184
  async migrateMemoryToTier(memory, targetTier) {
9599
9185
  const targetPath = this.buildTierMemoryPath(memory, targetTier);
9600
- const sourcePath = path11.resolve(memory.path);
9601
- const destPath = path11.resolve(targetPath);
9186
+ const sourcePath = path10.resolve(memory.path);
9187
+ const destPath = path10.resolve(targetPath);
9602
9188
  if (sourcePath === destPath) {
9603
9189
  return { changed: false, targetPath };
9604
9190
  }
@@ -9608,7 +9194,7 @@ ${memory.content}
9608
9194
  return { changed, targetPath };
9609
9195
  }
9610
9196
  get archiveDir() {
9611
- return path11.join(this.baseDir, "archive");
9197
+ return path10.join(this.baseDir, "archive");
9612
9198
  }
9613
9199
  /**
9614
9200
  * Archive a memory by moving it from facts/ to archive/YYYY-MM-DD/.
@@ -9621,8 +9207,8 @@ ${memory.content}
9621
9207
  try {
9622
9208
  const now = lifecycle?.at ?? /* @__PURE__ */ new Date();
9623
9209
  const today = now.toISOString().slice(0, 10);
9624
- const destDir = path11.join(this.archiveDir, today);
9625
- await mkdir2(destDir, { recursive: true });
9210
+ const destDir = path10.join(this.archiveDir, today);
9211
+ await mkdir(destDir, { recursive: true });
9626
9212
  const refIdsAtWrite = this.currentHistoricalIds();
9627
9213
  const updatedFm = canonicalizeEntityRefOption(
9628
9214
  {
@@ -9637,7 +9223,7 @@ ${memory.content}
9637
9223
 
9638
9224
  ${current.content}
9639
9225
  `;
9640
- const destPath = path11.join(destDir, path11.basename(current.path));
9226
+ const destPath = path10.join(destDir, path10.basename(current.path));
9641
9227
  const priorDest = await this.readStorageSecureFile(destPath).catch(() => null);
9642
9228
  await recordArchiveWrite(this.baseDir, destPath, () => this.writeStorageSecureFile(destPath, fileContent));
9643
9229
  if (typeof current.frontmatter.entityRef === "string") {
@@ -9654,7 +9240,7 @@ ${current.content}
9654
9240
  await recordArchiveDelete2(
9655
9241
  this.baseDir,
9656
9242
  destPath,
9657
- () => unlink5(destPath).then(
9243
+ () => unlink4(destPath).then(
9658
9244
  () => true,
9659
9245
  () => false
9660
9246
  )
@@ -9870,7 +9456,7 @@ ${memory.content}
9870
9456
  `;
9871
9457
  await this.writeTombstoneBlockedFrontmatter(memory, fileContent, updated, async () => {
9872
9458
  this.invalidateAllMemoriesCache();
9873
- if (memory.path.includes(`${path11.sep}cold${path11.sep}`)) {
9459
+ if (memory.path.includes(`${path10.sep}cold${path10.sep}`)) {
9874
9460
  this.invalidateColdMemoriesCache();
9875
9461
  }
9876
9462
  });
@@ -9881,7 +9467,7 @@ ${memory.content}
9881
9467
  });
9882
9468
  }
9883
9469
  await this.patchHotMemoriesCache({ addedPath: memory.path });
9884
- if (memory.path.includes(`${path11.sep}cold${path11.sep}`)) {
9470
+ if (memory.path.includes(`${path10.sep}cold${path10.sep}`)) {
9885
9471
  this.invalidateColdMemoriesCache();
9886
9472
  }
9887
9473
  try {
@@ -9962,7 +9548,7 @@ ${memory.content}
9962
9548
  return deleted;
9963
9549
  }
9964
9550
  async loadBuffer() {
9965
- const bufferPath = path11.join(this.stateDir, "buffer.json");
9551
+ const bufferPath = path10.join(this.stateDir, "buffer.json");
9966
9552
  try {
9967
9553
  const raw = await this.readStorageSecureFile(bufferPath);
9968
9554
  return JSON.parse(raw);
@@ -9974,11 +9560,11 @@ ${memory.content}
9974
9560
  }
9975
9561
  async saveBuffer(state) {
9976
9562
  await this.ensureDirectories();
9977
- const bufferPath = path11.join(this.stateDir, "buffer.json");
9563
+ const bufferPath = path10.join(this.stateDir, "buffer.json");
9978
9564
  await this.writeStorageSecureFile(bufferPath, JSON.stringify(state, null, 2));
9979
9565
  }
9980
9566
  async loadMeta() {
9981
- const metaPath = path11.join(this.stateDir, "meta.json");
9567
+ const metaPath = path10.join(this.stateDir, "meta.json");
9982
9568
  try {
9983
9569
  const raw = await this.readStorageSecureFile(metaPath);
9984
9570
  const parsed = JSON.parse(raw);
@@ -10011,7 +9597,7 @@ ${memory.content}
10011
9597
  }
10012
9598
  async saveMeta(state) {
10013
9599
  await this.ensureDirectories();
10014
- const metaPath = path11.join(this.stateDir, "meta.json");
9600
+ const metaPath = path10.join(this.stateDir, "meta.json");
10015
9601
  await this.writeStorageSecureFile(metaPath, JSON.stringify(state, null, 2));
10016
9602
  }
10017
9603
  async appendMemoryActionEvents(events) {
@@ -10075,7 +9661,7 @@ ${memory.content}
10075
9661
  },
10076
9662
  (payload) => this.appendStorageSecureFile(target, payload),
10077
9663
  async () => {
10078
- await mkdir2(path11.dirname(target), { recursive: true });
9664
+ await mkdir(path10.dirname(target), { recursive: true });
10079
9665
  }
10080
9666
  );
10081
9667
  }
@@ -10173,7 +9759,7 @@ ${memory.content}
10173
9759
  async appendReextractJobs(events) {
10174
9760
  if (events.length === 0) return 0;
10175
9761
  await this.ensureDirectories();
10176
- const filePath = path11.join(this.stateDir, "reextract-jobs.jsonl");
9762
+ const filePath = path10.join(this.stateDir, "reextract-jobs.jsonl");
10177
9763
  const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
10178
9764
  try {
10179
9765
  await this.appendStorageSecureFile(filePath, lines);
@@ -10186,7 +9772,7 @@ ${memory.content}
10186
9772
  }
10187
9773
  async readReextractJobs(limit = 200) {
10188
9774
  const safeLimit = Number.isFinite(limit) ? Math.max(1, Math.min(1e3, Math.floor(limit))) : 200;
10189
- const filePath = path11.join(this.stateDir, "reextract-jobs.jsonl");
9775
+ const filePath = path10.join(this.stateDir, "reextract-jobs.jsonl");
10190
9776
  try {
10191
9777
  const raw = await this.readStorageSecureFile(filePath);
10192
9778
  const lines = raw.split("\n").filter((line) => line.trim().length > 0);
@@ -10335,7 +9921,7 @@ ${memory.content}
10335
9921
  return false;
10336
9922
  }
10337
9923
  if (draftState.contentHash) {
10338
- const contentHash = createHash7("sha256").update(draftContent).digest("hex");
9924
+ const contentHash = createHash6("sha256").update(draftContent).digest("hex");
10339
9925
  if (contentHash !== draftState.contentHash) return false;
10340
9926
  }
10341
9927
  await this.writeCompressionGuidelines(draftContent);
@@ -10344,8 +9930,8 @@ ${memory.content}
10344
9930
  activationState: "active"
10345
9931
  });
10346
9932
  await Promise.all([
10347
- unlink5(this.compressionGuidelineDraftPath).catch(() => void 0),
10348
- unlink5(this.compressionGuidelineDraftStatePath).catch(() => void 0)
9933
+ unlink4(this.compressionGuidelineDraftPath).catch(() => void 0),
9934
+ unlink4(this.compressionGuidelineDraftStatePath).catch(() => void 0)
10349
9935
  ]);
10350
9936
  return true;
10351
9937
  }
@@ -10397,7 +9983,7 @@ ${memory.content}
10397
9983
  return `${prefix}-${ts}-${rand}`;
10398
9984
  }
10399
9985
  async writeQuestion(question, context, priority) {
10400
- await mkdir2(this.questionsDir, { recursive: true });
9986
+ await mkdir(this.questionsDir, { recursive: true });
10401
9987
  const id = this.generateId("q");
10402
9988
  const frontmatter = {
10403
9989
  id,
@@ -10413,7 +9999,7 @@ ${question}
10413
9999
 
10414
10000
  **Context:** ${context}
10415
10001
  `;
10416
- const filePath = path11.join(this.questionsDir, `${id}.md`);
10002
+ const filePath = path10.join(this.questionsDir, `${id}.md`);
10417
10003
  await this.writeStorageSecureFile(filePath, content);
10418
10004
  log.debug(`wrote question ${id} to ${filePath}`);
10419
10005
  this.invalidateQuestionsCache();
@@ -10431,7 +10017,7 @@ ${question}
10431
10017
  if (!match) return null;
10432
10018
  const frontmatterStr = match[1];
10433
10019
  const body = match[2].trim();
10434
- const id = this.extractFrontmatterValue(frontmatterStr, "id") ?? path11.basename(filePath, ".md");
10020
+ const id = this.extractFrontmatterValue(frontmatterStr, "id") ?? path10.basename(filePath, ".md");
10435
10021
  const created = this.extractFrontmatterValue(frontmatterStr, "created") ?? "";
10436
10022
  const priority = parseFloat(this.extractFrontmatterValue(frontmatterStr, "priority") ?? "0.5");
10437
10023
  const resolved = this.extractFrontmatterValue(frontmatterStr, "resolved") === "true";
@@ -10465,7 +10051,7 @@ ${question}
10465
10051
  async readIdentity(workspaceDir, namespace) {
10466
10052
  const identityPath = this.identityFilePath(workspaceDir, namespace);
10467
10053
  try {
10468
- return await readFile3(identityPath, "utf-8");
10054
+ return await readFile2(identityPath, "utf-8");
10469
10055
  } catch {
10470
10056
  return "";
10471
10057
  }
@@ -10483,15 +10069,15 @@ ${question}
10483
10069
  const identityPath = this.identityFilePath(workspaceDir, opts?.namespace);
10484
10070
  let existing = "";
10485
10071
  try {
10486
- existing = await readFile3(identityPath, "utf-8");
10072
+ existing = await readFile2(identityPath, "utf-8");
10487
10073
  } catch {
10488
10074
  }
10489
10075
  const hygiene = opts?.hygiene;
10490
- const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path11.basename(identityPath));
10076
+ const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path10.basename(identityPath));
10491
10077
  if (rotateEnabled) {
10492
10078
  const maxBytes = hygiene.rotateMaxBytes;
10493
10079
  if (existing.length > maxBytes) {
10494
- const archiveDir = path11.join(workspaceDir, hygiene.archiveDir);
10080
+ const archiveDir = path10.join(workspaceDir, hygiene.archiveDir);
10495
10081
  const { newContent } = await rotateMarkdownFileToArchive({
10496
10082
  filePath: identityPath,
10497
10083
  archiveDir,
@@ -10543,7 +10129,7 @@ ${reflection}
10543
10129
  }
10544
10130
  }
10545
10131
  async writeIdentityReflections(content) {
10546
- await mkdir2(this.identityDir, { recursive: true });
10132
+ await mkdir(this.identityDir, { recursive: true });
10547
10133
  await this.writeStorageSecureFile(this.identityReflectionsPath, content);
10548
10134
  }
10549
10135
  async appendIdentityReflection(reflection) {
@@ -10575,7 +10161,7 @@ ${reflection}
10575
10161
 
10576
10162
  ${reflection}
10577
10163
  `;
10578
- await mkdir2(this.identityDir, { recursive: true });
10164
+ await mkdir(this.identityDir, { recursive: true });
10579
10165
  await this.writeStorageSecureFile(this.identityReflectionsPath, `${existing.trimEnd()}${section}`);
10580
10166
  log.debug(`appended namespace-local reflection to ${this.identityReflectionsPath}`);
10581
10167
  }
@@ -10631,7 +10217,7 @@ ${reflection}
10631
10217
  const rightTs = latestEntityTimelineTimestamp(right.entity) ?? "";
10632
10218
  return compareEntityTimestamps(rightTs, leftTs);
10633
10219
  }).map(({ entityName }) => entityName);
10634
- await mkdir2(this.stateDir, { recursive: true });
10220
+ await mkdir(this.stateDir, { recursive: true });
10635
10221
  await this.writeStorageSecureFile(
10636
10222
  this.entitySynthesisQueuePath,
10637
10223
  JSON.stringify(
@@ -10651,7 +10237,7 @@ ${reflection}
10651
10237
  if (queue.length === 0) return;
10652
10238
  const removals = new Set(entityNames);
10653
10239
  const nextQueue = queue.filter((name) => !removals.has(name));
10654
- await mkdir2(this.stateDir, { recursive: true });
10240
+ await mkdir(this.stateDir, { recursive: true });
10655
10241
  await this.writeStorageSecureFile(
10656
10242
  this.entitySynthesisQueuePath,
10657
10243
  JSON.stringify(
@@ -10751,14 +10337,14 @@ ${reflection}
10751
10337
  if (entries.length === 0) return 0;
10752
10338
  const memories = await this.readAllMemories();
10753
10339
  const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
10754
- const memoryPathMap = new Map(memories.map((m) => [path11.resolve(m.path), m]));
10340
+ const memoryPathMap = new Map(memories.map((m) => [path10.resolve(m.path), m]));
10755
10341
  let updated = 0;
10756
10342
  const prevVersion = this.getMemoryCorpusVersion();
10757
10343
  const keyId = this.hotCacheKeyId();
10758
10344
  const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
10759
10345
  const appliedPatches = /* @__PURE__ */ new Map();
10760
10346
  for (const entry of entries) {
10761
- const memory = entry.memoryPath ? memoryPathMap.get(path11.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10347
+ const memory = entry.memoryPath ? memoryPathMap.get(path10.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
10762
10348
  if (!memory) continue;
10763
10349
  try {
10764
10350
  const applied = await this.withTombstoneBlockedMemoryPathLock(memory.path, async (current) => {
@@ -10789,7 +10375,7 @@ ${current.content}
10789
10375
  if (warm) {
10790
10376
  updateCacheOnWrite(this.baseDir, { ...applied.current, frontmatter: applied.newFm }, keyId);
10791
10377
  }
10792
- appliedPatches.set(path11.resolve(memory.path), {
10378
+ appliedPatches.set(path10.resolve(memory.path), {
10793
10379
  accessCount: entry.newCount,
10794
10380
  lastAccessed: entry.lastAccessed
10795
10381
  });
@@ -10805,7 +10391,7 @@ ${current.content}
10805
10391
  const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
10806
10392
  if (cur) {
10807
10393
  const reapplied = cur.map((m) => {
10808
- const patch = appliedPatches.get(path11.resolve(m.path));
10394
+ const patch = appliedPatches.get(path10.resolve(m.path));
10809
10395
  return patch ? {
10810
10396
  ...m,
10811
10397
  frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed }
@@ -10835,7 +10421,7 @@ ${current.content}
10835
10421
  const pathsById = /* @__PURE__ */ new Map();
10836
10422
  const filePathsById = /* @__PURE__ */ new Map();
10837
10423
  for (const filePath of filePaths) {
10838
- const memoryId = path11.basename(filePath, ".md");
10424
+ const memoryId = path10.basename(filePath, ".md");
10839
10425
  if (!wantedIds.has(memoryId)) continue;
10840
10426
  const paths = filePathsById.get(memoryId) ?? [];
10841
10427
  paths.push(filePath);
@@ -10847,7 +10433,7 @@ ${current.content}
10847
10433
  const preferredMatches = [];
10848
10434
  for (const preferredPath of preferred) {
10849
10435
  const directCandidates = new Set(qmdResultPathCandidates(this.baseDir, preferredPath));
10850
- const directMatch = existingPaths.find((filePath) => directCandidates.has(path11.resolve(filePath)));
10436
+ const directMatch = existingPaths.find((filePath) => directCandidates.has(path10.resolve(filePath)));
10851
10437
  if (directMatch) {
10852
10438
  preferredMatches.push(directMatch);
10853
10439
  continue;
@@ -10859,7 +10445,7 @@ ${current.content}
10859
10445
  candidates.add(candidate);
10860
10446
  }
10861
10447
  }
10862
- const match = existingPaths.find((filePath) => candidates.has(path11.resolve(filePath)));
10448
+ const match = existingPaths.find((filePath) => candidates.has(path10.resolve(filePath)));
10863
10449
  if (match) preferredMatches.push(match);
10864
10450
  }
10865
10451
  if (preferredMatches.length > 0) {
@@ -11049,7 +10635,7 @@ ${sanitized.text}
11049
10635
  }
11050
10636
  if (!oldMemory) return false;
11051
10637
  const requireActiveAtWrite = options.requireActive === true || inferMemoryStatus(oldMemory.frontmatter, toMemoryPathRel(this.baseDir, oldMemory.path)) === "active";
11052
- const operationId = createHash7("sha256").update(
10638
+ const operationId = createHash6("sha256").update(
11053
10639
  JSON.stringify({
11054
10640
  oldMemoryId,
11055
10641
  newMemoryId,
@@ -11178,11 +10764,11 @@ ${current.content}
11178
10764
  }
11179
10765
  }
11180
10766
  get summariesDir() {
11181
- return path11.join(this.baseDir, "summaries");
10767
+ return path10.join(this.baseDir, "summaries");
11182
10768
  }
11183
10769
  async writeSummary(summary) {
11184
- await mkdir2(this.summariesDir, { recursive: true });
11185
- const filePath = path11.join(this.summariesDir, `${summary.id}.json`);
10770
+ await mkdir(this.summariesDir, { recursive: true });
10771
+ const filePath = path10.join(this.summariesDir, `${summary.id}.json`);
11186
10772
  await this.writeStorageSecureFile(filePath, JSON.stringify(summary, null, 2));
11187
10773
  log.debug(`wrote summary ${summary.id}`);
11188
10774
  }
@@ -11192,7 +10778,7 @@ ${current.content}
11192
10778
  const summaries = [];
11193
10779
  for (const file of files) {
11194
10780
  if (!file.endsWith(".json")) continue;
11195
- const filePath = path11.join(this.summariesDir, file);
10781
+ const filePath = path10.join(this.summariesDir, file);
11196
10782
  const raw = await this.readStorageSecureFile(filePath);
11197
10783
  summaries.push(JSON.parse(raw));
11198
10784
  }
@@ -11262,8 +10848,8 @@ ${current.content}
11262
10848
  return archived;
11263
10849
  }
11264
10850
  async saveTopics(topics) {
11265
- const metaPath = path11.join(this.stateDir, "topics.json");
11266
- await mkdir2(this.stateDir, { recursive: true });
10851
+ const metaPath = path10.join(this.stateDir, "topics.json");
10852
+ await mkdir(this.stateDir, { recursive: true });
11267
10853
  await this.writeStorageSecureFile(
11268
10854
  metaPath,
11269
10855
  JSON.stringify({ topics, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)
@@ -11271,7 +10857,7 @@ ${current.content}
11271
10857
  log.debug(`saved ${topics.length} topic scores`);
11272
10858
  }
11273
10859
  async loadTopics() {
11274
- const metaPath = path11.join(this.stateDir, "topics.json");
10860
+ const metaPath = path10.join(this.stateDir, "topics.json");
11275
10861
  try {
11276
10862
  const raw = await this.readStorageSecureFile(metaPath);
11277
10863
  return JSON.parse(raw);
@@ -11386,4 +10972,4 @@ export {
11386
10972
  isValidBufferSurpriseEvent,
11387
10973
  StorageManager3 as StorageManager
11388
10974
  };
11389
- //# sourceMappingURL=chunk-QQXWFDRD.js.map
10975
+ //# sourceMappingURL=chunk-M4YHAODQ.js.map