@remnic/core 10.0.70 → 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.
- package/dist/access-admin-ops-surface.js +14 -14
- package/dist/access-authorization-probe.js +15 -15
- package/dist/access-boundary.js +14 -14
- package/dist/access-cli.js +58 -58
- package/dist/access-extraction-force-flush.js +14 -14
- package/dist/access-http-briefing.js +15 -15
- package/dist/access-http-query.js +16 -16
- package/dist/access-http.js +31 -31
- package/dist/access-identity-continuity-surface.js +14 -14
- package/dist/access-lcm-surface.js +14 -14
- package/dist/access-mcp.js +24 -24
- package/dist/access-namespace-preflight.js +14 -14
- package/dist/access-observe-write-surface.js +14 -14
- package/dist/access-operations-batch.js +16 -16
- package/dist/access-operations.js +23 -23
- package/dist/access-recall-concurrency.js +14 -14
- package/dist/access-recall-response.js +14 -14
- package/dist/access-recall-surface.js +14 -14
- package/dist/access-service.js +14 -14
- package/dist/access-surface-catalog.js +16 -16
- package/dist/active-recall.js +3 -3
- package/dist/briefing.js +4 -4
- package/dist/buffer-turn-helpers.d.ts +10 -1
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +3 -1
- package/dist/buffer.d.ts +4 -0
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +3 -3
- package/dist/causal-consolidation.js +5 -5
- package/dist/{chunk-B7YAIHAV.js → chunk-23BA3USG.js} +10 -10
- package/dist/{chunk-3F7N4I5I.js → chunk-2R44BBPK.js} +2 -2
- package/dist/{chunk-BW33YTF3.js → chunk-2WPWEVAH.js} +2 -2
- package/dist/{chunk-EF3HNVL4.js → chunk-4PMFSYH7.js} +2 -2
- package/dist/{chunk-J5TVHCDG.js → chunk-5ORJHH43.js} +2 -2
- package/dist/{chunk-MK7HXGM6.js → chunk-6KBCUIZP.js} +2 -2
- package/dist/{chunk-OX6GY22Q.js → chunk-7P5VBRBS.js} +2 -2
- package/dist/{chunk-3AASGFR4.js → chunk-7WFY2L5J.js} +3 -3
- package/dist/{chunk-YLMTFRZR.js → chunk-AGRMXXVA.js} +2 -2
- package/dist/{chunk-WIW4LOZL.js → chunk-AZNE2H6D.js} +2 -2
- package/dist/{chunk-GT4G2S2Y.js → chunk-BCBY5GYZ.js} +2 -2
- package/dist/{chunk-EIZ4MK33.js → chunk-BTU77RB5.js} +2 -2
- package/dist/{chunk-ZS5LREUZ.js → chunk-DC3DWF2M.js} +2 -2
- package/dist/{chunk-LTST4R7U.js → chunk-DE4U5PTV.js} +49 -45
- package/dist/chunk-DE4U5PTV.js.map +1 -0
- package/dist/{chunk-OAQO5AZJ.js → chunk-DSSTOV5M.js} +440 -267
- package/dist/chunk-DSSTOV5M.js.map +1 -0
- package/dist/{chunk-VDYRXI3E.js → chunk-EGKDONTC.js} +9 -3
- package/dist/chunk-EGKDONTC.js.map +1 -0
- package/dist/{chunk-FM6UKZAE.js → chunk-EQ6EMJRG.js} +2 -2
- package/dist/{chunk-TSZP7GGJ.js → chunk-FGGLVCHI.js} +2 -2
- package/dist/{chunk-K7LLGCPH.js → chunk-GXAZ4Q2S.js} +2 -2
- package/dist/{chunk-2GV24KFD.js → chunk-H2X32F2K.js} +2 -2
- package/dist/{chunk-2YPIFJHL.js → chunk-ICBUTKLL.js} +2 -2
- package/dist/{chunk-3W37NITP.js → chunk-IQXQ3KWR.js} +2 -2
- package/dist/{chunk-HNF7IMYQ.js → chunk-J72ZY7NU.js} +2 -2
- package/dist/{chunk-6QS5NQJH.js → chunk-JGLZ46JS.js} +2 -2
- package/dist/{chunk-MRN2MKB7.js → chunk-JY4LXMZR.js} +2 -2
- package/dist/{chunk-UJ2FP2RV.js → chunk-KY3KJUNN.js} +2 -2
- package/dist/{chunk-64U42JL5.js → chunk-LHMCZ6VW.js} +10 -10
- package/dist/{chunk-YRMSHA7H.js → chunk-LN7CWLAU.js} +2 -2
- package/dist/{chunk-XR4QR3JT.js → chunk-LYOCAUI6.js} +3 -3
- package/dist/{chunk-VA3GNAWQ.js → chunk-LZIOY7ZU.js} +4 -5
- package/dist/chunk-LZIOY7ZU.js.map +1 -0
- package/dist/{chunk-GMSRLDVR.js → chunk-N2Y6COEM.js} +2 -2
- package/dist/{chunk-XDUP6SWG.js → chunk-OGQGDOYK.js} +2 -2
- package/dist/{chunk-U7MIMS2Y.js → chunk-OUBEJWVI.js} +17 -1
- package/dist/chunk-OUBEJWVI.js.map +1 -0
- package/dist/{chunk-5FMGPV34.js → chunk-OWZXDBV4.js} +2 -2
- package/dist/{chunk-SQO5SEKA.js → chunk-PJAMFIDE.js} +3 -3
- package/dist/{chunk-I6HRHJRA.js → chunk-QIOQI7QZ.js} +2 -2
- package/dist/{chunk-OAKOAOEG.js → chunk-QUPTDKSX.js} +22 -22
- package/dist/{chunk-MCFI6G7U.js → chunk-QVZZE6VH.js} +3 -3
- package/dist/{chunk-LYTKNK5O.js → chunk-S37O4S6E.js} +2 -2
- package/dist/{chunk-ILD7N3XC.js → chunk-S73ZVU37.js} +2 -2
- package/dist/{chunk-5VQSKBNF.js → chunk-U6IL4724.js} +2 -2
- package/dist/{chunk-D3AGBN6G.js → chunk-UAOJVQXC.js} +2 -2
- package/dist/{chunk-MKMIY3E7.js → chunk-UE5JYPU6.js} +7 -7
- package/dist/{chunk-K47G2CBP.js → chunk-USX5YIKB.js} +5 -5
- package/dist/{chunk-YIG4HPY4.js → chunk-VK5HKVQ7.js} +2 -2
- package/dist/{chunk-ZOBYTRBU.js → chunk-VNTQU6KB.js} +47 -2
- package/dist/chunk-VNTQU6KB.js.map +1 -0
- package/dist/{chunk-THFSCUFC.js → chunk-VSJ3ARFS.js} +2 -2
- package/dist/{chunk-4BOBW6H4.js → chunk-W4V7P5HP.js} +2 -2
- package/dist/{chunk-DM3UZUCN.js → chunk-WNQ3B3Q5.js} +2 -2
- package/dist/{chunk-MFKBYXBY.js → chunk-WYOHQJKC.js} +6 -6
- package/dist/{chunk-66PEACZP.js → chunk-X4DHAXFO.js} +3 -3
- package/dist/{chunk-ZYEWTVNQ.js → chunk-XPZM7GP6.js} +7 -7
- package/dist/{chunk-2BBMCMJS.js → chunk-YPYSC3TX.js} +2 -2
- package/dist/{chunk-JGQEF33K.js → chunk-ZBET3W26.js} +2 -2
- package/dist/chunk-ZODKV27J.js +443 -0
- package/dist/chunk-ZODKV27J.js.map +1 -0
- package/dist/cli.js +43 -43
- package/dist/coding/export-okf-codegraph.js +3 -3
- package/dist/compounding/engine.js +5 -5
- package/dist/config.js +3 -3
- package/dist/connectors/codex-materialize-runner.js +4 -4
- package/dist/connectors/index.js +4 -4
- package/dist/convergence-refresh.js +6 -6
- package/dist/corpus-watermark.js +6 -6
- package/dist/entity-retrieval.js +4 -4
- package/dist/external-wiki-access.js +15 -15
- package/dist/extraction-window-drain.d.ts.map +1 -1
- package/dist/extraction-window-drain.js +1 -1
- package/dist/extraction.js +7 -7
- package/dist/harmonic-retrieval.js +4 -4
- package/dist/index.js +58 -58
- package/dist/location/index.js +6 -6
- package/dist/maintenance/memory-governance.js +4 -4
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
- package/dist/maintenance/rebuild-memory-projection-runner.js +6 -6
- package/dist/maintenance/rebuild-memory-projection.js +5 -5
- package/dist/memory-browse-operations.js +15 -15
- package/dist/namespaces/migrate.js +5 -5
- package/dist/namespaces/storage.js +4 -4
- package/dist/operator-doctor-corpus.js +7 -7
- package/dist/operator-toolkit.js +12 -12
- package/dist/orchestration/backlog-scheduler.d.ts +151 -0
- package/dist/orchestration/backlog-scheduler.d.ts.map +1 -0
- package/dist/orchestration/backlog-scheduler.js +891 -0
- package/dist/orchestration/backlog-scheduler.js.map +1 -0
- package/dist/orchestration/buffer-drain-runner.d.ts +31 -27
- package/dist/orchestration/buffer-drain-runner.d.ts.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +64 -269
- package/dist/orchestration/buffer-drain-runner.js.map +1 -1
- package/dist/orchestration/extraction-drain.d.ts +50 -17
- package/dist/orchestration/extraction-drain.d.ts.map +1 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts +19 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestration/extraction-run.d.ts +8 -0
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/extraction-task-queueing.d.ts +44 -0
- package/dist/orchestration/extraction-task-queueing.d.ts.map +1 -0
- package/dist/orchestration/maintenance.js +14 -14
- package/dist/orchestration/turn-ingestion.d.ts +11 -5
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.d.ts +13 -0
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +59 -59
- package/dist/recall-navigation-operations.js +15 -15
- package/dist/recall-navigation.js +14 -14
- package/dist/resume-bundles.js +3 -3
- package/dist/semantic-consolidation.js +5 -5
- package/dist/semantic-rule-promotion.js +4 -4
- package/dist/semantic-rule-verifier.js +4 -4
- package/dist/source-agent-qualifier.js +6 -6
- package/dist/standup/build.js +4 -4
- package/dist/storage/buffer-drain-claims.d.ts +15 -0
- package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage.js +3 -3
- package/dist/support-passport/index.js +17 -17
- package/dist/transfer/export-okf.js +4 -4
- package/dist/verified-recall.js +4 -4
- package/dist/who-knows-cli.js +5 -5
- package/dist/who-knows.js +4 -4
- package/package.json +12 -2
- package/src/backlog-scheduler.test.ts +806 -0
- package/src/buffer-drain-handover.test.ts +363 -18
- package/src/buffer-drain-inprocess.test.ts +355 -0
- package/src/buffer-drain-model-boundary.test.ts +1062 -0
- package/src/buffer-drop-extraction-chunk.test.ts +237 -22
- package/src/buffer-turn-helpers.ts +26 -1
- package/src/buffer.ts +8 -0
- package/src/extraction-window-drain.ts +7 -7
- package/src/orchestration/backlog-scheduler.ts +481 -0
- package/src/orchestration/buffer-drain-runner.ts +545 -180
- package/src/orchestration/extraction-drain.ts +287 -108
- package/src/orchestration/extraction-queue-coordinator.ts +51 -3
- package/src/orchestration/extraction-run.test.ts +41 -0
- package/src/orchestration/extraction-run.ts +24 -5
- package/src/orchestration/extraction-task-queueing.ts +87 -0
- package/src/orchestration/turn-ingestion.ts +46 -59
- package/src/orchestrator-extraction-queue.test.ts +46 -2
- package/src/orchestrator-flush.test.ts +4 -1
- package/src/orchestrator.ts +47 -21
- package/src/storage/buffer-drain-claims.ts +55 -0
- package/dist/chunk-LTST4R7U.js.map +0 -1
- package/dist/chunk-OAQO5AZJ.js.map +0 -1
- package/dist/chunk-U7MIMS2Y.js.map +0 -1
- package/dist/chunk-VA3GNAWQ.js.map +0 -1
- package/dist/chunk-VDYRXI3E.js.map +0 -1
- package/dist/chunk-ZOBYTRBU.js.map +0 -1
- /package/dist/{chunk-B7YAIHAV.js.map → chunk-23BA3USG.js.map} +0 -0
- /package/dist/{chunk-3F7N4I5I.js.map → chunk-2R44BBPK.js.map} +0 -0
- /package/dist/{chunk-BW33YTF3.js.map → chunk-2WPWEVAH.js.map} +0 -0
- /package/dist/{chunk-EF3HNVL4.js.map → chunk-4PMFSYH7.js.map} +0 -0
- /package/dist/{chunk-J5TVHCDG.js.map → chunk-5ORJHH43.js.map} +0 -0
- /package/dist/{chunk-MK7HXGM6.js.map → chunk-6KBCUIZP.js.map} +0 -0
- /package/dist/{chunk-OX6GY22Q.js.map → chunk-7P5VBRBS.js.map} +0 -0
- /package/dist/{chunk-3AASGFR4.js.map → chunk-7WFY2L5J.js.map} +0 -0
- /package/dist/{chunk-YLMTFRZR.js.map → chunk-AGRMXXVA.js.map} +0 -0
- /package/dist/{chunk-WIW4LOZL.js.map → chunk-AZNE2H6D.js.map} +0 -0
- /package/dist/{chunk-GT4G2S2Y.js.map → chunk-BCBY5GYZ.js.map} +0 -0
- /package/dist/{chunk-EIZ4MK33.js.map → chunk-BTU77RB5.js.map} +0 -0
- /package/dist/{chunk-ZS5LREUZ.js.map → chunk-DC3DWF2M.js.map} +0 -0
- /package/dist/{chunk-FM6UKZAE.js.map → chunk-EQ6EMJRG.js.map} +0 -0
- /package/dist/{chunk-TSZP7GGJ.js.map → chunk-FGGLVCHI.js.map} +0 -0
- /package/dist/{chunk-K7LLGCPH.js.map → chunk-GXAZ4Q2S.js.map} +0 -0
- /package/dist/{chunk-2GV24KFD.js.map → chunk-H2X32F2K.js.map} +0 -0
- /package/dist/{chunk-2YPIFJHL.js.map → chunk-ICBUTKLL.js.map} +0 -0
- /package/dist/{chunk-3W37NITP.js.map → chunk-IQXQ3KWR.js.map} +0 -0
- /package/dist/{chunk-HNF7IMYQ.js.map → chunk-J72ZY7NU.js.map} +0 -0
- /package/dist/{chunk-6QS5NQJH.js.map → chunk-JGLZ46JS.js.map} +0 -0
- /package/dist/{chunk-MRN2MKB7.js.map → chunk-JY4LXMZR.js.map} +0 -0
- /package/dist/{chunk-UJ2FP2RV.js.map → chunk-KY3KJUNN.js.map} +0 -0
- /package/dist/{chunk-64U42JL5.js.map → chunk-LHMCZ6VW.js.map} +0 -0
- /package/dist/{chunk-YRMSHA7H.js.map → chunk-LN7CWLAU.js.map} +0 -0
- /package/dist/{chunk-XR4QR3JT.js.map → chunk-LYOCAUI6.js.map} +0 -0
- /package/dist/{chunk-GMSRLDVR.js.map → chunk-N2Y6COEM.js.map} +0 -0
- /package/dist/{chunk-XDUP6SWG.js.map → chunk-OGQGDOYK.js.map} +0 -0
- /package/dist/{chunk-5FMGPV34.js.map → chunk-OWZXDBV4.js.map} +0 -0
- /package/dist/{chunk-SQO5SEKA.js.map → chunk-PJAMFIDE.js.map} +0 -0
- /package/dist/{chunk-I6HRHJRA.js.map → chunk-QIOQI7QZ.js.map} +0 -0
- /package/dist/{chunk-OAKOAOEG.js.map → chunk-QUPTDKSX.js.map} +0 -0
- /package/dist/{chunk-MCFI6G7U.js.map → chunk-QVZZE6VH.js.map} +0 -0
- /package/dist/{chunk-LYTKNK5O.js.map → chunk-S37O4S6E.js.map} +0 -0
- /package/dist/{chunk-ILD7N3XC.js.map → chunk-S73ZVU37.js.map} +0 -0
- /package/dist/{chunk-5VQSKBNF.js.map → chunk-U6IL4724.js.map} +0 -0
- /package/dist/{chunk-D3AGBN6G.js.map → chunk-UAOJVQXC.js.map} +0 -0
- /package/dist/{chunk-MKMIY3E7.js.map → chunk-UE5JYPU6.js.map} +0 -0
- /package/dist/{chunk-K47G2CBP.js.map → chunk-USX5YIKB.js.map} +0 -0
- /package/dist/{chunk-YIG4HPY4.js.map → chunk-VK5HKVQ7.js.map} +0 -0
- /package/dist/{chunk-THFSCUFC.js.map → chunk-VSJ3ARFS.js.map} +0 -0
- /package/dist/{chunk-4BOBW6H4.js.map → chunk-W4V7P5HP.js.map} +0 -0
- /package/dist/{chunk-DM3UZUCN.js.map → chunk-WNQ3B3Q5.js.map} +0 -0
- /package/dist/{chunk-MFKBYXBY.js.map → chunk-WYOHQJKC.js.map} +0 -0
- /package/dist/{chunk-66PEACZP.js.map → chunk-X4DHAXFO.js.map} +0 -0
- /package/dist/{chunk-ZYEWTVNQ.js.map → chunk-XPZM7GP6.js.map} +0 -0
- /package/dist/{chunk-2BBMCMJS.js.map → chunk-YPYSC3TX.js.map} +0 -0
- /package/dist/{chunk-JGQEF33K.js.map → chunk-ZBET3W26.js.map} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
BufferDrainRunner,
|
|
3
|
+
ClaimBufferStorage
|
|
4
|
+
} from "../chunk-ZODKV27J.js";
|
|
5
|
+
import "../chunk-DSSTOV5M.js";
|
|
4
6
|
import "../chunk-5QV6CE6K.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-LN7CWLAU.js";
|
|
8
|
+
import "../chunk-5PHOU5QI.js";
|
|
9
|
+
import "../chunk-XPZM7GP6.js";
|
|
7
10
|
import "../chunk-I74SUMNI.js";
|
|
8
11
|
import "../chunk-ILNPU5W5.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-HNF7IMYQ.js";
|
|
12
|
+
import "../chunk-J72ZY7NU.js";
|
|
11
13
|
import "../chunk-VZAKYDMJ.js";
|
|
12
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-VSJ3ARFS.js";
|
|
13
15
|
import "../chunk-666A3MOW.js";
|
|
14
16
|
import "../chunk-VDC6RZI4.js";
|
|
15
17
|
import "../chunk-UWK5OXUJ.js";
|
|
@@ -24,10 +26,10 @@ import "../chunk-TECVW3JP.js";
|
|
|
24
26
|
import "../chunk-C5JF6EZ7.js";
|
|
25
27
|
import "../chunk-KBL3JJR6.js";
|
|
26
28
|
import "../chunk-RZN4LQ5Y.js";
|
|
27
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-LYOCAUI6.js";
|
|
28
30
|
import "../chunk-5KBIOI4G.js";
|
|
29
31
|
import "../chunk-V5OCT34X.js";
|
|
30
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-W4V7P5HP.js";
|
|
31
33
|
import "../chunk-47DU4SGJ.js";
|
|
32
34
|
import "../chunk-3Q3XD3NO.js";
|
|
33
35
|
import "../chunk-ECZU5BJH.js";
|
|
@@ -69,9 +71,9 @@ import "../chunk-XXSOVESA.js";
|
|
|
69
71
|
import "../chunk-PHRLJFWZ.js";
|
|
70
72
|
import "../chunk-64NJRYU2.js";
|
|
71
73
|
import "../chunk-OH7QLI6W.js";
|
|
72
|
-
import "../chunk-
|
|
73
|
-
import "../chunk-
|
|
74
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-LZIOY7ZU.js";
|
|
75
|
+
import "../chunk-KY3KJUNN.js";
|
|
76
|
+
import "../chunk-EQ6EMJRG.js";
|
|
75
77
|
import "../chunk-54V4BZWP.js";
|
|
76
78
|
import "../chunk-2CGLBUW3.js";
|
|
77
79
|
import "../chunk-QT5MGENX.js";
|
|
@@ -100,7 +102,7 @@ import "../chunk-LUPVCGYK.js";
|
|
|
100
102
|
import "../chunk-BUYVPUEM.js";
|
|
101
103
|
import "../chunk-IAIPNEHD.js";
|
|
102
104
|
import "../chunk-DGFU5MSX.js";
|
|
103
|
-
import "../chunk-
|
|
105
|
+
import "../chunk-YPYSC3TX.js";
|
|
104
106
|
import "../chunk-S57QBPTA.js";
|
|
105
107
|
import "../chunk-GKUA4MGB.js";
|
|
106
108
|
import "../chunk-WJ6S54ES.js";
|
|
@@ -113,15 +115,15 @@ import "../chunk-VEWZZM3H.js";
|
|
|
113
115
|
import "../chunk-5IIQU4JZ.js";
|
|
114
116
|
import "../chunk-PYIR4SSB.js";
|
|
115
117
|
import "../chunk-7G5NTS7F.js";
|
|
116
|
-
import "../chunk-
|
|
118
|
+
import "../chunk-FGGLVCHI.js";
|
|
117
119
|
import "../chunk-4NZQ7IID.js";
|
|
118
120
|
import "../chunk-3I4FUAVJ.js";
|
|
119
|
-
import "../chunk-
|
|
121
|
+
import "../chunk-QUPTDKSX.js";
|
|
122
|
+
import "../chunk-54BGIBCR.js";
|
|
120
123
|
import "../chunk-H4CKS5B2.js";
|
|
121
124
|
import "../chunk-MMACM5G2.js";
|
|
122
|
-
import "../chunk-54BGIBCR.js";
|
|
123
125
|
import "../chunk-FXZTL7F7.js";
|
|
124
|
-
import "../chunk-
|
|
126
|
+
import "../chunk-S37O4S6E.js";
|
|
125
127
|
import "../chunk-BV2TIZ4F.js";
|
|
126
128
|
import "../chunk-HDDRVXX4.js";
|
|
127
129
|
import "../chunk-PYHOAXTI.js";
|
|
@@ -130,15 +132,15 @@ import "../chunk-OZKVVUJB.js";
|
|
|
130
132
|
import "../chunk-2DL3OFLD.js";
|
|
131
133
|
import "../chunk-G4IAEX6D.js";
|
|
132
134
|
import "../chunk-2NLLXCJG.js";
|
|
133
|
-
import "../chunk-UP6MOYCB.js";
|
|
134
135
|
import "../chunk-765K3SAT.js";
|
|
136
|
+
import "../chunk-UP6MOYCB.js";
|
|
135
137
|
import "../chunk-TBUEE7XF.js";
|
|
136
138
|
import "../chunk-FGDKJJZS.js";
|
|
137
139
|
import "../chunk-AJVLDJU6.js";
|
|
138
140
|
import "../chunk-SZDLX763.js";
|
|
139
141
|
import "../chunk-PYIFUBRK.js";
|
|
140
142
|
import "../chunk-EDR6CVWZ.js";
|
|
141
|
-
import "../chunk-
|
|
143
|
+
import "../chunk-ICBUTKLL.js";
|
|
142
144
|
import "../chunk-WHCD4Z3D.js";
|
|
143
145
|
import "../chunk-YQJCWR4R.js";
|
|
144
146
|
import "../chunk-7IGMKQWK.js";
|
|
@@ -146,24 +148,24 @@ import "../chunk-HSSERO3E.js";
|
|
|
146
148
|
import "../chunk-NOUJNHWG.js";
|
|
147
149
|
import "../chunk-I7TR2OCU.js";
|
|
148
150
|
import "../chunk-2524MOWK.js";
|
|
149
|
-
import "../chunk-
|
|
151
|
+
import "../chunk-DC3DWF2M.js";
|
|
150
152
|
import "../chunk-HL4DB7TO.js";
|
|
151
153
|
import "../chunk-WLT6LTQP.js";
|
|
152
154
|
import "../chunk-EOU6V4IN.js";
|
|
153
155
|
import "../chunk-VHSQU3RO.js";
|
|
154
|
-
import "../chunk-
|
|
155
|
-
import "../chunk-
|
|
156
|
+
import "../chunk-OGQGDOYK.js";
|
|
157
|
+
import "../chunk-BTU77RB5.js";
|
|
156
158
|
import "../chunk-HZNURRDS.js";
|
|
157
159
|
import "../chunk-B2NXOVZN.js";
|
|
158
160
|
import "../chunk-HDN7IVIO.js";
|
|
159
161
|
import "../chunk-ADYP7HXE.js";
|
|
160
162
|
import "../chunk-2LA3H54D.js";
|
|
161
|
-
import "../chunk-
|
|
162
|
-
import "../chunk-
|
|
163
|
+
import "../chunk-UE5JYPU6.js";
|
|
164
|
+
import "../chunk-QVZZE6VH.js";
|
|
163
165
|
import "../chunk-KFY3SGN7.js";
|
|
164
166
|
import "../chunk-CMTINOFS.js";
|
|
165
167
|
import "../chunk-3T74IZB3.js";
|
|
166
|
-
import "../chunk-
|
|
168
|
+
import "../chunk-IQXQ3KWR.js";
|
|
167
169
|
import "../chunk-I6ORDT54.js";
|
|
168
170
|
import "../chunk-BCCG7VWM.js";
|
|
169
171
|
import "../chunk-GGRRF4PZ.js";
|
|
@@ -176,19 +178,19 @@ import "../chunk-YNDLCWXS.js";
|
|
|
176
178
|
import "../chunk-AUDJPF4N.js";
|
|
177
179
|
import "../chunk-44442YCH.js";
|
|
178
180
|
import "../chunk-Y4Z4I6WK.js";
|
|
179
|
-
import "../chunk-
|
|
181
|
+
import "../chunk-X4DHAXFO.js";
|
|
180
182
|
import "../chunk-KJTKLXTH.js";
|
|
181
183
|
import "../chunk-2DQ2XREU.js";
|
|
182
184
|
import "../chunk-OKTXM5H4.js";
|
|
183
185
|
import "../chunk-3ICAWZUU.js";
|
|
184
186
|
import "../chunk-ZAJLJ35W.js";
|
|
185
|
-
import "../chunk-
|
|
187
|
+
import "../chunk-6KBCUIZP.js";
|
|
186
188
|
import "../chunk-5JMAGU26.js";
|
|
187
189
|
import "../chunk-YBPYIAA5.js";
|
|
188
190
|
import "../chunk-HK6KYIF6.js";
|
|
189
191
|
import "../chunk-2GBFKHBZ.js";
|
|
190
192
|
import "../chunk-6TBIWIAG.js";
|
|
191
|
-
import "../chunk-
|
|
193
|
+
import "../chunk-EGKDONTC.js";
|
|
192
194
|
import "../chunk-MPDLLLOG.js";
|
|
193
195
|
import "../chunk-YN2DQ2D6.js";
|
|
194
196
|
import "../chunk-MYVPLJOO.js";
|
|
@@ -232,7 +234,7 @@ import "../chunk-43HUVDTD.js";
|
|
|
232
234
|
import "../chunk-4RA3C3EV.js";
|
|
233
235
|
import "../chunk-B32WYRXX.js";
|
|
234
236
|
import "../chunk-3NF4QUNZ.js";
|
|
235
|
-
import "../chunk-
|
|
237
|
+
import "../chunk-LHMCZ6VW.js";
|
|
236
238
|
import "../chunk-V7IZKJI3.js";
|
|
237
239
|
import "../chunk-TB6CBZ5V.js";
|
|
238
240
|
import "../chunk-XW2T4QAW.js";
|
|
@@ -246,29 +248,29 @@ import "../chunk-2TGIKMMZ.js";
|
|
|
246
248
|
import "../chunk-SDESKFKT.js";
|
|
247
249
|
import "../chunk-3HSRWJTC.js";
|
|
248
250
|
import "../chunk-YIXWY4OZ.js";
|
|
249
|
-
import "../chunk-
|
|
250
|
-
import "../chunk-
|
|
251
|
+
import "../chunk-QIOQI7QZ.js";
|
|
252
|
+
import "../chunk-AGRMXXVA.js";
|
|
251
253
|
import "../chunk-SRT6SHVZ.js";
|
|
252
|
-
import "../chunk-
|
|
254
|
+
import "../chunk-PJAMFIDE.js";
|
|
253
255
|
import "../chunk-TE6S7KDF.js";
|
|
254
256
|
import "../chunk-EIB4FJVR.js";
|
|
255
257
|
import "../chunk-MZUQVWVC.js";
|
|
256
258
|
import "../chunk-A5KNZSNA.js";
|
|
257
259
|
import "../chunk-HUSTM6PU.js";
|
|
258
260
|
import "../chunk-D24OXEPB.js";
|
|
259
|
-
import "../chunk-
|
|
260
|
-
import "../chunk-
|
|
261
|
-
import "../chunk-
|
|
262
|
-
import "../chunk-
|
|
263
|
-
import "../chunk-
|
|
264
|
-
import "../chunk-
|
|
265
|
-
import "../chunk-
|
|
261
|
+
import "../chunk-USX5YIKB.js";
|
|
262
|
+
import "../chunk-H2X32F2K.js";
|
|
263
|
+
import "../chunk-AZNE2H6D.js";
|
|
264
|
+
import "../chunk-7WFY2L5J.js";
|
|
265
|
+
import "../chunk-VK5HKVQ7.js";
|
|
266
|
+
import "../chunk-5ORJHH43.js";
|
|
267
|
+
import "../chunk-WNQ3B3Q5.js";
|
|
266
268
|
import "../chunk-7T4TOGMS.js";
|
|
267
269
|
import "../chunk-7YQ6ESEA.js";
|
|
268
270
|
import "../chunk-ZXF3O7P4.js";
|
|
269
|
-
import "../chunk-
|
|
270
|
-
import "../chunk-K36RMINQ.js";
|
|
271
|
+
import "../chunk-WYOHQJKC.js";
|
|
271
272
|
import "../chunk-PQM3B54K.js";
|
|
273
|
+
import "../chunk-K36RMINQ.js";
|
|
272
274
|
import "../chunk-2RUTN7PR.js";
|
|
273
275
|
import "../chunk-CEN6DW6X.js";
|
|
274
276
|
import "../chunk-E4RMZGRS.js";
|
|
@@ -277,15 +279,15 @@ import "../chunk-2FLFJTCI.js";
|
|
|
277
279
|
import "../chunk-JATHBCAV.js";
|
|
278
280
|
import "../chunk-ZQUVBZI4.js";
|
|
279
281
|
import "../chunk-5R627MYY.js";
|
|
280
|
-
import "../chunk-
|
|
281
|
-
import "../chunk-
|
|
282
|
+
import "../chunk-OWZXDBV4.js";
|
|
283
|
+
import "../chunk-2R44BBPK.js";
|
|
282
284
|
import "../chunk-AB3A7EFH.js";
|
|
283
285
|
import "../chunk-KIUVEMBI.js";
|
|
284
|
-
import "../chunk-
|
|
286
|
+
import "../chunk-2WPWEVAH.js";
|
|
285
287
|
import "../chunk-2BPPGNAQ.js";
|
|
286
288
|
import "../chunk-DJSJ4ULL.js";
|
|
287
|
-
import "../chunk-
|
|
288
|
-
import "../chunk-
|
|
289
|
+
import "../chunk-4PMFSYH7.js";
|
|
290
|
+
import "../chunk-23BA3USG.js";
|
|
289
291
|
import "../chunk-W4F3C7N7.js";
|
|
290
292
|
import "../chunk-MPC7TYTZ.js";
|
|
291
293
|
import "../chunk-2R7OCBRR.js";
|
|
@@ -293,7 +295,7 @@ import "../chunk-IFBSZGW3.js";
|
|
|
293
295
|
import "../chunk-OGXXGHW6.js";
|
|
294
296
|
import "../chunk-RJWL3RHB.js";
|
|
295
297
|
import "../chunk-VQ7B2Q6M.js";
|
|
296
|
-
import "../chunk-
|
|
298
|
+
import "../chunk-JGLZ46JS.js";
|
|
297
299
|
import "../chunk-BANSBRNX.js";
|
|
298
300
|
import "../chunk-JWX2Q6HS.js";
|
|
299
301
|
import "../chunk-GNVZQ5JN.js";
|
|
@@ -316,7 +318,7 @@ import "../chunk-H7XKCNR6.js";
|
|
|
316
318
|
import "../chunk-EWJZZDRG.js";
|
|
317
319
|
import "../chunk-SOBJ6NEY.js";
|
|
318
320
|
import "../chunk-7O2MC42R.js";
|
|
319
|
-
import "../chunk-
|
|
321
|
+
import "../chunk-7P5VBRBS.js";
|
|
320
322
|
import "../chunk-ENPJX3BB.js";
|
|
321
323
|
import "../chunk-B6SPPYGJ.js";
|
|
322
324
|
import "../chunk-UD7UNYRD.js";
|
|
@@ -324,7 +326,7 @@ import "../chunk-IISBCCWR.js";
|
|
|
324
326
|
import "../chunk-BNU5TQLR.js";
|
|
325
327
|
import "../chunk-WGRAB3KB.js";
|
|
326
328
|
import "../chunk-2YA5N2BY.js";
|
|
327
|
-
import "../chunk-
|
|
329
|
+
import "../chunk-JY4LXMZR.js";
|
|
328
330
|
import "../chunk-HUDPXTXW.js";
|
|
329
331
|
import "../chunk-AZEZSQ5R.js";
|
|
330
332
|
import "../chunk-VPEIWMUT.js";
|
|
@@ -346,10 +348,10 @@ import "../chunk-WTWQA7BB.js";
|
|
|
346
348
|
import "../chunk-LXATZLSC.js";
|
|
347
349
|
import "../chunk-E3NBMTTX.js";
|
|
348
350
|
import "../chunk-RF2SMMPP.js";
|
|
349
|
-
import "../chunk-
|
|
350
|
-
import "../chunk-
|
|
351
|
-
import "../chunk-
|
|
352
|
-
import "../chunk-
|
|
351
|
+
import "../chunk-U6IL4724.js";
|
|
352
|
+
import "../chunk-GXAZ4Q2S.js";
|
|
353
|
+
import "../chunk-ZBET3W26.js";
|
|
354
|
+
import "../chunk-UAOJVQXC.js";
|
|
353
355
|
import "../chunk-UFGFMWAD.js";
|
|
354
356
|
import "../chunk-BFBS7OFQ.js";
|
|
355
357
|
import "../chunk-QGJSBU4R.js";
|
|
@@ -358,10 +360,10 @@ import "../chunk-LXY5VVGM.js";
|
|
|
358
360
|
import "../chunk-GKCXTSFF.js";
|
|
359
361
|
import "../chunk-2LSZVONP.js";
|
|
360
362
|
import "../chunk-ZY2MNJR6.js";
|
|
361
|
-
import "../chunk-
|
|
363
|
+
import "../chunk-BCBY5GYZ.js";
|
|
362
364
|
import "../chunk-3UXOZBHV.js";
|
|
363
365
|
import "../chunk-J6GZ2254.js";
|
|
364
|
-
import "../chunk-
|
|
366
|
+
import "../chunk-DE4U5PTV.js";
|
|
365
367
|
import "../chunk-43FLJLT2.js";
|
|
366
368
|
import "../chunk-CSAKJVXW.js";
|
|
367
369
|
import "../chunk-K2XUWZBM.js";
|
|
@@ -371,7 +373,7 @@ import "../chunk-U4LUIE6Y.js";
|
|
|
371
373
|
import "../chunk-T6OZW2WR.js";
|
|
372
374
|
import "../chunk-5YQXWVCP.js";
|
|
373
375
|
import "../chunk-QEDLJDHP.js";
|
|
374
|
-
import "../chunk-
|
|
376
|
+
import "../chunk-N2Y6COEM.js";
|
|
375
377
|
import "../chunk-X2KO4FK5.js";
|
|
376
378
|
import "../chunk-GZFKCLRC.js";
|
|
377
379
|
import "../chunk-EKUI7I2X.js";
|
|
@@ -391,14 +393,12 @@ import "../chunk-ZCUTSMR2.js";
|
|
|
391
393
|
import "../chunk-QDW3E4RD.js";
|
|
392
394
|
import "../chunk-6L63IN3M.js";
|
|
393
395
|
import "../chunk-ZJP66Q4I.js";
|
|
394
|
-
import
|
|
395
|
-
selfDeps
|
|
396
|
-
} from "../chunk-ILD7N3XC.js";
|
|
396
|
+
import "../chunk-S73ZVU37.js";
|
|
397
397
|
import "../chunk-QGVCFVX6.js";
|
|
398
398
|
import "../chunk-UHVXE24Y.js";
|
|
399
399
|
import "../chunk-IGOW4TJE.js";
|
|
400
|
-
import "../chunk-ZOBYTRBU.js";
|
|
401
400
|
import "../chunk-G6OFEGUR.js";
|
|
401
|
+
import "../chunk-VNTQU6KB.js";
|
|
402
402
|
import "../chunk-JEX2JL3U.js";
|
|
403
403
|
import "../chunk-U2A56LLF.js";
|
|
404
404
|
import "../chunk-DOJBV6WR.js";
|
|
@@ -452,9 +452,7 @@ import "../chunk-IUM3VSHI.js";
|
|
|
452
452
|
import "../chunk-C64XATK7.js";
|
|
453
453
|
import "../chunk-42JKGUFJ.js";
|
|
454
454
|
import "../chunk-23G5P7TA.js";
|
|
455
|
-
import
|
|
456
|
-
describeError
|
|
457
|
-
} from "../chunk-U7MIMS2Y.js";
|
|
455
|
+
import "../chunk-OUBEJWVI.js";
|
|
458
456
|
import "../chunk-AVVCPA7U.js";
|
|
459
457
|
import "../chunk-I55KAVET.js";
|
|
460
458
|
import "../chunk-L2EXJQJP.js";
|
|
@@ -571,213 +569,10 @@ import "../chunk-C7HJ3NEI.js";
|
|
|
571
569
|
import "../chunk-VS2IYZRU.js";
|
|
572
570
|
import "../chunk-KNA3BXXL.js";
|
|
573
571
|
import "../chunk-NINSR6LX.js";
|
|
574
|
-
import
|
|
575
|
-
log
|
|
576
|
-
} from "../chunk-3WCASNQZ.js";
|
|
572
|
+
import "../chunk-3WCASNQZ.js";
|
|
577
573
|
import "../chunk-PZ5AY32C.js";
|
|
578
|
-
|
|
579
|
-
// src/orchestration/buffer-drain-runner.ts
|
|
580
|
-
import { hostname } from "os";
|
|
581
|
-
var DEFAULT_LEASE_MS = 12e4;
|
|
582
|
-
var ClaimBufferStorage = class {
|
|
583
|
-
constructor(claims, key, ownerId, entry) {
|
|
584
|
-
this.claims = claims;
|
|
585
|
-
this.key = key;
|
|
586
|
-
this.ownerId = ownerId;
|
|
587
|
-
this.entry = entry;
|
|
588
|
-
}
|
|
589
|
-
claims;
|
|
590
|
-
key;
|
|
591
|
-
ownerId;
|
|
592
|
-
entry;
|
|
593
|
-
async loadBuffer() {
|
|
594
|
-
const entries = /* @__PURE__ */ Object.create(null);
|
|
595
|
-
entries[this.key] = {
|
|
596
|
-
turns: this.entry.turns,
|
|
597
|
-
retainedTurns: this.entry.retainedTurns,
|
|
598
|
-
lastExtractionAt: this.entry.lastExtractionAt,
|
|
599
|
-
extractionCount: this.entry.extractionCount
|
|
600
|
-
};
|
|
601
|
-
return {
|
|
602
|
-
turns: this.entry.turns,
|
|
603
|
-
lastExtractionAt: this.entry.lastExtractionAt,
|
|
604
|
-
extractionCount: this.entry.extractionCount,
|
|
605
|
-
entries
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
async saveBuffer(state) {
|
|
609
|
-
const entry = state.entries?.[this.key];
|
|
610
|
-
await this.claims.writeEntry(this.key, this.ownerId, entry ?? { turns: [], lastExtractionAt: null, extractionCount: 0 }, this.entry);
|
|
611
|
-
}
|
|
612
|
-
async saveBufferSession(key, entry) {
|
|
613
|
-
await this.claims.writeEntry(key, this.ownerId, entry, key === this.key ? this.entry : void 0);
|
|
614
|
-
}
|
|
615
|
-
async deleteBufferSession() {
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
var BufferDrainRunner = class {
|
|
619
|
-
constructor(orchestrator) {
|
|
620
|
-
this.orchestrator = orchestrator;
|
|
621
|
-
}
|
|
622
|
-
orchestrator;
|
|
623
|
-
/** The claim store of this orchestrator's memory root. */
|
|
624
|
-
get claims() {
|
|
625
|
-
return this.orchestrator.storage.bufferDrainClaims();
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Drain one claimed session. The caller owns the lease (it may have taken
|
|
629
|
-
* it already); this method verifies ownership before touching content.
|
|
630
|
-
*/
|
|
631
|
-
async drainSession(key, options) {
|
|
632
|
-
const claims = this.claims;
|
|
633
|
-
const leaseMs = options.leaseMs ?? DEFAULT_LEASE_MS;
|
|
634
|
-
const lease = {
|
|
635
|
-
ownerId: options.ownerId,
|
|
636
|
-
pid: process.pid,
|
|
637
|
-
host: hostname(),
|
|
638
|
-
acquiredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
639
|
-
heartbeatAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
640
|
-
leaseMs
|
|
641
|
-
};
|
|
642
|
-
const claim = await claims.load(key);
|
|
643
|
-
if (!claim) {
|
|
644
|
-
return { key, status: "skipped", turnsAtStart: 0, turnsRemaining: 0, persistedCount: 0, durableOutputCount: 0, reason: "not_claimed" };
|
|
645
|
-
}
|
|
646
|
-
const turnsAtStart = claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0);
|
|
647
|
-
options.onEvent?.({ type: "session_started", key, turns: turnsAtStart });
|
|
648
|
-
const held = await claims.adopt(key, lease);
|
|
649
|
-
if (held === "busy") {
|
|
650
|
-
const outcome2 = {
|
|
651
|
-
key,
|
|
652
|
-
status: "skipped",
|
|
653
|
-
turnsAtStart,
|
|
654
|
-
turnsRemaining: turnsAtStart,
|
|
655
|
-
persistedCount: 0,
|
|
656
|
-
durableOutputCount: 0,
|
|
657
|
-
reason: "claimed_by_another_drain"
|
|
658
|
-
};
|
|
659
|
-
options.onEvent?.({ type: "session_finished", key, outcome: outcome2 });
|
|
660
|
-
return outcome2;
|
|
661
|
-
}
|
|
662
|
-
const claimStorage = new ClaimBufferStorage(claims, key, options.ownerId, claim.entry);
|
|
663
|
-
const coordinator = new TurnIngestionCoordinator(selfDeps(this.orchestrator));
|
|
664
|
-
const turns = [...claim.entry.retainedTurns ?? [], ...claim.entry.turns];
|
|
665
|
-
if (turns.length === 0) {
|
|
666
|
-
await claims.ack(key, options.ownerId);
|
|
667
|
-
const outcome2 = {
|
|
668
|
-
key,
|
|
669
|
-
status: "drained",
|
|
670
|
-
turnsAtStart,
|
|
671
|
-
turnsRemaining: 0,
|
|
672
|
-
persistedCount: 0,
|
|
673
|
-
durableOutputCount: 0
|
|
674
|
-
};
|
|
675
|
-
options.onEvent?.({ type: "session_finished", key, outcome: outcome2 });
|
|
676
|
-
return outcome2;
|
|
677
|
-
}
|
|
678
|
-
const abort = new AbortController();
|
|
679
|
-
const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;
|
|
680
|
-
const heartbeat = setInterval(() => {
|
|
681
|
-
void claims.heartbeat(key, options.ownerId, leaseMs).then((state) => {
|
|
682
|
-
if (state === "lost") abort.abort(new Error(`buffer drain: lease lost for session ${key}`));
|
|
683
|
-
}).catch((err) => {
|
|
684
|
-
abort.abort(new Error(`buffer drain: lease heartbeat failed for session ${key}: ${describeError(err)}`));
|
|
685
|
-
});
|
|
686
|
-
}, Math.max(1e3, Math.floor(leaseMs / 3)));
|
|
687
|
-
heartbeat.unref?.();
|
|
688
|
-
const settledResult = await this.orchestrator.withBufferStorage(claimStorage, async () => {
|
|
689
|
-
const swapTurns = this.orchestrator.buffer.getTurns(key);
|
|
690
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
691
|
-
let settled = false;
|
|
692
|
-
void coordinator.queueBufferedExtraction(swapTurns, "trigger_mode", {
|
|
693
|
-
bufferKey: key,
|
|
694
|
-
clearBufferAfterExtraction: true,
|
|
695
|
-
// The drain owns this session's content: the daemon's own dedupe
|
|
696
|
-
// gate must not skip it, and the thresholds do not apply to a
|
|
697
|
-
// backlog.
|
|
698
|
-
skipDedupeCheck: true,
|
|
699
|
-
skipCharThreshold: true,
|
|
700
|
-
skipUserTurnThreshold: true,
|
|
701
|
-
abortSignal: signal,
|
|
702
|
-
onTaskSettled: (error, result2) => {
|
|
703
|
-
if (settled) return;
|
|
704
|
-
settled = true;
|
|
705
|
-
resolve({ error, result: result2 });
|
|
706
|
-
}
|
|
707
|
-
}).catch((error) => {
|
|
708
|
-
if (settled) return;
|
|
709
|
-
settled = true;
|
|
710
|
-
resolve({ error });
|
|
711
|
-
});
|
|
712
|
-
return await promise;
|
|
713
|
-
});
|
|
714
|
-
clearInterval(heartbeat);
|
|
715
|
-
const remaining = await claims.load(key);
|
|
716
|
-
const turnsRemaining = remaining ? remaining.entry.turns.length + (remaining.entry.retainedTurns?.length ?? 0) : 0;
|
|
717
|
-
const result = settledResult.result;
|
|
718
|
-
const persistedCount = result?.persistedCount ?? 0;
|
|
719
|
-
const durableOutputCount = result?.durableOutputCount ?? 0;
|
|
720
|
-
let status;
|
|
721
|
-
let reason;
|
|
722
|
-
if (turnsRemaining === 0) {
|
|
723
|
-
await claims.ack(key, options.ownerId);
|
|
724
|
-
status = "drained";
|
|
725
|
-
} else if (settledResult.error) {
|
|
726
|
-
await claims.releaseLease(key, options.ownerId);
|
|
727
|
-
status = "failed";
|
|
728
|
-
reason = describeError(settledResult.error);
|
|
729
|
-
} else {
|
|
730
|
-
await claims.releaseLease(key, options.ownerId);
|
|
731
|
-
status = "deferred";
|
|
732
|
-
reason = result?.reason ?? "deferred";
|
|
733
|
-
}
|
|
734
|
-
log.info(
|
|
735
|
-
`buffer drain: session ${key} ${status} (${turnsRemaining} turn(s) remaining)`
|
|
736
|
-
);
|
|
737
|
-
const outcome = {
|
|
738
|
-
key,
|
|
739
|
-
status,
|
|
740
|
-
turnsAtStart,
|
|
741
|
-
turnsRemaining,
|
|
742
|
-
persistedCount,
|
|
743
|
-
durableOutputCount
|
|
744
|
-
};
|
|
745
|
-
if (reason !== void 0) outcome.reason = reason;
|
|
746
|
-
options.onEvent?.({ type: "session_finished", key, outcome });
|
|
747
|
-
return outcome;
|
|
748
|
-
}
|
|
749
|
-
/** Claim a session file for the drain. Returns false when it is not claimable. */
|
|
750
|
-
async claim(key, ownerId, leaseMs = DEFAULT_LEASE_MS) {
|
|
751
|
-
const lease = {
|
|
752
|
-
ownerId,
|
|
753
|
-
pid: process.pid,
|
|
754
|
-
host: hostname(),
|
|
755
|
-
acquiredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
756
|
-
heartbeatAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
757
|
-
leaseMs
|
|
758
|
-
};
|
|
759
|
-
return await this.claims.claimFromSessionFile(key, lease) === "claimed";
|
|
760
|
-
}
|
|
761
|
-
/** Sessions with buffered turns, claimed or not (CLI scan). */
|
|
762
|
-
async scan() {
|
|
763
|
-
const sessions = await this.orchestrator.storage.loadBuffer();
|
|
764
|
-
const entries = sessions.entries ?? {};
|
|
765
|
-
const out = [];
|
|
766
|
-
const seen = /* @__PURE__ */ new Set();
|
|
767
|
-
for (const [key, entry] of Object.entries(entries)) {
|
|
768
|
-
seen.add(key);
|
|
769
|
-
const claim = this.claims.isClaimed(key) ? await this.claims.load(key) : null;
|
|
770
|
-
const turns = claim ? claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0) : entry.turns.length + (entry.retainedTurns?.length ?? 0);
|
|
771
|
-
out.push({ key, turns, claimed: claim !== null });
|
|
772
|
-
}
|
|
773
|
-
for (const listed of await this.claims.list()) {
|
|
774
|
-
if (seen.has(listed.key)) continue;
|
|
775
|
-
out.push({ key: listed.key, turns: listed.turnCount, claimed: true });
|
|
776
|
-
}
|
|
777
|
-
return out;
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
574
|
export {
|
|
781
|
-
BufferDrainRunner
|
|
575
|
+
BufferDrainRunner,
|
|
576
|
+
ClaimBufferStorage
|
|
782
577
|
};
|
|
783
578
|
//# sourceMappingURL=buffer-drain-runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/orchestration/buffer-drain-runner.ts"],"sourcesContent":["/**\n * Out-of-process extraction-buffer drain (`remnic buffer drain`).\n *\n * The runner owns ONE claimed session at a time and drives it through the\n * SAME extraction pipeline the daemon uses — the same chunking\n * (`chunkExtractionWindow` + the model's input budget), the same retry /\n * provider-circuit semantics, the same dropped-chunk side-file recovery. It\n * adds no extraction logic of its own.\n *\n * The difference is ownership: the claimed session's turns live in a drain\n * claim (a durable file), not in a live buffer. So the runner wires a\n * claim-backed `SmartBuffer` into the extraction queue instead of the live\n * one. Every chunk that extracts successfully is removed from the claim\n * immediately, which makes the drain resumable: a kill at any instant\n * leaves the un-extracted turns in the claim, and the next run continues\n * from there.\n *\n * Concurrency lives in the CLI (worker processes, one session each at a\n * time): the in-process extraction queue is serial by design, so a single\n * runner never runs two sessions' extractions at once.\n */\n\nimport type { BufferStorage } from \"../buffer-persistence.js\";\nimport { BufferDrainClaims, type DrainLease } from \"../storage/buffer-drain-claims.js\";\nimport type { BufferEntryState, BufferState } from \"../types.js\";\nimport { hostname } from \"node:os\";\nimport { describeError } from \"../buffer-turn-helpers.js\";\nimport { log } from \"../logger.js\";\nimport { selfDeps } from \"./self-deps.js\";\nimport { TurnIngestionCoordinator, type TurnIngestionDeps } from \"./turn-ingestion.js\";\nimport type { ExtractionRunResult } from \"./extraction-run.js\";\nimport type { Orchestrator } from \"../orchestrator.js\";\n\nexport type DrainSessionStatus = \"drained\" | \"deferred\" | \"failed\" | \"skipped\";\n\nexport interface DrainSessionOutcome {\n key: string;\n status: DrainSessionStatus;\n /** Turns the claim held when the drain started. */\n turnsAtStart: number;\n /** Turns still in the claim when the drain stopped. */\n turnsRemaining: number;\n /** Facts the extraction persisted during this run. */\n persistedCount: number;\n /** Durable outputs (memories + entities) the extraction wrote. */\n durableOutputCount: number;\n /** Why the session was skipped or deferred (machine-readable). */\n reason?: string;\n}\n\nexport interface BufferDrainRunnerOptions {\n /** Identity of this drainer; owns the lease it takes. */\n ownerId: string;\n /** Lease lifetime in ms. The heartbeat keeps it alive while draining. */\n leaseMs?: number;\n /** Cancels the run at the next chunk boundary. */\n signal?: AbortSignal;\n /** Progress callback (per session, and per claim transition). */\n onEvent?: (event: DrainRunnerEvent) => void;\n}\n\n/** A failed drain run: the reason a chunk or the session could not finish. */\nexport type DrainExtractionError = Error;\n\nexport type DrainRunnerEvent =\n | { type: \"session_started\"; key: string; turns: number }\n | { type: \"session_finished\"; key: string; outcome: DrainSessionOutcome };\n\nconst DEFAULT_LEASE_MS = 120_000;\n\n/**\n * A `BufferStorage` view of one drain claim: the claim file IS the buffer.\n * Writes are the drain's progress (what is left to extract), so every\n * successfully extracted chunk is durably removed before the next one runs.\n */\nclass ClaimBufferStorage implements BufferStorage {\n constructor(\n private readonly claims: BufferDrainClaims,\n private readonly key: string,\n private readonly ownerId: string,\n private readonly entry: BufferEntryState,\n ) {}\n\n async loadBuffer(): Promise<BufferState> {\n const entries: NonNullable<BufferState[\"entries\"]> = Object.create(null);\n entries[this.key] = {\n turns: this.entry.turns,\n retainedTurns: this.entry.retainedTurns,\n lastExtractionAt: this.entry.lastExtractionAt,\n extractionCount: this.entry.extractionCount,\n };\n return {\n turns: this.entry.turns,\n lastExtractionAt: this.entry.lastExtractionAt,\n extractionCount: this.entry.extractionCount,\n entries,\n };\n }\n\n async saveBuffer(state: BufferState): Promise<void> {\n // Whole-state fallback (the claim covers one session): persist the entry.\n const entry = state.entries?.[this.key];\n await this.claims.writeEntry(this.key, this.ownerId, entry ?? { turns: [], lastExtractionAt: null, extractionCount: 0 }, this.entry);\n }\n\n async saveBufferSession(key: string, entry: BufferEntryState): Promise<void> {\n await this.claims.writeEntry(key, this.ownerId, entry, key === this.key ? this.entry : undefined);\n }\n\n async deleteBufferSession(): Promise<void> {\n // The claim is removed by the ack path, never by a buffer eviction: the\n // drain decides when the session is finished.\n }\n}\n\nexport class BufferDrainRunner {\n constructor(private readonly orchestrator: Orchestrator) {}\n\n /** The claim store of this orchestrator's memory root. */\n get claims(): BufferDrainClaims {\n return this.orchestrator.storage.bufferDrainClaims();\n }\n\n /**\n * Drain one claimed session. The caller owns the lease (it may have taken\n * it already); this method verifies ownership before touching content.\n */\n async drainSession(key: string, options: BufferDrainRunnerOptions): Promise<DrainSessionOutcome> {\n const claims = this.claims;\n const leaseMs = options.leaseMs ?? DEFAULT_LEASE_MS;\n const lease: DrainLease = {\n ownerId: options.ownerId,\n pid: process.pid,\n host: hostname(),\n acquiredAt: new Date().toISOString(),\n heartbeatAt: new Date().toISOString(),\n leaseMs,\n };\n const claim = await claims.load(key);\n if (!claim) {\n return { key, status: \"skipped\", turnsAtStart: 0, turnsRemaining: 0, persistedCount: 0, durableOutputCount: 0, reason: \"not_claimed\" };\n }\n const turnsAtStart = claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0);\n options.onEvent?.({ type: \"session_started\", key, turns: turnsAtStart });\n\n // Take the lease unless this drainer already holds it.\n const held = await claims.adopt(key, lease);\n if (held === \"busy\") {\n const outcome: DrainSessionOutcome = {\n key,\n status: \"skipped\",\n turnsAtStart,\n turnsRemaining: turnsAtStart,\n persistedCount: 0,\n durableOutputCount: 0,\n reason: \"claimed_by_another_drain\",\n };\n options.onEvent?.({ type: \"session_finished\", key, outcome });\n return outcome;\n }\n\n // The claim is the buffer for this run: every successful chunk is\n // removed from it, so a kill leaves exactly the un-extracted turns.\n // The swap covers the whole extraction (its clear path reads the live\n // buffer), so progress lands in the claim, not in a session file.\n const claimStorage = new ClaimBufferStorage(claims, key, options.ownerId, claim.entry);\n const coordinator = new TurnIngestionCoordinator(selfDeps<TurnIngestionDeps>(this.orchestrator));\n\n // The claim's turns (retained first, like the live buffer's order).\n const turns = [...(claim.entry.retainedTurns ?? []), ...claim.entry.turns];\n if (turns.length === 0) {\n await claims.ack(key, options.ownerId);\n const outcome: DrainSessionOutcome = {\n key,\n status: \"drained\",\n turnsAtStart,\n turnsRemaining: 0,\n persistedCount: 0,\n durableOutputCount: 0,\n };\n options.onEvent?.({ type: \"session_finished\", key, outcome });\n return outcome;\n }\n\n // Keep the lease alive while a long extraction runs; a lost lease means\n // another drainer took the claim, so this run must stop instead of\n // writing progress into a claim it no longer owns.\n const abort = new AbortController();\n const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;\n const heartbeat = setInterval(() => {\n void claims\n .heartbeat(key, options.ownerId, leaseMs)\n .then((state) => {\n if (state === \"lost\") abort.abort(new Error(`buffer drain: lease lost for session ${key}`));\n })\n .catch((err: Error) => {\n // A heartbeat that cannot be renewed is a lease that cannot be\n // held: another drainer may adopt the claim, so stop this run\n // cleanly at the next chunk boundary (the next run resumes it).\n abort.abort(new Error(`buffer drain: lease heartbeat failed for session ${key}: ${describeError(err)}`));\n });\n }, Math.max(1_000, Math.floor(leaseMs / 3)));\n heartbeat.unref?.();\n\n const settledResult = await this.orchestrator.withBufferStorage(claimStorage, async () => {\n const swapTurns = this.orchestrator.buffer.getTurns(key);\n const { promise, resolve } = Promise.withResolvers<{ error?: unknown; result?: ExtractionRunResult }>();\n let settled = false;\n void coordinator\n .queueBufferedExtraction(swapTurns, \"trigger_mode\", {\n bufferKey: key,\n clearBufferAfterExtraction: true,\n // The drain owns this session's content: the daemon's own dedupe\n // gate must not skip it, and the thresholds do not apply to a\n // backlog.\n skipDedupeCheck: true,\n skipCharThreshold: true,\n skipUserTurnThreshold: true,\n abortSignal: signal,\n onTaskSettled: (error, result) => {\n if (settled) return;\n settled = true;\n resolve({ error, result });\n },\n })\n .catch((error: DrainExtractionError) => {\n if (settled) return;\n settled = true;\n resolve({ error });\n });\n return await promise;\n });\n clearInterval(heartbeat);\n const remaining = await claims.load(key);\n const turnsRemaining = remaining\n ? remaining.entry.turns.length + (remaining.entry.retainedTurns?.length ?? 0)\n : 0;\n const result = settledResult.result;\n const persistedCount = result?.persistedCount ?? 0;\n const durableOutputCount = result?.durableOutputCount ?? 0;\n\n let status: DrainSessionStatus;\n let reason: string | undefined;\n if (turnsRemaining === 0) {\n // Everything extracted (or dropped with a recovery side-file): the\n // claim is finished and the session file is gone for good.\n await claims.ack(key, options.ownerId);\n status = \"drained\";\n } else if (settledResult.error) {\n // A failed run keeps the remaining turns for the next attempt.\n await claims.releaseLease(key, options.ownerId);\n status = \"failed\";\n reason = describeError(settledResult.error);\n } else {\n // Deferred: provider breaker / backoff / a chunk still pending. The\n // content stays claimed and the next run resumes it.\n await claims.releaseLease(key, options.ownerId);\n status = \"deferred\";\n reason = result?.reason ?? \"deferred\";\n }\n log.info(\n `buffer drain: session ${key} ${status} (${turnsRemaining} turn(s) remaining)`,\n );\n const outcome: DrainSessionOutcome = {\n key,\n status,\n turnsAtStart,\n turnsRemaining,\n persistedCount,\n durableOutputCount,\n };\n if (reason !== undefined) outcome.reason = reason;\n options.onEvent?.({ type: \"session_finished\", key, outcome });\n return outcome;\n }\n\n /** Claim a session file for the drain. Returns false when it is not claimable. */\n async claim(key: string, ownerId: string, leaseMs = DEFAULT_LEASE_MS): Promise<boolean> {\n const lease: DrainLease = {\n ownerId,\n pid: process.pid,\n host: hostname(),\n acquiredAt: new Date().toISOString(),\n heartbeatAt: new Date().toISOString(),\n leaseMs,\n };\n return (await this.claims.claimFromSessionFile(key, lease)) === \"claimed\";\n }\n\n /** Sessions with buffered turns, claimed or not (CLI scan). */\n async scan(): Promise<{ key: string; turns: number; claimed: boolean }[]> {\n const sessions = await this.orchestrator.storage.loadBuffer();\n const entries = sessions.entries ?? {};\n const out: { key: string; turns: number; claimed: boolean }[] = [];\n const seen = new Set<string>();\n for (const [key, entry] of Object.entries(entries)) {\n seen.add(key);\n const claim = this.claims.isClaimed(key) ? await this.claims.load(key) : null;\n const turns = claim\n ? claim.entry.turns.length + (claim.entry.retainedTurns?.length ?? 0)\n : entry.turns.length + (entry.retainedTurns?.length ?? 0);\n out.push({ key, turns, claimed: claim !== null });\n }\n // Claims the buffer state no longer lists (drained by an earlier run\n // whose claim file outlived its session file).\n for (const listed of await this.claims.list()) {\n if (seen.has(listed.key)) continue;\n out.push({ key: listed.key, turns: listed.turnCount, claimed: true });\n }\n return out;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,gBAAgB;AA2CzB,IAAM,mBAAmB;AAOzB,IAAM,qBAAN,MAAkD;AAAA,EAChD,YACmB,QACA,KACA,SACA,OACjB;AA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D,UAAM,UAAU,SAAS,WAAW,CAAC;AACrC,UAAM,MAA0D,CAAC;AACjE,UAAM,OAAO,oBAAI,IAAY;AAC7B,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,WAAK,IAAI,GAAG;AACZ,YAAM,QAAQ,KAAK,OAAO,UAAU,GAAG,IAAI,MAAM,KAAK,OAAO,KAAK,GAAG,IAAI;AACzE,YAAM,QAAQ,QACV,MAAM,MAAM,MAAM,UAAU,MAAM,MAAM,eAAe,UAAU,KACjE,MAAM,MAAM,UAAU,MAAM,eAAe,UAAU;AACzD,UAAI,KAAK,EAAE,KAAK,OAAO,SAAS,UAAU,KAAK,CAAC;AAAA,IAClD;AAGA,eAAW,UAAU,MAAM,KAAK,OAAO,KAAK,GAAG;AAC7C,UAAI,KAAK,IAAI,OAAO,GAAG,EAAG;AAC1B,UAAI,KAAK,EAAE,KAAK,OAAO,KAAK,OAAO,OAAO,WAAW,SAAS,KAAK,CAAC;AAAA,IACtE;AACA,WAAO;AAAA,EACT;AACF;","names":["outcome","result"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chunked trigger-drain for the extraction pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `turn-ingestion.ts`: that file is at the structural ratchet's
|
|
5
|
-
* line cap (issue #1995), and the drain is a self-contained unit — it only
|
|
6
|
-
* needs the host's `runExtraction`, the buffer drop, the storage side-file
|
|
7
|
-
* copy and the preemption hook.
|
|
8
|
-
*/
|
|
1
|
+
/** Chunked trigger-drain for the extraction pipeline. */
|
|
9
2
|
import type { BufferTurn } from "../types.js";
|
|
10
3
|
import type { ExtractionPreemptHandle } from "./extraction-queue-coordinator.js";
|
|
11
4
|
import type { ExtractionRunCoordinator, ExtractionRunResult } from "./extraction-run.js";
|
|
@@ -27,6 +20,8 @@ export interface ExtractionDrainDeps {
|
|
|
27
20
|
extractionChunkDropAfterFailures: number;
|
|
28
21
|
};
|
|
29
22
|
extractionWindowBudgetChars?(): number;
|
|
23
|
+
/** Rendered-size oracle: the exact character count the extraction renderer */
|
|
24
|
+
measureRenderedTurns?(turns: readonly BufferTurn[]): number;
|
|
30
25
|
runExtraction(turns: BufferTurn[], options: RunOptions): Promise<ExtractionRunResult>;
|
|
31
26
|
getStorage(): Promise<{
|
|
32
27
|
saveDroppedExtractionChunk(bufferKey: string, reason: string, turns: readonly BufferTurn[]): Promise<string>;
|
|
@@ -38,14 +33,7 @@ export interface ExtractionDrainDeps {
|
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
35
|
export declare class ExtractionDrain {
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Consecutive failed attempts on the head chunk, per buffer key. In memory on
|
|
44
|
-
* purpose (a restart re-counts from zero). Bound to the chunk's content: a
|
|
45
|
-
* count recorded for one chunk never applies to a different one, so a force
|
|
46
|
-
* flush that clears a failing chunk cannot make unrelated content inherit its
|
|
47
|
-
* failures.
|
|
48
|
-
*/
|
|
36
|
+
/** Consecutive failed attempts on the head chunk, per buffer key. In memory on */
|
|
49
37
|
private readonly failures;
|
|
50
38
|
/**
|
|
51
39
|
* Buffer key to the first turn of the chunk a qualified window stopped on.
|
|
@@ -55,7 +43,12 @@ export declare class ExtractionDrain {
|
|
|
55
43
|
* window drains; one entry per key.
|
|
56
44
|
*/
|
|
57
45
|
private readonly qualified;
|
|
58
|
-
|
|
46
|
+
/** The claim drain runs with `dropFailedChunks: false`: a chunk that keeps */
|
|
47
|
+
private readonly dropFailedChunks;
|
|
48
|
+
private readonly deps;
|
|
49
|
+
constructor(deps: ExtractionDrainDeps, options?: {
|
|
50
|
+
dropFailedChunks?: boolean;
|
|
51
|
+
});
|
|
59
52
|
/** Characters the coordinator would count for this window: user/assistant text, trimmed and capped per turn, context-only turns left out. */
|
|
60
53
|
private windowChars;
|
|
61
54
|
private failureCount;
|
|
@@ -82,9 +75,49 @@ export declare class ExtractionDrain {
|
|
|
82
75
|
* concurrent automatic extractions cannot clobber each other's registration).
|
|
83
76
|
*/
|
|
84
77
|
run(turns: BufferTurn[], runOptions: DrainRunOptions, preemptable?: boolean, preemptHandle?: ExtractionPreemptHandle): Promise<ExtractionRunResult>;
|
|
78
|
+
/** Chunking plan for one trigger-drain window. Accepted-capture groups */
|
|
79
|
+
private chunkPlan;
|
|
80
|
+
/** Automatic chunking needs a clearable window, no fail-closed/forced
|
|
81
|
+
* caller, and a real budget to chunk against. */
|
|
82
|
+
private chunkable;
|
|
83
|
+
/** A native group clears its turns by identity (a pinned capture can sit
|
|
84
|
+
* in front); a drop must find them the same way. */
|
|
85
|
+
private identityCleared;
|
|
86
|
+
/** Eligibility (minimum user turns and characters) belongs to the whole
|
|
87
|
+
* window: a window that never qualified keeps the single-run path, which
|
|
88
|
+
* judges it exactly as before. */
|
|
89
|
+
private windowBelowThreshold;
|
|
90
|
+
/** The window qualified as a whole; its chunks must not be re-judged one by
|
|
91
|
+
* one (an assistant-only or short chunk would be cleared unextracted). */
|
|
92
|
+
private runChunked;
|
|
93
|
+
/** retention replaces theirs (retained turns do not pile up across chunks) */
|
|
94
|
+
private chunkOptionsFor;
|
|
95
|
+
/** A chunk-local abort controller so a fail-closed flush can abort the
|
|
96
|
+
* next chunk instead of waiting behind the whole window. */
|
|
97
|
+
private armChunkPreempt;
|
|
98
|
+
/** An abort error is rethrown (the chunk-local abort leaves the outer
|
|
99
|
+
* signal untouched, so the host gets the preemption reason it looks for,
|
|
100
|
+
* as it does for the first chunk). */
|
|
101
|
+
private rethrowChunkAbort;
|
|
102
|
+
/** A chunk whose extraction THREW: count the failure; below the drop
|
|
103
|
+
* threshold (or on a no-drop drain) rethrow so the window is retained;
|
|
104
|
+
* at the threshold a chunk that keeps throwing is dropped like one that
|
|
105
|
+
* keeps failing, so later chunks are not stuck behind it. */
|
|
106
|
+
private settleThrownChunk;
|
|
107
|
+
/** Map one chunk result to the drain-loop action: drained chunks continue
|
|
108
|
+
* to the next chunk; breaker/backoff retention and provider faults keep
|
|
109
|
+
* everything for retry without counting a chunk failure. */
|
|
110
|
+
private settleVerdict;
|
|
111
|
+
/** (live drains, recovery copy first) or keep it as durable retryable */
|
|
112
|
+
private settleFailedChunk;
|
|
113
|
+
/** Greedy chunking sized by the RENDERED conversation (the oracle the model */
|
|
114
|
+
private chunkByRenderedSize;
|
|
85
115
|
/** Side-file copy first (content survives a failed drop), then remove the failing chunk from the buffer. Never throws:
|
|
86
116
|
* the drop must not fail the extraction task that already settled its result. */
|
|
87
117
|
private dropFailedChunk;
|
|
118
|
+
/** The recovery side-file copy for a dropped chunk. null = the copy could
|
|
119
|
+
* not be written — the caller must keep the only buffered copy. */
|
|
120
|
+
private saveRecoveryCopy;
|
|
88
121
|
}
|
|
89
122
|
export {};
|
|
90
123
|
//# sourceMappingURL=extraction-drain.d.ts.map
|