@remnic/core 10.0.76 → 10.0.78
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 +27 -27
- package/dist/access-authorization-probe.js +28 -28
- package/dist/access-boundary.js +27 -27
- package/dist/access-cli.js +78 -77
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +27 -27
- package/dist/access-http-briefing.js +28 -28
- package/dist/access-http-query.js +29 -29
- package/dist/access-http.js +45 -45
- package/dist/access-identity-continuity-surface.js +27 -27
- package/dist/access-lcm-surface.js +27 -27
- package/dist/access-mcp.js +37 -37
- package/dist/access-namespace-preflight.js +27 -27
- package/dist/access-observe-helpers.d.ts.map +1 -1
- package/dist/access-observe-helpers.js +1 -1
- package/dist/access-observe-write-category.js +5 -5
- package/dist/access-observe-write-surface.js +27 -27
- package/dist/access-operations-batch.js +29 -29
- package/dist/access-operations.js +36 -36
- package/dist/access-recall-concurrency.js +27 -27
- package/dist/access-recall-response.js +27 -27
- package/dist/access-recall-surface.js +27 -27
- package/dist/access-schema.js +4 -4
- package/dist/access-service.js +27 -27
- package/dist/access-surface-catalog.js +29 -29
- package/dist/active-recall.js +7 -7
- package/dist/briefing.js +8 -8
- package/dist/calibration.js +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/causal-consolidation.js +9 -9
- package/dist/{chunk-Z3CKK5RR.js → chunk-2XG7QECM.js} +3 -3
- package/dist/{chunk-BZTA7DR4.js → chunk-35RSL5B4.js} +3 -3
- package/dist/{chunk-3GGCMRO7.js → chunk-3RYP4OTZ.js} +2 -2
- package/dist/{chunk-VEQVXNWR.js → chunk-446H5UUO.js} +4 -4
- package/dist/{chunk-XC7OYOQC.js → chunk-4BCX6YLW.js} +2 -2
- package/dist/{chunk-RXGFITWS.js → chunk-4HLPFYF2.js} +7 -7
- package/dist/{chunk-WIAXVBQH.js → chunk-65SKM4BF.js} +2 -2
- package/dist/{chunk-VEWTHVX2.js → chunk-6HERQLF4.js} +2 -2
- package/dist/{chunk-4DLZ2ITE.js → chunk-6OGFQ5GH.js} +2 -2
- package/dist/{chunk-C44DRDZM.js → chunk-6WULHFNJ.js} +2 -2
- package/dist/{chunk-IVXOYE43.js → chunk-7IQ5HYBJ.js} +2 -2
- package/dist/{chunk-SZBZOUHR.js → chunk-A45ZOJV4.js} +2 -2
- package/dist/chunk-ADJXJKU6.js +74 -0
- package/dist/chunk-ADJXJKU6.js.map +1 -0
- package/dist/{chunk-DANFOVQG.js → chunk-B7PLF3HW.js} +2 -2
- package/dist/{chunk-PBE7NFB5.js → chunk-BNQJKWWZ.js} +4 -4
- package/dist/{chunk-AY2UK5XK.js → chunk-BSBGI4BD.js} +2 -2
- package/dist/{chunk-AY2UK5XK.js.map → chunk-BSBGI4BD.js.map} +1 -1
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-IPHIIRDN.js → chunk-CYTTY4M2.js} +5 -7
- package/dist/chunk-CYTTY4M2.js.map +1 -0
- package/dist/{chunk-R24RYSQX.js → chunk-CZD654DQ.js} +22 -22
- package/dist/{chunk-MBENRPMY.js → chunk-D3WNJF7D.js} +12 -12
- package/dist/{chunk-5IQL4N37.js → chunk-D4WBMLPD.js} +2 -2
- package/dist/{chunk-FYQUUIPI.js → chunk-DLZGSZVC.js} +4 -4
- package/dist/{chunk-YK6SFDP2.js → chunk-DOJBV6WR.js} +4 -4
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-FETPTCQZ.js → chunk-E33UJHY3.js} +2 -2
- package/dist/{chunk-LJUQPT5G.js → chunk-EFRMEOZQ.js} +3 -3
- package/dist/{chunk-HTDXNIO6.js → chunk-HK3CUTAG.js} +2 -2
- package/dist/{chunk-FGUWCE5I.js → chunk-HUF4S4MY.js} +2 -2
- package/dist/{chunk-6Q6AQ36B.js → chunk-HWHNQVRV.js} +2 -2
- package/dist/{chunk-SYDPJUFR.js → chunk-IDGCL5OP.js} +2 -2
- package/dist/{chunk-F3FNXE7C.js → chunk-JHJP2IAU.js} +3 -3
- package/dist/{chunk-IBQ7LGUJ.js → chunk-JIGHVQF6.js} +6 -6
- package/dist/{chunk-P7HNMNN2.js → chunk-K4SVTZWP.js} +7 -7
- package/dist/{chunk-KAED7IBB.js → chunk-KDWO22ZK.js} +2 -2
- package/dist/{chunk-N6GEGRCT.js → chunk-KYVBGDGA.js} +2 -2
- package/dist/{chunk-HB5TNQMM.js → chunk-L7BOS7KV.js} +2 -2
- package/dist/{chunk-3MBSD53O.js → chunk-LE4MQ2WF.js} +2 -2
- package/dist/{chunk-I4LJJ44E.js → chunk-LNHBYT3F.js} +2 -2
- package/dist/{chunk-SHVLNI4L.js → chunk-LU66I56Q.js} +2 -2
- package/dist/{chunk-TD5VTVPT.js → chunk-N2H6VC65.js} +3 -3
- package/dist/{chunk-L4QYW2HO.js → chunk-NBFHOQIO.js} +2 -2
- package/dist/{chunk-KNZDGZSY.js → chunk-NVYY2TJG.js} +2 -2
- package/dist/{chunk-7FFGWIBN.js → chunk-PCSQRQPJ.js} +2 -2
- package/dist/{chunk-P3AQ2YSX.js → chunk-PFUXPTBT.js} +4 -4
- package/dist/{chunk-KQAFEZQX.js → chunk-R45L4TV6.js} +6 -6
- package/dist/{chunk-E22CQZ3H.js → chunk-R63X5BQA.js} +12 -12
- package/dist/{chunk-PLGBPFEO.js → chunk-RF7QJ736.js} +2 -2
- package/dist/{chunk-ZZSFRWKD.js → chunk-RIBCP4DJ.js} +2 -2
- package/dist/{chunk-HDN7IVIO.js → chunk-RIZ5NUNN.js} +16 -62
- package/dist/chunk-RIZ5NUNN.js.map +1 -0
- package/dist/{chunk-HR6NTVYZ.js → chunk-S34XZUTY.js} +172 -39
- package/dist/chunk-S34XZUTY.js.map +1 -0
- package/dist/{chunk-DEGE32C3.js → chunk-SLORPQZT.js} +2 -2
- package/dist/{chunk-6RPPZL7W.js → chunk-SMSJOWVE.js} +2 -2
- package/dist/{chunk-X53HJENJ.js → chunk-SPYFXSFZ.js} +2 -2
- package/dist/{chunk-IRFQKR4Y.js → chunk-SW6OAWK7.js} +2 -2
- package/dist/{chunk-VPEMGBTI.js → chunk-SZEPOUW2.js} +2 -2
- package/dist/{chunk-COIQ5N4J.js → chunk-TSITK6QK.js} +2 -2
- package/dist/{chunk-HCFNZWFB.js → chunk-VBNXDC7P.js} +2 -2
- package/dist/{chunk-FP2AT4WL.js → chunk-VJ3HFCG2.js} +2 -2
- package/dist/{chunk-OBQ2NZAR.js → chunk-VKDAJJQP.js} +4 -4
- package/dist/{chunk-HZNURRDS.js → chunk-VUROWXFL.js} +2 -2
- package/dist/{chunk-G5NH3SSX.js → chunk-X3KFSJLQ.js} +2 -2
- package/dist/{chunk-GCJA5KKT.js → chunk-XBNO56HC.js} +2 -2
- package/dist/{chunk-GWOFCHPN.js → chunk-YGECOOTF.js} +2 -2
- package/dist/{chunk-2R7OCBRR.js → chunk-YK7GOPIE.js} +2 -2
- package/dist/{chunk-ELUG6NKQ.js → chunk-YSA4CYTK.js} +2 -2
- package/dist/{chunk-233S3MXC.js → chunk-YXUNSOHD.js} +3 -3
- package/dist/{chunk-SY4AFWUZ.js → chunk-Z3O7ZOCC.js} +30 -30
- package/dist/{chunk-ZG57BEUS.js → chunk-ZAU2OPDW.js} +2 -2
- package/dist/cli.js +63 -62
- package/dist/coding/export-okf-codegraph.js +7 -7
- package/dist/compounding/engine.js +9 -9
- package/dist/config.js +7 -7
- package/dist/connectors/codex-materialize-runner.js +8 -8
- package/dist/connectors/index.js +8 -8
- package/dist/convergence-refresh.js +10 -10
- package/dist/corpus-watermark.js +10 -10
- package/dist/deep-recall-http-glue.js +5 -5
- package/dist/entity-retrieval.js +8 -8
- package/dist/external-wiki-access.js +28 -28
- package/dist/extraction.js +10 -10
- package/dist/harmonic-retrieval.js +8 -8
- package/dist/index.js +86 -85
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/local-llm.js +1 -1
- package/dist/location/index.js +10 -10
- package/dist/maintenance/memory-governance.js +8 -8
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +8 -8
- package/dist/maintenance/rebuild-memory-projection-runner.js +10 -10
- package/dist/maintenance/rebuild-memory-projection.js +9 -9
- package/dist/memory-browse-operations.js +28 -28
- package/dist/namespaces/migrate.js +9 -9
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.js +8 -8
- package/dist/operator-doctor-corpus.js +11 -11
- package/dist/operator-toolkit.js +16 -16
- package/dist/orchestration/backlog-scheduler.js +79 -78
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +79 -78
- package/dist/orchestration/extraction-queue-snapshot-sharing.d.ts +113 -0
- package/dist/orchestration/extraction-queue-snapshot-sharing.d.ts.map +1 -0
- package/dist/orchestration/maintenance.js +19 -19
- package/dist/orchestration/turn-ingestion.d.ts +3 -0
- package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
- package/dist/orchestrator.js +78 -77
- package/dist/recall-navigation-operations.js +28 -28
- package/dist/recall-navigation.js +27 -27
- package/dist/resume-bundles.js +10 -9
- package/dist/search/factory.js +5 -5
- package/dist/search/index.js +5 -5
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/orama-backend.js +2 -2
- package/dist/semantic-consolidation.js +9 -9
- package/dist/semantic-rule-promotion.js +8 -8
- package/dist/semantic-rule-verifier.js +8 -8
- package/dist/source-agent-qualifier.js +8 -8
- package/dist/standup/build.js +8 -8
- package/dist/storage.js +7 -7
- package/dist/summarizer.js +2 -2
- package/dist/support-passport/index.js +30 -30
- package/dist/transcript-ownership-digest.d.ts +31 -0
- package/dist/transcript-ownership-digest.d.ts.map +1 -0
- package/dist/transcript-ownership-digest.js +10 -0
- package/dist/transcript-ownership-digest.js.map +1 -0
- package/dist/transcript.d.ts +2 -5
- package/dist/transcript.d.ts.map +1 -1
- package/dist/transcript.js +2 -1
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.js +8 -8
- package/dist/verified-recall.js +8 -8
- package/dist/who-knows-cli.js +9 -9
- package/dist/who-knows.js +8 -8
- package/package.json +2 -2
- package/src/access-observe-helpers.test.ts +156 -0
- package/src/access-observe-helpers.ts +6 -6
- package/src/local-llm-qos.test.ts +59 -0
- package/src/local-llm.ts +1 -1
- package/src/orchestration/extraction-queue-bounded-retention.test.ts +548 -0
- package/src/orchestration/extraction-queue-snapshot-sharing.ts +257 -0
- package/src/orchestration/turn-ingestion.ts +19 -6
- package/src/transcript-ownership-digest.test.ts +403 -0
- package/src/transcript-ownership-digest.ts +99 -0
- package/src/transcript.ts +14 -76
- package/dist/chunk-HDN7IVIO.js.map +0 -1
- package/dist/chunk-HR6NTVYZ.js.map +0 -1
- package/dist/chunk-IPHIIRDN.js.map +0 -1
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-Z3CKK5RR.js.map → chunk-2XG7QECM.js.map} +0 -0
- /package/dist/{chunk-BZTA7DR4.js.map → chunk-35RSL5B4.js.map} +0 -0
- /package/dist/{chunk-3GGCMRO7.js.map → chunk-3RYP4OTZ.js.map} +0 -0
- /package/dist/{chunk-VEQVXNWR.js.map → chunk-446H5UUO.js.map} +0 -0
- /package/dist/{chunk-XC7OYOQC.js.map → chunk-4BCX6YLW.js.map} +0 -0
- /package/dist/{chunk-RXGFITWS.js.map → chunk-4HLPFYF2.js.map} +0 -0
- /package/dist/{chunk-WIAXVBQH.js.map → chunk-65SKM4BF.js.map} +0 -0
- /package/dist/{chunk-VEWTHVX2.js.map → chunk-6HERQLF4.js.map} +0 -0
- /package/dist/{chunk-4DLZ2ITE.js.map → chunk-6OGFQ5GH.js.map} +0 -0
- /package/dist/{chunk-C44DRDZM.js.map → chunk-6WULHFNJ.js.map} +0 -0
- /package/dist/{chunk-IVXOYE43.js.map → chunk-7IQ5HYBJ.js.map} +0 -0
- /package/dist/{chunk-SZBZOUHR.js.map → chunk-A45ZOJV4.js.map} +0 -0
- /package/dist/{chunk-DANFOVQG.js.map → chunk-B7PLF3HW.js.map} +0 -0
- /package/dist/{chunk-PBE7NFB5.js.map → chunk-BNQJKWWZ.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-R24RYSQX.js.map → chunk-CZD654DQ.js.map} +0 -0
- /package/dist/{chunk-MBENRPMY.js.map → chunk-D3WNJF7D.js.map} +0 -0
- /package/dist/{chunk-5IQL4N37.js.map → chunk-D4WBMLPD.js.map} +0 -0
- /package/dist/{chunk-FYQUUIPI.js.map → chunk-DLZGSZVC.js.map} +0 -0
- /package/dist/{chunk-YK6SFDP2.js.map → chunk-DOJBV6WR.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-FETPTCQZ.js.map → chunk-E33UJHY3.js.map} +0 -0
- /package/dist/{chunk-LJUQPT5G.js.map → chunk-EFRMEOZQ.js.map} +0 -0
- /package/dist/{chunk-HTDXNIO6.js.map → chunk-HK3CUTAG.js.map} +0 -0
- /package/dist/{chunk-FGUWCE5I.js.map → chunk-HUF4S4MY.js.map} +0 -0
- /package/dist/{chunk-6Q6AQ36B.js.map → chunk-HWHNQVRV.js.map} +0 -0
- /package/dist/{chunk-SYDPJUFR.js.map → chunk-IDGCL5OP.js.map} +0 -0
- /package/dist/{chunk-F3FNXE7C.js.map → chunk-JHJP2IAU.js.map} +0 -0
- /package/dist/{chunk-IBQ7LGUJ.js.map → chunk-JIGHVQF6.js.map} +0 -0
- /package/dist/{chunk-P7HNMNN2.js.map → chunk-K4SVTZWP.js.map} +0 -0
- /package/dist/{chunk-KAED7IBB.js.map → chunk-KDWO22ZK.js.map} +0 -0
- /package/dist/{chunk-N6GEGRCT.js.map → chunk-KYVBGDGA.js.map} +0 -0
- /package/dist/{chunk-HB5TNQMM.js.map → chunk-L7BOS7KV.js.map} +0 -0
- /package/dist/{chunk-3MBSD53O.js.map → chunk-LE4MQ2WF.js.map} +0 -0
- /package/dist/{chunk-I4LJJ44E.js.map → chunk-LNHBYT3F.js.map} +0 -0
- /package/dist/{chunk-SHVLNI4L.js.map → chunk-LU66I56Q.js.map} +0 -0
- /package/dist/{chunk-TD5VTVPT.js.map → chunk-N2H6VC65.js.map} +0 -0
- /package/dist/{chunk-L4QYW2HO.js.map → chunk-NBFHOQIO.js.map} +0 -0
- /package/dist/{chunk-KNZDGZSY.js.map → chunk-NVYY2TJG.js.map} +0 -0
- /package/dist/{chunk-7FFGWIBN.js.map → chunk-PCSQRQPJ.js.map} +0 -0
- /package/dist/{chunk-P3AQ2YSX.js.map → chunk-PFUXPTBT.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-R45L4TV6.js.map} +0 -0
- /package/dist/{chunk-E22CQZ3H.js.map → chunk-R63X5BQA.js.map} +0 -0
- /package/dist/{chunk-PLGBPFEO.js.map → chunk-RF7QJ736.js.map} +0 -0
- /package/dist/{chunk-ZZSFRWKD.js.map → chunk-RIBCP4DJ.js.map} +0 -0
- /package/dist/{chunk-DEGE32C3.js.map → chunk-SLORPQZT.js.map} +0 -0
- /package/dist/{chunk-6RPPZL7W.js.map → chunk-SMSJOWVE.js.map} +0 -0
- /package/dist/{chunk-X53HJENJ.js.map → chunk-SPYFXSFZ.js.map} +0 -0
- /package/dist/{chunk-IRFQKR4Y.js.map → chunk-SW6OAWK7.js.map} +0 -0
- /package/dist/{chunk-VPEMGBTI.js.map → chunk-SZEPOUW2.js.map} +0 -0
- /package/dist/{chunk-COIQ5N4J.js.map → chunk-TSITK6QK.js.map} +0 -0
- /package/dist/{chunk-HCFNZWFB.js.map → chunk-VBNXDC7P.js.map} +0 -0
- /package/dist/{chunk-FP2AT4WL.js.map → chunk-VJ3HFCG2.js.map} +0 -0
- /package/dist/{chunk-OBQ2NZAR.js.map → chunk-VKDAJJQP.js.map} +0 -0
- /package/dist/{chunk-HZNURRDS.js.map → chunk-VUROWXFL.js.map} +0 -0
- /package/dist/{chunk-G5NH3SSX.js.map → chunk-X3KFSJLQ.js.map} +0 -0
- /package/dist/{chunk-GCJA5KKT.js.map → chunk-XBNO56HC.js.map} +0 -0
- /package/dist/{chunk-GWOFCHPN.js.map → chunk-YGECOOTF.js.map} +0 -0
- /package/dist/{chunk-2R7OCBRR.js.map → chunk-YK7GOPIE.js.map} +0 -0
- /package/dist/{chunk-ELUG6NKQ.js.map → chunk-YSA4CYTK.js.map} +0 -0
- /package/dist/{chunk-233S3MXC.js.map → chunk-YXUNSOHD.js.map} +0 -0
- /package/dist/{chunk-SY4AFWUZ.js.map → chunk-Z3O7ZOCC.js.map} +0 -0
- /package/dist/{chunk-ZG57BEUS.js.map → chunk-ZAU2OPDW.js.map} +0 -0
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferDrainRunner
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-N2H6VC65.js";
|
|
4
|
+
import "../chunk-S34XZUTY.js";
|
|
5
5
|
import "../chunk-B36ACJG7.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-RF7QJ736.js";
|
|
7
7
|
import "../chunk-5PHOU5QI.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-D3WNJF7D.js";
|
|
9
9
|
import "../chunk-I74SUMNI.js";
|
|
10
10
|
import "../chunk-ILNPU5W5.js";
|
|
11
11
|
import "../chunk-VZAKYDMJ.js";
|
|
12
|
-
import "../chunk-4DLZ2ITE.js";
|
|
13
|
-
import "../chunk-IRFQKR4Y.js";
|
|
14
12
|
import "../chunk-666A3MOW.js";
|
|
13
|
+
import "../chunk-6OGFQ5GH.js";
|
|
14
|
+
import "../chunk-SW6OAWK7.js";
|
|
15
|
+
import "../chunk-KBL3JJR6.js";
|
|
15
16
|
import "../chunk-RZN4LQ5Y.js";
|
|
16
17
|
import "../chunk-VDC6RZI4.js";
|
|
17
18
|
import "../chunk-UWK5OXUJ.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-BNQJKWWZ.js";
|
|
20
|
+
import "../chunk-UXPUUL3G.js";
|
|
19
21
|
import "../chunk-DDA47TES.js";
|
|
20
22
|
import "../chunk-AQNHEDXP.js";
|
|
21
23
|
import "../chunk-SDL22RRW.js";
|
|
22
24
|
import "../chunk-7N4KAIGN.js";
|
|
23
25
|
import "../chunk-QNN4FYBD.js";
|
|
24
|
-
import "../chunk-UXPUUL3G.js";
|
|
25
26
|
import "../chunk-V5OCT34X.js";
|
|
26
27
|
import "../chunk-TECVW3JP.js";
|
|
27
28
|
import "../chunk-C5JF6EZ7.js";
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-LJUQPT5G.js";
|
|
29
|
+
import "../chunk-EFRMEOZQ.js";
|
|
30
30
|
import "../chunk-5KBIOI4G.js";
|
|
31
|
-
import "../chunk-6RPPZL7W.js";
|
|
32
|
-
import "../chunk-47DU4SGJ.js";
|
|
33
31
|
import "../chunk-3Q3XD3NO.js";
|
|
32
|
+
import "../chunk-SMSJOWVE.js";
|
|
33
|
+
import "../chunk-47DU4SGJ.js";
|
|
34
34
|
import "../chunk-GCBIXUPT.js";
|
|
35
35
|
import "../chunk-ECZU5BJH.js";
|
|
36
36
|
import "../chunk-KVDUKH5E.js";
|
|
@@ -71,7 +71,7 @@ import "../chunk-PHRLJFWZ.js";
|
|
|
71
71
|
import "../chunk-64NJRYU2.js";
|
|
72
72
|
import "../chunk-OH7QLI6W.js";
|
|
73
73
|
import "../chunk-LZIOY7ZU.js";
|
|
74
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-4BCX6YLW.js";
|
|
75
75
|
import "../chunk-6Y5ANLDH.js";
|
|
76
76
|
import "../chunk-54V4BZWP.js";
|
|
77
77
|
import "../chunk-2CGLBUW3.js";
|
|
@@ -101,7 +101,7 @@ import "../chunk-LUPVCGYK.js";
|
|
|
101
101
|
import "../chunk-BUYVPUEM.js";
|
|
102
102
|
import "../chunk-IAIPNEHD.js";
|
|
103
103
|
import "../chunk-DGFU5MSX.js";
|
|
104
|
-
import "../chunk-
|
|
104
|
+
import "../chunk-PCSQRQPJ.js";
|
|
105
105
|
import "../chunk-S57QBPTA.js";
|
|
106
106
|
import "../chunk-GKUA4MGB.js";
|
|
107
107
|
import "../chunk-WJ6S54ES.js";
|
|
@@ -114,57 +114,58 @@ import "../chunk-VEWZZM3H.js";
|
|
|
114
114
|
import "../chunk-5IIQU4JZ.js";
|
|
115
115
|
import "../chunk-PYIR4SSB.js";
|
|
116
116
|
import "../chunk-7G5NTS7F.js";
|
|
117
|
-
import "../chunk-
|
|
117
|
+
import "../chunk-L7BOS7KV.js";
|
|
118
118
|
import "../chunk-4NZQ7IID.js";
|
|
119
119
|
import "../chunk-3I4FUAVJ.js";
|
|
120
|
-
import "../chunk-
|
|
120
|
+
import "../chunk-Z3O7ZOCC.js";
|
|
121
121
|
import "../chunk-MMACM5G2.js";
|
|
122
122
|
import "../chunk-54BGIBCR.js";
|
|
123
123
|
import "../chunk-H4CKS5B2.js";
|
|
124
124
|
import "../chunk-FXZTL7F7.js";
|
|
125
|
+
import "../chunk-PYHOAXTI.js";
|
|
125
126
|
import "../chunk-UP6MOYCB.js";
|
|
126
|
-
import "../chunk-
|
|
127
|
+
import "../chunk-LNHBYT3F.js";
|
|
127
128
|
import "../chunk-BV2TIZ4F.js";
|
|
128
|
-
import "../chunk-HDDRVXX4.js";
|
|
129
|
-
import "../chunk-PYHOAXTI.js";
|
|
130
129
|
import "../chunk-Z734BLO3.js";
|
|
130
|
+
import "../chunk-HDDRVXX4.js";
|
|
131
131
|
import "../chunk-OZKVVUJB.js";
|
|
132
132
|
import "../chunk-2DL3OFLD.js";
|
|
133
133
|
import "../chunk-G4IAEX6D.js";
|
|
134
|
-
import "../chunk-
|
|
134
|
+
import "../chunk-BXLOS5AJ.js";
|
|
135
135
|
import "../chunk-765K3SAT.js";
|
|
136
|
-
import "../chunk-TBUEE7XF.js";
|
|
137
136
|
import "../chunk-FGDKJJZS.js";
|
|
138
137
|
import "../chunk-AJVLDJU6.js";
|
|
138
|
+
import "../chunk-TBUEE7XF.js";
|
|
139
139
|
import "../chunk-SZDLX763.js";
|
|
140
140
|
import "../chunk-PYIFUBRK.js";
|
|
141
141
|
import "../chunk-EDR6CVWZ.js";
|
|
142
|
-
import "../chunk-
|
|
142
|
+
import "../chunk-LE4MQ2WF.js";
|
|
143
143
|
import "../chunk-WHCD4Z3D.js";
|
|
144
144
|
import "../chunk-YQJCWR4R.js";
|
|
145
145
|
import "../chunk-7IGMKQWK.js";
|
|
146
|
+
import "../chunk-2524MOWK.js";
|
|
146
147
|
import "../chunk-HSSERO3E.js";
|
|
147
148
|
import "../chunk-NOUJNHWG.js";
|
|
148
149
|
import "../chunk-I7TR2OCU.js";
|
|
149
|
-
import "../chunk-
|
|
150
|
-
import "../chunk-GCJA5KKT.js";
|
|
150
|
+
import "../chunk-XBNO56HC.js";
|
|
151
151
|
import "../chunk-HL4DB7TO.js";
|
|
152
152
|
import "../chunk-WLT6LTQP.js";
|
|
153
153
|
import "../chunk-EOU6V4IN.js";
|
|
154
154
|
import "../chunk-VHSQU3RO.js";
|
|
155
|
-
import "../chunk-
|
|
156
|
-
import "../chunk-
|
|
157
|
-
import "../chunk-
|
|
155
|
+
import "../chunk-TSITK6QK.js";
|
|
156
|
+
import "../chunk-SPYFXSFZ.js";
|
|
157
|
+
import "../chunk-VUROWXFL.js";
|
|
158
158
|
import "../chunk-B2NXOVZN.js";
|
|
159
|
-
import "../chunk-
|
|
159
|
+
import "../chunk-RIZ5NUNN.js";
|
|
160
|
+
import "../chunk-ADJXJKU6.js";
|
|
160
161
|
import "../chunk-ADYP7HXE.js";
|
|
161
162
|
import "../chunk-3T74IZB3.js";
|
|
162
163
|
import "../chunk-2LA3H54D.js";
|
|
163
|
-
import "../chunk-
|
|
164
|
-
import "../chunk-
|
|
164
|
+
import "../chunk-K4SVTZWP.js";
|
|
165
|
+
import "../chunk-2XG7QECM.js";
|
|
165
166
|
import "../chunk-KFY3SGN7.js";
|
|
166
167
|
import "../chunk-CMTINOFS.js";
|
|
167
|
-
import "../chunk-
|
|
168
|
+
import "../chunk-HK3CUTAG.js";
|
|
168
169
|
import "../chunk-I6ORDT54.js";
|
|
169
170
|
import "../chunk-BCCG7VWM.js";
|
|
170
171
|
import "../chunk-GGRRF4PZ.js";
|
|
@@ -177,13 +178,13 @@ import "../chunk-YNDLCWXS.js";
|
|
|
177
178
|
import "../chunk-AUDJPF4N.js";
|
|
178
179
|
import "../chunk-44442YCH.js";
|
|
179
180
|
import "../chunk-Y4Z4I6WK.js";
|
|
180
|
-
import "../chunk-
|
|
181
|
+
import "../chunk-JHJP2IAU.js";
|
|
181
182
|
import "../chunk-KJTKLXTH.js";
|
|
182
183
|
import "../chunk-2DQ2XREU.js";
|
|
183
184
|
import "../chunk-OKTXM5H4.js";
|
|
184
185
|
import "../chunk-3ICAWZUU.js";
|
|
185
186
|
import "../chunk-ZAJLJ35W.js";
|
|
186
|
-
import "../chunk-
|
|
187
|
+
import "../chunk-NBFHOQIO.js";
|
|
187
188
|
import "../chunk-5JMAGU26.js";
|
|
188
189
|
import "../chunk-YBPYIAA5.js";
|
|
189
190
|
import "../chunk-HK6KYIF6.js";
|
|
@@ -233,7 +234,7 @@ import "../chunk-43HUVDTD.js";
|
|
|
233
234
|
import "../chunk-4RA3C3EV.js";
|
|
234
235
|
import "../chunk-B32WYRXX.js";
|
|
235
236
|
import "../chunk-3NF4QUNZ.js";
|
|
236
|
-
import "../chunk-
|
|
237
|
+
import "../chunk-R63X5BQA.js";
|
|
237
238
|
import "../chunk-V7IZKJI3.js";
|
|
238
239
|
import "../chunk-TB6CBZ5V.js";
|
|
239
240
|
import "../chunk-XW2T4QAW.js";
|
|
@@ -246,30 +247,30 @@ import "../chunk-NJAIR57U.js";
|
|
|
246
247
|
import "../chunk-2TGIKMMZ.js";
|
|
247
248
|
import "../chunk-SDESKFKT.js";
|
|
248
249
|
import "../chunk-3HSRWJTC.js";
|
|
249
|
-
import "../chunk-
|
|
250
|
-
import "../chunk-
|
|
251
|
-
import "../chunk-
|
|
250
|
+
import "../chunk-E33UJHY3.js";
|
|
251
|
+
import "../chunk-A45ZOJV4.js";
|
|
252
|
+
import "../chunk-6HERQLF4.js";
|
|
252
253
|
import "../chunk-SRT6SHVZ.js";
|
|
253
|
-
import "../chunk-
|
|
254
|
+
import "../chunk-446H5UUO.js";
|
|
254
255
|
import "../chunk-TE6S7KDF.js";
|
|
255
256
|
import "../chunk-EIB4FJVR.js";
|
|
256
257
|
import "../chunk-MZUQVWVC.js";
|
|
257
258
|
import "../chunk-A5KNZSNA.js";
|
|
258
259
|
import "../chunk-HUSTM6PU.js";
|
|
259
260
|
import "../chunk-D24OXEPB.js";
|
|
260
|
-
import "../chunk-
|
|
261
|
-
import "../chunk-
|
|
262
|
-
import "../chunk-
|
|
263
|
-
import "../chunk-
|
|
264
|
-
import "../chunk-
|
|
265
|
-
import "../chunk-
|
|
266
|
-
import "../chunk-
|
|
261
|
+
import "../chunk-JIGHVQF6.js";
|
|
262
|
+
import "../chunk-ZAU2OPDW.js";
|
|
263
|
+
import "../chunk-IDGCL5OP.js";
|
|
264
|
+
import "../chunk-YXUNSOHD.js";
|
|
265
|
+
import "../chunk-KYVBGDGA.js";
|
|
266
|
+
import "../chunk-3RYP4OTZ.js";
|
|
267
|
+
import "../chunk-SZEPOUW2.js";
|
|
267
268
|
import "../chunk-7T4TOGMS.js";
|
|
268
269
|
import "../chunk-7YQ6ESEA.js";
|
|
269
270
|
import "../chunk-ZXF3O7P4.js";
|
|
270
|
-
import "../chunk-
|
|
271
|
-
import "../chunk-PQM3B54K.js";
|
|
271
|
+
import "../chunk-4HLPFYF2.js";
|
|
272
272
|
import "../chunk-K36RMINQ.js";
|
|
273
|
+
import "../chunk-PQM3B54K.js";
|
|
273
274
|
import "../chunk-2RUTN7PR.js";
|
|
274
275
|
import "../chunk-CEN6DW6X.js";
|
|
275
276
|
import "../chunk-E4RMZGRS.js";
|
|
@@ -278,28 +279,28 @@ import "../chunk-2FLFJTCI.js";
|
|
|
278
279
|
import "../chunk-JATHBCAV.js";
|
|
279
280
|
import "../chunk-ZQUVBZI4.js";
|
|
280
281
|
import "../chunk-5R627MYY.js";
|
|
281
|
-
import "../chunk-
|
|
282
|
-
import "../chunk-
|
|
282
|
+
import "../chunk-NVYY2TJG.js";
|
|
283
|
+
import "../chunk-SLORPQZT.js";
|
|
283
284
|
import "../chunk-AB3A7EFH.js";
|
|
284
285
|
import "../chunk-KIUVEMBI.js";
|
|
285
|
-
import "../chunk-
|
|
286
|
+
import "../chunk-KDWO22ZK.js";
|
|
286
287
|
import "../chunk-2BPPGNAQ.js";
|
|
287
288
|
import "../chunk-DJSJ4ULL.js";
|
|
288
|
-
import "../chunk-
|
|
289
|
-
import "../chunk-
|
|
289
|
+
import "../chunk-VJ3HFCG2.js";
|
|
290
|
+
import "../chunk-CZD654DQ.js";
|
|
290
291
|
import "../chunk-W4F3C7N7.js";
|
|
291
292
|
import "../chunk-MPC7TYTZ.js";
|
|
292
|
-
import "../chunk-
|
|
293
|
+
import "../chunk-YK7GOPIE.js";
|
|
293
294
|
import "../chunk-IFBSZGW3.js";
|
|
294
295
|
import "../chunk-OGXXGHW6.js";
|
|
295
296
|
import "../chunk-RJWL3RHB.js";
|
|
296
297
|
import "../chunk-VQ7B2Q6M.js";
|
|
297
298
|
import "../chunk-BANSBRNX.js";
|
|
298
|
-
import "../chunk-
|
|
299
|
-
import "../chunk-JWX2Q6HS.js";
|
|
299
|
+
import "../chunk-YSA4CYTK.js";
|
|
300
300
|
import "../chunk-GNVZQ5JN.js";
|
|
301
301
|
import "../chunk-YN2UN7N3.js";
|
|
302
|
-
import "../chunk-
|
|
302
|
+
import "../chunk-JWX2Q6HS.js";
|
|
303
|
+
import "../chunk-X3KFSJLQ.js";
|
|
303
304
|
import "../chunk-HNOSWPKG.js";
|
|
304
305
|
import "../chunk-WWDO7ZWM.js";
|
|
305
306
|
import "../chunk-5Y43VGYB.js";
|
|
@@ -317,7 +318,7 @@ import "../chunk-SOBJ6NEY.js";
|
|
|
317
318
|
import "../chunk-7O2MC42R.js";
|
|
318
319
|
import "../chunk-VYDGHJIN.js";
|
|
319
320
|
import "../chunk-H7XKCNR6.js";
|
|
320
|
-
import "../chunk-
|
|
321
|
+
import "../chunk-RIBCP4DJ.js";
|
|
321
322
|
import "../chunk-B6SPPYGJ.js";
|
|
322
323
|
import "../chunk-FMFCQRDM.js";
|
|
323
324
|
import "../chunk-UD7UNYRD.js";
|
|
@@ -325,7 +326,7 @@ import "../chunk-IISBCCWR.js";
|
|
|
325
326
|
import "../chunk-FOQ7TW2T.js";
|
|
326
327
|
import "../chunk-ORVPS4ZW.js";
|
|
327
328
|
import "../chunk-2YA5N2BY.js";
|
|
328
|
-
import "../chunk-
|
|
329
|
+
import "../chunk-6WULHFNJ.js";
|
|
329
330
|
import "../chunk-HUDPXTXW.js";
|
|
330
331
|
import "../chunk-AZEZSQ5R.js";
|
|
331
332
|
import "../chunk-VPEIWMUT.js";
|
|
@@ -347,10 +348,10 @@ import "../chunk-HRATODNO.js";
|
|
|
347
348
|
import "../chunk-LXATZLSC.js";
|
|
348
349
|
import "../chunk-TLTBACYX.js";
|
|
349
350
|
import "../chunk-RF2SMMPP.js";
|
|
350
|
-
import "../chunk-
|
|
351
|
-
import "../chunk-
|
|
352
|
-
import "../chunk-
|
|
353
|
-
import "../chunk-
|
|
351
|
+
import "../chunk-YGECOOTF.js";
|
|
352
|
+
import "../chunk-VBNXDC7P.js";
|
|
353
|
+
import "../chunk-35RSL5B4.js";
|
|
354
|
+
import "../chunk-B7PLF3HW.js";
|
|
354
355
|
import "../chunk-UFGFMWAD.js";
|
|
355
356
|
import "../chunk-BFBS7OFQ.js";
|
|
356
357
|
import "../chunk-QGJSBU4R.js";
|
|
@@ -359,7 +360,7 @@ import "../chunk-LXY5VVGM.js";
|
|
|
359
360
|
import "../chunk-GKCXTSFF.js";
|
|
360
361
|
import "../chunk-2LSZVONP.js";
|
|
361
362
|
import "../chunk-ZY2MNJR6.js";
|
|
362
|
-
import "../chunk-
|
|
363
|
+
import "../chunk-7IQ5HYBJ.js";
|
|
363
364
|
import "../chunk-3UXOZBHV.js";
|
|
364
365
|
import "../chunk-J6GZ2254.js";
|
|
365
366
|
import "../chunk-P4TEQSIZ.js";
|
|
@@ -367,13 +368,13 @@ import "../chunk-Y5HZFIQO.js";
|
|
|
367
368
|
import "../chunk-CSAKJVXW.js";
|
|
368
369
|
import "../chunk-K2XUWZBM.js";
|
|
369
370
|
import "../chunk-OD4FM2U7.js";
|
|
370
|
-
import "../chunk-
|
|
371
|
+
import "../chunk-BSBGI4BD.js";
|
|
371
372
|
import "../chunk-QEDLJDHP.js";
|
|
372
373
|
import "../chunk-U4LUIE6Y.js";
|
|
373
374
|
import "../chunk-T6OZW2WR.js";
|
|
374
375
|
import "../chunk-5YQXWVCP.js";
|
|
375
376
|
import "../chunk-MJFL75J6.js";
|
|
376
|
-
import "../chunk-
|
|
377
|
+
import "../chunk-HUF4S4MY.js";
|
|
377
378
|
import "../chunk-X2KO4FK5.js";
|
|
378
379
|
import "../chunk-GZFKCLRC.js";
|
|
379
380
|
import "../chunk-EKUI7I2X.js";
|
|
@@ -393,22 +394,22 @@ import "../chunk-ZCUTSMR2.js";
|
|
|
393
394
|
import "../chunk-QDW3E4RD.js";
|
|
394
395
|
import "../chunk-6L63IN3M.js";
|
|
395
396
|
import "../chunk-ZJP66Q4I.js";
|
|
396
|
-
import "../chunk-
|
|
397
|
+
import "../chunk-D4WBMLPD.js";
|
|
397
398
|
import "../chunk-UHVXE24Y.js";
|
|
398
399
|
import "../chunk-QGVCFVX6.js";
|
|
399
400
|
import "../chunk-IGOW4TJE.js";
|
|
400
401
|
import "../chunk-G6OFEGUR.js";
|
|
401
402
|
import "../chunk-7PMOCQOL.js";
|
|
402
|
-
import "../chunk-
|
|
403
|
-
import "../chunk-
|
|
403
|
+
import "../chunk-LU66I56Q.js";
|
|
404
|
+
import "../chunk-VKDAJJQP.js";
|
|
404
405
|
import "../chunk-OVZIYLBZ.js";
|
|
405
406
|
import "../chunk-EXYT52NR.js";
|
|
406
|
-
import "../chunk-
|
|
407
|
-
import "../chunk-
|
|
407
|
+
import "../chunk-DOJBV6WR.js";
|
|
408
|
+
import "../chunk-PFUXPTBT.js";
|
|
408
409
|
import "../chunk-CYEPCZN5.js";
|
|
409
|
-
import "../chunk-
|
|
410
|
-
import "../chunk-Y5NLBXPV.js";
|
|
410
|
+
import "../chunk-DLZGSZVC.js";
|
|
411
411
|
import "../chunk-WNEVEMJ3.js";
|
|
412
|
+
import "../chunk-Y5NLBXPV.js";
|
|
412
413
|
import "../chunk-TFA6HPOA.js";
|
|
413
414
|
import "../chunk-F4TWWUMP.js";
|
|
414
415
|
import "../chunk-72A4L5JJ.js";
|
|
@@ -484,17 +485,17 @@ import "../chunk-AQEJKOKI.js";
|
|
|
484
485
|
import "../chunk-4RNBLLZR.js";
|
|
485
486
|
import "../chunk-WZU5AGO6.js";
|
|
486
487
|
import "../chunk-YLXETSAH.js";
|
|
487
|
-
import "../chunk-
|
|
488
|
+
import "../chunk-65SKM4BF.js";
|
|
488
489
|
import "../chunk-2D7BTSDW.js";
|
|
489
490
|
import "../chunk-353C5UNV.js";
|
|
490
491
|
import "../chunk-JRVMCZE3.js";
|
|
491
492
|
import "../chunk-BT7NVCML.js";
|
|
492
493
|
import "../chunk-IZJQNDGI.js";
|
|
493
|
-
import "../chunk-
|
|
494
|
-
import "../chunk-
|
|
495
|
-
import "../chunk-WEHSQBFR.js";
|
|
496
|
-
import "../chunk-X7Y7WX73.js";
|
|
494
|
+
import "../chunk-HWHNQVRV.js";
|
|
495
|
+
import "../chunk-R45L4TV6.js";
|
|
497
496
|
import "../chunk-J4EB7DNW.js";
|
|
497
|
+
import "../chunk-WEHSQBFR.js";
|
|
498
|
+
import "../chunk-DQEMWVMT.js";
|
|
498
499
|
import "../chunk-BJMBJZ2Y.js";
|
|
499
500
|
import "../chunk-UKJAGEXH.js";
|
|
500
501
|
import "../chunk-FP2373TW.js";
|
|
@@ -543,7 +544,7 @@ import "../chunk-ESG6ITGP.js";
|
|
|
543
544
|
import "../chunk-PCXDUHQH.js";
|
|
544
545
|
import "../chunk-VUFL7X3H.js";
|
|
545
546
|
import "../chunk-C5LWPYS3.js";
|
|
546
|
-
import "../chunk-
|
|
547
|
+
import "../chunk-CYTTY4M2.js";
|
|
547
548
|
import "../chunk-F5GVIPC7.js";
|
|
548
549
|
import "../chunk-X4OZMANG.js";
|
|
549
550
|
import "../chunk-NGHDW6UU.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/orchestration/backlog-scheduler.ts"],"sourcesContent":["/**\n * Daemon-owned extraction backlog scheduler.\n *\n * ONE bounded in-process loop that owns ALL persisted extraction backlog:\n * at startup (existing drain claims + buffered sessions), on every poll tick\n * (new persisted work), and by retrying keys that are still pending — with\n * bounded memory (per-key COUNTS only; candidate scans never retain turn\n * payloads) and bounded outstanding work (the extraction queue's own\n * maxConcurrency gates submissions, so live foreground work keeps its share\n * of the queue).\n *\n * Claim authority: an existing claim — including an EMPTY ack tombstone — is\n * authoritative over the live buffer's in-memory copy. A tombstoned key is\n * never re-claimed or counted as work; new ingress consumes the tombstone\n * through the native save handover, which is what makes the key a candidate\n * again. Claim creation is fenced: the key is reserved synchronously on the\n * extraction queue BEFORE the async claim decision, so a queued live task for\n * the same key cannot start past the claimed-session gate until the decision\n * settles; live capture continues via the native merge-into-claim protocol.\n *\n * Failed, deferred, or policy-denied outcomes keep their turns durable in the\n * claim and re-submit after backoff (exponential from `retryBaseMs` to\n * `retryMaxMs`, reset by progress; denials wait the full max) — never a busy\n * retry. `stop()` aborts in-flight drains at their chunk boundary and leaves\n * every claim retryable; a restarted daemon's scheduler adopts them.\n */\n\nimport { hostname } from \"node:os\";\nimport { log } from \"../logger.js\";\nimport type { Orchestrator } from \"../orchestrator.js\";\nimport type { BufferDrainClaims, DrainLease } from \"../storage/buffer-drain-claims.js\";\nimport { BufferDrainRunner } from \"./buffer-drain-runner.js\";\nimport type { DrainRunnerEvent, DrainSessionOutcome } from \"./buffer-drain-runner.js\";\nimport type { ExtractionQueueCoordinator } from \"./extraction-queue-coordinator.js\";\nimport type { ProviderBreakerSnapshot } from \"./provider-breaker.js\";\n\n/** What the scheduler needs from its host (structurally satisfied by the\n * orchestrator wiring); injectable so tests drive ticks deterministically. */\nexport interface BacklogSchedulerDeps {\n queue: Pick<ExtractionQueueCoordinator, \"tryReserveKey\" | \"releaseKeyReservation\" | \"maxConcurrency\">;\n claims: Pick<BufferDrainClaims, \"list\" | \"listPage\" | \"claimFromSessionFile\" | \"isClaimed\">;\n /** Live per-key pending counts (counts only — never turn payloads). May be\n * async: hosts with a lazily-loaded buffer load it here (idempotent). */\n liveBufferCounts():\n | Map<string, { turns: number; retainedTurns: number }>\n | Promise<Map<string, { turns: number; retainedTurns: number }>>;\n /** A fresh lease for claims this scheduler takes. */\n lease(): DrainLease;\n /** Drain one key to quiescence (BufferDrainRunner.drainSession). */\n drainKey(\n key: string,\n options: { ownerId: string; signal: AbortSignal; onEvent?: (event: DrainRunnerEvent) => void }\n ): Promise<DrainSessionOutcome>;\n /** Shared provider circuit-breaker snapshot (the same instance the run\n * coordinator gates attempts on). While OPEN inside its cooldown window\n * the scheduler skips submission entirely — claims stay durable, and the\n * breaker's single half-open probe (one attempt through once the window\n * lapses) keeps recovery automatic. Optional: hosts without a breaker\n * never skip. */\n breakerSnapshot?(): ProviderBreakerSnapshot;\n /** Test seam: monotonic-ish clock for backoff windows. */\n now?(): number;\n}\n\nexport interface BacklogSchedulerOptions {\n ownerId?: string;\n /** Scan cadence in ms (startup + new-work + retry checks). */\n pollMs?: number;\n retryBaseMs?: number;\n retryMaxMs?: number;\n now?: () => number;\n}\n\nexport interface BacklogSchedulerCounters {\n /** Keys submitted to the drain (claimed or adopted) this process lifetime. */\n claimed: number;\n /** Outcomes with genuinely empty claims (durable outputs preceded ack). */\n processed: number;\n /** Sum of durable outputs (memories + entities) across processed drains. */\n durableOutputs: number;\n /** Re-submissions after a failed/deferred/denied outcome. */\n retried: number;\n denied: { keys: number; turns: number };\n failed: number;\n}\n\nexport type BacklogKeyState = \"inflight\" | \"backoff\" | \"denied\";\n\nexport interface BacklogKeySnapshot {\n key: string;\n state: BacklogKeyState;\n turnsRemaining?: number;\n reason?: string;\n}\n\nexport interface BacklogSchedulerSnapshot {\n counters: BacklogSchedulerCounters;\n inFlight: string[];\n reservedKeys: string[];\n keys: BacklogKeySnapshot[];\n}\n\ninterface KeyState {\n state: BacklogKeyState;\n nextAttemptMs: number;\n /** Last observed remaining turns; progress resets the backoff exponent. */\n turnsRemaining: number;\n reason?: string;\n backoffExponent: number;\n}\n\nconst DEFAULT_POLL_MS = 15_000;\nconst DEFAULT_RETRY_BASE_MS = 30_000;\nconst DEFAULT_RETRY_MAX_MS = 15 * 60_000;\n\nexport class BacklogScheduler {\n private readonly deps: BacklogSchedulerDeps;\n private readonly options: Required<Omit<BacklogSchedulerOptions, \"now\">> & Pick<BacklogSchedulerOptions, \"now\">;\n private readonly keys = new Map<string, KeyState>();\n private readonly inFlight = new Map<string, { controller: AbortController; settled: Promise<void> }>();\n private readonly reserved = new Set<string>();\n private readonly counters: BacklogSchedulerCounters = {\n claimed: 0,\n processed: 0,\n durableOutputs: 0,\n retried: 0,\n denied: { keys: 0, turns: 0 },\n failed: 0,\n };\n private claimCursor: string | undefined;\n private timer: ReturnType<typeof setInterval> | undefined;\n private ticking = false;\n private stopped = true;\n\n constructor(deps: BacklogSchedulerDeps, options: BacklogSchedulerOptions = {}) {\n this.deps = deps;\n this.options = {\n ownerId: options.ownerId ?? `daemon-drain-${process.pid}`,\n pollMs: options.pollMs ?? DEFAULT_POLL_MS,\n retryBaseMs: options.retryBaseMs ?? DEFAULT_RETRY_BASE_MS,\n retryMaxMs: options.retryMaxMs ?? DEFAULT_RETRY_MAX_MS,\n now: options.now,\n };\n }\n\n /** Idempotent. Starts the poll timer (unref'd) and runs an initial tick. */\n start(): void {\n if (!this.stopped) return;\n this.stopped = false;\n this.timer = setInterval(() => void this.tick(), this.options.pollMs);\n this.timer.unref?.();\n void this.tick();\n }\n\n /** Idempotent. Stops the timer, aborts in-flight drains (their claims stay\n * retryable) and waits for them to settle. */\n async stop(): Promise<void> {\n if (this.stopped) return;\n this.stopped = true;\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = undefined;\n }\n const aborts: Promise<void>[] = [];\n for (const entry of this.inFlight.values()) {\n entry.controller.abort(new Error(\"backlog scheduler stopping\"));\n aborts.push(entry.settled);\n }\n await Promise.allSettled(aborts);\n }\n\n /** Bounded snapshot for ops/watchers: counters + per-key states + live sets. */\n snapshot(): BacklogSchedulerSnapshot {\n return {\n counters: {\n claimed: this.counters.claimed,\n processed: this.counters.processed,\n durableOutputs: this.counters.durableOutputs,\n retried: this.counters.retried,\n denied: { ...this.counters.denied },\n failed: this.counters.failed,\n },\n inFlight: [...this.inFlight.keys()],\n reservedKeys: [...this.reserved],\n keys: [...this.keys.entries()].map(([key, state]) => ({\n key,\n state: state.state,\n turnsRemaining: state.turnsRemaining,\n reason: state.reason,\n })),\n };\n }\n\n /** One scan+submit pass (tests drive this instead of the timer). Waits out\n * any in-progress tick first so the pass always actually scans. */\n async tickForTest(): Promise<void> {\n // setImmediate: yields to the event loop so pending I/O (a slow first\n // scan) can finish; a microtask spin would starve it.\n while (this.ticking) await new Promise((resolve) => setImmediate(resolve));\n await this.tick();\n }\n\n /** Await the settle (slot release) of everything currently in flight,\n * optionally excluding one still-gated key (tests). */\n async settleForTest(exclude?: string): Promise<void> {\n for (;;) {\n const pending = [...this.inFlight.entries()].filter(([key]) => key !== exclude).map(([, entry]) => entry.settled);\n if (pending.length === 0) return;\n await Promise.allSettled(pending);\n }\n }\n\n private now(): number {\n return this.options.now?.() ?? Date.now();\n }\n\n private async tick(): Promise<void> {\n if (this.ticking || this.stopped) return;\n this.ticking = true;\n const cursorBeforeTick = this.claimCursor;\n try {\n // Fast bail: a breaker already open must not pay discovery I/O\n // (listPage reads and parses claim bodies on every poll). The\n // submitCandidates guard below still catches a breaker that opens\n // while discovery awaits.\n const breakerBeforeDiscovery = this.deps.breakerSnapshot?.();\n if (\n breakerBeforeDiscovery &&\n breakerBeforeDiscovery.state === \"open\" &&\n this.now() < breakerBeforeDiscovery.openUntilMs\n ) {\n return;\n }\n // stop() may land while discovery's I/O is pending: re-check before\n // submitting anything, and again per candidate.\n // A discovery failure (EACCES/EIO on the claims dir) must not reject\n // into a detached timer callback: it would be an unhandled rejection\n // that terminates the server. Log, skip this pass, retry next poll.\n let candidates: { key: string; needsClaim: boolean }[];\n try {\n candidates = await this.discoverCandidates();\n } catch (err) {\n // Discovery may have listed a page before it failed: the page cursor\n // already moved, so restore it — otherwise those claims wait for the\n // cursor to wrap instead of the next poll.\n this.claimCursor = cursorBeforeTick;\n log.warn(\n `backlog drain: discovery failed; retrying next poll: ${err instanceof Error ? err.message : String(err)}`\n );\n return;\n }\n if (this.stopped) return;\n const dropped = this.submitCandidates(candidates);\n // The concurrency bound stopped submission mid-page: rewind the page\n // cursor so the unsubmitted claims are re-listed on the next tick\n // (already-submitted ones are gated by inFlight and key backoff).\n if (dropped) this.claimCursor = cursorBeforeTick;\n } finally {\n this.ticking = false;\n }\n }\n\n /** Bounded discovery: ONE page of existing claims with pending turns */\n private async discoverCandidates(): Promise<{ key: string; needsClaim: boolean }[]> {\n const out: { key: string; needsClaim: boolean }[] = [];\n const seen = new Set<string>();\n const pageLimit = Math.max(this.submissionLimit() * 4, 16);\n const page = await this.deps.claims.listPage(this.claimCursor, pageLimit);\n for (const listed of page.entries) {\n seen.add(listed.key);\n out.push({ key: listed.key, needsClaim: false });\n }\n this.claimCursor = page.nextCursor;\n for (const [key, counts] of await this.deps.liveBufferCounts()) {\n if (counts.turns + counts.retainedTurns <= 0) continue;\n if (seen.has(key) || this.deps.claims.isClaimed(key)) continue;\n seen.add(key);\n out.push({ key, needsClaim: true });\n }\n return out;\n }\n\n /** Submission bound: the queue's own concurrency limit, read with the\n * documented \"0 disables\" contract — a zero limit submits nothing. */\n private submissionLimit(): number {\n if (this.deps.queue.maxConcurrency <= 0) return 0;\n return this.deps.queue.maxConcurrency;\n }\n\n /** Submit discovery candidates within the queue's concurrency bound. */\n private submitCandidates(candidates: { key: string; needsClaim: boolean }[]): boolean {\n // Breaker-open churn guard: a full attempt reads the claim, rebuilds the\n // buffer/coordinator and re-renders chunks before the breaker fails it\n // fast — pure heap pressure per poll during a provider stall. Skip while\n // the window is open; once it lapses, submissions resume and the\n // breaker's half-open probe runs as usual.\n const breaker = this.deps.breakerSnapshot?.();\n if (breaker && breaker.state === \"open\" && this.now() < breaker.openUntilMs) {\n return true;\n }\n let dropped = false;\n for (const candidate of candidates) {\n if (this.stopped || this.inFlight.size >= this.submissionLimit()) {\n dropped = true;\n break;\n }\n if (!this.candidateEligible(candidate)) continue;\n // Fence the claim decision: reserve the key synchronously BEFORE the\n // async rename so no queued task for it can pass the claimed gate in\n // the meantime. Release happens when the decision settles.\n if (candidate.needsClaim) {\n if (!this.deps.queue.tryReserveKey(candidate.key)) continue;\n this.reserved.add(candidate.key);\n }\n void this.submit(candidate.key, candidate.needsClaim);\n }\n return dropped;\n }\n\n /** inFlight is the authority for \"already submitted\" — key state only\n * exists once an outcome landed (backoff/denied gating below). */\n private candidateEligible(candidate: { key: string; needsClaim: boolean }): boolean {\n if (this.stopped || this.inFlight.size >= this.submissionLimit()) return false;\n if (this.inFlight.has(candidate.key)) return false;\n const state = this.keys.get(candidate.key);\n return !(state && this.now() < state.nextAttemptMs);\n }\n\n /** Claim (when needed), then drain one key; the reservation spans the async\n * claim decision, the queue entry carries the key afterwards. */\n private async submit(key: string, needsClaim: boolean): Promise<void> {\n const controller = new AbortController();\n const { promise: settled, resolve: settle } = Promise.withResolvers<void>();\n this.inFlight.set(key, { controller, settled });\n try {\n if (!(await this.claimForSubmit(key, needsClaim))) return;\n // Stopped between the claim decision and the task: leave the claim\n // with its lease (it expires; the next start adopts) — never drain.\n if (this.stopped) return;\n await this.drainClaimedKey(key, controller.signal);\n } catch (err) {\n // Claim/drain failures are scheduler-level: the claim content is\n // untouched — count failed and back off (never an unhandled rejection\n // in the detached submission).\n this.counters.failed += 1;\n const message = err instanceof Error ? err.message : String(err);\n // SAFETY: a thrown non-Error (incl. null) carries no retry hint; the\n // optional chain reads the hint off Error throws only.\n this.setBackoff(key, (err as { turnsRemaining?: number } | null | undefined)?.turnsRemaining ?? 0, message);\n log.warn(`backlog drain: ${key} submission failed: ${message}`);\n } finally {\n this.inFlight.delete(key);\n this.reserved.delete(key);\n this.deps.queue.releaseKeyReservation(key);\n settle();\n }\n }\n\n /** after all — the key goes quiet without a task. \"claimed\": ours. */\n private async claimForSubmit(key: string, needsClaim: boolean): Promise<boolean> {\n if (!needsClaim) return true;\n try {\n const outcome = await this.deps.claims.claimFromSessionFile(key, this.deps.lease());\n if (outcome === \"empty\") {\n this.keys.delete(key);\n return false;\n }\n return true;\n } finally {\n this.reserved.delete(key);\n this.deps.queue.releaseKeyReservation(key);\n }\n }\n\n /** Drain one claimed key. drainKey reports failures as outcomes; a thrown\n * error still means the claim content is intact — count it failed and\n * back off. */\n private async drainClaimedKey(key: string, signal: AbortSignal): Promise<void> {\n this.counters.claimed += 1;\n try {\n const outcome = await this.deps.drainKey(key, {\n ownerId: this.options.ownerId,\n signal,\n });\n this.applyOutcome(key, outcome);\n } catch (err) {\n this.counters.failed += 1;\n const message = err instanceof Error ? err.message : String(err);\n // SAFETY: a thrown non-Error (incl. null) carries no retry hint; the\n // optional chain reads the hint off Error throws only.\n this.setBackoff(key, (err as { turnsRemaining?: number } | null | undefined)?.turnsRemaining ?? 0, message);\n log.warn(`backlog drain: ${key} threw: ${message}`);\n }\n }\n\n private applyOutcome(key: string, outcome: DrainSessionOutcome): void {\n const deniedTurns = outcome.denied?.reduce((sum, entry) => sum + entry.turns, 0) ?? 0;\n const previous = this.keys.get(key);\n const progressed = outcome.turnsRemaining < (previous?.turnsRemaining ?? Number.POSITIVE_INFINITY);\n if (outcome.status === \"drained\") {\n // The claim is now an empty tombstone: authoritative, nothing pending.\n // New ingress consumes it via the native save path and re-candidates.\n this.keys.delete(key);\n this.counters.processed += 1;\n this.counters.durableOutputs += outcome.durableOutputCount;\n log.info(\n `backlog drain: ${key} drained (${outcome.turnsAtStart} turn(s), ${outcome.durableOutputCount} durable output(s))`\n );\n return;\n }\n this.recordNonDrainedCounters(previous, outcome, deniedTurns);\n const denied = deniedTurns > 0 && outcome.turnsRemaining > 0;\n this.keys.set(key, this.nextKeyState(previous, outcome, denied, progressed));\n log.info(\n `backlog drain: ${key} ${outcome.status} (${outcome.turnsRemaining} turn(s) remaining` +\n `${denied ? `, denied: ${deniedTurns}` : \"\"}${outcome.reason ? `, ${outcome.reason}` : \"\"})`\n );\n }\n\n /** Denied backlog counters for a non-drained outcome. */\n private recordNonDrainedCounters(\n previous: KeyState | undefined,\n outcome: DrainSessionOutcome,\n deniedTurns: number\n ): void {\n if (deniedTurns > 0) {\n this.counters.denied.keys += 1;\n this.counters.denied.turns += deniedTurns;\n }\n if (outcome.status === \"failed\") this.counters.failed += 1;\n else if (previous !== undefined && (previous.state === \"backoff\" || previous.state === \"denied\"))\n this.counters.retried += 1;\n }\n\n /** The post-drain key state: denial waits the full max window (its content\n * is valid but currently unauthorized); progress resets the exponent. */\n private nextKeyState(\n previous: KeyState | undefined,\n outcome: DrainSessionOutcome,\n denied: boolean,\n progressed: boolean\n ): KeyState {\n return {\n state: denied ? \"denied\" : \"backoff\",\n nextAttemptMs: this.now() + this.backoffMs(previous, progressed && !denied),\n turnsRemaining: outcome.turnsRemaining,\n reason: outcome.reason,\n backoffExponent: this.nextBackoffExponent(denied, progressed, previous),\n };\n }\n\n private nextBackoffExponent(denied: boolean, progressed: boolean, previous: KeyState | undefined): number {\n return denied || !progressed ? (previous?.backoffExponent ?? 0) + 1 : 0;\n }\n\n private backoffMs(previous: KeyState | undefined, progressed: boolean): number {\n if (previous?.state === \"denied\") return this.options.retryMaxMs;\n const exponent = progressed ? 0 : (previous?.backoffExponent ?? 0) + 1;\n return Math.min(this.options.retryBaseMs * 2 ** exponent, this.options.retryMaxMs);\n }\n\n private setBackoff(key: string, turnsRemaining: number, reason: string): void {\n const previous = this.keys.get(key);\n this.keys.set(key, {\n state: \"backoff\",\n nextAttemptMs: this.now() + this.backoffMs(previous, false),\n turnsRemaining,\n reason,\n backoffExponent: (previous?.backoffExponent ?? 0) + 1,\n });\n }\n}\n\n/** Lease lifetime for claims the scheduler takes (matches the runner default). */\nconst SCHEDULER_LEASE_MS = 120_000;\n\n/** Wire the scheduler to an orchestrator's own queue, claim store, live buffer\n * counts and drain runner — the daemon's single ownership point. */\nexport function wireBacklogScheduler(\n orchestrator: Orchestrator,\n options: BacklogSchedulerOptions = {}\n): BacklogScheduler {\n const ownerId = options.ownerId ?? `daemon-drain-${process.pid}`;\n const runner = new BufferDrainRunner(orchestrator);\n return new BacklogScheduler(\n {\n queue: orchestrator.extractionQueueCoordinator,\n claims: orchestrator.storage.bufferDrainClaims(),\n liveBufferCounts: async () => {\n // The daemon's buffer may be lazy: ensure the persisted state is in\n // memory before counting (load is guarded/idempotent).\n await orchestrator.buffer.load();\n return orchestrator.buffer.entryCounts();\n },\n lease: () => {\n const now = new Date().toISOString();\n return {\n ownerId,\n pid: process.pid,\n host: hostname(),\n acquiredAt: now,\n heartbeatAt: now,\n leaseMs: SCHEDULER_LEASE_MS,\n };\n },\n drainKey: (key, drainOptions) => runner.drainSession(key, drainOptions),\n // The orchestrator's one shared provider breaker (foreground and every\n // claim-backed drain accumulate toward the same threshold).\n breakerSnapshot: () => orchestrator.getExtractionResilienceStatus().breaker,\n },\n { ...options, ownerId }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,gBAAgB;AAoFzB,IAAM,kBAAkB;AACxB,IAAM,wBAAwB;AAC9B,IAAM,uBAAuB,KAAK;AAE3B,IAAM,mBAAN,MAAuB;AAAA,EACX;AAAA,EACA;AAAA,EACA,OAAO,oBAAI,IAAsB;AAAA,EACjC,WAAW,oBAAI,IAAqE;AAAA,EACpF,WAAW,oBAAI,IAAY;AAAA,EAC3B,WAAqC;AAAA,IACpD,SAAS;AAAA,IACT,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE;AAAA,IAC5B,QAAQ;AAAA,EACV;AAAA,EACQ;AAAA,E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KAAK,QAAQ,cAAc,KAAK,UAAU,KAAK,QAAQ,UAAU;AAAA,EACnF;AAAA,EAEQ,WAAW,KAAa,gBAAwB,QAAsB;AAC5E,UAAM,WAAW,KAAK,KAAK,IAAI,GAAG;AAClC,SAAK,KAAK,IAAI,KAAK;AAAA,MACjB,OAAO;AAAA,MACP,eAAe,KAAK,IAAI,IAAI,KAAK,UAAU,UAAU,KAAK;AAAA,MAC1D;AAAA,MACA;AAAA,MACA,kBAAkB,UAAU,mBAAmB,KAAK;AAAA,IACtD,CAAC;AAAA,EACH;AACF;AAGA,IAAM,qBAAqB;AAIpB,SAAS,qBACd,cACA,UAAmC,CAAC,GAClB;AAClB,QAAM,UAAU,QAAQ,WAAW,gBAAgB,QAAQ,GAAG;AAC9D,QAAM,SAAS,IAAI,kBAAkB,YAAY;AACjD,SAAO,IAAI;AAAA,IACT;AAAA,MACE,OAAO,aAAa;AAAA,MACpB,QAAQ,aAAa,QAAQ,kBAAkB;AAAA,MAC/C,kBAAkB,YAAY;AAG5B,cAAM,aAAa,OAAO,KAAK;AAC/B,eAAO,aAAa,OAAO,YAAY;AAAA,MACzC;AAAA,MACA,OAAO,MAAM;AACX,cAAM,OAAM,oBAAI,KAAK,GAAE,YAAY;AACnC,eAAO;AAAA,UACL;AAAA,UACA,KAAK,QAAQ;AAAA,UACb,MAAM,SAAS;AAAA,UACf,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,UAAU,CAAC,KAAK,iBAAiB,OAAO,aAAa,KAAK,YAAY;AAAA;AAAA;AAAA,MAGtE,iBAAiB,MAAM,aAAa,8BAA8B,EAAE;AAAA,IACtE;AAAA,IACA,EAAE,GAAG,SAAS,QAAQ;AAAA,EACxB;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/orchestration/backlog-scheduler.ts"],"sourcesContent":["/**\n * Daemon-owned extraction backlog scheduler.\n *\n * ONE bounded in-process loop that owns ALL persisted extraction backlog:\n * at startup (existing drain claims + buffered sessions), on every poll tick\n * (new persisted work), and by retrying keys that are still pending — with\n * bounded memory (per-key COUNTS only; candidate scans never retain turn\n * payloads) and bounded outstanding work (the extraction queue's own\n * maxConcurrency gates submissions, so live foreground work keeps its share\n * of the queue).\n *\n * Claim authority: an existing claim — including an EMPTY ack tombstone — is\n * authoritative over the live buffer's in-memory copy. A tombstoned key is\n * never re-claimed or counted as work; new ingress consumes the tombstone\n * through the native save handover, which is what makes the key a candidate\n * again. Claim creation is fenced: the key is reserved synchronously on the\n * extraction queue BEFORE the async claim decision, so a queued live task for\n * the same key cannot start past the claimed-session gate until the decision\n * settles; live capture continues via the native merge-into-claim protocol.\n *\n * Failed, deferred, or policy-denied outcomes keep their turns durable in the\n * claim and re-submit after backoff (exponential from `retryBaseMs` to\n * `retryMaxMs`, reset by progress; denials wait the full max) — never a busy\n * retry. `stop()` aborts in-flight drains at their chunk boundary and leaves\n * every claim retryable; a restarted daemon's scheduler adopts them.\n */\n\nimport { hostname } from \"node:os\";\nimport { log } from \"../logger.js\";\nimport type { Orchestrator } from \"../orchestrator.js\";\nimport type { BufferDrainClaims, DrainLease } from \"../storage/buffer-drain-claims.js\";\nimport { BufferDrainRunner } from \"./buffer-drain-runner.js\";\nimport type { DrainRunnerEvent, DrainSessionOutcome } from \"./buffer-drain-runner.js\";\nimport type { ExtractionQueueCoordinator } from \"./extraction-queue-coordinator.js\";\nimport type { ProviderBreakerSnapshot } from \"./provider-breaker.js\";\n\n/** What the scheduler needs from its host (structurally satisfied by the\n * orchestrator wiring); injectable so tests drive ticks deterministically. */\nexport interface BacklogSchedulerDeps {\n queue: Pick<ExtractionQueueCoordinator, \"tryReserveKey\" | \"releaseKeyReservation\" | \"maxConcurrency\">;\n claims: Pick<BufferDrainClaims, \"list\" | \"listPage\" | \"claimFromSessionFile\" | \"isClaimed\">;\n /** Live per-key pending counts (counts only — never turn payloads). May be\n * async: hosts with a lazily-loaded buffer load it here (idempotent). */\n liveBufferCounts():\n | Map<string, { turns: number; retainedTurns: number }>\n | Promise<Map<string, { turns: number; retainedTurns: number }>>;\n /** A fresh lease for claims this scheduler takes. */\n lease(): DrainLease;\n /** Drain one key to quiescence (BufferDrainRunner.drainSession). */\n drainKey(\n key: string,\n options: { ownerId: string; signal: AbortSignal; onEvent?: (event: DrainRunnerEvent) => void }\n ): Promise<DrainSessionOutcome>;\n /** Shared provider circuit-breaker snapshot (the same instance the run\n * coordinator gates attempts on). While OPEN inside its cooldown window\n * the scheduler skips submission entirely — claims stay durable, and the\n * breaker's single half-open probe (one attempt through once the window\n * lapses) keeps recovery automatic. Optional: hosts without a breaker\n * never skip. */\n breakerSnapshot?(): ProviderBreakerSnapshot;\n /** Test seam: monotonic-ish clock for backoff windows. */\n now?(): number;\n}\n\nexport interface BacklogSchedulerOptions {\n ownerId?: string;\n /** Scan cadence in ms (startup + new-work + retry checks). */\n pollMs?: number;\n retryBaseMs?: number;\n retryMaxMs?: number;\n now?: () => number;\n}\n\nexport interface BacklogSchedulerCounters {\n /** Keys submitted to the drain (claimed or adopted) this process lifetime. */\n claimed: number;\n /** Outcomes with genuinely empty claims (durable outputs preceded ack). */\n processed: number;\n /** Sum of durable outputs (memories + entities) across processed drains. */\n durableOutputs: number;\n /** Re-submissions after a failed/deferred/denied outcome. */\n retried: number;\n denied: { keys: number; turns: number };\n failed: number;\n}\n\nexport type BacklogKeyState = \"inflight\" | \"backoff\" | \"denied\";\n\nexport interface BacklogKeySnapshot {\n key: string;\n state: BacklogKeyState;\n turnsRemaining?: number;\n reason?: string;\n}\n\nexport interface BacklogSchedulerSnapshot {\n counters: BacklogSchedulerCounters;\n inFlight: string[];\n reservedKeys: string[];\n keys: BacklogKeySnapshot[];\n}\n\ninterface KeyState {\n state: BacklogKeyState;\n nextAttemptMs: number;\n /** Last observed remaining turns; progress resets the backoff exponent. */\n turnsRemaining: number;\n reason?: string;\n backoffExponent: number;\n}\n\nconst DEFAULT_POLL_MS = 15_000;\nconst DEFAULT_RETRY_BASE_MS = 30_000;\nconst DEFAULT_RETRY_MAX_MS = 15 * 60_000;\n\nexport class BacklogScheduler {\n private readonly deps: BacklogSchedulerDeps;\n private readonly options: Required<Omit<BacklogSchedulerOptions, \"now\">> & Pick<BacklogSchedulerOptions, \"now\">;\n private readonly keys = new Map<string, KeyState>();\n private readonly inFlight = new Map<string, { controller: AbortController; settled: Promise<void> }>();\n private readonly reserved = new Set<string>();\n private readonly counters: BacklogSchedulerCounters = {\n claimed: 0,\n processed: 0,\n durableOutputs: 0,\n retried: 0,\n denied: { keys: 0, turns: 0 },\n failed: 0,\n };\n private claimCursor: string | undefined;\n private timer: ReturnType<typeof setInterval> | undefined;\n private ticking = false;\n private stopped = true;\n\n constructor(deps: BacklogSchedulerDeps, options: BacklogSchedulerOptions = {}) {\n this.deps = deps;\n this.options = {\n ownerId: options.ownerId ?? `daemon-drain-${process.pid}`,\n pollMs: options.pollMs ?? DEFAULT_POLL_MS,\n retryBaseMs: options.retryBaseMs ?? DEFAULT_RETRY_BASE_MS,\n retryMaxMs: options.retryMaxMs ?? DEFAULT_RETRY_MAX_MS,\n now: options.now,\n };\n }\n\n /** Idempotent. Starts the poll timer (unref'd) and runs an initial tick. */\n start(): void {\n if (!this.stopped) return;\n this.stopped = false;\n this.timer = setInterval(() => void this.tick(), this.options.pollMs);\n this.timer.unref?.();\n void this.tick();\n }\n\n /** Idempotent. Stops the timer, aborts in-flight drains (their claims stay\n * retryable) and waits for them to settle. */\n async stop(): Promise<void> {\n if (this.stopped) return;\n this.stopped = true;\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = undefined;\n }\n const aborts: Promise<void>[] = [];\n for (const entry of this.inFlight.values()) {\n entry.controller.abort(new Error(\"backlog scheduler stopping\"));\n aborts.push(entry.settled);\n }\n await Promise.allSettled(aborts);\n }\n\n /** Bounded snapshot for ops/watchers: counters + per-key states + live sets. */\n snapshot(): BacklogSchedulerSnapshot {\n return {\n counters: {\n claimed: this.counters.claimed,\n processed: this.counters.processed,\n durableOutputs: this.counters.durableOutputs,\n retried: this.counters.retried,\n denied: { ...this.counters.denied },\n failed: this.counters.failed,\n },\n inFlight: [...this.inFlight.keys()],\n reservedKeys: [...this.reserved],\n keys: [...this.keys.entries()].map(([key, state]) => ({\n key,\n state: state.state,\n turnsRemaining: state.turnsRemaining,\n reason: state.reason,\n })),\n };\n }\n\n /** One scan+submit pass (tests drive this instead of the timer). Waits out\n * any in-progress tick first so the pass always actually scans. */\n async tickForTest(): Promise<void> {\n // setImmediate: yields to the event loop so pending I/O (a slow first\n // scan) can finish; a microtask spin would starve it.\n while (this.ticking) await new Promise((resolve) => setImmediate(resolve));\n await this.tick();\n }\n\n /** Await the settle (slot release) of everything currently in flight,\n * optionally excluding one still-gated key (tests). */\n async settleForTest(exclude?: string): Promise<void> {\n for (;;) {\n const pending = [...this.inFlight.entries()].filter(([key]) => key !== exclude).map(([, entry]) => entry.settled);\n if (pending.length === 0) return;\n await Promise.allSettled(pending);\n }\n }\n\n private now(): number {\n return this.options.now?.() ?? Date.now();\n }\n\n private async tick(): Promise<void> {\n if (this.ticking || this.stopped) return;\n this.ticking = true;\n const cursorBeforeTick = this.claimCursor;\n try {\n // Fast bail: a breaker already open must not pay discovery I/O\n // (listPage reads and parses claim bodies on every poll). The\n // submitCandidates guard below still catches a breaker that opens\n // while discovery awaits.\n const breakerBeforeDiscovery = this.deps.breakerSnapshot?.();\n if (\n breakerBeforeDiscovery &&\n breakerBeforeDiscovery.state === \"open\" &&\n this.now() < breakerBeforeDiscovery.openUntilMs\n ) {\n return;\n }\n // stop() may land while discovery's I/O is pending: re-check before\n // submitting anything, and again per candidate.\n // A discovery failure (EACCES/EIO on the claims dir) must not reject\n // into a detached timer callback: it would be an unhandled rejection\n // that terminates the server. Log, skip this pass, retry next poll.\n let candidates: { key: string; needsClaim: boolean }[];\n try {\n candidates = await this.discoverCandidates();\n } catch (err) {\n // Discovery may have listed a page before it failed: the page cursor\n // already moved, so restore it — otherwise those claims wait for the\n // cursor to wrap instead of the next poll.\n this.claimCursor = cursorBeforeTick;\n log.warn(\n `backlog drain: discovery failed; retrying next poll: ${err instanceof Error ? err.message : String(err)}`\n );\n return;\n }\n if (this.stopped) return;\n const dropped = this.submitCandidates(candidates);\n // The concurrency bound stopped submission mid-page: rewind the page\n // cursor so the unsubmitted claims are re-listed on the next tick\n // (already-submitted ones are gated by inFlight and key backoff).\n if (dropped) this.claimCursor = cursorBeforeTick;\n } finally {\n this.ticking = false;\n }\n }\n\n /** Bounded discovery: ONE page of existing claims with pending turns */\n private async discoverCandidates(): Promise<{ key: string; needsClaim: boolean }[]> {\n const out: { key: string; needsClaim: boolean }[] = [];\n const seen = new Set<string>();\n const pageLimit = Math.max(this.submissionLimit() * 4, 16);\n const page = await this.deps.claims.listPage(this.claimCursor, pageLimit);\n for (const listed of page.entries) {\n seen.add(listed.key);\n out.push({ key: listed.key, needsClaim: false });\n }\n this.claimCursor = page.nextCursor;\n for (const [key, counts] of await this.deps.liveBufferCounts()) {\n if (counts.turns + counts.retainedTurns <= 0) continue;\n if (seen.has(key) || this.deps.claims.isClaimed(key)) continue;\n seen.add(key);\n out.push({ key, needsClaim: true });\n }\n return out;\n }\n\n /** Submission bound: the queue's own concurrency limit, read with the\n * documented \"0 disables\" contract — a zero limit submits nothing. */\n private submissionLimit(): number {\n if (this.deps.queue.maxConcurrency <= 0) return 0;\n return this.deps.queue.maxConcurrency;\n }\n\n /** Submit discovery candidates within the queue's concurrency bound. */\n private submitCandidates(candidates: { key: string; needsClaim: boolean }[]): boolean {\n // Breaker-open churn guard: a full attempt reads the claim, rebuilds the\n // buffer/coordinator and re-renders chunks before the breaker fails it\n // fast — pure heap pressure per poll during a provider stall. Skip while\n // the window is open; once it lapses, submissions resume and the\n // breaker's half-open probe runs as usual.\n const breaker = this.deps.breakerSnapshot?.();\n if (breaker && breaker.state === \"open\" && this.now() < breaker.openUntilMs) {\n return true;\n }\n let dropped = false;\n for (const candidate of candidates) {\n if (this.stopped || this.inFlight.size >= this.submissionLimit()) {\n dropped = true;\n break;\n }\n if (!this.candidateEligible(candidate)) continue;\n // Fence the claim decision: reserve the key synchronously BEFORE the\n // async rename so no queued task for it can pass the claimed gate in\n // the meantime. Release happens when the decision settles.\n if (candidate.needsClaim) {\n if (!this.deps.queue.tryReserveKey(candidate.key)) continue;\n this.reserved.add(candidate.key);\n }\n void this.submit(candidate.key, candidate.needsClaim);\n }\n return dropped;\n }\n\n /** inFlight is the authority for \"already submitted\" — key state only\n * exists once an outcome landed (backoff/denied gating below). */\n private candidateEligible(candidate: { key: string; needsClaim: boolean }): boolean {\n if (this.stopped || this.inFlight.size >= this.submissionLimit()) return false;\n if (this.inFlight.has(candidate.key)) return false;\n const state = this.keys.get(candidate.key);\n return !(state && this.now() < state.nextAttemptMs);\n }\n\n /** Claim (when needed), then drain one key; the reservation spans the async\n * claim decision, the queue entry carries the key afterwards. */\n private async submit(key: string, needsClaim: boolean): Promise<void> {\n const controller = new AbortController();\n const { promise: settled, resolve: settle } = Promise.withResolvers<void>();\n this.inFlight.set(key, { controller, settled });\n try {\n if (!(await this.claimForSubmit(key, needsClaim))) return;\n // Stopped between the claim decision and the task: leave the claim\n // with its lease (it expires; the next start adopts) — never drain.\n if (this.stopped) return;\n await this.drainClaimedKey(key, controller.signal);\n } catch (err) {\n // Claim/drain failures are scheduler-level: the claim content is\n // untouched — count failed and back off (never an unhandled rejection\n // in the detached submission).\n this.counters.failed += 1;\n const message = err instanceof Error ? err.message : String(err);\n // SAFETY: a thrown non-Error (incl. null) carries no retry hint; the\n // optional chain reads the hint off Error throws only.\n this.setBackoff(key, (err as { turnsRemaining?: number } | null | undefined)?.turnsRemaining ?? 0, message);\n log.warn(`backlog drain: ${key} submission failed: ${message}`);\n } finally {\n this.inFlight.delete(key);\n this.reserved.delete(key);\n this.deps.queue.releaseKeyReservation(key);\n settle();\n }\n }\n\n /** after all — the key goes quiet without a task. \"claimed\": ours. */\n private async claimForSubmit(key: string, needsClaim: boolean): Promise<boolean> {\n if (!needsClaim) return true;\n try {\n const outcome = await this.deps.claims.claimFromSessionFile(key, this.deps.lease());\n if (outcome === \"empty\") {\n this.keys.delete(key);\n return false;\n }\n return true;\n } finally {\n this.reserved.delete(key);\n this.deps.queue.releaseKeyReservation(key);\n }\n }\n\n /** Drain one claimed key. drainKey reports failures as outcomes; a thrown\n * error still means the claim content is intact — count it failed and\n * back off. */\n private async drainClaimedKey(key: string, signal: AbortSignal): Promise<void> {\n this.counters.claimed += 1;\n try {\n const outcome = await this.deps.drainKey(key, {\n ownerId: this.options.ownerId,\n signal,\n });\n this.applyOutcome(key, outcome);\n } catch (err) {\n this.counters.failed += 1;\n const message = err instanceof Error ? err.message : String(err);\n // SAFETY: a thrown non-Error (incl. null) carries no retry hint; the\n // optional chain reads the hint off Error throws only.\n this.setBackoff(key, (err as { turnsRemaining?: number } | null | undefined)?.turnsRemaining ?? 0, message);\n log.warn(`backlog drain: ${key} threw: ${message}`);\n }\n }\n\n private applyOutcome(key: string, outcome: DrainSessionOutcome): void {\n const deniedTurns = outcome.denied?.reduce((sum, entry) => sum + entry.turns, 0) ?? 0;\n const previous = this.keys.get(key);\n const progressed = outcome.turnsRemaining < (previous?.turnsRemaining ?? Number.POSITIVE_INFINITY);\n if (outcome.status === \"drained\") {\n // The claim is now an empty tombstone: authoritative, nothing pending.\n // New ingress consumes it via the native save path and re-candidates.\n this.keys.delete(key);\n this.counters.processed += 1;\n this.counters.durableOutputs += outcome.durableOutputCount;\n log.info(\n `backlog drain: ${key} drained (${outcome.turnsAtStart} turn(s), ${outcome.durableOutputCount} durable output(s))`\n );\n return;\n }\n this.recordNonDrainedCounters(previous, outcome, deniedTurns);\n const denied = deniedTurns > 0 && outcome.turnsRemaining > 0;\n this.keys.set(key, this.nextKeyState(previous, outcome, denied, progressed));\n log.info(\n `backlog drain: ${key} ${outcome.status} (${outcome.turnsRemaining} turn(s) remaining` +\n `${denied ? `, denied: ${deniedTurns}` : \"\"}${outcome.reason ? `, ${outcome.reason}` : \"\"})`\n );\n }\n\n /** Denied backlog counters for a non-drained outcome. */\n private recordNonDrainedCounters(\n previous: KeyState | undefined,\n outcome: DrainSessionOutcome,\n deniedTurns: number\n ): void {\n if (deniedTurns > 0) {\n this.counters.denied.keys += 1;\n this.counters.denied.turns += deniedTurns;\n }\n if (outcome.status === \"failed\") this.counters.failed += 1;\n else if (previous !== undefined && (previous.state === \"backoff\" || previous.state === \"denied\"))\n this.counters.retried += 1;\n }\n\n /** The post-drain key state: denial waits the full max window (its content\n * is valid but currently unauthorized); progress resets the exponent. */\n private nextKeyState(\n previous: KeyState | undefined,\n outcome: DrainSessionOutcome,\n denied: boolean,\n progressed: boolean\n ): KeyState {\n return {\n state: denied ? \"denied\" : \"backoff\",\n nextAttemptMs: this.now() + this.backoffMs(previous, progressed && !denied),\n turnsRemaining: outcome.turnsRemaining,\n reason: outcome.reason,\n backoffExponent: this.nextBackoffExponent(denied, progressed, previous),\n };\n }\n\n private nextBackoffExponent(denied: boolean, progressed: boolean, previous: KeyState | undefined): number {\n return denied || !progressed ? (previous?.backoffExponent ?? 0) + 1 : 0;\n }\n\n private backoffMs(previous: KeyState | undefined, progressed: boolean): number {\n if (previous?.state === \"denied\") return this.options.retryMaxMs;\n const exponent = progressed ? 0 : (previous?.backoffExponent ?? 0) + 1;\n return Math.min(this.options.retryBaseMs * 2 ** exponent, this.options.retryMaxMs);\n }\n\n private setBackoff(key: string, turnsRemaining: number, reason: string): void {\n const previous = this.keys.get(key);\n this.keys.set(key, {\n state: \"backoff\",\n nextAttemptMs: this.now() + this.backoffMs(previous, false),\n turnsRemaining,\n reason,\n backoffExponent: (previous?.backoffExponent ?? 0) + 1,\n });\n }\n}\n\n/** Lease lifetime for claims the scheduler takes (matches the runner default). */\nconst SCHEDULER_LEASE_MS = 120_000;\n\n/** Wire the scheduler to an orchestrator's own queue, claim store, live buffer\n * counts and drain runner — the daemon's single ownership point. */\nexport function wireBacklogScheduler(\n orchestrator: Orchestrator,\n options: BacklogSchedulerOptions = {}\n): BacklogScheduler {\n const ownerId = options.ownerId ?? `daemon-drain-${process.pid}`;\n const runner = new BufferDrainRunner(orchestrator);\n return new BacklogScheduler(\n {\n queue: orchestrator.extractionQueueCoordinator,\n claims: orchestrator.storage.bufferDrainClaims(),\n liveBufferCounts: async () => {\n // The daemon's buffer may be lazy: ensure the persisted state is in\n // memory before counting (load is guarded/idempotent).\n await orchestrator.buffer.load();\n return orchestrator.buffer.entryCounts();\n },\n lease: () => {\n const now = new Date().toISOString();\n return {\n ownerId,\n pid: process.pid,\n host: hostname(),\n acquiredAt: now,\n heartbeatAt: now,\n leaseMs: SCHEDULER_LEASE_MS,\n };\n },\n drainKey: (key, drainOptions) => runner.drainSession(key, drainOptions),\n // The orchestrator's one shared provider breaker (foreground and every\n // claim-backed drain accumulate toward the same threshold).\n breakerSnapshot: () => orchestrator.getExtractionResilienceStatus().breaker,\n },\n { ...options, ownerId }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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