nolo-cli 0.149.0-alpha.1 → 0.151.0-alpha.3
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/{_executeModel-OW3H7ICR.js → _executeModel-T7ANHTUW.js} +134 -91
- package/accountResolver-7RYB4D2P.js +300 -0
- package/action-SXJD5N5R.js +23 -0
- package/{addContentAction-B2DRF7P6.js → addContentAction-ZV774PHH.js} +20 -14
- package/{addDialogAgentAction-2P2FLTLD.js → addDialogAgentAction-A6SMKAGH.js} +26 -22
- package/{agentDeleteCommand-7IDWF6E3.js → agentDeleteCommand-4L5KCKFY.js} +181 -93
- package/{agentEmailCommands-A6XBQZBN.js → agentEmailCommands-2IMMIRO2.js} +132 -112
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-TWFLUYIZ.js +802 -0
- package/{agentMachineCommands-DQPUIMAC.js → agentMachineCommands-KIWXWT6L.js} +58 -62
- package/{agentProviderCommands-YK2BIIXZ.js → agentProviderCommands-HL6MBLCL.js} +149 -2
- package/{agentPullCommand-HF4A42D4.js → agentPullCommand-FA43RBRU.js} +7 -7
- package/agentRecordCommands-727NPCRW.js +154 -0
- package/agentRunCommand-JASIG3FZ.js +183 -0
- package/{agentRunControl-2SKCR4SB.js → agentRunControl-IFM7IGMG.js} +10 -2
- package/{agentRuntimeLocal-AK2QVJHY.js → agentRuntimeLocal-KKSQJMTE.js} +47 -50
- package/{agentSlice-O4RUQUMT.js → agentSlice-SLV57QGU.js} +23 -16
- package/{appDeleteCommands-N3XEVVYC.js → appDeleteCommands-4PL4KYRN.js} +58 -59
- package/{appDeployCommands-AWFIXYVW.js → appDeployCommands-EEEXCEB6.js} +67 -63
- package/{appDeployStatusCommands-CZRON2FO.js → appDeployStatusCommands-35ZX7T66.js} +56 -56
- package/{appGetCommands-XQIUY4TD.js → appGetCommands-WFCHXJWF.js} +56 -56
- package/{appListCommands-NNG4H36Y.js → appListCommands-XY2U6DPF.js} +57 -59
- package/{authCommand-UBJ4EWYZ.js → authCommand-QYN47CQD.js} +371 -68
- package/{authCommands-H6WKKCRW.js → authCommands-77CHYBGF.js} +12 -9
- package/{builtinSkillRegistry-ZMF6YGNO.js → builtinSkillRegistry-TDQ6JB2E.js} +13 -11
- package/{chromeCommands-2N6MEWRU.js → chromeCommands-OBBNJCLS.js} +314 -13
- package/chromeOpsCommands-3Z34RKSE.js +472 -0
- package/{chunk-ALXHV7NK.js → chunk-2GGXHQIW.js} +43 -4
- package/{localRuntimeAuthority-5W6IJRAD.js → chunk-2IXDJNZI.js} +154 -75
- package/{chunk-IVZJWTDI.js → chunk-36OMEXXR.js} +89 -21
- package/{chunk-H6A6X4EK.js → chunk-3MZAGMYY.js} +16 -0
- package/chunk-3PVYUPXK.js +40 -0
- package/chunk-3SZA4U64.js +1192 -0
- package/{chunk-ID7LNBWR.js → chunk-3T4ZG6AC.js} +1920 -644
- package/{chunk-GNMAFAIS.js → chunk-44WXLHFI.js} +1 -1
- package/{chunk-AGGIDPCZ.js → chunk-4JH2UMJR.js} +6 -0
- package/chunk-4LCOCOR5.js +50 -0
- package/chunk-4YRTZIVN.js +871 -0
- package/{chunk-N7J63Q6C.js → chunk-56GBUMO5.js} +10 -1
- package/{chunk-W7XHHYWM.js → chunk-5BHQICF2.js} +5 -1
- package/{chunk-XUWRURDF.js → chunk-5EBLANFT.js} +1 -1
- package/{chunk-3AH7LNUB.js → chunk-5EMSBTQ6.js} +33 -14
- package/{chunk-YRRASA5Q.js → chunk-5MM7NNO6.js} +113 -52
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-TXH4IWJL.js → chunk-626KHJNX.js} +20 -11
- package/{chunk-M5PVFLD4.js → chunk-64K7WX26.js} +90 -21
- package/{chunk-AKG5W4LG.js → chunk-6CCFTVBP.js} +76 -221
- package/chunk-6MJNEXUU.js +614 -0
- package/{chunk-62IL3KQV.js → chunk-6MXDOUMH.js} +15 -3
- package/{chunk-QOKAKDPE.js → chunk-6Q7UTJKR.js} +6 -94
- package/chunk-6QDYSCPW.js +223 -0
- package/{chunk-HYZIYH2H.js → chunk-74RAWNQN.js} +56 -63
- package/chunk-7DPNBQSV.js +9 -0
- package/{chunk-IAESIMK7.js → chunk-A4MW3YZL.js} +10 -14
- package/{chunk-OMRJYNCI.js → chunk-AG7MCDLR.js} +26 -31
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-7CHC4W22.js → chunk-AIZE5TDM.js} +3 -3
- package/chunk-AJ3G7X2K.js +7012 -0
- package/{chunk-5GVBDNTO.js → chunk-AU7AXHUL.js} +1 -1
- package/{chunk-4H22P2JV.js → chunk-AUIJZACN.js} +2073 -1275
- package/{chunk-CIF4X6ZM.js → chunk-AWVFQMOV.js} +25 -3
- package/{chunk-YAQJJDC2.js → chunk-BJEZC5RA.js} +214 -51
- package/{chunk-RYZINGPM.js → chunk-BPMPOFWP.js} +347 -235
- package/{chunk-YUNJN43V.js → chunk-BU2YQBV4.js} +215 -28
- package/{chunk-XPRWFQQK.js → chunk-CBHGZRCE.js} +38 -12
- package/{chunk-Y3PMXGLH.js → chunk-CHCS6XPJ.js} +365 -144
- package/chunk-CHOZJMJS.js +78 -0
- package/chunk-CYJWI3NH.js +119 -0
- package/{chunk-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/{chunk-3SV7RM24.js → chunk-D2QN6CTI.js} +117 -72
- package/{chunk-TZZ2WRBL.js → chunk-DFDXM2Y4.js} +20 -16
- package/{chunk-5TEEECZM.js → chunk-E2AKSW7L.js} +10 -7
- package/{chunk-RSEEDUMS.js → chunk-EDX5XSJM.js} +2 -2
- package/{chunk-QDSINZM3.js → chunk-EUGTFFO6.js} +2 -23
- package/{chunk-UNYJU5L6.js → chunk-EYLGAEB4.js} +5 -1
- package/{chunk-CU3QB4HW.js → chunk-EYWJT7A2.js} +12 -12
- package/{chunk-BNGW5ASC.js → chunk-EZVK3N5L.js} +66 -18
- package/{chunk-6FGTMQCL.js → chunk-F32Z66T4.js} +6 -10
- package/{chunk-ZOVKKMF6.js → chunk-FY4SDK2E.js} +1 -1
- package/chunk-G6OOUQWJ.js +417 -0
- package/{chunk-PQWU42UQ.js → chunk-GCKHQECX.js} +6 -6
- package/chunk-GKXCHNTE.js +15 -0
- package/{chunk-P6GMCCAT.js → chunk-GQV5KHJU.js} +78 -12
- package/{chunk-B2XUQXQX.js → chunk-HIQ4GF53.js} +191 -68
- package/{chunk-GMZLP5DV.js → chunk-HNUWUO75.js} +30 -19
- package/{chunk-UASIEDKM.js → chunk-I2XLRXVX.js} +36 -31
- package/{chunk-5UTFL4QJ.js → chunk-I2ZMGXXF.js} +10 -5
- package/chunk-I42VC5KR.js +15 -0
- package/{chunk-3BXNTXYI.js → chunk-I4SN4NUQ.js} +1199 -56
- package/chunk-IA7TRNNR.js +11 -0
- package/{chunk-WIWM4FE3.js → chunk-IJERIUXS.js} +55 -748
- package/{chunk-BIDGLJQ3.js → chunk-IK2TSJQA.js} +45 -8
- package/{chunk-CPUFH46E.js → chunk-ILU2NPWY.js} +10 -10
- package/{chunk-SLLGJZDT.js → chunk-ISQL4V7C.js} +4 -4
- package/chunk-IT3ZZRJE.js +12 -0
- package/{chunk-DY7ANLKG.js → chunk-JKMLSTZK.js} +43 -12
- package/{chunk-6TPOEJMQ.js → chunk-JZX2XLKC.js} +64 -23
- package/{chunk-27ONFIEY.js → chunk-K2AER7RX.js} +19 -12
- package/{chunk-O2OWEFII.js → chunk-KFHQQ3NO.js} +1 -1
- package/{chunk-QXGPFY6J.js → chunk-LGN377P3.js} +27 -17
- package/{chunk-L36OWPP3.js → chunk-LIQJTQRN.js} +118 -139
- package/{chunk-BFU6C242.js → chunk-NMFV26UG.js} +1 -1
- package/{chunk-5J3PYNUP.js → chunk-NYYFIKHI.js} +17 -3
- package/{chunk-6O4IK4V2.js → chunk-OFFL4DCR.js} +1 -1
- package/{chunk-B6SAMB33.js → chunk-OWYYDMGJ.js} +209 -9
- package/{chunk-KQHGZWSV.js → chunk-OXME3PEE.js} +1 -1
- package/{chunk-CTUQJVQM.js → chunk-P5QACQDK.js} +1 -1
- package/{chunk-TB3MIBRC.js → chunk-PIDUNDFS.js} +572 -430
- package/{chunk-4JMDLJAD.js → chunk-PJNFNEJE.js} +114 -37
- package/chunk-PKZKOVA5.js +11507 -0
- package/{chunk-Z4CSIXYP.js → chunk-PLSVXHSA.js} +3 -3
- package/chunk-PWTNI4N7.js +47 -0
- package/chunk-QFEW2ULV.js +42 -0
- package/{chunk-RGNEEJ3Y.js → chunk-QLQ573SU.js} +35 -9
- package/chunk-QQ56R7KS.js +88 -0
- package/chunk-QYPE3TS3.js +43 -0
- package/{chunk-HTVYCXBP.js → chunk-RN2GPWN6.js} +354 -120
- package/{chunk-ATLTFRYJ.js → chunk-ROCUB2H2.js} +280 -98
- package/{chunk-4DPP773Q.js → chunk-RSHPU4PD.js} +59 -11
- package/chunk-RVWMAFIT.js +134 -0
- package/{chunk-ESHYE7WU.js → chunk-S73EPYNC.js} +10 -7
- package/{chunk-UQNS32WZ.js → chunk-SCMHQUMK.js} +1 -1
- package/chunk-SW4S4XYB.js +1794 -0
- package/{chunk-ZUEK6A6C.js → chunk-TTH4HOJD.js} +1973 -754
- package/chunk-TY3TIUJK.js +89 -0
- package/{chunk-X2QRZXZH.js → chunk-TYJ5XFEA.js} +4 -4
- package/{chunk-ALFH24P3.js → chunk-TYYRSFBG.js} +197 -155
- package/{chunk-MST6R3E4.js → chunk-U5GPBQDG.js} +34 -22
- package/chunk-U5ICMAFV.js +14110 -0
- package/{chunk-7KVZ5LDQ.js → chunk-UBUH2TCC.js} +18 -4
- package/chunk-UEILX4EV.js +15 -0
- package/chunk-UHTDNB5Y.js +140 -0
- package/{chunk-YYLHWIW6.js → chunk-UKZX3NHN.js} +1 -1
- package/{chunk-OHOVNO7I.js → chunk-UOKFKFPO.js} +6 -3
- package/{chunk-XISEYOGH.js → chunk-USHQX6VT.js} +5 -5
- package/chunk-UUPR3TD7.js +53 -0
- package/{chunk-3DAVPNFT.js → chunk-V4EE3D54.js} +122 -107
- package/{chunk-HDLLCBRF.js → chunk-VEA7H5FG.js} +2 -2
- package/chunk-VHGD6FHV.js +116 -0
- package/chunk-VIWDGTDA.js +8 -0
- package/{chunk-GOH6RW6F.js → chunk-VJXHL6MH.js} +34 -11
- package/{chunk-4XEYAFLY.js → chunk-VL5KOY2C.js} +623 -94
- package/{chunk-EADNWBAZ.js → chunk-VP3BINY7.js} +13 -0
- package/{chunk-DXHL7G2L.js → chunk-VWW6O2TL.js} +274 -93
- package/{chunk-EOARMOVD.js → chunk-W4S6OTSC.js} +6 -3
- package/chunk-WD4XYDYC.js +567 -0
- package/chunk-WJZOQR2J.js +151 -0
- package/{chunk-AUDNYVRC.js → chunk-XETG4RIX.js} +5 -5
- package/{chunk-MX574M24.js → chunk-XI7DGLUK.js} +4 -4
- package/{chunk-3L2WKC3W.js → chunk-XPWGOTBQ.js} +8 -1
- package/chunk-XRUSXPCQ.js +514 -0
- package/{chunk-I4OPU5TK.js → chunk-XS47QOFV.js} +273 -11
- package/{chunk-S5XGT6GB.js → chunk-XZNCX52W.js} +30 -9
- package/{chunk-5OA5HMTL.js → chunk-YLMMECCH.js} +1 -1
- package/{chunk-CFT5HBGW.js → chunk-YVLQXTUB.js} +448 -12
- package/chunk-YVPQATSC.js +709 -0
- package/chunk-ZEZC7IIM.js +126 -0
- package/{chunk-ALGORS6Y.js → chunk-ZF6526IQ.js} +43 -8
- package/chunk-ZIWPQEFU.js +165 -0
- package/chunk-ZRAU6T47.js +56 -0
- package/{cliExecutor-AWYR3T33.js → cliExecutor-BWBF2MTI.js} +4 -3
- package/{clipboardy-BX4NMYHE.js → clipboardy-GCO3GT3I.js} +3 -8
- package/{commandRegistry-2KBOXZQC.js → commandRegistry-NBLZEMCW.js} +183 -107
- package/contentThunks-6AIWNSGO.js +84 -0
- package/{cooldownCommands-ZLEPIB4A.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-5UGTB26P.js → createAgentAutomationAction-4BUS65DZ.js} +53 -44
- package/createDialogAction-QAIKSCG4.js +76 -0
- package/{createPageAction-CDLDKPRM.js → createPageAction-DXCZ334C.js} +65 -54
- package/cursorProvider-YGGNMVWX.js +6123 -0
- package/{db-VQSAOWAO.js → db-2QOTXYGH.js} +11 -5
- package/{dbSlice-DQ32LYTJ.js → dbSlice-J37OGIXH.js} +19 -13
- package/{deleteFile-NX6QHCWZ.js → deleteFile-6JWDDRVP.js} +10 -6
- package/dialogCommands-YZLSJB6X.js +113 -0
- package/{dialogSlice-N3YB65G5.js → dialogSlice-PVUSMKFW.js} +53 -39
- package/{docCreateCommands-ZSLGVBZT.js → docCreateCommands-JB2RRMRJ.js} +54 -57
- package/{docDeleteCommands-5N4GVZBG.js → docDeleteCommands-AQENULNM.js} +56 -58
- package/{docReadCommands-YJSAA7AV.js → docReadCommands-DYD25YLQ.js} +53 -56
- package/{docStore-E3CEOV5Q.js → docStore-CSEBEMKP.js} +25 -16
- package/{docUpdateCommands-WEMLSW6W.js → docUpdateCommands-3GVS23QL.js} +54 -57
- package/{fetchMessages-67MEFPZR.js → fetchMessages-IIJWQ3HR.js} +5 -4
- package/{getPricing-NMMFT3YI.js → getPricing-FKK3F5EJ.js} +11 -9
- package/{handleSendMessageAction-DQAD5ERJ.js → handleSendMessageAction-G2TLYGC4.js} +422 -118
- package/index.js +11 -7
- package/{lib-FRRS27KN.js → lib-4YTWAGY7.js} +581 -248
- package/{localDialogRead-EBRS242U.js → localDialogRead-FSOMOPDZ.js} +2 -2
- package/localRuntimeAdapter-B4TAYYA7.js +244 -0
- package/localRuntimeAuthority-JDAD7CB6.js +16 -0
- package/{localRuntimeDb-3LRMNLCM.js → localRuntimeDb-CVC62PM5.js} +1 -1
- package/{machineCommands-HAP75VSG.js → machineCommands-6OBFD3XF.js} +503 -161
- package/{machineInfo-66ZFUMLE.js → machineInfo-UKPTZO5Y.js} +2 -2
- package/machineWsRunDispatch-OO7N3O3Y.js +169 -0
- package/{memberThunks-5ZXPR63F.js → memberThunks-66DH6ABQ.js} +25 -18
- package/{models-ZPU5EDF4.js → models-LAS4B2B5.js} +2 -2
- package/package.json +1 -1
- package/{providerPresetApply-DD6NGWW6.js → providerPresetApply-MY66I6NT.js} +10 -10
- package/{providerRegistry-XDRLMYGJ.js → providerRegistry-QOE2FT57.js} +13 -9
- package/{read-EPTJRAEF.js → read-DC4NUGN6.js} +12 -8
- package/{readDocTool-W4NDXNEX.js → readDocTool-NCJ5NT25.js} +1 -1
- package/{readlineWorkspace-7BC66QSX.js → readlineWorkspace-UIQN7JUR.js} +5017 -915
- package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
- package/{runAgentClientLoop-6E6UC3CE.js → runAgentClientLoop-GS3SGG37.js} +154 -97
- package/{runtimeDoctorCommands-ID23PNNZ.js → runtimeDoctorCommands-GIOGC5SC.js} +17 -17
- package/secretCommands-ZXZRLR3R.js +700 -0
- package/setDialogExtraReferencesAction-SITRPMYU.js +37 -0
- package/{setPrimaryDialogAgentAction-WZ7KI3YA.js → setPrimaryDialogAgentAction-U7N45TGC.js} +30 -29
- package/{chunk-SONWNI3L.js → settingThunks-Y7SVJOMZ.js} +223 -928
- package/{skillDiscovery-ZBU76COE.js → skillDiscovery-QC35EQY4.js} +2 -2
- package/{slateUtils-RIZES3PV.js → slateUtils-NGV2NMKM.js} +1 -1
- package/{spaceCommands-UJOVU4XI.js → spaceCommands-ZR5BR3GX.js} +59 -59
- package/{streamAgentChatTurn-3UXPYFNX.js → streamAgentChatTurn-4XYC33KE.js} +309 -165
- package/{switchDialogAgentAction-GMR7WN3P.js → switchDialogAgentAction-OMGBD3N2.js} +26 -22
- package/{tableCommands-G7RV3RU3.js → tableCommands-U3QDY4L6.js} +19 -17
- package/{toolApiClient-CVGWM4PN.js → toolApiClient-7WSJJJBV.js} +6 -5
- package/tools-P77EE7Q4.js +124 -0
- package/tuiSummaryLlmCaller-BM3VSTBU.js +130 -0
- package/{updateCommands-4EHDLF5J.js → updateCommands-NQXAGFM7.js} +3 -3
- package/{updateDialogTitleAction-UPFV7TDT.js → updateDialogTitleAction-CIANVPZC.js} +102 -57
- package/workloadLifecycle-36DXRZKU.js +320 -0
- package/action-GI44T4DR.js +0 -31
- package/agentListCommands-IW3GQVUP.js +0 -427
- package/agentRecordCommands-VCA76W6B.js +0 -134
- package/agentRunCommand-YNLDKVR7.js +0 -161
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-TJRMXMYA.js +0 -186
- package/chromeOpsCommands-IXRLN57H.js +0 -289
- package/chunk-36KZDDO5.js +0 -2415
- package/chunk-ACQD6YI2.js +0 -25363
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-CYSYR67N.js +0 -93
- package/chunk-JBTJAPUF.js +0 -35
- package/chunk-K2CSUCHJ.js +0 -620
- package/chunk-LTRXGFMS.js +0 -83
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-OCZKATRC.js +0 -129
- package/chunk-OTGFTBLI.js +0 -13
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-PZZTFEKK.js +0 -34
- package/chunk-URMS4XY2.js +0 -10
- package/chunk-UV6VISQJ.js +0 -20
- package/chunk-VJVNU77E.js +0 -83
- package/chunk-XYJSY4KG.js +0 -13807
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/contentThunks-BDIQRZR6.js +0 -73
- package/createDialogAction-B7VGVEVU.js +0 -66
- package/dialogCommands-G7YBVAMC.js +0 -102
- package/levelLazyShim-GZBKODGI.js +0 -7
- package/machineWsRunDispatch-L32G7C4P.js +0 -149
- package/serverStoreFactory-YMXDF4NI.js +0 -20
- package/setDialogExtraReferencesAction-M32UYNCG.js +0 -30
- package/settingSlice-Q6EKL7EQ.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-MKYDMWA4.js +0 -111
- package/tuiSummaryLlmCaller-3YFNHCTW.js +0 -128
- package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
- package/{chunk-2SYTUTLI.js → chunk-YBNHPX4S.js} +3 -3
- package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getModelConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I4SN4NUQ.js";
|
|
4
4
|
import {
|
|
5
5
|
isPlatformHostedDeepseekModel,
|
|
6
6
|
isPlatformHostedOpenAIImageModel,
|
|
7
7
|
resolvePlatformHostedRouting
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CHCS6XPJ.js";
|
|
9
9
|
import {
|
|
10
10
|
asTrimmedLowercaseString
|
|
11
11
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -43,18 +43,23 @@ function isOpenAiResponsesModel(args) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
if (provider === "deepseek" || provider === "nolo" || provider === "ollama-cloud") {
|
|
46
|
+
const hostedRoute = resolvePlatformHostedRouting(args.model);
|
|
47
|
+
if (hostedRoute) return hostedRoute.wire === "responses";
|
|
46
48
|
if (isPlatformHostedDeepseekModel(args.model)) return true;
|
|
47
49
|
if (isPlatformHostedOpenAIImageModel(args.model)) return true;
|
|
48
50
|
}
|
|
49
51
|
return false;
|
|
50
52
|
}
|
|
53
|
+
var PLATFORM_HOSTED_RESPONSES_GATEWAY_MARKER = "nolo-platform-gateway://responses";
|
|
54
|
+
var PLATFORM_HOSTED_CHAT_GATEWAY_MARKER = "nolo-platform-gateway://chat";
|
|
55
|
+
var CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER = "{account}";
|
|
51
56
|
function resolvePlatformResponsesEndpoint(provider, model) {
|
|
52
57
|
const normalized = asTrimmedLowercaseString(provider);
|
|
53
58
|
if (normalized === "openai") return OPENAI_RESPONSES_ENDPOINT;
|
|
54
59
|
if (normalized === "deepseek" || normalized === "nolo" || normalized === "ollama-cloud") {
|
|
55
60
|
const route = resolvePlatformHostedRouting(model);
|
|
56
61
|
if (route && route.wire === "responses") {
|
|
57
|
-
return route.endpoint;
|
|
62
|
+
return route.endpoint.includes(CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER) ? PLATFORM_HOSTED_RESPONSES_GATEWAY_MARKER : route.endpoint;
|
|
58
63
|
}
|
|
59
64
|
if (!model || isPlatformHostedDeepseekModel(model)) {
|
|
60
65
|
return DEEPSEEK_RESPONSES_ENDPOINT;
|
|
@@ -72,13 +77,21 @@ function resolvePlatformChatCompletionsEndpoint(provider, model) {
|
|
|
72
77
|
const aliased = PLATFORM_PROVIDER_ENDPOINT_ALIASES[key] ?? key;
|
|
73
78
|
if (aliased === "nolo") {
|
|
74
79
|
const route = resolvePlatformHostedRouting(model);
|
|
75
|
-
if (route && route.wire
|
|
80
|
+
if (route && route.wire === "chat.completions") {
|
|
76
81
|
return route.endpoint;
|
|
77
82
|
}
|
|
78
83
|
return void 0;
|
|
79
84
|
}
|
|
80
85
|
return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[aliased];
|
|
81
86
|
}
|
|
87
|
+
function resolvePlatformProxyChatGatewayEndpoint(provider, model) {
|
|
88
|
+
const key = asTrimmedLowercaseString(provider);
|
|
89
|
+
if (!key) return void 0;
|
|
90
|
+
const aliased = PLATFORM_PROVIDER_ENDPOINT_ALIASES[key] ?? key;
|
|
91
|
+
if (aliased !== "nolo") return void 0;
|
|
92
|
+
const route = resolvePlatformHostedRouting(model);
|
|
93
|
+
return route?.wire === "anthropic.messages" && route.keyName === "cloudflare" ? PLATFORM_HOSTED_CHAT_GATEWAY_MARKER : void 0;
|
|
94
|
+
}
|
|
82
95
|
function resolvePlatformHostedCredentialProvider(provider, model) {
|
|
83
96
|
const key = asTrimmedLowercaseString(provider);
|
|
84
97
|
if (!key) return void 0;
|
|
@@ -91,5 +104,6 @@ export {
|
|
|
91
104
|
isOpenAiResponsesModel,
|
|
92
105
|
resolvePlatformResponsesEndpoint,
|
|
93
106
|
resolvePlatformChatCompletionsEndpoint,
|
|
107
|
+
resolvePlatformProxyChatGatewayEndpoint,
|
|
94
108
|
resolvePlatformHostedCredentialProvider
|
|
95
109
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// packages/core/fnv1a32.ts
|
|
2
|
+
var fnv1a32 = (str) => {
|
|
3
|
+
let hash = 2166136261;
|
|
4
|
+
for (let i = 0; i < str.length; i++) {
|
|
5
|
+
hash ^= str.charCodeAt(i);
|
|
6
|
+
hash = hash * 16777619 >>> 0;
|
|
7
|
+
}
|
|
8
|
+
return hash >>> 0;
|
|
9
|
+
};
|
|
10
|
+
var fnv1a32Hex = (str) => fnv1a32(str).toString(16).padStart(8, "0");
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
fnv1a32,
|
|
14
|
+
fnv1a32Hex
|
|
15
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asTrimmedString
|
|
3
|
+
} from "./chunk-3EUW3WEO.js";
|
|
4
|
+
import {
|
|
5
|
+
getCredentialsDir,
|
|
6
|
+
getLegacyCredentialPath,
|
|
7
|
+
migrateLegacyCredentialFile
|
|
8
|
+
} from "./chunk-ZWQUWF6W.js";
|
|
9
|
+
|
|
10
|
+
// packages/agent-runtime/fileCredentialBroker.ts
|
|
11
|
+
import {
|
|
12
|
+
chmodSync,
|
|
13
|
+
existsSync,
|
|
14
|
+
mkdirSync,
|
|
15
|
+
readFileSync,
|
|
16
|
+
unlinkSync,
|
|
17
|
+
writeFileSync
|
|
18
|
+
} from "node:fs";
|
|
19
|
+
import { homedir } from "node:os";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
// packages/agent-runtime/credentialBroker.ts
|
|
23
|
+
function assertCredentialRef(ref) {
|
|
24
|
+
const trimmed = asTrimmedString(ref);
|
|
25
|
+
if (!trimmed) {
|
|
26
|
+
throw new Error("invalid_ref");
|
|
27
|
+
}
|
|
28
|
+
if (trimmed.includes("..") || trimmed.includes("/") || trimmed.includes("\\")) {
|
|
29
|
+
throw new Error("invalid_ref");
|
|
30
|
+
}
|
|
31
|
+
return trimmed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// packages/agent-runtime/fileCredentialBroker.ts
|
|
35
|
+
function getApiKeyCredentialsDir(homeDir) {
|
|
36
|
+
return join(getCredentialsDir(homeDir), "keys");
|
|
37
|
+
}
|
|
38
|
+
function credentialRefToFileName(ref) {
|
|
39
|
+
const safe = assertCredentialRef(ref).replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
40
|
+
if (!safe || safe === "." || safe === "..") {
|
|
41
|
+
throw new Error(`Credential ref is not filesystem-safe: ${ref}`);
|
|
42
|
+
}
|
|
43
|
+
return `${safe}.json`;
|
|
44
|
+
}
|
|
45
|
+
function getApiKeyCredentialPath(ref, homeDir) {
|
|
46
|
+
return join(getApiKeyCredentialsDir(homeDir), credentialRefToFileName(ref));
|
|
47
|
+
}
|
|
48
|
+
function ensurePrivateDir(dir) {
|
|
49
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
50
|
+
try {
|
|
51
|
+
chmodSync(dir, 448);
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function writePrivateFile(path, body) {
|
|
56
|
+
writeFileSync(path, body, { encoding: "utf8", mode: 384 });
|
|
57
|
+
try {
|
|
58
|
+
chmodSync(path, 384);
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function migrateApiKeyCredentialIfNeeded(ref, homeDir, migration) {
|
|
63
|
+
if (homeDir !== void 0 || !migration?.enableLegacyMigration) return;
|
|
64
|
+
const legacyHomeDir = migration.legacyHomeDir ?? homedir();
|
|
65
|
+
const relativePath = join("keys", credentialRefToFileName(ref));
|
|
66
|
+
migrateLegacyCredentialFile({
|
|
67
|
+
canonicalPath: getApiKeyCredentialPath(ref),
|
|
68
|
+
legacyPath: getLegacyCredentialPath(relativePath, legacyHomeDir),
|
|
69
|
+
mode: migration.mode ?? (migration.legacyHomeDir ? "test" : "production"),
|
|
70
|
+
isValid: (raw) => {
|
|
71
|
+
try {
|
|
72
|
+
const parsed = JSON.parse(raw);
|
|
73
|
+
return typeof parsed?.secret === "string" && Boolean(parsed.secret);
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function readApiKeyCredential(ref, homeDir, migration) {
|
|
81
|
+
migrateApiKeyCredentialIfNeeded(ref, homeDir, migration);
|
|
82
|
+
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
83
|
+
if (!existsSync(path)) return null;
|
|
84
|
+
try {
|
|
85
|
+
const raw = readFileSync(path, "utf8");
|
|
86
|
+
const parsed = JSON.parse(raw);
|
|
87
|
+
if (typeof parsed?.secret !== "string" || !parsed.secret) return null;
|
|
88
|
+
return parsed.secret;
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function writeApiKeyCredential(ref, secret, homeDir, now = Date.now()) {
|
|
94
|
+
const trimmedSecret = secret.trim();
|
|
95
|
+
if (!trimmedSecret) {
|
|
96
|
+
throw new Error("Cannot store an empty credential secret.");
|
|
97
|
+
}
|
|
98
|
+
assertCredentialRef(ref);
|
|
99
|
+
const dir = getApiKeyCredentialsDir(homeDir);
|
|
100
|
+
ensurePrivateDir(dir);
|
|
101
|
+
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
102
|
+
const payload = {
|
|
103
|
+
secret: trimmedSecret,
|
|
104
|
+
updatedAt: now
|
|
105
|
+
};
|
|
106
|
+
writePrivateFile(path, `${JSON.stringify(payload, null, 2)}
|
|
107
|
+
`);
|
|
108
|
+
}
|
|
109
|
+
function removeApiKeyCredential(ref, homeDir) {
|
|
110
|
+
assertCredentialRef(ref);
|
|
111
|
+
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
112
|
+
if (!existsSync(path)) return;
|
|
113
|
+
unlinkSync(path);
|
|
114
|
+
}
|
|
115
|
+
function hasApiKeyCredential(ref, homeDir, migration) {
|
|
116
|
+
return readApiKeyCredential(ref, homeDir, migration) !== null;
|
|
117
|
+
}
|
|
118
|
+
function createFileCredentialBroker(options = {}) {
|
|
119
|
+
const homeDir = options.homeDir;
|
|
120
|
+
const migration = options.migration;
|
|
121
|
+
const now = options.now ?? Date.now;
|
|
122
|
+
return {
|
|
123
|
+
get(ref) {
|
|
124
|
+
return readApiKeyCredential(ref, homeDir, migration);
|
|
125
|
+
},
|
|
126
|
+
put(ref, secret) {
|
|
127
|
+
writeApiKeyCredential(ref, secret, homeDir, now());
|
|
128
|
+
},
|
|
129
|
+
delete(ref) {
|
|
130
|
+
removeApiKeyCredential(ref, homeDir);
|
|
131
|
+
},
|
|
132
|
+
has(ref) {
|
|
133
|
+
return hasApiKeyCredential(ref, homeDir, migration);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export {
|
|
139
|
+
createFileCredentialBroker
|
|
140
|
+
};
|
|
@@ -35,7 +35,7 @@ var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0
|
|
|
35
35
|
function isRemoteCustomEndpoint(url) {
|
|
36
36
|
if (typeof url !== "string") return false;
|
|
37
37
|
try {
|
|
38
|
-
const host = new URL(url).hostname.toLowerCase();
|
|
38
|
+
const host = new URL(url).hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
39
39
|
return !LOCAL_HOSTS.has(host);
|
|
40
40
|
} catch {
|
|
41
41
|
return false;
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-5ZUL4CUO.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveAgentImageInputSupport
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GCKHQECX.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelContextWindow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BPMPOFWP.js";
|
|
10
10
|
import {
|
|
11
11
|
asOptionalFiniteNumber
|
|
12
12
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -80,7 +80,9 @@ var devinChannelContextWindow = (model) => {
|
|
|
80
80
|
if (!raw) return void 0;
|
|
81
81
|
return DEVIN_CHANNEL_CONTEXT_WINDOWS[raw];
|
|
82
82
|
};
|
|
83
|
-
var resolveAgentContextWindow = (agent) => (isDevinOAuthAgent(agent) ? devinChannelContextWindow(agent.model) : void 0) ??
|
|
83
|
+
var resolveAgentContextWindow = (agent) => (isDevinOAuthAgent(agent) ? devinChannelContextWindow(agent.model) : void 0) ?? // provider 透传给全局解析:平台托管通道(CF)与 Codex OAuth 等通道对同一 id
|
|
84
|
+
// 窗口不同,按通道取真值,不做全局取大/取小。
|
|
85
|
+
getModelContextWindow(agent.model ?? "", agent.provider);
|
|
84
86
|
|
|
85
87
|
// packages/agent-runtime/agentRecordConfig.ts
|
|
86
88
|
function stringField(record, key) {
|
|
@@ -450,6 +452,7 @@ export {
|
|
|
450
452
|
hasImageInRuntimeMessages,
|
|
451
453
|
stripImagePartsFromMessages,
|
|
452
454
|
stripImagePartsForTextOnlyAgent,
|
|
455
|
+
devinChannelContextWindow,
|
|
453
456
|
resolveAgentContextWindow,
|
|
454
457
|
resolveAgentRuntimeConfigFromRecord,
|
|
455
458
|
buildDesktopAgentRuntimeAgentConfigSnapshot,
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
deleteDbRecord,
|
|
3
3
|
queryUserRecords,
|
|
4
4
|
readDbRecord
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZF6526IQ.js";
|
|
6
6
|
import {
|
|
7
7
|
mergeAndDedupUserData
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OXME3PEE.js";
|
|
9
|
+
import {
|
|
10
|
+
isTombstoneRecord
|
|
11
|
+
} from "./chunk-D2MDMY2M.js";
|
|
9
12
|
import {
|
|
10
13
|
toErrorMessage
|
|
11
14
|
} from "./chunk-HNMXYYJR.js";
|
|
12
|
-
import {
|
|
13
|
-
isTombstoneRecord
|
|
14
|
-
} from "./chunk-GBRG75BQ.js";
|
|
15
15
|
|
|
16
16
|
// packages/cli/globalRecordOperations.ts
|
|
17
17
|
async function listUserRecordsFromServers(args) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildAgentRuntimeAgentLookupKeys,
|
|
3
|
+
shouldFetchAgentRuntimeRecordRemotely
|
|
4
|
+
} from "./chunk-QLQ573SU.js";
|
|
5
|
+
|
|
6
|
+
// packages/agent-runtime/oauthProviderRefs.ts
|
|
7
|
+
var OAUTH_PROVIDER_REFS = [
|
|
8
|
+
"chatgpt",
|
|
9
|
+
"xai",
|
|
10
|
+
"antigravity",
|
|
11
|
+
"claude",
|
|
12
|
+
"cursor",
|
|
13
|
+
"devin",
|
|
14
|
+
"workbuddy",
|
|
15
|
+
"workbuddy-ai"
|
|
16
|
+
];
|
|
17
|
+
var METERED_API_KEY_REF_PREFIX = "api-key:";
|
|
18
|
+
var normalizeRef = (ref) => typeof ref === "string" ? ref.trim().toLowerCase() : "";
|
|
19
|
+
var isKnownOAuthProviderRef = (ref) => OAUTH_PROVIDER_REFS.includes(normalizeRef(ref));
|
|
20
|
+
var isMeteredApiKeyRef = (ref) => {
|
|
21
|
+
const trimmed = typeof ref === "string" ? ref.trim() : "";
|
|
22
|
+
return trimmed.length > METERED_API_KEY_REF_PREFIX.length && trimmed.slice(0, METERED_API_KEY_REF_PREFIX.length).toLowerCase() === METERED_API_KEY_REF_PREFIX;
|
|
23
|
+
};
|
|
24
|
+
var OAUTH_PROVIDER_REF_LIST_COPY = OAUTH_PROVIDER_REFS.join(" / ");
|
|
25
|
+
function classifyAgentApiKeyRef(raw) {
|
|
26
|
+
const trimmed = typeof raw === "string" ? raw.trim() : "";
|
|
27
|
+
if (!trimmed) return { ok: true, kind: "empty" };
|
|
28
|
+
if (isKnownOAuthProviderRef(trimmed)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
kind: "oauth-provider",
|
|
32
|
+
provider: normalizeRef(trimmed)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (isMeteredApiKeyRef(trimmed)) return { ok: true, kind: "metered-api-key" };
|
|
36
|
+
return { ok: false, kind: "unsupported-oauth-provider", ref: trimmed };
|
|
37
|
+
}
|
|
38
|
+
function formatUnsupportedAgentApiKeyRefMessage(raw) {
|
|
39
|
+
const shown = typeof raw === "string" ? raw.trim() : "";
|
|
40
|
+
return `apiKeyRef "${shown}" \u4E0D\u662F\u53D7\u652F\u6301\u7684\u53D6\u503C\uFF0C\u8BB0\u5F55\u672A\u5199\u5165\u3002\u5408\u6CD5\u53D6\u503C\uFF1AOAuth provider ref\uFF08${OAUTH_PROVIDER_REF_LIST_COPY}\uFF09\uFF0C\u6216\u8BA1\u91CF/\u8BBE\u5907 broker ref\uFF08\u4EE5 "${METERED_API_KEY_REF_PREFIX}" \u5F00\u5934\uFF0C\u5982 ${METERED_API_KEY_REF_PREFIX}agent-...\uFF09\u3002\u6539\u6CD5\uFF1A\u628A apiKeyRef \u6539\u6210\u4E0A\u9762\u67D0\u4E2A\u53D7\u652F\u6301\u7684\u53D6\u503C\uFF0C\u6216\u6539\u7528 ${METERED_API_KEY_REF_PREFIX}<id>\uFF1B\u82E5\u8981\u7528\u81EA\u5E26 API key\uFF0C\u8BF7\u6E05\u7A7A apiKeyRef \u5E76\u586B\u5199 apiKey\u3002`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// packages/cli/client/localAgentRecords.ts
|
|
44
|
+
var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
|
|
45
|
+
var shouldReadAgentKeyRemotely = shouldFetchAgentRuntimeRecordRemotely;
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
OAUTH_PROVIDER_REFS,
|
|
49
|
+
classifyAgentApiKeyRef,
|
|
50
|
+
formatUnsupportedAgentApiKeyRefMessage,
|
|
51
|
+
buildLocalAgentLookupKeys,
|
|
52
|
+
shouldReadAgentKeyRemotely
|
|
53
|
+
};
|
|
@@ -1,21 +1,121 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toolRegistry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3T4ZG6AC.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
runtime_default
|
|
6
|
+
} from "./chunk-U5ICMAFV.js";
|
|
7
7
|
import {
|
|
8
8
|
canonicalizeToolNames
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5EBLANFT.js";
|
|
10
|
+
import {
|
|
11
|
+
isRecord
|
|
12
|
+
} from "./chunk-KUG52IAP.js";
|
|
10
13
|
import {
|
|
11
14
|
isNoloHostedProvider
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CHCS6XPJ.js";
|
|
13
16
|
import {
|
|
14
17
|
asTrimmedLowercaseString
|
|
15
18
|
} from "./chunk-QSJ3HFEF.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
// packages/ai/chat/inlineImageUrlsForCustomProvider.ts
|
|
21
|
+
var INLINE_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
|
|
22
|
+
var INLINE_IMAGE_TOTAL_MAX_BYTES = 20 * 1024 * 1024;
|
|
23
|
+
var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
|
|
24
|
+
var shouldInlineImageUrlsForAgent = (agentConfig) => {
|
|
25
|
+
const apiSource = agentConfig?.apiSource?.toLowerCase();
|
|
26
|
+
const provider = agentConfig?.provider?.toLowerCase();
|
|
27
|
+
const model = agentConfig?.model?.toLowerCase();
|
|
28
|
+
if (apiSource === "custom" || provider === "custom") return true;
|
|
29
|
+
if (isNoloHostedProvider(provider)) return true;
|
|
30
|
+
return provider === "openrouter" && model === "minimax/minimax-m3";
|
|
31
|
+
};
|
|
32
|
+
var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
|
|
33
|
+
var bytesToBase64 = (bytes) => {
|
|
34
|
+
const chunks = [];
|
|
35
|
+
for (let offset = 0; offset < bytes.length; offset += 32768) {
|
|
36
|
+
chunks.push(String.fromCharCode.apply(null, Array.from(bytes.subarray(offset, offset + 32768))));
|
|
37
|
+
}
|
|
38
|
+
return btoa(chunks.join(""));
|
|
39
|
+
};
|
|
40
|
+
var defaultFetchImage = async (url, signal, _maxBytes) => {
|
|
41
|
+
const response = await fetch(url, { signal });
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
error: `HTTP ${response.status}`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
mimeType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
52
|
+
bytes
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var cloneImagePartWithDataUrl = async (part, fetchImage, options, usedBytes) => {
|
|
56
|
+
const url = part?.image_url?.url;
|
|
57
|
+
if (typeof url !== "string" || !isInlineCandidate(url) || options.isAllowedImageUrl && !options.isAllowedImageUrl(url)) return part;
|
|
58
|
+
if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
59
|
+
const remaining = options.maxTotalBytes === void 0 ? void 0 : options.maxTotalBytes - usedBytes.value;
|
|
60
|
+
const fetchLimit = options.maxBytes === void 0 ? remaining : remaining === void 0 ? options.maxBytes : Math.min(options.maxBytes, remaining);
|
|
61
|
+
const result = await fetchImage(url, options.signal, fetchLimit);
|
|
62
|
+
if (options.signal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
63
|
+
if (result.skippedSize !== void 0) {
|
|
64
|
+
const reason = options.maxBytes !== void 0 && result.skippedSize > options.maxBytes ? "per-image" : "total-budget";
|
|
65
|
+
options.onSkipTooLarge?.(url, result.skippedSize, reason);
|
|
66
|
+
return part;
|
|
67
|
+
}
|
|
68
|
+
if (!result.ok || !result.bytes) return part;
|
|
69
|
+
if (options.maxBytes !== void 0 && result.bytes.byteLength > options.maxBytes) {
|
|
70
|
+
options.onSkipTooLarge?.(url, result.bytes.byteLength, "per-image");
|
|
71
|
+
return part;
|
|
72
|
+
}
|
|
73
|
+
if (options.maxTotalBytes !== void 0 && usedBytes.value + result.bytes.byteLength > options.maxTotalBytes) {
|
|
74
|
+
options.onSkipTooLarge?.(url, result.bytes.byteLength, "total-budget");
|
|
75
|
+
return part;
|
|
76
|
+
}
|
|
77
|
+
usedBytes.value += result.bytes.byteLength;
|
|
78
|
+
const mimeType = (result.mimeType || "application/octet-stream").split(";")[0].trim() || "application/octet-stream";
|
|
79
|
+
return { ...part, image_url: { ...part.image_url, url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}` } };
|
|
80
|
+
};
|
|
81
|
+
var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
|
|
82
|
+
if (!options.shouldInline) return bodyData;
|
|
83
|
+
const body = bodyData;
|
|
84
|
+
if (!Array.isArray(body?.messages)) return bodyData;
|
|
85
|
+
const fetchImage = options.fetchImage ?? defaultFetchImage;
|
|
86
|
+
const fetched = /* @__PURE__ */ new Map();
|
|
87
|
+
const fetchOnce = (url, signal, maxBytes) => {
|
|
88
|
+
let result = fetched.get(url);
|
|
89
|
+
if (!result) {
|
|
90
|
+
result = fetchImage(url, signal, maxBytes);
|
|
91
|
+
fetched.set(url, result);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
const usedBytes = { value: 0 };
|
|
96
|
+
let changed = false;
|
|
97
|
+
const messages = [...body.messages];
|
|
98
|
+
for (let mi = messages.length - 1; mi >= 0; mi--) {
|
|
99
|
+
const message = messages[mi];
|
|
100
|
+
if (!Array.isArray(message?.content)) continue;
|
|
101
|
+
const content = [...message.content];
|
|
102
|
+
for (let pi = content.length - 1; pi >= 0; pi--) {
|
|
103
|
+
const part = content[pi];
|
|
104
|
+
if (part?.type !== "image_url") continue;
|
|
105
|
+
if (options.maxTotalBytes !== void 0 && usedBytes.value >= options.maxTotalBytes) {
|
|
106
|
+
if (typeof part?.image_url?.url === "string" && isInlineCandidate(part.image_url.url)) options.onSkipTooLarge?.(part.image_url.url, void 0, "total-budget");
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const cloned = await cloneImagePartWithDataUrl(part, fetchOnce, options, usedBytes);
|
|
110
|
+
if (cloned !== part) {
|
|
111
|
+
content[pi] = cloned;
|
|
112
|
+
changed = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (content.some((part, index) => part !== message.content[index])) messages[mi] = { ...message, content };
|
|
116
|
+
}
|
|
117
|
+
return changed ? { ...body, messages } : bodyData;
|
|
118
|
+
};
|
|
19
119
|
|
|
20
120
|
// packages/ai/tools/toolSchemaCompatibility.ts
|
|
21
121
|
var COMPOSITION_KEYS = ["anyOf", "oneOf", "allOf"];
|
|
@@ -63,12 +163,12 @@ var PREPARE_TOOLS_CACHE_LIMIT = 128;
|
|
|
63
163
|
var warnedUnknownToolNames = /* @__PURE__ */ new Set();
|
|
64
164
|
function getTranslation(keys, defaultVal) {
|
|
65
165
|
for (const key of keys) {
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
166
|
+
if (runtime_default.exists(key)) {
|
|
167
|
+
return runtime_default.t(key);
|
|
68
168
|
}
|
|
69
169
|
const aiKey = key.startsWith("ai:") ? key : `ai:${key}`;
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
170
|
+
if (runtime_default.exists(aiKey)) {
|
|
171
|
+
return runtime_default.t(aiKey);
|
|
72
172
|
}
|
|
73
173
|
}
|
|
74
174
|
return defaultVal;
|
|
@@ -115,7 +215,7 @@ function translateSchema(schema) {
|
|
|
115
215
|
return nextSchema;
|
|
116
216
|
}
|
|
117
217
|
function currentI18nLanguage() {
|
|
118
|
-
return typeof
|
|
218
|
+
return typeof runtime_default.language === "string" ? runtime_default.language : "";
|
|
119
219
|
}
|
|
120
220
|
function translateSchemaCached(schema) {
|
|
121
221
|
if (!schema || typeof schema !== "object") return schema;
|
|
@@ -128,10 +228,11 @@ function translateSchemaCached(schema) {
|
|
|
128
228
|
translatedFunctionCache.set(cacheKey, translated);
|
|
129
229
|
return translated;
|
|
130
230
|
}
|
|
131
|
-
function buildPrepareToolsCacheKey(toolNames, disabledToolNames, provider) {
|
|
231
|
+
function buildPrepareToolsCacheKey(toolNames, disabledToolNames, provider, selectableRuntimeCount) {
|
|
132
232
|
return [
|
|
133
233
|
currentI18nLanguage(),
|
|
134
234
|
provider ?? "",
|
|
235
|
+
selectableRuntimeCount !== void 0 ? String(selectableRuntimeCount) : "",
|
|
135
236
|
disabledToolNames.join(""),
|
|
136
237
|
toolNames.join("")
|
|
137
238
|
].join("\0");
|
|
@@ -148,13 +249,15 @@ function rememberPrepareToolsResult(key, value) {
|
|
|
148
249
|
var prepareTools = (toolNames, options) => {
|
|
149
250
|
const disabledList = canonicalizeToolNames(options?.disabledToolNames ?? []);
|
|
150
251
|
const disabledToolNames = new Set(disabledList);
|
|
151
|
-
const
|
|
152
|
-
|
|
252
|
+
const selectableCount = typeof options?.selectableRuntimeCount === "number" ? options.selectableRuntimeCount : typeof options?.runtimeCatalog?.selectableCount === "number" ? options.runtimeCatalog.selectableCount : void 0;
|
|
253
|
+
const canonicalNames = canonicalizeToolNames(toolNames).filter((toolName) => !disabledToolNames.has(toolName)).filter(
|
|
254
|
+
(toolName) => !(selectableCount !== void 0 && selectableCount <= 1 && toolName === "listRuntimes")
|
|
153
255
|
);
|
|
154
256
|
const cacheKey = buildPrepareToolsCacheKey(
|
|
155
257
|
canonicalNames,
|
|
156
258
|
disabledList,
|
|
157
|
-
options?.provider
|
|
259
|
+
options?.provider,
|
|
260
|
+
selectableCount
|
|
158
261
|
);
|
|
159
262
|
const cached = prepareToolsResultCache.get(cacheKey);
|
|
160
263
|
if (cached) {
|
|
@@ -180,96 +283,8 @@ var prepareTools = (toolNames, options) => {
|
|
|
180
283
|
return prepared.slice();
|
|
181
284
|
};
|
|
182
285
|
|
|
183
|
-
// packages/ai/chat/inlineImageUrlsForCustomProvider.ts
|
|
184
|
-
var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
|
|
185
|
-
var shouldInlineImageUrlsForAgent = (agentConfig) => {
|
|
186
|
-
const apiSource = agentConfig?.apiSource?.toLowerCase();
|
|
187
|
-
const provider = agentConfig?.provider?.toLowerCase();
|
|
188
|
-
const model = agentConfig?.model?.toLowerCase();
|
|
189
|
-
if (apiSource === "custom" || provider === "custom") return true;
|
|
190
|
-
if (isNoloHostedProvider(provider)) return true;
|
|
191
|
-
return provider === "openrouter" && model === "minimax/minimax-m3";
|
|
192
|
-
};
|
|
193
|
-
var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
|
|
194
|
-
var bytesToBase64 = (bytes) => {
|
|
195
|
-
let binary = "";
|
|
196
|
-
for (const byte of bytes) {
|
|
197
|
-
binary += String.fromCharCode(byte);
|
|
198
|
-
}
|
|
199
|
-
return btoa(binary);
|
|
200
|
-
};
|
|
201
|
-
var defaultFetchImage = async (url) => {
|
|
202
|
-
const response = await fetch(url);
|
|
203
|
-
if (!response.ok) {
|
|
204
|
-
return {
|
|
205
|
-
ok: false,
|
|
206
|
-
error: `HTTP ${response.status}`
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
210
|
-
return {
|
|
211
|
-
ok: true,
|
|
212
|
-
mimeType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
213
|
-
bytes
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
var cloneImagePartWithDataUrl = async (part, fetchImage, isAllowedImageUrl) => {
|
|
217
|
-
const url = part?.image_url?.url;
|
|
218
|
-
if (typeof url !== "string" || !isInlineCandidate(url) || isAllowedImageUrl && !isAllowedImageUrl(url)) {
|
|
219
|
-
return part;
|
|
220
|
-
}
|
|
221
|
-
const result = await fetchImage(url);
|
|
222
|
-
if (!result.ok || !result.bytes) return part;
|
|
223
|
-
const mimeType = result.mimeType || "application/octet-stream";
|
|
224
|
-
return {
|
|
225
|
-
...part,
|
|
226
|
-
image_url: {
|
|
227
|
-
...part.image_url,
|
|
228
|
-
url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
|
|
233
|
-
if (!options.shouldInline) return bodyData;
|
|
234
|
-
const body = bodyData;
|
|
235
|
-
if (!Array.isArray(body?.messages)) return bodyData;
|
|
236
|
-
const fetchImage = options.fetchImage ?? defaultFetchImage;
|
|
237
|
-
let changed = false;
|
|
238
|
-
const messages = [];
|
|
239
|
-
for (const message of body.messages) {
|
|
240
|
-
if (!Array.isArray(message?.content)) {
|
|
241
|
-
messages.push(message);
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
const content = await Promise.all(
|
|
245
|
-
message.content.map(async (part) => {
|
|
246
|
-
if (part?.type !== "image_url") return part;
|
|
247
|
-
return cloneImagePartWithDataUrl(
|
|
248
|
-
part,
|
|
249
|
-
fetchImage,
|
|
250
|
-
options.isAllowedImageUrl
|
|
251
|
-
);
|
|
252
|
-
})
|
|
253
|
-
);
|
|
254
|
-
let messageChanged = false;
|
|
255
|
-
for (let i = 0; i < content.length; i++) {
|
|
256
|
-
if (content[i] !== message.content[i]) {
|
|
257
|
-
changed = true;
|
|
258
|
-
messageChanged = true;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
messages.push(messageChanged ? { ...message, content } : message);
|
|
263
|
-
}
|
|
264
|
-
if (!changed) return bodyData;
|
|
265
|
-
return {
|
|
266
|
-
...body,
|
|
267
|
-
messages
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
|
|
271
286
|
export {
|
|
272
|
-
prepareTools,
|
|
273
287
|
shouldInlineImageUrlsForAgent,
|
|
274
|
-
inlineImageUrlsForCustomProvider
|
|
288
|
+
inlineImageUrlsForCustomProvider,
|
|
289
|
+
prepareTools
|
|
275
290
|
};
|
|
@@ -81,9 +81,9 @@ var buildSkillDiscoveryLayer = (skills, _boundFolder) => {
|
|
|
81
81
|
if (skills.length === 0) return null;
|
|
82
82
|
const lines = [
|
|
83
83
|
"--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
|
|
84
|
-
`\u5DE5\u4F5C\u533A\u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF0C\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u6309\u540D\u52A0\u8F7D\u6216 readFile \u76F4\u63A5\u8BFB\u53D6\uFF1A`,
|
|
84
|
+
`\u5DE5\u4F5C\u533A\u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF0C\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u6309\u540D\u52A0\u8F7D\u6216 readFile \u76F4\u63A5\u8BFB\u53D6\uFF08\u8DEF\u5F84\u89C4\u5219 .agents/skills/<name>/SKILL.md\uFF09\uFF1A`,
|
|
85
85
|
...skills.map(
|
|
86
|
-
(s) => `- ${s.name}: ${s.description}
|
|
86
|
+
(s) => `- ${s.name}: ${s.description}`
|
|
87
87
|
)
|
|
88
88
|
];
|
|
89
89
|
return makeLayer("skill-discovery", lines.join("\n"), "session");
|