@theokit/sdk 4.40.0 → 4.41.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 +47 -0
- package/README.md +2 -2
- package/dist/agent-35MGOZVH.js +46 -0
- package/dist/{agent-MSR3DHO4.js.map → agent-35MGOZVH.js.map} +1 -1
- package/dist/agent-6C2ODKFU.cjs +55 -0
- package/dist/{agent-OOXJJD6A.cjs.map → agent-6C2ODKFU.cjs.map} +1 -1
- package/dist/{agent-BzZwYFiw.d.ts → agent-BiCINq25.d.ts} +2 -2
- package/dist/{agent-DxEL4fHh.d.cts → agent-Zta1kvGH.d.cts} +2 -2
- package/dist/agent-session-store-EPUERCUU.cjs +23 -0
- package/dist/{agent-session-store-RHTLZ5OX.cjs.map → agent-session-store-EPUERCUU.cjs.map} +1 -1
- package/dist/agent-session-store-TXP5ZVOD.js +6 -0
- package/dist/{agent-session-store-EGTTYSKS.js.map → agent-session-store-TXP5ZVOD.js.map} +1 -1
- package/dist/auth/index.cjs +19 -15
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +4 -4
- package/dist/{batch-WX2HLXX2.js → batch-OUF4N2TM.js} +9 -9
- package/dist/{batch-WX2HLXX2.js.map → batch-OUF4N2TM.js.map} +1 -1
- package/dist/{batch-FO2KZN7W.cjs → batch-URTEXK77.cjs} +26 -26
- package/dist/{batch-FO2KZN7W.cjs.map → batch-URTEXK77.cjs.map} +1 -1
- package/dist/{chunk-PDOLUFGY.cjs → chunk-27DYRARU.cjs} +4 -4
- package/dist/{chunk-PDOLUFGY.cjs.map → chunk-27DYRARU.cjs.map} +1 -1
- package/dist/{chunk-LYD3ALDT.js → chunk-2S6B5B2A.js} +5 -5
- package/dist/{chunk-LYD3ALDT.js.map → chunk-2S6B5B2A.js.map} +1 -1
- package/dist/{chunk-VTDQRUAJ.js → chunk-2WB6EIYW.js} +4 -4
- package/dist/{chunk-VTDQRUAJ.js.map → chunk-2WB6EIYW.js.map} +1 -1
- package/dist/{chunk-3CAQCFVZ.js → chunk-35NFZ7QB.js} +3 -3
- package/dist/{chunk-3CAQCFVZ.js.map → chunk-35NFZ7QB.js.map} +1 -1
- package/dist/{chunk-HCRCNI7A.js → chunk-3KY7MHR4.js} +3 -3
- package/dist/{chunk-HCRCNI7A.js.map → chunk-3KY7MHR4.js.map} +1 -1
- package/dist/{chunk-BURYFNOM.cjs → chunk-4JBHSLQO.cjs} +2 -2
- package/dist/chunk-4JBHSLQO.cjs.map +1 -0
- package/dist/{chunk-V7CA3CX5.cjs → chunk-4JRRFRV4.cjs} +5 -4
- package/dist/chunk-4JRRFRV4.cjs.map +1 -0
- package/dist/{chunk-5KOW3GLE.js → chunk-4QEC4CCS.js} +2 -2
- package/dist/chunk-4QEC4CCS.js.map +1 -0
- package/dist/{chunk-ALDFVGQQ.cjs → chunk-57KX5WTP.cjs} +9 -9
- package/dist/{chunk-ALDFVGQQ.cjs.map → chunk-57KX5WTP.cjs.map} +1 -1
- package/dist/{chunk-CJHBSSAF.cjs → chunk-64TJCXY5.cjs} +15 -15
- package/dist/{chunk-CJHBSSAF.cjs.map → chunk-64TJCXY5.cjs.map} +1 -1
- package/dist/{chunk-IEKSEAIV.js → chunk-6FSQ3CHQ.js} +3 -3
- package/dist/{chunk-IEKSEAIV.js.map → chunk-6FSQ3CHQ.js.map} +1 -1
- package/dist/{chunk-ZVQJHY4Y.cjs → chunk-6W4U2G3J.cjs} +5 -5
- package/dist/{chunk-ZVQJHY4Y.cjs.map → chunk-6W4U2G3J.cjs.map} +1 -1
- package/dist/{chunk-FMDZZRYE.cjs → chunk-6X2HUT4A.cjs} +8 -8
- package/dist/{chunk-FMDZZRYE.cjs.map → chunk-6X2HUT4A.cjs.map} +1 -1
- package/dist/{chunk-X2LDDKFM.cjs → chunk-7PESI6YD.cjs} +10 -10
- package/dist/{chunk-X2LDDKFM.cjs.map → chunk-7PESI6YD.cjs.map} +1 -1
- package/dist/{chunk-EYUZZXHZ.js → chunk-AF4BBKIF.js} +4 -4
- package/dist/chunk-AF4BBKIF.js.map +1 -0
- package/dist/{chunk-7GFX45DD.js → chunk-AM2CNBKE.js} +2 -2
- package/dist/chunk-AM2CNBKE.js.map +1 -0
- package/dist/{chunk-XKGOIGTJ.js → chunk-AZ6FKDQR.js} +3 -3
- package/dist/{chunk-XKGOIGTJ.js.map → chunk-AZ6FKDQR.js.map} +1 -1
- package/dist/{chunk-WPZTYOUX.cjs → chunk-BBZYXVLZ.cjs} +2 -2
- package/dist/chunk-BBZYXVLZ.cjs.map +1 -0
- package/dist/{chunk-2UBBO2MD.js → chunk-BHWHE453.js} +5 -5
- package/dist/{chunk-2UBBO2MD.js.map → chunk-BHWHE453.js.map} +1 -1
- package/dist/{chunk-LY4KEOOY.cjs → chunk-BRHRQOJA.cjs} +4 -4
- package/dist/{chunk-LY4KEOOY.cjs.map → chunk-BRHRQOJA.cjs.map} +1 -1
- package/dist/{chunk-4H2QARXM.cjs → chunk-BV42CCRP.cjs} +7 -7
- package/dist/{chunk-4H2QARXM.cjs.map → chunk-BV42CCRP.cjs.map} +1 -1
- package/dist/{chunk-ZRQZOJ3N.js → chunk-DCKIS53K.js} +52 -51
- package/dist/chunk-DCKIS53K.js.map +1 -0
- package/dist/{chunk-SKWVAQAY.js → chunk-DEZ75ET5.js} +3 -3
- package/dist/{chunk-SKWVAQAY.js.map → chunk-DEZ75ET5.js.map} +1 -1
- package/dist/{chunk-WJOLIPEM.js → chunk-EON4YTR6.js} +8 -8
- package/dist/{chunk-WJOLIPEM.js.map → chunk-EON4YTR6.js.map} +1 -1
- package/dist/{chunk-MI3OKONE.js → chunk-F4RUADRC.js} +3 -3
- package/dist/{chunk-MI3OKONE.js.map → chunk-F4RUADRC.js.map} +1 -1
- package/dist/{chunk-BVGJXMSB.cjs → chunk-F5DSDDBY.cjs} +312 -311
- package/dist/chunk-F5DSDDBY.cjs.map +1 -0
- package/dist/{chunk-SEWAPWAF.cjs → chunk-FMIKUGF2.cjs} +124 -124
- package/dist/chunk-FMIKUGF2.cjs.map +1 -0
- package/dist/{chunk-XZ7PO2FM.js → chunk-FRQ6F44U.js} +4 -4
- package/dist/{chunk-XZ7PO2FM.js.map → chunk-FRQ6F44U.js.map} +1 -1
- package/dist/{chunk-3LK3ZDL5.cjs → chunk-FZ4YMZA3.cjs} +5 -5
- package/dist/{chunk-3LK3ZDL5.cjs.map → chunk-FZ4YMZA3.cjs.map} +1 -1
- package/dist/{chunk-MM2JKFQV.cjs → chunk-GC44RATP.cjs} +10 -10
- package/dist/{chunk-MM2JKFQV.cjs.map → chunk-GC44RATP.cjs.map} +1 -1
- package/dist/{chunk-LNTQRD23.cjs → chunk-GH52NOCL.cjs} +26 -26
- package/dist/chunk-GH52NOCL.cjs.map +1 -0
- package/dist/{chunk-T6KFGMNY.cjs → chunk-GLEKLAUW.cjs} +12 -12
- package/dist/chunk-GLEKLAUW.cjs.map +1 -0
- package/dist/{chunk-UIPTINIF.js → chunk-GNMPCZNN.js} +6 -6
- package/dist/chunk-GNMPCZNN.js.map +1 -0
- package/dist/{chunk-K6TWHNT4.cjs → chunk-HECR7KF5.cjs} +11 -11
- package/dist/{chunk-K6TWHNT4.cjs.map → chunk-HECR7KF5.cjs.map} +1 -1
- package/dist/{chunk-NHXPQN44.js → chunk-HK4HRLWE.js} +3 -3
- package/dist/{chunk-NHXPQN44.js.map → chunk-HK4HRLWE.js.map} +1 -1
- package/dist/{chunk-LWVKI75U.js → chunk-HKSSM5RK.js} +3 -3
- package/dist/{chunk-LWVKI75U.js.map → chunk-HKSSM5RK.js.map} +1 -1
- package/dist/{chunk-ELYGL52R.cjs → chunk-HLNLYLNN.cjs} +4 -4
- package/dist/{chunk-ELYGL52R.cjs.map → chunk-HLNLYLNN.cjs.map} +1 -1
- package/dist/{chunk-ONVIALVV.js → chunk-IMX5YODO.js} +15 -15
- package/dist/chunk-IMX5YODO.js.map +1 -0
- package/dist/{chunk-C64E2EJS.js → chunk-J5RW43IR.js} +4 -4
- package/dist/{chunk-C64E2EJS.js.map → chunk-J5RW43IR.js.map} +1 -1
- package/dist/{chunk-4E3HLSYE.cjs → chunk-JA4FEA5Z.cjs} +4 -4
- package/dist/{chunk-4E3HLSYE.cjs.map → chunk-JA4FEA5Z.cjs.map} +1 -1
- package/dist/{chunk-EJNFZET4.cjs → chunk-JO76RWCA.cjs} +11 -11
- package/dist/{chunk-EJNFZET4.cjs.map → chunk-JO76RWCA.cjs.map} +1 -1
- package/dist/{chunk-QMIG7TKG.cjs → chunk-KCQUYQ3V.cjs} +17 -17
- package/dist/chunk-KCQUYQ3V.cjs.map +1 -0
- package/dist/{chunk-AKMPQJPX.js → chunk-L4JFQCG4.js} +5 -5
- package/dist/chunk-L4JFQCG4.js.map +1 -0
- package/dist/{chunk-HJMFPIRM.js → chunk-LLE7HPRI.js} +5 -5
- package/dist/{chunk-HJMFPIRM.js.map → chunk-LLE7HPRI.js.map} +1 -1
- package/dist/{chunk-4H2DCO6P.js → chunk-LXKNENHK.js} +3 -3
- package/dist/{chunk-4H2DCO6P.js.map → chunk-LXKNENHK.js.map} +1 -1
- package/dist/{chunk-PY7G7YWK.cjs → chunk-MMZX557L.cjs} +5 -5
- package/dist/{chunk-PY7G7YWK.cjs.map → chunk-MMZX557L.cjs.map} +1 -1
- package/dist/{chunk-VQ33XLC6.js → chunk-MRKSSN36.js} +3 -3
- package/dist/{chunk-VQ33XLC6.js.map → chunk-MRKSSN36.js.map} +1 -1
- package/dist/{chunk-33B2BSME.cjs → chunk-NETYW4V3.cjs} +13 -5
- package/dist/chunk-NETYW4V3.cjs.map +1 -0
- package/dist/{chunk-OVGNXGCK.cjs → chunk-NNNUQELM.cjs} +9 -9
- package/dist/{chunk-OVGNXGCK.cjs.map → chunk-NNNUQELM.cjs.map} +1 -1
- package/dist/{chunk-BM7VYZED.js → chunk-NOM2YWFP.js} +5 -5
- package/dist/{chunk-BM7VYZED.js.map → chunk-NOM2YWFP.js.map} +1 -1
- package/dist/{chunk-WMWZAJMJ.cjs → chunk-NRA36JKG.cjs} +11 -11
- package/dist/{chunk-WMWZAJMJ.cjs.map → chunk-NRA36JKG.cjs.map} +1 -1
- package/dist/{chunk-4HKAZRTC.js → chunk-O3IZ7JEL.js} +3 -3
- package/dist/{chunk-4HKAZRTC.js.map → chunk-O3IZ7JEL.js.map} +1 -1
- package/dist/{chunk-RHQJX3EI.cjs → chunk-OEFFPR2S.cjs} +4 -4
- package/dist/{chunk-RHQJX3EI.cjs.map → chunk-OEFFPR2S.cjs.map} +1 -1
- package/dist/{chunk-4GGXF7YM.js → chunk-OLLOUAUJ.js} +3 -3
- package/dist/{chunk-4GGXF7YM.js.map → chunk-OLLOUAUJ.js.map} +1 -1
- package/dist/{chunk-RA2UZBYP.js → chunk-PAV4ZPSW.js} +3 -3
- package/dist/{chunk-RA2UZBYP.js.map → chunk-PAV4ZPSW.js.map} +1 -1
- package/dist/{chunk-RNCN2TTP.js → chunk-PBML2FHN.js} +2 -2
- package/dist/{chunk-A76OFN2B.cjs.map → chunk-PBML2FHN.js.map} +1 -1
- package/dist/{chunk-XRKFWV7K.js → chunk-PYM5OUL4.js} +5 -5
- package/dist/{chunk-XRKFWV7K.js.map → chunk-PYM5OUL4.js.map} +1 -1
- package/dist/{chunk-F4SQTWVR.js → chunk-Q4DTGCSD.js} +3 -3
- package/dist/{chunk-F4SQTWVR.js.map → chunk-Q4DTGCSD.js.map} +1 -1
- package/dist/{chunk-S7OEXQMI.cjs → chunk-R3CKCRK3.cjs} +4 -4
- package/dist/{chunk-S7OEXQMI.cjs.map → chunk-R3CKCRK3.cjs.map} +1 -1
- package/dist/{chunk-5COPO3H4.cjs → chunk-RBQYHEZD.cjs} +4 -4
- package/dist/{chunk-5COPO3H4.cjs.map → chunk-RBQYHEZD.cjs.map} +1 -1
- package/dist/{chunk-KRPEPZQY.js → chunk-RJBHWM6D.js} +7 -7
- package/dist/chunk-RJBHWM6D.js.map +1 -0
- package/dist/{chunk-U53AYSHS.cjs → chunk-S4Q5OMIK.cjs} +11 -11
- package/dist/{chunk-U53AYSHS.cjs.map → chunk-S4Q5OMIK.cjs.map} +1 -1
- package/dist/{chunk-FUP3ZA5T.js → chunk-SNKY3C2L.js} +4 -4
- package/dist/{chunk-FUP3ZA5T.js.map → chunk-SNKY3C2L.js.map} +1 -1
- package/dist/{chunk-BBMN4O6E.js → chunk-TJRPNBY5.js} +4 -4
- package/dist/{chunk-BBMN4O6E.js.map → chunk-TJRPNBY5.js.map} +1 -1
- package/dist/{chunk-27E4EMR6.cjs → chunk-UJMEWGO6.cjs} +4 -4
- package/dist/{chunk-27E4EMR6.cjs.map → chunk-UJMEWGO6.cjs.map} +1 -1
- package/dist/{chunk-X627TO3A.js → chunk-UTYCG4RB.js} +12 -12
- package/dist/chunk-UTYCG4RB.js.map +1 -0
- package/dist/{chunk-5XPKYDK7.js → chunk-VQFSEKU5.js} +12 -5
- package/dist/chunk-VQFSEKU5.js.map +1 -0
- package/dist/{chunk-NJVV5OAV.cjs → chunk-WCXOKGOQ.cjs} +8 -8
- package/dist/chunk-WCXOKGOQ.cjs.map +1 -0
- package/dist/{chunk-PIBXDEZM.cjs → chunk-WIGJGFH4.cjs} +5 -5
- package/dist/{chunk-PIBXDEZM.cjs.map → chunk-WIGJGFH4.cjs.map} +1 -1
- package/dist/{chunk-LOTWA65Z.cjs → chunk-X2YQP452.cjs} +11 -11
- package/dist/{chunk-LOTWA65Z.cjs.map → chunk-X2YQP452.cjs.map} +1 -1
- package/dist/{chunk-ZAKTZ5B4.cjs → chunk-XA3TSBAH.cjs} +8 -8
- package/dist/{chunk-ZAKTZ5B4.cjs.map → chunk-XA3TSBAH.cjs.map} +1 -1
- package/dist/{chunk-H2V6CXM7.cjs → chunk-XR4LPBXH.cjs} +9 -9
- package/dist/{chunk-H2V6CXM7.cjs.map → chunk-XR4LPBXH.cjs.map} +1 -1
- package/dist/{chunk-6AE4QTSF.cjs → chunk-Y33IGXCJ.cjs} +24 -24
- package/dist/{chunk-6AE4QTSF.cjs.map → chunk-Y33IGXCJ.cjs.map} +1 -1
- package/dist/{chunk-E7WWIX34.cjs → chunk-YULF6FPB.cjs} +8 -8
- package/dist/{chunk-E7WWIX34.cjs.map → chunk-YULF6FPB.cjs.map} +1 -1
- package/dist/{chunk-23HI77BZ.js → chunk-Z6N6SDNR.js} +4 -4
- package/dist/chunk-Z6N6SDNR.js.map +1 -0
- package/dist/{chunk-A76OFN2B.cjs → chunk-ZHPET3LZ.cjs} +2 -2
- package/dist/chunk-ZHPET3LZ.cjs.map +1 -0
- package/dist/{chunk-5VKUZ26Q.js → chunk-ZNW2TXLO.js} +3 -3
- package/dist/{chunk-5VKUZ26Q.js.map → chunk-ZNW2TXLO.js.map} +1 -1
- package/dist/{chunk-N4JNY5DT.cjs → chunk-ZO2L5U6F.cjs} +32 -32
- package/dist/chunk-ZO2L5U6F.cjs.map +1 -0
- package/dist/{chunk-RMCHJZNZ.js → chunk-ZS6SLELQ.js} +4 -4
- package/dist/{chunk-RMCHJZNZ.js.map → chunk-ZS6SLELQ.js.map} +1 -1
- package/dist/{chunk-7PBAJ2WA.js → chunk-ZTEAJAE6.js} +3 -3
- package/dist/{chunk-7PBAJ2WA.js.map → chunk-ZTEAJAE6.js.map} +1 -1
- package/dist/compact-session-65XCKO6H.js +18 -0
- package/dist/{compact-session-AZU2LEAE.js.map → compact-session-65XCKO6H.js.map} +1 -1
- package/dist/compact-session-OU6SRPVJ.cjs +55 -0
- package/dist/{compact-session-TRCEYCPG.cjs.map → compact-session-OU6SRPVJ.cjs.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-2G4375BZ.cjs +22 -0
- package/dist/{context-DNFT4B5D.cjs.map → context-2G4375BZ.cjs.map} +1 -1
- package/dist/context-GSQYVVMJ.js +5 -0
- package/dist/{context-LYE6TJL5.js.map → context-GSQYVVMJ.js.map} +1 -1
- package/dist/{cron-BGR0HOz9.d.cts → cron-DgHJnMAK.d.cts} +2 -2
- package/dist/{cron-CDAIWCrL.d.ts → cron-DyWQsEG6.d.ts} +2 -2
- package/dist/cron.cjs +33 -33
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +32 -32
- package/dist/{errors-DxQe4_Qy.d.ts → errors-BSoXcl3F.d.cts} +3 -3
- package/dist/{errors-L1bxHHO0.d.cts → errors-CHllybaU.d.ts} +3 -3
- package/dist/errors.cjs +21 -21
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +43 -43
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +33 -33
- package/dist/eval.js.map +1 -1
- package/dist/{executor-TQ3FSZ7F.cjs → executor-CB75B5BH.cjs} +24 -24
- package/dist/{executor-TQ3FSZ7F.cjs.map → executor-CB75B5BH.cjs.map} +1 -1
- package/dist/{executor-PCRX3533.js → executor-VQLTQY53.js} +7 -7
- package/dist/{executor-PCRX3533.js.map → executor-VQLTQY53.js.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-MAZV5FXJ.cjs +19 -0
- package/dist/{fs-session-store-KRZZIG3O.cjs.map → fs-session-store-MAZV5FXJ.cjs.map} +1 -1
- package/dist/fs-session-store-ZNUYZHYI.js +10 -0
- package/dist/{fs-session-store-I6GUIFRO.js.map → fs-session-store-ZNUYZHYI.js.map} +1 -1
- package/dist/generate-object-6PWGH5DZ.cjs +20 -0
- package/dist/{generate-object-QILSGTEJ.cjs.map → generate-object-6PWGH5DZ.cjs.map} +1 -1
- package/dist/generate-object-IXMJ7FUX.js +7 -0
- package/dist/{generate-object-DLHT5RXH.js.map → generate-object-IXMJ7FUX.js.map} +1 -1
- package/dist/index-manager-X5IPG2JL.js +11 -0
- package/dist/{index-manager-SXF3FAQV.js.map → index-manager-X5IPG2JL.js.map} +1 -1
- package/dist/index-manager-YFFEPISE.cjs +20 -0
- package/dist/{index-manager-LEMQ73A7.cjs.map → index-manager-YFFEPISE.cjs.map} +1 -1
- package/dist/index.cjs +139 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +53 -53
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-BVSERZCI.cjs → inject-session-DDC36KKP.cjs} +11 -11
- package/dist/{inject-session-BVSERZCI.cjs.map → inject-session-DDC36KKP.cjs.map} +1 -1
- package/dist/{inject-session-E75EP3LL.js → inject-session-UBM4KVSV.js} +8 -8
- package/dist/{inject-session-E75EP3LL.js.map → inject-session-UBM4KVSV.js.map} +1 -1
- package/dist/internal/auth/credential-store.d.ts +13 -0
- package/dist/internal/diagnostics.d.ts +2 -2
- package/dist/internal/error-mappers/anthropic.d.ts +1 -1
- package/dist/internal/eval/code-runner.d.ts +1 -1
- package/dist/internal/global-singleton.d.ts +1 -1
- package/dist/internal/judge/judge-call.d.ts +1 -1
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/memory/embedding-adapter.d.ts +1 -1
- package/dist/internal/memory/memory-index.d.ts +1 -1
- package/dist/internal/persistence/atomic-write.d.cts +14 -1
- package/dist/internal/persistence/atomic-write.d.ts +14 -1
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/persistence/jsonl.d.cts +2 -2
- package/dist/internal/persistence/jsonl.d.ts +2 -2
- package/dist/internal/persistence/session-artifacts.d.cts +27 -0
- package/dist/internal/persistence/session-artifacts.d.ts +27 -0
- package/dist/internal/persistence/session-transcript.d.cts +1 -1
- package/dist/internal/persistence/session-transcript.d.ts +1 -1
- package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -1
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/internal/session/agent-session.d.ts +1 -1
- package/dist/internal/session/compact-session.d.ts +1 -1
- package/dist/internal/session/session-cache.d.ts +1 -1
- package/dist/judge-call-3QZO5H5N.js +5 -0
- package/dist/{judge-call-NPRU7JIQ.js.map → judge-call-3QZO5H5N.js.map} +1 -1
- package/dist/judge-call-J5EETJL3.cjs +22 -0
- package/dist/{judge-call-AIT3EULV.cjs.map → judge-call-J5EETJL3.cjs.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +5 -5
- package/dist/models.js.map +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +44 -30
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +4 -3
- package/dist/persistence.d.ts +4 -3
- package/dist/persistence.js +22 -12
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-KB3TS6BM.cjs +46 -0
- package/dist/{registry-VKDFTK6L.cjs.map → registry-KB3TS6BM.cjs.map} +1 -1
- package/dist/registry-PPFMCM4A.js +9 -0
- package/dist/{registry-AXQXPLFH.js.map → registry-PPFMCM4A.js.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-XXnwwGOT.d.ts → run-C8FBAC8o.d.cts} +21 -2
- package/dist/{run-XXnwwGOT.d.cts → run-C8FBAC8o.d.ts} +21 -2
- package/dist/{run-until-BK56WG4P.js → run-until-HEQOUVU6.js} +2 -2
- package/dist/run-until-HEQOUVU6.js.map +1 -0
- package/dist/{run-until-L5KQD3PV.cjs → run-until-U2B5FJJI.cjs} +2 -2
- package/dist/run-until-U2B5FJJI.cjs.map +1 -0
- package/dist/sandbox/bwrap.d.cts +15 -1
- package/dist/sandbox/bwrap.d.ts +15 -1
- package/dist/sandbox/index.cjs +39 -24
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +24 -10
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/provision.d.cts +1 -1
- package/dist/sandbox/provision.d.ts +1 -1
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.d.cts +3 -3
- package/dist/server/errors-envelope.d.ts +3 -3
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-7FWTO4BK.js +5 -0
- package/dist/{session-transcript-X3UMSVL2.js.map → session-transcript-7FWTO4BK.js.map} +1 -1
- package/dist/session-transcript-FYRKWRWV.cjs +50 -0
- package/dist/{session-transcript-SLQRKQ72.cjs.map → session-transcript-FYRKWRWV.cjs.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-3R3HZPQN.cjs +20 -0
- package/dist/{stream-object-3HEUGMQY.cjs.map → stream-object-3R3HZPQN.cjs.map} +1 -1
- package/dist/stream-object-NPJXDZXO.js +7 -0
- package/dist/{stream-object-VWYW7FJ2.js.map → stream-object-NPJXDZXO.js.map} +1 -1
- package/dist/subagents-loader-5KQVYUNS.js +6 -0
- package/dist/{subagents-loader-QUIK6GMV.js.map → subagents-loader-5KQVYUNS.js.map} +1 -1
- package/dist/subagents-loader-FDXPBBRA.cjs +15 -0
- package/dist/{subagents-loader-F52ARQ62.cjs.map → subagents-loader-FDXPBBRA.cjs.map} +1 -1
- package/dist/subagents-loader.cjs +15 -15
- package/dist/subagents-loader.cjs.map +1 -1
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/subagents-loader.js +14 -14
- package/dist/subagents-loader.js.map +1 -1
- 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/types/run-events.d.ts +20 -1
- package/dist/types/session-record.d.ts +1 -1
- package/dist/types/usage.d.ts +1 -1
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/docs/error-codes.md +22 -0
- package/docs/harness-capability-map.md +22 -0
- package/package.json +1 -1
- package/dist/agent-MSR3DHO4.js +0 -46
- package/dist/agent-OOXJJD6A.cjs +0 -55
- package/dist/agent-session-store-EGTTYSKS.js +0 -6
- package/dist/agent-session-store-RHTLZ5OX.cjs +0 -23
- package/dist/chunk-23HI77BZ.js.map +0 -1
- package/dist/chunk-33B2BSME.cjs.map +0 -1
- package/dist/chunk-5KOW3GLE.js.map +0 -1
- package/dist/chunk-5XPKYDK7.js.map +0 -1
- package/dist/chunk-7GFX45DD.js.map +0 -1
- package/dist/chunk-AKMPQJPX.js.map +0 -1
- package/dist/chunk-BURYFNOM.cjs.map +0 -1
- package/dist/chunk-BVGJXMSB.cjs.map +0 -1
- package/dist/chunk-EYUZZXHZ.js.map +0 -1
- package/dist/chunk-KRPEPZQY.js.map +0 -1
- package/dist/chunk-LNTQRD23.cjs.map +0 -1
- package/dist/chunk-N4JNY5DT.cjs.map +0 -1
- package/dist/chunk-NJVV5OAV.cjs.map +0 -1
- package/dist/chunk-ONVIALVV.js.map +0 -1
- package/dist/chunk-QMIG7TKG.cjs.map +0 -1
- package/dist/chunk-RNCN2TTP.js.map +0 -1
- package/dist/chunk-SEWAPWAF.cjs.map +0 -1
- package/dist/chunk-T6KFGMNY.cjs.map +0 -1
- package/dist/chunk-UIPTINIF.js.map +0 -1
- package/dist/chunk-V7CA3CX5.cjs.map +0 -1
- package/dist/chunk-WPZTYOUX.cjs.map +0 -1
- package/dist/chunk-X627TO3A.js.map +0 -1
- package/dist/chunk-ZRQZOJ3N.js.map +0 -1
- package/dist/compact-session-AZU2LEAE.js +0 -18
- package/dist/compact-session-TRCEYCPG.cjs +0 -55
- package/dist/context-DNFT4B5D.cjs +0 -22
- package/dist/context-LYE6TJL5.js +0 -5
- package/dist/fs-session-store-I6GUIFRO.js +0 -10
- package/dist/fs-session-store-KRZZIG3O.cjs +0 -19
- package/dist/generate-object-DLHT5RXH.js +0 -7
- package/dist/generate-object-QILSGTEJ.cjs +0 -20
- package/dist/index-manager-LEMQ73A7.cjs +0 -20
- package/dist/index-manager-SXF3FAQV.js +0 -11
- package/dist/judge-call-AIT3EULV.cjs +0 -22
- package/dist/judge-call-NPRU7JIQ.js +0 -5
- package/dist/registry-AXQXPLFH.js +0 -9
- package/dist/registry-VKDFTK6L.cjs +0 -46
- package/dist/run-until-BK56WG4P.js.map +0 -1
- package/dist/run-until-L5KQD3PV.cjs.map +0 -1
- package/dist/session-transcript-SLQRKQ72.cjs +0 -50
- package/dist/session-transcript-X3UMSVL2.js +0 -5
- package/dist/stream-object-3HEUGMQY.cjs +0 -20
- package/dist/stream-object-VWYW7FJ2.js +0 -7
- package/dist/subagents-loader-F52ARQ62.cjs +0 -15
- package/dist/subagents-loader-QUIK6GMV.js +0 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkHLNLYLNN_cjs = require('./chunk-HLNLYLNN.cjs');
|
|
4
|
+
var chunk4JBHSLQO_cjs = require('./chunk-4JBHSLQO.cjs');
|
|
5
|
+
var chunkS4Q5OMIK_cjs = require('./chunk-S4Q5OMIK.cjs');
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
7
|
+
var chunkWCXOKGOQ_cjs = require('./chunk-WCXOKGOQ.cjs');
|
|
8
|
+
var chunkNNNUQELM_cjs = require('./chunk-NNNUQELM.cjs');
|
|
9
|
+
var chunkGLEKLAUW_cjs = require('./chunk-GLEKLAUW.cjs');
|
|
10
|
+
var chunkYULF6FPB_cjs = require('./chunk-YULF6FPB.cjs');
|
|
11
|
+
var chunkZHPET3LZ_cjs = require('./chunk-ZHPET3LZ.cjs');
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var promises = require('fs/promises');
|
|
14
14
|
var os = require('os');
|
|
@@ -17,7 +17,7 @@ var url = require('url');
|
|
|
17
17
|
var module$1 = require('module');
|
|
18
18
|
|
|
19
19
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
20
|
-
var discoveryState =
|
|
20
|
+
var discoveryState = chunkGLEKLAUW_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
21
21
|
done: false
|
|
22
22
|
}));
|
|
23
23
|
function pluginsRoot() {
|
|
@@ -39,19 +39,19 @@ function loadTrustedNames() {
|
|
|
39
39
|
else discarded += 1;
|
|
40
40
|
}
|
|
41
41
|
if (discarded > 0) {
|
|
42
|
-
|
|
42
|
+
chunkZHPET3LZ_cjs.diag(
|
|
43
43
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
44
44
|
`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
} else {
|
|
48
|
-
|
|
48
|
+
chunkZHPET3LZ_cjs.diag(
|
|
49
49
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
50
50
|
`
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
} catch {
|
|
54
|
-
|
|
54
|
+
chunkZHPET3LZ_cjs.diag(
|
|
55
55
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
56
56
|
`
|
|
57
57
|
);
|
|
@@ -77,7 +77,7 @@ async function discoverProviderPlugins() {
|
|
|
77
77
|
const trusted = loadTrustedNames();
|
|
78
78
|
for (const entry of entries) {
|
|
79
79
|
if (!trusted.has(entry)) {
|
|
80
|
-
|
|
80
|
+
chunkZHPET3LZ_cjs.diag(
|
|
81
81
|
`[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
82
|
`
|
|
83
83
|
);
|
|
@@ -96,13 +96,13 @@ async function loadOne(dir, entryName) {
|
|
|
96
96
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
97
97
|
const profile = plugin.profile;
|
|
98
98
|
if (profile !== void 0 && typeof profile === "object") {
|
|
99
|
-
|
|
99
|
+
chunkGLEKLAUW_cjs.registerProvider(profile);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return;
|
|
103
103
|
} catch (err) {
|
|
104
104
|
const msg = err instanceof Error ? err.message : String(err);
|
|
105
|
-
|
|
105
|
+
chunkZHPET3LZ_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
106
106
|
`);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
@@ -114,7 +114,7 @@ function mapAnthropicError(args) {
|
|
|
114
114
|
const { status, body, headers, endpoint } = args;
|
|
115
115
|
const code = mapAnthropicStatusToCode(status, body);
|
|
116
116
|
const message = formatMessage(status, code);
|
|
117
|
-
const metadata =
|
|
117
|
+
const metadata = chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
118
118
|
provider: "anthropic",
|
|
119
119
|
endpoint,
|
|
120
120
|
code,
|
|
@@ -123,24 +123,24 @@ function mapAnthropicError(args) {
|
|
|
123
123
|
body
|
|
124
124
|
});
|
|
125
125
|
if (status === 401 || status === 403) {
|
|
126
|
-
return new
|
|
126
|
+
return new chunkYULF6FPB_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
127
127
|
}
|
|
128
128
|
if (status === 429) {
|
|
129
|
-
return new
|
|
129
|
+
return new chunkYULF6FPB_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
130
130
|
}
|
|
131
131
|
if (status === 400) {
|
|
132
|
-
return new
|
|
132
|
+
return new chunkYULF6FPB_cjs.ConfigurationError(message, {
|
|
133
133
|
code: `anthropic_${code}`,
|
|
134
134
|
metadata
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
if (status === 408) {
|
|
138
|
-
return new
|
|
138
|
+
return new chunkYULF6FPB_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
139
139
|
}
|
|
140
140
|
if (status >= 500 && status < 600) {
|
|
141
|
-
return new
|
|
141
|
+
return new chunkYULF6FPB_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
142
142
|
}
|
|
143
|
-
return new
|
|
143
|
+
return new chunkYULF6FPB_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
144
144
|
}
|
|
145
145
|
function mapAnthropicStatusToCode(status, body) {
|
|
146
146
|
if (status === 401 || status === 403) return "auth_failed";
|
|
@@ -211,7 +211,7 @@ function toBlockToolResultContent(content) {
|
|
|
211
211
|
function toStringToolResultContent(content, providerName) {
|
|
212
212
|
if (typeof content === "string") return content;
|
|
213
213
|
if (content.some((block) => block.type === "image")) {
|
|
214
|
-
throw new
|
|
214
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
215
215
|
`provider "${providerName}" does not support image content in tool results`
|
|
216
216
|
);
|
|
217
217
|
}
|
|
@@ -390,7 +390,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
390
390
|
(resolve, reject) => {
|
|
391
391
|
const timer = setTimeout(() => {
|
|
392
392
|
reject(
|
|
393
|
-
new
|
|
393
|
+
new chunkYULF6FPB_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
394
394
|
code: "stream_idle_timeout"
|
|
395
395
|
})
|
|
396
396
|
);
|
|
@@ -467,9 +467,9 @@ function ehAbort(err) {
|
|
|
467
467
|
}
|
|
468
468
|
function wrapTransportError(err, ctx) {
|
|
469
469
|
if (ehAbort(err)) return err;
|
|
470
|
-
if (err instanceof
|
|
471
|
-
const
|
|
472
|
-
return new
|
|
470
|
+
if (err instanceof chunkYULF6FPB_cjs.NetworkError) return err;
|
|
471
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
472
|
+
return new chunkYULF6FPB_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
|
|
473
473
|
code: "transport_failure",
|
|
474
474
|
cause: err
|
|
475
475
|
});
|
|
@@ -533,7 +533,7 @@ var AnthropicClient = class {
|
|
|
533
533
|
for (const event of events) yield event;
|
|
534
534
|
}
|
|
535
535
|
if (!accumulator.finishReasonSeen) {
|
|
536
|
-
throw new
|
|
536
|
+
throw new chunkYULF6FPB_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
537
537
|
code: "stream_truncated"
|
|
538
538
|
});
|
|
539
539
|
}
|
|
@@ -686,7 +686,7 @@ function classifyBedrockError(args, awsType, message) {
|
|
|
686
686
|
return "unknown";
|
|
687
687
|
}
|
|
688
688
|
function buildBedrockMetadata(args, code) {
|
|
689
|
-
return
|
|
689
|
+
return chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
690
690
|
provider: "bedrock",
|
|
691
691
|
endpoint: args.endpoint,
|
|
692
692
|
code,
|
|
@@ -703,19 +703,19 @@ function mapBedrockError(args) {
|
|
|
703
703
|
const metadata = buildBedrockMetadata(args, code);
|
|
704
704
|
switch (code) {
|
|
705
705
|
case "rate_limit":
|
|
706
|
-
return new
|
|
706
|
+
return new chunkYULF6FPB_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
707
707
|
case "auth_failed":
|
|
708
|
-
return new
|
|
708
|
+
return new chunkYULF6FPB_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
709
709
|
case "invalid_request": {
|
|
710
710
|
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
|
|
711
|
+
return new chunkYULF6FPB_cjs.ConfigurationError(friendly, { metadata });
|
|
712
712
|
}
|
|
713
713
|
case "timeout":
|
|
714
|
-
return new
|
|
714
|
+
return new chunkYULF6FPB_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
715
715
|
case "server_error":
|
|
716
|
-
return new
|
|
716
|
+
return new chunkYULF6FPB_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
717
717
|
default:
|
|
718
|
-
return new
|
|
718
|
+
return new chunkYULF6FPB_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
function parseBody(body) {
|
|
@@ -739,7 +739,7 @@ async function resolveBedrockToken(region) {
|
|
|
739
739
|
return cachedToken.value;
|
|
740
740
|
}
|
|
741
741
|
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-
|
|
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-FMIKUGF2.cjs', document.baseURI).href)));
|
|
743
743
|
const gen = r("@aws/bedrock-token-generator");
|
|
744
744
|
if (typeof gen.getToken !== "function") return void 0;
|
|
745
745
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -767,16 +767,16 @@ var BedrockAnthropicClient = class {
|
|
|
767
767
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
768
768
|
const fromEnv = await resolveBedrockToken(region);
|
|
769
769
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
770
|
-
throw new
|
|
770
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
771
771
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
772
772
|
{ code: "auth_failed" }
|
|
773
773
|
);
|
|
774
774
|
}
|
|
775
775
|
async *stream(request, signal) {
|
|
776
|
-
const region =
|
|
776
|
+
const region = chunkGLEKLAUW_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
777
777
|
const token = await this.resolveTokenOrThrow(region);
|
|
778
|
-
const bareModel =
|
|
779
|
-
const baseUrl = this.options.baseUrl ??
|
|
778
|
+
const bareModel = chunkGLEKLAUW_cjs.stripBedrockPrefix(request.model);
|
|
779
|
+
const baseUrl = this.options.baseUrl ?? chunkGLEKLAUW_cjs.resolveBedrockBaseUrl(request.model);
|
|
780
780
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
781
781
|
const url = `${baseUrl}${endpoint}`;
|
|
782
782
|
const response = await postAnthropicRequest({
|
|
@@ -831,7 +831,7 @@ var FaultInjectingLlmClient = class {
|
|
|
831
831
|
return yield* this.inner.stream(request, signal);
|
|
832
832
|
}
|
|
833
833
|
if (parsed.status >= 400) {
|
|
834
|
-
throw
|
|
834
|
+
throw chunkS4Q5OMIK_cjs.mapOpenAICompatibleError({
|
|
835
835
|
providerId: this.name,
|
|
836
836
|
status: parsed.status,
|
|
837
837
|
body: parsed.body,
|
|
@@ -878,7 +878,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
878
878
|
function warnInvalidJsonOnce(_raw) {
|
|
879
879
|
if (warnedInvalidJson) return;
|
|
880
880
|
warnedInvalidJson = true;
|
|
881
|
-
|
|
881
|
+
chunkZHPET3LZ_cjs.diag(
|
|
882
882
|
`[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
883
|
`
|
|
884
884
|
);
|
|
@@ -906,7 +906,7 @@ function mapOllamaTransportError(args) {
|
|
|
906
906
|
if (args.providerId !== "ollama") return void 0;
|
|
907
907
|
const causeCode = extractCauseCode(args.cause);
|
|
908
908
|
if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
|
|
909
|
-
const metadata =
|
|
909
|
+
const metadata = chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
910
910
|
provider: "ollama",
|
|
911
911
|
endpoint: args.endpoint,
|
|
912
912
|
code: "network",
|
|
@@ -914,7 +914,7 @@ function mapOllamaTransportError(args) {
|
|
|
914
914
|
headers: void 0,
|
|
915
915
|
body: { cause: causeCode }
|
|
916
916
|
});
|
|
917
|
-
return new
|
|
917
|
+
return new chunkYULF6FPB_cjs.ConfigurationError(
|
|
918
918
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
919
919
|
{ code: "ollama_unreachable", metadata }
|
|
920
920
|
);
|
|
@@ -924,7 +924,7 @@ function mapOllamaHttpError(args) {
|
|
|
924
924
|
const errString = extractErrorString(args.body).toLowerCase();
|
|
925
925
|
if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
|
|
926
926
|
const modelHint = extractModelName(errString);
|
|
927
|
-
const metadata =
|
|
927
|
+
const metadata = chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
928
928
|
provider: "ollama",
|
|
929
929
|
endpoint: args.endpoint,
|
|
930
930
|
code: "model_unavailable",
|
|
@@ -933,13 +933,13 @@ function mapOllamaHttpError(args) {
|
|
|
933
933
|
body: args.body
|
|
934
934
|
});
|
|
935
935
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
936
|
-
return new
|
|
936
|
+
return new chunkYULF6FPB_cjs.ConfigurationError(
|
|
937
937
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
938
938
|
{ code: "ollama_model_not_pulled", metadata }
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
941
|
if (args.status === 503 && errString.includes("model is loading")) {
|
|
942
|
-
const metadata =
|
|
942
|
+
const metadata = chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
943
943
|
provider: "ollama",
|
|
944
944
|
endpoint: args.endpoint,
|
|
945
945
|
code: "server_error",
|
|
@@ -947,7 +947,7 @@ function mapOllamaHttpError(args) {
|
|
|
947
947
|
headers: args.headers,
|
|
948
948
|
body: args.body
|
|
949
949
|
});
|
|
950
|
-
return new
|
|
950
|
+
return new chunkYULF6FPB_cjs.NetworkError(
|
|
951
951
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
952
952
|
{ code: "ollama_model_loading", metadata }
|
|
953
953
|
);
|
|
@@ -1168,7 +1168,7 @@ function toOllamaMessages(message) {
|
|
|
1168
1168
|
}
|
|
1169
1169
|
if (message.role === "user") {
|
|
1170
1170
|
if (message.content.some((p) => p.type === "image")) {
|
|
1171
|
-
throw new
|
|
1171
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
1172
1172
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1173
1173
|
{ code: "ollama_image_unsupported" }
|
|
1174
1174
|
);
|
|
@@ -1297,7 +1297,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1297
1297
|
try {
|
|
1298
1298
|
return await fetchFn(url, init);
|
|
1299
1299
|
} catch (cause) {
|
|
1300
|
-
throw new
|
|
1300
|
+
throw new chunkYULF6FPB_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
1303
|
async function safeParseJsonResponse(response) {
|
|
@@ -1324,7 +1324,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1324
1324
|
cause: body
|
|
1325
1325
|
};
|
|
1326
1326
|
if (envelope.code === "integration_not_connected") {
|
|
1327
|
-
return new
|
|
1327
|
+
return new chunkYULF6FPB_cjs.IntegrationNotConnectedError(message, {
|
|
1328
1328
|
provider: envelope.provider ?? "unknown",
|
|
1329
1329
|
helpUrl: envelope.helpUrl ?? "",
|
|
1330
1330
|
code: envelope.code,
|
|
@@ -1332,18 +1332,18 @@ function mapHttpStatusToError(status, body) {
|
|
|
1332
1332
|
});
|
|
1333
1333
|
}
|
|
1334
1334
|
if (status === 401 || status === 403) {
|
|
1335
|
-
return new
|
|
1335
|
+
return new chunkYULF6FPB_cjs.AuthenticationError(message, errorOptions);
|
|
1336
1336
|
}
|
|
1337
1337
|
if (status === 429) {
|
|
1338
|
-
return new
|
|
1338
|
+
return new chunkYULF6FPB_cjs.RateLimitError(message, errorOptions);
|
|
1339
1339
|
}
|
|
1340
1340
|
if (status >= 400 && status < 500) {
|
|
1341
|
-
return new
|
|
1341
|
+
return new chunkYULF6FPB_cjs.ConfigurationError(message, errorOptions);
|
|
1342
1342
|
}
|
|
1343
1343
|
if (status >= 500) {
|
|
1344
|
-
return new
|
|
1344
|
+
return new chunkYULF6FPB_cjs.NetworkError(message, errorOptions);
|
|
1345
1345
|
}
|
|
1346
|
-
return new
|
|
1346
|
+
return new chunkYULF6FPB_cjs.UnknownAgentError(message, errorOptions);
|
|
1347
1347
|
}
|
|
1348
1348
|
function extractErrorEnvelope(body) {
|
|
1349
1349
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1597,7 +1597,7 @@ var OpenAIClient = class {
|
|
|
1597
1597
|
endpoint: "/v1/chat/completions"
|
|
1598
1598
|
});
|
|
1599
1599
|
if (ollamaMapped !== void 0) throw ollamaMapped;
|
|
1600
|
-
throw
|
|
1600
|
+
throw chunkS4Q5OMIK_cjs.mapOpenAICompatibleError({
|
|
1601
1601
|
providerId,
|
|
1602
1602
|
status: response.status,
|
|
1603
1603
|
body,
|
|
@@ -1626,7 +1626,7 @@ var OpenAIClient = class {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
1628
1628
|
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
1629
|
-
throw
|
|
1629
|
+
throw chunkS4Q5OMIK_cjs.mapOpenAICompatibleError({
|
|
1630
1630
|
providerId,
|
|
1631
1631
|
status,
|
|
1632
1632
|
body: chunk,
|
|
@@ -1638,7 +1638,7 @@ var OpenAIClient = class {
|
|
|
1638
1638
|
for (const event of events) yield event;
|
|
1639
1639
|
}
|
|
1640
1640
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1641
|
-
throw new
|
|
1641
|
+
throw new chunkYULF6FPB_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1642
1642
|
code: "stream_truncated"
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
@@ -1770,13 +1770,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1770
1770
|
toolCalls.push(...recovered.toolCalls);
|
|
1771
1771
|
text = recovered.residualText;
|
|
1772
1772
|
stopReason = "tool_use";
|
|
1773
|
-
|
|
1773
|
+
chunkZHPET3LZ_cjs.diag(
|
|
1774
1774
|
`[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
1775
|
`
|
|
1776
1776
|
);
|
|
1777
1777
|
}
|
|
1778
1778
|
if (recovered.droppedNames.length > 0) {
|
|
1779
|
-
|
|
1779
|
+
chunkZHPET3LZ_cjs.diag(
|
|
1780
1780
|
`[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
1781
|
`
|
|
1782
1782
|
);
|
|
@@ -1898,10 +1898,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
1898
1898
|
const firstResult = await generator.next();
|
|
1899
1899
|
return { kind: "ok", generator, firstResult };
|
|
1900
1900
|
} catch (cause) {
|
|
1901
|
-
if (cause instanceof
|
|
1901
|
+
if (cause instanceof chunkYULF6FPB_cjs.NetworkError || cause instanceof chunkYULF6FPB_cjs.RateLimitError || cause instanceof chunkYULF6FPB_cjs.AuthenticationError) {
|
|
1902
1902
|
if (logFallback) {
|
|
1903
1903
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
1904
|
-
|
|
1904
|
+
chunkZHPET3LZ_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
1905
1905
|
`);
|
|
1906
1906
|
}
|
|
1907
1907
|
return { kind: "handshake_error", error: cause };
|
|
@@ -1943,7 +1943,7 @@ var PoolAwareLlmClient = class {
|
|
|
1943
1943
|
// 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
1944
|
async *stream(request, signal) {
|
|
1945
1945
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
1946
|
-
throw new
|
|
1946
|
+
throw new chunkYULF6FPB_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
1947
1947
|
code: "circuit_open"
|
|
1948
1948
|
});
|
|
1949
1949
|
}
|
|
@@ -1962,7 +1962,7 @@ var PoolAwareLlmClient = class {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
if (entry === null) {
|
|
1964
1964
|
this.breaker.recordTimeout(this.pool.provider);
|
|
1965
|
-
throw new
|
|
1965
|
+
throw new chunkYULF6FPB_cjs.CredentialPoolExhaustedError(
|
|
1966
1966
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
1967
1967
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
1968
1968
|
);
|
|
@@ -1976,13 +1976,13 @@ var PoolAwareLlmClient = class {
|
|
|
1976
1976
|
}
|
|
1977
1977
|
const decision = classifyAndDecide(attempt.error, hasRetried429);
|
|
1978
1978
|
if (decision === "retry") {
|
|
1979
|
-
const backoffMs =
|
|
1979
|
+
const backoffMs = chunkHLNLYLNN_cjs.computeBackoffMs({
|
|
1980
1980
|
attempt: 0,
|
|
1981
1981
|
...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
|
|
1982
1982
|
...this.rng !== void 0 ? { rng: this.rng } : {}
|
|
1983
1983
|
});
|
|
1984
1984
|
this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
|
|
1985
|
-
await
|
|
1985
|
+
await chunkHLNLYLNN_cjs.sleepWithAbort(backoffMs, signal);
|
|
1986
1986
|
hasRetried429 = true;
|
|
1987
1987
|
continue;
|
|
1988
1988
|
}
|
|
@@ -1994,7 +1994,7 @@ var PoolAwareLlmClient = class {
|
|
|
1994
1994
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
1995
1995
|
});
|
|
1996
1996
|
} catch (persistErr) {
|
|
1997
|
-
|
|
1997
|
+
chunkZHPET3LZ_cjs.diag(
|
|
1998
1998
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
1999
1999
|
`
|
|
2000
2000
|
);
|
|
@@ -2016,8 +2016,8 @@ var PoolAwareLlmClient = class {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
};
|
|
2018
2018
|
function classifyAndDecide(error, hasRetried429) {
|
|
2019
|
-
if (error instanceof
|
|
2020
|
-
if (error instanceof
|
|
2019
|
+
if (error instanceof chunkYULF6FPB_cjs.NetworkError) return "propagate";
|
|
2020
|
+
if (error instanceof chunkYULF6FPB_cjs.AuthenticationError) return "rotate";
|
|
2021
2021
|
const status = error.metadata?.statusCode ?? 429;
|
|
2022
2022
|
if (status === 402) return "rotate";
|
|
2023
2023
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2030,8 +2030,8 @@ function parseRetryAfterMs(error) {
|
|
|
2030
2030
|
return void 0;
|
|
2031
2031
|
}
|
|
2032
2032
|
function inferStatusCode(error) {
|
|
2033
|
-
if (error instanceof
|
|
2034
|
-
if (error instanceof
|
|
2033
|
+
if (error instanceof chunkYULF6FPB_cjs.AuthenticationError) return 401;
|
|
2034
|
+
if (error instanceof chunkYULF6FPB_cjs.RateLimitError) return 429;
|
|
2035
2035
|
return 0;
|
|
2036
2036
|
}
|
|
2037
2037
|
function abortError(signal) {
|
|
@@ -2139,7 +2139,7 @@ var ResponsesApiClient = class {
|
|
|
2139
2139
|
body = JSON.parse(text2);
|
|
2140
2140
|
} catch {
|
|
2141
2141
|
}
|
|
2142
|
-
throw
|
|
2142
|
+
throw chunkS4Q5OMIK_cjs.mapOpenAICompatibleError({
|
|
2143
2143
|
providerId,
|
|
2144
2144
|
status: response.status,
|
|
2145
2145
|
body,
|
|
@@ -2210,7 +2210,7 @@ var ResponsesApiClient = class {
|
|
|
2210
2210
|
} else if (t === "response.failed" || t === "error") {
|
|
2211
2211
|
const msg = event.response?.error?.message ?? event.message ?? "responses stream failed";
|
|
2212
2212
|
yield { type: "error", message: msg };
|
|
2213
|
-
throw
|
|
2213
|
+
throw chunkS4Q5OMIK_cjs.mapOpenAICompatibleError({
|
|
2214
2214
|
providerId,
|
|
2215
2215
|
status: 502,
|
|
2216
2216
|
body: { error: { message: msg } },
|
|
@@ -2241,14 +2241,14 @@ function abortError2(signal) {
|
|
|
2241
2241
|
// src/internal/llm/retrying-client.ts
|
|
2242
2242
|
var MAX_ATTEMPTS = 3;
|
|
2243
2243
|
function isRetriableError(err) {
|
|
2244
|
-
if (!
|
|
2245
|
-
if (err instanceof
|
|
2246
|
-
if (err instanceof
|
|
2247
|
-
if (err instanceof
|
|
2244
|
+
if (!chunkYULF6FPB_cjs.isTransientError(err)) return false;
|
|
2245
|
+
if (err instanceof chunkYULF6FPB_cjs.CredentialPoolExhaustedError) return false;
|
|
2246
|
+
if (err instanceof chunkYULF6FPB_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2247
|
+
if (err instanceof chunkYULF6FPB_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2248
2248
|
return true;
|
|
2249
2249
|
}
|
|
2250
2250
|
function retryAfterHintMs(err) {
|
|
2251
|
-
if (!(err instanceof
|
|
2251
|
+
if (!(err instanceof chunkYULF6FPB_cjs.RateLimitError)) return void 0;
|
|
2252
2252
|
const seconds = err.metadata?.retryAfter;
|
|
2253
2253
|
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2254
2254
|
}
|
|
@@ -2294,16 +2294,16 @@ var RetryingLlmClient = class {
|
|
|
2294
2294
|
*/
|
|
2295
2295
|
async #waitBackoff(err, attempt, signal) {
|
|
2296
2296
|
const hint = retryAfterHintMs(err);
|
|
2297
|
-
const ms =
|
|
2297
|
+
const ms = chunkHLNLYLNN_cjs.computeBackoffMs({
|
|
2298
2298
|
attempt,
|
|
2299
2299
|
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2300
2300
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2301
2301
|
});
|
|
2302
2302
|
const cause = err instanceof Error ? err.name : typeof err;
|
|
2303
|
-
|
|
2303
|
+
chunkZHPET3LZ_cjs.diag(
|
|
2304
2304
|
`retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
|
|
2305
2305
|
);
|
|
2306
|
-
await
|
|
2306
|
+
await chunkHLNLYLNN_cjs.sleepWithAbort(ms, signal);
|
|
2307
2307
|
}
|
|
2308
2308
|
async *stream(request, signal) {
|
|
2309
2309
|
let lastError;
|
|
@@ -2341,7 +2341,7 @@ function classifyVertexError(args, errStatus) {
|
|
|
2341
2341
|
return "unknown";
|
|
2342
2342
|
}
|
|
2343
2343
|
function vertexMetadata(args, code) {
|
|
2344
|
-
return
|
|
2344
|
+
return chunkS4Q5OMIK_cjs.buildErrorMetadata({
|
|
2345
2345
|
provider: "vertex",
|
|
2346
2346
|
endpoint: args.endpoint,
|
|
2347
2347
|
code,
|
|
@@ -2351,23 +2351,23 @@ function vertexMetadata(args, code) {
|
|
|
2351
2351
|
});
|
|
2352
2352
|
}
|
|
2353
2353
|
var VERTEX_ERROR_BUILDERS = {
|
|
2354
|
-
rate_limit: (args, msg) => new
|
|
2354
|
+
rate_limit: (args, msg) => new chunkYULF6FPB_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2355
2355
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2356
2356
|
}),
|
|
2357
|
-
auth_unauthenticated: (args, msg) => new
|
|
2357
|
+
auth_unauthenticated: (args, msg) => new chunkYULF6FPB_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2358
2358
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2359
2359
|
}),
|
|
2360
|
-
auth_permission: (args, msg) => new
|
|
2360
|
+
auth_permission: (args, msg) => new chunkYULF6FPB_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2361
2361
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2362
2362
|
}),
|
|
2363
|
-
invalid_request: (args, msg) => new
|
|
2363
|
+
invalid_request: (args, msg) => new chunkYULF6FPB_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2364
2364
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2365
2365
|
}),
|
|
2366
|
-
timeout: (args, msg) => new
|
|
2367
|
-
server_error: (args, msg) => new
|
|
2366
|
+
timeout: (args, msg) => new chunkYULF6FPB_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2367
|
+
server_error: (args, msg) => new chunkYULF6FPB_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2368
2368
|
metadata: vertexMetadata(args, "server_error")
|
|
2369
2369
|
}),
|
|
2370
|
-
unknown: (args, msg) => new
|
|
2370
|
+
unknown: (args, msg) => new chunkYULF6FPB_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2371
2371
|
};
|
|
2372
2372
|
function mapVertexError(args) {
|
|
2373
2373
|
const parsed = parseBody2(args.body);
|
|
@@ -2403,12 +2403,12 @@ async function resolveVertexAccessToken() {
|
|
|
2403
2403
|
async function getAuthClientOrThrow() {
|
|
2404
2404
|
let mod;
|
|
2405
2405
|
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-
|
|
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-FMIKUGF2.cjs', document.baseURI).href)));
|
|
2407
2407
|
mod = r("google-auth-library");
|
|
2408
2408
|
} catch (err) {
|
|
2409
2409
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2410
2410
|
if (isModuleMissing) {
|
|
2411
|
-
throw new
|
|
2411
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2412
2412
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2413
2413
|
{ code: "auth_failed", cause: err }
|
|
2414
2414
|
);
|
|
@@ -2419,7 +2419,7 @@ async function getAuthClientOrThrow() {
|
|
|
2419
2419
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2420
2420
|
return await auth.getClient();
|
|
2421
2421
|
} catch (err) {
|
|
2422
|
-
|
|
2422
|
+
chunkZHPET3LZ_cjs.diag(
|
|
2423
2423
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2424
2424
|
`
|
|
2425
2425
|
);
|
|
@@ -2445,7 +2445,7 @@ var VertexAnthropicClient = class {
|
|
|
2445
2445
|
resolveProjectOrThrow() {
|
|
2446
2446
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2447
2447
|
if (projectId !== void 0) return projectId;
|
|
2448
|
-
throw new
|
|
2448
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2449
2449
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2450
2450
|
{ code: "auth_failed" }
|
|
2451
2451
|
);
|
|
@@ -2455,7 +2455,7 @@ var VertexAnthropicClient = class {
|
|
|
2455
2455
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2456
2456
|
const fromAdc = await resolveVertexAccessToken();
|
|
2457
2457
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2458
|
-
throw new
|
|
2458
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2459
2459
|
"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
2460
|
{ code: "auth_failed" }
|
|
2461
2461
|
);
|
|
@@ -2464,8 +2464,8 @@ var VertexAnthropicClient = class {
|
|
|
2464
2464
|
const projectId = this.resolveProjectOrThrow();
|
|
2465
2465
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2466
2466
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2467
|
-
const baseUrl =
|
|
2468
|
-
const bareModel =
|
|
2467
|
+
const baseUrl = chunkGLEKLAUW_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2468
|
+
const bareModel = chunkGLEKLAUW_cjs.stripVertexPrefix(request.model);
|
|
2469
2469
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2470
2470
|
const url = `${baseUrl}${endpoint}`;
|
|
2471
2471
|
const response = await postAnthropicRequest({
|
|
@@ -2501,7 +2501,7 @@ var VertexGeminiClient = class {
|
|
|
2501
2501
|
async *stream(request, signal) {
|
|
2502
2502
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2503
2503
|
if (projectId === void 0) {
|
|
2504
|
-
throw new
|
|
2504
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2505
2505
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2506
2506
|
{ code: "auth_failed" }
|
|
2507
2507
|
);
|
|
@@ -2509,12 +2509,12 @@ var VertexGeminiClient = class {
|
|
|
2509
2509
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2510
2510
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2511
2511
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2512
|
-
throw new
|
|
2512
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2513
2513
|
"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
2514
|
{ code: "auth_failed" }
|
|
2515
2515
|
);
|
|
2516
2516
|
}
|
|
2517
|
-
const baseUrl =
|
|
2517
|
+
const baseUrl = chunkGLEKLAUW_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2518
2518
|
const url = `${baseUrl}/chat/completions`;
|
|
2519
2519
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2520
2520
|
const rewriteFetch = (input, init) => {
|
|
@@ -2540,7 +2540,7 @@ var VertexRouterClient = class {
|
|
|
2540
2540
|
options;
|
|
2541
2541
|
name = "vertex";
|
|
2542
2542
|
async *stream(request, signal) {
|
|
2543
|
-
const dialect =
|
|
2543
|
+
const dialect = chunkGLEKLAUW_cjs.inferModelDialect(request.model);
|
|
2544
2544
|
if (dialect === "anthropic") {
|
|
2545
2545
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2546
2546
|
return yield* inner2.stream(request, signal);
|
|
@@ -2552,7 +2552,7 @@ var VertexRouterClient = class {
|
|
|
2552
2552
|
|
|
2553
2553
|
// src/internal/llm/router.ts
|
|
2554
2554
|
function resolveProviderChain(options) {
|
|
2555
|
-
|
|
2555
|
+
chunkGLEKLAUW_cjs.registerBuiltins();
|
|
2556
2556
|
return buildChain(options);
|
|
2557
2557
|
}
|
|
2558
2558
|
function buildChain(options) {
|
|
@@ -2569,7 +2569,7 @@ function buildChain(options) {
|
|
|
2569
2569
|
addClient(options.primary);
|
|
2570
2570
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2571
2571
|
if (clients.length === 0) {
|
|
2572
|
-
throw new
|
|
2572
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2573
2573
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2574
2574
|
{ code: "provider_unresolved" }
|
|
2575
2575
|
);
|
|
@@ -2577,11 +2577,11 @@ function buildChain(options) {
|
|
|
2577
2577
|
return clients;
|
|
2578
2578
|
}
|
|
2579
2579
|
function buildClient(name, routerOptions) {
|
|
2580
|
-
const baseProfile =
|
|
2580
|
+
const baseProfile = chunkGLEKLAUW_cjs.getProviderProfile(name);
|
|
2581
2581
|
if (baseProfile === void 0) return void 0;
|
|
2582
2582
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2583
2583
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2584
|
-
const ambient =
|
|
2584
|
+
const ambient = chunkHLNLYLNN_cjs.currentCredentialPool(name);
|
|
2585
2585
|
if (ambient !== void 0) {
|
|
2586
2586
|
return new RetryingLlmClient(
|
|
2587
2587
|
new PoolAwareLlmClient(
|
|
@@ -2611,9 +2611,9 @@ function buildPoolOrSingle(args) {
|
|
|
2611
2611
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2612
2612
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2613
2613
|
const entries = poolKeys.map(
|
|
2614
|
-
(accessToken, priority) =>
|
|
2614
|
+
(accessToken, priority) => chunkHLNLYLNN_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2615
2615
|
);
|
|
2616
|
-
const pool = new
|
|
2616
|
+
const pool = new chunkHLNLYLNN_cjs.CredentialPool(name, entries, strategy);
|
|
2617
2617
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2618
2618
|
return new RetryingLlmClient(
|
|
2619
2619
|
new PoolAwareLlmClient(
|
|
@@ -2648,7 +2648,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2648
2648
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2649
2649
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2650
2650
|
warnedNoAuthApiKeys.add(provider);
|
|
2651
|
-
|
|
2651
|
+
chunkZHPET3LZ_cjs.diag(
|
|
2652
2652
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2653
2653
|
`
|
|
2654
2654
|
);
|
|
@@ -2674,10 +2674,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2674
2674
|
if (apiKeys === void 0) return;
|
|
2675
2675
|
for (const name of Object.keys(apiKeys)) {
|
|
2676
2676
|
if (warnedProviders.has(name)) continue;
|
|
2677
|
-
const profile =
|
|
2677
|
+
const profile = chunkGLEKLAUW_cjs.getProviderProfile(name);
|
|
2678
2678
|
if (profile === void 0) {
|
|
2679
2679
|
warnedProviders.add(name);
|
|
2680
|
-
|
|
2680
|
+
chunkZHPET3LZ_cjs.diag(
|
|
2681
2681
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2682
2682
|
`
|
|
2683
2683
|
);
|
|
@@ -2709,7 +2709,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2709
2709
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2710
2710
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2711
2711
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2712
|
-
throw new
|
|
2712
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2713
2713
|
`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
2714
|
);
|
|
2715
2715
|
}
|
|
@@ -2760,7 +2760,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2760
2760
|
providerName: profile.name
|
|
2761
2761
|
});
|
|
2762
2762
|
}
|
|
2763
|
-
throw new
|
|
2763
|
+
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
2764
2764
|
`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
2765
|
{ code: "transport_unavailable" }
|
|
2766
2766
|
);
|
|
@@ -2775,7 +2775,7 @@ function inferProviderFromApiKey(apiKey) {
|
|
|
2775
2775
|
{ provider: "openai", prefix: "sk-" }
|
|
2776
2776
|
];
|
|
2777
2777
|
for (const { provider, prefix } of byPrefix) {
|
|
2778
|
-
if (apiKey.startsWith(prefix) &&
|
|
2778
|
+
if (apiKey.startsWith(prefix) && chunkGLEKLAUW_cjs.getProviderProfile(provider) !== void 0) {
|
|
2779
2779
|
return provider;
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
@@ -2914,7 +2914,7 @@ function plainText(content) {
|
|
|
2914
2914
|
}
|
|
2915
2915
|
async function compactSessionTranscript(opts) {
|
|
2916
2916
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
2917
|
-
const history =
|
|
2917
|
+
const history = chunkWCXOKGOQ_cjs.reconstructMessages(prior);
|
|
2918
2918
|
const compressible = [];
|
|
2919
2919
|
for (const m of history) {
|
|
2920
2920
|
const text = plainText(m.content);
|
|
@@ -2922,14 +2922,14 @@ async function compactSessionTranscript(opts) {
|
|
|
2922
2922
|
compressible.push({ role: m.role, content: text });
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
2925
|
-
const preTokens =
|
|
2925
|
+
const preTokens = chunkNNNUQELM_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
2926
2926
|
const summaryBody = await opts.summarize(compressible);
|
|
2927
2927
|
const preserved = [];
|
|
2928
2928
|
let budget = 0;
|
|
2929
2929
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
2930
2930
|
const m = compressible[i];
|
|
2931
2931
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
2932
|
-
const cost =
|
|
2932
|
+
const cost = chunkNNNUQELM_cjs.estimateTokens(m.content);
|
|
2933
2933
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
2934
2934
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
2935
2935
|
if (remaining > 50) {
|
|
@@ -2943,7 +2943,7 @@ async function compactSessionTranscript(opts) {
|
|
|
2943
2943
|
}
|
|
2944
2944
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
2945
2945
|
${summaryBody}`;
|
|
2946
|
-
const transcript =
|
|
2946
|
+
const transcript = chunkWCXOKGOQ_cjs.SessionTranscript.fromRecords(prior, {
|
|
2947
2947
|
cwd: opts.loc.cwd,
|
|
2948
2948
|
sessionId: opts.sessionId,
|
|
2949
2949
|
model: opts.loc.model ?? "unknown"
|
|
@@ -2953,8 +2953,8 @@ ${summaryBody}`;
|
|
|
2953
2953
|
transcript.appendUserTurn(summary);
|
|
2954
2954
|
const delta = transcript.records().slice(prior.length);
|
|
2955
2955
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
2956
|
-
|
|
2957
|
-
const postTokens =
|
|
2956
|
+
chunk4JBHSLQO_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
2957
|
+
const postTokens = chunkNNNUQELM_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
2958
2958
|
return { preTokens, postTokens };
|
|
2959
2959
|
}
|
|
2960
2960
|
function resolveSummarizerRoute(opts) {
|
|
@@ -2963,9 +2963,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
2963
2963
|
}
|
|
2964
2964
|
function buildDefaultSummarizer(opts) {
|
|
2965
2965
|
return async (messages) => {
|
|
2966
|
-
|
|
2966
|
+
chunkGLEKLAUW_cjs.registerBuiltins();
|
|
2967
2967
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
2968
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
2968
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkGLEKLAUW_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
2969
2969
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
2970
2970
|
const route = resolveSummarizerRoute({
|
|
2971
2971
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3036,7 +3036,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3036
3036
|
return true;
|
|
3037
3037
|
} catch (cause) {
|
|
3038
3038
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3039
|
-
|
|
3039
|
+
chunkZHPET3LZ_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3040
3040
|
`);
|
|
3041
3041
|
return false;
|
|
3042
3042
|
}
|
|
@@ -3067,5 +3067,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3067
3067
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3068
3068
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3069
3069
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3070
|
-
//# sourceMappingURL=chunk-
|
|
3071
|
-
//# sourceMappingURL=chunk-
|
|
3070
|
+
//# sourceMappingURL=chunk-FMIKUGF2.cjs.map
|
|
3071
|
+
//# sourceMappingURL=chunk-FMIKUGF2.cjs.map
|