@remnic/core 10.0.156 → 10.0.158
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 +97 -96
- package/dist/access-cli.js +97 -96
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush-preempt.js +97 -96
- package/dist/access-extraction-force-flush.js +97 -96
- package/dist/access-http-briefing.js +97 -96
- package/dist/access-http-query.js +97 -96
- package/dist/access-http.js +97 -96
- package/dist/access-identity-continuity-surface.js +97 -96
- package/dist/access-lcm-surface.js +97 -96
- package/dist/access-mcp.js +97 -96
- package/dist/access-observe-write-category.js +7 -7
- package/dist/access-observe-write-surface.js +97 -96
- package/dist/access-offline-manifest.js +3 -3
- package/dist/access-operations-batch.js +97 -96
- package/dist/access-operations.js +97 -96
- package/dist/access-recall-concurrency.js +97 -96
- package/dist/access-recall-response.js +97 -96
- package/dist/access-recall-surface.js +97 -96
- package/dist/access-schema.js +4 -4
- package/dist/access-service.js +97 -96
- package/dist/active-recall.js +11 -11
- package/dist/{auto-sync-PSZJHHXB.js → auto-sync-L3M4RKJD.js} +4 -4
- package/dist/briefing.js +11 -11
- package/dist/buffer.js +4 -4
- package/dist/calibration.js +5 -5
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/causal-consolidation.js +12 -12
- package/dist/{chunk-BTNNL7ZW.js → chunk-2GJCSYSF.js} +3 -3
- package/dist/chunk-2GJCSYSF.js.map +1 -0
- package/dist/{chunk-ZZYJNT2J.js → chunk-2MWKUVHT.js} +2 -2
- package/dist/{chunk-WHCD4Z3D.js → chunk-2X4WP4GD.js} +2 -2
- package/dist/{chunk-V7IH24UG.js → chunk-2YJYBAR3.js} +3 -3
- package/dist/{chunk-MX5VGD6C.js → chunk-3DJ6R4CC.js} +4 -4
- package/dist/{chunk-SX6O25WK.js → chunk-3UKPFFMS.js} +2 -2
- package/dist/{chunk-V5NHW44X.js → chunk-52EM4UQU.js} +9 -9
- package/dist/{chunk-2G5XUS4S.js → chunk-5UE45DLK.js} +2 -2
- package/dist/{chunk-B57CAZPI.js → chunk-5V3IBSVB.js} +2 -2
- package/dist/{chunk-4LF5E2LM.js → chunk-66DUCUOC.js} +4 -4
- package/dist/{chunk-EDR6CVWZ.js → chunk-6PEEZSGL.js} +2 -2
- package/dist/{chunk-G5D5JKJJ.js → chunk-6PVS6JET.js} +2 -2
- package/dist/{chunk-DE6KQUAP.js → chunk-773QSFFN.js} +2 -2
- package/dist/{chunk-UI77UYQP.js → chunk-7IJ2H43M.js} +2 -2
- package/dist/{chunk-E4PME33M.js → chunk-7PCWJZXG.js} +2 -2
- package/dist/chunk-AMW3IDCO.js +45 -0
- package/dist/chunk-AMW3IDCO.js.map +1 -0
- package/dist/{chunk-4DCKLDYM.js → chunk-AQ6GV5MU.js} +18 -26
- package/dist/chunk-AQ6GV5MU.js.map +1 -0
- package/dist/{chunk-TE2SBFZD.js → chunk-B7F2G57I.js} +2 -2
- package/dist/{chunk-3BNWEHHC.js → chunk-BDFOBNLX.js} +2 -2
- package/dist/{chunk-PBE7NFB5.js → chunk-BNQJKWWZ.js} +4 -4
- package/dist/{chunk-EPTLYMQY.js → chunk-BT5TAOXG.js} +4 -4
- package/dist/{chunk-IMJKWVT7.js → chunk-BTCZVBV3.js} +3 -3
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-IUAWTN2B.js → chunk-CA7XVRHZ.js} +2 -2
- package/dist/{chunk-4IVRQMZW.js → chunk-DF4BC5MK.js} +2 -2
- package/dist/{chunk-MKJBZR7J.js → chunk-DFK6AQWM.js} +2 -2
- package/dist/{chunk-RJ5L6LRD.js → chunk-DLR3SBOM.js} +4 -4
- package/dist/{chunk-QWDXHBDY.js → chunk-DQ2N7IN6.js} +129 -129
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-D7GZM7AD.js → chunk-DS24H6M4.js} +2 -2
- package/dist/{chunk-X7J56GPG.js → chunk-FEYPXEKE.js} +2 -2
- package/dist/{chunk-AGMMHT4P.js → chunk-GT2HWRST.js} +21 -3
- package/dist/chunk-GT2HWRST.js.map +1 -0
- package/dist/{chunk-VT75USBD.js → chunk-HDU3MIK3.js} +2 -2
- package/dist/{chunk-HIUIJ4AB.js → chunk-HIPHLFIQ.js} +2 -2
- package/dist/{chunk-OQGGJBXX.js → chunk-HKOGDSNS.js} +2 -2
- package/dist/{chunk-TNACU47L.js → chunk-I6IKSDUO.js} +2 -2
- package/dist/{chunk-S7U6PKKV.js → chunk-IEB6XYW6.js} +2 -2
- package/dist/{chunk-C6Z3H23R.js → chunk-JUYTXFDV.js} +2 -2
- package/dist/{chunk-SGD7PCHI.js → chunk-K3KSTSGM.js} +4 -4
- package/dist/{chunk-TS6UKENE.js → chunk-KTZNXQWL.js} +2 -2
- package/dist/{chunk-BDKLKX43.js → chunk-KYZMCH4I.js} +79 -6
- package/dist/{chunk-BDKLKX43.js.map → chunk-KYZMCH4I.js.map} +1 -1
- package/dist/{chunk-DHPGGMGL.js → chunk-MUMQWCE2.js} +2 -2
- package/dist/{chunk-GCVMCCX7.js → chunk-MWEJL436.js} +2 -2
- package/dist/{chunk-L56BEEKZ.js → chunk-MZETCZJF.js} +4 -4
- package/dist/{chunk-IML7HMMK.js → chunk-NBHMEYM4.js} +2 -2
- package/dist/{chunk-H6X7GNDW.js → chunk-NFTFMMKT.js} +2 -2
- package/dist/{chunk-5WZT6WQW.js → chunk-NZHZQGLB.js} +2 -2
- package/dist/{chunk-AO5LKFGO.js → chunk-OFSAKEZB.js} +2 -2
- package/dist/{chunk-6PE4O7UE.js → chunk-PCCNK3RX.js} +2 -2
- package/dist/{chunk-E2R5BTBB.js → chunk-PJFSSXXY.js} +2 -2
- package/dist/{chunk-YQJCWR4R.js → chunk-QO5WYRK2.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-R45L4TV6.js} +6 -6
- package/dist/{chunk-3OUGSOJP.js → chunk-RKJYVJZJ.js} +2 -2
- package/dist/{chunk-5O26UA6Z.js → chunk-RV7IYUBK.js} +5 -5
- package/dist/{chunk-7IGMKQWK.js → chunk-SBQOBY3S.js} +2 -2
- package/dist/{chunk-I7TR2OCU.js → chunk-SQXCUH4L.js} +2 -2
- package/dist/{chunk-XV3I7SLU.js → chunk-TBOCVPXL.js} +4 -4
- package/dist/{chunk-EKXMWUXE.js → chunk-TGH7AU5U.js} +8 -8
- package/dist/{chunk-2COHMHLQ.js → chunk-TLJV42SZ.js} +2 -2
- package/dist/{chunk-R4O4JDTS.js → chunk-TXVTNDQT.js} +2 -2
- package/dist/{chunk-U6CKHWUQ.js → chunk-UADAXWUJ.js} +15 -15
- package/dist/{chunk-TE46SBDJ.js → chunk-UR6COSJN.js} +4 -4
- package/dist/{chunk-4MZCWJVS.js → chunk-VE23DIBH.js} +2 -2
- package/dist/{chunk-PORCJ6NC.js → chunk-VGCK2RV3.js} +2 -2
- package/dist/{chunk-ZIXP27JK.js → chunk-VVVFT435.js} +2 -2
- package/dist/{chunk-GCOQDPOE.js → chunk-VXKPZ6BO.js} +2 -2
- package/dist/{chunk-SAMHDJSQ.js → chunk-XTAGZXOM.js} +2 -2
- package/dist/{chunk-NFLZMAIV.js → chunk-YAFMWQRL.js} +6 -6
- package/dist/{chunk-IYH6NQDI.js → chunk-YKAQKIPR.js} +2 -2
- package/dist/{chunk-5JZ5CYTR.js → chunk-YOR5QBEU.js} +63 -62
- package/dist/chunk-YOR5QBEU.js.map +1 -0
- package/dist/{chunk-7FUE2LSW.js → chunk-ZWSSUWKO.js} +2 -2
- package/dist/cli.js +97 -96
- package/dist/coding/export-okf-codegraph.js +11 -11
- package/dist/compounding/engine.js +12 -12
- package/dist/config.js +11 -11
- package/dist/connectors/codex-materialize-runner.js +11 -11
- package/dist/connectors/index.js +11 -11
- package/dist/convergence-refresh.js +13 -13
- package/dist/corpus-watermark.js +13 -13
- package/dist/deep-recall-http-glue.js +5 -5
- package/dist/directory-sidecars.js +2 -2
- package/dist/entity-recall-reads.d.ts +5 -0
- package/dist/entity-recall-reads.d.ts.map +1 -0
- package/dist/entity-recall-reads.js +16 -0
- package/dist/entity-recall-reads.js.map +1 -0
- package/dist/entity-retrieval.d.ts.map +1 -1
- package/dist/entity-retrieval.js +12 -11
- package/dist/explicit-capture.js +97 -96
- package/dist/extraction.js +21 -21
- package/dist/harmonic-retrieval.js +11 -11
- package/dist/index.js +133 -132
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/local-llm-helpers.d.ts +22 -8
- package/dist/local-llm-helpers.d.ts.map +1 -1
- package/dist/local-llm-helpers.js +11 -1
- package/dist/local-llm-rate-limit.d.ts +1 -5
- package/dist/local-llm-rate-limit.d.ts.map +1 -1
- package/dist/local-llm-rate-limit.js +3 -1
- package/dist/local-llm.d.ts +2 -4
- package/dist/local-llm.d.ts.map +1 -1
- package/dist/local-llm.js +4 -4
- package/dist/location/index.js +13 -13
- package/dist/maintenance/archive-observations.js +2 -2
- package/dist/maintenance/atomic-file.d.ts +1 -1
- package/dist/maintenance/atomic-file.d.ts.map +1 -1
- package/dist/maintenance/atomic-file.js +1 -1
- package/dist/maintenance/memory-governance.js +11 -11
- package/dist/maintenance/migrate-observations.js +3 -3
- package/dist/maintenance/observation-ledger-utils.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
- package/dist/maintenance/rebuild-memory-projection-runner.js +13 -13
- package/dist/maintenance/rebuild-memory-projection.js +12 -12
- package/dist/maintenance/rebuild-observations.js +3 -3
- package/dist/memory-browse.js +4 -4
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/search.js +6 -6
- package/dist/namespaces/storage.js +11 -11
- package/dist/offline-sync-impression-drain.js +2 -2
- package/dist/operator-doctor-corpus.js +14 -14
- package/dist/operator-toolkit.js +18 -18
- package/dist/orchestration/backlog-scheduler.js +98 -97
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +98 -97
- package/dist/orchestration/maintenance.js +24 -24
- package/dist/orchestrator.js +97 -96
- package/dist/recall-navigation.js +97 -96
- package/dist/recall-state-view-admission.js +4 -4
- package/dist/recall-state.js +2 -2
- package/dist/recall-why-service.js +4 -4
- package/dist/relevance.js +2 -2
- package/dist/resume-bundles.js +12 -12
- 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 +12 -12
- package/dist/semantic-rule-promotion.js +11 -11
- package/dist/semantic-rule-verifier.js +11 -11
- package/dist/source-agent-qualifier.js +14 -14
- package/dist/standup/build.js +11 -11
- package/dist/storage.js +10 -10
- package/dist/summarizer.js +5 -5
- package/dist/support-passport/index.js +5 -5
- 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 +12 -12
- package/dist/verified-recall.js +11 -11
- package/dist/who-knows-cli.js +12 -12
- package/dist/who-knows.js +11 -11
- package/package.json +12 -2
- package/src/entity-recall-reads.ts +40 -0
- package/src/entity-retrieval.ts +16 -22
- package/src/local-llm-helpers.ts +116 -14
- package/src/local-llm-rate-limit.test.ts +79 -1
- package/src/local-llm-rate-limit.ts +37 -1
- package/src/local-llm.ts +75 -74
- package/src/maintenance/atomic-file.ts +2 -1
- package/dist/chunk-4DCKLDYM.js.map +0 -1
- package/dist/chunk-5JZ5CYTR.js.map +0 -1
- package/dist/chunk-AGMMHT4P.js.map +0 -1
- package/dist/chunk-BTNNL7ZW.js.map +0 -1
- /package/dist/{auto-sync-PSZJHHXB.js.map → auto-sync-L3M4RKJD.js.map} +0 -0
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-ZZYJNT2J.js.map → chunk-2MWKUVHT.js.map} +0 -0
- /package/dist/{chunk-WHCD4Z3D.js.map → chunk-2X4WP4GD.js.map} +0 -0
- /package/dist/{chunk-V7IH24UG.js.map → chunk-2YJYBAR3.js.map} +0 -0
- /package/dist/{chunk-MX5VGD6C.js.map → chunk-3DJ6R4CC.js.map} +0 -0
- /package/dist/{chunk-SX6O25WK.js.map → chunk-3UKPFFMS.js.map} +0 -0
- /package/dist/{chunk-V5NHW44X.js.map → chunk-52EM4UQU.js.map} +0 -0
- /package/dist/{chunk-2G5XUS4S.js.map → chunk-5UE45DLK.js.map} +0 -0
- /package/dist/{chunk-B57CAZPI.js.map → chunk-5V3IBSVB.js.map} +0 -0
- /package/dist/{chunk-4LF5E2LM.js.map → chunk-66DUCUOC.js.map} +0 -0
- /package/dist/{chunk-EDR6CVWZ.js.map → chunk-6PEEZSGL.js.map} +0 -0
- /package/dist/{chunk-G5D5JKJJ.js.map → chunk-6PVS6JET.js.map} +0 -0
- /package/dist/{chunk-DE6KQUAP.js.map → chunk-773QSFFN.js.map} +0 -0
- /package/dist/{chunk-UI77UYQP.js.map → chunk-7IJ2H43M.js.map} +0 -0
- /package/dist/{chunk-E4PME33M.js.map → chunk-7PCWJZXG.js.map} +0 -0
- /package/dist/{chunk-TE2SBFZD.js.map → chunk-B7F2G57I.js.map} +0 -0
- /package/dist/{chunk-3BNWEHHC.js.map → chunk-BDFOBNLX.js.map} +0 -0
- /package/dist/{chunk-PBE7NFB5.js.map → chunk-BNQJKWWZ.js.map} +0 -0
- /package/dist/{chunk-EPTLYMQY.js.map → chunk-BT5TAOXG.js.map} +0 -0
- /package/dist/{chunk-IMJKWVT7.js.map → chunk-BTCZVBV3.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-IUAWTN2B.js.map → chunk-CA7XVRHZ.js.map} +0 -0
- /package/dist/{chunk-4IVRQMZW.js.map → chunk-DF4BC5MK.js.map} +0 -0
- /package/dist/{chunk-MKJBZR7J.js.map → chunk-DFK6AQWM.js.map} +0 -0
- /package/dist/{chunk-RJ5L6LRD.js.map → chunk-DLR3SBOM.js.map} +0 -0
- /package/dist/{chunk-QWDXHBDY.js.map → chunk-DQ2N7IN6.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-D7GZM7AD.js.map → chunk-DS24H6M4.js.map} +0 -0
- /package/dist/{chunk-X7J56GPG.js.map → chunk-FEYPXEKE.js.map} +0 -0
- /package/dist/{chunk-VT75USBD.js.map → chunk-HDU3MIK3.js.map} +0 -0
- /package/dist/{chunk-HIUIJ4AB.js.map → chunk-HIPHLFIQ.js.map} +0 -0
- /package/dist/{chunk-OQGGJBXX.js.map → chunk-HKOGDSNS.js.map} +0 -0
- /package/dist/{chunk-TNACU47L.js.map → chunk-I6IKSDUO.js.map} +0 -0
- /package/dist/{chunk-S7U6PKKV.js.map → chunk-IEB6XYW6.js.map} +0 -0
- /package/dist/{chunk-C6Z3H23R.js.map → chunk-JUYTXFDV.js.map} +0 -0
- /package/dist/{chunk-SGD7PCHI.js.map → chunk-K3KSTSGM.js.map} +0 -0
- /package/dist/{chunk-TS6UKENE.js.map → chunk-KTZNXQWL.js.map} +0 -0
- /package/dist/{chunk-DHPGGMGL.js.map → chunk-MUMQWCE2.js.map} +0 -0
- /package/dist/{chunk-GCVMCCX7.js.map → chunk-MWEJL436.js.map} +0 -0
- /package/dist/{chunk-L56BEEKZ.js.map → chunk-MZETCZJF.js.map} +0 -0
- /package/dist/{chunk-IML7HMMK.js.map → chunk-NBHMEYM4.js.map} +0 -0
- /package/dist/{chunk-H6X7GNDW.js.map → chunk-NFTFMMKT.js.map} +0 -0
- /package/dist/{chunk-5WZT6WQW.js.map → chunk-NZHZQGLB.js.map} +0 -0
- /package/dist/{chunk-AO5LKFGO.js.map → chunk-OFSAKEZB.js.map} +0 -0
- /package/dist/{chunk-6PE4O7UE.js.map → chunk-PCCNK3RX.js.map} +0 -0
- /package/dist/{chunk-E2R5BTBB.js.map → chunk-PJFSSXXY.js.map} +0 -0
- /package/dist/{chunk-YQJCWR4R.js.map → chunk-QO5WYRK2.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-R45L4TV6.js.map} +0 -0
- /package/dist/{chunk-3OUGSOJP.js.map → chunk-RKJYVJZJ.js.map} +0 -0
- /package/dist/{chunk-5O26UA6Z.js.map → chunk-RV7IYUBK.js.map} +0 -0
- /package/dist/{chunk-7IGMKQWK.js.map → chunk-SBQOBY3S.js.map} +0 -0
- /package/dist/{chunk-I7TR2OCU.js.map → chunk-SQXCUH4L.js.map} +0 -0
- /package/dist/{chunk-XV3I7SLU.js.map → chunk-TBOCVPXL.js.map} +0 -0
- /package/dist/{chunk-EKXMWUXE.js.map → chunk-TGH7AU5U.js.map} +0 -0
- /package/dist/{chunk-2COHMHLQ.js.map → chunk-TLJV42SZ.js.map} +0 -0
- /package/dist/{chunk-R4O4JDTS.js.map → chunk-TXVTNDQT.js.map} +0 -0
- /package/dist/{chunk-U6CKHWUQ.js.map → chunk-UADAXWUJ.js.map} +0 -0
- /package/dist/{chunk-TE46SBDJ.js.map → chunk-UR6COSJN.js.map} +0 -0
- /package/dist/{chunk-4MZCWJVS.js.map → chunk-VE23DIBH.js.map} +0 -0
- /package/dist/{chunk-PORCJ6NC.js.map → chunk-VGCK2RV3.js.map} +0 -0
- /package/dist/{chunk-ZIXP27JK.js.map → chunk-VVVFT435.js.map} +0 -0
- /package/dist/{chunk-GCOQDPOE.js.map → chunk-VXKPZ6BO.js.map} +0 -0
- /package/dist/{chunk-SAMHDJSQ.js.map → chunk-XTAGZXOM.js.map} +0 -0
- /package/dist/{chunk-NFLZMAIV.js.map → chunk-YAFMWQRL.js.map} +0 -0
- /package/dist/{chunk-IYH6NQDI.js.map → chunk-YKAQKIPR.js.map} +0 -0
- /package/dist/{chunk-7FUE2LSW.js.map → chunk-ZWSSUWKO.js.map} +0 -0
package/dist/verified-recall.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compareVerifiedEpisodeResults,
|
|
3
3
|
searchVerifiedEpisodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XTAGZXOM.js";
|
|
5
5
|
import "./chunk-B7RWBZXW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-YAFMWQRL.js";
|
|
7
7
|
import "./chunk-QGVCFVX6.js";
|
|
8
8
|
import "./chunk-UHVXE24Y.js";
|
|
9
9
|
import "./chunk-BL7WULM5.js";
|
|
10
10
|
import "./chunk-G6OFEGUR.js";
|
|
11
11
|
import "./chunk-SDGD6MYV.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-TLJV42SZ.js";
|
|
13
|
+
import "./chunk-MZETCZJF.js";
|
|
14
14
|
import "./chunk-YCK26VSL.js";
|
|
15
15
|
import "./chunk-EXYT52NR.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-3DJ6R4CC.js";
|
|
17
|
+
import "./chunk-66DUCUOC.js";
|
|
18
18
|
import "./chunk-CYEPCZN5.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-Y5NLBXPV.js";
|
|
19
|
+
import "./chunk-DLR3SBOM.js";
|
|
21
20
|
import "./chunk-WNEVEMJ3.js";
|
|
21
|
+
import "./chunk-Y5NLBXPV.js";
|
|
22
22
|
import "./chunk-TFA6HPOA.js";
|
|
23
23
|
import "./chunk-F4TWWUMP.js";
|
|
24
24
|
import "./chunk-72A4L5JJ.js";
|
|
@@ -28,14 +28,14 @@ import "./chunk-PPUNC7UX.js";
|
|
|
28
28
|
import "./chunk-X3724WL4.js";
|
|
29
29
|
import "./chunk-L76BQSWB.js";
|
|
30
30
|
import "./chunk-MRPOZBJC.js";
|
|
31
|
-
import "./chunk-LDXUBPMO.js";
|
|
32
31
|
import "./chunk-DM2T26WE.js";
|
|
32
|
+
import "./chunk-LDXUBPMO.js";
|
|
33
33
|
import "./chunk-UWVMD54T.js";
|
|
34
34
|
import "./chunk-JNDMIAJ4.js";
|
|
35
35
|
import "./chunk-AAD2ZS6P.js";
|
|
36
36
|
import "./chunk-ZIKENA2C.js";
|
|
37
37
|
import "./chunk-YXZG5TVN.js";
|
|
38
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-RKJYVJZJ.js";
|
|
39
39
|
import "./chunk-SCU65EZI.js";
|
|
40
40
|
import "./chunk-3ONXXHQO.js";
|
|
41
41
|
import "./chunk-3WU7XOFN.js";
|
|
@@ -88,7 +88,7 @@ import "./chunk-TSUSHXBW.js";
|
|
|
88
88
|
import "./chunk-LEII44QG.js";
|
|
89
89
|
import "./chunk-HLUHEMN4.js";
|
|
90
90
|
import "./chunk-5FVVY2EB.js";
|
|
91
|
-
import "./chunk-
|
|
91
|
+
import "./chunk-2GJCSYSF.js";
|
|
92
92
|
import "./chunk-JDSVLVCG.js";
|
|
93
93
|
import "./chunk-5GKPFL3S.js";
|
|
94
94
|
import "./chunk-JAKIDQB2.js";
|
package/dist/who-knows-cli.js
CHANGED
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
renderWhoKnows,
|
|
5
5
|
renderWhoKnowsJson,
|
|
6
6
|
renderWhoKnowsText
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-DS24H6M4.js";
|
|
8
|
+
import "./chunk-ZWSSUWKO.js";
|
|
9
|
+
import "./chunk-YAFMWQRL.js";
|
|
10
10
|
import "./chunk-QGVCFVX6.js";
|
|
11
11
|
import "./chunk-UHVXE24Y.js";
|
|
12
12
|
import "./chunk-BL7WULM5.js";
|
|
13
13
|
import "./chunk-G6OFEGUR.js";
|
|
14
14
|
import "./chunk-SDGD6MYV.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-TLJV42SZ.js";
|
|
16
|
+
import "./chunk-MZETCZJF.js";
|
|
17
17
|
import "./chunk-YCK26VSL.js";
|
|
18
18
|
import "./chunk-EXYT52NR.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-3DJ6R4CC.js";
|
|
20
|
+
import "./chunk-66DUCUOC.js";
|
|
21
21
|
import "./chunk-CYEPCZN5.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-Y5NLBXPV.js";
|
|
22
|
+
import "./chunk-DLR3SBOM.js";
|
|
24
23
|
import "./chunk-WNEVEMJ3.js";
|
|
24
|
+
import "./chunk-Y5NLBXPV.js";
|
|
25
25
|
import "./chunk-TFA6HPOA.js";
|
|
26
26
|
import "./chunk-F4TWWUMP.js";
|
|
27
27
|
import "./chunk-72A4L5JJ.js";
|
|
@@ -31,14 +31,14 @@ import "./chunk-PPUNC7UX.js";
|
|
|
31
31
|
import "./chunk-X3724WL4.js";
|
|
32
32
|
import "./chunk-L76BQSWB.js";
|
|
33
33
|
import "./chunk-MRPOZBJC.js";
|
|
34
|
-
import "./chunk-LDXUBPMO.js";
|
|
35
34
|
import "./chunk-DM2T26WE.js";
|
|
35
|
+
import "./chunk-LDXUBPMO.js";
|
|
36
36
|
import "./chunk-UWVMD54T.js";
|
|
37
37
|
import "./chunk-JNDMIAJ4.js";
|
|
38
38
|
import "./chunk-AAD2ZS6P.js";
|
|
39
39
|
import "./chunk-ZIKENA2C.js";
|
|
40
40
|
import "./chunk-YXZG5TVN.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-RKJYVJZJ.js";
|
|
42
42
|
import "./chunk-SCU65EZI.js";
|
|
43
43
|
import "./chunk-3ONXXHQO.js";
|
|
44
44
|
import "./chunk-3WU7XOFN.js";
|
|
@@ -91,7 +91,7 @@ import "./chunk-TSUSHXBW.js";
|
|
|
91
91
|
import "./chunk-LEII44QG.js";
|
|
92
92
|
import "./chunk-HLUHEMN4.js";
|
|
93
93
|
import "./chunk-5FVVY2EB.js";
|
|
94
|
-
import "./chunk-
|
|
94
|
+
import "./chunk-2GJCSYSF.js";
|
|
95
95
|
import "./chunk-JDSVLVCG.js";
|
|
96
96
|
import "./chunk-5GKPFL3S.js";
|
|
97
97
|
import "./chunk-JAKIDQB2.js";
|
package/dist/who-knows.js
CHANGED
|
@@ -9,23 +9,23 @@ import {
|
|
|
9
9
|
loadWhoKnowsEntities,
|
|
10
10
|
tokenizeTopic,
|
|
11
11
|
validateWhoKnowsInput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ZWSSUWKO.js";
|
|
13
|
+
import "./chunk-YAFMWQRL.js";
|
|
14
14
|
import "./chunk-QGVCFVX6.js";
|
|
15
15
|
import "./chunk-UHVXE24Y.js";
|
|
16
16
|
import "./chunk-BL7WULM5.js";
|
|
17
17
|
import "./chunk-G6OFEGUR.js";
|
|
18
18
|
import "./chunk-SDGD6MYV.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-TLJV42SZ.js";
|
|
20
|
+
import "./chunk-MZETCZJF.js";
|
|
21
21
|
import "./chunk-YCK26VSL.js";
|
|
22
22
|
import "./chunk-EXYT52NR.js";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-3DJ6R4CC.js";
|
|
24
|
+
import "./chunk-66DUCUOC.js";
|
|
25
25
|
import "./chunk-CYEPCZN5.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-Y5NLBXPV.js";
|
|
26
|
+
import "./chunk-DLR3SBOM.js";
|
|
28
27
|
import "./chunk-WNEVEMJ3.js";
|
|
28
|
+
import "./chunk-Y5NLBXPV.js";
|
|
29
29
|
import "./chunk-TFA6HPOA.js";
|
|
30
30
|
import "./chunk-F4TWWUMP.js";
|
|
31
31
|
import "./chunk-72A4L5JJ.js";
|
|
@@ -35,14 +35,14 @@ import "./chunk-PPUNC7UX.js";
|
|
|
35
35
|
import "./chunk-X3724WL4.js";
|
|
36
36
|
import "./chunk-L76BQSWB.js";
|
|
37
37
|
import "./chunk-MRPOZBJC.js";
|
|
38
|
-
import "./chunk-LDXUBPMO.js";
|
|
39
38
|
import "./chunk-DM2T26WE.js";
|
|
39
|
+
import "./chunk-LDXUBPMO.js";
|
|
40
40
|
import "./chunk-UWVMD54T.js";
|
|
41
41
|
import "./chunk-JNDMIAJ4.js";
|
|
42
42
|
import "./chunk-AAD2ZS6P.js";
|
|
43
43
|
import "./chunk-ZIKENA2C.js";
|
|
44
44
|
import "./chunk-YXZG5TVN.js";
|
|
45
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-RKJYVJZJ.js";
|
|
46
46
|
import "./chunk-SCU65EZI.js";
|
|
47
47
|
import "./chunk-3ONXXHQO.js";
|
|
48
48
|
import "./chunk-3WU7XOFN.js";
|
|
@@ -95,7 +95,7 @@ import "./chunk-TSUSHXBW.js";
|
|
|
95
95
|
import "./chunk-LEII44QG.js";
|
|
96
96
|
import "./chunk-HLUHEMN4.js";
|
|
97
97
|
import "./chunk-5FVVY2EB.js";
|
|
98
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-2GJCSYSF.js";
|
|
99
99
|
import "./chunk-JDSVLVCG.js";
|
|
100
100
|
import "./chunk-5GKPFL3S.js";
|
|
101
101
|
import "./chunk-JAKIDQB2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.158",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3339,6 +3339,16 @@
|
|
|
3339
3339
|
"types": "./dist/write-quarantine.d.ts",
|
|
3340
3340
|
"remnic-source": "./src/write-quarantine.ts",
|
|
3341
3341
|
"import": "./dist/write-quarantine.js"
|
|
3342
|
+
},
|
|
3343
|
+
"./local-llm-helpers": {
|
|
3344
|
+
"types": "./dist/local-llm-helpers.d.ts",
|
|
3345
|
+
"remnic-source": "./src/local-llm-helpers.ts",
|
|
3346
|
+
"import": "./dist/local-llm-helpers.js"
|
|
3347
|
+
},
|
|
3348
|
+
"./local-llm-helpers.js": {
|
|
3349
|
+
"types": "./dist/local-llm-helpers.d.ts",
|
|
3350
|
+
"remnic-source": "./src/local-llm-helpers.ts",
|
|
3351
|
+
"import": "./dist/local-llm-helpers.js"
|
|
3342
3352
|
}
|
|
3343
3353
|
},
|
|
3344
3354
|
"files": [
|
|
@@ -3396,7 +3406,7 @@
|
|
|
3396
3406
|
"core"
|
|
3397
3407
|
],
|
|
3398
3408
|
"peerDependencies": {
|
|
3399
|
-
"@remnic/coding-graph": "^10.0.
|
|
3409
|
+
"@remnic/coding-graph": "^10.0.158"
|
|
3400
3410
|
},
|
|
3401
3411
|
"peerDependenciesMeta": {
|
|
3402
3412
|
"@remnic/coding-graph": {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { isAbortError, raceAbort } from "./abort-error.js";
|
|
3
|
+
import { resolveNamespaceCapabilities } from "./capabilities.js";
|
|
4
|
+
import { checkEntityRecallAbort } from "./entity-recall-cancellation.js";
|
|
5
|
+
import { collectNativeKnowledgeChunks, type NativeKnowledgeChunk } from "./native-knowledge.js";
|
|
6
|
+
import type { PluginConfig } from "./types.js";
|
|
7
|
+
|
|
8
|
+
export async function readEntityIndexStateText(file: string, abortSignal?: AbortSignal): Promise<string> {
|
|
9
|
+
checkEntityRecallAbort(abortSignal);
|
|
10
|
+
// Release this waiter when cancelled; the underlying shared filesystem read
|
|
11
|
+
// may still settle later. Ordinary read failures keep the existing fallback.
|
|
12
|
+
const raw = await raceAbort(readFile(file, "utf-8"), abortSignal, "entity recall aborted")
|
|
13
|
+
.catch((err) => {
|
|
14
|
+
if (isAbortError(err)) throw err;
|
|
15
|
+
return "";
|
|
16
|
+
});
|
|
17
|
+
checkEntityRecallAbort(abortSignal);
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function readNativeChunks(
|
|
22
|
+
config: PluginConfig,
|
|
23
|
+
recallNamespaces?: string[],
|
|
24
|
+
abortSignal?: AbortSignal,
|
|
25
|
+
): Promise<NativeKnowledgeChunk[]> {
|
|
26
|
+
if (!config.nativeKnowledge?.enabled) return [];
|
|
27
|
+
return collectNativeKnowledgeChunks({
|
|
28
|
+
workspaceDir: config.workspaceDir,
|
|
29
|
+
memoryDir: config.memoryDir,
|
|
30
|
+
config: config.nativeKnowledge,
|
|
31
|
+
recallNamespaces: resolveNamespaceCapabilities(config).namespaces ? recallNamespaces : undefined,
|
|
32
|
+
defaultNamespace: config.defaultNamespace,
|
|
33
|
+
abortSignal,
|
|
34
|
+
}).catch((err) => {
|
|
35
|
+
// Cancellation is the caller giving up (issue #2291); degrade only genuine
|
|
36
|
+
// read/sync failures, never a cancellation.
|
|
37
|
+
if (isAbortError(err)) throw err;
|
|
38
|
+
return [];
|
|
39
|
+
});
|
|
40
|
+
}
|
package/src/entity-retrieval.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { resolveNamespaceCapabilities } from "./capabilities.js";
|
|
2
|
+
import { readNativeChunks, readEntityIndexStateText } from "./entity-recall-reads.js";
|
|
2
3
|
import { renderAuthorityBoundContent } from "./recall-context-composition.js";
|
|
3
4
|
import { createHash } from "node:crypto";
|
|
4
5
|
import { sanitizeMemoryContent } from "./sanitize.js";
|
|
5
6
|
import { readFile } from "node:fs/promises";
|
|
6
7
|
import path from "node:path";
|
|
7
|
-
import {
|
|
8
|
+
import type { NativeKnowledgeChunk } from "./native-knowledge.js";
|
|
8
9
|
import { compareEntityTimestamps, normalizeEntityName, type StorageManager } from "./storage.js";
|
|
9
10
|
import { normalizeEntityText, resolveRequestedEntitySectionKeys } from "./entity-schema.js";
|
|
10
11
|
import type { EntityStructuredSection, MemoryFile, PluginConfig, TranscriptEntry } from "./types.js";
|
|
@@ -238,19 +239,6 @@ function buildAliasIndex(entries: EntityMentionIndexEntry[]): Map<string, Entity
|
|
|
238
239
|
}
|
|
239
240
|
return index;
|
|
240
241
|
}
|
|
241
|
-
async function readNativeChunks(
|
|
242
|
-
config: PluginConfig,
|
|
243
|
-
recallNamespaces?: string[],
|
|
244
|
-
): Promise<NativeKnowledgeChunk[]> {
|
|
245
|
-
if (!config.nativeKnowledge?.enabled) return [];
|
|
246
|
-
return collectNativeKnowledgeChunks({
|
|
247
|
-
workspaceDir: config.workspaceDir,
|
|
248
|
-
memoryDir: config.memoryDir,
|
|
249
|
-
config: config.nativeKnowledge,
|
|
250
|
-
recallNamespaces: resolveNamespaceCapabilities(config).namespaces ? recallNamespaces : undefined,
|
|
251
|
-
defaultNamespace: config.defaultNamespace,
|
|
252
|
-
}).catch(() => []);
|
|
253
|
-
}
|
|
254
242
|
async function resolveEntityIndexStorages(
|
|
255
243
|
storage: StorageManager,
|
|
256
244
|
config: PluginConfig,
|
|
@@ -284,8 +272,11 @@ function entityIndexStatePath(storage: StorageManager): string {
|
|
|
284
272
|
return path.join(storage.dir, "state", "entity-mention-index.json");
|
|
285
273
|
}
|
|
286
274
|
|
|
287
|
-
async function readEntityIndexState(
|
|
288
|
-
|
|
275
|
+
async function readEntityIndexState(
|
|
276
|
+
storage: StorageManager,
|
|
277
|
+
abortSignal?: AbortSignal,
|
|
278
|
+
): Promise<EntityMentionIndex | null> {
|
|
279
|
+
const raw = await readEntityIndexStateText(entityIndexStatePath(storage), abortSignal);
|
|
289
280
|
if (!raw) return null;
|
|
290
281
|
try {
|
|
291
282
|
const parsed = JSON.parse(raw) as Partial<EntityMentionIndex>;
|
|
@@ -300,6 +291,7 @@ async function readCurrentPersistedEntityIndex(
|
|
|
300
291
|
config: PluginConfig,
|
|
301
292
|
recallNamespaces?: string[],
|
|
302
293
|
namespaceStorage?: (namespace: string) => Promise<StorageManager>,
|
|
294
|
+
abortSignal?: AbortSignal,
|
|
303
295
|
): Promise<EntityMentionIndex | null> {
|
|
304
296
|
if (
|
|
305
297
|
resolveNamespaceCapabilities(config).namespaces &&
|
|
@@ -309,7 +301,8 @@ async function readCurrentPersistedEntityIndex(
|
|
|
309
301
|
) {
|
|
310
302
|
return null;
|
|
311
303
|
}
|
|
312
|
-
const index = await readEntityIndexState(storage);
|
|
304
|
+
const index = await readEntityIndexState(storage, abortSignal);
|
|
305
|
+
checkEntityRecallAbort(abortSignal);
|
|
313
306
|
if (!entityMentionPersistedIndexReadable(storage.dir) || !index || index.entityStatusVersion !== storage.getMemoryStatusVersion()) {
|
|
314
307
|
return null;
|
|
315
308
|
}
|
|
@@ -430,12 +423,12 @@ async function buildEntityMentionIndex(
|
|
|
430
423
|
const persistGeneration = entityMentionCacheGeneration(storage.dir);
|
|
431
424
|
const entityStatusVersionBefore = shouldPersistIndex ? storage.getMemoryStatusVersion() : undefined;
|
|
432
425
|
const [previousIndex, entityFileSets, memorySets, nativeChunks] = await Promise.all([
|
|
433
|
-
shouldPersistIndex ? readEntityIndexState(storage) : Promise.resolve(null),
|
|
426
|
+
shouldPersistIndex ? readEntityIndexState(storage, abortSignal) : Promise.resolve(null),
|
|
434
427
|
Promise.all(storages.map((scopedStorage) => scopedStorage.readAllEntityFiles({ abortSignal }))),
|
|
435
428
|
carrySnippets
|
|
436
429
|
? Promise.resolve([])
|
|
437
430
|
: Promise.all(storages.map((scopedStorage) => scopedStorage.readAllMemories({ abortSignal }))),
|
|
438
|
-
nativeChunksOverride ? Promise.resolve(nativeChunksOverride) : readNativeChunks(config, recallNamespaces),
|
|
431
|
+
nativeChunksOverride ? Promise.resolve(nativeChunksOverride) : readNativeChunks(config, recallNamespaces, abortSignal),
|
|
439
432
|
]);
|
|
440
433
|
// The bulk reads now stop at their own scan boundaries (issue #2307); this
|
|
441
434
|
// checkpoint still guards the (larger) indexing pass over their results.
|
|
@@ -996,6 +989,7 @@ export async function buildEntityRecallSection(options: BuildEntityRecallSection
|
|
|
996
989
|
options.config,
|
|
997
990
|
options.recallNamespaces,
|
|
998
991
|
options.namespaceStorage,
|
|
992
|
+
options.abortSignal,
|
|
999
993
|
);
|
|
1000
994
|
checkEntityRecallAbort(options.abortSignal);
|
|
1001
995
|
let nativeChunks: NativeKnowledgeChunk[] | undefined;
|
|
@@ -1004,7 +998,7 @@ export async function buildEntityRecallSection(options: BuildEntityRecallSection
|
|
|
1004
998
|
persistedIndex &&
|
|
1005
999
|
resolveLanguageIndependentExplicitCandidates(persistedIndex, options.query).length === 0
|
|
1006
1000
|
) {
|
|
1007
|
-
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces);
|
|
1001
|
+
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces, options.abortSignal);
|
|
1008
1002
|
if (!hasFreshNativeExplicitMention(persistedIndex, nativeChunks, options.query)) {
|
|
1009
1003
|
return entityRecallSectionAbsent(options.abortSignal);
|
|
1010
1004
|
}
|
|
@@ -1014,7 +1008,7 @@ export async function buildEntityRecallSection(options: BuildEntityRecallSection
|
|
|
1014
1008
|
options.namespaceStorage !== undefined &&
|
|
1015
1009
|
(options.recallNamespaces?.length ?? 0) > 0;
|
|
1016
1010
|
if (namespaceScoped) {
|
|
1017
|
-
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces);
|
|
1011
|
+
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces, options.abortSignal);
|
|
1018
1012
|
}
|
|
1019
1013
|
const resolvedStorages = namespaceScoped
|
|
1020
1014
|
? await resolveEntityIndexStorages(
|
|
@@ -1025,7 +1019,7 @@ export async function buildEntityRecallSection(options: BuildEntityRecallSection
|
|
|
1025
1019
|
)
|
|
1026
1020
|
: undefined;
|
|
1027
1021
|
if (!nativeChunks) {
|
|
1028
|
-
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces);
|
|
1022
|
+
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces, options.abortSignal);
|
|
1029
1023
|
}
|
|
1030
1024
|
const indexStorages = resolvedStorages ?? [options.storage];
|
|
1031
1025
|
const index = await resolveEntityMentionIndex({
|
package/src/local-llm-helpers.ts
CHANGED
|
@@ -274,21 +274,123 @@ export class SingleFlightProbe {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
/**
|
|
278
|
-
*
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
277
|
+
/** True when `value` is safe for `fetch` request headers. Node's `Headers`
|
|
278
|
+
* accepts a ByteString: controls and DEL are out, and so is anything above
|
|
279
|
+
* U+00FF — `é` is sendable, `Ā` is not (Kilo review on #3474). */
|
|
280
|
+
export function isHttpHeaderFieldValue(value: string): boolean {
|
|
281
|
+
if (!value) return false;
|
|
282
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
283
|
+
const code = value.charCodeAt(i);
|
|
284
|
+
if (code < 0x20 || code === 0x7f || code > 0xff) return false;
|
|
285
|
+
}
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function trimTrailingSlashes(url: string): string {
|
|
290
|
+
let end = url.length;
|
|
291
|
+
while (end > 0 && url.charCodeAt(end - 1) === 47) end -= 1;
|
|
292
|
+
return end === url.length ? url : url.slice(0, end);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Circuit-breaker and rate-limit scope when recall/extraction share one proxy URL. */
|
|
296
|
+
export function formatLocalLlmPoolKey(chatUrl: string, operation: string): string {
|
|
297
|
+
let normalized = chatUrl.replace("localhost", "127.0.0.1");
|
|
298
|
+
normalized = trimTrailingSlashes(normalized);
|
|
299
|
+
if (normalized.endsWith("/v1")) {
|
|
300
|
+
normalized = normalized.slice(0, -3);
|
|
301
|
+
}
|
|
302
|
+
const completions = normalized.endsWith("/chat/completions")
|
|
303
|
+
? normalized
|
|
304
|
+
: `${normalized}/v1/chat/completions`;
|
|
305
|
+
return `${completions}|op=${operation}`;
|
|
306
|
+
}
|
|
284
307
|
|
|
285
|
-
/**
|
|
308
|
+
/** HTTP headers the jarvis-ml recall proxy reads for pool routing. */
|
|
286
309
|
export function buildLocalLlmRoutingHeaders(
|
|
287
310
|
operation: string,
|
|
288
|
-
priority:
|
|
289
|
-
):
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
311
|
+
priority: "recall-critical" | "background" | undefined,
|
|
312
|
+
): Record<string, string> {
|
|
313
|
+
const routingEntries: Array<readonly [string, string]> = [
|
|
314
|
+
["Content-Type", "application/json"],
|
|
315
|
+
];
|
|
316
|
+
if (operation !== "unspecified" && isHttpHeaderFieldValue(operation)) {
|
|
317
|
+
routingEntries.push(["X-Remnic-Operation", operation]);
|
|
318
|
+
}
|
|
319
|
+
if (priority) {
|
|
320
|
+
routingEntries.push(["X-Remnic-Priority", priority]);
|
|
321
|
+
}
|
|
322
|
+
return Object.fromEntries(routingEntries) satisfies Record<string, string>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const LOCAL_LLM_GLOBAL_BACKEND_STATE = "__openclawEngramLocalLlmBackendState";
|
|
326
|
+
|
|
327
|
+
export type LocalLlmBackendPoolState = {
|
|
328
|
+
untilMs: number;
|
|
329
|
+
reason: string;
|
|
330
|
+
/** Once the trip lapses this is set instead of deleting the entry: every
|
|
331
|
+
* client must observe the transition once, so a tombstone stays visible for
|
|
332
|
+
* BACKEND_POOL_TOMBSTONE_MS. */
|
|
333
|
+
expiredAtMs?: number;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/** How long a lapsed circuit stays readable so each client can invalidate its
|
|
337
|
+
* cached health verdict once (the health cache is 60s; this leaves margin). */
|
|
338
|
+
const BACKEND_POOL_TOMBSTONE_MS = 15 * 60_000;
|
|
339
|
+
|
|
340
|
+
function localLlmBackendPoolMap(): Map<string, LocalLlmBackendPoolState> {
|
|
341
|
+
// SAFETY: globalThis carries one optional Map slot keyed for backend pool state.
|
|
342
|
+
const globalAny = globalThis as typeof globalThis & {
|
|
343
|
+
[LOCAL_LLM_GLOBAL_BACKEND_STATE]?: Map<string, LocalLlmBackendPoolState>;
|
|
344
|
+
};
|
|
345
|
+
const existing = globalAny[LOCAL_LLM_GLOBAL_BACKEND_STATE];
|
|
346
|
+
if (existing) return existing;
|
|
347
|
+
const created = new Map<string, LocalLlmBackendPoolState>();
|
|
348
|
+
globalAny[LOCAL_LLM_GLOBAL_BACKEND_STATE] = created;
|
|
349
|
+
return created;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function getLocalLlmTrippedBackendPoolState(
|
|
353
|
+
now: number,
|
|
354
|
+
chatUrl: string,
|
|
355
|
+
operation: string,
|
|
356
|
+
): LocalLlmBackendPoolState | null {
|
|
357
|
+
const key = formatLocalLlmPoolKey(chatUrl, operation);
|
|
358
|
+
const map = localLlmBackendPoolMap();
|
|
359
|
+
const state = map.get(key) ?? null;
|
|
360
|
+
if (!state) return null;
|
|
361
|
+
if (state.untilMs <= now) {
|
|
362
|
+
state.expiredAtMs ??= state.untilMs;
|
|
363
|
+
if (state.expiredAtMs + BACKEND_POOL_TOMBSTONE_MS <= now) map.delete(key);
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
return state;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** The instant this pool's circuit lapsed, or null while it is active or
|
|
370
|
+
* absent. The tombstone stays in the map so every client holding a cached
|
|
371
|
+
* health verdict can observe the transition once — deleting on first read left
|
|
372
|
+
* later clients stale (wAN review on #3474). */
|
|
373
|
+
export function localLlmBackendPoolExpiredAtMs(now: number, chatUrl: string, operation: string): number | null {
|
|
374
|
+
const key = formatLocalLlmPoolKey(chatUrl, operation);
|
|
375
|
+
const state = localLlmBackendPoolMap().get(key) ?? null;
|
|
376
|
+
if (state && state.untilMs <= now) {
|
|
377
|
+
state.expiredAtMs ??= state.untilMs;
|
|
378
|
+
return state.expiredAtMs;
|
|
379
|
+
}
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function markLocalLlmBackendPoolUnavailable(
|
|
384
|
+
reason: string,
|
|
385
|
+
durationMs: number,
|
|
386
|
+
chatUrl: string,
|
|
387
|
+
operation: string,
|
|
388
|
+
): void {
|
|
389
|
+
const normalizedReason = normalizeBackendTripReason(reason);
|
|
390
|
+
const key = formatLocalLlmPoolKey(chatUrl, operation);
|
|
391
|
+
if (durationMs > 0) {
|
|
392
|
+
localLlmBackendPoolMap().set(key, { untilMs: Date.now() + durationMs, reason: normalizedReason });
|
|
393
|
+
} else {
|
|
394
|
+
localLlmBackendPoolMap().delete(key);
|
|
395
|
+
}
|
|
294
396
|
}
|
|
@@ -2,6 +2,11 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
|
|
4
4
|
import { parseConfig } from "./config.js";
|
|
5
|
+
import {
|
|
6
|
+
formatLocalLlmPoolKey,
|
|
7
|
+
getLocalLlmTrippedBackendPoolState,
|
|
8
|
+
markLocalLlmBackendPoolUnavailable,
|
|
9
|
+
} from "./local-llm-helpers.js";
|
|
5
10
|
import type { LocalLlmChatCompletionOptions } from "./local-llm-helpers.js";
|
|
6
11
|
import {
|
|
7
12
|
LocalLlmConcurrencyLimiter,
|
|
@@ -11,6 +16,7 @@ import {
|
|
|
11
16
|
endpointBackoffRemainingMs,
|
|
12
17
|
extendEndpointBackoff,
|
|
13
18
|
isRateLimitedResponse,
|
|
19
|
+
isTerminalLocalLlmProxyPoolError,
|
|
14
20
|
parseRetryAfterMs,
|
|
15
21
|
parseTryAgainHintMs,
|
|
16
22
|
resetLocalLlmRateLimitStateForTests,
|
|
@@ -113,6 +119,58 @@ test("classifies 429/503/408 and LiteLLM cooldown bodies as rate limits, not 400
|
|
|
113
119
|
assert.equal(isRateLimitedResponse(500, "internal error"), false);
|
|
114
120
|
assert.equal(isRateLimitedResponse(400, "Context Window exceeded ... fallbacks cooldown_list"), false);
|
|
115
121
|
assert.equal(isRateLimitedResponse(502, ""), false);
|
|
122
|
+
assert.equal(
|
|
123
|
+
isRateLimitedResponse(
|
|
124
|
+
503,
|
|
125
|
+
JSON.stringify({ code: "remnic_recall_pool_unavailable", error: "recall pool missing" }),
|
|
126
|
+
),
|
|
127
|
+
false,
|
|
128
|
+
);
|
|
129
|
+
assert.equal(
|
|
130
|
+
isRateLimitedResponse(
|
|
131
|
+
503,
|
|
132
|
+
JSON.stringify({ code: "remnic_extraction_pool_unavailable", error: "trained pool missing" }),
|
|
133
|
+
),
|
|
134
|
+
false,
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("the terminal predicate matches the proxy's error-only pool-missing payload", () => {
|
|
139
|
+
// remnic-llm-proxy.py answers {"error": "..."} — no code field. The terminal
|
|
140
|
+
// check must catch the same bodies isRateLimitedResponse rejects, or the
|
|
141
|
+
// generic 5xx retry still fires (wAN review on #3474).
|
|
142
|
+
const proxyBody = JSON.stringify({
|
|
143
|
+
error: "recall pool missing or disabled; recall ops must not use the extraction pool",
|
|
144
|
+
});
|
|
145
|
+
assert.equal(isTerminalLocalLlmProxyPoolError(503, proxyBody), true);
|
|
146
|
+
assert.equal(isTerminalLocalLlmProxyPoolError(503, "embed pool missing or disabled (test)"), true);
|
|
147
|
+
assert.equal(isTerminalLocalLlmProxyPoolError(500, proxyBody), false);
|
|
148
|
+
assert.equal(isTerminalLocalLlmProxyPoolError(503, "upstream timeout"), false);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("the terminal predicate parses a structured pool code at any JSON spacing", () => {
|
|
152
|
+
// kilo on #3474: the needles matched only '"code":"x"' and '"code": "x"'; any
|
|
153
|
+
// other valid JSON spacing ('"code" : "x"', key reorder, pretty print with a
|
|
154
|
+
// deeper indent) fell through to the generic 5xx retry. Parse the body.
|
|
155
|
+
assert.equal(
|
|
156
|
+
isTerminalLocalLlmProxyPoolError(503, '{"code" : "remnic_recall_pool_unavailable"}'),
|
|
157
|
+
true,
|
|
158
|
+
);
|
|
159
|
+
assert.equal(
|
|
160
|
+
isTerminalLocalLlmProxyPoolError(
|
|
161
|
+
503,
|
|
162
|
+
JSON.stringify({ extra: 1, code: "remnic_extraction_pool_unavailable", detail: "x" }, null, 4),
|
|
163
|
+
),
|
|
164
|
+
true,
|
|
165
|
+
);
|
|
166
|
+
assert.equal(
|
|
167
|
+
isTerminalLocalLlmProxyPoolError(503, '{"code":"remnic_unrelated_error"}'),
|
|
168
|
+
false,
|
|
169
|
+
);
|
|
170
|
+
assert.equal(
|
|
171
|
+
isTerminalLocalLlmProxyPoolError(503, '{"code":"remnic_recall_pool_unavailable"}'),
|
|
172
|
+
true,
|
|
173
|
+
);
|
|
116
174
|
});
|
|
117
175
|
|
|
118
176
|
test("a pool-missing 503 is a config failure, not endpoint saturation (#3475)", () => {
|
|
@@ -290,7 +348,9 @@ test("a server hint beyond the max skips the retry and gates every client on tha
|
|
|
290
348
|
const b = new LocalLlmClient(createConfig({ localLlmUrl: url }));
|
|
291
349
|
assert.equal(await a.chatCompletion([{ role: "user", content: "x" }]), null);
|
|
292
350
|
assert.equal(calls, 1, "60s hint > 20ms max: no immediate retry");
|
|
293
|
-
assert.ok(
|
|
351
|
+
assert.ok(
|
|
352
|
+
endpointBackoffRemainingMs(formatLocalLlmPoolKey(`${url}/v1/chat/completions`, "unspecified")) > 50_000,
|
|
353
|
+
);
|
|
294
354
|
const options: LocalLlmChatCompletionOptions = { failureDiag: {} };
|
|
295
355
|
assert.equal(await b.chatCompletion([{ role: "user", content: "y" }], options), null);
|
|
296
356
|
assert.equal(calls, 1, "second client must not hit the proxy during the shared backoff");
|
|
@@ -497,3 +557,21 @@ test("one-permit and unlimited limits still admit background work", async () =>
|
|
|
497
557
|
assert.equal(limiter.inFlight, 0);
|
|
498
558
|
}
|
|
499
559
|
});
|
|
560
|
+
|
|
561
|
+
test("rate-limit backoff on one proxy operation does not block another", () => {
|
|
562
|
+
resetLocalLlmRateLimitStateForTests();
|
|
563
|
+
const chatUrl = "http://127.0.0.1:4399/v1/chat/completions";
|
|
564
|
+
const extractionKey = formatLocalLlmPoolKey(chatUrl, "extraction");
|
|
565
|
+
const recallKey = formatLocalLlmPoolKey(chatUrl, "rerank");
|
|
566
|
+
extendEndpointBackoff(extractionKey, 60_000);
|
|
567
|
+
assert.ok(endpointBackoffRemainingMs(extractionKey) > 0);
|
|
568
|
+
assert.equal(endpointBackoffRemainingMs(recallKey), 0);
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
test("backend circuit on one proxy operation does not trip another", () => {
|
|
572
|
+
const chatUrl = "http://127.0.0.1:4399/v1/chat/completions";
|
|
573
|
+
const now = Date.now();
|
|
574
|
+
markLocalLlmBackendPoolUnavailable("model load failure", 60_000, chatUrl, "extraction");
|
|
575
|
+
assert.ok(getLocalLlmTrippedBackendPoolState(now, chatUrl, "extraction"));
|
|
576
|
+
assert.equal(getLocalLlmTrippedBackendPoolState(now, chatUrl, "rerank"), null);
|
|
577
|
+
});
|
|
@@ -83,8 +83,44 @@ const POOL_MISSING_PATTERN = /pool missing or disabled/i;
|
|
|
83
83
|
* 408/429/503, or a 5xx whose body carries LiteLLM's cooldown wording.
|
|
84
84
|
* 400s are never rate limits (context-window errors mention fallbacks).
|
|
85
85
|
*/
|
|
86
|
+
/** Proxy 503 with a pool-config error code is terminal; do not enter rate-limit retries. */
|
|
87
|
+
const TERMINAL_PROXY_POOL_CODES: ReadonlySet<string> = new Set([
|
|
88
|
+
"remnic_recall_pool_unavailable",
|
|
89
|
+
"remnic_extraction_pool_unavailable",
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
/** Today's proxy answers {"error": "..."} with no code field, so the code path
|
|
93
|
+
* parses the body instead of substring-matching JSON — spacing and key order
|
|
94
|
+
* must not decide whether a terminal refusal retries (kilo on #3474). */
|
|
95
|
+
function bodyHasTerminalPoolCode(bodyText: string): boolean {
|
|
96
|
+
try {
|
|
97
|
+
// SAFETY: the proxy body is an opaque JSON object and `code` is optional, so a
|
|
98
|
+
// wrong-shape or wrong-type payload reads as undefined and fails the Set lookup.
|
|
99
|
+
const { code } = JSON.parse(bodyText) as { code?: string };
|
|
100
|
+
return code !== undefined && TERMINAL_PROXY_POOL_CODES.has(code);
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The proxy answers pool-config refusals as {"error": "... pool missing or
|
|
107
|
+
* disabled ..."} with no code field; the text shape is part of the terminal
|
|
108
|
+
* contract, or the generic 5xx retry still fires (wAN review on #3474). */
|
|
109
|
+
const TERMINAL_PROXY_POOL_TEXT = "pool missing or disabled";
|
|
110
|
+
|
|
111
|
+
export function isTerminalLocalLlmProxyPoolError(status: number, bodyText: string): boolean {
|
|
112
|
+
if (status !== 503) return false;
|
|
113
|
+
return (
|
|
114
|
+
bodyText.toLowerCase().includes(TERMINAL_PROXY_POOL_TEXT) ||
|
|
115
|
+
bodyHasTerminalPoolCode(bodyText)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
86
119
|
export function isRateLimitedResponse(status: number, bodyText: string): boolean {
|
|
87
|
-
if (
|
|
120
|
+
if (isTerminalLocalLlmProxyPoolError(status, bodyText)) return false;
|
|
121
|
+
// Pool-side refusals carry "pool missing or disabled" as text: a config
|
|
122
|
+
// failure, not endpoint saturation. Substring check, no regex.
|
|
123
|
+
if (bodyText.toLowerCase().includes("pool missing or disabled")) return false;
|
|
88
124
|
if (RATE_LIMIT_STATUSES.has(status)) return true;
|
|
89
125
|
return status >= 500 && RATE_LIMIT_BODY_PATTERN.test(bodyText);
|
|
90
126
|
}
|