autohand-cli 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/dist/{AgentRegistry-XPWSVO3Q.js → AgentRegistry-GOV7FN2O.js} +2 -2
- package/dist/AgentRegistry-J2C6JBZ3.cjs +10 -0
- package/dist/CommunitySkillsCache-22BB3J6H.cjs +8 -0
- package/dist/{CommunitySkillsCache-ZEQWP6YM.js → CommunitySkillsCache-ZACDPD4J.js} +2 -2
- package/dist/{HookManager-CWLTFKWO.js → HookManager-2S6AHOC3.js} +1 -1
- package/dist/{HookManager-TMAJQU4S.cjs → HookManager-TVEQI5ZU.cjs} +2 -2
- package/dist/{ImportWizard-QBKQEXDW.js → ImportWizard-AEBMAKXE.js} +4 -4
- package/dist/{ImportWizard-MQXEED2U.cjs → ImportWizard-AF2XL6DS.cjs} +13 -13
- package/dist/LearnAdvisor-KKEQ5QCV.js +9 -0
- package/dist/LearnAdvisor-Q7RAYLPF.cjs +9 -0
- package/dist/MemoryManager-PMNAEZMB.cjs +8 -0
- package/dist/{MemoryManager-WJMLPWGU.js → MemoryManager-QZRLTUB5.js} +2 -2
- package/dist/NVIDIAProvider-C3FWQOBZ.cjs +14 -0
- package/dist/{NVIDIAProvider-2HR737UE.js → NVIDIAProvider-SJPY3ONR.js} +1 -1
- package/dist/{PermissionManager-KMYILJ4Z.js → PermissionManager-MT7KBNNR.js} +3 -3
- package/dist/PermissionManager-URCNP5EC.cjs +11 -0
- package/dist/ProviderFactory-56N3ECE4.cjs +12 -0
- package/dist/{ProviderFactory-HFPRVQ25.js → ProviderFactory-RB4RVAF6.js} +3 -2
- package/dist/SessionManager-2IZGWASQ.cjs +10 -0
- package/dist/{SessionManager-PNBTJJTQ.js → SessionManager-554PHVPC.js} +2 -2
- package/dist/SkillsRegistry-GMRVONOQ.cjs +9 -0
- package/dist/{SkillsRegistry-4RRD5GMX.js → SkillsRegistry-NHHMIUYJ.js} +2 -2
- package/dist/SubAgent-4GOR2FIJ.js +13 -0
- package/dist/SubAgent-ZJMDH4FI.cjs +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-3USFSGOH.js} +5 -4
- package/dist/about-QR52U5DD.cjs +15 -0
- package/dist/{acp-VHEL7BOW.js → acp-5Y2W6OZP.js} +129 -90
- package/dist/{acp-EOETGAHC.cjs → acp-GSYE75OB.cjs} +135 -96
- package/dist/actionExecutor-KHUU3Z3Q.cjs +28 -0
- package/dist/{actionExecutor-33I47NZS.js → actionExecutor-PLQJZLZV.js} +12 -8
- package/dist/add-dir-BTAD5OZS.cjs +11 -0
- package/dist/{add-dir-VFX7QT4E.js → add-dir-HCERJDBR.js} +2 -2
- package/dist/agent-B3EVT7NN.cjs +126 -0
- package/dist/agent-SATQ3WZ3.js +126 -0
- package/dist/agents-44CRJGM7.cjs +18 -0
- package/dist/agents-NN4ZAJ7R.js +18 -0
- package/dist/agents-new-6D6G4QS6.cjs +17 -0
- package/dist/agents-new-7GAQ25EK.js +17 -0
- package/dist/{autoSkill-EFMK6WU6.js → autoSkill-66PKCYTW.js} +2 -2
- package/dist/autoSkill-VQLGBELN.cjs +20 -0
- package/dist/automode-45DWV4TN.cjs +10 -0
- package/dist/{automode-BMYSRM34.js → automode-BUF3VGXU.js} +2 -2
- package/dist/chrome-Q2U73HZB.cjs +50 -0
- package/dist/chrome-Q54OALOK.cjs +21 -0
- package/dist/{chrome-NHJ44WUN.js → chrome-Y3T7EIHG.js} +2 -2
- package/dist/chrome-ZNJ46OYW.js +21 -0
- package/dist/{chunk-D2OSPLYC.cjs → chunk-22SCR3EV.cjs} +2 -2
- package/dist/chunk-26G7YGOW.js +367 -0
- package/dist/{chunk-75EDROHL.cjs → chunk-2ESQR35E.cjs} +10 -10
- package/dist/{chunk-HKYZSUQ5.js → chunk-2IW5YFJ4.js} +4 -4
- package/dist/{chunk-JP3YHTQ2.cjs → chunk-3ICORF7M.cjs} +4 -4
- package/dist/{chunk-4256YRCO.cjs → chunk-3UC6DMFI.cjs} +30 -17
- package/dist/{chunk-6GUODJKM.cjs → chunk-3UHRCHKB.cjs} +23 -23
- package/dist/{chunk-HXJEGMGB.js → chunk-3ZOOH44N.js} +2 -2
- package/dist/{chunk-7RFJB75Y.js → chunk-44ZWOBTI.js} +9 -9
- package/dist/{chunk-CCVMREXI.js → chunk-4567QNRB.js} +32 -8
- package/dist/chunk-45CHNQM6.cjs +517 -0
- package/dist/{chunk-6NVAK6CK.js → chunk-4E7SHPNQ.js} +2 -2
- package/dist/{chunk-XGMI6IYB.cjs → chunk-4XFHP2SN.cjs} +7 -7
- package/dist/chunk-4XVLNOFA.js +360 -0
- package/dist/{chunk-D6GZBSOX.js → chunk-575PXZX7.js} +1 -1
- package/dist/{chunk-HJIXWGQZ.js → chunk-5A7ZL64N.js} +1 -1
- package/dist/{chunk-ROLA6EFO.cjs → chunk-5GCQ5UMV.cjs} +14 -14
- package/dist/{chunk-3DDL2E55.cjs → chunk-5SFV2NCY.cjs} +10 -10
- package/dist/chunk-5ZNYX4VH.cjs +71 -0
- package/dist/{chunk-PDHT7LQS.cjs → chunk-63ANVAOJ.cjs} +3 -3
- package/dist/{chunk-GWO66KBI.js → chunk-65LRPW5W.js} +1 -1
- package/dist/{chunk-IAGCRVJ3.js → chunk-6AYJCDTA.js} +14 -9
- package/dist/{chunk-A7HHCIDQ.js → chunk-6HF6XSCC.js} +2 -2
- package/dist/{chunk-47PHDKNW.cjs → chunk-6JWCGQJU.cjs} +6 -6
- package/dist/chunk-6OECOAK5.cjs +360 -0
- package/dist/{chunk-RBHANOYY.js → chunk-7DJJGKM6.js} +47 -3
- package/dist/{chunk-37M5UM6I.js → chunk-7IRQ7JEH.js} +1 -1
- package/dist/chunk-7MY4JHER.js +27 -0
- package/dist/{chunk-ZR46OJNZ.js → chunk-7PJKTSRN.js} +3 -3
- package/dist/{chunk-AC7DZ6SK.cjs → chunk-7PT646AL.cjs} +3 -3
- package/dist/{chunk-TKKN34TV.js → chunk-7WAUCLLQ.js} +3 -3
- package/dist/{chunk-DPSIGY6L.cjs → chunk-7XTUL7ZD.cjs} +9 -9
- package/dist/{chunk-GBMDFWJX.cjs → chunk-AE2ILW25.cjs} +13 -13
- package/dist/{chunk-BQ22N3TX.cjs → chunk-AOKXYGBQ.cjs} +27 -22
- package/dist/{chunk-REMGR23V.cjs → chunk-AQ5PVHOC.cjs} +7 -2
- package/dist/{chunk-AUYSIEVV.cjs → chunk-AZ47LKD5.cjs} +3 -3
- package/dist/chunk-B76FJKEJ.cjs +184 -0
- package/dist/{chunk-XV2HXRHX.js → chunk-BP37FVBM.js} +3 -3
- package/dist/{chunk-JIMSII7R.js → chunk-C46B72VK.js} +57 -10
- package/dist/{chunk-L4F7SUYL.js → chunk-C5QIQQ37.js} +3 -3
- package/dist/{chunk-AUFNACED.js → chunk-CCIDL4SA.js} +7094 -6126
- package/dist/{chunk-OV3PVUYN.js → chunk-CECH6QQP.js} +11 -11
- package/dist/{chunk-CH2J4PVE.cjs → chunk-CK4HAHVY.cjs} +13 -13
- package/dist/{chunk-Q2IL4DDI.cjs → chunk-CO2AADYU.cjs} +19 -14
- package/dist/{chunk-7JLT2VNW.cjs → chunk-CRTCZ4WL.cjs} +7533 -6565
- package/dist/{chunk-5JFTY3VU.js → chunk-CSTUTDTH.js} +2 -1
- package/dist/{chunk-DIZTWFVR.cjs → chunk-D546G7DA.cjs} +209 -55
- package/dist/{chunk-7HPWMALN.js → chunk-DGBPWODD.js} +1 -1
- package/dist/{chunk-RBZ7AFX7.cjs → chunk-DHUQZ53B.cjs} +2 -2
- package/dist/{chunk-U4C3HW6P.js → chunk-DNSD7DVJ.js} +2 -2
- package/dist/{chunk-SOLBYSLY.cjs → chunk-DSSCERHI.cjs} +2 -2
- package/dist/{chunk-OPNI6O7F.cjs → chunk-EA2MS25U.cjs} +4 -4
- package/dist/{chunk-E46DJH5S.js → chunk-EEHWALXA.js} +94 -3
- package/dist/{chunk-CFFE4VA3.js → chunk-EYHKL4QC.js} +1 -1
- package/dist/{chunk-FGT6KK6T.js → chunk-FBQJZKFX.js} +3 -3
- package/dist/{chunk-I24CWKKK.js → chunk-FFHSCM5M.js} +3 -3
- package/dist/{chunk-TXPSTCG7.cjs → chunk-GAOPJ5S3.cjs} +8 -8
- package/dist/{chunk-ARBEHFCG.js → chunk-GSDV75A5.js} +1 -1
- package/dist/{chunk-Z3XSSF7B.js → chunk-H426KOGY.js} +1 -1
- package/dist/{chunk-WRTXCQ3V.cjs → chunk-HC2Q6A3E.cjs} +858 -182
- package/dist/{chunk-IGMPWJ2I.cjs → chunk-HG3ZASBH.cjs} +8 -8
- package/dist/chunk-HK5A54AV.cjs +280 -0
- package/dist/{chunk-2HOLOHVK.js → chunk-HSWWM6AM.js} +136 -15
- package/dist/chunk-HTU4W3GB.js +183 -0
- package/dist/{chunk-5CMYEM3R.cjs → chunk-HVCIB4SW.cjs} +3 -3
- package/dist/chunk-HXHE2KAO.js +385 -0
- package/dist/{chunk-NMQ47RCG.js → chunk-HZWU6IO3.js} +5 -2
- package/dist/{chunk-ZPD2AO3U.js → chunk-I2ZK3AOD.js} +2 -2
- package/dist/{chunk-3UT7R3XV.js → chunk-IEPLQ47J.js} +61 -5
- package/dist/{chunk-3PXKRVCW.js → chunk-JB3JCYBJ.js} +7 -2
- package/dist/chunk-JCUHCH37.cjs +247 -0
- package/dist/{chunk-VBOFPU5M.cjs → chunk-JM3ZTQUK.cjs} +13 -9
- package/dist/{chunk-WZV6UVPY.js → chunk-JMJRFSNJ.js} +1 -1
- package/dist/{chunk-QKP772OZ.js → chunk-JPFRI4L4.js} +756 -80
- package/dist/{chunk-MOJ7ADW4.cjs → chunk-JV5HVCHU.cjs} +2 -2
- package/dist/{chunk-LN7D3EJZ.js → chunk-KA2U6MY2.js} +4 -3
- package/dist/{chunk-E26KKI46.cjs → chunk-KASXKDF2.cjs} +3 -1
- package/dist/chunk-KJ26T7GM.cjs +367 -0
- package/dist/chunk-KM7R5YPS.cjs +385 -0
- package/dist/{chunk-5F6ZKSHO.js → chunk-KMP6Y3LJ.js} +1 -1
- package/dist/chunk-KWXGDSYT.js +184 -0
- package/dist/{chunk-LDJQ5QHG.cjs → chunk-L46OUKW5.cjs} +15 -15
- package/dist/{chunk-Z4LIPMPM.js → chunk-L6OH44HL.js} +13 -9
- package/dist/chunk-LANGD5CO.js +280 -0
- package/dist/{chunk-CBFH2J3O.js → chunk-LEZEWKPA.js} +150 -7
- package/dist/{chunk-FQAVGSPW.js → chunk-M5DK524Z.js} +2 -2
- package/dist/{chunk-7LWQCE4Y.cjs → chunk-M7B7RRBK.cjs} +72 -25
- package/dist/{chunk-BWF4VDYE.js → chunk-MANJ67D3.js} +2 -2
- package/dist/{chunk-PHJO5YAL.cjs → chunk-MGNXABSU.cjs} +9 -9
- package/dist/{chunk-62RTC3XX.js → chunk-MMKZSJUN.js} +1 -1
- package/dist/{chunk-3KLSNNRW.cjs → chunk-MQQH4XQH.cjs} +4 -4
- package/dist/{chunk-HS4USDND.cjs → chunk-MZN6JBRZ.cjs} +2 -2
- package/dist/{chunk-AT7OWLY5.js → chunk-NB6M6ESM.js} +1 -1
- package/dist/{chunk-TQ33WBY5.cjs → chunk-NHWHEW7M.cjs} +2 -1
- package/dist/chunk-NQZH5CR2.cjs +468 -0
- package/dist/{chunk-2CGE7ZV3.cjs → chunk-NV6LCD2I.cjs} +119 -28
- package/dist/chunk-NVATU4V6.cjs +44 -0
- package/dist/{chunk-DLP436GI.js → chunk-NZ3ZWLUW.js} +2 -2
- package/dist/{chunk-IEXKKKOF.cjs → chunk-NZ7GCK7Y.cjs} +23 -23
- package/dist/{chunk-MQESBFBZ.cjs → chunk-NZQFKXM3.cjs} +21 -20
- package/dist/{chunk-QQ7PANOP.js → chunk-O5GI6SR3.js} +1 -1
- package/dist/{chunk-J5ADZN6V.cjs → chunk-OCATAKXV.cjs} +20 -20
- package/dist/{chunk-JYKPWK5O.js → chunk-OIGYWOL6.js} +1 -1
- package/dist/{chunk-O6TQP7U7.cjs → chunk-ONVYXTUT.cjs} +3 -3
- package/dist/{chunk-MPULXVC4.cjs → chunk-OV3T5MUH.cjs} +11 -11
- package/dist/{chunk-DMRXF5DU.js → chunk-P4FUTSVK.js} +3 -3
- package/dist/{chunk-MXVIDIC6.cjs → chunk-P6SLT2F4.cjs} +2 -2
- package/dist/{chunk-BL2UC7HC.js → chunk-PGFLPURU.js} +1 -1
- package/dist/{chunk-CWINVFRI.cjs → chunk-PIXQ2AVM.cjs} +17 -17
- package/dist/{chunk-MO4KP6XS.cjs → chunk-PNIAIOMZ.cjs} +5 -5
- package/dist/{chunk-HQWQZML5.cjs → chunk-PQBYFEBL.cjs} +2 -2
- package/dist/{chunk-UGFVM77J.cjs → chunk-PSAH4ZQB.cjs} +2 -2
- package/dist/{chunk-Y3M2DABP.js → chunk-PTTZI4QZ.js} +4 -4
- package/dist/{chunk-Q6AC3PHY.cjs → chunk-PY73W5MQ.cjs} +4 -4
- package/dist/{chunk-B5CGDNMR.js → chunk-PZZMIYII.js} +3 -3
- package/dist/{chunk-VRMZO6TB.js → chunk-Q3BS6FPM.js} +7 -6
- package/dist/chunk-QBYGMMDD.js +517 -0
- package/dist/{chunk-3LJJG5YY.cjs → chunk-QLZOMZO5.cjs} +4 -3
- package/dist/{chunk-3S563FNF.cjs → chunk-QQ64HEHP.cjs} +31 -31
- package/dist/{chunk-TBOLJDUG.js → chunk-QRQF3556.js} +12 -7
- package/dist/{chunk-ZZ63NW7A.cjs → chunk-RBXBH6EB.cjs} +17 -17
- package/dist/{chunk-PUD76XQT.cjs → chunk-RFUKZIJF.cjs} +5 -5
- package/dist/chunk-RS2E32YB.js +71 -0
- package/dist/{chunk-7MU7LWF3.cjs → chunk-S5JNQIGL.cjs} +5 -5
- package/dist/{chunk-BFQDQRDE.js → chunk-S5QKRA2V.js} +2 -2
- package/dist/{chunk-IKUMVBCW.cjs → chunk-SD3NTC7D.cjs} +48 -4
- package/dist/{chunk-PQLKJCIE.js → chunk-SDLY4X3G.js} +2 -2
- package/dist/{chunk-VKBIE6I6.js → chunk-SFFEKZGC.js} +2 -2
- package/dist/{chunk-TWQDAUZU.js → chunk-SHRLFX6F.js} +3 -1
- package/dist/{chunk-UEIXJG45.js → chunk-SNDDZG5H.js} +88 -72
- package/dist/{chunk-AOKCI722.cjs → chunk-SOVR7S3T.cjs} +2 -2
- package/dist/{chunk-M4KNC5BQ.js → chunk-SPQ7QIQ6.js} +1 -1
- package/dist/{chunk-QCHIDZBA.js → chunk-SRMGWMQO.js} +1 -1
- package/dist/{chunk-ZHJ7JGME.cjs → chunk-SVVP4UUZ.cjs} +11 -11
- package/dist/{chunk-CHI52KFR.cjs → chunk-SY2P3Z5W.cjs} +150 -7
- package/dist/chunk-SZD45IDG.js +468 -0
- package/dist/{chunk-VGEV44V2.cjs → chunk-TE4SYTWR.cjs} +189 -28
- package/dist/{chunk-YV63VW4K.js → chunk-TR6NECEZ.js} +1 -1
- package/dist/{chunk-GZ6DV2UG.js → chunk-TYBPTKFT.js} +1 -1
- package/dist/{chunk-5VHP6HDQ.js → chunk-U2QUMKCB.js} +1 -1
- package/dist/{chunk-6HH236FV.cjs → chunk-U6PLSPMD.cjs} +2 -2
- package/dist/{chunk-EZJHLOWP.js → chunk-UWZ4G3SQ.js} +20 -7
- package/dist/{chunk-UXLW45ZE.cjs → chunk-V3SZLWEQ.cjs} +25 -90
- package/dist/chunk-V4HGZSKQ.cjs +183 -0
- package/dist/{chunk-2QL6MNXG.js → chunk-V5ELP2XE.js} +6 -6
- package/dist/{chunk-N6O3XUZ2.cjs → chunk-VKOXFT4L.cjs} +2 -2
- package/dist/{chunk-J2K57QM7.cjs → chunk-VLGGMQUN.cjs} +6 -6
- package/dist/{chunk-HSCUPEA4.cjs → chunk-VQHSYAPZ.cjs} +11 -11
- package/dist/{chunk-DEQVRSV5.cjs → chunk-W5QLA6WP.cjs} +8 -8
- package/dist/chunk-WJYFLQ7G.cjs +27 -0
- package/dist/{chunk-MX75JYIY.js → chunk-WNJXIACY.js} +3 -3
- package/dist/{chunk-OHWMWKJQ.js → chunk-WPE2XHVX.js} +1 -1
- package/dist/{chunk-O64I2GYI.js → chunk-X3TI5TJJ.js} +1 -1
- package/dist/{chunk-46C73ZKK.cjs → chunk-X5P6QQOB.cjs} +66 -10
- package/dist/{chunk-TJNBASFD.cjs → chunk-X7XMITIL.cjs} +8 -8
- package/dist/{chunk-E6GFD7VR.cjs → chunk-XNIMSVS6.cjs} +11 -11
- package/dist/{chunk-WGLBC5AY.cjs → chunk-XW3XCK4E.cjs} +4 -4
- package/dist/{chunk-OM24WXEE.js → chunk-XZVDYC5U.js} +1 -1
- package/dist/{chunk-UWFG2R2I.cjs → chunk-Y5BDE24P.cjs} +33 -9
- package/dist/{chunk-GGLKUENP.js → chunk-YC5OBZQU.js} +161 -7
- package/dist/{chunk-JJ4KA7HK.cjs → chunk-YISPVAXO.cjs} +371 -250
- package/dist/{chunk-SWCQM52V.js → chunk-YQDI753V.js} +4 -4
- package/dist/{chunk-KNTUI4TZ.cjs → chunk-YWH55BWK.cjs} +9 -6
- package/dist/{chunk-ACDQGA4Z.js → chunk-YXM6SA7P.js} +7 -72
- package/dist/{chunk-3GUEUCZK.js → chunk-ZNGRLCFQ.js} +2 -0
- package/dist/{chunk-LQBONA55.cjs → chunk-ZNYZB7XY.cjs} +2 -0
- package/dist/{chunk-XIVFAD2L.js → chunk-ZPLCAXJW.js} +172 -11
- package/dist/chunk-ZUYYHKQA.js +44 -0
- package/dist/clear-QJXU25IF.cjs +12 -0
- package/dist/{clear-OFLFQ3MR.js → clear-Y5TO3RZA.js} +2 -2
- package/dist/communityInstaller-LXMVKVAV.cjs +22 -0
- package/dist/{communityInstaller-COB2KTOW.js → communityInstaller-RVL4STPS.js} +6 -6
- package/dist/completion-JX4T2ONW.cjs +17 -0
- package/dist/{completion-PT4VM2H2.js → completion-SE3XYG74.js} +5 -5
- package/dist/config-3224PRW4.cjs +21 -0
- package/dist/{config-R4O7GBTY.js → config-7KPHKFTP.js} +4 -3
- package/dist/{constants-HVCHVQAF.js → constants-EJFAWJQI.js} +1 -1
- package/dist/constants-MCCGUU5F.cjs +21 -0
- package/dist/{export-3PK3VFCE.js → export-BJVIDZC4.js} +5 -5
- package/dist/export-KU4557HK.cjs +15 -0
- package/dist/feature-K3LG5IJP.cjs +14 -0
- package/dist/feature-V4JF5TNJ.js +14 -0
- package/dist/features-5OJTLKS7.js +23 -0
- package/dist/features-VCBJQXCX.cjs +23 -0
- package/dist/feedback-D4437VE4.js +18 -0
- package/dist/feedback-VZPEHGFY.cjs +18 -0
- package/dist/go-X4E6BCD6.js +12 -0
- package/dist/go-XREVFS5I.cjs +12 -0
- package/dist/goal-4M3J6JS2.cjs +16 -0
- package/dist/goal-EI66BV7W.js +16 -0
- package/dist/help-GGFS7WHY.cjs +12 -0
- package/dist/{help-X3OAZ3CY.js → help-MLIROWKM.js} +2 -2
- package/dist/{history-YKFPHBJN.js → history-GQJ6RZD6.js} +2 -2
- package/dist/history-J4LUIOSI.cjs +14 -0
- package/dist/hooks-FSRIUS6A.cjs +18 -0
- package/dist/{hooks-7TA4PIIB.js → hooks-PPFHCF7T.js} +6 -6
- package/dist/i18n-CI6VFXL5.cjs +33 -0
- package/dist/{i18n-2KBUU7XL.js → i18n-Q7UZJRPL.js} +1 -1
- package/dist/ide-BUSVE54P.js +15 -0
- package/dist/ide-YR27BPGM.cjs +15 -0
- package/dist/{import-4CHYLS4K.js → import-3VBKI6BN.js} +3 -3
- package/dist/{import-I7T4ZHYL.cjs → import-C7S6UJMW.cjs} +3 -3
- package/dist/import-DBK4OCDF.cjs +10 -0
- package/dist/{import-JWPYKXCZ.js → import-U47DXCA7.js} +2 -2
- package/dist/index.cjs +267 -170
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +165 -68
- package/dist/init-OXTYS72D.cjs +10 -0
- package/dist/{init-262MWZV4.js → init-Q2O4R42R.js} +2 -2
- package/dist/{inputPrompt-YGBHDUEP.js → inputPrompt-3CFZDUBH.js} +2 -2
- package/dist/inputPrompt-JMACL4EB.cjs +90 -0
- package/dist/language-EK3M6UBV.cjs +22 -0
- package/dist/language-Q3RUGGOW.js +22 -0
- package/dist/learn-3DSX7DYG.cjs +23 -0
- package/dist/learn-OPOH5L43.js +23 -0
- package/dist/login-GST7MWXJ.cjs +27 -0
- package/dist/login-Q7DZKAX4.js +27 -0
- package/dist/logout-2G7OUK7I.cjs +24 -0
- package/dist/logout-FNBBL2UI.js +24 -0
- package/dist/{mcp-5O6PUL4G.js → mcp-AH3MMUBU.js} +7 -6
- package/dist/mcp-DW7R63IB.cjs +21 -0
- package/dist/{mcp-install-6XWXLFVY.js → mcp-install-222PCKSW.js} +9 -8
- package/dist/{mcp-install-P6DHES7V.cjs → mcp-install-IA4ZS2SV.cjs} +14 -13
- package/dist/memory-6NX3DAIY.cjs +10 -0
- package/dist/{memory-Q54CESNM.js → memory-VB46T5H3.js} +2 -2
- package/dist/model-64NAELFS.cjs +10 -0
- package/dist/{model-6AJ77PJG.js → model-SJJG64AM.js} +2 -2
- package/dist/new-DU5SOOOY.cjs +12 -0
- package/dist/{new-ZXHEWC2S.js → new-ERZ5C6CN.js} +2 -2
- package/dist/onboarding-2U2BV2KE.cjs +36 -0
- package/dist/{onboarding-JYNMK6NI.js → onboarding-ZQXMPSMJ.js} +14 -13
- package/dist/{permissions-YHJMVA6L.js → permissions-7ACNFK7A.js} +2 -2
- package/dist/permissions-GSNNV7RJ.cjs +10 -0
- package/dist/{quit-GWTNHQSP.js → quit-WY6T267G.js} +2 -2
- package/dist/quit-XIRE2KRE.cjs +10 -0
- package/dist/{registry-34GL6BNJ.js → registry-4DXUDKJN.js} +1 -1
- package/dist/{registry-V24W7YK6.cjs → registry-UEO3ETZ7.cjs} +21 -21
- package/dist/resume-RQZ3WXBP.cjs +17 -0
- package/dist/resume-XSXZMDMD.js +17 -0
- package/dist/{rpc-S3DGW6KV.js → rpc-XH7QLN4H.js} +251 -107
- package/dist/{rpc-NPS3PU4O.cjs → rpc-YF54T7JU.cjs} +347 -203
- package/dist/search-VXXFGZWU.cjs +21 -0
- package/dist/search-YAWGX7P7.js +21 -0
- package/dist/{sessions-IYAXMK23.js → sessions-NJYHJOEL.js} +2 -2
- package/dist/sessions-OSG3UJEZ.cjs +10 -0
- package/dist/settings-SO2UIGWV.cjs +42 -0
- package/dist/{settings-55BNW6BF.js → settings-ZXUQH3DO.js} +17 -8
- package/dist/setup-KG7EGKF5.js +30 -0
- package/dist/setup-RSOPCQ57.cjs +30 -0
- package/dist/share-WFAGZ5PY.js +17 -0
- package/dist/share-ZU3SGACF.cjs +17 -0
- package/dist/skills-KBVAQAD2.cjs +29 -0
- package/dist/{skills-VWOMV3CR.js → skills-NBTNDVAY.js} +8 -8
- package/dist/{skills-MVIZNHT4.js → skills-OB6RDW7D.js} +9 -9
- package/dist/{skills-GGMZOVIE.cjs → skills-ZROBG3RZ.cjs} +10 -10
- package/dist/{skills-install-QBA5RCV6.js → skills-install-BHTIEMKH.js} +7 -7
- package/dist/{skills-install-VTAMCNNY.cjs → skills-install-ILX6QVEF.cjs} +15 -15
- package/dist/skills-new-B45VQ2PP.cjs +18 -0
- package/dist/skills-new-YMRP2HNO.js +18 -0
- package/dist/slashCommands-53VYIBJU.js +105 -0
- package/dist/slashCommands-BG2RGGZ6.cjs +105 -0
- package/dist/status-CQ2IUOVK.cjs +24 -0
- package/dist/status-E7IGNVPC.js +24 -0
- package/dist/{sync-7OKF6636.js → sync-7C25MOT2.js} +6 -5
- package/dist/{sync-7BILIQHP.js → sync-OCJN4ZSO.js} +3 -3
- package/dist/sync-XRP46IVG.cjs +40 -0
- package/dist/sync-ZMFVE7T4.cjs +22 -0
- package/dist/{teammate-J6PHGL23.cjs → teammate-D77B6QRT.cjs} +9 -8
- package/dist/{teammate-GZQSCIMS.js → teammate-EZCMHOIL.js} +8 -7
- package/dist/templates-ARG2VRWW.cjs +11 -0
- package/dist/templates-UGVZV3KJ.js +11 -0
- package/dist/theme-KKRDE6P7.cjs +22 -0
- package/dist/theme-XF7XIWBQ.js +22 -0
- package/dist/ui/questionModal.cjs +6 -6
- package/dist/ui/questionModal.js +5 -5
- package/dist/{undo-SZEHLX7X.js → undo-GNUTFXCW.js} +2 -2
- package/dist/undo-U4KN7QQM.cjs +10 -0
- package/dist/usage-QSTNSDAO.js +24 -0
- package/dist/usage-YDEMQBNQ.cjs +24 -0
- package/package.json +7 -2
- package/dist/AgentRegistry-EGBDIUAK.cjs +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/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-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-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/permissions-YBNSANIA.cjs +0 -10
- package/dist/quit-B43SJ6E4.cjs +0 -10
- package/dist/resume-DYVOQN5L.cjs +0 -16
- package/dist/resume-M25UQKOX.js +0 -16
- package/dist/search-CPX4PWHP.js +0 -20
- package/dist/search-VUF3M4N3.cjs +0 -20
- package/dist/sessions-JODKER5D.cjs +0 -10
- 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,11 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkY5BDE24Pcjs = require('./chunk-Y5BDE24P.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
var _chunk3OF56EMAcjs = require('./chunk-3OF56EMA.cjs');
|
|
8
9
|
|
|
10
|
+
|
|
11
|
+
var _chunkHK5A54AVcjs = require('./chunk-HK5A54AV.cjs');
|
|
12
|
+
|
|
9
13
|
// src/providers/OllamaProvider.ts
|
|
10
14
|
var DEFAULT_TIMEOUT = 12e4;
|
|
11
15
|
var DEFAULT_CHUNK_TIMEOUT = 3e4;
|
|
@@ -182,14 +186,10 @@ var OllamaProvider = (_class = class {
|
|
|
182
186
|
};
|
|
183
187
|
});
|
|
184
188
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
completionTokens: _nullishCoalesce(data.eval_count, () => ( 0)),
|
|
190
|
-
totalTokens: (_nullishCoalesce(data.prompt_eval_count, () => ( 0))) + (_nullishCoalesce(data.eval_count, () => ( 0)))
|
|
191
|
-
};
|
|
192
|
-
}
|
|
189
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, {
|
|
190
|
+
prompt_tokens: data.prompt_eval_count,
|
|
191
|
+
completion_tokens: data.eval_count
|
|
192
|
+
});
|
|
193
193
|
return {
|
|
194
194
|
id: `ollama-${Date.now()}`,
|
|
195
195
|
created: Math.floor(new Date(data.created_at).getTime() / 1e3),
|
|
@@ -812,6 +812,8 @@ async function refreshChatGPTAuth(auth) {
|
|
|
812
812
|
|
|
813
813
|
// src/providers/OpenAIProvider.ts
|
|
814
814
|
var OPENAI_MODELS = [
|
|
815
|
+
"gpt-5.5",
|
|
816
|
+
"gpt-5.5-pro",
|
|
815
817
|
"gpt-5.4",
|
|
816
818
|
"gpt-5.4-pro",
|
|
817
819
|
"gpt-5.4-mini",
|
|
@@ -859,6 +861,11 @@ var OpenAIProvider = class {
|
|
|
859
861
|
setModel(model) {
|
|
860
862
|
this.model = model;
|
|
861
863
|
}
|
|
864
|
+
getCapabilities() {
|
|
865
|
+
return {
|
|
866
|
+
nativeToolCalling: true
|
|
867
|
+
};
|
|
868
|
+
}
|
|
862
869
|
async listModels() {
|
|
863
870
|
return [...OPENAI_MODELS];
|
|
864
871
|
}
|
|
@@ -885,7 +892,7 @@ var OpenAIProvider = class {
|
|
|
885
892
|
messages: request.messages.map((msg) => {
|
|
886
893
|
const mapped = {
|
|
887
894
|
role: msg.role === "system" ? "system" : msg.role === "user" ? "user" : msg.role === "tool" ? "tool" : "assistant",
|
|
888
|
-
content: msg.content
|
|
895
|
+
content: this.toChatCompletionContent(msg.content)
|
|
889
896
|
};
|
|
890
897
|
if (msg.role === "assistant" && _optionalChain([msg, 'access', _29 => _29.tool_calls, 'optionalAccess', _30 => _30.length])) {
|
|
891
898
|
mapped.tool_calls = msg.tool_calls;
|
|
@@ -968,14 +975,7 @@ var OpenAIProvider = class {
|
|
|
968
975
|
}
|
|
969
976
|
}));
|
|
970
977
|
}
|
|
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
|
-
}
|
|
978
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, data.usage);
|
|
979
979
|
return {
|
|
980
980
|
id: data.id,
|
|
981
981
|
created: data.created,
|
|
@@ -995,7 +995,7 @@ var OpenAIProvider = class {
|
|
|
995
995
|
stream: true,
|
|
996
996
|
tool_choice: "auto",
|
|
997
997
|
parallel_tool_calls: true,
|
|
998
|
-
input:
|
|
998
|
+
input: this.toResponsesInputItems(request.messages)
|
|
999
999
|
};
|
|
1000
1000
|
if (this.reasoningEffort && VALID_REASONING_EFFORTS.has(this.reasoningEffort)) {
|
|
1001
1001
|
body.reasoning = {
|
|
@@ -1059,11 +1059,7 @@ var OpenAIProvider = class {
|
|
|
1059
1059
|
const data = await this.parseCodexStream(response);
|
|
1060
1060
|
const toolCalls = this.extractResponsesToolCalls(data.output);
|
|
1061
1061
|
const content = this.extractResponsesContent(data);
|
|
1062
|
-
const usage = data.usage
|
|
1063
|
-
promptTokens: _nullishCoalesce(data.usage.input_tokens, () => ( 0)),
|
|
1064
|
-
completionTokens: _nullishCoalesce(data.usage.output_tokens, () => ( 0)),
|
|
1065
|
-
totalTokens: _nullishCoalesce(data.usage.total_tokens, () => ( (_nullishCoalesce(data.usage.input_tokens, () => ( 0))) + (_nullishCoalesce(data.usage.output_tokens, () => ( 0)))))
|
|
1066
|
-
} : void 0;
|
|
1062
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, data.usage);
|
|
1067
1063
|
return {
|
|
1068
1064
|
id: data.id,
|
|
1069
1065
|
created: _nullishCoalesce(data.created_at, () => ( Math.floor(Date.now() / 1e3))),
|
|
@@ -1115,13 +1111,42 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1115
1111
|
const text = await response.text();
|
|
1116
1112
|
let currentEvent = "";
|
|
1117
1113
|
let completedData = null;
|
|
1114
|
+
let streamedOutputText = "";
|
|
1115
|
+
const streamedOutputItems = /* @__PURE__ */ new Map();
|
|
1118
1116
|
for (const line of text.split("\n")) {
|
|
1119
1117
|
if (line.startsWith("event: ")) {
|
|
1120
1118
|
currentEvent = line.slice(7).trim();
|
|
1121
1119
|
continue;
|
|
1122
1120
|
}
|
|
1123
|
-
if (line.startsWith("data: ")
|
|
1124
|
-
|
|
1121
|
+
if (!line.startsWith("data: ")) {
|
|
1122
|
+
continue;
|
|
1123
|
+
}
|
|
1124
|
+
const dataLine = line.slice(6);
|
|
1125
|
+
const eventData = JSON.parse(dataLine);
|
|
1126
|
+
const eventType = this.getCodexStreamEventType(currentEvent, eventData);
|
|
1127
|
+
const eventRecord = eventData && typeof eventData === "object" ? eventData : {};
|
|
1128
|
+
if (eventType === "response.output_text.delta") {
|
|
1129
|
+
if (typeof eventRecord.delta === "string") {
|
|
1130
|
+
streamedOutputText += eventRecord.delta;
|
|
1131
|
+
}
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
if (eventType === "response.output_text.done") {
|
|
1135
|
+
if (typeof eventRecord.text === "string" && eventRecord.text.trim()) {
|
|
1136
|
+
streamedOutputText = eventRecord.text;
|
|
1137
|
+
}
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
if (eventType === "response.output_item.added" || eventType === "response.output_item.done") {
|
|
1141
|
+
this.captureStreamedOutputItem(eventData, streamedOutputItems);
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
if (eventType === "response.function_call_arguments.done") {
|
|
1145
|
+
this.captureStreamedFunctionCallArguments(eventData, streamedOutputItems);
|
|
1146
|
+
continue;
|
|
1147
|
+
}
|
|
1148
|
+
if (eventType === "response.completed") {
|
|
1149
|
+
completedData = this.extractCompletedResponse(eventData);
|
|
1125
1150
|
break;
|
|
1126
1151
|
}
|
|
1127
1152
|
}
|
|
@@ -1133,11 +1158,77 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1133
1158
|
false
|
|
1134
1159
|
);
|
|
1135
1160
|
}
|
|
1161
|
+
if ((!Array.isArray(completedData.output) || completedData.output.length === 0) && streamedOutputItems.size > 0) {
|
|
1162
|
+
completedData.output = [...streamedOutputItems.entries()].sort(([a], [b]) => a - b).map(([, item]) => item);
|
|
1163
|
+
}
|
|
1164
|
+
if (!this.extractResponsesContent(completedData) && streamedOutputText.trim()) {
|
|
1165
|
+
completedData.output_text = streamedOutputText;
|
|
1166
|
+
}
|
|
1136
1167
|
return completedData;
|
|
1137
1168
|
}
|
|
1169
|
+
getCodexStreamEventType(currentEvent, eventData) {
|
|
1170
|
+
if (currentEvent) {
|
|
1171
|
+
return currentEvent;
|
|
1172
|
+
}
|
|
1173
|
+
if (eventData && typeof eventData === "object" && "type" in eventData) {
|
|
1174
|
+
const type = eventData.type;
|
|
1175
|
+
return typeof type === "string" ? type : "";
|
|
1176
|
+
}
|
|
1177
|
+
return "";
|
|
1178
|
+
}
|
|
1179
|
+
captureStreamedOutputItem(eventData, outputItems) {
|
|
1180
|
+
if (!eventData || typeof eventData !== "object") {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
const event = eventData;
|
|
1184
|
+
if (!event.item || typeof event.output_index !== "number") {
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
const existing = outputItems.get(event.output_index);
|
|
1188
|
+
if (_optionalChain([existing, 'optionalAccess', _41 => _41.type]) === "function_call" && event.item.type === "function_call") {
|
|
1189
|
+
outputItems.set(event.output_index, {
|
|
1190
|
+
...existing,
|
|
1191
|
+
...event.item,
|
|
1192
|
+
arguments: event.item.arguments || existing.arguments
|
|
1193
|
+
});
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
outputItems.set(event.output_index, event.item);
|
|
1197
|
+
}
|
|
1198
|
+
captureStreamedFunctionCallArguments(eventData, outputItems) {
|
|
1199
|
+
if (!eventData || typeof eventData !== "object") {
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const event = eventData;
|
|
1203
|
+
if (typeof event.output_index !== "number" || typeof event.name !== "string" || typeof event.arguments !== "string") {
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
const existing = outputItems.get(event.output_index);
|
|
1207
|
+
if (_optionalChain([existing, 'optionalAccess', _42 => _42.type]) === "function_call") {
|
|
1208
|
+
outputItems.set(event.output_index, {
|
|
1209
|
+
...existing,
|
|
1210
|
+
name: event.name,
|
|
1211
|
+
arguments: event.arguments
|
|
1212
|
+
});
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
outputItems.set(event.output_index, {
|
|
1216
|
+
type: "function_call",
|
|
1217
|
+
id: event.item_id,
|
|
1218
|
+
call_id: event.item_id,
|
|
1219
|
+
name: event.name,
|
|
1220
|
+
arguments: event.arguments
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
extractCompletedResponse(eventData) {
|
|
1224
|
+
if (eventData && typeof eventData === "object" && "response" in eventData && eventData.response) {
|
|
1225
|
+
return eventData.response;
|
|
1226
|
+
}
|
|
1227
|
+
return eventData;
|
|
1228
|
+
}
|
|
1138
1229
|
async buildAuthHeaders() {
|
|
1139
1230
|
if (this.authMode === "chatgpt") {
|
|
1140
|
-
if (!_optionalChain([this, 'access',
|
|
1231
|
+
if (!_optionalChain([this, 'access', _43 => _43.chatgptAuth, 'optionalAccess', _44 => _44.accessToken]) || !this.chatgptAuth.accountId) {
|
|
1141
1232
|
throw new (0, _chunk3OF56EMAcjs.ApiError)("ChatGPT authentication is missing. Please sign in again.", "auth_failed", 401, false);
|
|
1142
1233
|
}
|
|
1143
1234
|
if (isChatGPTAuthExpired(this.chatgptAuth)) {
|
|
@@ -1161,12 +1252,73 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1161
1252
|
}
|
|
1162
1253
|
return (configBaseUrl || OPENAI_API_BASE_URL).replace(/\/$/, "");
|
|
1163
1254
|
}
|
|
1164
|
-
|
|
1255
|
+
isContentPartsArray(content) {
|
|
1256
|
+
return Array.isArray(content);
|
|
1257
|
+
}
|
|
1258
|
+
toChatCompletionContent(content) {
|
|
1259
|
+
if (!this.isContentPartsArray(content)) {
|
|
1260
|
+
return content;
|
|
1261
|
+
}
|
|
1262
|
+
return content.map((part) => {
|
|
1263
|
+
if (part.type === "text") {
|
|
1264
|
+
return { type: "text", text: part.text };
|
|
1265
|
+
}
|
|
1266
|
+
if (part.type === "image_url") {
|
|
1267
|
+
return {
|
|
1268
|
+
type: "image_url",
|
|
1269
|
+
image_url: part.image_url
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
return null;
|
|
1273
|
+
}).filter((part) => part !== null);
|
|
1274
|
+
}
|
|
1275
|
+
toResponsesMessageContent(role, content) {
|
|
1276
|
+
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
1277
|
+
if (!this.isContentPartsArray(content)) {
|
|
1278
|
+
return [{ type: textType, text: content }];
|
|
1279
|
+
}
|
|
1280
|
+
const parts = [];
|
|
1281
|
+
for (const part of content) {
|
|
1282
|
+
if (part.type === "text") {
|
|
1283
|
+
parts.push({ type: textType, text: part.text });
|
|
1284
|
+
continue;
|
|
1285
|
+
}
|
|
1286
|
+
if (part.type === "image_url" && role !== "assistant") {
|
|
1287
|
+
parts.push({
|
|
1288
|
+
type: "input_image",
|
|
1289
|
+
image_url: part.image_url.url
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
return parts;
|
|
1294
|
+
}
|
|
1295
|
+
toResponsesInputItems(messages) {
|
|
1296
|
+
const assistantToolCallIds = /* @__PURE__ */ new Set();
|
|
1297
|
+
const toolOutputIds = /* @__PURE__ */ new Set();
|
|
1298
|
+
for (const msg of messages) {
|
|
1299
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _45 => _45.tool_calls, 'optionalAccess', _46 => _46.length])) {
|
|
1300
|
+
for (const toolCall of msg.tool_calls) {
|
|
1301
|
+
assistantToolCallIds.add(toolCall.id);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
if (msg.role === "tool" && msg.tool_call_id) {
|
|
1305
|
+
toolOutputIds.add(msg.tool_call_id);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
const matchedToolCallIds = new Set(
|
|
1309
|
+
[...assistantToolCallIds].filter((id) => toolOutputIds.has(id))
|
|
1310
|
+
);
|
|
1311
|
+
return messages.flatMap((msg) => this.toResponsesInputItemsForMessage(msg, matchedToolCallIds));
|
|
1312
|
+
}
|
|
1313
|
+
toResponsesInputItemsForMessage(msg, matchedToolCallIds) {
|
|
1165
1314
|
const items = [];
|
|
1166
1315
|
if (msg.role === "system") {
|
|
1167
1316
|
return items;
|
|
1168
1317
|
}
|
|
1169
1318
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
1319
|
+
if (!matchedToolCallIds.has(msg.tool_call_id)) {
|
|
1320
|
+
return items;
|
|
1321
|
+
}
|
|
1170
1322
|
items.push({
|
|
1171
1323
|
type: "function_call_output",
|
|
1172
1324
|
call_id: msg.tool_call_id,
|
|
@@ -1175,14 +1327,18 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1175
1327
|
return items;
|
|
1176
1328
|
}
|
|
1177
1329
|
if (msg.content) {
|
|
1330
|
+
const content = this.toResponsesMessageContent(msg.role, msg.content);
|
|
1178
1331
|
items.push({
|
|
1179
1332
|
type: "message",
|
|
1180
1333
|
role: msg.role === "tool" ? "user" : msg.role,
|
|
1181
|
-
content
|
|
1334
|
+
content
|
|
1182
1335
|
});
|
|
1183
1336
|
}
|
|
1184
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
1337
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _47 => _47.tool_calls, 'optionalAccess', _48 => _48.length])) {
|
|
1185
1338
|
for (const toolCall of msg.tool_calls) {
|
|
1339
|
+
if (!matchedToolCallIds.has(toolCall.id)) {
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1186
1342
|
items.push({
|
|
1187
1343
|
type: "function_call",
|
|
1188
1344
|
call_id: toolCall.id,
|
|
@@ -1204,7 +1360,7 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1204
1360
|
if (!Array.isArray(output)) {
|
|
1205
1361
|
return [];
|
|
1206
1362
|
}
|
|
1207
|
-
return output.filter((entry) => _optionalChain([entry, 'optionalAccess',
|
|
1363
|
+
return output.filter((entry) => _optionalChain([entry, 'optionalAccess', _49 => _49.type]) === "function_call").map((toolCall, index) => ({
|
|
1208
1364
|
id: _nullishCoalesce(toolCall.call_id, () => ( `call_${index + 1}`)),
|
|
1209
1365
|
type: "function",
|
|
1210
1366
|
function: {
|
|
@@ -1230,11 +1386,11 @@ ${error.rawDetail}` : friendlyMessage,
|
|
|
1230
1386
|
}
|
|
1231
1387
|
const parts = [];
|
|
1232
1388
|
for (const item of data.output) {
|
|
1233
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
1389
|
+
if (_optionalChain([item, 'optionalAccess', _50 => _50.type]) !== "message" || !Array.isArray(item.content)) {
|
|
1234
1390
|
continue;
|
|
1235
1391
|
}
|
|
1236
1392
|
for (const contentItem of item.content) {
|
|
1237
|
-
if (_optionalChain([contentItem, 'optionalAccess',
|
|
1393
|
+
if (_optionalChain([contentItem, 'optionalAccess', _51 => _51.type]) === "output_text" && typeof contentItem.text === "string") {
|
|
1238
1394
|
parts.push(contentItem.text);
|
|
1239
1395
|
}
|
|
1240
1396
|
}
|
|
@@ -1266,7 +1422,7 @@ var LlamaCppProvider = (_class2 = class _LlamaCppProvider {
|
|
|
1266
1422
|
return this.model ? [this.model] : [];
|
|
1267
1423
|
}
|
|
1268
1424
|
const data = await response.json();
|
|
1269
|
-
return _nullishCoalesce(_optionalChain([data, 'access',
|
|
1425
|
+
return _nullishCoalesce(_optionalChain([data, 'access', _52 => _52.data, 'optionalAccess', _53 => _53.map, 'call', _54 => _54((m) => m.id)]), () => ( [this.model]));
|
|
1270
1426
|
} catch (e13) {
|
|
1271
1427
|
return this.model ? [this.model] : [];
|
|
1272
1428
|
}
|
|
@@ -1320,7 +1476,7 @@ var LlamaCppProvider = (_class2 = class _LlamaCppProvider {
|
|
|
1320
1476
|
const data = await response.json();
|
|
1321
1477
|
const choice = data.choices[0];
|
|
1322
1478
|
let toolCalls;
|
|
1323
|
-
if (_optionalChain([choice, 'optionalAccess',
|
|
1479
|
+
if (_optionalChain([choice, 'optionalAccess', _55 => _55.message, 'access', _56 => _56.tool_calls, 'optionalAccess', _57 => _57.length])) {
|
|
1324
1480
|
toolCalls = choice.message.tool_calls.map((tc) => ({
|
|
1325
1481
|
id: tc.id,
|
|
1326
1482
|
type: "function",
|
|
@@ -1338,11 +1494,11 @@ var LlamaCppProvider = (_class2 = class _LlamaCppProvider {
|
|
|
1338
1494
|
totalTokens: data.usage.total_tokens
|
|
1339
1495
|
};
|
|
1340
1496
|
}
|
|
1341
|
-
const finishReason = _optionalChain([toolCalls, 'optionalAccess',
|
|
1497
|
+
const finishReason = _optionalChain([toolCalls, 'optionalAccess', _58 => _58.length]) ? "tool_calls" : _optionalChain([choice, 'optionalAccess', _59 => _59.finish_reason]) === "stop" || _optionalChain([choice, 'optionalAccess', _60 => _60.finish_reason]) === "length" || _optionalChain([choice, 'optionalAccess', _61 => _61.finish_reason]) === "content_filter" ? choice.finish_reason : "stop";
|
|
1342
1498
|
return {
|
|
1343
1499
|
id: data.id || `llamacpp-${Date.now()}`,
|
|
1344
1500
|
created: data.created || Math.floor(Date.now() / 1e3),
|
|
1345
|
-
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess',
|
|
1501
|
+
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess', _62 => _62.message, 'access', _63 => _63.content]), () => ( "")),
|
|
1346
1502
|
toolCalls,
|
|
1347
1503
|
finishReason,
|
|
1348
1504
|
usage,
|
|
@@ -1427,13 +1583,13 @@ function getInputModalities(capability) {
|
|
|
1427
1583
|
if (Array.isArray(capability.input_modalities)) {
|
|
1428
1584
|
return capability.input_modalities;
|
|
1429
1585
|
}
|
|
1430
|
-
if (Array.isArray(_optionalChain([capability, 'access',
|
|
1586
|
+
if (Array.isArray(_optionalChain([capability, 'access', _64 => _64.architecture, 'optionalAccess', _65 => _65.input_modalities]))) {
|
|
1431
1587
|
return capability.architecture.input_modalities;
|
|
1432
1588
|
}
|
|
1433
1589
|
return [];
|
|
1434
1590
|
}
|
|
1435
1591
|
function getOpenRouterCapabilityContextWindow(capability) {
|
|
1436
|
-
const contextWindow = _nullishCoalesce(_optionalChain([capability, 'optionalAccess',
|
|
1592
|
+
const contextWindow = _nullishCoalesce(_optionalChain([capability, 'optionalAccess', _66 => _66.top_provider, 'optionalAccess', _67 => _67.context_length]), () => ( _optionalChain([capability, 'optionalAccess', _68 => _68.context_length])));
|
|
1437
1593
|
return typeof contextWindow === "number" && Number.isFinite(contextWindow) && contextWindow > 0 ? Math.floor(contextWindow) : void 0;
|
|
1438
1594
|
}
|
|
1439
1595
|
async function getOpenRouterModelContextWindow(model) {
|
|
@@ -1469,7 +1625,7 @@ async function fetchOpenRouterModelCapabilities(forceRefresh = false) {
|
|
|
1469
1625
|
throw new Error(`Failed to fetch model capabilities: ${response.status} ${response.statusText}`);
|
|
1470
1626
|
}
|
|
1471
1627
|
const data = await response.json();
|
|
1472
|
-
const models = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1628
|
+
const models = Array.isArray(_optionalChain([data, 'optionalAccess', _69 => _69.data])) ? data.data : [];
|
|
1473
1629
|
cache = {
|
|
1474
1630
|
models,
|
|
1475
1631
|
fetchedAt: Date.now()
|
|
@@ -1565,7 +1721,7 @@ function sanitizeMessages(messages, allowImageInputs) {
|
|
|
1565
1721
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
1566
1722
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
1567
1723
|
}
|
|
1568
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
1724
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _70 => _70.tool_calls, 'optionalAccess', _71 => _71.length])) {
|
|
1569
1725
|
sanitized.tool_calls = msg.tool_calls;
|
|
1570
1726
|
}
|
|
1571
1727
|
if (msg.name) {
|
|
@@ -1613,13 +1769,13 @@ var OpenRouterClient = class {
|
|
|
1613
1769
|
this.apiKey = _nullishCoalesce(settings.apiKey, () => ( ""));
|
|
1614
1770
|
this.baseUrl = _nullishCoalesce(settings.baseUrl, () => ( DEFAULT_BASE_URL));
|
|
1615
1771
|
this.defaultModel = settings.model;
|
|
1616
|
-
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
1772
|
+
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _72 => _72.maxRetries]), () => ( DEFAULT_MAX_RETRIES2));
|
|
1617
1773
|
this.maxRetries = Math.min(
|
|
1618
1774
|
Math.max(0, configuredRetries),
|
|
1619
1775
|
MAX_ALLOWED_RETRIES2
|
|
1620
1776
|
);
|
|
1621
|
-
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
1622
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
1777
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _73 => _73.retryDelay]), () => ( DEFAULT_RETRY_DELAY2));
|
|
1778
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _74 => _74.timeout]), () => ( DEFAULT_TIMEOUT2));
|
|
1623
1779
|
}
|
|
1624
1780
|
setDefaultModel(model) {
|
|
1625
1781
|
this.defaultModel = model;
|
|
@@ -1737,7 +1893,7 @@ var OpenRouterClient = class {
|
|
|
1737
1893
|
}
|
|
1738
1894
|
} catch (error) {
|
|
1739
1895
|
const err = error;
|
|
1740
|
-
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess',
|
|
1896
|
+
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess', _75 => _75.aborted])) {
|
|
1741
1897
|
throw new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
1742
1898
|
}
|
|
1743
1899
|
if (err.name === "AbortError") {
|
|
@@ -1759,31 +1915,24 @@ var OpenRouterClient = class {
|
|
|
1759
1915
|
throw await this.buildApiError(response);
|
|
1760
1916
|
}
|
|
1761
1917
|
const json = await response.json();
|
|
1762
|
-
const message = _optionalChain([json, 'optionalAccess',
|
|
1763
|
-
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess',
|
|
1764
|
-
const finishReason = _optionalChain([json, 'optionalAccess',
|
|
1918
|
+
const message = _optionalChain([json, 'optionalAccess', _76 => _76.choices, 'optionalAccess', _77 => _77[0], 'optionalAccess', _78 => _78.message]);
|
|
1919
|
+
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess', _79 => _79.content]), () => ( ""));
|
|
1920
|
+
const finishReason = _optionalChain([json, 'optionalAccess', _80 => _80.choices, 'optionalAccess', _81 => _81[0], 'optionalAccess', _82 => _82.finish_reason]);
|
|
1765
1921
|
let toolCalls;
|
|
1766
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
1922
|
+
if (_optionalChain([message, 'optionalAccess', _83 => _83.tool_calls]) && Array.isArray(message.tool_calls)) {
|
|
1767
1923
|
toolCalls = message.tool_calls.map((tc) => {
|
|
1768
|
-
const rawArgs = _optionalChain([tc, 'access',
|
|
1924
|
+
const rawArgs = _optionalChain([tc, 'access', _84 => _84.function, 'optionalAccess', _85 => _85.arguments]);
|
|
1769
1925
|
return {
|
|
1770
1926
|
id: tc.id,
|
|
1771
1927
|
type: "function",
|
|
1772
1928
|
function: {
|
|
1773
|
-
name: _nullishCoalesce(_optionalChain([tc, 'access',
|
|
1929
|
+
name: _nullishCoalesce(_optionalChain([tc, 'access', _86 => _86.function, 'optionalAccess', _87 => _87.name]), () => ( "")),
|
|
1774
1930
|
arguments: _nullishCoalesce(rawArgs, () => ( "{}"))
|
|
1775
1931
|
}
|
|
1776
1932
|
};
|
|
1777
1933
|
});
|
|
1778
1934
|
}
|
|
1779
|
-
|
|
1780
|
-
if (_optionalChain([json, 'optionalAccess', _84 => _84.usage])) {
|
|
1781
|
-
usage = {
|
|
1782
|
-
promptTokens: _nullishCoalesce(json.usage.prompt_tokens, () => ( 0)),
|
|
1783
|
-
completionTokens: _nullishCoalesce(json.usage.completion_tokens, () => ( 0)),
|
|
1784
|
-
totalTokens: _nullishCoalesce(json.usage.total_tokens, () => ( 0))
|
|
1785
|
-
};
|
|
1786
|
-
}
|
|
1935
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, _optionalChain([json, 'optionalAccess', _88 => _88.usage]));
|
|
1787
1936
|
return {
|
|
1788
1937
|
id: _nullishCoalesce(json.id, () => ( "autohand-local")),
|
|
1789
1938
|
created: _nullishCoalesce(json.created, () => ( Date.now())),
|
|
@@ -1799,7 +1948,7 @@ var OpenRouterClient = class {
|
|
|
1799
1948
|
let errorDetail = "";
|
|
1800
1949
|
try {
|
|
1801
1950
|
const body = await response.json();
|
|
1802
|
-
errorDetail = _optionalChain([body, 'optionalAccess',
|
|
1951
|
+
errorDetail = _optionalChain([body, 'optionalAccess', _89 => _89.error, 'optionalAccess', _90 => _90.message]) || _optionalChain([body, 'optionalAccess', _91 => _91.error]) || _optionalChain([body, 'optionalAccess', _92 => _92.message]) || "";
|
|
1803
1952
|
if (typeof errorDetail === "object") {
|
|
1804
1953
|
errorDetail = JSON.stringify(errorDetail);
|
|
1805
1954
|
}
|
|
@@ -1898,10 +2047,10 @@ var MLXProvider = class {
|
|
|
1898
2047
|
const port = config.port || 8080;
|
|
1899
2048
|
this.baseUrl = config.baseUrl || `http://localhost:${port}`;
|
|
1900
2049
|
this.model = config.model || "mlx-model";
|
|
1901
|
-
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2050
|
+
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _93 => _93.maxRetries]), () => ( DEFAULT_MAX_RETRIES3));
|
|
1902
2051
|
this.maxRetries = Math.min(Math.max(0, configuredRetries), MAX_ALLOWED_RETRIES3);
|
|
1903
|
-
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
1904
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2052
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _94 => _94.retryDelay]), () => ( DEFAULT_RETRY_DELAY3));
|
|
2053
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _95 => _95.timeout]), () => ( DEFAULT_TIMEOUT3));
|
|
1905
2054
|
}
|
|
1906
2055
|
getName() {
|
|
1907
2056
|
return "mlx";
|
|
@@ -1924,7 +2073,7 @@ var MLXProvider = class {
|
|
|
1924
2073
|
return this.model ? [this.model] : [];
|
|
1925
2074
|
}
|
|
1926
2075
|
const data = await response.json();
|
|
1927
|
-
return _nullishCoalesce(_optionalChain([data, 'access',
|
|
2076
|
+
return _nullishCoalesce(_optionalChain([data, 'access', _96 => _96.data, 'optionalAccess', _97 => _97.map, 'call', _98 => _98((m) => m.id)]), () => ( (this.model ? [this.model] : [])));
|
|
1928
2077
|
} finally {
|
|
1929
2078
|
clearTimeout(timerId);
|
|
1930
2079
|
}
|
|
@@ -2023,7 +2172,7 @@ var MLXProvider = class {
|
|
|
2023
2172
|
}
|
|
2024
2173
|
} catch (error) {
|
|
2025
2174
|
const err = error;
|
|
2026
|
-
if (err.name === "AbortError" && _optionalChain([userSignal, 'optionalAccess',
|
|
2175
|
+
if (err.name === "AbortError" && _optionalChain([userSignal, 'optionalAccess', _99 => _99.aborted])) {
|
|
2027
2176
|
throw new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
2028
2177
|
}
|
|
2029
2178
|
if (err.name === "AbortError") {
|
|
@@ -2062,7 +2211,7 @@ var MLXProvider = class {
|
|
|
2062
2211
|
}
|
|
2063
2212
|
const choice = data.choices[0];
|
|
2064
2213
|
let toolCalls;
|
|
2065
|
-
if (_optionalChain([choice, 'optionalAccess',
|
|
2214
|
+
if (_optionalChain([choice, 'optionalAccess', _100 => _100.message, 'access', _101 => _101.tool_calls, 'optionalAccess', _102 => _102.length])) {
|
|
2066
2215
|
toolCalls = choice.message.tool_calls.map((tc) => ({
|
|
2067
2216
|
id: tc.id,
|
|
2068
2217
|
type: "function",
|
|
@@ -2080,11 +2229,11 @@ var MLXProvider = class {
|
|
|
2080
2229
|
totalTokens: data.usage.total_tokens
|
|
2081
2230
|
};
|
|
2082
2231
|
}
|
|
2083
|
-
const finishReason = _optionalChain([toolCalls, 'optionalAccess',
|
|
2232
|
+
const finishReason = _optionalChain([toolCalls, 'optionalAccess', _103 => _103.length]) ? "tool_calls" : _optionalChain([choice, 'optionalAccess', _104 => _104.finish_reason]) === "stop" || _optionalChain([choice, 'optionalAccess', _105 => _105.finish_reason]) === "length" || _optionalChain([choice, 'optionalAccess', _106 => _106.finish_reason]) === "content_filter" ? choice.finish_reason : "stop";
|
|
2084
2233
|
return {
|
|
2085
2234
|
id: data.id || `mlx-${Date.now()}`,
|
|
2086
2235
|
created: data.created || Math.floor(Date.now() / 1e3),
|
|
2087
|
-
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess',
|
|
2236
|
+
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess', _107 => _107.message, 'access', _108 => _108.content]), () => ( "")),
|
|
2088
2237
|
toolCalls,
|
|
2089
2238
|
finishReason,
|
|
2090
2239
|
usage,
|
|
@@ -2095,12 +2244,12 @@ var MLXProvider = class {
|
|
|
2095
2244
|
let errorDetail = "";
|
|
2096
2245
|
try {
|
|
2097
2246
|
const body = await response.json();
|
|
2098
|
-
const maybeError = _optionalChain([body, 'optionalAccess',
|
|
2247
|
+
const maybeError = _optionalChain([body, 'optionalAccess', _109 => _109.error]);
|
|
2099
2248
|
if (maybeError && typeof maybeError === "object") {
|
|
2100
|
-
errorDetail = _nullishCoalesce(_optionalChain([maybeError, 'optionalAccess',
|
|
2249
|
+
errorDetail = _nullishCoalesce(_optionalChain([maybeError, 'optionalAccess', _110 => _110.message]), () => ( ""));
|
|
2101
2250
|
} else if (typeof maybeError === "string") {
|
|
2102
2251
|
errorDetail = maybeError;
|
|
2103
|
-
} else if (typeof _optionalChain([body, 'optionalAccess',
|
|
2252
|
+
} else if (typeof _optionalChain([body, 'optionalAccess', _111 => _111.message]) === "string") {
|
|
2104
2253
|
errorDetail = body.message;
|
|
2105
2254
|
}
|
|
2106
2255
|
if (typeof errorDetail === "object") {
|
|
@@ -2146,7 +2295,7 @@ function sanitizeMessages2(messages) {
|
|
|
2146
2295
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
2147
2296
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
2148
2297
|
}
|
|
2149
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
2298
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _112 => _112.tool_calls, 'optionalAccess', _113 => _113.length])) {
|
|
2150
2299
|
sanitized.tool_calls = msg.tool_calls;
|
|
2151
2300
|
}
|
|
2152
2301
|
if (msg.name) {
|
|
@@ -2192,13 +2341,13 @@ var LLMGatewayClient = class {
|
|
|
2192
2341
|
this.baseUrl = _nullishCoalesce(settings.baseUrl, () => ( DEFAULT_BASE_URL2));
|
|
2193
2342
|
this.defaultModel = settings.model;
|
|
2194
2343
|
this.errorLabels = errorLabels;
|
|
2195
|
-
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2344
|
+
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _114 => _114.maxRetries]), () => ( DEFAULT_MAX_RETRIES4));
|
|
2196
2345
|
this.maxRetries = Math.min(
|
|
2197
2346
|
Math.max(0, configuredRetries),
|
|
2198
2347
|
MAX_ALLOWED_RETRIES4
|
|
2199
2348
|
);
|
|
2200
|
-
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2201
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2349
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _115 => _115.retryDelay]), () => ( DEFAULT_RETRY_DELAY4));
|
|
2350
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _116 => _116.timeout]), () => ( DEFAULT_TIMEOUT4));
|
|
2202
2351
|
}
|
|
2203
2352
|
setDefaultModel(model) {
|
|
2204
2353
|
this.defaultModel = model;
|
|
@@ -2302,7 +2451,7 @@ var LLMGatewayClient = class {
|
|
|
2302
2451
|
}
|
|
2303
2452
|
} catch (error) {
|
|
2304
2453
|
const err = error;
|
|
2305
|
-
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess',
|
|
2454
|
+
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess', _117 => _117.aborted])) {
|
|
2306
2455
|
throw new Error("Request cancelled.");
|
|
2307
2456
|
}
|
|
2308
2457
|
if (err.name === "AbortError") {
|
|
@@ -2321,31 +2470,24 @@ var LLMGatewayClient = class {
|
|
|
2321
2470
|
return this.handleStreamingResponse(response);
|
|
2322
2471
|
}
|
|
2323
2472
|
const json = await response.json();
|
|
2324
|
-
const message = _optionalChain([json, 'optionalAccess',
|
|
2325
|
-
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess',
|
|
2326
|
-
const finishReason = _optionalChain([json, 'optionalAccess',
|
|
2473
|
+
const message = _optionalChain([json, 'optionalAccess', _118 => _118.choices, 'optionalAccess', _119 => _119[0], 'optionalAccess', _120 => _120.message]);
|
|
2474
|
+
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess', _121 => _121.content]), () => ( ""));
|
|
2475
|
+
const finishReason = _optionalChain([json, 'optionalAccess', _122 => _122.choices, 'optionalAccess', _123 => _123[0], 'optionalAccess', _124 => _124.finish_reason]);
|
|
2327
2476
|
let toolCalls;
|
|
2328
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
2477
|
+
if (_optionalChain([message, 'optionalAccess', _125 => _125.tool_calls]) && Array.isArray(message.tool_calls)) {
|
|
2329
2478
|
toolCalls = message.tool_calls.map((tc) => {
|
|
2330
|
-
const rawArgs = _optionalChain([tc, 'access',
|
|
2479
|
+
const rawArgs = _optionalChain([tc, 'access', _126 => _126.function, 'optionalAccess', _127 => _127.arguments]);
|
|
2331
2480
|
return {
|
|
2332
2481
|
id: tc.id,
|
|
2333
2482
|
type: "function",
|
|
2334
2483
|
function: {
|
|
2335
|
-
name: _nullishCoalesce(_optionalChain([tc, 'access',
|
|
2484
|
+
name: _nullishCoalesce(_optionalChain([tc, 'access', _128 => _128.function, 'optionalAccess', _129 => _129.name]), () => ( "")),
|
|
2336
2485
|
arguments: _nullishCoalesce(rawArgs, () => ( "{}"))
|
|
2337
2486
|
}
|
|
2338
2487
|
};
|
|
2339
2488
|
});
|
|
2340
2489
|
}
|
|
2341
|
-
|
|
2342
|
-
if (_optionalChain([json, 'optionalAccess', _126 => _126.usage])) {
|
|
2343
|
-
usage = {
|
|
2344
|
-
promptTokens: _nullishCoalesce(json.usage.prompt_tokens, () => ( 0)),
|
|
2345
|
-
completionTokens: _nullishCoalesce(json.usage.completion_tokens, () => ( 0)),
|
|
2346
|
-
totalTokens: _nullishCoalesce(json.usage.total_tokens, () => ( 0))
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2490
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, _optionalChain([json, 'optionalAccess', _130 => _130.usage]));
|
|
2349
2491
|
return {
|
|
2350
2492
|
id: _nullishCoalesce(json.id, () => ( "llmgateway-response")),
|
|
2351
2493
|
created: _nullishCoalesce(json.created, () => ( Date.now())),
|
|
@@ -2357,7 +2499,7 @@ var LLMGatewayClient = class {
|
|
|
2357
2499
|
};
|
|
2358
2500
|
}
|
|
2359
2501
|
async handleStreamingResponse(response) {
|
|
2360
|
-
const reader = _optionalChain([response, 'access',
|
|
2502
|
+
const reader = _optionalChain([response, 'access', _131 => _131.body, 'optionalAccess', _132 => _132.getReader, 'call', _133 => _133()]);
|
|
2361
2503
|
if (!reader) {
|
|
2362
2504
|
throw new Error("No response body for streaming");
|
|
2363
2505
|
}
|
|
@@ -2379,7 +2521,7 @@ var LLMGatewayClient = class {
|
|
|
2379
2521
|
try {
|
|
2380
2522
|
const data = JSON.parse(dataStr);
|
|
2381
2523
|
lastChunk = data;
|
|
2382
|
-
const delta = _optionalChain([data, 'access',
|
|
2524
|
+
const delta = _optionalChain([data, 'access', _134 => _134.choices, 'optionalAccess', _135 => _135[0], 'optionalAccess', _136 => _136.delta]);
|
|
2383
2525
|
if (!delta) continue;
|
|
2384
2526
|
const reasoning = delta.reasoning || delta.reasoning_content;
|
|
2385
2527
|
if (reasoning) {
|
|
@@ -2388,7 +2530,7 @@ var LLMGatewayClient = class {
|
|
|
2388
2530
|
if (delta.content) {
|
|
2389
2531
|
fullContent += delta.content;
|
|
2390
2532
|
}
|
|
2391
|
-
if (_optionalChain([data, 'access',
|
|
2533
|
+
if (_optionalChain([data, 'access', _137 => _137.choices, 'optionalAccess', _138 => _138[0], 'optionalAccess', _139 => _139.finish_reason])) {
|
|
2392
2534
|
finishReason = data.choices[0].finish_reason;
|
|
2393
2535
|
}
|
|
2394
2536
|
} catch (e26) {
|
|
@@ -2403,8 +2545,8 @@ var LLMGatewayClient = class {
|
|
|
2403
2545
|
|
|
2404
2546
|
${fullContent}` : fullContent;
|
|
2405
2547
|
return {
|
|
2406
|
-
id: _nullishCoalesce(_optionalChain([lastChunk, 'optionalAccess',
|
|
2407
|
-
created: _nullishCoalesce(_optionalChain([lastChunk, 'optionalAccess',
|
|
2548
|
+
id: _nullishCoalesce(_optionalChain([lastChunk, 'optionalAccess', _140 => _140.id]), () => ( `llmgateway-stream-${Date.now()}`)),
|
|
2549
|
+
created: _nullishCoalesce(_optionalChain([lastChunk, 'optionalAccess', _141 => _141.created]), () => ( Math.floor(Date.now() / 1e3))),
|
|
2408
2550
|
content: finalContent,
|
|
2409
2551
|
finishReason,
|
|
2410
2552
|
raw: { content: fullContent, reasoning: fullReasoning, chunks: lastChunk }
|
|
@@ -2415,7 +2557,7 @@ ${fullContent}` : fullContent;
|
|
|
2415
2557
|
let errorDetail = "";
|
|
2416
2558
|
try {
|
|
2417
2559
|
const body = await response.json();
|
|
2418
|
-
errorDetail = _optionalChain([body, 'optionalAccess',
|
|
2560
|
+
errorDetail = _optionalChain([body, 'optionalAccess', _142 => _142.error, 'optionalAccess', _143 => _143.message]) || _optionalChain([body, 'optionalAccess', _144 => _144.error]) || _optionalChain([body, 'optionalAccess', _145 => _145.message]) || "";
|
|
2419
2561
|
if (typeof errorDetail === "object") {
|
|
2420
2562
|
errorDetail = JSON.stringify(errorDetail);
|
|
2421
2563
|
}
|
|
@@ -2613,7 +2755,7 @@ function sanitizeMessages3(messages) {
|
|
|
2613
2755
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
2614
2756
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
2615
2757
|
}
|
|
2616
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
2758
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _146 => _146.tool_calls, 'optionalAccess', _147 => _147.length])) {
|
|
2617
2759
|
sanitized.tool_calls = msg.tool_calls;
|
|
2618
2760
|
}
|
|
2619
2761
|
if (msg.name) {
|
|
@@ -2650,13 +2792,13 @@ var AzureClient = class {
|
|
|
2650
2792
|
this.options = options;
|
|
2651
2793
|
this.tokenManager = new AzureTokenManager();
|
|
2652
2794
|
this.defaultModel = options.model;
|
|
2653
|
-
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2795
|
+
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _148 => _148.maxRetries]), () => ( DEFAULT_MAX_RETRIES5));
|
|
2654
2796
|
this.maxRetries = Math.min(
|
|
2655
2797
|
Math.max(0, configuredRetries),
|
|
2656
2798
|
MAX_ALLOWED_RETRIES5
|
|
2657
2799
|
);
|
|
2658
|
-
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2659
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
2800
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _149 => _149.retryDelay]), () => ( DEFAULT_RETRY_DELAY5));
|
|
2801
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _150 => _150.timeout]), () => ( DEFAULT_TIMEOUT5));
|
|
2660
2802
|
}
|
|
2661
2803
|
setDefaultModel(model) {
|
|
2662
2804
|
this.defaultModel = model;
|
|
@@ -2784,7 +2926,7 @@ var AzureClient = class {
|
|
|
2784
2926
|
}
|
|
2785
2927
|
} catch (error) {
|
|
2786
2928
|
const err = error;
|
|
2787
|
-
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess',
|
|
2929
|
+
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess', _151 => _151.aborted])) {
|
|
2788
2930
|
throw new Error("Request cancelled.");
|
|
2789
2931
|
}
|
|
2790
2932
|
if (err.name === "AbortError") {
|
|
@@ -2800,31 +2942,24 @@ var AzureClient = class {
|
|
|
2800
2942
|
throw new Error(await this.buildFriendlyError(response));
|
|
2801
2943
|
}
|
|
2802
2944
|
const json = await response.json();
|
|
2803
|
-
const message = _optionalChain([json, 'optionalAccess',
|
|
2804
|
-
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess',
|
|
2805
|
-
const finishReason = _optionalChain([json, 'optionalAccess',
|
|
2945
|
+
const message = _optionalChain([json, 'optionalAccess', _152 => _152.choices, 'optionalAccess', _153 => _153[0], 'optionalAccess', _154 => _154.message]);
|
|
2946
|
+
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess', _155 => _155.content]), () => ( ""));
|
|
2947
|
+
const finishReason = _optionalChain([json, 'optionalAccess', _156 => _156.choices, 'optionalAccess', _157 => _157[0], 'optionalAccess', _158 => _158.finish_reason]);
|
|
2806
2948
|
let toolCalls;
|
|
2807
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
2949
|
+
if (_optionalChain([message, 'optionalAccess', _159 => _159.tool_calls]) && Array.isArray(message.tool_calls)) {
|
|
2808
2950
|
toolCalls = message.tool_calls.map((tc) => {
|
|
2809
|
-
const rawArgs = _optionalChain([tc, 'access',
|
|
2951
|
+
const rawArgs = _optionalChain([tc, 'access', _160 => _160.function, 'optionalAccess', _161 => _161.arguments]);
|
|
2810
2952
|
return {
|
|
2811
2953
|
id: tc.id,
|
|
2812
2954
|
type: "function",
|
|
2813
2955
|
function: {
|
|
2814
|
-
name: _nullishCoalesce(_optionalChain([tc, 'access',
|
|
2956
|
+
name: _nullishCoalesce(_optionalChain([tc, 'access', _162 => _162.function, 'optionalAccess', _163 => _163.name]), () => ( "")),
|
|
2815
2957
|
arguments: _nullishCoalesce(rawArgs, () => ( "{}"))
|
|
2816
2958
|
}
|
|
2817
2959
|
};
|
|
2818
2960
|
});
|
|
2819
2961
|
}
|
|
2820
|
-
|
|
2821
|
-
if (_optionalChain([json, 'optionalAccess', _160 => _160.usage])) {
|
|
2822
|
-
usage = {
|
|
2823
|
-
promptTokens: _nullishCoalesce(json.usage.prompt_tokens, () => ( 0)),
|
|
2824
|
-
completionTokens: _nullishCoalesce(json.usage.completion_tokens, () => ( 0)),
|
|
2825
|
-
totalTokens: _nullishCoalesce(json.usage.total_tokens, () => ( 0))
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
2962
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, _optionalChain([json, 'optionalAccess', _164 => _164.usage]));
|
|
2828
2963
|
return {
|
|
2829
2964
|
id: _nullishCoalesce(json.id, () => ( "autohand-azure")),
|
|
2830
2965
|
created: _nullishCoalesce(json.created, () => ( Date.now())),
|
|
@@ -2840,7 +2975,7 @@ var AzureClient = class {
|
|
|
2840
2975
|
let errorDetail = "";
|
|
2841
2976
|
try {
|
|
2842
2977
|
const body = await response.json();
|
|
2843
|
-
errorDetail = _optionalChain([body, 'optionalAccess',
|
|
2978
|
+
errorDetail = _optionalChain([body, 'optionalAccess', _165 => _165.error, 'optionalAccess', _166 => _166.message]) || _optionalChain([body, 'optionalAccess', _167 => _167.error]) || _optionalChain([body, 'optionalAccess', _168 => _168.message]) || "";
|
|
2844
2979
|
if (typeof errorDetail === "object") {
|
|
2845
2980
|
errorDetail = JSON.stringify(errorDetail);
|
|
2846
2981
|
}
|
|
@@ -3062,7 +3197,7 @@ function sanitizeMessages4(messages) {
|
|
|
3062
3197
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
3063
3198
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
3064
3199
|
}
|
|
3065
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
3200
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _169 => _169.tool_calls, 'optionalAccess', _170 => _170.length])) {
|
|
3066
3201
|
sanitized.tool_calls = msg.tool_calls;
|
|
3067
3202
|
}
|
|
3068
3203
|
if (msg.name) {
|
|
@@ -3166,13 +3301,13 @@ var VertexAIProvider = class {
|
|
|
3166
3301
|
this.defaultModel = settings.model;
|
|
3167
3302
|
this.useGcloudRefresh = this.authToken.startsWith("ya29.") && this.authToken.length > 100;
|
|
3168
3303
|
this.baseUrl = `https://${this.endpoint}/v1/projects/${this.projectId}/locations/${this.region}/endpoints/openapi`;
|
|
3169
|
-
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
3304
|
+
const configuredRetries = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _171 => _171.maxRetries]), () => ( DEFAULT_MAX_RETRIES6));
|
|
3170
3305
|
this.maxRetries = Math.min(
|
|
3171
3306
|
Math.max(0, configuredRetries),
|
|
3172
3307
|
MAX_ALLOWED_RETRIES6
|
|
3173
3308
|
);
|
|
3174
|
-
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
3175
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
3309
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _172 => _172.retryDelay]), () => ( DEFAULT_RETRY_DELAY6));
|
|
3310
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _173 => _173.timeout]), () => ( DEFAULT_TIMEOUT6));
|
|
3176
3311
|
}
|
|
3177
3312
|
getName() {
|
|
3178
3313
|
return "vertexai";
|
|
@@ -3339,7 +3474,7 @@ var VertexAIProvider = class {
|
|
|
3339
3474
|
}
|
|
3340
3475
|
} catch (error) {
|
|
3341
3476
|
const err = error;
|
|
3342
|
-
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess',
|
|
3477
|
+
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess', _174 => _174.aborted])) {
|
|
3343
3478
|
throw new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
3344
3479
|
}
|
|
3345
3480
|
if (err.name === "AbortError") {
|
|
@@ -3360,31 +3495,24 @@ var VertexAIProvider = class {
|
|
|
3360
3495
|
if (isAnthropic) {
|
|
3361
3496
|
return this.parseAnthropicResponse(json);
|
|
3362
3497
|
}
|
|
3363
|
-
const message = _optionalChain([json, 'optionalAccess',
|
|
3364
|
-
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess',
|
|
3365
|
-
const finishReason = _optionalChain([json, 'optionalAccess',
|
|
3498
|
+
const message = _optionalChain([json, 'optionalAccess', _175 => _175.choices, 'optionalAccess', _176 => _176[0], 'optionalAccess', _177 => _177.message]);
|
|
3499
|
+
const text = _nullishCoalesce(_optionalChain([message, 'optionalAccess', _178 => _178.content]), () => ( ""));
|
|
3500
|
+
const finishReason = _optionalChain([json, 'optionalAccess', _179 => _179.choices, 'optionalAccess', _180 => _180[0], 'optionalAccess', _181 => _181.finish_reason]);
|
|
3366
3501
|
let toolCalls;
|
|
3367
|
-
if (_optionalChain([message, 'optionalAccess',
|
|
3502
|
+
if (_optionalChain([message, 'optionalAccess', _182 => _182.tool_calls]) && Array.isArray(message.tool_calls)) {
|
|
3368
3503
|
toolCalls = message.tool_calls.map((tc) => {
|
|
3369
|
-
const rawArgs = _optionalChain([tc, 'access',
|
|
3504
|
+
const rawArgs = _optionalChain([tc, 'access', _183 => _183.function, 'optionalAccess', _184 => _184.arguments]);
|
|
3370
3505
|
return {
|
|
3371
3506
|
id: tc.id,
|
|
3372
3507
|
type: "function",
|
|
3373
3508
|
function: {
|
|
3374
|
-
name: _nullishCoalesce(_optionalChain([tc, 'access',
|
|
3509
|
+
name: _nullishCoalesce(_optionalChain([tc, 'access', _185 => _185.function, 'optionalAccess', _186 => _186.name]), () => ( "")),
|
|
3375
3510
|
arguments: _nullishCoalesce(rawArgs, () => ( "{}"))
|
|
3376
3511
|
}
|
|
3377
3512
|
};
|
|
3378
3513
|
});
|
|
3379
3514
|
}
|
|
3380
|
-
|
|
3381
|
-
if (_optionalChain([json, 'optionalAccess', _183 => _183.usage])) {
|
|
3382
|
-
usage = {
|
|
3383
|
-
promptTokens: _nullishCoalesce(json.usage.prompt_tokens, () => ( 0)),
|
|
3384
|
-
completionTokens: _nullishCoalesce(json.usage.completion_tokens, () => ( 0)),
|
|
3385
|
-
totalTokens: _nullishCoalesce(json.usage.total_tokens, () => ( 0))
|
|
3386
|
-
};
|
|
3387
|
-
}
|
|
3515
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, _optionalChain([json, 'optionalAccess', _187 => _187.usage]));
|
|
3388
3516
|
return {
|
|
3389
3517
|
id: _nullishCoalesce(json.id, () => ( "vertexai-response")),
|
|
3390
3518
|
created: _nullishCoalesce(json.created, () => ( Date.now())),
|
|
@@ -3399,9 +3527,9 @@ var VertexAIProvider = class {
|
|
|
3399
3527
|
* Parse Anthropic API response format
|
|
3400
3528
|
*/
|
|
3401
3529
|
parseAnthropicResponse(json) {
|
|
3402
|
-
const contentBlocks = _nullishCoalesce(_optionalChain([json, 'optionalAccess',
|
|
3530
|
+
const contentBlocks = _nullishCoalesce(_optionalChain([json, 'optionalAccess', _188 => _188.content]), () => ( []));
|
|
3403
3531
|
const textBlock = contentBlocks.find((b) => b.type === "text");
|
|
3404
|
-
const text = _nullishCoalesce(_optionalChain([textBlock, 'optionalAccess',
|
|
3532
|
+
const text = _nullishCoalesce(_optionalChain([textBlock, 'optionalAccess', _189 => _189.text]), () => ( ""));
|
|
3405
3533
|
let toolCalls;
|
|
3406
3534
|
const toolUseBlocks = contentBlocks.filter((b) => b.type === "tool_use");
|
|
3407
3535
|
if (toolUseBlocks.length > 0) {
|
|
@@ -3414,15 +3542,8 @@ var VertexAIProvider = class {
|
|
|
3414
3542
|
}
|
|
3415
3543
|
}));
|
|
3416
3544
|
}
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
usage = {
|
|
3420
|
-
promptTokens: _nullishCoalesce(json.usage.input_tokens, () => ( 0)),
|
|
3421
|
-
completionTokens: _nullishCoalesce(json.usage.output_tokens, () => ( 0)),
|
|
3422
|
-
totalTokens: (_nullishCoalesce(json.usage.input_tokens, () => ( 0))) + (_nullishCoalesce(json.usage.output_tokens, () => ( 0)))
|
|
3423
|
-
};
|
|
3424
|
-
}
|
|
3425
|
-
const stopReason = _optionalChain([json, 'optionalAccess', _187 => _187.stop_reason]);
|
|
3545
|
+
const usage = _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, _optionalChain([json, 'optionalAccess', _190 => _190.usage]));
|
|
3546
|
+
const stopReason = _optionalChain([json, 'optionalAccess', _191 => _191.stop_reason]);
|
|
3426
3547
|
let finishReason;
|
|
3427
3548
|
if (stopReason === "end_turn" || stopReason === "stop_sequence") {
|
|
3428
3549
|
finishReason = "stop";
|
|
@@ -3446,7 +3567,7 @@ var VertexAIProvider = class {
|
|
|
3446
3567
|
let errorDetail = "";
|
|
3447
3568
|
try {
|
|
3448
3569
|
const body = await response.json();
|
|
3449
|
-
errorDetail = _optionalChain([body, 'optionalAccess',
|
|
3570
|
+
errorDetail = _optionalChain([body, 'optionalAccess', _192 => _192.error, 'optionalAccess', _193 => _193.message]) || _optionalChain([body, 'optionalAccess', _194 => _194.error]) || _optionalChain([body, 'optionalAccess', _195 => _195.message]) || "";
|
|
3450
3571
|
if (typeof errorDetail === "object") {
|
|
3451
3572
|
errorDetail = JSON.stringify(errorDetail);
|
|
3452
3573
|
}
|
|
@@ -3562,7 +3683,7 @@ var XAIProvider = class {
|
|
|
3562
3683
|
const response = await fetch(`${this.baseUrl}/language-models`, { headers });
|
|
3563
3684
|
if (response.ok) {
|
|
3564
3685
|
const data = await response.json();
|
|
3565
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
3686
|
+
if (_optionalChain([data, 'optionalAccess', _196 => _196.models]) && Array.isArray(data.models)) {
|
|
3566
3687
|
const ids = /* @__PURE__ */ new Set();
|
|
3567
3688
|
for (const m of data.models) {
|
|
3568
3689
|
if (m.id) ids.add(m.id);
|
|
@@ -3621,7 +3742,7 @@ var XAIProvider = class {
|
|
|
3621
3742
|
});
|
|
3622
3743
|
} catch (error) {
|
|
3623
3744
|
const err = error;
|
|
3624
|
-
if (err.name === "AbortError" && _optionalChain([request, 'access',
|
|
3745
|
+
if (err.name === "AbortError" && _optionalChain([request, 'access', _197 => _197.signal, 'optionalAccess', _198 => _198.aborted])) {
|
|
3625
3746
|
throw new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
3626
3747
|
}
|
|
3627
3748
|
if (err.name === "AbortError") {
|
|
@@ -3651,7 +3772,7 @@ var XAIProvider = class {
|
|
|
3651
3772
|
created: _nullishCoalesce(data.created_at, () => ( Math.floor(Date.now() / 1e3))),
|
|
3652
3773
|
content,
|
|
3653
3774
|
toolCalls,
|
|
3654
|
-
finishReason: toolCalls.length > 0 ? "tool_calls" : _optionalChain([data, 'access',
|
|
3775
|
+
finishReason: toolCalls.length > 0 ? "tool_calls" : _optionalChain([data, 'access', _199 => _199.incomplete_details, 'optionalAccess', _200 => _200.reason]) === "max_output_tokens" ? "length" : "stop",
|
|
3655
3776
|
usage,
|
|
3656
3777
|
raw: data
|
|
3657
3778
|
};
|
|
@@ -3670,7 +3791,7 @@ var XAIProvider = class {
|
|
|
3670
3791
|
// server-side tool we emit the server-side variant; everything else becomes a
|
|
3671
3792
|
// standard `function` tool.
|
|
3672
3793
|
mapToXAITools(tools) {
|
|
3673
|
-
if (!_optionalChain([tools, 'optionalAccess',
|
|
3794
|
+
if (!_optionalChain([tools, 'optionalAccess', _201 => _201.length])) return [];
|
|
3674
3795
|
return tools.map((tool) => {
|
|
3675
3796
|
const name = tool.name.toLowerCase();
|
|
3676
3797
|
if (name === "web_search" || name === "x_search" || name === "code_execution" || name === "code_interpreter") {
|
|
@@ -3701,7 +3822,7 @@ var XAIProvider = class {
|
|
|
3701
3822
|
});
|
|
3702
3823
|
continue;
|
|
3703
3824
|
}
|
|
3704
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
3825
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _202 => _202.tool_calls, 'optionalAccess', _203 => _203.length])) {
|
|
3705
3826
|
items.push({
|
|
3706
3827
|
type: "message",
|
|
3707
3828
|
role: "assistant",
|
|
@@ -3730,7 +3851,7 @@ var XAIProvider = class {
|
|
|
3730
3851
|
}
|
|
3731
3852
|
extractXAIToolCalls(output) {
|
|
3732
3853
|
if (!Array.isArray(output)) return [];
|
|
3733
|
-
return output.filter((entry) => _optionalChain([entry, 'optionalAccess',
|
|
3854
|
+
return output.filter((entry) => _optionalChain([entry, 'optionalAccess', _204 => _204.type]) === "function_call").map((toolCall, index) => ({
|
|
3734
3855
|
id: _nullishCoalesce(toolCall.call_id, () => ( `call_${index + 1}`)),
|
|
3735
3856
|
type: "function",
|
|
3736
3857
|
function: {
|
|
@@ -3746,9 +3867,9 @@ var XAIProvider = class {
|
|
|
3746
3867
|
if (!Array.isArray(data.output)) return "";
|
|
3747
3868
|
const parts = [];
|
|
3748
3869
|
for (const item of data.output) {
|
|
3749
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
3870
|
+
if (_optionalChain([item, 'optionalAccess', _205 => _205.type]) !== "message" || !Array.isArray(item.content)) continue;
|
|
3750
3871
|
for (const ci of item.content) {
|
|
3751
|
-
if (_optionalChain([ci, 'optionalAccess',
|
|
3872
|
+
if (_optionalChain([ci, 'optionalAccess', _206 => _206.type]) === "output_text" && typeof ci.text === "string") {
|
|
3752
3873
|
parts.push(ci.text);
|
|
3753
3874
|
}
|
|
3754
3875
|
}
|
|
@@ -3756,14 +3877,7 @@ var XAIProvider = class {
|
|
|
3756
3877
|
return parts.join("\n").trim();
|
|
3757
3878
|
}
|
|
3758
3879
|
mapXAIUsage(usage) {
|
|
3759
|
-
|
|
3760
|
-
const input = _nullishCoalesce(usage.input_tokens, () => ( 0));
|
|
3761
|
-
const output = _nullishCoalesce(usage.output_tokens, () => ( 0));
|
|
3762
|
-
return {
|
|
3763
|
-
promptTokens: input,
|
|
3764
|
-
completionTokens: output,
|
|
3765
|
-
totalTokens: _nullishCoalesce(usage.total_tokens, () => ( input + output))
|
|
3766
|
-
};
|
|
3880
|
+
return _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, usage);
|
|
3767
3881
|
}
|
|
3768
3882
|
async parseXAIStream(response) {
|
|
3769
3883
|
const text = await response.text();
|
|
@@ -3793,8 +3907,8 @@ var XAIProvider = class {
|
|
|
3793
3907
|
let errorDetail = "";
|
|
3794
3908
|
try {
|
|
3795
3909
|
const body = await response.json();
|
|
3796
|
-
const errObj = _optionalChain([body, 'optionalAccess',
|
|
3797
|
-
errorDetail = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([errObj, 'optionalAccess',
|
|
3910
|
+
const errObj = _optionalChain([body, 'optionalAccess', _207 => _207.error]);
|
|
3911
|
+
errorDetail = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([errObj, 'optionalAccess', _208 => _208.message]), () => ( _optionalChain([body, 'optionalAccess', _209 => _209.detail]))), () => ( _optionalChain([body, 'optionalAccess', _210 => _210.error]))), () => ( ""));
|
|
3798
3912
|
if (typeof errorDetail === "object") {
|
|
3799
3913
|
errorDetail = JSON.stringify(errorDetail);
|
|
3800
3914
|
}
|
|
@@ -3818,7 +3932,7 @@ function sanitizeMessages5(messages) {
|
|
|
3818
3932
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
3819
3933
|
sanitized.tool_call_id = msg.tool_call_id;
|
|
3820
3934
|
}
|
|
3821
|
-
if (msg.role === "assistant" && _optionalChain([msg, 'access',
|
|
3935
|
+
if (msg.role === "assistant" && _optionalChain([msg, 'access', _211 => _211.tool_calls, 'optionalAccess', _212 => _212.length])) {
|
|
3822
3936
|
sanitized.tool_calls = msg.tool_calls;
|
|
3823
3937
|
}
|
|
3824
3938
|
if (msg.name) {
|
|
@@ -3856,11 +3970,11 @@ var CerebrasClient = class {
|
|
|
3856
3970
|
this.baseUrl = _nullishCoalesce(settings.baseUrl, () => ( DEFAULT_BASE_URL3));
|
|
3857
3971
|
this.defaultModel = settings.model;
|
|
3858
3972
|
this.maxRetries = Math.min(
|
|
3859
|
-
_nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
3973
|
+
_nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _213 => _213.maxRetries]), () => ( DEFAULT_MAX_RETRIES7)),
|
|
3860
3974
|
MAX_ALLOWED_RETRIES7
|
|
3861
3975
|
);
|
|
3862
3976
|
this.retryDelay = DEFAULT_RETRY_DELAY7;
|
|
3863
|
-
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess',
|
|
3977
|
+
this.timeout = _nullishCoalesce(_optionalChain([networkSettings, 'optionalAccess', _214 => _214.timeout]), () => ( DEFAULT_TIMEOUT7));
|
|
3864
3978
|
}
|
|
3865
3979
|
setDefaultModel(model) {
|
|
3866
3980
|
this.defaultModel = model;
|
|
@@ -3950,9 +4064,9 @@ var CerebrasClient = class {
|
|
|
3950
4064
|
return this.handleStreamingResponse(response);
|
|
3951
4065
|
}
|
|
3952
4066
|
const data = await response.json();
|
|
3953
|
-
const choice = _optionalChain([data, 'access',
|
|
4067
|
+
const choice = _optionalChain([data, 'access', _215 => _215.choices, 'optionalAccess', _216 => _216[0]]);
|
|
3954
4068
|
let toolCalls;
|
|
3955
|
-
if (_optionalChain([choice, 'optionalAccess',
|
|
4069
|
+
if (_optionalChain([choice, 'optionalAccess', _217 => _217.message, 'optionalAccess', _218 => _218.tool_calls, 'optionalAccess', _219 => _219.length])) {
|
|
3956
4070
|
toolCalls = choice.message.tool_calls.map((tc) => ({
|
|
3957
4071
|
id: tc.id,
|
|
3958
4072
|
type: tc.type,
|
|
@@ -3970,11 +4084,11 @@ var CerebrasClient = class {
|
|
|
3970
4084
|
totalTokens: data.usage.total_tokens
|
|
3971
4085
|
};
|
|
3972
4086
|
}
|
|
3973
|
-
const finishReason = _optionalChain([toolCalls, 'optionalAccess',
|
|
4087
|
+
const finishReason = _optionalChain([toolCalls, 'optionalAccess', _220 => _220.length]) ? "tool_calls" : _optionalChain([choice, 'optionalAccess', _221 => _221.finish_reason]) === "stop" || _optionalChain([choice, 'optionalAccess', _222 => _222.finish_reason]) === "length" || _optionalChain([choice, 'optionalAccess', _223 => _223.finish_reason]) === "content_filter" ? choice.finish_reason : "stop";
|
|
3974
4088
|
return {
|
|
3975
4089
|
id: data.id || `cerebras-${Date.now()}`,
|
|
3976
4090
|
created: data.created || Math.floor(Date.now() / 1e3),
|
|
3977
|
-
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess',
|
|
4091
|
+
content: _nullishCoalesce(_optionalChain([choice, 'optionalAccess', _224 => _224.message, 'optionalAccess', _225 => _225.content]), () => ( "")),
|
|
3978
4092
|
toolCalls,
|
|
3979
4093
|
usage,
|
|
3980
4094
|
finishReason,
|
|
@@ -3982,7 +4096,7 @@ var CerebrasClient = class {
|
|
|
3982
4096
|
};
|
|
3983
4097
|
}
|
|
3984
4098
|
async handleStreamingResponse(response) {
|
|
3985
|
-
const reader = _optionalChain([response, 'access',
|
|
4099
|
+
const reader = _optionalChain([response, 'access', _226 => _226.body, 'optionalAccess', _227 => _227.getReader, 'call', _228 => _228()]);
|
|
3986
4100
|
if (!reader) {
|
|
3987
4101
|
throw new Error("No response body available for streaming");
|
|
3988
4102
|
}
|
|
@@ -4000,11 +4114,11 @@ var CerebrasClient = class {
|
|
|
4000
4114
|
if (data === "[DONE]") continue;
|
|
4001
4115
|
try {
|
|
4002
4116
|
const parsed = JSON.parse(data);
|
|
4003
|
-
const delta = _optionalChain([parsed, 'access',
|
|
4004
|
-
if (_optionalChain([delta, 'optionalAccess',
|
|
4117
|
+
const delta = _optionalChain([parsed, 'access', _229 => _229.choices, 'optionalAccess', _230 => _230[0], 'optionalAccess', _231 => _231.delta]);
|
|
4118
|
+
if (_optionalChain([delta, 'optionalAccess', _232 => _232.content])) {
|
|
4005
4119
|
content += delta.content;
|
|
4006
4120
|
}
|
|
4007
|
-
if (_optionalChain([parsed, 'access',
|
|
4121
|
+
if (_optionalChain([parsed, 'access', _233 => _233.choices, 'optionalAccess', _234 => _234[0], 'optionalAccess', _235 => _235.finish_reason])) {
|
|
4008
4122
|
finishReason = parsed.choices[0].finish_reason;
|
|
4009
4123
|
}
|
|
4010
4124
|
} catch (e43) {
|
|
@@ -4039,7 +4153,7 @@ var CerebrasClient = class {
|
|
|
4039
4153
|
let errorDetail = "";
|
|
4040
4154
|
try {
|
|
4041
4155
|
const errorData = await response.json();
|
|
4042
|
-
errorDetail = _optionalChain([errorData, 'access',
|
|
4156
|
+
errorDetail = _optionalChain([errorData, 'access', _236 => _236.error, 'optionalAccess', _237 => _237.message]) || JSON.stringify(errorData);
|
|
4043
4157
|
} catch (e44) {
|
|
4044
4158
|
try {
|
|
4045
4159
|
errorDetail = await response.text();
|
|
@@ -4132,6 +4246,544 @@ var DeepSeekProvider = class {
|
|
|
4132
4246
|
}
|
|
4133
4247
|
};
|
|
4134
4248
|
|
|
4249
|
+
// src/providers/BedrockProvider.ts
|
|
4250
|
+
|
|
4251
|
+
|
|
4252
|
+
|
|
4253
|
+
var _clientbedrockruntime = require('@aws-sdk/client-bedrock-runtime');
|
|
4254
|
+
|
|
4255
|
+
|
|
4256
|
+
|
|
4257
|
+
var _clientbedrock = require('@aws-sdk/client-bedrock');
|
|
4258
|
+
var _credentialproviders = require('@aws-sdk/credential-providers');
|
|
4259
|
+
var BEDROCK_DEFAULT_REGION = "us-east-1";
|
|
4260
|
+
var BEDROCK_DEFAULT_MODEL = "anthropic.claude-3-5-sonnet-20241022-v2:0";
|
|
4261
|
+
var BEDROCK_MODELS = [
|
|
4262
|
+
BEDROCK_DEFAULT_MODEL,
|
|
4263
|
+
"anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
4264
|
+
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
4265
|
+
"amazon.nova-pro-v1:0",
|
|
4266
|
+
"amazon.nova-lite-v1:0",
|
|
4267
|
+
"meta.llama3-1-70b-instruct-v1:0",
|
|
4268
|
+
"openai.gpt-oss-120b-1:0"
|
|
4269
|
+
];
|
|
4270
|
+
function resolveBedrockRegion(region) {
|
|
4271
|
+
return _optionalChain([region, 'optionalAccess', _238 => _238.trim, 'call', _239 => _239()]) || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || BEDROCK_DEFAULT_REGION;
|
|
4272
|
+
}
|
|
4273
|
+
function getBedrockRuntimeEndpoint(region) {
|
|
4274
|
+
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
4275
|
+
}
|
|
4276
|
+
function getBedrockOpenAIEndpoint(_mode, region) {
|
|
4277
|
+
return `${getBedrockRuntimeEndpoint(region)}/openai/v1`;
|
|
4278
|
+
}
|
|
4279
|
+
function resolveBedrockEndpoint(mode, region, configuredEndpoint) {
|
|
4280
|
+
if (_optionalChain([configuredEndpoint, 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()])) {
|
|
4281
|
+
return configuredEndpoint.replace(/\/+$/, "");
|
|
4282
|
+
}
|
|
4283
|
+
if (mode === "converse") {
|
|
4284
|
+
return getBedrockRuntimeEndpoint(region);
|
|
4285
|
+
}
|
|
4286
|
+
return getBedrockOpenAIEndpoint(mode, region);
|
|
4287
|
+
}
|
|
4288
|
+
function resolveBedrockAuthMode(mode, configured) {
|
|
4289
|
+
if (configured) return configured;
|
|
4290
|
+
return mode === "converse" ? "aws-credentials" : "bedrock-api-key";
|
|
4291
|
+
}
|
|
4292
|
+
function parseToolArguments(argumentsJson) {
|
|
4293
|
+
try {
|
|
4294
|
+
return JSON.parse(argumentsJson);
|
|
4295
|
+
} catch (e46) {
|
|
4296
|
+
return {};
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
function toTextContent(content) {
|
|
4300
|
+
return content ? [{ text: content }] : [];
|
|
4301
|
+
}
|
|
4302
|
+
function toToolUseBlocks(toolCalls) {
|
|
4303
|
+
return toolCalls.map((toolCall) => ({
|
|
4304
|
+
toolUse: {
|
|
4305
|
+
toolUseId: toolCall.id,
|
|
4306
|
+
name: toolCall.function.name,
|
|
4307
|
+
input: parseToolArguments(toolCall.function.arguments)
|
|
4308
|
+
}
|
|
4309
|
+
}));
|
|
4310
|
+
}
|
|
4311
|
+
function toConverseMessage(message) {
|
|
4312
|
+
if (message.role === "system") {
|
|
4313
|
+
return null;
|
|
4314
|
+
}
|
|
4315
|
+
if (message.role === "tool") {
|
|
4316
|
+
return {
|
|
4317
|
+
role: "user",
|
|
4318
|
+
content: [
|
|
4319
|
+
{
|
|
4320
|
+
toolResult: {
|
|
4321
|
+
toolUseId: _nullishCoalesce(_nullishCoalesce(message.tool_call_id, () => ( message.name)), () => ( "tool_result")),
|
|
4322
|
+
content: [{ text: message.content }]
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
]
|
|
4326
|
+
};
|
|
4327
|
+
}
|
|
4328
|
+
if (message.role === "assistant") {
|
|
4329
|
+
const content = [
|
|
4330
|
+
...toTextContent(message.content),
|
|
4331
|
+
..._optionalChain([message, 'access', _242 => _242.tool_calls, 'optionalAccess', _243 => _243.length]) ? toToolUseBlocks(message.tool_calls) : []
|
|
4332
|
+
];
|
|
4333
|
+
return {
|
|
4334
|
+
role: "assistant",
|
|
4335
|
+
content: content.length > 0 ? content : [{ text: "" }]
|
|
4336
|
+
};
|
|
4337
|
+
}
|
|
4338
|
+
return {
|
|
4339
|
+
role: "user",
|
|
4340
|
+
content: toTextContent(message.content)
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
function toOpenAIMessage(message) {
|
|
4344
|
+
const mapped = {
|
|
4345
|
+
role: message.role,
|
|
4346
|
+
content: message.role === "assistant" && _optionalChain([message, 'access', _244 => _244.tool_calls, 'optionalAccess', _245 => _245.length]) ? message.content || null : message.content
|
|
4347
|
+
};
|
|
4348
|
+
if (message.name) mapped.name = message.name;
|
|
4349
|
+
if (message.role === "tool" && message.tool_call_id) {
|
|
4350
|
+
mapped.tool_call_id = message.tool_call_id;
|
|
4351
|
+
}
|
|
4352
|
+
if (message.role === "assistant" && _optionalChain([message, 'access', _246 => _246.tool_calls, 'optionalAccess', _247 => _247.length])) {
|
|
4353
|
+
mapped.tool_calls = message.tool_calls;
|
|
4354
|
+
}
|
|
4355
|
+
return mapped;
|
|
4356
|
+
}
|
|
4357
|
+
function toResponsesInputItem(message) {
|
|
4358
|
+
if (message.role === "tool" && message.tool_call_id) {
|
|
4359
|
+
return [
|
|
4360
|
+
{
|
|
4361
|
+
type: "function_call_output",
|
|
4362
|
+
call_id: message.tool_call_id,
|
|
4363
|
+
output: message.content
|
|
4364
|
+
}
|
|
4365
|
+
];
|
|
4366
|
+
}
|
|
4367
|
+
if (message.role === "assistant" && _optionalChain([message, 'access', _248 => _248.tool_calls, 'optionalAccess', _249 => _249.length])) {
|
|
4368
|
+
return message.tool_calls.map((toolCall) => ({
|
|
4369
|
+
type: "function_call",
|
|
4370
|
+
call_id: toolCall.id,
|
|
4371
|
+
name: toolCall.function.name,
|
|
4372
|
+
arguments: toolCall.function.arguments
|
|
4373
|
+
}));
|
|
4374
|
+
}
|
|
4375
|
+
if (message.role === "system") {
|
|
4376
|
+
return [];
|
|
4377
|
+
}
|
|
4378
|
+
const contentType = message.role === "assistant" ? "output_text" : "input_text";
|
|
4379
|
+
return [
|
|
4380
|
+
{
|
|
4381
|
+
role: message.role,
|
|
4382
|
+
content: [{ type: contentType, text: message.content }]
|
|
4383
|
+
}
|
|
4384
|
+
];
|
|
4385
|
+
}
|
|
4386
|
+
function toOpenAITools(tools) {
|
|
4387
|
+
return tools.map((tool) => ({
|
|
4388
|
+
type: "function",
|
|
4389
|
+
function: {
|
|
4390
|
+
name: tool.name,
|
|
4391
|
+
description: tool.description,
|
|
4392
|
+
parameters: _nullishCoalesce(tool.parameters, () => ( { type: "object", properties: {} }))
|
|
4393
|
+
}
|
|
4394
|
+
}));
|
|
4395
|
+
}
|
|
4396
|
+
function toResponsesTools(tools) {
|
|
4397
|
+
return tools.map((tool) => ({
|
|
4398
|
+
type: "function",
|
|
4399
|
+
name: tool.name,
|
|
4400
|
+
description: tool.description,
|
|
4401
|
+
parameters: _nullishCoalesce(tool.parameters, () => ( { type: "object", properties: {} }))
|
|
4402
|
+
}));
|
|
4403
|
+
}
|
|
4404
|
+
function toConverseTools(tools) {
|
|
4405
|
+
return tools.map((tool) => ({
|
|
4406
|
+
toolSpec: {
|
|
4407
|
+
name: tool.name,
|
|
4408
|
+
description: tool.description,
|
|
4409
|
+
inputSchema: {
|
|
4410
|
+
json: _nullishCoalesce(tool.parameters, () => ( { type: "object", properties: {} }))
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
}));
|
|
4414
|
+
}
|
|
4415
|
+
function normalizeStopReason(stopReason) {
|
|
4416
|
+
if (stopReason === "tool_use" || stopReason === "tool_calls") {
|
|
4417
|
+
return "tool_calls";
|
|
4418
|
+
}
|
|
4419
|
+
if (stopReason === "max_tokens" || stopReason === "length") {
|
|
4420
|
+
return "length";
|
|
4421
|
+
}
|
|
4422
|
+
if (stopReason === "content_filter") {
|
|
4423
|
+
return "content_filter";
|
|
4424
|
+
}
|
|
4425
|
+
return "stop";
|
|
4426
|
+
}
|
|
4427
|
+
function toolCallsFromConverseBlocks(blocks) {
|
|
4428
|
+
return blocks.filter(
|
|
4429
|
+
(block) => "toolUse" in block && Boolean(block.toolUse)
|
|
4430
|
+
).map((block) => ({
|
|
4431
|
+
id: block.toolUse.toolUseId,
|
|
4432
|
+
type: "function",
|
|
4433
|
+
function: {
|
|
4434
|
+
name: block.toolUse.name,
|
|
4435
|
+
arguments: JSON.stringify(_nullishCoalesce(block.toolUse.input, () => ( {})))
|
|
4436
|
+
}
|
|
4437
|
+
}));
|
|
4438
|
+
}
|
|
4439
|
+
function textFromConverseBlocks(blocks) {
|
|
4440
|
+
return blocks.filter((block) => "text" in block).map((block) => block.text).join("");
|
|
4441
|
+
}
|
|
4442
|
+
function isBedrockAwsError(error) {
|
|
4443
|
+
return error instanceof Error;
|
|
4444
|
+
}
|
|
4445
|
+
function classifyBedrockError(error) {
|
|
4446
|
+
if (!isBedrockAwsError(error)) {
|
|
4447
|
+
return new (0, _chunk3OF56EMAcjs.ApiError)(String(error), "unknown", 0, true);
|
|
4448
|
+
}
|
|
4449
|
+
if (error.name === "AbortError") {
|
|
4450
|
+
return new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
4451
|
+
}
|
|
4452
|
+
const status = _nullishCoalesce(_optionalChain([error, 'access', _250 => _250["$metadata"], 'optionalAccess', _251 => _251.httpStatusCode]), () => ( 0));
|
|
4453
|
+
const message = error.message || error.name;
|
|
4454
|
+
const lower = `${error.name} ${message}`.toLowerCase();
|
|
4455
|
+
let code;
|
|
4456
|
+
if (lower.includes("credential") || lower.includes("signature") || lower.includes("unrecognizedclient") || lower.includes("expiredtoken")) {
|
|
4457
|
+
code = "auth_failed";
|
|
4458
|
+
} else if (lower.includes("accessdenied") || lower.includes("access denied") || lower.includes("not authorized") || lower.includes("model access")) {
|
|
4459
|
+
code = "access_denied";
|
|
4460
|
+
} else if (lower.includes("resourcenotfound") || lower.includes("model not found") || lower.includes("not found") || lower.includes("not available")) {
|
|
4461
|
+
code = "model_not_found";
|
|
4462
|
+
} else if (lower.includes("throttl") || lower.includes("quota") || lower.includes("toomanyrequests")) {
|
|
4463
|
+
code = "rate_limited";
|
|
4464
|
+
} else if (lower.includes("validation") || lower.includes("unsupported") || lower.includes("api mode")) {
|
|
4465
|
+
code = "invalid_request";
|
|
4466
|
+
} else if (lower.includes("network") || lower.includes("enotfound") || lower.includes("econn") || lower.includes("private endpoint")) {
|
|
4467
|
+
code = "network_error";
|
|
4468
|
+
}
|
|
4469
|
+
if (code) {
|
|
4470
|
+
const friendly = {
|
|
4471
|
+
auth_failed: "AWS Bedrock credentials were not found or were rejected. Configure AWS credentials, AWS_PROFILE, instance metadata, or choose Bedrock API key auth.",
|
|
4472
|
+
access_denied: "AWS Bedrock denied access. Enable model access in the AWS console and verify IAM permissions for this model.",
|
|
4473
|
+
model_not_found: "The selected Bedrock model is not available in this region. Check the model ID, inference profile, ARN, and region.",
|
|
4474
|
+
invalid_request: "Bedrock rejected the request. The selected model may not support this API mode or native tool use.",
|
|
4475
|
+
rate_limited: "AWS Bedrock throttled the request or quota was exceeded. Wait and retry, or request a quota increase.",
|
|
4476
|
+
network_error: "Unable to reach the AWS Bedrock endpoint. Check region, endpoint, private networking, and proxy settings.",
|
|
4477
|
+
timeout: "The AWS Bedrock request timed out.",
|
|
4478
|
+
cancelled: "Request cancelled.",
|
|
4479
|
+
context_overflow: "The conversation is too long for this Bedrock model.",
|
|
4480
|
+
payment_required: "AWS Bedrock billing or account setup is required.",
|
|
4481
|
+
server_error: "AWS Bedrock encountered a service error. Please try again later.",
|
|
4482
|
+
unknown: "AWS Bedrock returned an unexpected error."
|
|
4483
|
+
};
|
|
4484
|
+
return new (0, _chunk3OF56EMAcjs.ApiError)(`${friendly[code]}
|
|
4485
|
+
${message}`, code, status, code === "rate_limited" || code === "server_error", void 0, message);
|
|
4486
|
+
}
|
|
4487
|
+
return _chunk3OF56EMAcjs.classifyApiError.call(void 0, status, message);
|
|
4488
|
+
}
|
|
4489
|
+
async function readErrorBody(response) {
|
|
4490
|
+
try {
|
|
4491
|
+
return await response.text();
|
|
4492
|
+
} catch (e47) {
|
|
4493
|
+
return "";
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
var BedrockProvider = class {
|
|
4497
|
+
|
|
4498
|
+
|
|
4499
|
+
|
|
4500
|
+
|
|
4501
|
+
|
|
4502
|
+
|
|
4503
|
+
|
|
4504
|
+
|
|
4505
|
+
|
|
4506
|
+
constructor(config) {
|
|
4507
|
+
this.apiMode = _nullishCoalesce(config.apiMode, () => ( "converse"));
|
|
4508
|
+
this.authMode = resolveBedrockAuthMode(this.apiMode, config.authMode);
|
|
4509
|
+
this.region = resolveBedrockRegion(config.region);
|
|
4510
|
+
this.endpoint = resolveBedrockEndpoint(this.apiMode, this.region, config.endpoint);
|
|
4511
|
+
this.profile = config.profile;
|
|
4512
|
+
this.apiKey = config.apiKey;
|
|
4513
|
+
this.model = config.model || BEDROCK_DEFAULT_MODEL;
|
|
4514
|
+
}
|
|
4515
|
+
getName() {
|
|
4516
|
+
return "bedrock";
|
|
4517
|
+
}
|
|
4518
|
+
setModel(model) {
|
|
4519
|
+
this.model = model;
|
|
4520
|
+
}
|
|
4521
|
+
getCapabilities() {
|
|
4522
|
+
return { nativeToolCalling: true };
|
|
4523
|
+
}
|
|
4524
|
+
async listModels() {
|
|
4525
|
+
if (this.apiMode !== "converse") {
|
|
4526
|
+
return [...BEDROCK_MODELS];
|
|
4527
|
+
}
|
|
4528
|
+
try {
|
|
4529
|
+
const response = await this.getModelClient().send(
|
|
4530
|
+
new (0, _clientbedrock.ListFoundationModelsCommand)({})
|
|
4531
|
+
);
|
|
4532
|
+
const summaries = _nullishCoalesce(response.modelSummaries, () => ( []));
|
|
4533
|
+
const modelIds = summaries.map((summary) => summary.modelId).filter((modelId) => Boolean(modelId));
|
|
4534
|
+
return modelIds.length > 0 ? modelIds : [...BEDROCK_MODELS];
|
|
4535
|
+
} catch (e48) {
|
|
4536
|
+
return [...BEDROCK_MODELS];
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
async isAvailable() {
|
|
4540
|
+
if (this.authMode === "bedrock-api-key") {
|
|
4541
|
+
return Boolean(this.apiKey);
|
|
4542
|
+
}
|
|
4543
|
+
try {
|
|
4544
|
+
await this.listModels();
|
|
4545
|
+
return true;
|
|
4546
|
+
} catch (e49) {
|
|
4547
|
+
return false;
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
async complete(request) {
|
|
4551
|
+
if (!this.region) {
|
|
4552
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4553
|
+
"AWS Bedrock region is missing. Set bedrock.region, AWS_REGION, or AWS_DEFAULT_REGION.",
|
|
4554
|
+
"invalid_request",
|
|
4555
|
+
0,
|
|
4556
|
+
false
|
|
4557
|
+
);
|
|
4558
|
+
}
|
|
4559
|
+
if (this.apiMode === "converse") {
|
|
4560
|
+
return this.completeWithConverse(request);
|
|
4561
|
+
}
|
|
4562
|
+
return this.completeWithOpenAICompatible(request);
|
|
4563
|
+
}
|
|
4564
|
+
getCredentials() {
|
|
4565
|
+
if (this.profile) {
|
|
4566
|
+
return _credentialproviders.fromIni.call(void 0, { profile: this.profile });
|
|
4567
|
+
}
|
|
4568
|
+
return void 0;
|
|
4569
|
+
}
|
|
4570
|
+
getRuntimeClient() {
|
|
4571
|
+
if (!this.runtimeClient) {
|
|
4572
|
+
this.runtimeClient = new (0, _clientbedrockruntime.BedrockRuntimeClient)({
|
|
4573
|
+
region: this.region,
|
|
4574
|
+
endpoint: this.endpoint,
|
|
4575
|
+
credentials: this.getCredentials()
|
|
4576
|
+
});
|
|
4577
|
+
}
|
|
4578
|
+
return this.runtimeClient;
|
|
4579
|
+
}
|
|
4580
|
+
getModelClient() {
|
|
4581
|
+
if (!this.modelClient) {
|
|
4582
|
+
this.modelClient = new (0, _clientbedrock.BedrockClient)({
|
|
4583
|
+
region: this.region,
|
|
4584
|
+
credentials: this.getCredentials()
|
|
4585
|
+
});
|
|
4586
|
+
}
|
|
4587
|
+
return this.modelClient;
|
|
4588
|
+
}
|
|
4589
|
+
async completeWithConverse(request) {
|
|
4590
|
+
if (this.authMode === "bedrock-api-key") {
|
|
4591
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4592
|
+
"Bedrock Converse uses AWS credential-chain auth. Choose apiMode openai-chat/openai-responses to use Bedrock API keys.",
|
|
4593
|
+
"invalid_request",
|
|
4594
|
+
0,
|
|
4595
|
+
false
|
|
4596
|
+
);
|
|
4597
|
+
}
|
|
4598
|
+
const contentMessages = request.messages.map(toConverseMessage).filter((message) => message !== null);
|
|
4599
|
+
const system = request.messages.filter((message) => message.role === "system" && message.content).map((message) => ({ text: message.content }));
|
|
4600
|
+
const body = {
|
|
4601
|
+
modelId: _nullishCoalesce(request.model, () => ( this.model)),
|
|
4602
|
+
messages: contentMessages,
|
|
4603
|
+
inferenceConfig: {
|
|
4604
|
+
...request.maxTokens !== void 0 && { maxTokens: request.maxTokens },
|
|
4605
|
+
...request.temperature !== void 0 && { temperature: request.temperature }
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
if (system.length > 0) {
|
|
4609
|
+
body.system = system;
|
|
4610
|
+
}
|
|
4611
|
+
if (_optionalChain([request, 'access', _252 => _252.tools, 'optionalAccess', _253 => _253.length])) {
|
|
4612
|
+
body.toolConfig = {
|
|
4613
|
+
tools: toConverseTools(request.tools),
|
|
4614
|
+
...request.toolChoice && request.toolChoice !== "auto" ? { toolChoice: this.toConverseToolChoice(request.toolChoice) } : {}
|
|
4615
|
+
};
|
|
4616
|
+
}
|
|
4617
|
+
try {
|
|
4618
|
+
const data = await this.getRuntimeClient().send(
|
|
4619
|
+
new (0, _clientbedrockruntime.ConverseCommand)(body)
|
|
4620
|
+
);
|
|
4621
|
+
const blocks = _nullishCoalesce(_optionalChain([data, 'access', _254 => _254.output, 'optionalAccess', _255 => _255.message, 'optionalAccess', _256 => _256.content]), () => ( []));
|
|
4622
|
+
const toolCalls = toolCallsFromConverseBlocks(blocks);
|
|
4623
|
+
return {
|
|
4624
|
+
id: `bedrock-${Date.now()}`,
|
|
4625
|
+
created: Math.floor(Date.now() / 1e3),
|
|
4626
|
+
content: textFromConverseBlocks(blocks),
|
|
4627
|
+
...toolCalls.length > 0 && { toolCalls },
|
|
4628
|
+
finishReason: normalizeStopReason(data.stopReason),
|
|
4629
|
+
usage: _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, data.usage),
|
|
4630
|
+
raw: data
|
|
4631
|
+
};
|
|
4632
|
+
} catch (error) {
|
|
4633
|
+
throw classifyBedrockError(error);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
toConverseToolChoice(toolChoice) {
|
|
4637
|
+
if (!toolChoice || toolChoice === "auto") return void 0;
|
|
4638
|
+
if (toolChoice === "none") return { auto: {} };
|
|
4639
|
+
if (toolChoice === "required") return { any: {} };
|
|
4640
|
+
return { tool: { name: toolChoice.function.name } };
|
|
4641
|
+
}
|
|
4642
|
+
async completeWithOpenAICompatible(request) {
|
|
4643
|
+
if (this.authMode !== "bedrock-api-key") {
|
|
4644
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4645
|
+
"Bedrock OpenAI-compatible modes require authMode bedrock-api-key and bedrock.apiKey.",
|
|
4646
|
+
"auth_failed",
|
|
4647
|
+
0,
|
|
4648
|
+
false
|
|
4649
|
+
);
|
|
4650
|
+
}
|
|
4651
|
+
if (!this.apiKey) {
|
|
4652
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4653
|
+
"Bedrock API key is missing. Set bedrock.apiKey for OpenAI-compatible Bedrock modes.",
|
|
4654
|
+
"auth_failed",
|
|
4655
|
+
0,
|
|
4656
|
+
false
|
|
4657
|
+
);
|
|
4658
|
+
}
|
|
4659
|
+
if (this.apiMode === "openai-chat") {
|
|
4660
|
+
return this.completeWithOpenAIChat(request);
|
|
4661
|
+
}
|
|
4662
|
+
return this.completeWithOpenAIResponses(request);
|
|
4663
|
+
}
|
|
4664
|
+
async completeWithOpenAIChat(request) {
|
|
4665
|
+
const body = {
|
|
4666
|
+
model: _nullishCoalesce(request.model, () => ( this.model)),
|
|
4667
|
+
messages: request.messages.map(toOpenAIMessage),
|
|
4668
|
+
...request.temperature !== void 0 && { temperature: request.temperature },
|
|
4669
|
+
...request.maxTokens !== void 0 && { max_tokens: request.maxTokens }
|
|
4670
|
+
};
|
|
4671
|
+
if (_optionalChain([request, 'access', _257 => _257.tools, 'optionalAccess', _258 => _258.length])) {
|
|
4672
|
+
body.tools = toOpenAITools(request.tools);
|
|
4673
|
+
if (request.toolChoice) body.tool_choice = request.toolChoice;
|
|
4674
|
+
}
|
|
4675
|
+
const data = await this.fetchJson("/chat/completions", body, request.signal);
|
|
4676
|
+
const choice = _optionalChain([data, 'access', _259 => _259.choices, 'optionalAccess', _260 => _260[0]]);
|
|
4677
|
+
if (!_optionalChain([choice, 'optionalAccess', _261 => _261.message])) {
|
|
4678
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4679
|
+
"Malformed Bedrock OpenAI chat response: missing choice message.",
|
|
4680
|
+
"invalid_request",
|
|
4681
|
+
200,
|
|
4682
|
+
false,
|
|
4683
|
+
void 0,
|
|
4684
|
+
JSON.stringify(data)
|
|
4685
|
+
);
|
|
4686
|
+
}
|
|
4687
|
+
return {
|
|
4688
|
+
id: _nullishCoalesce(data.id, () => ( `bedrock-chat-${Date.now()}`)),
|
|
4689
|
+
created: _nullishCoalesce(data.created, () => ( Math.floor(Date.now() / 1e3))),
|
|
4690
|
+
content: _nullishCoalesce(choice.message.content, () => ( "")),
|
|
4691
|
+
..._optionalChain([choice, 'access', _262 => _262.message, 'access', _263 => _263.tool_calls, 'optionalAccess', _264 => _264.length]) && { toolCalls: choice.message.tool_calls },
|
|
4692
|
+
finishReason: normalizeStopReason(choice.finish_reason),
|
|
4693
|
+
usage: _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, data.usage),
|
|
4694
|
+
raw: data
|
|
4695
|
+
};
|
|
4696
|
+
}
|
|
4697
|
+
async completeWithOpenAIResponses(request) {
|
|
4698
|
+
const instructions = request.messages.filter((message) => message.role === "system").map((message) => message.content).join("\n\n");
|
|
4699
|
+
const body = {
|
|
4700
|
+
model: _nullishCoalesce(request.model, () => ( this.model)),
|
|
4701
|
+
input: request.messages.flatMap(toResponsesInputItem),
|
|
4702
|
+
...instructions && { instructions },
|
|
4703
|
+
...request.maxTokens !== void 0 && { max_output_tokens: request.maxTokens }
|
|
4704
|
+
};
|
|
4705
|
+
if (_optionalChain([request, 'access', _265 => _265.tools, 'optionalAccess', _266 => _266.length])) {
|
|
4706
|
+
body.tools = toResponsesTools(request.tools);
|
|
4707
|
+
if (request.toolChoice) body.tool_choice = request.toolChoice;
|
|
4708
|
+
}
|
|
4709
|
+
const data = await this.fetchJson("/responses", body, request.signal);
|
|
4710
|
+
const functionCalls = (_nullishCoalesce(data.output, () => ( []))).filter(
|
|
4711
|
+
(item) => item.type === "function_call" && typeof item.name === "string" && typeof item.arguments === "string"
|
|
4712
|
+
).map((item) => ({
|
|
4713
|
+
id: _nullishCoalesce(_nullishCoalesce(item.call_id, () => ( item.id)), () => ( `call_${Date.now()}`)),
|
|
4714
|
+
type: "function",
|
|
4715
|
+
function: {
|
|
4716
|
+
name: item.name,
|
|
4717
|
+
arguments: item.arguments
|
|
4718
|
+
}
|
|
4719
|
+
}));
|
|
4720
|
+
return {
|
|
4721
|
+
id: _nullishCoalesce(data.id, () => ( `bedrock-responses-${Date.now()}`)),
|
|
4722
|
+
created: _nullishCoalesce(data.created_at, () => ( Math.floor(Date.now() / 1e3))),
|
|
4723
|
+
content: _nullishCoalesce(data.output_text, () => ( "")),
|
|
4724
|
+
...functionCalls.length > 0 && { toolCalls: functionCalls },
|
|
4725
|
+
finishReason: functionCalls.length > 0 ? "tool_calls" : "stop",
|
|
4726
|
+
usage: _chunkY5BDE24Pcjs.normalizeLLMUsage.call(void 0, data.usage),
|
|
4727
|
+
raw: data
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4730
|
+
async fetchJson(path, body, signal) {
|
|
4731
|
+
let response;
|
|
4732
|
+
try {
|
|
4733
|
+
response = await fetch(`${this.endpoint}${path}`, {
|
|
4734
|
+
method: "POST",
|
|
4735
|
+
headers: {
|
|
4736
|
+
"Content-Type": "application/json",
|
|
4737
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4738
|
+
},
|
|
4739
|
+
body: JSON.stringify(body),
|
|
4740
|
+
signal
|
|
4741
|
+
});
|
|
4742
|
+
} catch (error) {
|
|
4743
|
+
const err = error;
|
|
4744
|
+
if (err.name === "AbortError" && _optionalChain([signal, 'optionalAccess', _267 => _267.aborted])) {
|
|
4745
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)("Request cancelled.", "cancelled", 0, false);
|
|
4746
|
+
}
|
|
4747
|
+
if (err.name === "AbortError") {
|
|
4748
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)("The Bedrock request timed out.", "timeout", 0, true);
|
|
4749
|
+
}
|
|
4750
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4751
|
+
"Unable to connect to the Bedrock OpenAI-compatible endpoint. Check region, endpoint, private networking, and proxy settings.",
|
|
4752
|
+
"network_error",
|
|
4753
|
+
0,
|
|
4754
|
+
true,
|
|
4755
|
+
void 0,
|
|
4756
|
+
err.message
|
|
4757
|
+
);
|
|
4758
|
+
}
|
|
4759
|
+
if (!response.ok) {
|
|
4760
|
+
const errorBody = await readErrorBody(response);
|
|
4761
|
+
const classified = _chunk3OF56EMAcjs.classifyApiError.call(void 0, response.status, errorBody, response.headers);
|
|
4762
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4763
|
+
`AWS Bedrock request failed.
|
|
4764
|
+
${classified.message}`,
|
|
4765
|
+
classified.code,
|
|
4766
|
+
classified.httpStatus,
|
|
4767
|
+
classified.retryable,
|
|
4768
|
+
classified.retryAfterMs,
|
|
4769
|
+
classified.rawDetail
|
|
4770
|
+
);
|
|
4771
|
+
}
|
|
4772
|
+
try {
|
|
4773
|
+
return await response.json();
|
|
4774
|
+
} catch (error) {
|
|
4775
|
+
throw new (0, _chunk3OF56EMAcjs.ApiError)(
|
|
4776
|
+
"Malformed Bedrock response: response body was not valid JSON.",
|
|
4777
|
+
"invalid_request",
|
|
4778
|
+
response.status,
|
|
4779
|
+
false,
|
|
4780
|
+
void 0,
|
|
4781
|
+
error instanceof Error ? error.message : String(error)
|
|
4782
|
+
);
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
};
|
|
4786
|
+
|
|
4135
4787
|
// src/providers/ProviderFactory.ts
|
|
4136
4788
|
var ProviderNotConfiguredError = class extends Error {
|
|
4137
4789
|
constructor(providerName) {
|
|
@@ -4169,6 +4821,9 @@ var ProviderFactory = class {
|
|
|
4169
4821
|
*/
|
|
4170
4822
|
static create(config) {
|
|
4171
4823
|
const providerName = config.provider || "openrouter";
|
|
4824
|
+
if (providerName === "bedrock" && !_chunkHK5A54AVcjs.isAwsBedrockProviderEnabled.call(void 0, config)) {
|
|
4825
|
+
return new UnconfiguredProvider("bedrock");
|
|
4826
|
+
}
|
|
4172
4827
|
switch (providerName) {
|
|
4173
4828
|
case "ollama":
|
|
4174
4829
|
if (!config.ollama) {
|
|
@@ -4224,12 +4879,17 @@ var ProviderFactory = class {
|
|
|
4224
4879
|
if (!config.nvidia) {
|
|
4225
4880
|
return new UnconfiguredProvider("nvidia");
|
|
4226
4881
|
}
|
|
4227
|
-
return new (0,
|
|
4882
|
+
return new (0, _chunkY5BDE24Pcjs.NVIDIAProvider)(config.nvidia, config.network);
|
|
4228
4883
|
case "deepseek":
|
|
4229
4884
|
if (!config.deepseek) {
|
|
4230
4885
|
return new UnconfiguredProvider("deepseek");
|
|
4231
4886
|
}
|
|
4232
4887
|
return new DeepSeekProvider(config.deepseek, config.network);
|
|
4888
|
+
case "bedrock":
|
|
4889
|
+
if (!config.bedrock) {
|
|
4890
|
+
return new UnconfiguredProvider("bedrock");
|
|
4891
|
+
}
|
|
4892
|
+
return new BedrockProvider(config.bedrock);
|
|
4233
4893
|
case "openrouter":
|
|
4234
4894
|
default:
|
|
4235
4895
|
if (!config.openrouter) {
|
|
@@ -4242,8 +4902,11 @@ var ProviderFactory = class {
|
|
|
4242
4902
|
* Get all available provider names.
|
|
4243
4903
|
* MLX is only included on Apple Silicon (macOS + arm64).
|
|
4244
4904
|
*/
|
|
4245
|
-
static getProviderNames() {
|
|
4905
|
+
static getProviderNames(config) {
|
|
4246
4906
|
const providers = ["zai", "xai", "vertexai", "nvidia", "openrouter", "openai", "ollama", "llmgateway", "llamacpp", "deepseek", "cerebras", "azure"];
|
|
4907
|
+
if (_chunkHK5A54AVcjs.isAwsBedrockProviderEnabled.call(void 0, config)) {
|
|
4908
|
+
providers.splice(providers.indexOf("azure"), 0, "bedrock");
|
|
4909
|
+
}
|
|
4247
4910
|
if (isMLXSupported()) {
|
|
4248
4911
|
providers.push("mlx");
|
|
4249
4912
|
}
|
|
@@ -4254,8 +4917,11 @@ var ProviderFactory = class {
|
|
|
4254
4917
|
* Note: This checks if the name is a valid provider type, not if it's available on this platform.
|
|
4255
4918
|
* MLX is always a valid provider name, but may not be available on non-Apple Silicon systems.
|
|
4256
4919
|
*/
|
|
4257
|
-
static isValidProvider(name) {
|
|
4258
|
-
|
|
4920
|
+
static isValidProvider(name, config) {
|
|
4921
|
+
if (name === "bedrock" && !_chunkHK5A54AVcjs.isAwsBedrockProviderEnabled.call(void 0, config)) {
|
|
4922
|
+
return false;
|
|
4923
|
+
}
|
|
4924
|
+
const allProviders = ["openrouter", "ollama", "openai", "llamacpp", "mlx", "llmgateway", "azure", "zai", "vertexai", "xai", "cerebras", "nvidia", "deepseek", "bedrock"];
|
|
4259
4925
|
return allProviders.includes(name);
|
|
4260
4926
|
}
|
|
4261
4927
|
};
|
|
@@ -4279,7 +4945,12 @@ var ProviderFactory = class {
|
|
|
4279
4945
|
|
|
4280
4946
|
|
|
4281
4947
|
|
|
4282
|
-
|
|
4948
|
+
|
|
4949
|
+
|
|
4950
|
+
|
|
4951
|
+
|
|
4952
|
+
|
|
4953
|
+
exports.isChatGPTAuthExpired = isChatGPTAuthExpired; exports.authenticateOpenAIChatGPT = authenticateOpenAIChatGPT; exports.OPENAI_MODELS = OPENAI_MODELS; exports.getOpenRouterModelContextWindow = getOpenRouterModelContextWindow; exports.modelSupportsImages = modelSupportsImages; exports.ZAI_DEFAULT_BASE_URL = ZAI_DEFAULT_BASE_URL; exports.ZAI_MODELS = ZAI_MODELS; exports.isGcloudInstalled = isGcloudInstalled; exports.getGcloudProject = getGcloudProject; exports.getGcloudAccessToken = getGcloudAccessToken; exports.getGcloudAccount = getGcloudAccount; exports.VERTEX_AI_CODING_MODELS = VERTEX_AI_CODING_MODELS; exports.CEREBRAS_DEFAULT_BASE_URL = CEREBRAS_DEFAULT_BASE_URL; exports.CEREBRAS_MODELS = CEREBRAS_MODELS; exports.DEEPSEEK_DEFAULT_BASE_URL = DEEPSEEK_DEFAULT_BASE_URL; exports.DEEPSEEK_MODELS = DEEPSEEK_MODELS; exports.BEDROCK_DEFAULT_REGION = BEDROCK_DEFAULT_REGION; exports.BEDROCK_DEFAULT_MODEL = BEDROCK_DEFAULT_MODEL; exports.BEDROCK_MODELS = BEDROCK_MODELS; exports.resolveBedrockEndpoint = resolveBedrockEndpoint; exports.resolveBedrockAuthMode = resolveBedrockAuthMode; exports.ProviderNotConfiguredError = ProviderNotConfiguredError; exports.ProviderFactory = ProviderFactory;
|
|
4283
4954
|
/**
|
|
4284
4955
|
* @license
|
|
4285
4956
|
* Copyright 2025 Autohand AI LLC
|
|
@@ -4289,3 +4960,8 @@ exports.isChatGPTAuthExpired = isChatGPTAuthExpired; exports.authenticateOpenAIC
|
|
|
4289
4960
|
* Google Cloud CLI authentication utilities
|
|
4290
4961
|
* @license Apache-2.0
|
|
4291
4962
|
*/
|
|
4963
|
+
/**
|
|
4964
|
+
* @license
|
|
4965
|
+
* Copyright 2026 Autohand AI LLC
|
|
4966
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4967
|
+
*/
|