@remnic/core 9.69.50 → 9.69.51

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 (271) hide show
  1. package/dist/access-admin-ops-surface.js +30 -30
  2. package/dist/access-audit.d.ts +1 -0
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.js +31 -31
  5. package/dist/access-boundary.js +30 -30
  6. package/dist/access-cli.js +84 -83
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-extraction-force-flush.js +30 -30
  9. package/dist/access-http-briefing.js +31 -31
  10. package/dist/access-http-query.js +32 -32
  11. package/dist/access-http.js +50 -50
  12. package/dist/access-identity-continuity-surface.js +30 -30
  13. package/dist/access-lcm-surface.js +30 -30
  14. package/dist/access-mcp-output-schemas.js +1 -1
  15. package/dist/access-mcp.js +41 -41
  16. package/dist/access-namespace-preflight.js +30 -30
  17. package/dist/access-observe-write-category.js +5 -5
  18. package/dist/access-observe-write-surface.js +30 -30
  19. package/dist/access-operations-batch.js +32 -32
  20. package/dist/access-operations.js +39 -39
  21. package/dist/access-recall-concurrency.js +30 -30
  22. package/dist/access-recall-response.js +30 -30
  23. package/dist/access-recall-surface.d.ts +1 -1
  24. package/dist/access-recall-surface.js +30 -30
  25. package/dist/access-schema.js +4 -4
  26. package/dist/access-service.js +30 -30
  27. package/dist/access-surface-catalog.js +32 -32
  28. package/dist/active-recall.js +2 -2
  29. package/dist/briefing.js +5 -5
  30. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  31. package/dist/causal-consolidation.js +6 -6
  32. package/dist/{chunk-BHI5ILU5.js → chunk-25HSEIEM.js} +2 -2
  33. package/dist/{chunk-3RZB7TYL.js → chunk-2EICZYIG.js} +2 -2
  34. package/dist/{chunk-2IVHOQRY.js → chunk-2ERLN25A.js} +2 -2
  35. package/dist/{chunk-OQZYHCWM.js → chunk-2G2CVN2T.js} +27 -26
  36. package/dist/{chunk-OQZYHCWM.js.map → chunk-2G2CVN2T.js.map} +1 -1
  37. package/dist/{chunk-PPNFKQ6D.js → chunk-2SZBCM2S.js} +2 -2
  38. package/dist/{chunk-E73SVGJA.js → chunk-33SX6K3N.js} +2 -2
  39. package/dist/{chunk-D6WX5FEF.js → chunk-3QZRSEAM.js} +2 -2
  40. package/dist/{chunk-LBLXEFWK.js → chunk-4MN27537.js} +1 -1
  41. package/dist/chunk-4MN27537.js.map +1 -0
  42. package/dist/{chunk-LR7KUQ2W.js → chunk-6HCJWCA4.js} +5 -5
  43. package/dist/chunk-6VITOSPL.js +69 -0
  44. package/dist/chunk-6VITOSPL.js.map +1 -0
  45. package/dist/{chunk-EZV43XBD.js → chunk-6Z4OLQUO.js} +2 -2
  46. package/dist/{chunk-JTPAXDSX.js → chunk-6ZMIASYT.js} +2 -2
  47. package/dist/{chunk-UD6W67JM.js → chunk-72AV2H3R.js} +76 -25
  48. package/dist/chunk-72AV2H3R.js.map +1 -0
  49. package/dist/{chunk-DNO6QWCB.js → chunk-7TTOX6NW.js} +2 -2
  50. package/dist/{chunk-OP5IBPHP.js → chunk-A33DLYNY.js} +2 -2
  51. package/dist/{chunk-3MIZ2EKQ.js → chunk-AH3OIMS7.js} +2 -2
  52. package/dist/{chunk-TZ44E732.js → chunk-AIVRD66I.js} +2 -2
  53. package/dist/{chunk-IST6MBYC.js → chunk-BMAYH7F4.js} +473 -329
  54. package/dist/chunk-BMAYH7F4.js.map +1 -0
  55. package/dist/{chunk-XTMABIFW.js → chunk-BULK6DGB.js} +2 -2
  56. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  57. package/dist/{chunk-PMLFPVYJ.js → chunk-CKBA2MWS.js} +2 -2
  58. package/dist/{chunk-TVVEYCNW.js → chunk-DAOMWGO2.js} +2 -2
  59. package/dist/{chunk-E64HBW7M.js → chunk-DLXBMXIB.js} +2 -2
  60. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  61. package/dist/{chunk-MQMZO23A.js → chunk-DQSVGTKB.js} +2 -2
  62. package/dist/{chunk-X6B2QWXW.js → chunk-DX63RFDJ.js} +2 -2
  63. package/dist/{chunk-OLJYDGGP.js → chunk-EBJL6HGR.js} +4 -4
  64. package/dist/{chunk-KOEDSRF5.js → chunk-ETNC6TT6.js} +2 -2
  65. package/dist/{chunk-SRMBMMTK.js → chunk-HEKWNWNL.js} +3 -3
  66. package/dist/{chunk-UI6R2YUB.js → chunk-IGDEKECC.js} +1 -1
  67. package/dist/{chunk-MECKA6G2.js → chunk-ISA5U5AP.js} +2 -2
  68. package/dist/{chunk-ZUNYFDI4.js → chunk-JGPG5UHM.js} +2 -2
  69. package/dist/{chunk-C3PKRFZ4.js → chunk-JXSOB3SA.js} +2 -2
  70. package/dist/{chunk-56C7OO3N.js → chunk-KAPYPTPS.js} +15 -15
  71. package/dist/{chunk-W6V7JN2E.js → chunk-KBHDV7P3.js} +3 -3
  72. package/dist/{chunk-F5V7KRQS.js → chunk-LIAKZGOY.js} +2 -2
  73. package/dist/{chunk-A7GQBJP5.js → chunk-LVFI5LG7.js} +7 -7
  74. package/dist/{chunk-QSP4Y73Q.js → chunk-LX7KIJQF.js} +2 -2
  75. package/dist/{chunk-ECLY4NZA.js → chunk-LZI6FWZW.js} +7 -1
  76. package/dist/chunk-LZI6FWZW.js.map +1 -0
  77. package/dist/{chunk-4PXFLDMJ.js → chunk-MNF6PTNL.js} +2 -2
  78. package/dist/{chunk-BOTSR5S3.js → chunk-MYDA2GA2.js} +2 -2
  79. package/dist/{chunk-4SDO74N2.js → chunk-NROI5XMG.js} +2 -2
  80. package/dist/{chunk-IYHHCSF6.js → chunk-NVW5ISEJ.js} +32 -32
  81. package/dist/{chunk-AL7OLBL7.js → chunk-NXSNFPYI.js} +2 -2
  82. package/dist/{chunk-D7QX26FF.js → chunk-O4JFBEUL.js} +2 -2
  83. package/dist/{chunk-PA5EOTRR.js → chunk-OIK3YL2P.js} +3 -3
  84. package/dist/{chunk-JOP7W24J.js → chunk-PLJ2MQFT.js} +4 -4
  85. package/dist/{chunk-HRCWDO6S.js → chunk-PYTSGD5M.js} +2 -2
  86. package/dist/{chunk-VBRS7Z3O.js → chunk-Q6OC4UUT.js} +2 -2
  87. package/dist/{chunk-4FWNMN5R.js → chunk-QRSC37NC.js} +5 -5
  88. package/dist/{chunk-D2XUSZ24.js → chunk-RIP2AOZW.js} +2 -2
  89. package/dist/{chunk-ZBAQMSEY.js → chunk-SCM4VYJW.js} +2 -2
  90. package/dist/{chunk-6525YIYL.js → chunk-SMI2G3MA.js} +3 -3
  91. package/dist/{chunk-DH536WT2.js → chunk-ST7FDKZT.js} +12 -2
  92. package/dist/chunk-ST7FDKZT.js.map +1 -0
  93. package/dist/{chunk-AYGWJ2UK.js → chunk-SZ75IB2T.js} +2 -2
  94. package/dist/{chunk-42BV46XS.js → chunk-T73ZC7C5.js} +2 -2
  95. package/dist/{chunk-3SI3FFTW.js → chunk-TNFDWJRS.js} +2 -2
  96. package/dist/{chunk-3UQIS2GC.js → chunk-TTFJQ5B5.js} +2 -2
  97. package/dist/{chunk-QZDUNK6V.js → chunk-UP3226JC.js} +6 -6
  98. package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
  99. package/dist/{chunk-QXQCPNKA.js → chunk-VLR4S5GF.js} +7 -7
  100. package/dist/{chunk-ZHXSOMYH.js → chunk-VVX5PZFS.js} +2 -2
  101. package/dist/{chunk-HS75MCQF.js → chunk-WUUGE7QC.js} +4 -4
  102. package/dist/{chunk-MVMNEU65.js → chunk-X25NTN3W.js} +2 -2
  103. package/dist/{chunk-IC3PM3YO.js → chunk-XFXVIXDI.js} +2 -2
  104. package/dist/{chunk-ML5FW2RO.js → chunk-XHDQQ2TT.js} +2 -2
  105. package/dist/{chunk-XUKUMBP3.js → chunk-XRUOO7OT.js} +2 -2
  106. package/dist/{chunk-WVI43D54.js → chunk-YEIKOBOW.js} +15 -2
  107. package/dist/chunk-YEIKOBOW.js.map +1 -0
  108. package/dist/{chunk-AYP2FZFA.js → chunk-YIIW2OH2.js} +2 -2
  109. package/dist/{chunk-FO6IK4IF.js → chunk-YJJMJH6J.js} +8 -8
  110. package/dist/cli.js +68 -68
  111. package/dist/coding/export-okf-codegraph.js +4 -4
  112. package/dist/compounding/engine.js +5 -5
  113. package/dist/config.js +2 -2
  114. package/dist/connectors/codex-materialize-runner.js +5 -5
  115. package/dist/connectors/index.js +5 -5
  116. package/dist/convergence-refresh.js +7 -7
  117. package/dist/corpus-watermark.js +7 -7
  118. package/dist/deep-recall-http-glue.js +5 -5
  119. package/dist/deep-recall.js +2 -2
  120. package/dist/directory-sidecars.d.ts +28 -2
  121. package/dist/directory-sidecars.js +9 -1
  122. package/dist/entity-retrieval.js +5 -5
  123. package/dist/external-wiki-access.js +31 -31
  124. package/dist/extraction.js +5 -5
  125. package/dist/harmonic-retrieval.js +1 -1
  126. package/dist/index.d.ts +2 -0
  127. package/dist/index.js +98 -88
  128. package/dist/lcm/engine.js +3 -3
  129. package/dist/lcm/index.js +8 -8
  130. package/dist/location/index.js +7 -7
  131. package/dist/maintenance/memory-governance.js +5 -5
  132. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +5 -5
  133. package/dist/maintenance/rebuild-memory-projection.js +6 -6
  134. package/dist/memory-browse-operations.js +31 -31
  135. package/dist/memory-browse.js +3 -3
  136. package/dist/namespaces/migrate.js +6 -6
  137. package/dist/namespaces/search.js +3 -3
  138. package/dist/namespaces/storage.js +5 -5
  139. package/dist/operator-doctor-corpus.js +8 -8
  140. package/dist/operator-toolkit.js +15 -15
  141. package/dist/orchestration/maintenance.js +13 -13
  142. package/dist/orchestrator.js +84 -83
  143. package/dist/recall-audit-anomaly.d.ts +1 -0
  144. package/dist/recall-audit.d.ts +4 -0
  145. package/dist/recall-audit.js +1 -1
  146. package/dist/recall-composition-decision.d.ts +41 -0
  147. package/dist/recall-composition-decision.js +17 -0
  148. package/dist/recall-composition-decision.js.map +1 -0
  149. package/dist/recall-explain-renderer.d.ts +1 -0
  150. package/dist/recall-explain-renderer.js +2 -2
  151. package/dist/recall-navigation-operations.js +31 -31
  152. package/dist/recall-navigation-renderer.d.ts +1 -0
  153. package/dist/recall-navigation.d.ts +1 -0
  154. package/dist/recall-navigation.js +30 -30
  155. package/dist/recall-state-view-admission.js +3 -3
  156. package/dist/recall-tag-filter.d.ts +1 -0
  157. package/dist/recall-xray-cli.d.ts +1 -0
  158. package/dist/recall-xray-cli.js +3 -3
  159. package/dist/recall-xray-renderer.d.ts +1 -0
  160. package/dist/recall-xray-renderer.js +2 -2
  161. package/dist/recall-xray.d.ts +9 -0
  162. package/dist/recall-xray.js +1 -1
  163. package/dist/resume-bundles.js +3 -3
  164. package/dist/search/factory.js +2 -2
  165. package/dist/search/index.js +4 -4
  166. package/dist/semantic-consolidation.js +6 -6
  167. package/dist/semantic-rule-promotion.js +5 -5
  168. package/dist/semantic-rule-verifier.js +5 -5
  169. package/dist/source-agent-qualifier.js +5 -5
  170. package/dist/standup/build.js +5 -5
  171. package/dist/storage.js +4 -4
  172. package/dist/support-passport/index.js +33 -33
  173. package/dist/transfer/autodetect.js +1 -1
  174. package/dist/transfer/backup.js +2 -2
  175. package/dist/transfer/capsule-export.js +3 -3
  176. package/dist/transfer/capsule-import.js +2 -2
  177. package/dist/transfer/export-okf.js +5 -5
  178. package/dist/verified-recall.js +5 -5
  179. package/dist/who-knows-cli.js +6 -6
  180. package/dist/who-knows.js +5 -5
  181. package/package.json +2 -2
  182. package/src/access-mcp-output-schemas.ts +14 -1
  183. package/src/access-recall-response.ts +3 -0
  184. package/src/directory-sidecars.test.ts +119 -0
  185. package/src/directory-sidecars.ts +110 -25
  186. package/src/experience/session-experience-recall.test.ts +228 -0
  187. package/src/experience/session-experience-recall.ts +60 -0
  188. package/src/index.ts +1 -0
  189. package/src/orchestration/recall-entry.ts +16 -2
  190. package/src/orchestration/recall-internal.ts +21 -18
  191. package/src/orchestration/recall-recognition-search.test.ts +290 -0
  192. package/src/orchestration/recall-recognition-search.ts +160 -0
  193. package/src/procedural/procedure-recall.ts +14 -3
  194. package/src/recall-audit.test.ts +34 -0
  195. package/src/recall-audit.ts +4 -0
  196. package/src/recall-composition-decision.test.ts +134 -0
  197. package/src/recall-composition-decision.ts +113 -0
  198. package/src/recall-xray-renderer.test.ts +17 -0
  199. package/src/recall-xray-renderer.ts +10 -0
  200. package/src/recall-xray.test.ts +28 -0
  201. package/src/recall-xray.ts +15 -0
  202. package/src/testing/subjects/recall-recognition-tier.test.ts +106 -0
  203. package/dist/chunk-DH536WT2.js.map +0 -1
  204. package/dist/chunk-ECLY4NZA.js.map +0 -1
  205. package/dist/chunk-IST6MBYC.js.map +0 -1
  206. package/dist/chunk-LBLXEFWK.js.map +0 -1
  207. package/dist/chunk-UD6W67JM.js.map +0 -1
  208. package/dist/chunk-WVI43D54.js.map +0 -1
  209. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  210. /package/dist/{chunk-BHI5ILU5.js.map → chunk-25HSEIEM.js.map} +0 -0
  211. /package/dist/{chunk-3RZB7TYL.js.map → chunk-2EICZYIG.js.map} +0 -0
  212. /package/dist/{chunk-2IVHOQRY.js.map → chunk-2ERLN25A.js.map} +0 -0
  213. /package/dist/{chunk-PPNFKQ6D.js.map → chunk-2SZBCM2S.js.map} +0 -0
  214. /package/dist/{chunk-E73SVGJA.js.map → chunk-33SX6K3N.js.map} +0 -0
  215. /package/dist/{chunk-D6WX5FEF.js.map → chunk-3QZRSEAM.js.map} +0 -0
  216. /package/dist/{chunk-LR7KUQ2W.js.map → chunk-6HCJWCA4.js.map} +0 -0
  217. /package/dist/{chunk-EZV43XBD.js.map → chunk-6Z4OLQUO.js.map} +0 -0
  218. /package/dist/{chunk-JTPAXDSX.js.map → chunk-6ZMIASYT.js.map} +0 -0
  219. /package/dist/{chunk-DNO6QWCB.js.map → chunk-7TTOX6NW.js.map} +0 -0
  220. /package/dist/{chunk-OP5IBPHP.js.map → chunk-A33DLYNY.js.map} +0 -0
  221. /package/dist/{chunk-3MIZ2EKQ.js.map → chunk-AH3OIMS7.js.map} +0 -0
  222. /package/dist/{chunk-TZ44E732.js.map → chunk-AIVRD66I.js.map} +0 -0
  223. /package/dist/{chunk-XTMABIFW.js.map → chunk-BULK6DGB.js.map} +0 -0
  224. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  225. /package/dist/{chunk-PMLFPVYJ.js.map → chunk-CKBA2MWS.js.map} +0 -0
  226. /package/dist/{chunk-TVVEYCNW.js.map → chunk-DAOMWGO2.js.map} +0 -0
  227. /package/dist/{chunk-E64HBW7M.js.map → chunk-DLXBMXIB.js.map} +0 -0
  228. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  229. /package/dist/{chunk-MQMZO23A.js.map → chunk-DQSVGTKB.js.map} +0 -0
  230. /package/dist/{chunk-X6B2QWXW.js.map → chunk-DX63RFDJ.js.map} +0 -0
  231. /package/dist/{chunk-OLJYDGGP.js.map → chunk-EBJL6HGR.js.map} +0 -0
  232. /package/dist/{chunk-KOEDSRF5.js.map → chunk-ETNC6TT6.js.map} +0 -0
  233. /package/dist/{chunk-SRMBMMTK.js.map → chunk-HEKWNWNL.js.map} +0 -0
  234. /package/dist/{chunk-UI6R2YUB.js.map → chunk-IGDEKECC.js.map} +0 -0
  235. /package/dist/{chunk-MECKA6G2.js.map → chunk-ISA5U5AP.js.map} +0 -0
  236. /package/dist/{chunk-ZUNYFDI4.js.map → chunk-JGPG5UHM.js.map} +0 -0
  237. /package/dist/{chunk-C3PKRFZ4.js.map → chunk-JXSOB3SA.js.map} +0 -0
  238. /package/dist/{chunk-56C7OO3N.js.map → chunk-KAPYPTPS.js.map} +0 -0
  239. /package/dist/{chunk-W6V7JN2E.js.map → chunk-KBHDV7P3.js.map} +0 -0
  240. /package/dist/{chunk-F5V7KRQS.js.map → chunk-LIAKZGOY.js.map} +0 -0
  241. /package/dist/{chunk-A7GQBJP5.js.map → chunk-LVFI5LG7.js.map} +0 -0
  242. /package/dist/{chunk-QSP4Y73Q.js.map → chunk-LX7KIJQF.js.map} +0 -0
  243. /package/dist/{chunk-4PXFLDMJ.js.map → chunk-MNF6PTNL.js.map} +0 -0
  244. /package/dist/{chunk-BOTSR5S3.js.map → chunk-MYDA2GA2.js.map} +0 -0
  245. /package/dist/{chunk-4SDO74N2.js.map → chunk-NROI5XMG.js.map} +0 -0
  246. /package/dist/{chunk-IYHHCSF6.js.map → chunk-NVW5ISEJ.js.map} +0 -0
  247. /package/dist/{chunk-AL7OLBL7.js.map → chunk-NXSNFPYI.js.map} +0 -0
  248. /package/dist/{chunk-D7QX26FF.js.map → chunk-O4JFBEUL.js.map} +0 -0
  249. /package/dist/{chunk-PA5EOTRR.js.map → chunk-OIK3YL2P.js.map} +0 -0
  250. /package/dist/{chunk-JOP7W24J.js.map → chunk-PLJ2MQFT.js.map} +0 -0
  251. /package/dist/{chunk-HRCWDO6S.js.map → chunk-PYTSGD5M.js.map} +0 -0
  252. /package/dist/{chunk-VBRS7Z3O.js.map → chunk-Q6OC4UUT.js.map} +0 -0
  253. /package/dist/{chunk-4FWNMN5R.js.map → chunk-QRSC37NC.js.map} +0 -0
  254. /package/dist/{chunk-D2XUSZ24.js.map → chunk-RIP2AOZW.js.map} +0 -0
  255. /package/dist/{chunk-ZBAQMSEY.js.map → chunk-SCM4VYJW.js.map} +0 -0
  256. /package/dist/{chunk-6525YIYL.js.map → chunk-SMI2G3MA.js.map} +0 -0
  257. /package/dist/{chunk-AYGWJ2UK.js.map → chunk-SZ75IB2T.js.map} +0 -0
  258. /package/dist/{chunk-42BV46XS.js.map → chunk-T73ZC7C5.js.map} +0 -0
  259. /package/dist/{chunk-3SI3FFTW.js.map → chunk-TNFDWJRS.js.map} +0 -0
  260. /package/dist/{chunk-3UQIS2GC.js.map → chunk-TTFJQ5B5.js.map} +0 -0
  261. /package/dist/{chunk-QZDUNK6V.js.map → chunk-UP3226JC.js.map} +0 -0
  262. /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
  263. /package/dist/{chunk-QXQCPNKA.js.map → chunk-VLR4S5GF.js.map} +0 -0
  264. /package/dist/{chunk-ZHXSOMYH.js.map → chunk-VVX5PZFS.js.map} +0 -0
  265. /package/dist/{chunk-HS75MCQF.js.map → chunk-WUUGE7QC.js.map} +0 -0
  266. /package/dist/{chunk-MVMNEU65.js.map → chunk-X25NTN3W.js.map} +0 -0
  267. /package/dist/{chunk-IC3PM3YO.js.map → chunk-XFXVIXDI.js.map} +0 -0
  268. /package/dist/{chunk-ML5FW2RO.js.map → chunk-XHDQQ2TT.js.map} +0 -0
  269. /package/dist/{chunk-XUKUMBP3.js.map → chunk-XRUOO7OT.js.map} +0 -0
  270. /package/dist/{chunk-AYP2FZFA.js.map → chunk-YIIW2OH2.js.map} +0 -0
  271. /package/dist/{chunk-FO6IK4IF.js.map → chunk-YJJMJH6J.js.map} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  ActivityStore,
15
15
  MaintenanceScheduler
16
- } from "./chunk-LR7KUQ2W.js";
16
+ } from "./chunk-6HCJWCA4.js";
17
17
  import {
18
18
  runPeerProfileReasoner
19
19
  } from "./chunk-I74SUMNI.js";
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-VZAKYDMJ.js";
23
23
  import {
24
24
  LcmEngine
25
- } from "./chunk-A7GQBJP5.js";
25
+ } from "./chunk-LVFI5LG7.js";
26
26
  import {
27
27
  chunkTranscriptEntries
28
28
  } from "./chunk-TECVW3JP.js";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  CompoundingEngine,
34
34
  defaultTierMigrationCycleBudget
35
- } from "./chunk-3MIZ2EKQ.js";
35
+ } from "./chunk-AH3OIMS7.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-Z22M4JCY.js";
@@ -44,6 +44,9 @@ import {
44
44
  applyUtilityRankingRuntimeDelta,
45
45
  loadUtilityRuntimeValues
46
46
  } from "./chunk-SWIKABKI.js";
47
+ import {
48
+ TmtBuilder
49
+ } from "./chunk-ECZU5BJH.js";
47
50
  import {
48
51
  extractTopics
49
52
  } from "./chunk-KVDUKH5E.js";
@@ -59,9 +62,6 @@ import {
59
62
  import {
60
63
  decideTierTransition
61
64
  } from "./chunk-GCBIXUPT.js";
62
- import {
63
- TmtBuilder
64
- } from "./chunk-ECZU5BJH.js";
65
65
  import {
66
66
  buildTargetedFactRecallSection,
67
67
  shouldRecallTargetedFactEvidence
@@ -111,7 +111,7 @@ import {
111
111
  import {
112
112
  indexStateViewAnnotatedResults,
113
113
  resolveRecallStateViewActive
114
- } from "./chunk-VBRS7Z3O.js";
114
+ } from "./chunk-Q6OC4UUT.js";
115
115
  import {
116
116
  applyRecallStateViews
117
117
  } from "./chunk-DBB5JPSL.js";
@@ -120,6 +120,9 @@ import {
120
120
  filterRecentScanMemories,
121
121
  stateViewPacketActive
122
122
  } from "./chunk-VSN2DMQK.js";
123
+ import {
124
+ reorderRecallResultsWithMmr
125
+ } from "./chunk-YDBIWGNI.js";
123
126
  import {
124
127
  dedupeResultsByNamespace,
125
128
  hasMemoryForResult,
@@ -129,8 +132,11 @@ import {
129
132
  resultHasKey
130
133
  } from "./chunk-D3V3UMET.js";
131
134
  import {
132
- reorderRecallResultsWithMmr
133
- } from "./chunk-YDBIWGNI.js";
135
+ compactRecallContextFromBuckets,
136
+ decideRecallContextComposition,
137
+ notifyContextComposition,
138
+ recallFailureComposition
139
+ } from "./chunk-6VITOSPL.js";
134
140
  import {
135
141
  applyReasoningTraceBoost
136
142
  } from "./chunk-ZZTOURJI.js";
@@ -201,7 +207,7 @@ import {
201
207
  buildEntityRecallSection,
202
208
  entityRecentTranscriptLookbackHours,
203
209
  readRecentEntityTranscriptEntries
204
- } from "./chunk-4SDO74N2.js";
210
+ } from "./chunk-NROI5XMG.js";
205
211
  import {
206
212
  planEpisodeWindowsWithFallback
207
213
  } from "./chunk-T3GIETKV.js";
@@ -213,7 +219,7 @@ import {
213
219
  } from "./chunk-V2HHAAPI.js";
214
220
  import {
215
221
  refreshConvergedNamespaces
216
- } from "./chunk-PPNFKQ6D.js";
222
+ } from "./chunk-2SZBCM2S.js";
217
223
  import {
218
224
  formatDaySummaryMemories
219
225
  } from "./chunk-LVXBC6YB.js";
@@ -225,7 +231,7 @@ import {
225
231
  runTimelinePublishCli,
226
232
  screenCandidateFact,
227
233
  summarizeVaultPublish
228
- } from "./chunk-IYHHCSF6.js";
234
+ } from "./chunk-NVW5ISEJ.js";
229
235
  import {
230
236
  normalizeReplaySessionKey
231
237
  } from "./chunk-AJVLDJU6.js";
@@ -235,14 +241,14 @@ import {
235
241
  import {
236
242
  compareVerifiedEpisodeResults,
237
243
  searchVerifiedEpisodes
238
- } from "./chunk-D6WX5FEF.js";
244
+ } from "./chunk-3QZRSEAM.js";
239
245
  import {
240
246
  ThreadingManager
241
247
  } from "./chunk-OJP3N7UK.js";
242
248
  import {
243
249
  compareVerifiedSemanticRuleResults,
244
250
  searchVerifiedSemanticRules
245
- } from "./chunk-BOTSR5S3.js";
251
+ } from "./chunk-MYDA2GA2.js";
246
252
  import {
247
253
  searchWorkProductLedgerEntries
248
254
  } from "./chunk-G7NYVKD6.js";
@@ -255,10 +261,10 @@ import {
255
261
  import {
256
262
  runNamespaceMaintenanceFanout,
257
263
  summarizeNamespaceMaintenanceHealth
258
- } from "./chunk-FO6IK4IF.js";
264
+ } from "./chunk-YJJMJH6J.js";
259
265
  import {
260
266
  planNamespaceMaintenance
261
- } from "./chunk-SRMBMMTK.js";
267
+ } from "./chunk-HEKWNWNL.js";
262
268
  import {
263
269
  isAboveImportanceThreshold,
264
270
  scoreImportance
@@ -287,7 +293,7 @@ import {
287
293
  materializeAfterSemanticConsolidation,
288
294
  parseConsolidationResponse,
289
295
  parseOperatorAwareConsolidationResponse
290
- } from "./chunk-MVMNEU65.js";
296
+ } from "./chunk-X25NTN3W.js";
291
297
  import {
292
298
  semanticChunkContent
293
299
  } from "./chunk-2GBFKHBZ.js";
@@ -324,7 +330,7 @@ import {
324
330
  detectMeetings,
325
331
  embeddingsFromCosineHits,
326
332
  normalizeConnectorScope
327
- } from "./chunk-OLJYDGGP.js";
333
+ } from "./chunk-EBJL6HGR.js";
328
334
  import {
329
335
  compileCorrectionRule,
330
336
  correctionsFilePath,
@@ -336,13 +342,18 @@ import {
336
342
  resolveJournalSource,
337
343
  resolveVaultNotePath
338
344
  } from "./chunk-3KJTSCSX.js";
345
+ import {
346
+ decideRecognitionTier,
347
+ loadRecognitionIndex,
348
+ runRecognitionTier
349
+ } from "./chunk-4KQIWY4A.js";
339
350
  import {
340
351
  AMBIENT_CAPTURE_PROMPT_RULE,
341
352
  isHighImpactPersonalFact
342
353
  } from "./chunk-QW27DOHG.js";
343
354
  import {
344
355
  MeetingsInputError
345
- } from "./chunk-56C7OO3N.js";
356
+ } from "./chunk-KAPYPTPS.js";
346
357
  import {
347
358
  WearablesInputError,
348
359
  describeErrorForOperator
@@ -360,20 +371,24 @@ import {
360
371
  } from "./chunk-DGS34QSY.js";
361
372
  import {
362
373
  NamespaceCatalog
363
- } from "./chunk-JTPAXDSX.js";
374
+ } from "./chunk-6ZMIASYT.js";
364
375
  import {
365
376
  RecallResultFormatter,
366
377
  SessionContextCoordinator,
367
378
  capturePassiveCorrections,
368
379
  clusterByKey,
369
380
  detectPassiveCorrections
370
- } from "./chunk-OQZYHCWM.js";
381
+ } from "./chunk-2G2CVN2T.js";
371
382
  import {
372
383
  importCapsule
373
- } from "./chunk-ZHXSOMYH.js";
384
+ } from "./chunk-VVX5PZFS.js";
374
385
  import {
375
386
  isCodingGraphInstalled
376
387
  } from "./chunk-VQ7B2Q6M.js";
388
+ import {
389
+ listTrustZoneRecords,
390
+ searchTrustZoneRecords
391
+ } from "./chunk-ROBHL3GL.js";
377
392
  import {
378
393
  applyTrustScoreStage,
379
394
  buildTrustSignalsForRerank,
@@ -381,10 +396,6 @@ import {
381
396
  trustResultFor,
382
397
  trustResultKey
383
398
  } from "./chunk-GNVZQ5JN.js";
384
- import {
385
- listTrustZoneRecords,
386
- searchTrustZoneRecords
387
- } from "./chunk-ROBHL3GL.js";
388
399
  import {
389
400
  HourlySummarizer
390
401
  } from "./chunk-BXOPUJ3W.js";
@@ -396,7 +407,7 @@ import {
396
407
  } from "./chunk-5UBH37SL.js";
397
408
  import {
398
409
  buildXraySnapshot
399
- } from "./chunk-ECLY4NZA.js";
410
+ } from "./chunk-LZI6FWZW.js";
400
411
  import {
401
412
  objectiveStateStoreOverrideForNamespace,
402
413
  searchObjectiveStateSnapshots
@@ -407,10 +418,10 @@ import {
407
418
  isTopLevelArchivePath,
408
419
  journalPath,
409
420
  writeJournalFile
410
- } from "./chunk-2IVHOQRY.js";
421
+ } from "./chunk-2ERLN25A.js";
411
422
  import {
412
423
  searchHarmonicRetrieval
413
- } from "./chunk-UI6R2YUB.js";
424
+ } from "./chunk-IGDEKECC.js";
414
425
  import {
415
426
  ProfilingCollector
416
427
  } from "./chunk-NLE6TSLG.js";
@@ -428,7 +439,6 @@ import {
428
439
  shouldSkipImplicitExtraction
429
440
  } from "./chunk-B4EGAHHS.js";
430
441
  import {
431
- boundRecallContextComposition,
432
442
  composeRecallContext,
433
443
  contextBudgetForFooter,
434
444
  formatCuriosityFooter,
@@ -437,7 +447,7 @@ import {
437
447
  } from "./chunk-IHOXK2I6.js";
438
448
  import {
439
449
  NamespaceStorageRouter
440
- } from "./chunk-42BV46XS.js";
450
+ } from "./chunk-T73ZC7C5.js";
441
451
  import {
442
452
  pruneOrphanCueAnchors
443
453
  } from "./chunk-BMWN7B3Y.js";
@@ -504,7 +514,7 @@ import {
504
514
  } from "./chunk-TBBDFYXW.js";
505
515
  import {
506
516
  buildChainFollowupGenerator
507
- } from "./chunk-XUKUMBP3.js";
517
+ } from "./chunk-XRUOO7OT.js";
508
518
  import {
509
519
  QmdResultResolver,
510
520
  StorageManager,
@@ -523,7 +533,7 @@ import {
523
533
  reconstructFusionInputs,
524
534
  selfDeps,
525
535
  serializeFusionDay
526
- } from "./chunk-D2XUSZ24.js";
536
+ } from "./chunk-RIP2AOZW.js";
527
537
  import {
528
538
  bodyIsEscaped,
529
539
  decodeTranscriptBody,
@@ -540,12 +550,12 @@ import {
540
550
  import {
541
551
  NamespaceSearchRouter,
542
552
  namespaceCollectionName
543
- } from "./chunk-TZ44E732.js";
553
+ } from "./chunk-AIVRD66I.js";
544
554
  import {
545
555
  createConversationIndexRuntime,
546
556
  createSearchBackend,
547
557
  isSearchBackendEnabled
548
- } from "./chunk-JOP7W24J.js";
558
+ } from "./chunk-PLJ2MQFT.js";
549
559
  import {
550
560
  NoopSearchBackend
551
561
  } from "./chunk-CYEPCZN5.js";
@@ -839,7 +849,7 @@ import {
839
849
  } from "./chunk-3WCASNQZ.js";
840
850
 
841
851
  // src/orchestrator.ts
842
- import path21 from "path";
852
+ import path22 from "path";
843
853
  import { createHash as createHash9 } from "crypto";
844
854
 
845
855
  // src/orchestration/tier-migration-coordinator.ts
@@ -2390,7 +2400,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2390
2400
  namespaces,
2391
2401
  {
2392
2402
  readNamespaceMemories: async (ns) => (await this.getStorage(ns)).readAllMemories(),
2393
- readMemoryFrontmatter: async (path40, preferredNamespace) => {
2403
+ readMemoryFrontmatter: async (path41, preferredNamespace) => {
2394
2404
  if (!fallbackReader) {
2395
2405
  for (const ns of namespaces) {
2396
2406
  try {
@@ -2402,7 +2412,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2402
2412
  }
2403
2413
  if (!fallbackReader) return null;
2404
2414
  const memory = await this.readQmdResultMemory(
2405
- path40,
2415
+ path41,
2406
2416
  fallbackReader,
2407
2417
  namespaces,
2408
2418
  preferredNamespace
@@ -9195,7 +9205,7 @@ function createDependencyPropagationReplayReconciliation(host) {
9195
9205
  // src/orchestration/recall-internal.ts
9196
9206
  import { createHash as createHash6 } from "crypto";
9197
9207
  import { readFile as readFile5, stat, unlink as unlink2 } from "fs/promises";
9198
- import path11 from "path";
9208
+ import path12 from "path";
9199
9209
 
9200
9210
  // src/orchestration/graph-path-state-loader.ts
9201
9211
  import { lstat, opendir, realpath } from "fs/promises";
@@ -9879,7 +9889,7 @@ var GraphRecallCoordinator = class {
9879
9889
  }
9880
9890
  };
9881
9891
 
9882
- // src/procedural/procedure-recall.ts
9892
+ // src/experience/session-experience-recall.ts
9883
9893
  function tokenOverlapScore(prompt, memoryText) {
9884
9894
  const norm = (s) => s.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2);
9885
9895
  const promptTokens = new Set(norm(prompt));
@@ -9892,13 +9902,52 @@ function tokenOverlapScore(prompt, memoryText) {
9892
9902
  const union = /* @__PURE__ */ new Set([...promptTokens, ...memTokens]);
9893
9903
  return inter / Math.max(1, union.size);
9894
9904
  }
9895
- function scoreProcedureForPrompt(m, prompt, queryIntent) {
9905
+ function isSessionExperienceMemory(memory) {
9906
+ const hash = memory.frontmatter.structuredAttributes?.experience_session_hash;
9907
+ return typeof hash === "string" && hash.length > 0;
9908
+ }
9909
+ function scoreSessionExperienceForPrompt(memory, prompt) {
9910
+ if (!isSessionExperienceMemory(memory)) return null;
9911
+ const situation = memory.frontmatter.structuredAttributes?.experience_situation ?? "";
9912
+ const situationScore = tokenOverlapScore(prompt, situation);
9913
+ const bodyScore = tokenOverlapScore(prompt, memory.content);
9914
+ return Math.min(1, situationScore * 0.75 + bodyScore * 0.25);
9915
+ }
9916
+ function renderSessionExperiencePreview(memory) {
9917
+ if (!isSessionExperienceMemory(memory)) return null;
9918
+ const attrs = memory.frontmatter.structuredAttributes ?? {};
9919
+ const situation = (attrs.experience_situation ?? "").trim();
9920
+ const approach = (attrs.experience_approach ?? "").trim();
9921
+ const reflection = (attrs.experience_reflection ?? "").trim();
9922
+ if (situation.length === 0 && approach.length === 0 && reflection.length === 0) {
9923
+ return `Experience. ${memory.content.replace(/\s+/g, " ").trim()}`;
9924
+ }
9925
+ return `Experience. Situation: ${situation} Approach: ${approach} Reflection: ${reflection}`.replace(/\s+/g, " ").trim();
9926
+ }
9927
+
9928
+ // src/procedural/procedure-recall.ts
9929
+ function tokenOverlapScore2(prompt, memoryText) {
9930
+ const norm = (s) => s.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2);
9931
+ const promptTokens = new Set(norm(prompt));
9932
+ const memTokens = new Set(norm(memoryText));
9933
+ if (promptTokens.size === 0 || memTokens.size === 0) return 0;
9934
+ let inter = 0;
9935
+ for (const t of promptTokens) {
9936
+ if (memTokens.has(t)) inter++;
9937
+ }
9938
+ const union = /* @__PURE__ */ new Set([...promptTokens, ...memTokens]);
9939
+ return inter / Math.max(1, union.size);
9940
+ }
9941
+ function scoreProcedureForPrompt(m, prompt, queryIntent, experienceEnabled) {
9896
9942
  const memText = `${m.content}
9897
9943
  ${(m.frontmatter.tags ?? []).join(" ")}`;
9898
- const jaccard = tokenOverlapScore(prompt, memText);
9944
+ const jaccard = tokenOverlapScore2(prompt, memText);
9899
9945
  const memIntent = inferIntentFromText(m.content.slice(0, 2e3));
9900
9946
  const intentScore = intentCompatibilityScore(queryIntent, memIntent);
9901
- return jaccard * 0.55 + intentScore * 0.45;
9947
+ const base = jaccard * 0.55 + intentScore * 0.45;
9948
+ if (!experienceEnabled) return base;
9949
+ const experience = scoreSessionExperienceForPrompt(m, prompt);
9950
+ return experience === null ? base : Math.max(base, experience);
9902
9951
  }
9903
9952
  async function buildProcedureRecallSection(storage, prompt, config, options) {
9904
9953
  if (config.procedural?.enabled !== true) return null;
@@ -9914,9 +9963,10 @@ async function buildProcedureRecallSection(storage, prompt, config, options) {
9914
9963
  )
9915
9964
  );
9916
9965
  const all = await storage.readAllMemories();
9966
+ const experienceEnabled = config.sessionExperience?.enabled === true;
9917
9967
  const scored = all.filter(
9918
9968
  (m) => m.frontmatter.category === "procedure" && isActiveMemoryStatus(m.frontmatter.status) && (options?.partitionToolScoped !== true || canRecallToolScopedMemory(m.frontmatter, options.requestingConnector))
9919
- ).map((m) => ({ m, score: scoreProcedureForPrompt(m, trimmed, queryIntent) })).filter((x) => x.score > 0.04).sort((a, b) => b.score - a.score).slice(0, maxN);
9969
+ ).map((m) => ({ m, score: scoreProcedureForPrompt(m, trimmed, queryIntent, experienceEnabled) })).filter((x) => x.score > 0.04).sort((a, b) => b.score - a.score).slice(0, maxN);
9920
9970
  if (scored.length === 0) return null;
9921
9971
  if (options?.injectedMemories) {
9922
9972
  for (const { m } of scored) {
@@ -9926,7 +9976,8 @@ async function buildProcedureRecallSection(storage, prompt, config, options) {
9926
9976
  const security = resolveSecurityCapabilities(config);
9927
9977
  const blocks = scored.map(({ m, score }) => {
9928
9978
  const id = m.frontmatter.id;
9929
- const flat = m.content.replace(/\s+/g, " ").trim();
9979
+ const labeled = experienceEnabled ? renderSessionExperiencePreview(m) : null;
9980
+ const flat = (labeled ?? m.content).replace(/\s+/g, " ").trim();
9930
9981
  const preview = flat.slice(0, 320);
9931
9982
  const suffix = flat.length > 320 ? "\u2026" : "";
9932
9983
  const body = renderAuthorityBoundContent(`${preview}${suffix}`, m.frontmatter.origin, {
@@ -10264,6 +10315,104 @@ function resolveCompositeProfileStorage(options) {
10264
10315
  return { profileStorage, profileStorageDirs };
10265
10316
  }
10266
10317
 
10318
+ // src/orchestration/recall-recognition-search.ts
10319
+ import path11 from "path";
10320
+ async function fetchQmdMemoryResultsWithRecognitionSwap(deps, prompt, qmdFetchLimit, qmdHybridFetchLimit, options) {
10321
+ if (deps.config.recallRecognitionTier !== true || options.collection || options.namespacesEnabled !== true) {
10322
+ return deps.fetchQmdMemoryResultsWithArtifactTopUp(
10323
+ prompt,
10324
+ qmdFetchLimit,
10325
+ qmdHybridFetchLimit,
10326
+ options
10327
+ );
10328
+ }
10329
+ const namespaces = options.recallNamespaces.filter(Boolean);
10330
+ if (namespaces.length === 0) {
10331
+ return deps.fetchQmdMemoryResultsWithArtifactTopUp(
10332
+ prompt,
10333
+ qmdFetchLimit,
10334
+ qmdHybridFetchLimit,
10335
+ options
10336
+ );
10337
+ }
10338
+ throwIfRecallAborted(options.abortSignal);
10339
+ const maxEntries = deps.config.recognitionIndexMaxEntries;
10340
+ const recognitionNs = [];
10341
+ const vectorNs = [];
10342
+ for (const namespace of namespaces) {
10343
+ throwIfRecallAborted(options.abortSignal);
10344
+ const storage = await deps.storageRouter.storageFor(namespace);
10345
+ const index = await loadRecognitionIndex(storage.dir);
10346
+ const decision = decideRecognitionTier(index, { maxEntries });
10347
+ if (index !== null && decision.tier === "recognition") {
10348
+ recognitionNs.push({ namespace, storage, index });
10349
+ } else {
10350
+ vectorNs.push(namespace);
10351
+ }
10352
+ }
10353
+ if (recognitionNs.length === 0) {
10354
+ return deps.fetchQmdMemoryResultsWithArtifactTopUp(
10355
+ prompt,
10356
+ qmdFetchLimit,
10357
+ qmdHybridFetchLimit,
10358
+ options
10359
+ );
10360
+ }
10361
+ const recognize = async (recognitionPrompt) => {
10362
+ const reply = await deps.fastLlmForRerank.chatCompletion(
10363
+ [{ role: "user", content: recognitionPrompt }],
10364
+ { operation: "recognition-tier", priority: "recall-critical" }
10365
+ );
10366
+ return reply?.content;
10367
+ };
10368
+ const recognized = [];
10369
+ for (const { namespace, storage, index } of recognitionNs) {
10370
+ throwIfRecallAborted(options.abortSignal);
10371
+ try {
10372
+ const run = await runRecognitionTier(prompt, index.entries, recognize);
10373
+ recognized.push(
10374
+ ...await hitsFromIds(namespace, storage, index, run.ids)
10375
+ );
10376
+ } catch (err) {
10377
+ log.warn(
10378
+ `recognition tier degraded to vector search: recognizer failed${err instanceof Error ? ` (${err.message})` : ""}`
10379
+ );
10380
+ vectorNs.push(namespace);
10381
+ }
10382
+ }
10383
+ const vectorResults = vectorNs.length === 0 ? [] : await deps.fetchQmdMemoryResultsWithArtifactTopUp(
10384
+ prompt,
10385
+ qmdFetchLimit,
10386
+ qmdHybridFetchLimit,
10387
+ { ...options, recallNamespaces: vectorNs }
10388
+ );
10389
+ return dedupeResultsByNamespace(
10390
+ [...recognized, ...vectorResults],
10391
+ options.resolveNamespace,
10392
+ qmdFetchLimit
10393
+ );
10394
+ }
10395
+ async function hitsFromIds(namespace, storage, index, ids) {
10396
+ if (ids.length === 0) return [];
10397
+ const pathsById = await storage.findExistingMemoryPaths([...ids]);
10398
+ const descriptionById = new Map(index.entries.map((entry) => [entry.id, entry.description]));
10399
+ const hits = [];
10400
+ for (const [offset, id] of ids.entries()) {
10401
+ const absPath = pathsById.get(id)?.[0];
10402
+ if (!absPath) continue;
10403
+ const rel = path11.relative(storage.dir, absPath).split(path11.sep).join("/");
10404
+ if (!rel || rel.startsWith("..")) continue;
10405
+ hits.push({
10406
+ docid: `${namespace}:${rel}`,
10407
+ namespace,
10408
+ path: rel,
10409
+ score: ids.length - offset,
10410
+ snippet: descriptionById.get(id) ?? id
10411
+ });
10412
+ }
10413
+ return hits;
10414
+ }
10415
+
10267
10416
  // src/orchestration/recall-internal.ts
10268
10417
  var RecallInternalCoordinator = class {
10269
10418
  constructor(deps) {
@@ -10498,7 +10647,7 @@ var RecallInternalCoordinator = class {
10498
10647
  const graphExpandedResultPaths = /* @__PURE__ */ new Set();
10499
10648
  const graphSourceLabelsForPath = (resultPath) => {
10500
10649
  const labels = [];
10501
- const normalizedPath = resultPath.split(path11.sep).join("/");
10650
+ const normalizedPath = resultPath.split(path12.sep).join("/");
10502
10651
  const isEntityPath = normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/");
10503
10652
  if (graphBaselinePaths.has(resultPath)) labels.push("baseline");
10504
10653
  if (graphExpandedResultPaths.has(resultPath))
@@ -11824,7 +11973,8 @@ ${rows.join("\n")}
11824
11973
  }) : Promise.resolve([])
11825
11974
  ]) : null;
11826
11975
  try {
11827
- const filteredResults = await this.deps.fetchQmdMemoryResultsWithArtifactTopUp(
11976
+ const filteredResults = await fetchQmdMemoryResultsWithRecognitionSwap(
11977
+ this.deps,
11828
11978
  retrievalQuery,
11829
11979
  qmdFetchLimit,
11830
11980
  qmdHybridFetchLimit,
@@ -12034,11 +12184,11 @@ ${formatted}`;
12034
12184
  if (!resolveRecallAuxiliaryCapabilities(this.deps.config).compactionReset) return null;
12035
12185
  const workspaceDir = compactionWorkspaceDir || this.deps.config.workspaceDir || defaultWorkspaceDir();
12036
12186
  const safeSessionKey = sanitizeSessionKeyForFilename(effectiveSessionKey);
12037
- const signalPath = path11.join(
12187
+ const signalPath = path12.join(
12038
12188
  workspaceDir,
12039
12189
  `.compaction-reset-signal-${safeSessionKey}`
12040
12190
  );
12041
- const bootPath = path11.join(workspaceDir, "BOOT.md");
12191
+ const bootPath = path12.join(workspaceDir, "BOOT.md");
12042
12192
  try {
12043
12193
  const signalStat = await stat(signalPath).catch(() => null);
12044
12194
  if (!signalStat) return null;
@@ -14015,27 +14165,15 @@ ${tmtNode.summary}`
14015
14165
  recalledMemoryNamespaces
14016
14166
  );
14017
14167
  const recalledContext = assembledRecall.sections.join("\n\n---\n\n");
14018
- const composition = boundRecallContextComposition({
14168
+ const { composition, context, truncated: compositionTruncated } = decideRecallContextComposition({
14019
14169
  context: recalledContext,
14170
+ compactContext: compactRecallContextFromBuckets(sectionBuckets),
14020
14171
  footer: curiosityFooter,
14021
14172
  maxChars: recallBudgetChars
14022
14173
  });
14023
- const context = composeRecallContext(composition);
14024
- try {
14025
- const observerResult = options.onContextComposition?.(composition);
14026
- if (observerResult && typeof observerResult.then === "function") {
14027
- void Promise.resolve(observerResult).catch((err) => log.warn(
14028
- "recall: context composition observer rejected",
14029
- err
14030
- ));
14031
- }
14032
- } catch (err) {
14174
+ notifyContextComposition(options.onContextComposition, composition, (err) => {
14033
14175
  log.warn("recall: context composition observer failed open", err);
14034
- }
14035
- const compositionTruncated = context.length < composeRecallContext({
14036
- context: recalledContext,
14037
- footer: curiosityFooter
14038
- }).length;
14176
+ });
14039
14177
  const includedSections = [...assembledRecall.includedIds];
14040
14178
  const omittedSections = [...assembledRecall.omittedIds];
14041
14179
  if (composition.footer && !includedSections.includes("questions")) includedSections.push("questions");
@@ -14203,6 +14341,7 @@ ${tmtNode.summary}`
14203
14341
  chars: this.deps.getRecallBudgetChars(options.budgetCharsOverride),
14204
14342
  used: context.length
14205
14343
  },
14344
+ ...composition.degradation ? { degradation: composition.degradation } : {},
14206
14345
  sessionKey,
14207
14346
  namespace: selfNamespace,
14208
14347
  traceId,
@@ -14324,10 +14463,10 @@ ${tmtNode.summary}`
14324
14463
 
14325
14464
  // src/orchestration/recall-search-pipeline.ts
14326
14465
  import { createHash as createHash7 } from "crypto";
14327
- import path13 from "path";
14466
+ import path14 from "path";
14328
14467
 
14329
14468
  // src/orchestration/recall-search-prefilter.ts
14330
- import path12 from "path";
14469
+ import path13 from "path";
14331
14470
  async function fetchActiveArtifactsForNamespace(deps, namespace, prompt, targetCount, options = {}) {
14332
14471
  const storage = await deps.storageRouter.storageFor(namespace);
14333
14472
  let fetchLimit = computeArtifactCandidateFetchLimit(targetCount);
@@ -14456,7 +14595,7 @@ async function searchEmbeddingFallback(deps, query, limit) {
14456
14595
  if (hits.length === 0) return [];
14457
14596
  const results = [];
14458
14597
  for (const hit of hits) {
14459
- const fullPath = path12.isAbsolute(hit.path) ? hit.path : path12.join(deps.config.memoryDir, hit.path);
14598
+ const fullPath = path13.isAbsolute(hit.path) ? hit.path : path13.join(deps.config.memoryDir, hit.path);
14460
14599
  const memory = await deps.storage.readMemoryByPath(fullPath);
14461
14600
  if (!memory) continue;
14462
14601
  results.push({
@@ -14834,7 +14973,7 @@ var RecallSearchPipelineCoordinator = class {
14834
14973
  const storage = await this.deps.storageRouter.storageFor(namespace);
14835
14974
  const storageDir = typeof storage.dir === "string" && storage.dir ? storage.dir : null;
14836
14975
  if (!storageDir) continue;
14837
- const recallRoot = path13.resolve(storageDir);
14976
+ const recallRoot = path14.resolve(storageDir);
14838
14977
  if (seenRecallRoots.has(recallRoot)) continue;
14839
14978
  seenRecallRoots.add(recallRoot);
14840
14979
  recallRoots.push(recallRoot);
@@ -14858,8 +14997,8 @@ var RecallSearchPipelineCoordinator = class {
14858
14997
  if (resolvedCold) scopedResults.push(resolvedCold.result);
14859
14998
  continue;
14860
14999
  }
14861
- if (path13.isAbsolute(result.path)) {
14862
- if (recallRoots.some((recallRoot) => isPathInsideStorageRoot(recallRoot, path13.resolve(result.path)))) {
15000
+ if (path14.isAbsolute(result.path)) {
15001
+ if (recallRoots.some((recallRoot) => isPathInsideStorageRoot(recallRoot, path14.resolve(result.path)))) {
14863
15002
  scopedResults.push(result);
14864
15003
  }
14865
15004
  continue;
@@ -16053,7 +16192,7 @@ var TurnIngestionCoordinator = class {
16053
16192
 
16054
16193
  // src/orchestration/recall-introspection.ts
16055
16194
  import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
16056
- import path15 from "path";
16195
+ import path16 from "path";
16057
16196
 
16058
16197
  // src/taxonomy/default-taxonomy.ts
16059
16198
  var DEFAULT_TAXONOMY = {
@@ -16176,7 +16315,7 @@ function generateResolverDocument(taxonomy) {
16176
16315
 
16177
16316
  // src/taxonomy/taxonomy-loader.ts
16178
16317
  import { readFile as readFile6, mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
16179
- import path14 from "path";
16318
+ import path15 from "path";
16180
16319
  var TAXONOMY_DIR = ".taxonomy";
16181
16320
  var TAXONOMY_FILE = "taxonomy.json";
16182
16321
  var MAX_SLUG_LENGTH = 32;
@@ -16274,7 +16413,7 @@ function validateTaxonomy(taxonomy) {
16274
16413
  }
16275
16414
  }
16276
16415
  async function loadTaxonomy(memoryDir) {
16277
- const taxonomyPath = path14.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
16416
+ const taxonomyPath = path15.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
16278
16417
  let raw;
16279
16418
  try {
16280
16419
  raw = await readFile6(taxonomyPath, "utf-8");
@@ -16324,16 +16463,16 @@ async function loadTaxonomy(memoryDir) {
16324
16463
  }
16325
16464
  async function saveTaxonomy(memoryDir, taxonomy) {
16326
16465
  validateTaxonomy(taxonomy);
16327
- const dir = path14.join(memoryDir, TAXONOMY_DIR);
16466
+ const dir = path15.join(memoryDir, TAXONOMY_DIR);
16328
16467
  await mkdir4(dir, { recursive: true });
16329
- const filePath = path14.join(dir, TAXONOMY_FILE);
16468
+ const filePath = path15.join(dir, TAXONOMY_FILE);
16330
16469
  await writeFile4(filePath, JSON.stringify(taxonomy, null, 2) + "\n", "utf-8");
16331
16470
  }
16332
16471
  function getTaxonomyDir(memoryDir) {
16333
- return path14.join(memoryDir, TAXONOMY_DIR);
16472
+ return path15.join(memoryDir, TAXONOMY_DIR);
16334
16473
  }
16335
16474
  function getTaxonomyFilePath(memoryDir) {
16336
- return path14.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
16475
+ return path15.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
16337
16476
  }
16338
16477
 
16339
16478
  // src/orchestration/recall-introspection.ts
@@ -16357,7 +16496,7 @@ var RecallIntrospectionCoordinator = class {
16357
16496
  }
16358
16497
  async getLastGraphRecallSnapshot(namespace) {
16359
16498
  const storage = await this.deps.getStorage(namespace);
16360
- const snapshotPath = path15.join(
16499
+ const snapshotPath = path16.join(
16361
16500
  storage.dir,
16362
16501
  "state",
16363
16502
  "last_graph_recall.json"
@@ -16396,7 +16535,7 @@ var RecallIntrospectionCoordinator = class {
16396
16535
  }
16397
16536
  async getLastIntentSnapshot(namespace) {
16398
16537
  const storage = await this.deps.getStorage(namespace);
16399
- const snapshotPath = path15.join(storage.dir, "state", "last_intent.json");
16538
+ const snapshotPath = path16.join(storage.dir, "state", "last_intent.json");
16400
16539
  try {
16401
16540
  const raw = await readFile7(snapshotPath, "utf-8");
16402
16541
  const parsed = JSON.parse(raw);
@@ -16429,7 +16568,7 @@ var RecallIntrospectionCoordinator = class {
16429
16568
  }
16430
16569
  async getLastQmdRecallSnapshot(namespace) {
16431
16570
  const storage = await this.deps.getStorage(namespace);
16432
- const snapshotPath = path15.join(
16571
+ const snapshotPath = path16.join(
16433
16572
  storage.dir,
16434
16573
  "state",
16435
16574
  "last_qmd_recall.json"
@@ -16721,12 +16860,12 @@ var RecallIntrospectionCoordinator = class {
16721
16860
  }
16722
16861
  async recordLastIntentSnapshot(options) {
16723
16862
  try {
16724
- const snapshotPath = path15.join(
16863
+ const snapshotPath = path16.join(
16725
16864
  options.storage.dir,
16726
16865
  "state",
16727
16866
  "last_intent.json"
16728
16867
  );
16729
- await mkdir5(path15.dirname(snapshotPath), { recursive: true });
16868
+ await mkdir5(path16.dirname(snapshotPath), { recursive: true });
16730
16869
  await writeFile5(
16731
16870
  snapshotPath,
16732
16871
  JSON.stringify(options.snapshot, null, 2),
@@ -16738,12 +16877,12 @@ var RecallIntrospectionCoordinator = class {
16738
16877
  }
16739
16878
  async recordLastQmdRecallSnapshot(options) {
16740
16879
  try {
16741
- const snapshotPath = path15.join(
16880
+ const snapshotPath = path16.join(
16742
16881
  options.storage.dir,
16743
16882
  "state",
16744
16883
  "last_qmd_recall.json"
16745
16884
  );
16746
- await mkdir5(path15.dirname(snapshotPath), { recursive: true });
16885
+ await mkdir5(path16.dirname(snapshotPath), { recursive: true });
16747
16886
  await writeFile5(
16748
16887
  snapshotPath,
16749
16888
  JSON.stringify(options.snapshot, null, 2),
@@ -16758,8 +16897,8 @@ var RecallIntrospectionCoordinator = class {
16758
16897
  const stateDir = await this.deps.resolveStateDirForNamespace(
16759
16898
  options.namespace
16760
16899
  );
16761
- const snapshotPath = path15.join(stateDir, "last_intent.json");
16762
- await mkdir5(path15.dirname(snapshotPath), { recursive: true });
16900
+ const snapshotPath = path16.join(stateDir, "last_intent.json");
16901
+ await mkdir5(path16.dirname(snapshotPath), { recursive: true });
16763
16902
  await writeFile5(
16764
16903
  snapshotPath,
16765
16904
  JSON.stringify(options.snapshot, null, 2),
@@ -16773,7 +16912,7 @@ var RecallIntrospectionCoordinator = class {
16773
16912
 
16774
16913
  // src/orchestration/orchestrator-init.ts
16775
16914
  import { readdir as readdir2, stat as stat2, unlink as unlink3 } from "fs/promises";
16776
- import path16 from "path";
16915
+ import path17 from "path";
16777
16916
 
16778
16917
  // src/orchestration/startup-collection-checks.ts
16779
16918
  async function startupDiscoveryWithTimeout(discover, configuredFallback, timeoutMs = qmdStartupCollectionCheckTimeoutMs()) {
@@ -17089,7 +17228,7 @@ var OrchestratorInitCoordinator = class {
17089
17228
  const files = await readdir2(wsDir).catch(() => []);
17090
17229
  for (const f of files) {
17091
17230
  if (!f.startsWith(".compaction-reset-signal-")) continue;
17092
- const fp = path16.join(wsDir, f);
17231
+ const fp = path17.join(wsDir, f);
17093
17232
  const s = await stat2(fp).catch(() => null);
17094
17233
  if (s && Date.now() - s.mtimeMs >= COMPACTION_SIGNAL_MAX_AGE_MS) {
17095
17234
  await unlink3(fp).catch(() => {
@@ -17508,7 +17647,7 @@ var OrchestratorInitCoordinator = class {
17508
17647
  };
17509
17648
 
17510
17649
  // src/orchestration/persistence-index.ts
17511
- import path17 from "path";
17650
+ import path18 from "path";
17512
17651
  var PersistenceIndexCoordinator = class {
17513
17652
  constructor(deps) {
17514
17653
  this.deps = deps;
@@ -17700,7 +17839,7 @@ var PersistenceIndexCoordinator = class {
17700
17839
  const allMems = allMemsForGraph ?? [];
17701
17840
  for (const m of allMems) {
17702
17841
  if (m.frontmatter.entityRef === entityRef) {
17703
- const rel = path17.relative(storage.dir, m.path);
17842
+ const rel = path18.relative(storage.dir, m.path);
17704
17843
  if (rel !== memoryRelPath) entitySiblings.push(rel);
17705
17844
  }
17706
17845
  }
@@ -17855,7 +17994,7 @@ var PersistenceIndexCoordinator = class {
17855
17994
 
17856
17995
  // src/orchestration/workspace-ops.ts
17857
17996
  import { lstat as lstat2, mkdir as mkdir6, readFile as readFile8, readdir as readdir3, realpath as realpath2, writeFile as writeFile6 } from "fs/promises";
17858
- import path18 from "path";
17997
+ import path19 from "path";
17859
17998
 
17860
17999
  // src/maintenance/pattern-reinforcement.ts
17861
18000
  function patternReinforcementKey(content) {
@@ -19759,8 +19898,8 @@ var MeetingsService = class {
19759
19898
  // src/orchestration/workspace-ops.ts
19760
19899
  var MEETINGS_BUILD_DEBOUNCE_MS = 5e3;
19761
19900
  function matchesMemoryPath(candidatePath, requestedPath, memoryDir) {
19762
- const normalizedCandidate = path18.resolve(candidatePath);
19763
- return normalizedCandidate === path18.resolve(requestedPath) || normalizedCandidate === path18.resolve(memoryDir, requestedPath);
19901
+ const normalizedCandidate = path19.resolve(candidatePath);
19902
+ return normalizedCandidate === path19.resolve(requestedPath) || normalizedCandidate === path19.resolve(memoryDir, requestedPath);
19764
19903
  }
19765
19904
  function accessTrackingPathCandidates(storageDir, memoryPath) {
19766
19905
  const candidates = qmdResultPathCandidates(storageDir, memoryPath);
@@ -19768,12 +19907,12 @@ function accessTrackingPathCandidates(storageDir, memoryPath) {
19768
19907
  if (!parts) return candidates;
19769
19908
  candidates.push(
19770
19909
  ...qmdResultPathCandidates(storageDir, parts.relativePath),
19771
- ...qmdResultPathCandidates(path18.join(storageDir, "cold"), parts.relativePath)
19910
+ ...qmdResultPathCandidates(path19.join(storageDir, "cold"), parts.relativePath)
19772
19911
  );
19773
19912
  return [...new Set(candidates)];
19774
19913
  }
19775
19914
  function canonicalMemoryPath(memoryPath, memoryDir) {
19776
- return path18.resolve(path18.isAbsolute(memoryPath) ? memoryPath : path18.resolve(memoryDir, memoryPath));
19915
+ return path19.resolve(path19.isAbsolute(memoryPath) ? memoryPath : path19.resolve(memoryDir, memoryPath));
19777
19916
  }
19778
19917
  var WorkspaceOpsCoordinator = class {
19779
19918
  constructor(deps) {
@@ -19855,15 +19994,15 @@ var WorkspaceOpsCoordinator = class {
19855
19994
  this.deps.lastFileHygieneRunAtMs = now;
19856
19995
  if (hygiene.rotateEnabled) {
19857
19996
  for (const rel of hygiene.rotatePaths) {
19858
- const abs = path18.isAbsolute(rel) ? rel : path18.join(this.deps.config.workspaceDir, rel);
19997
+ const abs = path19.isAbsolute(rel) ? rel : path19.join(this.deps.config.workspaceDir, rel);
19859
19998
  try {
19860
19999
  const raw = await readFile8(abs, "utf-8");
19861
20000
  if (raw.length > hygiene.rotateMaxBytes) {
19862
- const archiveDir = path18.join(
20001
+ const archiveDir = path19.join(
19863
20002
  this.deps.config.workspaceDir,
19864
20003
  hygiene.archiveDir
19865
20004
  );
19866
- const base = path18.basename(abs);
20005
+ const base = path19.basename(abs);
19867
20006
  const prefix = base.toUpperCase().replace(/\.MD$/i, "").replace(/[^A-Z0-9]+/g, "-") || "FILE";
19868
20007
  const { newContent } = await rotateMarkdownFileToArchive({
19869
20008
  filePath: abs,
@@ -19888,8 +20027,8 @@ var WorkspaceOpsCoordinator = class {
19888
20027
  log.warn(w.message);
19889
20028
  }
19890
20029
  if (hygiene.warningsLogEnabled && warnings.length > 0) {
19891
- const fp = path18.join(this.deps.config.memoryDir, hygiene.warningsLogPath);
19892
- await mkdir6(path18.dirname(fp), { recursive: true });
20030
+ const fp = path19.join(this.deps.config.memoryDir, hygiene.warningsLogPath);
20031
+ await mkdir6(path19.dirname(fp), { recursive: true });
19893
20032
  const stamp = (/* @__PURE__ */ new Date()).toISOString();
19894
20033
  const block = `
19895
20034
 
@@ -19929,7 +20068,7 @@ var WorkspaceOpsCoordinator = class {
19929
20068
  for (const categoryDir of RECALL_FALLBACK_DIRS) {
19930
20069
  if (memoryRootReal === null) break;
19931
20070
  for (const date of datesToScan) {
19932
- const dateDir = path18.join(storage.dir, categoryDir, date);
20071
+ const dateDir = path19.join(storage.dir, categoryDir, date);
19933
20072
  try {
19934
20073
  const dirStat = await lstat2(dateDir);
19935
20074
  if (dirStat.isSymbolicLink() || !dirStat.isDirectory()) continue;
@@ -19938,7 +20077,7 @@ var WorkspaceOpsCoordinator = class {
19938
20077
  for (const entry of entries) {
19939
20078
  if (entry.isSymbolicLink()) continue;
19940
20079
  if (!entry.name.endsWith(".md")) continue;
19941
- const fullPath = path18.join(dateDir, entry.name);
20080
+ const fullPath = path19.join(dateDir, entry.name);
19942
20081
  try {
19943
20082
  assertPathInsideRoot(memoryRootReal, await realpath2(fullPath), fullPath);
19944
20083
  const memory = await storage.readMemoryByPath(fullPath);
@@ -19960,13 +20099,13 @@ var WorkspaceOpsCoordinator = class {
19960
20099
  return a.frontmatter.created < b.frontmatter.created ? -1 : 1;
19961
20100
  });
19962
20101
  const hourlySummaries = [];
19963
- const hourlyBaseDir = path18.join(storage.dir, "summaries", "hourly");
20102
+ const hourlyBaseDir = path19.join(storage.dir, "summaries", "hourly");
19964
20103
  try {
19965
20104
  const sessionKeys = await readdir3(hourlyBaseDir, { withFileTypes: true });
19966
20105
  for (const sk of sessionKeys) {
19967
20106
  if (!sk.isDirectory()) continue;
19968
20107
  for (const date of datesToScan) {
19969
- const summaryFile = path18.join(hourlyBaseDir, sk.name, `${date}.md`);
20108
+ const summaryFile = path19.join(hourlyBaseDir, sk.name, `${date}.md`);
19970
20109
  try {
19971
20110
  const raw = await readFile8(summaryFile, "utf-8");
19972
20111
  const filtered = filterHourlySummaryMarkdownForLocalDay(
@@ -20443,18 +20582,18 @@ ${reflectionsContent.trim()}
20443
20582
  // src/orchestration/namespace-read-fanout.ts
20444
20583
  import { existsSync, readFileSync } from "fs";
20445
20584
  import { stat as stat3 } from "fs/promises";
20446
- import path20 from "path";
20585
+ import path21 from "path";
20447
20586
 
20448
20587
  // src/orchestration/orchestrator-namespace-scope.ts
20449
- import path19 from "path";
20588
+ import path20 from "path";
20450
20589
  function computeSemanticDedupScope(targetStorage, config) {
20451
20590
  if (!resolveNamespaceCapabilities(config).namespaces) return {};
20452
- const memoryDir = path19.resolve(config.memoryDir);
20453
- const storageDir = path19.resolve(targetStorage.dir);
20591
+ const memoryDir = path20.resolve(config.memoryDir);
20592
+ const storageDir = path20.resolve(targetStorage.dir);
20454
20593
  if (storageDir === memoryDir) {
20455
20594
  return { pathExcludePrefixes: ["namespaces/"] };
20456
20595
  }
20457
- let rel = path19.relative(memoryDir, storageDir);
20596
+ let rel = path20.relative(memoryDir, storageDir);
20458
20597
  if (!rel || rel.startsWith("..")) {
20459
20598
  log.debug(
20460
20599
  `semantic dedup: target storage dir ${storageDir} is outside memoryDir ${memoryDir}; scoping lookup to absolute path prefix`
@@ -20507,7 +20646,7 @@ var NamespaceReadFanoutCoordinator = class {
20507
20646
  loadNamespaceStorageDirHintsFromCatalog() {
20508
20647
  if (this.deps.namespaceStorageDirHintsLoaded || !this.deps.namespaceCatalog.enabled) return;
20509
20648
  this.deps.namespaceStorageDirHintsLoaded = true;
20510
- const catalogPath = path20.join(this.deps.config.memoryDir, "state", "namespaces.jsonl");
20649
+ const catalogPath = path21.join(this.deps.config.memoryDir, "state", "namespaces.jsonl");
20511
20650
  if (!existsSync(catalogPath)) return;
20512
20651
  let body;
20513
20652
  try {
@@ -20544,7 +20683,7 @@ var NamespaceReadFanoutCoordinator = class {
20544
20683
  if (!this.deps.storageDirMatchesNamespaceHint(record.namespace, record.storageDir)) {
20545
20684
  continue;
20546
20685
  }
20547
- const resolvedStorageDir = path20.resolve(record.storageDir);
20686
+ const resolvedStorageDir = path21.resolve(record.storageDir);
20548
20687
  const current = preferredByStorageDir.get(resolvedStorageDir);
20549
20688
  preferredByStorageDir.set(
20550
20689
  resolvedStorageDir,
@@ -20729,12 +20868,12 @@ var NamespaceReadFanoutCoordinator = class {
20729
20868
  }
20730
20869
  async resolveStateDirForNamespace(namespace) {
20731
20870
  if (!resolveNamespaceCapabilities(this.deps.config).namespaces) {
20732
- return path20.join(this.deps.config.memoryDir, "state");
20871
+ return path21.join(this.deps.config.memoryDir, "state");
20733
20872
  }
20734
20873
  if (namespace !== this.deps.config.defaultNamespace) {
20735
- return path20.join(this.deps.config.memoryDir, "namespaces", namespace, "state");
20874
+ return path21.join(this.deps.config.memoryDir, "namespaces", namespace, "state");
20736
20875
  }
20737
- const candidate = path20.join(
20876
+ const candidate = path21.join(
20738
20877
  this.deps.config.memoryDir,
20739
20878
  "namespaces",
20740
20879
  this.deps.config.defaultNamespace
@@ -20742,11 +20881,11 @@ var NamespaceReadFanoutCoordinator = class {
20742
20881
  try {
20743
20882
  const candidateStat = await stat3(candidate);
20744
20883
  if (candidateStat.isDirectory()) {
20745
- return path20.join(candidate, "state");
20884
+ return path21.join(candidate, "state");
20746
20885
  }
20747
20886
  } catch {
20748
20887
  }
20749
- return path20.join(this.deps.config.memoryDir, "state");
20888
+ return path21.join(this.deps.config.memoryDir, "state");
20750
20889
  }
20751
20890
  namespaceFromPath(p) {
20752
20891
  if (!resolveNamespaceCapabilities(this.deps.config).namespaces) return this.deps.config.defaultNamespace;
@@ -20878,7 +21017,12 @@ var RecallEntryCoordinator = class {
20878
21017
  } catch (err) {
20879
21018
  this.deps.logRecallFailure(err);
20880
21019
  this.deps.profiler.endTrace();
20881
- return "";
21020
+ const missing = options.abortSignal?.aborted ? null : recallFailureComposition(err);
21021
+ if (!missing) return "";
21022
+ notifyContextComposition(options.onContextComposition, missing, (observerErr) => {
21023
+ log.warn("recall: context composition observer failed open", observerErr);
21024
+ });
21025
+ return composeRecallContext(missing);
20882
21026
  } finally {
20883
21027
  options.abortSignal?.removeEventListener("abort", onAbort);
20884
21028
  }
@@ -21196,7 +21340,7 @@ var Orchestrator = class {
21196
21340
  if (this.destroyed) throw new Error("orchestrator has been destroyed");
21197
21341
  if (!this._dependencyPropagationDelivery) {
21198
21342
  this._dependencyPropagationDelivery = new DependencyPropagationDelivery({
21199
- queueRoot: path21.join(this.config.memoryDir, "state", "dependency-propagation"),
21343
+ queueRoot: path22.join(this.config.memoryDir, "state", "dependency-propagation"),
21200
21344
  config: this.config,
21201
21345
  extraction: this.extraction,
21202
21346
  getStorage: (namespace) => this.getStorage(namespace),
@@ -21551,7 +21695,7 @@ var Orchestrator = class {
21551
21695
  const defaultNs = normalizeNamespaceIdentity(this.config.defaultNamespace);
21552
21696
  if (ns !== defaultNs && !isSafeRouteNamespace(ns)) return;
21553
21697
  if (!this.storageDirMatchesNamespaceHint(ns, storageDir)) return;
21554
- const resolvedStorageDir = path21.resolve(storageDir);
21698
+ const resolvedStorageDir = path22.resolve(storageDir);
21555
21699
  let hints = this.namespaceStorageDirHints.get(resolvedStorageDir);
21556
21700
  if (!hints) {
21557
21701
  hints = /* @__PURE__ */ new Set();
@@ -21562,21 +21706,21 @@ var Orchestrator = class {
21562
21706
  storageDirMatchesNamespaceHint(namespace, storageDir) {
21563
21707
  const ns = normalizeNamespaceIdentity(namespace);
21564
21708
  if (!ns) return false;
21565
- const resolvedStorageDir = path21.resolve(storageDir);
21566
- const resolvedMemoryDir = path21.resolve(this.config.memoryDir);
21709
+ const resolvedStorageDir = path22.resolve(storageDir);
21710
+ const resolvedMemoryDir = path22.resolve(this.config.memoryDir);
21567
21711
  const defaultNs = normalizeNamespaceIdentity(this.config.defaultNamespace);
21568
21712
  if (resolvedStorageDir === resolvedMemoryDir) return ns === defaultNs;
21569
- const resolvedNamespacesDir = path21.join(resolvedMemoryDir, "namespaces");
21713
+ const resolvedNamespacesDir = path22.join(resolvedMemoryDir, "namespaces");
21570
21714
  if (!isPathInsideStorageRoot(resolvedNamespacesDir, resolvedStorageDir)) return false;
21571
- const rawRoot = path21.resolve(resolvedNamespacesDir, ns);
21572
- const tokenRoot = path21.resolve(resolvedNamespacesDir, namespaceIdentityToken(ns));
21715
+ const rawRoot = path22.resolve(resolvedNamespacesDir, ns);
21716
+ const tokenRoot = path22.resolve(resolvedNamespacesDir, namespaceIdentityToken(ns));
21573
21717
  return resolvedStorageDir === rawRoot || resolvedStorageDir === tokenRoot;
21574
21718
  }
21575
21719
  namespaceStorageDirHintOwnershipRank(record, resolvedStorageDir, configured) {
21576
- if (resolvedStorageDir === path21.resolve(this.config.memoryDir)) {
21720
+ if (resolvedStorageDir === path22.resolve(this.config.memoryDir)) {
21577
21721
  return record.namespace === normalizeNamespaceIdentity(this.config.defaultNamespace) ? 0 : 3;
21578
21722
  }
21579
- const leaf = path21.basename(resolvedStorageDir);
21723
+ const leaf = path22.basename(resolvedStorageDir);
21580
21724
  const tokenOwnsRoot = namespaceIdentityToken(record.namespace) === leaf;
21581
21725
  if (tokenOwnsRoot && configured.has(record.namespace)) return 0;
21582
21726
  if (record.namespace === leaf) return 1;
@@ -21717,7 +21861,7 @@ var Orchestrator = class {
21717
21861
  StorageManager.setOkfConformanceDefault(config.memoryDir, config.okf?.conformanceEnabled);
21718
21862
  this.profiler = new ProfilingCollector({
21719
21863
  enabled: resolvePipelineProcessingCapabilities(this.config).profiling,
21720
- storageDir: config.profilingStorageDir || path21.join(config.memoryDir, "profiling"),
21864
+ storageDir: config.profilingStorageDir || path22.join(config.memoryDir, "profiling"),
21721
21865
  maxTraces: config.profilingMaxTraces
21722
21866
  });
21723
21867
  this.namespaceCatalog = new NamespaceCatalog(config);
@@ -21804,7 +21948,7 @@ var Orchestrator = class {
21804
21948
  this.compounding = resolveConsolidationCapabilities(config).compounding ? new CompoundingEngine(config, this.storage) : void 0;
21805
21949
  this.buffer = new SmartBuffer(config, this.storage);
21806
21950
  this.transcript = new TranscriptManager(config);
21807
- this.conversationIndexDir = path21.join(
21951
+ this.conversationIndexDir = path22.join(
21808
21952
  config.memoryDir,
21809
21953
  "conversation-index",
21810
21954
  "chunks"
@@ -21954,7 +22098,7 @@ var Orchestrator = class {
21954
22098
  saveContentHashIndexes: () => this.saveContentHashIndexes()
21955
22099
  });
21956
22100
  this.threading = new ThreadingManager(
21957
- path21.join(config.memoryDir, "threads"),
22101
+ path22.join(config.memoryDir, "threads"),
21958
22102
  config.threadingGapMinutes
21959
22103
  );
21960
22104
  const lifecycleCaps = resolveMemoryLifecycleCapabilities(config);
@@ -24047,9 +24191,9 @@ function readStructuralSymbol(entry) {
24047
24191
  const rec = entry;
24048
24192
  const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
24049
24193
  if (!symbol) return null;
24050
- const path40 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
24194
+ const path41 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
24051
24195
  const kind = typeof rec.kind === "string" && rec.kind.length > 0 ? rec.kind : void 0;
24052
- const item = path40 !== void 0 && kind !== void 0 ? { symbol, path: path40, kind } : path40 !== void 0 ? { symbol, path: path40 } : kind !== void 0 ? { symbol, kind } : { symbol };
24196
+ const item = path41 !== void 0 && kind !== void 0 ? { symbol, path: path41, kind } : path41 !== void 0 ? { symbol, path: path41 } : kind !== void 0 ? { symbol, kind } : { symbol };
24053
24197
  return item;
24054
24198
  }
24055
24199
  function classifySpawnError(err) {
@@ -24123,7 +24267,7 @@ var DEFAULT_GRACE_PERIOD_DAYS = 7;
24123
24267
 
24124
24268
  // src/binary-lifecycle/backend.ts
24125
24269
  import fsp from "fs/promises";
24126
- import path22 from "path";
24270
+ import path23 from "path";
24127
24271
  var FilesystemBackend = class {
24128
24272
  type = "filesystem";
24129
24273
  basePath;
@@ -24131,19 +24275,19 @@ var FilesystemBackend = class {
24131
24275
  if (!basePath || basePath.trim().length === 0) {
24132
24276
  throw new Error("FilesystemBackend requires a non-empty basePath");
24133
24277
  }
24134
- this.basePath = path22.resolve(basePath);
24278
+ this.basePath = path23.resolve(basePath);
24135
24279
  }
24136
24280
  resolveRemotePath(remotePath) {
24137
- const resolved = path22.isAbsolute(remotePath) ? path22.resolve(remotePath) : path22.resolve(this.basePath, remotePath);
24138
- const relative = path22.relative(this.basePath, resolved);
24139
- if (relative === ".." || relative.startsWith(`..${path22.sep}`) || path22.isAbsolute(relative)) {
24281
+ const resolved = path23.isAbsolute(remotePath) ? path23.resolve(remotePath) : path23.resolve(this.basePath, remotePath);
24282
+ const relative = path23.relative(this.basePath, resolved);
24283
+ if (relative === ".." || relative.startsWith(`..${path23.sep}`) || path23.isAbsolute(relative)) {
24140
24284
  throw new Error(`FilesystemBackend remotePath escapes basePath: ${JSON.stringify(remotePath)}`);
24141
24285
  }
24142
24286
  return resolved;
24143
24287
  }
24144
24288
  isInsideBase(candidate, realBase) {
24145
- const relative = path22.relative(realBase, candidate);
24146
- return relative === "" || relative !== ".." && !relative.startsWith(`..${path22.sep}`) && !path22.isAbsolute(relative);
24289
+ const relative = path23.relative(realBase, candidate);
24290
+ return relative === "" || relative !== ".." && !relative.startsWith(`..${path23.sep}`) && !path23.isAbsolute(relative);
24147
24291
  }
24148
24292
  async realBasePathIfExists() {
24149
24293
  try {
@@ -24172,13 +24316,13 @@ var FilesystemBackend = class {
24172
24316
  }
24173
24317
  async ensureSafeParentDirectory(dest) {
24174
24318
  const realBase = await this.ensureBaseDirectory();
24175
- const destDir = path22.dirname(dest);
24176
- const relativeDir = path22.relative(this.basePath, destDir);
24177
- const segments = relativeDir === "" ? [] : relativeDir.split(path22.sep);
24319
+ const destDir = path23.dirname(dest);
24320
+ const relativeDir = path23.relative(this.basePath, destDir);
24321
+ const segments = relativeDir === "" ? [] : relativeDir.split(path23.sep);
24178
24322
  let current = this.basePath;
24179
24323
  for (const segment of segments) {
24180
24324
  if (segment === "." || segment === "") continue;
24181
- current = path22.join(current, segment);
24325
+ current = path23.join(current, segment);
24182
24326
  try {
24183
24327
  const stat5 = await fsp.lstat(current);
24184
24328
  if (stat5.isSymbolicLink()) {
@@ -24206,13 +24350,13 @@ var FilesystemBackend = class {
24206
24350
  if (realBase === null) {
24207
24351
  return null;
24208
24352
  }
24209
- const destDir = path22.dirname(dest);
24210
- const relativeDir = path22.relative(this.basePath, destDir);
24211
- const segments = relativeDir === "" ? [] : relativeDir.split(path22.sep);
24353
+ const destDir = path23.dirname(dest);
24354
+ const relativeDir = path23.relative(this.basePath, destDir);
24355
+ const segments = relativeDir === "" ? [] : relativeDir.split(path23.sep);
24212
24356
  let current = this.basePath;
24213
24357
  for (const segment of segments) {
24214
24358
  if (segment === "." || segment === "") continue;
24215
- current = path22.join(current, segment);
24359
+ current = path23.join(current, segment);
24216
24360
  let stat5;
24217
24361
  try {
24218
24362
  stat5 = await fsp.lstat(current);
@@ -24260,7 +24404,7 @@ var FilesystemBackend = class {
24260
24404
  return dest;
24261
24405
  }
24262
24406
  async upload(localPath, remotePath) {
24263
- if (path22.isAbsolute(remotePath)) {
24407
+ if (path23.isAbsolute(remotePath)) {
24264
24408
  throw new Error(`FilesystemBackend upload remotePath must be relative: ${JSON.stringify(remotePath)}`);
24265
24409
  }
24266
24410
  const dest = this.resolveRemotePath(remotePath);
@@ -24333,7 +24477,7 @@ function createBackend(cfg) {
24333
24477
 
24334
24478
  // src/binary-lifecycle/scanner.ts
24335
24479
  import fsp2 from "fs/promises";
24336
- import path23 from "path";
24480
+ import path24 from "path";
24337
24481
  import crypto from "crypto";
24338
24482
  function matchesPatterns(filename, patterns) {
24339
24483
  const lower = filename.toLowerCase();
@@ -24358,8 +24502,8 @@ async function scanForBinaries(memoryDir, config, manifest) {
24358
24502
  return;
24359
24503
  }
24360
24504
  for (const entry of entries) {
24361
- const fullPath = path23.join(dir, entry.name);
24362
- const relativePath = path23.relative(memoryDir, fullPath).split(path23.sep).join("/");
24505
+ const fullPath = path24.join(dir, entry.name);
24506
+ const relativePath = path24.relative(memoryDir, fullPath).split(path24.sep).join("/");
24363
24507
  if (entry.isDirectory()) {
24364
24508
  if (entry.name === ".binary-lifecycle") continue;
24365
24509
  await walk(fullPath);
@@ -24399,15 +24543,15 @@ async function hashFile(filePath) {
24399
24543
 
24400
24544
  // src/binary-lifecycle/manifest.ts
24401
24545
  import fsp3 from "fs/promises";
24402
- import path24 from "path";
24546
+ import path25 from "path";
24403
24547
  import crypto2 from "crypto";
24404
24548
  var MANIFEST_DIR = ".binary-lifecycle";
24405
24549
  var MANIFEST_FILE = "manifest.json";
24406
24550
  function manifestDir(memoryDir) {
24407
- return path24.join(memoryDir, MANIFEST_DIR);
24551
+ return path25.join(memoryDir, MANIFEST_DIR);
24408
24552
  }
24409
24553
  function manifestPath(memoryDir) {
24410
- return path24.join(memoryDir, MANIFEST_DIR, MANIFEST_FILE);
24554
+ return path25.join(memoryDir, MANIFEST_DIR, MANIFEST_FILE);
24411
24555
  }
24412
24556
  async function readManifest(memoryDir) {
24413
24557
  const filePath = manifestPath(memoryDir);
@@ -24459,13 +24603,13 @@ function emptyManifest() {
24459
24603
 
24460
24604
  // src/binary-lifecycle/pipeline.ts
24461
24605
  import fsp4 from "fs/promises";
24462
- import path25 from "path";
24606
+ import path26 from "path";
24463
24607
  import crypto3 from "crypto";
24464
24608
  var historicalIdCache = new HistoricalEntityCanonicalIdCache();
24465
24609
  function isRecallCorpusMarkdown(mdPath, memoryDir) {
24466
- const rel = path25.relative(memoryDir, mdPath);
24467
- if (rel.startsWith("..") || path25.isAbsolute(rel)) return false;
24468
- const top = rel.split(path25.sep)[0];
24610
+ const rel = path26.relative(memoryDir, mdPath);
24611
+ if (rel.startsWith("..") || path26.isAbsolute(rel)) return false;
24612
+ const top = rel.split(path26.sep)[0];
24469
24613
  return RECALL_FALLBACK_DIRS.includes(top);
24470
24614
  }
24471
24615
  async function hashFile2(filePath) {
@@ -24489,13 +24633,13 @@ function escapeRegex(s) {
24489
24633
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24490
24634
  }
24491
24635
  function resolveManifestAssetPath(memoryDir, originalPath) {
24492
- if (originalPath.length === 0 || originalPath.includes("\0") || originalPath.includes("\\") || path25.isAbsolute(originalPath) || path25.win32.isAbsolute(originalPath)) {
24636
+ if (originalPath.length === 0 || originalPath.includes("\0") || originalPath.includes("\\") || path26.isAbsolute(originalPath) || path26.win32.isAbsolute(originalPath)) {
24493
24637
  return null;
24494
24638
  }
24495
- const memoryRoot = path25.resolve(memoryDir);
24496
- const fullPath = path25.resolve(memoryRoot, originalPath);
24497
- const relative = path25.relative(memoryRoot, fullPath);
24498
- if (relative === "" || relative === ".." || relative.startsWith(`..${path25.sep}`) || path25.isAbsolute(relative)) {
24639
+ const memoryRoot = path26.resolve(memoryDir);
24640
+ const fullPath = path26.resolve(memoryRoot, originalPath);
24641
+ const relative = path26.relative(memoryRoot, fullPath);
24642
+ if (relative === "" || relative === ".." || relative.startsWith(`..${path26.sep}`) || path26.isAbsolute(relative)) {
24499
24643
  return null;
24500
24644
  }
24501
24645
  return fullPath;
@@ -24506,7 +24650,7 @@ function validateBinaryLifecycleConfig(config) {
24506
24650
  }
24507
24651
  }
24508
24652
  function remotePathForAsset(backend, relPath) {
24509
- const normalized = relPath.split(path25.sep).join("/");
24653
+ const normalized = relPath.split(path26.sep).join("/");
24510
24654
  if (backend.type === "filesystem") {
24511
24655
  return `.binary-lifecycle/mirrors/${normalized}`;
24512
24656
  }
@@ -24519,11 +24663,11 @@ async function stageMirror(memoryDir, newPaths, backend, assets, log2, dryRun) {
24519
24663
  let mirrored = 0;
24520
24664
  const errors = [];
24521
24665
  for (const relPath of newPaths) {
24522
- const fullPath = path25.join(memoryDir, relPath);
24666
+ const fullPath = path26.join(memoryDir, relPath);
24523
24667
  try {
24524
24668
  const stat5 = await fsp4.stat(fullPath);
24525
24669
  const contentHash = await hashFile2(fullPath);
24526
- const ext = path25.extname(relPath);
24670
+ const ext = path26.extname(relPath);
24527
24671
  const mimeType = guessMimeType(ext);
24528
24672
  const remotePath = remotePathForAsset(backend, relPath);
24529
24673
  let backendLocation = remotePath;
@@ -24674,7 +24818,7 @@ async function stageRedirect(memoryDir, assets, log2, dryRun, readMarkdownFile,
24674
24818
  for (const update of updates) {
24675
24819
  try {
24676
24820
  await withRawEntityPageMutation(memoryDir, update.mdPath, async () => {
24677
- const stateDir = path25.join(memoryDir, "state");
24821
+ const stateDir = path26.join(memoryDir, "state");
24678
24822
  const kind = classifyEntityRefWritePath(memoryDir, update.mdPath);
24679
24823
  if (kind === "memory") {
24680
24824
  const idsAtWrite = historicalIdCache.get(stateDir);
@@ -24767,10 +24911,10 @@ async function countRemainingLocalReferences(memoryDir, asset, assetAbsolute, md
24767
24911
  return { remaining, errors };
24768
24912
  }
24769
24913
  function markdownReferencePattern(asset, assetAbsolute, mdPath) {
24770
- const mdDir = path25.dirname(mdPath);
24914
+ const mdDir = path26.dirname(mdPath);
24771
24915
  const candidates = /* @__PURE__ */ new Set();
24772
24916
  const addCandidate = (candidate) => {
24773
- const normalized = candidate.split(path25.sep).join("/");
24917
+ const normalized = candidate.split(path26.sep).join("/");
24774
24918
  if (normalized.length === 0) return;
24775
24919
  candidates.add(normalized);
24776
24920
  const isParentTraversal = normalized === ".." || normalized.startsWith("../");
@@ -24778,10 +24922,10 @@ function markdownReferencePattern(asset, assetAbsolute, mdPath) {
24778
24922
  candidates.add(`./${normalized}`);
24779
24923
  }
24780
24924
  };
24781
- addCandidate(path25.relative(mdDir, assetAbsolute));
24782
- const originalPath = asset.originalPath.split(path25.sep).join("/");
24783
- const originalAsFileRelative = path25.resolve(mdDir, ...originalPath.split("/"));
24784
- if (path25.resolve(originalAsFileRelative) === path25.resolve(assetAbsolute)) {
24925
+ addCandidate(path26.relative(mdDir, assetAbsolute));
24926
+ const originalPath = asset.originalPath.split(path26.sep).join("/");
24927
+ const originalAsFileRelative = path26.resolve(mdDir, ...originalPath.split("/"));
24928
+ if (path26.resolve(originalAsFileRelative) === path26.resolve(assetAbsolute)) {
24785
24929
  addCandidate(originalPath);
24786
24930
  }
24787
24931
  addCandidate(`/${originalPath}`);
@@ -24877,7 +25021,7 @@ async function findMarkdownFiles(dir) {
24877
25021
  return;
24878
25022
  }
24879
25023
  for (const entry of entries) {
24880
- const full = path25.join(current, entry.name);
25024
+ const full = path26.join(current, entry.name);
24881
25025
  if (entry.isDirectory()) {
24882
25026
  if (entry.name === ".binary-lifecycle") continue;
24883
25027
  await walk(full);
@@ -24952,7 +25096,7 @@ async function runBinaryLifecyclePipeline(memoryDir, config, backend, log2, opts
24952
25096
 
24953
25097
  // src/projection/index.ts
24954
25098
  import fs from "fs";
24955
- import path26 from "path";
25099
+ import path27 from "path";
24956
25100
  var VALID_PROJECTION_CATEGORIES = new Set(ALL_CATEGORY_KEYS);
24957
25101
  async function generateContextTree(options) {
24958
25102
  const startTime = Date.now();
@@ -24967,8 +25111,8 @@ async function generateContextTree(options) {
24967
25111
  let nodesGenerated = 0;
24968
25112
  let nodesSkipped = 0;
24969
25113
  const categoryCounts = {};
24970
- const resolvedMemoryDir = path26.resolve(memoryDir);
24971
- const resolvedOutputDir = path26.resolve(outputDir);
25114
+ const resolvedMemoryDir = path27.resolve(memoryDir);
25115
+ const resolvedOutputDir = path27.resolve(outputDir);
24972
25116
  const requestedCategories = validateProjectionCategories(filterCategories);
24973
25117
  const realMemoryDir = assertSafeMemoryRoot(resolvedMemoryDir);
24974
25118
  assertNotSymlink(resolvedOutputDir, "context tree outputDir");
@@ -25006,7 +25150,7 @@ async function generateContextTree(options) {
25006
25150
  }
25007
25151
  }
25008
25152
  if (includeEntities) {
25009
- const entitiesDir = path26.join(memoryDir, "entities");
25153
+ const entitiesDir = path27.join(memoryDir, "entities");
25010
25154
  if (fs.existsSync(entitiesDir)) {
25011
25155
  assertSafeInputRoot(realMemoryDir, entitiesDir, "entities root");
25012
25156
  categoryCounts["entity"] = 0;
@@ -25018,7 +25162,7 @@ async function generateContextTree(options) {
25018
25162
  continue;
25019
25163
  }
25020
25164
  const content = fs.readFileSync(filePath, "utf8");
25021
- const fileName = path26.basename(filePath, ".md");
25165
+ const fileName = path27.basename(filePath, ".md");
25022
25166
  const node = projectEntityNode(fileName, content);
25023
25167
  const outputPath = resolveContainedOutputPath(realOutputDir, "entities", `${fileName}.md`);
25024
25168
  writeProjectedContent(realOutputDir, outputPath, node.content);
@@ -25030,7 +25174,7 @@ async function generateContextTree(options) {
25030
25174
  }
25031
25175
  const shouldIncludeQuestions = includeQuestions && (requestedCategories === void 0 || requestedCategories.includes("question"));
25032
25176
  if (shouldIncludeQuestions) {
25033
- const questionsDir = path26.join(memoryDir, "questions");
25177
+ const questionsDir = path27.join(memoryDir, "questions");
25034
25178
  if (fs.existsSync(questionsDir)) {
25035
25179
  assertSafeInputRoot(realMemoryDir, questionsDir, "questions root");
25036
25180
  categoryCounts["question"] = 0;
@@ -25071,8 +25215,8 @@ async function generateContextTree(options) {
25071
25215
  };
25072
25216
  }
25073
25217
  function isPathInside(root, candidate) {
25074
- const relative = path26.relative(root, candidate);
25075
- return relative === "" || !relative.startsWith("..") && !path26.isAbsolute(relative);
25218
+ const relative = path27.relative(root, candidate);
25219
+ return relative === "" || !relative.startsWith("..") && !path27.isAbsolute(relative);
25076
25220
  }
25077
25221
  function assertNotSymlink(targetPath, label) {
25078
25222
  try {
@@ -25109,12 +25253,12 @@ function assertSafeInputRoot(realMemoryDir, targetPath, label) {
25109
25253
  }
25110
25254
  function assertSafeOutputTarget(realOutputDir, outputPath) {
25111
25255
  let current = realOutputDir;
25112
- const relative = path26.relative(realOutputDir, outputPath);
25113
- if (relative.startsWith("..") || path26.isAbsolute(relative)) {
25256
+ const relative = path27.relative(realOutputDir, outputPath);
25257
+ if (relative.startsWith("..") || path27.isAbsolute(relative)) {
25114
25258
  throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
25115
25259
  }
25116
- for (const segment of relative.split(path26.sep).filter(Boolean)) {
25117
- current = path26.join(current, segment);
25260
+ for (const segment of relative.split(path27.sep).filter(Boolean)) {
25261
+ current = path27.join(current, segment);
25118
25262
  try {
25119
25263
  const stat5 = fs.lstatSync(current);
25120
25264
  if (stat5.isSymbolicLink()) {
@@ -25144,17 +25288,17 @@ function validateProjectionCategories(categories) {
25144
25288
  return validated;
25145
25289
  }
25146
25290
  function resolveContainedOutputPath(outputRoot, ...segments) {
25147
- const resolved = path26.resolve(outputRoot, ...segments);
25148
- const relative = path26.relative(outputRoot, resolved);
25149
- if (relative === "" || !relative.startsWith("..") && !path26.isAbsolute(relative)) {
25291
+ const resolved = path27.resolve(outputRoot, ...segments);
25292
+ const relative = path27.relative(outputRoot, resolved);
25293
+ if (relative === "" || !relative.startsWith("..") && !path27.isAbsolute(relative)) {
25150
25294
  return resolved;
25151
25295
  }
25152
25296
  throw new Error(`context tree output path escapes outputDir: ${segments.join("/")}`);
25153
25297
  }
25154
25298
  function writeProjectedContent(realOutputDir, outputPath, generatedContent) {
25155
25299
  assertSafeOutputTarget(realOutputDir, outputPath);
25156
- fs.mkdirSync(path26.dirname(outputPath), { recursive: true });
25157
- const realParent = fs.realpathSync(path26.dirname(outputPath));
25300
+ fs.mkdirSync(path27.dirname(outputPath), { recursive: true });
25301
+ const realParent = fs.realpathSync(path27.dirname(outputPath));
25158
25302
  if (!isPathInside(realOutputDir, realParent)) {
25159
25303
  throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
25160
25304
  }
@@ -25193,7 +25337,7 @@ function walkR(dir, realMemoryDir) {
25193
25337
  const results = [];
25194
25338
  function walk(directory) {
25195
25339
  for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
25196
- const fullPath = path26.join(directory, entry.name);
25340
+ const fullPath = path27.join(directory, entry.name);
25197
25341
  if (entry.isSymbolicLink()) {
25198
25342
  throw new Error(`context tree input path contains symlink: ${fullPath}`);
25199
25343
  }
@@ -25246,13 +25390,13 @@ function extractBody(content) {
25246
25390
  }
25247
25391
  function projectNode(filePath, category, fm, rawContent) {
25248
25392
  const body = extractBody(rawContent);
25249
- const fileName = path26.basename(filePath, ".md");
25250
- const dateDir = path26.basename(path26.dirname(filePath));
25393
+ const fileName = path27.basename(filePath, ".md");
25394
+ const dateDir = path27.basename(path27.dirname(filePath));
25251
25395
  let relPath;
25252
25396
  if (/^\d{4}-\d{2}-\d{2}$/.test(dateDir)) {
25253
- relPath = path26.join(category, dateDir, `${fileName}.md`);
25397
+ relPath = path27.join(category, dateDir, `${fileName}.md`);
25254
25398
  } else {
25255
- relPath = path26.join(category, `${fileName}.md`);
25399
+ relPath = path27.join(category, `${fileName}.md`);
25256
25400
  }
25257
25401
  const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
25258
25402
  const md = `# ${fm.id}
@@ -25298,7 +25442,7 @@ function projectEntityNode(fileName, content) {
25298
25442
  ${content}
25299
25443
  `;
25300
25444
  return {
25301
- path: path26.join("entities", `${fileName}.md`),
25445
+ path: path27.join("entities", `${fileName}.md`),
25302
25446
  category: "entity",
25303
25447
  title: fileName,
25304
25448
  content: md,
@@ -25351,7 +25495,7 @@ function generateIndex(categoryCounts, outputDir) {
25351
25495
 
25352
25496
  // src/onboarding/index.ts
25353
25497
  import fs2 from "fs";
25354
- import path27 from "path";
25498
+ import path28 from "path";
25355
25499
  var LANGUAGE_RULES = [
25356
25500
  {
25357
25501
  language: "TypeScript",
@@ -25453,7 +25597,7 @@ function onboard(options) {
25453
25597
  maxDepth = 6,
25454
25598
  excludeDirs = []
25455
25599
  } = options;
25456
- const directory = path27.resolve(options.directory ?? process.cwd());
25600
+ const directory = path28.resolve(options.directory ?? process.cwd());
25457
25601
  let rootStat;
25458
25602
  try {
25459
25603
  rootStat = fs2.statSync(directory);
@@ -25495,7 +25639,7 @@ function walkDir(root, exclude, maxDepth) {
25495
25639
  }
25496
25640
  for (const entry of entries) {
25497
25641
  if (exclude.has(entry.name)) continue;
25498
- const fullPath = path27.join(dir, entry.name);
25642
+ const fullPath = path28.join(dir, entry.name);
25499
25643
  if (entry.isDirectory()) {
25500
25644
  walk(fullPath, depth + 1);
25501
25645
  } else if (entry.isFile()) {
@@ -25510,11 +25654,11 @@ function detectLanguages(files, root) {
25510
25654
  const results = [];
25511
25655
  const extCounts = /* @__PURE__ */ new Map();
25512
25656
  for (const f of files) {
25513
- const ext = path27.extname(f).toLowerCase();
25657
+ const ext = path28.extname(f).toLowerCase();
25514
25658
  if (ext) extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
25515
25659
  }
25516
25660
  const rootFiles = new Set(
25517
- files.filter((f) => path27.dirname(f) === root).map((f) => path27.basename(f))
25661
+ files.filter((f) => path28.dirname(f) === root).map((f) => path28.basename(f))
25518
25662
  );
25519
25663
  for (const rule of LANGUAGE_RULES) {
25520
25664
  const evidence = [];
@@ -25558,7 +25702,7 @@ function detectLanguages(files, root) {
25558
25702
  }
25559
25703
  function detectShape(files, root) {
25560
25704
  const rootFiles = new Set(
25561
- files.filter((f) => path27.dirname(f) === root).map((f) => path27.basename(f))
25705
+ files.filter((f) => path28.dirname(f) === root).map((f) => path28.basename(f))
25562
25706
  );
25563
25707
  const rootDirs = /* @__PURE__ */ new Set();
25564
25708
  try {
@@ -25569,7 +25713,7 @@ function detectShape(files, root) {
25569
25713
  }
25570
25714
  const evidence = [];
25571
25715
  if (rootFiles.has("package.json")) {
25572
- const pkg = readJsonSafe(path27.join(root, "package.json"));
25716
+ const pkg = readJsonSafe(path28.join(root, "package.json"));
25573
25717
  if (pkg?.workspaces) {
25574
25718
  evidence.push("package.json has workspaces");
25575
25719
  return { shape: "monorepo", evidence };
@@ -25583,13 +25727,13 @@ function detectShape(files, root) {
25583
25727
  evidence.push("workspace manifest found");
25584
25728
  return { shape: "workspace", evidence };
25585
25729
  }
25586
- const cargoToml = readTomlWorkspace(path27.join(root, "Cargo.toml"));
25730
+ const cargoToml = readTomlWorkspace(path28.join(root, "Cargo.toml"));
25587
25731
  if (cargoToml) {
25588
25732
  evidence.push("Cargo.toml has workspace");
25589
25733
  return { shape: "workspace", evidence };
25590
25734
  }
25591
25735
  if (rootFiles.has("package.json")) {
25592
- const pkg = readJsonSafe(path27.join(root, "package.json"));
25736
+ const pkg = readJsonSafe(path28.join(root, "package.json"));
25593
25737
  if (pkg?.exports || pkg?.main) {
25594
25738
  if (pkg?.bin) {
25595
25739
  evidence.push("package.json has bin");
@@ -25623,8 +25767,8 @@ function discoverDocs(files, root) {
25623
25767
  { pattern: /^\.editorconfig$/i, kind: "config" }
25624
25768
  ];
25625
25769
  for (const filePath of files) {
25626
- const basename = path27.basename(filePath).toLowerCase();
25627
- const relPath = path27.relative(root, filePath);
25770
+ const basename = path28.basename(filePath).toLowerCase();
25771
+ const relPath = path28.relative(root, filePath);
25628
25772
  let kind;
25629
25773
  for (const { pattern, kind: k } of docPatterns) {
25630
25774
  if (pattern.test(basename)) {
@@ -25636,7 +25780,7 @@ function discoverDocs(files, root) {
25636
25780
  kind = "docs";
25637
25781
  }
25638
25782
  if (!kind && (basename.endsWith(".md") || basename.endsWith(".mdx"))) {
25639
- if (path27.dirname(relPath) === "." || isUnderDocsDir(relPath)) {
25783
+ if (path28.dirname(relPath) === "." || isUnderDocsDir(relPath)) {
25640
25784
  kind = "docs";
25641
25785
  }
25642
25786
  }
@@ -25657,7 +25801,7 @@ function discoverDocs(files, root) {
25657
25801
  return docs;
25658
25802
  }
25659
25803
  function isUnderDocsDir(relPath) {
25660
- const parts = relPath.split(path27.sep);
25804
+ const parts = relPath.split(path28.sep);
25661
25805
  return parts[0] === "docs" || parts[0] === "doc" || parts[0] === "documentation";
25662
25806
  }
25663
25807
  function buildPlan(languages, shape, docs, _root) {
@@ -25701,7 +25845,7 @@ function readTomlWorkspace(filePath) {
25701
25845
 
25702
25846
  // src/curation/index.ts
25703
25847
  import fs3 from "fs";
25704
- import path28 from "path";
25848
+ import path29 from "path";
25705
25849
  import crypto4 from "crypto";
25706
25850
  async function curate(options) {
25707
25851
  const startTime = Date.now();
@@ -25792,12 +25936,12 @@ function resolveTargets(targetPath) {
25792
25936
  const extensions = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
25793
25937
  function walk(dir) {
25794
25938
  for (const entry of fs3.readdirSync(dir, { withFileTypes: true })) {
25795
- const fullPath = path28.join(dir, entry.name);
25939
+ const fullPath = path29.join(dir, entry.name);
25796
25940
  if (entry.isDirectory()) {
25797
25941
  if (entry.name !== "node_modules" && entry.name !== ".git") {
25798
25942
  walk(fullPath);
25799
25943
  }
25800
- } else if (extensions.has(path28.extname(entry.name).toLowerCase())) {
25944
+ } else if (extensions.has(path29.extname(entry.name).toLowerCase())) {
25801
25945
  results.push(fullPath);
25802
25946
  }
25803
25947
  }
@@ -25806,12 +25950,12 @@ function resolveTargets(targetPath) {
25806
25950
  return results;
25807
25951
  }
25808
25952
  function resolveProvenanceRoot(targetPath) {
25809
- const resolvedTarget = path28.resolve(targetPath);
25953
+ const resolvedTarget = path29.resolve(targetPath);
25810
25954
  const stat5 = fs3.statSync(resolvedTarget);
25811
- return stat5.isFile() ? path28.dirname(resolvedTarget) : resolvedTarget;
25955
+ return stat5.isFile() ? path29.dirname(resolvedTarget) : resolvedTarget;
25812
25956
  }
25813
25957
  function extractStatements(content, filePath, projectRoot, source, sourceFileHash, categoryOverride, confidence, entityRef, tags) {
25814
- const relativePath = path28.relative(projectRoot, path28.resolve(filePath)) || path28.basename(filePath);
25958
+ const relativePath = path29.relative(projectRoot, path29.resolve(filePath)) || path29.basename(filePath);
25815
25959
  const statements = [];
25816
25960
  const now = (/* @__PURE__ */ new Date()).toISOString();
25817
25961
  const paragraphs = content.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p.length > 20 && p.length < 2e3);
@@ -25905,7 +26049,7 @@ function loadExistingMemories(memoryDir) {
25905
26049
  if (!fs3.existsSync(memoryDir)) return result;
25906
26050
  const dirs = ALL_CATEGORY_DIRS;
25907
26051
  for (const dir of dirs) {
25908
- const fullDir = path28.join(memoryDir, dir);
26052
+ const fullDir = path29.join(memoryDir, dir);
25909
26053
  if (!fs3.existsSync(fullDir)) continue;
25910
26054
  walkFiles(fullDir, (filePath) => {
25911
26055
  const content = readFileSafe(filePath);
@@ -25928,11 +26072,11 @@ function writeStatement(stmt, memoryDir) {
25928
26072
  const now = /* @__PURE__ */ new Date();
25929
26073
  const dateDir = now.toISOString().split("T")[0];
25930
26074
  const categoryDir = getCategoryDir(memoryDir, stmt.category);
25931
- const dir = path28.join(categoryDir, dateDir);
26075
+ const dir = path29.join(categoryDir, dateDir);
25932
26076
  fs3.mkdirSync(dir, { recursive: true });
25933
26077
  const fileName = `${stmt.category}-${Date.now()}-${stmt.id.slice(0, 8)}.md`;
25934
- const filePath = path28.join(dir, fileName);
25935
- const historicalIds = historicalIdCache2.get(path28.join(memoryDir, "state"));
26078
+ const filePath = path29.join(dir, fileName);
26079
+ const historicalIds = historicalIdCache2.get(path29.join(memoryDir, "state"));
25936
26080
  const rawBody = `${[
25937
26081
  "---",
25938
26082
  `id: ${stmt.id}`,
@@ -25955,7 +26099,7 @@ ${stmt.content}
25955
26099
  fs3.writeFileSync(filePath, body);
25956
26100
  try {
25957
26101
  repairContentAfterJournalMoveSync({
25958
- stateDir: path28.join(memoryDir, "state"),
26102
+ stateDir: path29.join(memoryDir, "state"),
25959
26103
  cache: historicalIdCache2,
25960
26104
  idsAtWrite: historicalIds,
25961
26105
  rawContent: rawBody,
@@ -26016,7 +26160,7 @@ function extractBody2(content) {
26016
26160
  }
26017
26161
  function walkFiles(dir, callback) {
26018
26162
  for (const entry of fs3.readdirSync(dir, { withFileTypes: true })) {
26019
- const fullPath = path28.join(dir, entry.name);
26163
+ const fullPath = path29.join(dir, entry.name);
26020
26164
  if (entry.isDirectory()) {
26021
26165
  walkFiles(fullPath, callback);
26022
26166
  } else if (entry.name.endsWith(".md")) {
@@ -26028,7 +26172,7 @@ function walkFiles(dir, callback) {
26028
26172
  // src/dedup/index.ts
26029
26173
  import crypto5 from "crypto";
26030
26174
  import fs4 from "fs";
26031
- import path29 from "path";
26175
+ import path30 from "path";
26032
26176
  var DEFAULT_DEDUP_THRESHOLD = 0.85;
26033
26177
  var DEFAULT_MAX_LOAD = 1e4;
26034
26178
  function normalizeThreshold(value, defaultValue) {
@@ -26235,7 +26379,7 @@ function loadMemories(memoryDir, categories, maxLoad = 1e4) {
26235
26379
  const memoryRootReal = fs4.realpathSync(memoryDir);
26236
26380
  for (const category of allCategories) {
26237
26381
  if (result.length >= maxLoad) break;
26238
- const dir = path29.join(memoryDir, category);
26382
+ const dir = path30.join(memoryDir, category);
26239
26383
  if (!fs4.existsSync(dir)) continue;
26240
26384
  const categoryStat = fs4.lstatSync(dir);
26241
26385
  if (categoryStat.isSymbolicLink()) {
@@ -26296,15 +26440,15 @@ function extractBody3(content) {
26296
26440
  return match ? match[1].trim() : content.trim();
26297
26441
  }
26298
26442
  function assertPathInsideRoot2(rootReal, targetReal, sourcePath) {
26299
- const rel = path29.relative(rootReal, targetReal);
26300
- if (rel === "" || !rel.startsWith("..") && !path29.isAbsolute(rel)) {
26443
+ const rel = path30.relative(rootReal, targetReal);
26444
+ if (rel === "" || !rel.startsWith("..") && !path30.isAbsolute(rel)) {
26301
26445
  return;
26302
26446
  }
26303
26447
  throw new Error(`Refusing to scan memory path outside root: ${sourcePath}`);
26304
26448
  }
26305
26449
  function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
26306
26450
  for (const entry of fs4.readdirSync(dir, { withFileTypes: true })) {
26307
- const fullPath = path29.join(dir, entry.name);
26451
+ const fullPath = path30.join(dir, entry.name);
26308
26452
  const entryStat = fs4.lstatSync(fullPath);
26309
26453
  if (entryStat.isSymbolicLink()) {
26310
26454
  throw new Error(`Refusing to scan symlinked memory path: ${fullPath}`);
@@ -26322,7 +26466,7 @@ function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
26322
26466
 
26323
26467
  // src/sync/index.ts
26324
26468
  import fs5 from "fs";
26325
- import path30 from "path";
26469
+ import path31 from "path";
26326
26470
  import crypto6 from "crypto";
26327
26471
  var DEFAULT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
26328
26472
  var DEFAULT_EXCLUDE2 = /* @__PURE__ */ new Set([
@@ -26344,7 +26488,7 @@ function syncChanges(options) {
26344
26488
  } = options;
26345
26489
  const extSet = new Set(extensions);
26346
26490
  const excludeSet = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE2, ...excludeDirs]);
26347
- const stateFilePath = options.stateFile ?? path30.join(memoryDir, ".sync-state.json");
26491
+ const stateFilePath = options.stateFile ?? path31.join(memoryDir, ".sync-state.json");
26348
26492
  const prevState = loadState(stateFilePath);
26349
26493
  const currentFiles = scanFiles(sourceDir, extSet, excludeSet);
26350
26494
  const changes = computeDiff(currentFiles, prevState.fileHashes, sourceDir);
@@ -26360,7 +26504,7 @@ function syncChanges(options) {
26360
26504
  for (const [relPath, hash] of Object.entries(currentFiles)) {
26361
26505
  newState.fileHashes[relPath] = hash;
26362
26506
  }
26363
- fs5.mkdirSync(path30.dirname(stateFilePath), { recursive: true });
26507
+ fs5.mkdirSync(path31.dirname(stateFilePath), { recursive: true });
26364
26508
  fs5.writeFileSync(stateFilePath, JSON.stringify(newState, null, 2));
26365
26509
  }
26366
26510
  return {
@@ -26426,13 +26570,13 @@ function scanFiles(root, extensions, exclude) {
26426
26570
  }
26427
26571
  for (const entry of entries) {
26428
26572
  if (exclude.has(entry.name)) continue;
26429
- const fullPath = path30.join(dir, entry.name);
26573
+ const fullPath = path31.join(dir, entry.name);
26430
26574
  if (entry.isDirectory()) {
26431
26575
  walk(fullPath);
26432
26576
  } else if (entry.isFile()) {
26433
- const ext = path30.extname(entry.name).toLowerCase();
26577
+ const ext = path31.extname(entry.name).toLowerCase();
26434
26578
  if (!extensions.has(ext)) continue;
26435
- const relPath = path30.relative(root, fullPath);
26579
+ const relPath = path31.relative(root, fullPath);
26436
26580
  try {
26437
26581
  const content = fs5.readFileSync(fullPath, "utf8");
26438
26582
  result[relPath] = hashContent3(content);
@@ -26447,7 +26591,7 @@ function scanFiles(root, extensions, exclude) {
26447
26591
  function computeDiff(current, previous, sourceDir) {
26448
26592
  const changes = [];
26449
26593
  for (const [relPath, hash] of Object.entries(current)) {
26450
- const fullPath = path30.join(sourceDir, relPath);
26594
+ const fullPath = path31.join(sourceDir, relPath);
26451
26595
  if (!(relPath in previous)) {
26452
26596
  let size = 0;
26453
26597
  try {
@@ -26480,7 +26624,7 @@ function computeDiff(current, previous, sourceDir) {
26480
26624
  for (const relPath of Object.keys(previous)) {
26481
26625
  if (!(relPath in current)) {
26482
26626
  changes.push({
26483
- filePath: path30.join(sourceDir, relPath),
26627
+ filePath: path31.join(sourceDir, relPath),
26484
26628
  relativePath: relPath,
26485
26629
  type: "deleted",
26486
26630
  currentHash: "",
@@ -26510,21 +26654,21 @@ function hashContent3(content) {
26510
26654
  import { spawnSync } from "child_process";
26511
26655
  import crypto7 from "crypto";
26512
26656
  import fs6 from "fs";
26513
- import path31 from "path";
26657
+ import path32 from "path";
26514
26658
  var historicalIdCache3 = new HistoricalEntityCanonicalIdCache();
26515
26659
  var MANIFEST_VERSION = 1;
26516
26660
  var MANIFEST_LOCK_STALE_MS = 3e4;
26517
26661
  var MANIFEST_LOCK_TIMEOUT_MS = MANIFEST_LOCK_STALE_MS + 1e4;
26518
26662
  var MANIFEST_LOCK_SLEEP_MS = 20;
26519
26663
  function normalizeSpaceMemoryDir(memoryDir) {
26520
- return path31.resolve(memoryDir);
26664
+ return path32.resolve(memoryDir);
26521
26665
  }
26522
26666
  function getSpacesDir(baseDir) {
26523
26667
  const homeDir = baseDir ?? resolveHomeDir();
26524
- return path31.join(homeDir, ".config", "engram", "spaces");
26668
+ return path32.join(homeDir, ".config", "engram", "spaces");
26525
26669
  }
26526
26670
  function getManifestPath(baseDir) {
26527
- return path31.join(getSpacesDir(baseDir), "manifest.json");
26671
+ return path32.join(getSpacesDir(baseDir), "manifest.json");
26528
26672
  }
26529
26673
  function loadManifest(baseDir, memoryDirOverride) {
26530
26674
  if (fs6.existsSync(getManifestPath(baseDir))) {
@@ -26571,9 +26715,9 @@ function readManifestUnlocked(baseDir, memoryDirOverride, options = {}) {
26571
26715
  }
26572
26716
  function saveManifestUnlocked(manifest, baseDir) {
26573
26717
  const manifestPath2 = getManifestPath(baseDir);
26574
- const manifestDir2 = path31.dirname(manifestPath2);
26718
+ const manifestDir2 = path32.dirname(manifestPath2);
26575
26719
  fs6.mkdirSync(manifestDir2, { recursive: true });
26576
- const tempPath = path31.join(manifestDir2, `.manifest.${process.pid}.${Date.now()}.${crypto7.randomUUID()}.tmp`);
26720
+ const tempPath = path32.join(manifestDir2, `.manifest.${process.pid}.${Date.now()}.${crypto7.randomUUID()}.tmp`);
26577
26721
  try {
26578
26722
  fs6.writeFileSync(tempPath, `${JSON.stringify(manifest, null, 2)}
26579
26723
  `, { flag: "wx" });
@@ -26588,7 +26732,7 @@ function saveManifestUnlocked(manifest, baseDir) {
26588
26732
  }
26589
26733
  function withManifestLock(baseDir, operation) {
26590
26734
  const lockDir = `${getManifestPath(baseDir)}.lock`;
26591
- fs6.mkdirSync(path31.dirname(lockDir), { recursive: true });
26735
+ fs6.mkdirSync(path32.dirname(lockDir), { recursive: true });
26592
26736
  const lockOwner = acquireManifestLock(lockDir);
26593
26737
  try {
26594
26738
  return operation();
@@ -26614,7 +26758,7 @@ function acquireManifestLock(lockDir) {
26614
26758
  try {
26615
26759
  fs6.mkdirSync(lockDir, { recursive: false });
26616
26760
  try {
26617
- fs6.writeFileSync(path31.join(lockDir, "owner"), `${owner}
26761
+ fs6.writeFileSync(path32.join(lockDir, "owner"), `${owner}
26618
26762
  `, { flag: "wx" });
26619
26763
  } catch (error) {
26620
26764
  fs6.rmSync(lockDir, { recursive: true, force: true });
@@ -26644,7 +26788,7 @@ function acquireManifestLock(lockDir) {
26644
26788
  }
26645
26789
  function releaseManifestLock(lockDir, owner) {
26646
26790
  try {
26647
- const ownerPath = path31.join(lockDir, "owner");
26791
+ const ownerPath = path32.join(lockDir, "owner");
26648
26792
  if (fs6.readFileSync(ownerPath, "utf8").trim() === owner) {
26649
26793
  fs6.rmSync(lockDir, { recursive: true, force: true });
26650
26794
  }
@@ -26660,7 +26804,7 @@ function removeStaleManifestLock(lockDir) {
26660
26804
  try {
26661
26805
  fs6.mkdirSync(reclaimDir, { recursive: false });
26662
26806
  try {
26663
- fs6.writeFileSync(path31.join(reclaimDir, "owner"), `${reclaimOwner}
26807
+ fs6.writeFileSync(path32.join(reclaimDir, "owner"), `${reclaimOwner}
26664
26808
  `, { flag: "wx" });
26665
26809
  } catch (error) {
26666
26810
  fs6.rmSync(reclaimDir, { recursive: true, force: true });
@@ -26735,7 +26879,7 @@ function readManifestLockSnapshot(lockDir) {
26735
26879
  throw error;
26736
26880
  }
26737
26881
  try {
26738
- const owner = fs6.readFileSync(path31.join(lockDir, "owner"), "utf8").trim();
26882
+ const owner = fs6.readFileSync(path32.join(lockDir, "owner"), "utf8").trim();
26739
26883
  return { mtimeMs: stat5.mtimeMs, owner };
26740
26884
  } catch (error) {
26741
26885
  if (error.code === "ENOENT") {
@@ -26807,8 +26951,8 @@ function sleepSync(ms) {
26807
26951
  }
26808
26952
  function createPersonalSpace(baseDir, memoryDirOverride) {
26809
26953
  const homeDir = baseDir ?? resolveHomeDir();
26810
- const standalonePath = path31.join(homeDir, ".engram", "memory");
26811
- const openclawPath = path31.join(homeDir, ".openclaw", "workspace", "memory", "local");
26954
+ const standalonePath = path32.join(homeDir, ".engram", "memory");
26955
+ const openclawPath = path32.join(homeDir, ".openclaw", "workspace", "memory", "local");
26812
26956
  const memoryDir = memoryDirOverride ?? readEnvVar("REMNIC_MEMORY_DIR") ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs6.existsSync(standalonePath) ? standalonePath : fs6.existsSync(openclawPath) ? openclawPath : standalonePath);
26813
26957
  const normalizedMemoryDir = normalizeSpaceMemoryDir(memoryDir);
26814
26958
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -26837,7 +26981,7 @@ function createSpace(options) {
26837
26981
  const id = options.name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
26838
26982
  const now = (/* @__PURE__ */ new Date()).toISOString();
26839
26983
  const memoryDir = normalizeSpaceMemoryDir(
26840
- options.memoryDir ?? path31.join(getSpacesDir(options.baseDir), id, "memory")
26984
+ options.memoryDir ?? path32.join(getSpacesDir(options.baseDir), id, "memory")
26841
26985
  );
26842
26986
  const space = updateManifest(options.baseDir, (manifest) => {
26843
26987
  if (manifest.spaces.some((s) => s.id === id)) {
@@ -27083,14 +27227,14 @@ async function mergeSpaces(sourceSpaceId, targetSpaceId, options) {
27083
27227
  };
27084
27228
  }
27085
27229
  function getAuditLog(baseDir) {
27086
- const auditPath = path31.join(getSpacesDir(baseDir), "audit.jsonl");
27230
+ const auditPath = path32.join(getSpacesDir(baseDir), "audit.jsonl");
27087
27231
  if (!fs6.existsSync(auditPath)) return [];
27088
27232
  const lines = fs6.readFileSync(auditPath, "utf8").trim().split("\n");
27089
27233
  return lines.filter((l) => l.trim()).map((l) => JSON.parse(l));
27090
27234
  }
27091
27235
  function appendAudit(entry, baseDir) {
27092
- const auditPath = path31.join(getSpacesDir(baseDir), "audit.jsonl");
27093
- fs6.mkdirSync(path31.dirname(auditPath), { recursive: true });
27236
+ const auditPath = path32.join(getSpacesDir(baseDir), "audit.jsonl");
27237
+ fs6.mkdirSync(path32.dirname(auditPath), { recursive: true });
27094
27238
  const full = {
27095
27239
  id: crypto7.randomUUID(),
27096
27240
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -27111,11 +27255,11 @@ async function copyMemories(sourceDir, targetDir, options) {
27111
27255
  sourceFiles.filter((p) => {
27112
27256
  const rp = safeRealpath(p);
27113
27257
  if (!rp || !isPathInsideRoot(rp, sourceRoot)) return false;
27114
- const rel = path31.relative(sourceRoot, rp);
27115
- const mapped = path31.resolve(targetRoot, rel);
27258
+ const rel = path32.relative(sourceRoot, rp);
27259
+ const mapped = path32.resolve(targetRoot, rel);
27116
27260
  if (!isPathInsideRoot(mapped, targetRoot)) return false;
27117
27261
  return classifyEntityRefWritePath(targetRoot, mapped) === "entity";
27118
- }).map((p) => path31.basename(p, ".md"))
27262
+ }).map((p) => path32.basename(p, ".md"))
27119
27263
  );
27120
27264
  const firstEntityId = sourceEntityIds.values().next().value;
27121
27265
  if (firstEntityId === void 0) {
@@ -27123,7 +27267,7 @@ async function copyMemories(sourceDir, targetDir, options) {
27123
27267
  }
27124
27268
  return withRawEntityPageMutation(
27125
27269
  targetRoot,
27126
- path31.join(targetRoot, "entities", `${firstEntityId}.md`),
27270
+ path32.join(targetRoot, "entities", `${firstEntityId}.md`),
27127
27271
  async () => copyPreparedMemories(
27128
27272
  sourceFiles,
27129
27273
  sourceRoot,
@@ -27150,14 +27294,14 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
27150
27294
  continue;
27151
27295
  }
27152
27296
  const content = fs6.readFileSync(sourcePath, "utf8");
27153
- const relativePath = path31.relative(sourceRoot, sourceRealPath);
27154
- const targetPath = path31.resolve(targetRoot, relativePath);
27297
+ const relativePath = path32.relative(sourceRoot, sourceRealPath);
27298
+ const targetPath = path32.resolve(targetRoot, relativePath);
27155
27299
  if (!isPathInsideRoot(targetPath, targetRoot)) {
27156
27300
  skipped++;
27157
27301
  continue;
27158
27302
  }
27159
27303
  const targetKind = classifyEntityRefWritePath(targetRoot, targetPath);
27160
- const idsAtCompare = historicalIdCache3.get(path31.join(targetRoot, "state"));
27304
+ const idsAtCompare = historicalIdCache3.get(path32.join(targetRoot, "state"));
27161
27305
  const sourceRef = targetKind === "memory" ? readEntityRefFromFrontmatter(content) : null;
27162
27306
  const refHasSourceClaimant = sourceRef !== null && sourceEntityIds.has(sourceRef);
27163
27307
  const canonicalContent = targetKind === "memory" && !refHasSourceClaimant ? canonicalizeEntityRefFrontmatter(content, idsAtCompare) : content;
@@ -27184,7 +27328,7 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
27184
27328
  if (fs6.existsSync(targetPath) && !options?.force) {
27185
27329
  const targetContent = fs6.readFileSync(targetPath, "utf8");
27186
27330
  const targetHash = hashContent4(targetContent);
27187
- if (hashContent4(canonicalContent) === targetHash && historicalIdCache3.get(path31.join(targetRoot, "state")) === idsAtCompare) {
27331
+ if (hashContent4(canonicalContent) === targetHash && historicalIdCache3.get(path32.join(targetRoot, "state")) === idsAtCompare) {
27188
27332
  skipped++;
27189
27333
  continue;
27190
27334
  }
@@ -27200,13 +27344,13 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
27200
27344
  continue;
27201
27345
  }
27202
27346
  }
27203
- fs6.mkdirSync(path31.dirname(targetPath), { recursive: true });
27204
- const targetParentRealPath = safeRealpath(path31.dirname(targetPath));
27347
+ fs6.mkdirSync(path32.dirname(targetPath), { recursive: true });
27348
+ const targetParentRealPath = safeRealpath(path32.dirname(targetPath));
27205
27349
  if (!targetParentRealPath || !isPathInsideRoot(targetParentRealPath, targetRoot)) {
27206
27350
  skipped++;
27207
27351
  continue;
27208
27352
  }
27209
- const stateDir = path31.join(targetRoot, "state");
27353
+ const stateDir = path32.join(targetRoot, "state");
27210
27354
  if (targetKind === "memory" && !refHasSourceClaimant) {
27211
27355
  const idsAtWrite = historicalIdCache3.get(stateDir);
27212
27356
  const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
@@ -27250,7 +27394,7 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
27250
27394
  bumpMemoryCorpusVersionForDir(targetRoot);
27251
27395
  }
27252
27396
  if (reconcileNeeded) {
27253
- requestEntityCanonicalIdReconcileSync(path31.join(targetRoot, "state"));
27397
+ requestEntityCanonicalIdReconcileSync(path32.join(targetRoot, "state"));
27254
27398
  }
27255
27399
  return { merged, conflicts, skipped };
27256
27400
  }
@@ -27261,7 +27405,7 @@ function walkMd(dir) {
27261
27405
  const results = [];
27262
27406
  function walk(d) {
27263
27407
  for (const entry of fs6.readdirSync(d, { withFileTypes: true })) {
27264
- const fullPath = path31.join(d, entry.name);
27408
+ const fullPath = path32.join(d, entry.name);
27265
27409
  if (entry.isSymbolicLink()) {
27266
27410
  continue;
27267
27411
  }
@@ -27290,8 +27434,8 @@ function safeRealpath(filePath) {
27290
27434
  }
27291
27435
  }
27292
27436
  function isPathInsideRoot(candidatePath, rootPath) {
27293
- const relative = path31.relative(rootPath, candidatePath);
27294
- return relative === "" || !relative.startsWith("..") && !path31.isAbsolute(relative);
27437
+ const relative = path32.relative(rootPath, candidatePath);
27438
+ return relative === "" || !relative.startsWith("..") && !path32.isAbsolute(relative);
27295
27439
  }
27296
27440
  function parseSimpleFrontmatter(content) {
27297
27441
  const match = content.match(/^---\n([\s\S]*?)\n---/);
@@ -27412,7 +27556,7 @@ var REMNIC_RECALL_DECISION_RULES = `## When to Use Recall vs Direct Read
27412
27556
  // src/memory-extension/codex-publisher.ts
27413
27557
  import fs7 from "fs";
27414
27558
  import os from "os";
27415
- import path32 from "path";
27559
+ import path33 from "path";
27416
27560
  var REMNIC_EXTENSION_DIR_NAME = "remnic";
27417
27561
  function resolveEnvHome(env) {
27418
27562
  if (env === void 0) return resolveHomeDir();
@@ -27421,12 +27565,12 @@ function resolveEnvHome(env) {
27421
27565
  function expandTildeWithHome(input, homeDir) {
27422
27566
  if (input === "~") return homeDir;
27423
27567
  if (input.startsWith("~/") || input.startsWith("~\\")) {
27424
- return path32.join(homeDir, input.slice(2));
27568
+ return path33.join(homeDir, input.slice(2));
27425
27569
  }
27426
27570
  return input;
27427
27571
  }
27428
27572
  function normalizeHostRoot(input, homeDir) {
27429
- return path32.resolve(expandTildeWithHome(input.trim(), homeDir));
27573
+ return path33.resolve(expandTildeWithHome(input.trim(), homeDir));
27430
27574
  }
27431
27575
  var CodexMemoryExtensionPublisher = class {
27432
27576
  hostId = "codex";
@@ -27440,12 +27584,12 @@ var CodexMemoryExtensionPublisher = class {
27440
27584
  async resolveExtensionRoot(env) {
27441
27585
  const homeDir = resolveEnvHome(env);
27442
27586
  const codexHomeInput = env === void 0 ? readEnvVar("CODEX_HOME")?.trim() : env.CODEX_HOME?.trim();
27443
- const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path32.resolve(homeDir, ".codex");
27444
- return path32.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
27587
+ const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path33.resolve(homeDir, ".codex");
27588
+ return path33.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
27445
27589
  }
27446
27590
  async isHostAvailable() {
27447
27591
  try {
27448
- const home = readEnvVar("CODEX_HOME")?.trim() || path32.join(resolveHomeDir(), ".codex");
27592
+ const home = readEnvVar("CODEX_HOME")?.trim() || path33.join(resolveHomeDir(), ".codex");
27449
27593
  return fs7.existsSync(home);
27450
27594
  } catch {
27451
27595
  return false;
@@ -27496,7 +27640,7 @@ When running inside the Codex phase-2 consolidation sandbox:
27496
27640
  }
27497
27641
  async publish(ctx) {
27498
27642
  const extensionRoot = await this.resolveExtensionRoot();
27499
- const instructionsPath = path32.join(extensionRoot, "instructions.md");
27643
+ const instructionsPath = path33.join(extensionRoot, "instructions.md");
27500
27644
  const filesWritten = [];
27501
27645
  const skipped = [];
27502
27646
  ctx.log.info(`Publishing Codex memory extension to ${extensionRoot}`);
@@ -28128,9 +28272,9 @@ function buildWeeklyActivitySummary(cards, options) {
28128
28272
  // src/activity/timeline/weekly-persist.ts
28129
28273
  import { randomBytes as randomBytes3 } from "crypto";
28130
28274
  import { mkdirSync, readFileSync as readFileSync2, renameSync, unlinkSync, writeFileSync } from "fs";
28131
- import path33 from "path";
28275
+ import path34 from "path";
28132
28276
  var WEEKLY_SNAPSHOT_FORMAT_VERSION = 1;
28133
- var WEEKLY_SNAPSHOT_DIR = path33.join("activity", "weekly");
28277
+ var WEEKLY_SNAPSHOT_DIR = path34.join("activity", "weekly");
28134
28278
  function requireToken(value, name) {
28135
28279
  if (typeof value !== "string" || value.trim().length === 0) {
28136
28280
  throw new TypeError(`${name} must be a non-empty string`);
@@ -28153,8 +28297,8 @@ function weeklySnapshotPath(input) {
28153
28297
  const identity = hashActivityBody(
28154
28298
  `${input.summary.weekStartUtc}\0${input.summary.weekEndUtc}\0${sourceRevision}\0${configHash}`
28155
28299
  );
28156
- return path33.join(
28157
- path33.resolve(memoryDir),
28300
+ return path34.join(
28301
+ path34.resolve(memoryDir),
28158
28302
  WEEKLY_SNAPSHOT_DIR,
28159
28303
  namespaceIdentityToken(namespace),
28160
28304
  `${weekDate}--${identity}.json`
@@ -28184,7 +28328,7 @@ function persistWeeklySnapshot(input) {
28184
28328
  throw error;
28185
28329
  }
28186
28330
  }
28187
- mkdirSync(path33.dirname(filePath), { recursive: true, mode: 448 });
28331
+ mkdirSync(path34.dirname(filePath), { recursive: true, mode: 448 });
28188
28332
  const tmpPath = `${filePath}.${process.pid}.${randomBytes3(8).toString("hex")}.tmp`;
28189
28333
  writeFileSync(tmpPath, text, { encoding: "utf8", mode: 384 });
28190
28334
  try {
@@ -28689,7 +28833,7 @@ function selectRecapForDay(input) {
28689
28833
 
28690
28834
  // src/activity/journal-read.ts
28691
28835
  import { closeSync, constants as fsConstants, fstatSync, lstatSync, openSync, readFileSync as readFileSync3, realpathSync, statSync as statSync2 } from "fs";
28692
- import path34 from "path";
28836
+ import path35 from "path";
28693
28837
 
28694
28838
  // src/activity/journal-section.ts
28695
28839
  function parseAtxHeading(line) {
@@ -28880,8 +29024,8 @@ function readJournalForDate(input) {
28880
29024
  const relative = resolveVaultNotePath(input.vault.dailyNotePath, input.date, {
28881
29025
  timezone: input.timezone
28882
29026
  });
28883
- const root = path34.resolve(expandTildePath(input.vault.vaultPath));
28884
- const filePath = path34.join(root, relative);
29027
+ const root = path35.resolve(expandTildePath(input.vault.vaultPath));
29028
+ const filePath = path35.join(root, relative);
28885
29029
  try {
28886
29030
  const rootStat = lstatSync(root);
28887
29031
  if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
@@ -28890,8 +29034,8 @@ function readJournalForDate(input) {
28890
29034
  } catch {
28891
29035
  return { ok: true, exists: false, reason: "missing_file", filePath };
28892
29036
  }
28893
- const lexical = path34.relative(root, filePath);
28894
- if (lexical.length === 0 || lexical === ".." || lexical.startsWith(`..${path34.sep}`) || path34.isAbsolute(lexical)) {
29037
+ const lexical = path35.relative(root, filePath);
29038
+ if (lexical.length === 0 || lexical === ".." || lexical.startsWith(`..${path35.sep}`) || path35.isAbsolute(lexical)) {
28895
29039
  return { ok: false, reason: "path_escape", filePath };
28896
29040
  }
28897
29041
  if (!containedBySymlinks(root, filePath)) {
@@ -28924,11 +29068,11 @@ function containedBySymlinks(root, dest) {
28924
29068
  try {
28925
29069
  if (statSync2(probe).isFile() || statSync2(probe).isDirectory()) {
28926
29070
  const real = realpathSync(probe);
28927
- return real === realRoot || real.startsWith(`${realRoot}${path34.sep}`);
29071
+ return real === realRoot || real.startsWith(`${realRoot}${path35.sep}`);
28928
29072
  }
28929
29073
  } catch {
28930
29074
  }
28931
- const parent = path34.dirname(probe);
29075
+ const parent = path35.dirname(probe);
28932
29076
  if (parent === probe) return false;
28933
29077
  probe = parent;
28934
29078
  }
@@ -28939,15 +29083,15 @@ function symlinkRejected() {
28939
29083
  return err;
28940
29084
  }
28941
29085
  function readVerifiedDailyNote(root, filePath) {
28942
- const relative = path34.relative(root, filePath);
28943
- const parts = relative.split(path34.sep).filter((part) => part.length > 0 && part !== ".");
29086
+ const relative = path35.relative(root, filePath);
29087
+ const parts = relative.split(path35.sep).filter((part) => part.length > 0 && part !== ".");
28944
29088
  let cursor = root;
28945
29089
  for (const part of parts) {
28946
- cursor = path34.join(cursor, part);
29090
+ cursor = path35.join(cursor, part);
28947
29091
  const st = lstatSync(cursor);
28948
29092
  if (st.isSymbolicLink()) throw symlinkRejected();
28949
29093
  }
28950
- const parent = path34.dirname(filePath);
29094
+ const parent = path35.dirname(filePath);
28951
29095
  const parentLstat = lstatSync(parent);
28952
29096
  if (parentLstat.isSymbolicLink() || !parentLstat.isDirectory()) throw symlinkRejected();
28953
29097
  const nofollow = fsConstants.O_NOFOLLOW ?? 0;
@@ -28971,7 +29115,7 @@ function readVerifiedDailyNote(root, filePath) {
28971
29115
  try {
28972
29116
  const fdPath = realpathSync(`/proc/self/fd/${fd}`);
28973
29117
  const realRoot = realpathSync(root);
28974
- if (fdPath !== realRoot && !fdPath.startsWith(`${realRoot}${path34.sep}`)) {
29118
+ if (fdPath !== realRoot && !fdPath.startsWith(`${realRoot}${path35.sep}`)) {
28975
29119
  throw symlinkRejected();
28976
29120
  }
28977
29121
  } catch (err) {
@@ -28986,11 +29130,11 @@ function readVerifiedDailyNote(root, filePath) {
28986
29130
  // src/activity/journal-state.ts
28987
29131
  import { createHash as createHash10, randomBytes as randomBytes4 } from "crypto";
28988
29132
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
28989
- import path35 from "path";
29133
+ import path36 from "path";
28990
29134
  var STATE_DIR_NAME = "state";
28991
29135
  var STATE_FILE_NAME = "timeline.json";
28992
29136
  function timelineStatePath(memoryDir) {
28993
- return path35.join(memoryDir, STATE_DIR_NAME, STATE_FILE_NAME);
29137
+ return path36.join(memoryDir, STATE_DIR_NAME, STATE_FILE_NAME);
28994
29138
  }
28995
29139
  function hashJournalText(text) {
28996
29140
  return createHash10("sha256").update(text, "utf8").digest("hex");
@@ -29016,14 +29160,14 @@ function readTimelineState(memoryDir) {
29016
29160
  }
29017
29161
  function writeTimelineState(memoryDir, state) {
29018
29162
  const filePath = timelineStatePath(memoryDir);
29019
- mkdirSync2(path35.dirname(filePath), { recursive: true });
29163
+ mkdirSync2(path36.dirname(filePath), { recursive: true });
29020
29164
  const tempPath = `${filePath}.${process.pid}.${randomBytes4(8).toString("hex")}.tmp`;
29021
29165
  writeFileSync2(tempPath, `${JSON.stringify(state, null, 2)}
29022
29166
  `);
29023
29167
  renameSync2(tempPath, filePath);
29024
29168
  }
29025
29169
  function journalDateLockPath(memoryDir, date) {
29026
- return path35.join(memoryDir, STATE_DIR_NAME, `journal-extract-${date}.lock`);
29170
+ return path36.join(memoryDir, STATE_DIR_NAME, `journal-extract-${date}.lock`);
29027
29171
  }
29028
29172
  function timelineStateLockPath(memoryDir) {
29029
29173
  return `${timelineStatePath(memoryDir)}.lock`;
@@ -29715,7 +29859,7 @@ function filterPrivacyWindow(items, options) {
29715
29859
  }
29716
29860
 
29717
29861
  // src/activity/vault-wikilink.ts
29718
- import path36 from "path";
29862
+ import path37 from "path";
29719
29863
  function formatVaultWikilink(notePath) {
29720
29864
  if (typeof notePath !== "string" || notePath.trim().length === 0) {
29721
29865
  throw new RangeError("Vault wikilink path must be a non-empty relative path.");
@@ -29723,7 +29867,7 @@ function formatVaultWikilink(notePath) {
29723
29867
  if (notePath.includes("\n") || notePath.includes("\r")) {
29724
29868
  throw new RangeError("Vault wikilink path must not contain newlines.");
29725
29869
  }
29726
- if (path36.posix.isAbsolute(notePath) || path36.win32.isAbsolute(notePath)) {
29870
+ if (path37.posix.isAbsolute(notePath) || path37.win32.isAbsolute(notePath)) {
29727
29871
  throw new RangeError("Vault wikilink path must be relative; absolute paths are rejected.");
29728
29872
  }
29729
29873
  if (notePath.split(/[\\/]/).some((segment) => segment === "..")) {
@@ -29745,7 +29889,7 @@ function stripVaultMdSuffix(notePath) {
29745
29889
  }
29746
29890
 
29747
29891
  // src/activity/vault-join.ts
29748
- import path37 from "path";
29892
+ import path38 from "path";
29749
29893
  function joinVaultSegments(parts) {
29750
29894
  if (parts.length === 0) {
29751
29895
  throw new RangeError("Vault path parts must be a non-empty list.");
@@ -29760,7 +29904,7 @@ function joinVaultSegments(parts) {
29760
29904
  if (part.includes("\n") || part.includes("\r")) {
29761
29905
  throw new RangeError("Vault path part must not contain a newline.");
29762
29906
  }
29763
- if (path37.posix.isAbsolute(part) || path37.win32.isAbsolute(part)) {
29907
+ if (path38.posix.isAbsolute(part) || path38.win32.isAbsolute(part)) {
29764
29908
  throw new RangeError("Vault path part must be relative.");
29765
29909
  }
29766
29910
  if (part.split("/").includes("..")) {
@@ -29815,7 +29959,7 @@ function planVaultDryRun(inputs) {
29815
29959
  // src/session-summaries/index.ts
29816
29960
  import { createHash as createHash11 } from "crypto";
29817
29961
  import { lstat as lstat3, mkdir as mkdir7, readFile as readFile9, readdir as readdir4, rename, rm, stat as stat4, writeFile as writeFile7 } from "fs/promises";
29818
- import path38 from "path";
29962
+ import path39 from "path";
29819
29963
 
29820
29964
  // src/session-summaries/adapters.ts
29821
29965
  var VALID_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "tool", "system", "other"]);
@@ -30320,7 +30464,7 @@ function shortHash(value, length = 16) {
30320
30464
  async function listTranscriptFiles(root, maxFiles) {
30321
30465
  const out = [];
30322
30466
  let truncated = false;
30323
- const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path38.sep}` : entryName;
30467
+ const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path39.sep}` : entryName;
30324
30468
  async function visit(dir) {
30325
30469
  if (truncated) return;
30326
30470
  const entries = (await readdir4(dir, { withFileTypes: true })).sort(
@@ -30330,13 +30474,13 @@ async function listTranscriptFiles(root, maxFiles) {
30330
30474
  if (truncated) return;
30331
30475
  if (entry.name.startsWith(".")) continue;
30332
30476
  if (entry.isSymbolicLink()) continue;
30333
- const fullPath = path38.join(dir, entry.name);
30477
+ const fullPath = path39.join(dir, entry.name);
30334
30478
  if (entry.isDirectory()) {
30335
30479
  await visit(fullPath);
30336
30480
  continue;
30337
30481
  }
30338
30482
  if (!entry.isFile()) continue;
30339
- const ext = path38.extname(entry.name).toLowerCase();
30483
+ const ext = path39.extname(entry.name).toLowerCase();
30340
30484
  if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
30341
30485
  out.push(fullPath);
30342
30486
  if (out.length > maxFiles) {
@@ -30363,7 +30507,7 @@ function normalizeInputDir(inputDir) {
30363
30507
  if (typeof inputDir !== "string" || inputDir.trim().length === 0) {
30364
30508
  throw new Error("inputDir must be a non-empty string");
30365
30509
  }
30366
- return path38.resolve(expandTildePath(inputDir.trim()));
30510
+ return path39.resolve(expandTildePath(inputDir.trim()));
30367
30511
  }
30368
30512
  function initRoleCounts() {
30369
30513
  return {
@@ -30520,11 +30664,11 @@ async function collectLocalSessionSummaries(options) {
30520
30664
  continue;
30521
30665
  }
30522
30666
  seenFileHashes.add(fileHash);
30523
- const fileExtension = path38.extname(filePath).toLowerCase();
30667
+ const fileExtension = path39.extname(filePath).toLowerCase();
30524
30668
  const parsed = await adapter.parseFile(
30525
30669
  {
30526
30670
  content,
30527
- fileName: path38.basename(filePath),
30671
+ fileName: path39.basename(filePath),
30528
30672
  fileExtension,
30529
30673
  fileRef: fileHash
30530
30674
  },
@@ -30580,7 +30724,7 @@ async function collectLocalSessionSummaries(options) {
30580
30724
  }
30581
30725
  async function readRedactionConfig(pathLike) {
30582
30726
  if (!pathLike) return void 0;
30583
- const raw = await readFile9(path38.resolve(expandTildePath(pathLike)), "utf-8");
30727
+ const raw = await readFile9(path39.resolve(expandTildePath(pathLike)), "utf-8");
30584
30728
  const parsed = JSON.parse(raw);
30585
30729
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
30586
30730
  throw new Error("redaction config must be a JSON object");
@@ -30593,15 +30737,15 @@ function toJsonl(drafts) {
30593
30737
  }
30594
30738
  function defaultDraftOutputPath(memoryDir, generatedAt) {
30595
30739
  const stamp = generatedAt.replace(/[:.]/g, "-");
30596
- return path38.join(
30597
- path38.resolve(expandTildePath(memoryDir)),
30740
+ return path39.join(
30741
+ path39.resolve(expandTildePath(memoryDir)),
30598
30742
  "state",
30599
30743
  "session-summary-drafts",
30600
30744
  `session-summaries-${stamp}.jsonl`
30601
30745
  );
30602
30746
  }
30603
30747
  async function writeDrafts(filePath, drafts) {
30604
- await mkdir7(path38.dirname(filePath), { recursive: true });
30748
+ await mkdir7(path39.dirname(filePath), { recursive: true });
30605
30749
  const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
30606
30750
  try {
30607
30751
  await writeFile7(tempPath, toJsonl(drafts), "utf-8");
@@ -30619,7 +30763,7 @@ async function runLocalSessionSummaryCliCommand(options) {
30619
30763
  });
30620
30764
  const wroteFiles = [];
30621
30765
  if (options.output) {
30622
- const outputPath = path38.resolve(expandTildePath(options.output));
30766
+ const outputPath = path39.resolve(expandTildePath(options.output));
30623
30767
  await writeDrafts(outputPath, report.drafts);
30624
30768
  wroteFiles.push(outputPath);
30625
30769
  }
@@ -30654,19 +30798,19 @@ async function runLocalSessionSummaryCliCommand(options) {
30654
30798
 
30655
30799
  // src/transfer/capsule-fork.ts
30656
30800
  import { lstat as lstat4, mkdir as mkdir8, readFile as readFile10, realpath as realpath3, writeFile as writeFile8 } from "fs/promises";
30657
- import path39 from "path";
30801
+ import path40 from "path";
30658
30802
  async function forkCapsule(opts) {
30659
30803
  validateForkId(opts.forkId);
30660
- const rootAbs = path39.resolve(opts.targetRoot);
30804
+ const rootAbs = path40.resolve(opts.targetRoot);
30661
30805
  await assertIsDirectoryNotSymlink(rootAbs, "forkCapsule", "targetRoot");
30662
- const forkDirAbs = path39.join(rootAbs, "forks", opts.forkId);
30806
+ const forkDirAbs = path40.join(rootAbs, "forks", opts.forkId);
30663
30807
  const forkEntryExists = await pathEntryExists(forkDirAbs);
30664
30808
  if (forkEntryExists) {
30665
30809
  throw new Error(
30666
30810
  `forkCapsule: fork path already exists \u2014 forkId "${opts.forkId}" is already in use at: ${forkDirAbs}`
30667
30811
  );
30668
30812
  }
30669
- const archiveAbs = path39.resolve(opts.sourceArchive);
30813
+ const archiveAbs = path40.resolve(opts.sourceArchive);
30670
30814
  const importResult = await importCapsule({
30671
30815
  archivePath: archiveAbs,
30672
30816
  root: rootAbs,
@@ -30688,10 +30832,10 @@ async function forkCapsule(opts) {
30688
30832
  importedRecords: importResult.imported.length,
30689
30833
  skippedRecords: importResult.skipped.length
30690
30834
  };
30691
- const lineagePath = path39.join(forkDirAbs, "lineage.json");
30835
+ const lineagePath = path40.join(forkDirAbs, "lineage.json");
30692
30836
  const rootReal = await realpath3(rootAbs);
30693
30837
  await assertRealpathInsideRoot(rootReal, lineagePath, `forks/${opts.forkId}/lineage.json`, "forkCapsule");
30694
- await mkdir8(path39.dirname(lineagePath), { recursive: true });
30838
+ await mkdir8(path40.dirname(lineagePath), { recursive: true });
30695
30839
  await writeFile8(lineagePath, JSON.stringify(lineage, null, 2) + "\n", "utf-8");
30696
30840
  return {
30697
30841
  archivePath: archiveAbs,
@@ -30705,11 +30849,11 @@ async function readForkLineage(targetRoot, forkId) {
30705
30849
  if (typeof forkId !== "string" || forkId.length === 0 || forkId.length > 64 || !CAPSULE_ID_PATTERN.test(forkId)) {
30706
30850
  return null;
30707
30851
  }
30708
- const rootAbs = path39.resolve(targetRoot);
30852
+ const rootAbs = path40.resolve(targetRoot);
30709
30853
  const rootReal = await realpath3(rootAbs).catch(() => rootAbs);
30710
- const lineagePath = path39.join(rootReal, "forks", forkId, "lineage.json");
30711
- const rel = path39.relative(rootReal, lineagePath);
30712
- if (rel.startsWith("..") || path39.isAbsolute(rel)) {
30854
+ const lineagePath = path40.join(rootReal, "forks", forkId, "lineage.json");
30855
+ const rel = path40.relative(rootReal, lineagePath);
30856
+ if (rel.startsWith("..") || path40.isAbsolute(rel)) {
30713
30857
  return null;
30714
30858
  }
30715
30859
  if (!await isLineagePathContained(rootReal, lineagePath)) {
@@ -30750,19 +30894,19 @@ async function pathEntryExists(absPath) {
30750
30894
  async function isLineagePathContained(rootReal, lineagePath) {
30751
30895
  let existing = lineagePath;
30752
30896
  const suffix = [];
30753
- while (existing !== path39.dirname(existing)) {
30897
+ while (existing !== path40.dirname(existing)) {
30754
30898
  const st = await lstat4(existing).catch(() => null);
30755
30899
  if (st !== null) break;
30756
- suffix.unshift(path39.basename(existing));
30757
- existing = path39.dirname(existing);
30900
+ suffix.unshift(path40.basename(existing));
30901
+ existing = path40.dirname(existing);
30758
30902
  }
30759
30903
  const existingReal = await realpath3(existing).catch(() => existing);
30760
- const targetReal = suffix.length > 0 ? path39.join(existingReal, ...suffix) : existingReal;
30761
- const rel = path39.relative(rootReal, targetReal);
30904
+ const targetReal = suffix.length > 0 ? path40.join(existingReal, ...suffix) : existingReal;
30905
+ const rel = path40.relative(rootReal, targetReal);
30762
30906
  if (rel === "") return true;
30763
30907
  if (rel === "..") return false;
30764
- if (rel.startsWith(`..${path39.sep}`)) return false;
30765
- if (path39.isAbsolute(rel)) return false;
30908
+ if (rel.startsWith(`..${path40.sep}`)) return false;
30909
+ if (path40.isAbsolute(rel)) return false;
30766
30910
  return true;
30767
30911
  }
30768
30912
 
@@ -30951,4 +31095,4 @@ export {
30951
31095
  qmdStartupCollectionChecksWithTimeout,
30952
31096
  Orchestrator
30953
31097
  };
30954
- //# sourceMappingURL=chunk-IST6MBYC.js.map
31098
+ //# sourceMappingURL=chunk-BMAYH7F4.js.map