@theokit/sdk 5.11.1 → 5.12.1
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 +115 -0
- package/dist/a2a/index.cjs +8 -8
- package/dist/a2a/index.js +3 -3
- package/dist/agent-BVKIUP7F.cjs +71 -0
- package/dist/{agent-OKP4LHG2.cjs.map → agent-BVKIUP7F.cjs.map} +1 -1
- package/dist/{agent-CmKwSyyD.d.ts → agent-CVzDy_Oj.d.ts} +17 -8
- package/dist/{agent-XMkGzff_.d.cts → agent-Cn0sphpA.d.cts} +17 -8
- package/dist/agent-IG7BP6GN.js +62 -0
- package/dist/{agent-DFV52V6E.js.map → agent-IG7BP6GN.js.map} +1 -1
- package/dist/agent-prims-CZyxfCmS.d.cts +206 -0
- package/dist/agent-prims-CZyxfCmS.d.ts +206 -0
- package/dist/agent-session-store-22GKA7O4.js +6 -0
- package/dist/{agent-session-store-ODD3IZCW.js.map → agent-session-store-22GKA7O4.js.map} +1 -1
- package/dist/agent-session-store-WP6NGDVX.cjs +23 -0
- package/dist/{agent-session-store-SVEJHSUA.cjs.map → agent-session-store-WP6NGDVX.cjs.map} +1 -1
- package/dist/auth/index.cjs +33 -33
- package/dist/auth/index.js +6 -6
- package/dist/{batch-427O54FQ.js → batch-EP3FCL6D.js} +9 -9
- package/dist/{batch-427O54FQ.js.map → batch-EP3FCL6D.js.map} +1 -1
- package/dist/{batch-U4SO4RLX.cjs → batch-IZ5EDKJ5.cjs} +29 -29
- package/dist/{batch-U4SO4RLX.cjs.map → batch-IZ5EDKJ5.cjs.map} +1 -1
- package/dist/{chunk-IIYJMXYW.cjs → chunk-27V5I2WW.cjs} +4 -4
- package/dist/{chunk-IIYJMXYW.cjs.map → chunk-27V5I2WW.cjs.map} +1 -1
- package/dist/{chunk-DPY2M74T.js → chunk-2C24NSNV.js} +5 -5
- package/dist/{chunk-DPY2M74T.js.map → chunk-2C24NSNV.js.map} +1 -1
- package/dist/{chunk-7F7XE6CM.js → chunk-2S4HQCDF.js} +3 -3
- package/dist/{chunk-7F7XE6CM.js.map → chunk-2S4HQCDF.js.map} +1 -1
- package/dist/{chunk-LZJXEPEQ.js → chunk-2SFLLOMN.js} +3 -3
- package/dist/{chunk-LZJXEPEQ.js.map → chunk-2SFLLOMN.js.map} +1 -1
- package/dist/{chunk-RGQICWFU.js → chunk-354F3OF5.js} +3 -3
- package/dist/{chunk-RGQICWFU.js.map → chunk-354F3OF5.js.map} +1 -1
- package/dist/{chunk-TX56N7FR.js → chunk-3FSBE4PS.js} +4 -4
- package/dist/{chunk-TX56N7FR.js.map → chunk-3FSBE4PS.js.map} +1 -1
- package/dist/{chunk-RQMCOFAI.cjs → chunk-3HA7N2BB.cjs} +8 -8
- package/dist/{chunk-RQMCOFAI.cjs.map → chunk-3HA7N2BB.cjs.map} +1 -1
- package/dist/{chunk-GM54F4FE.cjs → chunk-3KIUY67P.cjs} +9 -9
- package/dist/{chunk-GM54F4FE.cjs.map → chunk-3KIUY67P.cjs.map} +1 -1
- package/dist/{chunk-CZJ6Q7CW.js → chunk-3OY6H3I7.js} +66 -7
- package/dist/chunk-3OY6H3I7.js.map +1 -0
- package/dist/{chunk-ZWACQM5U.cjs → chunk-3WKWBYPO.cjs} +9 -9
- package/dist/{chunk-ZWACQM5U.cjs.map → chunk-3WKWBYPO.cjs.map} +1 -1
- package/dist/{chunk-Q34EBNYG.js → chunk-4GUFNDZR.js} +5 -5
- package/dist/{chunk-Q34EBNYG.js.map → chunk-4GUFNDZR.js.map} +1 -1
- package/dist/{chunk-XDUGSTYJ.cjs → chunk-4YD2WI57.cjs} +15 -15
- package/dist/{chunk-XDUGSTYJ.cjs.map → chunk-4YD2WI57.cjs.map} +1 -1
- package/dist/{chunk-SKDNCTXG.cjs → chunk-5A4UFBHW.cjs} +15 -15
- package/dist/{chunk-SKDNCTXG.cjs.map → chunk-5A4UFBHW.cjs.map} +1 -1
- package/dist/{chunk-SUVCHX4L.js → chunk-5AR6O7GW.js} +3 -3
- package/dist/{chunk-SUVCHX4L.js.map → chunk-5AR6O7GW.js.map} +1 -1
- package/dist/{chunk-SVCPJRUB.js → chunk-5HSMH2ZZ.js} +6 -6
- package/dist/{chunk-SVCPJRUB.js.map → chunk-5HSMH2ZZ.js.map} +1 -1
- package/dist/{chunk-GTX6FEDP.js → chunk-5IRDK5BC.js} +3 -3
- package/dist/{chunk-GTX6FEDP.js.map → chunk-5IRDK5BC.js.map} +1 -1
- package/dist/{chunk-H3CVJSFC.js → chunk-5IUDICRK.js} +3 -3
- package/dist/{chunk-H3CVJSFC.js.map → chunk-5IUDICRK.js.map} +1 -1
- package/dist/{chunk-FYEHYQ7T.cjs → chunk-6CXRYPG7.cjs} +15 -15
- package/dist/{chunk-FYEHYQ7T.cjs.map → chunk-6CXRYPG7.cjs.map} +1 -1
- package/dist/{chunk-NQVWSSX2.cjs → chunk-6OCJWGVD.cjs} +12 -12
- package/dist/{chunk-NQVWSSX2.cjs.map → chunk-6OCJWGVD.cjs.map} +1 -1
- package/dist/{chunk-MPR2ISL2.cjs → chunk-6XQLTQB6.cjs} +4 -4
- package/dist/{chunk-MPR2ISL2.cjs.map → chunk-6XQLTQB6.cjs.map} +1 -1
- package/dist/{chunk-72CPLZPC.cjs → chunk-7INPXUJI.cjs} +5 -5
- package/dist/{chunk-72CPLZPC.cjs.map → chunk-7INPXUJI.cjs.map} +1 -1
- package/dist/{chunk-HG5LKFG7.cjs → chunk-7WARNHWW.cjs} +16 -16
- package/dist/{chunk-HG5LKFG7.cjs.map → chunk-7WARNHWW.cjs.map} +1 -1
- package/dist/{chunk-KIKKTW5O.cjs → chunk-7YUPSBDV.cjs} +4 -4
- package/dist/{chunk-KIKKTW5O.cjs.map → chunk-7YUPSBDV.cjs.map} +1 -1
- package/dist/{chunk-IZDDSLL2.js → chunk-AB4OPJLD.js} +6 -6
- package/dist/{chunk-IZDDSLL2.js.map → chunk-AB4OPJLD.js.map} +1 -1
- package/dist/{chunk-XERM7PDQ.js → chunk-AGO5S5WD.js} +3 -3
- package/dist/{chunk-XERM7PDQ.js.map → chunk-AGO5S5WD.js.map} +1 -1
- package/dist/{chunk-ZWFTECOE.js → chunk-AHKS3DKI.js} +3 -3
- package/dist/{chunk-ZWFTECOE.js.map → chunk-AHKS3DKI.js.map} +1 -1
- package/dist/{chunk-ECD6ER3E.cjs → chunk-AIZ6WXSL.cjs} +4 -4
- package/dist/{chunk-ECD6ER3E.cjs.map → chunk-AIZ6WXSL.cjs.map} +1 -1
- package/dist/{chunk-KO6SHCEH.js → chunk-AQW54OWQ.js} +3 -3
- package/dist/{chunk-KO6SHCEH.js.map → chunk-AQW54OWQ.js.map} +1 -1
- package/dist/{chunk-P22BZE7G.cjs → chunk-AT2PESXB.cjs} +7 -7
- package/dist/{chunk-P22BZE7G.cjs.map → chunk-AT2PESXB.cjs.map} +1 -1
- package/dist/{chunk-MHIBYKWA.js → chunk-BJ7BPLQK.js} +131 -72
- package/dist/chunk-BJ7BPLQK.js.map +1 -0
- package/dist/{chunk-HV4V63CO.js → chunk-BO3PV3OP.js} +4 -4
- package/dist/{chunk-HV4V63CO.js.map → chunk-BO3PV3OP.js.map} +1 -1
- package/dist/{chunk-GHHIJEFX.cjs → chunk-BWYC7RZG.cjs} +9 -9
- package/dist/{chunk-GHHIJEFX.cjs.map → chunk-BWYC7RZG.cjs.map} +1 -1
- package/dist/{chunk-UNFBHV46.cjs → chunk-CEGU5AVD.cjs} +9 -9
- package/dist/chunk-CEGU5AVD.cjs.map +1 -0
- package/dist/{chunk-JV7JA7BM.cjs → chunk-CGH4BCIY.cjs} +11 -11
- package/dist/{chunk-JV7JA7BM.cjs.map → chunk-CGH4BCIY.cjs.map} +1 -1
- package/dist/{chunk-L3C6CCBG.cjs → chunk-CWQPQTUZ.cjs} +21 -21
- package/dist/{chunk-L3C6CCBG.cjs.map → chunk-CWQPQTUZ.cjs.map} +1 -1
- package/dist/{chunk-X3LOJJMO.js → chunk-DF77RBF4.js} +9 -9
- package/dist/{chunk-X3LOJJMO.js.map → chunk-DF77RBF4.js.map} +1 -1
- package/dist/{chunk-7NQ7HJ3E.cjs → chunk-EPANMGH7.cjs} +8 -7
- package/dist/chunk-EPANMGH7.cjs.map +1 -0
- package/dist/{chunk-NKIQTLFA.cjs → chunk-EQ5IDL6W.cjs} +4 -4
- package/dist/{chunk-NKIQTLFA.cjs.map → chunk-EQ5IDL6W.cjs.map} +1 -1
- package/dist/{chunk-D5KXKBEN.cjs → chunk-FEAWEBWN.cjs} +5 -5
- package/dist/{chunk-D5KXKBEN.cjs.map → chunk-FEAWEBWN.cjs.map} +1 -1
- package/dist/{chunk-NJSIAJEK.cjs → chunk-FLDMPVUC.cjs} +4 -4
- package/dist/{chunk-NJSIAJEK.cjs.map → chunk-FLDMPVUC.cjs.map} +1 -1
- package/dist/{chunk-ASK2OQM5.cjs → chunk-G7XBVM3T.cjs} +5 -5
- package/dist/{chunk-ASK2OQM5.cjs.map → chunk-G7XBVM3T.cjs.map} +1 -1
- package/dist/{chunk-U27XHOEF.js → chunk-H7G65PNI.js} +5 -5
- package/dist/{chunk-U27XHOEF.js.map → chunk-H7G65PNI.js.map} +1 -1
- package/dist/{chunk-JW3GVLM6.cjs → chunk-H7HD6RXO.cjs} +4 -4
- package/dist/{chunk-JW3GVLM6.cjs.map → chunk-H7HD6RXO.cjs.map} +1 -1
- package/dist/{chunk-ZHWKT2NI.js → chunk-HJ2LV464.js} +3 -3
- package/dist/{chunk-ZHWKT2NI.js.map → chunk-HJ2LV464.js.map} +1 -1
- package/dist/{chunk-KGZ66JVZ.cjs → chunk-HN4IKB6X.cjs} +14 -14
- package/dist/{chunk-KGZ66JVZ.cjs.map → chunk-HN4IKB6X.cjs.map} +1 -1
- package/dist/{chunk-XKMVJ443.js → chunk-HWMGR3HA.js} +6 -6
- package/dist/{chunk-XKMVJ443.js.map → chunk-HWMGR3HA.js.map} +1 -1
- package/dist/{chunk-EQ5NCH2Y.cjs → chunk-IO4RI5ZJ.cjs} +24 -24
- package/dist/{chunk-EQ5NCH2Y.cjs.map → chunk-IO4RI5ZJ.cjs.map} +1 -1
- package/dist/{chunk-OLSEWLK5.cjs → chunk-IOFMRS6T.cjs} +6 -6
- package/dist/{chunk-OLSEWLK5.cjs.map → chunk-IOFMRS6T.cjs.map} +1 -1
- package/dist/{chunk-7QJYKVP6.js → chunk-KCM3RMKR.js} +3 -3
- package/dist/{chunk-7QJYKVP6.js.map → chunk-KCM3RMKR.js.map} +1 -1
- package/dist/{chunk-7KIN3L2S.js → chunk-KU5O7WPK.js} +3 -3
- package/dist/{chunk-7KIN3L2S.js.map → chunk-KU5O7WPK.js.map} +1 -1
- package/dist/{chunk-J5623RIV.cjs → chunk-KX5QXLBS.cjs} +10 -10
- package/dist/{chunk-J5623RIV.cjs.map → chunk-KX5QXLBS.cjs.map} +1 -1
- package/dist/{chunk-J6GXS5A2.cjs → chunk-L7JPXZ2C.cjs} +17 -17
- package/dist/{chunk-J6GXS5A2.cjs.map → chunk-L7JPXZ2C.cjs.map} +1 -1
- package/dist/{chunk-P7NNKEWO.cjs → chunk-L7V4DDIE.cjs} +4 -4
- package/dist/{chunk-P7NNKEWO.cjs.map → chunk-L7V4DDIE.cjs.map} +1 -1
- package/dist/chunk-LO6LIUZ6.cjs +18 -0
- package/dist/{chunk-SGC7LSHF.cjs.map → chunk-LO6LIUZ6.cjs.map} +1 -1
- package/dist/{chunk-P5N3Q2NH.cjs → chunk-LSWHDOCL.cjs} +192 -148
- package/dist/chunk-LSWHDOCL.cjs.map +1 -0
- package/dist/{chunk-3JHIFQ4I.js → chunk-M4U24U6G.js} +3 -3
- package/dist/{chunk-3JHIFQ4I.js.map → chunk-M4U24U6G.js.map} +1 -1
- package/dist/{chunk-GGRPAQ3B.js → chunk-MLGETTYX.js} +5 -5
- package/dist/{chunk-GGRPAQ3B.js.map → chunk-MLGETTYX.js.map} +1 -1
- package/dist/{chunk-XZHJYSPB.js → chunk-MLJDW2YK.js} +4 -4
- package/dist/{chunk-XZHJYSPB.js.map → chunk-MLJDW2YK.js.map} +1 -1
- package/dist/{chunk-5Q4RTLMP.js → chunk-MS3TQSXU.js} +3 -3
- package/dist/{chunk-5Q4RTLMP.js.map → chunk-MS3TQSXU.js.map} +1 -1
- package/dist/{chunk-W2ZVTEOD.js → chunk-MSEL5E5P.js} +6 -6
- package/dist/{chunk-W2ZVTEOD.js.map → chunk-MSEL5E5P.js.map} +1 -1
- package/dist/{chunk-ZAM7BJXJ.cjs → chunk-MSW7LB2V.cjs} +5 -5
- package/dist/{chunk-ZAM7BJXJ.cjs.map → chunk-MSW7LB2V.cjs.map} +1 -1
- package/dist/{chunk-GMSRRJ53.js → chunk-NBNRQN6T.js} +5 -4
- package/dist/chunk-NBNRQN6T.js.map +1 -0
- package/dist/{chunk-7HUCU3KK.js → chunk-NHOEXFZT.js} +5 -5
- package/dist/{chunk-7HUCU3KK.js.map → chunk-NHOEXFZT.js.map} +1 -1
- package/dist/{chunk-6G4IRQUD.js → chunk-NJBJ3CUG.js} +6 -6
- package/dist/{chunk-6G4IRQUD.js.map → chunk-NJBJ3CUG.js.map} +1 -1
- package/dist/{chunk-I2ORT6QD.js → chunk-NKQVLWDF.js} +3 -3
- package/dist/{chunk-I2ORT6QD.js.map → chunk-NKQVLWDF.js.map} +1 -1
- package/dist/{chunk-N7KS3TIR.cjs → chunk-NP362THY.cjs} +28 -15
- package/dist/chunk-NP362THY.cjs.map +1 -0
- package/dist/{chunk-NWS2CS3Y.cjs → chunk-NWWTYBD3.cjs} +5 -5
- package/dist/{chunk-NWS2CS3Y.cjs.map → chunk-NWWTYBD3.cjs.map} +1 -1
- package/dist/{chunk-SVQIW5RJ.js → chunk-OLJOI4LK.js} +4 -4
- package/dist/{chunk-SVQIW5RJ.js.map → chunk-OLJOI4LK.js.map} +1 -1
- package/dist/{chunk-7JAKO3NM.js → chunk-ORLTGPOS.js} +3 -3
- package/dist/{chunk-7JAKO3NM.js.map → chunk-ORLTGPOS.js.map} +1 -1
- package/dist/{chunk-5DD4NJN3.js → chunk-PKRPV3R7.js} +3 -3
- package/dist/{chunk-5DD4NJN3.js.map → chunk-PKRPV3R7.js.map} +1 -1
- package/dist/{chunk-R5YPDAKD.cjs → chunk-POBZXULR.cjs} +4 -4
- package/dist/{chunk-R5YPDAKD.cjs.map → chunk-POBZXULR.cjs.map} +1 -1
- package/dist/{chunk-35KBC4BX.cjs → chunk-Q6WT5535.cjs} +446 -387
- package/dist/chunk-Q6WT5535.cjs.map +1 -0
- package/dist/{chunk-MQGSOKR3.js → chunk-Q7UG242V.js} +3 -3
- package/dist/{chunk-MQGSOKR3.js.map → chunk-Q7UG242V.js.map} +1 -1
- package/dist/{chunk-XKZFIP7Z.cjs → chunk-QG4SXZ2A.cjs} +4 -4
- package/dist/{chunk-XKZFIP7Z.cjs.map → chunk-QG4SXZ2A.cjs.map} +1 -1
- package/dist/{chunk-NAGPKWOD.cjs → chunk-QISSETTG.cjs} +4 -4
- package/dist/{chunk-NAGPKWOD.cjs.map → chunk-QISSETTG.cjs.map} +1 -1
- package/dist/{chunk-OR6XIWLB.js → chunk-QK2ERTO3.js} +4 -4
- package/dist/{chunk-OR6XIWLB.js.map → chunk-QK2ERTO3.js.map} +1 -1
- package/dist/{chunk-ZDYDBXSD.js → chunk-RN3XDZGS.js} +6 -6
- package/dist/{chunk-ZDYDBXSD.js.map → chunk-RN3XDZGS.js.map} +1 -1
- package/dist/{chunk-6LHQPOMI.cjs → chunk-RNXXYF22.cjs} +66 -7
- package/dist/chunk-RNXXYF22.cjs.map +1 -0
- package/dist/{chunk-TMKTSYDS.cjs → chunk-RS7YQR4X.cjs} +6 -6
- package/dist/{chunk-TMKTSYDS.cjs.map → chunk-RS7YQR4X.cjs.map} +1 -1
- package/dist/{chunk-HU666T3Q.cjs → chunk-S46WJTDL.cjs} +14 -14
- package/dist/{chunk-HU666T3Q.cjs.map → chunk-S46WJTDL.cjs.map} +1 -1
- package/dist/{chunk-ZD66GFH5.cjs → chunk-SDZ4XDWS.cjs} +35 -35
- package/dist/{chunk-ZD66GFH5.cjs.map → chunk-SDZ4XDWS.cjs.map} +1 -1
- package/dist/{chunk-ZJZ7LV3A.js → chunk-SV63WTA2.js} +3 -3
- package/dist/{chunk-ZJZ7LV3A.js.map → chunk-SV63WTA2.js.map} +1 -1
- package/dist/{chunk-CQYBJOB2.cjs → chunk-SXH37C7X.cjs} +4 -4
- package/dist/{chunk-CQYBJOB2.cjs.map → chunk-SXH37C7X.cjs.map} +1 -1
- package/dist/{chunk-GMRFAX4I.js → chunk-SZQFCHU6.js} +4 -4
- package/dist/{chunk-GMRFAX4I.js.map → chunk-SZQFCHU6.js.map} +1 -1
- package/dist/{chunk-6PB5AQCY.cjs → chunk-TLVI2OQK.cjs} +16 -16
- package/dist/{chunk-6PB5AQCY.cjs.map → chunk-TLVI2OQK.cjs.map} +1 -1
- package/dist/{chunk-B5MHRQJZ.js → chunk-TNFOU6SB.js} +3 -3
- package/dist/chunk-TNFOU6SB.js.map +1 -0
- package/dist/{chunk-N6OEX5TN.cjs → chunk-UDAKAE4Z.cjs} +16 -16
- package/dist/{chunk-N6OEX5TN.cjs.map → chunk-UDAKAE4Z.cjs.map} +1 -1
- package/dist/{chunk-26NEAJ6T.js → chunk-VVGFZQZC.js} +4 -4
- package/dist/{chunk-26NEAJ6T.js.map → chunk-VVGFZQZC.js.map} +1 -1
- package/dist/{chunk-XCQ432OX.js → chunk-VZGE7NAI.js} +3 -3
- package/dist/{chunk-XCQ432OX.js.map → chunk-VZGE7NAI.js.map} +1 -1
- package/dist/{chunk-C7GKRGKN.cjs → chunk-WDVG5R2Q.cjs} +19 -19
- package/dist/{chunk-C7GKRGKN.cjs.map → chunk-WDVG5R2Q.cjs.map} +1 -1
- package/dist/{chunk-FTZTZBCU.js → chunk-XESYJ4JC.js} +4 -4
- package/dist/{chunk-FTZTZBCU.js.map → chunk-XESYJ4JC.js.map} +1 -1
- package/dist/{chunk-OPAKPEPG.js → chunk-XJ3WU5CZ.js} +5 -5
- package/dist/{chunk-OPAKPEPG.js.map → chunk-XJ3WU5CZ.js.map} +1 -1
- package/dist/{chunk-BBJ77S62.js → chunk-XJ4C4NFX.js} +64 -20
- package/dist/chunk-XJ4C4NFX.js.map +1 -0
- package/dist/{chunk-AY43232P.js → chunk-XRPMZ7TO.js} +4 -4
- package/dist/{chunk-AY43232P.js.map → chunk-XRPMZ7TO.js.map} +1 -1
- package/dist/{chunk-X6DUEDAF.js → chunk-XZKIAENA.js} +3 -3
- package/dist/{chunk-X6DUEDAF.js.map → chunk-XZKIAENA.js.map} +1 -1
- package/dist/{chunk-X7EUUHXU.js → chunk-YMVTUV5K.js} +3 -3
- package/dist/{chunk-X7EUUHXU.js.map → chunk-YMVTUV5K.js.map} +1 -1
- package/dist/{chunk-3JANYJYS.cjs → chunk-YOVZMN4P.cjs} +8 -8
- package/dist/{chunk-3JANYJYS.cjs.map → chunk-YOVZMN4P.cjs.map} +1 -1
- package/dist/{chunk-TY56BKSK.cjs → chunk-YQ3XC6C2.cjs} +4 -4
- package/dist/{chunk-TY56BKSK.cjs.map → chunk-YQ3XC6C2.cjs.map} +1 -1
- package/dist/{chunk-JLIRFWUG.js → chunk-ZJAYFSVI.js} +22 -9
- package/dist/chunk-ZJAYFSVI.js.map +1 -0
- package/dist/{chunk-MU7IAA7G.js → chunk-ZLFFDPXC.js} +9 -9
- package/dist/{chunk-MU7IAA7G.js.map → chunk-ZLFFDPXC.js.map} +1 -1
- package/dist/{chunk-JLRLCBJ4.cjs → chunk-ZOFRNNZD.cjs} +4 -4
- package/dist/{chunk-JLRLCBJ4.cjs.map → chunk-ZOFRNNZD.cjs.map} +1 -1
- package/dist/{chunk-MPQJE3G4.cjs → chunk-ZWLFHSON.cjs} +15 -15
- package/dist/{chunk-MPQJE3G4.cjs.map → chunk-ZWLFHSON.cjs.map} +1 -1
- package/dist/compact-session-3U2JYTVG.js +25 -0
- package/dist/{compact-session-4HAUP3HK.js.map → compact-session-3U2JYTVG.js.map} +1 -1
- package/dist/{compact-session-Y56D3S57.cjs → compact-session-NM56BREJ.cjs} +24 -24
- package/dist/{compact-session-Y56D3S57.cjs.map → compact-session-NM56BREJ.cjs.map} +1 -1
- package/dist/compaction.cjs +18 -18
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context/index.cjs +9 -9
- package/dist/context/index.js +6 -6
- package/dist/context-4RSI3AXT.cjs +24 -0
- package/dist/{context-B5J4GX2F.cjs.map → context-4RSI3AXT.cjs.map} +1 -1
- package/dist/context-7EBZST3L.js +7 -0
- package/dist/{context-3FZRAO5K.js.map → context-7EBZST3L.js.map} +1 -1
- package/dist/{cron-Blj6wMYg.d.cts → cron-BWDYetbq.d.cts} +2 -2
- package/dist/{cron-BPccQCO8.d.ts → cron-CHn-F0fC.d.ts} +2 -2
- package/dist/cron.cjs +42 -42
- package/dist/cron.d.cts +4 -4
- package/dist/cron.d.ts +4 -4
- package/dist/cron.js +41 -41
- package/dist/{errors-BWOJeWTZ.d.cts → errors-BiDQFWTG.d.cts} +10 -7
- package/dist/{errors-DDvG18IB.d.ts → errors-Pf22PJJ-.d.ts} +10 -7
- package/dist/errors.cjs +23 -23
- package/dist/errors.d.cts +2 -3
- package/dist/errors.d.ts +2 -3
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +54 -54
- package/dist/eval.js +42 -42
- package/dist/{executor-3NI7KNL4.js → executor-3D2UDJHW.js} +8 -8
- package/dist/{executor-3NI7KNL4.js.map → executor-3D2UDJHW.js.map} +1 -1
- package/dist/{executor-2SUGI3ZT.cjs → executor-HKHT4CWS.cjs} +26 -26
- package/dist/{executor-2SUGI3ZT.cjs.map → executor-HKHT4CWS.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +12 -12
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-6ZCCJX3K.js +11 -0
- package/dist/{fs-session-store-3VI4CPTX.js.map → fs-session-store-6ZCCJX3K.js.map} +1 -1
- package/dist/fs-session-store-S2AXVJIX.cjs +20 -0
- package/dist/{fs-session-store-IQ6PEHYF.cjs.map → fs-session-store-S2AXVJIX.cjs.map} +1 -1
- package/dist/generate-object-S7MNVF2V.js +7 -0
- package/dist/{generate-object-NTKAWE7D.js.map → generate-object-S7MNVF2V.js.map} +1 -1
- package/dist/generate-object-XBWD2PU7.cjs +20 -0
- package/dist/{generate-object-YHTWG5DB.cjs.map → generate-object-XBWD2PU7.cjs.map} +1 -1
- package/dist/index-manager-HO456AVW.cjs +27 -0
- package/dist/{index-manager-YGXRFJMZ.cjs.map → index-manager-HO456AVW.cjs.map} +1 -1
- package/dist/index-manager-QDH56FER.js +18 -0
- package/dist/{index-manager-JVYIVTZG.js.map → index-manager-QDH56FER.js.map} +1 -1
- package/dist/index.cjs +172 -172
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +59 -59
- package/dist/{inject-session-R73PRM7B.cjs → inject-session-JVTZNQF6.cjs} +9 -9
- package/dist/{inject-session-R73PRM7B.cjs.map → inject-session-JVTZNQF6.cjs.map} +1 -1
- package/dist/{inject-session-LJX5JGV5.js → inject-session-THABTKJY.js} +7 -7
- package/dist/{inject-session-LJX5JGV5.js.map → inject-session-THABTKJY.js.map} +1 -1
- package/dist/interactive/index.cjs +4 -4
- package/dist/interactive/index.js +2 -2
- package/dist/internal/budget/normalize-usage.d.ts +5 -1
- package/dist/internal/error-mappers/openai-compatible.d.ts +3 -1
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/memory/storage/index.cjs +42 -42
- package/dist/internal/memory/storage/index.js +10 -10
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +8 -8
- package/dist/internal/providers/catalog-schema.d.ts +1 -1
- package/dist/internal/runtime/lifecycle/throw-on-error-run.d.ts +18 -0
- package/dist/internal/runtime/model-selection.d.ts +1 -1
- package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +2 -2
- package/dist/internal/runtime/typed-run-error.d.ts +16 -0
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-4LR4IFVT.js +5 -0
- package/dist/{judge-call-LOL5FQEX.js.map → judge-call-4LR4IFVT.js.map} +1 -1
- package/dist/judge-call-ZTUQMQRL.cjs +22 -0
- package/dist/{judge-call-AQQYK6VT.cjs.map → judge-call-ZTUQMQRL.cjs.map} +1 -1
- package/dist/mcp-auth.cjs +14 -14
- package/dist/mcp-auth.js +4 -4
- package/dist/models.cjs +22 -22
- package/dist/models.js +8 -8
- package/dist/oauth-transaction-store-OMX436YB.cjs +38 -0
- package/dist/{oauth-transaction-store-ZINDV7AF.cjs.map → oauth-transaction-store-OMX436YB.cjs.map} +1 -1
- package/dist/oauth-transaction-store-U34YLEGP.js +5 -0
- package/dist/{oauth-transaction-store-NP2YHZ6D.js.map → oauth-transaction-store-U34YLEGP.js.map} +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +31 -31
- package/dist/persistence.js +10 -10
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/providers.cjs +9 -9
- package/dist/providers.js +7 -7
- package/dist/registry-5TDAF7RK.js +9 -0
- package/dist/{registry-5FK42CRV.js.map → registry-5TDAF7RK.js.map} +1 -1
- package/dist/registry-W7TSCLQO.cjs +46 -0
- package/dist/{registry-BVTNO73E.cjs.map → registry-W7TSCLQO.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-until-DG2KXWB2.cjs → run-until-4KHVF7YC.cjs} +8 -4
- package/dist/run-until-4KHVF7YC.cjs.map +1 -0
- package/dist/{run-until-6D6TQ4JN.js → run-until-G6BW2DWM.js} +8 -4
- package/dist/run-until-G6BW2DWM.js.map +1 -0
- package/dist/sandbox/index.cjs +114 -41
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +99 -26
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +24 -4
- package/dist/sandbox/linux-sandbox.d.ts +24 -4
- package/dist/sandbox/seccomp-delivery.d.cts +46 -0
- package/dist/sandbox/seccomp-delivery.d.ts +46 -0
- package/dist/{run-DsA5Ip2i.d.cts → sdk-agent-4-dXI2GS.d.cts} +1500 -753
- package/dist/{run-DsA5Ip2i.d.ts → sdk-agent-CTOJlWA_.d.ts} +1500 -753
- package/dist/server/auth/index.cjs +22 -22
- package/dist/server/auth/index.js +7 -7
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.d.cts +2 -3
- package/dist/server/errors-envelope.d.ts +2 -3
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-7TZ6HXSX.cjs +62 -0
- package/dist/{session-transcript-RACG7BK2.cjs.map → session-transcript-7TZ6HXSX.cjs.map} +1 -1
- package/dist/session-transcript-BSHZYYY6.js +5 -0
- package/dist/{session-transcript-AR7IBICT.js.map → session-transcript-BSHZYYY6.js.map} +1 -1
- package/dist/skills.cjs +8 -8
- package/dist/skills.js +5 -5
- package/dist/stream-object-R6SMYV4R.js +7 -0
- package/dist/{stream-object-QAEHG4YO.js.map → stream-object-R6SMYV4R.js.map} +1 -1
- package/dist/stream-object-TEEK3CAX.cjs +20 -0
- package/dist/{stream-object-TKVGGA54.cjs.map → stream-object-TEEK3CAX.cjs.map} +1 -1
- package/dist/subagents-loader-TXOA5EJJ.cjs +16 -0
- package/dist/{subagents-loader-5TZCAIYQ.cjs.map → subagents-loader-TXOA5EJJ.cjs.map} +1 -1
- package/dist/subagents-loader-Z744TAKD.js +7 -0
- package/dist/{subagents-loader-PEV3PD4Q.js.map → subagents-loader-Z744TAKD.js.map} +1 -1
- package/dist/subagents-loader.cjs +7 -7
- package/dist/subagents-loader.d.cts +4 -3
- package/dist/subagents-loader.d.ts +4 -3
- package/dist/subagents-loader.js +5 -5
- 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/agent-prims.d.ts +16 -0
- package/dist/types/agent.d.ts +15 -6
- package/dist/types/run.d.ts +14 -14
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +6 -6
- package/docs/error-codes.md +24 -23
- package/docs/harness-capability-map.md +5 -5
- package/package.json +1 -1
- package/dist/agent-DFV52V6E.js +0 -62
- package/dist/agent-OKP4LHG2.cjs +0 -71
- package/dist/agent-session-store-ODD3IZCW.js +0 -6
- package/dist/agent-session-store-SVEJHSUA.cjs +0 -23
- package/dist/chunk-35KBC4BX.cjs.map +0 -1
- package/dist/chunk-6LHQPOMI.cjs.map +0 -1
- package/dist/chunk-7NQ7HJ3E.cjs.map +0 -1
- package/dist/chunk-B5MHRQJZ.js.map +0 -1
- package/dist/chunk-BBJ77S62.js.map +0 -1
- package/dist/chunk-CZJ6Q7CW.js.map +0 -1
- package/dist/chunk-GMSRRJ53.js.map +0 -1
- package/dist/chunk-JLIRFWUG.js.map +0 -1
- package/dist/chunk-MHIBYKWA.js.map +0 -1
- package/dist/chunk-N7KS3TIR.cjs.map +0 -1
- package/dist/chunk-P5N3Q2NH.cjs.map +0 -1
- package/dist/chunk-SGC7LSHF.cjs +0 -18
- package/dist/chunk-UNFBHV46.cjs.map +0 -1
- package/dist/compact-session-4HAUP3HK.js +0 -25
- package/dist/context-3FZRAO5K.js +0 -7
- package/dist/context-B5J4GX2F.cjs +0 -24
- package/dist/fs-session-store-3VI4CPTX.js +0 -11
- package/dist/fs-session-store-IQ6PEHYF.cjs +0 -20
- package/dist/generate-object-NTKAWE7D.js +0 -7
- package/dist/generate-object-YHTWG5DB.cjs +0 -20
- package/dist/index-manager-JVYIVTZG.js +0 -18
- package/dist/index-manager-YGXRFJMZ.cjs +0 -27
- package/dist/judge-call-AQQYK6VT.cjs +0 -22
- package/dist/judge-call-LOL5FQEX.js +0 -5
- package/dist/oauth-transaction-store-NP2YHZ6D.js +0 -5
- package/dist/oauth-transaction-store-ZINDV7AF.cjs +0 -38
- package/dist/registry-5FK42CRV.js +0 -9
- package/dist/registry-BVTNO73E.cjs +0 -46
- package/dist/run-until-6D6TQ4JN.js.map +0 -1
- package/dist/run-until-DG2KXWB2.cjs.map +0 -1
- package/dist/sdk-agent-dNwjwCt5.d.cts +0 -940
- package/dist/sdk-agent-wEOLXD3F.d.ts +0 -940
- package/dist/session-transcript-AR7IBICT.js +0 -5
- package/dist/session-transcript-RACG7BK2.cjs +0 -62
- package/dist/stream-object-QAEHG4YO.js +0 -7
- package/dist/stream-object-TKVGGA54.cjs +0 -20
- package/dist/subagents-loader-5TZCAIYQ.cjs +0 -16
- package/dist/subagents-loader-PEV3PD4Q.js +0 -7
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSXH37C7X_cjs = require('./chunk-SXH37C7X.cjs');
|
|
4
4
|
var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkNP362THY_cjs = require('./chunk-NP362THY.cjs');
|
|
6
6
|
var chunkQOGNZMHD_cjs = require('./chunk-QOGNZMHD.cjs');
|
|
7
7
|
var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
|
|
8
8
|
var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
|
|
10
|
+
var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
|
|
11
11
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
|
|
13
13
|
var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkQISSETTG_cjs = require('./chunk-QISSETTG.cjs');
|
|
15
15
|
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
|
|
17
|
+
var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
|
|
18
18
|
var fs = require('fs');
|
|
19
19
|
var promises = require('fs/promises');
|
|
20
20
|
var os = require('os');
|
|
@@ -45,19 +45,19 @@ function loadTrustedNames() {
|
|
|
45
45
|
else discarded += 1;
|
|
46
46
|
}
|
|
47
47
|
if (discarded > 0) {
|
|
48
|
-
|
|
48
|
+
chunkRNXXYF22_cjs.diag(
|
|
49
49
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
50
50
|
`
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
} else {
|
|
54
|
-
|
|
54
|
+
chunkRNXXYF22_cjs.diag(
|
|
55
55
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
56
56
|
`
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
} catch {
|
|
60
|
-
|
|
60
|
+
chunkRNXXYF22_cjs.diag(
|
|
61
61
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
62
62
|
`
|
|
63
63
|
);
|
|
@@ -83,7 +83,7 @@ async function discoverProviderPlugins() {
|
|
|
83
83
|
const trusted = loadTrustedNames();
|
|
84
84
|
for (const entry of entries) {
|
|
85
85
|
if (!trusted.has(entry)) {
|
|
86
|
-
|
|
86
|
+
chunkRNXXYF22_cjs.diag(
|
|
87
87
|
`[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.
|
|
88
88
|
`
|
|
89
89
|
);
|
|
@@ -102,13 +102,13 @@ async function loadOne(dir, entryName) {
|
|
|
102
102
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
103
103
|
const profile = plugin.profile;
|
|
104
104
|
if (profile !== void 0 && typeof profile === "object") {
|
|
105
|
-
|
|
105
|
+
chunkS46WJTDL_cjs.registerProvider(profile);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
return;
|
|
109
109
|
} catch (err) {
|
|
110
110
|
const msg = err instanceof Error ? err.message : String(err);
|
|
111
|
-
|
|
111
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
112
112
|
`);
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
@@ -120,7 +120,7 @@ function mapAnthropicError(args) {
|
|
|
120
120
|
const { status, body, headers, endpoint } = args;
|
|
121
121
|
const code = mapAnthropicStatusToCode(status, body);
|
|
122
122
|
const message = formatMessage(status, code);
|
|
123
|
-
const metadata =
|
|
123
|
+
const metadata = chunkNP362THY_cjs.buildErrorMetadata({
|
|
124
124
|
provider: "anthropic",
|
|
125
125
|
endpoint,
|
|
126
126
|
code,
|
|
@@ -129,24 +129,24 @@ function mapAnthropicError(args) {
|
|
|
129
129
|
body
|
|
130
130
|
});
|
|
131
131
|
if (status === 401 || status === 403) {
|
|
132
|
-
return new
|
|
132
|
+
return new chunkCEGU5AVD_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
133
133
|
}
|
|
134
134
|
if (status === 429) {
|
|
135
|
-
return new
|
|
135
|
+
return new chunkCEGU5AVD_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
136
136
|
}
|
|
137
137
|
if (status === 400) {
|
|
138
|
-
return new
|
|
138
|
+
return new chunkCEGU5AVD_cjs.ConfigurationError(message, {
|
|
139
139
|
code: `anthropic_${code}`,
|
|
140
140
|
metadata
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
if (status === 408) {
|
|
144
|
-
return new
|
|
144
|
+
return new chunkCEGU5AVD_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
145
145
|
}
|
|
146
146
|
if (status >= 500 && status < 600) {
|
|
147
|
-
return new
|
|
147
|
+
return new chunkCEGU5AVD_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
148
148
|
}
|
|
149
|
-
return new
|
|
149
|
+
return new chunkCEGU5AVD_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
150
150
|
}
|
|
151
151
|
function mapAnthropicStatusToCode(status, body) {
|
|
152
152
|
if (status === 400) {
|
|
@@ -159,7 +159,7 @@ function mapAnthropicStatusToCode(status, body) {
|
|
|
159
159
|
}
|
|
160
160
|
return "invalid_request";
|
|
161
161
|
}
|
|
162
|
-
return
|
|
162
|
+
return chunkNP362THY_cjs.httpStatusToErrorCode(status);
|
|
163
163
|
}
|
|
164
164
|
function formatMessage(status, code) {
|
|
165
165
|
return `Anthropic API error: ${code} (HTTP ${status})`;
|
|
@@ -200,7 +200,7 @@ function assign(finish, key, value) {
|
|
|
200
200
|
if (value === void 0) return;
|
|
201
201
|
const count = asTokenCount(value);
|
|
202
202
|
if (count === void 0) {
|
|
203
|
-
|
|
203
|
+
chunkRNXXYF22_cjs.diag(
|
|
204
204
|
`[theokit-sdk] provider reported an unusable ${key} (${String(value)}) \u2014 dropping it. Usage and cost for this turn will be incomplete.
|
|
205
205
|
`
|
|
206
206
|
);
|
|
@@ -230,7 +230,7 @@ function toBlockToolResultContent(content) {
|
|
|
230
230
|
function toStringToolResultContent(content, providerName, toolUseId) {
|
|
231
231
|
if (typeof content === "string") return content;
|
|
232
232
|
if (content.some((block) => block.type === "image")) {
|
|
233
|
-
throw new
|
|
233
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
234
234
|
`provider "${providerName}" does not support image content in tool results` + (toolUseId === void 0 ? "" : ` \u2014 the result of tool call ${toolUseId} carried an image`) + `, and this wire carries tool results as text only`
|
|
235
235
|
);
|
|
236
236
|
}
|
|
@@ -412,7 +412,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
412
412
|
(resolve, reject) => {
|
|
413
413
|
const timer = setTimeout(() => {
|
|
414
414
|
reject(
|
|
415
|
-
new
|
|
415
|
+
new chunkCEGU5AVD_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
416
416
|
code: "stream_idle_timeout"
|
|
417
417
|
})
|
|
418
418
|
);
|
|
@@ -489,9 +489,9 @@ function isAbortError(err) {
|
|
|
489
489
|
}
|
|
490
490
|
function wrapTransportError(err, ctx) {
|
|
491
491
|
if (isAbortError(err)) return err;
|
|
492
|
-
if (err instanceof
|
|
492
|
+
if (err instanceof chunkCEGU5AVD_cjs.TheokitAgentError) return err;
|
|
493
493
|
const detail = err instanceof Error ? err.message : String(err);
|
|
494
|
-
return new
|
|
494
|
+
return new chunkCEGU5AVD_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
|
|
495
495
|
code: "transport_failure",
|
|
496
496
|
cause: err
|
|
497
497
|
});
|
|
@@ -551,7 +551,7 @@ var AnthropicClient = class {
|
|
|
551
551
|
for (const event of events) yield event;
|
|
552
552
|
}
|
|
553
553
|
if (!accumulator.finishReasonSeen) {
|
|
554
|
-
throw new
|
|
554
|
+
throw new chunkCEGU5AVD_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
555
555
|
code: "stream_truncated"
|
|
556
556
|
});
|
|
557
557
|
}
|
|
@@ -570,12 +570,12 @@ function parseAnthropicFrame(record) {
|
|
|
570
570
|
const event = record.event;
|
|
571
571
|
const size = `${record.data.length} chars`;
|
|
572
572
|
if (CONTENT_FRAMES.has(event)) {
|
|
573
|
-
throw new
|
|
573
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(
|
|
574
574
|
`Anthropic SSE ${event} frame (${size}) is not valid JSON; the turn would lose content`,
|
|
575
575
|
{ code: "stream_malformed_frame", cause: parseErr }
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
|
-
|
|
578
|
+
chunkRNXXYF22_cjs.diag(
|
|
579
579
|
`[theokit-sdk] skipped an Anthropic SSE ${event} frame (${size}) that is not valid JSON
|
|
580
580
|
`
|
|
581
581
|
);
|
|
@@ -741,10 +741,10 @@ function classifyBedrockError(args, awsType, message) {
|
|
|
741
741
|
return "invalid_request";
|
|
742
742
|
}
|
|
743
743
|
if (awsType.includes("Timeout")) return "timeout";
|
|
744
|
-
return
|
|
744
|
+
return chunkNP362THY_cjs.httpStatusToErrorCode(args.status);
|
|
745
745
|
}
|
|
746
746
|
function buildBedrockMetadata(args, code) {
|
|
747
|
-
return
|
|
747
|
+
return chunkNP362THY_cjs.buildErrorMetadata({
|
|
748
748
|
provider: "bedrock",
|
|
749
749
|
endpoint: args.endpoint,
|
|
750
750
|
code,
|
|
@@ -754,28 +754,28 @@ function buildBedrockMetadata(args, code) {
|
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
function mapBedrockError(args) {
|
|
757
|
-
const parsed =
|
|
757
|
+
const parsed = chunkNP362THY_cjs.parseErrorBody(args.body);
|
|
758
758
|
const awsType = parsed.__type ?? "";
|
|
759
759
|
const message = parsed.message ?? parsed.Message ?? "Bedrock request failed";
|
|
760
760
|
const code = classifyBedrockError(args, awsType, message);
|
|
761
761
|
const metadata = buildBedrockMetadata(args, code);
|
|
762
762
|
switch (code) {
|
|
763
763
|
case "rate_limit":
|
|
764
|
-
return new
|
|
764
|
+
return new chunkCEGU5AVD_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
765
765
|
case "auth_failed":
|
|
766
|
-
return new
|
|
766
|
+
return new chunkCEGU5AVD_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
767
767
|
case "invalid_request": {
|
|
768
768
|
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}`;
|
|
769
|
-
return new
|
|
769
|
+
return new chunkCEGU5AVD_cjs.ConfigurationError(friendly, { metadata });
|
|
770
770
|
}
|
|
771
771
|
case "quota_exceeded":
|
|
772
|
-
return new
|
|
772
|
+
return new chunkCEGU5AVD_cjs.RateLimitError(`Bedrock quota exceeded: ${message}`, { metadata });
|
|
773
773
|
case "timeout":
|
|
774
|
-
return new
|
|
774
|
+
return new chunkCEGU5AVD_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
775
775
|
case "server_error":
|
|
776
|
-
return new
|
|
776
|
+
return new chunkCEGU5AVD_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
777
777
|
default:
|
|
778
|
-
return new
|
|
778
|
+
return new chunkCEGU5AVD_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
781
|
var cachedToken = null;
|
|
@@ -788,7 +788,7 @@ async function resolveBedrockToken(region) {
|
|
|
788
788
|
return cachedToken.value;
|
|
789
789
|
}
|
|
790
790
|
try {
|
|
791
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
791
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
|
|
792
792
|
const gen = r("@aws/bedrock-token-generator");
|
|
793
793
|
if (typeof gen.getToken !== "function") return void 0;
|
|
794
794
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -816,16 +816,16 @@ var BedrockAnthropicClient = class {
|
|
|
816
816
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
817
817
|
const fromEnv = await resolveBedrockToken(region);
|
|
818
818
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
819
|
-
throw new
|
|
819
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
820
820
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
821
821
|
{ code: "auth_failed" }
|
|
822
822
|
);
|
|
823
823
|
}
|
|
824
824
|
async *stream(request, signal) {
|
|
825
|
-
const region =
|
|
825
|
+
const region = chunkS46WJTDL_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
826
826
|
const token = await this.resolveTokenOrThrow(region);
|
|
827
|
-
const bareModel =
|
|
828
|
-
const baseUrl = this.options.baseUrl ??
|
|
827
|
+
const bareModel = chunkS46WJTDL_cjs.stripBedrockPrefix(request.model);
|
|
828
|
+
const baseUrl = this.options.baseUrl ?? chunkS46WJTDL_cjs.resolveBedrockBaseUrl(request.model);
|
|
829
829
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
830
830
|
const url = `${baseUrl}${endpoint}`;
|
|
831
831
|
const response = await postAnthropicRequest({
|
|
@@ -880,7 +880,7 @@ var FaultInjectingLlmClient = class {
|
|
|
880
880
|
return yield* this.inner.stream(request, signal);
|
|
881
881
|
}
|
|
882
882
|
if (parsed.status >= 400) {
|
|
883
|
-
throw
|
|
883
|
+
throw chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
884
884
|
providerId: this.name,
|
|
885
885
|
status: parsed.status,
|
|
886
886
|
body: parsed.body,
|
|
@@ -927,7 +927,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
927
927
|
function warnInvalidJsonOnce(_raw) {
|
|
928
928
|
if (warnedInvalidJson) return;
|
|
929
929
|
warnedInvalidJson = true;
|
|
930
|
-
|
|
930
|
+
chunkRNXXYF22_cjs.diag(
|
|
931
931
|
`[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.
|
|
932
932
|
`
|
|
933
933
|
);
|
|
@@ -955,7 +955,7 @@ function mapOllamaTransportError(args) {
|
|
|
955
955
|
if (args.providerId !== "ollama") return void 0;
|
|
956
956
|
const causeCode = extractCauseCode(args.cause);
|
|
957
957
|
if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
|
|
958
|
-
const metadata =
|
|
958
|
+
const metadata = chunkNP362THY_cjs.buildErrorMetadata({
|
|
959
959
|
provider: "ollama",
|
|
960
960
|
endpoint: args.endpoint,
|
|
961
961
|
code: "network",
|
|
@@ -963,7 +963,7 @@ function mapOllamaTransportError(args) {
|
|
|
963
963
|
headers: void 0,
|
|
964
964
|
body: { cause: causeCode }
|
|
965
965
|
});
|
|
966
|
-
return new
|
|
966
|
+
return new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
967
967
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
968
968
|
{ code: "ollama_unreachable", metadata }
|
|
969
969
|
);
|
|
@@ -973,7 +973,7 @@ function mapOllamaHttpError(args) {
|
|
|
973
973
|
const errString = extractErrorString(args.body).toLowerCase();
|
|
974
974
|
if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
|
|
975
975
|
const modelHint = extractModelName(errString);
|
|
976
|
-
const metadata =
|
|
976
|
+
const metadata = chunkNP362THY_cjs.buildErrorMetadata({
|
|
977
977
|
provider: "ollama",
|
|
978
978
|
endpoint: args.endpoint,
|
|
979
979
|
code: "model_unavailable",
|
|
@@ -982,13 +982,13 @@ function mapOllamaHttpError(args) {
|
|
|
982
982
|
body: args.body
|
|
983
983
|
});
|
|
984
984
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
985
|
-
return new
|
|
985
|
+
return new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
986
986
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
987
987
|
{ code: "ollama_model_not_pulled", metadata }
|
|
988
988
|
);
|
|
989
989
|
}
|
|
990
990
|
if (args.status === 503 && errString.includes("model is loading")) {
|
|
991
|
-
const metadata =
|
|
991
|
+
const metadata = chunkNP362THY_cjs.buildErrorMetadata({
|
|
992
992
|
provider: "ollama",
|
|
993
993
|
endpoint: args.endpoint,
|
|
994
994
|
code: "server_error",
|
|
@@ -996,7 +996,7 @@ function mapOllamaHttpError(args) {
|
|
|
996
996
|
headers: args.headers,
|
|
997
997
|
body: args.body
|
|
998
998
|
});
|
|
999
|
-
return new
|
|
999
|
+
return new chunkCEGU5AVD_cjs.NetworkError(
|
|
1000
1000
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
1001
1001
|
{ code: "ollama_model_loading", metadata }
|
|
1002
1002
|
);
|
|
@@ -1075,7 +1075,7 @@ var OllamaNativeClient = class {
|
|
|
1075
1075
|
endpoint: "/api/chat"
|
|
1076
1076
|
});
|
|
1077
1077
|
if (mapped !== void 0) throw mapped;
|
|
1078
|
-
throw
|
|
1078
|
+
throw chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
1079
1079
|
providerId: "ollama",
|
|
1080
1080
|
status: response.status,
|
|
1081
1081
|
body: bodyJson,
|
|
@@ -1223,7 +1223,7 @@ function toOllamaMessages(message) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
if (message.role === "user") {
|
|
1225
1225
|
if (message.content.some((p) => p.type === "image")) {
|
|
1226
|
-
throw new
|
|
1226
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
1227
1227
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1228
1228
|
{ code: "ollama_image_unsupported" }
|
|
1229
1229
|
);
|
|
@@ -1351,25 +1351,40 @@ function normalizeOpenAIResponses(raw) {
|
|
|
1351
1351
|
function sent(v) {
|
|
1352
1352
|
return v !== void 0 && v !== null;
|
|
1353
1353
|
}
|
|
1354
|
+
function strictCount(v) {
|
|
1355
|
+
const n = typeof v === "string" ? Number.parseInt(v, 10) : v;
|
|
1356
|
+
return typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.trunc(n) : Number.NaN;
|
|
1357
|
+
}
|
|
1358
|
+
function usableOr0(count) {
|
|
1359
|
+
return count === void 0 || Number.isNaN(count) ? 0 : count;
|
|
1360
|
+
}
|
|
1361
|
+
function cacheBucket(nested, topLevel) {
|
|
1362
|
+
if (!sent(nested) && !sent(topLevel)) return void 0;
|
|
1363
|
+
const fromNested = sent(nested) ? strictCount(nested) : 0;
|
|
1364
|
+
if (fromNested !== 0) return fromNested;
|
|
1365
|
+
return sent(topLevel) ? strictCount(topLevel) : 0;
|
|
1366
|
+
}
|
|
1354
1367
|
function splitChatCompletionsPrompt(raw) {
|
|
1355
1368
|
const details = raw.prompt_tokens_details ?? {};
|
|
1356
|
-
const
|
|
1357
|
-
const
|
|
1358
|
-
const
|
|
1359
|
-
const cached = (cacheReadTokens ?? 0) + (cacheWriteTokens ?? 0);
|
|
1369
|
+
const cacheReadTokens = cacheBucket(details.cached_tokens, raw.cache_read_input_tokens);
|
|
1370
|
+
const cacheWriteTokens = cacheBucket(details.cache_write_tokens, raw.cache_creation_input_tokens);
|
|
1371
|
+
const cached = usableOr0(cacheReadTokens) + usableOr0(cacheWriteTokens);
|
|
1360
1372
|
return {
|
|
1361
|
-
...sent(raw.prompt_tokens) ? { inputTokens: Math.max(0,
|
|
1373
|
+
...sent(raw.prompt_tokens) ? { inputTokens: Math.max(0, strictCount(raw.prompt_tokens) - cached) } : {},
|
|
1362
1374
|
...cacheReadTokens !== void 0 ? { cacheReadTokens } : {},
|
|
1363
1375
|
...cacheWriteTokens !== void 0 ? { cacheWriteTokens } : {}
|
|
1364
1376
|
};
|
|
1365
1377
|
}
|
|
1378
|
+
function netOfCache(total, cacheReadTokens, cacheWriteTokens) {
|
|
1379
|
+
return total === void 0 ? void 0 : Math.max(0, total - (cacheReadTokens ?? 0) - (cacheWriteTokens ?? 0));
|
|
1380
|
+
}
|
|
1366
1381
|
function normalizeOpenAIChat(raw) {
|
|
1367
1382
|
const outputTokens = int(raw.completion_tokens);
|
|
1368
1383
|
const completionDetails = raw.completion_tokens_details ?? {};
|
|
1369
1384
|
const split = splitChatCompletionsPrompt(raw);
|
|
1370
|
-
const inputTokens = split.inputTokens
|
|
1371
|
-
const cacheReadTokens = split.cacheReadTokens
|
|
1372
|
-
const cacheWriteTokens = split.cacheWriteTokens
|
|
1385
|
+
const inputTokens = int(split.inputTokens);
|
|
1386
|
+
const cacheReadTokens = int(split.cacheReadTokens);
|
|
1387
|
+
const cacheWriteTokens = int(split.cacheWriteTokens);
|
|
1373
1388
|
const reasoningTokens = int(completionDetails.reasoning_tokens);
|
|
1374
1389
|
const usage = {
|
|
1375
1390
|
inputTokens,
|
|
@@ -1418,7 +1433,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1418
1433
|
try {
|
|
1419
1434
|
return await fetchFn(url, init);
|
|
1420
1435
|
} catch (cause) {
|
|
1421
|
-
throw new
|
|
1436
|
+
throw new chunkCEGU5AVD_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1422
1437
|
}
|
|
1423
1438
|
}
|
|
1424
1439
|
async function safeParseJsonResponse(response) {
|
|
@@ -1445,7 +1460,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1445
1460
|
cause: body
|
|
1446
1461
|
};
|
|
1447
1462
|
if (envelope.code === "integration_not_connected") {
|
|
1448
|
-
return new
|
|
1463
|
+
return new chunkCEGU5AVD_cjs.IntegrationNotConnectedError(message, {
|
|
1449
1464
|
provider: envelope.provider ?? "unknown",
|
|
1450
1465
|
helpUrl: envelope.helpUrl ?? "",
|
|
1451
1466
|
code: envelope.code,
|
|
@@ -1456,21 +1471,21 @@ function mapHttpStatusToError(status, body) {
|
|
|
1456
1471
|
}
|
|
1457
1472
|
function statusToError(status, message, errorOptions) {
|
|
1458
1473
|
if (status === 401 || status === 403) {
|
|
1459
|
-
return new
|
|
1474
|
+
return new chunkCEGU5AVD_cjs.AuthenticationError(message, errorOptions);
|
|
1460
1475
|
}
|
|
1461
1476
|
if (status === 429) {
|
|
1462
|
-
return new
|
|
1477
|
+
return new chunkCEGU5AVD_cjs.RateLimitError(message, errorOptions);
|
|
1463
1478
|
}
|
|
1464
1479
|
if (status === 408) {
|
|
1465
|
-
return new
|
|
1480
|
+
return new chunkCEGU5AVD_cjs.NetworkError(message, { ...errorOptions, code: errorOptions.code ?? "timeout" });
|
|
1466
1481
|
}
|
|
1467
1482
|
if (status >= 400 && status < 500) {
|
|
1468
|
-
return new
|
|
1483
|
+
return new chunkCEGU5AVD_cjs.ConfigurationError(message, errorOptions);
|
|
1469
1484
|
}
|
|
1470
1485
|
if (status >= 500) {
|
|
1471
|
-
return new
|
|
1486
|
+
return new chunkCEGU5AVD_cjs.NetworkError(message, errorOptions);
|
|
1472
1487
|
}
|
|
1473
|
-
return new
|
|
1488
|
+
return new chunkCEGU5AVD_cjs.UnknownAgentError(message, errorOptions);
|
|
1474
1489
|
}
|
|
1475
1490
|
function extractErrorEnvelope(body) {
|
|
1476
1491
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1734,7 +1749,7 @@ var OpenAIClient = class {
|
|
|
1734
1749
|
endpoint: "/v1/chat/completions"
|
|
1735
1750
|
});
|
|
1736
1751
|
if (ollamaMapped !== void 0) throw ollamaMapped;
|
|
1737
|
-
throw
|
|
1752
|
+
throw chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
1738
1753
|
providerId,
|
|
1739
1754
|
status: response.status,
|
|
1740
1755
|
body,
|
|
@@ -1770,7 +1785,7 @@ var OpenAIClient = class {
|
|
|
1770
1785
|
}
|
|
1771
1786
|
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
1772
1787
|
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
1773
|
-
throw
|
|
1788
|
+
throw chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
1774
1789
|
providerId,
|
|
1775
1790
|
status,
|
|
1776
1791
|
body: chunk,
|
|
@@ -1782,7 +1797,7 @@ var OpenAIClient = class {
|
|
|
1782
1797
|
for (const event of events) yield event;
|
|
1783
1798
|
}
|
|
1784
1799
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1785
|
-
throw new
|
|
1800
|
+
throw new chunkCEGU5AVD_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1786
1801
|
code: "stream_truncated"
|
|
1787
1802
|
});
|
|
1788
1803
|
}
|
|
@@ -1900,13 +1915,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1900
1915
|
toolCalls.push(...recovered.toolCalls);
|
|
1901
1916
|
text = recovered.residualText;
|
|
1902
1917
|
stopReason = "tool_use";
|
|
1903
|
-
|
|
1918
|
+
chunkRNXXYF22_cjs.diag(
|
|
1904
1919
|
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
1905
1920
|
`
|
|
1906
1921
|
);
|
|
1907
1922
|
}
|
|
1908
1923
|
if (recovered.droppedNames.length > 0) {
|
|
1909
|
-
|
|
1924
|
+
chunkRNXXYF22_cjs.diag(
|
|
1910
1925
|
`[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(",")})
|
|
1911
1926
|
`
|
|
1912
1927
|
);
|
|
@@ -2033,10 +2048,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
2033
2048
|
const firstResult = await generator.next();
|
|
2034
2049
|
return { kind: "ok", generator, firstResult };
|
|
2035
2050
|
} catch (cause) {
|
|
2036
|
-
if (cause instanceof
|
|
2051
|
+
if (cause instanceof chunkCEGU5AVD_cjs.NetworkError || cause instanceof chunkCEGU5AVD_cjs.RateLimitError || cause instanceof chunkCEGU5AVD_cjs.AuthenticationError) {
|
|
2037
2052
|
if (logFallback) {
|
|
2038
2053
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
2039
|
-
|
|
2054
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
2040
2055
|
`);
|
|
2041
2056
|
}
|
|
2042
2057
|
return { kind: "handshake_error", error: cause };
|
|
@@ -2078,7 +2093,7 @@ var PoolAwareLlmClient = class {
|
|
|
2078
2093
|
// 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.
|
|
2079
2094
|
async *stream(request, signal) {
|
|
2080
2095
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
2081
|
-
throw new
|
|
2096
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
2082
2097
|
code: "circuit_open"
|
|
2083
2098
|
});
|
|
2084
2099
|
}
|
|
@@ -2097,7 +2112,7 @@ var PoolAwareLlmClient = class {
|
|
|
2097
2112
|
}
|
|
2098
2113
|
if (entry === null) {
|
|
2099
2114
|
this.breaker.recordTimeout(this.pool.provider);
|
|
2100
|
-
throw new
|
|
2115
|
+
throw new chunkCEGU5AVD_cjs.CredentialPoolExhaustedError(
|
|
2101
2116
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
2102
2117
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
2103
2118
|
);
|
|
@@ -2129,7 +2144,7 @@ var PoolAwareLlmClient = class {
|
|
|
2129
2144
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
2130
2145
|
});
|
|
2131
2146
|
} catch (persistErr) {
|
|
2132
|
-
|
|
2147
|
+
chunkRNXXYF22_cjs.diag(
|
|
2133
2148
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
2134
2149
|
`
|
|
2135
2150
|
);
|
|
@@ -2151,8 +2166,8 @@ var PoolAwareLlmClient = class {
|
|
|
2151
2166
|
}
|
|
2152
2167
|
};
|
|
2153
2168
|
function classifyAndDecide(error, hasRetried429) {
|
|
2154
|
-
if (error instanceof
|
|
2155
|
-
if (error instanceof
|
|
2169
|
+
if (error instanceof chunkCEGU5AVD_cjs.NetworkError) return "propagate";
|
|
2170
|
+
if (error instanceof chunkCEGU5AVD_cjs.AuthenticationError) return "rotate";
|
|
2156
2171
|
const status = error.metadata?.statusCode ?? 429;
|
|
2157
2172
|
if (status === 402) return "rotate";
|
|
2158
2173
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2165,8 +2180,8 @@ function parseRetryAfterMs(error) {
|
|
|
2165
2180
|
return void 0;
|
|
2166
2181
|
}
|
|
2167
2182
|
function inferStatusCode(error) {
|
|
2168
|
-
if (error instanceof
|
|
2169
|
-
if (error instanceof
|
|
2183
|
+
if (error instanceof chunkCEGU5AVD_cjs.AuthenticationError) return 401;
|
|
2184
|
+
if (error instanceof chunkCEGU5AVD_cjs.RateLimitError) return 429;
|
|
2170
2185
|
return 0;
|
|
2171
2186
|
}
|
|
2172
2187
|
|
|
@@ -2384,11 +2399,11 @@ var ResponsesStreamAccumulator = class {
|
|
|
2384
2399
|
}
|
|
2385
2400
|
applyUsage(usage) {
|
|
2386
2401
|
if (usage === void 0) return;
|
|
2387
|
-
this.inputTokens = usage.input_tokens;
|
|
2388
2402
|
this.outputTokens = usage.output_tokens;
|
|
2389
2403
|
this.reasoningTokens = usage.output_tokens_details?.reasoning_tokens;
|
|
2390
2404
|
this.cacheReadTokens = usage.input_tokens_details?.cached_tokens;
|
|
2391
2405
|
this.cacheWriteTokens = usage.input_tokens_details?.cache_write_tokens;
|
|
2406
|
+
this.inputTokens = netOfCache(usage.input_tokens, this.cacheReadTokens, this.cacheWriteTokens);
|
|
2392
2407
|
}
|
|
2393
2408
|
};
|
|
2394
2409
|
var MAX_REMEMBERED_REASONING_CALLS = 256;
|
|
@@ -2454,7 +2469,7 @@ var ResponsesApiClient = class {
|
|
|
2454
2469
|
body = JSON.parse(text);
|
|
2455
2470
|
} catch {
|
|
2456
2471
|
}
|
|
2457
|
-
return
|
|
2472
|
+
return chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
2458
2473
|
providerId,
|
|
2459
2474
|
status: response.status,
|
|
2460
2475
|
body,
|
|
@@ -2490,7 +2505,7 @@ var ResponsesApiClient = class {
|
|
|
2490
2505
|
const failure = ResponsesStreamAccumulator.failureMessage(event);
|
|
2491
2506
|
if (failure !== void 0) {
|
|
2492
2507
|
yield { type: "error", message: failure };
|
|
2493
|
-
throw
|
|
2508
|
+
throw chunkNP362THY_cjs.mapOpenAICompatibleError({
|
|
2494
2509
|
providerId,
|
|
2495
2510
|
status: 502,
|
|
2496
2511
|
body: { error: { message: failure } },
|
|
@@ -2508,14 +2523,14 @@ var ResponsesApiClient = class {
|
|
|
2508
2523
|
// src/internal/llm/retrying-client.ts
|
|
2509
2524
|
var MAX_ATTEMPTS = 3;
|
|
2510
2525
|
function isRetriableError(err) {
|
|
2511
|
-
if (!
|
|
2512
|
-
if (err instanceof
|
|
2513
|
-
if (err instanceof
|
|
2514
|
-
if (err instanceof
|
|
2526
|
+
if (!chunkCEGU5AVD_cjs.isTransientError(err)) return false;
|
|
2527
|
+
if (err instanceof chunkCEGU5AVD_cjs.CredentialPoolExhaustedError) return false;
|
|
2528
|
+
if (err instanceof chunkCEGU5AVD_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2529
|
+
if (err instanceof chunkCEGU5AVD_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2515
2530
|
return true;
|
|
2516
2531
|
}
|
|
2517
2532
|
function retryAfterHintMs(err) {
|
|
2518
|
-
if (!(err instanceof
|
|
2533
|
+
if (!(err instanceof chunkCEGU5AVD_cjs.RateLimitError)) return void 0;
|
|
2519
2534
|
const seconds = err.metadata?.retryAfter;
|
|
2520
2535
|
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2521
2536
|
}
|
|
@@ -2567,7 +2582,7 @@ var RetryingLlmClient = class {
|
|
|
2567
2582
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2568
2583
|
});
|
|
2569
2584
|
const cause = err instanceof Error ? err.name : typeof err;
|
|
2570
|
-
|
|
2585
|
+
chunkRNXXYF22_cjs.diag(
|
|
2571
2586
|
`retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
|
|
2572
2587
|
);
|
|
2573
2588
|
await chunkQOGNZMHD_cjs.sleepWithAbort(ms, signal);
|
|
@@ -2604,11 +2619,11 @@ function classifyVertexError(args, errStatus) {
|
|
|
2604
2619
|
for (const rule of VERTEX_RULES) {
|
|
2605
2620
|
if (rule.test(args.status, errStatus)) return rule.code;
|
|
2606
2621
|
}
|
|
2607
|
-
const shared =
|
|
2622
|
+
const shared = chunkNP362THY_cjs.httpStatusToErrorCode(args.status);
|
|
2608
2623
|
return shared === "auth_failed" ? "auth_permission" : shared;
|
|
2609
2624
|
}
|
|
2610
2625
|
function vertexMetadata(args, code) {
|
|
2611
|
-
return
|
|
2626
|
+
return chunkNP362THY_cjs.buildErrorMetadata({
|
|
2612
2627
|
provider: "vertex",
|
|
2613
2628
|
endpoint: args.endpoint,
|
|
2614
2629
|
code,
|
|
@@ -2618,29 +2633,29 @@ function vertexMetadata(args, code) {
|
|
|
2618
2633
|
});
|
|
2619
2634
|
}
|
|
2620
2635
|
var VERTEX_ERROR_BUILDERS = {
|
|
2621
|
-
rate_limit: (args, msg) => new
|
|
2636
|
+
rate_limit: (args, msg) => new chunkCEGU5AVD_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2622
2637
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2623
2638
|
}),
|
|
2624
|
-
auth_unauthenticated: (args, msg) => new
|
|
2639
|
+
auth_unauthenticated: (args, msg) => new chunkCEGU5AVD_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2625
2640
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2626
2641
|
}),
|
|
2627
|
-
auth_permission: (args, msg) => new
|
|
2642
|
+
auth_permission: (args, msg) => new chunkCEGU5AVD_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2628
2643
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2629
2644
|
}),
|
|
2630
|
-
invalid_request: (args, msg) => new
|
|
2645
|
+
invalid_request: (args, msg) => new chunkCEGU5AVD_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2631
2646
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2632
2647
|
}),
|
|
2633
|
-
quota_exceeded: (args, msg) => new
|
|
2648
|
+
quota_exceeded: (args, msg) => new chunkCEGU5AVD_cjs.RateLimitError(`Vertex quota exceeded: ${msg}`, {
|
|
2634
2649
|
metadata: vertexMetadata(args, "quota_exceeded")
|
|
2635
2650
|
}),
|
|
2636
|
-
timeout: (args, msg) => new
|
|
2637
|
-
server_error: (args, msg) => new
|
|
2651
|
+
timeout: (args, msg) => new chunkCEGU5AVD_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2652
|
+
server_error: (args, msg) => new chunkCEGU5AVD_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2638
2653
|
metadata: vertexMetadata(args, "server_error")
|
|
2639
2654
|
}),
|
|
2640
|
-
unknown: (args, msg) => new
|
|
2655
|
+
unknown: (args, msg) => new chunkCEGU5AVD_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2641
2656
|
};
|
|
2642
2657
|
function mapVertexError(args) {
|
|
2643
|
-
const parsed =
|
|
2658
|
+
const parsed = chunkNP362THY_cjs.parseErrorBody(args.body);
|
|
2644
2659
|
const errStatus = parsed.error?.status ?? "";
|
|
2645
2660
|
const message = parsed.error?.message ?? "Vertex request failed";
|
|
2646
2661
|
const code = classifyVertexError(args, errStatus);
|
|
@@ -2662,12 +2677,12 @@ async function resolveVertexAccessToken() {
|
|
|
2662
2677
|
async function getAuthClientOrThrow() {
|
|
2663
2678
|
let mod;
|
|
2664
2679
|
try {
|
|
2665
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2680
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
|
|
2666
2681
|
mod = r("google-auth-library");
|
|
2667
2682
|
} catch (err) {
|
|
2668
2683
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2669
2684
|
if (isModuleMissing) {
|
|
2670
|
-
throw new
|
|
2685
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2671
2686
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2672
2687
|
{ code: "auth_failed", cause: err }
|
|
2673
2688
|
);
|
|
@@ -2678,7 +2693,7 @@ async function getAuthClientOrThrow() {
|
|
|
2678
2693
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2679
2694
|
return await auth.getClient();
|
|
2680
2695
|
} catch (err) {
|
|
2681
|
-
|
|
2696
|
+
chunkRNXXYF22_cjs.diag(
|
|
2682
2697
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2683
2698
|
`
|
|
2684
2699
|
);
|
|
@@ -2704,7 +2719,7 @@ var VertexAnthropicClient = class {
|
|
|
2704
2719
|
resolveProjectOrThrow() {
|
|
2705
2720
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2706
2721
|
if (projectId !== void 0) return projectId;
|
|
2707
|
-
throw new
|
|
2722
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2708
2723
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2709
2724
|
{ code: "auth_failed" }
|
|
2710
2725
|
);
|
|
@@ -2714,7 +2729,7 @@ var VertexAnthropicClient = class {
|
|
|
2714
2729
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2715
2730
|
const fromAdc = await resolveVertexAccessToken();
|
|
2716
2731
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2717
|
-
throw new
|
|
2732
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2718
2733
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2719
2734
|
{ code: "auth_failed" }
|
|
2720
2735
|
);
|
|
@@ -2723,8 +2738,8 @@ var VertexAnthropicClient = class {
|
|
|
2723
2738
|
const projectId = this.resolveProjectOrThrow();
|
|
2724
2739
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2725
2740
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2726
|
-
const baseUrl =
|
|
2727
|
-
const bareModel =
|
|
2741
|
+
const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2742
|
+
const bareModel = chunkS46WJTDL_cjs.stripVertexPrefix(request.model);
|
|
2728
2743
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2729
2744
|
const url = `${baseUrl}${endpoint}`;
|
|
2730
2745
|
const response = await postAnthropicRequest({
|
|
@@ -2760,7 +2775,7 @@ var VertexGeminiClient = class {
|
|
|
2760
2775
|
async *stream(request, signal) {
|
|
2761
2776
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2762
2777
|
if (projectId === void 0) {
|
|
2763
|
-
throw new
|
|
2778
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2764
2779
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2765
2780
|
{ code: "auth_failed" }
|
|
2766
2781
|
);
|
|
@@ -2768,12 +2783,12 @@ var VertexGeminiClient = class {
|
|
|
2768
2783
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2769
2784
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2770
2785
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2771
|
-
throw new
|
|
2786
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2772
2787
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2773
2788
|
{ code: "auth_failed" }
|
|
2774
2789
|
);
|
|
2775
2790
|
}
|
|
2776
|
-
const baseUrl =
|
|
2791
|
+
const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2777
2792
|
const url = `${baseUrl}/chat/completions`;
|
|
2778
2793
|
const innerFetch = chunkEHD25JBZ_cjs.boundFetch(this.options.fetch);
|
|
2779
2794
|
const rewriteFetch = (_input, init) => innerFetch(url, init);
|
|
@@ -2795,7 +2810,7 @@ var VertexRouterClient = class {
|
|
|
2795
2810
|
options;
|
|
2796
2811
|
name = "vertex";
|
|
2797
2812
|
async *stream(request, signal) {
|
|
2798
|
-
const dialect =
|
|
2813
|
+
const dialect = chunkS46WJTDL_cjs.inferModelDialect(request.model);
|
|
2799
2814
|
if (dialect === "anthropic") {
|
|
2800
2815
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2801
2816
|
return yield* inner2.stream(request, signal);
|
|
@@ -2807,7 +2822,7 @@ var VertexRouterClient = class {
|
|
|
2807
2822
|
|
|
2808
2823
|
// src/internal/llm/router.ts
|
|
2809
2824
|
function resolveProviderChain(options) {
|
|
2810
|
-
|
|
2825
|
+
chunkS46WJTDL_cjs.registerBuiltins();
|
|
2811
2826
|
return buildChain(options);
|
|
2812
2827
|
}
|
|
2813
2828
|
function buildChain(options) {
|
|
@@ -2815,7 +2830,7 @@ function buildChain(options) {
|
|
|
2815
2830
|
const seen = /* @__PURE__ */ new Set();
|
|
2816
2831
|
const clients = [];
|
|
2817
2832
|
const addClient = (name, perCallBaseUrl) => {
|
|
2818
|
-
const lowered = name
|
|
2833
|
+
const lowered = normalizeProviderName(name);
|
|
2819
2834
|
if (seen.has(lowered)) return;
|
|
2820
2835
|
seen.add(lowered);
|
|
2821
2836
|
const client = buildClient(lowered, options, perCallBaseUrl);
|
|
@@ -2824,19 +2839,48 @@ function buildChain(options) {
|
|
|
2824
2839
|
addClient(options.primary, options.baseUrl);
|
|
2825
2840
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2826
2841
|
if (clients.length === 0) {
|
|
2827
|
-
|
|
2842
|
+
if (chunkS46WJTDL_cjs.getProviderProfile(normalizeProviderName(options.primary)) === void 0) {
|
|
2843
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(unregisteredProviderMessage(options.primary), {
|
|
2844
|
+
code: "provider_unresolved"
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2828
2848
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2829
2849
|
{ code: "provider_unresolved" }
|
|
2830
2850
|
);
|
|
2831
2851
|
}
|
|
2832
2852
|
return clients;
|
|
2833
2853
|
}
|
|
2854
|
+
function normalizeProviderName(name) {
|
|
2855
|
+
return name.toLowerCase();
|
|
2856
|
+
}
|
|
2857
|
+
function unregisteredProviderMessage(name) {
|
|
2858
|
+
const normalized = normalizeProviderName(name);
|
|
2859
|
+
const caseOnlyMatch = chunkS46WJTDL_cjs.listProviders().find(
|
|
2860
|
+
(profile) => normalizeProviderName(profile.name) === normalized
|
|
2861
|
+
);
|
|
2862
|
+
if (caseOnlyMatch !== void 0) {
|
|
2863
|
+
return `No provider client could be resolved: "${name}" matches the registered provider "${caseOnlyMatch.name}" only when case is ignored, and routes look provider names up in lowercase. Register the provider as "${normalized}".`;
|
|
2864
|
+
}
|
|
2865
|
+
const aliasMessage = caseOnlyAliasMessage(name, normalized);
|
|
2866
|
+
if (aliasMessage !== void 0) return aliasMessage;
|
|
2867
|
+
const registered = chunkS46WJTDL_cjs.listProviders().map((profile) => profile.name).sort((a, b) => a.localeCompare(b)).join(", ");
|
|
2868
|
+
return `No provider client could be resolved: "${name}" is not a known provider. Registered providers: ${registered}.`;
|
|
2869
|
+
}
|
|
2870
|
+
function caseOnlyAliasMessage(name, normalized) {
|
|
2871
|
+
for (const profile of chunkS46WJTDL_cjs.listProviders()) {
|
|
2872
|
+
const alias = profile.aliases?.find((entry) => normalizeProviderName(entry) === normalized);
|
|
2873
|
+
if (alias === void 0) continue;
|
|
2874
|
+
return `No provider client could be resolved: "${name}" matches the alias "${alias}" of the registered provider "${profile.name}" only when case is ignored, and routes look provider names up in lowercase. Register the alias as "${normalized}", or route to "${profile.name}".`;
|
|
2875
|
+
}
|
|
2876
|
+
return void 0;
|
|
2877
|
+
}
|
|
2834
2878
|
function buildTransport(name, routerOptions, perCallBaseUrl) {
|
|
2835
|
-
const baseProfile =
|
|
2879
|
+
const baseProfile = chunkS46WJTDL_cjs.getProviderProfile(name);
|
|
2836
2880
|
if (baseProfile === void 0) return void 0;
|
|
2837
2881
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2838
2882
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2839
|
-
const ambient =
|
|
2883
|
+
const ambient = chunkSXH37C7X_cjs.currentCredentialPool(name);
|
|
2840
2884
|
if (ambient !== void 0) {
|
|
2841
2885
|
return new PoolAwareLlmClient(
|
|
2842
2886
|
ambient,
|
|
@@ -2868,9 +2912,9 @@ function buildPoolOrSingle(args) {
|
|
|
2868
2912
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2869
2913
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2870
2914
|
const entries = poolKeys.map(
|
|
2871
|
-
(accessToken, priority) =>
|
|
2915
|
+
(accessToken, priority) => chunkSXH37C7X_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2872
2916
|
);
|
|
2873
|
-
const pool = new
|
|
2917
|
+
const pool = new chunkSXH37C7X_cjs.CredentialPool(name, entries, strategy);
|
|
2874
2918
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2875
2919
|
return new PoolAwareLlmClient(
|
|
2876
2920
|
pool,
|
|
@@ -2901,7 +2945,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2901
2945
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2902
2946
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2903
2947
|
warnedNoAuthApiKeys.add(provider);
|
|
2904
|
-
|
|
2948
|
+
chunkRNXXYF22_cjs.diag(
|
|
2905
2949
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2906
2950
|
`
|
|
2907
2951
|
);
|
|
@@ -2927,10 +2971,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2927
2971
|
if (apiKeys === void 0) return;
|
|
2928
2972
|
for (const name of Object.keys(apiKeys)) {
|
|
2929
2973
|
if (warnedProviders.has(name)) continue;
|
|
2930
|
-
const profile =
|
|
2974
|
+
const profile = chunkS46WJTDL_cjs.getProviderProfile(name);
|
|
2931
2975
|
if (profile === void 0) {
|
|
2932
2976
|
warnedProviders.add(name);
|
|
2933
|
-
|
|
2977
|
+
chunkRNXXYF22_cjs.diag(
|
|
2934
2978
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2935
2979
|
`
|
|
2936
2980
|
);
|
|
@@ -2962,7 +3006,7 @@ function selectTransport(profile, apiKey, baseUrl) {
|
|
|
2962
3006
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2963
3007
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2964
3008
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2965
|
-
throw new
|
|
3009
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2966
3010
|
`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".`
|
|
2967
3011
|
);
|
|
2968
3012
|
}
|
|
@@ -3021,7 +3065,7 @@ function selectTransport(profile, apiKey, baseUrl) {
|
|
|
3021
3065
|
providerName: profile.name
|
|
3022
3066
|
});
|
|
3023
3067
|
}
|
|
3024
|
-
throw new
|
|
3068
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3025
3069
|
`Provider "${profile.name}" declares apiMode "${profile.apiMode}", which this SDK has no transport for. Transports are built in and cannot be extended by a plugin; the supported modes are "chat_completions", "anthropic_messages", "bedrock_anthropic" and "responses_api". Change the provider's apiMode to one of those, or open an issue if the provider genuinely speaks a fifth protocol.`,
|
|
3026
3070
|
{ code: "transport_unavailable" }
|
|
3027
3071
|
);
|
|
@@ -3102,7 +3146,7 @@ function checkProviderPrefix(key, provider) {
|
|
|
3102
3146
|
function registerPluginProviderProfiles(entries) {
|
|
3103
3147
|
let registered = 0;
|
|
3104
3148
|
for (const entry of entries) {
|
|
3105
|
-
|
|
3149
|
+
chunkS46WJTDL_cjs.registerProvider(entry.profile);
|
|
3106
3150
|
registered += 1;
|
|
3107
3151
|
}
|
|
3108
3152
|
return registered;
|
|
@@ -3126,7 +3170,7 @@ var AMBIENT_STORE = {
|
|
|
3126
3170
|
};
|
|
3127
3171
|
function isStoredOAuthAvailable(env = process.env) {
|
|
3128
3172
|
try {
|
|
3129
|
-
return
|
|
3173
|
+
return chunkQISSETTG_cjs.readStoredOAuth(AMBIENT_STORE, env) !== void 0;
|
|
3130
3174
|
} catch {
|
|
3131
3175
|
return false;
|
|
3132
3176
|
}
|
|
@@ -3186,7 +3230,7 @@ function shouldUseRealLocalRuntime(apiKey) {
|
|
|
3186
3230
|
function inferProviderFromApiKey(apiKey) {
|
|
3187
3231
|
const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
|
|
3188
3232
|
if (provider === void 0) return void 0;
|
|
3189
|
-
return
|
|
3233
|
+
return chunkS46WJTDL_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
3190
3234
|
}
|
|
3191
3235
|
function detectPrimaryProvider() {
|
|
3192
3236
|
if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
|
|
@@ -3206,24 +3250,24 @@ function warnProviderPrecedenceOnce(asked, used) {
|
|
|
3206
3250
|
const key = `${asked}->${used}`;
|
|
3207
3251
|
if (warnedProviderPrecedence.has(key)) return;
|
|
3208
3252
|
warnedProviderPrecedence.add(key);
|
|
3209
|
-
|
|
3253
|
+
chunkRNXXYF22_cjs.diag(
|
|
3210
3254
|
`[theokit-sdk] model id names provider "${asked}", but "${used}" was used \u2014 an explicit \`providers.routes[0]\` or the API key's own prefix outranks the model id's prefix. Pass \`providers.routes\` to choose deliberately.
|
|
3211
3255
|
`
|
|
3212
3256
|
);
|
|
3213
3257
|
}
|
|
3214
3258
|
var pluginProvidersAnnounced = false;
|
|
3215
3259
|
function resolveRunProvider(options) {
|
|
3216
|
-
|
|
3260
|
+
chunkS46WJTDL_cjs.registerBuiltins();
|
|
3217
3261
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
3218
3262
|
const registered = registerPluginProviderProfiles(profiles);
|
|
3219
3263
|
if (registered > 0 && !pluginProvidersAnnounced) {
|
|
3220
3264
|
pluginProvidersAnnounced = true;
|
|
3221
3265
|
const names = profiles.map((e) => e.profile.name).join(", ");
|
|
3222
|
-
|
|
3266
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] registered ${registered} plugin provider profile(s): ${names}
|
|
3223
3267
|
`);
|
|
3224
3268
|
}
|
|
3225
3269
|
const parsedModel = chunk3EE6LVWT_cjs.parseModelId(options.model?.id);
|
|
3226
|
-
const modelInferredProvider = parsedModel.provider !== void 0 &&
|
|
3270
|
+
const modelInferredProvider = parsedModel.provider !== void 0 && chunkS46WJTDL_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
3227
3271
|
const keyInferredProvider = inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
3228
3272
|
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? detectPrimaryProvider();
|
|
3229
3273
|
warnProviderPrecedenceOnce(modelInferredProvider, primary);
|
|
@@ -3254,13 +3298,13 @@ async function compressConversationWindow(opts) {
|
|
|
3254
3298
|
try {
|
|
3255
3299
|
summary = await opts.callLlm(opts.model, COMPRESSION_SYSTEM, userPrompt);
|
|
3256
3300
|
} catch (cause) {
|
|
3257
|
-
throw new
|
|
3301
|
+
throw new chunkCEGU5AVD_cjs.CompressionFailedError(
|
|
3258
3302
|
`Compression LLM call failed: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
3259
3303
|
{ cause: cause instanceof Error ? cause : void 0 }
|
|
3260
3304
|
);
|
|
3261
3305
|
}
|
|
3262
3306
|
if (!summary || summary.trim().length === 0) {
|
|
3263
|
-
throw new
|
|
3307
|
+
throw new chunkCEGU5AVD_cjs.CompressionFailedError(
|
|
3264
3308
|
"Compression LLM returned empty summary \u2014 reduction ineffective."
|
|
3265
3309
|
);
|
|
3266
3310
|
}
|
|
@@ -3306,7 +3350,7 @@ async function runPreCompactBounded(handler, ctx, timeoutMs, onError) {
|
|
|
3306
3350
|
}
|
|
3307
3351
|
async function compactSessionTranscript(opts) {
|
|
3308
3352
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
3309
|
-
const history =
|
|
3353
|
+
const history = chunk3WKWBYPO_cjs.reconstructMessages(prior);
|
|
3310
3354
|
const compressible = [];
|
|
3311
3355
|
for (const m of history) {
|
|
3312
3356
|
const text = plainText(m.content);
|
|
@@ -3314,7 +3358,7 @@ async function compactSessionTranscript(opts) {
|
|
|
3314
3358
|
compressible.push({ role: m.role, content: text });
|
|
3315
3359
|
}
|
|
3316
3360
|
}
|
|
3317
|
-
const preTokens =
|
|
3361
|
+
const preTokens = chunkKX5QXLBS_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
3318
3362
|
if (opts.onPreCompact !== void 0) {
|
|
3319
3363
|
await runPreCompactBounded(
|
|
3320
3364
|
opts.onPreCompact,
|
|
@@ -3329,7 +3373,7 @@ async function compactSessionTranscript(opts) {
|
|
|
3329
3373
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
3330
3374
|
const m = compressible[i];
|
|
3331
3375
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
3332
|
-
const cost =
|
|
3376
|
+
const cost = chunkKX5QXLBS_cjs.estimateTokens(m.content);
|
|
3333
3377
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
3334
3378
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
3335
3379
|
if (remaining > 50) {
|
|
@@ -3343,7 +3387,7 @@ async function compactSessionTranscript(opts) {
|
|
|
3343
3387
|
}
|
|
3344
3388
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
3345
3389
|
${summaryBody}`;
|
|
3346
|
-
const transcript =
|
|
3390
|
+
const transcript = chunk3WKWBYPO_cjs.SessionTranscript.fromRecords(prior, {
|
|
3347
3391
|
cwd: opts.loc.cwd,
|
|
3348
3392
|
sessionId: opts.sessionId,
|
|
3349
3393
|
model: opts.loc.model ?? "unknown"
|
|
@@ -3354,7 +3398,7 @@ ${summaryBody}`;
|
|
|
3354
3398
|
const delta = transcript.records().slice(prior.length);
|
|
3355
3399
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
3356
3400
|
chunkYJNYDJ2T_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
3357
|
-
const postTokens =
|
|
3401
|
+
const postTokens = chunkKX5QXLBS_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
3358
3402
|
return { preTokens, postTokens };
|
|
3359
3403
|
}
|
|
3360
3404
|
function resolveSummarizerRoute(opts) {
|
|
@@ -3363,9 +3407,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
3363
3407
|
}
|
|
3364
3408
|
function buildDefaultSummarizer(opts) {
|
|
3365
3409
|
return async (messages) => {
|
|
3366
|
-
|
|
3410
|
+
chunkS46WJTDL_cjs.registerBuiltins();
|
|
3367
3411
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
3368
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
3412
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkS46WJTDL_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
3369
3413
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
3370
3414
|
const route = resolveSummarizerRoute({
|
|
3371
3415
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3379,7 +3423,7 @@ function buildDefaultSummarizer(opts) {
|
|
|
3379
3423
|
model = opts.agentModel;
|
|
3380
3424
|
} else {
|
|
3381
3425
|
try {
|
|
3382
|
-
model =
|
|
3426
|
+
model = chunkKX5QXLBS_cjs.resolveCompressionModel(opts.agentModel);
|
|
3383
3427
|
} catch {
|
|
3384
3428
|
model = opts.agentModel;
|
|
3385
3429
|
}
|
|
@@ -3434,7 +3478,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3434
3478
|
return true;
|
|
3435
3479
|
} catch (cause) {
|
|
3436
3480
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3437
|
-
|
|
3481
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3438
3482
|
`);
|
|
3439
3483
|
return false;
|
|
3440
3484
|
}
|
|
@@ -3471,5 +3515,5 @@ exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
|
3471
3515
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3472
3516
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3473
3517
|
exports.validateApiKeyShape = validateApiKeyShape;
|
|
3474
|
-
//# sourceMappingURL=chunk-
|
|
3475
|
-
//# sourceMappingURL=chunk-
|
|
3518
|
+
//# sourceMappingURL=chunk-LSWHDOCL.cjs.map
|
|
3519
|
+
//# sourceMappingURL=chunk-LSWHDOCL.cjs.map
|