@theokit/sdk 4.51.0 → 4.52.0
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/CHANGELOG.md +32 -0
- package/dist/agent-C66BEJGO.cjs +58 -0
- package/dist/{agent-B2WU3JP6.cjs.map → agent-C66BEJGO.cjs.map} +1 -1
- package/dist/agent-HYQGJTIN.js +49 -0
- package/dist/{agent-DI2QQHSJ.js.map → agent-HYQGJTIN.js.map} +1 -1
- package/dist/agent-session-store-EPX2WQI4.cjs +23 -0
- package/dist/{agent-session-store-EPUERCUU.cjs.map → agent-session-store-EPX2WQI4.cjs.map} +1 -1
- package/dist/agent-session-store-JMU7ASDB.js +6 -0
- package/dist/{agent-session-store-TXP5ZVOD.js.map → agent-session-store-JMU7ASDB.js.map} +1 -1
- package/dist/auth/index.cjs +21 -16
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-OUF4N2TM.js → batch-NLIS4QTW.js} +9 -9
- package/dist/{batch-OUF4N2TM.js.map → batch-NLIS4QTW.js.map} +1 -1
- package/dist/{batch-URTEXK77.cjs → batch-WQ3AJCDV.cjs} +26 -26
- package/dist/{batch-URTEXK77.cjs.map → batch-WQ3AJCDV.cjs.map} +1 -1
- package/dist/{chunk-WUUSAMFC.cjs → chunk-2CD5XUAG.cjs} +24 -24
- package/dist/{chunk-WUUSAMFC.cjs.map → chunk-2CD5XUAG.cjs.map} +1 -1
- package/dist/{chunk-NETYW4V3.cjs → chunk-2CFEET3Y.cjs} +4 -4
- package/dist/{chunk-NETYW4V3.cjs.map → chunk-2CFEET3Y.cjs.map} +1 -1
- package/dist/{chunk-YULF6FPB.cjs → chunk-2YGIBOUH.cjs} +8 -8
- package/dist/{chunk-YULF6FPB.cjs.map → chunk-2YGIBOUH.cjs.map} +1 -1
- package/dist/{chunk-FZ4YMZA3.cjs → chunk-3R4ZCQAZ.cjs} +5 -5
- package/dist/{chunk-FZ4YMZA3.cjs.map → chunk-3R4ZCQAZ.cjs.map} +1 -1
- package/dist/{chunk-HECR7KF5.cjs → chunk-3YYDHUNH.cjs} +11 -11
- package/dist/{chunk-HECR7KF5.cjs.map → chunk-3YYDHUNH.cjs.map} +1 -1
- package/dist/{chunk-BRHRQOJA.cjs → chunk-44IISBRZ.cjs} +4 -4
- package/dist/{chunk-BRHRQOJA.cjs.map → chunk-44IISBRZ.cjs.map} +1 -1
- package/dist/{chunk-PBML2FHN.js → chunk-4X3SBHPK.js} +2 -2
- package/dist/chunk-4X3SBHPK.js.map +1 -0
- package/dist/{chunk-OLLOUAUJ.js → chunk-5XXUYU3M.js} +3 -3
- package/dist/{chunk-OLLOUAUJ.js.map → chunk-5XXUYU3M.js.map} +1 -1
- package/dist/{chunk-KCQUYQ3V.cjs → chunk-6DCTL32L.cjs} +17 -17
- package/dist/{chunk-KCQUYQ3V.cjs.map → chunk-6DCTL32L.cjs.map} +1 -1
- package/dist/{chunk-R2A3WIJY.js → chunk-6PTCKXD3.js} +8 -8
- package/dist/{chunk-R2A3WIJY.js.map → chunk-6PTCKXD3.js.map} +1 -1
- package/dist/{chunk-XR4LPBXH.cjs → chunk-7HQVDLFI.cjs} +9 -9
- package/dist/{chunk-XR4LPBXH.cjs.map → chunk-7HQVDLFI.cjs.map} +1 -1
- package/dist/{chunk-GNMPCZNN.js → chunk-7TB5U7RK.js} +6 -6
- package/dist/{chunk-GNMPCZNN.js.map → chunk-7TB5U7RK.js.map} +1 -1
- package/dist/{chunk-7PESI6YD.cjs → chunk-ADVZIC43.cjs} +10 -10
- package/dist/{chunk-7PESI6YD.cjs.map → chunk-ADVZIC43.cjs.map} +1 -1
- package/dist/{chunk-NNNUQELM.cjs → chunk-AMYY3JHQ.cjs} +9 -9
- package/dist/{chunk-NNNUQELM.cjs.map → chunk-AMYY3JHQ.cjs.map} +1 -1
- package/dist/{chunk-L4JFQCG4.js → chunk-BKRTYDVN.js} +3 -3
- package/dist/{chunk-L4JFQCG4.js.map → chunk-BKRTYDVN.js.map} +1 -1
- package/dist/{chunk-UJMEWGO6.cjs → chunk-BWGXYOBZ.cjs} +4 -4
- package/dist/{chunk-UJMEWGO6.cjs.map → chunk-BWGXYOBZ.cjs.map} +1 -1
- package/dist/{chunk-E7WDXT4X.js → chunk-BXVSBYGW.js} +5 -5
- package/dist/{chunk-E7WDXT4X.js.map → chunk-BXVSBYGW.js.map} +1 -1
- package/dist/{chunk-AF4BBKIF.js → chunk-C4EU627W.js} +4 -4
- package/dist/{chunk-AF4BBKIF.js.map → chunk-C4EU627W.js.map} +1 -1
- package/dist/{chunk-VQFSEKU5.js → chunk-CHVSMEKM.js} +3 -3
- package/dist/{chunk-VQFSEKU5.js.map → chunk-CHVSMEKM.js.map} +1 -1
- package/dist/{chunk-6X2HUT4A.cjs → chunk-CZHPR2G7.cjs} +8 -8
- package/dist/{chunk-6X2HUT4A.cjs.map → chunk-CZHPR2G7.cjs.map} +1 -1
- package/dist/{chunk-F4RUADRC.js → chunk-DHVNJYTO.js} +3 -3
- package/dist/{chunk-F4RUADRC.js.map → chunk-DHVNJYTO.js.map} +1 -1
- package/dist/{chunk-SEZJGV7C.js → chunk-DU7PBCAM.js} +5 -5
- package/dist/{chunk-SEZJGV7C.js.map → chunk-DU7PBCAM.js.map} +1 -1
- package/dist/{chunk-S4Q5OMIK.cjs → chunk-E3OCRJU6.cjs} +11 -11
- package/dist/{chunk-S4Q5OMIK.cjs.map → chunk-E3OCRJU6.cjs.map} +1 -1
- package/dist/{chunk-3KY7MHR4.js → chunk-E6T264NS.js} +3 -3
- package/dist/{chunk-3KY7MHR4.js.map → chunk-E6T264NS.js.map} +1 -1
- package/dist/{chunk-WCXOKGOQ.cjs → chunk-ECPL5RV6.cjs} +8 -8
- package/dist/{chunk-WCXOKGOQ.cjs.map → chunk-ECPL5RV6.cjs.map} +1 -1
- package/dist/{chunk-LLE7HPRI.js → chunk-EFXJ5C7X.js} +5 -5
- package/dist/{chunk-LLE7HPRI.js.map → chunk-EFXJ5C7X.js.map} +1 -1
- package/dist/{chunk-RWMNTFHZ.cjs → chunk-EQMLJ52C.cjs} +26 -26
- package/dist/{chunk-RWMNTFHZ.cjs.map → chunk-EQMLJ52C.cjs.map} +1 -1
- package/dist/{chunk-WIGJGFH4.cjs → chunk-EUBGGYPH.cjs} +5 -5
- package/dist/{chunk-WIGJGFH4.cjs.map → chunk-EUBGGYPH.cjs.map} +1 -1
- package/dist/{chunk-RBQYHEZD.cjs → chunk-FBZMSLDC.cjs} +4 -4
- package/dist/{chunk-RBQYHEZD.cjs.map → chunk-FBZMSLDC.cjs.map} +1 -1
- package/dist/{chunk-3G6ZDZ6L.cjs → chunk-FUASIT3E.cjs} +15 -15
- package/dist/{chunk-3G6ZDZ6L.cjs.map → chunk-FUASIT3E.cjs.map} +1 -1
- package/dist/{chunk-MRKSSN36.js → chunk-HI4ZW62S.js} +3 -3
- package/dist/{chunk-MRKSSN36.js.map → chunk-HI4ZW62S.js.map} +1 -1
- package/dist/{chunk-O3IZ7JEL.js → chunk-I732VEDW.js} +3 -3
- package/dist/{chunk-O3IZ7JEL.js.map → chunk-I732VEDW.js.map} +1 -1
- package/dist/{chunk-AZ6FKDQR.js → chunk-ITQ4NO4P.js} +3 -3
- package/dist/{chunk-AZ6FKDQR.js.map → chunk-ITQ4NO4P.js.map} +1 -1
- package/dist/{chunk-PYM5OUL4.js → chunk-J4RY5DTI.js} +5 -5
- package/dist/{chunk-PYM5OUL4.js.map → chunk-J4RY5DTI.js.map} +1 -1
- package/dist/{chunk-NOM2YWFP.js → chunk-JJZ4NIAG.js} +5 -5
- package/dist/{chunk-NOM2YWFP.js.map → chunk-JJZ4NIAG.js.map} +1 -1
- package/dist/{chunk-GC44RATP.cjs → chunk-K42QGAKM.cjs} +10 -10
- package/dist/{chunk-GC44RATP.cjs.map → chunk-K42QGAKM.cjs.map} +1 -1
- package/dist/{chunk-FRQ6F44U.js → chunk-KIX45IKP.js} +4 -4
- package/dist/{chunk-FRQ6F44U.js.map → chunk-KIX45IKP.js.map} +1 -1
- package/dist/{chunk-OEFFPR2S.cjs → chunk-KNZU4YO5.cjs} +4 -4
- package/dist/{chunk-OEFFPR2S.cjs.map → chunk-KNZU4YO5.cjs.map} +1 -1
- package/dist/{chunk-HK4HRLWE.js → chunk-KZBB4YKU.js} +3 -3
- package/dist/{chunk-HK4HRLWE.js.map → chunk-KZBB4YKU.js.map} +1 -1
- package/dist/{chunk-ZS6SLELQ.js → chunk-L7EGRCKJ.js} +4 -4
- package/dist/{chunk-ZS6SLELQ.js.map → chunk-L7EGRCKJ.js.map} +1 -1
- package/dist/{chunk-F7OBYH2X.cjs → chunk-LLK2RS6I.cjs} +294 -294
- package/dist/{chunk-F7OBYH2X.cjs.map → chunk-LLK2RS6I.cjs.map} +1 -1
- package/dist/{chunk-LXKNENHK.js → chunk-MV4TOCUK.js} +3 -3
- package/dist/{chunk-LXKNENHK.js.map → chunk-MV4TOCUK.js.map} +1 -1
- package/dist/{chunk-PAV4ZPSW.js → chunk-N43XLTHZ.js} +3 -3
- package/dist/{chunk-PAV4ZPSW.js.map → chunk-N43XLTHZ.js.map} +1 -1
- package/dist/{chunk-ZNW2TXLO.js → chunk-NACDF3PK.js} +3 -3
- package/dist/{chunk-ZNW2TXLO.js.map → chunk-NACDF3PK.js.map} +1 -1
- package/dist/{chunk-27DYRARU.cjs → chunk-NFATC6ZF.cjs} +4 -4
- package/dist/{chunk-27DYRARU.cjs.map → chunk-NFATC6ZF.cjs.map} +1 -1
- package/dist/{chunk-E54KDYOE.js → chunk-NOS7PTKP.js} +7 -7
- package/dist/{chunk-E54KDYOE.js.map → chunk-NOS7PTKP.js.map} +1 -1
- package/dist/{chunk-NRA36JKG.cjs → chunk-OI6RHLGC.cjs} +11 -11
- package/dist/{chunk-NRA36JKG.cjs.map → chunk-OI6RHLGC.cjs.map} +1 -1
- package/dist/{chunk-J5RW43IR.js → chunk-OIBHY6JQ.js} +4 -4
- package/dist/{chunk-J5RW43IR.js.map → chunk-OIBHY6JQ.js.map} +1 -1
- package/dist/{chunk-SNKY3C2L.js → chunk-OZXPA3ME.js} +4 -4
- package/dist/{chunk-SNKY3C2L.js.map → chunk-OZXPA3ME.js.map} +1 -1
- package/dist/{chunk-35NFZ7QB.js → chunk-PLUCC4N5.js} +3 -3
- package/dist/{chunk-35NFZ7QB.js.map → chunk-PLUCC4N5.js.map} +1 -1
- package/dist/{chunk-MMZX557L.cjs → chunk-PVBANCWU.cjs} +5 -5
- package/dist/{chunk-MMZX557L.cjs.map → chunk-PVBANCWU.cjs.map} +1 -1
- package/dist/{chunk-BV42CCRP.cjs → chunk-QLAWEGTZ.cjs} +7 -7
- package/dist/{chunk-BV42CCRP.cjs.map → chunk-QLAWEGTZ.cjs.map} +1 -1
- package/dist/{chunk-HKSSM5RK.js → chunk-R7TKOQMJ.js} +3 -3
- package/dist/{chunk-HKSSM5RK.js.map → chunk-R7TKOQMJ.js.map} +1 -1
- package/dist/{chunk-HLNLYLNN.cjs → chunk-RAACTJ7C.cjs} +4 -4
- package/dist/{chunk-HLNLYLNN.cjs.map → chunk-RAACTJ7C.cjs.map} +1 -1
- package/dist/{chunk-X2YQP452.cjs → chunk-RTLUZKDL.cjs} +11 -11
- package/dist/{chunk-X2YQP452.cjs.map → chunk-RTLUZKDL.cjs.map} +1 -1
- package/dist/{chunk-6W4U2G3J.cjs → chunk-SDJYLCJK.cjs} +5 -5
- package/dist/{chunk-6W4U2G3J.cjs.map → chunk-SDJYLCJK.cjs.map} +1 -1
- package/dist/{chunk-VK7SIDYI.js → chunk-SPZZSAHV.js} +5 -5
- package/dist/{chunk-VK7SIDYI.js.map → chunk-SPZZSAHV.js.map} +1 -1
- package/dist/{chunk-ZHPET3LZ.cjs → chunk-SXSPMRSV.cjs} +2 -2
- package/dist/chunk-SXSPMRSV.cjs.map +1 -0
- package/dist/{chunk-JA4FEA5Z.cjs → chunk-T6QUCG7L.cjs} +4 -4
- package/dist/{chunk-JA4FEA5Z.cjs.map → chunk-T6QUCG7L.cjs.map} +1 -1
- package/dist/{chunk-GLEKLAUW.cjs → chunk-T6ZCG5AP.cjs} +12 -12
- package/dist/{chunk-GLEKLAUW.cjs.map → chunk-T6ZCG5AP.cjs.map} +1 -1
- package/dist/chunk-U3PAW4PL.js +22 -0
- package/dist/chunk-U3PAW4PL.js.map +1 -0
- package/dist/{chunk-ZTEAJAE6.js → chunk-UJ3SXRZZ.js} +3 -3
- package/dist/{chunk-ZTEAJAE6.js.map → chunk-UJ3SXRZZ.js.map} +1 -1
- package/dist/{chunk-Z6N6SDNR.js → chunk-V2EJLKGA.js} +4 -4
- package/dist/{chunk-Z6N6SDNR.js.map → chunk-V2EJLKGA.js.map} +1 -1
- package/dist/{chunk-57KX5WTP.cjs → chunk-V45L2OYP.cjs} +9 -9
- package/dist/{chunk-57KX5WTP.cjs.map → chunk-V45L2OYP.cjs.map} +1 -1
- package/dist/{chunk-2WB6EIYW.js → chunk-W4FV7JBH.js} +4 -4
- package/dist/{chunk-2WB6EIYW.js.map → chunk-W4FV7JBH.js.map} +1 -1
- package/dist/chunk-WVDH34LK.cjs +24 -0
- package/dist/chunk-WVDH34LK.cjs.map +1 -0
- package/dist/{chunk-TJRPNBY5.js → chunk-XGYI2KQH.js} +4 -4
- package/dist/{chunk-TJRPNBY5.js.map → chunk-XGYI2KQH.js.map} +1 -1
- package/dist/{chunk-4JRRFRV4.cjs → chunk-XK54DTRF.cjs} +4 -4
- package/dist/{chunk-4JRRFRV4.cjs.map → chunk-XK54DTRF.cjs.map} +1 -1
- package/dist/{chunk-JGYYNDAZ.js → chunk-XWCTBGYK.js} +3 -3
- package/dist/{chunk-JGYYNDAZ.js.map → chunk-XWCTBGYK.js.map} +1 -1
- package/dist/{chunk-UQHIEUDY.cjs → chunk-YARJG3GV.cjs} +8 -8
- package/dist/{chunk-UQHIEUDY.cjs.map → chunk-YARJG3GV.cjs.map} +1 -1
- package/dist/{chunk-TDDRPFO3.js → chunk-YBB66SZZ.js} +13 -21
- package/dist/chunk-YBB66SZZ.js.map +1 -0
- package/dist/{chunk-XABN5HY6.cjs → chunk-YTO5BRBD.cjs} +8 -8
- package/dist/{chunk-XABN5HY6.cjs.map → chunk-YTO5BRBD.cjs.map} +1 -1
- package/dist/{chunk-72HEBGWN.cjs → chunk-Z5U2JGEK.cjs} +11 -11
- package/dist/{chunk-72HEBGWN.cjs.map → chunk-Z5U2JGEK.cjs.map} +1 -1
- package/dist/{chunk-ACHVCIDQ.js → chunk-ZFARZBOX.js} +35 -35
- package/dist/{chunk-ACHVCIDQ.js.map → chunk-ZFARZBOX.js.map} +1 -1
- package/dist/{chunk-QFFNMJAS.cjs → chunk-ZNEYQ56O.cjs} +124 -132
- package/dist/chunk-ZNEYQ56O.cjs.map +1 -0
- package/dist/{chunk-Q4DTGCSD.js → chunk-ZSJPRPN7.js} +3 -3
- package/dist/{chunk-Q4DTGCSD.js.map → chunk-ZSJPRPN7.js.map} +1 -1
- package/dist/compact-session-AXKDB6FC.cjs +57 -0
- package/dist/{compact-session-FKYCJRAK.cjs.map → compact-session-AXKDB6FC.cjs.map} +1 -1
- package/dist/compact-session-DUAUEFRR.js +20 -0
- package/dist/{compact-session-LF4YOT5S.js.map → compact-session-DUAUEFRR.js.map} +1 -1
- package/dist/compaction.cjs +16 -16
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context-4HGPCOH6.cjs +22 -0
- package/dist/{context-2G4375BZ.cjs.map → context-4HGPCOH6.cjs.map} +1 -1
- package/dist/context-DCECDKWN.js +5 -0
- package/dist/{context-GSQYVVMJ.js.map → context-DCECDKWN.js.map} +1 -1
- package/dist/cron.cjs +32 -31
- package/dist/cron.js +31 -30
- package/dist/errors.cjs +21 -21
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +37 -36
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +31 -30
- package/dist/eval.js.map +1 -1
- package/dist/{executor-VQLTQY53.js → executor-3CGPLVJL.js} +7 -7
- package/dist/{executor-VQLTQY53.js.map → executor-3CGPLVJL.js.map} +1 -1
- package/dist/{executor-CB75B5BH.cjs → executor-4SW7QGZ4.cjs} +24 -24
- package/dist/{executor-CB75B5BH.cjs.map → executor-4SW7QGZ4.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-2TF3ZWMT.js +10 -0
- package/dist/{fs-session-store-ZNUYZHYI.js.map → fs-session-store-2TF3ZWMT.js.map} +1 -1
- package/dist/fs-session-store-TL4RJTXZ.cjs +19 -0
- package/dist/{fs-session-store-MAZV5FXJ.cjs.map → fs-session-store-TL4RJTXZ.cjs.map} +1 -1
- package/dist/generate-object-E465DX5I.cjs +20 -0
- package/dist/{generate-object-6PWGH5DZ.cjs.map → generate-object-E465DX5I.cjs.map} +1 -1
- package/dist/generate-object-TVQCW2IZ.js +7 -0
- package/dist/{generate-object-IXMJ7FUX.js.map → generate-object-TVQCW2IZ.js.map} +1 -1
- package/dist/index-manager-EA6FGIQG.js +12 -0
- package/dist/{index-manager-OMJVYS2U.js.map → index-manager-EA6FGIQG.js.map} +1 -1
- package/dist/index-manager-HGGL4DD5.cjs +21 -0
- package/dist/{index-manager-34ELCOAP.cjs.map → index-manager-HGGL4DD5.cjs.map} +1 -1
- package/dist/index.cjs +134 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -43
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-MWRJENH4.js → inject-session-RBGOGACE.js} +7 -7
- package/dist/{inject-session-MWRJENH4.js.map → inject-session-RBGOGACE.js.map} +1 -1
- package/dist/{inject-session-J7Y6XACY.cjs → inject-session-TASLP5FA.cjs} +9 -9
- package/dist/{inject-session-J7Y6XACY.cjs.map → inject-session-TASLP5FA.cjs.map} +1 -1
- package/dist/internal/auth/api-key-prefix.d.ts +17 -0
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-GVIJWQVE.cjs +22 -0
- package/dist/{judge-call-J5EETJL3.cjs.map → judge-call-GVIJWQVE.cjs.map} +1 -1
- package/dist/judge-call-QMKGC2ZK.js +5 -0
- package/dist/{judge-call-3QZO5H5N.js.map → judge-call-QMKGC2ZK.js.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.js +5 -5
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +28 -28
- package/dist/persistence.js +8 -8
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-GC7BQMSV.js +9 -0
- package/dist/{registry-PPFMCM4A.js.map → registry-GC7BQMSV.js.map} +1 -1
- package/dist/registry-UBY26R4I.cjs +46 -0
- package/dist/{registry-KB3TS6BM.cjs.map → registry-UBY26R4I.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/sandbox/index.cjs +6 -6
- package/dist/sandbox/index.js +2 -2
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-SKIRBEJE.js +5 -0
- package/dist/{session-transcript-7FWTO4BK.js.map → session-transcript-SKIRBEJE.js.map} +1 -1
- package/dist/session-transcript-TNAJ4O3M.cjs +50 -0
- package/dist/{session-transcript-FYRKWRWV.cjs.map → session-transcript-TNAJ4O3M.cjs.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-QMNR3YFF.js +7 -0
- package/dist/{stream-object-NPJXDZXO.js.map → stream-object-QMNR3YFF.js.map} +1 -1
- package/dist/stream-object-T4DAMNVB.cjs +20 -0
- package/dist/{stream-object-3R3HZPQN.cjs.map → stream-object-T4DAMNVB.cjs.map} +1 -1
- package/dist/subagents-loader-3CXBQWWY.cjs +15 -0
- package/dist/{subagents-loader-FDXPBBRA.cjs.map → subagents-loader-3CXBQWWY.cjs.map} +1 -1
- package/dist/subagents-loader-WN2SB6PV.js +6 -0
- package/dist/{subagents-loader-5KQVYUNS.js.map → subagents-loader-WN2SB6PV.js.map} +1 -1
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.js +4 -4
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/package.json +1 -1
- package/dist/agent-B2WU3JP6.cjs +0 -57
- package/dist/agent-DI2QQHSJ.js +0 -48
- package/dist/agent-session-store-EPUERCUU.cjs +0 -23
- package/dist/agent-session-store-TXP5ZVOD.js +0 -6
- package/dist/chunk-PBML2FHN.js.map +0 -1
- package/dist/chunk-QFFNMJAS.cjs.map +0 -1
- package/dist/chunk-TDDRPFO3.js.map +0 -1
- package/dist/chunk-ZHPET3LZ.cjs.map +0 -1
- package/dist/compact-session-FKYCJRAK.cjs +0 -56
- package/dist/compact-session-LF4YOT5S.js +0 -19
- package/dist/context-2G4375BZ.cjs +0 -22
- package/dist/context-GSQYVVMJ.js +0 -5
- package/dist/fs-session-store-MAZV5FXJ.cjs +0 -19
- package/dist/fs-session-store-ZNUYZHYI.js +0 -10
- package/dist/generate-object-6PWGH5DZ.cjs +0 -20
- package/dist/generate-object-IXMJ7FUX.js +0 -7
- package/dist/index-manager-34ELCOAP.cjs +0 -21
- package/dist/index-manager-OMJVYS2U.js +0 -12
- package/dist/judge-call-3QZO5H5N.js +0 -5
- package/dist/judge-call-J5EETJL3.cjs +0 -22
- package/dist/registry-KB3TS6BM.cjs +0 -46
- package/dist/registry-PPFMCM4A.js +0 -9
- package/dist/session-transcript-7FWTO4BK.js +0 -5
- package/dist/session-transcript-FYRKWRWV.cjs +0 -50
- package/dist/stream-object-3R3HZPQN.cjs +0 -20
- package/dist/stream-object-NPJXDZXO.js +0 -7
- package/dist/subagents-loader-5KQVYUNS.js +0 -6
- package/dist/subagents-loader-FDXPBBRA.cjs +0 -15
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk4JBHSLQO_cjs = require('./chunk-4JBHSLQO.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkRAACTJ7C_cjs = require('./chunk-RAACTJ7C.cjs');
|
|
5
|
+
var chunkE3OCRJU6_cjs = require('./chunk-E3OCRJU6.cjs');
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
7
|
+
var chunkWVDH34LK_cjs = require('./chunk-WVDH34LK.cjs');
|
|
8
|
+
var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
|
|
9
|
+
var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
|
|
10
|
+
var chunkT6ZCG5AP_cjs = require('./chunk-T6ZCG5AP.cjs');
|
|
11
|
+
var chunk2YGIBOUH_cjs = require('./chunk-2YGIBOUH.cjs');
|
|
12
|
+
var chunkSXSPMRSV_cjs = require('./chunk-SXSPMRSV.cjs');
|
|
12
13
|
var fs = require('fs');
|
|
13
14
|
var promises = require('fs/promises');
|
|
14
15
|
var os = require('os');
|
|
@@ -17,7 +18,7 @@ var url = require('url');
|
|
|
17
18
|
var module$1 = require('module');
|
|
18
19
|
|
|
19
20
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
20
|
-
var discoveryState =
|
|
21
|
+
var discoveryState = chunkT6ZCG5AP_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
21
22
|
done: false
|
|
22
23
|
}));
|
|
23
24
|
function pluginsRoot() {
|
|
@@ -39,19 +40,19 @@ function loadTrustedNames() {
|
|
|
39
40
|
else discarded += 1;
|
|
40
41
|
}
|
|
41
42
|
if (discarded > 0) {
|
|
42
|
-
|
|
43
|
+
chunkSXSPMRSV_cjs.diag(
|
|
43
44
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
44
45
|
`
|
|
45
46
|
);
|
|
46
47
|
}
|
|
47
48
|
} else {
|
|
48
|
-
|
|
49
|
+
chunkSXSPMRSV_cjs.diag(
|
|
49
50
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
50
51
|
`
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
} catch {
|
|
54
|
-
|
|
55
|
+
chunkSXSPMRSV_cjs.diag(
|
|
55
56
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
56
57
|
`
|
|
57
58
|
);
|
|
@@ -77,7 +78,7 @@ async function discoverProviderPlugins() {
|
|
|
77
78
|
const trusted = loadTrustedNames();
|
|
78
79
|
for (const entry of entries) {
|
|
79
80
|
if (!trusted.has(entry)) {
|
|
80
|
-
|
|
81
|
+
chunkSXSPMRSV_cjs.diag(
|
|
81
82
|
`[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
|
|
82
83
|
`
|
|
83
84
|
);
|
|
@@ -96,13 +97,13 @@ async function loadOne(dir, entryName) {
|
|
|
96
97
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
97
98
|
const profile = plugin.profile;
|
|
98
99
|
if (profile !== void 0 && typeof profile === "object") {
|
|
99
|
-
|
|
100
|
+
chunkT6ZCG5AP_cjs.registerProvider(profile);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
return;
|
|
103
104
|
} catch (err) {
|
|
104
105
|
const msg = err instanceof Error ? err.message : String(err);
|
|
105
|
-
|
|
106
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
106
107
|
`);
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
@@ -114,7 +115,7 @@ function mapAnthropicError(args) {
|
|
|
114
115
|
const { status, body, headers, endpoint } = args;
|
|
115
116
|
const code = mapAnthropicStatusToCode(status, body);
|
|
116
117
|
const message = formatMessage(status, code);
|
|
117
|
-
const metadata =
|
|
118
|
+
const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
118
119
|
provider: "anthropic",
|
|
119
120
|
endpoint,
|
|
120
121
|
code,
|
|
@@ -123,24 +124,24 @@ function mapAnthropicError(args) {
|
|
|
123
124
|
body
|
|
124
125
|
});
|
|
125
126
|
if (status === 401 || status === 403) {
|
|
126
|
-
return new
|
|
127
|
+
return new chunk2YGIBOUH_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
127
128
|
}
|
|
128
129
|
if (status === 429) {
|
|
129
|
-
return new
|
|
130
|
+
return new chunk2YGIBOUH_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
130
131
|
}
|
|
131
132
|
if (status === 400) {
|
|
132
|
-
return new
|
|
133
|
+
return new chunk2YGIBOUH_cjs.ConfigurationError(message, {
|
|
133
134
|
code: `anthropic_${code}`,
|
|
134
135
|
metadata
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
if (status === 408) {
|
|
138
|
-
return new
|
|
139
|
+
return new chunk2YGIBOUH_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
139
140
|
}
|
|
140
141
|
if (status >= 500 && status < 600) {
|
|
141
|
-
return new
|
|
142
|
+
return new chunk2YGIBOUH_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
142
143
|
}
|
|
143
|
-
return new
|
|
144
|
+
return new chunk2YGIBOUH_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
144
145
|
}
|
|
145
146
|
function mapAnthropicStatusToCode(status, body) {
|
|
146
147
|
if (status === 401 || status === 403) return "auth_failed";
|
|
@@ -211,7 +212,7 @@ function toBlockToolResultContent(content) {
|
|
|
211
212
|
function toStringToolResultContent(content, providerName) {
|
|
212
213
|
if (typeof content === "string") return content;
|
|
213
214
|
if (content.some((block) => block.type === "image")) {
|
|
214
|
-
throw new
|
|
215
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
215
216
|
`provider "${providerName}" does not support image content in tool results`
|
|
216
217
|
);
|
|
217
218
|
}
|
|
@@ -390,7 +391,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
390
391
|
(resolve, reject) => {
|
|
391
392
|
const timer = setTimeout(() => {
|
|
392
393
|
reject(
|
|
393
|
-
new
|
|
394
|
+
new chunk2YGIBOUH_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
394
395
|
code: "stream_idle_timeout"
|
|
395
396
|
})
|
|
396
397
|
);
|
|
@@ -467,9 +468,9 @@ function ehAbort(err) {
|
|
|
467
468
|
}
|
|
468
469
|
function wrapTransportError(err, ctx) {
|
|
469
470
|
if (ehAbort(err)) return err;
|
|
470
|
-
if (err instanceof
|
|
471
|
+
if (err instanceof chunk2YGIBOUH_cjs.NetworkError) return err;
|
|
471
472
|
const detail = err instanceof Error ? err.message : String(err);
|
|
472
|
-
return new
|
|
473
|
+
return new chunk2YGIBOUH_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
|
|
473
474
|
code: "transport_failure",
|
|
474
475
|
cause: err
|
|
475
476
|
});
|
|
@@ -533,7 +534,7 @@ var AnthropicClient = class {
|
|
|
533
534
|
for (const event of events) yield event;
|
|
534
535
|
}
|
|
535
536
|
if (!accumulator.finishReasonSeen) {
|
|
536
|
-
throw new
|
|
537
|
+
throw new chunk2YGIBOUH_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
537
538
|
code: "stream_truncated"
|
|
538
539
|
});
|
|
539
540
|
}
|
|
@@ -686,7 +687,7 @@ function classifyBedrockError(args, awsType, message) {
|
|
|
686
687
|
return "unknown";
|
|
687
688
|
}
|
|
688
689
|
function buildBedrockMetadata(args, code) {
|
|
689
|
-
return
|
|
690
|
+
return chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
690
691
|
provider: "bedrock",
|
|
691
692
|
endpoint: args.endpoint,
|
|
692
693
|
code,
|
|
@@ -703,19 +704,19 @@ function mapBedrockError(args) {
|
|
|
703
704
|
const metadata = buildBedrockMetadata(args, code);
|
|
704
705
|
switch (code) {
|
|
705
706
|
case "rate_limit":
|
|
706
|
-
return new
|
|
707
|
+
return new chunk2YGIBOUH_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
707
708
|
case "auth_failed":
|
|
708
|
-
return new
|
|
709
|
+
return new chunk2YGIBOUH_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
709
710
|
case "invalid_request": {
|
|
710
711
|
const friendly = message.includes("use case details") ? `Bedrock account setup required: ${message} (AWS Console \u2192 Bedrock \u2192 Model access \u2192 Anthropic \u2192 Submit use case form, then retry in 15 min.)` : `Bedrock validation: ${message}`;
|
|
711
|
-
return new
|
|
712
|
+
return new chunk2YGIBOUH_cjs.ConfigurationError(friendly, { metadata });
|
|
712
713
|
}
|
|
713
714
|
case "timeout":
|
|
714
|
-
return new
|
|
715
|
+
return new chunk2YGIBOUH_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
715
716
|
case "server_error":
|
|
716
|
-
return new
|
|
717
|
+
return new chunk2YGIBOUH_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
717
718
|
default:
|
|
718
|
-
return new
|
|
719
|
+
return new chunk2YGIBOUH_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
719
720
|
}
|
|
720
721
|
}
|
|
721
722
|
function parseBody(body) {
|
|
@@ -739,7 +740,7 @@ async function resolveBedrockToken(region) {
|
|
|
739
740
|
return cachedToken.value;
|
|
740
741
|
}
|
|
741
742
|
try {
|
|
742
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
743
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-ZNEYQ56O.cjs', document.baseURI).href)));
|
|
743
744
|
const gen = r("@aws/bedrock-token-generator");
|
|
744
745
|
if (typeof gen.getToken !== "function") return void 0;
|
|
745
746
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -767,16 +768,16 @@ var BedrockAnthropicClient = class {
|
|
|
767
768
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
768
769
|
const fromEnv = await resolveBedrockToken(region);
|
|
769
770
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
770
|
-
throw new
|
|
771
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
771
772
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
772
773
|
{ code: "auth_failed" }
|
|
773
774
|
);
|
|
774
775
|
}
|
|
775
776
|
async *stream(request, signal) {
|
|
776
|
-
const region =
|
|
777
|
+
const region = chunkT6ZCG5AP_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
777
778
|
const token = await this.resolveTokenOrThrow(region);
|
|
778
|
-
const bareModel =
|
|
779
|
-
const baseUrl = this.options.baseUrl ??
|
|
779
|
+
const bareModel = chunkT6ZCG5AP_cjs.stripBedrockPrefix(request.model);
|
|
780
|
+
const baseUrl = this.options.baseUrl ?? chunkT6ZCG5AP_cjs.resolveBedrockBaseUrl(request.model);
|
|
780
781
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
781
782
|
const url = `${baseUrl}${endpoint}`;
|
|
782
783
|
const response = await postAnthropicRequest({
|
|
@@ -831,7 +832,7 @@ var FaultInjectingLlmClient = class {
|
|
|
831
832
|
return yield* this.inner.stream(request, signal);
|
|
832
833
|
}
|
|
833
834
|
if (parsed.status >= 400) {
|
|
834
|
-
throw
|
|
835
|
+
throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
|
|
835
836
|
providerId: this.name,
|
|
836
837
|
status: parsed.status,
|
|
837
838
|
body: parsed.body,
|
|
@@ -878,7 +879,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
878
879
|
function warnInvalidJsonOnce(_raw) {
|
|
879
880
|
if (warnedInvalidJson) return;
|
|
880
881
|
warnedInvalidJson = true;
|
|
881
|
-
|
|
882
|
+
chunkSXSPMRSV_cjs.diag(
|
|
882
883
|
`[theokit-sdk] ${ENV_OVERRIDE_KEY} is set but value is not valid JSON of shape \`{"status": number, "body": object | string}\`. Falling back to real LLM call. This warning is shown once per process.
|
|
883
884
|
`
|
|
884
885
|
);
|
|
@@ -906,7 +907,7 @@ function mapOllamaTransportError(args) {
|
|
|
906
907
|
if (args.providerId !== "ollama") return void 0;
|
|
907
908
|
const causeCode = extractCauseCode(args.cause);
|
|
908
909
|
if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
|
|
909
|
-
const metadata =
|
|
910
|
+
const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
910
911
|
provider: "ollama",
|
|
911
912
|
endpoint: args.endpoint,
|
|
912
913
|
code: "network",
|
|
@@ -914,7 +915,7 @@ function mapOllamaTransportError(args) {
|
|
|
914
915
|
headers: void 0,
|
|
915
916
|
body: { cause: causeCode }
|
|
916
917
|
});
|
|
917
|
-
return new
|
|
918
|
+
return new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
918
919
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
919
920
|
{ code: "ollama_unreachable", metadata }
|
|
920
921
|
);
|
|
@@ -924,7 +925,7 @@ function mapOllamaHttpError(args) {
|
|
|
924
925
|
const errString = extractErrorString(args.body).toLowerCase();
|
|
925
926
|
if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
|
|
926
927
|
const modelHint = extractModelName(errString);
|
|
927
|
-
const metadata =
|
|
928
|
+
const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
928
929
|
provider: "ollama",
|
|
929
930
|
endpoint: args.endpoint,
|
|
930
931
|
code: "model_unavailable",
|
|
@@ -933,13 +934,13 @@ function mapOllamaHttpError(args) {
|
|
|
933
934
|
body: args.body
|
|
934
935
|
});
|
|
935
936
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
936
|
-
return new
|
|
937
|
+
return new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
937
938
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
938
939
|
{ code: "ollama_model_not_pulled", metadata }
|
|
939
940
|
);
|
|
940
941
|
}
|
|
941
942
|
if (args.status === 503 && errString.includes("model is loading")) {
|
|
942
|
-
const metadata =
|
|
943
|
+
const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
943
944
|
provider: "ollama",
|
|
944
945
|
endpoint: args.endpoint,
|
|
945
946
|
code: "server_error",
|
|
@@ -947,7 +948,7 @@ function mapOllamaHttpError(args) {
|
|
|
947
948
|
headers: args.headers,
|
|
948
949
|
body: args.body
|
|
949
950
|
});
|
|
950
|
-
return new
|
|
951
|
+
return new chunk2YGIBOUH_cjs.NetworkError(
|
|
951
952
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
952
953
|
{ code: "ollama_model_loading", metadata }
|
|
953
954
|
);
|
|
@@ -1168,7 +1169,7 @@ function toOllamaMessages(message) {
|
|
|
1168
1169
|
}
|
|
1169
1170
|
if (message.role === "user") {
|
|
1170
1171
|
if (message.content.some((p) => p.type === "image")) {
|
|
1171
|
-
throw new
|
|
1172
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
1172
1173
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1173
1174
|
{ code: "ollama_image_unsupported" }
|
|
1174
1175
|
);
|
|
@@ -1297,7 +1298,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1297
1298
|
try {
|
|
1298
1299
|
return await fetchFn(url, init);
|
|
1299
1300
|
} catch (cause) {
|
|
1300
|
-
throw new
|
|
1301
|
+
throw new chunk2YGIBOUH_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1301
1302
|
}
|
|
1302
1303
|
}
|
|
1303
1304
|
async function safeParseJsonResponse(response) {
|
|
@@ -1324,7 +1325,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1324
1325
|
cause: body
|
|
1325
1326
|
};
|
|
1326
1327
|
if (envelope.code === "integration_not_connected") {
|
|
1327
|
-
return new
|
|
1328
|
+
return new chunk2YGIBOUH_cjs.IntegrationNotConnectedError(message, {
|
|
1328
1329
|
provider: envelope.provider ?? "unknown",
|
|
1329
1330
|
helpUrl: envelope.helpUrl ?? "",
|
|
1330
1331
|
code: envelope.code,
|
|
@@ -1332,18 +1333,18 @@ function mapHttpStatusToError(status, body) {
|
|
|
1332
1333
|
});
|
|
1333
1334
|
}
|
|
1334
1335
|
if (status === 401 || status === 403) {
|
|
1335
|
-
return new
|
|
1336
|
+
return new chunk2YGIBOUH_cjs.AuthenticationError(message, errorOptions);
|
|
1336
1337
|
}
|
|
1337
1338
|
if (status === 429) {
|
|
1338
|
-
return new
|
|
1339
|
+
return new chunk2YGIBOUH_cjs.RateLimitError(message, errorOptions);
|
|
1339
1340
|
}
|
|
1340
1341
|
if (status >= 400 && status < 500) {
|
|
1341
|
-
return new
|
|
1342
|
+
return new chunk2YGIBOUH_cjs.ConfigurationError(message, errorOptions);
|
|
1342
1343
|
}
|
|
1343
1344
|
if (status >= 500) {
|
|
1344
|
-
return new
|
|
1345
|
+
return new chunk2YGIBOUH_cjs.NetworkError(message, errorOptions);
|
|
1345
1346
|
}
|
|
1346
|
-
return new
|
|
1347
|
+
return new chunk2YGIBOUH_cjs.UnknownAgentError(message, errorOptions);
|
|
1347
1348
|
}
|
|
1348
1349
|
function extractErrorEnvelope(body) {
|
|
1349
1350
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1597,7 +1598,7 @@ var OpenAIClient = class {
|
|
|
1597
1598
|
endpoint: "/v1/chat/completions"
|
|
1598
1599
|
});
|
|
1599
1600
|
if (ollamaMapped !== void 0) throw ollamaMapped;
|
|
1600
|
-
throw
|
|
1601
|
+
throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
|
|
1601
1602
|
providerId,
|
|
1602
1603
|
status: response.status,
|
|
1603
1604
|
body,
|
|
@@ -1626,7 +1627,7 @@ var OpenAIClient = class {
|
|
|
1626
1627
|
}
|
|
1627
1628
|
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
1628
1629
|
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
1629
|
-
throw
|
|
1630
|
+
throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
|
|
1630
1631
|
providerId,
|
|
1631
1632
|
status,
|
|
1632
1633
|
body: chunk,
|
|
@@ -1638,7 +1639,7 @@ var OpenAIClient = class {
|
|
|
1638
1639
|
for (const event of events) yield event;
|
|
1639
1640
|
}
|
|
1640
1641
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1641
|
-
throw new
|
|
1642
|
+
throw new chunk2YGIBOUH_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1642
1643
|
code: "stream_truncated"
|
|
1643
1644
|
});
|
|
1644
1645
|
}
|
|
@@ -1770,13 +1771,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1770
1771
|
toolCalls.push(...recovered.toolCalls);
|
|
1771
1772
|
text = recovered.residualText;
|
|
1772
1773
|
stopReason = "tool_use";
|
|
1773
|
-
|
|
1774
|
+
chunkSXSPMRSV_cjs.diag(
|
|
1774
1775
|
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
1775
1776
|
`
|
|
1776
1777
|
);
|
|
1777
1778
|
}
|
|
1778
1779
|
if (recovered.droppedNames.length > 0) {
|
|
1779
|
-
|
|
1780
|
+
chunkSXSPMRSV_cjs.diag(
|
|
1780
1781
|
`[theokit-sdk] dropped ${recovered.droppedNames.length} leaked block(s) whose name is not a tool in the request (provider="${this.providerName}", names=${recovered.droppedNames.join(",")})
|
|
1781
1782
|
`
|
|
1782
1783
|
);
|
|
@@ -1898,10 +1899,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
1898
1899
|
const firstResult = await generator.next();
|
|
1899
1900
|
return { kind: "ok", generator, firstResult };
|
|
1900
1901
|
} catch (cause) {
|
|
1901
|
-
if (cause instanceof
|
|
1902
|
+
if (cause instanceof chunk2YGIBOUH_cjs.NetworkError || cause instanceof chunk2YGIBOUH_cjs.RateLimitError || cause instanceof chunk2YGIBOUH_cjs.AuthenticationError) {
|
|
1902
1903
|
if (logFallback) {
|
|
1903
1904
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
1904
|
-
|
|
1905
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
1905
1906
|
`);
|
|
1906
1907
|
}
|
|
1907
1908
|
return { kind: "handshake_error", error: cause };
|
|
@@ -1943,7 +1944,7 @@ var PoolAwareLlmClient = class {
|
|
|
1943
1944
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: stream() must serialize pool-select → build client → first-event probe → classify → retry/rotate/propagate. Extracting helpers fragments the linear narrative; the comments above each branch keep it readable.
|
|
1944
1945
|
async *stream(request, signal) {
|
|
1945
1946
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
1946
|
-
throw new
|
|
1947
|
+
throw new chunk2YGIBOUH_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
1947
1948
|
code: "circuit_open"
|
|
1948
1949
|
});
|
|
1949
1950
|
}
|
|
@@ -1962,7 +1963,7 @@ var PoolAwareLlmClient = class {
|
|
|
1962
1963
|
}
|
|
1963
1964
|
if (entry === null) {
|
|
1964
1965
|
this.breaker.recordTimeout(this.pool.provider);
|
|
1965
|
-
throw new
|
|
1966
|
+
throw new chunk2YGIBOUH_cjs.CredentialPoolExhaustedError(
|
|
1966
1967
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
1967
1968
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
1968
1969
|
);
|
|
@@ -1976,13 +1977,13 @@ var PoolAwareLlmClient = class {
|
|
|
1976
1977
|
}
|
|
1977
1978
|
const decision = classifyAndDecide(attempt.error, hasRetried429);
|
|
1978
1979
|
if (decision === "retry") {
|
|
1979
|
-
const backoffMs =
|
|
1980
|
+
const backoffMs = chunkRAACTJ7C_cjs.computeBackoffMs({
|
|
1980
1981
|
attempt: 0,
|
|
1981
1982
|
...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
|
|
1982
1983
|
...this.rng !== void 0 ? { rng: this.rng } : {}
|
|
1983
1984
|
});
|
|
1984
1985
|
this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
|
|
1985
|
-
await
|
|
1986
|
+
await chunkRAACTJ7C_cjs.sleepWithAbort(backoffMs, signal);
|
|
1986
1987
|
hasRetried429 = true;
|
|
1987
1988
|
continue;
|
|
1988
1989
|
}
|
|
@@ -1994,7 +1995,7 @@ var PoolAwareLlmClient = class {
|
|
|
1994
1995
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
1995
1996
|
});
|
|
1996
1997
|
} catch (persistErr) {
|
|
1997
|
-
|
|
1998
|
+
chunkSXSPMRSV_cjs.diag(
|
|
1998
1999
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
1999
2000
|
`
|
|
2000
2001
|
);
|
|
@@ -2016,8 +2017,8 @@ var PoolAwareLlmClient = class {
|
|
|
2016
2017
|
}
|
|
2017
2018
|
};
|
|
2018
2019
|
function classifyAndDecide(error, hasRetried429) {
|
|
2019
|
-
if (error instanceof
|
|
2020
|
-
if (error instanceof
|
|
2020
|
+
if (error instanceof chunk2YGIBOUH_cjs.NetworkError) return "propagate";
|
|
2021
|
+
if (error instanceof chunk2YGIBOUH_cjs.AuthenticationError) return "rotate";
|
|
2021
2022
|
const status = error.metadata?.statusCode ?? 429;
|
|
2022
2023
|
if (status === 402) return "rotate";
|
|
2023
2024
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2030,8 +2031,8 @@ function parseRetryAfterMs(error) {
|
|
|
2030
2031
|
return void 0;
|
|
2031
2032
|
}
|
|
2032
2033
|
function inferStatusCode(error) {
|
|
2033
|
-
if (error instanceof
|
|
2034
|
-
if (error instanceof
|
|
2034
|
+
if (error instanceof chunk2YGIBOUH_cjs.AuthenticationError) return 401;
|
|
2035
|
+
if (error instanceof chunk2YGIBOUH_cjs.RateLimitError) return 429;
|
|
2035
2036
|
return 0;
|
|
2036
2037
|
}
|
|
2037
2038
|
function abortError(signal) {
|
|
@@ -2139,7 +2140,7 @@ var ResponsesApiClient = class {
|
|
|
2139
2140
|
body = JSON.parse(text2);
|
|
2140
2141
|
} catch {
|
|
2141
2142
|
}
|
|
2142
|
-
throw
|
|
2143
|
+
throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
|
|
2143
2144
|
providerId,
|
|
2144
2145
|
status: response.status,
|
|
2145
2146
|
body,
|
|
@@ -2210,7 +2211,7 @@ var ResponsesApiClient = class {
|
|
|
2210
2211
|
} else if (t === "response.failed" || t === "error") {
|
|
2211
2212
|
const msg = event.response?.error?.message ?? event.message ?? "responses stream failed";
|
|
2212
2213
|
yield { type: "error", message: msg };
|
|
2213
|
-
throw
|
|
2214
|
+
throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
|
|
2214
2215
|
providerId,
|
|
2215
2216
|
status: 502,
|
|
2216
2217
|
body: { error: { message: msg } },
|
|
@@ -2241,14 +2242,14 @@ function abortError2(signal) {
|
|
|
2241
2242
|
// src/internal/llm/retrying-client.ts
|
|
2242
2243
|
var MAX_ATTEMPTS = 3;
|
|
2243
2244
|
function isRetriableError(err) {
|
|
2244
|
-
if (!
|
|
2245
|
-
if (err instanceof
|
|
2246
|
-
if (err instanceof
|
|
2247
|
-
if (err instanceof
|
|
2245
|
+
if (!chunk2YGIBOUH_cjs.isTransientError(err)) return false;
|
|
2246
|
+
if (err instanceof chunk2YGIBOUH_cjs.CredentialPoolExhaustedError) return false;
|
|
2247
|
+
if (err instanceof chunk2YGIBOUH_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2248
|
+
if (err instanceof chunk2YGIBOUH_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2248
2249
|
return true;
|
|
2249
2250
|
}
|
|
2250
2251
|
function retryAfterHintMs(err) {
|
|
2251
|
-
if (!(err instanceof
|
|
2252
|
+
if (!(err instanceof chunk2YGIBOUH_cjs.RateLimitError)) return void 0;
|
|
2252
2253
|
const seconds = err.metadata?.retryAfter;
|
|
2253
2254
|
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2254
2255
|
}
|
|
@@ -2294,16 +2295,16 @@ var RetryingLlmClient = class {
|
|
|
2294
2295
|
*/
|
|
2295
2296
|
async #waitBackoff(err, attempt, signal) {
|
|
2296
2297
|
const hint = retryAfterHintMs(err);
|
|
2297
|
-
const ms =
|
|
2298
|
+
const ms = chunkRAACTJ7C_cjs.computeBackoffMs({
|
|
2298
2299
|
attempt,
|
|
2299
2300
|
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2300
2301
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2301
2302
|
});
|
|
2302
2303
|
const cause = err instanceof Error ? err.name : typeof err;
|
|
2303
|
-
|
|
2304
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2304
2305
|
`retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
|
|
2305
2306
|
);
|
|
2306
|
-
await
|
|
2307
|
+
await chunkRAACTJ7C_cjs.sleepWithAbort(ms, signal);
|
|
2307
2308
|
}
|
|
2308
2309
|
async *stream(request, signal) {
|
|
2309
2310
|
let lastError;
|
|
@@ -2341,7 +2342,7 @@ function classifyVertexError(args, errStatus) {
|
|
|
2341
2342
|
return "unknown";
|
|
2342
2343
|
}
|
|
2343
2344
|
function vertexMetadata(args, code) {
|
|
2344
|
-
return
|
|
2345
|
+
return chunkE3OCRJU6_cjs.buildErrorMetadata({
|
|
2345
2346
|
provider: "vertex",
|
|
2346
2347
|
endpoint: args.endpoint,
|
|
2347
2348
|
code,
|
|
@@ -2351,23 +2352,23 @@ function vertexMetadata(args, code) {
|
|
|
2351
2352
|
});
|
|
2352
2353
|
}
|
|
2353
2354
|
var VERTEX_ERROR_BUILDERS = {
|
|
2354
|
-
rate_limit: (args, msg) => new
|
|
2355
|
+
rate_limit: (args, msg) => new chunk2YGIBOUH_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2355
2356
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2356
2357
|
}),
|
|
2357
|
-
auth_unauthenticated: (args, msg) => new
|
|
2358
|
+
auth_unauthenticated: (args, msg) => new chunk2YGIBOUH_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2358
2359
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2359
2360
|
}),
|
|
2360
|
-
auth_permission: (args, msg) => new
|
|
2361
|
+
auth_permission: (args, msg) => new chunk2YGIBOUH_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2361
2362
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2362
2363
|
}),
|
|
2363
|
-
invalid_request: (args, msg) => new
|
|
2364
|
+
invalid_request: (args, msg) => new chunk2YGIBOUH_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2364
2365
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2365
2366
|
}),
|
|
2366
|
-
timeout: (args, msg) => new
|
|
2367
|
-
server_error: (args, msg) => new
|
|
2367
|
+
timeout: (args, msg) => new chunk2YGIBOUH_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2368
|
+
server_error: (args, msg) => new chunk2YGIBOUH_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2368
2369
|
metadata: vertexMetadata(args, "server_error")
|
|
2369
2370
|
}),
|
|
2370
|
-
unknown: (args, msg) => new
|
|
2371
|
+
unknown: (args, msg) => new chunk2YGIBOUH_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2371
2372
|
};
|
|
2372
2373
|
function mapVertexError(args) {
|
|
2373
2374
|
const parsed = parseBody2(args.body);
|
|
@@ -2403,12 +2404,12 @@ async function resolveVertexAccessToken() {
|
|
|
2403
2404
|
async function getAuthClientOrThrow() {
|
|
2404
2405
|
let mod;
|
|
2405
2406
|
try {
|
|
2406
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2407
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-ZNEYQ56O.cjs', document.baseURI).href)));
|
|
2407
2408
|
mod = r("google-auth-library");
|
|
2408
2409
|
} catch (err) {
|
|
2409
2410
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2410
2411
|
if (isModuleMissing) {
|
|
2411
|
-
throw new
|
|
2412
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2412
2413
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2413
2414
|
{ code: "auth_failed", cause: err }
|
|
2414
2415
|
);
|
|
@@ -2419,7 +2420,7 @@ async function getAuthClientOrThrow() {
|
|
|
2419
2420
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2420
2421
|
return await auth.getClient();
|
|
2421
2422
|
} catch (err) {
|
|
2422
|
-
|
|
2423
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2423
2424
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2424
2425
|
`
|
|
2425
2426
|
);
|
|
@@ -2445,7 +2446,7 @@ var VertexAnthropicClient = class {
|
|
|
2445
2446
|
resolveProjectOrThrow() {
|
|
2446
2447
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2447
2448
|
if (projectId !== void 0) return projectId;
|
|
2448
|
-
throw new
|
|
2449
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2449
2450
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2450
2451
|
{ code: "auth_failed" }
|
|
2451
2452
|
);
|
|
@@ -2455,7 +2456,7 @@ var VertexAnthropicClient = class {
|
|
|
2455
2456
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2456
2457
|
const fromAdc = await resolveVertexAccessToken();
|
|
2457
2458
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2458
|
-
throw new
|
|
2459
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2459
2460
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2460
2461
|
{ code: "auth_failed" }
|
|
2461
2462
|
);
|
|
@@ -2464,8 +2465,8 @@ var VertexAnthropicClient = class {
|
|
|
2464
2465
|
const projectId = this.resolveProjectOrThrow();
|
|
2465
2466
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2466
2467
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2467
|
-
const baseUrl =
|
|
2468
|
-
const bareModel =
|
|
2468
|
+
const baseUrl = chunkT6ZCG5AP_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2469
|
+
const bareModel = chunkT6ZCG5AP_cjs.stripVertexPrefix(request.model);
|
|
2469
2470
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2470
2471
|
const url = `${baseUrl}${endpoint}`;
|
|
2471
2472
|
const response = await postAnthropicRequest({
|
|
@@ -2501,7 +2502,7 @@ var VertexGeminiClient = class {
|
|
|
2501
2502
|
async *stream(request, signal) {
|
|
2502
2503
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2503
2504
|
if (projectId === void 0) {
|
|
2504
|
-
throw new
|
|
2505
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2505
2506
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2506
2507
|
{ code: "auth_failed" }
|
|
2507
2508
|
);
|
|
@@ -2509,12 +2510,12 @@ var VertexGeminiClient = class {
|
|
|
2509
2510
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2510
2511
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2511
2512
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2512
|
-
throw new
|
|
2513
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2513
2514
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2514
2515
|
{ code: "auth_failed" }
|
|
2515
2516
|
);
|
|
2516
2517
|
}
|
|
2517
|
-
const baseUrl =
|
|
2518
|
+
const baseUrl = chunkT6ZCG5AP_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2518
2519
|
const url = `${baseUrl}/chat/completions`;
|
|
2519
2520
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2520
2521
|
const rewriteFetch = (input, init) => {
|
|
@@ -2540,7 +2541,7 @@ var VertexRouterClient = class {
|
|
|
2540
2541
|
options;
|
|
2541
2542
|
name = "vertex";
|
|
2542
2543
|
async *stream(request, signal) {
|
|
2543
|
-
const dialect =
|
|
2544
|
+
const dialect = chunkT6ZCG5AP_cjs.inferModelDialect(request.model);
|
|
2544
2545
|
if (dialect === "anthropic") {
|
|
2545
2546
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2546
2547
|
return yield* inner2.stream(request, signal);
|
|
@@ -2552,7 +2553,7 @@ var VertexRouterClient = class {
|
|
|
2552
2553
|
|
|
2553
2554
|
// src/internal/llm/router.ts
|
|
2554
2555
|
function resolveProviderChain(options) {
|
|
2555
|
-
|
|
2556
|
+
chunkT6ZCG5AP_cjs.registerBuiltins();
|
|
2556
2557
|
return buildChain(options);
|
|
2557
2558
|
}
|
|
2558
2559
|
function buildChain(options) {
|
|
@@ -2569,7 +2570,7 @@ function buildChain(options) {
|
|
|
2569
2570
|
addClient(options.primary);
|
|
2570
2571
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2571
2572
|
if (clients.length === 0) {
|
|
2572
|
-
throw new
|
|
2573
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2573
2574
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2574
2575
|
{ code: "provider_unresolved" }
|
|
2575
2576
|
);
|
|
@@ -2577,11 +2578,11 @@ function buildChain(options) {
|
|
|
2577
2578
|
return clients;
|
|
2578
2579
|
}
|
|
2579
2580
|
function buildClient(name, routerOptions) {
|
|
2580
|
-
const baseProfile =
|
|
2581
|
+
const baseProfile = chunkT6ZCG5AP_cjs.getProviderProfile(name);
|
|
2581
2582
|
if (baseProfile === void 0) return void 0;
|
|
2582
2583
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2583
2584
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2584
|
-
const ambient =
|
|
2585
|
+
const ambient = chunkRAACTJ7C_cjs.currentCredentialPool(name);
|
|
2585
2586
|
if (ambient !== void 0) {
|
|
2586
2587
|
return new RetryingLlmClient(
|
|
2587
2588
|
new PoolAwareLlmClient(
|
|
@@ -2611,9 +2612,9 @@ function buildPoolOrSingle(args) {
|
|
|
2611
2612
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2612
2613
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2613
2614
|
const entries = poolKeys.map(
|
|
2614
|
-
(accessToken, priority) =>
|
|
2615
|
+
(accessToken, priority) => chunkRAACTJ7C_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2615
2616
|
);
|
|
2616
|
-
const pool = new
|
|
2617
|
+
const pool = new chunkRAACTJ7C_cjs.CredentialPool(name, entries, strategy);
|
|
2617
2618
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2618
2619
|
return new RetryingLlmClient(
|
|
2619
2620
|
new PoolAwareLlmClient(
|
|
@@ -2648,7 +2649,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2648
2649
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2649
2650
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2650
2651
|
warnedNoAuthApiKeys.add(provider);
|
|
2651
|
-
|
|
2652
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2652
2653
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2653
2654
|
`
|
|
2654
2655
|
);
|
|
@@ -2674,10 +2675,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2674
2675
|
if (apiKeys === void 0) return;
|
|
2675
2676
|
for (const name of Object.keys(apiKeys)) {
|
|
2676
2677
|
if (warnedProviders.has(name)) continue;
|
|
2677
|
-
const profile =
|
|
2678
|
+
const profile = chunkT6ZCG5AP_cjs.getProviderProfile(name);
|
|
2678
2679
|
if (profile === void 0) {
|
|
2679
2680
|
warnedProviders.add(name);
|
|
2680
|
-
|
|
2681
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2681
2682
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2682
2683
|
`
|
|
2683
2684
|
);
|
|
@@ -2709,7 +2710,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2709
2710
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2710
2711
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2711
2712
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2712
|
-
throw new
|
|
2713
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2713
2714
|
`provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
|
|
2714
2715
|
);
|
|
2715
2716
|
}
|
|
@@ -2760,7 +2761,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2760
2761
|
providerName: profile.name
|
|
2761
2762
|
});
|
|
2762
2763
|
}
|
|
2763
|
-
throw new
|
|
2764
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2764
2765
|
`Provider "${profile.name}" requires apiMode "${profile.apiMode}" but no transport is registered. Install a third-party transport plugin (@theokit-transport-${profile.apiMode}) or use a provider with apiMode "chat_completions" or "anthropic_messages".`,
|
|
2765
2766
|
{ code: "transport_unavailable" }
|
|
2766
2767
|
);
|
|
@@ -2768,18 +2769,9 @@ function selectTransport(profile, apiKey) {
|
|
|
2768
2769
|
|
|
2769
2770
|
// src/internal/local-agent/real-local-run-provider.ts
|
|
2770
2771
|
function inferProviderFromApiKey(apiKey) {
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
{ provider: "anthropic", prefix: "sk-ant-" },
|
|
2775
|
-
{ provider: "openai", prefix: "sk-" }
|
|
2776
|
-
];
|
|
2777
|
-
for (const { provider, prefix } of byPrefix) {
|
|
2778
|
-
if (apiKey.startsWith(prefix) && chunkGLEKLAUW_cjs.getProviderProfile(provider) !== void 0) {
|
|
2779
|
-
return provider;
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
return void 0;
|
|
2772
|
+
const provider = chunkWVDH34LK_cjs.providerFromApiKeyPrefix(apiKey);
|
|
2773
|
+
if (provider === void 0) return void 0;
|
|
2774
|
+
return chunkT6ZCG5AP_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
2783
2775
|
}
|
|
2784
2776
|
function detectPrimaryProvider() {
|
|
2785
2777
|
if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
|
|
@@ -2914,7 +2906,7 @@ function plainText(content) {
|
|
|
2914
2906
|
}
|
|
2915
2907
|
async function compactSessionTranscript(opts) {
|
|
2916
2908
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
2917
|
-
const history =
|
|
2909
|
+
const history = chunkECPL5RV6_cjs.reconstructMessages(prior);
|
|
2918
2910
|
const compressible = [];
|
|
2919
2911
|
for (const m of history) {
|
|
2920
2912
|
const text = plainText(m.content);
|
|
@@ -2922,14 +2914,14 @@ async function compactSessionTranscript(opts) {
|
|
|
2922
2914
|
compressible.push({ role: m.role, content: text });
|
|
2923
2915
|
}
|
|
2924
2916
|
}
|
|
2925
|
-
const preTokens =
|
|
2917
|
+
const preTokens = chunkAMYY3JHQ_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
2926
2918
|
const summaryBody = await opts.summarize(compressible);
|
|
2927
2919
|
const preserved = [];
|
|
2928
2920
|
let budget = 0;
|
|
2929
2921
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
2930
2922
|
const m = compressible[i];
|
|
2931
2923
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
2932
|
-
const cost =
|
|
2924
|
+
const cost = chunkAMYY3JHQ_cjs.estimateTokens(m.content);
|
|
2933
2925
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
2934
2926
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
2935
2927
|
if (remaining > 50) {
|
|
@@ -2943,7 +2935,7 @@ async function compactSessionTranscript(opts) {
|
|
|
2943
2935
|
}
|
|
2944
2936
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
2945
2937
|
${summaryBody}`;
|
|
2946
|
-
const transcript =
|
|
2938
|
+
const transcript = chunkECPL5RV6_cjs.SessionTranscript.fromRecords(prior, {
|
|
2947
2939
|
cwd: opts.loc.cwd,
|
|
2948
2940
|
sessionId: opts.sessionId,
|
|
2949
2941
|
model: opts.loc.model ?? "unknown"
|
|
@@ -2954,7 +2946,7 @@ ${summaryBody}`;
|
|
|
2954
2946
|
const delta = transcript.records().slice(prior.length);
|
|
2955
2947
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
2956
2948
|
chunk4JBHSLQO_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
2957
|
-
const postTokens =
|
|
2949
|
+
const postTokens = chunkAMYY3JHQ_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
2958
2950
|
return { preTokens, postTokens };
|
|
2959
2951
|
}
|
|
2960
2952
|
function resolveSummarizerRoute(opts) {
|
|
@@ -2963,9 +2955,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
2963
2955
|
}
|
|
2964
2956
|
function buildDefaultSummarizer(opts) {
|
|
2965
2957
|
return async (messages) => {
|
|
2966
|
-
|
|
2958
|
+
chunkT6ZCG5AP_cjs.registerBuiltins();
|
|
2967
2959
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
2968
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
2960
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkT6ZCG5AP_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
2969
2961
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
2970
2962
|
const route = resolveSummarizerRoute({
|
|
2971
2963
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3036,7 +3028,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3036
3028
|
return true;
|
|
3037
3029
|
} catch (cause) {
|
|
3038
3030
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3039
|
-
|
|
3031
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3040
3032
|
`);
|
|
3041
3033
|
return false;
|
|
3042
3034
|
}
|
|
@@ -3067,5 +3059,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3067
3059
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3068
3060
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3069
3061
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3070
|
-
//# sourceMappingURL=chunk-
|
|
3071
|
-
//# sourceMappingURL=chunk-
|
|
3062
|
+
//# sourceMappingURL=chunk-ZNEYQ56O.cjs.map
|
|
3063
|
+
//# sourceMappingURL=chunk-ZNEYQ56O.cjs.map
|