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
package/chunk-OCZKATRC.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// packages/ai/chat/parseApiError.ts
|
|
2
|
-
var CONTEXT_OVERFLOW_ACTIONS = [
|
|
3
|
-
"compact-and-retry",
|
|
4
|
-
"new-dialog",
|
|
5
|
-
"switch-model",
|
|
6
|
-
"retry"
|
|
7
|
-
];
|
|
8
|
-
var CONTEXT_TOO_LARGE_ACTIONS = [
|
|
9
|
-
"new-dialog",
|
|
10
|
-
"switch-model",
|
|
11
|
-
"retry"
|
|
12
|
-
];
|
|
13
|
-
var truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
|
|
14
|
-
var isContextOverflowText = (message) => /maximum context|context (length|window|overflow|limit)|context_length_exceed\w*|requested about .*tokens|too many tokens|prompt is too long|exceeds? (the )?(model|max)/i.test(
|
|
15
|
-
message
|
|
16
|
-
);
|
|
17
|
-
function classifyApiError(input) {
|
|
18
|
-
const { status, message, body, code } = input;
|
|
19
|
-
const errorMessage = message;
|
|
20
|
-
let defaultMessage = `\u72B6\u6001\u7801 ${status} ${input.statusText ?? ""}`;
|
|
21
|
-
switch (status) {
|
|
22
|
-
case 400:
|
|
23
|
-
if (isContextOverflowText(errorMessage) || isContextOverflowText(body) || code === "UPSTREAM_400") {
|
|
24
|
-
return {
|
|
25
|
-
kind: "context_overflow",
|
|
26
|
-
message: "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002",
|
|
27
|
-
code,
|
|
28
|
-
status,
|
|
29
|
-
retryable: true,
|
|
30
|
-
actions: [...CONTEXT_OVERFLOW_ACTIONS]
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
if (code === "MISSING_PROVIDER_API_KEY") {
|
|
34
|
-
return {
|
|
35
|
-
kind: "generic",
|
|
36
|
-
message: truncateErrorMessage(errorMessage),
|
|
37
|
-
code,
|
|
38
|
-
status,
|
|
39
|
-
retryable: false
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (errorMessage && errorMessage !== defaultMessage) {
|
|
43
|
-
return {
|
|
44
|
-
kind: "generic",
|
|
45
|
-
message: `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`,
|
|
46
|
-
code,
|
|
47
|
-
status,
|
|
48
|
-
retryable: false
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return { kind: "generic", message: "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165", code, status, retryable: false };
|
|
52
|
-
case 413:
|
|
53
|
-
return {
|
|
54
|
-
kind: "context_too_large",
|
|
55
|
-
message: "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002",
|
|
56
|
-
code,
|
|
57
|
-
status,
|
|
58
|
-
retryable: true,
|
|
59
|
-
actions: [...CONTEXT_TOO_LARGE_ACTIONS]
|
|
60
|
-
};
|
|
61
|
-
case 401:
|
|
62
|
-
return {
|
|
63
|
-
kind: "auth",
|
|
64
|
-
message: code === "AUTH_TOKEN_EXPIRED" ? "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_ACCOUNT_INVALID" ? "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458" : code === "AUTH_NO_TOKEN" ? "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55" : code === "AUTH_INVALID_TOKEN" ? "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_TOKEN_NOT_ACTIVE" ? "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5" : errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55",
|
|
65
|
-
code,
|
|
66
|
-
status,
|
|
67
|
-
retryable: true,
|
|
68
|
-
actions: ["retry"]
|
|
69
|
-
};
|
|
70
|
-
case 503:
|
|
71
|
-
return {
|
|
72
|
-
kind: "server",
|
|
73
|
-
message: errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
|
|
74
|
-
code,
|
|
75
|
-
status,
|
|
76
|
-
retryable: true,
|
|
77
|
-
actions: ["retry"]
|
|
78
|
-
};
|
|
79
|
-
case 504:
|
|
80
|
-
return {
|
|
81
|
-
kind: "timeout",
|
|
82
|
-
message: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
|
|
83
|
-
code,
|
|
84
|
-
status,
|
|
85
|
-
retryable: true,
|
|
86
|
-
actions: ["retry"]
|
|
87
|
-
};
|
|
88
|
-
default:
|
|
89
|
-
return {
|
|
90
|
-
kind: "generic",
|
|
91
|
-
message: `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`,
|
|
92
|
-
code,
|
|
93
|
-
status,
|
|
94
|
-
retryable: true,
|
|
95
|
-
actions: ["retry"]
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async function parseApiErrorInfo(response) {
|
|
100
|
-
const errorBody = await response.text();
|
|
101
|
-
let errorMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
|
|
102
|
-
let errorCode = `E${response.status}`;
|
|
103
|
-
try {
|
|
104
|
-
const errorJson = JSON.parse(errorBody);
|
|
105
|
-
errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || errorMessage;
|
|
106
|
-
errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
|
|
107
|
-
} catch (_e) {
|
|
108
|
-
if (errorBody) {
|
|
109
|
-
errorMessage = errorBody;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return classifyApiError({
|
|
113
|
-
status: response.status,
|
|
114
|
-
statusText: response.statusText,
|
|
115
|
-
message: errorMessage,
|
|
116
|
-
body: errorBody,
|
|
117
|
-
code: errorCode
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
async function parseApiError(response) {
|
|
121
|
-
return (await parseApiErrorInfo(response)).message;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export {
|
|
125
|
-
CONTEXT_OVERFLOW_ACTIONS,
|
|
126
|
-
CONTEXT_TOO_LARGE_ACTIONS,
|
|
127
|
-
isContextOverflowText,
|
|
128
|
-
parseApiError
|
|
129
|
-
};
|
package/chunk-OTGFTBLI.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildAgentRuntimeAgentLookupKeys,
|
|
3
|
-
shouldFetchAgentRuntimeRecordRemotely
|
|
4
|
-
} from "./chunk-RGNEEJ3Y.js";
|
|
5
|
-
|
|
6
|
-
// packages/cli/client/localAgentRecords.ts
|
|
7
|
-
var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
|
|
8
|
-
var shouldReadAgentKeyRemotely = shouldFetchAgentRuntimeRecordRemotely;
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
buildLocalAgentLookupKeys,
|
|
12
|
-
shouldReadAgentKeyRemotely
|
|
13
|
-
};
|
package/chunk-PUOC4YRO.js
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
asTrimmedLowercaseString
|
|
3
|
-
} from "./chunk-QSJ3HFEF.js";
|
|
4
|
-
import {
|
|
5
|
-
isRecord
|
|
6
|
-
} from "./chunk-KUG52IAP.js";
|
|
7
|
-
import {
|
|
8
|
-
asOptionalTrimmedString
|
|
9
|
-
} from "./chunk-G3SUCT4W.js";
|
|
10
|
-
|
|
11
|
-
// packages/core/ollamaEndpoint.ts
|
|
12
|
-
function isOllamaEndpoint(endpoint) {
|
|
13
|
-
if (!endpoint || typeof endpoint !== "string") return false;
|
|
14
|
-
try {
|
|
15
|
-
const url = new URL(endpoint.includes("://") ? endpoint : `http://${endpoint}`);
|
|
16
|
-
if (url.port === "11434") return true;
|
|
17
|
-
const host = url.hostname.toLowerCase();
|
|
18
|
-
return host === "ollama.com" || host.endsWith(".ollama.com") || host === "ollama.ai" || host.endsWith(".ollama.ai");
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// packages/ai/llm/usageRequestOptions.ts
|
|
25
|
-
var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
|
|
26
|
-
"google",
|
|
27
|
-
"openrouter",
|
|
28
|
-
"xai",
|
|
29
|
-
"openai",
|
|
30
|
-
"fireworks",
|
|
31
|
-
"mistral",
|
|
32
|
-
"cloudflare",
|
|
33
|
-
"gmi",
|
|
34
|
-
// OpenAI-compatible hosted providers expose the terminal usage chunk when
|
|
35
|
-
// requested, including DeepInfra and Vultr. Keep this capability decision
|
|
36
|
-
// in the shared seam so proxy and local runtimes cannot drift.
|
|
37
|
-
"deepinfra",
|
|
38
|
-
"vultr",
|
|
39
|
-
// Explicit local-runtime providers with OpenAI-compatible streaming: both
|
|
40
|
-
// DeepSeek official and Ollama honor stream_options.include_usage on their
|
|
41
|
-
// chat.completions endpoints. Without them, locally-configured agents lose
|
|
42
|
-
// token statistics / local billing (the whitelist replaced the previous
|
|
43
|
-
// always-on include_usage). ollama-cloud is the Ollama Cloud subscription
|
|
44
|
-
// endpoint (https://ollama.com/v1), an OpenAI-compatible API that likewise
|
|
45
|
-
// honors stream_options.include_usage.
|
|
46
|
-
"deepseek",
|
|
47
|
-
"ollama",
|
|
48
|
-
"ollama-cloud",
|
|
49
|
-
// RunInfra hosted fallback channel: OpenAI-compatible chat.completions
|
|
50
|
-
// endpoint, supports stream_options.include_usage (measured to return
|
|
51
|
-
// prompt_tokens_details.cached_tokens).
|
|
52
|
-
"runinfra",
|
|
53
|
-
"baseten",
|
|
54
|
-
// Kimi For Coding subscription (api.kimi.com/coding/v1): OpenAI-compatible
|
|
55
|
-
// chat.completions streaming that only emits the terminal usage frame when
|
|
56
|
-
// stream_options.include_usage is requested (measured; the official
|
|
57
|
-
// kimi-code CLI also sends include_usage). Custom agents pointing at the
|
|
58
|
-
// same endpoint are covered by the endpoint check below, not here.
|
|
59
|
-
"kimi-code"
|
|
60
|
-
]);
|
|
61
|
-
var KIMI_CODE_ENDPOINT_MARKER = "api.kimi.com";
|
|
62
|
-
var isKimiCodeEndpoint = (endpoint) => typeof endpoint === "string" && endpoint.includes(KIMI_CODE_ENDPOINT_MARKER);
|
|
63
|
-
var EXTRA_USAGE_FIELD_PROVIDERS = /* @__PURE__ */ new Set(["openrouter"]);
|
|
64
|
-
var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerName);
|
|
65
|
-
var getUsageRequestOptions = (providerName, options) => {
|
|
66
|
-
const normalizedProvider = normalizeProviderName(providerName);
|
|
67
|
-
const api = options?.api ?? "chat-completions";
|
|
68
|
-
const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && (isKimiCodeEndpoint(options?.endpoint) || isOllamaEndpoint(options?.endpoint));
|
|
69
|
-
if (api === "responses") {
|
|
70
|
-
return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
71
|
-
usage: {
|
|
72
|
-
include: true
|
|
73
|
-
}
|
|
74
|
-
} : {};
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
...shouldRequestStreamUsage ? {
|
|
78
|
-
stream_options: {
|
|
79
|
-
include_usage: true
|
|
80
|
-
}
|
|
81
|
-
} : {},
|
|
82
|
-
...EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
83
|
-
usage: {
|
|
84
|
-
include: true
|
|
85
|
-
}
|
|
86
|
-
} : {}
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
91
|
-
function preserveAgentStateFields(source, target, options) {
|
|
92
|
-
const mutableTarget = target;
|
|
93
|
-
if (source.role === "assistant") {
|
|
94
|
-
if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
|
|
95
|
-
mutableTarget.reasoning_content = source.reasoning_content;
|
|
96
|
-
}
|
|
97
|
-
if (Array.isArray(source.tool_calls)) {
|
|
98
|
-
mutableTarget.tool_calls = source.tool_calls;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (source.role === "tool") {
|
|
102
|
-
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
103
|
-
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
104
|
-
}
|
|
105
|
-
return target;
|
|
106
|
-
}
|
|
107
|
-
function toOpenAiCompatibleMessages(messages, options) {
|
|
108
|
-
return messages.map(
|
|
109
|
-
(message) => preserveAgentStateFields(message, {
|
|
110
|
-
role: message.role,
|
|
111
|
-
content: message.content ?? ""
|
|
112
|
-
}, options)
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
function shouldStripReasoningContentForOutbound(provider, model) {
|
|
116
|
-
const p = provider?.trim().toLowerCase();
|
|
117
|
-
const m = model?.trim().toLowerCase();
|
|
118
|
-
if (!p || !m) return false;
|
|
119
|
-
if (p === "deepseek" || p === "nolo") {
|
|
120
|
-
return m === "deepseek-flash" || m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
|
|
121
|
-
}
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// packages/integrations/openai/responsesHelpers.ts
|
|
126
|
-
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
127
|
-
var sanitizeResponsesParameters = (parameters) => {
|
|
128
|
-
if (!isRecord(parameters)) {
|
|
129
|
-
return parameters;
|
|
130
|
-
}
|
|
131
|
-
const next = { ...parameters };
|
|
132
|
-
for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
|
|
133
|
-
delete next[key];
|
|
134
|
-
}
|
|
135
|
-
return next;
|
|
136
|
-
};
|
|
137
|
-
var appendTextPart = (parts, text, role) => {
|
|
138
|
-
if (!text) return;
|
|
139
|
-
const last = parts.at(-1);
|
|
140
|
-
const textType = role === "assistant" ? "output_text" : "input_text";
|
|
141
|
-
if (last?.type === textType) {
|
|
142
|
-
last.text += text;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
parts.push({ type: textType, text });
|
|
146
|
-
};
|
|
147
|
-
var normalizeMessageParts = (content, role) => {
|
|
148
|
-
if (typeof content === "string") {
|
|
149
|
-
if (!content) return [];
|
|
150
|
-
return [
|
|
151
|
-
{
|
|
152
|
-
type: role === "assistant" ? "output_text" : "input_text",
|
|
153
|
-
text: content
|
|
154
|
-
}
|
|
155
|
-
];
|
|
156
|
-
}
|
|
157
|
-
const parts = [];
|
|
158
|
-
for (const part of content ?? []) {
|
|
159
|
-
const typedPart = part;
|
|
160
|
-
if (typedPart?.type === "text" && typeof typedPart.text === "string") {
|
|
161
|
-
appendTextPart(parts, typedPart.text, role);
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
|
|
165
|
-
if (role === "assistant") continue;
|
|
166
|
-
parts.push({
|
|
167
|
-
type: "input_image",
|
|
168
|
-
image_url: typedPart.image_url.url,
|
|
169
|
-
detail: typedPart.image_url.detail
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return parts;
|
|
174
|
-
};
|
|
175
|
-
var normalizeToolOutput = (content) => {
|
|
176
|
-
if (typeof content === "string") return content;
|
|
177
|
-
return JSON.stringify(content ?? "");
|
|
178
|
-
};
|
|
179
|
-
var toResponsesTools = (tools) => {
|
|
180
|
-
if (!Array.isArray(tools) || tools.length === 0) return void 0;
|
|
181
|
-
const normalized = tools.map((tool) => {
|
|
182
|
-
const fn = tool?.function;
|
|
183
|
-
const name = fn?.name ?? tool?.name;
|
|
184
|
-
if (!name) return null;
|
|
185
|
-
const parameters = fn?.parameters ?? tool?.parameters;
|
|
186
|
-
return {
|
|
187
|
-
type: "function",
|
|
188
|
-
name,
|
|
189
|
-
...typeof (fn?.description ?? tool?.description) === "string" ? { description: fn?.description ?? tool?.description } : {},
|
|
190
|
-
parameters: sanitizeResponsesParameters(parameters),
|
|
191
|
-
...fn?.strict !== void 0 || tool?.strict !== void 0 ? { strict: fn?.strict ?? tool?.strict } : {}
|
|
192
|
-
};
|
|
193
|
-
}).filter(Boolean);
|
|
194
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
195
|
-
};
|
|
196
|
-
var convertMessagesToResponsesInput = (messages, options) => {
|
|
197
|
-
const input = [];
|
|
198
|
-
for (const message of messages) {
|
|
199
|
-
if (!message?.role) continue;
|
|
200
|
-
if (message.role === "tool") {
|
|
201
|
-
if (!message.tool_call_id) continue;
|
|
202
|
-
input.push({
|
|
203
|
-
type: "function_call_output",
|
|
204
|
-
call_id: message.tool_call_id,
|
|
205
|
-
output: normalizeToolOutput(message.content)
|
|
206
|
-
});
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
const role = message.role;
|
|
210
|
-
if (role === "assistant" && !options?.stripReasoningContent && typeof message.reasoning_content === "string" && message.reasoning_content) {
|
|
211
|
-
input.push({
|
|
212
|
-
type: "reasoning",
|
|
213
|
-
content: [
|
|
214
|
-
{ type: "reasoning_text", text: message.reasoning_content }
|
|
215
|
-
]
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
const contentParts = normalizeMessageParts(message.content, role);
|
|
219
|
-
if (contentParts.length > 0) {
|
|
220
|
-
input.push({
|
|
221
|
-
type: "message",
|
|
222
|
-
role,
|
|
223
|
-
content: contentParts
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
if (role === "assistant" && Array.isArray(message.content)) {
|
|
227
|
-
const replayImages = message.content.map((part) => part).filter(
|
|
228
|
-
(part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
|
|
229
|
-
).map((part) => ({
|
|
230
|
-
type: "input_image",
|
|
231
|
-
image_url: part.image_url.url,
|
|
232
|
-
detail: part.image_url.detail
|
|
233
|
-
}));
|
|
234
|
-
if (replayImages.length > 0) {
|
|
235
|
-
input.push({
|
|
236
|
-
type: "message",
|
|
237
|
-
role: "user",
|
|
238
|
-
content: replayImages
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
243
|
-
for (const toolCall of message.tool_calls) {
|
|
244
|
-
if (!toolCall?.id || !toolCall.function?.name) continue;
|
|
245
|
-
input.push({
|
|
246
|
-
type: "function_call",
|
|
247
|
-
call_id: toolCall.id,
|
|
248
|
-
name: toolCall.function.name,
|
|
249
|
-
arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return input;
|
|
255
|
-
};
|
|
256
|
-
var extractTextFromResponseOutput = (response) => {
|
|
257
|
-
const parts = [];
|
|
258
|
-
for (const item of response?.output ?? []) {
|
|
259
|
-
if (item?.type !== "message") continue;
|
|
260
|
-
for (const content of item.content ?? []) {
|
|
261
|
-
if (content?.type === "output_text" && typeof content.text === "string") {
|
|
262
|
-
parts.push(content.text);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return parts.join("");
|
|
267
|
-
};
|
|
268
|
-
var extractReasoningFromResponseOutput = (response) => {
|
|
269
|
-
const parts = [];
|
|
270
|
-
for (const item of response?.output ?? []) {
|
|
271
|
-
if (item?.type !== "reasoning") continue;
|
|
272
|
-
if (typeof item.content === "string") {
|
|
273
|
-
parts.push(item.content);
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
for (const content of item.content ?? []) {
|
|
277
|
-
if (typeof content === "string") parts.push(content);
|
|
278
|
-
else if (typeof content?.text === "string") parts.push(content.text);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return parts.join("");
|
|
282
|
-
};
|
|
283
|
-
var toDataUrl = (base64Data, mimeType) => {
|
|
284
|
-
const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
|
|
285
|
-
return `data:${normalizedMimeType};base64,${base64Data}`;
|
|
286
|
-
};
|
|
287
|
-
var extractImagePartsFromResponseOutput = (response) => {
|
|
288
|
-
const images = [];
|
|
289
|
-
for (const item of response?.output ?? []) {
|
|
290
|
-
if (item?.type === "image_generation_call") {
|
|
291
|
-
const result = asOptionalTrimmedString(item.result);
|
|
292
|
-
if (result) {
|
|
293
|
-
const outputFormat = asOptionalTrimmedString(item.output_format);
|
|
294
|
-
images.push({
|
|
295
|
-
type: "image_url",
|
|
296
|
-
image_url: {
|
|
297
|
-
url: toDataUrl(
|
|
298
|
-
result,
|
|
299
|
-
outputFormat ? `image/${outputFormat}` : void 0
|
|
300
|
-
)
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
if (item?.type !== "message") continue;
|
|
307
|
-
for (const content of item.content ?? []) {
|
|
308
|
-
const result = asOptionalTrimmedString(content?.result);
|
|
309
|
-
if (content?.type === "output_image" && result) {
|
|
310
|
-
images.push({
|
|
311
|
-
type: "image_url",
|
|
312
|
-
image_url: {
|
|
313
|
-
url: toDataUrl(
|
|
314
|
-
result,
|
|
315
|
-
content.mime_type ?? content.mimeType ?? null
|
|
316
|
-
)
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return images;
|
|
323
|
-
};
|
|
324
|
-
var extractToolCallsFromResponseOutput = (response) => {
|
|
325
|
-
const calls = [];
|
|
326
|
-
for (const item of response?.output ?? []) {
|
|
327
|
-
if (item?.type !== "function_call") continue;
|
|
328
|
-
if (!item.call_id || !item.name) continue;
|
|
329
|
-
calls.push({
|
|
330
|
-
id: item.call_id,
|
|
331
|
-
type: "function",
|
|
332
|
-
function: {
|
|
333
|
-
name: item.name,
|
|
334
|
-
arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
return calls;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
// packages/agent-runtime/promptCacheKey.ts
|
|
342
|
-
function collectStablePromptPrefix(messages, fallbackPrompt) {
|
|
343
|
-
const systemTexts = [];
|
|
344
|
-
if (fallbackPrompt?.trim()) systemTexts.push(fallbackPrompt.trim());
|
|
345
|
-
for (const raw of messages) {
|
|
346
|
-
if (!raw || typeof raw !== "object") continue;
|
|
347
|
-
const message = raw;
|
|
348
|
-
const role = String(message.role ?? "");
|
|
349
|
-
if (role !== "system" && role !== "developer") continue;
|
|
350
|
-
if (typeof message.content === "string") {
|
|
351
|
-
const boundary = Number(message.stable_prefix_chars);
|
|
352
|
-
const text = Number.isFinite(boundary) && boundary > 0 ? message.content.slice(0, boundary) : message.content;
|
|
353
|
-
if (text.trim()) systemTexts.push(text.trim());
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
return systemTexts.join("\n\n");
|
|
357
|
-
}
|
|
358
|
-
function stablePromptCacheKey(parts, namespace) {
|
|
359
|
-
const value = JSON.stringify(parts);
|
|
360
|
-
let hash = 2166136261;
|
|
361
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
362
|
-
hash ^= value.charCodeAt(index);
|
|
363
|
-
hash = Math.imul(hash, 16777619) >>> 0;
|
|
364
|
-
}
|
|
365
|
-
return `${namespace}-${hash.toString(16).padStart(8, "0")}`;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// packages/core/chat/imageParts.ts
|
|
369
|
-
function isImageUrlPart(part) {
|
|
370
|
-
return isRecord(part) && part.type === "image_url";
|
|
371
|
-
}
|
|
372
|
-
function hasImageParts(messages) {
|
|
373
|
-
return messages.some(
|
|
374
|
-
(message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
export {
|
|
379
|
-
isOllamaEndpoint,
|
|
380
|
-
getUsageRequestOptions,
|
|
381
|
-
isImageUrlPart,
|
|
382
|
-
hasImageParts,
|
|
383
|
-
preserveAgentStateFields,
|
|
384
|
-
toOpenAiCompatibleMessages,
|
|
385
|
-
shouldStripReasoningContentForOutbound,
|
|
386
|
-
toResponsesTools,
|
|
387
|
-
convertMessagesToResponsesInput,
|
|
388
|
-
extractTextFromResponseOutput,
|
|
389
|
-
extractReasoningFromResponseOutput,
|
|
390
|
-
extractImagePartsFromResponseOutput,
|
|
391
|
-
extractToolCallsFromResponseOutput,
|
|
392
|
-
collectStablePromptPrefix,
|
|
393
|
-
stablePromptCacheKey
|
|
394
|
-
};
|
package/chunk-PZZTFEKK.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fetchReferenceContents,
|
|
3
|
-
resolveReferenceAssets
|
|
4
|
-
} from "./chunk-HTVYCXBP.js";
|
|
5
|
-
|
|
6
|
-
// packages/ai/agent/fetchAgentContexts.ts
|
|
7
|
-
async function fetchAgentContexts(references, dispatch) {
|
|
8
|
-
if (!Array.isArray(references)) {
|
|
9
|
-
return { botInstructionsContext: "", botKnowledgeContext: "" };
|
|
10
|
-
}
|
|
11
|
-
const { references: normalizedRefs, contentByKey } = await resolveReferenceAssets(references, dispatch);
|
|
12
|
-
const instructionKeys = /* @__PURE__ */ new Set();
|
|
13
|
-
const knowledgeKeys = /* @__PURE__ */ new Set();
|
|
14
|
-
normalizedRefs.forEach((ref) => {
|
|
15
|
-
if (!ref.dbKey) return;
|
|
16
|
-
ref.type === "instruction" ? instructionKeys.add(ref.dbKey) : knowledgeKeys.add(ref.dbKey);
|
|
17
|
-
});
|
|
18
|
-
const [instructionsMap, knowledgeMap] = await Promise.all([
|
|
19
|
-
fetchReferenceContents(Array.from(instructionKeys), dispatch, {
|
|
20
|
-
preloaded: contentByKey
|
|
21
|
-
}),
|
|
22
|
-
fetchReferenceContents(Array.from(knowledgeKeys), dispatch, {
|
|
23
|
-
preloaded: contentByKey
|
|
24
|
-
})
|
|
25
|
-
]);
|
|
26
|
-
return {
|
|
27
|
-
botInstructionsContext: Array.from(instructionsMap.values()).join(""),
|
|
28
|
-
botKnowledgeContext: Array.from(knowledgeMap.values()).join("")
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
fetchAgentContexts
|
|
34
|
-
};
|
package/chunk-URMS4XY2.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// packages/database/levelLockError.ts
|
|
2
|
-
function isLevelLockError(error) {
|
|
3
|
-
if (error == null) return false;
|
|
4
|
-
const text = typeof error === "object" ? `${error.code ?? ""} ${error.message ?? error}` : String(error);
|
|
5
|
-
return /LEVEL_LOCKED|Resource temporarily unavailable|\/LOCK|LOCK:/.test(text);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
isLevelLockError
|
|
10
|
-
};
|
package/chunk-UV6VISQJ.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// packages/cli/levelLazyShim.mjs
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
var _require = createRequire(import.meta.url);
|
|
4
|
-
var _RealLevel;
|
|
5
|
-
function ensureLevel() {
|
|
6
|
-
if (!_RealLevel) {
|
|
7
|
-
_RealLevel = _require("level").Level;
|
|
8
|
-
}
|
|
9
|
-
return _RealLevel;
|
|
10
|
-
}
|
|
11
|
-
var Level = class {
|
|
12
|
-
constructor(...args) {
|
|
13
|
-
const RealLevel = ensureLevel();
|
|
14
|
-
return new RealLevel(...args);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
Level
|
|
20
|
-
};
|
package/chunk-VJVNU77E.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// packages/cli/secretScan.ts
|
|
2
|
-
var ASSIGNMENT_KEYS = [
|
|
3
|
-
{ label: "password", keys: "password|passwd", min: 8 },
|
|
4
|
-
{ label: "psk", keys: "psk", min: 8 },
|
|
5
|
-
{ label: "api key", keys: "api[_-]?key|apikey", min: 12 },
|
|
6
|
-
{ label: "token", keys: "token|secret", min: 12 }
|
|
7
|
-
];
|
|
8
|
-
var ASSIGNMENT_PATTERNS = ASSIGNMENT_KEYS.map(
|
|
9
|
-
({ label, keys, min }) => ({
|
|
10
|
-
label,
|
|
11
|
-
// 反向引用 \1 让引号成对成为必要条件:半截引号不算。值里允许空格与逗号——
|
|
12
|
-
// 写成带空格的口令是常见形态,旧的字符类会把这种值截成半截从而整条漏掉。
|
|
13
|
-
quoted: new RegExp(
|
|
14
|
-
`\\b(?:${keys})\\s*[:=]\\s*(["'])([^"']{${min},})\\1`,
|
|
15
|
-
"i"
|
|
16
|
-
),
|
|
17
|
-
// 不带引号时只取到分隔符为止,是否算密钥交给 looksLikeBareSecret 判。
|
|
18
|
-
bare: new RegExp(
|
|
19
|
-
`\\b(?:${keys})\\s*[:=]\\s*([^\\s"',#]{${min},})`,
|
|
20
|
-
"i"
|
|
21
|
-
)
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
var PRIVATE_KEY_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----/;
|
|
25
|
-
var EXPRESSION_CHARS = /[?(){};|&<>$]/;
|
|
26
|
-
var CONSTANT_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
27
|
-
var CAMEL_CASE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)+$/;
|
|
28
|
-
var PROPERTY_SEGMENT = /^[A-Za-z_$][\w$]*$/;
|
|
29
|
-
var NAME_FORM_MAX_CHARS = 48;
|
|
30
|
-
var PROPERTY_SEGMENT_MAX_CHARS = 24;
|
|
31
|
-
function looksLikeDottedName(value) {
|
|
32
|
-
const segments = value.split(".");
|
|
33
|
-
if (segments.length < 2) return false;
|
|
34
|
-
return segments.every(
|
|
35
|
-
(segment) => PROPERTY_SEGMENT.test(segment) && (segment.length <= PROPERTY_SEGMENT_MAX_CHARS || CONSTANT_CASE.test(segment) && segment.includes("_"))
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
function stripTrailingMarkdownFence(value) {
|
|
39
|
-
return value.replace(/`+$/, "");
|
|
40
|
-
}
|
|
41
|
-
function looksLikeBareSecret(rawValue) {
|
|
42
|
-
const value = stripTrailingMarkdownFence(rawValue);
|
|
43
|
-
if (EXPRESSION_CHARS.test(value)) return false;
|
|
44
|
-
if (CONSTANT_CASE.test(value) && value.includes("_")) return false;
|
|
45
|
-
if (looksLikeDottedName(value)) return false;
|
|
46
|
-
if (value.length > NAME_FORM_MAX_CHARS) {
|
|
47
|
-
return /\d/.test(value);
|
|
48
|
-
}
|
|
49
|
-
if (CAMEL_CASE.test(value)) return false;
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
function toPreview(line) {
|
|
53
|
-
return line.length > 120 ? `${line.slice(0, 117)}...` : line;
|
|
54
|
-
}
|
|
55
|
-
function findPotentialSecrets(text) {
|
|
56
|
-
const findings = [];
|
|
57
|
-
text.split(/\r?\n/).forEach((line, index) => {
|
|
58
|
-
const lineNumber = index + 1;
|
|
59
|
-
const preview = toPreview(line);
|
|
60
|
-
for (const { label, quoted, bare } of ASSIGNMENT_PATTERNS) {
|
|
61
|
-
if (quoted.test(line)) {
|
|
62
|
-
findings.push({ label, line: lineNumber, preview });
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const bareMatch = bare.exec(line);
|
|
66
|
-
if (bareMatch && looksLikeBareSecret(bareMatch[1])) {
|
|
67
|
-
findings.push({ label, line: lineNumber, preview });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (PRIVATE_KEY_PATTERN.test(line)) {
|
|
71
|
-
findings.push({ label: "private key", line: lineNumber, preview });
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return findings;
|
|
75
|
-
}
|
|
76
|
-
function formatSecretFindings(findings) {
|
|
77
|
-
return findings.map((finding) => ` line ${finding.line} (${finding.label}): ${finding.preview}`).join("\n");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
findPotentialSecrets,
|
|
82
|
-
formatSecretFindings
|
|
83
|
-
};
|