nolo-cli 0.149.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-OW3H7ICR.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-A6XBQZBN.js → agentEmailCommands-V4P5EFLP.js} +132 -112
- package/{agentGrantCommands-M3XFO6EN.js → agentGrantCommands-HOJ3JBBQ.js} +3 -3
- package/agentListCommands-TWFLUYIZ.js +802 -0
- package/{agentMachineCommands-DQPUIMAC.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-O4RUQUMT.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-ZUEK6A6C.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-YAQJJDC2.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-ATLTFRYJ.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-TXH4IWJL.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-MST6R3E4.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-TZZ2WRBL.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-UASIEDKM.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-DXHL7G2L.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-HTVYCXBP.js → chunk-SMENBO3M.js} +354 -120
- package/{chunk-OMRJYNCI.js → chunk-SSFDFOVT.js} +26 -31
- package/chunk-SW4S4XYB.js +1794 -0
- package/{chunk-TB3MIBRC.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-ID7LNBWR.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-3DAVPNFT.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-2KBOXZQC.js → commandRegistry-XN7C5GHO.js} +183 -107
- package/contentThunks-5L7YQI3S.js +84 -0
- package/{cooldownCommands-ZLEPIB4A.js → cooldownCommands-JFKTYS2D.js} +2 -2
- package/{createAgentAutomationAction-5UGTB26P.js → createAgentAutomationAction-QOPOLCRK.js} +53 -44
- package/createDialogAction-MZ66VY5Q.js +76 -0
- package/{createPageAction-CDLDKPRM.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-N3YB65G5.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-E3CEOV5Q.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-DQAD5ERJ.js → handleSendMessageAction-DVG5U26T.js} +422 -118
- package/index.js +11 -7
- package/{lib-FRRS27KN.js → lib-4YTWAGY7.js} +581 -248
- package/{localDialogRead-EBRS242U.js → localDialogRead-FSOMOPDZ.js} +2 -2
- package/localRuntimeAdapter-HXRHFKRC.js +244 -0
- package/localRuntimeAuthority-JDAD7CB6.js +16 -0
- package/{localRuntimeDb-3LRMNLCM.js → localRuntimeDb-CVC62PM5.js} +1 -1
- package/{machineCommands-HAP75VSG.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-7BC66QSX.js → readlineWorkspace-RIE62QVZ.js} +5022 -921
- package/{removeDialogAgentAction-OSYNZRX7.js → removeDialogAgentAction-E2H3OZU6.js} +29 -28
- package/{runAgentClientLoop-6E6UC3CE.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-3UXPYFNX.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-UPFV7TDT.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-VCA76W6B.js +0 -134
- package/agentRunCommand-YNLDKVR7.js +0 -161
- package/browser-image-compression-MFDTD7K6.js +0 -1763
- package/chatQueueReduxAdapter-TJRMXMYA.js +0 -186
- package/chromeOpsCommands-IXRLN57H.js +0 -289
- package/chunk-36KZDDO5.js +0 -2415
- package/chunk-ACQD6YI2.js +0 -25363
- package/chunk-CQ3WA2NE.js +0 -299
- package/chunk-CYSYR67N.js +0 -93
- package/chunk-JBTJAPUF.js +0 -35
- package/chunk-K2CSUCHJ.js +0 -620
- package/chunk-LTRXGFMS.js +0 -83
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-MEYIRKDN.js +0 -8967
- package/chunk-OCZKATRC.js +0 -129
- package/chunk-OTGFTBLI.js +0 -13
- package/chunk-PUOC4YRO.js +0 -394
- package/chunk-PZZTFEKK.js +0 -34
- package/chunk-URMS4XY2.js +0 -10
- package/chunk-UV6VISQJ.js +0 -20
- package/chunk-VJVNU77E.js +0 -83
- package/chunk-XYJSY4KG.js +0 -13807
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YPREESF4.js +0 -225
- package/contentThunks-BDIQRZR6.js +0 -73
- package/createDialogAction-B7VGVEVU.js +0 -66
- package/dialogCommands-G7YBVAMC.js +0 -102
- package/levelLazyShim-GZBKODGI.js +0 -7
- package/machineWsRunDispatch-L32G7C4P.js +0 -149
- package/serverStoreFactory-YMXDF4NI.js +0 -20
- package/setDialogExtraReferencesAction-M32UYNCG.js +0 -30
- package/settingSlice-Q6EKL7EQ.js +0 -204
- package/syncMapping-N6RGXGBW.js +0 -437
- package/tools-MKYDMWA4.js +0 -111
- package/tuiSummaryLlmCaller-3YFNHCTW.js +0 -128
- package/{chunk-SV5IJK6K.js → chunk-NBTY7YJF.js} +3 -3
- package/{chunk-2SYTUTLI.js → chunk-YBNHPX4S.js} +3 -3
- package/{offlineMarxistsAgentCommand-HGXZV4XJ.js → offlineMarxistsAgentCommand-2QTHJCHV.js} +4 -4
|
@@ -1,46 +1,63 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildStaticUserPolicyContext,
|
|
3
3
|
resolveSpaceContextPreloadPlan
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KFHQQ3NO.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchReferenceContents,
|
|
7
7
|
mergeReferences,
|
|
8
8
|
resolveReferenceAssets,
|
|
9
9
|
resolveToolsFromKeys
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SMENBO3M.js";
|
|
11
11
|
import {
|
|
12
|
+
UI_CARD_ENVELOPE_MAX_BYTES,
|
|
12
13
|
getAllToolRuns,
|
|
14
|
+
parseUiCard,
|
|
13
15
|
resolveAgentRecommendedSkillNames,
|
|
14
|
-
resolveAgentRequiredPackIds
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
resolveAgentRequiredPackIds,
|
|
17
|
+
selectAiRecentContentLimit,
|
|
18
|
+
selectGlobalPrompt,
|
|
19
|
+
selectKnowledgeCaptureLevel,
|
|
20
|
+
selectSpaceContextLevel,
|
|
21
|
+
selectUserTonePreset,
|
|
22
|
+
uiCardFallback
|
|
23
|
+
} from "./chunk-ES633ZS5.js";
|
|
19
24
|
import {
|
|
20
25
|
resolveToolBaseUrl
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-CBHGZRCE.js";
|
|
22
27
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
getFinalPrice,
|
|
29
|
+
getModelPricing,
|
|
30
|
+
getPrices,
|
|
31
|
+
hasExplicitAgentPricing
|
|
32
|
+
} from "./chunk-RSHPU4PD.js";
|
|
25
33
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
getDocState
|
|
35
|
+
} from "./chunk-GQN2WLAI.js";
|
|
36
|
+
import {
|
|
37
|
+
getTableState
|
|
38
|
+
} from "./chunk-ZKZ5X2HS.js";
|
|
29
39
|
import {
|
|
30
40
|
PERSONALIZATION_DIALOG_CATEGORY,
|
|
31
41
|
buildPersonalizationDialogPolicyContext,
|
|
32
42
|
extractReferenceKeysFromMessage,
|
|
33
43
|
selectAllMsgs
|
|
34
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-556RW72X.js";
|
|
45
|
+
import {
|
|
46
|
+
getCurrentSpaceIdRaw,
|
|
47
|
+
getViewMode
|
|
48
|
+
} from "./chunk-ZJ7UHBJS.js";
|
|
35
49
|
import {
|
|
36
50
|
selectPendingFiles
|
|
37
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-OWYYDMGJ.js";
|
|
38
52
|
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
read,
|
|
54
|
+
selectById
|
|
55
|
+
} from "./chunk-74RAWNQN.js";
|
|
56
|
+
import {
|
|
57
|
+
getSessionSnapshotForState,
|
|
58
|
+
selectIdentityUserBalance,
|
|
59
|
+
selectIdentityUserId
|
|
60
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
44
61
|
import {
|
|
45
62
|
TOOL_PACKS,
|
|
46
63
|
addDefaultSystemCapabilityTools,
|
|
@@ -50,72 +67,246 @@ import {
|
|
|
50
67
|
expandEnabledPackPromptPatches,
|
|
51
68
|
expandEnabledPacks,
|
|
52
69
|
resolveEffectiveEnabledPacks
|
|
53
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-JZX2XLKC.js";
|
|
54
71
|
import {
|
|
55
72
|
projectToolMessageContent
|
|
56
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-GCKHQECX.js";
|
|
57
74
|
import {
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
attachmentKind,
|
|
76
|
+
normalizeAttachmentPart
|
|
77
|
+
} from "./chunk-WJZOQR2J.js";
|
|
60
78
|
import {
|
|
79
|
+
getModelContextWindow,
|
|
61
80
|
planContextUsage
|
|
62
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-BPMPOFWP.js";
|
|
63
82
|
import {
|
|
64
|
-
|
|
65
|
-
} from "./chunk-
|
|
66
|
-
import {
|
|
67
|
-
getModelConfig,
|
|
68
|
-
getProviderByModelName
|
|
69
|
-
} from "./chunk-3BXNTXYI.js";
|
|
83
|
+
asRecordOrEmpty
|
|
84
|
+
} from "./chunk-KX6YBIHG.js";
|
|
70
85
|
import {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} from "./chunk-HDLLCBRF.js";
|
|
86
|
+
isAbortError
|
|
87
|
+
} from "./chunk-7DPNBQSV.js";
|
|
74
88
|
import {
|
|
75
89
|
canonicalizeToolNames,
|
|
76
90
|
prioritizeToolNames
|
|
77
|
-
} from "./chunk-
|
|
78
|
-
import {
|
|
79
|
-
selectAiRecentContentLimit,
|
|
80
|
-
selectGlobalPrompt,
|
|
81
|
-
selectKnowledgeCaptureLevel,
|
|
82
|
-
selectSpaceContextLevel,
|
|
83
|
-
selectUserTonePreset
|
|
84
|
-
} from "./chunk-SONWNI3L.js";
|
|
85
|
-
import {
|
|
86
|
-
asRecordOrEmpty
|
|
87
|
-
} from "./chunk-KX6YBIHG.js";
|
|
91
|
+
} from "./chunk-5EBLANFT.js";
|
|
88
92
|
import {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} from "./chunk-HYZIYH2H.js";
|
|
93
|
+
extractCustomId
|
|
94
|
+
} from "./chunk-M2EJHDJP.js";
|
|
92
95
|
import {
|
|
93
|
-
asNonEmptyStringArray,
|
|
94
96
|
metaKey
|
|
95
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-5EMSBTQ6.js";
|
|
98
|
+
import {
|
|
99
|
+
asNonEmptyStringArray
|
|
100
|
+
} from "./chunk-I42VC5KR.js";
|
|
96
101
|
import {
|
|
97
102
|
asOptionalFiniteNumber
|
|
98
103
|
} from "./chunk-WWC7I6TA.js";
|
|
99
104
|
import {
|
|
100
|
-
|
|
101
|
-
} from "./chunk-
|
|
105
|
+
estimateTokenCount
|
|
106
|
+
} from "./chunk-PSCNXBYA.js";
|
|
102
107
|
import {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} from "./chunk-SEJ5OS6F.js";
|
|
108
|
+
getModelConfig,
|
|
109
|
+
getProviderByModelName
|
|
110
|
+
} from "./chunk-I4SN4NUQ.js";
|
|
107
111
|
import {
|
|
108
112
|
isRecord
|
|
109
113
|
} from "./chunk-KUG52IAP.js";
|
|
110
|
-
import {
|
|
111
|
-
extractCustomId
|
|
112
|
-
} from "./chunk-M2EJHDJP.js";
|
|
113
114
|
import {
|
|
114
115
|
asTrimmedString
|
|
115
116
|
} from "./chunk-3EUW3WEO.js";
|
|
116
117
|
import {
|
|
117
118
|
asOptionalTrimmedString
|
|
118
119
|
} from "./chunk-G3SUCT4W.js";
|
|
120
|
+
import {
|
|
121
|
+
buildLinkedSpacesSection,
|
|
122
|
+
buildSpaceContextLayer
|
|
123
|
+
} from "./chunk-VEA7H5FG.js";
|
|
124
|
+
|
|
125
|
+
// packages/ai/agent/foregroundTurnAdmissionFetch.ts
|
|
126
|
+
var FOREGROUND_TURN_KEEPALIVE_MAX_BODY_BYTES = 60 * 1024;
|
|
127
|
+
function getUtf8ByteLength(value) {
|
|
128
|
+
return new TextEncoder().encode(value).byteLength;
|
|
129
|
+
}
|
|
130
|
+
function shouldKeepForegroundTurnAdmissionAlive(serializedBody) {
|
|
131
|
+
return serializedBody.length > 0 && getUtf8ByteLength(serializedBody) <= FOREGROUND_TURN_KEEPALIVE_MAX_BODY_BYTES;
|
|
132
|
+
}
|
|
133
|
+
function buildForegroundTurnAdmissionFetchInit(args) {
|
|
134
|
+
return {
|
|
135
|
+
method: "POST",
|
|
136
|
+
headers: args.headers,
|
|
137
|
+
body: args.body,
|
|
138
|
+
...args.signal ? { signal: args.signal } : {},
|
|
139
|
+
...shouldKeepForegroundTurnAdmissionAlive(args.body) ? { keepalive: true } : {}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// packages/ai/agent/foregroundExecutionClientState.ts
|
|
144
|
+
var stateByDialogId = /* @__PURE__ */ new Map();
|
|
145
|
+
var MAX_TRACKED_DIALOGS = 256;
|
|
146
|
+
function trimmed(value) {
|
|
147
|
+
return typeof value === "string" ? value.trim() : "";
|
|
148
|
+
}
|
|
149
|
+
function trimCache() {
|
|
150
|
+
while (stateByDialogId.size > MAX_TRACKED_DIALOGS) {
|
|
151
|
+
const oldest = stateByDialogId.keys().next().value;
|
|
152
|
+
if (!oldest) return;
|
|
153
|
+
stateByDialogId.delete(oldest);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function setForegroundExecutionClientState(args) {
|
|
157
|
+
const dialogId = trimmed(args.dialogId);
|
|
158
|
+
const executionId = trimmed(args.executionId);
|
|
159
|
+
if (!dialogId || !executionId) return;
|
|
160
|
+
stateByDialogId.delete(dialogId);
|
|
161
|
+
stateByDialogId.set(dialogId, { dialogId, executionId, status: "running" });
|
|
162
|
+
trimCache();
|
|
163
|
+
}
|
|
164
|
+
function clearForegroundExecutionClientState(dialogId, expectedExecutionId) {
|
|
165
|
+
const normalizedDialogId = trimmed(dialogId);
|
|
166
|
+
if (!normalizedDialogId) return;
|
|
167
|
+
if (expectedExecutionId) {
|
|
168
|
+
const current = stateByDialogId.get(normalizedDialogId);
|
|
169
|
+
if (current && current.executionId !== expectedExecutionId) return;
|
|
170
|
+
}
|
|
171
|
+
stateByDialogId.delete(normalizedDialogId);
|
|
172
|
+
}
|
|
173
|
+
function observeForegroundExecutionPayload(payload) {
|
|
174
|
+
if (!payload || typeof payload !== "object") return;
|
|
175
|
+
const event = payload;
|
|
176
|
+
const type = trimmed(event.type);
|
|
177
|
+
const dialogId = trimmed(event.dialogId);
|
|
178
|
+
const executionId = trimmed(event.executionId);
|
|
179
|
+
if ((type === "dialog" || type === "foreground_turn_status") && event.status === "running" && dialogId && executionId) {
|
|
180
|
+
setForegroundExecutionClientState({ dialogId, executionId });
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (type === "foreground_turn_terminal" || type === "done" || type === "cancelled" || type === "error" || type === "failed") {
|
|
184
|
+
if (dialogId && executionId) {
|
|
185
|
+
clearForegroundExecutionClientState(dialogId, executionId);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// packages/ai/agent/streamTurnStreamConsumer.ts
|
|
191
|
+
async function readAgentRunStreamChunk(reader, signal, isAborted) {
|
|
192
|
+
if (isAborted() || signal?.aborted) {
|
|
193
|
+
void reader.cancel().catch(() => {
|
|
194
|
+
});
|
|
195
|
+
throw new DOMException("The operation was aborted.", "AbortError");
|
|
196
|
+
}
|
|
197
|
+
if (!signal) {
|
|
198
|
+
return reader.read();
|
|
199
|
+
}
|
|
200
|
+
let settled = false;
|
|
201
|
+
return new Promise((resolve, reject) => {
|
|
202
|
+
const finish = (cb) => {
|
|
203
|
+
if (settled) return;
|
|
204
|
+
settled = true;
|
|
205
|
+
signal.removeEventListener("abort", onAbort);
|
|
206
|
+
cb();
|
|
207
|
+
};
|
|
208
|
+
const onAbort = () => {
|
|
209
|
+
void reader.cancel().catch(() => {
|
|
210
|
+
});
|
|
211
|
+
finish(
|
|
212
|
+
() => reject(new DOMException("The operation was aborted.", "AbortError"))
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
signal.addEventListener("abort", onAbort);
|
|
216
|
+
reader.read().then(
|
|
217
|
+
(result) => finish(() => resolve(result)),
|
|
218
|
+
(err) => finish(() => reject(err))
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async function consumeAgentRunStream(handlers) {
|
|
223
|
+
const {
|
|
224
|
+
reader,
|
|
225
|
+
decoder,
|
|
226
|
+
parseChunk,
|
|
227
|
+
onPayload,
|
|
228
|
+
isDoneEvent,
|
|
229
|
+
isAborted,
|
|
230
|
+
signal,
|
|
231
|
+
onAbort
|
|
232
|
+
} = handlers;
|
|
233
|
+
let sawDone = false;
|
|
234
|
+
let observedDialogId = "";
|
|
235
|
+
let observedExecutionId = "";
|
|
236
|
+
const clearObservedExecution = () => {
|
|
237
|
+
if (!observedDialogId || !observedExecutionId) return;
|
|
238
|
+
clearForegroundExecutionClientState(
|
|
239
|
+
observedDialogId,
|
|
240
|
+
observedExecutionId
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
try {
|
|
244
|
+
while (true) {
|
|
245
|
+
let done;
|
|
246
|
+
let value;
|
|
247
|
+
try {
|
|
248
|
+
({ done, value } = await readAgentRunStreamChunk(
|
|
249
|
+
reader,
|
|
250
|
+
signal,
|
|
251
|
+
isAborted
|
|
252
|
+
));
|
|
253
|
+
} catch (error) {
|
|
254
|
+
if (isAbortError(error) || isAborted() || signal?.aborted) {
|
|
255
|
+
clearObservedExecution();
|
|
256
|
+
await onAbort();
|
|
257
|
+
return { outcome: "aborted" };
|
|
258
|
+
}
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
if (isAborted() || signal?.aborted) {
|
|
262
|
+
clearObservedExecution();
|
|
263
|
+
await onAbort();
|
|
264
|
+
return { outcome: "aborted" };
|
|
265
|
+
}
|
|
266
|
+
if (done) {
|
|
267
|
+
clearObservedExecution();
|
|
268
|
+
return { outcome: "streamEnded", sawDone };
|
|
269
|
+
}
|
|
270
|
+
const payloads = parseChunk(
|
|
271
|
+
decoder.decode(value, { stream: true })
|
|
272
|
+
);
|
|
273
|
+
for (const payload of payloads) {
|
|
274
|
+
if (isAborted() || signal?.aborted) {
|
|
275
|
+
clearObservedExecution();
|
|
276
|
+
await onAbort();
|
|
277
|
+
return { outcome: "aborted" };
|
|
278
|
+
}
|
|
279
|
+
if (payload && typeof payload === "object") {
|
|
280
|
+
if (payload.type === "dialog" && typeof payload.dialogId === "string") {
|
|
281
|
+
observedDialogId = payload.dialogId.trim();
|
|
282
|
+
observedExecutionId = typeof payload.executionId === "string" ? payload.executionId.trim() : "";
|
|
283
|
+
}
|
|
284
|
+
observeForegroundExecutionPayload(payload);
|
|
285
|
+
}
|
|
286
|
+
const directive = await onPayload(payload);
|
|
287
|
+
if (directive?.reject !== void 0) {
|
|
288
|
+
clearObservedExecution();
|
|
289
|
+
return { outcome: "rejected", message: directive.reject };
|
|
290
|
+
}
|
|
291
|
+
if (directive?.abort) {
|
|
292
|
+
clearObservedExecution();
|
|
293
|
+
await onAbort();
|
|
294
|
+
return { outcome: "aborted" };
|
|
295
|
+
}
|
|
296
|
+
if (isDoneEvent(payload)) {
|
|
297
|
+
sawDone = true;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
} catch (error) {
|
|
302
|
+
clearObservedExecution();
|
|
303
|
+
if (isAbortError(error) || isAborted() || signal?.aborted) {
|
|
304
|
+
await onAbort();
|
|
305
|
+
return { outcome: "aborted" };
|
|
306
|
+
}
|
|
307
|
+
throw error;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
119
310
|
|
|
120
311
|
// packages/ai/agent/projectDesktopToolUiContent.ts
|
|
121
312
|
var DESKTOP_TOOL_UI_CONTENT_MAX_CHARS = 48e3;
|
|
@@ -174,10 +365,26 @@ function projectDesktopToolUiContent(args) {
|
|
|
174
365
|
const toolName = asOptionalTrimmedString(args.toolName) || "tool";
|
|
175
366
|
const metadata = isRecord(args.metadata) ? args.metadata : {};
|
|
176
367
|
const rawContent = typeof args.content === "string" ? args.content : typeof args.summary === "string" ? args.summary : typeof args.message === "string" ? args.message : "";
|
|
177
|
-
if (toolName === "
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
368
|
+
if (toolName === "show_interaction") {
|
|
369
|
+
try {
|
|
370
|
+
const parsedContent = JSON.parse(rawContent);
|
|
371
|
+
const envelope = isRecord(parsedContent) && isRecord(parsedContent.rawData) ? parsedContent.rawData : parsedContent;
|
|
372
|
+
const candidate = isRecord(envelope) && envelope.type === "show_interaction" ? envelope.card : envelope;
|
|
373
|
+
const parsed = parseUiCard(candidate);
|
|
374
|
+
if (!parsed.ok) return `show_interaction failed: invalid card (${parsed.error})`;
|
|
375
|
+
const card = parsed.value;
|
|
376
|
+
const cardOnly = JSON.stringify({ type: "show_interaction", card });
|
|
377
|
+
if (new TextEncoder().encode(cardOnly).byteLength > UI_CARD_ENVELOPE_MAX_BYTES) {
|
|
378
|
+
return "show_interaction failed: projected card too large";
|
|
379
|
+
}
|
|
380
|
+
const canonical = JSON.stringify({
|
|
381
|
+
type: "show_interaction",
|
|
382
|
+
card,
|
|
383
|
+
fallbackText: uiCardFallback(card)
|
|
384
|
+
});
|
|
385
|
+
return new TextEncoder().encode(canonical).byteLength <= UI_CARD_ENVELOPE_MAX_BYTES ? canonical : cardOnly;
|
|
386
|
+
} catch {
|
|
387
|
+
return "show_interaction failed: invalid JSON card";
|
|
181
388
|
}
|
|
182
389
|
}
|
|
183
390
|
if (toolName === "execShell") {
|
|
@@ -219,6 +426,105 @@ function projectDesktopToolUiContent(args) {
|
|
|
219
426
|
return clipUiText(preferred);
|
|
220
427
|
}
|
|
221
428
|
|
|
429
|
+
// packages/ai/attachments/toolsForAttachments.ts
|
|
430
|
+
var LEGACY_MEDIA_JOB_PART_TYPE = "media_job";
|
|
431
|
+
var LEGACY_MEDIA_TEXT_PREFIX = "[\u5A92\u4F53\u9644\u4EF6]";
|
|
432
|
+
var LEGACY_MEDIA_TEXT_FIELDS = ["fileId", "jobId", "\u6587\u4EF6", "\u65F6\u957F"];
|
|
433
|
+
var LEGACY_MEDIA_TEXT_ID_FIELDS = ["fileId", "jobId"];
|
|
434
|
+
var LEGACY_MEDIA_TEXT_STRICT_PATTERN = /^\[媒体附件\](?:\s+(?:fileId|jobId|文件|时长)=\S+)+$/;
|
|
435
|
+
var parseLegacyMediaFields = (body) => {
|
|
436
|
+
const matcher = new RegExp(`(?:${LEGACY_MEDIA_TEXT_FIELDS.join("|")})=`, "g");
|
|
437
|
+
const starts = [];
|
|
438
|
+
for (let match = matcher.exec(body); match; match = matcher.exec(body)) {
|
|
439
|
+
starts.push({
|
|
440
|
+
key: match[0].slice(0, -1),
|
|
441
|
+
start: match.index,
|
|
442
|
+
end: match.index + match[0].length
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
if (starts.length === 0) return null;
|
|
446
|
+
if (body.slice(0, starts[0].start).trim() !== "") return null;
|
|
447
|
+
return starts.map((field, index) => ({
|
|
448
|
+
key: field.key,
|
|
449
|
+
value: body.slice(field.end, index + 1 < starts.length ? starts[index + 1].start : body.length)
|
|
450
|
+
}));
|
|
451
|
+
};
|
|
452
|
+
var hasLegacyMediaId = (fields) => fields.some(
|
|
453
|
+
(field) => LEGACY_MEDIA_TEXT_ID_FIELDS.includes(field.key) && /^\S+$/.test(field.value.trim())
|
|
454
|
+
);
|
|
455
|
+
var isLegacyMediaText = (text) => {
|
|
456
|
+
if (typeof text !== "string" || !text.startsWith(LEGACY_MEDIA_TEXT_PREFIX)) return false;
|
|
457
|
+
const rest = text.slice(LEGACY_MEDIA_TEXT_PREFIX.length);
|
|
458
|
+
if (rest !== "" && !/^\s/.test(rest)) return false;
|
|
459
|
+
const fields = parseLegacyMediaFields(rest);
|
|
460
|
+
if (!fields) return false;
|
|
461
|
+
if (fields.some((field) => field.value.trim() === "")) return false;
|
|
462
|
+
if (hasLegacyMediaId(fields)) return true;
|
|
463
|
+
return LEGACY_MEDIA_TEXT_STRICT_PATTERN.test(text);
|
|
464
|
+
};
|
|
465
|
+
var isLegacyMediaJobText = (part) => {
|
|
466
|
+
if (typeof part !== "object" || part === null) return false;
|
|
467
|
+
const record = part;
|
|
468
|
+
if (record.type !== "text" || typeof record.text !== "string") return false;
|
|
469
|
+
return isLegacyMediaText(record.text.trim());
|
|
470
|
+
};
|
|
471
|
+
var MEDIA_ATOMIC_TOOLS = [
|
|
472
|
+
"transcribe",
|
|
473
|
+
"translate",
|
|
474
|
+
"writeTranslations",
|
|
475
|
+
"exportDocument",
|
|
476
|
+
"readArtifact"
|
|
477
|
+
];
|
|
478
|
+
var TOOLS_BY_KIND = {
|
|
479
|
+
audio: MEDIA_ATOMIC_TOOLS,
|
|
480
|
+
video: MEDIA_ATOMIC_TOOLS,
|
|
481
|
+
image: [],
|
|
482
|
+
document: [],
|
|
483
|
+
text: [],
|
|
484
|
+
archive: [],
|
|
485
|
+
// P2:archive 目录清单 + 只读条目工具
|
|
486
|
+
binary: []
|
|
487
|
+
};
|
|
488
|
+
var toolsForAttachmentKinds = (kinds) => {
|
|
489
|
+
const names = /* @__PURE__ */ new Set();
|
|
490
|
+
for (const kind of kinds ?? []) {
|
|
491
|
+
for (const name of TOOLS_BY_KIND[kind] ?? []) {
|
|
492
|
+
names.add(name);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return Array.from(names);
|
|
496
|
+
};
|
|
497
|
+
var attachmentKindOfPart = (part) => {
|
|
498
|
+
if (typeof part !== "object" || part === null) return null;
|
|
499
|
+
const record = part;
|
|
500
|
+
if (record.type === LEGACY_MEDIA_JOB_PART_TYPE) return "audio";
|
|
501
|
+
if (isLegacyMediaJobText(record)) return "audio";
|
|
502
|
+
const normalized = normalizeAttachmentPart(record);
|
|
503
|
+
return normalized.status === "valid" ? attachmentKind(normalized.attachment) : null;
|
|
504
|
+
};
|
|
505
|
+
var MAX_PART_DEPTH = 4;
|
|
506
|
+
var collectParts = (input, out, depth) => {
|
|
507
|
+
if (depth > MAX_PART_DEPTH) return;
|
|
508
|
+
if (Array.isArray(input)) {
|
|
509
|
+
for (const item of input) collectParts(item, out, depth + 1);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (typeof input !== "object" || input === null) return;
|
|
513
|
+
const record = input;
|
|
514
|
+
out.push(record);
|
|
515
|
+
if (Array.isArray(record.children)) collectParts(record.children, out, depth + 1);
|
|
516
|
+
};
|
|
517
|
+
var attachmentKindsInContent = (content) => {
|
|
518
|
+
const parts = [];
|
|
519
|
+
collectParts(content, parts, 0);
|
|
520
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
521
|
+
for (const part of parts) {
|
|
522
|
+
const kind = attachmentKindOfPart(part);
|
|
523
|
+
if (kind) kinds.add(kind);
|
|
524
|
+
}
|
|
525
|
+
return Array.from(kinds);
|
|
526
|
+
};
|
|
527
|
+
|
|
222
528
|
// packages/ai/agent/getFullChatContextKeys.ts
|
|
223
529
|
var difference = (arrA, arrB) => {
|
|
224
530
|
if (!arrA.length) return [];
|
|
@@ -284,11 +590,20 @@ var getFullChatContextKeys = async (state, dispatch, agentConfig, userInput, dia
|
|
|
284
590
|
}
|
|
285
591
|
}
|
|
286
592
|
}
|
|
593
|
+
const attachmentKinds = /* @__PURE__ */ new Set();
|
|
594
|
+
for (const kind of attachmentKindsInContent(userInput)) attachmentKinds.add(kind);
|
|
595
|
+
for (const msg of msgs ?? []) {
|
|
596
|
+
for (const kind of attachmentKindsInContent(msg?.content)) attachmentKinds.add(kind);
|
|
597
|
+
}
|
|
598
|
+
const summaryMarkerId = dialogConfig?.summarizedBeforeId;
|
|
599
|
+
const attachmentKindsIncomplete = Boolean(summaryMarkerId) && !(msgs ?? []).some((msg) => msg?.id === summaryMarkerId);
|
|
287
600
|
return {
|
|
288
601
|
botInstructionKeys,
|
|
289
602
|
currentInputKeys,
|
|
290
603
|
historyKeys,
|
|
291
|
-
botKnowledgeKeys
|
|
604
|
+
botKnowledgeKeys,
|
|
605
|
+
attachmentKinds,
|
|
606
|
+
attachmentKindsIncomplete
|
|
292
607
|
};
|
|
293
608
|
};
|
|
294
609
|
var deduplicateContextKeys = (keys) => {
|
|
@@ -320,197 +635,6 @@ var deduplicateContextKeys = (keys) => {
|
|
|
320
635
|
};
|
|
321
636
|
};
|
|
322
637
|
|
|
323
|
-
// packages/ai/agent/turnToolContext.ts
|
|
324
|
-
var KNOWN_MENTION_RESOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
325
|
-
"tool",
|
|
326
|
-
"page",
|
|
327
|
-
"agent",
|
|
328
|
-
"space"
|
|
329
|
-
]);
|
|
330
|
-
function extractMentionsWithSafety(userInput) {
|
|
331
|
-
const toolNames = [];
|
|
332
|
-
const mentionedPageKeys = [];
|
|
333
|
-
const unresolvedReasons = [];
|
|
334
|
-
let complete = true;
|
|
335
|
-
if (!Array.isArray(userInput)) {
|
|
336
|
-
return { toolNames, mentionedPageKeys, complete, unresolvedReasons };
|
|
337
|
-
}
|
|
338
|
-
const traverse = (nodes) => {
|
|
339
|
-
for (const node of nodes) {
|
|
340
|
-
if (!node || typeof node !== "object") continue;
|
|
341
|
-
if (node.type === "mention") {
|
|
342
|
-
const resourceType = asTrimmedString(node.resourceType);
|
|
343
|
-
const resourceId = asTrimmedString(node.resourceId);
|
|
344
|
-
if (!resourceType || !KNOWN_MENTION_RESOURCE_TYPES.has(resourceType)) {
|
|
345
|
-
complete = false;
|
|
346
|
-
unresolvedReasons.push(
|
|
347
|
-
`unknown or missing mention resourceType: "${resourceType || "empty"}"`
|
|
348
|
-
);
|
|
349
|
-
} else if (!resourceId) {
|
|
350
|
-
complete = false;
|
|
351
|
-
unresolvedReasons.push(
|
|
352
|
-
`missing mention resourceId for type "${resourceType}"`
|
|
353
|
-
);
|
|
354
|
-
} else {
|
|
355
|
-
switch (resourceType) {
|
|
356
|
-
case "tool":
|
|
357
|
-
toolNames.push(resourceId);
|
|
358
|
-
break;
|
|
359
|
-
case "page":
|
|
360
|
-
mentionedPageKeys.push(resourceId);
|
|
361
|
-
break;
|
|
362
|
-
case "agent":
|
|
363
|
-
case "space":
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
if (typeof node.pageKey === "string" && node.pageKey.trim()) {
|
|
369
|
-
mentionedPageKeys.push(node.pageKey.trim());
|
|
370
|
-
}
|
|
371
|
-
if (Array.isArray(node.children)) {
|
|
372
|
-
traverse(node.children);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
try {
|
|
377
|
-
traverse(userInput);
|
|
378
|
-
} catch (error) {
|
|
379
|
-
complete = false;
|
|
380
|
-
unresolvedReasons.push(`failed to traverse userInput mentions: ${error?.message || error}`);
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
toolNames: [...new Set(toolNames)],
|
|
384
|
-
mentionedPageKeys: [...new Set(mentionedPageKeys)],
|
|
385
|
-
complete,
|
|
386
|
-
unresolvedReasons
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
async function resolveTurnToolContext(input) {
|
|
390
|
-
const unresolvedReasons = [];
|
|
391
|
-
let isComplete = true;
|
|
392
|
-
const mentionResult = extractMentionsWithSafety(input.userInput);
|
|
393
|
-
if (!mentionResult.complete) {
|
|
394
|
-
isComplete = false;
|
|
395
|
-
unresolvedReasons.push(...mentionResult.unresolvedReasons);
|
|
396
|
-
}
|
|
397
|
-
const mentionedToolNames = canonicalizeToolNames(mentionResult.toolNames);
|
|
398
|
-
const agentRefs = Array.isArray(input.agentConfig?.references) ? input.agentConfig.references : [];
|
|
399
|
-
const dialogExtraRefs = Array.isArray(input.dialogConfig?.extraReferences) ? input.dialogConfig.extraReferences : [];
|
|
400
|
-
const mergedReferences = mergeReferences(agentRefs, dialogExtraRefs);
|
|
401
|
-
let refAssets = {
|
|
402
|
-
references: [],
|
|
403
|
-
referencedTools: [],
|
|
404
|
-
recommendedSkillTools: [],
|
|
405
|
-
recommendedSkillHints: [],
|
|
406
|
-
skillPromptPatches: [],
|
|
407
|
-
contentByKey: /* @__PURE__ */ new Map()
|
|
408
|
-
};
|
|
409
|
-
if (mergedReferences.length > 0) {
|
|
410
|
-
try {
|
|
411
|
-
refAssets = await resolveReferenceAssets(
|
|
412
|
-
mergedReferences,
|
|
413
|
-
input.dispatch
|
|
414
|
-
);
|
|
415
|
-
for (const ref of mergedReferences) {
|
|
416
|
-
if (ref?.dbKey && !refAssets.contentByKey.has(ref.dbKey)) {
|
|
417
|
-
isComplete = false;
|
|
418
|
-
unresolvedReasons.push(`failed to resolve reference content for "${ref.dbKey}"`);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
} catch (error) {
|
|
422
|
-
isComplete = false;
|
|
423
|
-
unresolvedReasons.push(`failed to resolve reference assets: ${error?.message || error}`);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
let contextToolsResult = {
|
|
427
|
-
tools: [],
|
|
428
|
-
recommendedSkillTools: [],
|
|
429
|
-
recommendedSkillHints: [],
|
|
430
|
-
skillPromptPatches: [],
|
|
431
|
-
contentByKey: /* @__PURE__ */ new Map()
|
|
432
|
-
};
|
|
433
|
-
const hasContextEngine = Boolean(
|
|
434
|
-
input.state && input.dispatch && input.state.message
|
|
435
|
-
);
|
|
436
|
-
if (hasContextEngine) {
|
|
437
|
-
try {
|
|
438
|
-
const agentConfigWithReferences = {
|
|
439
|
-
...input.agentConfig ?? {},
|
|
440
|
-
references: refAssets.references,
|
|
441
|
-
referencedTools: refAssets.referencedTools,
|
|
442
|
-
recommendedSkillTools: refAssets.recommendedSkillTools,
|
|
443
|
-
recommendedSkillHints: refAssets.recommendedSkillHints,
|
|
444
|
-
skillPromptPatches: refAssets.skillPromptPatches
|
|
445
|
-
};
|
|
446
|
-
const keySets = await getFullChatContextKeys(
|
|
447
|
-
input.state,
|
|
448
|
-
input.dispatch,
|
|
449
|
-
agentConfigWithReferences,
|
|
450
|
-
input.userInput,
|
|
451
|
-
input.dialogConfig ?? void 0
|
|
452
|
-
);
|
|
453
|
-
for (const pk of mentionResult.mentionedPageKeys) {
|
|
454
|
-
keySets.currentInputKeys.add(pk);
|
|
455
|
-
}
|
|
456
|
-
const finalKeys = deduplicateContextKeys(keySets);
|
|
457
|
-
const allContextKeys = /* @__PURE__ */ new Set([
|
|
458
|
-
...finalKeys.botInstructionsContext,
|
|
459
|
-
...finalKeys.currentInputContext,
|
|
460
|
-
...finalKeys.historyContext,
|
|
461
|
-
...finalKeys.botKnowledgeContext
|
|
462
|
-
]);
|
|
463
|
-
if (allContextKeys.size > 0) {
|
|
464
|
-
contextToolsResult = await resolveToolsFromKeys(
|
|
465
|
-
Array.from(allContextKeys),
|
|
466
|
-
input.dispatch,
|
|
467
|
-
refAssets.contentByKey
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
} catch (error) {
|
|
471
|
-
isComplete = false;
|
|
472
|
-
unresolvedReasons.push(`failed to resolve context keys: ${error?.message || error}`);
|
|
473
|
-
}
|
|
474
|
-
} else if (mentionResult.mentionedPageKeys.length > 0) {
|
|
475
|
-
isComplete = false;
|
|
476
|
-
unresolvedReasons.push("cannot inspect mentioned pages without store dispatch");
|
|
477
|
-
}
|
|
478
|
-
const allReferencedTools = [
|
|
479
|
-
...refAssets.referencedTools ?? [],
|
|
480
|
-
...contextToolsResult.tools ?? []
|
|
481
|
-
];
|
|
482
|
-
const referencedToolNames = canonicalizeToolNames(allReferencedTools);
|
|
483
|
-
const recommendedSkillTools = [
|
|
484
|
-
...refAssets.recommendedSkillTools ?? [],
|
|
485
|
-
...contextToolsResult.recommendedSkillTools ?? []
|
|
486
|
-
];
|
|
487
|
-
const recommendedSkillHints = [
|
|
488
|
-
...refAssets.recommendedSkillHints ?? [],
|
|
489
|
-
...contextToolsResult.recommendedSkillHints ?? []
|
|
490
|
-
];
|
|
491
|
-
const skillPromptPatches = [
|
|
492
|
-
...refAssets.skillPromptPatches ?? [],
|
|
493
|
-
...contextToolsResult.skillPromptPatches ?? []
|
|
494
|
-
];
|
|
495
|
-
return {
|
|
496
|
-
referencedToolNames,
|
|
497
|
-
mentionedToolNames,
|
|
498
|
-
complete: isComplete,
|
|
499
|
-
...unresolvedReasons.length > 0 ? { unresolvedReasons } : {},
|
|
500
|
-
resolvedReferences: refAssets.references,
|
|
501
|
-
referencedTools: refAssets.referencedTools,
|
|
502
|
-
contextTools: contextToolsResult.tools,
|
|
503
|
-
recommendedSkillTools,
|
|
504
|
-
recommendedSkillHints,
|
|
505
|
-
skillPromptPatches,
|
|
506
|
-
referenceContentCache: refAssets.contentByKey,
|
|
507
|
-
mergedContentCache: new Map([
|
|
508
|
-
...refAssets.contentByKey,
|
|
509
|
-
...contextToolsResult.contentByKey
|
|
510
|
-
])
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
|
|
514
638
|
// packages/ai/agent/canvasEditingContext.ts
|
|
515
639
|
function buildCanvasNodeEditingContextSummary(runtimeOptions) {
|
|
516
640
|
if (runtimeOptions?.editingTarget?.kind !== "canvas_node") return null;
|
|
@@ -1513,195 +1637,214 @@ var resolveImageGenerationStreamingState = (agentConfig, args) => {
|
|
|
1513
1637
|
};
|
|
1514
1638
|
};
|
|
1515
1639
|
|
|
1516
|
-
// packages/ai/agent/
|
|
1517
|
-
var
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
...shouldKeepForegroundTurnAdmissionAlive(args.body) ? { keepalive: true } : {}
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
// packages/ai/agent/foregroundExecutionClientState.ts
|
|
1535
|
-
var stateByDialogId = /* @__PURE__ */ new Map();
|
|
1536
|
-
var MAX_TRACKED_DIALOGS = 256;
|
|
1537
|
-
function trimmed(value) {
|
|
1538
|
-
return typeof value === "string" ? value.trim() : "";
|
|
1539
|
-
}
|
|
1540
|
-
function trimCache() {
|
|
1541
|
-
while (stateByDialogId.size > MAX_TRACKED_DIALOGS) {
|
|
1542
|
-
const oldest = stateByDialogId.keys().next().value;
|
|
1543
|
-
if (!oldest) return;
|
|
1544
|
-
stateByDialogId.delete(oldest);
|
|
1640
|
+
// packages/ai/agent/turnToolContext.ts
|
|
1641
|
+
var KNOWN_MENTION_RESOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
1642
|
+
"tool",
|
|
1643
|
+
"page",
|
|
1644
|
+
"agent",
|
|
1645
|
+
"space"
|
|
1646
|
+
]);
|
|
1647
|
+
function extractMentionsWithSafety(userInput) {
|
|
1648
|
+
const toolNames = [];
|
|
1649
|
+
const mentionedPageKeys = [];
|
|
1650
|
+
const unresolvedReasons = [];
|
|
1651
|
+
let complete = true;
|
|
1652
|
+
if (!Array.isArray(userInput)) {
|
|
1653
|
+
return { toolNames, mentionedPageKeys, complete, unresolvedReasons };
|
|
1545
1654
|
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1655
|
+
const traverse = (nodes) => {
|
|
1656
|
+
for (const node of nodes) {
|
|
1657
|
+
if (!node || typeof node !== "object") continue;
|
|
1658
|
+
if (node.type === "mention") {
|
|
1659
|
+
const resourceType = asTrimmedString(node.resourceType);
|
|
1660
|
+
const resourceId = asTrimmedString(node.resourceId);
|
|
1661
|
+
if (!resourceType || !KNOWN_MENTION_RESOURCE_TYPES.has(resourceType)) {
|
|
1662
|
+
complete = false;
|
|
1663
|
+
unresolvedReasons.push(
|
|
1664
|
+
`unknown or missing mention resourceType: "${resourceType || "empty"}"`
|
|
1665
|
+
);
|
|
1666
|
+
} else if (!resourceId) {
|
|
1667
|
+
complete = false;
|
|
1668
|
+
unresolvedReasons.push(
|
|
1669
|
+
`missing mention resourceId for type "${resourceType}"`
|
|
1670
|
+
);
|
|
1671
|
+
} else {
|
|
1672
|
+
switch (resourceType) {
|
|
1673
|
+
case "tool":
|
|
1674
|
+
toolNames.push(resourceId);
|
|
1675
|
+
break;
|
|
1676
|
+
case "page":
|
|
1677
|
+
mentionedPageKeys.push(resourceId);
|
|
1678
|
+
break;
|
|
1679
|
+
case "agent":
|
|
1680
|
+
case "space":
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
if (typeof node.pageKey === "string" && node.pageKey.trim()) {
|
|
1686
|
+
mentionedPageKeys.push(node.pageKey.trim());
|
|
1687
|
+
}
|
|
1688
|
+
if (Array.isArray(node.children)) {
|
|
1689
|
+
traverse(node.children);
|
|
1690
|
+
}
|
|
1577
1691
|
}
|
|
1692
|
+
};
|
|
1693
|
+
try {
|
|
1694
|
+
traverse(userInput);
|
|
1695
|
+
} catch (error) {
|
|
1696
|
+
complete = false;
|
|
1697
|
+
unresolvedReasons.push(`failed to traverse userInput mentions: ${error?.message || error}`);
|
|
1578
1698
|
}
|
|
1699
|
+
return {
|
|
1700
|
+
toolNames: [...new Set(toolNames)],
|
|
1701
|
+
mentionedPageKeys: [...new Set(mentionedPageKeys)],
|
|
1702
|
+
complete,
|
|
1703
|
+
unresolvedReasons
|
|
1704
|
+
};
|
|
1579
1705
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
}
|
|
1588
|
-
if (!signal) {
|
|
1589
|
-
return reader.read();
|
|
1706
|
+
async function resolveTurnToolContext(input) {
|
|
1707
|
+
const unresolvedReasons = [];
|
|
1708
|
+
let isComplete = true;
|
|
1709
|
+
const mentionResult = extractMentionsWithSafety(input.userInput);
|
|
1710
|
+
if (!mentionResult.complete) {
|
|
1711
|
+
isComplete = false;
|
|
1712
|
+
unresolvedReasons.push(...mentionResult.unresolvedReasons);
|
|
1590
1713
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
finish(
|
|
1603
|
-
() => reject(new DOMException("The operation was aborted.", "AbortError"))
|
|
1604
|
-
);
|
|
1605
|
-
};
|
|
1606
|
-
signal.addEventListener("abort", onAbort);
|
|
1607
|
-
reader.read().then(
|
|
1608
|
-
(result) => finish(() => resolve(result)),
|
|
1609
|
-
(err) => finish(() => reject(err))
|
|
1610
|
-
);
|
|
1611
|
-
});
|
|
1612
|
-
}
|
|
1613
|
-
async function consumeAgentRunStream(handlers) {
|
|
1614
|
-
const {
|
|
1615
|
-
reader,
|
|
1616
|
-
decoder,
|
|
1617
|
-
parseChunk,
|
|
1618
|
-
onPayload,
|
|
1619
|
-
isDoneEvent,
|
|
1620
|
-
isAborted,
|
|
1621
|
-
signal,
|
|
1622
|
-
onAbort
|
|
1623
|
-
} = handlers;
|
|
1624
|
-
let sawDone = false;
|
|
1625
|
-
let observedDialogId = "";
|
|
1626
|
-
let observedExecutionId = "";
|
|
1627
|
-
const clearObservedExecution = () => {
|
|
1628
|
-
if (!observedDialogId || !observedExecutionId) return;
|
|
1629
|
-
clearForegroundExecutionClientState(
|
|
1630
|
-
observedDialogId,
|
|
1631
|
-
observedExecutionId
|
|
1632
|
-
);
|
|
1714
|
+
const mentionedToolNames = canonicalizeToolNames(mentionResult.toolNames);
|
|
1715
|
+
const agentRefs = Array.isArray(input.agentConfig?.references) ? input.agentConfig.references : [];
|
|
1716
|
+
const dialogExtraRefs = Array.isArray(input.dialogConfig?.extraReferences) ? input.dialogConfig.extraReferences : [];
|
|
1717
|
+
const mergedReferences = mergeReferences(agentRefs, dialogExtraRefs);
|
|
1718
|
+
let refAssets = {
|
|
1719
|
+
references: [],
|
|
1720
|
+
referencedTools: [],
|
|
1721
|
+
recommendedSkillTools: [],
|
|
1722
|
+
recommendedSkillHints: [],
|
|
1723
|
+
skillPromptPatches: [],
|
|
1724
|
+
contentByKey: /* @__PURE__ */ new Map()
|
|
1633
1725
|
};
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
({ done, value } = await readAgentRunStreamChunk(
|
|
1640
|
-
reader,
|
|
1641
|
-
signal,
|
|
1642
|
-
isAborted
|
|
1643
|
-
));
|
|
1644
|
-
} catch (error) {
|
|
1645
|
-
if (isAbortError(error) || isAborted() || signal?.aborted) {
|
|
1646
|
-
clearObservedExecution();
|
|
1647
|
-
await onAbort();
|
|
1648
|
-
return { outcome: "aborted" };
|
|
1649
|
-
}
|
|
1650
|
-
throw error;
|
|
1651
|
-
}
|
|
1652
|
-
if (isAborted() || signal?.aborted) {
|
|
1653
|
-
clearObservedExecution();
|
|
1654
|
-
await onAbort();
|
|
1655
|
-
return { outcome: "aborted" };
|
|
1656
|
-
}
|
|
1657
|
-
if (done) {
|
|
1658
|
-
clearObservedExecution();
|
|
1659
|
-
return { outcome: "streamEnded", sawDone };
|
|
1660
|
-
}
|
|
1661
|
-
const payloads = parseChunk(
|
|
1662
|
-
decoder.decode(value, { stream: true })
|
|
1726
|
+
if (mergedReferences.length > 0) {
|
|
1727
|
+
try {
|
|
1728
|
+
refAssets = await resolveReferenceAssets(
|
|
1729
|
+
mergedReferences,
|
|
1730
|
+
input.dispatch
|
|
1663
1731
|
);
|
|
1664
|
-
for (const
|
|
1665
|
-
if (
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
return { outcome: "aborted" };
|
|
1669
|
-
}
|
|
1670
|
-
if (payload && typeof payload === "object") {
|
|
1671
|
-
if (payload.type === "dialog" && typeof payload.dialogId === "string") {
|
|
1672
|
-
observedDialogId = payload.dialogId.trim();
|
|
1673
|
-
observedExecutionId = typeof payload.executionId === "string" ? payload.executionId.trim() : "";
|
|
1674
|
-
}
|
|
1675
|
-
observeForegroundExecutionPayload(payload);
|
|
1676
|
-
}
|
|
1677
|
-
const directive = await onPayload(payload);
|
|
1678
|
-
if (directive?.reject !== void 0) {
|
|
1679
|
-
clearObservedExecution();
|
|
1680
|
-
return { outcome: "rejected", message: directive.reject };
|
|
1681
|
-
}
|
|
1682
|
-
if (directive?.abort) {
|
|
1683
|
-
clearObservedExecution();
|
|
1684
|
-
await onAbort();
|
|
1685
|
-
return { outcome: "aborted" };
|
|
1686
|
-
}
|
|
1687
|
-
if (isDoneEvent(payload)) {
|
|
1688
|
-
sawDone = true;
|
|
1732
|
+
for (const ref of mergedReferences) {
|
|
1733
|
+
if (ref?.dbKey && !refAssets.contentByKey.has(ref.dbKey)) {
|
|
1734
|
+
isComplete = false;
|
|
1735
|
+
unresolvedReasons.push(`failed to resolve reference content for "${ref.dbKey}"`);
|
|
1689
1736
|
}
|
|
1690
1737
|
}
|
|
1738
|
+
} catch (error) {
|
|
1739
|
+
isComplete = false;
|
|
1740
|
+
unresolvedReasons.push(`failed to resolve reference assets: ${error?.message || error}`);
|
|
1691
1741
|
}
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1742
|
+
}
|
|
1743
|
+
let attachmentKinds = attachmentKindsInContent(input.userInput);
|
|
1744
|
+
let attachmentKindsIncomplete = false;
|
|
1745
|
+
let contextToolsResult = {
|
|
1746
|
+
tools: [],
|
|
1747
|
+
recommendedSkillTools: [],
|
|
1748
|
+
recommendedSkillHints: [],
|
|
1749
|
+
skillPromptPatches: [],
|
|
1750
|
+
contentByKey: /* @__PURE__ */ new Map()
|
|
1751
|
+
};
|
|
1752
|
+
const hasContextEngine = Boolean(
|
|
1753
|
+
input.state && input.dispatch && input.state.message
|
|
1754
|
+
);
|
|
1755
|
+
if (hasContextEngine) {
|
|
1756
|
+
try {
|
|
1757
|
+
const agentConfigWithReferences = {
|
|
1758
|
+
...input.agentConfig ?? {},
|
|
1759
|
+
references: refAssets.references,
|
|
1760
|
+
referencedTools: refAssets.referencedTools,
|
|
1761
|
+
recommendedSkillTools: refAssets.recommendedSkillTools,
|
|
1762
|
+
recommendedSkillHints: refAssets.recommendedSkillHints,
|
|
1763
|
+
skillPromptPatches: refAssets.skillPromptPatches
|
|
1764
|
+
};
|
|
1765
|
+
const keySets = await getFullChatContextKeys(
|
|
1766
|
+
input.state,
|
|
1767
|
+
input.dispatch,
|
|
1768
|
+
agentConfigWithReferences,
|
|
1769
|
+
input.userInput,
|
|
1770
|
+
input.dialogConfig ?? void 0
|
|
1771
|
+
);
|
|
1772
|
+
attachmentKinds = [...keySets.attachmentKinds ?? []];
|
|
1773
|
+
attachmentKindsIncomplete = keySets.attachmentKindsIncomplete === true;
|
|
1774
|
+
for (const pk of mentionResult.mentionedPageKeys) {
|
|
1775
|
+
keySets.currentInputKeys.add(pk);
|
|
1776
|
+
}
|
|
1777
|
+
const finalKeys = deduplicateContextKeys(keySets);
|
|
1778
|
+
const allContextKeys = /* @__PURE__ */ new Set([
|
|
1779
|
+
...finalKeys.botInstructionsContext,
|
|
1780
|
+
...finalKeys.currentInputContext,
|
|
1781
|
+
...finalKeys.historyContext,
|
|
1782
|
+
...finalKeys.botKnowledgeContext
|
|
1783
|
+
]);
|
|
1784
|
+
if (allContextKeys.size > 0) {
|
|
1785
|
+
contextToolsResult = await resolveToolsFromKeys(
|
|
1786
|
+
Array.from(allContextKeys),
|
|
1787
|
+
input.dispatch,
|
|
1788
|
+
refAssets.contentByKey
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1791
|
+
} catch (error) {
|
|
1792
|
+
isComplete = false;
|
|
1793
|
+
unresolvedReasons.push(`failed to resolve context keys: ${error?.message || error}`);
|
|
1697
1794
|
}
|
|
1698
|
-
|
|
1795
|
+
} else if (mentionResult.mentionedPageKeys.length > 0) {
|
|
1796
|
+
isComplete = false;
|
|
1797
|
+
unresolvedReasons.push("cannot inspect mentioned pages without store dispatch");
|
|
1699
1798
|
}
|
|
1799
|
+
if (attachmentKindsIncomplete) {
|
|
1800
|
+
isComplete = false;
|
|
1801
|
+
unresolvedReasons.push(
|
|
1802
|
+
"attachment kinds before summarization are not in memory (pending discovery)"
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1805
|
+
const attachmentToolNames = toolsForAttachmentKinds(attachmentKinds);
|
|
1806
|
+
const allReferencedTools = [
|
|
1807
|
+
...refAssets.referencedTools ?? [],
|
|
1808
|
+
...contextToolsResult.tools ?? [],
|
|
1809
|
+
...attachmentToolNames
|
|
1810
|
+
];
|
|
1811
|
+
const referencedToolNames = canonicalizeToolNames(allReferencedTools);
|
|
1812
|
+
const recommendedSkillTools = [
|
|
1813
|
+
...refAssets.recommendedSkillTools ?? [],
|
|
1814
|
+
...contextToolsResult.recommendedSkillTools ?? []
|
|
1815
|
+
];
|
|
1816
|
+
const recommendedSkillHints = [
|
|
1817
|
+
...refAssets.recommendedSkillHints ?? [],
|
|
1818
|
+
...contextToolsResult.recommendedSkillHints ?? []
|
|
1819
|
+
];
|
|
1820
|
+
const skillPromptPatches = [
|
|
1821
|
+
...refAssets.skillPromptPatches ?? [],
|
|
1822
|
+
...contextToolsResult.skillPromptPatches ?? []
|
|
1823
|
+
];
|
|
1824
|
+
return {
|
|
1825
|
+
referencedToolNames,
|
|
1826
|
+
attachmentToolNames,
|
|
1827
|
+
mentionedToolNames,
|
|
1828
|
+
complete: isComplete,
|
|
1829
|
+
...unresolvedReasons.length > 0 ? { unresolvedReasons } : {},
|
|
1830
|
+
resolvedReferences: refAssets.references,
|
|
1831
|
+
referencedTools: refAssets.referencedTools,
|
|
1832
|
+
contextTools: contextToolsResult.tools,
|
|
1833
|
+
recommendedSkillTools,
|
|
1834
|
+
recommendedSkillHints,
|
|
1835
|
+
skillPromptPatches,
|
|
1836
|
+
referenceContentCache: refAssets.contentByKey,
|
|
1837
|
+
mergedContentCache: new Map([
|
|
1838
|
+
...refAssets.contentByKey,
|
|
1839
|
+
...contextToolsResult.contentByKey
|
|
1840
|
+
])
|
|
1841
|
+
};
|
|
1700
1842
|
}
|
|
1701
1843
|
|
|
1702
1844
|
export {
|
|
1845
|
+
buildForegroundTurnAdmissionFetchInit,
|
|
1846
|
+
consumeAgentRunStream,
|
|
1703
1847
|
projectDesktopToolUiContent,
|
|
1704
|
-
resolveTurnToolContext,
|
|
1705
1848
|
compressOldToolResults,
|
|
1706
1849
|
trimMessagesWithSummary,
|
|
1707
1850
|
validateAccessAndBalance,
|
|
@@ -1711,6 +1854,5 @@ export {
|
|
|
1711
1854
|
mergeAgentToolsWithRuntime,
|
|
1712
1855
|
applyImageConfigRuntimeOverride,
|
|
1713
1856
|
resolveImageGenerationStreamingState,
|
|
1714
|
-
|
|
1715
|
-
consumeAgentRunStream
|
|
1857
|
+
resolveTurnToolContext
|
|
1716
1858
|
};
|