@theokit/sdk 4.52.1 → 4.53.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 +48 -8
- package/LICENSE +2 -2
- package/README.md +5 -5
- package/bin/theokit-migrate-config.mjs +11 -2
- package/dist/{agent-BiCINq25.d.ts → agent-B9HXlwID.d.ts} +21 -8
- package/dist/agent-FFVV4U5N.js +50 -0
- package/dist/{agent-RDHK6MVT.js.map → agent-FFVV4U5N.js.map} +1 -1
- package/dist/agent-YLAHVHEH.cjs +59 -0
- package/dist/{agent-U2R2R5JP.cjs.map → agent-YLAHVHEH.cjs.map} +1 -1
- package/dist/{agent-Zta1kvGH.d.cts → agent-nLqeXKIX.d.cts} +21 -8
- package/dist/agent-session-store-DUGBAX5V.cjs +23 -0
- package/dist/{agent-session-store-EPX2WQI4.cjs.map → agent-session-store-DUGBAX5V.cjs.map} +1 -1
- package/dist/agent-session-store-TNCGL5RN.js +6 -0
- package/dist/{agent-session-store-JMU7ASDB.js.map → agent-session-store-TNCGL5RN.js.map} +1 -1
- package/dist/agent.d.ts +16 -1
- package/dist/auth/index.cjs +29 -28
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +6 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-NLIS4QTW.js → batch-UPKN4SG6.js} +9 -9
- package/dist/{batch-NLIS4QTW.js.map → batch-UPKN4SG6.js.map} +1 -1
- package/dist/{batch-WQ3AJCDV.cjs → batch-ZEFN5SO7.cjs} +26 -26
- package/dist/{batch-WQ3AJCDV.cjs.map → batch-ZEFN5SO7.cjs.map} +1 -1
- package/dist/{chunk-CY7MIMI4.cjs → chunk-2D43RD5D.cjs} +8 -8
- package/dist/{chunk-CY7MIMI4.cjs.map → chunk-2D43RD5D.cjs.map} +1 -1
- package/dist/{chunk-WLESQ3ZQ.cjs → chunk-2FYEVT2B.cjs} +121 -121
- package/dist/{chunk-WLESQ3ZQ.cjs.map → chunk-2FYEVT2B.cjs.map} +1 -1
- package/dist/{chunk-BBZYXVLZ.cjs → chunk-2ZPEDVLM.cjs} +2 -2
- package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
- package/dist/{chunk-T6QUCG7L.cjs → chunk-3BK6YR5P.cjs} +4 -4
- package/dist/{chunk-T6QUCG7L.cjs.map → chunk-3BK6YR5P.cjs.map} +1 -1
- package/dist/chunk-3V7UJLQT.js +147 -0
- package/dist/chunk-3V7UJLQT.js.map +1 -0
- package/dist/{chunk-ITQ4NO4P.js → chunk-3WVMJY7F.js} +3 -3
- package/dist/{chunk-ITQ4NO4P.js.map → chunk-3WVMJY7F.js.map} +1 -1
- package/dist/{chunk-RAACTJ7C.cjs → chunk-3X6PM7DU.cjs} +4 -4
- package/dist/{chunk-RAACTJ7C.cjs.map → chunk-3X6PM7DU.cjs.map} +1 -1
- package/dist/{chunk-DEZ75ET5.js → chunk-4Q4K4WB5.js} +3 -3
- package/dist/{chunk-DEZ75ET5.js.map → chunk-4Q4K4WB5.js.map} +1 -1
- package/dist/{chunk-4X3SBHPK.js → chunk-5F5NWKPN.js} +20 -4
- package/dist/chunk-5F5NWKPN.js.map +1 -0
- package/dist/chunk-5YKNEMXR.cjs +155 -0
- package/dist/chunk-5YKNEMXR.cjs.map +1 -0
- package/dist/{chunk-3YYDHUNH.cjs → chunk-665SFFFR.cjs} +11 -11
- package/dist/{chunk-3YYDHUNH.cjs.map → chunk-665SFFFR.cjs.map} +1 -1
- package/dist/{chunk-CHVSMEKM.js → chunk-6AZDM6LK.js} +3 -3
- package/dist/chunk-6AZDM6LK.js.map +1 -0
- package/dist/{chunk-AMYY3JHQ.cjs → chunk-ADLLFY3H.cjs} +9 -9
- package/dist/{chunk-AMYY3JHQ.cjs.map → chunk-ADLLFY3H.cjs.map} +1 -1
- package/dist/{chunk-J4RY5DTI.js → chunk-B6HOIWQ6.js} +5 -5
- package/dist/{chunk-J4RY5DTI.js.map → chunk-B6HOIWQ6.js.map} +1 -1
- package/dist/{chunk-EQMLJ52C.cjs → chunk-BDTVFIPB.cjs} +26 -26
- package/dist/{chunk-EQMLJ52C.cjs.map → chunk-BDTVFIPB.cjs.map} +1 -1
- package/dist/{chunk-UJ3SXRZZ.js → chunk-BERBYXFH.js} +3 -3
- package/dist/{chunk-UJ3SXRZZ.js.map → chunk-BERBYXFH.js.map} +1 -1
- package/dist/{chunk-KZBB4YKU.js → chunk-BFYGJGC5.js} +3 -3
- package/dist/{chunk-KZBB4YKU.js.map → chunk-BFYGJGC5.js.map} +1 -1
- package/dist/{chunk-SXSPMRSV.cjs → chunk-BM6N4KHO.cjs} +21 -3
- package/dist/chunk-BM6N4KHO.cjs.map +1 -0
- package/dist/{chunk-2CFEET3Y.cjs → chunk-C4H6PB5J.cjs} +4 -4
- package/dist/chunk-C4H6PB5J.cjs.map +1 -0
- package/dist/{chunk-NFATC6ZF.cjs → chunk-C5DEO6OI.cjs} +4 -4
- package/dist/{chunk-NFATC6ZF.cjs.map → chunk-C5DEO6OI.cjs.map} +1 -1
- package/dist/{chunk-EUBGGYPH.cjs → chunk-CZ2GKKYL.cjs} +5 -5
- package/dist/{chunk-EUBGGYPH.cjs.map → chunk-CZ2GKKYL.cjs.map} +1 -1
- package/dist/{chunk-I732VEDW.js → chunk-D24WJWN2.js} +3 -3
- package/dist/{chunk-I732VEDW.js.map → chunk-D24WJWN2.js.map} +1 -1
- package/dist/{chunk-3R4ZCQAZ.cjs → chunk-D75S2X6I.cjs} +5 -5
- package/dist/{chunk-3R4ZCQAZ.cjs.map → chunk-D75S2X6I.cjs.map} +1 -1
- package/dist/{chunk-5XXUYU3M.js → chunk-DGOG5NXR.js} +3 -3
- package/dist/{chunk-5XXUYU3M.js.map → chunk-DGOG5NXR.js.map} +1 -1
- package/dist/{chunk-RTLUZKDL.cjs → chunk-E7FJOO4G.cjs} +11 -11
- package/dist/{chunk-RTLUZKDL.cjs.map → chunk-E7FJOO4G.cjs.map} +1 -1
- package/dist/{chunk-BWGXYOBZ.cjs → chunk-ELKO4ZLR.cjs} +4 -4
- package/dist/{chunk-BWGXYOBZ.cjs.map → chunk-ELKO4ZLR.cjs.map} +1 -1
- package/dist/{chunk-FBZMSLDC.cjs → chunk-EZ2YEF4F.cjs} +4 -4
- package/dist/{chunk-FBZMSLDC.cjs.map → chunk-EZ2YEF4F.cjs.map} +1 -1
- package/dist/{chunk-6GS7JI64.cjs → chunk-F77UENR6.cjs} +343 -324
- package/dist/chunk-F77UENR6.cjs.map +1 -0
- package/dist/{chunk-OZXPA3ME.js → chunk-FFM3SJTQ.js} +4 -4
- package/dist/{chunk-OZXPA3ME.js.map → chunk-FFM3SJTQ.js.map} +1 -1
- package/dist/{chunk-PLUCC4N5.js → chunk-FIOCJYLA.js} +3 -3
- package/dist/{chunk-PLUCC4N5.js.map → chunk-FIOCJYLA.js.map} +1 -1
- package/dist/{chunk-Z5U2JGEK.cjs → chunk-FOXKFTVZ.cjs} +11 -11
- package/dist/{chunk-Z5U2JGEK.cjs.map → chunk-FOXKFTVZ.cjs.map} +1 -1
- package/dist/{chunk-K42QGAKM.cjs → chunk-FPYT5WZP.cjs} +10 -10
- package/dist/{chunk-K42QGAKM.cjs.map → chunk-FPYT5WZP.cjs.map} +1 -1
- package/dist/{chunk-KELIQH7K.js → chunk-G3JWXOGY.js} +78 -58
- package/dist/chunk-G3JWXOGY.js.map +1 -0
- package/dist/{chunk-DHVNJYTO.js → chunk-GBBDINFK.js} +3 -3
- package/dist/{chunk-DHVNJYTO.js.map → chunk-GBBDINFK.js.map} +1 -1
- package/dist/{chunk-V45L2OYP.cjs → chunk-GD63JPGC.cjs} +9 -9
- package/dist/{chunk-V45L2OYP.cjs.map → chunk-GD63JPGC.cjs.map} +1 -1
- package/dist/{chunk-42PLABFU.js → chunk-GOVJO4YE.js} +5 -5
- package/dist/{chunk-42PLABFU.js.map → chunk-GOVJO4YE.js.map} +1 -1
- package/dist/{chunk-CZHPR2G7.cjs → chunk-HAWE74GQ.cjs} +8 -8
- package/dist/{chunk-CZHPR2G7.cjs.map → chunk-HAWE74GQ.cjs.map} +1 -1
- package/dist/{chunk-KIX45IKP.js → chunk-HE4BIAOS.js} +4 -4
- package/dist/{chunk-KIX45IKP.js.map → chunk-HE4BIAOS.js.map} +1 -1
- package/dist/{chunk-AM2CNBKE.js → chunk-HKCKOAIO.js} +2 -2
- package/dist/chunk-HKCKOAIO.js.map +1 -0
- package/dist/{chunk-V2EJLKGA.js → chunk-HSQ5Q3I5.js} +10 -11
- package/dist/chunk-HSQ5Q3I5.js.map +1 -0
- package/dist/{chunk-QLAWEGTZ.cjs → chunk-JIQRXKTA.cjs} +7 -7
- package/dist/chunk-JIQRXKTA.cjs.map +1 -0
- package/dist/{chunk-EFXJ5C7X.js → chunk-KSWHTR54.js} +5 -5
- package/dist/{chunk-EFXJ5C7X.js.map → chunk-KSWHTR54.js.map} +1 -1
- package/dist/{chunk-6PTCKXD3.js → chunk-LD4MOBFX.js} +8 -8
- package/dist/{chunk-6PTCKXD3.js.map → chunk-LD4MOBFX.js.map} +1 -1
- package/dist/{chunk-2YGIBOUH.cjs → chunk-LPVIRJVF.cjs} +9 -9
- package/dist/chunk-LPVIRJVF.cjs.map +1 -0
- package/dist/{chunk-M5EK7N6R.js → chunk-LS3LMQ23.js} +9 -9
- package/dist/{chunk-M5EK7N6R.js.map → chunk-LS3LMQ23.js.map} +1 -1
- package/dist/{chunk-N43XLTHZ.js → chunk-LTSTGCL6.js} +3 -3
- package/dist/{chunk-N43XLTHZ.js.map → chunk-LTSTGCL6.js.map} +1 -1
- package/dist/{chunk-W4FV7JBH.js → chunk-MSFLYJDY.js} +4 -4
- package/dist/chunk-MSFLYJDY.js.map +1 -0
- package/dist/{chunk-C4EU627W.js → chunk-N5CR3TJZ.js} +4 -4
- package/dist/{chunk-C4EU627W.js.map → chunk-N5CR3TJZ.js.map} +1 -1
- package/dist/{chunk-NACDF3PK.js → chunk-NZL4BNFQ.js} +4 -4
- package/dist/chunk-NZL4BNFQ.js.map +1 -0
- package/dist/{chunk-OI6RHLGC.cjs → chunk-OUOXM36O.cjs} +11 -11
- package/dist/{chunk-OI6RHLGC.cjs.map → chunk-OUOXM36O.cjs.map} +1 -1
- package/dist/{chunk-BXVSBYGW.js → chunk-OY7O3Q6R.js} +5 -5
- package/dist/{chunk-BXVSBYGW.js.map → chunk-OY7O3Q6R.js.map} +1 -1
- package/dist/{chunk-L7EGRCKJ.js → chunk-PBZ7HMBP.js} +4 -4
- package/dist/{chunk-L7EGRCKJ.js.map → chunk-PBZ7HMBP.js.map} +1 -1
- package/dist/{chunk-OIBHY6JQ.js → chunk-PGP7IOJ2.js} +4 -4
- package/dist/{chunk-OIBHY6JQ.js.map → chunk-PGP7IOJ2.js.map} +1 -1
- package/dist/{chunk-R7TKOQMJ.js → chunk-POWRZSK4.js} +3 -3
- package/dist/{chunk-R7TKOQMJ.js.map → chunk-POWRZSK4.js.map} +1 -1
- package/dist/{chunk-R3CKCRK3.cjs → chunk-Q4RESANI.cjs} +4 -4
- package/dist/{chunk-R3CKCRK3.cjs.map → chunk-Q4RESANI.cjs.map} +1 -1
- package/dist/{chunk-ZNEE4WWQ.cjs → chunk-QBTVATSF.cjs} +25 -24
- package/dist/chunk-QBTVATSF.cjs.map +1 -0
- package/dist/{chunk-ZSJPRPN7.js → chunk-R5YZACGK.js} +3 -3
- package/dist/{chunk-ZSJPRPN7.js.map → chunk-R5YZACGK.js.map} +1 -1
- package/dist/{chunk-ADVZIC43.cjs → chunk-RAHSWE5C.cjs} +10 -10
- package/dist/{chunk-ADVZIC43.cjs.map → chunk-RAHSWE5C.cjs.map} +1 -1
- package/dist/{chunk-NOS7PTKP.js → chunk-SEL2ZQMT.js} +7 -7
- package/dist/{chunk-NOS7PTKP.js.map → chunk-SEL2ZQMT.js.map} +1 -1
- package/dist/{chunk-XWCTBGYK.js → chunk-SK4QLUBK.js} +3 -3
- package/dist/chunk-SK4QLUBK.js.map +1 -0
- package/dist/chunk-SSDD676S.js +171 -0
- package/dist/chunk-SSDD676S.js.map +1 -0
- package/dist/{chunk-E3OCRJU6.cjs → chunk-SVO5WPZX.cjs} +11 -11
- package/dist/{chunk-E3OCRJU6.cjs.map → chunk-SVO5WPZX.cjs.map} +1 -1
- package/dist/{chunk-44IISBRZ.cjs → chunk-SZHU7A5B.cjs} +4 -4
- package/dist/{chunk-44IISBRZ.cjs.map → chunk-SZHU7A5B.cjs.map} +1 -1
- package/dist/{chunk-SDJYLCJK.cjs → chunk-TTJ54H3E.cjs} +6 -6
- package/dist/chunk-TTJ54H3E.cjs.map +1 -0
- package/dist/{chunk-HI4ZW62S.js → chunk-U4UJHOSH.js} +4 -4
- package/dist/chunk-U4UJHOSH.js.map +1 -0
- package/dist/{chunk-XGYI2KQH.js → chunk-UFIXH26P.js} +4 -4
- package/dist/{chunk-XGYI2KQH.js.map → chunk-UFIXH26P.js.map} +1 -1
- package/dist/{chunk-JJZ4NIAG.js → chunk-V26QVGUG.js} +7 -6
- package/dist/chunk-V26QVGUG.js.map +1 -0
- package/dist/{chunk-GNPI5IWZ.js → chunk-V6HWJQQV.js} +6 -5
- package/dist/chunk-V6HWJQQV.js.map +1 -0
- package/dist/{chunk-MV4TOCUK.js → chunk-VC5ABJXC.js} +3 -3
- package/dist/{chunk-MV4TOCUK.js.map → chunk-VC5ABJXC.js.map} +1 -1
- package/dist/chunk-VF7X6HDR.cjs +177 -0
- package/dist/chunk-VF7X6HDR.cjs.map +1 -0
- package/dist/{chunk-7HQVDLFI.cjs → chunk-VGPXHHF3.cjs} +11 -9
- package/dist/chunk-VGPXHHF3.cjs.map +1 -0
- package/dist/{chunk-T6ZCG5AP.cjs → chunk-VUKQL3L2.cjs} +18 -19
- package/dist/chunk-VUKQL3L2.cjs.map +1 -0
- package/dist/{chunk-PVBANCWU.cjs → chunk-VW6M4B3Z.cjs} +5 -5
- package/dist/{chunk-PVBANCWU.cjs.map → chunk-VW6M4B3Z.cjs.map} +1 -1
- package/dist/{chunk-KNZU4YO5.cjs → chunk-WQ53UQL4.cjs} +4 -4
- package/dist/{chunk-KNZU4YO5.cjs.map → chunk-WQ53UQL4.cjs.map} +1 -1
- package/dist/{chunk-6DCTL32L.cjs → chunk-XPR366DL.cjs} +17 -17
- package/dist/{chunk-6DCTL32L.cjs.map → chunk-XPR366DL.cjs.map} +1 -1
- package/dist/{chunk-7TB5U7RK.js → chunk-XROIW6BH.js} +6 -6
- package/dist/{chunk-7TB5U7RK.js.map → chunk-XROIW6BH.js.map} +1 -1
- package/dist/{chunk-ECPL5RV6.cjs → chunk-Y4AXQOT4.cjs} +8 -8
- package/dist/{chunk-ECPL5RV6.cjs.map → chunk-Y4AXQOT4.cjs.map} +1 -1
- package/dist/{chunk-E6T264NS.js → chunk-Y4I4EQFK.js} +3 -3
- package/dist/{chunk-E6T264NS.js.map → chunk-Y4I4EQFK.js.map} +1 -1
- package/dist/{chunk-FUASIT3E.cjs → chunk-ZN2DGEY3.cjs} +15 -15
- package/dist/{chunk-FUASIT3E.cjs.map → chunk-ZN2DGEY3.cjs.map} +1 -1
- package/dist/{chunk-YTO5BRBD.cjs → chunk-ZT57WTUJ.cjs} +8 -8
- package/dist/chunk-ZT57WTUJ.cjs.map +1 -0
- package/dist/compact-session-4MNKNMO2.js +21 -0
- package/dist/{compact-session-XLXC2CZN.js.map → compact-session-4MNKNMO2.js.map} +1 -1
- package/dist/compact-session-EPFBQ46Z.cjs +58 -0
- package/dist/{compact-session-FBVWO6B3.cjs.map → compact-session-EPFBQ46Z.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-7USNN6LP.cjs +22 -0
- package/dist/{context-4HGPCOH6.cjs.map → context-7USNN6LP.cjs.map} +1 -1
- package/dist/context-ENXZNF6J.js +5 -0
- package/dist/{context-DCECDKWN.js.map → context-ENXZNF6J.js.map} +1 -1
- package/dist/{cron-DyWQsEG6.d.ts → cron-BMjgFH-_.d.ts} +1 -1
- package/dist/{cron-DgHJnMAK.d.cts → cron-DFDdCdMM.d.cts} +1 -1
- package/dist/cron.cjs +33 -32
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +32 -31
- package/dist/errors.cjs +21 -21
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +43 -42
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +33 -32
- package/dist/eval.js.map +1 -1
- package/dist/{executor-4SW7QGZ4.cjs → executor-2Z3LGG3I.cjs} +24 -24
- package/dist/{executor-4SW7QGZ4.cjs.map → executor-2Z3LGG3I.cjs.map} +1 -1
- package/dist/{executor-3CGPLVJL.js → executor-2Z6XJJJG.js} +7 -7
- package/dist/{executor-3CGPLVJL.js.map → executor-2Z6XJJJG.js.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-R5FD3EN6.js +10 -0
- package/dist/{fs-session-store-2TF3ZWMT.js.map → fs-session-store-R5FD3EN6.js.map} +1 -1
- package/dist/fs-session-store-VVY2AHWG.cjs +19 -0
- package/dist/{fs-session-store-TL4RJTXZ.cjs.map → fs-session-store-VVY2AHWG.cjs.map} +1 -1
- package/dist/generate-object-AVXOJK2I.cjs +20 -0
- package/dist/{generate-object-E465DX5I.cjs.map → generate-object-AVXOJK2I.cjs.map} +1 -1
- package/dist/generate-object-WQRCXFD2.js +7 -0
- package/dist/{generate-object-TVQCW2IZ.js.map → generate-object-WQRCXFD2.js.map} +1 -1
- package/dist/index-manager-VRU3A2YL.cjs +21 -0
- package/dist/{index-manager-HGGL4DD5.cjs.map → index-manager-VRU3A2YL.cjs.map} +1 -1
- package/dist/index-manager-WS7TVKUW.js +12 -0
- package/dist/{index-manager-EA6FGIQG.js.map → index-manager-WS7TVKUW.js.map} +1 -1
- package/dist/index.cjs +143 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -8
- package/dist/index.d.ts +64 -8
- package/dist/index.js +45 -44
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-UBAQ7I3G.cjs → inject-session-AUQLBDRS.cjs} +9 -9
- package/dist/{inject-session-UBAQ7I3G.cjs.map → inject-session-AUQLBDRS.cjs.map} +1 -1
- package/dist/{inject-session-UEH5MAKU.js → inject-session-GMBMJVNZ.js} +7 -7
- package/dist/{inject-session-UEH5MAKU.js.map → inject-session-GMBMJVNZ.js.map} +1 -1
- package/dist/internal/auth/auth-types.d.ts +1 -1
- package/dist/internal/auth/oauth-device.d.ts +2 -2
- package/dist/internal/local-agent/mcp-pool.d.ts +2 -4
- package/dist/internal/mcp/oauth.d.ts +14 -0
- package/dist/internal/mcp/token-storage.d.ts +18 -0
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/persistence/atomic-write.d.cts +93 -0
- package/dist/internal/persistence/atomic-write.d.ts +93 -0
- package/dist/internal/persistence/file-lock.d.cts +13 -1
- package/dist/internal/persistence/file-lock.d.ts +13 -1
- package/dist/internal/persistence/fts5-sanitize.d.cts +9 -1
- package/dist/internal/persistence/fts5-sanitize.d.ts +9 -1
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/persistence/session-dir.d.cts +1 -0
- package/dist/internal/persistence/session-dir.d.ts +1 -0
- package/dist/internal/persistence/session-writer.d.cts +13 -0
- package/dist/internal/persistence/session-writer.d.ts +13 -0
- package/dist/internal/persistence/sqlite-wal.d.cts +9 -1
- package/dist/internal/persistence/sqlite-wal.d.ts +9 -1
- package/dist/internal/persistence/transcript-ops.d.cts +6 -7
- package/dist/internal/persistence/transcript-ops.d.ts +6 -7
- package/dist/internal/providers/builtin/cerebras.d.ts +2 -2
- package/dist/internal/providers/builtin/deepinfra.d.ts +1 -1
- package/dist/internal/providers/catalog-source-models-dev.d.ts +1 -1
- package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -3
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/internal/security/path-guard.d.cts +61 -0
- package/dist/internal/security/path-guard.d.ts +61 -0
- package/dist/internal/session/compact-session.d.ts +2 -2
- package/dist/internal/telemetry/tracer.d.ts +24 -0
- package/dist/judge-call-G5SGV2M2.cjs +22 -0
- package/dist/{judge-call-GVIJWQVE.cjs.map → judge-call-G5SGV2M2.cjs.map} +1 -1
- package/dist/judge-call-MDIPTBJI.js +5 -0
- package/dist/{judge-call-QMKGC2ZK.js.map → judge-call-MDIPTBJI.js.map} +1 -1
- package/dist/mcp-auth.cjs +299 -0
- package/dist/mcp-auth.cjs.map +1 -0
- package/dist/mcp-auth.d.cts +17 -0
- package/dist/mcp-auth.d.ts +17 -0
- package/dist/mcp-auth.js +292 -0
- package/dist/mcp-auth.js.map +1 -0
- package/dist/models.cjs +22 -21
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +7 -6
- 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 +38 -29
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +18 -9
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-63ASMXT4.cjs +46 -0
- package/dist/{registry-UBY26R4I.cjs.map → registry-63ASMXT4.cjs.map} +1 -1
- package/dist/registry-O7FJ2MPM.js +9 -0
- package/dist/{registry-GC7BQMSV.js.map → registry-O7FJ2MPM.js.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/sandbox/bwrap.d.cts +1 -2
- package/dist/sandbox/bwrap.d.ts +1 -2
- package/dist/sandbox/index.cjs +20 -20
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +5 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-DOM3UTXR.cjs +50 -0
- package/dist/{session-transcript-TNAJ4O3M.cjs.map → session-transcript-DOM3UTXR.cjs.map} +1 -1
- package/dist/session-transcript-RAKEK76V.js +5 -0
- package/dist/{session-transcript-SKIRBEJE.js.map → session-transcript-RAKEK76V.js.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-L3Q7PBMF.cjs +20 -0
- package/dist/{stream-object-T4DAMNVB.cjs.map → stream-object-L3Q7PBMF.cjs.map} +1 -1
- package/dist/stream-object-ZYXWS4B2.js +7 -0
- package/dist/{stream-object-QMNR3YFF.js.map → stream-object-ZYXWS4B2.js.map} +1 -1
- package/dist/subagents-loader-I56GSKAQ.js +6 -0
- package/dist/{subagents-loader-WN2SB6PV.js.map → subagents-loader-I56GSKAQ.js.map} +1 -1
- package/dist/subagents-loader-VRW73QQT.cjs +15 -0
- package/dist/{subagents-loader-3CXBQWWY.cjs.map → subagents-loader-VRW73QQT.cjs.map} +1 -1
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/subagents-loader.js +4 -4
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/types/agent.d.ts +19 -6
- package/dist/types/provider-profile.d.ts +2 -2
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/package.json +28 -18
- package/dist/agent-RDHK6MVT.js +0 -49
- package/dist/agent-U2R2R5JP.cjs +0 -58
- package/dist/agent-session-store-EPX2WQI4.cjs +0 -23
- package/dist/agent-session-store-JMU7ASDB.js +0 -6
- package/dist/chunk-2CFEET3Y.cjs.map +0 -1
- package/dist/chunk-2YGIBOUH.cjs.map +0 -1
- package/dist/chunk-4X3SBHPK.js.map +0 -1
- package/dist/chunk-6GS7JI64.cjs.map +0 -1
- package/dist/chunk-7HQVDLFI.cjs.map +0 -1
- package/dist/chunk-AM2CNBKE.js.map +0 -1
- package/dist/chunk-BBZYXVLZ.cjs.map +0 -1
- package/dist/chunk-BKRTYDVN.js +0 -312
- package/dist/chunk-BKRTYDVN.js.map +0 -1
- package/dist/chunk-CHVSMEKM.js.map +0 -1
- package/dist/chunk-GNPI5IWZ.js.map +0 -1
- package/dist/chunk-HI4ZW62S.js.map +0 -1
- package/dist/chunk-JJZ4NIAG.js.map +0 -1
- package/dist/chunk-KELIQH7K.js.map +0 -1
- package/dist/chunk-NACDF3PK.js.map +0 -1
- package/dist/chunk-QLAWEGTZ.cjs.map +0 -1
- package/dist/chunk-SDJYLCJK.cjs.map +0 -1
- package/dist/chunk-SXSPMRSV.cjs.map +0 -1
- package/dist/chunk-T6ZCG5AP.cjs.map +0 -1
- package/dist/chunk-V2EJLKGA.js.map +0 -1
- package/dist/chunk-W4FV7JBH.js.map +0 -1
- package/dist/chunk-XK54DTRF.cjs +0 -325
- package/dist/chunk-XK54DTRF.cjs.map +0 -1
- package/dist/chunk-XWCTBGYK.js.map +0 -1
- package/dist/chunk-YTO5BRBD.cjs.map +0 -1
- package/dist/chunk-ZNEE4WWQ.cjs.map +0 -1
- package/dist/compact-session-FBVWO6B3.cjs +0 -57
- package/dist/compact-session-XLXC2CZN.js +0 -20
- package/dist/context-4HGPCOH6.cjs +0 -22
- package/dist/context-DCECDKWN.js +0 -5
- package/dist/fs-session-store-2TF3ZWMT.js +0 -10
- package/dist/fs-session-store-TL4RJTXZ.cjs +0 -19
- package/dist/generate-object-E465DX5I.cjs +0 -20
- package/dist/generate-object-TVQCW2IZ.js +0 -7
- package/dist/index-manager-EA6FGIQG.js +0 -12
- package/dist/index-manager-HGGL4DD5.cjs +0 -21
- package/dist/judge-call-GVIJWQVE.cjs +0 -22
- package/dist/judge-call-QMKGC2ZK.js +0 -5
- package/dist/registry-GC7BQMSV.js +0 -9
- package/dist/registry-UBY26R4I.cjs +0 -46
- package/dist/session-transcript-SKIRBEJE.js +0 -5
- package/dist/session-transcript-TNAJ4O3M.cjs +0 -50
- package/dist/stream-object-QMNR3YFF.js +0 -7
- package/dist/stream-object-T4DAMNVB.cjs +0 -20
- package/dist/subagents-loader-3CXBQWWY.cjs +0 -15
- package/dist/subagents-loader-WN2SB6PV.js +0 -6
- package/docs/error-codes.md +0 -179
- package/docs/harness-capability-map.md +0 -304
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk3X6PM7DU_cjs = require('./chunk-3X6PM7DU.cjs');
|
|
3
4
|
var chunk4JBHSLQO_cjs = require('./chunk-4JBHSLQO.cjs');
|
|
4
|
-
var
|
|
5
|
-
var chunkE3OCRJU6_cjs = require('./chunk-E3OCRJU6.cjs');
|
|
5
|
+
var chunkSVO5WPZX_cjs = require('./chunk-SVO5WPZX.cjs');
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
7
|
var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
8
|
+
var chunkY4AXQOT4_cjs = require('./chunk-Y4AXQOT4.cjs');
|
|
9
|
+
var chunkADLLFY3H_cjs = require('./chunk-ADLLFY3H.cjs');
|
|
10
|
+
var chunkVUKQL3L2_cjs = require('./chunk-VUKQL3L2.cjs');
|
|
11
|
+
var chunkLPVIRJVF_cjs = require('./chunk-LPVIRJVF.cjs');
|
|
12
|
+
var chunkBM6N4KHO_cjs = require('./chunk-BM6N4KHO.cjs');
|
|
13
13
|
var fs = require('fs');
|
|
14
14
|
var promises = require('fs/promises');
|
|
15
15
|
var os = require('os');
|
|
@@ -18,7 +18,7 @@ var url = require('url');
|
|
|
18
18
|
var module$1 = require('module');
|
|
19
19
|
|
|
20
20
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
21
|
-
var discoveryState =
|
|
21
|
+
var discoveryState = chunkVUKQL3L2_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
22
22
|
done: false
|
|
23
23
|
}));
|
|
24
24
|
function pluginsRoot() {
|
|
@@ -40,19 +40,19 @@ function loadTrustedNames() {
|
|
|
40
40
|
else discarded += 1;
|
|
41
41
|
}
|
|
42
42
|
if (discarded > 0) {
|
|
43
|
-
|
|
43
|
+
chunkBM6N4KHO_cjs.diag(
|
|
44
44
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
45
45
|
`
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
|
|
49
|
+
chunkBM6N4KHO_cjs.diag(
|
|
50
50
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
51
51
|
`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
} catch {
|
|
55
|
-
|
|
55
|
+
chunkBM6N4KHO_cjs.diag(
|
|
56
56
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
57
57
|
`
|
|
58
58
|
);
|
|
@@ -78,7 +78,7 @@ async function discoverProviderPlugins() {
|
|
|
78
78
|
const trusted = loadTrustedNames();
|
|
79
79
|
for (const entry of entries) {
|
|
80
80
|
if (!trusted.has(entry)) {
|
|
81
|
-
|
|
81
|
+
chunkBM6N4KHO_cjs.diag(
|
|
82
82
|
`[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
|
|
83
83
|
`
|
|
84
84
|
);
|
|
@@ -97,13 +97,13 @@ async function loadOne(dir, entryName) {
|
|
|
97
97
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
98
98
|
const profile = plugin.profile;
|
|
99
99
|
if (profile !== void 0 && typeof profile === "object") {
|
|
100
|
-
|
|
100
|
+
chunkVUKQL3L2_cjs.registerProvider(profile);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
return;
|
|
104
104
|
} catch (err) {
|
|
105
105
|
const msg = err instanceof Error ? err.message : String(err);
|
|
106
|
-
|
|
106
|
+
chunkBM6N4KHO_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
107
107
|
`);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
@@ -115,7 +115,7 @@ function mapAnthropicError(args) {
|
|
|
115
115
|
const { status, body, headers, endpoint } = args;
|
|
116
116
|
const code = mapAnthropicStatusToCode(status, body);
|
|
117
117
|
const message = formatMessage(status, code);
|
|
118
|
-
const metadata =
|
|
118
|
+
const metadata = chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
119
119
|
provider: "anthropic",
|
|
120
120
|
endpoint,
|
|
121
121
|
code,
|
|
@@ -124,24 +124,24 @@ function mapAnthropicError(args) {
|
|
|
124
124
|
body
|
|
125
125
|
});
|
|
126
126
|
if (status === 401 || status === 403) {
|
|
127
|
-
return new
|
|
127
|
+
return new chunkLPVIRJVF_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
128
128
|
}
|
|
129
129
|
if (status === 429) {
|
|
130
|
-
return new
|
|
130
|
+
return new chunkLPVIRJVF_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
131
131
|
}
|
|
132
132
|
if (status === 400) {
|
|
133
|
-
return new
|
|
133
|
+
return new chunkLPVIRJVF_cjs.ConfigurationError(message, {
|
|
134
134
|
code: `anthropic_${code}`,
|
|
135
135
|
metadata
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
if (status === 408) {
|
|
139
|
-
return new
|
|
139
|
+
return new chunkLPVIRJVF_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
140
140
|
}
|
|
141
141
|
if (status >= 500 && status < 600) {
|
|
142
|
-
return new
|
|
142
|
+
return new chunkLPVIRJVF_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
143
143
|
}
|
|
144
|
-
return new
|
|
144
|
+
return new chunkLPVIRJVF_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
145
145
|
}
|
|
146
146
|
function mapAnthropicStatusToCode(status, body) {
|
|
147
147
|
if (status === 401 || status === 403) return "auth_failed";
|
|
@@ -212,7 +212,7 @@ function toBlockToolResultContent(content) {
|
|
|
212
212
|
function toStringToolResultContent(content, providerName) {
|
|
213
213
|
if (typeof content === "string") return content;
|
|
214
214
|
if (content.some((block) => block.type === "image")) {
|
|
215
|
-
throw new
|
|
215
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
216
216
|
`provider "${providerName}" does not support image content in tool results`
|
|
217
217
|
);
|
|
218
218
|
}
|
|
@@ -391,7 +391,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
391
391
|
(resolve, reject) => {
|
|
392
392
|
const timer = setTimeout(() => {
|
|
393
393
|
reject(
|
|
394
|
-
new
|
|
394
|
+
new chunkLPVIRJVF_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
395
395
|
code: "stream_idle_timeout"
|
|
396
396
|
})
|
|
397
397
|
);
|
|
@@ -468,9 +468,9 @@ function ehAbort(err) {
|
|
|
468
468
|
}
|
|
469
469
|
function wrapTransportError(err, ctx) {
|
|
470
470
|
if (ehAbort(err)) return err;
|
|
471
|
-
if (err instanceof
|
|
471
|
+
if (err instanceof chunkLPVIRJVF_cjs.NetworkError) return err;
|
|
472
472
|
const detail = err instanceof Error ? err.message : String(err);
|
|
473
|
-
return new
|
|
473
|
+
return new chunkLPVIRJVF_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
|
|
474
474
|
code: "transport_failure",
|
|
475
475
|
cause: err
|
|
476
476
|
});
|
|
@@ -534,7 +534,7 @@ var AnthropicClient = class {
|
|
|
534
534
|
for (const event of events) yield event;
|
|
535
535
|
}
|
|
536
536
|
if (!accumulator.finishReasonSeen) {
|
|
537
|
-
throw new
|
|
537
|
+
throw new chunkLPVIRJVF_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
538
538
|
code: "stream_truncated"
|
|
539
539
|
});
|
|
540
540
|
}
|
|
@@ -687,7 +687,7 @@ function classifyBedrockError(args, awsType, message) {
|
|
|
687
687
|
return "unknown";
|
|
688
688
|
}
|
|
689
689
|
function buildBedrockMetadata(args, code) {
|
|
690
|
-
return
|
|
690
|
+
return chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
691
691
|
provider: "bedrock",
|
|
692
692
|
endpoint: args.endpoint,
|
|
693
693
|
code,
|
|
@@ -704,19 +704,19 @@ function mapBedrockError(args) {
|
|
|
704
704
|
const metadata = buildBedrockMetadata(args, code);
|
|
705
705
|
switch (code) {
|
|
706
706
|
case "rate_limit":
|
|
707
|
-
return new
|
|
707
|
+
return new chunkLPVIRJVF_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
708
708
|
case "auth_failed":
|
|
709
|
-
return new
|
|
709
|
+
return new chunkLPVIRJVF_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
710
710
|
case "invalid_request": {
|
|
711
711
|
const friendly = message.includes("use case details") ? `Bedrock account setup required: ${message} (AWS Console \u2192 Bedrock \u2192 Model access \u2192 Anthropic \u2192 Submit use case form, then retry in 15 min.)` : `Bedrock validation: ${message}`;
|
|
712
|
-
return new
|
|
712
|
+
return new chunkLPVIRJVF_cjs.ConfigurationError(friendly, { metadata });
|
|
713
713
|
}
|
|
714
714
|
case "timeout":
|
|
715
|
-
return new
|
|
715
|
+
return new chunkLPVIRJVF_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
716
716
|
case "server_error":
|
|
717
|
-
return new
|
|
717
|
+
return new chunkLPVIRJVF_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
718
718
|
default:
|
|
719
|
-
return new
|
|
719
|
+
return new chunkLPVIRJVF_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
function parseBody(body) {
|
|
@@ -740,7 +740,7 @@ async function resolveBedrockToken(region) {
|
|
|
740
740
|
return cachedToken.value;
|
|
741
741
|
}
|
|
742
742
|
try {
|
|
743
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
743
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2FYEVT2B.cjs', document.baseURI).href)));
|
|
744
744
|
const gen = r("@aws/bedrock-token-generator");
|
|
745
745
|
if (typeof gen.getToken !== "function") return void 0;
|
|
746
746
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -768,16 +768,16 @@ var BedrockAnthropicClient = class {
|
|
|
768
768
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
769
769
|
const fromEnv = await resolveBedrockToken(region);
|
|
770
770
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
771
|
-
throw new
|
|
771
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
772
772
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
773
773
|
{ code: "auth_failed" }
|
|
774
774
|
);
|
|
775
775
|
}
|
|
776
776
|
async *stream(request, signal) {
|
|
777
|
-
const region =
|
|
777
|
+
const region = chunkVUKQL3L2_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
778
778
|
const token = await this.resolveTokenOrThrow(region);
|
|
779
|
-
const bareModel =
|
|
780
|
-
const baseUrl = this.options.baseUrl ??
|
|
779
|
+
const bareModel = chunkVUKQL3L2_cjs.stripBedrockPrefix(request.model);
|
|
780
|
+
const baseUrl = this.options.baseUrl ?? chunkVUKQL3L2_cjs.resolveBedrockBaseUrl(request.model);
|
|
781
781
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
782
782
|
const url = `${baseUrl}${endpoint}`;
|
|
783
783
|
const response = await postAnthropicRequest({
|
|
@@ -832,7 +832,7 @@ var FaultInjectingLlmClient = class {
|
|
|
832
832
|
return yield* this.inner.stream(request, signal);
|
|
833
833
|
}
|
|
834
834
|
if (parsed.status >= 400) {
|
|
835
|
-
throw
|
|
835
|
+
throw chunkSVO5WPZX_cjs.mapOpenAICompatibleError({
|
|
836
836
|
providerId: this.name,
|
|
837
837
|
status: parsed.status,
|
|
838
838
|
body: parsed.body,
|
|
@@ -879,7 +879,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
879
879
|
function warnInvalidJsonOnce(_raw) {
|
|
880
880
|
if (warnedInvalidJson) return;
|
|
881
881
|
warnedInvalidJson = true;
|
|
882
|
-
|
|
882
|
+
chunkBM6N4KHO_cjs.diag(
|
|
883
883
|
`[theokit-sdk] ${ENV_OVERRIDE_KEY} is set but value is not valid JSON of shape \`{"status": number, "body": object | string}\`. Falling back to real LLM call. This warning is shown once per process.
|
|
884
884
|
`
|
|
885
885
|
);
|
|
@@ -907,7 +907,7 @@ function mapOllamaTransportError(args) {
|
|
|
907
907
|
if (args.providerId !== "ollama") return void 0;
|
|
908
908
|
const causeCode = extractCauseCode(args.cause);
|
|
909
909
|
if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
|
|
910
|
-
const metadata =
|
|
910
|
+
const metadata = chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
911
911
|
provider: "ollama",
|
|
912
912
|
endpoint: args.endpoint,
|
|
913
913
|
code: "network",
|
|
@@ -915,7 +915,7 @@ function mapOllamaTransportError(args) {
|
|
|
915
915
|
headers: void 0,
|
|
916
916
|
body: { cause: causeCode }
|
|
917
917
|
});
|
|
918
|
-
return new
|
|
918
|
+
return new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
919
919
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
920
920
|
{ code: "ollama_unreachable", metadata }
|
|
921
921
|
);
|
|
@@ -925,7 +925,7 @@ function mapOllamaHttpError(args) {
|
|
|
925
925
|
const errString = extractErrorString(args.body).toLowerCase();
|
|
926
926
|
if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
|
|
927
927
|
const modelHint = extractModelName(errString);
|
|
928
|
-
const metadata =
|
|
928
|
+
const metadata = chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
929
929
|
provider: "ollama",
|
|
930
930
|
endpoint: args.endpoint,
|
|
931
931
|
code: "model_unavailable",
|
|
@@ -934,13 +934,13 @@ function mapOllamaHttpError(args) {
|
|
|
934
934
|
body: args.body
|
|
935
935
|
});
|
|
936
936
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
937
|
-
return new
|
|
937
|
+
return new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
938
938
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
939
939
|
{ code: "ollama_model_not_pulled", metadata }
|
|
940
940
|
);
|
|
941
941
|
}
|
|
942
942
|
if (args.status === 503 && errString.includes("model is loading")) {
|
|
943
|
-
const metadata =
|
|
943
|
+
const metadata = chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
944
944
|
provider: "ollama",
|
|
945
945
|
endpoint: args.endpoint,
|
|
946
946
|
code: "server_error",
|
|
@@ -948,7 +948,7 @@ function mapOllamaHttpError(args) {
|
|
|
948
948
|
headers: args.headers,
|
|
949
949
|
body: args.body
|
|
950
950
|
});
|
|
951
|
-
return new
|
|
951
|
+
return new chunkLPVIRJVF_cjs.NetworkError(
|
|
952
952
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
953
953
|
{ code: "ollama_model_loading", metadata }
|
|
954
954
|
);
|
|
@@ -1169,7 +1169,7 @@ function toOllamaMessages(message) {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
if (message.role === "user") {
|
|
1171
1171
|
if (message.content.some((p) => p.type === "image")) {
|
|
1172
|
-
throw new
|
|
1172
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
1173
1173
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1174
1174
|
{ code: "ollama_image_unsupported" }
|
|
1175
1175
|
);
|
|
@@ -1298,7 +1298,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1298
1298
|
try {
|
|
1299
1299
|
return await fetchFn(url, init);
|
|
1300
1300
|
} catch (cause) {
|
|
1301
|
-
throw new
|
|
1301
|
+
throw new chunkLPVIRJVF_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
async function safeParseJsonResponse(response) {
|
|
@@ -1325,7 +1325,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1325
1325
|
cause: body
|
|
1326
1326
|
};
|
|
1327
1327
|
if (envelope.code === "integration_not_connected") {
|
|
1328
|
-
return new
|
|
1328
|
+
return new chunkLPVIRJVF_cjs.IntegrationNotConnectedError(message, {
|
|
1329
1329
|
provider: envelope.provider ?? "unknown",
|
|
1330
1330
|
helpUrl: envelope.helpUrl ?? "",
|
|
1331
1331
|
code: envelope.code,
|
|
@@ -1333,18 +1333,18 @@ function mapHttpStatusToError(status, body) {
|
|
|
1333
1333
|
});
|
|
1334
1334
|
}
|
|
1335
1335
|
if (status === 401 || status === 403) {
|
|
1336
|
-
return new
|
|
1336
|
+
return new chunkLPVIRJVF_cjs.AuthenticationError(message, errorOptions);
|
|
1337
1337
|
}
|
|
1338
1338
|
if (status === 429) {
|
|
1339
|
-
return new
|
|
1339
|
+
return new chunkLPVIRJVF_cjs.RateLimitError(message, errorOptions);
|
|
1340
1340
|
}
|
|
1341
1341
|
if (status >= 400 && status < 500) {
|
|
1342
|
-
return new
|
|
1342
|
+
return new chunkLPVIRJVF_cjs.ConfigurationError(message, errorOptions);
|
|
1343
1343
|
}
|
|
1344
1344
|
if (status >= 500) {
|
|
1345
|
-
return new
|
|
1345
|
+
return new chunkLPVIRJVF_cjs.NetworkError(message, errorOptions);
|
|
1346
1346
|
}
|
|
1347
|
-
return new
|
|
1347
|
+
return new chunkLPVIRJVF_cjs.UnknownAgentError(message, errorOptions);
|
|
1348
1348
|
}
|
|
1349
1349
|
function extractErrorEnvelope(body) {
|
|
1350
1350
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1598,7 +1598,7 @@ var OpenAIClient = class {
|
|
|
1598
1598
|
endpoint: "/v1/chat/completions"
|
|
1599
1599
|
});
|
|
1600
1600
|
if (ollamaMapped !== void 0) throw ollamaMapped;
|
|
1601
|
-
throw
|
|
1601
|
+
throw chunkSVO5WPZX_cjs.mapOpenAICompatibleError({
|
|
1602
1602
|
providerId,
|
|
1603
1603
|
status: response.status,
|
|
1604
1604
|
body,
|
|
@@ -1627,7 +1627,7 @@ var OpenAIClient = class {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
1629
1629
|
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
1630
|
-
throw
|
|
1630
|
+
throw chunkSVO5WPZX_cjs.mapOpenAICompatibleError({
|
|
1631
1631
|
providerId,
|
|
1632
1632
|
status,
|
|
1633
1633
|
body: chunk,
|
|
@@ -1639,7 +1639,7 @@ var OpenAIClient = class {
|
|
|
1639
1639
|
for (const event of events) yield event;
|
|
1640
1640
|
}
|
|
1641
1641
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1642
|
-
throw new
|
|
1642
|
+
throw new chunkLPVIRJVF_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1643
1643
|
code: "stream_truncated"
|
|
1644
1644
|
});
|
|
1645
1645
|
}
|
|
@@ -1771,13 +1771,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1771
1771
|
toolCalls.push(...recovered.toolCalls);
|
|
1772
1772
|
text = recovered.residualText;
|
|
1773
1773
|
stopReason = "tool_use";
|
|
1774
|
-
|
|
1774
|
+
chunkBM6N4KHO_cjs.diag(
|
|
1775
1775
|
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
1776
1776
|
`
|
|
1777
1777
|
);
|
|
1778
1778
|
}
|
|
1779
1779
|
if (recovered.droppedNames.length > 0) {
|
|
1780
|
-
|
|
1780
|
+
chunkBM6N4KHO_cjs.diag(
|
|
1781
1781
|
`[theokit-sdk] dropped ${recovered.droppedNames.length} leaked block(s) whose name is not a tool in the request (provider="${this.providerName}", names=${recovered.droppedNames.join(",")})
|
|
1782
1782
|
`
|
|
1783
1783
|
);
|
|
@@ -1899,10 +1899,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
1899
1899
|
const firstResult = await generator.next();
|
|
1900
1900
|
return { kind: "ok", generator, firstResult };
|
|
1901
1901
|
} catch (cause) {
|
|
1902
|
-
if (cause instanceof
|
|
1902
|
+
if (cause instanceof chunkLPVIRJVF_cjs.NetworkError || cause instanceof chunkLPVIRJVF_cjs.RateLimitError || cause instanceof chunkLPVIRJVF_cjs.AuthenticationError) {
|
|
1903
1903
|
if (logFallback) {
|
|
1904
1904
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
1905
|
-
|
|
1905
|
+
chunkBM6N4KHO_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
1906
1906
|
`);
|
|
1907
1907
|
}
|
|
1908
1908
|
return { kind: "handshake_error", error: cause };
|
|
@@ -1944,7 +1944,7 @@ var PoolAwareLlmClient = class {
|
|
|
1944
1944
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: stream() must serialize pool-select → build client → first-event probe → classify → retry/rotate/propagate. Extracting helpers fragments the linear narrative; the comments above each branch keep it readable.
|
|
1945
1945
|
async *stream(request, signal) {
|
|
1946
1946
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
1947
|
-
throw new
|
|
1947
|
+
throw new chunkLPVIRJVF_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
1948
1948
|
code: "circuit_open"
|
|
1949
1949
|
});
|
|
1950
1950
|
}
|
|
@@ -1963,7 +1963,7 @@ var PoolAwareLlmClient = class {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
if (entry === null) {
|
|
1965
1965
|
this.breaker.recordTimeout(this.pool.provider);
|
|
1966
|
-
throw new
|
|
1966
|
+
throw new chunkLPVIRJVF_cjs.CredentialPoolExhaustedError(
|
|
1967
1967
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
1968
1968
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
1969
1969
|
);
|
|
@@ -1977,13 +1977,13 @@ var PoolAwareLlmClient = class {
|
|
|
1977
1977
|
}
|
|
1978
1978
|
const decision = classifyAndDecide(attempt.error, hasRetried429);
|
|
1979
1979
|
if (decision === "retry") {
|
|
1980
|
-
const backoffMs =
|
|
1980
|
+
const backoffMs = chunk3X6PM7DU_cjs.computeBackoffMs({
|
|
1981
1981
|
attempt: 0,
|
|
1982
1982
|
...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
|
|
1983
1983
|
...this.rng !== void 0 ? { rng: this.rng } : {}
|
|
1984
1984
|
});
|
|
1985
1985
|
this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
|
|
1986
|
-
await
|
|
1986
|
+
await chunk3X6PM7DU_cjs.sleepWithAbort(backoffMs, signal);
|
|
1987
1987
|
hasRetried429 = true;
|
|
1988
1988
|
continue;
|
|
1989
1989
|
}
|
|
@@ -1995,7 +1995,7 @@ var PoolAwareLlmClient = class {
|
|
|
1995
1995
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
1996
1996
|
});
|
|
1997
1997
|
} catch (persistErr) {
|
|
1998
|
-
|
|
1998
|
+
chunkBM6N4KHO_cjs.diag(
|
|
1999
1999
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
2000
2000
|
`
|
|
2001
2001
|
);
|
|
@@ -2017,8 +2017,8 @@ var PoolAwareLlmClient = class {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
};
|
|
2019
2019
|
function classifyAndDecide(error, hasRetried429) {
|
|
2020
|
-
if (error instanceof
|
|
2021
|
-
if (error instanceof
|
|
2020
|
+
if (error instanceof chunkLPVIRJVF_cjs.NetworkError) return "propagate";
|
|
2021
|
+
if (error instanceof chunkLPVIRJVF_cjs.AuthenticationError) return "rotate";
|
|
2022
2022
|
const status = error.metadata?.statusCode ?? 429;
|
|
2023
2023
|
if (status === 402) return "rotate";
|
|
2024
2024
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2031,8 +2031,8 @@ function parseRetryAfterMs(error) {
|
|
|
2031
2031
|
return void 0;
|
|
2032
2032
|
}
|
|
2033
2033
|
function inferStatusCode(error) {
|
|
2034
|
-
if (error instanceof
|
|
2035
|
-
if (error instanceof
|
|
2034
|
+
if (error instanceof chunkLPVIRJVF_cjs.AuthenticationError) return 401;
|
|
2035
|
+
if (error instanceof chunkLPVIRJVF_cjs.RateLimitError) return 429;
|
|
2036
2036
|
return 0;
|
|
2037
2037
|
}
|
|
2038
2038
|
function abortError(signal) {
|
|
@@ -2140,7 +2140,7 @@ var ResponsesApiClient = class {
|
|
|
2140
2140
|
body = JSON.parse(text2);
|
|
2141
2141
|
} catch {
|
|
2142
2142
|
}
|
|
2143
|
-
throw
|
|
2143
|
+
throw chunkSVO5WPZX_cjs.mapOpenAICompatibleError({
|
|
2144
2144
|
providerId,
|
|
2145
2145
|
status: response.status,
|
|
2146
2146
|
body,
|
|
@@ -2211,7 +2211,7 @@ var ResponsesApiClient = class {
|
|
|
2211
2211
|
} else if (t === "response.failed" || t === "error") {
|
|
2212
2212
|
const msg = event.response?.error?.message ?? event.message ?? "responses stream failed";
|
|
2213
2213
|
yield { type: "error", message: msg };
|
|
2214
|
-
throw
|
|
2214
|
+
throw chunkSVO5WPZX_cjs.mapOpenAICompatibleError({
|
|
2215
2215
|
providerId,
|
|
2216
2216
|
status: 502,
|
|
2217
2217
|
body: { error: { message: msg } },
|
|
@@ -2242,14 +2242,14 @@ function abortError2(signal) {
|
|
|
2242
2242
|
// src/internal/llm/retrying-client.ts
|
|
2243
2243
|
var MAX_ATTEMPTS = 3;
|
|
2244
2244
|
function isRetriableError(err) {
|
|
2245
|
-
if (!
|
|
2246
|
-
if (err instanceof
|
|
2247
|
-
if (err instanceof
|
|
2248
|
-
if (err instanceof
|
|
2245
|
+
if (!chunkLPVIRJVF_cjs.isTransientError(err)) return false;
|
|
2246
|
+
if (err instanceof chunkLPVIRJVF_cjs.CredentialPoolExhaustedError) return false;
|
|
2247
|
+
if (err instanceof chunkLPVIRJVF_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2248
|
+
if (err instanceof chunkLPVIRJVF_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2249
2249
|
return true;
|
|
2250
2250
|
}
|
|
2251
2251
|
function retryAfterHintMs(err) {
|
|
2252
|
-
if (!(err instanceof
|
|
2252
|
+
if (!(err instanceof chunkLPVIRJVF_cjs.RateLimitError)) return void 0;
|
|
2253
2253
|
const seconds = err.metadata?.retryAfter;
|
|
2254
2254
|
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2255
2255
|
}
|
|
@@ -2295,16 +2295,16 @@ var RetryingLlmClient = class {
|
|
|
2295
2295
|
*/
|
|
2296
2296
|
async #waitBackoff(err, attempt, signal) {
|
|
2297
2297
|
const hint = retryAfterHintMs(err);
|
|
2298
|
-
const ms =
|
|
2298
|
+
const ms = chunk3X6PM7DU_cjs.computeBackoffMs({
|
|
2299
2299
|
attempt,
|
|
2300
2300
|
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2301
2301
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2302
2302
|
});
|
|
2303
2303
|
const cause = err instanceof Error ? err.name : typeof err;
|
|
2304
|
-
|
|
2304
|
+
chunkBM6N4KHO_cjs.diag(
|
|
2305
2305
|
`retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
|
|
2306
2306
|
);
|
|
2307
|
-
await
|
|
2307
|
+
await chunk3X6PM7DU_cjs.sleepWithAbort(ms, signal);
|
|
2308
2308
|
}
|
|
2309
2309
|
async *stream(request, signal) {
|
|
2310
2310
|
let lastError;
|
|
@@ -2342,7 +2342,7 @@ function classifyVertexError(args, errStatus) {
|
|
|
2342
2342
|
return "unknown";
|
|
2343
2343
|
}
|
|
2344
2344
|
function vertexMetadata(args, code) {
|
|
2345
|
-
return
|
|
2345
|
+
return chunkSVO5WPZX_cjs.buildErrorMetadata({
|
|
2346
2346
|
provider: "vertex",
|
|
2347
2347
|
endpoint: args.endpoint,
|
|
2348
2348
|
code,
|
|
@@ -2352,23 +2352,23 @@ function vertexMetadata(args, code) {
|
|
|
2352
2352
|
});
|
|
2353
2353
|
}
|
|
2354
2354
|
var VERTEX_ERROR_BUILDERS = {
|
|
2355
|
-
rate_limit: (args, msg) => new
|
|
2355
|
+
rate_limit: (args, msg) => new chunkLPVIRJVF_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2356
2356
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2357
2357
|
}),
|
|
2358
|
-
auth_unauthenticated: (args, msg) => new
|
|
2358
|
+
auth_unauthenticated: (args, msg) => new chunkLPVIRJVF_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2359
2359
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2360
2360
|
}),
|
|
2361
|
-
auth_permission: (args, msg) => new
|
|
2361
|
+
auth_permission: (args, msg) => new chunkLPVIRJVF_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2362
2362
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2363
2363
|
}),
|
|
2364
|
-
invalid_request: (args, msg) => new
|
|
2364
|
+
invalid_request: (args, msg) => new chunkLPVIRJVF_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2365
2365
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2366
2366
|
}),
|
|
2367
|
-
timeout: (args, msg) => new
|
|
2368
|
-
server_error: (args, msg) => new
|
|
2367
|
+
timeout: (args, msg) => new chunkLPVIRJVF_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2368
|
+
server_error: (args, msg) => new chunkLPVIRJVF_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2369
2369
|
metadata: vertexMetadata(args, "server_error")
|
|
2370
2370
|
}),
|
|
2371
|
-
unknown: (args, msg) => new
|
|
2371
|
+
unknown: (args, msg) => new chunkLPVIRJVF_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2372
2372
|
};
|
|
2373
2373
|
function mapVertexError(args) {
|
|
2374
2374
|
const parsed = parseBody2(args.body);
|
|
@@ -2404,12 +2404,12 @@ async function resolveVertexAccessToken() {
|
|
|
2404
2404
|
async function getAuthClientOrThrow() {
|
|
2405
2405
|
let mod;
|
|
2406
2406
|
try {
|
|
2407
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2407
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2FYEVT2B.cjs', document.baseURI).href)));
|
|
2408
2408
|
mod = r("google-auth-library");
|
|
2409
2409
|
} catch (err) {
|
|
2410
2410
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2411
2411
|
if (isModuleMissing) {
|
|
2412
|
-
throw new
|
|
2412
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2413
2413
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2414
2414
|
{ code: "auth_failed", cause: err }
|
|
2415
2415
|
);
|
|
@@ -2420,7 +2420,7 @@ async function getAuthClientOrThrow() {
|
|
|
2420
2420
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2421
2421
|
return await auth.getClient();
|
|
2422
2422
|
} catch (err) {
|
|
2423
|
-
|
|
2423
|
+
chunkBM6N4KHO_cjs.diag(
|
|
2424
2424
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2425
2425
|
`
|
|
2426
2426
|
);
|
|
@@ -2446,7 +2446,7 @@ var VertexAnthropicClient = class {
|
|
|
2446
2446
|
resolveProjectOrThrow() {
|
|
2447
2447
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2448
2448
|
if (projectId !== void 0) return projectId;
|
|
2449
|
-
throw new
|
|
2449
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2450
2450
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2451
2451
|
{ code: "auth_failed" }
|
|
2452
2452
|
);
|
|
@@ -2456,7 +2456,7 @@ var VertexAnthropicClient = class {
|
|
|
2456
2456
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2457
2457
|
const fromAdc = await resolveVertexAccessToken();
|
|
2458
2458
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2459
|
-
throw new
|
|
2459
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2460
2460
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2461
2461
|
{ code: "auth_failed" }
|
|
2462
2462
|
);
|
|
@@ -2465,8 +2465,8 @@ var VertexAnthropicClient = class {
|
|
|
2465
2465
|
const projectId = this.resolveProjectOrThrow();
|
|
2466
2466
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2467
2467
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2468
|
-
const baseUrl =
|
|
2469
|
-
const bareModel =
|
|
2468
|
+
const baseUrl = chunkVUKQL3L2_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2469
|
+
const bareModel = chunkVUKQL3L2_cjs.stripVertexPrefix(request.model);
|
|
2470
2470
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2471
2471
|
const url = `${baseUrl}${endpoint}`;
|
|
2472
2472
|
const response = await postAnthropicRequest({
|
|
@@ -2502,7 +2502,7 @@ var VertexGeminiClient = class {
|
|
|
2502
2502
|
async *stream(request, signal) {
|
|
2503
2503
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2504
2504
|
if (projectId === void 0) {
|
|
2505
|
-
throw new
|
|
2505
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2506
2506
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2507
2507
|
{ code: "auth_failed" }
|
|
2508
2508
|
);
|
|
@@ -2510,12 +2510,12 @@ var VertexGeminiClient = class {
|
|
|
2510
2510
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2511
2511
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2512
2512
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2513
|
-
throw new
|
|
2513
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2514
2514
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2515
2515
|
{ code: "auth_failed" }
|
|
2516
2516
|
);
|
|
2517
2517
|
}
|
|
2518
|
-
const baseUrl =
|
|
2518
|
+
const baseUrl = chunkVUKQL3L2_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2519
2519
|
const url = `${baseUrl}/chat/completions`;
|
|
2520
2520
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2521
2521
|
const rewriteFetch = (input, init) => {
|
|
@@ -2541,7 +2541,7 @@ var VertexRouterClient = class {
|
|
|
2541
2541
|
options;
|
|
2542
2542
|
name = "vertex";
|
|
2543
2543
|
async *stream(request, signal) {
|
|
2544
|
-
const dialect =
|
|
2544
|
+
const dialect = chunkVUKQL3L2_cjs.inferModelDialect(request.model);
|
|
2545
2545
|
if (dialect === "anthropic") {
|
|
2546
2546
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2547
2547
|
return yield* inner2.stream(request, signal);
|
|
@@ -2553,7 +2553,7 @@ var VertexRouterClient = class {
|
|
|
2553
2553
|
|
|
2554
2554
|
// src/internal/llm/router.ts
|
|
2555
2555
|
function resolveProviderChain(options) {
|
|
2556
|
-
|
|
2556
|
+
chunkVUKQL3L2_cjs.registerBuiltins();
|
|
2557
2557
|
return buildChain(options);
|
|
2558
2558
|
}
|
|
2559
2559
|
function buildChain(options) {
|
|
@@ -2570,7 +2570,7 @@ function buildChain(options) {
|
|
|
2570
2570
|
addClient(options.primary);
|
|
2571
2571
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2572
2572
|
if (clients.length === 0) {
|
|
2573
|
-
throw new
|
|
2573
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2574
2574
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2575
2575
|
{ code: "provider_unresolved" }
|
|
2576
2576
|
);
|
|
@@ -2578,11 +2578,11 @@ function buildChain(options) {
|
|
|
2578
2578
|
return clients;
|
|
2579
2579
|
}
|
|
2580
2580
|
function buildClient(name, routerOptions) {
|
|
2581
|
-
const baseProfile =
|
|
2581
|
+
const baseProfile = chunkVUKQL3L2_cjs.getProviderProfile(name);
|
|
2582
2582
|
if (baseProfile === void 0) return void 0;
|
|
2583
2583
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2584
2584
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2585
|
-
const ambient =
|
|
2585
|
+
const ambient = chunk3X6PM7DU_cjs.currentCredentialPool(name);
|
|
2586
2586
|
if (ambient !== void 0) {
|
|
2587
2587
|
return new RetryingLlmClient(
|
|
2588
2588
|
new PoolAwareLlmClient(
|
|
@@ -2612,9 +2612,9 @@ function buildPoolOrSingle(args) {
|
|
|
2612
2612
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2613
2613
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2614
2614
|
const entries = poolKeys.map(
|
|
2615
|
-
(accessToken, priority) =>
|
|
2615
|
+
(accessToken, priority) => chunk3X6PM7DU_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2616
2616
|
);
|
|
2617
|
-
const pool = new
|
|
2617
|
+
const pool = new chunk3X6PM7DU_cjs.CredentialPool(name, entries, strategy);
|
|
2618
2618
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2619
2619
|
return new RetryingLlmClient(
|
|
2620
2620
|
new PoolAwareLlmClient(
|
|
@@ -2649,7 +2649,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2649
2649
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2650
2650
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2651
2651
|
warnedNoAuthApiKeys.add(provider);
|
|
2652
|
-
|
|
2652
|
+
chunkBM6N4KHO_cjs.diag(
|
|
2653
2653
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2654
2654
|
`
|
|
2655
2655
|
);
|
|
@@ -2675,10 +2675,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2675
2675
|
if (apiKeys === void 0) return;
|
|
2676
2676
|
for (const name of Object.keys(apiKeys)) {
|
|
2677
2677
|
if (warnedProviders.has(name)) continue;
|
|
2678
|
-
const profile =
|
|
2678
|
+
const profile = chunkVUKQL3L2_cjs.getProviderProfile(name);
|
|
2679
2679
|
if (profile === void 0) {
|
|
2680
2680
|
warnedProviders.add(name);
|
|
2681
|
-
|
|
2681
|
+
chunkBM6N4KHO_cjs.diag(
|
|
2682
2682
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2683
2683
|
`
|
|
2684
2684
|
);
|
|
@@ -2710,7 +2710,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2710
2710
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2711
2711
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2712
2712
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2713
|
-
throw new
|
|
2713
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2714
2714
|
`provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
|
|
2715
2715
|
);
|
|
2716
2716
|
}
|
|
@@ -2761,7 +2761,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2761
2761
|
providerName: profile.name
|
|
2762
2762
|
});
|
|
2763
2763
|
}
|
|
2764
|
-
throw new
|
|
2764
|
+
throw new chunkLPVIRJVF_cjs.ConfigurationError(
|
|
2765
2765
|
`Provider "${profile.name}" requires apiMode "${profile.apiMode}" but no transport is registered. Install a third-party transport plugin (@theokit-transport-${profile.apiMode}) or use a provider with apiMode "chat_completions" or "anthropic_messages".`,
|
|
2766
2766
|
{ code: "transport_unavailable" }
|
|
2767
2767
|
);
|
|
@@ -2771,7 +2771,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2771
2771
|
function inferProviderFromApiKey(apiKey) {
|
|
2772
2772
|
const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
|
|
2773
2773
|
if (provider === void 0) return void 0;
|
|
2774
|
-
return
|
|
2774
|
+
return chunkVUKQL3L2_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
|
|
2775
2775
|
}
|
|
2776
2776
|
function detectPrimaryProvider() {
|
|
2777
2777
|
if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
|
|
@@ -2906,7 +2906,7 @@ function plainText(content) {
|
|
|
2906
2906
|
}
|
|
2907
2907
|
async function compactSessionTranscript(opts) {
|
|
2908
2908
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
2909
|
-
const history =
|
|
2909
|
+
const history = chunkY4AXQOT4_cjs.reconstructMessages(prior);
|
|
2910
2910
|
const compressible = [];
|
|
2911
2911
|
for (const m of history) {
|
|
2912
2912
|
const text = plainText(m.content);
|
|
@@ -2914,14 +2914,14 @@ async function compactSessionTranscript(opts) {
|
|
|
2914
2914
|
compressible.push({ role: m.role, content: text });
|
|
2915
2915
|
}
|
|
2916
2916
|
}
|
|
2917
|
-
const preTokens =
|
|
2917
|
+
const preTokens = chunkADLLFY3H_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
2918
2918
|
const summaryBody = await opts.summarize(compressible);
|
|
2919
2919
|
const preserved = [];
|
|
2920
2920
|
let budget = 0;
|
|
2921
2921
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
2922
2922
|
const m = compressible[i];
|
|
2923
2923
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
2924
|
-
const cost =
|
|
2924
|
+
const cost = chunkADLLFY3H_cjs.estimateTokens(m.content);
|
|
2925
2925
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
2926
2926
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
2927
2927
|
if (remaining > 50) {
|
|
@@ -2935,7 +2935,7 @@ async function compactSessionTranscript(opts) {
|
|
|
2935
2935
|
}
|
|
2936
2936
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
2937
2937
|
${summaryBody}`;
|
|
2938
|
-
const transcript =
|
|
2938
|
+
const transcript = chunkY4AXQOT4_cjs.SessionTranscript.fromRecords(prior, {
|
|
2939
2939
|
cwd: opts.loc.cwd,
|
|
2940
2940
|
sessionId: opts.sessionId,
|
|
2941
2941
|
model: opts.loc.model ?? "unknown"
|
|
@@ -2946,7 +2946,7 @@ ${summaryBody}`;
|
|
|
2946
2946
|
const delta = transcript.records().slice(prior.length);
|
|
2947
2947
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
2948
2948
|
chunk4JBHSLQO_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
2949
|
-
const postTokens =
|
|
2949
|
+
const postTokens = chunkADLLFY3H_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
2950
2950
|
return { preTokens, postTokens };
|
|
2951
2951
|
}
|
|
2952
2952
|
function resolveSummarizerRoute(opts) {
|
|
@@ -2955,9 +2955,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
function buildDefaultSummarizer(opts) {
|
|
2957
2957
|
return async (messages) => {
|
|
2958
|
-
|
|
2958
|
+
chunkVUKQL3L2_cjs.registerBuiltins();
|
|
2959
2959
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
2960
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
2960
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkVUKQL3L2_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
2961
2961
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
2962
2962
|
const route = resolveSummarizerRoute({
|
|
2963
2963
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3028,7 +3028,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3028
3028
|
return true;
|
|
3029
3029
|
} catch (cause) {
|
|
3030
3030
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3031
|
-
|
|
3031
|
+
chunkBM6N4KHO_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3032
3032
|
`);
|
|
3033
3033
|
return false;
|
|
3034
3034
|
}
|
|
@@ -3059,5 +3059,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3059
3059
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3060
3060
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3061
3061
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3062
|
-
//# sourceMappingURL=chunk-
|
|
3063
|
-
//# sourceMappingURL=chunk-
|
|
3062
|
+
//# sourceMappingURL=chunk-2FYEVT2B.cjs.map
|
|
3063
|
+
//# sourceMappingURL=chunk-2FYEVT2B.cjs.map
|