@remnic/core 10.0.51 → 10.0.53

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 (266) hide show
  1. package/dist/access-admin-ops-surface.js +24 -24
  2. package/dist/access-authorization-probe.js +25 -25
  3. package/dist/access-boundary.js +24 -24
  4. package/dist/access-cli.js +65 -65
  5. package/dist/access-extraction-force-flush.js +24 -24
  6. package/dist/access-http-briefing.js +25 -25
  7. package/dist/access-http-query.js +26 -26
  8. package/dist/access-http.js +40 -40
  9. package/dist/access-identity-continuity-surface.js +24 -24
  10. package/dist/access-lcm-surface.js +24 -24
  11. package/dist/access-mcp.js +33 -33
  12. package/dist/access-namespace-preflight.js +24 -24
  13. package/dist/access-observe-write-surface.js +24 -24
  14. package/dist/access-operations-batch.js +25 -25
  15. package/dist/access-operations.js +32 -32
  16. package/dist/access-recall-concurrency.js +24 -24
  17. package/dist/access-recall-response.js +24 -24
  18. package/dist/access-recall-surface.js +24 -24
  19. package/dist/access-service.js +24 -24
  20. package/dist/access-surface-catalog.js +26 -26
  21. package/dist/active-recall.js +9 -9
  22. package/dist/briefing.js +10 -10
  23. package/dist/buffer.js +5 -5
  24. package/dist/causal-consolidation.js +11 -11
  25. package/dist/{chunk-3NL4ALUP.js → chunk-24SIB3EW.js} +3 -3
  26. package/dist/{chunk-Y3T5KQCR.js → chunk-2EYCW2ET.js} +2 -2
  27. package/dist/{chunk-AHGOOZUC.js → chunk-34UVJNSG.js} +2 -2
  28. package/dist/{chunk-2EXF6IIB.js → chunk-3632XJMR.js} +2 -2
  29. package/dist/{chunk-KETS5A62.js → chunk-3H3PNQEF.js} +2 -2
  30. package/dist/{chunk-SFRBUBUZ.js → chunk-3LNAQLW4.js} +3 -3
  31. package/dist/{chunk-75BK4XGV.js → chunk-4BUJICMI.js} +10 -10
  32. package/dist/{chunk-KIWO4327.js → chunk-4W5B5Z6P.js} +2 -2
  33. package/dist/{chunk-B35EQQ7L.js → chunk-53OFDW3P.js} +3 -3
  34. package/dist/{chunk-2ONKXEC7.js → chunk-5LBBXI2A.js} +2 -2
  35. package/dist/{chunk-UCLJTGP3.js → chunk-65B5RFKQ.js} +2 -2
  36. package/dist/{chunk-KAJYSO3U.js → chunk-6CDNOREO.js} +2 -2
  37. package/dist/{chunk-POJRFSJM.js → chunk-7XGNGLAN.js} +2 -2
  38. package/dist/{chunk-A6JDT6QF.js → chunk-AO5ZOD32.js} +2 -2
  39. package/dist/{chunk-RA7YRL6H.js → chunk-AOSCGNIC.js} +3 -3
  40. package/dist/{chunk-LWMLBVGB.js → chunk-B43P3DTC.js} +2 -2
  41. package/dist/{chunk-SJD334AG.js → chunk-CA6X37OB.js} +217 -173
  42. package/dist/chunk-CA6X37OB.js.map +1 -0
  43. package/dist/{chunk-VUMWVYMR.js → chunk-CIMD2MUR.js} +3 -3
  44. package/dist/{chunk-XRFLR3XF.js → chunk-DLZGSZVC.js} +22 -9
  45. package/dist/chunk-DLZGSZVC.js.map +1 -0
  46. package/dist/{chunk-5CWH2LKL.js → chunk-DOJBV6WR.js} +29 -14
  47. package/dist/chunk-DOJBV6WR.js.map +1 -0
  48. package/dist/{chunk-44EUCSG4.js → chunk-FFQNNFHX.js} +2 -2
  49. package/dist/{chunk-HEF4BRMT.js → chunk-FZLZUDJJ.js} +2 -2
  50. package/dist/{chunk-L3EFYRYK.js → chunk-GGFQAGOT.js} +7 -7
  51. package/dist/{chunk-ZLCBLDJO.js → chunk-GIRWNTMV.js} +2 -2
  52. package/dist/{chunk-EC2KVA27.js → chunk-H4DWSOBQ.js} +169 -105
  53. package/dist/chunk-H4DWSOBQ.js.map +1 -0
  54. package/dist/{chunk-SHNM7RIT.js → chunk-HJ4X4BGS.js} +2 -2
  55. package/dist/{chunk-MUNYUSBU.js → chunk-HJQ4NKKO.js} +2 -2
  56. package/dist/{chunk-V6Z4NAJZ.js → chunk-HM3ZTDAX.js} +2 -2
  57. package/dist/{chunk-EZS6QJNC.js → chunk-IFOCK3OJ.js} +2 -2
  58. package/dist/{chunk-LXXIV7Y2.js → chunk-JEX2JL3U.js} +7 -2
  59. package/dist/{chunk-LXXIV7Y2.js.map → chunk-JEX2JL3U.js.map} +1 -1
  60. package/dist/{chunk-DF6ZF2BN.js → chunk-LIVNX7WK.js} +2 -2
  61. package/dist/{chunk-WY66J4PI.js → chunk-LRVFS4KA.js} +2 -2
  62. package/dist/{chunk-LMB47UM6.js → chunk-LTDK6HBV.js} +2 -2
  63. package/dist/{chunk-HCIRR3BA.js → chunk-M4U25HLR.js} +2 -2
  64. package/dist/{chunk-YK7ZJPQM.js → chunk-MGN2RQRG.js} +2 -2
  65. package/dist/{chunk-G26YNEOC.js → chunk-NWA6IXR3.js} +1 -1
  66. package/dist/{chunk-G26YNEOC.js.map → chunk-NWA6IXR3.js.map} +1 -1
  67. package/dist/{chunk-JIJAWTRK.js → chunk-OCXDZJL4.js} +264 -194
  68. package/dist/chunk-OCXDZJL4.js.map +1 -0
  69. package/dist/{chunk-IUQXRRJB.js → chunk-OMWQO7H6.js} +2 -2
  70. package/dist/{chunk-7VO6E5UD.js → chunk-OVZIYLBZ.js} +6 -2
  71. package/dist/chunk-OVZIYLBZ.js.map +1 -0
  72. package/dist/{chunk-SPTPBKZX.js → chunk-OWNAWY6D.js} +2 -2
  73. package/dist/{chunk-XKDQTDXN.js → chunk-PFUXPTBT.js} +36 -15
  74. package/dist/chunk-PFUXPTBT.js.map +1 -0
  75. package/dist/{chunk-DQOGZZJA.js → chunk-QAHP5SBG.js} +3 -3
  76. package/dist/{chunk-GBGU5OZP.js → chunk-QF5EJ5VP.js} +13 -13
  77. package/dist/{chunk-FT75AQ74.js → chunk-QS5DUSBM.js} +2 -2
  78. package/dist/{chunk-72CBJ5VP.js → chunk-R3WZ74B2.js} +3 -3
  79. package/dist/{chunk-PDTNQLPC.js → chunk-RG3I2663.js} +2 -2
  80. package/dist/{chunk-CK6GCGMX.js → chunk-RTJJPW3C.js} +2 -2
  81. package/dist/{chunk-RJDYDF5K.js → chunk-TRAOZ2WP.js} +2 -2
  82. package/dist/{chunk-6ZAU7LAR.js → chunk-TTTPTQ6S.js} +2 -2
  83. package/dist/{chunk-JS44PBCM.js → chunk-U2A56LLF.js} +6 -6
  84. package/dist/{chunk-MC7PXJDP.js → chunk-UBOWDOL5.js} +5 -5
  85. package/dist/{chunk-4FM35YIA.js → chunk-UQYBPPVC.js} +2 -2
  86. package/dist/{chunk-OCRLJJOV.js → chunk-V4VCBFAL.js} +3 -3
  87. package/dist/{chunk-FNNGWN3O.js → chunk-VGE4PUY6.js} +2 -2
  88. package/dist/{chunk-5DVOBBTV.js → chunk-VV73XT3A.js} +2 -2
  89. package/dist/{chunk-GE3ZX6YK.js → chunk-W7NKMRAF.js} +2 -2
  90. package/dist/{chunk-AJJPXUE6.js → chunk-WBN66HPI.js} +2 -2
  91. package/dist/{chunk-XWJUFER3.js → chunk-WGFEGBFB.js} +2 -2
  92. package/dist/{chunk-43TUWQNR.js → chunk-XDKEHZUC.js} +2 -2
  93. package/dist/{chunk-ROAKLYOL.js → chunk-XHEKS4UN.js} +2 -2
  94. package/dist/{chunk-ZKK3VMWU.js → chunk-XVTB6BZS.js} +2 -2
  95. package/dist/{chunk-AZLD4CKG.js → chunk-Y56D5FSD.js} +17 -17
  96. package/dist/{chunk-MPWOAIIH.js → chunk-YDT3OEYF.js} +2 -2
  97. package/dist/{chunk-IN6U2BS5.js → chunk-YJHOVA42.js} +2 -2
  98. package/dist/{chunk-TC55M5PO.js → chunk-YLN4ZQV4.js} +2 -2
  99. package/dist/cli.js +50 -50
  100. package/dist/coding/export-okf-codegraph.js +9 -9
  101. package/dist/compounding/engine.js +11 -11
  102. package/dist/config.js +9 -9
  103. package/dist/connectors/codex-materialize-runner.js +10 -10
  104. package/dist/connectors/index.js +10 -10
  105. package/dist/convergence-refresh.js +12 -12
  106. package/dist/corpus-watermark.js +12 -12
  107. package/dist/entity-retrieval.js +10 -10
  108. package/dist/external-wiki-access.js +25 -25
  109. package/dist/extraction.js +14 -14
  110. package/dist/harmonic-retrieval.js +10 -10
  111. package/dist/index.js +65 -65
  112. package/dist/location/index.js +12 -12
  113. package/dist/maintenance/memory-governance.js +10 -10
  114. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
  115. package/dist/maintenance/rebuild-memory-projection-runner.js +12 -12
  116. package/dist/maintenance/rebuild-memory-projection.js +11 -11
  117. package/dist/memory-browse-operations.js +25 -25
  118. package/dist/memory-browse.js +5 -5
  119. package/dist/namespaces/migrate.js +11 -11
  120. package/dist/namespaces/search.d.ts.map +1 -1
  121. package/dist/namespaces/search.js +8 -8
  122. package/dist/namespaces/storage.js +10 -10
  123. package/dist/operator-doctor-corpus.js +13 -13
  124. package/dist/operator-toolkit.js +18 -18
  125. package/dist/orchestration/extraction-persist-deps.d.ts +2 -0
  126. package/dist/orchestration/extraction-persist-deps.d.ts.map +1 -1
  127. package/dist/orchestration/extraction-persist-promotion.d.ts +40 -10
  128. package/dist/orchestration/extraction-persist-promotion.d.ts.map +1 -1
  129. package/dist/orchestration/extraction-persist.d.ts.map +1 -1
  130. package/dist/orchestration/lifecycle-pending-fallback-drain.d.ts +18 -0
  131. package/dist/orchestration/lifecycle-pending-fallback-drain.d.ts.map +1 -0
  132. package/dist/orchestration/maintenance.d.ts +11 -13
  133. package/dist/orchestration/maintenance.d.ts.map +1 -1
  134. package/dist/orchestration/maintenance.js +20 -20
  135. package/dist/orchestration/qmd-maintenance-completion.d.ts +20 -0
  136. package/dist/orchestration/qmd-maintenance-completion.d.ts.map +1 -0
  137. package/dist/orchestrator.d.ts.map +1 -1
  138. package/dist/orchestrator.js +65 -65
  139. package/dist/qmd.js +2 -2
  140. package/dist/recall-composition-decision.js +2 -2
  141. package/dist/recall-navigation-operations.js +25 -25
  142. package/dist/recall-navigation.js +24 -24
  143. package/dist/recall-state-view-admission.js +5 -5
  144. package/dist/recall-why-service.js +5 -5
  145. package/dist/resume-bundles.js +9 -9
  146. package/dist/search/factory.js +7 -7
  147. package/dist/search/index.js +7 -7
  148. package/dist/search/lancedb-backend.d.ts +3 -0
  149. package/dist/search/lancedb-backend.d.ts.map +1 -1
  150. package/dist/search/lancedb-backend.js +2 -2
  151. package/dist/search/meilisearch-backend.d.ts +3 -0
  152. package/dist/search/meilisearch-backend.d.ts.map +1 -1
  153. package/dist/search/meilisearch-backend.js +2 -2
  154. package/dist/search/orama-backend.d.ts +3 -0
  155. package/dist/search/orama-backend.d.ts.map +1 -1
  156. package/dist/search/orama-backend.js +2 -2
  157. package/dist/search/port.d.ts +7 -0
  158. package/dist/search/port.d.ts.map +1 -1
  159. package/dist/search/port.js +1 -1
  160. package/dist/search/remote-backend.d.ts +2 -0
  161. package/dist/search/remote-backend.d.ts.map +1 -1
  162. package/dist/search/remote-backend.js +2 -2
  163. package/dist/semantic-consolidation.js +11 -11
  164. package/dist/semantic-rule-promotion.js +10 -10
  165. package/dist/semantic-rule-verifier.js +10 -10
  166. package/dist/source-agent-qualifier.js +13 -13
  167. package/dist/standup/build.js +10 -10
  168. package/dist/storage/entity-canonical-id-migration-adapter.d.ts +7 -1
  169. package/dist/storage/entity-canonical-id-migration-adapter.d.ts.map +1 -1
  170. package/dist/storage/entity-migration-maintenance-pending.d.ts +31 -0
  171. package/dist/storage/entity-migration-maintenance-pending.d.ts.map +1 -0
  172. package/dist/storage.d.ts +2 -2
  173. package/dist/storage.d.ts.map +1 -1
  174. package/dist/storage.js +9 -9
  175. package/dist/support-passport/index.js +27 -27
  176. package/dist/transfer/export-okf.js +10 -10
  177. package/dist/verified-recall.js +10 -10
  178. package/dist/who-knows-cli.js +11 -11
  179. package/dist/who-knows.js +10 -10
  180. package/package.json +2 -2
  181. package/src/namespaces/search.test.ts +121 -0
  182. package/src/namespaces/search.ts +8 -0
  183. package/src/orchestration/extraction-persist-deps.ts +3 -0
  184. package/src/orchestration/extraction-persist-promotion.ts +104 -16
  185. package/src/orchestration/extraction-persist.ts +66 -77
  186. package/src/orchestration/lifecycle-pending-fallback-drain.ts +97 -0
  187. package/src/orchestration/maintenance.test.ts +443 -1
  188. package/src/orchestration/maintenance.ts +73 -95
  189. package/src/orchestration/qmd-maintenance-completion.ts +32 -0
  190. package/src/orchestrator-entity-write-failure.test.ts +370 -0
  191. package/src/orchestrator.ts +9 -1
  192. package/src/search/lancedb-backend.ts +29 -12
  193. package/src/search/meilisearch-backend.test.ts +148 -0
  194. package/src/search/meilisearch-backend.ts +41 -14
  195. package/src/search/orama-backend.test.ts +75 -1
  196. package/src/search/orama-backend.ts +22 -7
  197. package/src/search/port.ts +7 -0
  198. package/src/search/remote-backend.ts +4 -0
  199. package/src/storage/entity-canonical-id-migration-adapter.ts +44 -9
  200. package/src/storage/entity-migration-maintenance-pending-helpers.test.ts +87 -0
  201. package/src/storage/entity-migration-maintenance-pending.test.ts +242 -0
  202. package/src/storage/entity-migration-maintenance-pending.ts +89 -0
  203. package/src/storage.ts +2 -2
  204. package/dist/chunk-5CWH2LKL.js.map +0 -1
  205. package/dist/chunk-7VO6E5UD.js.map +0 -1
  206. package/dist/chunk-EC2KVA27.js.map +0 -1
  207. package/dist/chunk-JIJAWTRK.js.map +0 -1
  208. package/dist/chunk-SJD334AG.js.map +0 -1
  209. package/dist/chunk-XKDQTDXN.js.map +0 -1
  210. package/dist/chunk-XRFLR3XF.js.map +0 -1
  211. /package/dist/{chunk-3NL4ALUP.js.map → chunk-24SIB3EW.js.map} +0 -0
  212. /package/dist/{chunk-Y3T5KQCR.js.map → chunk-2EYCW2ET.js.map} +0 -0
  213. /package/dist/{chunk-AHGOOZUC.js.map → chunk-34UVJNSG.js.map} +0 -0
  214. /package/dist/{chunk-2EXF6IIB.js.map → chunk-3632XJMR.js.map} +0 -0
  215. /package/dist/{chunk-KETS5A62.js.map → chunk-3H3PNQEF.js.map} +0 -0
  216. /package/dist/{chunk-SFRBUBUZ.js.map → chunk-3LNAQLW4.js.map} +0 -0
  217. /package/dist/{chunk-75BK4XGV.js.map → chunk-4BUJICMI.js.map} +0 -0
  218. /package/dist/{chunk-KIWO4327.js.map → chunk-4W5B5Z6P.js.map} +0 -0
  219. /package/dist/{chunk-B35EQQ7L.js.map → chunk-53OFDW3P.js.map} +0 -0
  220. /package/dist/{chunk-2ONKXEC7.js.map → chunk-5LBBXI2A.js.map} +0 -0
  221. /package/dist/{chunk-UCLJTGP3.js.map → chunk-65B5RFKQ.js.map} +0 -0
  222. /package/dist/{chunk-KAJYSO3U.js.map → chunk-6CDNOREO.js.map} +0 -0
  223. /package/dist/{chunk-POJRFSJM.js.map → chunk-7XGNGLAN.js.map} +0 -0
  224. /package/dist/{chunk-A6JDT6QF.js.map → chunk-AO5ZOD32.js.map} +0 -0
  225. /package/dist/{chunk-RA7YRL6H.js.map → chunk-AOSCGNIC.js.map} +0 -0
  226. /package/dist/{chunk-LWMLBVGB.js.map → chunk-B43P3DTC.js.map} +0 -0
  227. /package/dist/{chunk-VUMWVYMR.js.map → chunk-CIMD2MUR.js.map} +0 -0
  228. /package/dist/{chunk-44EUCSG4.js.map → chunk-FFQNNFHX.js.map} +0 -0
  229. /package/dist/{chunk-HEF4BRMT.js.map → chunk-FZLZUDJJ.js.map} +0 -0
  230. /package/dist/{chunk-L3EFYRYK.js.map → chunk-GGFQAGOT.js.map} +0 -0
  231. /package/dist/{chunk-ZLCBLDJO.js.map → chunk-GIRWNTMV.js.map} +0 -0
  232. /package/dist/{chunk-SHNM7RIT.js.map → chunk-HJ4X4BGS.js.map} +0 -0
  233. /package/dist/{chunk-MUNYUSBU.js.map → chunk-HJQ4NKKO.js.map} +0 -0
  234. /package/dist/{chunk-V6Z4NAJZ.js.map → chunk-HM3ZTDAX.js.map} +0 -0
  235. /package/dist/{chunk-EZS6QJNC.js.map → chunk-IFOCK3OJ.js.map} +0 -0
  236. /package/dist/{chunk-DF6ZF2BN.js.map → chunk-LIVNX7WK.js.map} +0 -0
  237. /package/dist/{chunk-WY66J4PI.js.map → chunk-LRVFS4KA.js.map} +0 -0
  238. /package/dist/{chunk-LMB47UM6.js.map → chunk-LTDK6HBV.js.map} +0 -0
  239. /package/dist/{chunk-HCIRR3BA.js.map → chunk-M4U25HLR.js.map} +0 -0
  240. /package/dist/{chunk-YK7ZJPQM.js.map → chunk-MGN2RQRG.js.map} +0 -0
  241. /package/dist/{chunk-IUQXRRJB.js.map → chunk-OMWQO7H6.js.map} +0 -0
  242. /package/dist/{chunk-SPTPBKZX.js.map → chunk-OWNAWY6D.js.map} +0 -0
  243. /package/dist/{chunk-DQOGZZJA.js.map → chunk-QAHP5SBG.js.map} +0 -0
  244. /package/dist/{chunk-GBGU5OZP.js.map → chunk-QF5EJ5VP.js.map} +0 -0
  245. /package/dist/{chunk-FT75AQ74.js.map → chunk-QS5DUSBM.js.map} +0 -0
  246. /package/dist/{chunk-72CBJ5VP.js.map → chunk-R3WZ74B2.js.map} +0 -0
  247. /package/dist/{chunk-PDTNQLPC.js.map → chunk-RG3I2663.js.map} +0 -0
  248. /package/dist/{chunk-CK6GCGMX.js.map → chunk-RTJJPW3C.js.map} +0 -0
  249. /package/dist/{chunk-RJDYDF5K.js.map → chunk-TRAOZ2WP.js.map} +0 -0
  250. /package/dist/{chunk-6ZAU7LAR.js.map → chunk-TTTPTQ6S.js.map} +0 -0
  251. /package/dist/{chunk-JS44PBCM.js.map → chunk-U2A56LLF.js.map} +0 -0
  252. /package/dist/{chunk-MC7PXJDP.js.map → chunk-UBOWDOL5.js.map} +0 -0
  253. /package/dist/{chunk-4FM35YIA.js.map → chunk-UQYBPPVC.js.map} +0 -0
  254. /package/dist/{chunk-OCRLJJOV.js.map → chunk-V4VCBFAL.js.map} +0 -0
  255. /package/dist/{chunk-FNNGWN3O.js.map → chunk-VGE4PUY6.js.map} +0 -0
  256. /package/dist/{chunk-5DVOBBTV.js.map → chunk-VV73XT3A.js.map} +0 -0
  257. /package/dist/{chunk-GE3ZX6YK.js.map → chunk-W7NKMRAF.js.map} +0 -0
  258. /package/dist/{chunk-AJJPXUE6.js.map → chunk-WBN66HPI.js.map} +0 -0
  259. /package/dist/{chunk-XWJUFER3.js.map → chunk-WGFEGBFB.js.map} +0 -0
  260. /package/dist/{chunk-43TUWQNR.js.map → chunk-XDKEHZUC.js.map} +0 -0
  261. /package/dist/{chunk-ROAKLYOL.js.map → chunk-XHEKS4UN.js.map} +0 -0
  262. /package/dist/{chunk-ZKK3VMWU.js.map → chunk-XVTB6BZS.js.map} +0 -0
  263. /package/dist/{chunk-AZLD4CKG.js.map → chunk-Y56D5FSD.js.map} +0 -0
  264. /package/dist/{chunk-MPWOAIIH.js.map → chunk-YDT3OEYF.js.map} +0 -0
  265. /package/dist/{chunk-IN6U2BS5.js.map → chunk-YJHOVA42.js.map} +0 -0
  266. /package/dist/{chunk-TC55M5PO.js.map → chunk-YLN4ZQV4.js.map} +0 -0
@@ -9,26 +9,26 @@ import {
9
9
  } from "./chunk-666A3MOW.js";
10
10
  import {
11
11
  PROJECTION_REBUILD_RUNNER_FLAG
12
- } from "./chunk-LWMLBVGB.js";
12
+ } from "./chunk-B43P3DTC.js";
13
13
  import {
14
14
  startLocationAutoSync
15
- } from "./chunk-KAJYSO3U.js";
15
+ } from "./chunk-6CDNOREO.js";
16
16
  import {
17
17
  CompoundingEngine,
18
18
  isIsoWeekId,
19
19
  msUntilNextIsoWeek,
20
20
  previousIsoWeekId
21
- } from "./chunk-B35EQQ7L.js";
21
+ } from "./chunk-53OFDW3P.js";
22
22
  import {
23
23
  rebuildMemoryLifecycleLedger
24
- } from "./chunk-EZS6QJNC.js";
24
+ } from "./chunk-IFOCK3OJ.js";
25
25
  import {
26
26
  planNamespaceMaintenance,
27
27
  runNamespaceMaintenanceBatchPlan
28
- } from "./chunk-72CBJ5VP.js";
28
+ } from "./chunk-R3WZ74B2.js";
29
29
  import {
30
30
  rebuildMemoryProjection
31
- } from "./chunk-DQOGZZJA.js";
31
+ } from "./chunk-QAHP5SBG.js";
32
32
  import {
33
33
  DEFAULT_TIMELINE_CATEGORIES,
34
34
  TIMELINE_RESERVED_IDLE,
@@ -108,8 +108,8 @@ import {
108
108
 
109
109
  // src/orchestration/maintenance.ts
110
110
  import { existsSync as existsSync2 } from "fs";
111
- import { appendFile, lstat as lstat2, mkdir as mkdir3, readFile as readFile2, readdir, realpath, stat, writeFile as writeFile2 } from "fs/promises";
112
- import path7 from "path";
111
+ import { lstat as lstat2, readdir, realpath, stat } from "fs/promises";
112
+ import path8 from "path";
113
113
 
114
114
  // src/maintenance/day-summary-cron.ts
115
115
  function resolveDaySummaryCronModel(config) {
@@ -373,14 +373,85 @@ async function maybeRebuildMemoryProjectionScheduled(opts) {
373
373
  }
374
374
  }
375
375
 
376
+ // src/orchestration/lifecycle-pending-fallback-drain.ts
377
+ import { appendFile, mkdir, readFile, writeFile } from "fs/promises";
378
+ import path2 from "path";
379
+ async function drainPendingLifecycleAppendsForPath(memoryDir) {
380
+ const ledgerPath = path2.join(memoryDir, "state", "memory-lifecycle-ledger.jsonl");
381
+ const spillDir = pendingLifecycleLedgerDir(ledgerPath);
382
+ let spillFiles;
383
+ let claimedOrphans;
384
+ try {
385
+ spillFiles = await listContainedSpillFiles(spillDir);
386
+ claimedOrphans = await listContainedSpillFiles(spillDir, ".jsonl.claimed");
387
+ } catch (err) {
388
+ log.debug(`fallback lifecycle pending scan failed (non-fatal) for ${memoryDir}: ${err}`);
389
+ return;
390
+ }
391
+ if (spillFiles.length === 0 && claimedOrphans.length === 0) return;
392
+ const io = {
393
+ writeSecure: async (filePath, payload) => {
394
+ await mkdir(path2.dirname(filePath), { recursive: true });
395
+ await writeFile(filePath, payload, "utf-8");
396
+ },
397
+ readSecure: async (filePath) => {
398
+ if (await probeEncryptedRegularFileHeader(filePath)) {
399
+ throw new Error(`fallback lifecycle drain deferred: encrypted spill at ${filePath}`);
400
+ }
401
+ return readFile(filePath, "utf-8");
402
+ }
403
+ };
404
+ try {
405
+ await drainPendingLifecycleLedgerIfAny(
406
+ ledgerPath,
407
+ io,
408
+ async (payload) => {
409
+ if (await probeEncryptedRegularFileHeader(ledgerPath)) {
410
+ throw new Error(`fallback lifecycle drain deferred: ledger became encrypted at ${ledgerPath}`);
411
+ }
412
+ await appendFile(ledgerPath, payload, "utf-8");
413
+ },
414
+ async () => {
415
+ await mkdir(path2.dirname(ledgerPath), { recursive: true });
416
+ }
417
+ );
418
+ } catch (err) {
419
+ log.debug(`fallback lifecycle pending drain failed (non-fatal) for ${memoryDir}: ${err}`);
420
+ }
421
+ }
422
+
423
+ // src/orchestration/qmd-maintenance-completion.ts
424
+ var QmdMaintenanceCompletion = class {
425
+ waiters = [];
426
+ /** Resolves true when a pass that started after this call completed successfully. */
427
+ wait() {
428
+ return new Promise((resolve) => this.waiters.push(resolve));
429
+ }
430
+ /**
431
+ * A pass is starting: take every waiter it will serve and return their settle function.
432
+ * `defer` keeps them waiting for a later pass (a pass that covered only part of the selection).
433
+ */
434
+ claim() {
435
+ const claimed = this.waiters.splice(0);
436
+ return (served, defer = false) => {
437
+ if (defer) this.waiters.unshift(...claimed);
438
+ else claimed.forEach((resolve) => resolve(served));
439
+ };
440
+ }
441
+ /** The scheduler stopped: nothing will serve the waiters. */
442
+ abandon() {
443
+ this.claim()(false);
444
+ }
445
+ };
446
+
376
447
  // src/compounding/weekly-scheduler.ts
377
448
  import { lstat } from "fs/promises";
378
- import path2 from "path";
449
+ import path3 from "path";
379
450
  function compoundingWeeklyDoneMarkerPath(memoryDir, weekId) {
380
451
  if (!isIsoWeekId(weekId)) {
381
452
  throw new Error("compounding weekly cron: week id must be YYYY-Www");
382
453
  }
383
- return path2.join(memoryDir, "compounding", "weekly", ".scheduler", `${weekId}.done`);
454
+ return path3.join(memoryDir, "compounding", "weekly", ".scheduler", `${weekId}.done`);
384
455
  }
385
456
  async function defaultWeekDone(memoryDir, weekId) {
386
457
  try {
@@ -517,18 +588,18 @@ async function refreshActivityIndex(qmd, collection, signal) {
517
588
 
518
589
  // src/activity/store.ts
519
590
  import { mkdirSync } from "fs";
520
- import { mkdir } from "fs/promises";
521
- import path3 from "path";
591
+ import { mkdir as mkdir2 } from "fs/promises";
592
+ import path4 from "path";
522
593
  var ACTIVITY_SCHEMA_VERSION = 1;
523
594
  var MAX_SEARCH_RESULTS = 100;
524
595
  function activityDatabasePath(memoryDir) {
525
- return path3.join(memoryDir, "state", "activity.sqlite");
596
+ return path4.join(memoryDir, "state", "activity.sqlite");
526
597
  }
527
598
  async function ensureActivityStateDir(memoryDir) {
528
- await mkdir(path3.join(memoryDir, "state"), { recursive: true });
599
+ await mkdir2(path4.join(memoryDir, "state"), { recursive: true });
529
600
  }
530
601
  function openActivityDatabase(memoryDir) {
531
- mkdirSync(path3.join(memoryDir, "state"), { recursive: true });
602
+ mkdirSync(path4.join(memoryDir, "state"), { recursive: true });
532
603
  const db = openBetterSqlite3(activityDatabasePath(memoryDir));
533
604
  db.pragma("journal_mode = WAL");
534
605
  db.pragma("busy_timeout = 5000");
@@ -775,9 +846,9 @@ var ActivityStore = class _ActivityStore {
775
846
  };
776
847
 
777
848
  // src/activity/pipeline.ts
778
- import { mkdir as mkdir2, readFile, rename, writeFile } from "fs/promises";
849
+ import { mkdir as mkdir3, readFile as readFile2, rename, writeFile as writeFile2 } from "fs/promises";
779
850
  import { randomUUID } from "crypto";
780
- import path4 from "path";
851
+ import path5 from "path";
781
852
  var MAX_SYNC_PAGES = 1e4;
782
853
  function activityCursorKey(machine, date) {
783
854
  return `${machine}\0${date}`;
@@ -812,13 +883,13 @@ function snapshotForMachine(snapshot, machine) {
812
883
  async function writeDigestIfChanged(memoryDir, date, serialized) {
813
884
  const target = activityDigestPath(memoryDir, date);
814
885
  try {
815
- if (await readFile(target, "utf8") === serialized) return false;
886
+ if (await readFile2(target, "utf8") === serialized) return false;
816
887
  } catch (error) {
817
888
  if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") throw error;
818
889
  }
819
- await mkdir2(path4.dirname(target), { recursive: true, mode: 448 });
890
+ await mkdir3(path5.dirname(target), { recursive: true, mode: 448 });
820
891
  const temporary = `${target}.${process.pid}.${randomUUID()}.tmp`;
821
- await writeFile(temporary, serialized, { encoding: "utf8", mode: 384 });
892
+ await writeFile2(temporary, serialized, { encoding: "utf8", mode: 384 });
822
893
  await rename(temporary, target);
823
894
  return true;
824
895
  }
@@ -963,8 +1034,8 @@ function responsePage(value, machine) {
963
1034
  nextCursor
964
1035
  };
965
1036
  }
966
- function requestUrl(baseUrl, path8, query) {
967
- const url = new URL(path8, baseUrl);
1037
+ function requestUrl(baseUrl, path9, query) {
1038
+ const url = new URL(path9, baseUrl);
968
1039
  const parts = Object.entries(query).filter((entry) => entry[1] !== void 0).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
969
1040
  url.search = parts.join("&");
970
1041
  return url.toString();
@@ -1019,13 +1090,13 @@ var ActivityHttpSourceClient = class {
1019
1090
  // src/activity/timeline/regenerate.ts
1020
1091
  import { randomBytes } from "crypto";
1021
1092
  import { mkdirSync as mkdirSync3, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
1022
- import path6 from "path";
1093
+ import path7 from "path";
1023
1094
 
1024
1095
  // src/activity/timeline/corrections.ts
1025
1096
  import { mkdirSync as mkdirSync2 } from "fs";
1026
- import path5 from "path";
1097
+ import path6 from "path";
1027
1098
  function timelineCorrectionDatabasePath(memoryDir) {
1028
- return path5.join(memoryDir, "state", "activity-timeline.sqlite");
1099
+ return path6.join(memoryDir, "state", "activity-timeline.sqlite");
1029
1100
  }
1030
1101
  function rowToCorrection(row) {
1031
1102
  return {
@@ -1041,7 +1112,7 @@ var TimelineCorrectionStore = class _TimelineCorrectionStore {
1041
1112
  this.db = db;
1042
1113
  }
1043
1114
  static open(memoryDir) {
1044
- mkdirSync2(path5.join(memoryDir, "state"), { recursive: true });
1115
+ mkdirSync2(path6.join(memoryDir, "state"), { recursive: true });
1045
1116
  const db = openBetterSqlite3(timelineCorrectionDatabasePath(memoryDir));
1046
1117
  db.pragma("journal_mode = WAL");
1047
1118
  db.pragma("busy_timeout = 5000");
@@ -1425,7 +1496,7 @@ async function runTimelineCardAnalysis(input) {
1425
1496
 
1426
1497
  // src/activity/timeline/regenerate.ts
1427
1498
  var TIMELINE_DAY_FORMAT_VERSION = 1;
1428
- var TIMELINE_DAY_DIR = path6.join("activity", "timeline");
1499
+ var TIMELINE_DAY_DIR = path7.join("activity", "timeline");
1429
1500
  var inflight = /* @__PURE__ */ new Map();
1430
1501
  function requireToken(value, name) {
1431
1502
  if (typeof value !== "string" || value.trim().length === 0) {
@@ -1438,7 +1509,7 @@ function timelineDayPath(memoryDir, date) {
1438
1509
  if (!isValidActivityDate(date)) {
1439
1510
  throw new RangeError("date must be a real YYYY-MM-DD day");
1440
1511
  }
1441
- return path6.join(path6.resolve(root), TIMELINE_DAY_DIR, `${date}.json`);
1512
+ return path7.join(path7.resolve(root), TIMELINE_DAY_DIR, `${date}.json`);
1442
1513
  }
1443
1514
  function snapshotToObservation(snapshot) {
1444
1515
  if (typeof snapshot.id !== "number") return null;
@@ -1468,7 +1539,7 @@ function localDatesForUtcRange(fromMs, toMs, timezone) {
1468
1539
  function listPersistedTimelineDates(memoryDir) {
1469
1540
  let entries;
1470
1541
  try {
1471
- entries = readdirSync(path6.join(path6.resolve(requireToken(memoryDir, "memoryDir")), TIMELINE_DAY_DIR));
1542
+ entries = readdirSync(path7.join(path7.resolve(requireToken(memoryDir, "memoryDir")), TIMELINE_DAY_DIR));
1472
1543
  } catch {
1473
1544
  return [];
1474
1545
  }
@@ -1562,7 +1633,7 @@ function persistDay(filePath, payload) {
1562
1633
  throw error;
1563
1634
  }
1564
1635
  }
1565
- mkdirSync3(path6.dirname(filePath), { recursive: true, mode: 448 });
1636
+ mkdirSync3(path7.dirname(filePath), { recursive: true, mode: 448 });
1566
1637
  const tmpPath = `${filePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
1567
1638
  writeFileSync(tmpPath, text, { encoding: "utf8", mode: 384 });
1568
1639
  try {
@@ -1657,7 +1728,7 @@ async function regenerateUncached(input) {
1657
1728
  }
1658
1729
  }
1659
1730
  async function regenerateTimelineDay(input) {
1660
- const key = `${path6.resolve(requireToken(input.memoryDir, "memoryDir"))}\0${input.date}`;
1731
+ const key = `${path7.resolve(requireToken(input.memoryDir, "memoryDir"))}\0${input.date}`;
1661
1732
  const pending = inflight.get(key);
1662
1733
  if (pending !== void 0) return pending;
1663
1734
  const run = regenerateUncached(input).finally(() => {
@@ -1965,6 +2036,9 @@ var MaintenanceScheduler = class {
1965
2036
  qmdMaintenanceTimer = null;
1966
2037
  qmdMaintenancePending = false;
1967
2038
  qmdMaintenanceInFlight = false;
2039
+ qmdCompletion = new QmdMaintenanceCompletion();
2040
+ /** Namespaces that ran in passes of the request still waiting for full coverage. */
2041
+ qmdCoveredNamespaces = /* @__PURE__ */ new Set();
1968
2042
  lastQmdEmbedAtMs = 0;
1969
2043
  lastQmdEmbedAtMsByNamespace = /* @__PURE__ */ new Map();
1970
2044
  // ── Lifecycle-ledger auto-compaction state (issue #1910) ──
@@ -2055,7 +2129,7 @@ var MaintenanceScheduler = class {
2055
2129
  }
2056
2130
  async autoRegisterDaySummaryCron() {
2057
2131
  const home = resolveHomeDir();
2058
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2132
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2059
2133
  try {
2060
2134
  if (!existsSync2(jobsPath)) {
2061
2135
  log.debug("day-summary cron: jobs.json not found, skipping auto-register");
@@ -2085,7 +2159,7 @@ var MaintenanceScheduler = class {
2085
2159
  }
2086
2160
  async autoRegisterNightlyGovernanceCron() {
2087
2161
  const home = resolveHomeDir();
2088
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2162
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2089
2163
  try {
2090
2164
  if (!existsSync2(jobsPath)) {
2091
2165
  log.debug("nightly governance cron: jobs.json not found, skipping auto-register");
@@ -2107,7 +2181,7 @@ var MaintenanceScheduler = class {
2107
2181
  }
2108
2182
  async autoRegisterProceduralMiningCron() {
2109
2183
  const home = resolveHomeDir();
2110
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2184
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2111
2185
  try {
2112
2186
  if (!existsSync2(jobsPath)) {
2113
2187
  log.debug("procedural mining cron: jobs.json not found, skipping auto-register");
@@ -2127,7 +2201,7 @@ var MaintenanceScheduler = class {
2127
2201
  }
2128
2202
  async autoRegisterContradictionScanCron() {
2129
2203
  const home = resolveHomeDir();
2130
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2204
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2131
2205
  try {
2132
2206
  if (!existsSync2(jobsPath)) {
2133
2207
  log.debug("contradiction scan cron: jobs.json not found, skipping auto-register");
@@ -2147,7 +2221,7 @@ var MaintenanceScheduler = class {
2147
2221
  }
2148
2222
  async autoRegisterPatternReinforcementCron() {
2149
2223
  const home = resolveHomeDir();
2150
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2224
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2151
2225
  try {
2152
2226
  if (!existsSync2(jobsPath)) {
2153
2227
  log.debug("pattern reinforcement cron: jobs.json not found, skipping auto-register");
@@ -2167,7 +2241,7 @@ var MaintenanceScheduler = class {
2167
2241
  }
2168
2242
  async autoRegisterGraphEdgeDecayCron() {
2169
2243
  const home = resolveHomeDir();
2170
- const jobsPath = path7.join(home, ".openclaw", "cron", "jobs.json");
2244
+ const jobsPath = path8.join(home, ".openclaw", "cron", "jobs.json");
2171
2245
  try {
2172
2246
  if (!existsSync2(jobsPath)) {
2173
2247
  log.debug("graph edge decay cron: jobs.json not found, skipping auto-register");
@@ -2241,18 +2315,29 @@ var MaintenanceScheduler = class {
2241
2315
  // ───────────────────────────────────────────────────────────────────────
2242
2316
  // QMD maintenance scheduling (debounced + singleflight)
2243
2317
  // ───────────────────────────────────────────────────────────────────────
2244
- /** Internal: queue a debounced QMD maintenance pass. */
2318
+ /** Internal: queue a debounced QMD maintenance pass; false when nothing could be armed. */
2245
2319
  requestQmdMaintenance() {
2246
- if (!this.deps.getQmd().isAvailable()) return;
2247
- if (!resolveQmdCapabilities(this.deps.config).qmdMaintenance) return;
2320
+ if (!this.deps.getQmd().isAvailable()) return false;
2321
+ if (!resolveQmdCapabilities(this.deps.config).qmdMaintenance) return false;
2248
2322
  this.qmdMaintenancePending = true;
2249
- if (this.qmdMaintenanceTimer) return;
2323
+ if (this.qmdMaintenanceTimer) return true;
2250
2324
  this.qmdMaintenanceTimer = setTimeout(() => {
2251
2325
  this.qmdMaintenanceTimer = null;
2252
2326
  this.runQmdMaintenance().catch(
2253
2327
  (err) => log.debug(`background qmd maintenance failed: ${err}`)
2254
2328
  );
2255
2329
  }, this.deps.config.qmdMaintenanceDebounceMs);
2330
+ return true;
2331
+ }
2332
+ /**
2333
+ * Like a maintenance request, but resolves true only once a pass that started
2334
+ * after it completed successfully. False when nothing could be armed (QMD
2335
+ * unavailable or maintenance off), the pass failed, or dispose() abandoned it,
2336
+ * so a caller that must not lose the re-index keeps owing it.
2337
+ */
2338
+ requestQmdMaintenanceCompletion() {
2339
+ if (this.disposed || !this.requestQmdMaintenance()) return Promise.resolve(false);
2340
+ return this.qmdCompletion.wait();
2256
2341
  }
2257
2342
  /**
2258
2343
  * Public entrypoint for tool-driven QMD maintenance requests.
@@ -2282,6 +2367,9 @@ var MaintenanceScheduler = class {
2282
2367
  if (!this.qmdMaintenancePending) return;
2283
2368
  this.qmdMaintenanceInFlight = true;
2284
2369
  this.qmdMaintenancePending = false;
2370
+ const settle = this.qmdCompletion.claim();
2371
+ let served = false;
2372
+ let deferred = false;
2285
2373
  try {
2286
2374
  if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
2287
2375
  const plan = await this.namespaceMaintenancePlan("qmd");
@@ -2300,7 +2388,7 @@ var MaintenanceScheduler = class {
2300
2388
  }
2301
2389
  this.lastQmdEmbedAtMs = now;
2302
2390
  };
2303
- await runNamespaceMaintenanceBatchPlan(
2391
+ const summary = await runNamespaceMaintenanceBatchPlan(
2304
2392
  this.deps.config,
2305
2393
  plan,
2306
2394
  async (candidates) => {
@@ -2347,8 +2435,34 @@ var MaintenanceScheduler = class {
2347
2435
  skipReasonForError: qmdMaintenanceSkipReasonForError
2348
2436
  }
2349
2437
  );
2438
+ const covered = this.qmdCoveredNamespaces;
2439
+ const before = covered.size;
2440
+ for (const status of summary.statuses) {
2441
+ if (status.state === "ran") covered.add(status.namespace);
2442
+ }
2443
+ const uncovered = summary.statuses.some(
2444
+ (status) => status.state === "skipped" && (status.reason === "budget_exhausted" || status.reason === "lock_held") && !covered.has(status.namespace)
2445
+ );
2446
+ served = summary.ran > 0 && summary.failed === 0 && !uncovered;
2447
+ deferred = !served && summary.failed === 0 && covered.size > before && !this.disposed;
2350
2448
  } else {
2351
- await this.deps.getQmd().update();
2449
+ const qmd = this.deps.getQmd();
2450
+ if (qmd.updateCompleted) {
2451
+ try {
2452
+ served = await qmd.updateCompleted();
2453
+ } catch (err) {
2454
+ log.debug(`qmd maintenance update did not run: ${err}`);
2455
+ }
2456
+ } else if (qmd.updateStrict) {
2457
+ try {
2458
+ await qmd.updateStrict();
2459
+ served = true;
2460
+ } catch (err) {
2461
+ log.debug(`qmd maintenance update did not run: ${err}`);
2462
+ }
2463
+ } else {
2464
+ await qmd.update();
2465
+ }
2352
2466
  const now = Date.now();
2353
2467
  if (resolveQmdCapabilities(this.deps.config).qmdAutoEmbed && now - this.lastQmdEmbedAtMs >= this.deps.config.qmdEmbedMinIntervalMs) {
2354
2468
  await this.deps.getQmd().embed();
@@ -2356,7 +2470,10 @@ var MaintenanceScheduler = class {
2356
2470
  }
2357
2471
  }
2358
2472
  } finally {
2473
+ settle(served, deferred);
2474
+ if (!deferred) this.qmdCoveredNamespaces.clear();
2359
2475
  this.qmdMaintenanceInFlight = false;
2476
+ if (deferred) this.qmdMaintenancePending = true;
2360
2477
  if (this.qmdMaintenancePending) {
2361
2478
  this.requestQmdMaintenance();
2362
2479
  }
@@ -2439,7 +2556,7 @@ var MaintenanceScheduler = class {
2439
2556
  */
2440
2557
  async hasOverCapEncryptedLifecycleLedger(targets) {
2441
2558
  for (const target of targets) {
2442
- const ledgerPath = path7.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
2559
+ const ledgerPath = path8.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
2443
2560
  let size;
2444
2561
  try {
2445
2562
  size = (await stat(ledgerPath)).size;
@@ -2466,7 +2583,7 @@ var MaintenanceScheduler = class {
2466
2583
  if (target.storage) {
2467
2584
  await this.drainPendingLifecycleAppends(target.storage);
2468
2585
  } else {
2469
- await this.drainPendingLifecycleAppendsForPath(target.memoryDir);
2586
+ await drainPendingLifecycleAppendsForPath(target.memoryDir);
2470
2587
  }
2471
2588
  }
2472
2589
  /** Drain a target's durable pending lifecycle-append spill into its ledger
@@ -2479,60 +2596,6 @@ var MaintenanceScheduler = class {
2479
2596
  log.debug(`lifecycle pending drain failed (non-fatal): ${err}`);
2480
2597
  }
2481
2598
  }
2482
- /**
2483
- * Drain a filesystem-fallback target's pending lifecycle-append spill when no
2484
- * secure StorageManager is available (catalog-disabled namespace; issue
2485
- * #2033). Uses the safe path-scoped PLAINTEXT context this fallback already
2486
- * operates in: a keyless drain can only fold plaintext spills into a plaintext
2487
- * ledger, so it refuses when the ledger or ANY spill is encrypted at rest,
2488
- * leaving those pending for a keyed (catalog-path) drain — exactly mirroring
2489
- * the fallback compaction's encrypted-ledger deferral. Non-fatal; a fast
2490
- * no-op when nothing is pending. The shared spill lister enforces the symlink/
2491
- * containment guard on every spill file it reads or deletes.
2492
- */
2493
- async drainPendingLifecycleAppendsForPath(memoryDir) {
2494
- const ledgerPath = path7.join(memoryDir, "state", "memory-lifecycle-ledger.jsonl");
2495
- const spillDir = pendingLifecycleLedgerDir(ledgerPath);
2496
- let spillFiles;
2497
- let claimedOrphans;
2498
- try {
2499
- spillFiles = await listContainedSpillFiles(spillDir);
2500
- claimedOrphans = await listContainedSpillFiles(spillDir, ".jsonl.claimed");
2501
- } catch (err) {
2502
- log.debug(`fallback lifecycle pending scan failed (non-fatal) for ${memoryDir}: ${err}`);
2503
- return;
2504
- }
2505
- if (spillFiles.length === 0 && claimedOrphans.length === 0) return;
2506
- const io = {
2507
- writeSecure: async (filePath, payload) => {
2508
- await mkdir3(path7.dirname(filePath), { recursive: true });
2509
- await writeFile2(filePath, payload, "utf-8");
2510
- },
2511
- readSecure: async (filePath) => {
2512
- if (await probeEncryptedRegularFileHeader(filePath)) {
2513
- throw new Error(`fallback lifecycle drain deferred: encrypted spill at ${filePath}`);
2514
- }
2515
- return readFile2(filePath, "utf-8");
2516
- }
2517
- };
2518
- try {
2519
- await drainPendingLifecycleLedgerIfAny(
2520
- ledgerPath,
2521
- io,
2522
- async (payload) => {
2523
- if (await probeEncryptedRegularFileHeader(ledgerPath)) {
2524
- throw new Error(`fallback lifecycle drain deferred: ledger became encrypted at ${ledgerPath}`);
2525
- }
2526
- await appendFile(ledgerPath, payload, "utf-8");
2527
- },
2528
- async () => {
2529
- await mkdir3(path7.dirname(ledgerPath), { recursive: true });
2530
- }
2531
- );
2532
- } catch (err) {
2533
- log.debug(`fallback lifecycle pending drain failed (non-fatal) for ${memoryDir}: ${err}`);
2534
- }
2535
- }
2536
2599
  /**
2537
2600
  * Enumerate the lifecycle ledgers to consider for compaction: the root
2538
2601
  * (through the secure-configured root storage when available) plus every
@@ -2544,7 +2607,7 @@ var MaintenanceScheduler = class {
2544
2607
  const targets = [];
2545
2608
  const seen = /* @__PURE__ */ new Set();
2546
2609
  const addTarget = (memoryDir, storage) => {
2547
- const key = path7.resolve(memoryDir);
2610
+ const key = path8.resolve(memoryDir);
2548
2611
  if (seen.has(key)) return;
2549
2612
  seen.add(key);
2550
2613
  targets.push({ memoryDir, storage });
@@ -2573,7 +2636,7 @@ var MaintenanceScheduler = class {
2573
2636
  }
2574
2637
  }
2575
2638
  if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
2576
- const namespacesBase = path7.join(this.deps.config.memoryDir, "namespaces");
2639
+ const namespacesBase = path8.join(this.deps.config.memoryDir, "namespaces");
2577
2640
  let memoryDirReal;
2578
2641
  try {
2579
2642
  memoryDirReal = await realpath(this.deps.config.memoryDir);
@@ -2598,7 +2661,7 @@ var MaintenanceScheduler = class {
2598
2661
  }
2599
2662
  for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
2600
2663
  if (!entry.isDirectory() || entry.isSymbolicLink()) continue;
2601
- const childPath = path7.join(namespacesBase, entry.name);
2664
+ const childPath = path8.join(namespacesBase, entry.name);
2602
2665
  try {
2603
2666
  assertPathInsideRoot(memoryDirReal, await realpath(childPath), childPath);
2604
2667
  } catch (err) {
@@ -2610,7 +2673,7 @@ var MaintenanceScheduler = class {
2610
2673
  if (resolveNamespaceStorage && routeNamespace !== null) {
2611
2674
  try {
2612
2675
  const storage = await resolveNamespaceStorage(routeNamespace);
2613
- if (path7.resolve(storage.dir) === path7.resolve(childPath)) {
2676
+ if (path8.resolve(storage.dir) === path8.resolve(childPath)) {
2614
2677
  addTarget(storage.dir, storage);
2615
2678
  continue;
2616
2679
  }
@@ -2641,7 +2704,7 @@ var MaintenanceScheduler = class {
2641
2704
  * an over-cap rewrite never arms the throttle.
2642
2705
  */
2643
2706
  async compactLifecycleLedgerTarget(target, threshold) {
2644
- const ledgerPath = path7.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
2707
+ const ledgerPath = path8.join(target.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
2645
2708
  let size = 0;
2646
2709
  try {
2647
2710
  size = (await stat(ledgerPath)).size;
@@ -2745,6 +2808,7 @@ var MaintenanceScheduler = class {
2745
2808
  this.qmdMaintenanceTimer = null;
2746
2809
  }
2747
2810
  this.qmdMaintenancePending = false;
2811
+ this.qmdCompletion.abandon();
2748
2812
  await activityDrain;
2749
2813
  await locationDrain;
2750
2814
  await weeklyDrain;
@@ -2793,4 +2857,4 @@ export {
2793
2857
  ActivitySyncScheduler,
2794
2858
  MaintenanceScheduler
2795
2859
  };
2796
- //# sourceMappingURL=chunk-EC2KVA27.js.map
2860
+ //# sourceMappingURL=chunk-H4DWSOBQ.js.map