nolo-cli 0.148.0-alpha.1 → 0.151.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-NFJAMAGJ.js → _executeModel-XHAFJ2MM.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-DPUUS56Z.js} +181 -93
- package/{agentEmailCommands-4KW33JII.js → agentEmailCommands-V4P5EFLP.js} +132 -112
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-TWFLUYIZ.js +802 -0
- package/{agentMachineCommands-CMQR4RQ4.js → agentMachineCommands-MELPAZZI.js} +58 -62
- package/{agentProviderCommands-YK2BIIXZ.js → agentProviderCommands-HL6MBLCL.js} +149 -2
- package/{agentPullCommand-HF4A42D4.js → agentPullCommand-FA43RBRU.js} +7 -7
- package/agentRecordCommands-FSWSSQIO.js +154 -0
- package/agentRunCommand-GDBJVOAT.js +183 -0
- package/{agentRunControl-2SKCR4SB.js → agentRunControl-IFM7IGMG.js} +10 -2
- package/{agentRuntimeLocal-AK2QVJHY.js → agentRuntimeLocal-KKSQJMTE.js} +47 -50
- package/{agentSlice-OZ33K224.js → agentSlice-YO2ZLJMD.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-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-556RW72X.js +14110 -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-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-7MOXKPHC.js +119 -0
- package/{chunk-523WHFSL.js → chunk-7XKL25PW.js} +1973 -754
- package/{chunk-IAESIMK7.js → chunk-A4MW3YZL.js} +10 -14
- package/chunk-AGIM7IMJ.js +147 -0
- package/{chunk-7CHC4W22.js → chunk-AIZE5TDM.js} +3 -3
- package/{chunk-P4BX6FFU.js → chunk-AOCM7HPT.js} +214 -51
- 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-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-GBRG75BQ.js → chunk-D2MDMY2M.js} +1 -0
- package/{chunk-3SV7RM24.js → chunk-D2QN6CTI.js} +117 -72
- package/{chunk-5TEEECZM.js → chunk-E2AKSW7L.js} +10 -7
- package/{chunk-RSEEDUMS.js → chunk-EDX5XSJM.js} +2 -2
- package/{chunk-BKWMNZ2X.js → chunk-ES633ZS5.js} +280 -98
- 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-FJMRBOPO.js +11507 -0
- 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-T7F46O36.js → chunk-GQN2WLAI.js} +20 -11
- package/{chunk-P6GMCCAT.js → chunk-GQV5KHJU.js} +78 -12
- package/{chunk-B2XUQXQX.js → chunk-HIQ4GF53.js} +191 -68
- package/{chunk-YUWMM4US.js → chunk-HKX3ULQB.js} +34 -22
- package/{chunk-GMZLP5DV.js → chunk-HNUWUO75.js} +30 -19
- 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-CPUFH46E.js → chunk-ILU2NPWY.js} +10 -10
- package/{chunk-SLLGJZDT.js → chunk-ISQL4V7C.js} +4 -4
- package/chunk-IT3ZZRJE.js +12 -0
- package/{chunk-LPVCRQMM.js → chunk-IZ7OJB6K.js} +20 -16
- 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-FWQEKRTD.js → chunk-LTRUTOHX.js} +36 -31
- 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-DIXLJWCD.js → chunk-PCKVQXYV.js} +274 -93
- package/{chunk-4JMDLJAD.js → chunk-PJNFNEJE.js} +114 -37
- package/{chunk-Z4CSIXYP.js → chunk-PLSVXHSA.js} +3 -3
- package/{chunk-BIDGLJQ3.js → chunk-PLXDDGBK.js} +45 -8
- 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-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-T767MPHB.js → chunk-SMENBO3M.js} +354 -120
- package/{chunk-PCVVZ2MH.js → chunk-SSFDFOVT.js} +26 -31
- package/chunk-SW4S4XYB.js +1794 -0
- package/{chunk-HUFPWXFW.js → chunk-T6X3D7NB.js} +572 -430
- 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-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-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-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-2JMMBU6V.js → chunk-Y2DXOPSO.js} +1920 -644
- 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-DCFPQW22.js → chunk-Z7OJUX6S.js} +122 -107
- package/chunk-ZEZC7IIM.js +126 -0
- package/{chunk-ALGORS6Y.js → chunk-ZF6526IQ.js} +43 -8
- package/chunk-ZIWPQEFU.js +165 -0
- package/chunk-ZKZ5X2HS.js +7012 -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-YOEQUA7T.js → commandRegistry-XN7C5GHO.js} +183 -107
- package/contentThunks-5L7YQI3S.js +84 -0
- package/{cooldownCommands-ZLEPIB4A.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-5EJL6ROU.js → createAgentAutomationAction-QOPOLCRK.js} +53 -44
- package/createDialogAction-MZ66VY5Q.js +76 -0
- package/{createPageAction-75ELC64R.js → createPageAction-VQDJIXMY.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-KSXPGJB2.js → dialogSlice-6RODVYCK.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-AROBVRCR.js → docStore-ZZA3OPM5.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-EGNWHAUB.js → handleSendMessageAction-DVG5U26T.js} +619 -165
- 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-HXRHFKRC.js +244 -0
- package/localRuntimeAuthority-JDAD7CB6.js +16 -0
- package/{localRuntimeDb-3LRMNLCM.js → localRuntimeDb-CVC62PM5.js} +1 -1
- package/{machineCommands-ARZYKGGE.js → machineCommands-5KBF4RCC.js} +503 -161
- package/{machineInfo-66ZFUMLE.js → machineInfo-UKPTZO5Y.js} +2 -2
- package/machineWsRunDispatch-4OQDEDOR.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-3XOFVARF.js → readlineWorkspace-RIE62QVZ.js} +5022 -921
- package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
- package/{runAgentClientLoop-UMF7VZYZ.js → runAgentClientLoop-KLUUXBZS.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-GYGMYOSM.js → streamAgentChatTurn-MN2SSPGA.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-W2MOLERY.js +124 -0
- package/tuiSummaryLlmCaller-BM3VSTBU.js +130 -0
- package/{updateCommands-4EHDLF5J.js → updateCommands-NQXAGFM7.js} +3 -3
- package/{updateDialogTitleAction-4U5W4AMH.js → updateDialogTitleAction-Z4JX6REN.js} +102 -57
- package/workloadLifecycle-36DXRZKU.js +320 -0
- package/action-GI44T4DR.js +0 -31
- package/agentListCommands-IW3GQVUP.js +0 -427
- package/agentRecordCommands-4YBSYPIY.js +0 -134
- package/agentRunCommand-5MU5X5OT.js +0 -161
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-HVHA2HPM.js +0 -186
- package/chromeOpsCommands-IXRLN57H.js +0 -289
- package/chunk-42Z3EMC4.js +0 -25363
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-CYSYR67N.js +0 -93
- package/chunk-IAG4FHOJ.js +0 -34
- 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-QU5A4LYX.js +0 -2415
- package/chunk-URMS4XY2.js +0 -10
- package/chunk-UV6VISQJ.js +0 -20
- package/chunk-VJVNU77E.js +0 -83
- package/chunk-WRMKCKZ3.js +0 -13807
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/contentThunks-AK2F3KNC.js +0 -73
- package/createDialogAction-F5WEWA47.js +0 -66
- package/dialogCommands-G7YBVAMC.js +0 -102
- package/levelLazyShim-GZBKODGI.js +0 -7
- package/machineWsRunDispatch-I7F4L532.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-DU4JXVAV.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,14 +1,54 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Database
|
|
3
|
+
} from "./chunk-IT3ZZRJE.js";
|
|
4
|
+
import {
|
|
5
|
+
Level,
|
|
2
6
|
createLegacyServerDb,
|
|
3
7
|
createLevelAuthorityStore
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
Level
|
|
7
|
-
} from "./chunk-UV6VISQJ.js";
|
|
8
|
+
} from "./chunk-AWVFQMOV.js";
|
|
8
9
|
import {
|
|
9
10
|
asTrimmedLowercaseString
|
|
10
11
|
} from "./chunk-QSJ3HFEF.js";
|
|
11
12
|
|
|
13
|
+
// packages/core/runtimeRole.ts
|
|
14
|
+
var ROLE_ENV = "NOLO_SERVER_RUNTIME_ROLE";
|
|
15
|
+
var frozenRuntimeRole = null;
|
|
16
|
+
function isPm2Managed(env = process.env) {
|
|
17
|
+
return typeof env.pm_id === "string" && env.pm_id.trim() !== "";
|
|
18
|
+
}
|
|
19
|
+
function resolveRuntimeRole(env = process.env) {
|
|
20
|
+
const raw = String(env[ROLE_ENV] || "").trim().toLowerCase();
|
|
21
|
+
if (raw === "core" || raw === "chat-proxy") return raw;
|
|
22
|
+
if (raw !== "") {
|
|
23
|
+
throw new Error(`\u672A\u77E5\u7684 ${ROLE_ENV}="${raw}"\uFF1A\u53EA\u652F\u6301 "core" / "chat-proxy"\u3002`);
|
|
24
|
+
}
|
|
25
|
+
if (isPm2Managed(env)) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`PM2 \u6258\u7BA1\u8FDB\u7A0B\u7F3A\u5C11 ${ROLE_ENV}\uFF1A\u62D2\u7EDD\u4EE5\u9ED8\u8BA4\u8EAB\u4EFD\u542F\u52A8 \u2014\u2014 \u5386\u53F2\u4E8B\u6545\uFF082026-09-17\uFF09\u4E2D\uFF0C\u4E00\u4E2A\u7F3A\u7701\u6210 core \u7684\u8FDB\u7A0B\u62A2\u5360\u4E86\u5171\u4EAB LevelDB \u9501\uFF0C\u6838\u5FC3\u4E0E\u90E8\u7F72\u5168\u90E8\u5931\u8D25\u3002\u8BF7\u901A\u8FC7\u90E8\u7F72\u811A\u672C\u542F\u52A8\u69FD\u4F4D\uFF08core / chat-proxy \u90FD\u4F1A\u663E\u5F0F\u58F0\u660E\u89D2\u8272\uFF09\u3002`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return "core";
|
|
31
|
+
}
|
|
32
|
+
function getRuntimeRole() {
|
|
33
|
+
if (!frozenRuntimeRole) {
|
|
34
|
+
frozenRuntimeRole = resolveRuntimeRole(process.env);
|
|
35
|
+
}
|
|
36
|
+
return frozenRuntimeRole;
|
|
37
|
+
}
|
|
38
|
+
function shouldOpenDatabase(role = getRuntimeRole()) {
|
|
39
|
+
return role === "core";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// packages/database-engine/serverDbRoleViolation.ts
|
|
43
|
+
var ServerDbRoleViolationError = class extends Error {
|
|
44
|
+
code = "SERVER_DB_ROLE_VIOLATION";
|
|
45
|
+
constructor(message) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.name = "ServerDbRoleViolationError";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var SERVER_DB_ROLE_VIOLATION_MESSAGE = "\u5F53\u524D\u8FDB\u7A0B\u89D2\u8272\u4E0D\u62E5\u6709\u5171\u4EAB LevelDB\uFF08\u53EA\u6709 core \u62E5\u6709\uFF09\uFF1A\u62D2\u7EDD\u6253\u5F00/\u8BBF\u95EE\u6570\u636E\u5E93\u3002chat-proxy \u5E94\u901A\u8FC7 internal API \u5411 core \u8BF7\u6C42\u6240\u9700\u6570\u636E\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5F00\u5E93\u3002";
|
|
51
|
+
|
|
12
52
|
// packages/database-engine/serverStoreFactory.ts
|
|
13
53
|
import fs from "fs";
|
|
14
54
|
import path from "path";
|
|
@@ -76,7 +116,8 @@ var MemoryAuthorityBacking = class {
|
|
|
76
116
|
if (options.gte && entry.key < options.gte) continue;
|
|
77
117
|
if (options.lte && entry.key > options.lte) continue;
|
|
78
118
|
if (options.lt && entry.key >= options.lt) continue;
|
|
79
|
-
|
|
119
|
+
const value = options.values === false ? void 0 : entry.value;
|
|
120
|
+
yield [entry.key, value];
|
|
80
121
|
}
|
|
81
122
|
}
|
|
82
123
|
};
|
|
@@ -116,15 +157,6 @@ function createMemoryAuthorityStore(location = ":memory:") {
|
|
|
116
157
|
};
|
|
117
158
|
}
|
|
118
159
|
|
|
119
|
-
// packages/cli/bunSqliteLazyShim.mjs
|
|
120
|
-
var Database = class {
|
|
121
|
-
constructor() {
|
|
122
|
-
throw new Error(
|
|
123
|
-
"bun:sqlite is not available in the Node CLI runtime; the CLI's default authority store driver is level. If NOLO_SERVER_AUTHORITY_DRIVER=sqlite is set in a Node CLI environment, remove it (sqlite is a server/Bun-only driver)"
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
160
|
// packages/database-engine/sqliteAuthorityStore.ts
|
|
129
161
|
var CREATE_TABLE_SQL = `
|
|
130
162
|
CREATE TABLE IF NOT EXISTS kv_store (
|
|
@@ -255,9 +287,11 @@ function createSqliteAuthorityStore(dbPath) {
|
|
|
255
287
|
}
|
|
256
288
|
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
257
289
|
const orderClause = options.reverse ? "ORDER BY key DESC" : "ORDER BY key ASC";
|
|
258
|
-
const
|
|
290
|
+
const selectClause = options.values === false ? "SELECT key FROM kv_store" : "SELECT key, value FROM kv_store";
|
|
291
|
+
const stmt = db.query(`${selectClause} ${whereClause} ${orderClause}`);
|
|
259
292
|
for (const row of stmt.iterate(...params)) {
|
|
260
|
-
|
|
293
|
+
const value = options.values === false ? void 0 : decodeValue(row.value);
|
|
294
|
+
yield [row.key, value];
|
|
261
295
|
}
|
|
262
296
|
}
|
|
263
297
|
};
|
|
@@ -307,7 +341,44 @@ function createAuthorityStoreForDriver(driver, dbPath) {
|
|
|
307
341
|
return createSqliteAuthorityStore(dbPath);
|
|
308
342
|
}
|
|
309
343
|
}
|
|
344
|
+
function createRoleBlockedAuthorityStore(dbPath) {
|
|
345
|
+
const blocked = () => {
|
|
346
|
+
throw new ServerDbRoleViolationError(SERVER_DB_ROLE_VIOLATION_MESSAGE);
|
|
347
|
+
};
|
|
348
|
+
async function* blockedIterator() {
|
|
349
|
+
blocked();
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
location: dbPath,
|
|
353
|
+
status: "closed",
|
|
354
|
+
async open() {
|
|
355
|
+
blocked();
|
|
356
|
+
},
|
|
357
|
+
async close() {
|
|
358
|
+
},
|
|
359
|
+
async get() {
|
|
360
|
+
return blocked();
|
|
361
|
+
},
|
|
362
|
+
async put() {
|
|
363
|
+
blocked();
|
|
364
|
+
},
|
|
365
|
+
async del() {
|
|
366
|
+
blocked();
|
|
367
|
+
},
|
|
368
|
+
async batchWrite() {
|
|
369
|
+
blocked();
|
|
370
|
+
},
|
|
371
|
+
createBatch() {
|
|
372
|
+
return blocked();
|
|
373
|
+
},
|
|
374
|
+
iterator: blockedIterator
|
|
375
|
+
};
|
|
376
|
+
}
|
|
310
377
|
function getOrCreateServerStoreRuntime(dbPath, options = {}) {
|
|
378
|
+
if (!shouldOpenDatabase()) {
|
|
379
|
+
const blocker = createRoleBlockedAuthorityStore(dbPath);
|
|
380
|
+
return { authorityStore: blocker, serverDb: createLegacyServerDb(blocker) };
|
|
381
|
+
}
|
|
311
382
|
const globalScope = options.globalScope ?? globalThis;
|
|
312
383
|
const driver = options.driver ?? resolveServerStoreDriver(options.env);
|
|
313
384
|
const cachedDriver = globalScope.__serverAuthorityStoreDriver;
|
|
@@ -337,10 +408,8 @@ function getOrCreateServerStoreRuntime(dbPath, options = {}) {
|
|
|
337
408
|
}
|
|
338
409
|
|
|
339
410
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
resolveServerStoreDriver,
|
|
344
|
-
createAuthorityStoreForDriver,
|
|
411
|
+
shouldOpenDatabase,
|
|
412
|
+
ServerDbRoleViolationError,
|
|
413
|
+
SERVER_DB_ROLE_VIOLATION_MESSAGE,
|
|
345
414
|
getOrCreateServerStoreRuntime
|
|
346
415
|
};
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeTimingMs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BPMPOFWP.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
ALL_MODELS
|
|
9
|
-
} from "./chunk-CYSYR67N.js";
|
|
5
|
+
BUILTIN_NOLO_AGENT_KEY
|
|
6
|
+
} from "./chunk-EZVK3N5L.js";
|
|
10
7
|
import {
|
|
11
8
|
asTrimmedNonEmptyStringArray
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I42VC5KR.js";
|
|
13
10
|
import {
|
|
14
11
|
asOptionalFiniteNumber
|
|
15
12
|
} from "./chunk-WWC7I6TA.js";
|
|
16
|
-
import {
|
|
17
|
-
BUILTIN_NOLO_AGENT_KEY
|
|
18
|
-
} from "./chunk-BNGW5ASC.js";
|
|
19
13
|
import {
|
|
20
14
|
asOptionalTrimmedString
|
|
21
15
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -57,213 +51,6 @@ var DEFAULT_AUTO_EXECUTION_TIER = "flash";
|
|
|
57
51
|
var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
|
|
58
52
|
var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
|
|
59
53
|
|
|
60
|
-
// packages/ai/llm/getModelContextWindow.ts
|
|
61
|
-
var DEFAULT_CONTEXT_WINDOW = 256e3;
|
|
62
|
-
var QWEN_3_6_CONTEXT_WINDOW = 262144;
|
|
63
|
-
var GLM_5_2_CONTEXT_WINDOW = 1e6;
|
|
64
|
-
var ANTIGRAVITY_EFFORT_SUFFIXES = [
|
|
65
|
-
"-tiered",
|
|
66
|
-
"-extra-low",
|
|
67
|
-
"-low",
|
|
68
|
-
"-medium",
|
|
69
|
-
"-high"
|
|
70
|
-
];
|
|
71
|
-
function stripEffortSuffix(model) {
|
|
72
|
-
for (const suffix of ANTIGRAVITY_EFFORT_SUFFIXES) {
|
|
73
|
-
if (model.endsWith(suffix) && model.length > suffix.length) {
|
|
74
|
-
return model.slice(0, -suffix.length);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return model;
|
|
78
|
-
}
|
|
79
|
-
function stripPreviewSuffix(model) {
|
|
80
|
-
const suffix = "-preview";
|
|
81
|
-
if (model.endsWith(suffix) && model.length > suffix.length) {
|
|
82
|
-
return model.slice(0, -suffix.length);
|
|
83
|
-
}
|
|
84
|
-
return model;
|
|
85
|
-
}
|
|
86
|
-
function stripModelTag(model) {
|
|
87
|
-
const colonIndex = model.indexOf(":");
|
|
88
|
-
if (colonIndex > 0) {
|
|
89
|
-
return model.slice(0, colonIndex);
|
|
90
|
-
}
|
|
91
|
-
return model;
|
|
92
|
-
}
|
|
93
|
-
var fullModelMap = null;
|
|
94
|
-
var getFullModelMap = () => {
|
|
95
|
-
if (!fullModelMap) {
|
|
96
|
-
fullModelMap = /* @__PURE__ */ new Map();
|
|
97
|
-
for (const [provider, models] of Object.entries(MODEL_LOOKUP_MAP)) {
|
|
98
|
-
for (const model of models) {
|
|
99
|
-
const entry = { ...model, provider };
|
|
100
|
-
fullModelMap.set(model.name, entry);
|
|
101
|
-
if (model.displayName) {
|
|
102
|
-
fullModelMap.set(model.displayName.toLowerCase(), entry);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return fullModelMap;
|
|
108
|
-
};
|
|
109
|
-
var legacyModelMap = null;
|
|
110
|
-
var getLegacyModelMap = () => {
|
|
111
|
-
if (!legacyModelMap) {
|
|
112
|
-
legacyModelMap = /* @__PURE__ */ new Map();
|
|
113
|
-
for (const model of ALL_MODELS) {
|
|
114
|
-
legacyModelMap.set(model.name, model);
|
|
115
|
-
if (model.displayName) {
|
|
116
|
-
legacyModelMap.set(model.displayName.toLowerCase(), model);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return legacyModelMap;
|
|
121
|
-
};
|
|
122
|
-
function fuzzyContextWindow(normalizedName) {
|
|
123
|
-
if (normalizedName.includes("qwen-long") || normalizedName.includes("qwen3-long")) return 10485760;
|
|
124
|
-
if (normalizedName.includes("qwen-coder") || normalizedName.includes("qwen3-coder")) return 1048576;
|
|
125
|
-
if (normalizedName.includes("qwen3.8") || normalizedName.includes("qwen3p8")) return 1e6;
|
|
126
|
-
if (normalizedName.includes("minimax-m3") || normalizedName.includes("minimax_m3")) return 1e6;
|
|
127
|
-
if (normalizedName.includes("glm-5.3") || normalizedName.includes("glm5.3")) return 105e4;
|
|
128
|
-
if (normalizedName.includes("glm-5.2") || normalizedName.includes("glm5.2")) return GLM_5_2_CONTEXT_WINDOW;
|
|
129
|
-
if (normalizedName.includes("deepseek")) return 1e6;
|
|
130
|
-
if (normalizedName.includes("gpt-5") || normalizedName.includes("gpt-4.1")) return 1047576;
|
|
131
|
-
if (normalizedName.startsWith("cursor-grok-4.5")) return 1e6;
|
|
132
|
-
if (normalizedName.includes("claude-4.6")) return 1e6;
|
|
133
|
-
if (normalizedName.includes("gemini-3.1")) return 1e6;
|
|
134
|
-
if (normalizedName.includes("gemini")) return 1048576;
|
|
135
|
-
if (normalizedName.includes("qwen3.6") || normalizedName.includes("qwen3p6")) return QWEN_3_6_CONTEXT_WINDOW;
|
|
136
|
-
if (normalizedName.includes("qwen3.7") || normalizedName.includes("qwen3p7")) return 262144;
|
|
137
|
-
if (normalizedName.includes("minimax-m2") || normalizedName.includes("minimax_m2")) return 262144;
|
|
138
|
-
if (normalizedName.includes("claude")) return 2e5;
|
|
139
|
-
if (normalizedName.includes("llama3.1") || normalizedName.includes("llama-3.1") || normalizedName.includes("llama3.2") || normalizedName.includes("llama-3.2") || normalizedName.includes("llama3.3") || normalizedName.includes("llama-3.3") || normalizedName.includes("qwen2.5") || normalizedName.includes("qwen-2.5") || normalizedName.includes("mistral-nemo") || normalizedName.includes("phi3.5") || normalizedName.includes("phi-3.5") || normalizedName.includes("phi4") || normalizedName.includes("phi-4")) {
|
|
140
|
-
return 131072;
|
|
141
|
-
}
|
|
142
|
-
if (normalizedName.includes("qwen2") || normalizedName.includes("qwen-2") || normalizedName.includes("mistral") || normalizedName.includes("mixtral")) {
|
|
143
|
-
return 32768;
|
|
144
|
-
}
|
|
145
|
-
if (normalizedName.includes("codellama") || normalizedName.includes("starcoder") || normalizedName.includes("phi3") || normalizedName.includes("phi-3")) {
|
|
146
|
-
return 16384;
|
|
147
|
-
}
|
|
148
|
-
if (normalizedName.includes("llama3") || normalizedName.includes("llama-3") || normalizedName.includes("gemma2") || normalizedName.includes("gemma-2") || normalizedName.includes("gemma")) {
|
|
149
|
-
return 8192;
|
|
150
|
-
}
|
|
151
|
-
if (normalizedName.includes("llama2") || normalizedName.includes("llama-2") || normalizedName.includes("llama")) {
|
|
152
|
-
return 4096;
|
|
153
|
-
}
|
|
154
|
-
return void 0;
|
|
155
|
-
}
|
|
156
|
-
var getModelContextWindow = (modelName) => {
|
|
157
|
-
if (!modelName) return DEFAULT_CONTEXT_WINDOW;
|
|
158
|
-
const normalizedName = modelName.toLowerCase();
|
|
159
|
-
const map = getFullModelMap();
|
|
160
|
-
const rawCandidates = [modelName, normalizedName];
|
|
161
|
-
const strippedTag = stripModelTag(modelName);
|
|
162
|
-
if (strippedTag !== modelName) {
|
|
163
|
-
rawCandidates.push(strippedTag, strippedTag.toLowerCase());
|
|
164
|
-
}
|
|
165
|
-
const candidates = [];
|
|
166
|
-
for (const base of rawCandidates) {
|
|
167
|
-
candidates.push(base);
|
|
168
|
-
const strippedEffort = stripEffortSuffix(base);
|
|
169
|
-
if (strippedEffort !== base) {
|
|
170
|
-
candidates.push(strippedEffort, strippedEffort.toLowerCase());
|
|
171
|
-
}
|
|
172
|
-
const strippedPreview = stripPreviewSuffix(base);
|
|
173
|
-
if (strippedPreview !== base) {
|
|
174
|
-
candidates.push(strippedPreview, strippedPreview.toLowerCase());
|
|
175
|
-
}
|
|
176
|
-
if (strippedEffort !== base) {
|
|
177
|
-
const strippedBoth = stripPreviewSuffix(strippedEffort);
|
|
178
|
-
if (strippedBoth !== strippedEffort) {
|
|
179
|
-
candidates.push(strippedBoth, strippedBoth.toLowerCase());
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
for (const candidate of candidates) {
|
|
184
|
-
const model = map.get(candidate);
|
|
185
|
-
if (model?.contextWindow) {
|
|
186
|
-
return typeof model.contextWindow === "number" ? model.contextWindow : DEFAULT_CONTEXT_WINDOW;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return fuzzyContextWindow(normalizedName) ?? DEFAULT_CONTEXT_WINDOW;
|
|
190
|
-
};
|
|
191
|
-
var getModelInfo = (modelName) => {
|
|
192
|
-
if (!modelName) return null;
|
|
193
|
-
const map = getLegacyModelMap();
|
|
194
|
-
return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// packages/agent-runtime/emptyAssistantRepair.ts
|
|
198
|
-
var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u53EA\u80FD\u8C03\u7528\u672C\u6B21\u8BF7\u6C42\u4E2D\u5DF2\u58F0\u660E\u7684\u5DE5\u5177\u2014\u2014\u4F60\u60F3\u7528\u7684\u5DE5\u5177\u4E0D\u5728\u58F0\u660E\u5217\u8868\u4E2D\u65F6\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u8C03\u7528\u5B83\uFF0C\u76F4\u63A5\u7528\u6587\u5B57\u8BF4\u660E\u8BE5\u80FD\u529B\u5F53\u524D\u4E0D\u53EF\u7528\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
|
|
199
|
-
var EMPTY_ASSISTANT_FALLBACK_MESSAGE = "\u6A21\u578B\u8FDE\u7EED\u8FD4\u56DE\u7A7A\u6D88\u606F\uFF0C\u5F53\u524D\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\uFF0C\u6216\u7ED9\u51FA\u66F4\u5177\u4F53\u7684\u4FEE\u6539\u8303\u56F4\u3002";
|
|
200
|
-
var LENGTH_TRUNCATED_FALLBACK_MESSAGE = "\u8F93\u51FA\u8FBE\u5230\u957F\u5EA6\u4E0A\u9650\u88AB\u622A\u65AD\uFF0C\u6216\u4E0A\u4E0B\u6587\u5DF2\u8D85\u51FA\u6A21\u578B\u7A97\u53E3\u3002\u5EFA\u8BAE\u7F29\u77ED\u4EFB\u52A1\u3001\u538B\u7F29\u6216\u65B0\u5F00\u5BF9\u8BDD\uFF0C\u6216\u63D0\u9AD8\u8F93\u51FA\u4E0A\u9650\u3002";
|
|
201
|
-
var STREAM_TRUNCATED_FALLBACK_MESSAGE = "\u4E0A\u6E38\u54CD\u5E94\u6D41\u5728\u6536\u5C3E\u524D\u88AB\u4E2D\u65AD\uFF08\u672A\u6536\u5230\u7ED3\u675F\u6807\u8BB0\uFF09\uFF0C\u672C\u8F6E\u8F93\u51FA\u4E0D\u5B8C\u6574\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\u3002";
|
|
202
|
-
var REPETITION_LOOP_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u6A21\u578B\u9677\u5165\u91CD\u590D\u8F93\u51FA\u6B7B\u5FAA\u73AF\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
203
|
-
var STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u8FDE\u7EED\u591A\u6B21\u76F8\u540C\u5DE5\u5177\u8C03\u7528\u4E14\u65E0\u5B9E\u8D28\u8FDB\u5C55\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
204
|
-
var MAX_REASONING_ONLY_REPAIRS = 2;
|
|
205
|
-
function resolveEmptyAssistantOutcome(args) {
|
|
206
|
-
if (args.hasVisibleOutput && !args.hasToolCalls && !args.finishReason && !args.streamComplete) {
|
|
207
|
-
return { kind: "ok_with_warning", reason: "stream_truncated" };
|
|
208
|
-
}
|
|
209
|
-
if (args.hasToolCalls || args.hasVisibleOutput) return { kind: "ok" };
|
|
210
|
-
if (args.finishReason === "length") return { kind: "fallback", reason: "length_truncated" };
|
|
211
|
-
if (!args.finishReason && !args.streamComplete) {
|
|
212
|
-
if (!args.repairUsed) return { kind: "repair" };
|
|
213
|
-
return { kind: "fallback", reason: "stream_truncated" };
|
|
214
|
-
}
|
|
215
|
-
if (args.hasReasoning && (args.reasoningRepairCount ?? 0) < MAX_REASONING_ONLY_REPAIRS) {
|
|
216
|
-
return { kind: "repair" };
|
|
217
|
-
}
|
|
218
|
-
if (!args.repairUsed) return { kind: "repair" };
|
|
219
|
-
return { kind: "fallback", reason: "empty_completion" };
|
|
220
|
-
}
|
|
221
|
-
function resolveEmptyAssistantFallbackMessage(reason) {
|
|
222
|
-
if (reason === "length_truncated") return LENGTH_TRUNCATED_FALLBACK_MESSAGE;
|
|
223
|
-
if (reason === "stream_truncated") return STREAM_TRUNCATED_FALLBACK_MESSAGE;
|
|
224
|
-
if (reason === "repetition_loop") return REPETITION_LOOP_FALLBACK_MESSAGE;
|
|
225
|
-
if (reason === "stagnant_tool_calls") return STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE;
|
|
226
|
-
return EMPTY_ASSISTANT_FALLBACK_MESSAGE;
|
|
227
|
-
}
|
|
228
|
-
function hasAssistantVisibleOutput(content) {
|
|
229
|
-
if (typeof content === "string") return content.trim().length > 0;
|
|
230
|
-
if (!Array.isArray(content)) return false;
|
|
231
|
-
return content.some((part) => {
|
|
232
|
-
if (part?.type === "text" && String(part.text ?? "").trim()) return true;
|
|
233
|
-
if (part?.type === "image_url") {
|
|
234
|
-
const url = part?.image_url?.url;
|
|
235
|
-
return typeof url === "string" && url.trim().length > 0;
|
|
236
|
-
}
|
|
237
|
-
return false;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
var LENGTH_TRUNCATED_REASONING_MARKER = "[length_truncated_reasoning_tail]";
|
|
241
|
-
var STREAM_TRUNCATED_REASONING_MARKER = "[stream_truncated_reasoning_tail]";
|
|
242
|
-
var MAX_TRUNCATED_REASONING_CHARS = 2e3;
|
|
243
|
-
function formatReasoningTailWithMarker(reasoning_content, marker, maxChars) {
|
|
244
|
-
if (typeof reasoning_content !== "string") return null;
|
|
245
|
-
const trimmed = reasoning_content.trim();
|
|
246
|
-
if (trimmed.length === 0) return null;
|
|
247
|
-
const tail = trimmed.length > maxChars ? trimmed.slice(-maxChars) : trimmed;
|
|
248
|
-
return `[nolo] ${marker}
|
|
249
|
-
${tail}`;
|
|
250
|
-
}
|
|
251
|
-
function formatLengthTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
252
|
-
return formatReasoningTailWithMarker(reasoning_content, LENGTH_TRUNCATED_REASONING_MARKER, maxChars);
|
|
253
|
-
}
|
|
254
|
-
function formatStreamTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
255
|
-
return formatReasoningTailWithMarker(reasoning_content, STREAM_TRUNCATED_REASONING_MARKER, maxChars);
|
|
256
|
-
}
|
|
257
|
-
function resolveTruncatedReasoningTailLog(reason, reasoning_content) {
|
|
258
|
-
if (reason === "length_truncated") {
|
|
259
|
-
return formatLengthTruncatedReasoningTail(reasoning_content);
|
|
260
|
-
}
|
|
261
|
-
if (reason === "stream_truncated") {
|
|
262
|
-
return formatStreamTruncatedReasoningTail(reasoning_content);
|
|
263
|
-
}
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
54
|
// packages/ai/token/cacheTokenFields.ts
|
|
268
55
|
var finiteTokenCount = (value) => {
|
|
269
56
|
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
@@ -297,7 +84,8 @@ var readCacheReadInputTokens = (usage) => firstPositive(usage, [
|
|
|
297
84
|
]);
|
|
298
85
|
var readCacheCreationInputTokens = (usage) => firstPositive(usage, [
|
|
299
86
|
topLevel("cache_creation_input_tokens"),
|
|
300
|
-
topLevel("prompt_cache_miss_tokens")
|
|
87
|
+
topLevel("prompt_cache_miss_tokens"),
|
|
88
|
+
nested(["input_tokens_details", "cache_write_tokens"])
|
|
301
89
|
]);
|
|
302
90
|
|
|
303
91
|
// packages/ai/token/normalizeUsage.ts
|
|
@@ -383,12 +171,79 @@ var normalizeUsage = (usage) => {
|
|
|
383
171
|
};
|
|
384
172
|
};
|
|
385
173
|
|
|
174
|
+
// packages/agent-runtime/emptyAssistantRepair.ts
|
|
175
|
+
var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u53EA\u80FD\u8C03\u7528\u672C\u6B21\u8BF7\u6C42\u4E2D\u5DF2\u58F0\u660E\u7684\u5DE5\u5177\u2014\u2014\u4F60\u60F3\u7528\u7684\u5DE5\u5177\u4E0D\u5728\u58F0\u660E\u5217\u8868\u4E2D\u65F6\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u8C03\u7528\u5B83\uFF0C\u76F4\u63A5\u7528\u6587\u5B57\u8BF4\u660E\u8BE5\u80FD\u529B\u5F53\u524D\u4E0D\u53EF\u7528\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
|
|
176
|
+
var EMPTY_ASSISTANT_FALLBACK_MESSAGE = "\u6A21\u578B\u8FDE\u7EED\u8FD4\u56DE\u7A7A\u6D88\u606F\uFF0C\u5F53\u524D\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\uFF0C\u6216\u7ED9\u51FA\u66F4\u5177\u4F53\u7684\u4FEE\u6539\u8303\u56F4\u3002";
|
|
177
|
+
var LENGTH_TRUNCATED_FALLBACK_MESSAGE = "\u8F93\u51FA\u8FBE\u5230\u957F\u5EA6\u4E0A\u9650\u88AB\u622A\u65AD\uFF0C\u6216\u4E0A\u4E0B\u6587\u5DF2\u8D85\u51FA\u6A21\u578B\u7A97\u53E3\u3002\u5EFA\u8BAE\u7F29\u77ED\u4EFB\u52A1\u3001\u538B\u7F29\u6216\u65B0\u5F00\u5BF9\u8BDD\uFF0C\u6216\u63D0\u9AD8\u8F93\u51FA\u4E0A\u9650\u3002";
|
|
178
|
+
var STREAM_TRUNCATED_FALLBACK_MESSAGE = "\u4E0A\u6E38\u54CD\u5E94\u6D41\u5728\u6536\u5C3E\u524D\u88AB\u4E2D\u65AD\uFF08\u672A\u6536\u5230\u7ED3\u675F\u6807\u8BB0\uFF09\uFF0C\u672C\u8F6E\u8F93\u51FA\u4E0D\u5B8C\u6574\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\u3002";
|
|
179
|
+
var REPETITION_LOOP_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u6A21\u578B\u9677\u5165\u91CD\u590D\u8F93\u51FA\u6B7B\u5FAA\u73AF\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
180
|
+
var STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u8FDE\u7EED\u591A\u6B21\u76F8\u540C\u5DE5\u5177\u8C03\u7528\u4E14\u65E0\u5B9E\u8D28\u8FDB\u5C55\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
181
|
+
var MAX_REASONING_ONLY_REPAIRS = 2;
|
|
182
|
+
function resolveEmptyAssistantOutcome(args) {
|
|
183
|
+
if (args.hasVisibleOutput && !args.hasToolCalls && !args.finishReason && !args.streamComplete) {
|
|
184
|
+
return { kind: "ok_with_warning", reason: "stream_truncated" };
|
|
185
|
+
}
|
|
186
|
+
if (args.hasToolCalls || args.hasVisibleOutput) return { kind: "ok" };
|
|
187
|
+
if (args.finishReason === "length") return { kind: "fallback", reason: "length_truncated" };
|
|
188
|
+
if (!args.finishReason && !args.streamComplete) {
|
|
189
|
+
if (!args.repairUsed) return { kind: "repair" };
|
|
190
|
+
return { kind: "fallback", reason: "stream_truncated" };
|
|
191
|
+
}
|
|
192
|
+
if (args.hasReasoning && (args.reasoningRepairCount ?? 0) < MAX_REASONING_ONLY_REPAIRS) {
|
|
193
|
+
return { kind: "repair" };
|
|
194
|
+
}
|
|
195
|
+
if (!args.repairUsed) return { kind: "repair" };
|
|
196
|
+
return { kind: "fallback", reason: "empty_completion" };
|
|
197
|
+
}
|
|
198
|
+
function resolveEmptyAssistantFallbackMessage(reason) {
|
|
199
|
+
if (reason === "length_truncated") return LENGTH_TRUNCATED_FALLBACK_MESSAGE;
|
|
200
|
+
if (reason === "stream_truncated") return STREAM_TRUNCATED_FALLBACK_MESSAGE;
|
|
201
|
+
if (reason === "repetition_loop") return REPETITION_LOOP_FALLBACK_MESSAGE;
|
|
202
|
+
if (reason === "stagnant_tool_calls") return STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE;
|
|
203
|
+
return EMPTY_ASSISTANT_FALLBACK_MESSAGE;
|
|
204
|
+
}
|
|
205
|
+
function hasAssistantVisibleOutput(content) {
|
|
206
|
+
if (typeof content === "string") return content.trim().length > 0;
|
|
207
|
+
if (!Array.isArray(content)) return false;
|
|
208
|
+
return content.some((part) => {
|
|
209
|
+
if (part?.type === "text" && String(part.text ?? "").trim()) return true;
|
|
210
|
+
if (part?.type === "image_url") {
|
|
211
|
+
const url = part?.image_url?.url;
|
|
212
|
+
return typeof url === "string" && url.trim().length > 0;
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
var LENGTH_TRUNCATED_REASONING_MARKER = "[length_truncated_reasoning_tail]";
|
|
218
|
+
var STREAM_TRUNCATED_REASONING_MARKER = "[stream_truncated_reasoning_tail]";
|
|
219
|
+
var MAX_TRUNCATED_REASONING_CHARS = 2e3;
|
|
220
|
+
function formatReasoningTailWithMarker(reasoning_content, marker, maxChars) {
|
|
221
|
+
if (typeof reasoning_content !== "string") return null;
|
|
222
|
+
const trimmed = reasoning_content.trim();
|
|
223
|
+
if (trimmed.length === 0) return null;
|
|
224
|
+
const tail = trimmed.length > maxChars ? trimmed.slice(-maxChars) : trimmed;
|
|
225
|
+
return `[nolo] ${marker}
|
|
226
|
+
${tail}`;
|
|
227
|
+
}
|
|
228
|
+
function formatLengthTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
229
|
+
return formatReasoningTailWithMarker(reasoning_content, LENGTH_TRUNCATED_REASONING_MARKER, maxChars);
|
|
230
|
+
}
|
|
231
|
+
function formatStreamTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
232
|
+
return formatReasoningTailWithMarker(reasoning_content, STREAM_TRUNCATED_REASONING_MARKER, maxChars);
|
|
233
|
+
}
|
|
234
|
+
function resolveTruncatedReasoningTailLog(reason, reasoning_content) {
|
|
235
|
+
if (reason === "length_truncated") {
|
|
236
|
+
return formatLengthTruncatedReasoningTail(reasoning_content);
|
|
237
|
+
}
|
|
238
|
+
if (reason === "stream_truncated") {
|
|
239
|
+
return formatStreamTruncatedReasoningTail(reasoning_content);
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
|
|
386
244
|
export {
|
|
387
245
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
388
246
|
resolveAutoExecutionProfile,
|
|
389
|
-
DEFAULT_CONTEXT_WINDOW,
|
|
390
|
-
getModelContextWindow,
|
|
391
|
-
getModelInfo,
|
|
392
247
|
readCacheReadInputTokens,
|
|
393
248
|
readCacheCreationInputTokens,
|
|
394
249
|
normalizeUsage,
|