nolo-cli 0.33.0-alpha.9 → 0.34.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-2WR4RTZZ.js → _executeModel-TMUXL7J5.js} +64 -65
- package/{action-OQWPNKAH.js → action-KMBZ3LCZ.js} +12 -12
- package/{addContentAction-YVINZQTF.js → addContentAction-KQ44UT2U.js} +10 -10
- package/{addDialogAgentAction-6IOCIEPI.js → addDialogAgentAction-ILSDCMYL.js} +9 -9
- package/{agentDeleteCommand-H22WRYC6.js → agentDeleteCommand-KA2IQAPG.js} +40 -39
- package/{agentEmailCommands-DGJVCMCG.js → agentEmailCommands-UIYBGCZW.js} +74 -75
- package/{agentListCommands-6NWMLIMQ.js → agentListCommands-L6JNUOLH.js} +47 -37
- package/{agentMachineCommands-5MUO6RDI.js → agentMachineCommands-5CQW5NZR.js} +37 -36
- package/agentProviderCommands-65ZC2WB4.js +122 -0
- package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-TSWAJPS2.js} +1 -1
- package/agentRecordCommands-VUDJQIZH.js +112 -0
- package/agentRunCommand-EJWYF3BL.js +132 -0
- package/{agentRunControl-SCIVRZWX.js → agentRunControl-7MUPSYDQ.js} +7 -1
- package/{agentRuntimeLocal-PRAR3NCW.js → agentRuntimeLocal-XXBMDMBU.js} +33 -33
- package/{agentSlice-AMDSTXP5.js → agentSlice-HTIEYKIU.js} +12 -12
- package/agentSuperviseCommands-MKWW3ICX.js +640 -0
- package/{appDeleteCommands-L5PKC42V.js → appDeleteCommands-OUBL6VHB.js} +35 -34
- package/{appDeployCommands-3J7Z4XWV.js → appDeployCommands-BZSS2MX4.js} +35 -34
- package/{appDeployStatusCommands-YTRPXE72.js → appDeployStatusCommands-P2ZQOY5X.js} +35 -34
- package/{appGetCommands-JVXV5WXD.js → appGetCommands-WCFWQZZM.js} +35 -34
- package/{appListCommands-7KDEOJSO.js → appListCommands-FVJ3QNL7.js} +35 -34
- package/{authCommand-6Y5LTMZB.js → authCommand-B2XRHNJH.js} +19 -19
- package/{authCommands-EAPFGNHN.js → authCommands-GWABTFMR.js} +6 -6
- package/{chatQueueReduxAdapter-ZKSS6XRV.js → chatQueueReduxAdapter-ZP2ZS63U.js} +28 -28
- package/{chunk-UM4H3URE.js → chunk-23KKIMD5.js} +7 -7
- package/chunk-2BWU4ORW.js +2574 -0
- package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
- package/{chunk-M2YMQOLC.js → chunk-4APLX2RT.js} +75 -10
- package/{chunk-ZHYK3N56.js → chunk-4AWH4LQA.js} +3 -1
- package/{chunk-3GZXL6FM.js → chunk-4DMPISV6.js} +7 -3
- package/{chunk-BQ3OHLR5.js → chunk-5GQ6XCJY.js} +1217 -691
- package/{chunk-GOIDVXK5.js → chunk-5LDKQUOT.js} +21 -8
- package/{chunk-OIQPORYI.js → chunk-64KIQZA2.js} +175 -2
- package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
- package/chunk-6XG52ZQ6.js +146 -0
- package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
- package/chunk-AA2YUJNV.js +54 -0
- package/{chunk-7INB7NXF.js → chunk-AE5GVFMG.js} +294 -54
- package/{chunk-UNOTBWZZ.js → chunk-B6H5XCT2.js} +8 -8
- package/{chunk-NNWHHCVP.js → chunk-BMB563Y6.js} +10 -4
- package/{chunk-DFUPZE6V.js → chunk-C6ELZQ7H.js} +249 -34
- package/{chunk-7KNERA53.js → chunk-E2OQ5N2F.js} +87 -13
- package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
- package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
- package/{chunk-JZPBVBIY.js → chunk-FD36SCCD.js} +19 -8
- package/{chunk-DKMOY3QI.js → chunk-FGLKRJDI.js} +54 -3
- package/{chunk-MQWVAOIU.js → chunk-FT4XBCK4.js} +33 -158
- package/{chunk-2QTEYCR7.js → chunk-FTM4KUOZ.js} +17 -17
- package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
- package/{chunk-7YYHKBJP.js → chunk-GKHV4UH5.js} +1 -1
- package/{chunk-2IVEXF7P.js → chunk-GUYMR3JL.js} +6 -33
- package/{chunk-YDTYDA5W.js → chunk-GZRMWK5R.js} +6 -4
- package/{chunk-X664KVEV.js → chunk-HHBXCRJS.js} +204 -123
- package/{chunk-AN7DGYMW.js → chunk-I7VDDN45.js} +4579 -3131
- package/{chunk-DSBGWT2C.js → chunk-IEEEWIVO.js} +10 -10
- package/{chunk-75U775RZ.js → chunk-IFS5CUEH.js} +1 -1
- package/{chunk-WLH5BAKX.js → chunk-IIOHYLIG.js} +9 -4
- package/{chunk-UEAUAXYS.js → chunk-ILZY5B4U.js} +2063 -214
- package/chunk-IMHO5LC6.js +370 -0
- package/{chunk-ADLYMQB6.js → chunk-IZCHPD7T.js} +52 -3
- package/{chunk-ITIA6OAQ.js → chunk-IZNJDUJ4.js} +5 -5
- package/{chunk-X2DAEZ3X.js → chunk-J5NMOM35.js} +1 -1
- package/{chunk-RPRRIFXV.js → chunk-JI2TIPLP.js} +1 -1
- package/{chunk-EGRJC4ZN.js → chunk-JIADXJYU.js} +1 -1
- package/{chunk-IHEC7VBF.js → chunk-K4KIFRIN.js} +1 -1
- package/{chunk-WJSW43QZ.js → chunk-L3JWI7WX.js} +0 -1
- package/{chunk-3RUW3ONU.js → chunk-LD6Y6RJY.js} +4 -4
- package/chunk-M3JQWYBC.js +387 -0
- package/{chunk-GM6PU7B6.js → chunk-MEYIRKDN.js} +0 -1
- package/{chunk-6YXDOOSH.js → chunk-MGIHZ5CJ.js} +4 -4
- package/{chunk-4F5M2MW5.js → chunk-MJWX4JQO.js} +2 -2
- package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
- package/{chunk-5CS33IBL.js → chunk-NQ4N4IGO.js} +11 -12
- package/{chunk-ZZ2MH7LE.js → chunk-O6OSWFZQ.js} +0 -1
- package/{chunk-RJKIB55Y.js → chunk-OSCSEJJR.js} +15 -8
- package/{chunk-HUCT7HID.js → chunk-P2I7ELDC.js} +3 -3
- package/{chunk-BXPBZVRE.js → chunk-PILJX4DH.js} +285 -251
- package/{chunk-SCUETSRP.js → chunk-PV734VZX.js} +1 -1
- package/{chunk-XLLTJXAD.js → chunk-QI3CHZUT.js} +39 -2672
- package/{chunk-WNHST4IE.js → chunk-RKRXAL3V.js} +5451 -5013
- package/{chunk-7E72JMBB.js → chunk-SMPAUSX5.js} +46 -5
- package/{chunk-5X4GQ53C.js → chunk-TLBZMLLJ.js} +7 -7
- package/{chunk-ASDXPOJH.js → chunk-U6QQLXWI.js} +1 -1
- package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
- package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
- package/{chunk-CPYYM4RJ.js → chunk-V5GA74HI.js} +19 -5
- package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
- package/{chunk-G7E4NWFE.js → chunk-W445DPVT.js} +1 -1
- package/{chunk-EMW55KKX.js → chunk-WBZE7C6S.js} +1 -1
- package/{chunk-3UG2IIZ3.js → chunk-WN5AJG5I.js} +1 -1
- package/{chunk-KSRFVP36.js → chunk-WRN7L5CS.js} +1 -1
- package/{chunk-GJXRIOLS.js → chunk-WRP5TTM6.js} +4 -84
- package/chunk-X2K2JSO4.js +163 -0
- package/{chunk-OR2HNLVO.js → chunk-X6EN3KJX.js} +279 -477
- package/{chunk-VWY2CZD2.js → chunk-XMFDQYWA.js} +3 -3
- package/{chunk-IKWTTKWG.js → chunk-XQES6LXQ.js} +2 -2
- package/{chunk-IR6W62Q6.js → chunk-XT73C4VH.js} +18 -21
- package/{chunk-7L5CQQIT.js → chunk-Y5W623XU.js} +15 -15
- package/{chunk-RY57GLGW.js → chunk-YPREESF4.js} +42 -5
- package/{chunk-BQXOGBFN.js → chunk-YZ2WE6CW.js} +2 -2
- package/{chunk-DNQK7M7K.js → chunk-Z7COG62J.js} +4 -4
- package/{chunk-3WXRAHCG.js → chunk-ZBB3MZR3.js} +3 -3
- package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
- package/{clipboardy-MMBYVRLF.js → clipboardy-PRUHGPGC.js} +4 -3
- package/{codingSkills-DY5MINPG.js → codingSkills-6F4EQFCM.js} +4 -5
- package/cooldownCommands-C2SZLEEO.js +90 -0
- package/{createAgentAutomationAction-GVSJL2CI.js → createAgentAutomationAction-TGUXUZCY.js} +28 -30
- package/createDialogAction-FD5AEOUF.js +58 -0
- package/{createPageAction-M2VDKBYS.js → createPageAction-NPC3LYNK.js} +31 -34
- package/{dbSlice-UI2VCBLG.js → dbSlice-PIQGICNM.js} +9 -9
- package/{deleteFile-XQXPBFFB.js → deleteFile-NPZ64DFN.js} +4 -4
- package/{dialogCommands-26DBYNBT.js → dialogCommands-ZF2RSNCG.js} +37 -36
- package/{dialogSlice-FFGLRCBL.js → dialogSlice-6BINHWQT.js} +27 -27
- package/dist-VODFSGNG.js +7442 -0
- package/{docCreateCommands-F2ASWG6B.js → docCreateCommands-4VQ5MOHP.js} +36 -36
- package/{docDeleteCommands-A4URDZPI.js → docDeleteCommands-M7WLNVPB.js} +37 -37
- package/{docReadCommands-DO6VHDZD.js → docReadCommands-6LU6P2WT.js} +36 -36
- package/{docStore-EDAE7RNT.js → docStore-SIUFLABN.js} +29 -31
- package/{docUpdateCommands-ZTXZ3RTP.js → docUpdateCommands-S2LX4ENL.js} +39 -39
- package/{fetchMessages-7QRCCRYK.js → fetchMessages-CUEFN4GQ.js} +4 -4
- package/{getPricing-L2ENXWHV.js → getPricing-P3E2WRIH.js} +5 -5
- package/{handleSendMessageAction-CIRLGHOC.js → handleSendMessageAction-QVG5YNZY.js} +29 -29
- package/index.js +92 -77
- package/{localDialogRead-SLMPV5SK.js → localDialogRead-P7CHFMIC.js} +1 -1
- package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
- package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
- package/{machineCommands-NIQNCYJV.js → machineCommands-OSEBN7BZ.js} +76 -77
- package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
- package/{machineWsRunDispatch-EMTSQGAR.js → machineWsRunDispatch-NTJQCIIF.js} +68 -69
- package/{models-OX2S5C6Q.js → models-L7S2EKPM.js} +2 -2
- package/package.json +1 -1
- package/{read-2VHEHCAN.js → read-6C2XD3YZ.js} +5 -5
- package/{readDocTool-CSWD6NPC.js → readDocTool-Y7AB365O.js} +1 -1
- package/{readlineWorkspace-A2JBJWLI.js → readlineWorkspace-JPME5S7A.js} +4860 -3476
- package/{removeDialogAgentAction-2T7BPM3T.js → removeDialogAgentAction-KG5WMJRZ.js} +13 -13
- package/{runAgentClientLoop-BV4736ED.js → runAgentClientLoop-SOKEXCUF.js} +61 -61
- package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
- package/{setDialogExtraReferencesAction-GPT37HTW.js → setDialogExtraReferencesAction-O2NLXMSM.js} +10 -10
- package/{setPrimaryDialogAgentAction-3746P7IW.js → setPrimaryDialogAgentAction-FYYUY7PB.js} +13 -13
- package/{settingSlice-FIFOQ6OR.js → settingSlice-GPLI6E3M.js} +11 -11
- package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-GPUDHDTZ.js} +3 -4
- package/{slateUtils-VO2FU36K.js → slateUtils-RIZES3PV.js} +1 -1
- package/{spaceCommands-AYZQHDB3.js → spaceCommands-Z5JLMFFJ.js} +223 -37
- package/{spaceSlice-43BNF22B.js → spaceSlice-Z3BGCLGX.js} +28 -30
- package/{streamAgentChatTurn-OLLRSITV.js → streamAgentChatTurn-INF5RGK4.js} +115 -129
- package/{switchDialogAgentAction-MQTUTQHL.js → switchDialogAgentAction-GH5P6Q3Z.js} +9 -9
- package/{chunk-IDAU4UFS.js → syncMapping-N6RGXGBW.js} +11 -11
- package/{tableCommands-QE47K72R.js → tableCommands-PQUJ55AS.js} +3 -3
- package/{tools-2SI3FXLL.js → tools-ZELMSJZ3.js} +45 -47
- package/{tuiSummaryLlmCaller-EAWQ3IZX.js → tuiSummaryLlmCaller-LH7F2SP7.js} +18 -18
- package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
- package/{updateDialogTitleAction-YJEQFYOA.js → updateDialogTitleAction-EDUCIB7G.js} +31 -33
- package/agentRecordCommands-YMGKT2WF.js +0 -113
- package/agentRunCommand-LYEMVQJH.js +0 -131
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-D5JI6VDM.js +0 -1800
- package/chunk-M3JEW6N6.js +0 -193
- package/chunk-ZURFOV5J.js +0 -105
- package/chunk-ZWS6DUHX.js +0 -480
- package/createDialogAction-VVR46Q2A.js +0 -61
- package/syncMapping-RK2MANUX.js +0 -43
- package/{chunk-KMSZPTM6.js → chunk-2WKUUY2E.js} +3 -3
- package/{chunk-CWMSB67P.js → chunk-AGGIDPCZ.js} +0 -0
- package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
buildDialogAttachmentPlan,
|
|
6
6
|
extractFileContentIds
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JIADXJYU.js";
|
|
8
8
|
import {
|
|
9
9
|
isOAuthApiKeyRef
|
|
10
10
|
} from "./chunk-YYLHWIW6.js";
|
|
11
11
|
import {
|
|
12
12
|
getApproxPricePerImage
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AGGIDPCZ.js";
|
|
14
14
|
import {
|
|
15
15
|
runLlm
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TLBZMLLJ.js";
|
|
17
17
|
import {
|
|
18
18
|
cleanupCliSessionForDialog
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MGIHZ5CJ.js";
|
|
20
20
|
import {
|
|
21
21
|
getActiveDialogAgentId,
|
|
22
22
|
getDialogAgentIds,
|
|
@@ -26,16 +26,27 @@ import {
|
|
|
26
26
|
require_date_fns
|
|
27
27
|
} from "./chunk-M76ECQRD.js";
|
|
28
28
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
abortActiveControllers,
|
|
30
|
+
addPageReferenceToRuntime,
|
|
31
|
+
applyClearDialogStateRuntime,
|
|
32
|
+
applyUpdateTokensFulfilled,
|
|
33
|
+
clearActiveControllers,
|
|
34
|
+
deleteDialogRuntime,
|
|
35
|
+
getActiveDialogKey,
|
|
36
|
+
getDialogRuntimeTokens,
|
|
37
|
+
require_react,
|
|
38
|
+
resetDialogRuntimeSessionState,
|
|
39
|
+
selectCurrentDialogKey,
|
|
40
|
+
setActiveDialogKey,
|
|
41
|
+
setDialogConfigError
|
|
42
|
+
} from "./chunk-MRWGHF56.js";
|
|
31
43
|
import {
|
|
32
44
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
33
45
|
DEFAULT_CONTEXT_WINDOW,
|
|
34
46
|
getModelContextWindow,
|
|
35
47
|
getModelInfo,
|
|
36
|
-
resolveAutoExecutionProfile
|
|
37
|
-
|
|
38
|
-
} from "./chunk-GJXRIOLS.js";
|
|
48
|
+
resolveAutoExecutionProfile
|
|
49
|
+
} from "./chunk-WRP5TTM6.js";
|
|
39
50
|
import {
|
|
40
51
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
41
52
|
buildCompactionMetricsFromPlan,
|
|
@@ -47,36 +58,26 @@ import {
|
|
|
47
58
|
normalizeAssistantContentBuffer,
|
|
48
59
|
planCompression,
|
|
49
60
|
serializeMessageContent
|
|
50
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-FGLKRJDI.js";
|
|
51
62
|
import {
|
|
52
63
|
findModelConfig,
|
|
53
64
|
getModelConfig
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import {
|
|
56
|
-
abortActiveControllers,
|
|
57
|
-
addPageReferenceToRuntime,
|
|
58
|
-
applyClearDialogStateRuntime,
|
|
59
|
-
applyUpdateTokensFulfilled,
|
|
60
|
-
clearActiveControllers,
|
|
61
|
-
deleteDialogRuntime,
|
|
62
|
-
getActiveDialogKey,
|
|
63
|
-
getDialogRuntimeTokens,
|
|
64
|
-
require_react,
|
|
65
|
-
resetDialogRuntimeSessionState,
|
|
66
|
-
selectCurrentDialogKey,
|
|
67
|
-
setActiveDialogKey,
|
|
68
|
-
setDialogConfigError
|
|
69
|
-
} from "./chunk-MRWGHF56.js";
|
|
65
|
+
} from "./chunk-C6ELZQ7H.js";
|
|
70
66
|
import {
|
|
71
67
|
toErrorMessage
|
|
72
68
|
} from "./chunk-HNMXYYJR.js";
|
|
69
|
+
import {
|
|
70
|
+
fetchMessages
|
|
71
|
+
} from "./chunk-WRN7L5CS.js";
|
|
73
72
|
import {
|
|
74
73
|
getPlatformHostedDeepSeekV4Price,
|
|
75
|
-
isPlatformHostedDeepSeekV4Model
|
|
76
|
-
|
|
74
|
+
isPlatformHostedDeepSeekV4Model,
|
|
75
|
+
isPlatformHostedImageModel,
|
|
76
|
+
isPlatformHostedOpenAIImageModel
|
|
77
|
+
} from "./chunk-X6EN3KJX.js";
|
|
77
78
|
import {
|
|
78
79
|
nolotusId
|
|
79
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-B6H5XCT2.js";
|
|
80
81
|
import {
|
|
81
82
|
asRecordOrEmpty
|
|
82
83
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -86,7 +87,7 @@ import {
|
|
|
86
87
|
remove,
|
|
87
88
|
selectById,
|
|
88
89
|
write
|
|
89
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-23KKIMD5.js";
|
|
90
91
|
import {
|
|
91
92
|
buildDialogAgentListIndexDeleteOps,
|
|
92
93
|
createDialogMessageKeyAndId,
|
|
@@ -97,16 +98,27 @@ import {
|
|
|
97
98
|
isDialogRecordKey,
|
|
98
99
|
isPageKey,
|
|
99
100
|
isTableMetaKey
|
|
100
|
-
} from "./chunk-
|
|
101
|
-
import {
|
|
102
|
-
asOptionalFiniteNumber
|
|
103
|
-
} from "./chunk-WWC7I6TA.js";
|
|
101
|
+
} from "./chunk-2WKUUY2E.js";
|
|
104
102
|
import {
|
|
105
103
|
asTrimmedNonEmptyStringArray
|
|
106
104
|
} from "./chunk-I42VC5KR.js";
|
|
105
|
+
import {
|
|
106
|
+
asOptionalFiniteNumber
|
|
107
|
+
} from "./chunk-WWC7I6TA.js";
|
|
107
108
|
import {
|
|
108
109
|
asTrimmedLowercaseString
|
|
109
110
|
} from "./chunk-QSJ3HFEF.js";
|
|
111
|
+
import {
|
|
112
|
+
builtinAgentCatalogEntryById,
|
|
113
|
+
builtinRuntimeFallbackEntries,
|
|
114
|
+
isBuiltinPlatformAgentKey
|
|
115
|
+
} from "./chunk-XT73C4VH.js";
|
|
116
|
+
import {
|
|
117
|
+
extractCustomId,
|
|
118
|
+
extractUserId,
|
|
119
|
+
parsePublicAgentId,
|
|
120
|
+
publicAgentKey
|
|
121
|
+
} from "./chunk-BJIRLHJR.js";
|
|
110
122
|
import {
|
|
111
123
|
asyncThunkCreator,
|
|
112
124
|
buildCreateSlice,
|
|
@@ -117,25 +129,21 @@ import {
|
|
|
117
129
|
parseOwnerUserIdFromDbKey,
|
|
118
130
|
scheduleDeleteReplication,
|
|
119
131
|
selectIdentityUserId
|
|
120
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-HHBXCRJS.js";
|
|
121
133
|
import {
|
|
122
134
|
createClientLogger,
|
|
123
135
|
isAbortError
|
|
124
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-L3JWI7WX.js";
|
|
125
137
|
import {
|
|
126
138
|
isTombstoneRecord,
|
|
127
139
|
shouldReplaceWithNextRecord
|
|
128
140
|
} from "./chunk-GBRG75BQ.js";
|
|
129
|
-
import {
|
|
130
|
-
asTrimmedString
|
|
131
|
-
} from "./chunk-3EUW3WEO.js";
|
|
132
|
-
import {
|
|
133
|
-
extractCustomId,
|
|
134
|
-
extractUserId
|
|
135
|
-
} from "./chunk-BJIRLHJR.js";
|
|
136
141
|
import {
|
|
137
142
|
isRecord
|
|
138
143
|
} from "./chunk-KUG52IAP.js";
|
|
144
|
+
import {
|
|
145
|
+
asTrimmedString
|
|
146
|
+
} from "./chunk-3EUW3WEO.js";
|
|
139
147
|
import {
|
|
140
148
|
asOptionalTrimmedString
|
|
141
149
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -884,8 +892,8 @@ var addReferenceKeysAction = createAsyncThunk(
|
|
|
884
892
|
const { content, dialogKey } = args;
|
|
885
893
|
const newKeys = extractReferenceKeys(content);
|
|
886
894
|
if (newKeys.length === 0) return;
|
|
887
|
-
const
|
|
888
|
-
const dialogConfig = selectById(
|
|
895
|
+
const state = getState();
|
|
896
|
+
const dialogConfig = selectById(state, dialogKey);
|
|
889
897
|
if (!dialogConfig) return;
|
|
890
898
|
const existingKeys = new Set(dialogConfig.referenceKeys || []);
|
|
891
899
|
const keysToAdd = newKeys.filter((k) => !existingKeys.has(k));
|
|
@@ -1322,8 +1330,8 @@ var extractReferenceKeysFromMessage = (msg) => {
|
|
|
1322
1330
|
};
|
|
1323
1331
|
|
|
1324
1332
|
// packages/chat/dialog/actions/updateDialogSummaryAction.ts
|
|
1325
|
-
var getMessagesForDialogFromState = (
|
|
1326
|
-
const msgsState =
|
|
1333
|
+
var getMessagesForDialogFromState = (state, dialogId) => {
|
|
1334
|
+
const msgsState = state.message.dialogStateById[dialogId]?.msgs;
|
|
1327
1335
|
if (!msgsState || !msgsState.ids) return [];
|
|
1328
1336
|
return msgsState.ids.flatMap((id) => {
|
|
1329
1337
|
const msg = msgsState.entities[id];
|
|
@@ -1338,19 +1346,19 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
|
|
|
1338
1346
|
summarizingDialogs.add(dialogKey);
|
|
1339
1347
|
const { dispatch, getState } = thunkApi;
|
|
1340
1348
|
try {
|
|
1341
|
-
const
|
|
1349
|
+
const state = getState();
|
|
1342
1350
|
const dialogId = extractCustomId(dialogKey);
|
|
1343
|
-
const dialogConfig = selectById(
|
|
1351
|
+
const dialogConfig = selectById(state, dialogKey);
|
|
1344
1352
|
if (!dialogConfig) return;
|
|
1345
1353
|
let contextWindow = DEFAULT_CONTEXT_WINDOW;
|
|
1346
1354
|
if (dialogConfig.cybots && dialogConfig.cybots.length > 0) {
|
|
1347
1355
|
const agentId = dialogConfig.cybots[0];
|
|
1348
|
-
const agent = selectById(
|
|
1356
|
+
const agent = selectById(state, agentId);
|
|
1349
1357
|
if (agent?.model) {
|
|
1350
1358
|
contextWindow = getModelContextWindow(agent.model);
|
|
1351
1359
|
}
|
|
1352
1360
|
}
|
|
1353
|
-
const allMsgs = preFetchedMessages || getMessagesForDialogFromState(
|
|
1361
|
+
const allMsgs = preFetchedMessages || getMessagesForDialogFromState(state, dialogId);
|
|
1354
1362
|
const plan = planCompression({
|
|
1355
1363
|
allMsgs,
|
|
1356
1364
|
summarizedBeforeId: dialogConfig.summarizedBeforeId,
|
|
@@ -1525,6 +1533,10 @@ var uiAskChoiceFunctionSchema = {
|
|
|
1525
1533
|
type: "string",
|
|
1526
1534
|
description: "\u95EE\u9898\u6807\u8BC6\u3002"
|
|
1527
1535
|
},
|
|
1536
|
+
header: {
|
|
1537
|
+
type: "string",
|
|
1538
|
+
description: "\u591A\u95EE\u9898 tab \u680F\u663E\u793A\u7684\u77ED\u6807\u7B7E\uFF08\u226412 \u5B57\u7B26\uFF0C\u5982\u201C\u683C\u5F0F/\u8BED\u8A00/\u8303\u56F4\u201D\uFF09\uFF0C\u7F3A\u7701\u7528 Qn\u3002"
|
|
1539
|
+
},
|
|
1528
1540
|
question: {
|
|
1529
1541
|
type: "string",
|
|
1530
1542
|
description: "\u95EE\u9898\u6587\u6848\u3002"
|
|
@@ -1643,6 +1655,76 @@ var buildPersonalizationDialogPolicyContext = () => [
|
|
|
1643
1655
|
"\u9664\u975E\u7528\u6237\u660E\u786E\u8981\u6C42\uFF0C\u5426\u5219\u4E0D\u8981\u521B\u5EFA\u6587\u6863\uFF0C\u4E0D\u8981\u521B\u5EFA\u6216\u4FEE\u6539\u4EFB\u4F55 agent\u3002"
|
|
1644
1656
|
].join("\n");
|
|
1645
1657
|
|
|
1658
|
+
// packages/agent-runtime/builtinPlatformAgentRoute.ts
|
|
1659
|
+
function resolveBuiltinAgentRuntimeFields(agentKey) {
|
|
1660
|
+
if (!isBuiltinPlatformAgentKey(agentKey)) return null;
|
|
1661
|
+
const entry = builtinAgentCatalogEntryById(parsePublicAgentId(agentKey));
|
|
1662
|
+
if (!entry) return null;
|
|
1663
|
+
return { provider: entry.provider, model: entry.model };
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
// packages/agent-runtime/builtinPlatformAgentConfigs.ts
|
|
1667
|
+
function buildConfig(e) {
|
|
1668
|
+
const key = publicAgentKey(e.id);
|
|
1669
|
+
const rawRecord = {
|
|
1670
|
+
dbKey: key,
|
|
1671
|
+
isPublic: true,
|
|
1672
|
+
provider: e.provider,
|
|
1673
|
+
model: e.model,
|
|
1674
|
+
apiSource: e.apiSource ?? "platform",
|
|
1675
|
+
useServerProxy: e.useServerProxy ?? true
|
|
1676
|
+
};
|
|
1677
|
+
if (e.hasImageOutput) rawRecord.hasImageOutput = true;
|
|
1678
|
+
if (e.imageModel) rawRecord.imageModel = e.imageModel;
|
|
1679
|
+
if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
|
|
1680
|
+
if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
|
|
1681
|
+
return {
|
|
1682
|
+
key,
|
|
1683
|
+
name: e.name,
|
|
1684
|
+
provider: e.provider,
|
|
1685
|
+
model: e.model,
|
|
1686
|
+
apiSource: e.apiSource ?? "platform",
|
|
1687
|
+
useServerProxy: e.useServerProxy ?? true,
|
|
1688
|
+
rawRecord
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
|
|
1692
|
+
builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
|
|
1693
|
+
);
|
|
1694
|
+
function resolveBuiltinPlatformAgentConfig(agentRef) {
|
|
1695
|
+
return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
|
|
1696
|
+
}
|
|
1697
|
+
function resolveBuiltinPlatformAgentRecord(agentRef) {
|
|
1698
|
+
const config = resolveBuiltinPlatformAgentConfig(agentRef);
|
|
1699
|
+
if (!config) return null;
|
|
1700
|
+
return {
|
|
1701
|
+
...config.rawRecord,
|
|
1702
|
+
dbKey: agentRef,
|
|
1703
|
+
...config.name ? { name: config.name } : {}
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
function applyBuiltinAgentRuntimeOverride(agentKey, record) {
|
|
1707
|
+
const fields = resolveBuiltinAgentRuntimeFields(agentKey);
|
|
1708
|
+
if (!fields) return record;
|
|
1709
|
+
const current = record;
|
|
1710
|
+
const rawNeedsOverride = current.rawRecord != null && (current.rawRecord.provider !== fields.provider || current.rawRecord.model !== fields.model);
|
|
1711
|
+
if (current.provider === fields.provider && current.model === fields.model && !rawNeedsOverride) {
|
|
1712
|
+
return record;
|
|
1713
|
+
}
|
|
1714
|
+
return {
|
|
1715
|
+
...record,
|
|
1716
|
+
provider: fields.provider,
|
|
1717
|
+
model: fields.model,
|
|
1718
|
+
...current.rawRecord ? {
|
|
1719
|
+
rawRecord: {
|
|
1720
|
+
...current.rawRecord,
|
|
1721
|
+
provider: fields.provider,
|
|
1722
|
+
model: fields.model
|
|
1723
|
+
}
|
|
1724
|
+
} : {}
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1646
1728
|
// packages/chat/dialog/dialogAgentPolicy.ts
|
|
1647
1729
|
var resolveDialogAgentMode = (dialog) => {
|
|
1648
1730
|
if (dialog?.agentMode === "auto") return "auto";
|
|
@@ -2007,7 +2089,8 @@ function buildFallbackActivity(toolName, args) {
|
|
|
2007
2089
|
const path = asTrimmedString(args.path);
|
|
2008
2090
|
return path ? { title: "\u4FEE\u6539\u6587\u4EF6", refs: [{ type: "file", path }] } : void 0;
|
|
2009
2091
|
}
|
|
2010
|
-
case "
|
|
2092
|
+
case "codeSearch":
|
|
2093
|
+
case "code_search": {
|
|
2011
2094
|
const query = asTrimmedString(args.query);
|
|
2012
2095
|
return query ? { title: "\u5728\u4EE3\u7801\u91CC\u627E\u7EBF\u7D22", detail: query } : void 0;
|
|
2013
2096
|
}
|
|
@@ -2017,14 +2100,6 @@ function buildFallbackActivity(toolName, args) {
|
|
|
2017
2100
|
);
|
|
2018
2101
|
return pattern ? { title: "\u67E5\u627E\u76F8\u5173\u6587\u4EF6", detail: pattern } : void 0;
|
|
2019
2102
|
}
|
|
2020
|
-
case "listFiles": {
|
|
2021
|
-
const path = asTrimmedString(args.path) || ".";
|
|
2022
|
-
return {
|
|
2023
|
-
title: "\u6D4F\u89C8\u76EE\u5F55",
|
|
2024
|
-
detail: path,
|
|
2025
|
-
refs: [{ type: "file", path }]
|
|
2026
|
-
};
|
|
2027
|
-
}
|
|
2028
2103
|
case "loadSkill": {
|
|
2029
2104
|
const name = asTrimmedString(args.name);
|
|
2030
2105
|
return name ? { title: "\u52A0\u8F7D\u6280\u80FD", detail: name } : void 0;
|
|
@@ -2499,13 +2574,13 @@ function getLatestUserInputFromMessages(messages) {
|
|
|
2499
2574
|
}
|
|
2500
2575
|
return null;
|
|
2501
2576
|
}
|
|
2502
|
-
function getDialogSpaceIdFromState(
|
|
2577
|
+
function getDialogSpaceIdFromState(state, dialogKey) {
|
|
2503
2578
|
if (!dialogKey) return void 0;
|
|
2504
|
-
const dialog = selectById(
|
|
2579
|
+
const dialog = selectById(state, dialogKey);
|
|
2505
2580
|
return typeof dialog?.spaceId === "string" ? dialog.spaceId : void 0;
|
|
2506
2581
|
}
|
|
2507
|
-
function resolveMemoryCaptureBaseUrl(
|
|
2508
|
-
const currentServer = typeof
|
|
2582
|
+
function resolveMemoryCaptureBaseUrl(state) {
|
|
2583
|
+
const currentServer = typeof state?.settings?.currentServer === "string" ? state.settings.currentServer : null;
|
|
2509
2584
|
const _window = globalThis.window;
|
|
2510
2585
|
if (!_window) return (currentServer || "").replace(/\/+$/, "");
|
|
2511
2586
|
if (!currentServer) return _window.location.origin;
|
|
@@ -2517,11 +2592,11 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
|
|
|
2517
2592
|
if (!input.agentKey) return;
|
|
2518
2593
|
const latestUserInput = getLatestUserInputFromMessages(input.messages);
|
|
2519
2594
|
if (!latestUserInput) return;
|
|
2520
|
-
const
|
|
2521
|
-
const token = typeof
|
|
2522
|
-
const baseUrl = resolveMemoryCaptureBaseUrl(
|
|
2595
|
+
const state = input.state;
|
|
2596
|
+
const token = typeof state?.auth?.currentToken === "string" ? state.auth.currentToken : null;
|
|
2597
|
+
const baseUrl = resolveMemoryCaptureBaseUrl(state);
|
|
2523
2598
|
if (!token || !baseUrl) return;
|
|
2524
|
-
const dialog = input.dialogKey ? selectById(
|
|
2599
|
+
const dialog = input.dialogKey ? selectById(state, input.dialogKey) : void 0;
|
|
2525
2600
|
try {
|
|
2526
2601
|
await fetch(`${baseUrl}/api/memory/capture-turn`, {
|
|
2527
2602
|
method: "POST",
|
|
@@ -2534,7 +2609,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
|
|
|
2534
2609
|
dialogId: input.dialogId,
|
|
2535
2610
|
userInput: latestUserInput,
|
|
2536
2611
|
assistantText: input.assistantText,
|
|
2537
|
-
spaceId: input.spaceId ?? getDialogSpaceIdFromState(
|
|
2612
|
+
spaceId: input.spaceId ?? getDialogSpaceIdFromState(state, input.dialogKey)
|
|
2538
2613
|
})
|
|
2539
2614
|
});
|
|
2540
2615
|
} catch {
|
|
@@ -2663,24 +2738,24 @@ var captureUnderstandingFromCompletedUiTurn2 = async (input) => captureUnderstan
|
|
|
2663
2738
|
messages: input.messages ?? selectAllMsgs(input.state, input.dialogId)
|
|
2664
2739
|
});
|
|
2665
2740
|
var resolveMessageDialogId = (_state, dialogId, dialogKey) => dialogId ?? (dialogKey ? extractCustomId(dialogKey) : null) ?? getActiveMessageDialogId() ?? GLOBAL_MESSAGE_DIALOG_ID;
|
|
2666
|
-
var ensureMessageDialogState = (
|
|
2667
|
-
const resolvedDialogId = resolveMessageDialogId(
|
|
2668
|
-
if (!
|
|
2669
|
-
|
|
2741
|
+
var ensureMessageDialogState = (state, dialogId, dialogKey) => {
|
|
2742
|
+
const resolvedDialogId = resolveMessageDialogId(state, dialogId, dialogKey);
|
|
2743
|
+
if (!state.dialogStateById) {
|
|
2744
|
+
state.dialogStateById = {
|
|
2670
2745
|
[GLOBAL_MESSAGE_DIALOG_ID]: createEmptyMessageDialogState()
|
|
2671
2746
|
};
|
|
2672
2747
|
}
|
|
2673
|
-
if (!
|
|
2674
|
-
|
|
2748
|
+
if (!state.dialogStateById[resolvedDialogId]) {
|
|
2749
|
+
state.dialogStateById[resolvedDialogId] = createEmptyMessageDialogState();
|
|
2675
2750
|
}
|
|
2676
|
-
return
|
|
2751
|
+
return state.dialogStateById[resolvedDialogId];
|
|
2677
2752
|
};
|
|
2678
|
-
var getMessageDialogState = (
|
|
2679
|
-
const dialogStateById =
|
|
2680
|
-
const resolvedDialogId = resolveMessageDialogId(
|
|
2753
|
+
var getMessageDialogState = (state, dialogId, dialogKey) => {
|
|
2754
|
+
const dialogStateById = state.dialogStateById ?? {};
|
|
2755
|
+
const resolvedDialogId = resolveMessageDialogId(state, dialogId, dialogKey);
|
|
2681
2756
|
const bucket = dialogStateById[resolvedDialogId];
|
|
2682
2757
|
if (bucket) return bucket;
|
|
2683
|
-
const legacyMsgs =
|
|
2758
|
+
const legacyMsgs = state.msgs;
|
|
2684
2759
|
if (legacyMsgs && typeof legacyMsgs === "object") {
|
|
2685
2760
|
return { msgs: legacyMsgs };
|
|
2686
2761
|
}
|
|
@@ -2695,16 +2770,16 @@ var inferDialogIdFromDbKey = (dbKey) => {
|
|
|
2695
2770
|
return null;
|
|
2696
2771
|
};
|
|
2697
2772
|
var inferDialogIdFromMessage = (message) => message.dialogId ?? inferDialogIdFromDbKey(message.dbKey);
|
|
2698
|
-
var findDialogIdByMessageId = (
|
|
2699
|
-
for (const [dialogId, dialogState] of Object.entries(
|
|
2773
|
+
var findDialogIdByMessageId = (state, messageId) => {
|
|
2774
|
+
for (const [dialogId, dialogState] of Object.entries(state.dialogStateById)) {
|
|
2700
2775
|
if (dialogState.msgs.entities[messageId]) {
|
|
2701
2776
|
return dialogId;
|
|
2702
2777
|
}
|
|
2703
2778
|
}
|
|
2704
2779
|
return null;
|
|
2705
2780
|
};
|
|
2706
|
-
var findDialogIdByMessageDbKey = (
|
|
2707
|
-
for (const [dialogId, dialogState] of Object.entries(
|
|
2781
|
+
var findDialogIdByMessageDbKey = (state, dbKey) => {
|
|
2782
|
+
for (const [dialogId, dialogState] of Object.entries(state.dialogStateById)) {
|
|
2708
2783
|
const hasDbKey = Object.values(dialogState.msgs.entities).some(
|
|
2709
2784
|
(message) => message?.dbKey === dbKey
|
|
2710
2785
|
);
|
|
@@ -2743,10 +2818,10 @@ var messageSlice = createSliceWithThunks({
|
|
|
2743
2818
|
name: "message",
|
|
2744
2819
|
initialState,
|
|
2745
2820
|
reducers: (create) => ({
|
|
2746
|
-
addUserMessage: create.reducer((
|
|
2821
|
+
addUserMessage: create.reducer((state, action2) => {
|
|
2747
2822
|
const { dialogId, ...message } = action2.payload;
|
|
2748
2823
|
const dialogState = ensureMessageDialogState(
|
|
2749
|
-
|
|
2824
|
+
state,
|
|
2750
2825
|
dialogId ?? inferDialogIdFromMessage(action2.payload)
|
|
2751
2826
|
);
|
|
2752
2827
|
upsertOneMessage(dialogState, {
|
|
@@ -2755,10 +2830,10 @@ var messageSlice = createSliceWithThunks({
|
|
|
2755
2830
|
});
|
|
2756
2831
|
}),
|
|
2757
2832
|
messageStreaming: create.reducer(
|
|
2758
|
-
(
|
|
2833
|
+
(state, action2) => {
|
|
2759
2834
|
const { dialogId, ...message } = action2.payload;
|
|
2760
2835
|
const resolvedDialogId = dialogId ?? inferDialogIdFromMessage(action2.payload);
|
|
2761
|
-
const dialogState = ensureMessageDialogState(
|
|
2836
|
+
const dialogState = ensureMessageDialogState(state, resolvedDialogId);
|
|
2762
2837
|
const existing = dialogState.msgs.entities[message.id];
|
|
2763
2838
|
upsertOneMessage(
|
|
2764
2839
|
dialogState,
|
|
@@ -2768,36 +2843,36 @@ var messageSlice = createSliceWithThunks({
|
|
|
2768
2843
|
markMessageStreamActivity(resolvedDialogId);
|
|
2769
2844
|
}
|
|
2770
2845
|
),
|
|
2771
|
-
resetMsgs: create.reducer((
|
|
2846
|
+
resetMsgs: create.reducer((state, action2) => {
|
|
2772
2847
|
if (action2.payload?.all) {
|
|
2773
|
-
|
|
2848
|
+
state.dialogStateById = {
|
|
2774
2849
|
[GLOBAL_MESSAGE_DIALOG_ID]: createEmptyMessageDialogState()
|
|
2775
2850
|
};
|
|
2776
2851
|
resetAllMessageSessions();
|
|
2777
2852
|
return;
|
|
2778
2853
|
}
|
|
2779
2854
|
const dialogId = resolveMessageDialogId(
|
|
2780
|
-
|
|
2855
|
+
state,
|
|
2781
2856
|
action2.payload?.dialogId,
|
|
2782
2857
|
action2.payload?.dialogKey
|
|
2783
2858
|
);
|
|
2784
|
-
delete
|
|
2859
|
+
delete state.dialogStateById[dialogId];
|
|
2785
2860
|
deleteMessageSession(dialogId);
|
|
2786
2861
|
if (dialogId === getActiveMessageDialogId()) {
|
|
2787
2862
|
setActiveMessageDialogId(null);
|
|
2788
2863
|
}
|
|
2789
|
-
if (!
|
|
2790
|
-
|
|
2864
|
+
if (!state.dialogStateById[GLOBAL_MESSAGE_DIALOG_ID]) {
|
|
2865
|
+
state.dialogStateById[GLOBAL_MESSAGE_DIALOG_ID] = createEmptyMessageDialogState();
|
|
2791
2866
|
}
|
|
2792
2867
|
}),
|
|
2793
|
-
clearAllStreaming: create.reducer((
|
|
2794
|
-
const targetStates = action2.payload?.all ? Object.entries(
|
|
2868
|
+
clearAllStreaming: create.reducer((state, action2) => {
|
|
2869
|
+
const targetStates = action2.payload?.all ? Object.entries(state.dialogStateById) : [[
|
|
2795
2870
|
resolveMessageDialogId(
|
|
2796
|
-
|
|
2871
|
+
state,
|
|
2797
2872
|
action2.payload?.dialogId,
|
|
2798
2873
|
action2.payload?.dialogKey
|
|
2799
2874
|
),
|
|
2800
|
-
getMessageDialogState(
|
|
2875
|
+
getMessageDialogState(state, action2.payload?.dialogId, action2.payload?.dialogKey)
|
|
2801
2876
|
]];
|
|
2802
2877
|
targetStates.forEach(([dialogId, dialogState]) => {
|
|
2803
2878
|
const updates = Object.values(dialogState.msgs.entities).filter((m) => m?.isStreaming).map((m) => ({ id: m.id, changes: { isStreaming: false } }));
|
|
@@ -2809,10 +2884,10 @@ var messageSlice = createSliceWithThunks({
|
|
|
2809
2884
|
});
|
|
2810
2885
|
}),
|
|
2811
2886
|
removeTransientMessage: create.reducer(
|
|
2812
|
-
(
|
|
2887
|
+
(state, action2) => {
|
|
2813
2888
|
const payload = typeof action2.payload === "string" ? { id: action2.payload } : action2.payload;
|
|
2814
|
-
const dialogId = payload.dialogId ?? findDialogIdByMessageId(
|
|
2815
|
-
const dialogState = ensureMessageDialogState(
|
|
2889
|
+
const dialogId = payload.dialogId ?? findDialogIdByMessageId(state, payload.id);
|
|
2890
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
2816
2891
|
removeOneMessage(dialogState, payload.id);
|
|
2817
2892
|
}
|
|
2818
2893
|
),
|
|
@@ -2820,10 +2895,10 @@ var messageSlice = createSliceWithThunks({
|
|
|
2820
2895
|
// instead of wiping the trace. Decision rules live in messageFinalizeOnError
|
|
2821
2896
|
// (Wave15); this reducer applies them + clears the streaming index.
|
|
2822
2897
|
finalizeTransientMessageOnError: create.reducer(
|
|
2823
|
-
(
|
|
2898
|
+
(state, action2) => {
|
|
2824
2899
|
const payload = typeof action2.payload === "string" ? { id: action2.payload } : action2.payload;
|
|
2825
|
-
const dialogId = payload.dialogId ?? findDialogIdByMessageId(
|
|
2826
|
-
const dialogState = ensureMessageDialogState(
|
|
2900
|
+
const dialogId = payload.dialogId ?? findDialogIdByMessageId(state, payload.id);
|
|
2901
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
2827
2902
|
const existing = dialogState.msgs.entities[payload.id];
|
|
2828
2903
|
const decision = resolveFinalizeTransientOnError(
|
|
2829
2904
|
existing,
|
|
@@ -2842,26 +2917,26 @@ var messageSlice = createSliceWithThunks({
|
|
|
2842
2917
|
setStreamingMessageId(dialogId, null);
|
|
2843
2918
|
}
|
|
2844
2919
|
),
|
|
2845
|
-
addToolMessage: create.reducer((
|
|
2920
|
+
addToolMessage: create.reducer((state, action2) => {
|
|
2846
2921
|
const dialogState = ensureMessageDialogState(
|
|
2847
|
-
|
|
2922
|
+
state,
|
|
2848
2923
|
inferDialogIdFromMessage(action2.payload)
|
|
2849
2924
|
);
|
|
2850
2925
|
addOneMessage(dialogState, action2.payload);
|
|
2851
2926
|
}),
|
|
2852
|
-
updateToolMessage: create.reducer((
|
|
2927
|
+
updateToolMessage: create.reducer((state, action2) => {
|
|
2853
2928
|
const dialogState = ensureMessageDialogState(
|
|
2854
|
-
|
|
2855
|
-
action2.payload.dialogId ?? findDialogIdByMessageId(
|
|
2929
|
+
state,
|
|
2930
|
+
action2.payload.dialogId ?? findDialogIdByMessageId(state, action2.payload.id)
|
|
2856
2931
|
);
|
|
2857
2932
|
updateOneMessage(dialogState, action2.payload);
|
|
2858
2933
|
}),
|
|
2859
|
-
removeMessagesByIds: create.reducer((
|
|
2860
|
-
const dialogState = ensureMessageDialogState(
|
|
2934
|
+
removeMessagesByIds: create.reducer((state, action2) => {
|
|
2935
|
+
const dialogState = ensureMessageDialogState(state, action2.payload.dialogId);
|
|
2861
2936
|
dialogState.msgs = messagesAdapter.removeMany(dialogState.msgs, action2.payload.ids);
|
|
2862
2937
|
}),
|
|
2863
|
-
setMessages: create.reducer((
|
|
2864
|
-
const dialogState = ensureMessageDialogState(
|
|
2938
|
+
setMessages: create.reducer((state, action2) => {
|
|
2939
|
+
const dialogState = ensureMessageDialogState(state, action2.payload.dialogId);
|
|
2865
2940
|
if (action2.payload.replace) {
|
|
2866
2941
|
setAllMessages(dialogState, action2.payload.messages);
|
|
2867
2942
|
} else {
|
|
@@ -2877,13 +2952,13 @@ var messageSlice = createSliceWithThunks({
|
|
|
2877
2952
|
async (args, thunkApi) => {
|
|
2878
2953
|
const { message, dialogConfig } = args;
|
|
2879
2954
|
const { getState, dispatch, rejectWithValue } = thunkApi;
|
|
2880
|
-
const
|
|
2955
|
+
const state = getState();
|
|
2881
2956
|
if (!dialogConfig) {
|
|
2882
2957
|
return rejectWithValue("Missing dialogConfig");
|
|
2883
2958
|
}
|
|
2884
2959
|
const dialogKey = dialogConfig.dbKey || dialogConfig.id;
|
|
2885
2960
|
const dialogId = extractCustomId(dialogKey);
|
|
2886
|
-
const currentAccountUserId = selectIdentityUserId(
|
|
2961
|
+
const currentAccountUserId = selectIdentityUserId(state) ?? null;
|
|
2887
2962
|
const dialogConfigUserId = dialogConfig.userId;
|
|
2888
2963
|
const { fullMessage } = assemblePersistedUserMessage({
|
|
2889
2964
|
message,
|
|
@@ -2938,8 +3013,8 @@ var messageSlice = createSliceWithThunks({
|
|
|
2938
3013
|
}, thunkApi) => {
|
|
2939
3014
|
const { db } = thunkApi.extra;
|
|
2940
3015
|
const { getState, signal, dispatch } = thunkApi;
|
|
2941
|
-
const
|
|
2942
|
-
const { currentToken: token, remoteServers } = getRuntimeServerContext(
|
|
3016
|
+
const state = getState();
|
|
3017
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
2943
3018
|
const { localMessages, remotePromise, earlyReturned } = await fetchAndCacheMessagesLocalFirst({
|
|
2944
3019
|
db,
|
|
2945
3020
|
dialogId,
|
|
@@ -2991,9 +3066,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
2991
3066
|
return finalMessages;
|
|
2992
3067
|
},
|
|
2993
3068
|
{
|
|
2994
|
-
pending: (
|
|
3069
|
+
pending: (state, action2) => {
|
|
2995
3070
|
const { dialogId, isNew, limit } = action2.meta.arg;
|
|
2996
|
-
const dialogState = ensureMessageDialogState(
|
|
3071
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
2997
3072
|
if (isNew) {
|
|
2998
3073
|
if (Object.keys(dialogState.msgs.entities).length === 0) {
|
|
2999
3074
|
removeAllMessages(dialogState);
|
|
@@ -3012,9 +3087,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3012
3087
|
currentInitMsgsRequestId: action2.meta.requestId
|
|
3013
3088
|
});
|
|
3014
3089
|
},
|
|
3015
|
-
fulfilled: (
|
|
3090
|
+
fulfilled: (state, action2) => {
|
|
3016
3091
|
const dialogId = action2.meta.arg.dialogId;
|
|
3017
|
-
const dialogState = ensureMessageDialogState(
|
|
3092
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
3018
3093
|
const session = getMessageSession(dialogId);
|
|
3019
3094
|
if (session.currentInitMsgsRequestId !== action2.meta.requestId) {
|
|
3020
3095
|
return;
|
|
@@ -3041,9 +3116,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3041
3116
|
setAllMessages(dialogState, action2.payload);
|
|
3042
3117
|
}
|
|
3043
3118
|
},
|
|
3044
|
-
rejected: (
|
|
3119
|
+
rejected: (state, action2) => {
|
|
3045
3120
|
const dialogId = action2.meta.arg.dialogId;
|
|
3046
|
-
ensureMessageDialogState(
|
|
3121
|
+
ensureMessageDialogState(state, dialogId);
|
|
3047
3122
|
const session = getMessageSession(dialogId);
|
|
3048
3123
|
if (session.currentInitMsgsRequestId !== action2.meta.requestId) {
|
|
3049
3124
|
return;
|
|
@@ -3076,8 +3151,8 @@ var messageSlice = createSliceWithThunks({
|
|
|
3076
3151
|
}, thunkApi) => {
|
|
3077
3152
|
const { getState, extra, signal } = thunkApi;
|
|
3078
3153
|
const { db } = extra;
|
|
3079
|
-
const
|
|
3080
|
-
const { currentToken: token, remoteServers } = getRuntimeServerContext(
|
|
3154
|
+
const state = getState();
|
|
3155
|
+
const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
|
|
3081
3156
|
const messages = (await fetchAndCacheMessages({
|
|
3082
3157
|
db,
|
|
3083
3158
|
dialogId,
|
|
@@ -3091,18 +3166,18 @@ var messageSlice = createSliceWithThunks({
|
|
|
3091
3166
|
return { messages, limit };
|
|
3092
3167
|
},
|
|
3093
3168
|
{
|
|
3094
|
-
pending: (
|
|
3169
|
+
pending: (state, action2) => {
|
|
3095
3170
|
const dialogId = action2.meta.arg.dialogId;
|
|
3096
|
-
ensureMessageDialogState(
|
|
3171
|
+
ensureMessageDialogState(state, dialogId);
|
|
3097
3172
|
patchMessageSession(dialogId, {
|
|
3098
3173
|
isLoadingOlder: true,
|
|
3099
3174
|
error: null,
|
|
3100
3175
|
currentLoadOlderRequestId: action2.meta.requestId
|
|
3101
3176
|
});
|
|
3102
3177
|
},
|
|
3103
|
-
fulfilled: (
|
|
3178
|
+
fulfilled: (state, action2) => {
|
|
3104
3179
|
const dialogId = action2.meta.arg.dialogId;
|
|
3105
|
-
const dialogState = ensureMessageDialogState(
|
|
3180
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
3106
3181
|
const session = getMessageSession(dialogId);
|
|
3107
3182
|
if (session.currentLoadOlderRequestId !== action2.meta.requestId) {
|
|
3108
3183
|
return;
|
|
@@ -3117,9 +3192,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3117
3192
|
upsertManyMessages(dialogState, messages);
|
|
3118
3193
|
}
|
|
3119
3194
|
},
|
|
3120
|
-
rejected: (
|
|
3195
|
+
rejected: (state, action2) => {
|
|
3121
3196
|
const dialogId = action2.meta.arg.dialogId;
|
|
3122
|
-
ensureMessageDialogState(
|
|
3197
|
+
ensureMessageDialogState(state, dialogId);
|
|
3123
3198
|
const session = getMessageSession(dialogId);
|
|
3124
3199
|
if (session.currentLoadOlderRequestId !== action2.meta.requestId) {
|
|
3125
3200
|
return;
|
|
@@ -3202,10 +3277,10 @@ var messageSlice = createSliceWithThunks({
|
|
|
3202
3277
|
messages: selectAllMsgs(getState(), dialogId),
|
|
3203
3278
|
finalContent: finalVisibleContent
|
|
3204
3279
|
});
|
|
3205
|
-
const
|
|
3206
|
-
const dialogConfig = selectById(
|
|
3280
|
+
const state = getState();
|
|
3281
|
+
const dialogConfig = selectById(state, dialogKey);
|
|
3207
3282
|
const dialogConfigUserId = dialogConfig?.userId;
|
|
3208
|
-
const currentAccountUserId = selectIdentityUserId(
|
|
3283
|
+
const currentAccountUserId = selectIdentityUserId(state) ?? null;
|
|
3209
3284
|
const userId = resolveMessageOwner({
|
|
3210
3285
|
dialogConfigUserId: typeof dialogConfigUserId === "string" ? dialogConfigUserId : null,
|
|
3211
3286
|
dialogKey,
|
|
@@ -3309,9 +3384,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3309
3384
|
};
|
|
3310
3385
|
},
|
|
3311
3386
|
{
|
|
3312
|
-
fulfilled: (
|
|
3387
|
+
fulfilled: (state, action2) => {
|
|
3313
3388
|
const payload = action2.payload;
|
|
3314
|
-
const dialogState = ensureMessageDialogState(
|
|
3389
|
+
const dialogState = ensureMessageDialogState(state, payload.dialogId);
|
|
3315
3390
|
const existing = dialogState.msgs.entities[payload.id];
|
|
3316
3391
|
upsertOneMessage(dialogState, {
|
|
3317
3392
|
...existing ?? {},
|
|
@@ -3323,13 +3398,13 @@ var messageSlice = createSliceWithThunks({
|
|
|
3323
3398
|
});
|
|
3324
3399
|
setStreamingMessageId(payload.dialogId, null);
|
|
3325
3400
|
},
|
|
3326
|
-
rejected: (
|
|
3401
|
+
rejected: (state, action2) => {
|
|
3327
3402
|
const arg = action2.meta?.arg;
|
|
3328
3403
|
const messageId = arg?.messageId;
|
|
3329
3404
|
const dialogId = arg?.dialogId;
|
|
3330
3405
|
console.error("messageStreamEnd failed:", action2.error);
|
|
3331
3406
|
if (messageId && dialogId) {
|
|
3332
|
-
const dialogState = ensureMessageDialogState(
|
|
3407
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
3333
3408
|
updateOneMessage(dialogState, {
|
|
3334
3409
|
id: messageId,
|
|
3335
3410
|
changes: {
|
|
@@ -3349,9 +3424,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3349
3424
|
),
|
|
3350
3425
|
deleteMessage: create.asyncThunk(
|
|
3351
3426
|
async (dbKey, { dispatch, getState }) => {
|
|
3352
|
-
const
|
|
3353
|
-
const dialogId = findDialogIdByMessageDbKey(
|
|
3354
|
-
const dialogState = dialogId ?
|
|
3427
|
+
const state = getState();
|
|
3428
|
+
const dialogId = findDialogIdByMessageDbKey(state.message, dbKey);
|
|
3429
|
+
const dialogState = dialogId ? state.message.dialogStateById[dialogId] : void 0;
|
|
3355
3430
|
const entities = dialogState?.msgs.entities ?? {};
|
|
3356
3431
|
const msg = Object.values(entities).find((m) => m?.dbKey === dbKey);
|
|
3357
3432
|
const { id: msgId, extraRemoveId, extraRemoveDbKey } = planDeleteMessageCascade(msg, entities);
|
|
@@ -3362,9 +3437,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3362
3437
|
return { id: msgId, extraRemoveId, dialogId };
|
|
3363
3438
|
},
|
|
3364
3439
|
{
|
|
3365
|
-
fulfilled: (
|
|
3440
|
+
fulfilled: (state, action2) => {
|
|
3366
3441
|
const { id, extraRemoveId, dialogId } = action2.payload;
|
|
3367
|
-
const dialogState = ensureMessageDialogState(
|
|
3442
|
+
const dialogState = ensureMessageDialogState(state, dialogId);
|
|
3368
3443
|
if (id) {
|
|
3369
3444
|
removeOneMessage(dialogState, id);
|
|
3370
3445
|
}
|
|
@@ -3378,17 +3453,17 @@ var messageSlice = createSliceWithThunks({
|
|
|
3378
3453
|
async (args, thunkApi) => {
|
|
3379
3454
|
const { dispatch, getState, rejectWithValue } = thunkApi;
|
|
3380
3455
|
try {
|
|
3381
|
-
const
|
|
3382
|
-
const dialogKey = args.dialogKey ?? selectCurrentDialogKey(
|
|
3456
|
+
const state = getState();
|
|
3457
|
+
const dialogKey = args.dialogKey ?? selectCurrentDialogKey(state);
|
|
3383
3458
|
if (!dialogKey) {
|
|
3384
3459
|
throw new Error("editUserMessageAndReplay: dialogKey is required.");
|
|
3385
3460
|
}
|
|
3386
|
-
const dialogConfig = selectById(
|
|
3461
|
+
const dialogConfig = selectById(state, dialogKey);
|
|
3387
3462
|
if (!dialogConfig) {
|
|
3388
3463
|
throw new Error("editUserMessageAndReplay: dialog config is missing.");
|
|
3389
3464
|
}
|
|
3390
3465
|
const dialogId = dialogConfig.id ?? extractCustomId(dialogKey);
|
|
3391
|
-
const messages = selectAllMsgs(
|
|
3466
|
+
const messages = selectAllMsgs(state, dialogId);
|
|
3392
3467
|
const plan = planEditUserMessageAndReplay({
|
|
3393
3468
|
messages,
|
|
3394
3469
|
messageId: args.messageId,
|
|
@@ -3444,7 +3519,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
3444
3519
|
runtimeOptions: args.runtimeOptions
|
|
3445
3520
|
});
|
|
3446
3521
|
if (agentKeyToUse) {
|
|
3447
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
3522
|
+
const { streamAgentChatTurn } = await import("./agentSlice-HTIEYKIU.js");
|
|
3448
3523
|
await dispatch(
|
|
3449
3524
|
streamAgentChatTurn({
|
|
3450
3525
|
agentKey: agentKeyToUse,
|
|
@@ -3473,15 +3548,15 @@ messageActions = messageSlice.actions;
|
|
|
3473
3548
|
var dialogMessageSelectors = messagesAdapter.getSelectors(
|
|
3474
3549
|
(dialogState) => dialogState.msgs
|
|
3475
3550
|
);
|
|
3476
|
-
var selectMessageDialogState = (
|
|
3551
|
+
var selectMessageDialogState = (state, dialogId) => getMessageDialogState(state.message, dialogId);
|
|
3477
3552
|
var selectAllMsgs = createSelector(
|
|
3478
3553
|
[
|
|
3479
|
-
(
|
|
3554
|
+
(state, dialogId) => selectMessageDialogState(state, dialogId)
|
|
3480
3555
|
],
|
|
3481
3556
|
(dialogState) => dialogMessageSelectors.selectAll(dialogState)
|
|
3482
3557
|
);
|
|
3483
|
-
var selectMsgById = (
|
|
3484
|
-
getMessageDialogState(
|
|
3558
|
+
var selectMsgById = (state, messageId, dialogId) => dialogMessageSelectors.selectById(
|
|
3559
|
+
getMessageDialogState(state.message, dialogId),
|
|
3485
3560
|
messageId
|
|
3486
3561
|
);
|
|
3487
3562
|
var {
|
|
@@ -3505,63 +3580,6 @@ var {
|
|
|
3505
3580
|
} = messageSlice.actions;
|
|
3506
3581
|
var messageSlice_default = messageSlice.reducer;
|
|
3507
3582
|
|
|
3508
|
-
// packages/ai/workflow/workflowStore.ts
|
|
3509
|
-
var createInitialState = () => ({
|
|
3510
|
-
title: null,
|
|
3511
|
-
steps: [],
|
|
3512
|
-
stats: {
|
|
3513
|
-
startTime: null,
|
|
3514
|
-
totalStepsExecuted: 0,
|
|
3515
|
-
failedSteps: 0
|
|
3516
|
-
}
|
|
3517
|
-
});
|
|
3518
|
-
var listeners2 = /* @__PURE__ */ new Set();
|
|
3519
|
-
var version2 = 0;
|
|
3520
|
-
var state = createInitialState();
|
|
3521
|
-
var notify2 = () => {
|
|
3522
|
-
for (const listener of listeners2) {
|
|
3523
|
-
try {
|
|
3524
|
-
listener();
|
|
3525
|
-
} catch {
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
};
|
|
3529
|
-
var bump = () => {
|
|
3530
|
-
version2 += 1;
|
|
3531
|
-
notify2();
|
|
3532
|
-
};
|
|
3533
|
-
function setWorkflow(args) {
|
|
3534
|
-
state = {
|
|
3535
|
-
title: args.title,
|
|
3536
|
-
steps: args.steps,
|
|
3537
|
-
stats: {
|
|
3538
|
-
startTime: Date.now(),
|
|
3539
|
-
totalStepsExecuted: 0,
|
|
3540
|
-
failedSteps: 0
|
|
3541
|
-
}
|
|
3542
|
-
};
|
|
3543
|
-
bump();
|
|
3544
|
-
}
|
|
3545
|
-
function updateStep(args) {
|
|
3546
|
-
const step = state.steps.find((s) => s.id === args.id);
|
|
3547
|
-
if (step) {
|
|
3548
|
-
Object.assign(step, args.updates);
|
|
3549
|
-
bump();
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
function incrementStepsExecuted() {
|
|
3553
|
-
state.stats.totalStepsExecuted += 1;
|
|
3554
|
-
bump();
|
|
3555
|
-
}
|
|
3556
|
-
function incrementFailedSteps() {
|
|
3557
|
-
state.stats.failedSteps += 1;
|
|
3558
|
-
bump();
|
|
3559
|
-
}
|
|
3560
|
-
function clearWorkflow() {
|
|
3561
|
-
state = createInitialState();
|
|
3562
|
-
bump();
|
|
3563
|
-
}
|
|
3564
|
-
|
|
3565
3583
|
// packages/chat/dialog/actions/updateTokensAction.ts
|
|
3566
3584
|
var import_date_fns = __toESM(require_date_fns());
|
|
3567
3585
|
import { ulid } from "ulid";
|
|
@@ -3866,7 +3884,8 @@ var calculateApiReportedCost = (usage) => {
|
|
|
3866
3884
|
};
|
|
3867
3885
|
var resolveOpenAIBuiltInImageSurcharge = (model, usage) => {
|
|
3868
3886
|
const imageGenerationCount = asOptionalFiniteNumber(usage.image_generation_count) ?? 0;
|
|
3869
|
-
const pricePerImage = getApproxPricePerImage(model) ??
|
|
3887
|
+
const pricePerImage = getApproxPricePerImage(model) ?? // gpt-image-2 已收进 nolo 平台托管目录(provider=nolo)
|
|
3888
|
+
getApproxPricePerImage(findModelConfig("nolo", "gpt-image-2")) ?? 0;
|
|
3870
3889
|
if (imageGenerationCount <= 0 || pricePerImage <= 0) return 0;
|
|
3871
3890
|
return imageGenerationCount * pricePerImage;
|
|
3872
3891
|
};
|
|
@@ -3886,13 +3905,11 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
|
|
|
3886
3905
|
case "openai":
|
|
3887
3906
|
case "deepinfra":
|
|
3888
3907
|
return calculateCacheBasedCost(resolvedPrice, usage, externalPrice);
|
|
3889
|
-
// nolo/crof: honor inputCacheHit only when the model defines it (K3 has
|
|
3890
|
-
// inputCacheHit=2, K2.6 has 0.32 from its OpenRouter upstream). Models
|
|
3891
3908
|
// without it keep simple full-price billing so cached tokens are not
|
|
3892
3909
|
// priced at 0 — but a platform-hosted model用于 agentic 循环时必须补上
|
|
3893
3910
|
// 这一项,否则每轮重放的上下文会被按 input 原价重复计费。
|
|
3894
3911
|
case "nolo":
|
|
3895
|
-
case "
|
|
3912
|
+
case "upstream-k3":
|
|
3896
3913
|
return typeof resolvedPrice.inputCacheHit === "number" ? calculateCacheBasedCost(resolvedPrice, usage, externalPrice) : calculateSimpleCost(resolvedPrice, usage, externalPrice);
|
|
3897
3914
|
case "anthropic":
|
|
3898
3915
|
return calculateAnthropicCost(resolvedPrice, usage, externalPrice);
|
|
@@ -3965,6 +3982,25 @@ var calculatePrice = ({
|
|
|
3965
3982
|
try {
|
|
3966
3983
|
model = getModelConfig(provider, modelName);
|
|
3967
3984
|
} catch {
|
|
3985
|
+
if (isPlatformHostedImageModel(modelName)) {
|
|
3986
|
+
const hostedImageModel = getModelConfig("nolo", modelName);
|
|
3987
|
+
const costs3 = calculateBasicCost(
|
|
3988
|
+
hostedImageModel,
|
|
3989
|
+
usage,
|
|
3990
|
+
provider ?? "nolo",
|
|
3991
|
+
externalPrice,
|
|
3992
|
+
billingServiceTier,
|
|
3993
|
+
nowMs
|
|
3994
|
+
);
|
|
3995
|
+
const surcharge = isPlatformHostedOpenAIImageModel(modelName) ? resolveOpenAIBuiltInImageSurcharge(hostedImageModel, usage) : 0;
|
|
3996
|
+
const adjusted = surcharge > 0 ? {
|
|
3997
|
+
...costs3,
|
|
3998
|
+
regular: costs3.regular + surcharge,
|
|
3999
|
+
charge: costs3.charge + surcharge
|
|
4000
|
+
} : costs3;
|
|
4001
|
+
const pay3 = calculatePayDistribution(adjusted, externalPrice, sharingLevel);
|
|
4002
|
+
return { cost: sanitizeCost(adjusted.charge), pay: pay3 };
|
|
4003
|
+
}
|
|
3968
4004
|
if ((provider === "nolo" || provider === "deepseek") && isPlatformHostedDeepSeekV4Model(modelName)) {
|
|
3969
4005
|
const hostedModel = getModelConfig("nolo", modelName);
|
|
3970
4006
|
const costs3 = calculateBasicCost(
|
|
@@ -4127,6 +4163,9 @@ var resolveBillingTarget = ({
|
|
|
4127
4163
|
};
|
|
4128
4164
|
};
|
|
4129
4165
|
|
|
4166
|
+
// packages/ai/token/usageConstants.ts
|
|
4167
|
+
var LOCAL_USER_ID = "local";
|
|
4168
|
+
|
|
4130
4169
|
// packages/ai/token/prepareTokenUsageData.ts
|
|
4131
4170
|
function resolveTokenUsagePricing(args) {
|
|
4132
4171
|
const { rawUsage, agentConfig, nowMs } = args;
|
|
@@ -4165,7 +4204,7 @@ function resolveTokenUsagePricing(args) {
|
|
|
4165
4204
|
}
|
|
4166
4205
|
function resolveBillable(input) {
|
|
4167
4206
|
const uid = input.userId?.trim();
|
|
4168
|
-
if (!uid || uid ===
|
|
4207
|
+
if (!uid || uid === LOCAL_USER_ID) return false;
|
|
4169
4208
|
const apiSource = input.apiSource;
|
|
4170
4209
|
if (apiSource === "cli") return false;
|
|
4171
4210
|
if (isOAuthApiKeyRef(input.apiKeyRef)) return false;
|
|
@@ -4467,9 +4506,9 @@ var saveTokenUsage = async (data, thunkApi) => {
|
|
|
4467
4506
|
});
|
|
4468
4507
|
};
|
|
4469
4508
|
var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usageRecord, agentConfig }, thunkApi) => {
|
|
4470
|
-
const
|
|
4471
|
-
const { currentUser } =
|
|
4472
|
-
const dialogConfig = dialogKey ? selectById(
|
|
4509
|
+
const state = thunkApi.getState();
|
|
4510
|
+
const { currentUser } = state.auth;
|
|
4511
|
+
const dialogConfig = dialogKey ? selectById(state, dialogKey) : null;
|
|
4473
4512
|
const dialogConfigUserId = dialogConfig?.userId;
|
|
4474
4513
|
const ownerUserId = resolveMessageOwner({
|
|
4475
4514
|
dialogConfigUserId: typeof dialogConfigUserId === "string" ? dialogConfigUserId : null,
|
|
@@ -4511,7 +4550,7 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usage
|
|
|
4511
4550
|
timestamp
|
|
4512
4551
|
};
|
|
4513
4552
|
const stableTokenKey = callId ? createTokenKey.recordForStableCall(ownerUserId, callId) : null;
|
|
4514
|
-
const accountingAlreadyProjected = stableTokenKey ? Boolean(selectById(
|
|
4553
|
+
const accountingAlreadyProjected = stableTokenKey ? Boolean(selectById(state, stableTokenKey)) : false;
|
|
4515
4554
|
const billedCatalog = findModelConfig(recordProvider, billedModel)?.price;
|
|
4516
4555
|
const record = createTokenRecord(persistedTokenData, {
|
|
4517
4556
|
cost: result.cost,
|
|
@@ -4641,7 +4680,7 @@ var deleteOwnedDialogAttachments = async (args) => {
|
|
|
4641
4680
|
metadataReadFailures
|
|
4642
4681
|
});
|
|
4643
4682
|
if (!plan.deleteCandidates.length) return plan;
|
|
4644
|
-
const { deleteFileAction } = await import("./deleteFile-
|
|
4683
|
+
const { deleteFileAction } = await import("./deleteFile-NPZ64DFN.js");
|
|
4645
4684
|
for (const candidate of plan.deleteCandidates) {
|
|
4646
4685
|
if (candidate.fileDbKey) {
|
|
4647
4686
|
await deleteFileAction(candidate.fileDbKey, args.thunkApi);
|
|
@@ -4653,12 +4692,12 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
4653
4692
|
const { dialogKey, includeAttachments } = normalizeDeleteDialogPayload(payload);
|
|
4654
4693
|
const { dispatch, getState, extra } = thunkApi;
|
|
4655
4694
|
const { db } = extra;
|
|
4656
|
-
const
|
|
4657
|
-
const { currentServer, syncServers } = getRuntimeServerContext(
|
|
4695
|
+
const state = getState();
|
|
4696
|
+
const { currentServer, syncServers } = getRuntimeServerContext(state);
|
|
4658
4697
|
const currentDialogKey = getActiveDialogKey();
|
|
4659
4698
|
const currentDialogId = currentDialogKey ? extractCustomId(currentDialogKey) : null;
|
|
4660
4699
|
const targetDialogId = extractCustomId(dialogKey);
|
|
4661
|
-
const targetDialogConfig = selectById(
|
|
4700
|
+
const targetDialogConfig = selectById(state, dialogKey);
|
|
4662
4701
|
const isCurrentDialog = currentDialogId !== null && currentDialogId === targetDialogId;
|
|
4663
4702
|
await cleanupCliSessionForDialog(
|
|
4664
4703
|
{ dispatch, getState },
|
|
@@ -4698,53 +4737,52 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
4698
4737
|
syncServers,
|
|
4699
4738
|
dbKey: targetDialogId,
|
|
4700
4739
|
deleteOptions: { type: "messages" },
|
|
4701
|
-
state
|
|
4740
|
+
state
|
|
4702
4741
|
});
|
|
4703
4742
|
}
|
|
4704
4743
|
if (isCurrentDialog) {
|
|
4705
4744
|
await thunkApi.dispatch(resetMsgs());
|
|
4706
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
4745
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-6BINHWQT.js");
|
|
4707
4746
|
dispatch(clearPendingAttachments2());
|
|
4708
|
-
clearWorkflow();
|
|
4709
4747
|
}
|
|
4710
4748
|
return { dialogKey, isCurrentDialog, attachmentPlan };
|
|
4711
4749
|
};
|
|
4712
4750
|
|
|
4713
4751
|
// packages/chat/dialog/dialogSlice.ts
|
|
4714
4752
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
4715
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
4753
|
+
const { createDialogAction } = await import("./createDialogAction-FD5AEOUF.js");
|
|
4716
4754
|
return createDialogAction(args, thunkApi);
|
|
4717
4755
|
};
|
|
4718
4756
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
4719
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
4757
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TGUXUZCY.js");
|
|
4720
4758
|
return createAgentAutomationAction(args, thunkApi);
|
|
4721
4759
|
};
|
|
4722
4760
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
4723
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
4761
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-EDUCIB7G.js");
|
|
4724
4762
|
return updateDialogTitleAction(args, thunkApi);
|
|
4725
4763
|
};
|
|
4726
4764
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
4727
|
-
const { addDialogAgentAction } = await import("./addDialogAgentAction-
|
|
4765
|
+
const { addDialogAgentAction } = await import("./addDialogAgentAction-ILSDCMYL.js");
|
|
4728
4766
|
return addDialogAgentAction(args, thunkApi);
|
|
4729
4767
|
};
|
|
4730
4768
|
var runRemoveDialogAgentAction = async (args, thunkApi) => {
|
|
4731
|
-
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-
|
|
4769
|
+
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-KG5WMJRZ.js");
|
|
4732
4770
|
return removeDialogAgentAction(args, thunkApi);
|
|
4733
4771
|
};
|
|
4734
4772
|
var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
|
|
4735
|
-
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-
|
|
4773
|
+
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-FYYUY7PB.js");
|
|
4736
4774
|
return setPrimaryDialogAgentAction(args, thunkApi);
|
|
4737
4775
|
};
|
|
4738
4776
|
var runSwitchDialogAgentAction = async (args, thunkApi) => {
|
|
4739
|
-
const { switchDialogAgentAction } = await import("./switchDialogAgentAction-
|
|
4777
|
+
const { switchDialogAgentAction } = await import("./switchDialogAgentAction-GH5P6Q3Z.js");
|
|
4740
4778
|
return switchDialogAgentAction(args, thunkApi);
|
|
4741
4779
|
};
|
|
4742
4780
|
var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
4743
|
-
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-
|
|
4781
|
+
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-O2NLXMSM.js");
|
|
4744
4782
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
4745
4783
|
};
|
|
4746
4784
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
4747
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
4785
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-QVG5YNZY.js");
|
|
4748
4786
|
return handleSendMessageAction(args, thunkApi);
|
|
4749
4787
|
};
|
|
4750
4788
|
function clearDialogState() {
|
|
@@ -4757,7 +4795,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
4757
4795
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
4758
4796
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
4759
4797
|
try {
|
|
4760
|
-
const { createDocState } = await import("./docStore-
|
|
4798
|
+
const { createDocState } = await import("./docStore-SIUFLABN.js");
|
|
4761
4799
|
const pageKey = await createDocState(
|
|
4762
4800
|
{ slateData, title },
|
|
4763
4801
|
{ dispatch, getState }
|
|
@@ -4799,7 +4837,6 @@ var initDialog = createAsyncThunk(
|
|
|
4799
4837
|
async (id, { dispatch, signal, getState }) => {
|
|
4800
4838
|
setActiveDialogKey(id);
|
|
4801
4839
|
resetDialogRuntimeSessionState(id);
|
|
4802
|
-
clearWorkflow();
|
|
4803
4840
|
try {
|
|
4804
4841
|
const { currentServer: preferredServerOrigin } = getRuntimeServerContext(
|
|
4805
4842
|
getState()
|
|
@@ -4883,30 +4920,30 @@ var setDialogExtraReferences = createAsyncThunk(
|
|
|
4883
4920
|
"dialog/setDialogExtraReferences",
|
|
4884
4921
|
runSetDialogExtraReferencesAction
|
|
4885
4922
|
);
|
|
4886
|
-
function selectCurrentDialogConfig(
|
|
4923
|
+
function selectCurrentDialogConfig(state) {
|
|
4887
4924
|
const key = getActiveDialogKey();
|
|
4888
|
-
return key ? selectById(
|
|
4925
|
+
return key ? selectById(state, key) : null;
|
|
4889
4926
|
}
|
|
4890
4927
|
var selectCurrentDialogAgentIds = createSelector(
|
|
4891
|
-
(
|
|
4928
|
+
(state) => selectCurrentDialogConfig(state),
|
|
4892
4929
|
(dialogConfig) => getDialogAgentIds(dialogConfig)
|
|
4893
4930
|
);
|
|
4894
4931
|
var selectCurrentPrimaryAgentId = createSelector(
|
|
4895
|
-
(
|
|
4932
|
+
(state) => selectCurrentDialogConfig(state),
|
|
4896
4933
|
(dialogConfig) => getPrimaryDialogAgentId(dialogConfig)
|
|
4897
4934
|
);
|
|
4898
4935
|
var selectDialogConfigByKey = createSelector(
|
|
4899
|
-
(
|
|
4936
|
+
(state) => state,
|
|
4900
4937
|
(_, dialogKey) => dialogKey,
|
|
4901
|
-
(
|
|
4938
|
+
(state, dialogKey) => dialogKey ? selectById(state, dialogKey) : null
|
|
4902
4939
|
);
|
|
4903
4940
|
var selectCurrentDialogTokens = createSelector(
|
|
4904
|
-
(
|
|
4941
|
+
(state) => state,
|
|
4905
4942
|
selectCurrentDialogConfig,
|
|
4906
4943
|
(_state, dialogKey) => dialogKey,
|
|
4907
|
-
(
|
|
4944
|
+
(state, currentDialog, dialogKey) => {
|
|
4908
4945
|
if (dialogKey) {
|
|
4909
|
-
const dialogConfig = selectById(
|
|
4946
|
+
const dialogConfig = selectById(state, dialogKey);
|
|
4910
4947
|
return mergeDialogTokenStats(
|
|
4911
4948
|
dialogConfig,
|
|
4912
4949
|
getDialogRuntimeTokens(dialogKey)
|
|
@@ -4927,6 +4964,9 @@ export {
|
|
|
4927
4964
|
parseUiAskChoiceContent,
|
|
4928
4965
|
PERSONALIZATION_DIALOG_CATEGORY,
|
|
4929
4966
|
buildPersonalizationDialogPolicyContext,
|
|
4967
|
+
resolveBuiltinPlatformAgentConfig,
|
|
4968
|
+
resolveBuiltinPlatformAgentRecord,
|
|
4969
|
+
applyBuiltinAgentRuntimeOverride,
|
|
4930
4970
|
resolveDialogRuntimeAgentKey,
|
|
4931
4971
|
resolveHandleSendMessageContext,
|
|
4932
4972
|
estimateMissingUsage,
|
|
@@ -4935,7 +4975,6 @@ export {
|
|
|
4935
4975
|
selectMsgById,
|
|
4936
4976
|
addUserMessage,
|
|
4937
4977
|
messageStreaming,
|
|
4938
|
-
resetMsgs,
|
|
4939
4978
|
removeTransientMessage,
|
|
4940
4979
|
finalizeTransientMessageOnError,
|
|
4941
4980
|
prepareAndPersistMessage,
|
|
@@ -4943,11 +4982,6 @@ export {
|
|
|
4943
4982
|
messageStreamEnd,
|
|
4944
4983
|
addToolMessage,
|
|
4945
4984
|
updateToolMessage,
|
|
4946
|
-
setWorkflow,
|
|
4947
|
-
updateStep,
|
|
4948
|
-
incrementStepsExecuted,
|
|
4949
|
-
incrementFailedSteps,
|
|
4950
|
-
clearWorkflow,
|
|
4951
4985
|
toast,
|
|
4952
4986
|
API_REPORTED_COST_MULTIPLIER,
|
|
4953
4987
|
normalizeUsage,
|