@remnic/core 10.0.69 → 10.0.71

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 (412) hide show
  1. package/dist/access-admin-ops-surface.js +82 -79
  2. package/dist/access-authorization-probe.js +83 -80
  3. package/dist/access-boundary.js +82 -79
  4. package/dist/access-cli.js +196 -193
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-extraction-force-flush.js +82 -79
  7. package/dist/access-http-briefing.js +83 -80
  8. package/dist/access-http-query.js +84 -81
  9. package/dist/access-http.js +106 -103
  10. package/dist/access-identity-continuity-surface.js +82 -79
  11. package/dist/access-lcm-surface.js +82 -79
  12. package/dist/access-mcp.js +95 -92
  13. package/dist/access-namespace-preflight.js +82 -79
  14. package/dist/access-observe-lcm-archive.d.ts +5 -0
  15. package/dist/access-observe-lcm-archive.d.ts.map +1 -0
  16. package/dist/access-observe-lcm-archive.js +9 -0
  17. package/dist/access-observe-objective-state.d.ts +8 -0
  18. package/dist/access-observe-objective-state.d.ts.map +1 -0
  19. package/dist/access-observe-objective-state.js +17 -0
  20. package/dist/access-observe-stage-timing.d.ts +11 -0
  21. package/dist/access-observe-stage-timing.d.ts.map +1 -0
  22. package/dist/access-observe-stage-timing.js +9 -0
  23. package/dist/access-observe-stage-timing.js.map +1 -0
  24. package/dist/access-observe-write-category.js +13 -13
  25. package/dist/access-observe-write-surface.d.ts.map +1 -1
  26. package/dist/access-observe-write-surface.js +82 -79
  27. package/dist/access-offline-manifest.js +8 -8
  28. package/dist/access-operations-batch.js +85 -82
  29. package/dist/access-operations.js +92 -89
  30. package/dist/access-recall-concurrency.js +82 -79
  31. package/dist/access-recall-response.js +82 -79
  32. package/dist/access-recall-surface.js +82 -79
  33. package/dist/access-schema.js +12 -12
  34. package/dist/access-service.d.ts +1 -0
  35. package/dist/access-service.d.ts.map +1 -1
  36. package/dist/access-service.js +82 -79
  37. package/dist/access-surface-catalog.js +84 -81
  38. package/dist/access-surface-catalog.js.map +1 -1
  39. package/dist/active-recall.js +26 -26
  40. package/dist/adapters/index.js +4 -4
  41. package/dist/adapters/registry.js +2 -2
  42. package/dist/briefing.js +17 -17
  43. package/dist/buffer-turn-helpers.d.ts +10 -1
  44. package/dist/buffer-turn-helpers.d.ts.map +1 -1
  45. package/dist/buffer-turn-helpers.js +3 -1
  46. package/dist/buffer.d.ts +4 -0
  47. package/dist/buffer.d.ts.map +1 -1
  48. package/dist/buffer.js +9 -9
  49. package/dist/calibration.js +4 -4
  50. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  51. package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
  52. package/dist/causal-behavior.js +2 -2
  53. package/dist/causal-chain.js +2 -2
  54. package/dist/causal-consolidation.js +22 -22
  55. package/dist/causal-retrieval.js +2 -2
  56. package/dist/causal-trajectory-graph.js +3 -3
  57. package/dist/causal-trajectory.js +1 -1
  58. package/dist/{chunk-6WKWL53V.js → chunk-23BA3USG.js} +128 -122
  59. package/dist/chunk-23BA3USG.js.map +1 -0
  60. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  61. package/dist/{chunk-CI3MAAIY.js → chunk-2R44BBPK.js} +2 -2
  62. package/dist/{chunk-QDZWQBLU.js → chunk-2R7OCBRR.js} +2 -2
  63. package/dist/{chunk-B3MWELZ3.js → chunk-2WPWEVAH.js} +2 -2
  64. package/dist/{chunk-PLCYKAWH.js → chunk-3ICAWZUU.js} +4 -4
  65. package/dist/{chunk-R4ZHF4K2.js → chunk-43FLJLT2.js} +4 -4
  66. package/dist/{chunk-PMDOGXA2.js → chunk-4PMFSYH7.js} +2 -2
  67. package/dist/{chunk-HXFIILGF.js → chunk-4RASUAN3.js} +4 -4
  68. package/dist/{chunk-EI6M5NVK.js → chunk-5JBVPJCT.js} +2 -2
  69. package/dist/{chunk-4NV7O76Q.js → chunk-5ORJHH43.js} +2 -2
  70. package/dist/{chunk-74AY3S7U.js → chunk-5RW247F5.js} +10 -10
  71. package/dist/{chunk-4XINO77L.js → chunk-66JOLMWS.js} +2 -2
  72. package/dist/{chunk-AYJQ644F.js → chunk-6KBCUIZP.js} +2 -2
  73. package/dist/{chunk-GKL6QYZO.js → chunk-6L63IN3M.js} +1 -1
  74. package/dist/{chunk-OPFVXM2D.js → chunk-7P5VBRBS.js} +2 -2
  75. package/dist/{chunk-4SOWMA55.js → chunk-7WFY2L5J.js} +3 -3
  76. package/dist/{chunk-GJ4HU6LK.js → chunk-AGRMXXVA.js} +2 -2
  77. package/dist/{chunk-KOLJJN5G.js → chunk-AQNHEDXP.js} +11 -4
  78. package/dist/chunk-AQNHEDXP.js.map +1 -0
  79. package/dist/{chunk-IVUVQPTQ.js → chunk-AZNE2H6D.js} +2 -2
  80. package/dist/{chunk-HPB5TF55.js → chunk-BCBY5GYZ.js} +3 -3
  81. package/dist/{chunk-M4IEZGCK.js → chunk-BFBS7OFQ.js} +7 -7
  82. package/dist/{chunk-4PG5R6BJ.js → chunk-BNU5TQLR.js} +2 -2
  83. package/dist/{chunk-TVE7W67N.js → chunk-BTU77RB5.js} +2 -2
  84. package/dist/{chunk-H6VJSITJ.js → chunk-CIL4GHMD.js} +3 -3
  85. package/dist/{chunk-KZZ5EZ7O.js → chunk-DC3DWF2M.js} +2 -2
  86. package/dist/{chunk-R2BIVU2Z.js → chunk-DE4U5PTV.js} +50 -46
  87. package/dist/chunk-DE4U5PTV.js.map +1 -0
  88. package/dist/{chunk-DDBB55L2.js → chunk-DSSTOV5M.js} +534 -361
  89. package/dist/chunk-DSSTOV5M.js.map +1 -0
  90. package/dist/{chunk-4MPAKYZU.js → chunk-EGKDONTC.js} +12 -6
  91. package/dist/chunk-EGKDONTC.js.map +1 -0
  92. package/dist/{chunk-AUFPPBC3.js → chunk-ENPJX3BB.js} +3 -3
  93. package/dist/{chunk-CTH2CQCB.js → chunk-EQ6EMJRG.js} +2 -2
  94. package/dist/{chunk-63A2BU2B.js → chunk-F4ZHKDBW.js} +5 -5
  95. package/dist/{chunk-3LBDEGQA.js → chunk-FDUCIUQ5.js} +2 -2
  96. package/dist/{chunk-OCK4D5PC.js → chunk-FGGLVCHI.js} +2 -2
  97. package/dist/{chunk-XVZA6VXC.js → chunk-FZVROZKC.js} +4 -4
  98. package/dist/{chunk-3RHU5MD7.js → chunk-GXAZ4Q2S.js} +2 -2
  99. package/dist/{chunk-UVVFPCPX.js → chunk-H2X32F2K.js} +2 -2
  100. package/dist/{chunk-645WOU5I.js → chunk-H7BZBSP6.js} +4 -4
  101. package/dist/{chunk-W7K5BP3M.js → chunk-HQPFACXO.js} +2 -2
  102. package/dist/{chunk-TECK5IVY.js → chunk-HZNURRDS.js} +2 -2
  103. package/dist/{chunk-U2CAGMUD.js → chunk-ICBUTKLL.js} +2 -2
  104. package/dist/{chunk-B4DXREWC.js → chunk-IQXQ3KWR.js} +2 -2
  105. package/dist/{chunk-AL3TCNSJ.js → chunk-J6GZ2254.js} +4 -4
  106. package/dist/{chunk-5MGKGEL7.js → chunk-J72ZY7NU.js} +2 -2
  107. package/dist/{chunk-OH55F76C.js → chunk-JEX2JL3U.js} +2 -2
  108. package/dist/{chunk-Y3XPSGNF.js → chunk-JGLZ46JS.js} +2 -2
  109. package/dist/{chunk-EXQJMFRF.js → chunk-JY4LXMZR.js} +2 -2
  110. package/dist/{chunk-6P7U3HWG.js → chunk-K36RMINQ.js} +3 -3
  111. package/dist/{chunk-BUKK5SWA.js → chunk-KQAFEZQX.js} +2 -2
  112. package/dist/{chunk-LN4X2NDA.js → chunk-KY3KJUNN.js} +10 -10
  113. package/dist/chunk-L3E7MLMK.js +20 -0
  114. package/dist/chunk-L3E7MLMK.js.map +1 -0
  115. package/dist/{chunk-H5DIRCZP.js → chunk-LHMCZ6VW.js} +18 -18
  116. package/dist/{chunk-GGD2YDS6.js → chunk-LN7CWLAU.js} +2 -2
  117. package/dist/{chunk-GHHQLSSY.js → chunk-LYOCAUI6.js} +3 -3
  118. package/dist/{chunk-VA3GNAWQ.js → chunk-LZIOY7ZU.js} +4 -5
  119. package/dist/chunk-LZIOY7ZU.js.map +1 -0
  120. package/dist/{chunk-W26D2USW.js → chunk-MUH7RR6T.js} +6 -6
  121. package/dist/{chunk-IAGVM7EY.js → chunk-N2Y6COEM.js} +2 -2
  122. package/dist/{chunk-64JLBFCQ.js → chunk-N7NAGECH.js} +2 -2
  123. package/dist/{chunk-5Y6VA6X2.js → chunk-OGQGDOYK.js} +2 -2
  124. package/dist/{chunk-U7MIMS2Y.js → chunk-OUBEJWVI.js} +17 -1
  125. package/dist/chunk-OUBEJWVI.js.map +1 -0
  126. package/dist/{chunk-JLMOH5JA.js → chunk-OWZXDBV4.js} +2 -2
  127. package/dist/{chunk-ZORS5BG5.js → chunk-PJAMFIDE.js} +10 -10
  128. package/dist/chunk-QCFZDYYG.js +34 -0
  129. package/dist/chunk-QCFZDYYG.js.map +1 -0
  130. package/dist/{chunk-SXTVZ6JL.js → chunk-QIOQI7QZ.js} +2 -2
  131. package/dist/{chunk-MMCO4SRG.js → chunk-QNN4FYBD.js} +19 -11
  132. package/dist/chunk-QNN4FYBD.js.map +1 -0
  133. package/dist/{chunk-75DCOS6I.js → chunk-QUPTDKSX.js} +67 -67
  134. package/dist/{chunk-HH73M65H.js → chunk-QVZZE6VH.js} +3 -3
  135. package/dist/{chunk-XWE3EOWX.js → chunk-RZED7FAU.js} +2 -2
  136. package/dist/{chunk-IZBIDPMY.js → chunk-S37O4S6E.js} +2 -2
  137. package/dist/{chunk-NHWDTOBN.js → chunk-S73ZVU37.js} +21 -21
  138. package/dist/{chunk-YSATDEBY.js → chunk-SBRUTD5O.js} +5 -5
  139. package/dist/{chunk-WVP2I6C5.js → chunk-SDL22RRW.js} +50 -11
  140. package/dist/chunk-SDL22RRW.js.map +1 -0
  141. package/dist/{chunk-PRKNAIGZ.js → chunk-T6T2RMWW.js} +5 -5
  142. package/dist/{chunk-CIEEYVUB.js → chunk-TPX7XXY4.js} +2 -2
  143. package/dist/{chunk-L334PSLW.js → chunk-U2A56LLF.js} +8 -8
  144. package/dist/{chunk-P4TV3TQ2.js → chunk-U6IL4724.js} +5 -5
  145. package/dist/{chunk-5UM4H64E.js → chunk-UAOJVQXC.js} +2 -2
  146. package/dist/{chunk-MOIJWWNA.js → chunk-UE5JYPU6.js} +13 -13
  147. package/dist/{chunk-TGQW3AMK.js → chunk-UIFWZMO7.js} +23 -23
  148. package/dist/{chunk-UW6LBFYN.js → chunk-USX5YIKB.js} +6 -6
  149. package/dist/{chunk-QGFR73SN.js → chunk-VK5HKVQ7.js} +2 -2
  150. package/dist/{chunk-ZOBYTRBU.js → chunk-VNTQU6KB.js} +47 -2
  151. package/dist/chunk-VNTQU6KB.js.map +1 -0
  152. package/dist/{chunk-IHCXMYSE.js → chunk-VPEIWMUT.js} +2 -2
  153. package/dist/{chunk-O5ZINWW3.js → chunk-VSJ3ARFS.js} +2 -2
  154. package/dist/{chunk-RLVI2M5Q.js → chunk-W4V7P5HP.js} +2 -2
  155. package/dist/{chunk-ELHJK7LM.js → chunk-WBN66HPI.js} +6 -6
  156. package/dist/{chunk-BJLCV2P3.js → chunk-WGRAB3KB.js} +2 -2
  157. package/dist/{chunk-5KDDAQ6K.js → chunk-WN2DASTS.js} +10 -10
  158. package/dist/{chunk-IG3EZ3TF.js → chunk-WNQ3B3Q5.js} +2 -2
  159. package/dist/{chunk-V6SBA5O7.js → chunk-WYOHQJKC.js} +7 -7
  160. package/dist/chunk-WZU5AGO6.js +38 -0
  161. package/dist/chunk-WZU5AGO6.js.map +1 -0
  162. package/dist/{chunk-WHROVQ5Q.js → chunk-X4DHAXFO.js} +3 -3
  163. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  164. package/dist/{chunk-JLGBJ4AX.js → chunk-XPZM7GP6.js} +10 -10
  165. package/dist/{chunk-64S6X4IU.js → chunk-XTN54NML.js} +4 -4
  166. package/dist/{chunk-UYUFDTIX.js → chunk-YIXWY4OZ.js} +2 -2
  167. package/dist/{chunk-NCZGGGWI.js → chunk-YPYSC3TX.js} +12 -12
  168. package/dist/{chunk-AVGDYYMA.js → chunk-ZBET3W26.js} +3 -3
  169. package/dist/{chunk-Y7427SL7.js → chunk-ZG4GNPRE.js} +216 -50
  170. package/dist/chunk-ZG4GNPRE.js.map +1 -0
  171. package/dist/chunk-ZODKV27J.js +443 -0
  172. package/dist/chunk-ZODKV27J.js.map +1 -0
  173. package/dist/cli.js +133 -130
  174. package/dist/coding/export-okf-codegraph.js +16 -16
  175. package/dist/coding/pre-action-gate.js +2 -2
  176. package/dist/compounding/engine.js +18 -18
  177. package/dist/config.js +26 -26
  178. package/dist/connectors/codex-materialize-runner.js +19 -19
  179. package/dist/connectors/codex-materialize.js +2 -2
  180. package/dist/connectors/index.js +20 -20
  181. package/dist/consolidation-provenance-check.js +2 -2
  182. package/dist/convergence-refresh.js +20 -20
  183. package/dist/corpus-watermark.js +20 -20
  184. package/dist/deep-recall-http-glue.js +13 -13
  185. package/dist/deep-recall.js +2 -2
  186. package/dist/embedding-fallback.js +2 -2
  187. package/dist/entity-retrieval.js +20 -20
  188. package/dist/event-order-recall.js +2 -2
  189. package/dist/external-wiki-access.js +83 -80
  190. package/dist/extraction-span-materialize.js +2 -2
  191. package/dist/extraction-window-drain.d.ts.map +1 -1
  192. package/dist/extraction-window-drain.js +1 -1
  193. package/dist/extraction.js +32 -32
  194. package/dist/{graph-edge-decay-OEX5OGMI.js → graph-edge-decay-CXTNJ7IQ.js} +6 -6
  195. package/dist/graph-edge-decay-CXTNJ7IQ.js.map +1 -0
  196. package/dist/graph-jsonl.js +4 -4
  197. package/dist/graph-snapshot.js +4 -4
  198. package/dist/graph.js +3 -3
  199. package/dist/harmonic-retrieval.js +17 -17
  200. package/dist/index.js +281 -278
  201. package/dist/lcm/archive.d.ts +12 -2
  202. package/dist/lcm/archive.d.ts.map +1 -1
  203. package/dist/lcm/archive.js +2 -2
  204. package/dist/lcm/engine.d.ts +59 -8
  205. package/dist/lcm/engine.d.ts.map +1 -1
  206. package/dist/lcm/engine.js +6 -6
  207. package/dist/lcm/index.js +16 -16
  208. package/dist/lcm/queue.d.ts +7 -3
  209. package/dist/lcm/queue.d.ts.map +1 -1
  210. package/dist/lcm/queue.js +1 -1
  211. package/dist/lcm/summarizer.d.ts +8 -1
  212. package/dist/lcm/summarizer.d.ts.map +1 -1
  213. package/dist/lcm/summarizer.js +3 -3
  214. package/dist/local-llm.js +4 -4
  215. package/dist/location/index.js +19 -19
  216. package/dist/maintenance/memory-governance.js +18 -18
  217. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +17 -17
  218. package/dist/maintenance/rebuild-memory-projection-runner.js +20 -20
  219. package/dist/maintenance/rebuild-memory-projection.js +19 -19
  220. package/dist/memory-browse-operations.js +83 -80
  221. package/dist/memory-browse.js +6 -6
  222. package/dist/namespaces/migrate.js +18 -18
  223. package/dist/namespaces/search.js +7 -7
  224. package/dist/namespaces/storage.js +17 -17
  225. package/dist/offline-sync-changeset-generations.js +5 -5
  226. package/dist/offline-sync-embedding-generation.js +4 -4
  227. package/dist/offline-sync-snapshot-stream.js +7 -7
  228. package/dist/offline-sync.js +9 -9
  229. package/dist/operator-doctor-corpus.js +21 -21
  230. package/dist/operator-toolkit.js +41 -41
  231. package/dist/orchestration/backlog-scheduler.d.ts +151 -0
  232. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -0
  233. package/dist/orchestration/backlog-scheduler.js +891 -0
  234. package/dist/orchestration/backlog-scheduler.js.map +1 -0
  235. package/dist/orchestration/buffer-drain-runner.d.ts +31 -27
  236. package/dist/orchestration/buffer-drain-runner.d.ts.map +1 -1
  237. package/dist/orchestration/buffer-drain-runner.js +202 -404
  238. package/dist/orchestration/buffer-drain-runner.js.map +1 -1
  239. package/dist/orchestration/extraction-drain.d.ts +50 -17
  240. package/dist/orchestration/extraction-drain.d.ts.map +1 -1
  241. package/dist/orchestration/extraction-queue-coordinator.d.ts +19 -1
  242. package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
  243. package/dist/orchestration/extraction-run.d.ts +8 -0
  244. package/dist/orchestration/extraction-run.d.ts.map +1 -1
  245. package/dist/orchestration/extraction-task-queueing.d.ts +44 -0
  246. package/dist/orchestration/extraction-task-queueing.d.ts.map +1 -0
  247. package/dist/orchestration/maintenance.js +33 -33
  248. package/dist/orchestration/turn-ingestion.d.ts +11 -5
  249. package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
  250. package/dist/orchestrator.d.ts +13 -0
  251. package/dist/orchestrator.d.ts.map +1 -1
  252. package/dist/orchestrator.js +196 -193
  253. package/dist/qmd.js +4 -4
  254. package/dist/recall-navigation-operations.js +83 -80
  255. package/dist/recall-navigation.js +82 -79
  256. package/dist/recall-state-view-admission.js +6 -6
  257. package/dist/recall-why-service.js +6 -6
  258. package/dist/resume-bundles.js +29 -29
  259. package/dist/search/factory.js +6 -6
  260. package/dist/search/index.js +12 -12
  261. package/dist/semantic-consolidation.js +25 -25
  262. package/dist/semantic-rule-promotion.js +17 -17
  263. package/dist/semantic-rule-verifier.js +17 -17
  264. package/dist/source-agent-qualifier.js +24 -24
  265. package/dist/standup/build.js +17 -17
  266. package/dist/storage/buffer-drain-claims.d.ts +15 -0
  267. package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
  268. package/dist/storage/buffer-drain-claims.js +2 -2
  269. package/dist/storage/buffer-session-files.js +2 -2
  270. package/dist/storage.js +16 -16
  271. package/dist/summarizer.js +6 -6
  272. package/dist/support-passport/index.js +85 -82
  273. package/dist/transfer/backup.js +2 -2
  274. package/dist/transfer/capsule-export.js +2 -2
  275. package/dist/transfer/capsule-import.js +2 -2
  276. package/dist/transfer/export-okf.js +17 -17
  277. package/dist/verified-recall.js +17 -17
  278. package/dist/who-knows-cli.js +18 -18
  279. package/dist/who-knows.js +17 -17
  280. package/package.json +12 -2
  281. package/src/access-observe-lcm-archive.ts +30 -0
  282. package/src/access-observe-lcm-fail-closed.test.ts +118 -0
  283. package/src/access-observe-objective-state.ts +40 -0
  284. package/src/access-observe-stage-timing.test.ts +246 -0
  285. package/src/access-observe-stage-timing.ts +58 -0
  286. package/src/access-observe-write-surface.ts +45 -45
  287. package/src/access-service.ts +1 -0
  288. package/src/backlog-scheduler.test.ts +806 -0
  289. package/src/buffer-drain-handover.test.ts +363 -18
  290. package/src/buffer-drain-inprocess.test.ts +355 -0
  291. package/src/buffer-drain-model-boundary.test.ts +1062 -0
  292. package/src/buffer-drop-extraction-chunk.test.ts +237 -22
  293. package/src/buffer-turn-helpers.ts +26 -1
  294. package/src/buffer.ts +8 -0
  295. package/src/extraction-window-drain.ts +7 -7
  296. package/src/lcm/archive.ts +59 -7
  297. package/src/lcm/engine.ts +256 -53
  298. package/src/lcm/queue.test.ts +32 -14
  299. package/src/lcm/queue.ts +24 -16
  300. package/src/lcm/summarizer.ts +15 -2
  301. package/src/lcm-durability.test.ts +856 -0
  302. package/src/lcm-engine.test.ts +12 -3
  303. package/src/orchestration/backlog-scheduler.ts +481 -0
  304. package/src/orchestration/buffer-drain-runner.ts +545 -180
  305. package/src/orchestration/extraction-drain.ts +287 -108
  306. package/src/orchestration/extraction-queue-coordinator.ts +51 -3
  307. package/src/orchestration/extraction-run.test.ts +41 -0
  308. package/src/orchestration/extraction-run.ts +24 -5
  309. package/src/orchestration/extraction-task-queueing.ts +87 -0
  310. package/src/orchestration/turn-ingestion.ts +46 -59
  311. package/src/orchestrator-extraction-queue.test.ts +46 -2
  312. package/src/orchestrator-flush.test.ts +4 -1
  313. package/src/orchestrator.ts +47 -21
  314. package/src/storage/buffer-drain-claims.ts +55 -0
  315. package/dist/chunk-4MPAKYZU.js.map +0 -1
  316. package/dist/chunk-6WKWL53V.js.map +0 -1
  317. package/dist/chunk-DDBB55L2.js.map +0 -1
  318. package/dist/chunk-KOLJJN5G.js.map +0 -1
  319. package/dist/chunk-MMCO4SRG.js.map +0 -1
  320. package/dist/chunk-R2BIVU2Z.js.map +0 -1
  321. package/dist/chunk-U7MIMS2Y.js.map +0 -1
  322. package/dist/chunk-VA3GNAWQ.js.map +0 -1
  323. package/dist/chunk-WVP2I6C5.js.map +0 -1
  324. package/dist/chunk-Y7427SL7.js.map +0 -1
  325. package/dist/chunk-ZOBYTRBU.js.map +0 -1
  326. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-observe-lcm-archive.js.map} +0 -0
  327. /package/dist/{graph-edge-decay-OEX5OGMI.js.map → access-observe-objective-state.js.map} +0 -0
  328. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  329. /package/dist/{chunk-CI3MAAIY.js.map → chunk-2R44BBPK.js.map} +0 -0
  330. /package/dist/{chunk-QDZWQBLU.js.map → chunk-2R7OCBRR.js.map} +0 -0
  331. /package/dist/{chunk-B3MWELZ3.js.map → chunk-2WPWEVAH.js.map} +0 -0
  332. /package/dist/{chunk-PLCYKAWH.js.map → chunk-3ICAWZUU.js.map} +0 -0
  333. /package/dist/{chunk-R4ZHF4K2.js.map → chunk-43FLJLT2.js.map} +0 -0
  334. /package/dist/{chunk-PMDOGXA2.js.map → chunk-4PMFSYH7.js.map} +0 -0
  335. /package/dist/{chunk-HXFIILGF.js.map → chunk-4RASUAN3.js.map} +0 -0
  336. /package/dist/{chunk-EI6M5NVK.js.map → chunk-5JBVPJCT.js.map} +0 -0
  337. /package/dist/{chunk-4NV7O76Q.js.map → chunk-5ORJHH43.js.map} +0 -0
  338. /package/dist/{chunk-74AY3S7U.js.map → chunk-5RW247F5.js.map} +0 -0
  339. /package/dist/{chunk-4XINO77L.js.map → chunk-66JOLMWS.js.map} +0 -0
  340. /package/dist/{chunk-AYJQ644F.js.map → chunk-6KBCUIZP.js.map} +0 -0
  341. /package/dist/{chunk-GKL6QYZO.js.map → chunk-6L63IN3M.js.map} +0 -0
  342. /package/dist/{chunk-OPFVXM2D.js.map → chunk-7P5VBRBS.js.map} +0 -0
  343. /package/dist/{chunk-4SOWMA55.js.map → chunk-7WFY2L5J.js.map} +0 -0
  344. /package/dist/{chunk-GJ4HU6LK.js.map → chunk-AGRMXXVA.js.map} +0 -0
  345. /package/dist/{chunk-IVUVQPTQ.js.map → chunk-AZNE2H6D.js.map} +0 -0
  346. /package/dist/{chunk-HPB5TF55.js.map → chunk-BCBY5GYZ.js.map} +0 -0
  347. /package/dist/{chunk-M4IEZGCK.js.map → chunk-BFBS7OFQ.js.map} +0 -0
  348. /package/dist/{chunk-4PG5R6BJ.js.map → chunk-BNU5TQLR.js.map} +0 -0
  349. /package/dist/{chunk-TVE7W67N.js.map → chunk-BTU77RB5.js.map} +0 -0
  350. /package/dist/{chunk-H6VJSITJ.js.map → chunk-CIL4GHMD.js.map} +0 -0
  351. /package/dist/{chunk-KZZ5EZ7O.js.map → chunk-DC3DWF2M.js.map} +0 -0
  352. /package/dist/{chunk-AUFPPBC3.js.map → chunk-ENPJX3BB.js.map} +0 -0
  353. /package/dist/{chunk-CTH2CQCB.js.map → chunk-EQ6EMJRG.js.map} +0 -0
  354. /package/dist/{chunk-63A2BU2B.js.map → chunk-F4ZHKDBW.js.map} +0 -0
  355. /package/dist/{chunk-3LBDEGQA.js.map → chunk-FDUCIUQ5.js.map} +0 -0
  356. /package/dist/{chunk-OCK4D5PC.js.map → chunk-FGGLVCHI.js.map} +0 -0
  357. /package/dist/{chunk-XVZA6VXC.js.map → chunk-FZVROZKC.js.map} +0 -0
  358. /package/dist/{chunk-3RHU5MD7.js.map → chunk-GXAZ4Q2S.js.map} +0 -0
  359. /package/dist/{chunk-UVVFPCPX.js.map → chunk-H2X32F2K.js.map} +0 -0
  360. /package/dist/{chunk-645WOU5I.js.map → chunk-H7BZBSP6.js.map} +0 -0
  361. /package/dist/{chunk-W7K5BP3M.js.map → chunk-HQPFACXO.js.map} +0 -0
  362. /package/dist/{chunk-TECK5IVY.js.map → chunk-HZNURRDS.js.map} +0 -0
  363. /package/dist/{chunk-U2CAGMUD.js.map → chunk-ICBUTKLL.js.map} +0 -0
  364. /package/dist/{chunk-B4DXREWC.js.map → chunk-IQXQ3KWR.js.map} +0 -0
  365. /package/dist/{chunk-AL3TCNSJ.js.map → chunk-J6GZ2254.js.map} +0 -0
  366. /package/dist/{chunk-5MGKGEL7.js.map → chunk-J72ZY7NU.js.map} +0 -0
  367. /package/dist/{chunk-OH55F76C.js.map → chunk-JEX2JL3U.js.map} +0 -0
  368. /package/dist/{chunk-Y3XPSGNF.js.map → chunk-JGLZ46JS.js.map} +0 -0
  369. /package/dist/{chunk-EXQJMFRF.js.map → chunk-JY4LXMZR.js.map} +0 -0
  370. /package/dist/{chunk-6P7U3HWG.js.map → chunk-K36RMINQ.js.map} +0 -0
  371. /package/dist/{chunk-BUKK5SWA.js.map → chunk-KQAFEZQX.js.map} +0 -0
  372. /package/dist/{chunk-LN4X2NDA.js.map → chunk-KY3KJUNN.js.map} +0 -0
  373. /package/dist/{chunk-H5DIRCZP.js.map → chunk-LHMCZ6VW.js.map} +0 -0
  374. /package/dist/{chunk-GGD2YDS6.js.map → chunk-LN7CWLAU.js.map} +0 -0
  375. /package/dist/{chunk-GHHQLSSY.js.map → chunk-LYOCAUI6.js.map} +0 -0
  376. /package/dist/{chunk-W26D2USW.js.map → chunk-MUH7RR6T.js.map} +0 -0
  377. /package/dist/{chunk-IAGVM7EY.js.map → chunk-N2Y6COEM.js.map} +0 -0
  378. /package/dist/{chunk-64JLBFCQ.js.map → chunk-N7NAGECH.js.map} +0 -0
  379. /package/dist/{chunk-5Y6VA6X2.js.map → chunk-OGQGDOYK.js.map} +0 -0
  380. /package/dist/{chunk-JLMOH5JA.js.map → chunk-OWZXDBV4.js.map} +0 -0
  381. /package/dist/{chunk-ZORS5BG5.js.map → chunk-PJAMFIDE.js.map} +0 -0
  382. /package/dist/{chunk-SXTVZ6JL.js.map → chunk-QIOQI7QZ.js.map} +0 -0
  383. /package/dist/{chunk-75DCOS6I.js.map → chunk-QUPTDKSX.js.map} +0 -0
  384. /package/dist/{chunk-HH73M65H.js.map → chunk-QVZZE6VH.js.map} +0 -0
  385. /package/dist/{chunk-XWE3EOWX.js.map → chunk-RZED7FAU.js.map} +0 -0
  386. /package/dist/{chunk-IZBIDPMY.js.map → chunk-S37O4S6E.js.map} +0 -0
  387. /package/dist/{chunk-NHWDTOBN.js.map → chunk-S73ZVU37.js.map} +0 -0
  388. /package/dist/{chunk-YSATDEBY.js.map → chunk-SBRUTD5O.js.map} +0 -0
  389. /package/dist/{chunk-PRKNAIGZ.js.map → chunk-T6T2RMWW.js.map} +0 -0
  390. /package/dist/{chunk-CIEEYVUB.js.map → chunk-TPX7XXY4.js.map} +0 -0
  391. /package/dist/{chunk-L334PSLW.js.map → chunk-U2A56LLF.js.map} +0 -0
  392. /package/dist/{chunk-P4TV3TQ2.js.map → chunk-U6IL4724.js.map} +0 -0
  393. /package/dist/{chunk-5UM4H64E.js.map → chunk-UAOJVQXC.js.map} +0 -0
  394. /package/dist/{chunk-MOIJWWNA.js.map → chunk-UE5JYPU6.js.map} +0 -0
  395. /package/dist/{chunk-TGQW3AMK.js.map → chunk-UIFWZMO7.js.map} +0 -0
  396. /package/dist/{chunk-UW6LBFYN.js.map → chunk-USX5YIKB.js.map} +0 -0
  397. /package/dist/{chunk-QGFR73SN.js.map → chunk-VK5HKVQ7.js.map} +0 -0
  398. /package/dist/{chunk-IHCXMYSE.js.map → chunk-VPEIWMUT.js.map} +0 -0
  399. /package/dist/{chunk-O5ZINWW3.js.map → chunk-VSJ3ARFS.js.map} +0 -0
  400. /package/dist/{chunk-RLVI2M5Q.js.map → chunk-W4V7P5HP.js.map} +0 -0
  401. /package/dist/{chunk-ELHJK7LM.js.map → chunk-WBN66HPI.js.map} +0 -0
  402. /package/dist/{chunk-BJLCV2P3.js.map → chunk-WGRAB3KB.js.map} +0 -0
  403. /package/dist/{chunk-5KDDAQ6K.js.map → chunk-WN2DASTS.js.map} +0 -0
  404. /package/dist/{chunk-IG3EZ3TF.js.map → chunk-WNQ3B3Q5.js.map} +0 -0
  405. /package/dist/{chunk-V6SBA5O7.js.map → chunk-WYOHQJKC.js.map} +0 -0
  406. /package/dist/{chunk-WHROVQ5Q.js.map → chunk-X4DHAXFO.js.map} +0 -0
  407. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  408. /package/dist/{chunk-JLGBJ4AX.js.map → chunk-XPZM7GP6.js.map} +0 -0
  409. /package/dist/{chunk-64S6X4IU.js.map → chunk-XTN54NML.js.map} +0 -0
  410. /package/dist/{chunk-UYUFDTIX.js.map → chunk-YIXWY4OZ.js.map} +0 -0
  411. /package/dist/{chunk-NCZGGGWI.js.map → chunk-YPYSC3TX.js.map} +0 -0
  412. /package/dist/{chunk-AVGDYYMA.js.map → chunk-ZBET3W26.js.map} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  ActivityStore,
15
15
  MaintenanceScheduler
16
- } from "./chunk-JLGBJ4AX.js";
16
+ } from "./chunk-XPZM7GP6.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-Y7427SL7.js";
25
+ } from "./chunk-ZG4GNPRE.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-GHHQLSSY.js";
35
+ } from "./chunk-LYOCAUI6.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-5KBIOI4G.js";
@@ -44,9 +44,15 @@ import {
44
44
  applyUtilityRankingRuntimeDelta,
45
45
  loadUtilityRuntimeValues
46
46
  } from "./chunk-3Q3XD3NO.js";
47
+ import {
48
+ TmtBuilder
49
+ } from "./chunk-ECZU5BJH.js";
47
50
  import {
48
51
  extractTopics
49
52
  } from "./chunk-KVDUKH5E.js";
53
+ import {
54
+ buildTemporalTimelineRecallSection
55
+ } from "./chunk-VHF73MGU.js";
50
56
  import {
51
57
  CODEX_THREAD_KEY_PREFIX
52
58
  } from "./chunk-4EX5WZ4M.js";
@@ -56,16 +62,10 @@ import {
56
62
  import {
57
63
  decideTierTransition
58
64
  } from "./chunk-GCBIXUPT.js";
59
- import {
60
- TmtBuilder
61
- } from "./chunk-ECZU5BJH.js";
62
65
  import {
63
66
  buildTargetedFactRecallSection,
64
67
  shouldRecallTargetedFactEvidence
65
68
  } from "./chunk-T67LUYCR.js";
66
- import {
67
- buildTemporalTimelineRecallSection
68
- } from "./chunk-VHF73MGU.js";
69
69
  import {
70
70
  memoriesToStandingEntries,
71
71
  prefixStandingMemoryBlock,
@@ -74,14 +74,6 @@ import {
74
74
  import {
75
75
  SessionObserverState
76
76
  } from "./chunk-ODZKV2F7.js";
77
- import {
78
- applyRuntimeRetrievalPolicy
79
- } from "./chunk-5IZL4DCV.js";
80
- import {
81
- RerankCache,
82
- reorderByRankedKeys,
83
- rerankLocalOrNoop
84
- } from "./chunk-LUDXM7MD.js";
85
77
  import {
86
78
  buildResponseGuidanceRecallSection,
87
79
  shouldRecallResponseGuidance
@@ -108,15 +100,23 @@ import {
108
100
  resolvePromptTagPrefilterAsync
109
101
  } from "./chunk-ZOKZIR5K.js";
110
102
  import {
111
- findUnresolvedEntityRefs
112
- } from "./chunk-X7XN6YU4.js";
103
+ applyRuntimeRetrievalPolicy
104
+ } from "./chunk-5IZL4DCV.js";
113
105
  import {
114
106
  RelevanceStore
115
107
  } from "./chunk-X7J56GPG.js";
108
+ import {
109
+ RerankCache,
110
+ reorderByRankedKeys,
111
+ rerankLocalOrNoop
112
+ } from "./chunk-LUDXM7MD.js";
113
+ import {
114
+ findUnresolvedEntityRefs
115
+ } from "./chunk-X7XN6YU4.js";
116
116
  import {
117
117
  indexStateViewAnnotatedResults,
118
118
  resolveRecallStateViewActive
119
- } from "./chunk-64JLBFCQ.js";
119
+ } from "./chunk-N7NAGECH.js";
120
120
  import {
121
121
  applyRecallStateViews
122
122
  } from "./chunk-DBB5JPSL.js";
@@ -128,15 +128,15 @@ import {
128
128
  import {
129
129
  reorderRecallResultsWithMmr
130
130
  } from "./chunk-IIK2PD3F.js";
131
- import {
132
- applyReasoningTraceBoost
133
- } from "./chunk-EVWDNKQA.js";
134
131
  import {
135
132
  compactRecallContextFromBuckets,
136
133
  decideRecallContextComposition,
137
134
  notifyContextComposition,
138
135
  recallFailureComposition
139
136
  } from "./chunk-MGN2RQRG.js";
137
+ import {
138
+ applyReasoningTraceBoost
139
+ } from "./chunk-EVWDNKQA.js";
140
140
  import {
141
141
  installPrioritizedEmbedding
142
142
  } from "./chunk-ROI7BK7H.js";
@@ -154,12 +154,6 @@ import {
154
154
  import {
155
155
  runLiveConnectorsOnce
156
156
  } from "./chunk-APYY5CX3.js";
157
- import {
158
- classifyMemoryKind
159
- } from "./chunk-YAZNBMNF.js";
160
- import {
161
- scoreEvidencePathDetail
162
- } from "./chunk-XXSOVESA.js";
163
157
  import {
164
158
  deriveHarmonicRecords,
165
159
  harmonicEntityReferenceMatches,
@@ -167,25 +161,28 @@ import {
167
161
  normalizedHarmonicEntityIdentity,
168
162
  persistHarmonicRecords
169
163
  } from "./chunk-LQ5SS4OP.js";
164
+ import {
165
+ classifyMemoryKind
166
+ } from "./chunk-YAZNBMNF.js";
167
+ import {
168
+ scoreEvidencePathDetail
169
+ } from "./chunk-XXSOVESA.js";
170
+ import {
171
+ buildFocusedListRecallSection,
172
+ shouldRecallFocusedListEvidence
173
+ } from "./chunk-OH7QLI6W.js";
170
174
  import {
171
175
  chunkExtractionWindow,
172
176
  classifyDrainResult,
173
177
  extractionWindowBudgetChars,
174
178
  mergeDrainResults
175
- } from "./chunk-VA3GNAWQ.js";
179
+ } from "./chunk-LZIOY7ZU.js";
176
180
  import {
177
181
  ExtractionEngine
178
- } from "./chunk-LN4X2NDA.js";
182
+ } from "./chunk-KY3KJUNN.js";
179
183
  import {
180
184
  parseMemoryActionEligibilityContext
181
185
  } from "./chunk-JHU4EYDV.js";
182
- import {
183
- buildFocusedListRecallSection,
184
- shouldRecallFocusedListEvidence
185
- } from "./chunk-OH7QLI6W.js";
186
- import {
187
- recordJudgeTrainingPair
188
- } from "./chunk-PWFCHOB3.js";
189
186
  import {
190
187
  createDeferCountMap,
191
188
  createVerdictCache,
@@ -193,9 +190,15 @@ import {
193
190
  judgeFactDurability,
194
191
  validateProcedureExtraction
195
192
  } from "./chunk-TJ5YGCPV.js";
193
+ import {
194
+ recordJudgeTrainingPair
195
+ } from "./chunk-PWFCHOB3.js";
196
+ import {
197
+ buildExplicitCueRecallSection
198
+ } from "./chunk-TVIVY7KU.js";
196
199
  import {
197
200
  buildEventOrderRecallSection
198
- } from "./chunk-645WOU5I.js";
201
+ } from "./chunk-H7BZBSP6.js";
199
202
  import {
200
203
  shouldRecallEventOrderEvidence
201
204
  } from "./chunk-BUYVPUEM.js";
@@ -203,29 +206,26 @@ import {
203
206
  pickFactEventTimeAnchor,
204
207
  resolveFactEventTime
205
208
  } from "./chunk-IAIPNEHD.js";
206
- import {
207
- buildExplicitCueRecallSection
208
- } from "./chunk-TVIVY7KU.js";
209
209
  import {
210
210
  buildEntityRecallSection,
211
211
  entityRecentTranscriptLookbackHours,
212
212
  readRecentEntityTranscriptEntries
213
- } from "./chunk-NCZGGGWI.js";
213
+ } from "./chunk-YPYSC3TX.js";
214
214
  import {
215
215
  planEpisodeWindowsWithFallback
216
216
  } from "./chunk-T3GIETKV.js";
217
+ import {
218
+ EmbeddingFallback
219
+ } from "./chunk-SBRUTD5O.js";
217
220
  import {
218
221
  tryDirectAnswer
219
222
  } from "./chunk-5IIQU4JZ.js";
220
- import {
221
- EmbeddingFallback
222
- } from "./chunk-YSATDEBY.js";
223
223
  import {
224
224
  formatDaySummaryMemories
225
225
  } from "./chunk-7G5NTS7F.js";
226
226
  import {
227
227
  refreshConvergedNamespaces
228
- } from "./chunk-OCK4D5PC.js";
228
+ } from "./chunk-FGGLVCHI.js";
229
229
  import {
230
230
  builtInConnectorPackageSpecifier,
231
231
  ensureBuiltInWearableConnectors,
@@ -234,24 +234,24 @@ import {
234
234
  runTimelinePublishCli,
235
235
  screenCandidateFact,
236
236
  summarizeVaultPublish
237
- } from "./chunk-75DCOS6I.js";
238
- import {
239
- normalizeReplaySessionKey
240
- } from "./chunk-AJVLDJU6.js";
237
+ } from "./chunk-QUPTDKSX.js";
241
238
  import {
242
239
  RoutingRulesStore
243
240
  } from "./chunk-TBUEE7XF.js";
241
+ import {
242
+ normalizeReplaySessionKey
243
+ } from "./chunk-AJVLDJU6.js";
244
244
  import {
245
245
  compareVerifiedEpisodeResults,
246
246
  searchVerifiedEpisodes
247
- } from "./chunk-KZZ5EZ7O.js";
247
+ } from "./chunk-DC3DWF2M.js";
248
248
  import {
249
249
  ThreadingManager
250
250
  } from "./chunk-VHSQU3RO.js";
251
251
  import {
252
252
  compareVerifiedSemanticRuleResults,
253
253
  searchVerifiedSemanticRules
254
- } from "./chunk-TVE7W67N.js";
254
+ } from "./chunk-BTU77RB5.js";
255
255
  import {
256
256
  searchWorkProductLedgerEntries
257
257
  } from "./chunk-B2NXOVZN.js";
@@ -264,10 +264,10 @@ import {
264
264
  import {
265
265
  runNamespaceMaintenanceFanout,
266
266
  summarizeNamespaceMaintenanceHealth
267
- } from "./chunk-MOIJWWNA.js";
267
+ } from "./chunk-UE5JYPU6.js";
268
268
  import {
269
269
  planNamespaceMaintenance
270
- } from "./chunk-HH73M65H.js";
270
+ } from "./chunk-QVZZE6VH.js";
271
271
  import {
272
272
  isAboveImportanceThreshold,
273
273
  scoreImportance
@@ -296,10 +296,7 @@ import {
296
296
  materializeAfterSemanticConsolidation,
297
297
  parseConsolidationResponse,
298
298
  parseOperatorAwareConsolidationResponse
299
- } from "./chunk-AYJQ644F.js";
300
- import {
301
- SmartBuffer
302
- } from "./chunk-4MPAKYZU.js";
299
+ } from "./chunk-6KBCUIZP.js";
303
300
  import {
304
301
  semanticChunkContent
305
302
  } from "./chunk-2GBFKHBZ.js";
@@ -307,12 +304,8 @@ import {
307
304
  chunkContent
308
305
  } from "./chunk-6TBIWIAG.js";
309
306
  import {
310
- buildRecallQueryPolicy
311
- } from "./chunk-C6WMSXCJ.js";
312
- import {
313
- buildBehaviorSignalsForMemory,
314
- dedupeBehaviorSignalsByMemoryAndHash
315
- } from "./chunk-KD3QD3A5.js";
307
+ SmartBuffer
308
+ } from "./chunk-EGKDONTC.js";
316
309
  import {
317
310
  BootstrapEngine
318
311
  } from "./chunk-MYVPLJOO.js";
@@ -322,9 +315,6 @@ import {
322
315
  import {
323
316
  BoxBuilder
324
317
  } from "./chunk-B7RWBZXW.js";
325
- import {
326
- evaluateMemoryActionPolicy
327
- } from "./chunk-MI2OTWV5.js";
328
318
  import {
329
319
  REFUSED_MERGE_CATEGORIES,
330
320
  applyNoveltyGate,
@@ -335,7 +325,7 @@ import {
335
325
  embeddingsFromCosineHits,
336
326
  normalizeConnectorScope,
337
327
  runSeedGraduationPass
338
- } from "./chunk-PRKNAIGZ.js";
328
+ } from "./chunk-T6T2RMWW.js";
339
329
  import {
340
330
  compileCorrectionRule,
341
331
  correctionsFilePath,
@@ -371,9 +361,19 @@ import {
371
361
  AMBIENT_CAPTURE_PROMPT_RULE,
372
362
  isHighImpactPersonalFact
373
363
  } from "./chunk-QW27DOHG.js";
364
+ import {
365
+ buildRecallQueryPolicy
366
+ } from "./chunk-C6WMSXCJ.js";
367
+ import {
368
+ buildBehaviorSignalsForMemory,
369
+ dedupeBehaviorSignalsByMemoryAndHash
370
+ } from "./chunk-KD3QD3A5.js";
371
+ import {
372
+ evaluateMemoryActionPolicy
373
+ } from "./chunk-MI2OTWV5.js";
374
374
  import {
375
375
  MeetingsInputError
376
- } from "./chunk-H5DIRCZP.js";
376
+ } from "./chunk-LHMCZ6VW.js";
377
377
  import {
378
378
  WearablesInputError,
379
379
  describeErrorForOperator
@@ -388,10 +388,10 @@ import {
388
388
  import {
389
389
  removeNodeEdgesForRewrite,
390
390
  rollbackNodeEdgeRewrite
391
- } from "./chunk-W7K5BP3M.js";
391
+ } from "./chunk-HQPFACXO.js";
392
392
  import {
393
393
  NamespaceCatalog
394
- } from "./chunk-CI3MAAIY.js";
394
+ } from "./chunk-2R44BBPK.js";
395
395
  import {
396
396
  RecallResultFormatter,
397
397
  SessionContextCoordinator,
@@ -400,13 +400,17 @@ import {
400
400
  detectPassiveCorrections,
401
401
  renderSessionExperiencePreview,
402
402
  scoreSessionExperienceForPrompt
403
- } from "./chunk-6WKWL53V.js";
403
+ } from "./chunk-23BA3USG.js";
404
404
  import {
405
405
  importCapsule
406
- } from "./chunk-QDZWQBLU.js";
406
+ } from "./chunk-2R7OCBRR.js";
407
407
  import {
408
408
  isCodingGraphInstalled
409
409
  } from "./chunk-VQ7B2Q6M.js";
410
+ import {
411
+ listTrustZoneRecords,
412
+ searchTrustZoneRecords
413
+ } from "./chunk-JWX2Q6HS.js";
410
414
  import {
411
415
  applyTrustScoreStage,
412
416
  buildTrustSignalsForRerank,
@@ -414,13 +418,9 @@ import {
414
418
  trustResultFor,
415
419
  trustResultKey
416
420
  } from "./chunk-GNVZQ5JN.js";
417
- import {
418
- listTrustZoneRecords,
419
- searchTrustZoneRecords
420
- } from "./chunk-JWX2Q6HS.js";
421
421
  import {
422
422
  HourlySummarizer
423
- } from "./chunk-W26D2USW.js";
423
+ } from "./chunk-MUH7RR6T.js";
424
424
  import {
425
425
  LastRecallStore,
426
426
  RecallHandleHistoryStore,
@@ -430,20 +430,16 @@ import {
430
430
  import {
431
431
  buildXraySnapshot
432
432
  } from "./chunk-7O2MC42R.js";
433
- import {
434
- objectiveStateStoreOverrideForNamespace,
435
- searchObjectiveStateSnapshots
436
- } from "./chunk-4RNBLLZR.js";
437
433
  import {
438
434
  filterRecallCandidates,
439
435
  isGenericRecallExcludedPath,
440
436
  isTopLevelArchivePath,
441
437
  journalPath,
442
438
  writeJournalFile
443
- } from "./chunk-BJLCV2P3.js";
439
+ } from "./chunk-WGRAB3KB.js";
444
440
  import {
445
441
  searchHarmonicRetrieval
446
- } from "./chunk-EXQJMFRF.js";
442
+ } from "./chunk-JY4LXMZR.js";
447
443
  import {
448
444
  ProfilingCollector
449
445
  } from "./chunk-DOWACHYO.js";
@@ -464,23 +460,24 @@ import {
464
460
  renderAuthorityBoundContent,
465
461
  selectCuriosityQuestion
466
462
  } from "./chunk-NVKO5YKP.js";
467
- import {
468
- NamespaceStorageRouter
469
- } from "./chunk-5UM4H64E.js";
470
463
  import {
471
464
  pruneOrphanCueAnchors
472
465
  } from "./chunk-LXATZLSC.js";
466
+ import {
467
+ NamespaceStorageRouter
468
+ } from "./chunk-UAOJVQXC.js";
473
469
  import {
474
470
  GraphIndex
475
- } from "./chunk-M4IEZGCK.js";
471
+ } from "./chunk-BFBS7OFQ.js";
476
472
  import {
477
473
  GraphEdgeAppendError
478
474
  } from "./chunk-GKCXTSFF.js";
479
475
  import {
480
476
  ExtractionDeadlineError,
481
477
  ExtractionRunCoordinator,
478
+ ProviderCircuitBreaker,
482
479
  classifyExtractionOrigin
483
- } from "./chunk-R2BIVU2Z.js";
480
+ } from "./chunk-DE4U5PTV.js";
484
481
  import {
485
482
  ARTIFACT_STATUS_CACHE_TTL_MS,
486
483
  BulkImportBatchPartialFailureError,
@@ -520,7 +517,7 @@ import {
520
517
  throwIfRecallAborted,
521
518
  tokenizeRecallQuery,
522
519
  utcDateKeysForLocalDay
523
- } from "./chunk-R4ZHF4K2.js";
520
+ } from "./chunk-43FLJLT2.js";
524
521
  import {
525
522
  inferIntentFromText,
526
523
  intentCompatibilityScore,
@@ -529,17 +526,10 @@ import {
529
526
  } from "./chunk-CSAKJVXW.js";
530
527
  import {
531
528
  LocalLlmClient
532
- } from "./chunk-74AY3S7U.js";
529
+ } from "./chunk-5RW247F5.js";
533
530
  import {
534
531
  buildChainFollowupGenerator
535
- } from "./chunk-IAGVM7EY.js";
536
- import {
537
- decideLifecycleTransition,
538
- resolveLifecycleState
539
- } from "./chunk-TBBDFYXW.js";
540
- import {
541
- estimateTokenCount
542
- } from "./chunk-TOTT6S2V.js";
532
+ } from "./chunk-N2Y6COEM.js";
543
533
  import {
544
534
  capStateViewPackets,
545
535
  reconcileStateViewPairs,
@@ -557,7 +547,7 @@ import {
557
547
  } from "./chunk-QDW3E4RD.js";
558
548
  import {
559
549
  searchCausalTrajectories
560
- } from "./chunk-GKL6QYZO.js";
550
+ } from "./chunk-6L63IN3M.js";
561
551
  import {
562
552
  QmdResultResolver,
563
553
  StorageManager,
@@ -577,7 +567,10 @@ import {
577
567
  reconstructFusionInputs,
578
568
  selfDeps,
579
569
  serializeFusionDay
580
- } from "./chunk-NHWDTOBN.js";
570
+ } from "./chunk-S73ZVU37.js";
571
+ import {
572
+ buildRetiredFactTombstoneInputs
573
+ } from "./chunk-QGVCFVX6.js";
581
574
  import {
582
575
  bodyIsEscaped,
583
576
  decodeTranscriptBody,
@@ -588,18 +581,15 @@ import {
588
581
  saveSpeakerRegistry,
589
582
  speakerRegistryKey
590
583
  } from "./chunk-UHVXE24Y.js";
591
- import {
592
- buildRetiredFactTombstoneInputs
593
- } from "./chunk-QGVCFVX6.js";
594
584
  import {
595
585
  NamespaceSearchRouter,
596
586
  namespaceCollectionName
597
- } from "./chunk-OH55F76C.js";
587
+ } from "./chunk-JEX2JL3U.js";
598
588
  import {
599
589
  createConversationIndexRuntime,
600
590
  createSearchBackend,
601
591
  isSearchBackendEnabled
602
- } from "./chunk-L334PSLW.js";
592
+ } from "./chunk-U2A56LLF.js";
603
593
  import {
604
594
  NoopSearchBackend
605
595
  } from "./chunk-CYEPCZN5.js";
@@ -629,14 +619,14 @@ import {
629
619
  isDirectorySidecarsEnabledForDir,
630
620
  setDirectorySidecarsEnabledForDir
631
621
  } from "./chunk-3OUGSOJP.js";
622
+ import {
623
+ checkCorpusReadAbort
624
+ } from "./chunk-P4GUQSK3.js";
632
625
  import {
633
626
  detectLanguageHint,
634
627
  dominantCorpusLanguage,
635
628
  planCrossScript
636
629
  } from "./chunk-3WU7XOFN.js";
637
- import {
638
- checkCorpusReadAbort
639
- } from "./chunk-P4GUQSK3.js";
640
630
  import {
641
631
  createVersion,
642
632
  pruneVersions,
@@ -669,20 +659,20 @@ import {
669
659
  isValidAsOf,
670
660
  isValidityExpiredNow
671
661
  } from "./chunk-6CIAGZ6X.js";
672
- import {
673
- isUntrustedOrigin,
674
- parseOriginClass
675
- } from "./chunk-23G5P7TA.js";
676
662
  import {
677
663
  buildQmdRecallCacheKey,
678
664
  getCachedQmdRecall,
679
665
  setCachedQmdRecall
680
666
  } from "./chunk-42JKGUFJ.js";
667
+ import {
668
+ isUntrustedOrigin,
669
+ parseOriginClass
670
+ } from "./chunk-23G5P7TA.js";
681
671
  import {
682
672
  bufferTurnsEqual,
683
673
  describeError,
684
674
  groupTurnsByExtractionScope
685
- } from "./chunk-U7MIMS2Y.js";
675
+ } from "./chunk-OUBEJWVI.js";
686
676
  import {
687
677
  FallbackLlmClient,
688
678
  gatewayTaskChainOptions
@@ -696,6 +686,13 @@ import {
696
686
  resolveRecallCoreSectionDeadlineMs,
697
687
  runRecallSectionWithinDeadline
698
688
  } from "./chunk-RNFMFC37.js";
689
+ import {
690
+ decideLifecycleTransition,
691
+ resolveLifecycleState
692
+ } from "./chunk-TBBDFYXW.js";
693
+ import {
694
+ estimateTokenCount
695
+ } from "./chunk-TOTT6S2V.js";
699
696
  import {
700
697
  coerceBool,
701
698
  coerceBooleanLike,
@@ -711,6 +708,10 @@ import {
711
708
  import {
712
709
  extractJsonCandidates
713
710
  } from "./chunk-YBA52OKG.js";
711
+ import {
712
+ objectiveStateStoreOverrideForNamespace,
713
+ searchObjectiveStateSnapshots
714
+ } from "./chunk-4RNBLLZR.js";
714
715
  import {
715
716
  localDayKey,
716
717
  renderDayLocationContext
@@ -738,13 +739,13 @@ import {
738
739
  import {
739
740
  CAPSULE_ID_PATTERN
740
741
  } from "./chunk-WEHSQBFR.js";
741
- import {
742
- buildRetrievedMemoryProvenance
743
- } from "./chunk-I4WBNM3M.js";
744
742
  import {
745
743
  keyring_exports,
746
744
  secureStoreDir
747
745
  } from "./chunk-BJMBJZ2Y.js";
746
+ import {
747
+ buildRetrievedMemoryProvenance
748
+ } from "./chunk-I4WBNM3M.js";
748
749
  import {
749
750
  getConfiguredNamespaces,
750
751
  resolveNamespaceFromStorageDir,
@@ -790,7 +791,7 @@ import {
790
791
  } from "./chunk-JAKIDQB2.js";
791
792
  import {
792
793
  storageBackedIndexStoreIo
793
- } from "./chunk-5KDDAQ6K.js";
794
+ } from "./chunk-WN2DASTS.js";
794
795
  import {
795
796
  assertIsDirectoryNotSymlink,
796
797
  assertRealpathInsideRoot
@@ -1090,6 +1091,13 @@ var ExtractionQueueCoordinator = class {
1090
1091
  accepting = true;
1091
1092
  /** Buffer keys with a task currently running (per-key exclusion). */
1092
1093
  activeKeys = /* @__PURE__ */ new Set();
1094
+ /**
1095
+ * Buffer keys with a claim DECISION in flight (daemon backlog scheduler).
1096
+ * A reservation is taken synchronously BEFORE the async claim/decision so
1097
+ * no queued task for the key can start past the gate while the decision is
1098
+ * unsettled; selection skips reserved keys until release.
1099
+ */
1100
+ reservedKeys = /* @__PURE__ */ new Set();
1093
1101
  /** Preempt slots of the currently running tasks, keyed by slot identity. */
1094
1102
  preemptSlots = /* @__PURE__ */ new Map();
1095
1103
  preemptSeq = 0;
@@ -1135,6 +1143,40 @@ var ExtractionQueueCoordinator = class {
1135
1143
  }
1136
1144
  return true;
1137
1145
  }
1146
+ /**
1147
+ * Synchronously reserve `key` so no task for it starts until the key's
1148
+ * owner (the backlog scheduler's claim decision) settles and releases.
1149
+ * Returns false when the key is active, queued, or already reserved —
1150
+ * single-threaded JS makes this check+add atomic.
1151
+ */
1152
+ tryReserveKey(key) {
1153
+ if (this.activeKeys.has(key) || this.reservedKeys.has(key)) return false;
1154
+ if (this.queue.some((entry) => entry.key === key)) return false;
1155
+ this.reservedKeys.add(key);
1156
+ if (!this.processing && this.queue.length > 0) {
1157
+ this.processing = true;
1158
+ this.processQueue().catch((err) => {
1159
+ this.logExtractionQueueFailure(err, "processor");
1160
+ this.processing = false;
1161
+ });
1162
+ }
1163
+ return true;
1164
+ }
1165
+ /** Settle a reservation: the key's decision is made and enqueued work (if
1166
+ * any) now carries the key authority itself. Idempotent; wakes a parked
1167
+ * processor waiting only on this release. */
1168
+ releaseKeyReservation(key) {
1169
+ if (!this.reservedKeys.delete(key)) return;
1170
+ if (this.queue.length > 0 && !this.processing) {
1171
+ this.processing = true;
1172
+ this.processQueue().catch((err) => {
1173
+ this.logExtractionQueueFailure(err, "processor");
1174
+ this.processing = false;
1175
+ });
1176
+ } else {
1177
+ this.wake?.();
1178
+ }
1179
+ }
1138
1180
  preemptRunning(preferredKey) {
1139
1181
  const armed = Array.from(this.preemptSlots.values()).filter((slot) => slot.armed !== void 0);
1140
1182
  if (armed.length === 0) return;
@@ -1201,11 +1243,11 @@ var ExtractionQueueCoordinator = class {
1201
1243
  this.processing = false;
1202
1244
  }
1203
1245
  }
1204
- /** Take the next queue entry whose key is not already running (FIFO within a key). */
1246
+ /** Take the next queue entry whose key is not already running or reserved (FIFO within a key). */
1205
1247
  takeRunnable() {
1206
1248
  for (let index = 0; index < this.queue.length; index += 1) {
1207
1249
  const entry = this.queue[index];
1208
- if (entry.key !== void 0 && this.activeKeys.has(entry.key)) continue;
1250
+ if (entry.key !== void 0 && (this.activeKeys.has(entry.key) || this.reservedKeys.has(entry.key))) continue;
1209
1251
  this.queue.splice(index, 1);
1210
1252
  if (entry.key !== void 0) this.activeKeys.add(entry.key);
1211
1253
  return entry;
@@ -15995,17 +16037,7 @@ function chunkFingerprint(chunk) {
15995
16037
  return hash.digest("hex");
15996
16038
  }
15997
16039
  var ExtractionDrain = class {
15998
- constructor(deps) {
15999
- this.deps = deps;
16000
- }
16001
- deps;
16002
- /**
16003
- * Consecutive failed attempts on the head chunk, per buffer key. In memory on
16004
- * purpose (a restart re-counts from zero). Bound to the chunk's content: a
16005
- * count recorded for one chunk never applies to a different one, so a force
16006
- * flush that clears a failing chunk cannot make unrelated content inherit its
16007
- * failures.
16008
- */
16040
+ /** Consecutive failed attempts on the head chunk, per buffer key. In memory on */
16009
16041
  failures = /* @__PURE__ */ new Map();
16010
16042
  /**
16011
16043
  * Buffer key to the first turn of the chunk a qualified window stopped on.
@@ -16015,6 +16047,13 @@ var ExtractionDrain = class {
16015
16047
  * window drains; one entry per key.
16016
16048
  */
16017
16049
  qualified = /* @__PURE__ */ new Map();
16050
+ /** The claim drain runs with `dropFailedChunks: false`: a chunk that keeps */
16051
+ dropFailedChunks;
16052
+ deps;
16053
+ constructor(deps, options) {
16054
+ this.deps = deps;
16055
+ this.dropFailedChunks = options?.dropFailedChunks !== false;
16056
+ }
16018
16057
  /** Characters the coordinator would count for this window: user/assistant text, trimmed and capped per turn, context-only turns left out. */
16019
16058
  windowChars(turns) {
16020
16059
  let total = 0;
@@ -16055,17 +16094,40 @@ var ExtractionDrain = class {
16055
16094
  */
16056
16095
  async run(turns, runOptions, preemptable = false, preemptHandle) {
16057
16096
  const budgetChars = this.deps.extractionWindowBudgetChars?.() ?? Number.POSITIVE_INFINITY;
16058
- const chunkable = runOptions.clearBufferAfterExtraction && !runOptions.forceExtractionAttempt && !runOptions.failOnExtractionFailure && !turns.some((turn) => turn.acceptedCapture === true) && Number.isFinite(budgetChars) && budgetChars > 0;
16059
- const chunks = chunkable ? chunkExtractionWindow(turns, budgetChars) : [];
16060
- const resumed = chunks.length > 0 && this.qualified.get(runOptions.bufferKey) === chunkFingerprint(chunks[0].slice(0, 1));
16061
- if (chunks.length <= 1 && !resumed) return await this.deps.runExtraction(turns, runOptions);
16062
- if (!resumed) {
16063
- const windowUserTurns = turns.filter((turn) => turn.role === "user").length;
16064
- const belowChars = !runOptions.skipCharThreshold && this.windowChars(turns) < this.deps.config.extractionMinChars;
16065
- if (!runOptions.skipUserTurnThreshold && windowUserTurns < this.deps.config.extractionMinUserTurns || belowChars) {
16066
- return await this.deps.runExtraction(turns, runOptions);
16067
- }
16097
+ const plan = this.chunkPlan(turns, runOptions, budgetChars);
16098
+ if (plan.singleRun) return await this.deps.runExtraction(turns, runOptions);
16099
+ if (!plan.resumed && this.windowBelowThreshold(turns, runOptions)) {
16100
+ return await this.deps.runExtraction(turns, runOptions);
16068
16101
  }
16102
+ return await this.runChunked(plan.chunks, runOptions, preemptable, preemptHandle);
16103
+ }
16104
+ /** Chunking plan for one trigger-drain window. Accepted-capture groups */
16105
+ chunkPlan(turns, runOptions, budgetChars) {
16106
+ const chunks = this.chunkable(runOptions, turns, budgetChars) ? this.deps.measureRenderedTurns !== void 0 ? this.chunkByRenderedSize(turns, budgetChars) : chunkExtractionWindow(turns, budgetChars) : [];
16107
+ const resumed = chunks.length > 0 && this.qualified.get(runOptions.bufferKey) === chunkFingerprint(chunks[0].slice(0, 1));
16108
+ return { singleRun: chunks.length <= 1 && !resumed, chunks, resumed };
16109
+ }
16110
+ /** Automatic chunking needs a clearable window, no fail-closed/forced
16111
+ * caller, and a real budget to chunk against. */
16112
+ chunkable(runOptions, turns, budgetChars) {
16113
+ return runOptions.clearBufferAfterExtraction && !runOptions.forceExtractionAttempt && !runOptions.failOnExtractionFailure && this.identityCleared(runOptions, turns) && Number.isFinite(budgetChars) && budgetChars > 0;
16114
+ }
16115
+ /** A native group clears its turns by identity (a pinned capture can sit
16116
+ * in front); a drop must find them the same way. */
16117
+ identityCleared(runOptions, turns) {
16118
+ return runOptions.clearMatchingTurns === true || !turns.some((turn) => turn.acceptedCapture === true);
16119
+ }
16120
+ /** Eligibility (minimum user turns and characters) belongs to the whole
16121
+ * window: a window that never qualified keeps the single-run path, which
16122
+ * judges it exactly as before. */
16123
+ windowBelowThreshold(turns, runOptions) {
16124
+ const windowUserTurns = turns.filter((turn) => turn.role === "user").length;
16125
+ const belowChars = !runOptions.skipCharThreshold && this.windowChars(turns) < this.deps.config.extractionMinChars;
16126
+ return !runOptions.skipUserTurnThreshold && windowUserTurns < this.deps.config.extractionMinUserTurns || belowChars;
16127
+ }
16128
+ /** The window qualified as a whole; its chunks must not be re-judged one by
16129
+ * one (an assistant-only or short chunk would be cleared unextracted). */
16130
+ async runChunked(chunks, runOptions, preemptable, preemptHandle) {
16069
16131
  const baseOptions = { ...runOptions, skipCharThreshold: true, skipUserTurnThreshold: true };
16070
16132
  const bufferKey = runOptions.bufferKey;
16071
16133
  const byIdentity = runOptions.clearMatchingTurns === true;
@@ -16073,81 +16135,148 @@ var ExtractionDrain = class {
16073
16135
  let aggregate = null;
16074
16136
  for (const [position, chunk] of chunks.entries()) {
16075
16137
  this.qualified.set(bufferKey, chunkFingerprint(chunk.slice(0, 1)));
16076
- let chunkOptions = { ...baseOptions, retentionWindow: chunks.slice(0, position + 1).flat() };
16077
- let preempt;
16078
- if (preemptable && position > 0) {
16079
- const local = new AbortController();
16080
- preempt = local;
16081
- preemptHandle?.arm(() => local.abort(preemptedExtractionError()));
16082
- chunkOptions = {
16083
- ...chunkOptions,
16084
- abortSignal: runOptions.abortSignal ? AbortSignal.any([runOptions.abortSignal, local.signal]) : local.signal
16085
- };
16086
- }
16087
- let failures = this.failureCount(bufferKey, chunk);
16138
+ const { options: chunkOptions, preempt } = this.chunkOptionsFor(
16139
+ chunks,
16140
+ position,
16141
+ baseOptions,
16142
+ runOptions,
16143
+ preemptable,
16144
+ preemptHandle
16145
+ );
16146
+ const failures = this.failureCount(bufferKey, chunk);
16088
16147
  let result;
16089
16148
  try {
16090
16149
  result = await this.deps.runExtraction(chunk, chunkOptions);
16091
16150
  } catch (err) {
16092
- if (isAbortError(err)) throw preempt && preempt.signal.aborted && !runOptions.abortSignal?.aborted ? preempt.signal.reason : err;
16093
- failures += 1;
16094
- if (failures < dropAfter) {
16095
- this.setFailureCount(bufferKey, chunk, failures);
16096
- throw err;
16097
- }
16098
- const thrown = {
16099
- status: "skipped",
16100
- reason: `thrown: ${describeError(err)}`,
16101
- persistedCount: 0,
16102
- durableOutputCount: 0
16103
- };
16104
- if (!await this.dropFailedChunk(bufferKey, chunk, dropAfter, thrown, byIdentity)) {
16105
- this.setFailureCount(bufferKey, chunk, failures);
16106
- throw err;
16107
- }
16108
- this.setFailureCount(bufferKey, chunk, 0);
16151
+ this.rethrowChunkAbort(err, preempt, runOptions.abortSignal?.aborted === true);
16152
+ aggregate = await this.settleThrownChunk(bufferKey, chunk, failures, dropAfter, err, byIdentity, aggregate);
16109
16153
  continue;
16110
16154
  }
16111
- const verdict = classifyDrainResult(result);
16112
- if (verdict === "drained") {
16113
- this.setFailureCount(bufferKey, chunk, 0);
16114
- aggregate = mergeDrainResults(aggregate, result);
16155
+ const settled = this.settleVerdict(bufferKey, chunk, result, aggregate);
16156
+ if (settled.action === "continue") {
16157
+ aggregate = settled.result;
16115
16158
  continue;
16116
16159
  }
16117
- if (verdict === "deferred") return mergeDrainResults(aggregate, result);
16118
- if (result.failureClass === "provider_retryable" || result.failureClass === "auth_config") {
16119
- return mergeDrainResults(aggregate, result);
16120
- }
16121
- failures += 1;
16122
- if (failures >= dropAfter) {
16123
- if (!await this.dropFailedChunk(bufferKey, chunk, dropAfter, result, byIdentity)) {
16124
- this.setFailureCount(bufferKey, chunk, failures);
16125
- return mergeDrainResults(aggregate, result);
16126
- }
16127
- this.setFailureCount(bufferKey, chunk, 0);
16128
- aggregate = mergeDrainResults(aggregate, result);
16160
+ if (settled.action === "return") return settled.result;
16161
+ const failed = await this.settleFailedChunk({
16162
+ bufferKey,
16163
+ chunk,
16164
+ failures,
16165
+ dropAfter,
16166
+ result: settled.result,
16167
+ byIdentity,
16168
+ aggregate: settled.aggregate
16169
+ });
16170
+ if (failed.action === "continue") {
16171
+ aggregate = failed.result;
16129
16172
  continue;
16130
16173
  }
16131
- this.setFailureCount(bufferKey, chunk, failures);
16132
- return mergeDrainResults(aggregate, result);
16174
+ return failed.result;
16133
16175
  }
16134
16176
  this.qualified.delete(bufferKey);
16135
16177
  return aggregate ?? { status: "skipped", persistedCount: 0, durableOutputCount: 0 };
16136
16178
  }
16179
+ /** retention replaces theirs (retained turns do not pile up across chunks) */
16180
+ chunkOptionsFor(chunks, position, baseOptions, runOptions, preemptable, preemptHandle) {
16181
+ let options = { ...baseOptions, retentionWindow: chunks.slice(0, position + 1).flat() };
16182
+ let preempt;
16183
+ if (preemptable && position > 0) {
16184
+ preempt = this.armChunkPreempt(preemptHandle);
16185
+ options = {
16186
+ ...options,
16187
+ abortSignal: runOptions.abortSignal ? AbortSignal.any([runOptions.abortSignal, preempt.signal]) : preempt.signal
16188
+ };
16189
+ }
16190
+ return { options, preempt };
16191
+ }
16192
+ /** A chunk-local abort controller so a fail-closed flush can abort the
16193
+ * next chunk instead of waiting behind the whole window. */
16194
+ armChunkPreempt(preemptHandle) {
16195
+ const local = new AbortController();
16196
+ preemptHandle?.arm(() => local.abort(preemptedExtractionError()));
16197
+ return local;
16198
+ }
16199
+ /** An abort error is rethrown (the chunk-local abort leaves the outer
16200
+ * signal untouched, so the host gets the preemption reason it looks for,
16201
+ * as it does for the first chunk). */
16202
+ rethrowChunkAbort(cause, preempt, outerAborted) {
16203
+ if (!isAbortError(cause)) return;
16204
+ throw preempt && preempt.signal.aborted && !outerAborted ? preempt.signal.reason : cause;
16205
+ }
16206
+ /** A chunk whose extraction THREW: count the failure; below the drop
16207
+ * threshold (or on a no-drop drain) rethrow so the window is retained;
16208
+ * at the threshold a chunk that keeps throwing is dropped like one that
16209
+ * keeps failing, so later chunks are not stuck behind it. */
16210
+ async settleThrownChunk(bufferKey, chunk, failures, dropAfter, cause, byIdentity, aggregate) {
16211
+ failures += 1;
16212
+ if (failures < dropAfter || !this.dropFailedChunks) {
16213
+ this.setFailureCount(bufferKey, chunk, failures);
16214
+ throw cause;
16215
+ }
16216
+ const thrown = {
16217
+ status: "skipped",
16218
+ reason: `thrown: ${describeError(cause)}`,
16219
+ persistedCount: 0,
16220
+ durableOutputCount: 0
16221
+ };
16222
+ if (!await this.dropFailedChunk(bufferKey, chunk, dropAfter, thrown, byIdentity)) {
16223
+ this.setFailureCount(bufferKey, chunk, failures);
16224
+ throw cause;
16225
+ }
16226
+ this.setFailureCount(bufferKey, chunk, 0);
16227
+ return mergeDrainResults(aggregate, thrown);
16228
+ }
16229
+ /** Map one chunk result to the drain-loop action: drained chunks continue
16230
+ * to the next chunk; breaker/backoff retention and provider faults keep
16231
+ * everything for retry without counting a chunk failure. */
16232
+ settleVerdict(bufferKey, chunk, result, aggregate) {
16233
+ const verdict = classifyDrainResult(result);
16234
+ if (verdict === "drained") {
16235
+ this.setFailureCount(bufferKey, chunk, 0);
16236
+ return { action: "continue", result: mergeDrainResults(aggregate, result), aggregate };
16237
+ }
16238
+ if (verdict === "deferred") return { action: "return", result: mergeDrainResults(aggregate, result), aggregate };
16239
+ if (result.failureClass === "provider_retryable" || result.failureClass === "auth_config") {
16240
+ return { action: "return", result: mergeDrainResults(aggregate, result), aggregate };
16241
+ }
16242
+ return { action: "failed", result, aggregate };
16243
+ }
16244
+ /** (live drains, recovery copy first) or keep it as durable retryable */
16245
+ async settleFailedChunk(args) {
16246
+ const failures = args.failures + 1;
16247
+ if (failures >= args.dropAfter && this.dropFailedChunks) {
16248
+ if (!await this.dropFailedChunk(args.bufferKey, args.chunk, args.dropAfter, args.result, args.byIdentity)) {
16249
+ this.setFailureCount(args.bufferKey, args.chunk, failures);
16250
+ return { action: "return", result: mergeDrainResults(args.aggregate, args.result) };
16251
+ }
16252
+ this.setFailureCount(args.bufferKey, args.chunk, 0);
16253
+ return { action: "continue", result: mergeDrainResults(args.aggregate, args.result) };
16254
+ }
16255
+ this.setFailureCount(args.bufferKey, args.chunk, failures);
16256
+ return { action: "return", result: mergeDrainResults(args.aggregate, args.result) };
16257
+ }
16258
+ /** Greedy chunking sized by the RENDERED conversation (the oracle the model */
16259
+ chunkByRenderedSize(turns, budgetChars) {
16260
+ const measure = this.deps.measureRenderedTurns;
16261
+ const chunks = [];
16262
+ let current = [];
16263
+ for (const turn of turns) {
16264
+ if (current.length > 0 && measure([...current, turn]) > budgetChars) {
16265
+ chunks.push(current);
16266
+ current = [];
16267
+ }
16268
+ current.push(turn);
16269
+ }
16270
+ if (current.length > 0) chunks.push(current);
16271
+ return chunks;
16272
+ }
16137
16273
  /** Side-file copy first (content survives a failed drop), then remove the failing chunk from the buffer. Never throws:
16138
16274
  * the drop must not fail the extraction task that already settled its result. */
16139
16275
  async dropFailedChunk(bufferKey, chunk, dropAfter, result, byIdentity) {
16140
16276
  const reason = `dropped after ${dropAfter} repeated extraction failures (last result: status=${result.status} reason=${result.reason ?? "n/a"})`;
16141
- try {
16142
- const storage = await this.deps.getStorage();
16143
- const path42 = await storage.saveDroppedExtractionChunk(bufferKey, reason, chunk);
16144
- log.warn(`buffer[${bufferKey}]: dropping ${chunk.length} turns \u2014 ${reason}; copy saved to ${path42}`);
16145
- } catch (err) {
16146
- log.warn(
16147
- `buffer[${bufferKey}]: could not save the dropped-chunk recovery copy; keeping the chunk in the buffer: ${describeError(err)}`
16148
- );
16149
- return false;
16150
- }
16277
+ const copyPath = await this.saveRecoveryCopy(bufferKey, reason, chunk);
16278
+ if (copyPath === null) return false;
16279
+ log.warn(`buffer[${bufferKey}]: dropping ${chunk.length} turns \u2014 ${reason}; copy saved to ${copyPath}`);
16151
16280
  try {
16152
16281
  const dropped = await this.deps.buffer.dropExtractionChunk(bufferKey, chunk, { allowNonPrefix: byIdentity });
16153
16282
  if (dropped > 0) {
@@ -16162,6 +16291,19 @@ var ExtractionDrain = class {
16162
16291
  }
16163
16292
  return false;
16164
16293
  }
16294
+ /** The recovery side-file copy for a dropped chunk. null = the copy could
16295
+ * not be written — the caller must keep the only buffered copy. */
16296
+ async saveRecoveryCopy(bufferKey, reason, chunk) {
16297
+ try {
16298
+ const storage = await this.deps.getStorage();
16299
+ return await storage.saveDroppedExtractionChunk(bufferKey, reason, chunk);
16300
+ } catch (err) {
16301
+ log.warn(
16302
+ `buffer[${bufferKey}]: could not save the dropped-chunk recovery copy; keeping the chunk in the buffer: ${describeError(err)}`
16303
+ );
16304
+ return null;
16305
+ }
16306
+ }
16165
16307
  };
16166
16308
 
16167
16309
  // src/orchestration/buffer-drain-gate.ts
@@ -16177,6 +16319,39 @@ function skipClaimedSession(buffer, bufferKey, settle) {
16177
16319
  return true;
16178
16320
  }
16179
16321
 
16322
+ // src/orchestration/extraction-task-queueing.ts
16323
+ function queueBufferedCaptureScopeGroups(queueBufferedExtraction, extractionTurns, bufferKey, options) {
16324
+ for (const group of groupTurnsByExtractionScope(extractionTurns)) {
16325
+ const groupIsAccepted = group.turns.some((turn) => turn.acceptedCapture === true);
16326
+ if (!groupIsAccepted) {
16327
+ void queueBufferedExtraction(group.turns, "trigger_mode", {
16328
+ bufferKey,
16329
+ clearMatchingTurns: true,
16330
+ preemptable: true
16331
+ }).catch((err) => log.error(`native trigger extraction failed: ${err}`));
16332
+ continue;
16333
+ }
16334
+ const { promise: extraction, resolve, reject } = Promise.withResolvers();
16335
+ void queueBufferedExtraction(group.turns, "trigger_mode", {
16336
+ bufferKey,
16337
+ clearBufferAfterExtraction: true,
16338
+ clearMatchingTurns: true,
16339
+ skipDedupeCheck: true,
16340
+ skipCharThreshold: true,
16341
+ skipUserTurnThreshold: true,
16342
+ abortSignal: options.abortSignal,
16343
+ extractionDeadlineMs: options.deadlineMs,
16344
+ writeNamespaceOverride: group.writeNamespaceOverride,
16345
+ principalOverride: group.principalOverride,
16346
+ scopeProfileWritePlan: group.scopeProfileWritePlan ?? null,
16347
+ preemptable: true,
16348
+ onTaskSettled: (err) => err ? reject(err) : resolve()
16349
+ }).catch(reject);
16350
+ if (options.onExtractionQueued) options.onExtractionQueued(extraction);
16351
+ else extraction.catch((err) => log.error(`buffered capture extraction failed: ${err}`));
16352
+ }
16353
+ }
16354
+
16180
16355
  // src/orchestration/turn-ingestion.ts
16181
16356
  var ReplayAdmissionRefusedError = class extends Error {
16182
16357
  constructor(message) {
@@ -16228,7 +16403,7 @@ var TurnIngestionCoordinator = class {
16228
16403
  if (outcome.decision === "keep_buffering") return;
16229
16404
  if (!outcome.extractionTurns) return;
16230
16405
  if (outcome.extractionTurns.some((turn2) => turn2.acceptedCapture === true)) {
16231
- this.queueBufferedCaptureScopeGroups(outcome.extractionTurns, bufferKey, {});
16406
+ queueBufferedCaptureScopeGroups(this.deps.queueBufferedExtraction, outcome.extractionTurns, bufferKey, {});
16232
16407
  return;
16233
16408
  }
16234
16409
  await this.deps.queueBufferedExtraction(
@@ -16364,48 +16539,17 @@ var TurnIngestionCoordinator = class {
16364
16539
  );
16365
16540
  }
16366
16541
  if (outcome.decision !== "keep_buffering" && outcome.extractionTurns) {
16367
- this.queueBufferedCaptureScopeGroups(outcome.extractionTurns, bufferKey, options);
16542
+ queueBufferedCaptureScopeGroups(
16543
+ this.deps.queueBufferedExtraction,
16544
+ outcome.extractionTurns,
16545
+ bufferKey,
16546
+ options
16547
+ );
16368
16548
  }
16369
16549
  }
16370
16550
  await this.deps.buffer.flushPendingSave({ throwOnFailure: true });
16371
16551
  }
16372
16552
  }
16373
- /**
16374
- * Buffer-approved captures skip threshold/dedupe rechecks, not provider retry cooldowns.
16375
- * Scope and staleness are enforced at the shared queueBufferedExtraction boundary.
16376
- */
16377
- queueBufferedCaptureScopeGroups(extractionTurns, bufferKey, options) {
16378
- for (const group of groupTurnsByExtractionScope(extractionTurns)) {
16379
- const groupIsAccepted = group.turns.some((turn) => turn.acceptedCapture === true);
16380
- if (!groupIsAccepted) {
16381
- void this.deps.queueBufferedExtraction(group.turns, "trigger_mode", {
16382
- bufferKey,
16383
- clearMatchingTurns: true,
16384
- preemptable: true
16385
- }).catch((err) => log.error(`native trigger extraction failed: ${err}`));
16386
- continue;
16387
- }
16388
- const extraction = new Promise((resolve, reject) => {
16389
- void this.deps.queueBufferedExtraction(group.turns, "trigger_mode", {
16390
- bufferKey,
16391
- clearBufferAfterExtraction: true,
16392
- clearMatchingTurns: true,
16393
- skipDedupeCheck: true,
16394
- skipCharThreshold: true,
16395
- skipUserTurnThreshold: true,
16396
- abortSignal: options.abortSignal,
16397
- extractionDeadlineMs: options.deadlineMs,
16398
- writeNamespaceOverride: group.writeNamespaceOverride,
16399
- principalOverride: group.principalOverride,
16400
- scopeProfileWritePlan: group.scopeProfileWritePlan ?? null,
16401
- preemptable: true,
16402
- onTaskSettled: (err) => err ? reject(err) : resolve()
16403
- }).catch(reject);
16404
- });
16405
- if (options.onExtractionQueued) options.onExtractionQueued(extraction);
16406
- else extraction.catch((err) => log.error(`buffered capture extraction failed: ${err}`));
16407
- }
16408
- }
16409
16553
  /**
16410
16554
  * Ingest a batch of bulk-import turns (#460). Like ingestReplayBatch, this
16411
16555
  * normalizes user/assistant turns into the extraction buffer and awaits
@@ -16625,7 +16769,7 @@ var TurnIngestionCoordinator = class {
16625
16769
  `heartbeat observer trigger: session=${sessionKey} deltaBytes=${decision.deltaBytes} deltaTokens=${decision.deltaTokens}`
16626
16770
  );
16627
16771
  if (turns.some((turn) => turn.acceptedCapture === true)) {
16628
- this.queueBufferedCaptureScopeGroups(turns, bufferKey, {});
16772
+ queueBufferedCaptureScopeGroups(this.deps.queueBufferedExtraction, turns, bufferKey, {});
16629
16773
  return;
16630
16774
  }
16631
16775
  await this.deps.queueBufferedExtraction(turns, "heartbeat_observer", {
@@ -16644,7 +16788,7 @@ var TurnIngestionCoordinator = class {
16644
16788
  }
16645
16789
  async queueBufferedExtraction(turnsToExtract, reason, options = {}) {
16646
16790
  const bufferKey = options.bufferKey ?? turnsToExtract[0]?.sessionKey ?? "default";
16647
- if (skipClaimedSession(this.deps.buffer, bufferKey, (result) => options.onTaskSettled?.(void 0, result))) return;
16791
+ if (skipClaimedSession(options.execution?.buffer ?? this.deps.buffer, bufferKey, (result) => options.onTaskSettled?.(void 0, result))) return;
16648
16792
  if (!options.skipDedupeCheck && !this.deps.shouldQueueExtraction(turnsToExtract, { bufferKey })) {
16649
16793
  log.debug(`extraction dedupe skip: preserving buffer (${reason})`);
16650
16794
  options.onTaskSettled?.(void 0, {
@@ -16710,132 +16854,139 @@ var TurnIngestionCoordinator = class {
16710
16854
  if (settled) return;
16711
16855
  const preemptable = options.preemptable === true && options.preemptRunning !== true;
16712
16856
  const accepted = this.deps.extractionQueueCoordinator.enqueue(async (preemptHandle) => {
16713
- await this.deps.extractionQueueCoordinator.runPreemptable(preemptHandle, preemptable, options.abortSignal, async (abortSignal) => {
16714
- if (settled) return;
16715
- if (typeof extractionDeadlineMs === "number" && extractionDeadlineMs <= Date.now()) {
16716
- settleTask(new ExtractionDeadlineError("queue_wait"));
16717
- return;
16718
- }
16719
- clearQueueWaitTimer();
16720
- try {
16721
- let effectiveTurns = turnsToExtract;
16722
- let effectiveScopePlan = options.scopeProfileWritePlan;
16723
- if (effectiveTurns.some((turn) => turn.acceptedCapture === true)) {
16724
- const liveTurns = this.deps.buffer.getTurns(bufferKey).filter((live) => effectiveTurns.some((snapshotted) => bufferTurnsEqual(live, snapshotted)));
16725
- if (liveTurns.length === 0) {
16726
- settleTask(void 0, {
16727
- status: "skipped",
16728
- reason: "already_drained",
16729
- persistedCount: 0,
16730
- durableOutputCount: 0
16731
- });
16732
- return;
16733
- }
16734
- effectiveTurns = liveTurns;
16735
- const namespacesOn = resolveNamespaceCapabilities(this.deps.config).namespaces === true;
16736
- const acceptedTurn = effectiveTurns.find((turn) => turn.acceptedCapture === true);
16737
- const pinnedNamespace = acceptedTurn?.writeNamespaceOverride;
16738
- const policySkipError = (reason2) => options.failOnExtractionFailure === true ? new Error(`accepted capture preserved: ${reason2} (${bufferKey})`) : void 0;
16739
- if (!namespacesOn && pinnedNamespace !== void 0 && pinnedNamespace !== this.deps.config.defaultNamespace) {
16740
- const err = policySkipError("pinned_namespace_unavailable");
16741
- if (err) {
16742
- settleTask(err);
16743
- return;
16744
- }
16745
- settleTask(void 0, {
16746
- status: "skipped",
16747
- reason: "pinned_namespace_unavailable",
16748
- persistedCount: 0,
16749
- durableOutputCount: 0
16750
- });
16751
- return;
16752
- }
16753
- const firstSessionKey = effectiveTurns[0]?.sessionKey ?? "";
16754
- const principal = options.principalOverride !== void 0 && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(firstSessionKey, this.deps.config);
16755
- if (namespacesOn && pinnedNamespace !== void 0 && !effectiveScopePlan) {
16756
- const originalContext = acceptedTurn?.codingContext ?? null;
16757
- const overlay = originalContext ? resolveCodingNamespaceOverlay(
16758
- originalContext,
16759
- this.deps.config.codingMode,
16760
- this.deps.config.defaultNamespace
16761
- ) : null;
16762
- const baseNamespace = defaultNamespaceForPrincipal(principal, this.deps.config);
16763
- const projectNamespace = overlay && this.deps.config.codingMode ? combineNamespaces(baseNamespace, overlay.namespace) : void 0;
16764
- const writeAuthorized = projectNamespace === pinnedNamespace ? hasExplicitNamespacePolicy(pinnedNamespace, this.deps.config) ? canWriteNamespace(principal, pinnedNamespace, this.deps.config) : canWriteNamespace(principal, baseNamespace, this.deps.config) : canWriteNamespace(principal, pinnedNamespace, this.deps.config);
16765
- if (!writeAuthorized) {
16766
- const err = policySkipError("namespace_write_revoked");
16767
- if (err) {
16768
- settleTask(err);
16769
- return;
16770
- }
16857
+ try {
16858
+ await this.deps.extractionQueueCoordinator.runPreemptable(preemptHandle, preemptable, options.abortSignal, async (abortSignal) => {
16859
+ if (settled) return;
16860
+ if (typeof extractionDeadlineMs === "number" && extractionDeadlineMs <= Date.now()) {
16861
+ settleTask(new ExtractionDeadlineError("queue_wait"));
16862
+ return;
16863
+ }
16864
+ clearQueueWaitTimer();
16865
+ if (options.execution === void 0 && skipClaimedSession(this.deps.buffer, bufferKey, (result) => settleTask(void 0, result))) return;
16866
+ try {
16867
+ let effectiveTurns = turnsToExtract;
16868
+ let effectiveScopePlan = options.scopeProfileWritePlan;
16869
+ const executionBuffer = options.execution?.buffer;
16870
+ if (effectiveTurns.some((turn) => turn.acceptedCapture === true)) {
16871
+ const liveTurns = (executionBuffer ?? this.deps.buffer).getTurns(bufferKey).filter((live) => effectiveTurns.some((snapshotted) => bufferTurnsEqual(live, snapshotted)));
16872
+ if (liveTurns.length === 0) {
16771
16873
  settleTask(void 0, {
16772
16874
  status: "skipped",
16773
- reason: "namespace_write_revoked",
16875
+ reason: "already_drained",
16774
16876
  persistedCount: 0,
16775
16877
  durableOutputCount: 0
16776
16878
  });
16777
16879
  return;
16778
16880
  }
16779
- }
16780
- if (effectiveScopePlan) {
16781
- const originalContext = acceptedTurn?.codingContext ?? null;
16782
- const codingOverlay = originalContext ? resolveCodingNamespaceOverlay(
16783
- originalContext,
16784
- this.deps.config.codingMode,
16785
- this.deps.config.defaultNamespace
16786
- ) : null;
16787
- const fresh = resolveScopeProfilePlan({
16788
- config: this.deps.config,
16789
- principal,
16790
- codingContext: originalContext,
16791
- codingOverlay
16792
- });
16793
- const identityHolds = fresh !== null && fresh.profileId === effectiveScopePlan.profileId && fresh.writeLayer === effectiveScopePlan.writeLayer && fresh.writeNamespace === effectiveScopePlan.writeNamespace;
16794
- if (!identityHolds) {
16795
- const err = policySkipError("scope_profile_revoked");
16881
+ effectiveTurns = liveTurns;
16882
+ const namespacesOn = resolveNamespaceCapabilities(this.deps.config).namespaces === true;
16883
+ const acceptedTurn = effectiveTurns.find((turn) => turn.acceptedCapture === true);
16884
+ const pinnedNamespace = acceptedTurn?.writeNamespaceOverride;
16885
+ const policySkipError = (reason2) => options.failOnExtractionFailure === true ? new Error(`accepted capture preserved: ${reason2} (${bufferKey})`) : void 0;
16886
+ if (!namespacesOn && pinnedNamespace !== void 0 && pinnedNamespace !== this.deps.config.defaultNamespace) {
16887
+ const err = policySkipError("pinned_namespace_unavailable");
16796
16888
  if (err) {
16797
16889
  settleTask(err);
16798
16890
  return;
16799
16891
  }
16800
16892
  settleTask(void 0, {
16801
16893
  status: "skipped",
16802
- reason: "scope_profile_revoked",
16894
+ reason: "pinned_namespace_unavailable",
16803
16895
  persistedCount: 0,
16804
16896
  durableOutputCount: 0
16805
16897
  });
16806
16898
  return;
16807
16899
  }
16808
- effectiveScopePlan = fresh;
16900
+ const firstSessionKey = effectiveTurns[0]?.sessionKey ?? "";
16901
+ const principal = options.principalOverride !== void 0 && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(firstSessionKey, this.deps.config);
16902
+ if (namespacesOn && pinnedNamespace !== void 0 && !effectiveScopePlan) {
16903
+ const originalContext = acceptedTurn?.codingContext ?? null;
16904
+ const overlay = originalContext ? resolveCodingNamespaceOverlay(
16905
+ originalContext,
16906
+ this.deps.config.codingMode,
16907
+ this.deps.config.defaultNamespace
16908
+ ) : null;
16909
+ const baseNamespace = defaultNamespaceForPrincipal(principal, this.deps.config);
16910
+ const projectNamespace = overlay && this.deps.config.codingMode ? combineNamespaces(baseNamespace, overlay.namespace) : void 0;
16911
+ const writeAuthorized = projectNamespace === pinnedNamespace ? hasExplicitNamespacePolicy(pinnedNamespace, this.deps.config) ? canWriteNamespace(principal, pinnedNamespace, this.deps.config) : canWriteNamespace(principal, baseNamespace, this.deps.config) : canWriteNamespace(principal, pinnedNamespace, this.deps.config);
16912
+ if (!writeAuthorized) {
16913
+ const err = policySkipError("namespace_write_revoked");
16914
+ if (err) {
16915
+ settleTask(err);
16916
+ return;
16917
+ }
16918
+ settleTask(void 0, {
16919
+ status: "skipped",
16920
+ reason: "namespace_write_revoked",
16921
+ persistedCount: 0,
16922
+ durableOutputCount: 0
16923
+ });
16924
+ return;
16925
+ }
16926
+ }
16927
+ if (effectiveScopePlan) {
16928
+ const originalContext = acceptedTurn?.codingContext ?? null;
16929
+ const codingOverlay = originalContext ? resolveCodingNamespaceOverlay(
16930
+ originalContext,
16931
+ this.deps.config.codingMode,
16932
+ this.deps.config.defaultNamespace
16933
+ ) : null;
16934
+ const fresh = resolveScopeProfilePlan({
16935
+ config: this.deps.config,
16936
+ principal,
16937
+ codingContext: originalContext,
16938
+ codingOverlay
16939
+ });
16940
+ const identityHolds = fresh !== null && fresh.profileId === effectiveScopePlan.profileId && fresh.writeLayer === effectiveScopePlan.writeLayer && fresh.writeNamespace === effectiveScopePlan.writeNamespace;
16941
+ if (!identityHolds) {
16942
+ const err = policySkipError("scope_profile_revoked");
16943
+ if (err) {
16944
+ settleTask(err);
16945
+ return;
16946
+ }
16947
+ settleTask(void 0, {
16948
+ status: "skipped",
16949
+ reason: "scope_profile_revoked",
16950
+ persistedCount: 0,
16951
+ durableOutputCount: 0
16952
+ });
16953
+ return;
16954
+ }
16955
+ effectiveScopePlan = fresh;
16956
+ }
16957
+ }
16958
+ const result = await (options.execution?.drain ?? this.drain).run(effectiveTurns, {
16959
+ clearBufferAfterExtraction: options.clearBufferAfterExtraction ?? true,
16960
+ clearMatchingTurns: options.clearMatchingTurns === true,
16961
+ skipCharThreshold: options.skipCharThreshold ?? false,
16962
+ skipUserTurnThreshold: options.skipUserTurnThreshold ?? false,
16963
+ deadlineMs: extractionDeadlineMs,
16964
+ bufferKey,
16965
+ onDurableCommit: options.onDurableCommit,
16966
+ onBeforePersist: () => preemptHandle?.disarm(),
16967
+ abortSignal,
16968
+ failOnExtractionFailure: options.failOnExtractionFailure === true,
16969
+ writeNamespaceOverride: options.writeNamespaceOverride,
16970
+ principalOverride: options.principalOverride,
16971
+ scopeProfileWritePlan: effectiveScopePlan,
16972
+ forceExtractionAttempt: options.forceExtractionAttempt === true
16973
+ }, preemptable, preemptHandle);
16974
+ settleTask(void 0, result);
16975
+ } catch (err) {
16976
+ const reason2 = abortSignal.reason;
16977
+ const settledError = reason2 instanceof Error && isPreemptedExtraction(reason2) ? reason2 : err;
16978
+ if (settleTask(settledError)) {
16979
+ throw settledError;
16809
16980
  }
16810
16981
  }
16811
- const result = await this.drain.run(effectiveTurns, {
16812
- clearBufferAfterExtraction: options.clearBufferAfterExtraction ?? true,
16813
- clearMatchingTurns: options.clearMatchingTurns === true,
16814
- skipCharThreshold: options.skipCharThreshold ?? false,
16815
- skipUserTurnThreshold: options.skipUserTurnThreshold ?? false,
16816
- deadlineMs: extractionDeadlineMs,
16817
- bufferKey,
16818
- onDurableCommit: options.onDurableCommit,
16819
- onBeforePersist: () => preemptHandle?.disarm(),
16820
- abortSignal,
16821
- failOnExtractionFailure: options.failOnExtractionFailure === true,
16822
- writeNamespaceOverride: options.writeNamespaceOverride,
16823
- principalOverride: options.principalOverride,
16824
- scopeProfileWritePlan: effectiveScopePlan,
16825
- forceExtractionAttempt: options.forceExtractionAttempt === true
16826
- }, preemptable, preemptHandle);
16827
- settleTask(void 0, result);
16828
- } catch (err) {
16829
- const reason2 = abortSignal.reason;
16830
- const settledError = reason2 instanceof Error && isPreemptedExtraction(reason2) ? reason2 : err;
16831
- if (settleTask(settledError)) {
16832
- throw settledError;
16833
- }
16834
- }
16835
- });
16982
+ });
16983
+ } finally {
16984
+ options.onTaskExit?.();
16985
+ }
16836
16986
  }, { front: options.preemptRunning === true, key: bufferKey });
16837
16987
  if (!accepted) {
16838
16988
  settleTask(new Error("extraction queue is stopped"));
16989
+ options.onTaskExit?.();
16839
16990
  return;
16840
16991
  }
16841
16992
  log.debug(`queued extraction from ${reason}`);
@@ -22275,29 +22426,50 @@ var Orchestrator = class {
22275
22426
  }
22276
22427
  extractionQueueCoordinator;
22277
22428
  _extractionRunCoordinator;
22429
+ _providerBreaker;
22430
+ /** One breaker per orchestrator: foreground and every isolated claim-backed
22431
+ * drain accumulate toward the same threshold and honor each other's open
22432
+ * state (review round — isolated coordinators must not reset
22433
+ * provider resilience). */
22434
+ get providerBreaker() {
22435
+ if (!this._providerBreaker) this._providerBreaker = new ProviderCircuitBreaker();
22436
+ return this._providerBreaker;
22437
+ }
22438
+ /** The run-coordinator deps bundle, parameterized by its buffer accessor so
22439
+ * an isolated claim-backed drain can bind its own SmartBuffer (the daemon
22440
+ * backlog scheduler) while live extraction keeps `this.buffer`. */
22441
+ extractionRunDeps(getBuffer) {
22442
+ return {
22443
+ config: this.config,
22444
+ getBuffer,
22445
+ providerBreaker: this.providerBreaker,
22446
+ getExtraction: () => this.extraction,
22447
+ getStorageRouter: () => this.storageRouter,
22448
+ getThreading: () => this.threading,
22449
+ persistExtraction: (result, storage, threadId, sourceContext, baseNamespace, scopeProfileWritePlan, sourceText, graphCaps, lifecycleCaps) => this.persistExtraction(result, storage, threadId, sourceContext, baseNamespace, scopeProfileWritePlan, sourceText, graphCaps, lifecycleCaps),
22450
+ maybeCapturePassiveCorrections: (turns, opts) => this.maybeCapturePassiveCorrections(turns, opts),
22451
+ resolveSelfNamespace: (sessionKey) => this.resolveSelfNamespace(sessionKey),
22452
+ getCodingContextForSession: (sessionKey) => this.getCodingContextForSession(sessionKey),
22453
+ applyCodingNamespaceOverlay: (sessionKey, namespace) => this.applyCodingNamespaceOverlay(sessionKey, namespace),
22454
+ boxBuilderFor: (storage) => this.boxBuilderFor(storage),
22455
+ appendPersistedThreadEpisodes: (threadId, ids, pendingReviewIds) => this.appendPersistedThreadEpisodes(threadId, ids, pendingReviewIds),
22456
+ maybeScheduleConsolidation: (nonZero) => this.maybeScheduleConsolidation(nonZero),
22457
+ requestQmdMaintenance: () => this.requestQmdMaintenance(),
22458
+ runTierMigrationCycle: (storage, trigger, options) => this.runTierMigrationCycle(storage, trigger, options),
22459
+ recordProcessedExtractionFingerprint: (storage, fingerprint, preloadedMeta) => this.recordProcessedExtractionFingerprint(storage, fingerprint, preloadedMeta)
22460
+ };
22461
+ }
22278
22462
  get extractionRunCoordinator() {
22279
22463
  if (!this._extractionRunCoordinator) {
22280
- this._extractionRunCoordinator = new ExtractionRunCoordinator({
22281
- config: this.config,
22282
- getBuffer: () => this.buffer,
22283
- getExtraction: () => this.extraction,
22284
- getStorageRouter: () => this.storageRouter,
22285
- getThreading: () => this.threading,
22286
- persistExtraction: (result, storage, threadId, sourceContext, baseNamespace, scopeProfileWritePlan, sourceText, graphCaps, lifecycleCaps) => this.persistExtraction(result, storage, threadId, sourceContext, baseNamespace, scopeProfileWritePlan, sourceText, graphCaps, lifecycleCaps),
22287
- maybeCapturePassiveCorrections: (turns, opts) => this.maybeCapturePassiveCorrections(turns, opts),
22288
- resolveSelfNamespace: (sessionKey) => this.resolveSelfNamespace(sessionKey),
22289
- getCodingContextForSession: (sessionKey) => this.getCodingContextForSession(sessionKey),
22290
- applyCodingNamespaceOverlay: (sessionKey, namespace) => this.applyCodingNamespaceOverlay(sessionKey, namespace),
22291
- boxBuilderFor: (storage) => this.boxBuilderFor(storage),
22292
- appendPersistedThreadEpisodes: (threadId, ids, pendingReviewIds) => this.appendPersistedThreadEpisodes(threadId, ids, pendingReviewIds),
22293
- maybeScheduleConsolidation: (nonZero) => this.maybeScheduleConsolidation(nonZero),
22294
- requestQmdMaintenance: () => this.requestQmdMaintenance(),
22295
- runTierMigrationCycle: (storage, trigger, options) => this.runTierMigrationCycle(storage, trigger, options),
22296
- recordProcessedExtractionFingerprint: (storage, fingerprint, preloadedMeta) => this.recordProcessedExtractionFingerprint(storage, fingerprint, preloadedMeta)
22297
- });
22464
+ this._extractionRunCoordinator = new ExtractionRunCoordinator(this.extractionRunDeps(() => this.buffer));
22298
22465
  }
22299
22466
  return this._extractionRunCoordinator;
22300
22467
  }
22468
+ /** An extraction run coordinator bound to `buffer` — per drain task, so a
22469
+ * claim-backed drain never shares the live buffer's mutable state. */
22470
+ extractionRunCoordinatorForBuffer(buffer) {
22471
+ return new ExtractionRunCoordinator(this.extractionRunDeps(() => buffer));
22472
+ }
22301
22473
  _consolidationRunCoordinator;
22302
22474
  get consolidationRunCoordinator() {
22303
22475
  if (!this._consolidationRunCoordinator) {
@@ -31906,8 +32078,9 @@ export {
31906
32078
  mergeGraphExpandedResults,
31907
32079
  graphPathRelativeToStorage,
31908
32080
  blendGraphExpandedRecallScore,
32081
+ ExtractionDrain,
31909
32082
  TurnIngestionCoordinator,
31910
32083
  qmdStartupCollectionChecksWithTimeout,
31911
32084
  Orchestrator
31912
32085
  };
31913
- //# sourceMappingURL=chunk-DDBB55L2.js.map
32086
+ //# sourceMappingURL=chunk-DSSTOV5M.js.map