autohand-cli 0.9.0 → 0.9.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/README.md +118 -76
- package/dist/AgentRegistry-BBQRODQC.cjs +18 -0
- package/dist/AgentRegistry-JBXZUPML.js +18 -0
- package/dist/{CommunitySkillsCache-ZEQWP6YM.js → CommunitySkillsCache-CI7UN2DX.js} +2 -2
- package/dist/CommunitySkillsCache-XTQ6RMTA.cjs +8 -0
- package/dist/{HookManager-CWLTFKWO.js → HookManager-BELBPQQI.js} +1 -1
- package/dist/{HookManager-TMAJQU4S.cjs → HookManager-ZL2CLAJW.cjs} +2 -2
- package/dist/{ImportWizard-MQXEED2U.cjs → ImportWizard-U6CIJREW.cjs} +13 -13
- package/dist/{ImportWizard-QBKQEXDW.js → ImportWizard-VJFSWSUQ.js} +4 -4
- package/dist/LearnAdvisor-LAURA3IB.cjs +9 -0
- package/dist/LearnAdvisor-RFOBXFG7.js +9 -0
- package/dist/MemoryManager-3A2VRPF2.js +9 -0
- package/dist/MemoryManager-UOEQZIDC.cjs +9 -0
- package/dist/{NVIDIAProvider-2HR737UE.js → NVIDIAProvider-AFNJNWJM.js} +1 -1
- package/dist/NVIDIAProvider-L5GTYRCQ.cjs +14 -0
- package/dist/{PermissionManager-KMYILJ4Z.js → PermissionManager-N2LDSOYF.js} +3 -3
- package/dist/PermissionManager-ZNURIEYR.cjs +11 -0
- package/dist/ProviderFactory-3BFS65V7.cjs +13 -0
- package/dist/{ProviderFactory-HFPRVQ25.js → ProviderFactory-XUT6BSGB.js} +4 -2
- package/dist/SessionManager-LGPQIA57.cjs +10 -0
- package/dist/{SessionManager-PNBTJJTQ.js → SessionManager-OR4KDDDS.js} +2 -2
- package/dist/{SkillsRegistry-4RRD5GMX.js → SkillsRegistry-IL3GWROU.js} +2 -2
- package/dist/SkillsRegistry-PM34DQNA.cjs +9 -0
- package/dist/SubAgent-2WG4QQB5.cjs +13 -0
- package/dist/SubAgent-ICGN23TQ.js +13 -0
- package/dist/{SyncApiClient-LRPFNCKJ.js → SyncApiClient-G3FM65IV.js} +1 -1
- package/dist/SyncApiClient-ODBDECOG.cjs +11 -0
- package/dist/{about-BW3PDZUU.js → about-OYVGQMJJ.js} +5 -4
- package/dist/about-U2BH7HDR.cjs +15 -0
- package/dist/{acp-VHEL7BOW.js → acp-JWHGXZL5.js} +207 -102
- package/dist/{acp-EOETGAHC.cjs → acp-S37JOBCS.cjs} +226 -121
- package/dist/actionExecutor-2QEPMELQ.cjs +28 -0
- package/dist/actionExecutor-6NCCORRB.js +28 -0
- package/dist/add-dir-KFUHSIR2.cjs +11 -0
- package/dist/{add-dir-VFX7QT4E.js → add-dir-MM2BM2Z2.js} +2 -2
- package/dist/agent-DUIYLIVN.js +132 -0
- package/dist/agent-YYEHGDAK.cjs +132 -0
- package/dist/agents-GBGG4CW7.cjs +19 -0
- package/dist/agents-ZH34C72F.js +19 -0
- package/dist/agents-new-ERXLS7SB.cjs +17 -0
- package/dist/agents-new-EVTGPTA4.js +17 -0
- package/dist/{autoSkill-EFMK6WU6.js → autoSkill-HEWKJ5JV.js} +2 -2
- package/dist/autoSkill-YL6PN6AV.cjs +20 -0
- package/dist/automode-4BJ7FNPL.cjs +10 -0
- package/dist/{automode-BMYSRM34.js → automode-S4U7A7Q2.js} +2 -2
- package/dist/chrome-45ZXHL5N.cjs +22 -0
- package/dist/{chrome-NHJ44WUN.js → chrome-BBSRVG6S.js} +2 -2
- package/dist/chrome-IFVZRHAT.cjs +50 -0
- package/dist/chrome-MYE6DNA2.js +22 -0
- package/dist/chunk-24CEJYEG.cjs +579 -0
- package/dist/{chunk-47PHDKNW.cjs → chunk-255GIVM2.cjs} +6 -6
- package/dist/{chunk-DIZTWFVR.cjs → chunk-2BDSR2OW.cjs} +238 -61
- package/dist/{chunk-BL2UC7HC.js → chunk-2BPIR7LA.js} +121 -4
- package/dist/{chunk-BQ22N3TX.cjs → chunk-2NY7OHBF.cjs} +47 -27
- package/dist/chunk-2WUNHTXL.js +303 -0
- package/dist/{chunk-HQWQZML5.cjs → chunk-34B6ZO6W.cjs} +124 -7
- package/dist/{chunk-5JTTM5SC.js → chunk-3BJN7GAH.js} +1 -1
- package/dist/{chunk-4256YRCO.cjs → chunk-3CAXECWJ.cjs} +30 -17
- package/dist/{chunk-KNTUI4TZ.cjs → chunk-3CBYUBZC.cjs} +5 -5
- package/dist/chunk-3DF3GZQ7.js +277 -0
- package/dist/{chunk-E26KKI46.cjs → chunk-3JURXAL6.cjs} +61 -8
- package/dist/{chunk-MOJ7ADW4.cjs → chunk-3KWAP2Y3.cjs} +88 -9
- package/dist/{chunk-OHWMWKJQ.js → chunk-3MCK6UBL.js} +1 -1
- package/dist/{chunk-5VHP6HDQ.js → chunk-3TH7IK4M.js} +62 -9
- package/dist/{chunk-ACDQGA4Z.js → chunk-3V77OB3W.js} +7 -72
- package/dist/{chunk-HS4USDND.cjs → chunk-3Y5UEK7K.cjs} +4 -4
- package/dist/{chunk-XV2HXRHX.js → chunk-4GPPSBEZ.js} +3 -3
- package/dist/chunk-5CMBAJ6K.js +377 -0
- package/dist/{chunk-MO4KP6XS.cjs → chunk-5YRXFBYZ.cjs} +35 -6
- package/dist/chunk-5ZNYX4VH.cjs +71 -0
- package/dist/chunk-6AC2TT26.js +156 -0
- package/dist/{chunk-UGFVM77J.cjs → chunk-6EIQ6A6U.cjs} +2 -2
- package/dist/{chunk-SWCQM52V.js → chunk-6HSEDXVF.js} +4 -4
- package/dist/{chunk-QQ7PANOP.js → chunk-6NUXK62F.js} +1 -1
- package/dist/{chunk-5CMYEM3R.cjs → chunk-6TGCAPYH.cjs} +62 -9
- package/dist/{chunk-NMQ47RCG.js → chunk-6W3SZCSP.js} +1 -1
- package/dist/{chunk-VRMZO6TB.js → chunk-73LV3DDZ.js} +7 -6
- package/dist/{chunk-3GUEUCZK.js → chunk-7BGGLIQF.js} +85 -1
- package/dist/{chunk-RBHANOYY.js → chunk-7DJJGKM6.js} +47 -3
- package/dist/{chunk-LQBONA55.cjs → chunk-7EEK7CRR.cjs} +85 -1
- package/dist/chunk-7TO3PDMV.cjs +324 -0
- package/dist/chunk-7UU22RSH.cjs +277 -0
- package/dist/{chunk-E6GFD7VR.cjs → chunk-A3GAM6FM.cjs} +11 -11
- package/dist/{chunk-DEQVRSV5.cjs → chunk-A7DJU75T.cjs} +8 -8
- package/dist/{chunk-DPSIGY6L.cjs → chunk-AAAO4ERQ.cjs} +9 -9
- package/dist/{chunk-FQAVGSPW.js → chunk-AAJLMP57.js} +2 -2
- package/dist/chunk-ABR756QN.js +529 -0
- package/dist/{chunk-JYKPWK5O.js → chunk-APFGDIPD.js} +3 -1
- package/dist/{chunk-Y3M2DABP.js → chunk-APQYRMYL.js} +4 -4
- package/dist/{chunk-Q2IL4DDI.cjs → chunk-AZKOIF2G.cjs} +62 -19
- package/dist/{chunk-MXVIDIC6.cjs → chunk-AZLHUPNC.cjs} +2 -2
- package/dist/chunk-B55VCYSQ.cjs +30 -0
- package/dist/{chunk-WZV6UVPY.js → chunk-BLQUMSM3.js} +1 -1
- package/dist/{chunk-PHJO5YAL.cjs → chunk-BXKPX6K4.cjs} +9 -9
- package/dist/{chunk-3KLSNNRW.cjs → chunk-C66FN2LP.cjs} +4 -4
- package/dist/{chunk-OV3PVUYN.js → chunk-CH7KUFAS.js} +9 -9
- package/dist/{chunk-CWINVFRI.cjs → chunk-CILSXOPI.cjs} +17 -17
- package/dist/{chunk-3UT7R3XV.js → chunk-CM24K6ZT.js} +145 -12
- package/dist/chunk-CMEZ42F2.cjs +303 -0
- package/dist/{chunk-46C73ZKK.cjs → chunk-CNQKIWIS.cjs} +152 -19
- package/dist/{chunk-5JFTY3VU.js → chunk-CSTUTDTH.js} +2 -1
- package/dist/{chunk-REMGR23V.cjs → chunk-CSUGNNJY.cjs} +10 -4
- package/dist/{chunk-TBOLJDUG.js → chunk-D6HB3H3L.js} +31 -11
- package/dist/{chunk-OM24WXEE.js → chunk-D7AYKVKW.js} +2 -2
- package/dist/{chunk-6GUODJKM.cjs → chunk-DLCXWOWT.cjs} +23 -23
- package/dist/{chunk-CH2J4PVE.cjs → chunk-DMM2BKSV.cjs} +121 -28
- package/dist/{chunk-M4KNC5BQ.js → chunk-DW3DPV77.js} +1 -1
- package/dist/chunk-ECQD2QC3.cjs +33 -0
- package/dist/{chunk-UEIXJG45.js → chunk-EEYOS3UC.js} +116 -80
- package/dist/{chunk-7HPWMALN.js → chunk-EF2EN5CR.js} +2 -2
- package/dist/{chunk-7LWQCE4Y.cjs → chunk-EFXFURDY.cjs} +192 -58
- package/dist/chunk-EK34UZPB.cjs +40 -0
- package/dist/{chunk-7JLT2VNW.cjs → chunk-FJR6EZLO.cjs} +9666 -7201
- package/dist/{chunk-GZ6DV2UG.js → chunk-FPO7YNPQ.js} +1 -1
- package/dist/{chunk-O64I2GYI.js → chunk-FS4I6BNR.js} +1 -1
- package/dist/{chunk-MX75JYIY.js → chunk-FSJ2MNOC.js} +3 -3
- package/dist/{chunk-7RFJB75Y.js → chunk-GEHZMC4G.js} +11 -8
- package/dist/{chunk-UWFG2R2I.cjs → chunk-GO6C2RAR.cjs} +36 -9
- package/dist/{chunk-WGLBC5AY.cjs → chunk-GSMR6V36.cjs} +4 -4
- package/dist/{chunk-Z3XSSF7B.js → chunk-GSZWATME.js} +1 -1
- package/dist/{chunk-7MU7LWF3.cjs → chunk-GYLGCR6F.cjs} +5 -5
- package/dist/{chunk-O6TQP7U7.cjs → chunk-H3OOWNYQ.cjs} +3 -3
- package/dist/{chunk-2QL6MNXG.js → chunk-H65446XW.js} +115 -20
- package/dist/chunk-H7HXRRHK.js +324 -0
- package/dist/{chunk-ZZ63NW7A.cjs → chunk-HN2JTDN5.cjs} +17 -17
- package/dist/{chunk-AOKCI722.cjs → chunk-HNXUZ5OY.cjs} +2 -2
- package/dist/{chunk-AUYSIEVV.cjs → chunk-HOYT3E65.cjs} +3 -3
- package/dist/{chunk-DMRXF5DU.js → chunk-HTPY5ESD.js} +3 -3
- package/dist/chunk-HTU4W3GB.js +183 -0
- package/dist/{chunk-3DDL2E55.cjs → chunk-HVLWH2AF.cjs} +10 -10
- package/dist/{chunk-HSCUPEA4.cjs → chunk-HZTEU4W5.cjs} +74 -105
- package/dist/{chunk-XGMI6IYB.cjs → chunk-I5T7LPFP.cjs} +7 -7
- package/dist/{chunk-XIVFAD2L.js → chunk-IB5CJXE7.js} +173 -12
- package/dist/chunk-INNXFLDR.cjs +388 -0
- package/dist/{chunk-75EDROHL.cjs → chunk-JFLEP3T7.cjs} +10 -10
- package/dist/chunk-JJGDOBFL.js +40 -0
- package/dist/{chunk-VBOFPU5M.cjs → chunk-JM3ZTQUK.cjs} +13 -9
- package/dist/{chunk-HJIXWGQZ.js → chunk-JSU46T6K.js} +1 -1
- package/dist/{chunk-AT7OWLY5.js → chunk-K6WN6BT4.js} +1 -1
- package/dist/{chunk-LN7D3EJZ.js → chunk-KA2U6MY2.js} +4 -3
- package/dist/{chunk-3S563FNF.cjs → chunk-KIQH3SMT.cjs} +34 -31
- package/dist/{chunk-BWF4VDYE.js → chunk-KPRXHIE2.js} +54 -85
- package/dist/{chunk-Z4LIPMPM.js → chunk-L6OH44HL.js} +13 -9
- package/dist/{chunk-A7HHCIDQ.js → chunk-LIO3RX2Z.js} +2 -2
- package/dist/{chunk-DLP436GI.js → chunk-LOSXLH7P.js} +110 -17
- package/dist/{chunk-IEXKKKOF.cjs → chunk-LSOR72PB.cjs} +23 -23
- package/dist/{chunk-IAGCRVJ3.js → chunk-MA3AVDCC.js} +55 -12
- package/dist/{chunk-B5CGDNMR.js → chunk-ME3S2WIR.js} +3 -3
- package/dist/{chunk-HKYZSUQ5.js → chunk-NC2I2M4P.js} +4 -4
- package/dist/{chunk-GBMDFWJX.cjs → chunk-NC4A4LVC.cjs} +13 -13
- package/dist/{chunk-E46DJH5S.js → chunk-NGEK5FCJ.js} +176 -3
- package/dist/{chunk-TQ33WBY5.cjs → chunk-NHWHEW7M.cjs} +2 -1
- package/dist/{chunk-62RTC3XX.js → chunk-NKW6CHXQ.js} +1 -1
- package/dist/{chunk-3PXKRVCW.js → chunk-NOWCRKP2.js} +10 -4
- package/dist/{chunk-HXJEGMGB.js → chunk-NUB2LMB6.js} +2 -2
- package/dist/chunk-NVATU4V6.cjs +44 -0
- package/dist/chunk-O246MKIW.cjs +267 -0
- package/dist/{chunk-QCHIDZBA.js → chunk-OGFWL2PS.js} +1 -1
- package/dist/{chunk-JJ4KA7HK.cjs → chunk-ONNGAR6W.cjs} +415 -551
- package/dist/{chunk-TKKN34TV.js → chunk-OOFR6A62.js} +33 -4
- package/dist/{chunk-6NVAK6CK.js → chunk-OZ7FHO7J.js} +2 -2
- package/dist/{chunk-2CGE7ZV3.cjs → chunk-P5EWGUI2.cjs} +201 -28
- package/dist/{chunk-GGLKUENP.js → chunk-P6BQJPAI.js} +191 -14
- package/dist/{chunk-TWQDAUZU.js → chunk-PG2JIU5M.js} +60 -7
- package/dist/chunk-PI27G2ED.cjs +377 -0
- package/dist/{chunk-YV63VW4K.js → chunk-PI7LRPL6.js} +1 -1
- package/dist/{chunk-TXPSTCG7.cjs → chunk-PMPEC5HN.cjs} +18 -15
- package/dist/{chunk-ROLA6EFO.cjs → chunk-PYUP7AKY.cjs} +14 -14
- package/dist/{chunk-BFQDQRDE.js → chunk-QC5Z3ZT5.js} +2 -2
- package/dist/chunk-QDO4L2A7.cjs +156 -0
- package/dist/{chunk-LFDPTJYF.cjs → chunk-QDXRI5AM.cjs} +1 -1
- package/dist/{chunk-3LJJG5YY.cjs → chunk-QLZOMZO5.cjs} +4 -3
- package/dist/chunk-QVXMSQOG.js +430 -0
- package/dist/{chunk-ZHJ7JGME.cjs → chunk-R4UKBKDY.cjs} +11 -11
- package/dist/{chunk-IGMPWJ2I.cjs → chunk-R75AWII3.cjs} +118 -23
- package/dist/{chunk-VGEV44V2.cjs → chunk-RD5PLUIX.cjs} +191 -30
- package/dist/{chunk-I24CWKKK.js → chunk-RGB34CV5.js} +3 -3
- package/dist/{chunk-CHI52KFR.cjs → chunk-RJCZLFHE.cjs} +246 -39
- package/dist/{chunk-D2OSPLYC.cjs → chunk-RKWNM2BJ.cjs} +2 -2
- package/dist/{chunk-FGT6KK6T.js → chunk-RMVONICR.js} +3 -3
- package/dist/{chunk-Q6AC3PHY.cjs → chunk-RPSYRJL7.cjs} +10 -4
- package/dist/chunk-RS2E32YB.js +71 -0
- package/dist/chunk-RWKU2X7O.js +388 -0
- package/dist/chunk-RZLEGVMH.cjs +565 -0
- package/dist/{chunk-5F6ZKSHO.js → chunk-S2L3Y677.js} +1 -1
- package/dist/{chunk-ARBEHFCG.js → chunk-S7KVUIOS.js} +1 -1
- package/dist/{chunk-AC7DZ6SK.cjs → chunk-SACJJ6NO.cjs} +5 -3
- package/dist/{chunk-IKUMVBCW.cjs → chunk-SD3NTC7D.cjs} +48 -4
- package/dist/{chunk-CBFH2J3O.js → chunk-SJQU2ZFR.js} +246 -39
- package/dist/{chunk-GWO66KBI.js → chunk-SKAQKQFF.js} +12 -2
- package/dist/chunk-T4DXP5OP.js +30 -0
- package/dist/{chunk-CFFE4VA3.js → chunk-T6FTB6K2.js} +1 -1
- package/dist/{chunk-U4C3HW6P.js → chunk-T6N6GRFT.js} +13 -10
- package/dist/{chunk-D6GZBSOX.js → chunk-TJFKA6A7.js} +82 -3
- package/dist/{chunk-2HOLOHVK.js → chunk-TJZUPS4Z.js} +163 -299
- package/dist/{chunk-RBZ7AFX7.cjs → chunk-TLKHZ425.cjs} +2 -2
- package/dist/{chunk-J2K57QM7.cjs → chunk-TQ24NLXO.cjs} +6 -6
- package/dist/{chunk-LUMV3DB2.js → chunk-TWBAU46X.js} +1 -1
- package/dist/{chunk-OPNI6O7F.cjs → chunk-TZB5XADL.cjs} +4 -4
- package/dist/{chunk-6HH236FV.cjs → chunk-UAYXZXWU.cjs} +4 -4
- package/dist/{chunk-MPULXVC4.cjs → chunk-UKBFNBDO.cjs} +11 -11
- package/dist/chunk-UMJYX5KD.js +565 -0
- package/dist/chunk-USKYTHDL.cjs +235 -0
- package/dist/chunk-V4HGZSKQ.cjs +183 -0
- package/dist/{chunk-MQESBFBZ.cjs → chunk-VAJUSZMC.cjs} +21 -20
- package/dist/{chunk-PQLKJCIE.js → chunk-VGQG4NBJ.js} +2 -2
- package/dist/chunk-VLUIVJ3J.js +235 -0
- package/dist/chunk-VOBINVMV.cjs +430 -0
- package/dist/{chunk-L4F7SUYL.js → chunk-VSHKKCSH.js} +16 -5
- package/dist/{chunk-LDJQ5QHG.cjs → chunk-VSZU3MGA.cjs} +28 -17
- package/dist/{chunk-YFXTE422.cjs → chunk-VWHAUB77.cjs} +8 -3
- package/dist/{chunk-EZJHLOWP.js → chunk-VXGYFX45.js} +20 -7
- package/dist/{chunk-JIMSII7R.js → chunk-WH6YUQDB.js} +193 -59
- package/dist/{chunk-VKBIE6I6.js → chunk-WQ6TD55V.js} +2 -2
- package/dist/{chunk-ZR46OJNZ.js → chunk-WQWECXTY.js} +3 -3
- package/dist/{chunk-SOLBYSLY.cjs → chunk-WVDJUJH6.cjs} +2 -2
- package/dist/{chunk-QKP772OZ.js → chunk-X24VIVDZ.js} +963 -103
- package/dist/{chunk-37M5UM6I.js → chunk-X4NRTLXD.js} +7 -1
- package/dist/chunk-X53SHYCG.js +27 -0
- package/dist/{chunk-PUD76XQT.cjs → chunk-XB2Z4ZAK.cjs} +5 -5
- package/dist/chunk-Y47OJGLB.cjs +27 -0
- package/dist/{chunk-WRTXCQ3V.cjs → chunk-Y4MN27V3.cjs} +1080 -220
- package/dist/{chunk-ZK6HOR62.js → chunk-YEHFYZFU.js} +7 -2
- package/dist/{chunk-FFBDRUO5.cjs → chunk-YICIUY23.cjs} +1 -1
- package/dist/{chunk-PDHT7LQS.cjs → chunk-YMXYC777.cjs} +3 -3
- package/dist/{chunk-TJNBASFD.cjs → chunk-Z3GRWK6O.cjs} +8 -8
- package/dist/{chunk-JP3YHTQ2.cjs → chunk-Z5GG2KSL.cjs} +4 -4
- package/dist/{chunk-ZPD2AO3U.js → chunk-ZER7DYQK.js} +2 -2
- package/dist/{chunk-UXLW45ZE.cjs → chunk-ZFDXZEZJ.cjs} +25 -90
- package/dist/chunk-ZFV4HJA6.js +579 -0
- package/dist/chunk-ZHMYTI5D.cjs +529 -0
- package/dist/{chunk-CCVMREXI.js → chunk-ZLR2TFBC.js} +35 -8
- package/dist/{chunk-J5ADZN6V.cjs → chunk-ZTWNU5QZ.cjs} +20 -20
- package/dist/chunk-ZUYYHKQA.js +44 -0
- package/dist/{chunk-AUFNACED.js → chunk-ZVLVLDYN.js} +9086 -6621
- package/dist/clear-AJGXD2BB.cjs +12 -0
- package/dist/{clear-OFLFQ3MR.js → clear-HAHDSWKW.js} +3 -3
- package/dist/communityInstaller-IRR6M3N6.cjs +22 -0
- package/dist/{communityInstaller-COB2KTOW.js → communityInstaller-OLKEUGMX.js} +6 -6
- package/dist/completion-G7Z436TF.cjs +17 -0
- package/dist/{completion-PT4VM2H2.js → completion-ZS3AXJ6A.js} +5 -5
- package/dist/{config-R4O7GBTY.js → config-OWYAQPCX.js} +5 -3
- package/dist/config-W2BHT2QE.cjs +22 -0
- package/dist/{constants-HVCHVQAF.js → constants-AS6K67AA.js} +5 -3
- package/dist/constants-B4W5BT7F.cjs +23 -0
- package/dist/{export-3PK3VFCE.js → export-5HIU3KMD.js} +5 -5
- package/dist/export-GFD32UY2.cjs +15 -0
- package/dist/{extractSessionMemories-A2JX5WJ2.js → extractSessionMemories-K6ZVAW2F.js} +1 -1
- package/dist/{extractSessionMemories-XL3MS37F.cjs → extractSessionMemories-LLOIJR5U.cjs} +2 -2
- package/dist/feature-KP74CZ3F.cjs +14 -0
- package/dist/feature-OPNVMB2E.js +14 -0
- package/dist/features-LT55MURX.cjs +24 -0
- package/dist/features-ZDIU26WX.js +24 -0
- package/dist/feedback-7WTJFQ6S.js +18 -0
- package/dist/feedback-CEOJ3453.cjs +18 -0
- package/dist/go-2CY5SZNR.js +16 -0
- package/dist/go-O2CSQON4.cjs +16 -0
- package/dist/goal-DL2N2AWT.cjs +16 -0
- package/dist/goal-IJS7VZSG.js +16 -0
- package/dist/help-RNOGDEBA.cjs +12 -0
- package/dist/{help-X3OAZ3CY.js → help-TCWD2IRH.js} +2 -2
- package/dist/{history-YKFPHBJN.js → history-ATOR5OQV.js} +2 -2
- package/dist/history-UUSGX2AL.cjs +14 -0
- package/dist/{hooks-7TA4PIIB.js → hooks-R3Z5QKUP.js} +6 -6
- package/dist/hooks-RWM5UY67.cjs +18 -0
- package/dist/{i18n-2KBUU7XL.js → i18n-4QI4TD4I.js} +1 -1
- package/dist/i18n-MFAEU5RV.cjs +33 -0
- package/dist/ide-6PBTCCUQ.js +15 -0
- package/dist/ide-UE3G7NMQ.cjs +15 -0
- package/dist/{import-I7T4ZHYL.cjs → import-2IG76KAN.cjs} +6 -4
- package/dist/{import-JWPYKXCZ.js → import-E47QL4DW.js} +2 -2
- package/dist/import-NQDNBFUL.cjs +10 -0
- package/dist/{import-4CHYLS4K.js → import-VQIHGJWS.js} +6 -4
- package/dist/index.cjs +512 -305
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +402 -195
- package/dist/init-DX3RDGDT.cjs +10 -0
- package/dist/{init-262MWZV4.js → init-Q54OAAFZ.js} +2 -2
- package/dist/{inputPrompt-YGBHDUEP.js → inputPrompt-V2VBDRM7.js} +3 -3
- package/dist/inputPrompt-WVGVWAHS.cjs +90 -0
- package/dist/language-I6KXAOXD.js +23 -0
- package/dist/language-XMIVOH5E.cjs +23 -0
- package/dist/learn-JPVVGTKU.js +23 -0
- package/dist/learn-NLSHI2MZ.cjs +23 -0
- package/dist/login-NABQYLYC.cjs +28 -0
- package/dist/login-XPOVFSWN.js +28 -0
- package/dist/logout-HNHCGB4Q.js +25 -0
- package/dist/logout-SKGDXJSW.cjs +25 -0
- package/dist/{mcp-5O6PUL4G.js → mcp-EN73YFGZ.js} +8 -6
- package/dist/mcp-TADZCPJQ.cjs +22 -0
- package/dist/{mcp-install-P6DHES7V.cjs → mcp-install-2GKWWBAS.cjs} +15 -13
- package/dist/{mcp-install-6XWXLFVY.js → mcp-install-3TBTVSHW.js} +10 -8
- package/dist/memory-GRXFTDIN.cjs +10 -0
- package/dist/{memory-Q54CESNM.js → memory-K2P3CDCH.js} +2 -2
- package/dist/{model-6AJ77PJG.js → model-DEG22OWA.js} +2 -2
- package/dist/model-OSD74T7Z.cjs +10 -0
- package/dist/new-4NWBOATU.cjs +12 -0
- package/dist/{new-ZXHEWC2S.js → new-KJAP2MB6.js} +3 -3
- package/dist/onboarding-2U5WE2OA.js +39 -0
- package/dist/onboarding-5DZFCO5Q.cjs +39 -0
- package/dist/permissions-KY5I6YQ3.cjs +10 -0
- package/dist/{permissions-YHJMVA6L.js → permissions-TKYON7PP.js} +2 -2
- package/dist/{plan-YYUAXPTL.js → plan-DYHHLZSS.js} +1 -1
- package/dist/plan-PYKP652W.cjs +13 -0
- package/dist/quit-GSKJL42O.js +14 -0
- package/dist/quit-TQSRTBUT.cjs +14 -0
- package/dist/{registry-34GL6BNJ.js → registry-EZ4V4TUQ.js} +1339 -1
- package/dist/{registry-V24W7YK6.cjs → registry-LCWYI4IB.cjs} +1378 -40
- package/dist/resume-4VWJXARX.cjs +17 -0
- package/dist/resume-TLHWWWFN.js +17 -0
- package/dist/{review-QHP2KP4Q.js → review-CSK4IYTO.js} +1 -1
- package/dist/review-XLJEUH5K.cjs +9 -0
- package/dist/{rpc-S3DGW6KV.js → rpc-3DLQBDWU.js} +301 -130
- package/dist/{rpc-NPS3PU4O.cjs → rpc-O36WUU3L.cjs} +399 -228
- package/dist/search-DSX2CY4A.cjs +22 -0
- package/dist/search-I3QUDUQL.js +22 -0
- package/dist/sessionBranching-DVNOUWJT.cjs +19 -0
- package/dist/sessionBranching-FKV4CR36.js +19 -0
- package/dist/sessions-3JUOT3ED.cjs +10 -0
- package/dist/{sessions-IYAXMK23.js → sessions-VWMDIPOS.js} +2 -2
- package/dist/settings-FT2LZZUV.js +45 -0
- package/dist/settings-RL4KNWHB.cjs +45 -0
- package/dist/setup-HQEJVOYT.js +32 -0
- package/dist/setup-MN54LKOL.cjs +32 -0
- package/dist/share-BUAFZNBX.cjs +17 -0
- package/dist/share-CGB6MAVJ.js +17 -0
- package/dist/skills/builtin/code-reviewer/SKILL.md +64 -0
- package/dist/skills/builtin/goal-writer/SKILL.md +124 -0
- package/dist/{skills-VWOMV3CR.js → skills-7DKR3HRZ.js} +8 -8
- package/dist/{skills-MVIZNHT4.js → skills-BBBENOEY.js} +9 -9
- package/dist/skills-OQM7IHAF.cjs +29 -0
- package/dist/{skills-GGMZOVIE.cjs → skills-RA2PKL63.cjs} +10 -10
- package/dist/{skills-install-VTAMCNNY.cjs → skills-install-D7K476SL.cjs} +16 -16
- package/dist/{skills-install-QBA5RCV6.js → skills-install-T4SOKJSL.js} +9 -9
- package/dist/skills-new-S33NGEU3.js +18 -0
- package/dist/skills-new-UVYH53MD.cjs +18 -0
- package/dist/slashCommands-MWOUDSQP.js +111 -0
- package/dist/slashCommands-XASURUTV.cjs +111 -0
- package/dist/squad-PIIYDFVH.cjs +15 -0
- package/dist/squad-VHYOVEJP.js +15 -0
- package/dist/status-GHFTXQBL.js +25 -0
- package/dist/status-WXMIJIU3.cjs +25 -0
- package/dist/statusline-2K7AC6ZQ.js +21 -0
- package/dist/statusline-GROI4HOC.cjs +21 -0
- package/dist/sync-254WF6JI.cjs +42 -0
- package/dist/sync-2DIZN4EH.cjs +24 -0
- package/dist/{sync-7BILIQHP.js → sync-J6I2ZUKQ.js} +6 -4
- package/dist/{sync-7OKF6636.js → sync-Z3LVSEEV.js} +8 -5
- package/dist/{teammate-J6PHGL23.cjs → teammate-EXR76PEQ.cjs} +9 -8
- package/dist/{teammate-GZQSCIMS.js → teammate-K4DAOFEQ.js} +8 -7
- package/dist/templates-ARG2VRWW.cjs +11 -0
- package/dist/templates-UGVZV3KJ.js +11 -0
- package/dist/theme-MVQDSU47.js +23 -0
- package/dist/theme-QAKEYWJG.cjs +23 -0
- package/dist/ui/questionModal.cjs +6 -6
- package/dist/ui/questionModal.js +5 -5
- package/dist/{undo-SZEHLX7X.js → undo-5AU47JHF.js} +2 -2
- package/dist/undo-ME6WKUXZ.cjs +10 -0
- package/dist/usage-QTKO2YMD.js +25 -0
- package/dist/usage-TYNJKVER.cjs +25 -0
- package/package.json +10 -4
- package/dist/AgentRegistry-EGBDIUAK.cjs +0 -10
- package/dist/AgentRegistry-XPWSVO3Q.js +0 -10
- package/dist/CommunitySkillsCache-2OIUV227.cjs +0 -8
- package/dist/LearnAdvisor-46FG2XIP.js +0 -9
- package/dist/LearnAdvisor-XBRDNAGH.cjs +0 -9
- package/dist/MemoryManager-34L4YOKA.cjs +0 -8
- package/dist/MemoryManager-WJMLPWGU.js +0 -8
- package/dist/NVIDIAProvider-MVTL62PR.cjs +0 -14
- package/dist/PermissionManager-5OOJ7FAT.cjs +0 -11
- package/dist/ProviderFactory-C3YPXTDD.cjs +0 -11
- package/dist/SessionManager-WAPTFMDO.cjs +0 -10
- package/dist/SkillsRegistry-7AJP74GJ.cjs +0 -9
- package/dist/SubAgent-FDIH3DXB.js +0 -11
- package/dist/SubAgent-HVL2ICVZ.cjs +0 -11
- package/dist/SyncApiClient-VMBOLQ6H.cjs +0 -11
- package/dist/about-FCAX37YC.cjs +0 -14
- package/dist/actionExecutor-33I47NZS.js +0 -24
- package/dist/actionExecutor-4YBMR3YH.cjs +0 -24
- package/dist/add-dir-7SS6KSH5.cjs +0 -11
- package/dist/agent-DMRUFU4M.cjs +0 -116
- package/dist/agent-WCJEYQJT.js +0 -116
- package/dist/agents-CHROO3VU.cjs +0 -17
- package/dist/agents-UVDUL65K.js +0 -17
- package/dist/agents-new-AUBWSOXP.js +0 -17
- package/dist/agents-new-Y562WC47.cjs +0 -17
- package/dist/autoSkill-YOLLFTP2.cjs +0 -20
- package/dist/automode-DBLKTTKD.cjs +0 -10
- package/dist/chrome-ATC4OO5I.cjs +0 -20
- package/dist/chrome-O62WXV7F.js +0 -20
- package/dist/chrome-XHJLCO4M.cjs +0 -50
- package/dist/chunk-6XVVIY54.cjs +0 -256
- package/dist/chunk-AU6JAGZJ.cjs +0 -231
- package/dist/chunk-N6O3XUZ2.cjs +0 -23
- package/dist/chunk-VDWJMWDF.js +0 -256
- package/dist/clear-33TWQ2ES.cjs +0 -12
- package/dist/communityInstaller-TWMGPSYM.cjs +0 -22
- package/dist/completion-IIZMHXYP.cjs +0 -17
- package/dist/config-KL6WU7R2.cjs +0 -20
- package/dist/constants-RLMJ5D5P.cjs +0 -21
- package/dist/export-WLGNWEMJ.cjs +0 -15
- package/dist/feedback-G635NCLJ.js +0 -18
- package/dist/feedback-LLMK3TZH.cjs +0 -18
- package/dist/help-BAXLP2M2.cjs +0 -12
- package/dist/history-6HOJSEMT.cjs +0 -14
- package/dist/hooks-XVFU67T2.cjs +0 -18
- package/dist/i18n-MUJMKTFM.cjs +0 -33
- package/dist/ide-CCQ33PGC.cjs +0 -15
- package/dist/ide-VLVFBZ5F.js +0 -15
- package/dist/import-J46F54JY.cjs +0 -10
- package/dist/init-EE5Y7RBL.cjs +0 -10
- package/dist/inputPrompt-IIFKCX5Q.cjs +0 -90
- package/dist/language-CVLPB7OV.js +0 -21
- package/dist/language-ZTWFHUSV.cjs +0 -21
- package/dist/learn-PON7I5QS.js +0 -23
- package/dist/learn-XLRSVNA3.cjs +0 -23
- package/dist/login-223QTGBG.cjs +0 -26
- package/dist/login-6IKTBUBY.js +0 -26
- package/dist/logout-RN2AG6SI.js +0 -23
- package/dist/logout-U3M4FFX7.cjs +0 -23
- package/dist/mcp-NUQ76QQB.cjs +0 -20
- package/dist/memory-CYMDQ2YC.cjs +0 -10
- package/dist/model-IDRCKDML.cjs +0 -10
- package/dist/new-7LEWOUF2.cjs +0 -12
- package/dist/onboarding-FXX7YHSJ.cjs +0 -35
- package/dist/onboarding-JYNMK6NI.js +0 -35
- package/dist/permissions-YBNSANIA.cjs +0 -10
- package/dist/plan-XEJMOT55.cjs +0 -13
- package/dist/quit-B43SJ6E4.cjs +0 -10
- package/dist/quit-GWTNHQSP.js +0 -10
- package/dist/resume-DYVOQN5L.cjs +0 -16
- package/dist/resume-M25UQKOX.js +0 -16
- package/dist/review-UWHWQHCB.cjs +0 -9
- package/dist/search-CPX4PWHP.js +0 -20
- package/dist/search-VUF3M4N3.cjs +0 -20
- package/dist/sessions-JODKER5D.cjs +0 -10
- package/dist/settings-55BNW6BF.js +0 -33
- package/dist/settings-BKTS7OMC.cjs +0 -33
- package/dist/setup-IRC5HQG2.js +0 -29
- package/dist/setup-MMQ7TWOP.cjs +0 -29
- package/dist/share-6JRQECAH.cjs +0 -17
- package/dist/share-YM5MJKMO.js +0 -17
- package/dist/skills-LWSOKOSH.cjs +0 -29
- package/dist/skills-new-GPL46YV2.js +0 -18
- package/dist/skills-new-L5BEZN5V.cjs +0 -18
- package/dist/slashCommands-FBPCIWM5.cjs +0 -95
- package/dist/slashCommands-FCWY5DXW.js +0 -95
- package/dist/status-3B5SDZPL.js +0 -17
- package/dist/status-TTGRF6NC.cjs +0 -17
- package/dist/sync-77CXVVTK.cjs +0 -21
- package/dist/sync-EH4K5U3N.cjs +0 -40
- package/dist/theme-64BYGJ57.cjs +0 -21
- package/dist/theme-YJE6HEON.js +0 -21
- package/dist/undo-PRTEGL2J.cjs +0 -10
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
NVIDIAProvider
|
|
3
|
-
|
|
2
|
+
NVIDIAProvider,
|
|
3
|
+
normalizeLLMUsage
|
|
4
|
+
} from "./chunk-ZLR2TFBC.js";
|
|
4
5
|
import {
|
|
5
6
|
ApiError,
|
|
6
7
|
classifyApiError
|
|
7
8
|
} from "./chunk-FQVG6ZHF.js";
|
|
9
|
+
import {
|
|
10
|
+
getCustomProviderConfig,
|
|
11
|
+
isCustomProviderName,
|
|
12
|
+
toCustomProviderName
|
|
13
|
+
} from "./chunk-JJGDOBFL.js";
|
|
14
|
+
import {
|
|
15
|
+
isAwsBedrockProviderEnabled
|
|
16
|
+
} from "./chunk-H7HXRRHK.js";
|
|
8
17
|
|
|
9
18
|
// src/providers/OllamaProvider.ts
|
|
10
19
|
var DEFAULT_TIMEOUT = 12e4;
|
|
@@ -33,6 +42,9 @@ var OllamaProvider = class {
|
|
|
33
42
|
getName() {
|
|
34
43
|
return "ollama";
|
|
35
44
|
}
|
|
45
|
+
getCapabilities() {
|
|
46
|
+
return { nativeToolCalling: true };
|
|
47
|
+
}
|
|
36
48
|
setModel(model) {
|
|
37
49
|
this.model = model;
|
|
38
50
|
}
|
|
@@ -162,9 +174,10 @@ var OllamaProvider = class {
|
|
|
162
174
|
return this.handleStreamingResponse(response);
|
|
163
175
|
}
|
|
164
176
|
const data = await response.json();
|
|
177
|
+
const message = data.message ?? { role: "assistant", content: "" };
|
|
165
178
|
let toolCalls;
|
|
166
|
-
if (
|
|
167
|
-
toolCalls =
|
|
179
|
+
if (message.tool_calls && Array.isArray(message.tool_calls)) {
|
|
180
|
+
toolCalls = message.tool_calls.map((tc, index) => {
|
|
168
181
|
let argumentsStr;
|
|
169
182
|
try {
|
|
170
183
|
argumentsStr = JSON.stringify(tc.function.arguments);
|
|
@@ -182,18 +195,14 @@ var OllamaProvider = class {
|
|
|
182
195
|
};
|
|
183
196
|
});
|
|
184
197
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
completionTokens: data.eval_count ?? 0,
|
|
190
|
-
totalTokens: (data.prompt_eval_count ?? 0) + (data.eval_count ?? 0)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
198
|
+
const usage = normalizeLLMUsage({
|
|
199
|
+
prompt_tokens: data.prompt_eval_count,
|
|
200
|
+
completion_tokens: data.eval_count
|
|
201
|
+
});
|
|
193
202
|
return {
|
|
194
203
|
id: `ollama-${Date.now()}`,
|
|
195
204
|
created: Math.floor(new Date(data.created_at).getTime() / 1e3),
|
|
196
|
-
content:
|
|
205
|
+
content: message.content,
|
|
197
206
|
toolCalls,
|
|
198
207
|
finishReason: toolCalls?.length ? "tool_calls" : "stop",
|
|
199
208
|
usage,
|
|
@@ -402,7 +411,7 @@ ${content}`
|
|
|
402
411
|
for (const line of lines) {
|
|
403
412
|
try {
|
|
404
413
|
const data = JSON.parse(line);
|
|
405
|
-
fullContent += data.message
|
|
414
|
+
fullContent += data.message?.content ?? "";
|
|
406
415
|
lastData = data;
|
|
407
416
|
if (data.done) {
|
|
408
417
|
streamEndedWithDone = true;
|
|
@@ -812,6 +821,8 @@ async function refreshChatGPTAuth(auth) {
|
|
|
812
821
|
|
|
813
822
|
// src/providers/OpenAIProvider.ts
|
|
814
823
|
var OPENAI_MODELS = [
|
|
824
|
+
"gpt-5.5",
|
|
825
|
+
"gpt-5.5-pro",
|
|
815
826
|
"gpt-5.4",
|
|
816
827
|
"gpt-5.4-pro",
|
|
817
828
|
"gpt-5.4-mini",
|
|
@@ -859,6 +870,11 @@ var OpenAIProvider = class {
|
|
|
859
870
|
setModel(model) {
|
|
860
871
|
this.model = model;
|
|
861
872
|
}
|
|
873
|
+
getCapabilities() {
|
|
874
|
+
return {
|
|
875
|
+
nativeToolCalling: true
|
|
876
|
+
};
|
|
877
|
+
}
|
|
862
878
|
async listModels() {
|
|
863
879
|
return [...OPENAI_MODELS];
|
|
864
880
|
}
|
|
@@ -885,7 +901,7 @@ var OpenAIProvider = class {
|
|
|
885
901
|
messages: request.messages.map((msg) => {
|
|
886
902
|
const mapped = {
|
|
887
903
|
role: msg.role === "system" ? "system" : msg.role === "user" ? "user" : msg.role === "tool" ? "tool" : "assistant",
|
|
888
|
-
content: msg.content
|
|
904
|
+
content: this.toChatCompletionContent(msg.content)
|
|
889
905
|
};
|
|
890
906
|
if (msg.role === "assistant" && msg.tool_calls?.length) {
|
|
891
907
|
mapped.tool_calls = msg.tool_calls;
|
|
@@ -968,14 +984,7 @@ var OpenAIProvider = class {
|
|
|
968
984
|
}
|
|
969
985
|
}));
|
|
970
986
|
}
|
|
971
|
-
|
|
972
|
-
if (data.usage) {
|
|
973
|
-
usage = {
|
|
974
|
-
promptTokens: data.usage.prompt_tokens,
|
|
975
|
-
completionTokens: data.usage.completion_tokens,
|
|
976
|
-
totalTokens: data.usage.total_tokens
|
|
977
|
-
};
|
|
978
|
-
}
|
|
987
|
+
const usage = normalizeLLMUsage(data.usage);
|
|
979
988
|
return {
|
|
980
989
|
id: data.id,
|
|
981
990
|
created: data.created,
|
|
@@ -995,7 +1004,7 @@ var OpenAIProvider = class {
|
|
|
995
1004
|
stream: true,
|
|
996
1005
|
tool_choice: "auto",
|
|
997
1006
|
parallel_tool_calls: true,
|
|
998
|
-
input:
|
|
1007
|
+
input: this.toResponsesInputItems(request.messages)
|
|
999
1008
|
};
|
|
1000
1009
|
if (this.reasoningEffort && VALID_REASONING_EFFORTS.has(this.reasoningEffort)) {
|
|
1001
1010
|
body.reasoning = {
|
|
@@ -1059,11 +1068,7 @@ var OpenAIProvider = class {
|
|
|
1059
1068
|
const data = await this.parseCodexStream(response);
|
|
1060
1069
|
const toolCalls = this.extractResponsesToolCalls(data.output);
|
|
1061
1070
|
const content = this.extractResponsesContent(data);
|
|
1062
|
-
const usage = data.usage
|
|
1063
|
-
promptTokens: data.usage.input_tokens ?? 0,
|
|
1064
|
-
completionTokens: data.usage.output_tokens ?? 0,
|
|
1065
|
-
totalTokens: data.usage.total_tokens ?? (data.usage.input_tokens ?? 0) + (data.usage.output_tokens ?? 0)
|
|
1066
|
-
} : void 0;
|
|
1071
|
+
const usage = normalizeLLMUsage(data.usage);
|
|
1067
1072
|
return {
|
|
1068
1073
|
id: data.id,
|
|
1069
1074
|
created: data.created_at ?? Math.floor(Date.now() / 1e3),
|
|
@@ -1115,13 +1120,42 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1115
1120
|
const text = await response.text();
|
|
1116
1121
|
let currentEvent = "";
|
|
1117
1122
|
let completedData = null;
|
|
1123
|
+
let streamedOutputText = "";
|
|
1124
|
+
const streamedOutputItems = /* @__PURE__ */ new Map();
|
|
1118
1125
|
for (const line of text.split("\n")) {
|
|
1119
1126
|
if (line.startsWith("event: ")) {
|
|
1120
1127
|
currentEvent = line.slice(7).trim();
|
|
1121
1128
|
continue;
|
|
1122
1129
|
}
|
|
1123
|
-
if (line.startsWith("data: ")
|
|
1124
|
-
|
|
1130
|
+
if (!line.startsWith("data: ")) {
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
const dataLine = line.slice(6);
|
|
1134
|
+
const eventData = JSON.parse(dataLine);
|
|
1135
|
+
const eventType = this.getCodexStreamEventType(currentEvent, eventData);
|
|
1136
|
+
const eventRecord = eventData && typeof eventData === "object" ? eventData : {};
|
|
1137
|
+
if (eventType === "response.output_text.delta") {
|
|
1138
|
+
if (typeof eventRecord.delta === "string") {
|
|
1139
|
+
streamedOutputText += eventRecord.delta;
|
|
1140
|
+
}
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
if (eventType === "response.output_text.done") {
|
|
1144
|
+
if (typeof eventRecord.text === "string" && eventRecord.text.trim()) {
|
|
1145
|
+
streamedOutputText = eventRecord.text;
|
|
1146
|
+
}
|
|
1147
|
+
continue;
|
|
1148
|
+
}
|
|
1149
|
+
if (eventType === "response.output_item.added" || eventType === "response.output_item.done") {
|
|
1150
|
+
this.captureStreamedOutputItem(eventData, streamedOutputItems);
|
|
1151
|
+
continue;
|
|
1152
|
+
}
|
|
1153
|
+
if (eventType === "response.function_call_arguments.done") {
|
|
1154
|
+
this.captureStreamedFunctionCallArguments(eventData, streamedOutputItems);
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
if (eventType === "response.completed") {
|
|
1158
|
+
completedData = this.extractCompletedResponse(eventData);
|
|
1125
1159
|
break;
|
|
1126
1160
|
}
|
|
1127
1161
|
}
|
|
@@ -1133,8 +1167,74 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1133
1167
|
false
|
|
1134
1168
|
);
|
|
1135
1169
|
}
|
|
1170
|
+
if ((!Array.isArray(completedData.output) || completedData.output.length === 0) && streamedOutputItems.size > 0) {
|
|
1171
|
+
completedData.output = [...streamedOutputItems.entries()].sort(([a], [b]) => a - b).map(([, item]) => item);
|
|
1172
|
+
}
|
|
1173
|
+
if (!this.extractResponsesContent(completedData) && streamedOutputText.trim()) {
|
|
1174
|
+
completedData.output_text = streamedOutputText;
|
|
1175
|
+
}
|
|
1136
1176
|
return completedData;
|
|
1137
1177
|
}
|
|
1178
|
+
getCodexStreamEventType(currentEvent, eventData) {
|
|
1179
|
+
if (currentEvent) {
|
|
1180
|
+
return currentEvent;
|
|
1181
|
+
}
|
|
1182
|
+
if (eventData && typeof eventData === "object" && "type" in eventData) {
|
|
1183
|
+
const type = eventData.type;
|
|
1184
|
+
return typeof type === "string" ? type : "";
|
|
1185
|
+
}
|
|
1186
|
+
return "";
|
|
1187
|
+
}
|
|
1188
|
+
captureStreamedOutputItem(eventData, outputItems) {
|
|
1189
|
+
if (!eventData || typeof eventData !== "object") {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
const event = eventData;
|
|
1193
|
+
if (!event.item || typeof event.output_index !== "number") {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
const existing = outputItems.get(event.output_index);
|
|
1197
|
+
if (existing?.type === "function_call" && event.item.type === "function_call") {
|
|
1198
|
+
outputItems.set(event.output_index, {
|
|
1199
|
+
...existing,
|
|
1200
|
+
...event.item,
|
|
1201
|
+
arguments: event.item.arguments || existing.arguments
|
|
1202
|
+
});
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
outputItems.set(event.output_index, event.item);
|
|
1206
|
+
}
|
|
1207
|
+
captureStreamedFunctionCallArguments(eventData, outputItems) {
|
|
1208
|
+
if (!eventData || typeof eventData !== "object") {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
const event = eventData;
|
|
1212
|
+
if (typeof event.output_index !== "number" || typeof event.name !== "string" || typeof event.arguments !== "string") {
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
const existing = outputItems.get(event.output_index);
|
|
1216
|
+
if (existing?.type === "function_call") {
|
|
1217
|
+
outputItems.set(event.output_index, {
|
|
1218
|
+
...existing,
|
|
1219
|
+
name: event.name,
|
|
1220
|
+
arguments: event.arguments
|
|
1221
|
+
});
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
outputItems.set(event.output_index, {
|
|
1225
|
+
type: "function_call",
|
|
1226
|
+
id: event.item_id,
|
|
1227
|
+
call_id: event.item_id,
|
|
1228
|
+
name: event.name,
|
|
1229
|
+
arguments: event.arguments
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
extractCompletedResponse(eventData) {
|
|
1233
|
+
if (eventData && typeof eventData === "object" && "response" in eventData && eventData.response) {
|
|
1234
|
+
return eventData.response;
|
|
1235
|
+
}
|
|
1236
|
+
return eventData;
|
|
1237
|
+
}
|
|
1138
1238
|
async buildAuthHeaders() {
|
|
1139
1239
|
if (this.authMode === "chatgpt") {
|
|
1140
1240
|
if (!this.chatgptAuth?.accessToken || !this.chatgptAuth.accountId) {
|
|
@@ -1161,12 +1261,73 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1161
1261
|
}
|
|
1162
1262
|
return (configBaseUrl || OPENAI_API_BASE_URL).replace(/\/$/, "");
|
|
1163
1263
|
}
|
|
1164
|
-
|
|
1264
|
+
isContentPartsArray(content) {
|
|
1265
|
+
return Array.isArray(content);
|
|
1266
|
+
}
|
|
1267
|
+
toChatCompletionContent(content) {
|
|
1268
|
+
if (!this.isContentPartsArray(content)) {
|
|
1269
|
+
return content;
|
|
1270
|
+
}
|
|
1271
|
+
return content.map((part) => {
|
|
1272
|
+
if (part.type === "text") {
|
|
1273
|
+
return { type: "text", text: part.text };
|
|
1274
|
+
}
|
|
1275
|
+
if (part.type === "image_url") {
|
|
1276
|
+
return {
|
|
1277
|
+
type: "image_url",
|
|
1278
|
+
image_url: part.image_url
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
return null;
|
|
1282
|
+
}).filter((part) => part !== null);
|
|
1283
|
+
}
|
|
1284
|
+
toResponsesMessageContent(role, content) {
|
|
1285
|
+
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
1286
|
+
if (!this.isContentPartsArray(content)) {
|
|
1287
|
+
return [{ type: textType, text: content }];
|
|
1288
|
+
}
|
|
1289
|
+
const parts = [];
|
|
1290
|
+
for (const part of content) {
|
|
1291
|
+
if (part.type === "text") {
|
|
1292
|
+
parts.push({ type: textType, text: part.text });
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
if (part.type === "image_url" && role !== "assistant") {
|
|
1296
|
+
parts.push({
|
|
1297
|
+
type: "input_image",
|
|
1298
|
+
image_url: part.image_url.url
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return parts;
|
|
1303
|
+
}
|
|
1304
|
+
toResponsesInputItems(messages) {
|
|
1305
|
+
const assistantToolCallIds = /* @__PURE__ */ new Set();
|
|
1306
|
+
const toolOutputIds = /* @__PURE__ */ new Set();
|
|
1307
|
+
for (const msg of messages) {
|
|
1308
|
+
if (msg.role === "assistant" && msg.tool_calls?.length) {
|
|
1309
|
+
for (const toolCall of msg.tool_calls) {
|
|
1310
|
+
assistantToolCallIds.add(toolCall.id);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (msg.role === "tool" && msg.tool_call_id) {
|
|
1314
|
+
toolOutputIds.add(msg.tool_call_id);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
const matchedToolCallIds = new Set(
|
|
1318
|
+
[...assistantToolCallIds].filter((id) => toolOutputIds.has(id))
|
|
1319
|
+
);
|
|
1320
|
+
return messages.flatMap((msg) => this.toResponsesInputItemsForMessage(msg, matchedToolCallIds));
|
|
1321
|
+
}
|
|
1322
|
+
toResponsesInputItemsForMessage(msg, matchedToolCallIds) {
|
|
1165
1323
|
const items = [];
|
|
1166
1324
|
if (msg.role === "system") {
|
|
1167
1325
|
return items;
|
|
1168
1326
|
}
|
|
1169
1327
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
1328
|
+
if (!matchedToolCallIds.has(msg.tool_call_id)) {
|
|
1329
|
+
return items;
|
|
1330
|
+
}
|
|
1170
1331
|
items.push({
|
|
1171
1332
|
type: "function_call_output",
|
|
1172
1333
|
call_id: msg.tool_call_id,
|
|
@@ -1175,14 +1336,18 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1175
1336
|
return items;
|
|
1176
1337
|
}
|
|
1177
1338
|
if (msg.content) {
|
|
1339
|
+
const content = this.toResponsesMessageContent(msg.role, msg.content);
|
|
1178
1340
|
items.push({
|
|
1179
1341
|
type: "message",
|
|
1180
1342
|
role: msg.role === "tool" ? "user" : msg.role,
|
|
1181
|
-
content
|
|
1343
|
+
content
|
|
1182
1344
|
});
|
|
1183
1345
|
}
|
|
1184
1346
|
if (msg.role === "assistant" && msg.tool_calls?.length) {
|
|
1185
1347
|
for (const toolCall of msg.tool_calls) {
|
|
1348
|
+
if (!matchedToolCallIds.has(toolCall.id)) {
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1186
1351
|
items.push({
|
|
1187
1352
|
type: "function_call",
|
|
1188
1353
|
call_id: toolCall.id,
|
|
@@ -1256,6 +1421,9 @@ var LlamaCppProvider = class _LlamaCppProvider {
|
|
|
1256
1421
|
getName() {
|
|
1257
1422
|
return "llamacpp";
|
|
1258
1423
|
}
|
|
1424
|
+
getCapabilities() {
|
|
1425
|
+
return { nativeToolCalling: true };
|
|
1426
|
+
}
|
|
1259
1427
|
setModel(model) {
|
|
1260
1428
|
this.model = model;
|
|
1261
1429
|
}
|
|
@@ -1776,14 +1944,7 @@ var OpenRouterClient = class {
|
|
|
1776
1944
|
};
|
|
1777
1945
|
});
|
|
1778
1946
|
}
|
|
1779
|
-
|
|
1780
|
-
if (json?.usage) {
|
|
1781
|
-
usage = {
|
|
1782
|
-
promptTokens: json.usage.prompt_tokens ?? 0,
|
|
1783
|
-
completionTokens: json.usage.completion_tokens ?? 0,
|
|
1784
|
-
totalTokens: json.usage.total_tokens ?? 0
|
|
1785
|
-
};
|
|
1786
|
-
}
|
|
1947
|
+
const usage = normalizeLLMUsage(json?.usage);
|
|
1787
1948
|
return {
|
|
1788
1949
|
id: json.id ?? "autohand-local",
|
|
1789
1950
|
created: json.created ?? Date.now(),
|
|
@@ -1844,6 +2005,9 @@ var OpenRouterProvider = class {
|
|
|
1844
2005
|
getName() {
|
|
1845
2006
|
return "openrouter";
|
|
1846
2007
|
}
|
|
2008
|
+
getCapabilities() {
|
|
2009
|
+
return { nativeToolCalling: true };
|
|
2010
|
+
}
|
|
1847
2011
|
setModel(model) {
|
|
1848
2012
|
this.model = model;
|
|
1849
2013
|
this.client.setDefaultModel(model);
|
|
@@ -1906,6 +2070,9 @@ var MLXProvider = class {
|
|
|
1906
2070
|
getName() {
|
|
1907
2071
|
return "mlx";
|
|
1908
2072
|
}
|
|
2073
|
+
getCapabilities() {
|
|
2074
|
+
return { nativeToolCalling: true };
|
|
2075
|
+
}
|
|
1909
2076
|
setModel(model) {
|
|
1910
2077
|
this.model = model;
|
|
1911
2078
|
}
|
|
@@ -2138,7 +2305,24 @@ var MLXProvider = class {
|
|
|
2138
2305
|
|
|
2139
2306
|
// src/providers/LLMGatewayClient.ts
|
|
2140
2307
|
function sanitizeMessages2(messages) {
|
|
2141
|
-
|
|
2308
|
+
const toolOutputIds = new Set(
|
|
2309
|
+
messages.filter((msg) => msg.role === "tool" && msg.tool_call_id).map((msg) => msg.tool_call_id)
|
|
2310
|
+
);
|
|
2311
|
+
const matchedToolCallIds = /* @__PURE__ */ new Set();
|
|
2312
|
+
for (const msg of messages) {
|
|
2313
|
+
if (msg.role !== "assistant" || !msg.tool_calls?.length) {
|
|
2314
|
+
continue;
|
|
2315
|
+
}
|
|
2316
|
+
for (const toolCall of msg.tool_calls) {
|
|
2317
|
+
if (toolOutputIds.has(toolCall.id)) {
|
|
2318
|
+
matchedToolCallIds.add(toolCall.id);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
return messages.flatMap((msg) => {
|
|
2323
|
+
if (msg.role === "tool" && (!msg.tool_call_id || !matchedToolCallIds.has(msg.tool_call_id))) {
|
|
2324
|
+
return [];
|
|
2325
|
+
}
|
|
2142
2326
|
const sanitized = {
|
|
2143
2327
|
role: msg.role,
|
|
2144
2328
|
content: msg.content
|
|
@@ -2147,12 +2331,17 @@ function sanitizeMessages2(messages) {
|
|
|
2147
2331
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
2148
2332
|
}
|
|
2149
2333
|
if (msg.role === "assistant" && msg.tool_calls?.length) {
|
|
2150
|
-
|
|
2334
|
+
const matchedToolCalls = msg.tool_calls.filter((toolCall) => matchedToolCallIds.has(toolCall.id));
|
|
2335
|
+
if (matchedToolCalls.length > 0) {
|
|
2336
|
+
sanitized.tool_calls = matchedToolCalls;
|
|
2337
|
+
} else if (!msg.content) {
|
|
2338
|
+
return [];
|
|
2339
|
+
}
|
|
2151
2340
|
}
|
|
2152
2341
|
if (msg.name) {
|
|
2153
2342
|
sanitized.name = msg.name;
|
|
2154
2343
|
}
|
|
2155
|
-
return sanitized;
|
|
2344
|
+
return [sanitized];
|
|
2156
2345
|
});
|
|
2157
2346
|
}
|
|
2158
2347
|
var DEFAULT_BASE_URL2 = "https://api.llmgateway.io/v1";
|
|
@@ -2167,18 +2356,26 @@ var DEFAULT_ERROR_LABELS = {
|
|
|
2167
2356
|
};
|
|
2168
2357
|
function buildFriendlyErrors(labels) {
|
|
2169
2358
|
return {
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
504: `The request timed out. The ${labels.serviceName} service may be experiencing high load.`
|
|
2359
|
+
invalid_request: "The request was malformed and could not be processed.",
|
|
2360
|
+
context_overflow: "The conversation is too long for this model. Try /undo to remove recent turns or /new to start fresh.",
|
|
2361
|
+
model_not_found: "The requested model was not found. Use /model to select a different one.",
|
|
2362
|
+
auth_failed: `Authentication failed. Please verify your ${labels.credentialName} in ~/.autohand/config.json.`,
|
|
2363
|
+
payment_required: `Payment required. Please check your ${labels.accountName} balance or billing settings.`,
|
|
2364
|
+
access_denied: `Access denied. Your ${labels.credentialName} may not have permission for this model.`,
|
|
2365
|
+
rate_limited: "Rate limit exceeded. Please wait a moment and try again, or choose a different model.",
|
|
2366
|
+
server_error: `The ${labels.serviceName} service is temporarily unavailable. Please try again later.`,
|
|
2367
|
+
timeout: `The request timed out. The ${labels.serviceName} service may be experiencing high load.`
|
|
2180
2368
|
};
|
|
2181
2369
|
}
|
|
2370
|
+
function coerceErrorDetail(value) {
|
|
2371
|
+
if (typeof value === "string") {
|
|
2372
|
+
return value;
|
|
2373
|
+
}
|
|
2374
|
+
if (value && typeof value === "object") {
|
|
2375
|
+
return JSON.stringify(value);
|
|
2376
|
+
}
|
|
2377
|
+
return "";
|
|
2378
|
+
}
|
|
2182
2379
|
var LLMGatewayClient = class {
|
|
2183
2380
|
apiKey;
|
|
2184
2381
|
baseUrl;
|
|
@@ -2187,10 +2384,12 @@ var LLMGatewayClient = class {
|
|
|
2187
2384
|
retryDelay;
|
|
2188
2385
|
timeout;
|
|
2189
2386
|
errorLabels;
|
|
2387
|
+
reasoningEffort;
|
|
2190
2388
|
constructor(settings, networkSettings, errorLabels = DEFAULT_ERROR_LABELS) {
|
|
2191
2389
|
this.apiKey = settings.apiKey ?? "";
|
|
2192
2390
|
this.baseUrl = settings.baseUrl ?? DEFAULT_BASE_URL2;
|
|
2193
2391
|
this.defaultModel = settings.model;
|
|
2392
|
+
this.reasoningEffort = settings.reasoningEffort;
|
|
2194
2393
|
this.errorLabels = errorLabels;
|
|
2195
2394
|
const configuredRetries = networkSettings?.maxRetries ?? DEFAULT_MAX_RETRIES4;
|
|
2196
2395
|
this.maxRetries = Math.min(
|
|
@@ -2271,6 +2470,9 @@ var LLMGatewayClient = class {
|
|
|
2271
2470
|
max_tokens: request.maxTokens ?? 16e3,
|
|
2272
2471
|
stream: request.stream ?? false
|
|
2273
2472
|
};
|
|
2473
|
+
if (this.reasoningEffort) {
|
|
2474
|
+
payload.reasoning_effort = this.reasoningEffort;
|
|
2475
|
+
}
|
|
2274
2476
|
return payload;
|
|
2275
2477
|
}
|
|
2276
2478
|
buildChatTemplateKwargs(kwargs) {
|
|
@@ -2338,14 +2540,7 @@ var LLMGatewayClient = class {
|
|
|
2338
2540
|
};
|
|
2339
2541
|
});
|
|
2340
2542
|
}
|
|
2341
|
-
|
|
2342
|
-
if (json?.usage) {
|
|
2343
|
-
usage = {
|
|
2344
|
-
promptTokens: json.usage.prompt_tokens ?? 0,
|
|
2345
|
-
completionTokens: json.usage.completion_tokens ?? 0,
|
|
2346
|
-
totalTokens: json.usage.total_tokens ?? 0
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2543
|
+
const usage = normalizeLLMUsage(json?.usage);
|
|
2349
2544
|
return {
|
|
2350
2545
|
id: json.id ?? "llmgateway-response",
|
|
2351
2546
|
created: json.created ?? Date.now(),
|
|
@@ -2415,17 +2610,15 @@ ${fullContent}` : fullContent;
|
|
|
2415
2610
|
let errorDetail = "";
|
|
2416
2611
|
try {
|
|
2417
2612
|
const body = await response.json();
|
|
2418
|
-
errorDetail = body?.error?.message || body?.error || body?.message
|
|
2419
|
-
if (typeof errorDetail === "object") {
|
|
2420
|
-
errorDetail = JSON.stringify(errorDetail);
|
|
2421
|
-
}
|
|
2613
|
+
errorDetail = coerceErrorDetail(body?.error?.message || body?.error || body?.message);
|
|
2422
2614
|
} catch {
|
|
2423
2615
|
try {
|
|
2424
2616
|
errorDetail = await response.text();
|
|
2425
2617
|
} catch {
|
|
2426
2618
|
}
|
|
2427
2619
|
}
|
|
2428
|
-
const
|
|
2620
|
+
const classified = classifyApiError(status, errorDetail, response.headers);
|
|
2621
|
+
const friendlyMessage = buildFriendlyErrors(this.errorLabels)[classified.code];
|
|
2429
2622
|
if (friendlyMessage) {
|
|
2430
2623
|
return errorDetail ? `${friendlyMessage}
|
|
2431
2624
|
${errorDetail}` : friendlyMessage;
|
|
@@ -2483,6 +2676,9 @@ var LLMGatewayProvider = class {
|
|
|
2483
2676
|
getName() {
|
|
2484
2677
|
return "llmgateway";
|
|
2485
2678
|
}
|
|
2679
|
+
getCapabilities() {
|
|
2680
|
+
return { nativeToolCalling: true };
|
|
2681
|
+
}
|
|
2486
2682
|
setModel(model) {
|
|
2487
2683
|
this.model = model;
|
|
2488
2684
|
this.client.setDefaultModel(model);
|
|
@@ -2817,14 +3013,7 @@ var AzureClient = class {
|
|
|
2817
3013
|
};
|
|
2818
3014
|
});
|
|
2819
3015
|
}
|
|
2820
|
-
|
|
2821
|
-
if (json?.usage) {
|
|
2822
|
-
usage = {
|
|
2823
|
-
promptTokens: json.usage.prompt_tokens ?? 0,
|
|
2824
|
-
completionTokens: json.usage.completion_tokens ?? 0,
|
|
2825
|
-
totalTokens: json.usage.total_tokens ?? 0
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
3016
|
+
const usage = normalizeLLMUsage(json?.usage);
|
|
2828
3017
|
return {
|
|
2829
3018
|
id: json.id ?? "autohand-azure",
|
|
2830
3019
|
created: json.created ?? Date.now(),
|
|
@@ -2922,6 +3111,9 @@ var AzureProvider = class {
|
|
|
2922
3111
|
getName() {
|
|
2923
3112
|
return "azure";
|
|
2924
3113
|
}
|
|
3114
|
+
getCapabilities() {
|
|
3115
|
+
return { nativeToolCalling: true };
|
|
3116
|
+
}
|
|
2925
3117
|
setModel(model) {
|
|
2926
3118
|
this.model = model;
|
|
2927
3119
|
this.client.setDefaultModel(model);
|
|
@@ -2940,6 +3132,8 @@ var AzureProvider = class {
|
|
|
2940
3132
|
// src/providers/ZaiProvider.ts
|
|
2941
3133
|
var ZAI_DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4";
|
|
2942
3134
|
var ZAI_MODELS = [
|
|
3135
|
+
"glm-5.2",
|
|
3136
|
+
"glm-5.1",
|
|
2943
3137
|
"glm-4.5",
|
|
2944
3138
|
"glm-4.5v",
|
|
2945
3139
|
"glm-4.5-air",
|
|
@@ -2966,6 +3160,9 @@ var ZaiProvider = class {
|
|
|
2966
3160
|
getName() {
|
|
2967
3161
|
return "zai";
|
|
2968
3162
|
}
|
|
3163
|
+
getCapabilities() {
|
|
3164
|
+
return { nativeToolCalling: true };
|
|
3165
|
+
}
|
|
2969
3166
|
setModel(model) {
|
|
2970
3167
|
this.model = model;
|
|
2971
3168
|
this.client.setDefaultModel(model);
|
|
@@ -2981,6 +3178,48 @@ var ZaiProvider = class {
|
|
|
2981
3178
|
}
|
|
2982
3179
|
};
|
|
2983
3180
|
|
|
3181
|
+
// src/providers/SakanaProvider.ts
|
|
3182
|
+
var SAKANA_DEFAULT_BASE_URL = "https://api.sakana.ai/v1";
|
|
3183
|
+
var SAKANA_MODELS = [
|
|
3184
|
+
"fugu",
|
|
3185
|
+
"fugu-ultra"
|
|
3186
|
+
];
|
|
3187
|
+
var SakanaProvider = class {
|
|
3188
|
+
client;
|
|
3189
|
+
model;
|
|
3190
|
+
constructor(config, networkSettings) {
|
|
3191
|
+
const effectiveConfig = {
|
|
3192
|
+
...config,
|
|
3193
|
+
baseUrl: config.baseUrl ?? SAKANA_DEFAULT_BASE_URL
|
|
3194
|
+
};
|
|
3195
|
+
this.client = new LLMGatewayClient(effectiveConfig, networkSettings, {
|
|
3196
|
+
serviceName: "Sakana.AI",
|
|
3197
|
+
credentialName: "Sakana API key",
|
|
3198
|
+
accountName: "Sakana account"
|
|
3199
|
+
});
|
|
3200
|
+
this.model = config.model;
|
|
3201
|
+
}
|
|
3202
|
+
getName() {
|
|
3203
|
+
return "sakana";
|
|
3204
|
+
}
|
|
3205
|
+
getCapabilities() {
|
|
3206
|
+
return { nativeToolCalling: true };
|
|
3207
|
+
}
|
|
3208
|
+
setModel(model) {
|
|
3209
|
+
this.model = model;
|
|
3210
|
+
this.client.setDefaultModel(model);
|
|
3211
|
+
}
|
|
3212
|
+
async listModels() {
|
|
3213
|
+
return [...SAKANA_MODELS];
|
|
3214
|
+
}
|
|
3215
|
+
async isAvailable() {
|
|
3216
|
+
return true;
|
|
3217
|
+
}
|
|
3218
|
+
async complete(request) {
|
|
3219
|
+
return this.client.complete(request);
|
|
3220
|
+
}
|
|
3221
|
+
};
|
|
3222
|
+
|
|
2984
3223
|
// src/utils/gcloudAuth.ts
|
|
2985
3224
|
import { exec } from "child_process";
|
|
2986
3225
|
import { promisify } from "util";
|
|
@@ -3177,6 +3416,9 @@ var VertexAIProvider = class {
|
|
|
3177
3416
|
getName() {
|
|
3178
3417
|
return "vertexai";
|
|
3179
3418
|
}
|
|
3419
|
+
getCapabilities() {
|
|
3420
|
+
return { nativeToolCalling: true };
|
|
3421
|
+
}
|
|
3180
3422
|
setModel(model) {
|
|
3181
3423
|
this.defaultModel = model;
|
|
3182
3424
|
}
|
|
@@ -3377,14 +3619,7 @@ var VertexAIProvider = class {
|
|
|
3377
3619
|
};
|
|
3378
3620
|
});
|
|
3379
3621
|
}
|
|
3380
|
-
|
|
3381
|
-
if (json?.usage) {
|
|
3382
|
-
usage = {
|
|
3383
|
-
promptTokens: json.usage.prompt_tokens ?? 0,
|
|
3384
|
-
completionTokens: json.usage.completion_tokens ?? 0,
|
|
3385
|
-
totalTokens: json.usage.total_tokens ?? 0
|
|
3386
|
-
};
|
|
3387
|
-
}
|
|
3622
|
+
const usage = normalizeLLMUsage(json?.usage);
|
|
3388
3623
|
return {
|
|
3389
3624
|
id: json.id ?? "vertexai-response",
|
|
3390
3625
|
created: json.created ?? Date.now(),
|
|
@@ -3414,14 +3649,7 @@ var VertexAIProvider = class {
|
|
|
3414
3649
|
}
|
|
3415
3650
|
}));
|
|
3416
3651
|
}
|
|
3417
|
-
|
|
3418
|
-
if (json?.usage) {
|
|
3419
|
-
usage = {
|
|
3420
|
-
promptTokens: json.usage.input_tokens ?? 0,
|
|
3421
|
-
completionTokens: json.usage.output_tokens ?? 0,
|
|
3422
|
-
totalTokens: (json.usage.input_tokens ?? 0) + (json.usage.output_tokens ?? 0)
|
|
3423
|
-
};
|
|
3424
|
-
}
|
|
3652
|
+
const usage = normalizeLLMUsage(json?.usage);
|
|
3425
3653
|
const stopReason = json?.stop_reason;
|
|
3426
3654
|
let finishReason;
|
|
3427
3655
|
if (stopReason === "end_turn" || stopReason === "stop_sequence") {
|
|
@@ -3549,6 +3777,9 @@ var XAIProvider = class {
|
|
|
3549
3777
|
getName() {
|
|
3550
3778
|
return "xai";
|
|
3551
3779
|
}
|
|
3780
|
+
getCapabilities() {
|
|
3781
|
+
return { nativeToolCalling: true };
|
|
3782
|
+
}
|
|
3552
3783
|
setModel(model) {
|
|
3553
3784
|
this.model = model;
|
|
3554
3785
|
}
|
|
@@ -3756,14 +3987,7 @@ var XAIProvider = class {
|
|
|
3756
3987
|
return parts.join("\n").trim();
|
|
3757
3988
|
}
|
|
3758
3989
|
mapXAIUsage(usage) {
|
|
3759
|
-
|
|
3760
|
-
const input = usage.input_tokens ?? 0;
|
|
3761
|
-
const output = usage.output_tokens ?? 0;
|
|
3762
|
-
return {
|
|
3763
|
-
promptTokens: input,
|
|
3764
|
-
completionTokens: output,
|
|
3765
|
-
totalTokens: usage.total_tokens ?? input + output
|
|
3766
|
-
};
|
|
3990
|
+
return normalizeLLMUsage(usage);
|
|
3767
3991
|
}
|
|
3768
3992
|
async parseXAIStream(response) {
|
|
3769
3993
|
const text = await response.text();
|
|
@@ -4076,6 +4300,9 @@ var CerebrasProvider = class {
|
|
|
4076
4300
|
getName() {
|
|
4077
4301
|
return "cerebras";
|
|
4078
4302
|
}
|
|
4303
|
+
getCapabilities() {
|
|
4304
|
+
return { nativeToolCalling: true };
|
|
4305
|
+
}
|
|
4079
4306
|
setModel(model) {
|
|
4080
4307
|
this.model = model;
|
|
4081
4308
|
this.client.setDefaultModel(model);
|
|
@@ -4117,6 +4344,9 @@ var DeepSeekProvider = class {
|
|
|
4117
4344
|
getName() {
|
|
4118
4345
|
return "deepseek";
|
|
4119
4346
|
}
|
|
4347
|
+
getCapabilities() {
|
|
4348
|
+
return { nativeToolCalling: true };
|
|
4349
|
+
}
|
|
4120
4350
|
setModel(model) {
|
|
4121
4351
|
this.model = model;
|
|
4122
4352
|
this.client.setDefaultModel(model);
|
|
@@ -4132,6 +4362,593 @@ var DeepSeekProvider = class {
|
|
|
4132
4362
|
}
|
|
4133
4363
|
};
|
|
4134
4364
|
|
|
4365
|
+
// src/providers/BedrockProvider.ts
|
|
4366
|
+
import {
|
|
4367
|
+
BedrockRuntimeClient,
|
|
4368
|
+
ConverseCommand
|
|
4369
|
+
} from "@aws-sdk/client-bedrock-runtime";
|
|
4370
|
+
import {
|
|
4371
|
+
BedrockClient,
|
|
4372
|
+
ListFoundationModelsCommand
|
|
4373
|
+
} from "@aws-sdk/client-bedrock";
|
|
4374
|
+
import { fromIni } from "@aws-sdk/credential-providers";
|
|
4375
|
+
var BEDROCK_DEFAULT_REGION = "us-east-1";
|
|
4376
|
+
var BEDROCK_DEFAULT_MODEL = "anthropic.claude-3-5-sonnet-20241022-v2:0";
|
|
4377
|
+
var BEDROCK_MODELS = [
|
|
4378
|
+
BEDROCK_DEFAULT_MODEL,
|
|
4379
|
+
"anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
4380
|
+
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
4381
|
+
"amazon.nova-pro-v1:0",
|
|
4382
|
+
"amazon.nova-lite-v1:0",
|
|
4383
|
+
"meta.llama3-1-70b-instruct-v1:0",
|
|
4384
|
+
"openai.gpt-oss-120b-1:0"
|
|
4385
|
+
];
|
|
4386
|
+
function resolveBedrockRegion(region) {
|
|
4387
|
+
return region?.trim() || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || BEDROCK_DEFAULT_REGION;
|
|
4388
|
+
}
|
|
4389
|
+
function getBedrockRuntimeEndpoint(region) {
|
|
4390
|
+
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
4391
|
+
}
|
|
4392
|
+
function getBedrockOpenAIEndpoint(_mode, region) {
|
|
4393
|
+
return `${getBedrockRuntimeEndpoint(region)}/openai/v1`;
|
|
4394
|
+
}
|
|
4395
|
+
function resolveBedrockEndpoint(mode, region, configuredEndpoint) {
|
|
4396
|
+
if (configuredEndpoint?.trim()) {
|
|
4397
|
+
return configuredEndpoint.replace(/\/+$/, "");
|
|
4398
|
+
}
|
|
4399
|
+
if (mode === "converse") {
|
|
4400
|
+
return getBedrockRuntimeEndpoint(region);
|
|
4401
|
+
}
|
|
4402
|
+
return getBedrockOpenAIEndpoint(mode, region);
|
|
4403
|
+
}
|
|
4404
|
+
function resolveBedrockAuthMode(mode, configured) {
|
|
4405
|
+
if (configured) return configured;
|
|
4406
|
+
return mode === "converse" ? "aws-credentials" : "bedrock-api-key";
|
|
4407
|
+
}
|
|
4408
|
+
function parseToolArguments(argumentsJson) {
|
|
4409
|
+
try {
|
|
4410
|
+
return JSON.parse(argumentsJson);
|
|
4411
|
+
} catch {
|
|
4412
|
+
return {};
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
function toTextContent(content) {
|
|
4416
|
+
return content ? [{ text: content }] : [];
|
|
4417
|
+
}
|
|
4418
|
+
function toToolUseBlocks(toolCalls) {
|
|
4419
|
+
return toolCalls.map((toolCall) => ({
|
|
4420
|
+
toolUse: {
|
|
4421
|
+
toolUseId: toolCall.id,
|
|
4422
|
+
name: toolCall.function.name,
|
|
4423
|
+
input: parseToolArguments(toolCall.function.arguments)
|
|
4424
|
+
}
|
|
4425
|
+
}));
|
|
4426
|
+
}
|
|
4427
|
+
function toConverseMessage(message) {
|
|
4428
|
+
if (message.role === "system") {
|
|
4429
|
+
return null;
|
|
4430
|
+
}
|
|
4431
|
+
if (message.role === "tool") {
|
|
4432
|
+
return {
|
|
4433
|
+
role: "user",
|
|
4434
|
+
content: [
|
|
4435
|
+
{
|
|
4436
|
+
toolResult: {
|
|
4437
|
+
toolUseId: message.tool_call_id ?? message.name ?? "tool_result",
|
|
4438
|
+
content: [{ text: message.content }]
|
|
4439
|
+
}
|
|
4440
|
+
}
|
|
4441
|
+
]
|
|
4442
|
+
};
|
|
4443
|
+
}
|
|
4444
|
+
if (message.role === "assistant") {
|
|
4445
|
+
const content = [
|
|
4446
|
+
...toTextContent(message.content),
|
|
4447
|
+
...message.tool_calls?.length ? toToolUseBlocks(message.tool_calls) : []
|
|
4448
|
+
];
|
|
4449
|
+
return {
|
|
4450
|
+
role: "assistant",
|
|
4451
|
+
content: content.length > 0 ? content : [{ text: "" }]
|
|
4452
|
+
};
|
|
4453
|
+
}
|
|
4454
|
+
return {
|
|
4455
|
+
role: "user",
|
|
4456
|
+
content: toTextContent(message.content)
|
|
4457
|
+
};
|
|
4458
|
+
}
|
|
4459
|
+
function toOpenAIMessage(message) {
|
|
4460
|
+
const mapped = {
|
|
4461
|
+
role: message.role,
|
|
4462
|
+
content: message.role === "assistant" && message.tool_calls?.length ? message.content || null : message.content
|
|
4463
|
+
};
|
|
4464
|
+
if (message.name) mapped.name = message.name;
|
|
4465
|
+
if (message.role === "tool" && message.tool_call_id) {
|
|
4466
|
+
mapped.tool_call_id = message.tool_call_id;
|
|
4467
|
+
}
|
|
4468
|
+
if (message.role === "assistant" && message.tool_calls?.length) {
|
|
4469
|
+
mapped.tool_calls = message.tool_calls;
|
|
4470
|
+
}
|
|
4471
|
+
return mapped;
|
|
4472
|
+
}
|
|
4473
|
+
function toResponsesInputItem(message) {
|
|
4474
|
+
if (message.role === "tool" && message.tool_call_id) {
|
|
4475
|
+
return [
|
|
4476
|
+
{
|
|
4477
|
+
type: "function_call_output",
|
|
4478
|
+
call_id: message.tool_call_id,
|
|
4479
|
+
output: message.content
|
|
4480
|
+
}
|
|
4481
|
+
];
|
|
4482
|
+
}
|
|
4483
|
+
if (message.role === "assistant" && message.tool_calls?.length) {
|
|
4484
|
+
return message.tool_calls.map((toolCall) => ({
|
|
4485
|
+
type: "function_call",
|
|
4486
|
+
call_id: toolCall.id,
|
|
4487
|
+
name: toolCall.function.name,
|
|
4488
|
+
arguments: toolCall.function.arguments
|
|
4489
|
+
}));
|
|
4490
|
+
}
|
|
4491
|
+
if (message.role === "system") {
|
|
4492
|
+
return [];
|
|
4493
|
+
}
|
|
4494
|
+
const contentType = message.role === "assistant" ? "output_text" : "input_text";
|
|
4495
|
+
return [
|
|
4496
|
+
{
|
|
4497
|
+
role: message.role,
|
|
4498
|
+
content: [{ type: contentType, text: message.content }]
|
|
4499
|
+
}
|
|
4500
|
+
];
|
|
4501
|
+
}
|
|
4502
|
+
function toOpenAITools(tools) {
|
|
4503
|
+
return tools.map((tool) => ({
|
|
4504
|
+
type: "function",
|
|
4505
|
+
function: {
|
|
4506
|
+
name: tool.name,
|
|
4507
|
+
description: tool.description,
|
|
4508
|
+
parameters: tool.parameters ?? { type: "object", properties: {} }
|
|
4509
|
+
}
|
|
4510
|
+
}));
|
|
4511
|
+
}
|
|
4512
|
+
function toResponsesTools(tools) {
|
|
4513
|
+
return tools.map((tool) => ({
|
|
4514
|
+
type: "function",
|
|
4515
|
+
name: tool.name,
|
|
4516
|
+
description: tool.description,
|
|
4517
|
+
parameters: tool.parameters ?? { type: "object", properties: {} }
|
|
4518
|
+
}));
|
|
4519
|
+
}
|
|
4520
|
+
function toConverseTools(tools) {
|
|
4521
|
+
return tools.map((tool) => ({
|
|
4522
|
+
toolSpec: {
|
|
4523
|
+
name: tool.name,
|
|
4524
|
+
description: tool.description,
|
|
4525
|
+
inputSchema: {
|
|
4526
|
+
json: tool.parameters ?? { type: "object", properties: {} }
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
}));
|
|
4530
|
+
}
|
|
4531
|
+
function normalizeStopReason(stopReason) {
|
|
4532
|
+
if (stopReason === "tool_use" || stopReason === "tool_calls") {
|
|
4533
|
+
return "tool_calls";
|
|
4534
|
+
}
|
|
4535
|
+
if (stopReason === "max_tokens" || stopReason === "length") {
|
|
4536
|
+
return "length";
|
|
4537
|
+
}
|
|
4538
|
+
if (stopReason === "content_filter") {
|
|
4539
|
+
return "content_filter";
|
|
4540
|
+
}
|
|
4541
|
+
return "stop";
|
|
4542
|
+
}
|
|
4543
|
+
function toolCallsFromConverseBlocks(blocks) {
|
|
4544
|
+
return blocks.filter(
|
|
4545
|
+
(block) => "toolUse" in block && Boolean(block.toolUse)
|
|
4546
|
+
).map((block) => ({
|
|
4547
|
+
id: block.toolUse.toolUseId,
|
|
4548
|
+
type: "function",
|
|
4549
|
+
function: {
|
|
4550
|
+
name: block.toolUse.name,
|
|
4551
|
+
arguments: JSON.stringify(block.toolUse.input ?? {})
|
|
4552
|
+
}
|
|
4553
|
+
}));
|
|
4554
|
+
}
|
|
4555
|
+
function textFromConverseBlocks(blocks) {
|
|
4556
|
+
return blocks.filter((block) => "text" in block).map((block) => block.text).join("");
|
|
4557
|
+
}
|
|
4558
|
+
function isBedrockAwsError(error) {
|
|
4559
|
+
return error instanceof Error;
|
|
4560
|
+
}
|
|
4561
|
+
function classifyBedrockError(error) {
|
|
4562
|
+
if (!isBedrockAwsError(error)) {
|
|
4563
|
+
return new ApiError(String(error), "unknown", 0, true);
|
|
4564
|
+
}
|
|
4565
|
+
if (error.name === "AbortError") {
|
|
4566
|
+
return new ApiError("Request cancelled.", "cancelled", 0, false);
|
|
4567
|
+
}
|
|
4568
|
+
const status = error["$metadata"]?.httpStatusCode ?? 0;
|
|
4569
|
+
const message = error.message || error.name;
|
|
4570
|
+
const lower = `${error.name} ${message}`.toLowerCase();
|
|
4571
|
+
let code;
|
|
4572
|
+
if (lower.includes("credential") || lower.includes("signature") || lower.includes("unrecognizedclient") || lower.includes("expiredtoken")) {
|
|
4573
|
+
code = "auth_failed";
|
|
4574
|
+
} else if (lower.includes("accessdenied") || lower.includes("access denied") || lower.includes("not authorized") || lower.includes("model access")) {
|
|
4575
|
+
code = "access_denied";
|
|
4576
|
+
} else if (lower.includes("resourcenotfound") || lower.includes("model not found") || lower.includes("not found") || lower.includes("not available")) {
|
|
4577
|
+
code = "model_not_found";
|
|
4578
|
+
} else if (lower.includes("throttl") || lower.includes("quota") || lower.includes("toomanyrequests")) {
|
|
4579
|
+
code = "rate_limited";
|
|
4580
|
+
} else if (lower.includes("validation") || lower.includes("unsupported") || lower.includes("api mode")) {
|
|
4581
|
+
code = "invalid_request";
|
|
4582
|
+
} else if (lower.includes("network") || lower.includes("enotfound") || lower.includes("econn") || lower.includes("private endpoint")) {
|
|
4583
|
+
code = "network_error";
|
|
4584
|
+
}
|
|
4585
|
+
if (code) {
|
|
4586
|
+
const friendly = {
|
|
4587
|
+
auth_failed: "AWS Bedrock credentials were not found or were rejected. Configure AWS credentials, AWS_PROFILE, instance metadata, or choose Bedrock API key auth.",
|
|
4588
|
+
access_denied: "AWS Bedrock denied access. Enable model access in the AWS console and verify IAM permissions for this model.",
|
|
4589
|
+
model_not_found: "The selected Bedrock model is not available in this region. Check the model ID, inference profile, ARN, and region.",
|
|
4590
|
+
invalid_request: "Bedrock rejected the request. The selected model may not support this API mode or native tool use.",
|
|
4591
|
+
rate_limited: "AWS Bedrock throttled the request or quota was exceeded. Wait and retry, or request a quota increase.",
|
|
4592
|
+
network_error: "Unable to reach the AWS Bedrock endpoint. Check region, endpoint, private networking, and proxy settings.",
|
|
4593
|
+
timeout: "The AWS Bedrock request timed out.",
|
|
4594
|
+
cancelled: "Request cancelled.",
|
|
4595
|
+
context_overflow: "The conversation is too long for this Bedrock model.",
|
|
4596
|
+
payment_required: "AWS Bedrock billing or account setup is required.",
|
|
4597
|
+
server_error: "AWS Bedrock encountered a service error. Please try again later.",
|
|
4598
|
+
unknown: "AWS Bedrock returned an unexpected error."
|
|
4599
|
+
};
|
|
4600
|
+
return new ApiError(`${friendly[code]}
|
|
4601
|
+
${message}`, code, status, code === "rate_limited" || code === "server_error", void 0, message);
|
|
4602
|
+
}
|
|
4603
|
+
return classifyApiError(status, message);
|
|
4604
|
+
}
|
|
4605
|
+
async function readErrorBody(response) {
|
|
4606
|
+
try {
|
|
4607
|
+
return await response.text();
|
|
4608
|
+
} catch {
|
|
4609
|
+
return "";
|
|
4610
|
+
}
|
|
4611
|
+
}
|
|
4612
|
+
var BedrockProvider = class {
|
|
4613
|
+
apiMode;
|
|
4614
|
+
authMode;
|
|
4615
|
+
region;
|
|
4616
|
+
endpoint;
|
|
4617
|
+
profile;
|
|
4618
|
+
apiKey;
|
|
4619
|
+
model;
|
|
4620
|
+
runtimeClient;
|
|
4621
|
+
modelClient;
|
|
4622
|
+
constructor(config) {
|
|
4623
|
+
this.apiMode = config.apiMode ?? "converse";
|
|
4624
|
+
this.authMode = resolveBedrockAuthMode(this.apiMode, config.authMode);
|
|
4625
|
+
this.region = resolveBedrockRegion(config.region);
|
|
4626
|
+
this.endpoint = resolveBedrockEndpoint(this.apiMode, this.region, config.endpoint);
|
|
4627
|
+
this.profile = config.profile;
|
|
4628
|
+
this.apiKey = config.apiKey;
|
|
4629
|
+
this.model = config.model || BEDROCK_DEFAULT_MODEL;
|
|
4630
|
+
}
|
|
4631
|
+
getName() {
|
|
4632
|
+
return "bedrock";
|
|
4633
|
+
}
|
|
4634
|
+
setModel(model) {
|
|
4635
|
+
this.model = model;
|
|
4636
|
+
}
|
|
4637
|
+
getCapabilities() {
|
|
4638
|
+
return { nativeToolCalling: true };
|
|
4639
|
+
}
|
|
4640
|
+
async listModels() {
|
|
4641
|
+
if (this.apiMode !== "converse") {
|
|
4642
|
+
return [...BEDROCK_MODELS];
|
|
4643
|
+
}
|
|
4644
|
+
try {
|
|
4645
|
+
const response = await this.getModelClient().send(
|
|
4646
|
+
new ListFoundationModelsCommand({})
|
|
4647
|
+
);
|
|
4648
|
+
const summaries = response.modelSummaries ?? [];
|
|
4649
|
+
const modelIds = summaries.map((summary) => summary.modelId).filter((modelId) => Boolean(modelId));
|
|
4650
|
+
return modelIds.length > 0 ? modelIds : [...BEDROCK_MODELS];
|
|
4651
|
+
} catch {
|
|
4652
|
+
return [...BEDROCK_MODELS];
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
async isAvailable() {
|
|
4656
|
+
if (this.authMode === "bedrock-api-key") {
|
|
4657
|
+
return Boolean(this.apiKey);
|
|
4658
|
+
}
|
|
4659
|
+
try {
|
|
4660
|
+
await this.listModels();
|
|
4661
|
+
return true;
|
|
4662
|
+
} catch {
|
|
4663
|
+
return false;
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
async complete(request) {
|
|
4667
|
+
if (!this.region) {
|
|
4668
|
+
throw new ApiError(
|
|
4669
|
+
"AWS Bedrock region is missing. Set bedrock.region, AWS_REGION, or AWS_DEFAULT_REGION.",
|
|
4670
|
+
"invalid_request",
|
|
4671
|
+
0,
|
|
4672
|
+
false
|
|
4673
|
+
);
|
|
4674
|
+
}
|
|
4675
|
+
if (this.apiMode === "converse") {
|
|
4676
|
+
return this.completeWithConverse(request);
|
|
4677
|
+
}
|
|
4678
|
+
return this.completeWithOpenAICompatible(request);
|
|
4679
|
+
}
|
|
4680
|
+
getCredentials() {
|
|
4681
|
+
if (this.profile) {
|
|
4682
|
+
return fromIni({ profile: this.profile });
|
|
4683
|
+
}
|
|
4684
|
+
return void 0;
|
|
4685
|
+
}
|
|
4686
|
+
getRuntimeClient() {
|
|
4687
|
+
if (!this.runtimeClient) {
|
|
4688
|
+
this.runtimeClient = new BedrockRuntimeClient({
|
|
4689
|
+
region: this.region,
|
|
4690
|
+
endpoint: this.endpoint,
|
|
4691
|
+
credentials: this.getCredentials()
|
|
4692
|
+
});
|
|
4693
|
+
}
|
|
4694
|
+
return this.runtimeClient;
|
|
4695
|
+
}
|
|
4696
|
+
getModelClient() {
|
|
4697
|
+
if (!this.modelClient) {
|
|
4698
|
+
this.modelClient = new BedrockClient({
|
|
4699
|
+
region: this.region,
|
|
4700
|
+
credentials: this.getCredentials()
|
|
4701
|
+
});
|
|
4702
|
+
}
|
|
4703
|
+
return this.modelClient;
|
|
4704
|
+
}
|
|
4705
|
+
async completeWithConverse(request) {
|
|
4706
|
+
if (this.authMode === "bedrock-api-key") {
|
|
4707
|
+
throw new ApiError(
|
|
4708
|
+
"Bedrock Converse uses AWS credential-chain auth. Choose apiMode openai-chat/openai-responses to use Bedrock API keys.",
|
|
4709
|
+
"invalid_request",
|
|
4710
|
+
0,
|
|
4711
|
+
false
|
|
4712
|
+
);
|
|
4713
|
+
}
|
|
4714
|
+
const contentMessages = request.messages.map(toConverseMessage).filter((message) => message !== null);
|
|
4715
|
+
const system = request.messages.filter((message) => message.role === "system" && message.content).map((message) => ({ text: message.content }));
|
|
4716
|
+
const body = {
|
|
4717
|
+
modelId: request.model ?? this.model,
|
|
4718
|
+
messages: contentMessages,
|
|
4719
|
+
inferenceConfig: {
|
|
4720
|
+
...request.maxTokens !== void 0 && { maxTokens: request.maxTokens },
|
|
4721
|
+
...request.temperature !== void 0 && { temperature: request.temperature }
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4724
|
+
if (system.length > 0) {
|
|
4725
|
+
body.system = system;
|
|
4726
|
+
}
|
|
4727
|
+
if (request.tools?.length) {
|
|
4728
|
+
body.toolConfig = {
|
|
4729
|
+
tools: toConverseTools(request.tools),
|
|
4730
|
+
...request.toolChoice && request.toolChoice !== "auto" ? { toolChoice: this.toConverseToolChoice(request.toolChoice) } : {}
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
try {
|
|
4734
|
+
const data = await this.getRuntimeClient().send(
|
|
4735
|
+
new ConverseCommand(body)
|
|
4736
|
+
);
|
|
4737
|
+
const blocks = data.output?.message?.content ?? [];
|
|
4738
|
+
const toolCalls = toolCallsFromConverseBlocks(blocks);
|
|
4739
|
+
return {
|
|
4740
|
+
id: `bedrock-${Date.now()}`,
|
|
4741
|
+
created: Math.floor(Date.now() / 1e3),
|
|
4742
|
+
content: textFromConverseBlocks(blocks),
|
|
4743
|
+
...toolCalls.length > 0 && { toolCalls },
|
|
4744
|
+
finishReason: normalizeStopReason(data.stopReason),
|
|
4745
|
+
usage: normalizeLLMUsage(data.usage),
|
|
4746
|
+
raw: data
|
|
4747
|
+
};
|
|
4748
|
+
} catch (error) {
|
|
4749
|
+
throw classifyBedrockError(error);
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
toConverseToolChoice(toolChoice) {
|
|
4753
|
+
if (!toolChoice || toolChoice === "auto") return void 0;
|
|
4754
|
+
if (toolChoice === "none") return { auto: {} };
|
|
4755
|
+
if (toolChoice === "required") return { any: {} };
|
|
4756
|
+
return { tool: { name: toolChoice.function.name } };
|
|
4757
|
+
}
|
|
4758
|
+
async completeWithOpenAICompatible(request) {
|
|
4759
|
+
if (this.authMode !== "bedrock-api-key") {
|
|
4760
|
+
throw new ApiError(
|
|
4761
|
+
"Bedrock OpenAI-compatible modes require authMode bedrock-api-key and bedrock.apiKey.",
|
|
4762
|
+
"auth_failed",
|
|
4763
|
+
0,
|
|
4764
|
+
false
|
|
4765
|
+
);
|
|
4766
|
+
}
|
|
4767
|
+
if (!this.apiKey) {
|
|
4768
|
+
throw new ApiError(
|
|
4769
|
+
"Bedrock API key is missing. Set bedrock.apiKey for OpenAI-compatible Bedrock modes.",
|
|
4770
|
+
"auth_failed",
|
|
4771
|
+
0,
|
|
4772
|
+
false
|
|
4773
|
+
);
|
|
4774
|
+
}
|
|
4775
|
+
if (this.apiMode === "openai-chat") {
|
|
4776
|
+
return this.completeWithOpenAIChat(request);
|
|
4777
|
+
}
|
|
4778
|
+
return this.completeWithOpenAIResponses(request);
|
|
4779
|
+
}
|
|
4780
|
+
async completeWithOpenAIChat(request) {
|
|
4781
|
+
const body = {
|
|
4782
|
+
model: request.model ?? this.model,
|
|
4783
|
+
messages: request.messages.map(toOpenAIMessage),
|
|
4784
|
+
...request.temperature !== void 0 && { temperature: request.temperature },
|
|
4785
|
+
...request.maxTokens !== void 0 && { max_tokens: request.maxTokens }
|
|
4786
|
+
};
|
|
4787
|
+
if (request.tools?.length) {
|
|
4788
|
+
body.tools = toOpenAITools(request.tools);
|
|
4789
|
+
if (request.toolChoice) body.tool_choice = request.toolChoice;
|
|
4790
|
+
}
|
|
4791
|
+
const data = await this.fetchJson("/chat/completions", body, request.signal);
|
|
4792
|
+
const choice = data.choices?.[0];
|
|
4793
|
+
if (!choice?.message) {
|
|
4794
|
+
throw new ApiError(
|
|
4795
|
+
"Malformed Bedrock OpenAI chat response: missing choice message.",
|
|
4796
|
+
"invalid_request",
|
|
4797
|
+
200,
|
|
4798
|
+
false,
|
|
4799
|
+
void 0,
|
|
4800
|
+
JSON.stringify(data)
|
|
4801
|
+
);
|
|
4802
|
+
}
|
|
4803
|
+
return {
|
|
4804
|
+
id: data.id ?? `bedrock-chat-${Date.now()}`,
|
|
4805
|
+
created: data.created ?? Math.floor(Date.now() / 1e3),
|
|
4806
|
+
content: choice.message.content ?? "",
|
|
4807
|
+
...choice.message.tool_calls?.length && { toolCalls: choice.message.tool_calls },
|
|
4808
|
+
finishReason: normalizeStopReason(choice.finish_reason),
|
|
4809
|
+
usage: normalizeLLMUsage(data.usage),
|
|
4810
|
+
raw: data
|
|
4811
|
+
};
|
|
4812
|
+
}
|
|
4813
|
+
async completeWithOpenAIResponses(request) {
|
|
4814
|
+
const instructions = request.messages.filter((message) => message.role === "system").map((message) => message.content).join("\n\n");
|
|
4815
|
+
const body = {
|
|
4816
|
+
model: request.model ?? this.model,
|
|
4817
|
+
input: request.messages.flatMap(toResponsesInputItem),
|
|
4818
|
+
...instructions && { instructions },
|
|
4819
|
+
...request.maxTokens !== void 0 && { max_output_tokens: request.maxTokens }
|
|
4820
|
+
};
|
|
4821
|
+
if (request.tools?.length) {
|
|
4822
|
+
body.tools = toResponsesTools(request.tools);
|
|
4823
|
+
if (request.toolChoice) body.tool_choice = request.toolChoice;
|
|
4824
|
+
}
|
|
4825
|
+
const data = await this.fetchJson("/responses", body, request.signal);
|
|
4826
|
+
const functionCalls = (data.output ?? []).filter(
|
|
4827
|
+
(item) => item.type === "function_call" && typeof item.name === "string" && typeof item.arguments === "string"
|
|
4828
|
+
).map((item) => ({
|
|
4829
|
+
id: item.call_id ?? item.id ?? `call_${Date.now()}`,
|
|
4830
|
+
type: "function",
|
|
4831
|
+
function: {
|
|
4832
|
+
name: item.name,
|
|
4833
|
+
arguments: item.arguments
|
|
4834
|
+
}
|
|
4835
|
+
}));
|
|
4836
|
+
return {
|
|
4837
|
+
id: data.id ?? `bedrock-responses-${Date.now()}`,
|
|
4838
|
+
created: data.created_at ?? Math.floor(Date.now() / 1e3),
|
|
4839
|
+
content: data.output_text ?? "",
|
|
4840
|
+
...functionCalls.length > 0 && { toolCalls: functionCalls },
|
|
4841
|
+
finishReason: functionCalls.length > 0 ? "tool_calls" : "stop",
|
|
4842
|
+
usage: normalizeLLMUsage(data.usage),
|
|
4843
|
+
raw: data
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
async fetchJson(path, body, signal) {
|
|
4847
|
+
let response;
|
|
4848
|
+
try {
|
|
4849
|
+
response = await fetch(`${this.endpoint}${path}`, {
|
|
4850
|
+
method: "POST",
|
|
4851
|
+
headers: {
|
|
4852
|
+
"Content-Type": "application/json",
|
|
4853
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4854
|
+
},
|
|
4855
|
+
body: JSON.stringify(body),
|
|
4856
|
+
signal
|
|
4857
|
+
});
|
|
4858
|
+
} catch (error) {
|
|
4859
|
+
const err = error;
|
|
4860
|
+
if (err.name === "AbortError" && signal?.aborted) {
|
|
4861
|
+
throw new ApiError("Request cancelled.", "cancelled", 0, false);
|
|
4862
|
+
}
|
|
4863
|
+
if (err.name === "AbortError") {
|
|
4864
|
+
throw new ApiError("The Bedrock request timed out.", "timeout", 0, true);
|
|
4865
|
+
}
|
|
4866
|
+
throw new ApiError(
|
|
4867
|
+
"Unable to connect to the Bedrock OpenAI-compatible endpoint. Check region, endpoint, private networking, and proxy settings.",
|
|
4868
|
+
"network_error",
|
|
4869
|
+
0,
|
|
4870
|
+
true,
|
|
4871
|
+
void 0,
|
|
4872
|
+
err.message
|
|
4873
|
+
);
|
|
4874
|
+
}
|
|
4875
|
+
if (!response.ok) {
|
|
4876
|
+
const errorBody = await readErrorBody(response);
|
|
4877
|
+
const classified = classifyApiError(response.status, errorBody, response.headers);
|
|
4878
|
+
throw new ApiError(
|
|
4879
|
+
`AWS Bedrock request failed.
|
|
4880
|
+
${classified.message}`,
|
|
4881
|
+
classified.code,
|
|
4882
|
+
classified.httpStatus,
|
|
4883
|
+
classified.retryable,
|
|
4884
|
+
classified.retryAfterMs,
|
|
4885
|
+
classified.rawDetail
|
|
4886
|
+
);
|
|
4887
|
+
}
|
|
4888
|
+
try {
|
|
4889
|
+
return await response.json();
|
|
4890
|
+
} catch (error) {
|
|
4891
|
+
throw new ApiError(
|
|
4892
|
+
"Malformed Bedrock response: response body was not valid JSON.",
|
|
4893
|
+
"invalid_request",
|
|
4894
|
+
response.status,
|
|
4895
|
+
false,
|
|
4896
|
+
void 0,
|
|
4897
|
+
error instanceof Error ? error.message : String(error)
|
|
4898
|
+
);
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
};
|
|
4902
|
+
|
|
4903
|
+
// src/providers/CustomOpenAICompatibleProvider.ts
|
|
4904
|
+
var CustomOpenAICompatibleProvider = class {
|
|
4905
|
+
providerName;
|
|
4906
|
+
client;
|
|
4907
|
+
models;
|
|
4908
|
+
apiKeyRequired;
|
|
4909
|
+
apiKey;
|
|
4910
|
+
model;
|
|
4911
|
+
constructor(config, networkSettings) {
|
|
4912
|
+
this.providerName = toCustomProviderName(config.id);
|
|
4913
|
+
this.model = config.model;
|
|
4914
|
+
this.models = config.models?.map((entry) => entry.id) ?? [config.model];
|
|
4915
|
+
this.apiKeyRequired = config.apiKeyRequired !== false;
|
|
4916
|
+
this.apiKey = config.apiKey;
|
|
4917
|
+
this.client = new LLMGatewayClient(
|
|
4918
|
+
{
|
|
4919
|
+
apiKey: config.apiKey ?? "",
|
|
4920
|
+
baseUrl: config.baseUrl,
|
|
4921
|
+
model: config.model
|
|
4922
|
+
},
|
|
4923
|
+
networkSettings,
|
|
4924
|
+
{
|
|
4925
|
+
serviceName: config.displayName,
|
|
4926
|
+
credentialName: `${config.displayName} API key`,
|
|
4927
|
+
accountName: `${config.displayName} account`
|
|
4928
|
+
}
|
|
4929
|
+
);
|
|
4930
|
+
}
|
|
4931
|
+
getName() {
|
|
4932
|
+
return this.providerName;
|
|
4933
|
+
}
|
|
4934
|
+
getCapabilities() {
|
|
4935
|
+
return { nativeToolCalling: true };
|
|
4936
|
+
}
|
|
4937
|
+
setModel(model) {
|
|
4938
|
+
this.model = model;
|
|
4939
|
+
this.client.setDefaultModel(model);
|
|
4940
|
+
}
|
|
4941
|
+
async listModels() {
|
|
4942
|
+
return this.models;
|
|
4943
|
+
}
|
|
4944
|
+
async isAvailable() {
|
|
4945
|
+
return !this.apiKeyRequired || Boolean(this.apiKey);
|
|
4946
|
+
}
|
|
4947
|
+
async complete(request) {
|
|
4948
|
+
return this.client.complete(request);
|
|
4949
|
+
}
|
|
4950
|
+
};
|
|
4951
|
+
|
|
4135
4952
|
// src/providers/ProviderFactory.ts
|
|
4136
4953
|
var ProviderNotConfiguredError = class extends Error {
|
|
4137
4954
|
constructor(providerName) {
|
|
@@ -4169,6 +4986,16 @@ var ProviderFactory = class {
|
|
|
4169
4986
|
*/
|
|
4170
4987
|
static create(config) {
|
|
4171
4988
|
const providerName = config.provider || "openrouter";
|
|
4989
|
+
if (isCustomProviderName(providerName)) {
|
|
4990
|
+
const customProvider = getCustomProviderConfig(config, providerName);
|
|
4991
|
+
if (!customProvider || customProvider.apiFormat !== "openai-compatible") {
|
|
4992
|
+
return new UnconfiguredProvider(providerName);
|
|
4993
|
+
}
|
|
4994
|
+
return new CustomOpenAICompatibleProvider(customProvider, config.network);
|
|
4995
|
+
}
|
|
4996
|
+
if (providerName === "bedrock" && !isAwsBedrockProviderEnabled(config)) {
|
|
4997
|
+
return new UnconfiguredProvider("bedrock");
|
|
4998
|
+
}
|
|
4172
4999
|
switch (providerName) {
|
|
4173
5000
|
case "ollama":
|
|
4174
5001
|
if (!config.ollama) {
|
|
@@ -4205,6 +5032,11 @@ var ProviderFactory = class {
|
|
|
4205
5032
|
return new UnconfiguredProvider("zai");
|
|
4206
5033
|
}
|
|
4207
5034
|
return new ZaiProvider(config.zai, config.network);
|
|
5035
|
+
case "sakana":
|
|
5036
|
+
if (!config.sakana) {
|
|
5037
|
+
return new UnconfiguredProvider("sakana");
|
|
5038
|
+
}
|
|
5039
|
+
return new SakanaProvider(config.sakana, config.network);
|
|
4208
5040
|
case "vertexai":
|
|
4209
5041
|
if (!config.vertexai) {
|
|
4210
5042
|
return new UnconfiguredProvider("vertexai");
|
|
@@ -4230,6 +5062,11 @@ var ProviderFactory = class {
|
|
|
4230
5062
|
return new UnconfiguredProvider("deepseek");
|
|
4231
5063
|
}
|
|
4232
5064
|
return new DeepSeekProvider(config.deepseek, config.network);
|
|
5065
|
+
case "bedrock":
|
|
5066
|
+
if (!config.bedrock) {
|
|
5067
|
+
return new UnconfiguredProvider("bedrock");
|
|
5068
|
+
}
|
|
5069
|
+
return new BedrockProvider(config.bedrock);
|
|
4233
5070
|
case "openrouter":
|
|
4234
5071
|
default:
|
|
4235
5072
|
if (!config.openrouter) {
|
|
@@ -4242,11 +5079,16 @@ var ProviderFactory = class {
|
|
|
4242
5079
|
* Get all available provider names.
|
|
4243
5080
|
* MLX is only included on Apple Silicon (macOS + arm64).
|
|
4244
5081
|
*/
|
|
4245
|
-
static getProviderNames() {
|
|
4246
|
-
const providers = ["zai", "xai", "vertexai", "nvidia", "openrouter", "openai", "ollama", "llmgateway", "llamacpp", "deepseek", "cerebras", "azure"];
|
|
5082
|
+
static getProviderNames(config) {
|
|
5083
|
+
const providers = ["zai", "xai", "vertexai", "sakana", "nvidia", "openrouter", "openai", "ollama", "llmgateway", "llamacpp", "deepseek", "cerebras", "azure"];
|
|
5084
|
+
if (isAwsBedrockProviderEnabled(config)) {
|
|
5085
|
+
providers.splice(providers.indexOf("azure"), 0, "bedrock");
|
|
5086
|
+
}
|
|
4247
5087
|
if (isMLXSupported()) {
|
|
4248
5088
|
providers.push("mlx");
|
|
4249
5089
|
}
|
|
5090
|
+
const customProviders = Object.values(config?.customProviders ?? {}).filter((entry) => entry.disabled !== true).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((entry) => toCustomProviderName(entry.id));
|
|
5091
|
+
providers.push(...customProviders);
|
|
4250
5092
|
return providers;
|
|
4251
5093
|
}
|
|
4252
5094
|
/**
|
|
@@ -4254,8 +5096,14 @@ var ProviderFactory = class {
|
|
|
4254
5096
|
* Note: This checks if the name is a valid provider type, not if it's available on this platform.
|
|
4255
5097
|
* MLX is always a valid provider name, but may not be available on non-Apple Silicon systems.
|
|
4256
5098
|
*/
|
|
4257
|
-
static isValidProvider(name) {
|
|
4258
|
-
|
|
5099
|
+
static isValidProvider(name, config) {
|
|
5100
|
+
if (isCustomProviderName(name)) {
|
|
5101
|
+
return getCustomProviderConfig(config, name) !== void 0;
|
|
5102
|
+
}
|
|
5103
|
+
if (name === "bedrock" && !isAwsBedrockProviderEnabled(config)) {
|
|
5104
|
+
return false;
|
|
5105
|
+
}
|
|
5106
|
+
const allProviders = ["openrouter", "ollama", "openai", "llamacpp", "mlx", "llmgateway", "azure", "zai", "sakana", "vertexai", "xai", "cerebras", "nvidia", "deepseek", "bedrock"];
|
|
4259
5107
|
return allProviders.includes(name);
|
|
4260
5108
|
}
|
|
4261
5109
|
};
|
|
@@ -4268,6 +5116,8 @@ export {
|
|
|
4268
5116
|
modelSupportsImages,
|
|
4269
5117
|
ZAI_DEFAULT_BASE_URL,
|
|
4270
5118
|
ZAI_MODELS,
|
|
5119
|
+
SAKANA_DEFAULT_BASE_URL,
|
|
5120
|
+
SAKANA_MODELS,
|
|
4271
5121
|
isGcloudInstalled,
|
|
4272
5122
|
getGcloudProject,
|
|
4273
5123
|
getGcloudAccessToken,
|
|
@@ -4277,6 +5127,11 @@ export {
|
|
|
4277
5127
|
CEREBRAS_MODELS,
|
|
4278
5128
|
DEEPSEEK_DEFAULT_BASE_URL,
|
|
4279
5129
|
DEEPSEEK_MODELS,
|
|
5130
|
+
BEDROCK_DEFAULT_REGION,
|
|
5131
|
+
BEDROCK_DEFAULT_MODEL,
|
|
5132
|
+
BEDROCK_MODELS,
|
|
5133
|
+
resolveBedrockEndpoint,
|
|
5134
|
+
resolveBedrockAuthMode,
|
|
4280
5135
|
ProviderNotConfiguredError,
|
|
4281
5136
|
ProviderFactory
|
|
4282
5137
|
};
|
|
@@ -4289,3 +5144,8 @@ export {
|
|
|
4289
5144
|
* Google Cloud CLI authentication utilities
|
|
4290
5145
|
* @license Apache-2.0
|
|
4291
5146
|
*/
|
|
5147
|
+
/**
|
|
5148
|
+
* @license
|
|
5149
|
+
* Copyright 2026 Autohand AI LLC
|
|
5150
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5151
|
+
*/
|