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
|
@@ -7,130 +7,180 @@ import {
|
|
|
7
7
|
mergeAgentToolsWithRuntime,
|
|
8
8
|
projectDesktopToolUiContent,
|
|
9
9
|
resolveTurnToolContext
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-T6X3D7NB.js";
|
|
11
|
+
import "./chunk-KFHQQ3NO.js";
|
|
12
12
|
import {
|
|
13
13
|
CONTEXT_OVERFLOW_ACTIONS,
|
|
14
14
|
CONTEXT_TOO_LARGE_ACTIONS,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
15
|
+
extractErrorDiagnostics,
|
|
16
|
+
isContextOverflowText,
|
|
18
17
|
performServerProxyFetchWithRetry
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SMENBO3M.js";
|
|
20
19
|
import {
|
|
21
20
|
createSSEParser,
|
|
22
21
|
resolveAgentRequiredPackIds,
|
|
23
22
|
waitForAbortableDelay
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ES633ZS5.js";
|
|
25
24
|
import "./chunk-NF64D32W.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-XPWGOTBQ.js";
|
|
26
|
+
import "./chunk-ZIWPQEFU.js";
|
|
27
|
+
import "./chunk-CBHGZRCE.js";
|
|
28
|
+
import "./chunk-SCMHQUMK.js";
|
|
29
|
+
import "./chunk-RSHPU4PD.js";
|
|
30
|
+
import "./chunk-VIDPVFP3.js";
|
|
31
|
+
import "./chunk-AGIM7IMJ.js";
|
|
32
|
+
import "./chunk-GQN2WLAI.js";
|
|
33
|
+
import "./chunk-ZKZ5X2HS.js";
|
|
33
34
|
import {
|
|
35
|
+
clearForegroundTurnSettledVisible,
|
|
34
36
|
initMsgs,
|
|
37
|
+
markForegroundTurnSettledVisible,
|
|
35
38
|
messageStreamEnd,
|
|
36
39
|
messageStreaming,
|
|
37
40
|
prepareAndPersistUserMessage,
|
|
41
|
+
protectTransientForCanonicalHandoff,
|
|
42
|
+
releaseTransientCanonicalHandoff,
|
|
38
43
|
removeTransientMessage,
|
|
39
44
|
resolveHandleSendMessageContext,
|
|
40
45
|
selectAllMsgs,
|
|
41
46
|
setMessages,
|
|
42
47
|
setStreamingMessageId,
|
|
48
|
+
toolResultNeedsUserConfirmation,
|
|
43
49
|
updateToolMessage
|
|
44
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-556RW72X.js";
|
|
45
51
|
import "./chunk-523DITKR.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-UKZX3NHN.js";
|
|
53
|
+
import "./chunk-OFFL4DCR.js";
|
|
54
|
+
import "./chunk-QYPE3TS3.js";
|
|
48
55
|
import {
|
|
49
56
|
streamAgentChatTurn
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
57
|
+
} from "./chunk-IZ7OJB6K.js";
|
|
58
|
+
import "./chunk-4JH2UMJR.js";
|
|
59
|
+
import "./chunk-ZJ7UHBJS.js";
|
|
60
|
+
import "./chunk-BYXBJQAS.js";
|
|
61
|
+
import "./chunk-PLSVXHSA.js";
|
|
52
62
|
import "./chunk-5RGU3J7P.js";
|
|
53
|
-
import "./chunk-M76ECQRD.js";
|
|
54
63
|
import {
|
|
55
64
|
addActiveController,
|
|
56
65
|
getActiveDialogKey,
|
|
57
66
|
removeActiveController
|
|
58
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-OWYYDMGJ.js";
|
|
68
|
+
import "./chunk-ZRAU6T47.js";
|
|
69
|
+
import "./chunk-4LCOCOR5.js";
|
|
59
70
|
import "./chunk-YDH3FDFQ.js";
|
|
60
|
-
import "./chunk-MX574M24.js";
|
|
61
|
-
import "./chunk-4DPP773Q.js";
|
|
62
|
-
import "./chunk-VIDPVFP3.js";
|
|
63
|
-
import "./chunk-AGGIDPCZ.js";
|
|
64
|
-
import "./chunk-B2XUQXQX.js";
|
|
65
|
-
import {
|
|
66
|
-
expandEnabledPacks
|
|
67
|
-
} from "./chunk-6TPOEJMQ.js";
|
|
68
|
-
import "./chunk-AUDNYVRC.js";
|
|
69
|
-
import "./chunk-KHCLMKZZ.js";
|
|
70
|
-
import "./chunk-PQWU42UQ.js";
|
|
71
|
-
import "./chunk-AKG5W4LG.js";
|
|
72
|
-
import "./chunk-RYZINGPM.js";
|
|
73
|
-
import "./chunk-PSCNXBYA.js";
|
|
74
|
-
import "./chunk-L36OWPP3.js";
|
|
75
|
-
import "./chunk-BYXBJQAS.js";
|
|
76
|
-
import "./chunk-DWLEOOGR.js";
|
|
77
|
-
import "./chunk-7KVZ5LDQ.js";
|
|
78
|
-
import "./chunk-HNMXYYJR.js";
|
|
79
|
-
import "./chunk-3BXNTXYI.js";
|
|
80
|
-
import "./chunk-W7XHHYWM.js";
|
|
81
|
-
import "./chunk-RSEEDUMS.js";
|
|
82
|
-
import "./chunk-UAD2WT54.js";
|
|
83
|
-
import "./chunk-ZWQUWF6W.js";
|
|
84
|
-
import "./chunk-HDLLCBRF.js";
|
|
85
|
-
import "./chunk-4VJAC32I.js";
|
|
86
|
-
import {
|
|
87
|
-
canonicalizeToolName
|
|
88
|
-
} from "./chunk-XUWRURDF.js";
|
|
89
|
-
import "./chunk-5J3PYNUP.js";
|
|
90
|
-
import "./chunk-CYSYR67N.js";
|
|
91
|
-
import {
|
|
92
|
-
PLATFORM_LLM_BUSY_USER_MESSAGE
|
|
93
|
-
} from "./chunk-Y3PMXGLH.js";
|
|
94
71
|
import {
|
|
95
72
|
selectCurrentServer
|
|
96
|
-
} from "./chunk-
|
|
97
|
-
import "./chunk-
|
|
98
|
-
import "./chunk-
|
|
99
|
-
import "./chunk-
|
|
73
|
+
} from "./chunk-QFEW2ULV.js";
|
|
74
|
+
import "./chunk-XI7DGLUK.js";
|
|
75
|
+
import "./chunk-EDX5XSJM.js";
|
|
76
|
+
import "./chunk-UAD2WT54.js";
|
|
100
77
|
import {
|
|
101
78
|
readAndWait,
|
|
102
79
|
selectById
|
|
103
|
-
} from "./chunk-
|
|
104
|
-
import "./chunk-
|
|
105
|
-
import
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
import "./chunk-
|
|
109
|
-
import "./chunk-
|
|
110
|
-
import "./chunk-IAESIMK7.js";
|
|
111
|
-
import "./chunk-WIWM4FE3.js";
|
|
80
|
+
} from "./chunk-74RAWNQN.js";
|
|
81
|
+
import "./chunk-3PVYUPXK.js";
|
|
82
|
+
import "./chunk-A4MW3YZL.js";
|
|
83
|
+
import "./chunk-AIZE5TDM.js";
|
|
84
|
+
import "./chunk-4YRTZIVN.js";
|
|
85
|
+
import "./chunk-UEILX4EV.js";
|
|
86
|
+
import "./chunk-IJERIUXS.js";
|
|
112
87
|
import {
|
|
113
88
|
getIsDesktopApp
|
|
114
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-6Q7UTJKR.js";
|
|
90
|
+
import "./chunk-QQ56R7KS.js";
|
|
91
|
+
import "./chunk-OW765XBU.js";
|
|
115
92
|
import {
|
|
116
93
|
selectIdentityToken,
|
|
117
94
|
selectIdentityUserId
|
|
118
95
|
} from "./chunk-SEJ5OS6F.js";
|
|
119
|
-
import "./chunk-
|
|
120
|
-
import "./chunk-
|
|
121
|
-
import
|
|
122
|
-
|
|
96
|
+
import "./chunk-D2MDMY2M.js";
|
|
97
|
+
import "./chunk-HIQ4GF53.js";
|
|
98
|
+
import {
|
|
99
|
+
expandEnabledPacks
|
|
100
|
+
} from "./chunk-JZX2XLKC.js";
|
|
101
|
+
import "./chunk-EUGTFFO6.js";
|
|
102
|
+
import "./chunk-XETG4RIX.js";
|
|
103
|
+
import "./chunk-GKXCHNTE.js";
|
|
104
|
+
import "./chunk-GCKHQECX.js";
|
|
105
|
+
import "./chunk-WJZOQR2J.js";
|
|
106
|
+
import "./chunk-6CCFTVBP.js";
|
|
107
|
+
import "./chunk-BPMPOFWP.js";
|
|
108
|
+
import "./chunk-5MMAK75Q.js";
|
|
109
|
+
import "./chunk-DWLEOOGR.js";
|
|
110
|
+
import "./chunk-LIQJTQRN.js";
|
|
111
|
+
import "./chunk-UHTDNB5Y.js";
|
|
112
|
+
import "./chunk-KX6YBIHG.js";
|
|
113
|
+
import "./chunk-7DPNBQSV.js";
|
|
114
|
+
import {
|
|
115
|
+
canonicalizeToolName
|
|
116
|
+
} from "./chunk-5EBLANFT.js";
|
|
117
|
+
import "./chunk-NYYFIKHI.js";
|
|
118
|
+
import "./chunk-EZVK3N5L.js";
|
|
123
119
|
import {
|
|
124
120
|
extractCustomId
|
|
125
121
|
} from "./chunk-M2EJHDJP.js";
|
|
126
|
-
import
|
|
122
|
+
import {
|
|
123
|
+
createDialogMessageKeyAndId
|
|
124
|
+
} from "./chunk-5EMSBTQ6.js";
|
|
125
|
+
import "./chunk-I42VC5KR.js";
|
|
127
126
|
import "./chunk-U6VC4MU4.js";
|
|
127
|
+
import "./chunk-WWC7I6TA.js";
|
|
128
|
+
import "./chunk-PSCNXBYA.js";
|
|
129
|
+
import "./chunk-UBUH2TCC.js";
|
|
130
|
+
import "./chunk-I4SN4NUQ.js";
|
|
131
|
+
import "./chunk-5BHQICF2.js";
|
|
132
|
+
import "./chunk-KUG52IAP.js";
|
|
133
|
+
import "./chunk-3EUW3WEO.js";
|
|
134
|
+
import "./chunk-HNMXYYJR.js";
|
|
128
135
|
import "./chunk-LCBAMY2M.js";
|
|
129
136
|
import "./chunk-4SN6J65J.js";
|
|
130
137
|
import "./chunk-CF7PE763.js";
|
|
131
138
|
import "./chunk-G3SUCT4W.js";
|
|
139
|
+
import "./chunk-RVWMAFIT.js";
|
|
140
|
+
import {
|
|
141
|
+
PLATFORM_LLM_BUSY_USER_MESSAGE
|
|
142
|
+
} from "./chunk-CHCS6XPJ.js";
|
|
143
|
+
import "./chunk-QSJ3HFEF.js";
|
|
144
|
+
import "./chunk-ZWQUWF6W.js";
|
|
145
|
+
import "./chunk-KHCLMKZZ.js";
|
|
146
|
+
import "./chunk-VEA7H5FG.js";
|
|
147
|
+
import "./chunk-4VJAC32I.js";
|
|
132
148
|
import "./chunk-4VNS5WPM.js";
|
|
133
149
|
|
|
150
|
+
// packages/ai/agent/foregroundTurnStageLog.ts
|
|
151
|
+
var FOREGROUND_TURN_STAGE_LOG_PREFIX = "[foregroundTurn][latency]";
|
|
152
|
+
var isStageLogEnabled = () => {
|
|
153
|
+
try {
|
|
154
|
+
if (globalThis.__NOLO_FOREGROUND_TURN_STAGE_LOG__ === true) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
const storage = globalThis.localStorage;
|
|
158
|
+
return typeof storage?.getItem === "function" ? storage.getItem("nolo.foregroundTurn.stageLog") === "1" : false;
|
|
159
|
+
} catch {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function createForegroundTurnStageLog(args) {
|
|
164
|
+
const t0 = Date.now();
|
|
165
|
+
const identity = `turn=${args.turnKey} runId=${args.runId} dialogId=${args.dialogId} dialogKey=${args.dialogKey} base=${args.base}`;
|
|
166
|
+
const marks = [];
|
|
167
|
+
return {
|
|
168
|
+
stage: (stage, detail) => {
|
|
169
|
+
const at = Date.now() - t0;
|
|
170
|
+
marks.push(`${stage}=+${at}ms`);
|
|
171
|
+
if (!isStageLogEnabled()) return;
|
|
172
|
+
console.info(
|
|
173
|
+
`${FOREGROUND_TURN_STAGE_LOG_PREFIX} stage=${stage} t=+${at}ms ${identity}${detail ? ` ${detail}` : ""}`
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
summary: (outcome, detail) => {
|
|
177
|
+
console.info(
|
|
178
|
+
`${FOREGROUND_TURN_STAGE_LOG_PREFIX} SUMMARY outcome=${outcome} total=+${Date.now() - t0}ms ${identity} marks=[${marks.join(" ")}]${detail ? ` ${detail}` : ""}`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
134
184
|
// packages/ai/tools/effectiveToolSurface.ts
|
|
135
185
|
function readEffectiveToolName(value) {
|
|
136
186
|
if (typeof value === "string") {
|
|
@@ -184,6 +234,10 @@ function resolveEffectiveToolSurface(input) {
|
|
|
184
234
|
(Array.isArray(agent.disabledTools) ? agent.disabledTools : []).map(readEffectiveToolName).filter((name) => !!name)
|
|
185
235
|
);
|
|
186
236
|
for (const name of disabled) byName.delete(name);
|
|
237
|
+
const selectableCount = typeof input.selectableRuntimeCount === "number" ? input.selectableRuntimeCount : typeof input.runtimeCatalog?.selectableCount === "number" ? input.runtimeCatalog.selectableCount : void 0;
|
|
238
|
+
if (selectableCount !== void 0 && selectableCount <= 1) {
|
|
239
|
+
byName.delete("listRuntimes");
|
|
240
|
+
}
|
|
187
241
|
const entries = [...byName.entries()].map(
|
|
188
242
|
([name, sources]) => ({ name, sources: [...sources] })
|
|
189
243
|
);
|
|
@@ -218,12 +272,186 @@ function resolveEffectiveToolSurface(input) {
|
|
|
218
272
|
};
|
|
219
273
|
}
|
|
220
274
|
|
|
221
|
-
// packages/ai/
|
|
275
|
+
// packages/ai/tools/toolExecutionSemantics.ts
|
|
276
|
+
var UNKNOWN_TOOL_EXECUTION_CONTRACT = {
|
|
277
|
+
replay: "unknown",
|
|
278
|
+
sideEffects: "unknown",
|
|
279
|
+
locality: "unknown",
|
|
280
|
+
interaction: "unknown",
|
|
281
|
+
concurrency: "exclusive",
|
|
282
|
+
durableWebForeground: false
|
|
283
|
+
};
|
|
284
|
+
var serverPureRead = (durableWebForeground) => ({
|
|
285
|
+
replay: "pure",
|
|
286
|
+
sideEffects: "none",
|
|
287
|
+
locality: "server",
|
|
288
|
+
interaction: "none",
|
|
289
|
+
concurrency: "safe",
|
|
290
|
+
durableWebForeground
|
|
291
|
+
});
|
|
292
|
+
var serverExternalRead = (durableWebForeground) => ({
|
|
293
|
+
// Repeating the request should not mutate the target resource, but may spend
|
|
294
|
+
// provider quota/money and may observe newer remote state; it is not pure.
|
|
295
|
+
replay: "idempotent",
|
|
296
|
+
sideEffects: "observable",
|
|
297
|
+
locality: "server",
|
|
298
|
+
interaction: "none",
|
|
299
|
+
concurrency: "safe",
|
|
300
|
+
durableWebForeground
|
|
301
|
+
});
|
|
302
|
+
var serverConfirmedHandoffStep = () => ({
|
|
303
|
+
replay: "unsafe",
|
|
304
|
+
sideEffects: "observable",
|
|
305
|
+
locality: "server",
|
|
306
|
+
interaction: "handoff",
|
|
307
|
+
concurrency: "exclusive",
|
|
308
|
+
durableWebForeground: false
|
|
309
|
+
});
|
|
310
|
+
var TOOL_EXECUTION_CONTRACT = Object.freeze({
|
|
311
|
+
// Proven durable network reads. They execute on the server but touch external
|
|
312
|
+
// systems, so replay/cost semantics are intentionally not called "pure".
|
|
313
|
+
exa_search: serverExternalRead("read-only"),
|
|
314
|
+
fetchWebpage: serverExternalRead("read-only"),
|
|
315
|
+
// Proven durable server-hosted workspace reads/queries.
|
|
316
|
+
searchDialogMessages: serverPureRead("read-only"),
|
|
317
|
+
listDialogs: serverPureRead("read-only"),
|
|
318
|
+
readDialog: serverPureRead("read-only"),
|
|
319
|
+
queryDialogsBySubjectRef: serverPureRead("read-only"),
|
|
320
|
+
listAgents: serverPureRead("read-only"),
|
|
321
|
+
readAgent: serverPureRead("read-only"),
|
|
322
|
+
listSpaces: serverPureRead("read-only"),
|
|
323
|
+
readSpace: serverPureRead("read-only"),
|
|
324
|
+
readDoc: serverPureRead("read-only"),
|
|
325
|
+
readSkillDoc: serverPureRead("read-only"),
|
|
326
|
+
listTables: serverPureRead("read-only"),
|
|
327
|
+
queryTableRows: serverPureRead("read-only"),
|
|
328
|
+
// Read-only presentation payload. Actions remain inert; this adds no submit or
|
|
329
|
+
// open-app authority to server-owned projection.
|
|
330
|
+
show_interaction: {
|
|
331
|
+
replay: "pure",
|
|
332
|
+
sideEffects: "none",
|
|
333
|
+
locality: "server",
|
|
334
|
+
interaction: "none",
|
|
335
|
+
concurrency: "safe",
|
|
336
|
+
durableWebForeground: "read-only"
|
|
337
|
+
},
|
|
338
|
+
// Durable interactive boundary: the current execution ends and a later user
|
|
339
|
+
// choice starts a new execution. It is intentionally not modeled as a read.
|
|
340
|
+
ask_user: {
|
|
341
|
+
replay: "unsafe",
|
|
342
|
+
sideEffects: "observable",
|
|
343
|
+
locality: "server",
|
|
344
|
+
interaction: "blocking",
|
|
345
|
+
concurrency: "exclusive",
|
|
346
|
+
durableWebForeground: "interactive"
|
|
347
|
+
},
|
|
348
|
+
// Confirmed human hand-off boundary for the media step family. These tools
|
|
349
|
+
// do not start work needing authorization: they return
|
|
350
|
+
// `{ status: "requires_confirmation", ... }` and the run must stop and wait
|
|
351
|
+
// for the user. Registered explicitly (rather than inferred from any status)
|
|
352
|
+
// so a random tool echoing the same status never pauses the run, and kept out
|
|
353
|
+
// of the durable Web foreground plane on purpose (media ServerTool admission
|
|
354
|
+
// is owned elsewhere).
|
|
355
|
+
transcribe: serverConfirmedHandoffStep(),
|
|
356
|
+
translate: serverConfirmedHandoffStep(),
|
|
357
|
+
exportDocument: serverConfirmedHandoffStep(),
|
|
358
|
+
readArtifact: serverConfirmedHandoffStep(),
|
|
359
|
+
// Representative explicitly non-durable execution classes. These entries
|
|
360
|
+
// make the reason machine-readable; unlisted tools remain UNKNOWN.
|
|
361
|
+
execShell: {
|
|
362
|
+
replay: "unsafe",
|
|
363
|
+
sideEffects: "mutation",
|
|
364
|
+
locality: "workspace",
|
|
365
|
+
interaction: "none",
|
|
366
|
+
concurrency: "exclusive",
|
|
367
|
+
durableWebForeground: false
|
|
368
|
+
},
|
|
369
|
+
readFile: {
|
|
370
|
+
replay: "idempotent",
|
|
371
|
+
sideEffects: "none",
|
|
372
|
+
locality: "device",
|
|
373
|
+
interaction: "none",
|
|
374
|
+
concurrency: "safe",
|
|
375
|
+
durableWebForeground: false
|
|
376
|
+
},
|
|
377
|
+
globFiles: {
|
|
378
|
+
replay: "idempotent",
|
|
379
|
+
sideEffects: "none",
|
|
380
|
+
locality: "device",
|
|
381
|
+
interaction: "none",
|
|
382
|
+
concurrency: "safe",
|
|
383
|
+
durableWebForeground: false
|
|
384
|
+
},
|
|
385
|
+
createDoc: {
|
|
386
|
+
replay: "unsafe",
|
|
387
|
+
sideEffects: "mutation",
|
|
388
|
+
locality: "server",
|
|
389
|
+
interaction: "none",
|
|
390
|
+
concurrency: "exclusive",
|
|
391
|
+
durableWebForeground: false
|
|
392
|
+
},
|
|
393
|
+
updateDoc: {
|
|
394
|
+
replay: "unsafe",
|
|
395
|
+
sideEffects: "mutation",
|
|
396
|
+
locality: "server",
|
|
397
|
+
interaction: "none",
|
|
398
|
+
concurrency: "exclusive",
|
|
399
|
+
durableWebForeground: false
|
|
400
|
+
},
|
|
401
|
+
deleteDialogs: {
|
|
402
|
+
replay: "unsafe",
|
|
403
|
+
sideEffects: "mutation",
|
|
404
|
+
locality: "server",
|
|
405
|
+
interaction: "confirm",
|
|
406
|
+
concurrency: "exclusive",
|
|
407
|
+
durableWebForeground: false
|
|
408
|
+
},
|
|
409
|
+
loadSkill: {
|
|
410
|
+
replay: "unsafe",
|
|
411
|
+
sideEffects: "observable",
|
|
412
|
+
locality: "server",
|
|
413
|
+
interaction: "none",
|
|
414
|
+
concurrency: "exclusive",
|
|
415
|
+
durableWebForeground: false
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
function resolveToolExecutionContract(toolName) {
|
|
419
|
+
if (typeof toolName !== "string" || !toolName.trim()) {
|
|
420
|
+
return UNKNOWN_TOOL_EXECUTION_CONTRACT;
|
|
421
|
+
}
|
|
422
|
+
const canonicalName = canonicalizeToolName(toolName);
|
|
423
|
+
return TOOL_EXECUTION_CONTRACT[canonicalName] ?? UNKNOWN_TOOL_EXECUTION_CONTRACT;
|
|
424
|
+
}
|
|
425
|
+
function collectDurableWebToolNames(durableClass) {
|
|
426
|
+
return new Set(
|
|
427
|
+
Object.entries(TOOL_EXECUTION_CONTRACT).filter(([, contract]) => contract.durableWebForeground === durableClass).map(([name]) => name)
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
var DURABLE_WEB_FOREGROUND_READ_ONLY_TOOL_NAMES = collectDurableWebToolNames("read-only");
|
|
431
|
+
var DURABLE_WEB_FOREGROUND_INTERACTIVE_TOOL_NAMES = collectDurableWebToolNames("interactive");
|
|
222
432
|
var DURABLE_WEB_FOREGROUND_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"fetchWebpage"
|
|
433
|
+
...DURABLE_WEB_FOREGROUND_READ_ONLY_TOOL_NAMES,
|
|
434
|
+
...DURABLE_WEB_FOREGROUND_INTERACTIVE_TOOL_NAMES
|
|
226
435
|
]);
|
|
436
|
+
var CONFIRMED_HANDOFF_TOOL_NAMES = new Set(
|
|
437
|
+
Object.entries(TOOL_EXECUTION_CONTRACT).filter(([, contract]) => contract.interaction === "handoff").map(([name]) => name)
|
|
438
|
+
);
|
|
439
|
+
function hasProvenServerReadOnlySemantics(toolName) {
|
|
440
|
+
const contract = resolveToolExecutionContract(toolName);
|
|
441
|
+
return contract.durableWebForeground === "read-only" && (contract.replay === "pure" || contract.replay === "idempotent") && (contract.sideEffects === "none" || contract.sideEffects === "observable") && contract.locality === "server" && contract.interaction === "none";
|
|
442
|
+
}
|
|
443
|
+
function hasProvenDurableWebForegroundSemantics(toolName) {
|
|
444
|
+
const contract = resolveToolExecutionContract(toolName);
|
|
445
|
+
if (contract.durableWebForeground === "read-only") {
|
|
446
|
+
return hasProvenServerReadOnlySemantics(toolName);
|
|
447
|
+
}
|
|
448
|
+
if (contract.durableWebForeground === "interactive") {
|
|
449
|
+
return contract.locality === "server" && contract.interaction === "blocking" && contract.sideEffects === "observable";
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// packages/ai/agent/serverOwnedWebForegroundEligibility.ts
|
|
227
455
|
var AUDITED_WEB_FOREGROUND_HOST_BASELINE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
228
456
|
// TOOL_PACKS.CORE
|
|
229
457
|
"read",
|
|
@@ -233,6 +461,8 @@ var AUDITED_WEB_FOREGROUND_HOST_BASELINE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
233
461
|
"search_workspace",
|
|
234
462
|
"updateSelf",
|
|
235
463
|
"ask_user",
|
|
464
|
+
// show_interaction: CORE 宿主注入;服务端纯函数展示(parse + fallback,无 I/O、无客户端通道),只读展示语义,不执行卡片动作
|
|
465
|
+
"show_interaction",
|
|
236
466
|
"createAgentAutomation",
|
|
237
467
|
"updateAgentAutomation",
|
|
238
468
|
"deleteAgentAutomation",
|
|
@@ -246,23 +476,24 @@ var AUDITED_WEB_FOREGROUND_HOST_BASELINE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
246
476
|
// Default system capabilities
|
|
247
477
|
"exa_search",
|
|
248
478
|
"fetchWebpage",
|
|
249
|
-
"setTodoList",
|
|
250
479
|
"startAgentRun",
|
|
251
480
|
"controlAgentRun",
|
|
252
481
|
"listAgents"
|
|
253
482
|
]);
|
|
483
|
+
function isDurableRequestedToolName(name) {
|
|
484
|
+
if (typeof name !== "string") return false;
|
|
485
|
+
return hasProvenDurableWebForegroundSemantics(canonicalizeToolName(name));
|
|
486
|
+
}
|
|
254
487
|
function hasSupportedDurableToolSurface(agent, suppliedSurface) {
|
|
255
488
|
const surface = suppliedSurface ?? resolveEffectiveToolSurface({
|
|
256
489
|
agent
|
|
257
490
|
});
|
|
258
491
|
if (surface.shellEnabled || surface.workspaceLease) return false;
|
|
259
|
-
if (!surface.requestedNames.every(
|
|
260
|
-
(name) => DURABLE_WEB_FOREGROUND_TOOL_NAMES.has(name)
|
|
261
|
-
)) {
|
|
492
|
+
if (!surface.requestedNames.every(isDurableRequestedToolName)) {
|
|
262
493
|
return false;
|
|
263
494
|
}
|
|
264
495
|
return surface.hostInjectedNames.every(
|
|
265
|
-
(name) => AUDITED_WEB_FOREGROUND_HOST_BASELINE_TOOL_NAMES.has(name)
|
|
496
|
+
(name) => AUDITED_WEB_FOREGROUND_HOST_BASELINE_TOOL_NAMES.has(canonicalizeToolName(name))
|
|
266
497
|
);
|
|
267
498
|
}
|
|
268
499
|
function shouldUseServerOwnedWebForegroundTurn(input) {
|
|
@@ -278,7 +509,7 @@ function shouldUseServerOwnedWebForegroundTurn(input) {
|
|
|
278
509
|
...input.turnToolContext.referencedToolNames,
|
|
279
510
|
...input.turnToolContext.mentionedToolNames
|
|
280
511
|
];
|
|
281
|
-
if (lateBound.some((name) => !
|
|
512
|
+
if (lateBound.some((name) => !isDurableRequestedToolName(name))) {
|
|
282
513
|
return false;
|
|
283
514
|
}
|
|
284
515
|
}
|
|
@@ -292,15 +523,12 @@ function shouldUseServerOwnedWebForegroundTurn(input) {
|
|
|
292
523
|
const runtimeOptions = input.runtimeOptions;
|
|
293
524
|
if (runtimeOptions?.extraTools?.length) {
|
|
294
525
|
if (!input.effectiveToolSurface) return false;
|
|
295
|
-
if (runtimeOptions.extraTools.some(
|
|
296
|
-
(name) => typeof name === "string" && !DURABLE_WEB_FOREGROUND_TOOL_NAMES.has(name)
|
|
297
|
-
)) {
|
|
526
|
+
if (runtimeOptions.extraTools.some((name) => !isDurableRequestedToolName(name))) {
|
|
298
527
|
return false;
|
|
299
528
|
}
|
|
300
529
|
}
|
|
301
530
|
if (runtimeOptions?.editingTarget) return false;
|
|
302
531
|
if (runtimeOptions?.imageConfigOverride) return false;
|
|
303
|
-
if (runtimeOptions?.quickChatModelOverride) return false;
|
|
304
532
|
if (runtimeOptions?.workspaceToolsHint) return false;
|
|
305
533
|
if (runtimeOptions?.cwd) return false;
|
|
306
534
|
if (runtimeOptions?.restrictShellToWorkspace) return false;
|
|
@@ -381,11 +609,7 @@ function createServerOwnedToolProjection(args) {
|
|
|
381
609
|
if (!toolName || !supported.has(toolName)) return;
|
|
382
610
|
const metadata = payload.metadata && typeof payload.metadata === "object" && !Array.isArray(payload.metadata) ? payload.metadata : void 0;
|
|
383
611
|
const failed = isToolResultFailure(payload.content, metadata);
|
|
384
|
-
const content = toolName === "ask_user" ? typeof payload.content === "string" ? payload.content : "" : projectDesktopToolUiContent({
|
|
385
|
-
toolName,
|
|
386
|
-
content: payload.content,
|
|
387
|
-
metadata
|
|
388
|
-
});
|
|
612
|
+
const content = toolName === "ask_user" ? typeof payload.content === "string" ? payload.content : "" : projectDesktopToolUiContent({ toolName, content: payload.content, metadata });
|
|
389
613
|
const base = existing ?? (() => {
|
|
390
614
|
const { key, messageId } = createDialogMessageKeyAndId(args.dialogId);
|
|
391
615
|
return {
|
|
@@ -406,17 +630,21 @@ function createServerOwnedToolProjection(args) {
|
|
|
406
630
|
...args.messageMetadata
|
|
407
631
|
};
|
|
408
632
|
})();
|
|
409
|
-
const staysReadOnly = keepReadOnly.has(toolName);
|
|
633
|
+
const staysReadOnly = !failed && keepReadOnly.has(toolName);
|
|
634
|
+
const awaitingUserConfirmation = toolResultNeedsUserConfirmation(toolName, payload.content);
|
|
410
635
|
const toolPayload = {
|
|
411
636
|
...base.toolPayload ?? {},
|
|
412
637
|
toolName,
|
|
413
|
-
status: staysReadOnly ? "running" : failed ? "failed" : "succeeded"
|
|
638
|
+
status: staysReadOnly ? "running" : awaitingUserConfirmation ? "pending" : failed ? "failed" : "succeeded"
|
|
414
639
|
};
|
|
415
640
|
const message = {
|
|
416
641
|
...base,
|
|
417
642
|
content,
|
|
418
643
|
isStreaming: staysReadOnly,
|
|
419
644
|
toolName,
|
|
645
|
+
// F1: surface server-projected metadata (incl. executionLocation) on the
|
|
646
|
+
// message so tool rows can render the actual execution host.
|
|
647
|
+
...metadata ? { metadata } : {},
|
|
420
648
|
toolPayload
|
|
421
649
|
};
|
|
422
650
|
transientByCallId.set(callId, message);
|
|
@@ -435,7 +663,8 @@ function createServerOwnedToolProjection(args) {
|
|
|
435
663
|
content,
|
|
436
664
|
isStreaming: false,
|
|
437
665
|
toolName,
|
|
438
|
-
toolPayload
|
|
666
|
+
toolPayload,
|
|
667
|
+
...metadata ? { metadata } : {}
|
|
439
668
|
}
|
|
440
669
|
})
|
|
441
670
|
);
|
|
@@ -450,19 +679,55 @@ function createServerOwnedToolProjection(args) {
|
|
|
450
679
|
}
|
|
451
680
|
|
|
452
681
|
// packages/ai/agent/serverOwnedWebForegroundHandoff.ts
|
|
682
|
+
function normalizeComparableText(value) {
|
|
683
|
+
if (typeof value === "string") {
|
|
684
|
+
return value.replace(/\r\n/g, "\n").trimEnd();
|
|
685
|
+
}
|
|
686
|
+
if (!Array.isArray(value)) return "";
|
|
687
|
+
return value.flatMap((part) => {
|
|
688
|
+
if (!part || typeof part !== "object") return [];
|
|
689
|
+
const record = part;
|
|
690
|
+
if (record.type === "text" && typeof record.text === "string") {
|
|
691
|
+
return [record.text];
|
|
692
|
+
}
|
|
693
|
+
return [];
|
|
694
|
+
}).join("").replace(/\r\n/g, "\n").trimEnd();
|
|
695
|
+
}
|
|
453
696
|
function assistantText(message) {
|
|
454
|
-
return
|
|
697
|
+
return normalizeComparableText(message.content);
|
|
698
|
+
}
|
|
699
|
+
function assistantThinking(message) {
|
|
700
|
+
const value = typeof message.thinkContent === "string" ? message.thinkContent : typeof message.reasoning_content === "string" ? message.reasoning_content : "";
|
|
701
|
+
return normalizeComparableText(value);
|
|
455
702
|
}
|
|
456
|
-
function
|
|
703
|
+
function assistantAgentKey(message) {
|
|
704
|
+
const value = message.agentKey ?? message.cybotKey;
|
|
705
|
+
return typeof value === "string" ? value : "";
|
|
706
|
+
}
|
|
707
|
+
function findNewCanonicalAssistant(messages, initialMessageIds, transientId, expectedText, expectedThinking, expectedAgentKey) {
|
|
457
708
|
const transient = messages.find((message) => message?.id === transientId);
|
|
458
|
-
const completedText =
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return
|
|
709
|
+
const completedText = normalizeComparableText(
|
|
710
|
+
expectedText !== void 0 ? expectedText : transient ? assistantText(transient) : ""
|
|
711
|
+
);
|
|
712
|
+
const completedThinking = normalizeComparableText(
|
|
713
|
+
expectedThinking !== void 0 ? expectedThinking : transient ? assistantThinking(transient) : ""
|
|
714
|
+
);
|
|
715
|
+
const candidates = messages.filter((message) => {
|
|
716
|
+
if (!message?.id || message.id === transientId) return false;
|
|
717
|
+
if (initialMessageIds.has(message.id)) return false;
|
|
718
|
+
if (message.role !== "assistant") return false;
|
|
719
|
+
if (message.isStreaming) return false;
|
|
720
|
+
if (completedText) return assistantText(message) === completedText;
|
|
721
|
+
if (completedThinking) return assistantThinking(message) === completedThinking;
|
|
722
|
+
return false;
|
|
723
|
+
});
|
|
724
|
+
if (candidates.length === 0) return null;
|
|
725
|
+
if (candidates.length === 1) return candidates[0] ?? null;
|
|
726
|
+
if (expectedAgentKey) {
|
|
727
|
+
const agentMatches = candidates.filter(
|
|
728
|
+
(message) => assistantAgentKey(message) === expectedAgentKey
|
|
729
|
+
);
|
|
730
|
+
if (agentMatches.length === 1) return agentMatches[0] ?? null;
|
|
466
731
|
}
|
|
467
732
|
return null;
|
|
468
733
|
}
|
|
@@ -475,7 +740,9 @@ async function waitForNewCanonicalAssistant(args) {
|
|
|
475
740
|
args.readMessages(),
|
|
476
741
|
args.initialMessageIds,
|
|
477
742
|
args.transientId,
|
|
478
|
-
args.expectedText
|
|
743
|
+
args.expectedText,
|
|
744
|
+
args.expectedThinking,
|
|
745
|
+
args.expectedAgentKey
|
|
479
746
|
);
|
|
480
747
|
if (canonical) return canonical;
|
|
481
748
|
if (Date.now() >= deadline) return null;
|
|
@@ -529,7 +796,48 @@ function resolveServerOwnedWebEffectiveToolSurface(args) {
|
|
|
529
796
|
};
|
|
530
797
|
}
|
|
531
798
|
|
|
799
|
+
// packages/ai/agent/serverOwnedAssistantStream.ts
|
|
800
|
+
var EMPTY_SERVER_OWNED_ASSISTANT_STREAM = {
|
|
801
|
+
text: "",
|
|
802
|
+
thinking: "",
|
|
803
|
+
segmentText: "",
|
|
804
|
+
segmentThinking: ""
|
|
805
|
+
};
|
|
806
|
+
function applyServerOwnedAssistantStreamPayload(state, payload) {
|
|
807
|
+
if (payload?.type === "thinking" && typeof payload.content === "string") {
|
|
808
|
+
return {
|
|
809
|
+
...state,
|
|
810
|
+
thinking: state.thinking + payload.content,
|
|
811
|
+
segmentThinking: state.segmentThinking + payload.content
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
if (payload?.type === "text" && typeof payload.content === "string") {
|
|
815
|
+
return {
|
|
816
|
+
...state,
|
|
817
|
+
text: state.text + payload.content,
|
|
818
|
+
segmentText: state.segmentText + payload.content
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
if (payload?.type === "assistant_tool_calls") {
|
|
822
|
+
if (!state.segmentText && !state.segmentThinking) return state;
|
|
823
|
+
return {
|
|
824
|
+
...state,
|
|
825
|
+
segmentText: "",
|
|
826
|
+
segmentThinking: ""
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
return state;
|
|
830
|
+
}
|
|
831
|
+
|
|
532
832
|
// packages/ai/agent/serverOwnedWebForegroundTurn.ts
|
|
833
|
+
var SERVER_OWNED_CANONICAL_HANDOFF_PROTECT_MS = 65e3;
|
|
834
|
+
function resolveServerOwnedWebAllowedToolNames(toolNames) {
|
|
835
|
+
return Array.from(
|
|
836
|
+
new Set(
|
|
837
|
+
toolNames.filter((name) => typeof name === "string").map((name) => canonicalizeToolName(name)).filter((name) => DURABLE_WEB_FOREGROUND_TOOL_NAMES.has(name))
|
|
838
|
+
)
|
|
839
|
+
);
|
|
840
|
+
}
|
|
533
841
|
function detectServerOwnedCandidateSurface() {
|
|
534
842
|
return typeof window !== "undefined" && typeof document !== "undefined" ? "web" : "non-web";
|
|
535
843
|
}
|
|
@@ -550,7 +858,7 @@ async function canRunServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
550
858
|
let agentConfig = args.agentConfig ?? void 0;
|
|
551
859
|
if (!agentConfig) {
|
|
552
860
|
try {
|
|
553
|
-
const { readAndWait: readAndWait2 } = await import("./dbSlice-
|
|
861
|
+
const { readAndWait: readAndWait2 } = await import("./dbSlice-J37OGIXH.js");
|
|
554
862
|
agentConfig = await thunk.dispatch(readAndWait2(args.agentKey)).unwrap();
|
|
555
863
|
} catch {
|
|
556
864
|
return { eligible: false };
|
|
@@ -571,19 +879,26 @@ async function canRunServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
571
879
|
state,
|
|
572
880
|
turnToolContext
|
|
573
881
|
});
|
|
882
|
+
const eligible = shouldUseServerOwnedWebForegroundTurn({
|
|
883
|
+
surface: detectServerOwnedCandidateSurface(),
|
|
884
|
+
agentConfig,
|
|
885
|
+
effectiveToolSurface,
|
|
886
|
+
turnToolContext,
|
|
887
|
+
userInput: args.userInput,
|
|
888
|
+
runtimeOptions: args.runtimeOptions,
|
|
889
|
+
currentServer,
|
|
890
|
+
token,
|
|
891
|
+
isDesktopApp: getIsDesktopApp()
|
|
892
|
+
});
|
|
893
|
+
if (!eligible) {
|
|
894
|
+
return { eligible: false, agentConfig };
|
|
895
|
+
}
|
|
574
896
|
return {
|
|
575
|
-
eligible:
|
|
576
|
-
|
|
577
|
-
agentConfig,
|
|
578
|
-
effectiveToolSurface
|
|
579
|
-
|
|
580
|
-
userInput: args.userInput,
|
|
581
|
-
runtimeOptions: args.runtimeOptions,
|
|
582
|
-
currentServer,
|
|
583
|
-
token,
|
|
584
|
-
isDesktopApp: getIsDesktopApp()
|
|
585
|
-
}),
|
|
586
|
-
agentConfig
|
|
897
|
+
eligible: true,
|
|
898
|
+
agentConfig: {
|
|
899
|
+
...agentConfig,
|
|
900
|
+
tools: resolveServerOwnedWebAllowedToolNames(effectiveToolSurface.names)
|
|
901
|
+
}
|
|
587
902
|
};
|
|
588
903
|
} catch {
|
|
589
904
|
return { eligible: false };
|
|
@@ -612,8 +927,22 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
612
927
|
const { key: transientKey, messageId: transientId } = createDialogMessageKeyAndId(dialogId);
|
|
613
928
|
const controller = new AbortController();
|
|
614
929
|
const loopKey = `server-owned:${dialogId}:${transientId}`;
|
|
615
|
-
let
|
|
930
|
+
let assistantStream = EMPTY_SERVER_OWNED_ASSISTANT_STREAM;
|
|
616
931
|
let sawDone = false;
|
|
932
|
+
let clientControllerReleased = false;
|
|
933
|
+
let visibleFinalized = false;
|
|
934
|
+
let sawFirstDelta = false;
|
|
935
|
+
let observedExecutionId = "";
|
|
936
|
+
let canonicalVisible = false;
|
|
937
|
+
const stageLog = createForegroundTurnStageLog({
|
|
938
|
+
turnKey: loopKey,
|
|
939
|
+
// This path's server run identity IS the dialogId; executionId stays in the
|
|
940
|
+
// SUMMARY detail to tell multiple runs of the same dialog apart.
|
|
941
|
+
runId: dialogId,
|
|
942
|
+
dialogKey,
|
|
943
|
+
dialogId,
|
|
944
|
+
base: currentServer
|
|
945
|
+
});
|
|
617
946
|
const toolProjection = createServerOwnedToolProjection({
|
|
618
947
|
dialogId,
|
|
619
948
|
dispatch: thunk.dispatch,
|
|
@@ -623,20 +952,85 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
623
952
|
userId
|
|
624
953
|
},
|
|
625
954
|
supportedToolNames: DURABLE_WEB_FOREGROUND_TOOL_NAMES,
|
|
626
|
-
keepReadOnlyUntilCanonical: ["ask_user"]
|
|
955
|
+
keepReadOnlyUntilCanonical: ["ask_user", "show_interaction"]
|
|
627
956
|
});
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
957
|
+
const projectAssistant = () => {
|
|
958
|
+
thunk.dispatch(
|
|
959
|
+
messageStreaming({
|
|
960
|
+
id: transientId,
|
|
961
|
+
dialogId,
|
|
962
|
+
dbKey: transientKey,
|
|
963
|
+
role: "assistant",
|
|
964
|
+
content: assistantStream.text,
|
|
965
|
+
thinkContent: assistantStream.thinking,
|
|
966
|
+
cybotKey: args.agentKey,
|
|
967
|
+
agentKey: args.agentKey,
|
|
968
|
+
userId
|
|
969
|
+
})
|
|
970
|
+
);
|
|
971
|
+
};
|
|
972
|
+
const releaseClientController = () => {
|
|
973
|
+
if (clientControllerReleased) return;
|
|
974
|
+
clientControllerReleased = true;
|
|
975
|
+
thunk.dispatch(removeActiveController({ messageId: loopKey, dialogKey }));
|
|
976
|
+
clearForegroundTurnSettledVisible(dialogId);
|
|
977
|
+
stageLog.stage("controller-release");
|
|
978
|
+
};
|
|
979
|
+
const finalizeVisibleProjectionOnDone = () => {
|
|
980
|
+
if (visibleFinalized) return;
|
|
981
|
+
visibleFinalized = true;
|
|
982
|
+
protectTransientForCanonicalHandoff(
|
|
632
983
|
dialogId,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
984
|
+
transientId,
|
|
985
|
+
SERVER_OWNED_CANONICAL_HANDOFF_PROTECT_MS
|
|
986
|
+
);
|
|
987
|
+
finishTransientImmediately();
|
|
988
|
+
markForegroundTurnSettledVisible(dialogId);
|
|
989
|
+
};
|
|
990
|
+
const finishTransientImmediately = () => {
|
|
991
|
+
const transient = selectAllMsgs(thunk.getState(), dialogId).find((message) => message?.id === transientId);
|
|
992
|
+
if (transient) {
|
|
993
|
+
thunk.dispatch(
|
|
994
|
+
setMessages({
|
|
995
|
+
dialogId,
|
|
996
|
+
messages: [{
|
|
997
|
+
...transient,
|
|
998
|
+
content: assistantStream.text,
|
|
999
|
+
thinkContent: assistantStream.thinking,
|
|
1000
|
+
isStreaming: false
|
|
1001
|
+
}]
|
|
1002
|
+
})
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
setStreamingMessageId(dialogId, null);
|
|
1006
|
+
};
|
|
1007
|
+
const removeTransientWhenCanonicalArrives = () => {
|
|
1008
|
+
void waitForNewCanonicalAssistant({
|
|
1009
|
+
readMessages: () => selectAllMsgs(thunk.getState(), dialogId),
|
|
1010
|
+
initialMessageIds,
|
|
1011
|
+
transientId,
|
|
1012
|
+
// The server persists a new assistant trace segment after every tool
|
|
1013
|
+
// boundary. Fingerprint only the final segment here; the live transient
|
|
1014
|
+
// intentionally keeps the concatenated presentation until canonical rows
|
|
1015
|
+
// replace it.
|
|
1016
|
+
expectedText: assistantStream.segmentText,
|
|
1017
|
+
expectedThinking: assistantStream.segmentThinking,
|
|
1018
|
+
expectedAgentKey: args.agentKey,
|
|
1019
|
+
timeoutMs: 6e4,
|
|
1020
|
+
pollMs: 100
|
|
1021
|
+
}).then((canonical) => {
|
|
1022
|
+
if (!canonical) return;
|
|
1023
|
+
toolProjection.cleanup();
|
|
1024
|
+
thunk.dispatch(removeTransientMessage({ id: transientId, dialogId }));
|
|
1025
|
+
}).catch(() => {
|
|
1026
|
+
}).finally(() => {
|
|
1027
|
+
releaseTransientCanonicalHandoff(dialogId, transientId);
|
|
1028
|
+
});
|
|
1029
|
+
};
|
|
1030
|
+
thunk.dispatch(addActiveController({ messageId: loopKey, controller, dialogKey }));
|
|
1031
|
+
projectAssistant();
|
|
1032
|
+
const allowedToolNames = resolveServerOwnedWebAllowedToolNames(
|
|
1033
|
+
Array.isArray(args.agentConfig.tools) ? args.agentConfig.tools : []
|
|
640
1034
|
);
|
|
641
1035
|
const body = JSON.stringify({
|
|
642
1036
|
agentKey: args.agentKey,
|
|
@@ -656,6 +1050,11 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
656
1050
|
"client-user-prepersisted",
|
|
657
1051
|
"durable-tool-cards"
|
|
658
1052
|
],
|
|
1053
|
+
// This is the exact post-filter surface produced during admission, not a
|
|
1054
|
+
// global durable superset. Server-private defaults and machine tools are
|
|
1055
|
+
// injected before this constraint, then intersected back to this turn's
|
|
1056
|
+
// admitted names. Direct run() callers are sanitized again above.
|
|
1057
|
+
allowedToolNames,
|
|
659
1058
|
...args.dialogConfig.agentMode === "auto" ? { dialogAgentMode: "auto" } : { dialogAgentMode: "fixed" }
|
|
660
1059
|
},
|
|
661
1060
|
...args.runtimeOptions ? { runtimeOptions: args.runtimeOptions } : {},
|
|
@@ -671,6 +1070,10 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
671
1070
|
},
|
|
672
1071
|
signal: controller.signal
|
|
673
1072
|
});
|
|
1073
|
+
stageLog.stage(
|
|
1074
|
+
"run-fetch-start",
|
|
1075
|
+
`endpoint=${currentServer}/api/agent/run agentKey=${args.agentKey}`
|
|
1076
|
+
);
|
|
674
1077
|
try {
|
|
675
1078
|
let response;
|
|
676
1079
|
try {
|
|
@@ -688,12 +1091,16 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
688
1091
|
});
|
|
689
1092
|
return { serverOwned: true, detached: true };
|
|
690
1093
|
}
|
|
1094
|
+
stageLog.stage("headers", `status=${response.status} ok=${response.ok}`);
|
|
691
1095
|
if (!response.ok) {
|
|
692
1096
|
const text = await response.text().catch(() => "");
|
|
693
1097
|
throw new Error(text || `Agent run failed (${response.status})`);
|
|
694
1098
|
}
|
|
695
1099
|
const reader = response.body?.getReader();
|
|
696
|
-
if (!reader)
|
|
1100
|
+
if (!reader) {
|
|
1101
|
+
stageLog.stage("no-stream-body");
|
|
1102
|
+
return { serverOwned: true, detached: true };
|
|
1103
|
+
}
|
|
697
1104
|
const parseSSE = createSSEParser();
|
|
698
1105
|
const decoder = new TextDecoder();
|
|
699
1106
|
const outcome = await consumeAgentRunStream({
|
|
@@ -706,39 +1113,63 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
706
1113
|
onAbort: async () => {
|
|
707
1114
|
},
|
|
708
1115
|
onPayload: (payload) => {
|
|
1116
|
+
if (payload?.type === "dialog") {
|
|
1117
|
+
observedExecutionId = typeof payload.executionId === "string" ? payload.executionId.trim() : "";
|
|
1118
|
+
}
|
|
709
1119
|
if (payload?.type === "error") {
|
|
710
1120
|
return { reject: payload.message || "Agent execution failed" };
|
|
711
1121
|
}
|
|
712
1122
|
toolProjection.handlePayload(payload);
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1123
|
+
const nextAssistantStream = applyServerOwnedAssistantStreamPayload(
|
|
1124
|
+
assistantStream,
|
|
1125
|
+
payload
|
|
1126
|
+
);
|
|
1127
|
+
if (nextAssistantStream !== assistantStream) {
|
|
1128
|
+
assistantStream = nextAssistantStream;
|
|
1129
|
+
projectAssistant();
|
|
1130
|
+
if (!sawFirstDelta && payload?.type !== "done") {
|
|
1131
|
+
sawFirstDelta = true;
|
|
1132
|
+
stageLog.stage(
|
|
1133
|
+
"first-delta",
|
|
1134
|
+
`payloadType=${payload?.type} executionId=${observedExecutionId}`
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
if (payload?.type === "done" && !visibleFinalized) {
|
|
1139
|
+
stageLog.stage("done-frame", `executionId=${observedExecutionId}`);
|
|
1140
|
+
finalizeVisibleProjectionOnDone();
|
|
727
1141
|
}
|
|
728
1142
|
}
|
|
729
1143
|
});
|
|
1144
|
+
stageLog.stage(
|
|
1145
|
+
"eof",
|
|
1146
|
+
outcome.outcome === "streamEnded" ? `outcome=streamEnded sawDone=${outcome.sawDone} executionId=${observedExecutionId}` : `outcome=${outcome.outcome}`
|
|
1147
|
+
);
|
|
730
1148
|
if (outcome.outcome === "aborted") return { serverOwned: true, aborted: true };
|
|
731
1149
|
if (outcome.outcome === "rejected") throw new Error(outcome.message);
|
|
732
1150
|
if (!outcome.sawDone) return { serverOwned: true, detached: true };
|
|
733
1151
|
sawDone = true;
|
|
734
|
-
|
|
1152
|
+
finalizeVisibleProjectionOnDone();
|
|
735
1153
|
try {
|
|
736
|
-
|
|
1154
|
+
stageLog.stage("init-msgs-start", `dialogKey=${dialogKey}`);
|
|
1155
|
+
const initMsgsStartedAt = Date.now();
|
|
1156
|
+
await thunk.dispatch(
|
|
1157
|
+
initMsgs({
|
|
1158
|
+
dialogId,
|
|
1159
|
+
dialogKey,
|
|
1160
|
+
preferredServerOrigin: currentServer
|
|
1161
|
+
})
|
|
1162
|
+
).unwrap();
|
|
1163
|
+
stageLog.stage("init-msgs-end", `ms=${Date.now() - initMsgsStartedAt}`);
|
|
737
1164
|
canonicalVisible = !!await waitForNewCanonicalAssistant({
|
|
738
1165
|
readMessages: () => selectAllMsgs(thunk.getState(), dialogId),
|
|
739
1166
|
initialMessageIds,
|
|
740
1167
|
transientId,
|
|
741
|
-
expectedText:
|
|
1168
|
+
expectedText: assistantStream.segmentText,
|
|
1169
|
+
expectedThinking: assistantStream.segmentThinking,
|
|
1170
|
+
expectedAgentKey: args.agentKey,
|
|
1171
|
+
timeoutMs: 350,
|
|
1172
|
+
pollMs: 25
|
|
742
1173
|
});
|
|
743
1174
|
} catch (error) {
|
|
744
1175
|
console.warn("[chat] server-owned canonical handoff refresh failed", {
|
|
@@ -747,32 +1178,33 @@ async function runServerOwnedWebForegroundTurn(args, thunk) {
|
|
|
747
1178
|
});
|
|
748
1179
|
}
|
|
749
1180
|
if (canonicalVisible) {
|
|
1181
|
+
releaseTransientCanonicalHandoff(dialogId, transientId);
|
|
750
1182
|
toolProjection.cleanup();
|
|
751
1183
|
thunk.dispatch(removeTransientMessage({ id: transientId, dialogId }));
|
|
752
1184
|
} else {
|
|
753
1185
|
toolProjection.cleanup();
|
|
754
|
-
|
|
755
|
-
if (transient) {
|
|
756
|
-
thunk.dispatch(
|
|
757
|
-
setMessages({
|
|
758
|
-
dialogId,
|
|
759
|
-
messages: [{ ...transient, isStreaming: false }]
|
|
760
|
-
})
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
setStreamingMessageId(dialogId, null);
|
|
1186
|
+
removeTransientWhenCanonicalArrives();
|
|
764
1187
|
console.warn(
|
|
765
|
-
"[chat] server-owned canonical message not visible after done; keeping transient
|
|
1188
|
+
"[chat] server-owned canonical message not visible after done; keeping finished transient until canonical arrives",
|
|
766
1189
|
{ dialogId, transientId }
|
|
767
1190
|
);
|
|
768
1191
|
}
|
|
769
1192
|
return { serverOwned: true };
|
|
770
1193
|
} finally {
|
|
771
|
-
|
|
772
|
-
if (!sawDone) {
|
|
1194
|
+
releaseClientController();
|
|
1195
|
+
if (!sawDone && !visibleFinalized) {
|
|
1196
|
+
releaseTransientCanonicalHandoff(dialogId, transientId);
|
|
773
1197
|
toolProjection.cleanup();
|
|
774
1198
|
thunk.dispatch(removeTransientMessage({ id: transientId, dialogId }));
|
|
775
1199
|
}
|
|
1200
|
+
if (visibleFinalized && !sawDone) {
|
|
1201
|
+
toolProjection.cleanup();
|
|
1202
|
+
removeTransientWhenCanonicalArrives();
|
|
1203
|
+
}
|
|
1204
|
+
stageLog.summary(
|
|
1205
|
+
controller.signal.aborted ? "aborted" : sawDone ? "done" : visibleFinalized ? "done-visible-only" : "no-done",
|
|
1206
|
+
`runId=${dialogId} executionId=${observedExecutionId} canonicalVisible=${canonicalVisible} settledVisible=${visibleFinalized}`
|
|
1207
|
+
);
|
|
776
1208
|
}
|
|
777
1209
|
}
|
|
778
1210
|
|
|
@@ -877,6 +1309,22 @@ function parseSendError(errorInput) {
|
|
|
877
1309
|
domain = first ? asString(first.domain) : void 0;
|
|
878
1310
|
}
|
|
879
1311
|
const stage = resolveErrorStage(fullErrorText);
|
|
1312
|
+
const inputRecord = asRecord(errorInput);
|
|
1313
|
+
const authCode = asString(inputRecord?.authCode) ?? asString(inputRecord?.code);
|
|
1314
|
+
const hasPlatformAuthCode = /^AUTH_[A-Z0-9_]+$/.test(authCode ?? "") || /\bAUTH_[A-Z0-9_]+\b/.test(fullErrorText);
|
|
1315
|
+
const isPlatformProviderFailure = /\bplatform provider failed\b/i.test(fullErrorText);
|
|
1316
|
+
const isLoginStatus = statusCode === void 0 || statusCode === 401;
|
|
1317
|
+
const requiresLogin = isLoginStatus && !url && !/validation_required|api[_ -]?key/i.test(fullErrorText) && (hasPlatformAuthCode || isPlatformProviderFailure && statusCode === 401);
|
|
1318
|
+
if (requiresLogin) {
|
|
1319
|
+
return {
|
|
1320
|
+
kind: "auth",
|
|
1321
|
+
retryable: false,
|
|
1322
|
+
stage,
|
|
1323
|
+
summary: "\u9700\u8981\u767B\u5F55",
|
|
1324
|
+
actionHint: "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55",
|
|
1325
|
+
extraLinks: [{ text: "\u53BB\u767B\u5F55", url: "/login" }]
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
880
1328
|
const isPlatformBusy = fullErrorText.includes(PLATFORM_LLM_BUSY_USER_MESSAGE) || /PLATFORM_LLM_BUSY/i.test(fullErrorText);
|
|
881
1329
|
const busyUpstreamDetail = fullErrorText.match(
|
|
882
1330
|
/nolo\s+(?:HTTP\s*\d{3}|[A-Za-z]+Error)/
|
|
@@ -1161,7 +1609,9 @@ var finalizeSendFailureInDialog = async (dispatch, dialogConfig, agentKey, error
|
|
|
1161
1609
|
const dialogId = dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
|
|
1162
1610
|
const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
|
|
1163
1611
|
const parsed = parseSendError(errorInput);
|
|
1612
|
+
const diagnostics = extractErrorDiagnostics(errorInput);
|
|
1164
1613
|
const errorMeta = {
|
|
1614
|
+
...diagnostics ? { diagnostics } : {},
|
|
1165
1615
|
kind: parsed.kind,
|
|
1166
1616
|
retryable: parsed.retryable,
|
|
1167
1617
|
stage: parsed.stage,
|
|
@@ -1259,10 +1709,14 @@ var handleSendMessageAction = async (args, { dispatch, getState, rejectWithValue
|
|
|
1259
1709
|
dialogKey: dialogConfig.dbKey
|
|
1260
1710
|
});
|
|
1261
1711
|
}
|
|
1712
|
+
const selectedRuntimeTarget = dialogConfig.runtimeBinding?.target;
|
|
1262
1713
|
const resolvedContext = resolveHandleSendMessageContext({
|
|
1263
1714
|
dialogConfig,
|
|
1264
1715
|
targetAgentKey: args.targetAgentKey,
|
|
1265
|
-
runtimeOptions:
|
|
1716
|
+
runtimeOptions: {
|
|
1717
|
+
...args.runtimeOptions,
|
|
1718
|
+
...selectedRuntimeTarget && (selectedRuntimeTarget.kind === "server" || selectedRuntimeTarget.kind === "machine") ? { runtimeTarget: selectedRuntimeTarget } : {}
|
|
1719
|
+
}
|
|
1266
1720
|
});
|
|
1267
1721
|
agentKeyToUse = resolvedContext.agentKeyToUse;
|
|
1268
1722
|
const agentConfigToUse = resolvedContext.agentConfigToUse;
|