@remnic/core 10.0.70 → 10.0.72

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 (231) hide show
  1. package/dist/access-admin-ops-surface.js +14 -14
  2. package/dist/access-authorization-probe.js +15 -15
  3. package/dist/access-boundary.js +14 -14
  4. package/dist/access-cli.js +58 -58
  5. package/dist/access-extraction-force-flush.js +14 -14
  6. package/dist/access-http-briefing.js +15 -15
  7. package/dist/access-http-query.js +16 -16
  8. package/dist/access-http.js +31 -31
  9. package/dist/access-identity-continuity-surface.js +14 -14
  10. package/dist/access-lcm-surface.js +14 -14
  11. package/dist/access-mcp.js +24 -24
  12. package/dist/access-namespace-preflight.js +14 -14
  13. package/dist/access-observe-write-surface.js +14 -14
  14. package/dist/access-operations-batch.js +16 -16
  15. package/dist/access-operations.js +23 -23
  16. package/dist/access-recall-concurrency.js +14 -14
  17. package/dist/access-recall-response.js +14 -14
  18. package/dist/access-recall-surface.js +14 -14
  19. package/dist/access-service.js +14 -14
  20. package/dist/access-surface-catalog.js +16 -16
  21. package/dist/active-recall.js +3 -3
  22. package/dist/briefing.js +4 -4
  23. package/dist/buffer-turn-helpers.d.ts +10 -1
  24. package/dist/buffer-turn-helpers.d.ts.map +1 -1
  25. package/dist/buffer-turn-helpers.js +3 -1
  26. package/dist/buffer.d.ts +4 -0
  27. package/dist/buffer.d.ts.map +1 -1
  28. package/dist/buffer.js +3 -3
  29. package/dist/causal-consolidation.js +5 -5
  30. package/dist/{chunk-B7YAIHAV.js → chunk-23BA3USG.js} +10 -10
  31. package/dist/{chunk-3F7N4I5I.js → chunk-2R44BBPK.js} +2 -2
  32. package/dist/{chunk-BW33YTF3.js → chunk-2WPWEVAH.js} +2 -2
  33. package/dist/{chunk-EF3HNVL4.js → chunk-4PMFSYH7.js} +2 -2
  34. package/dist/{chunk-J5TVHCDG.js → chunk-5ORJHH43.js} +2 -2
  35. package/dist/{chunk-MK7HXGM6.js → chunk-6KBCUIZP.js} +2 -2
  36. package/dist/{chunk-OX6GY22Q.js → chunk-7P5VBRBS.js} +2 -2
  37. package/dist/{chunk-3AASGFR4.js → chunk-7WFY2L5J.js} +3 -3
  38. package/dist/{chunk-YLMTFRZR.js → chunk-AGRMXXVA.js} +2 -2
  39. package/dist/{chunk-WIW4LOZL.js → chunk-AZNE2H6D.js} +2 -2
  40. package/dist/{chunk-GT4G2S2Y.js → chunk-BCBY5GYZ.js} +2 -2
  41. package/dist/{chunk-EIZ4MK33.js → chunk-BTU77RB5.js} +2 -2
  42. package/dist/{chunk-ZS5LREUZ.js → chunk-DC3DWF2M.js} +2 -2
  43. package/dist/{chunk-LTST4R7U.js → chunk-DE4U5PTV.js} +49 -45
  44. package/dist/chunk-DE4U5PTV.js.map +1 -0
  45. package/dist/{chunk-OAQO5AZJ.js → chunk-DSSTOV5M.js} +440 -267
  46. package/dist/chunk-DSSTOV5M.js.map +1 -0
  47. package/dist/{chunk-VDYRXI3E.js → chunk-EGKDONTC.js} +9 -3
  48. package/dist/chunk-EGKDONTC.js.map +1 -0
  49. package/dist/{chunk-FM6UKZAE.js → chunk-EQ6EMJRG.js} +2 -2
  50. package/dist/{chunk-TSZP7GGJ.js → chunk-FGGLVCHI.js} +2 -2
  51. package/dist/{chunk-K7LLGCPH.js → chunk-GXAZ4Q2S.js} +2 -2
  52. package/dist/{chunk-2GV24KFD.js → chunk-H2X32F2K.js} +2 -2
  53. package/dist/{chunk-2YPIFJHL.js → chunk-ICBUTKLL.js} +2 -2
  54. package/dist/{chunk-3W37NITP.js → chunk-IQXQ3KWR.js} +2 -2
  55. package/dist/{chunk-HNF7IMYQ.js → chunk-J72ZY7NU.js} +2 -2
  56. package/dist/{chunk-6QS5NQJH.js → chunk-JGLZ46JS.js} +2 -2
  57. package/dist/{chunk-MRN2MKB7.js → chunk-JY4LXMZR.js} +2 -2
  58. package/dist/{chunk-UJ2FP2RV.js → chunk-KY3KJUNN.js} +2 -2
  59. package/dist/{chunk-64U42JL5.js → chunk-LHMCZ6VW.js} +10 -10
  60. package/dist/{chunk-YRMSHA7H.js → chunk-LN7CWLAU.js} +2 -2
  61. package/dist/{chunk-XR4QR3JT.js → chunk-LYOCAUI6.js} +3 -3
  62. package/dist/{chunk-VA3GNAWQ.js → chunk-LZIOY7ZU.js} +4 -5
  63. package/dist/chunk-LZIOY7ZU.js.map +1 -0
  64. package/dist/{chunk-GMSRLDVR.js → chunk-N2Y6COEM.js} +2 -2
  65. package/dist/{chunk-XDUP6SWG.js → chunk-OGQGDOYK.js} +2 -2
  66. package/dist/{chunk-U7MIMS2Y.js → chunk-OUBEJWVI.js} +17 -1
  67. package/dist/chunk-OUBEJWVI.js.map +1 -0
  68. package/dist/{chunk-5FMGPV34.js → chunk-OWZXDBV4.js} +2 -2
  69. package/dist/{chunk-SQO5SEKA.js → chunk-PJAMFIDE.js} +3 -3
  70. package/dist/{chunk-I6HRHJRA.js → chunk-QIOQI7QZ.js} +2 -2
  71. package/dist/{chunk-OAKOAOEG.js → chunk-QUPTDKSX.js} +22 -22
  72. package/dist/{chunk-MCFI6G7U.js → chunk-QVZZE6VH.js} +3 -3
  73. package/dist/{chunk-LYTKNK5O.js → chunk-S37O4S6E.js} +2 -2
  74. package/dist/{chunk-ILD7N3XC.js → chunk-S73ZVU37.js} +2 -2
  75. package/dist/{chunk-5VQSKBNF.js → chunk-U6IL4724.js} +2 -2
  76. package/dist/{chunk-D3AGBN6G.js → chunk-UAOJVQXC.js} +2 -2
  77. package/dist/{chunk-MKMIY3E7.js → chunk-UE5JYPU6.js} +7 -7
  78. package/dist/{chunk-K47G2CBP.js → chunk-USX5YIKB.js} +5 -5
  79. package/dist/{chunk-YIG4HPY4.js → chunk-VK5HKVQ7.js} +2 -2
  80. package/dist/{chunk-ZOBYTRBU.js → chunk-VNTQU6KB.js} +47 -2
  81. package/dist/chunk-VNTQU6KB.js.map +1 -0
  82. package/dist/{chunk-THFSCUFC.js → chunk-VSJ3ARFS.js} +2 -2
  83. package/dist/{chunk-4BOBW6H4.js → chunk-W4V7P5HP.js} +2 -2
  84. package/dist/{chunk-DM3UZUCN.js → chunk-WNQ3B3Q5.js} +2 -2
  85. package/dist/{chunk-MFKBYXBY.js → chunk-WYOHQJKC.js} +6 -6
  86. package/dist/{chunk-66PEACZP.js → chunk-X4DHAXFO.js} +3 -3
  87. package/dist/{chunk-ZYEWTVNQ.js → chunk-XPZM7GP6.js} +7 -7
  88. package/dist/{chunk-2BBMCMJS.js → chunk-YPYSC3TX.js} +2 -2
  89. package/dist/{chunk-JGQEF33K.js → chunk-ZBET3W26.js} +2 -2
  90. package/dist/chunk-ZODKV27J.js +443 -0
  91. package/dist/chunk-ZODKV27J.js.map +1 -0
  92. package/dist/cli.js +43 -43
  93. package/dist/coding/export-okf-codegraph.js +3 -3
  94. package/dist/compounding/engine.js +5 -5
  95. package/dist/config.js +3 -3
  96. package/dist/connectors/codex-materialize-runner.js +4 -4
  97. package/dist/connectors/index.js +4 -4
  98. package/dist/convergence-refresh.js +6 -6
  99. package/dist/corpus-watermark.js +6 -6
  100. package/dist/entity-retrieval.js +4 -4
  101. package/dist/external-wiki-access.js +15 -15
  102. package/dist/extraction-window-drain.d.ts.map +1 -1
  103. package/dist/extraction-window-drain.js +1 -1
  104. package/dist/extraction.js +7 -7
  105. package/dist/harmonic-retrieval.js +4 -4
  106. package/dist/index.js +58 -58
  107. package/dist/location/index.js +6 -6
  108. package/dist/maintenance/memory-governance.js +4 -4
  109. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
  110. package/dist/maintenance/rebuild-memory-projection-runner.js +6 -6
  111. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  112. package/dist/memory-browse-operations.js +15 -15
  113. package/dist/namespaces/migrate.js +5 -5
  114. package/dist/namespaces/storage.js +4 -4
  115. package/dist/operator-doctor-corpus.js +7 -7
  116. package/dist/operator-toolkit.js +12 -12
  117. package/dist/orchestration/backlog-scheduler.d.ts +151 -0
  118. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -0
  119. package/dist/orchestration/backlog-scheduler.js +891 -0
  120. package/dist/orchestration/backlog-scheduler.js.map +1 -0
  121. package/dist/orchestration/buffer-drain-runner.d.ts +31 -27
  122. package/dist/orchestration/buffer-drain-runner.d.ts.map +1 -1
  123. package/dist/orchestration/buffer-drain-runner.js +64 -269
  124. package/dist/orchestration/buffer-drain-runner.js.map +1 -1
  125. package/dist/orchestration/extraction-drain.d.ts +50 -17
  126. package/dist/orchestration/extraction-drain.d.ts.map +1 -1
  127. package/dist/orchestration/extraction-queue-coordinator.d.ts +19 -1
  128. package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
  129. package/dist/orchestration/extraction-run.d.ts +8 -0
  130. package/dist/orchestration/extraction-run.d.ts.map +1 -1
  131. package/dist/orchestration/extraction-task-queueing.d.ts +44 -0
  132. package/dist/orchestration/extraction-task-queueing.d.ts.map +1 -0
  133. package/dist/orchestration/maintenance.js +14 -14
  134. package/dist/orchestration/turn-ingestion.d.ts +11 -5
  135. package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
  136. package/dist/orchestrator.d.ts +13 -0
  137. package/dist/orchestrator.d.ts.map +1 -1
  138. package/dist/orchestrator.js +59 -59
  139. package/dist/recall-navigation-operations.js +15 -15
  140. package/dist/recall-navigation.js +14 -14
  141. package/dist/resume-bundles.js +3 -3
  142. package/dist/semantic-consolidation.js +5 -5
  143. package/dist/semantic-rule-promotion.js +4 -4
  144. package/dist/semantic-rule-verifier.js +4 -4
  145. package/dist/source-agent-qualifier.js +6 -6
  146. package/dist/standup/build.js +4 -4
  147. package/dist/storage/buffer-drain-claims.d.ts +15 -0
  148. package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
  149. package/dist/storage/buffer-drain-claims.js +2 -2
  150. package/dist/storage/buffer-session-files.js +2 -2
  151. package/dist/storage.js +3 -3
  152. package/dist/support-passport/index.js +17 -17
  153. package/dist/transfer/export-okf.js +4 -4
  154. package/dist/verified-recall.js +4 -4
  155. package/dist/who-knows-cli.js +5 -5
  156. package/dist/who-knows.js +4 -4
  157. package/package.json +12 -2
  158. package/src/backlog-scheduler.test.ts +806 -0
  159. package/src/buffer-drain-handover.test.ts +363 -18
  160. package/src/buffer-drain-inprocess.test.ts +355 -0
  161. package/src/buffer-drain-model-boundary.test.ts +1062 -0
  162. package/src/buffer-drop-extraction-chunk.test.ts +237 -22
  163. package/src/buffer-turn-helpers.ts +26 -1
  164. package/src/buffer.ts +8 -0
  165. package/src/extraction-window-drain.ts +7 -7
  166. package/src/orchestration/backlog-scheduler.ts +481 -0
  167. package/src/orchestration/buffer-drain-runner.ts +545 -180
  168. package/src/orchestration/extraction-drain.ts +287 -108
  169. package/src/orchestration/extraction-queue-coordinator.ts +51 -3
  170. package/src/orchestration/extraction-run.test.ts +41 -0
  171. package/src/orchestration/extraction-run.ts +24 -5
  172. package/src/orchestration/extraction-task-queueing.ts +87 -0
  173. package/src/orchestration/turn-ingestion.ts +46 -59
  174. package/src/orchestrator-extraction-queue.test.ts +46 -2
  175. package/src/orchestrator-flush.test.ts +4 -1
  176. package/src/orchestrator.ts +47 -21
  177. package/src/storage/buffer-drain-claims.ts +55 -0
  178. package/dist/chunk-LTST4R7U.js.map +0 -1
  179. package/dist/chunk-OAQO5AZJ.js.map +0 -1
  180. package/dist/chunk-U7MIMS2Y.js.map +0 -1
  181. package/dist/chunk-VA3GNAWQ.js.map +0 -1
  182. package/dist/chunk-VDYRXI3E.js.map +0 -1
  183. package/dist/chunk-ZOBYTRBU.js.map +0 -1
  184. /package/dist/{chunk-B7YAIHAV.js.map → chunk-23BA3USG.js.map} +0 -0
  185. /package/dist/{chunk-3F7N4I5I.js.map → chunk-2R44BBPK.js.map} +0 -0
  186. /package/dist/{chunk-BW33YTF3.js.map → chunk-2WPWEVAH.js.map} +0 -0
  187. /package/dist/{chunk-EF3HNVL4.js.map → chunk-4PMFSYH7.js.map} +0 -0
  188. /package/dist/{chunk-J5TVHCDG.js.map → chunk-5ORJHH43.js.map} +0 -0
  189. /package/dist/{chunk-MK7HXGM6.js.map → chunk-6KBCUIZP.js.map} +0 -0
  190. /package/dist/{chunk-OX6GY22Q.js.map → chunk-7P5VBRBS.js.map} +0 -0
  191. /package/dist/{chunk-3AASGFR4.js.map → chunk-7WFY2L5J.js.map} +0 -0
  192. /package/dist/{chunk-YLMTFRZR.js.map → chunk-AGRMXXVA.js.map} +0 -0
  193. /package/dist/{chunk-WIW4LOZL.js.map → chunk-AZNE2H6D.js.map} +0 -0
  194. /package/dist/{chunk-GT4G2S2Y.js.map → chunk-BCBY5GYZ.js.map} +0 -0
  195. /package/dist/{chunk-EIZ4MK33.js.map → chunk-BTU77RB5.js.map} +0 -0
  196. /package/dist/{chunk-ZS5LREUZ.js.map → chunk-DC3DWF2M.js.map} +0 -0
  197. /package/dist/{chunk-FM6UKZAE.js.map → chunk-EQ6EMJRG.js.map} +0 -0
  198. /package/dist/{chunk-TSZP7GGJ.js.map → chunk-FGGLVCHI.js.map} +0 -0
  199. /package/dist/{chunk-K7LLGCPH.js.map → chunk-GXAZ4Q2S.js.map} +0 -0
  200. /package/dist/{chunk-2GV24KFD.js.map → chunk-H2X32F2K.js.map} +0 -0
  201. /package/dist/{chunk-2YPIFJHL.js.map → chunk-ICBUTKLL.js.map} +0 -0
  202. /package/dist/{chunk-3W37NITP.js.map → chunk-IQXQ3KWR.js.map} +0 -0
  203. /package/dist/{chunk-HNF7IMYQ.js.map → chunk-J72ZY7NU.js.map} +0 -0
  204. /package/dist/{chunk-6QS5NQJH.js.map → chunk-JGLZ46JS.js.map} +0 -0
  205. /package/dist/{chunk-MRN2MKB7.js.map → chunk-JY4LXMZR.js.map} +0 -0
  206. /package/dist/{chunk-UJ2FP2RV.js.map → chunk-KY3KJUNN.js.map} +0 -0
  207. /package/dist/{chunk-64U42JL5.js.map → chunk-LHMCZ6VW.js.map} +0 -0
  208. /package/dist/{chunk-YRMSHA7H.js.map → chunk-LN7CWLAU.js.map} +0 -0
  209. /package/dist/{chunk-XR4QR3JT.js.map → chunk-LYOCAUI6.js.map} +0 -0
  210. /package/dist/{chunk-GMSRLDVR.js.map → chunk-N2Y6COEM.js.map} +0 -0
  211. /package/dist/{chunk-XDUP6SWG.js.map → chunk-OGQGDOYK.js.map} +0 -0
  212. /package/dist/{chunk-5FMGPV34.js.map → chunk-OWZXDBV4.js.map} +0 -0
  213. /package/dist/{chunk-SQO5SEKA.js.map → chunk-PJAMFIDE.js.map} +0 -0
  214. /package/dist/{chunk-I6HRHJRA.js.map → chunk-QIOQI7QZ.js.map} +0 -0
  215. /package/dist/{chunk-OAKOAOEG.js.map → chunk-QUPTDKSX.js.map} +0 -0
  216. /package/dist/{chunk-MCFI6G7U.js.map → chunk-QVZZE6VH.js.map} +0 -0
  217. /package/dist/{chunk-LYTKNK5O.js.map → chunk-S37O4S6E.js.map} +0 -0
  218. /package/dist/{chunk-ILD7N3XC.js.map → chunk-S73ZVU37.js.map} +0 -0
  219. /package/dist/{chunk-5VQSKBNF.js.map → chunk-U6IL4724.js.map} +0 -0
  220. /package/dist/{chunk-D3AGBN6G.js.map → chunk-UAOJVQXC.js.map} +0 -0
  221. /package/dist/{chunk-MKMIY3E7.js.map → chunk-UE5JYPU6.js.map} +0 -0
  222. /package/dist/{chunk-K47G2CBP.js.map → chunk-USX5YIKB.js.map} +0 -0
  223. /package/dist/{chunk-YIG4HPY4.js.map → chunk-VK5HKVQ7.js.map} +0 -0
  224. /package/dist/{chunk-THFSCUFC.js.map → chunk-VSJ3ARFS.js.map} +0 -0
  225. /package/dist/{chunk-4BOBW6H4.js.map → chunk-W4V7P5HP.js.map} +0 -0
  226. /package/dist/{chunk-DM3UZUCN.js.map → chunk-WNQ3B3Q5.js.map} +0 -0
  227. /package/dist/{chunk-MFKBYXBY.js.map → chunk-WYOHQJKC.js.map} +0 -0
  228. /package/dist/{chunk-66PEACZP.js.map → chunk-X4DHAXFO.js.map} +0 -0
  229. /package/dist/{chunk-ZYEWTVNQ.js.map → chunk-XPZM7GP6.js.map} +0 -0
  230. /package/dist/{chunk-2BBMCMJS.js.map → chunk-YPYSC3TX.js.map} +0 -0
  231. /package/dist/{chunk-JGQEF33K.js.map → chunk-ZBET3W26.js.map} +0 -0
@@ -7,16 +7,16 @@ import {
7
7
  syncWearableSource,
8
8
  wearableSourceLabel
9
9
  } from "./chunk-5QV6CE6K.js";
10
+ import {
11
+ CompressionGuidelineCoordinator
12
+ } from "./chunk-5PHOU5QI.js";
10
13
  import {
11
14
  ActivityStore,
12
15
  MaintenanceScheduler
13
- } from "./chunk-ZYEWTVNQ.js";
16
+ } from "./chunk-XPZM7GP6.js";
14
17
  import {
15
18
  runPeerProfileReasoner
16
19
  } from "./chunk-I74SUMNI.js";
17
- import {
18
- CompressionGuidelineCoordinator
19
- } from "./chunk-5PHOU5QI.js";
20
20
  import {
21
21
  migrateFromEngram
22
22
  } from "./chunk-VZAKYDMJ.js";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  CompoundingEngine,
34
34
  defaultTierMigrationCycleBudget
35
- } from "./chunk-XR4QR3JT.js";
35
+ } from "./chunk-LYOCAUI6.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-5KBIOI4G.js";
@@ -176,10 +176,10 @@ import {
176
176
  classifyDrainResult,
177
177
  extractionWindowBudgetChars,
178
178
  mergeDrainResults
179
- } from "./chunk-VA3GNAWQ.js";
179
+ } from "./chunk-LZIOY7ZU.js";
180
180
  import {
181
181
  ExtractionEngine
182
- } from "./chunk-UJ2FP2RV.js";
182
+ } from "./chunk-KY3KJUNN.js";
183
183
  import {
184
184
  parseMemoryActionEligibilityContext
185
185
  } from "./chunk-JHU4EYDV.js";
@@ -210,7 +210,7 @@ import {
210
210
  buildEntityRecallSection,
211
211
  entityRecentTranscriptLookbackHours,
212
212
  readRecentEntityTranscriptEntries
213
- } from "./chunk-2BBMCMJS.js";
213
+ } from "./chunk-YPYSC3TX.js";
214
214
  import {
215
215
  planEpisodeWindowsWithFallback
216
216
  } from "./chunk-T3GIETKV.js";
@@ -225,7 +225,7 @@ import {
225
225
  } from "./chunk-7G5NTS7F.js";
226
226
  import {
227
227
  refreshConvergedNamespaces
228
- } from "./chunk-TSZP7GGJ.js";
228
+ } from "./chunk-FGGLVCHI.js";
229
229
  import {
230
230
  builtInConnectorPackageSpecifier,
231
231
  ensureBuiltInWearableConnectors,
@@ -234,7 +234,7 @@ import {
234
234
  runTimelinePublishCli,
235
235
  screenCandidateFact,
236
236
  summarizeVaultPublish
237
- } from "./chunk-OAKOAOEG.js";
237
+ } from "./chunk-QUPTDKSX.js";
238
238
  import {
239
239
  RoutingRulesStore
240
240
  } from "./chunk-TBUEE7XF.js";
@@ -244,14 +244,14 @@ import {
244
244
  import {
245
245
  compareVerifiedEpisodeResults,
246
246
  searchVerifiedEpisodes
247
- } from "./chunk-ZS5LREUZ.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-EIZ4MK33.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-MKMIY3E7.js";
267
+ } from "./chunk-UE5JYPU6.js";
268
268
  import {
269
269
  planNamespaceMaintenance
270
- } from "./chunk-MCFI6G7U.js";
270
+ } from "./chunk-QVZZE6VH.js";
271
271
  import {
272
272
  isAboveImportanceThreshold,
273
273
  scoreImportance
@@ -296,7 +296,7 @@ import {
296
296
  materializeAfterSemanticConsolidation,
297
297
  parseConsolidationResponse,
298
298
  parseOperatorAwareConsolidationResponse
299
- } from "./chunk-MK7HXGM6.js";
299
+ } from "./chunk-6KBCUIZP.js";
300
300
  import {
301
301
  semanticChunkContent
302
302
  } from "./chunk-2GBFKHBZ.js";
@@ -305,7 +305,7 @@ import {
305
305
  } from "./chunk-6TBIWIAG.js";
306
306
  import {
307
307
  SmartBuffer
308
- } from "./chunk-VDYRXI3E.js";
308
+ } from "./chunk-EGKDONTC.js";
309
309
  import {
310
310
  BootstrapEngine
311
311
  } from "./chunk-MYVPLJOO.js";
@@ -373,7 +373,7 @@ import {
373
373
  } from "./chunk-MI2OTWV5.js";
374
374
  import {
375
375
  MeetingsInputError
376
- } from "./chunk-64U42JL5.js";
376
+ } from "./chunk-LHMCZ6VW.js";
377
377
  import {
378
378
  WearablesInputError,
379
379
  describeErrorForOperator
@@ -391,7 +391,7 @@ import {
391
391
  } from "./chunk-HQPFACXO.js";
392
392
  import {
393
393
  NamespaceCatalog
394
- } from "./chunk-3F7N4I5I.js";
394
+ } from "./chunk-2R44BBPK.js";
395
395
  import {
396
396
  RecallResultFormatter,
397
397
  SessionContextCoordinator,
@@ -400,7 +400,7 @@ import {
400
400
  detectPassiveCorrections,
401
401
  renderSessionExperiencePreview,
402
402
  scoreSessionExperienceForPrompt
403
- } from "./chunk-B7YAIHAV.js";
403
+ } from "./chunk-23BA3USG.js";
404
404
  import {
405
405
  importCapsule
406
406
  } from "./chunk-2R7OCBRR.js";
@@ -439,7 +439,7 @@ import {
439
439
  } from "./chunk-WGRAB3KB.js";
440
440
  import {
441
441
  searchHarmonicRetrieval
442
- } from "./chunk-MRN2MKB7.js";
442
+ } from "./chunk-JY4LXMZR.js";
443
443
  import {
444
444
  ProfilingCollector
445
445
  } from "./chunk-DOWACHYO.js";
@@ -465,7 +465,7 @@ import {
465
465
  } from "./chunk-LXATZLSC.js";
466
466
  import {
467
467
  NamespaceStorageRouter
468
- } from "./chunk-D3AGBN6G.js";
468
+ } from "./chunk-UAOJVQXC.js";
469
469
  import {
470
470
  GraphIndex
471
471
  } from "./chunk-BFBS7OFQ.js";
@@ -475,8 +475,9 @@ import {
475
475
  import {
476
476
  ExtractionDeadlineError,
477
477
  ExtractionRunCoordinator,
478
+ ProviderCircuitBreaker,
478
479
  classifyExtractionOrigin
479
- } from "./chunk-LTST4R7U.js";
480
+ } from "./chunk-DE4U5PTV.js";
480
481
  import {
481
482
  ARTIFACT_STATUS_CACHE_TTL_MS,
482
483
  BulkImportBatchPartialFailureError,
@@ -528,7 +529,7 @@ import {
528
529
  } from "./chunk-5RW247F5.js";
529
530
  import {
530
531
  buildChainFollowupGenerator
531
- } from "./chunk-GMSRLDVR.js";
532
+ } from "./chunk-N2Y6COEM.js";
532
533
  import {
533
534
  capStateViewPackets,
534
535
  reconcileStateViewPairs,
@@ -566,7 +567,7 @@ import {
566
567
  reconstructFusionInputs,
567
568
  selfDeps,
568
569
  serializeFusionDay
569
- } from "./chunk-ILD7N3XC.js";
570
+ } from "./chunk-S73ZVU37.js";
570
571
  import {
571
572
  buildRetiredFactTombstoneInputs
572
573
  } from "./chunk-QGVCFVX6.js";
@@ -671,7 +672,7 @@ import {
671
672
  bufferTurnsEqual,
672
673
  describeError,
673
674
  groupTurnsByExtractionScope
674
- } from "./chunk-U7MIMS2Y.js";
675
+ } from "./chunk-OUBEJWVI.js";
675
676
  import {
676
677
  FallbackLlmClient,
677
678
  gatewayTaskChainOptions
@@ -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-OAQO5AZJ.js.map
32086
+ //# sourceMappingURL=chunk-DSSTOV5M.js.map