@theokit/sdk 4.39.0 → 4.39.2
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 +61 -0
- package/dist/agent-KGKKAGXY.js +46 -0
- package/dist/{agent-KKZYLY5D.js.map → agent-KGKKAGXY.js.map} +1 -1
- package/dist/agent-TOWHPM7B.cjs +55 -0
- package/dist/{agent-I3EZZR6S.cjs.map → agent-TOWHPM7B.cjs.map} +1 -1
- package/dist/agent-session-store-EGTTYSKS.js +6 -0
- package/dist/{agent-session-store-RHMHP5DG.js.map → agent-session-store-EGTTYSKS.js.map} +1 -1
- package/dist/agent-session-store-RHTLZ5OX.cjs +23 -0
- package/dist/{agent-session-store-N4TVKHBU.cjs.map → agent-session-store-RHTLZ5OX.cjs.map} +1 -1
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +4 -4
- package/dist/{batch-X6JKGDPK.cjs → batch-FO2KZN7W.cjs} +26 -26
- package/dist/{batch-X6JKGDPK.cjs.map → batch-FO2KZN7W.cjs.map} +1 -1
- package/dist/{batch-6KQM3EBA.js → batch-WX2HLXX2.js} +9 -9
- package/dist/{batch-6KQM3EBA.js.map → batch-WX2HLXX2.js.map} +1 -1
- package/dist/{chunk-ECHGWE47.cjs → chunk-27E4EMR6.cjs} +4 -4
- package/dist/{chunk-ECHGWE47.cjs.map → chunk-27E4EMR6.cjs.map} +1 -1
- package/dist/{chunk-DGLLVCNB.cjs → chunk-33B2BSME.cjs} +4 -4
- package/dist/{chunk-DGLLVCNB.cjs.map → chunk-33B2BSME.cjs.map} +1 -1
- package/dist/{chunk-KE6XKRLQ.js → chunk-3CAQCFVZ.js} +3 -3
- package/dist/{chunk-KE6XKRLQ.js.map → chunk-3CAQCFVZ.js.map} +1 -1
- package/dist/{chunk-XYOHKCYG.cjs → chunk-3LK3ZDL5.cjs} +5 -5
- package/dist/{chunk-XYOHKCYG.cjs.map → chunk-3LK3ZDL5.cjs.map} +1 -1
- package/dist/{chunk-I53ZQHU6.cjs → chunk-4E3HLSYE.cjs} +4 -4
- package/dist/{chunk-I53ZQHU6.cjs.map → chunk-4E3HLSYE.cjs.map} +1 -1
- package/dist/{chunk-AR5MQZ3J.js → chunk-4GGXF7YM.js} +3 -3
- package/dist/{chunk-AR5MQZ3J.js.map → chunk-4GGXF7YM.js.map} +1 -1
- package/dist/{chunk-4JSZYSGW.js → chunk-4H2DCO6P.js} +3 -3
- package/dist/{chunk-4JSZYSGW.js.map → chunk-4H2DCO6P.js.map} +1 -1
- package/dist/{chunk-75DSEWTJ.cjs → chunk-4H2QARXM.cjs} +7 -7
- package/dist/{chunk-75DSEWTJ.cjs.map → chunk-4H2QARXM.cjs.map} +1 -1
- package/dist/{chunk-JZUPMTJY.js → chunk-4HKAZRTC.js} +3 -3
- package/dist/{chunk-JZUPMTJY.js.map → chunk-4HKAZRTC.js.map} +1 -1
- package/dist/{chunk-CEIHCKTO.cjs → chunk-5COPO3H4.cjs} +4 -4
- package/dist/{chunk-CEIHCKTO.cjs.map → chunk-5COPO3H4.cjs.map} +1 -1
- package/dist/{chunk-KX7JV5KM.js → chunk-5XPKYDK7.js} +3 -3
- package/dist/{chunk-KX7JV5KM.js.map → chunk-5XPKYDK7.js.map} +1 -1
- package/dist/{chunk-E2FFG33C.js → chunk-7HP6N5X3.js} +5 -5
- package/dist/{chunk-E2FFG33C.js.map → chunk-7HP6N5X3.js.map} +1 -1
- package/dist/{chunk-3I4B3OIX.js → chunk-7PBAJ2WA.js} +3 -3
- package/dist/{chunk-3I4B3OIX.js.map → chunk-7PBAJ2WA.js.map} +1 -1
- package/dist/{chunk-KGRIHEDT.js → chunk-7WXT5M6P.js} +5 -5
- package/dist/{chunk-KGRIHEDT.js.map → chunk-7WXT5M6P.js.map} +1 -1
- package/dist/{chunk-BCQ3E2ZG.cjs → chunk-A76OFN2B.cjs} +8 -4
- package/dist/chunk-A76OFN2B.cjs.map +1 -0
- package/dist/{chunk-TOTP24P6.js → chunk-AFJAQ5JV.js} +4 -4
- package/dist/{chunk-TOTP24P6.js.map → chunk-AFJAQ5JV.js.map} +1 -1
- package/dist/{chunk-DKFGUOWL.js → chunk-AKMPQJPX.js} +3 -3
- package/dist/{chunk-DKFGUOWL.js.map → chunk-AKMPQJPX.js.map} +1 -1
- package/dist/{chunk-HIQFVHC6.cjs → chunk-ALDFVGQQ.cjs} +9 -9
- package/dist/{chunk-HIQFVHC6.cjs.map → chunk-ALDFVGQQ.cjs.map} +1 -1
- package/dist/{chunk-INSFS5GT.cjs → chunk-AYDSWY35.cjs} +293 -293
- package/dist/{chunk-INSFS5GT.cjs.map → chunk-AYDSWY35.cjs.map} +1 -1
- package/dist/{chunk-YRXY2A5L.js → chunk-BBMN4O6E.js} +4 -4
- package/dist/{chunk-YRXY2A5L.js.map → chunk-BBMN4O6E.js.map} +1 -1
- package/dist/{chunk-6EEYRFJC.js → chunk-BM7VYZED.js} +5 -5
- package/dist/{chunk-6EEYRFJC.js.map → chunk-BM7VYZED.js.map} +1 -1
- package/dist/{chunk-ML5A5DOJ.js → chunk-C64E2EJS.js} +4 -4
- package/dist/{chunk-ML5A5DOJ.js.map → chunk-C64E2EJS.js.map} +1 -1
- package/dist/{chunk-E4IUN3JB.cjs → chunk-CJHBSSAF.cjs} +15 -15
- package/dist/{chunk-E4IUN3JB.cjs.map → chunk-CJHBSSAF.cjs.map} +1 -1
- package/dist/{chunk-IHFNRNTJ.cjs → chunk-E7WWIX34.cjs} +8 -8
- package/dist/{chunk-IHFNRNTJ.cjs.map → chunk-E7WWIX34.cjs.map} +1 -1
- package/dist/{chunk-C7OP3FAK.cjs → chunk-EJNFZET4.cjs} +11 -11
- package/dist/{chunk-C7OP3FAK.cjs.map → chunk-EJNFZET4.cjs.map} +1 -1
- package/dist/{chunk-ECW2MLEW.cjs → chunk-ELYGL52R.cjs} +4 -4
- package/dist/{chunk-ECW2MLEW.cjs.map → chunk-ELYGL52R.cjs.map} +1 -1
- package/dist/{chunk-GIRD3RWH.js → chunk-ERBH54V3.js} +35 -35
- package/dist/{chunk-GIRD3RWH.js.map → chunk-ERBH54V3.js.map} +1 -1
- package/dist/{chunk-JRLXEYR4.js → chunk-EYUZZXHZ.js} +4 -4
- package/dist/{chunk-JRLXEYR4.js.map → chunk-EYUZZXHZ.js.map} +1 -1
- package/dist/{chunk-PI4RO4GR.js → chunk-F4SQTWVR.js} +3 -3
- package/dist/{chunk-PI4RO4GR.js.map → chunk-F4SQTWVR.js.map} +1 -1
- package/dist/{chunk-LALG2K33.cjs → chunk-FMDZZRYE.cjs} +8 -8
- package/dist/{chunk-LALG2K33.cjs.map → chunk-FMDZZRYE.cjs.map} +1 -1
- package/dist/{chunk-SCFW5MJZ.js → chunk-FUP3ZA5T.js} +4 -4
- package/dist/{chunk-SCFW5MJZ.js.map → chunk-FUP3ZA5T.js.map} +1 -1
- package/dist/{chunk-DWY25VLP.cjs → chunk-H2V6CXM7.cjs} +9 -9
- package/dist/{chunk-DWY25VLP.cjs.map → chunk-H2V6CXM7.cjs.map} +1 -1
- package/dist/{chunk-DU7DE543.js → chunk-HCRCNI7A.js} +3 -3
- package/dist/{chunk-DU7DE543.js.map → chunk-HCRCNI7A.js.map} +1 -1
- package/dist/{chunk-QKE556YD.js → chunk-HJMFPIRM.js} +5 -5
- package/dist/{chunk-QKE556YD.js.map → chunk-HJMFPIRM.js.map} +1 -1
- package/dist/{chunk-J3UK2GMN.js → chunk-IEKSEAIV.js} +3 -3
- package/dist/{chunk-J3UK2GMN.js.map → chunk-IEKSEAIV.js.map} +1 -1
- package/dist/{chunk-DMTZ3FII.cjs → chunk-JERO4TP6.cjs} +5 -5
- package/dist/{chunk-DMTZ3FII.cjs.map → chunk-JERO4TP6.cjs.map} +1 -1
- package/dist/{chunk-6LGQECT7.cjs → chunk-K6TWHNT4.cjs} +11 -11
- package/dist/{chunk-6LGQECT7.cjs.map → chunk-K6TWHNT4.cjs.map} +1 -1
- package/dist/{chunk-4F7JQZOX.js → chunk-KRPEPZQY.js} +7 -7
- package/dist/{chunk-4F7JQZOX.js.map → chunk-KRPEPZQY.js.map} +1 -1
- package/dist/{chunk-CN6UX5EV.cjs → chunk-LNTQRD23.cjs} +26 -26
- package/dist/{chunk-CN6UX5EV.cjs.map → chunk-LNTQRD23.cjs.map} +1 -1
- package/dist/{chunk-W4WKVOOQ.cjs → chunk-LOTWA65Z.cjs} +11 -11
- package/dist/{chunk-W4WKVOOQ.cjs.map → chunk-LOTWA65Z.cjs.map} +1 -1
- package/dist/{chunk-BPN5ONSW.cjs → chunk-LR3VKB7A.cjs} +124 -120
- package/dist/chunk-LR3VKB7A.cjs.map +1 -0
- package/dist/{chunk-ET6PHZRX.js → chunk-LWVKI75U.js} +3 -3
- package/dist/{chunk-ET6PHZRX.js.map → chunk-LWVKI75U.js.map} +1 -1
- package/dist/{chunk-G2Q3ZC6C.cjs → chunk-LY4KEOOY.cjs} +4 -4
- package/dist/{chunk-G2Q3ZC6C.cjs.map → chunk-LY4KEOOY.cjs.map} +1 -1
- package/dist/{chunk-42IFCKQZ.js → chunk-LYD3ALDT.js} +5 -5
- package/dist/{chunk-42IFCKQZ.js.map → chunk-LYD3ALDT.js.map} +1 -1
- package/dist/{chunk-KWUNN5J2.js → chunk-MDN44YMZ.js} +5 -5
- package/dist/{chunk-KWUNN5J2.js.map → chunk-MDN44YMZ.js.map} +1 -1
- package/dist/{chunk-HWNVAUK4.js → chunk-MI3OKONE.js} +3 -3
- package/dist/{chunk-HWNVAUK4.js.map → chunk-MI3OKONE.js.map} +1 -1
- package/dist/{chunk-VJYSQXN6.cjs → chunk-MM2JKFQV.cjs} +10 -10
- package/dist/{chunk-VJYSQXN6.cjs.map → chunk-MM2JKFQV.cjs.map} +1 -1
- package/dist/{chunk-74D7KSBP.cjs → chunk-MWVLE5RY.cjs} +11 -11
- package/dist/{chunk-74D7KSBP.cjs.map → chunk-MWVLE5RY.cjs.map} +1 -1
- package/dist/{chunk-V2RBCCN5.js → chunk-NHXPQN44.js} +3 -3
- package/dist/{chunk-V2RBCCN5.js.map → chunk-NHXPQN44.js.map} +1 -1
- package/dist/{chunk-Z2CUEBXV.cjs → chunk-NJVV5OAV.cjs} +8 -8
- package/dist/{chunk-Z2CUEBXV.cjs.map → chunk-NJVV5OAV.cjs.map} +1 -1
- package/dist/{chunk-J6T5LWJ4.cjs → chunk-OVGNXGCK.cjs} +9 -9
- package/dist/{chunk-J6T5LWJ4.cjs.map → chunk-OVGNXGCK.cjs.map} +1 -1
- package/dist/{chunk-TIMPJL5V.cjs → chunk-PDOLUFGY.cjs} +4 -4
- package/dist/{chunk-TIMPJL5V.cjs.map → chunk-PDOLUFGY.cjs.map} +1 -1
- package/dist/{chunk-FWBSDQZ7.cjs → chunk-PIBXDEZM.cjs} +5 -5
- package/dist/{chunk-FWBSDQZ7.cjs.map → chunk-PIBXDEZM.cjs.map} +1 -1
- package/dist/{chunk-USZTVNUQ.cjs → chunk-PY7G7YWK.cjs} +5 -5
- package/dist/{chunk-USZTVNUQ.cjs.map → chunk-PY7G7YWK.cjs.map} +1 -1
- package/dist/{chunk-N475ETD6.cjs → chunk-QMIG7TKG.cjs} +17 -17
- package/dist/{chunk-N475ETD6.cjs.map → chunk-QMIG7TKG.cjs.map} +1 -1
- package/dist/{chunk-D7IULBF2.js → chunk-RA2UZBYP.js} +3 -3
- package/dist/{chunk-D7IULBF2.js.map → chunk-RA2UZBYP.js.map} +1 -1
- package/dist/{chunk-7OLG7VI4.cjs → chunk-RHQJX3EI.cjs} +4 -4
- package/dist/{chunk-7OLG7VI4.cjs.map → chunk-RHQJX3EI.cjs.map} +1 -1
- package/dist/{chunk-YP67XZES.js → chunk-RMCHJZNZ.js} +4 -4
- package/dist/{chunk-YP67XZES.js.map → chunk-RMCHJZNZ.js.map} +1 -1
- package/dist/{chunk-ZYB6B7QJ.js → chunk-RMO7HAIF.js} +13 -9
- package/dist/chunk-RMO7HAIF.js.map +1 -0
- package/dist/{chunk-IVSD7L22.js → chunk-RNCN2TTP.js} +8 -4
- package/dist/chunk-RNCN2TTP.js.map +1 -0
- package/dist/{chunk-BQDUEG4C.js → chunk-RTDT2UMT.js} +3 -3
- package/dist/{chunk-BQDUEG4C.js.map → chunk-RTDT2UMT.js.map} +1 -1
- package/dist/{chunk-FRUBE44B.cjs → chunk-TZ47DTM2.cjs} +24 -24
- package/dist/{chunk-FRUBE44B.cjs.map → chunk-TZ47DTM2.cjs.map} +1 -1
- package/dist/{chunk-6YNYA7GD.cjs → chunk-U53AYSHS.cjs} +11 -11
- package/dist/{chunk-6YNYA7GD.cjs.map → chunk-U53AYSHS.cjs.map} +1 -1
- package/dist/{chunk-G4XUXSRN.cjs → chunk-UDSGSPUY.cjs} +12 -12
- package/dist/{chunk-G4XUXSRN.cjs.map → chunk-UDSGSPUY.cjs.map} +1 -1
- package/dist/{chunk-LJX2SQV2.js → chunk-UIPTINIF.js} +6 -6
- package/dist/{chunk-LJX2SQV2.js.map → chunk-UIPTINIF.js.map} +1 -1
- package/dist/{chunk-6NEHIHFU.cjs → chunk-V7CA3CX5.cjs} +4 -4
- package/dist/{chunk-6NEHIHFU.cjs.map → chunk-V7CA3CX5.cjs.map} +1 -1
- package/dist/{chunk-SG5ZWT6C.js → chunk-VQ33XLC6.js} +3 -3
- package/dist/{chunk-SG5ZWT6C.js.map → chunk-VQ33XLC6.js.map} +1 -1
- package/dist/{chunk-AECV3G5Z.js → chunk-VTDQRUAJ.js} +4 -4
- package/dist/{chunk-AECV3G5Z.js.map → chunk-VTDQRUAJ.js.map} +1 -1
- package/dist/{chunk-MC5EINBV.js → chunk-WJOLIPEM.js} +8 -8
- package/dist/{chunk-MC5EINBV.js.map → chunk-WJOLIPEM.js.map} +1 -1
- package/dist/{chunk-7U2HAAWB.cjs → chunk-X2LDDKFM.cjs} +10 -10
- package/dist/{chunk-7U2HAAWB.cjs.map → chunk-X2LDDKFM.cjs.map} +1 -1
- package/dist/{chunk-LGILIGV3.js → chunk-XKGOIGTJ.js} +3 -3
- package/dist/{chunk-LGILIGV3.js.map → chunk-XKGOIGTJ.js.map} +1 -1
- package/dist/{chunk-65ONFZWM.js → chunk-XZ7PO2FM.js} +4 -4
- package/dist/{chunk-65ONFZWM.js.map → chunk-XZ7PO2FM.js.map} +1 -1
- package/dist/{chunk-DCXRHCZJ.cjs → chunk-Z5DYGBPV.cjs} +8 -8
- package/dist/{chunk-DCXRHCZJ.cjs.map → chunk-Z5DYGBPV.cjs.map} +1 -1
- package/dist/{chunk-7YBJZS5P.cjs → chunk-ZAKTZ5B4.cjs} +8 -8
- package/dist/{chunk-7YBJZS5P.cjs.map → chunk-ZAKTZ5B4.cjs.map} +1 -1
- package/dist/compact-session-FCEFK2CG.cjs +55 -0
- package/dist/{compact-session-VVT6IBJG.cjs.map → compact-session-FCEFK2CG.cjs.map} +1 -1
- package/dist/compact-session-KPYRNTQN.js +18 -0
- package/dist/{compact-session-PYEC3NZV.js.map → compact-session-KPYRNTQN.js.map} +1 -1
- package/dist/compaction.cjs +16 -16
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context-DNFT4B5D.cjs +22 -0
- package/dist/{context-2FZSC6VQ.cjs.map → context-DNFT4B5D.cjs.map} +1 -1
- package/dist/context-LYE6TJL5.js +5 -0
- package/dist/{context-ATJJAFOS.js.map → context-LYE6TJL5.js.map} +1 -1
- package/dist/cron.cjs +31 -31
- package/dist/cron.js +30 -30
- package/dist/errors.cjs +21 -21
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +36 -36
- package/dist/eval.js +30 -30
- package/dist/{executor-T65PPOPT.js → executor-PCRX3533.js} +7 -7
- package/dist/{executor-T65PPOPT.js.map → executor-PCRX3533.js.map} +1 -1
- package/dist/{executor-BMRICN46.cjs → executor-TQ3FSZ7F.cjs} +24 -24
- package/dist/{executor-BMRICN46.cjs.map → executor-TQ3FSZ7F.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-V32XJ63Z.cjs +19 -0
- package/dist/{fs-session-store-J5MCFFUM.cjs.map → fs-session-store-V32XJ63Z.cjs.map} +1 -1
- package/dist/fs-session-store-YPZIOLJM.js +10 -0
- package/dist/{fs-session-store-O6FNHECD.js.map → fs-session-store-YPZIOLJM.js.map} +1 -1
- package/dist/generate-object-DLHT5RXH.js +7 -0
- package/dist/{generate-object-XDCBYVK3.js.map → generate-object-DLHT5RXH.js.map} +1 -1
- package/dist/generate-object-QILSGTEJ.cjs +20 -0
- package/dist/{generate-object-UF6WIZLF.cjs.map → generate-object-QILSGTEJ.cjs.map} +1 -1
- package/dist/index-manager-LEMQ73A7.cjs +20 -0
- package/dist/{index-manager-N7RQYUKT.cjs.map → index-manager-LEMQ73A7.cjs.map} +1 -1
- package/dist/index-manager-SXF3FAQV.js +11 -0
- package/dist/{index-manager-ZVZUHPP7.js.map → index-manager-SXF3FAQV.js.map} +1 -1
- package/dist/index.cjs +129 -129
- package/dist/index.js +43 -43
- package/dist/{inject-session-LFCYVSLJ.cjs → inject-session-BIVVFWGL.cjs} +9 -9
- package/dist/{inject-session-LFCYVSLJ.cjs.map → inject-session-BIVVFWGL.cjs.map} +1 -1
- package/dist/{inject-session-GQMTDZUN.js → inject-session-OLWZ2NJN.js} +7 -7
- package/dist/{inject-session-GQMTDZUN.js.map → inject-session-OLWZ2NJN.js.map} +1 -1
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-AIT3EULV.cjs +22 -0
- package/dist/{judge-call-U2D33JOW.cjs.map → judge-call-AIT3EULV.cjs.map} +1 -1
- package/dist/judge-call-NPRU7JIQ.js +5 -0
- package/dist/{judge-call-NA2G6ZMJ.js.map → judge-call-NPRU7JIQ.js.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.js +5 -5
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +26 -26
- package/dist/persistence.js +7 -7
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-AXQXPLFH.js +9 -0
- package/dist/{registry-CAS6Y5ZY.js.map → registry-AXQXPLFH.js.map} +1 -1
- package/dist/registry-VKDFTK6L.cjs +46 -0
- package/dist/{registry-JSDI4WKA.cjs.map → registry-VKDFTK6L.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/sandbox/index.cjs +6 -6
- package/dist/sandbox/index.js +2 -2
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-SLQRKQ72.cjs +50 -0
- package/dist/{session-transcript-H7NUFXXM.cjs.map → session-transcript-SLQRKQ72.cjs.map} +1 -1
- package/dist/session-transcript-X3UMSVL2.js +5 -0
- package/dist/{session-transcript-3B52DKTG.js.map → session-transcript-X3UMSVL2.js.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-3HEUGMQY.cjs +20 -0
- package/dist/{stream-object-4FDU76YW.cjs.map → stream-object-3HEUGMQY.cjs.map} +1 -1
- package/dist/stream-object-VWYW7FJ2.js +7 -0
- package/dist/{stream-object-HWDEEQN4.js.map → stream-object-VWYW7FJ2.js.map} +1 -1
- package/dist/subagents-loader-F52ARQ62.cjs +15 -0
- package/dist/{subagents-loader-A4W6C3QP.cjs.map → subagents-loader-F52ARQ62.cjs.map} +1 -1
- package/dist/subagents-loader-QUIK6GMV.js +6 -0
- package/dist/{subagents-loader-X33KH2SZ.js.map → subagents-loader-QUIK6GMV.js.map} +1 -1
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.js +4 -4
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/package.json +1 -1
- package/dist/agent-I3EZZR6S.cjs +0 -55
- package/dist/agent-KKZYLY5D.js +0 -46
- package/dist/agent-session-store-N4TVKHBU.cjs +0 -23
- package/dist/agent-session-store-RHMHP5DG.js +0 -6
- package/dist/chunk-BCQ3E2ZG.cjs.map +0 -1
- package/dist/chunk-BPN5ONSW.cjs.map +0 -1
- package/dist/chunk-IVSD7L22.js.map +0 -1
- package/dist/chunk-ZYB6B7QJ.js.map +0 -1
- package/dist/compact-session-PYEC3NZV.js +0 -18
- package/dist/compact-session-VVT6IBJG.cjs +0 -55
- package/dist/context-2FZSC6VQ.cjs +0 -22
- package/dist/context-ATJJAFOS.js +0 -5
- package/dist/fs-session-store-J5MCFFUM.cjs +0 -19
- package/dist/fs-session-store-O6FNHECD.js +0 -10
- package/dist/generate-object-UF6WIZLF.cjs +0 -20
- package/dist/generate-object-XDCBYVK3.js +0 -7
- package/dist/index-manager-N7RQYUKT.cjs +0 -20
- package/dist/index-manager-ZVZUHPP7.js +0 -11
- package/dist/judge-call-NA2G6ZMJ.js +0 -5
- package/dist/judge-call-U2D33JOW.cjs +0 -22
- package/dist/registry-CAS6Y5ZY.js +0 -9
- package/dist/registry-JSDI4WKA.cjs +0 -46
- package/dist/session-transcript-3B52DKTG.js +0 -5
- package/dist/session-transcript-H7NUFXXM.cjs +0 -50
- package/dist/stream-object-4FDU76YW.cjs +0 -20
- package/dist/stream-object-HWDEEQN4.js +0 -7
- package/dist/subagents-loader-A4W6C3QP.cjs +0 -15
- package/dist/subagents-loader-X33KH2SZ.js +0 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkELYGL52R_cjs = require('./chunk-ELYGL52R.cjs');
|
|
4
4
|
var chunkBURYFNOM_cjs = require('./chunk-BURYFNOM.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkU53AYSHS_cjs = require('./chunk-U53AYSHS.cjs');
|
|
6
6
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
7
|
+
var chunkNJVV5OAV_cjs = require('./chunk-NJVV5OAV.cjs');
|
|
8
|
+
var chunkOVGNXGCK_cjs = require('./chunk-OVGNXGCK.cjs');
|
|
9
|
+
var chunkUDSGSPUY_cjs = require('./chunk-UDSGSPUY.cjs');
|
|
10
|
+
var chunkE7WWIX34_cjs = require('./chunk-E7WWIX34.cjs');
|
|
11
|
+
var chunkA76OFN2B_cjs = require('./chunk-A76OFN2B.cjs');
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var promises = require('fs/promises');
|
|
14
14
|
var os = require('os');
|
|
@@ -17,7 +17,7 @@ var url = require('url');
|
|
|
17
17
|
var module$1 = require('module');
|
|
18
18
|
|
|
19
19
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
20
|
-
var discoveryState =
|
|
20
|
+
var discoveryState = chunkUDSGSPUY_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
21
21
|
done: false
|
|
22
22
|
}));
|
|
23
23
|
function pluginsRoot() {
|
|
@@ -39,19 +39,19 @@ function loadTrustedNames() {
|
|
|
39
39
|
else discarded += 1;
|
|
40
40
|
}
|
|
41
41
|
if (discarded > 0) {
|
|
42
|
-
|
|
42
|
+
chunkA76OFN2B_cjs.diag(
|
|
43
43
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
44
44
|
`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
} else {
|
|
48
|
-
|
|
48
|
+
chunkA76OFN2B_cjs.diag(
|
|
49
49
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
50
50
|
`
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
} catch {
|
|
54
|
-
|
|
54
|
+
chunkA76OFN2B_cjs.diag(
|
|
55
55
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
56
56
|
`
|
|
57
57
|
);
|
|
@@ -77,7 +77,7 @@ async function discoverProviderPlugins() {
|
|
|
77
77
|
const trusted = loadTrustedNames();
|
|
78
78
|
for (const entry of entries) {
|
|
79
79
|
if (!trusted.has(entry)) {
|
|
80
|
-
|
|
80
|
+
chunkA76OFN2B_cjs.diag(
|
|
81
81
|
`[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
|
|
82
82
|
`
|
|
83
83
|
);
|
|
@@ -96,13 +96,13 @@ async function loadOne(dir, entryName) {
|
|
|
96
96
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
97
97
|
const profile = plugin.profile;
|
|
98
98
|
if (profile !== void 0 && typeof profile === "object") {
|
|
99
|
-
|
|
99
|
+
chunkUDSGSPUY_cjs.registerProvider(profile);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return;
|
|
103
103
|
} catch (err) {
|
|
104
104
|
const msg = err instanceof Error ? err.message : String(err);
|
|
105
|
-
|
|
105
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
106
106
|
`);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
@@ -114,7 +114,7 @@ function mapAnthropicError(args) {
|
|
|
114
114
|
const { status, body, headers, endpoint } = args;
|
|
115
115
|
const code = mapAnthropicStatusToCode(status, body);
|
|
116
116
|
const message = formatMessage(status, code);
|
|
117
|
-
const metadata =
|
|
117
|
+
const metadata = chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
118
118
|
provider: "anthropic",
|
|
119
119
|
endpoint,
|
|
120
120
|
code,
|
|
@@ -123,24 +123,24 @@ function mapAnthropicError(args) {
|
|
|
123
123
|
body
|
|
124
124
|
});
|
|
125
125
|
if (status === 401 || status === 403) {
|
|
126
|
-
return new
|
|
126
|
+
return new chunkE7WWIX34_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
127
127
|
}
|
|
128
128
|
if (status === 429) {
|
|
129
|
-
return new
|
|
129
|
+
return new chunkE7WWIX34_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
130
130
|
}
|
|
131
131
|
if (status === 400) {
|
|
132
|
-
return new
|
|
132
|
+
return new chunkE7WWIX34_cjs.ConfigurationError(message, {
|
|
133
133
|
code: `anthropic_${code}`,
|
|
134
134
|
metadata
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
if (status === 408) {
|
|
138
|
-
return new
|
|
138
|
+
return new chunkE7WWIX34_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
139
139
|
}
|
|
140
140
|
if (status >= 500 && status < 600) {
|
|
141
|
-
return new
|
|
141
|
+
return new chunkE7WWIX34_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
142
142
|
}
|
|
143
|
-
return new
|
|
143
|
+
return new chunkE7WWIX34_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
144
144
|
}
|
|
145
145
|
function mapAnthropicStatusToCode(status, body) {
|
|
146
146
|
if (status === 401 || status === 403) return "auth_failed";
|
|
@@ -211,7 +211,7 @@ function toBlockToolResultContent(content) {
|
|
|
211
211
|
function toStringToolResultContent(content, providerName) {
|
|
212
212
|
if (typeof content === "string") return content;
|
|
213
213
|
if (content.some((block) => block.type === "image")) {
|
|
214
|
-
throw new
|
|
214
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
215
215
|
`provider "${providerName}" does not support image content in tool results`
|
|
216
216
|
);
|
|
217
217
|
}
|
|
@@ -390,7 +390,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
390
390
|
(resolve, reject) => {
|
|
391
391
|
const timer = setTimeout(() => {
|
|
392
392
|
reject(
|
|
393
|
-
new
|
|
393
|
+
new chunkE7WWIX34_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
394
394
|
code: "stream_idle_timeout"
|
|
395
395
|
})
|
|
396
396
|
);
|
|
@@ -467,9 +467,9 @@ function ehAbort(err) {
|
|
|
467
467
|
}
|
|
468
468
|
function wrapTransportError(err, ctx) {
|
|
469
469
|
if (ehAbort(err)) return err;
|
|
470
|
-
if (err instanceof
|
|
470
|
+
if (err instanceof chunkE7WWIX34_cjs.NetworkError) return err;
|
|
471
471
|
const detalhe = err instanceof Error ? err.message : String(err);
|
|
472
|
-
return new
|
|
472
|
+
return new chunkE7WWIX34_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detalhe}`, {
|
|
473
473
|
code: "transport_failure",
|
|
474
474
|
cause: err
|
|
475
475
|
});
|
|
@@ -533,7 +533,7 @@ var AnthropicClient = class {
|
|
|
533
533
|
for (const event of events) yield event;
|
|
534
534
|
}
|
|
535
535
|
if (!accumulator.finishReasonSeen) {
|
|
536
|
-
throw new
|
|
536
|
+
throw new chunkE7WWIX34_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
537
537
|
code: "stream_truncated"
|
|
538
538
|
});
|
|
539
539
|
}
|
|
@@ -686,7 +686,7 @@ function classifyBedrockError(args, awsType, message) {
|
|
|
686
686
|
return "unknown";
|
|
687
687
|
}
|
|
688
688
|
function buildBedrockMetadata(args, code) {
|
|
689
|
-
return
|
|
689
|
+
return chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
690
690
|
provider: "bedrock",
|
|
691
691
|
endpoint: args.endpoint,
|
|
692
692
|
code,
|
|
@@ -703,19 +703,19 @@ function mapBedrockError(args) {
|
|
|
703
703
|
const metadata = buildBedrockMetadata(args, code);
|
|
704
704
|
switch (code) {
|
|
705
705
|
case "rate_limit":
|
|
706
|
-
return new
|
|
706
|
+
return new chunkE7WWIX34_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
707
707
|
case "auth_failed":
|
|
708
|
-
return new
|
|
708
|
+
return new chunkE7WWIX34_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
709
709
|
case "invalid_request": {
|
|
710
710
|
const friendly = message.includes("use case details") ? `Bedrock account setup required: ${message} (AWS Console \u2192 Bedrock \u2192 Model access \u2192 Anthropic \u2192 Submit use case form, then retry in 15 min.)` : `Bedrock validation: ${message}`;
|
|
711
|
-
return new
|
|
711
|
+
return new chunkE7WWIX34_cjs.ConfigurationError(friendly, { metadata });
|
|
712
712
|
}
|
|
713
713
|
case "timeout":
|
|
714
|
-
return new
|
|
714
|
+
return new chunkE7WWIX34_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
715
715
|
case "server_error":
|
|
716
|
-
return new
|
|
716
|
+
return new chunkE7WWIX34_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
717
717
|
default:
|
|
718
|
-
return new
|
|
718
|
+
return new chunkE7WWIX34_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
function parseBody(body) {
|
|
@@ -739,7 +739,7 @@ async function resolveBedrockToken(region) {
|
|
|
739
739
|
return cachedToken.value;
|
|
740
740
|
}
|
|
741
741
|
try {
|
|
742
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
742
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LR3VKB7A.cjs', document.baseURI).href)));
|
|
743
743
|
const gen = r("@aws/bedrock-token-generator");
|
|
744
744
|
if (typeof gen.getToken !== "function") return void 0;
|
|
745
745
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -767,16 +767,16 @@ var BedrockAnthropicClient = class {
|
|
|
767
767
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
768
768
|
const fromEnv = await resolveBedrockToken(region);
|
|
769
769
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
770
|
-
throw new
|
|
770
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
771
771
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
772
772
|
{ code: "auth_failed" }
|
|
773
773
|
);
|
|
774
774
|
}
|
|
775
775
|
async *stream(request, signal) {
|
|
776
|
-
const region =
|
|
776
|
+
const region = chunkUDSGSPUY_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
777
777
|
const token = await this.resolveTokenOrThrow(region);
|
|
778
|
-
const bareModel =
|
|
779
|
-
const baseUrl = this.options.baseUrl ??
|
|
778
|
+
const bareModel = chunkUDSGSPUY_cjs.stripBedrockPrefix(request.model);
|
|
779
|
+
const baseUrl = this.options.baseUrl ?? chunkUDSGSPUY_cjs.resolveBedrockBaseUrl(request.model);
|
|
780
780
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
781
781
|
const url = `${baseUrl}${endpoint}`;
|
|
782
782
|
const response = await postAnthropicRequest({
|
|
@@ -831,7 +831,7 @@ var FaultInjectingLlmClient = class {
|
|
|
831
831
|
return yield* this.inner.stream(request, signal);
|
|
832
832
|
}
|
|
833
833
|
if (parsed.status >= 400) {
|
|
834
|
-
throw
|
|
834
|
+
throw chunkU53AYSHS_cjs.mapOpenAICompatibleError({
|
|
835
835
|
providerId: this.name,
|
|
836
836
|
status: parsed.status,
|
|
837
837
|
body: parsed.body,
|
|
@@ -878,7 +878,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
878
878
|
function warnInvalidJsonOnce(_raw) {
|
|
879
879
|
if (warnedInvalidJson) return;
|
|
880
880
|
warnedInvalidJson = true;
|
|
881
|
-
|
|
881
|
+
chunkA76OFN2B_cjs.diag(
|
|
882
882
|
`[theokit-sdk] ${ENV_OVERRIDE_KEY} is set but value is not valid JSON of shape \`{"status": number, "body": object | string}\`. Falling back to real LLM call. This warning is shown once per process.
|
|
883
883
|
`
|
|
884
884
|
);
|
|
@@ -906,7 +906,7 @@ function mapOllamaTransportError(args) {
|
|
|
906
906
|
if (args.providerId !== "ollama") return void 0;
|
|
907
907
|
const causeCode = extractCauseCode(args.cause);
|
|
908
908
|
if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
|
|
909
|
-
const metadata =
|
|
909
|
+
const metadata = chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
910
910
|
provider: "ollama",
|
|
911
911
|
endpoint: args.endpoint,
|
|
912
912
|
code: "network",
|
|
@@ -914,7 +914,7 @@ function mapOllamaTransportError(args) {
|
|
|
914
914
|
headers: void 0,
|
|
915
915
|
body: { cause: causeCode }
|
|
916
916
|
});
|
|
917
|
-
return new
|
|
917
|
+
return new chunkE7WWIX34_cjs.ConfigurationError(
|
|
918
918
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
919
919
|
{ code: "ollama_unreachable", metadata }
|
|
920
920
|
);
|
|
@@ -924,7 +924,7 @@ function mapOllamaHttpError(args) {
|
|
|
924
924
|
const errString = extractErrorString(args.body).toLowerCase();
|
|
925
925
|
if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
|
|
926
926
|
const modelHint = extractModelName(errString);
|
|
927
|
-
const metadata =
|
|
927
|
+
const metadata = chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
928
928
|
provider: "ollama",
|
|
929
929
|
endpoint: args.endpoint,
|
|
930
930
|
code: "model_unavailable",
|
|
@@ -933,13 +933,13 @@ function mapOllamaHttpError(args) {
|
|
|
933
933
|
body: args.body
|
|
934
934
|
});
|
|
935
935
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
936
|
-
return new
|
|
936
|
+
return new chunkE7WWIX34_cjs.ConfigurationError(
|
|
937
937
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
938
938
|
{ code: "ollama_model_not_pulled", metadata }
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
941
|
if (args.status === 503 && errString.includes("model is loading")) {
|
|
942
|
-
const metadata =
|
|
942
|
+
const metadata = chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
943
943
|
provider: "ollama",
|
|
944
944
|
endpoint: args.endpoint,
|
|
945
945
|
code: "server_error",
|
|
@@ -947,7 +947,7 @@ function mapOllamaHttpError(args) {
|
|
|
947
947
|
headers: args.headers,
|
|
948
948
|
body: args.body
|
|
949
949
|
});
|
|
950
|
-
return new
|
|
950
|
+
return new chunkE7WWIX34_cjs.NetworkError(
|
|
951
951
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
952
952
|
{ code: "ollama_model_loading", metadata }
|
|
953
953
|
);
|
|
@@ -1168,7 +1168,7 @@ function toOllamaMessages(message) {
|
|
|
1168
1168
|
}
|
|
1169
1169
|
if (message.role === "user") {
|
|
1170
1170
|
if (message.content.some((p) => p.type === "image")) {
|
|
1171
|
-
throw new
|
|
1171
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
1172
1172
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1173
1173
|
{ code: "ollama_image_unsupported" }
|
|
1174
1174
|
);
|
|
@@ -1297,7 +1297,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1297
1297
|
try {
|
|
1298
1298
|
return await fetchFn(url, init);
|
|
1299
1299
|
} catch (cause) {
|
|
1300
|
-
throw new
|
|
1300
|
+
throw new chunkE7WWIX34_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
1303
|
async function safeParseJsonResponse(response) {
|
|
@@ -1324,7 +1324,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1324
1324
|
cause: body
|
|
1325
1325
|
};
|
|
1326
1326
|
if (envelope.code === "integration_not_connected") {
|
|
1327
|
-
return new
|
|
1327
|
+
return new chunkE7WWIX34_cjs.IntegrationNotConnectedError(message, {
|
|
1328
1328
|
provider: envelope.provider ?? "unknown",
|
|
1329
1329
|
helpUrl: envelope.helpUrl ?? "",
|
|
1330
1330
|
code: envelope.code,
|
|
@@ -1332,18 +1332,18 @@ function mapHttpStatusToError(status, body) {
|
|
|
1332
1332
|
});
|
|
1333
1333
|
}
|
|
1334
1334
|
if (status === 401 || status === 403) {
|
|
1335
|
-
return new
|
|
1335
|
+
return new chunkE7WWIX34_cjs.AuthenticationError(message, errorOptions);
|
|
1336
1336
|
}
|
|
1337
1337
|
if (status === 429) {
|
|
1338
|
-
return new
|
|
1338
|
+
return new chunkE7WWIX34_cjs.RateLimitError(message, errorOptions);
|
|
1339
1339
|
}
|
|
1340
1340
|
if (status >= 400 && status < 500) {
|
|
1341
|
-
return new
|
|
1341
|
+
return new chunkE7WWIX34_cjs.ConfigurationError(message, errorOptions);
|
|
1342
1342
|
}
|
|
1343
1343
|
if (status >= 500) {
|
|
1344
|
-
return new
|
|
1344
|
+
return new chunkE7WWIX34_cjs.NetworkError(message, errorOptions);
|
|
1345
1345
|
}
|
|
1346
|
-
return new
|
|
1346
|
+
return new chunkE7WWIX34_cjs.UnknownAgentError(message, errorOptions);
|
|
1347
1347
|
}
|
|
1348
1348
|
function extractErrorEnvelope(body) {
|
|
1349
1349
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1597,7 +1597,7 @@ var OpenAIClient = class {
|
|
|
1597
1597
|
endpoint: "/v1/chat/completions"
|
|
1598
1598
|
});
|
|
1599
1599
|
if (ollamaMapped !== void 0) throw ollamaMapped;
|
|
1600
|
-
throw
|
|
1600
|
+
throw chunkU53AYSHS_cjs.mapOpenAICompatibleError({
|
|
1601
1601
|
providerId,
|
|
1602
1602
|
status: response.status,
|
|
1603
1603
|
body,
|
|
@@ -1626,7 +1626,7 @@ var OpenAIClient = class {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
1628
1628
|
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
1629
|
-
throw
|
|
1629
|
+
throw chunkU53AYSHS_cjs.mapOpenAICompatibleError({
|
|
1630
1630
|
providerId,
|
|
1631
1631
|
status,
|
|
1632
1632
|
body: chunk,
|
|
@@ -1638,7 +1638,7 @@ var OpenAIClient = class {
|
|
|
1638
1638
|
for (const event of events) yield event;
|
|
1639
1639
|
}
|
|
1640
1640
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1641
|
-
throw new
|
|
1641
|
+
throw new chunkE7WWIX34_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1642
1642
|
code: "stream_truncated"
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
@@ -1770,13 +1770,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1770
1770
|
toolCalls.push(...recovered.toolCalls);
|
|
1771
1771
|
text = recovered.residualText;
|
|
1772
1772
|
stopReason = "tool_use";
|
|
1773
|
-
|
|
1773
|
+
chunkA76OFN2B_cjs.diag(
|
|
1774
1774
|
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
1775
1775
|
`
|
|
1776
1776
|
);
|
|
1777
1777
|
}
|
|
1778
1778
|
if (recovered.droppedNames.length > 0) {
|
|
1779
|
-
|
|
1779
|
+
chunkA76OFN2B_cjs.diag(
|
|
1780
1780
|
`[theokit-sdk] dropped ${recovered.droppedNames.length} leaked block(s) whose name is not a tool in the request (provider="${this.providerName}", names=${recovered.droppedNames.join(",")})
|
|
1781
1781
|
`
|
|
1782
1782
|
);
|
|
@@ -1898,10 +1898,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
1898
1898
|
const firstResult = await generator.next();
|
|
1899
1899
|
return { kind: "ok", generator, firstResult };
|
|
1900
1900
|
} catch (cause) {
|
|
1901
|
-
if (cause instanceof
|
|
1901
|
+
if (cause instanceof chunkE7WWIX34_cjs.NetworkError || cause instanceof chunkE7WWIX34_cjs.RateLimitError || cause instanceof chunkE7WWIX34_cjs.AuthenticationError) {
|
|
1902
1902
|
if (logFallback) {
|
|
1903
1903
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
1904
|
-
|
|
1904
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
1905
1905
|
`);
|
|
1906
1906
|
}
|
|
1907
1907
|
return { kind: "handshake_error", error: cause };
|
|
@@ -1943,7 +1943,7 @@ var PoolAwareLlmClient = class {
|
|
|
1943
1943
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: stream() must serialize pool-select → build client → first-event probe → classify → retry/rotate/propagate. Extracting helpers fragments the linear narrative; the comments above each branch keep it readable.
|
|
1944
1944
|
async *stream(request, signal) {
|
|
1945
1945
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
1946
|
-
throw new
|
|
1946
|
+
throw new chunkE7WWIX34_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
1947
1947
|
code: "circuit_open"
|
|
1948
1948
|
});
|
|
1949
1949
|
}
|
|
@@ -1962,7 +1962,7 @@ var PoolAwareLlmClient = class {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
if (entry === null) {
|
|
1964
1964
|
this.breaker.recordTimeout(this.pool.provider);
|
|
1965
|
-
throw new
|
|
1965
|
+
throw new chunkE7WWIX34_cjs.CredentialPoolExhaustedError(
|
|
1966
1966
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
1967
1967
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
1968
1968
|
);
|
|
@@ -1976,13 +1976,13 @@ var PoolAwareLlmClient = class {
|
|
|
1976
1976
|
}
|
|
1977
1977
|
const decision = classifyAndDecide(attempt.error, hasRetried429);
|
|
1978
1978
|
if (decision === "retry") {
|
|
1979
|
-
const backoffMs =
|
|
1979
|
+
const backoffMs = chunkELYGL52R_cjs.computeBackoffMs({
|
|
1980
1980
|
attempt: 0,
|
|
1981
1981
|
...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
|
|
1982
1982
|
...this.rng !== void 0 ? { rng: this.rng } : {}
|
|
1983
1983
|
});
|
|
1984
1984
|
this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
|
|
1985
|
-
await
|
|
1985
|
+
await chunkELYGL52R_cjs.sleepWithAbort(backoffMs, signal);
|
|
1986
1986
|
hasRetried429 = true;
|
|
1987
1987
|
continue;
|
|
1988
1988
|
}
|
|
@@ -1994,7 +1994,7 @@ var PoolAwareLlmClient = class {
|
|
|
1994
1994
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
1995
1995
|
});
|
|
1996
1996
|
} catch (persistErr) {
|
|
1997
|
-
|
|
1997
|
+
chunkA76OFN2B_cjs.diag(
|
|
1998
1998
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
1999
1999
|
`
|
|
2000
2000
|
);
|
|
@@ -2016,8 +2016,8 @@ var PoolAwareLlmClient = class {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
};
|
|
2018
2018
|
function classifyAndDecide(error, hasRetried429) {
|
|
2019
|
-
if (error instanceof
|
|
2020
|
-
if (error instanceof
|
|
2019
|
+
if (error instanceof chunkE7WWIX34_cjs.NetworkError) return "propagate";
|
|
2020
|
+
if (error instanceof chunkE7WWIX34_cjs.AuthenticationError) return "rotate";
|
|
2021
2021
|
const status = error.metadata?.statusCode ?? 429;
|
|
2022
2022
|
if (status === 402) return "rotate";
|
|
2023
2023
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2030,8 +2030,8 @@ function parseRetryAfterMs(error) {
|
|
|
2030
2030
|
return void 0;
|
|
2031
2031
|
}
|
|
2032
2032
|
function inferStatusCode(error) {
|
|
2033
|
-
if (error instanceof
|
|
2034
|
-
if (error instanceof
|
|
2033
|
+
if (error instanceof chunkE7WWIX34_cjs.AuthenticationError) return 401;
|
|
2034
|
+
if (error instanceof chunkE7WWIX34_cjs.RateLimitError) return 429;
|
|
2035
2035
|
return 0;
|
|
2036
2036
|
}
|
|
2037
2037
|
function abortError(signal) {
|
|
@@ -2139,7 +2139,7 @@ var ResponsesApiClient = class {
|
|
|
2139
2139
|
body = JSON.parse(text2);
|
|
2140
2140
|
} catch {
|
|
2141
2141
|
}
|
|
2142
|
-
throw
|
|
2142
|
+
throw chunkU53AYSHS_cjs.mapOpenAICompatibleError({
|
|
2143
2143
|
providerId,
|
|
2144
2144
|
status: response.status,
|
|
2145
2145
|
body,
|
|
@@ -2210,7 +2210,7 @@ var ResponsesApiClient = class {
|
|
|
2210
2210
|
} else if (t === "response.failed" || t === "error") {
|
|
2211
2211
|
const msg = event.response?.error?.message ?? event.message ?? "responses stream failed";
|
|
2212
2212
|
yield { type: "error", message: msg };
|
|
2213
|
-
throw
|
|
2213
|
+
throw chunkU53AYSHS_cjs.mapOpenAICompatibleError({
|
|
2214
2214
|
providerId,
|
|
2215
2215
|
status: 502,
|
|
2216
2216
|
body: { error: { message: msg } },
|
|
@@ -2241,14 +2241,14 @@ function abortError2(signal) {
|
|
|
2241
2241
|
// src/internal/llm/retrying-client.ts
|
|
2242
2242
|
var MAX_ATTEMPTS = 3;
|
|
2243
2243
|
function isRetriableError(err) {
|
|
2244
|
-
if (!
|
|
2245
|
-
if (err instanceof
|
|
2246
|
-
if (err instanceof
|
|
2247
|
-
if (err instanceof
|
|
2244
|
+
if (!chunkE7WWIX34_cjs.isTransientError(err)) return false;
|
|
2245
|
+
if (err instanceof chunkE7WWIX34_cjs.CredentialPoolExhaustedError) return false;
|
|
2246
|
+
if (err instanceof chunkE7WWIX34_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2247
|
+
if (err instanceof chunkE7WWIX34_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2248
2248
|
return true;
|
|
2249
2249
|
}
|
|
2250
2250
|
function retryAfterHintMs(err) {
|
|
2251
|
-
if (!(err instanceof
|
|
2251
|
+
if (!(err instanceof chunkE7WWIX34_cjs.RateLimitError)) return void 0;
|
|
2252
2252
|
const seconds = err.metadata?.retryAfter;
|
|
2253
2253
|
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2254
2254
|
}
|
|
@@ -2294,12 +2294,16 @@ var RetryingLlmClient = class {
|
|
|
2294
2294
|
*/
|
|
2295
2295
|
async #waitBackoff(err, attempt, signal) {
|
|
2296
2296
|
const hint = retryAfterHintMs(err);
|
|
2297
|
-
const ms =
|
|
2297
|
+
const ms = chunkELYGL52R_cjs.computeBackoffMs({
|
|
2298
2298
|
attempt,
|
|
2299
2299
|
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2300
2300
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2301
2301
|
});
|
|
2302
|
-
|
|
2302
|
+
const cause = err instanceof Error ? err.name : typeof err;
|
|
2303
|
+
chunkA76OFN2B_cjs.diag(
|
|
2304
|
+
`retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
|
|
2305
|
+
);
|
|
2306
|
+
await chunkELYGL52R_cjs.sleepWithAbort(ms, signal);
|
|
2303
2307
|
}
|
|
2304
2308
|
async *stream(request, signal) {
|
|
2305
2309
|
let lastError;
|
|
@@ -2337,7 +2341,7 @@ function classifyVertexError(args, errStatus) {
|
|
|
2337
2341
|
return "unknown";
|
|
2338
2342
|
}
|
|
2339
2343
|
function vertexMetadata(args, code) {
|
|
2340
|
-
return
|
|
2344
|
+
return chunkU53AYSHS_cjs.buildErrorMetadata({
|
|
2341
2345
|
provider: "vertex",
|
|
2342
2346
|
endpoint: args.endpoint,
|
|
2343
2347
|
code,
|
|
@@ -2347,23 +2351,23 @@ function vertexMetadata(args, code) {
|
|
|
2347
2351
|
});
|
|
2348
2352
|
}
|
|
2349
2353
|
var VERTEX_ERROR_BUILDERS = {
|
|
2350
|
-
rate_limit: (args, msg) => new
|
|
2354
|
+
rate_limit: (args, msg) => new chunkE7WWIX34_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2351
2355
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2352
2356
|
}),
|
|
2353
|
-
auth_unauthenticated: (args, msg) => new
|
|
2357
|
+
auth_unauthenticated: (args, msg) => new chunkE7WWIX34_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2354
2358
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2355
2359
|
}),
|
|
2356
|
-
auth_permission: (args, msg) => new
|
|
2360
|
+
auth_permission: (args, msg) => new chunkE7WWIX34_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2357
2361
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2358
2362
|
}),
|
|
2359
|
-
invalid_request: (args, msg) => new
|
|
2363
|
+
invalid_request: (args, msg) => new chunkE7WWIX34_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2360
2364
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2361
2365
|
}),
|
|
2362
|
-
timeout: (args, msg) => new
|
|
2363
|
-
server_error: (args, msg) => new
|
|
2366
|
+
timeout: (args, msg) => new chunkE7WWIX34_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2367
|
+
server_error: (args, msg) => new chunkE7WWIX34_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2364
2368
|
metadata: vertexMetadata(args, "server_error")
|
|
2365
2369
|
}),
|
|
2366
|
-
unknown: (args, msg) => new
|
|
2370
|
+
unknown: (args, msg) => new chunkE7WWIX34_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2367
2371
|
};
|
|
2368
2372
|
function mapVertexError(args) {
|
|
2369
2373
|
const parsed = parseBody2(args.body);
|
|
@@ -2399,12 +2403,12 @@ async function resolveVertexAccessToken() {
|
|
|
2399
2403
|
async function getAuthClientOrThrow() {
|
|
2400
2404
|
let mod;
|
|
2401
2405
|
try {
|
|
2402
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2406
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LR3VKB7A.cjs', document.baseURI).href)));
|
|
2403
2407
|
mod = r("google-auth-library");
|
|
2404
2408
|
} catch (err) {
|
|
2405
2409
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2406
2410
|
if (isModuleMissing) {
|
|
2407
|
-
throw new
|
|
2411
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2408
2412
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2409
2413
|
{ code: "auth_failed", cause: err }
|
|
2410
2414
|
);
|
|
@@ -2415,7 +2419,7 @@ async function getAuthClientOrThrow() {
|
|
|
2415
2419
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2416
2420
|
return await auth.getClient();
|
|
2417
2421
|
} catch (err) {
|
|
2418
|
-
|
|
2422
|
+
chunkA76OFN2B_cjs.diag(
|
|
2419
2423
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2420
2424
|
`
|
|
2421
2425
|
);
|
|
@@ -2441,7 +2445,7 @@ var VertexAnthropicClient = class {
|
|
|
2441
2445
|
resolveProjectOrThrow() {
|
|
2442
2446
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2443
2447
|
if (projectId !== void 0) return projectId;
|
|
2444
|
-
throw new
|
|
2448
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2445
2449
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2446
2450
|
{ code: "auth_failed" }
|
|
2447
2451
|
);
|
|
@@ -2451,7 +2455,7 @@ var VertexAnthropicClient = class {
|
|
|
2451
2455
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2452
2456
|
const fromAdc = await resolveVertexAccessToken();
|
|
2453
2457
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2454
|
-
throw new
|
|
2458
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2455
2459
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2456
2460
|
{ code: "auth_failed" }
|
|
2457
2461
|
);
|
|
@@ -2460,8 +2464,8 @@ var VertexAnthropicClient = class {
|
|
|
2460
2464
|
const projectId = this.resolveProjectOrThrow();
|
|
2461
2465
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2462
2466
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2463
|
-
const baseUrl =
|
|
2464
|
-
const bareModel =
|
|
2467
|
+
const baseUrl = chunkUDSGSPUY_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2468
|
+
const bareModel = chunkUDSGSPUY_cjs.stripVertexPrefix(request.model);
|
|
2465
2469
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2466
2470
|
const url = `${baseUrl}${endpoint}`;
|
|
2467
2471
|
const response = await postAnthropicRequest({
|
|
@@ -2497,7 +2501,7 @@ var VertexGeminiClient = class {
|
|
|
2497
2501
|
async *stream(request, signal) {
|
|
2498
2502
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2499
2503
|
if (projectId === void 0) {
|
|
2500
|
-
throw new
|
|
2504
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2501
2505
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2502
2506
|
{ code: "auth_failed" }
|
|
2503
2507
|
);
|
|
@@ -2505,12 +2509,12 @@ var VertexGeminiClient = class {
|
|
|
2505
2509
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2506
2510
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2507
2511
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2508
|
-
throw new
|
|
2512
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2509
2513
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2510
2514
|
{ code: "auth_failed" }
|
|
2511
2515
|
);
|
|
2512
2516
|
}
|
|
2513
|
-
const baseUrl =
|
|
2517
|
+
const baseUrl = chunkUDSGSPUY_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2514
2518
|
const url = `${baseUrl}/chat/completions`;
|
|
2515
2519
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2516
2520
|
const rewriteFetch = (input, init) => {
|
|
@@ -2536,7 +2540,7 @@ var VertexRouterClient = class {
|
|
|
2536
2540
|
options;
|
|
2537
2541
|
name = "vertex";
|
|
2538
2542
|
async *stream(request, signal) {
|
|
2539
|
-
const dialect =
|
|
2543
|
+
const dialect = chunkUDSGSPUY_cjs.inferModelDialect(request.model);
|
|
2540
2544
|
if (dialect === "anthropic") {
|
|
2541
2545
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2542
2546
|
return yield* inner2.stream(request, signal);
|
|
@@ -2548,7 +2552,7 @@ var VertexRouterClient = class {
|
|
|
2548
2552
|
|
|
2549
2553
|
// src/internal/llm/router.ts
|
|
2550
2554
|
function resolveProviderChain(options) {
|
|
2551
|
-
|
|
2555
|
+
chunkUDSGSPUY_cjs.registerBuiltins();
|
|
2552
2556
|
return buildChain(options);
|
|
2553
2557
|
}
|
|
2554
2558
|
function buildChain(options) {
|
|
@@ -2565,7 +2569,7 @@ function buildChain(options) {
|
|
|
2565
2569
|
addClient(options.primary);
|
|
2566
2570
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2567
2571
|
if (clients.length === 0) {
|
|
2568
|
-
throw new
|
|
2572
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2569
2573
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2570
2574
|
{ code: "provider_unresolved" }
|
|
2571
2575
|
);
|
|
@@ -2573,11 +2577,11 @@ function buildChain(options) {
|
|
|
2573
2577
|
return clients;
|
|
2574
2578
|
}
|
|
2575
2579
|
function buildClient(name, routerOptions) {
|
|
2576
|
-
const baseProfile =
|
|
2580
|
+
const baseProfile = chunkUDSGSPUY_cjs.getProviderProfile(name);
|
|
2577
2581
|
if (baseProfile === void 0) return void 0;
|
|
2578
2582
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2579
2583
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2580
|
-
const ambient =
|
|
2584
|
+
const ambient = chunkELYGL52R_cjs.currentCredentialPool(name);
|
|
2581
2585
|
if (ambient !== void 0) {
|
|
2582
2586
|
return new RetryingLlmClient(
|
|
2583
2587
|
new PoolAwareLlmClient(
|
|
@@ -2607,9 +2611,9 @@ function buildPoolOrSingle(args) {
|
|
|
2607
2611
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2608
2612
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2609
2613
|
const entries = poolKeys.map(
|
|
2610
|
-
(accessToken, priority) =>
|
|
2614
|
+
(accessToken, priority) => chunkELYGL52R_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2611
2615
|
);
|
|
2612
|
-
const pool = new
|
|
2616
|
+
const pool = new chunkELYGL52R_cjs.CredentialPool(name, entries, strategy);
|
|
2613
2617
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2614
2618
|
return new RetryingLlmClient(
|
|
2615
2619
|
new PoolAwareLlmClient(
|
|
@@ -2644,7 +2648,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2644
2648
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2645
2649
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2646
2650
|
warnedNoAuthApiKeys.add(provider);
|
|
2647
|
-
|
|
2651
|
+
chunkA76OFN2B_cjs.diag(
|
|
2648
2652
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2649
2653
|
`
|
|
2650
2654
|
);
|
|
@@ -2670,10 +2674,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2670
2674
|
if (apiKeys === void 0) return;
|
|
2671
2675
|
for (const name of Object.keys(apiKeys)) {
|
|
2672
2676
|
if (warnedProviders.has(name)) continue;
|
|
2673
|
-
const profile =
|
|
2677
|
+
const profile = chunkUDSGSPUY_cjs.getProviderProfile(name);
|
|
2674
2678
|
if (profile === void 0) {
|
|
2675
2679
|
warnedProviders.add(name);
|
|
2676
|
-
|
|
2680
|
+
chunkA76OFN2B_cjs.diag(
|
|
2677
2681
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2678
2682
|
`
|
|
2679
2683
|
);
|
|
@@ -2705,7 +2709,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2705
2709
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2706
2710
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2707
2711
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2708
|
-
throw new
|
|
2712
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2709
2713
|
`provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
|
|
2710
2714
|
);
|
|
2711
2715
|
}
|
|
@@ -2756,7 +2760,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2756
2760
|
providerName: profile.name
|
|
2757
2761
|
});
|
|
2758
2762
|
}
|
|
2759
|
-
throw new
|
|
2763
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2760
2764
|
`Provider "${profile.name}" requires apiMode "${profile.apiMode}" but no transport is registered. Install a third-party transport plugin (@theokit-transport-${profile.apiMode}) or use a provider with apiMode "chat_completions" or "anthropic_messages".`,
|
|
2761
2765
|
{ code: "transport_unavailable" }
|
|
2762
2766
|
);
|
|
@@ -2771,7 +2775,7 @@ function inferProviderFromApiKey(apiKey) {
|
|
|
2771
2775
|
{ provider: "openai", prefix: "sk-" }
|
|
2772
2776
|
];
|
|
2773
2777
|
for (const { provider, prefix } of byPrefix) {
|
|
2774
|
-
if (apiKey.startsWith(prefix) &&
|
|
2778
|
+
if (apiKey.startsWith(prefix) && chunkUDSGSPUY_cjs.getProviderProfile(provider) !== void 0) {
|
|
2775
2779
|
return provider;
|
|
2776
2780
|
}
|
|
2777
2781
|
}
|
|
@@ -2910,7 +2914,7 @@ function plainText(content) {
|
|
|
2910
2914
|
}
|
|
2911
2915
|
async function compactSessionTranscript(opts) {
|
|
2912
2916
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
2913
|
-
const history =
|
|
2917
|
+
const history = chunkNJVV5OAV_cjs.reconstructMessages(prior);
|
|
2914
2918
|
const compressible = [];
|
|
2915
2919
|
for (const m of history) {
|
|
2916
2920
|
const text = plainText(m.content);
|
|
@@ -2918,14 +2922,14 @@ async function compactSessionTranscript(opts) {
|
|
|
2918
2922
|
compressible.push({ role: m.role, content: text });
|
|
2919
2923
|
}
|
|
2920
2924
|
}
|
|
2921
|
-
const preTokens =
|
|
2925
|
+
const preTokens = chunkOVGNXGCK_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
2922
2926
|
const summaryBody = await opts.summarize(compressible);
|
|
2923
2927
|
const preserved = [];
|
|
2924
2928
|
let budget = 0;
|
|
2925
2929
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
2926
2930
|
const m = compressible[i];
|
|
2927
2931
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
2928
|
-
const cost =
|
|
2932
|
+
const cost = chunkOVGNXGCK_cjs.estimateTokens(m.content);
|
|
2929
2933
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
2930
2934
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
2931
2935
|
if (remaining > 50) {
|
|
@@ -2939,7 +2943,7 @@ async function compactSessionTranscript(opts) {
|
|
|
2939
2943
|
}
|
|
2940
2944
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
2941
2945
|
${summaryBody}`;
|
|
2942
|
-
const transcript =
|
|
2946
|
+
const transcript = chunkNJVV5OAV_cjs.SessionTranscript.fromRecords(prior, {
|
|
2943
2947
|
cwd: opts.loc.cwd,
|
|
2944
2948
|
sessionId: opts.sessionId,
|
|
2945
2949
|
model: opts.loc.model ?? "unknown"
|
|
@@ -2950,7 +2954,7 @@ ${summaryBody}`;
|
|
|
2950
2954
|
const delta = transcript.records().slice(prior.length);
|
|
2951
2955
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
2952
2956
|
chunkBURYFNOM_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
2953
|
-
const postTokens =
|
|
2957
|
+
const postTokens = chunkOVGNXGCK_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
2954
2958
|
return { preTokens, postTokens };
|
|
2955
2959
|
}
|
|
2956
2960
|
function resolveSummarizerRoute(opts) {
|
|
@@ -2959,9 +2963,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
2959
2963
|
}
|
|
2960
2964
|
function buildDefaultSummarizer(opts) {
|
|
2961
2965
|
return async (messages) => {
|
|
2962
|
-
|
|
2966
|
+
chunkUDSGSPUY_cjs.registerBuiltins();
|
|
2963
2967
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
2964
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
2968
|
+
const prefixProfile = modelPrefix !== void 0 ? chunkUDSGSPUY_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
2965
2969
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
2966
2970
|
const route = resolveSummarizerRoute({
|
|
2967
2971
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3032,7 +3036,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3032
3036
|
return true;
|
|
3033
3037
|
} catch (cause) {
|
|
3034
3038
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3035
|
-
|
|
3039
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3036
3040
|
`);
|
|
3037
3041
|
return false;
|
|
3038
3042
|
}
|
|
@@ -3063,5 +3067,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3063
3067
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3064
3068
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3065
3069
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3066
|
-
//# sourceMappingURL=chunk-
|
|
3067
|
-
//# sourceMappingURL=chunk-
|
|
3070
|
+
//# sourceMappingURL=chunk-LR3VKB7A.cjs.map
|
|
3071
|
+
//# sourceMappingURL=chunk-LR3VKB7A.cjs.map
|