nolo-cli 0.19.0 → 0.24.0-alpha.13
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/README.md +9 -18
- package/{_executeModel-X5PCIZN6.js → _executeModel-ZPNYAEFW.js} +46 -44
- package/{action-LT7BRFLK.js → action-5MNAXR5B.js} +7 -6
- package/{addContentAction-PL3KKBDH.js → addContentAction-UNSYTVTB.js} +5 -5
- package/{addDialogAgentAction-FCMSKYAF.js → addDialogAgentAction-LJGNP2AO.js} +5 -5
- package/{agentDeleteCommand-2BZDQV36.js → agentDeleteCommand-5ZV4433K.js} +27 -26
- package/{agentEmailCommands-2QJDGRMB.js → agentEmailCommands-Z7KOYDVQ.js} +57 -55
- package/{agentListCommands-6VEPTKBI.js → agentListCommands-UQUXJYUN.js} +30 -26
- package/{agentMachineCommands-NVVHNWYI.js → agentMachineCommands-53O6P6L5.js} +25 -24
- package/{agentRecordCommands-4GGRDMD4.js → agentRecordCommands-ZRYNBSSS.js} +52 -50
- package/{agentRunCommand-XOLQNKBZ.js → agentRunCommand-B73MKVOG.js} +55 -54
- package/{agentRunControl-Y5AFH5PQ.js → agentRunControl-SNUKXN6J.js} +6 -2
- package/{agentRuntimeLocal-7WYWCGL4.js → agentRuntimeLocal-GVNERRKQ.js} +21 -18
- package/{agentSlice-EAXPGEYV.js → agentSlice-OJBHIL34.js} +5 -5
- package/{appDeleteCommands-77KR2RJ4.js → appDeleteCommands-23Z3Z6KE.js} +23 -22
- package/{appDeployCommands-K7CAHGBI.js → appDeployCommands-3MFAR4Z7.js} +23 -22
- package/{appDeployStatusCommands-4OEKLTBT.js → appDeployStatusCommands-JHU6GSN4.js} +23 -22
- package/{appGetCommands-VM2WDLAZ.js → appGetCommands-24J55H2Y.js} +23 -22
- package/{appListCommands-GX6BBA6U.js → appListCommands-HE5KP3PH.js} +23 -22
- package/{authCommand-DY6UUL6O.js → authCommand-KGRK6MNU.js} +12 -13
- package/{authCommands-XTBV7OFZ.js → authCommands-JSOG2H4E.js} +4 -5
- package/{chunk-OWOHNGCN.js → chunk-2MBTWINN.js} +42 -3
- package/{chunk-MVQ4TBSD.js → chunk-54VHTARN.js} +1 -1
- package/{chunk-RQN4SEKL.js → chunk-5DWZ46RJ.js} +1 -1
- package/{chunk-VYHDJEQD.js → chunk-5EDKWSQN.js} +136 -78
- package/{chunk-Z4NR32XR.js → chunk-5RGU3J7P.js} +13 -0
- package/{chunk-7BUYEZ6U.js → chunk-7H3UTGPM.js} +12 -72
- package/{chunk-3ZX7PERL.js → chunk-AAWJ5S3G.js} +20 -7
- package/{chunk-SCTYAHYK.js → chunk-ADE6577S.js} +237 -142
- package/{chunk-PJSV3IZ5.js → chunk-AOPOTHFK.js} +1 -1
- package/{chunk-3ND52WIL.js → chunk-ATWUOTJP.js} +180 -24
- package/{chunk-SWDPIPOY.js → chunk-AZW5AHMW.js} +1 -1
- package/chunk-CF7S2RYZ.js +376 -0
- package/{chunk-L4F3I4SR.js → chunk-CV6BM7LU.js} +4 -6
- package/{chunk-G5U6LDLG.js → chunk-CWTT2NZ6.js} +6 -6
- package/{chunk-MKA6QE5E.js → chunk-CZHE6LLV.js} +135 -55
- package/{chunk-KFEVY3ST.js → chunk-D34RI6NI.js} +18 -8
- package/{chunk-XRZJGPFI.js → chunk-FON47ACC.js} +4 -4
- package/{chunk-K6EUAOW3.js → chunk-FXFGNOT2.js} +67 -1
- package/{chunk-LLWKHDG4.js → chunk-G36SUBHA.js} +14 -6
- package/{chunk-REA4JLBH.js → chunk-GD23ZX7Z.js} +7 -6
- package/{chunk-ROWQEJRP.js → chunk-GE6IWA5N.js} +12 -4
- package/{chunk-EDV7EBOI.js → chunk-GGB6MPHD.js} +2155 -1503
- package/{chunk-IYEXFJPC.js → chunk-GNGOZMU2.js} +64 -57
- package/{chunk-4T5F7YZQ.js → chunk-I6RJGORZ.js} +1 -1
- package/{chunk-DFCFMCY6.js → chunk-J2WT5CEO.js} +2 -2
- package/{chunk-AHCY2S2I.js → chunk-JJ2WUBFN.js} +1 -1
- package/{chunk-UGUW3FHG.js → chunk-JMSCXQUG.js} +2 -2
- package/{chunk-VDXCXCXH.js → chunk-KURQBS7S.js} +1 -1
- package/{chunk-FQZZLA3C.js → chunk-KXKQO4Q6.js} +17 -0
- package/{chunk-3Q7WHGCB.js → chunk-L65QKSVJ.js} +1 -1
- package/{chunk-UAIVG4J6.js → chunk-LEHTC2FI.js} +1 -8
- package/{chunk-UBHAWFQ6.js → chunk-LLDGWLML.js} +42 -19
- package/{chunk-JLA4FXYC.js → chunk-MALVZUYL.js} +1 -1
- package/{chunk-N54HIJVJ.js → chunk-MCXQNEJ3.js} +101 -9
- package/{chunk-GFUIQ4RY.js → chunk-MXFQHRSS.js} +1 -1
- package/{chunk-LSFAWXKC.js → chunk-N7J63Q6C.js} +1 -0
- package/{chunk-6Y7A3OQQ.js → chunk-NRY4GCKJ.js} +2 -0
- package/{chunk-ELT65PZW.js → chunk-OXLLFZNF.js} +1 -1
- package/{chunk-YGW4G5W5.js → chunk-P3RZ6DHN.js} +133 -25
- package/{chunk-5MIDPSSK.js → chunk-PB7G5MAM.js} +3 -3
- package/{chunk-HEGV7BH3.js → chunk-PMCKFQYC.js} +1 -1
- package/{chunk-23FZYPLC.js → chunk-PTKI7TIN.js} +911 -1064
- package/{chunk-MHSGJW4Z.js → chunk-PXPISYEH.js} +44 -14
- package/{chunk-I2ZJKTG5.js → chunk-PY7VGC5M.js} +29 -10
- package/{chunk-PIZYJVHQ.js → chunk-RM464B7I.js} +4 -4
- package/{chunk-XHG22OEX.js → chunk-ROJI6DRT.js} +2 -2
- package/{chunk-VNAEBGDK.js → chunk-RZNYL4LW.js} +123 -26
- package/{chunk-RVOUXDFU.js → chunk-S6KVFOUG.js} +6 -34
- package/{chunk-BV4VEE3W.js → chunk-S7AV3NCK.js} +277 -357
- package/{chunk-R35XMF6F.js → chunk-SIUEKVK4.js} +484 -67
- package/{chunk-B5TOXZAK.js → chunk-SIZQB7BD.js} +1 -1
- package/{chunk-DFFIZ25G.js → chunk-SLOGKB7M.js} +4 -1
- package/{chunk-MPVYDS7I.js → chunk-TLYHUIWF.js} +3 -3
- package/{chunk-HWW2M4SN.js → chunk-TNM27YZ7.js} +5 -4
- package/{chunk-OK6YSWLH.js → chunk-TWA4L7J7.js} +1 -1
- package/chunk-UZ6XXCVR.js +50 -0
- package/{chunk-DKZFOK24.js → chunk-WCP5FDTF.js} +16 -304
- package/{chunk-TRT4I4UD.js → chunk-WSQLK2KR.js} +2 -2
- package/{chunk-FXUSIQC2.js → chunk-XNZJVYFS.js} +1 -1
- package/{chunk-V3ED5AWK.js → chunk-YJY7HODU.js} +27 -16
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-CZ6NYQTV.js → chunk-ZFL3LTU7.js} +2 -2
- package/{chunk-34WPV75U.js → chunk-ZUXIXYJI.js} +1 -1
- package/{chunk-VC6OZXO5.js → chunk-ZWJOGMKH.js} +2 -26
- package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
- package/{codingSkills-36KN5NQT.js → codingSkills-EN6Z6G6U.js} +4 -4
- package/{createAgentAutomationAction-GNFF524X.js → createAgentAutomationAction-PO62NUR7.js} +19 -18
- package/{createDialogAction-RB55KCLO.js → createDialogAction-ORFRYI3C.js} +22 -20
- package/{createPageAction-Y7343GLU.js → createPageAction-XWVMNTYH.js} +20 -19
- package/{db-W3O47YGF.js → db-W5UHK4P3.js} +150 -0
- package/{dbSlice-CGSRFJN3.js → dbSlice-5BKDURDL.js} +4 -4
- package/{dialogCommands-IAZK6YHQ.js → dialogCommands-XTJHROXM.js} +24 -23
- package/{dialogSlice-UQAXF23P.js → dialogSlice-DJXC53YW.js} +24 -18
- package/{docCreateCommands-I2EWZGCI.js → docCreateCommands-T2XRVXYS.js} +24 -27
- package/{docDeleteCommands-IZ45UZKG.js → docDeleteCommands-L7RXFXY3.js} +25 -24
- package/{docReadCommands-R6Z4QJYU.js → docReadCommands-M5PYNADQ.js} +24 -23
- package/{docStore-5HOJ4D7D.js → docStore-6LKLLFDW.js} +20 -19
- package/{docUpdateCommands-2LRBKQPY.js → docUpdateCommands-OA5EGPLQ.js} +24 -27
- package/{fetchMessages-BMGVZVSE.js → fetchMessages-W4IKHPCS.js} +2 -3
- package/{getPricing-G7DLAST6.js → getPricing-6C3C47Y4.js} +3 -3
- package/{handleSendMessageAction-Q4HY35WX.js → handleSendMessageAction-ILFGZTN5.js} +23 -20
- package/index.js +74 -74
- package/{localDialogRead-4H3QJFLW.js → localDialogRead-JXTAHW2E.js} +2 -2
- package/{machineCommands-PKBPQKTY.js → machineCommands-AKAQGPAO.js} +59 -57
- package/{machineWsRunDispatch-UZAW4OXJ.js → machineWsRunDispatch-RSBERM64.js} +51 -49
- package/{models-DJFSJ7SW.js → models-ILWKIX2Y.js} +2 -2
- package/package.json +1 -1
- package/{read-3FMPZPER.js → read-F3L3T2WJ.js} +2 -1
- package/{readDocTool-VSYHKK3V.js → readDocTool-FOHWVA4R.js} +1 -1
- package/{readlineWorkspace-Y2RDOFZG.js → readlineWorkspace-TUH3SFHO.js} +937 -430
- package/{removeDialogAgentAction-OAGA2G3U.js → removeDialogAgentAction-QCFGIUIH.js} +8 -7
- package/{runAgentClientLoop-NBPIKJ6J.js → runAgentClientLoop-C3QB2EXV.js} +45 -38
- package/{setDialogExtraReferencesAction-JZEXA5SL.js → setDialogExtraReferencesAction-DK4CKERU.js} +5 -5
- package/{setPrimaryDialogAgentAction-4ZUQQKDG.js → setPrimaryDialogAgentAction-SJSO6N27.js} +8 -7
- package/{settingSlice-7MNKHZ6R.js → settingSlice-XNM5AFPU.js} +6 -5
- package/{spaceCommands-DHCZ7J5I.js → spaceCommands-SXYOFGUJ.js} +25 -24
- package/{spaceSlice-ZXLLG3CR.js → spaceSlice-6BHMRP5O.js} +21 -18
- package/{streamAgentChatTurn-L3YW6LSB.js → streamAgentChatTurn-GF5W5OIP.js} +140 -98
- package/switchDialogAgentAction-4OAC6QRN.js +61 -0
- package/{tableCommands-BEQAGE4I.js → tableCommands-QSZILI7I.js} +1 -1
- package/{toolApiClient-QI3YBNWB.js → toolApiClient-ISM4ZQX4.js} +2 -2
- package/{tools-ECGXR5QF.js → tools-KBCLJ43G.js} +36 -33
- package/{tuiSummaryLlmCaller-OMSCNHXA.js → tuiSummaryLlmCaller-ARIMGILF.js} +6 -6
- package/{updateCommands-XTW55TOT.js → updateCommands-AK2RDOFR.js} +8 -2
- package/{updateDialogTitleAction-HQ2EUDFT.js → updateDialogTitleAction-LMHZUY4Q.js} +28 -27
- package/chunk-DL6EPNIK.js +0 -50
- package/chunk-V5R4NZP2.js +0 -78
- package/chunk-X4Q4UZEY.js +0 -26
- package/queryRunOverlay-O4LOMMPO.js +0 -161
- package/runOverlayPresentation-ZO4VCWEU.js +0 -11
- package/types-ZSTJ7MPR.js +0 -7
- package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
- package/{runtimeDoctorCommands-E2OUORHK.js → runtimeDoctorCommands-HSU632DY.js} +3 -3
|
@@ -2,33 +2,37 @@ import {
|
|
|
2
2
|
BUILTIN_SUMMARY_LLM_CONFIG,
|
|
3
3
|
buildBuiltinSummaryContent
|
|
4
4
|
} from "./chunk-XOIF2TNF.js";
|
|
5
|
-
import {
|
|
6
|
-
buildDialogAttachmentPlan,
|
|
7
|
-
extractFileContentIds
|
|
8
|
-
} from "./chunk-B5TOXZAK.js";
|
|
9
5
|
import {
|
|
10
6
|
authRoutes
|
|
11
7
|
} from "./chunk-MRC4Q34M.js";
|
|
8
|
+
import {
|
|
9
|
+
buildDialogAttachmentPlan,
|
|
10
|
+
extractFileContentIds
|
|
11
|
+
} from "./chunk-SIZQB7BD.js";
|
|
12
12
|
import {
|
|
13
13
|
deleteServerSyncedCredential,
|
|
14
14
|
runLlm
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GD23ZX7Z.js";
|
|
16
|
+
import {
|
|
17
|
+
isOAuthApiKeyRef
|
|
18
|
+
} from "./chunk-YYLHWIW6.js";
|
|
16
19
|
import {
|
|
17
20
|
getApproxPricePerImage
|
|
18
21
|
} from "./chunk-CWMSB67P.js";
|
|
19
22
|
import {
|
|
20
23
|
cleanupCliSessionForDialog
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ROJI6DRT.js";
|
|
22
25
|
import {
|
|
26
|
+
getActiveDialogAgentId,
|
|
23
27
|
getDialogAgentIds,
|
|
24
28
|
getPrimaryDialogAgentId
|
|
25
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5RGU3J7P.js";
|
|
26
30
|
import {
|
|
27
31
|
require_date_fns
|
|
28
32
|
} from "./chunk-M76ECQRD.js";
|
|
29
33
|
import {
|
|
30
34
|
fetchMessages
|
|
31
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-L65QKSVJ.js";
|
|
32
36
|
import {
|
|
33
37
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
34
38
|
DEFAULT_CONTEXT_WINDOW,
|
|
@@ -38,29 +42,14 @@ import {
|
|
|
38
42
|
planCompression,
|
|
39
43
|
resolveAutoExecutionProfile,
|
|
40
44
|
serializeMessageContent
|
|
41
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-PY7VGC5M.js";
|
|
42
46
|
import {
|
|
43
47
|
createFileCredentialBroker
|
|
44
48
|
} from "./chunk-5CS33IBL.js";
|
|
45
49
|
import {
|
|
46
50
|
findModelConfig,
|
|
47
51
|
getModelConfig
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import {
|
|
50
|
-
toErrorMessage
|
|
51
|
-
} from "./chunk-HNMXYYJR.js";
|
|
52
|
-
import {
|
|
53
|
-
UNCATEGORIZED_ID,
|
|
54
|
-
addContentAction,
|
|
55
|
-
checkSpaceMembership,
|
|
56
|
-
createSpaceKey,
|
|
57
|
-
localSpaceAuthorityPatchStamp,
|
|
58
|
-
normalizeSpaceId
|
|
59
|
-
} from "./chunk-ELT65PZW.js";
|
|
60
|
-
import {
|
|
61
|
-
extractCustomId,
|
|
62
|
-
extractUserId
|
|
63
|
-
} from "./chunk-DFFIZ25G.js";
|
|
52
|
+
} from "./chunk-LEHTC2FI.js";
|
|
64
53
|
import {
|
|
65
54
|
abortActiveControllers,
|
|
66
55
|
addPageReferenceToRuntime,
|
|
@@ -78,16 +67,31 @@ import {
|
|
|
78
67
|
setActiveDialogKey,
|
|
79
68
|
setDialogConfigError
|
|
80
69
|
} from "./chunk-3ASDTTEI.js";
|
|
70
|
+
import {
|
|
71
|
+
toErrorMessage
|
|
72
|
+
} from "./chunk-HNMXYYJR.js";
|
|
73
|
+
import {
|
|
74
|
+
getPlatformHostedDeepSeekV4Price,
|
|
75
|
+
isPlatformHostedDeepSeekV4Model
|
|
76
|
+
} from "./chunk-CZHE6LLV.js";
|
|
81
77
|
import {
|
|
82
78
|
isSystemAdmin,
|
|
83
79
|
nolotusId,
|
|
84
80
|
selectRemoteServer,
|
|
85
81
|
selectRemoteServers,
|
|
86
82
|
selectRemoteSyncServers
|
|
87
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-S6KVFOUG.js";
|
|
88
84
|
import {
|
|
89
85
|
asRecordOrEmpty
|
|
90
86
|
} from "./chunk-KX6YBIHG.js";
|
|
87
|
+
import {
|
|
88
|
+
UNCATEGORIZED_ID,
|
|
89
|
+
addContentAction,
|
|
90
|
+
checkSpaceMembership,
|
|
91
|
+
createSpaceKey,
|
|
92
|
+
localSpaceAuthorityPatchStamp,
|
|
93
|
+
normalizeSpaceId
|
|
94
|
+
} from "./chunk-OXLLFZNF.js";
|
|
91
95
|
import {
|
|
92
96
|
patch,
|
|
93
97
|
read,
|
|
@@ -100,7 +104,7 @@ import {
|
|
|
100
104
|
uploadFileAction,
|
|
101
105
|
upsertSSREntity,
|
|
102
106
|
write
|
|
103
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-FON47ACC.js";
|
|
104
108
|
import {
|
|
105
109
|
DB_PREFIX,
|
|
106
110
|
SEPARATOR,
|
|
@@ -125,7 +129,7 @@ import {
|
|
|
125
129
|
splitKey,
|
|
126
130
|
toTrimmedString,
|
|
127
131
|
ulid
|
|
128
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-NRY4GCKJ.js";
|
|
129
133
|
import {
|
|
130
134
|
asOptionalFiniteNumber
|
|
131
135
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -137,8 +141,9 @@ import {
|
|
|
137
141
|
asTrimmedLowercaseString
|
|
138
142
|
} from "./chunk-QSJ3HFEF.js";
|
|
139
143
|
import {
|
|
144
|
+
builtinRuntimeFallbackEntries,
|
|
140
145
|
readAction
|
|
141
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-ATWUOTJP.js";
|
|
142
147
|
import {
|
|
143
148
|
DEVICE_LOCAL_OWNER_ID,
|
|
144
149
|
asyncThunkCreator,
|
|
@@ -179,6 +184,11 @@ import {
|
|
|
179
184
|
import {
|
|
180
185
|
asOptionalPositiveFiniteNumber
|
|
181
186
|
} from "./chunk-U6VC4MU4.js";
|
|
187
|
+
import {
|
|
188
|
+
extractCustomId,
|
|
189
|
+
extractUserId,
|
|
190
|
+
publicAgentKey
|
|
191
|
+
} from "./chunk-SLOGKB7M.js";
|
|
182
192
|
import {
|
|
183
193
|
isRecord
|
|
184
194
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -3820,12 +3830,54 @@ var buildPersonalizationDialogPolicyContext = () => [
|
|
|
3820
3830
|
"\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"
|
|
3821
3831
|
].join("\n");
|
|
3822
3832
|
|
|
3833
|
+
// packages/agent-runtime/builtinPlatformAgentConfigs.ts
|
|
3834
|
+
function buildConfig(e) {
|
|
3835
|
+
const key = publicAgentKey(e.id);
|
|
3836
|
+
const rawRecord = {
|
|
3837
|
+
dbKey: key,
|
|
3838
|
+
isPublic: true,
|
|
3839
|
+
provider: e.provider,
|
|
3840
|
+
model: e.model,
|
|
3841
|
+
apiSource: e.apiSource ?? "platform",
|
|
3842
|
+
useServerProxy: e.useServerProxy ?? true
|
|
3843
|
+
};
|
|
3844
|
+
if (e.hasImageOutput) rawRecord.hasImageOutput = true;
|
|
3845
|
+
if (e.imageModel) rawRecord.imageModel = e.imageModel;
|
|
3846
|
+
if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
|
|
3847
|
+
if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
|
|
3848
|
+
return {
|
|
3849
|
+
key,
|
|
3850
|
+
name: e.name,
|
|
3851
|
+
provider: e.provider,
|
|
3852
|
+
model: e.model,
|
|
3853
|
+
apiSource: e.apiSource ?? "platform",
|
|
3854
|
+
useServerProxy: e.useServerProxy ?? true,
|
|
3855
|
+
rawRecord
|
|
3856
|
+
};
|
|
3857
|
+
}
|
|
3858
|
+
var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
|
|
3859
|
+
builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
|
|
3860
|
+
);
|
|
3861
|
+
function resolveBuiltinPlatformAgentConfig(agentRef) {
|
|
3862
|
+
return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
|
|
3863
|
+
}
|
|
3864
|
+
function resolveBuiltinPlatformAgentRecord(agentRef) {
|
|
3865
|
+
const config = resolveBuiltinPlatformAgentConfig(agentRef);
|
|
3866
|
+
if (!config) return null;
|
|
3867
|
+
return {
|
|
3868
|
+
...config.rawRecord,
|
|
3869
|
+
dbKey: agentRef,
|
|
3870
|
+
...config.name ? { name: config.name } : {}
|
|
3871
|
+
};
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3823
3874
|
// packages/chat/dialog/dialogAgentPolicy.ts
|
|
3824
3875
|
var resolveDialogAgentMode = (dialog) => {
|
|
3825
3876
|
if (dialog?.agentMode === "auto") return "auto";
|
|
3826
3877
|
if (dialog?.agentMode === "fixed") return "fixed";
|
|
3827
|
-
return
|
|
3878
|
+
return getActiveDialogAgentId(dialog) ? "fixed" : "auto";
|
|
3828
3879
|
};
|
|
3880
|
+
var isAutoDialog = (dialog) => resolveDialogAgentMode(dialog) === "auto";
|
|
3829
3881
|
var resolveDialogAutoTier = (dialog) => {
|
|
3830
3882
|
const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
|
|
3831
3883
|
return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
|
|
@@ -3834,19 +3886,25 @@ var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
|
|
|
3834
3886
|
const explicit = asOptionalTrimmedString(explicitAgentKey);
|
|
3835
3887
|
if (explicit) return explicit;
|
|
3836
3888
|
if (resolveDialogAgentMode(dialog) === "fixed") {
|
|
3837
|
-
const fixed =
|
|
3889
|
+
const fixed = getActiveDialogAgentId(dialog);
|
|
3838
3890
|
if (fixed) return fixed;
|
|
3839
3891
|
}
|
|
3840
3892
|
return resolveAutoExecutionProfile(
|
|
3841
3893
|
resolveDialogAutoTier(dialog) ?? DEFAULT_AUTO_EXECUTION_PROFILE.tier
|
|
3842
3894
|
).legacyAgentKey;
|
|
3843
3895
|
};
|
|
3896
|
+
var resolveDialogRuntimeAgentConfig = (dialog, explicitAgentKey) => {
|
|
3897
|
+
if (!isAutoDialog(dialog)) return null;
|
|
3898
|
+
const key = resolveDialogRuntimeAgentKey(dialog, explicitAgentKey);
|
|
3899
|
+
return resolveBuiltinPlatformAgentRecord(key) ?? null;
|
|
3900
|
+
};
|
|
3844
3901
|
|
|
3845
3902
|
// packages/chat/dialog/actions/handleSendMessageResolver.ts
|
|
3846
3903
|
function resolveHandleSendMessageContext(input) {
|
|
3847
3904
|
const { dialogConfig, targetAgentKey, runtimeOptions } = input;
|
|
3848
3905
|
return {
|
|
3849
3906
|
agentKeyToUse: resolveDialogRuntimeAgentKey(dialogConfig, targetAgentKey),
|
|
3907
|
+
agentConfigToUse: resolveDialogRuntimeAgentConfig(dialogConfig, targetAgentKey) ?? void 0,
|
|
3850
3908
|
effectiveRuntimeOptions: dialogConfig.category === PERSONALIZATION_DIALOG_CATEGORY ? buildPersonalizationRuntimeOptions(runtimeOptions ?? {}) : runtimeOptions
|
|
3851
3909
|
};
|
|
3852
3910
|
}
|
|
@@ -4668,7 +4726,8 @@ var createEmptyMessageSessionState = () => ({
|
|
|
4668
4726
|
lastStreamTimestamp: 0,
|
|
4669
4727
|
currentInitMsgsRequestId: void 0,
|
|
4670
4728
|
currentLoadOlderRequestId: void 0,
|
|
4671
|
-
streamingMessageId: null
|
|
4729
|
+
streamingMessageId: null,
|
|
4730
|
+
lastAbortTimestamp: 0
|
|
4672
4731
|
});
|
|
4673
4732
|
var activeDialogId = null;
|
|
4674
4733
|
var sessionByDialogId = {
|
|
@@ -4737,6 +4796,12 @@ function markMessageStreamActivity(dialogId) {
|
|
|
4737
4796
|
notify();
|
|
4738
4797
|
return action("messageSession/streamActivity", { dialogId });
|
|
4739
4798
|
}
|
|
4799
|
+
function markMessageSessionAbort(dialogId) {
|
|
4800
|
+
const session = ensureMessageSession(dialogId);
|
|
4801
|
+
session.lastAbortTimestamp = Date.now();
|
|
4802
|
+
notify();
|
|
4803
|
+
return action("messageSession/abort", { dialogId });
|
|
4804
|
+
}
|
|
4740
4805
|
function setStreamingMessageId(dialogId, messageId) {
|
|
4741
4806
|
const session = ensureMessageSession(dialogId);
|
|
4742
4807
|
if (session.streamingMessageId === messageId) return;
|
|
@@ -4913,6 +4978,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
4913
4978
|
updateManyMessages(dialogState, updates);
|
|
4914
4979
|
}
|
|
4915
4980
|
setStreamingMessageId(dialogId, null);
|
|
4981
|
+
markMessageSessionAbort(dialogId);
|
|
4916
4982
|
});
|
|
4917
4983
|
}),
|
|
4918
4984
|
removeTransientMessage: create.reducer(
|
|
@@ -4980,33 +5046,6 @@ var messageSlice = createSliceWithThunks({
|
|
|
4980
5046
|
});
|
|
4981
5047
|
}
|
|
4982
5048
|
}),
|
|
4983
|
-
/**
|
|
4984
|
-
* Append a run-overlay presentation as a non-streaming assistant message.
|
|
4985
|
-
*
|
|
4986
|
-
* This is a pure UI presentation action — it does NOT trigger a new agent
|
|
4987
|
-
* turn, does NOT call the LLM, and is therefore not billed. The message
|
|
4988
|
-
* is upserted into the dialog's message list so the user sees the run
|
|
4989
|
-
* status snapshot at turn-end. A fresh message id/dbKey are minted from
|
|
4990
|
-
* the dialog id so repeated overlays across turns don't collide.
|
|
4991
|
-
*
|
|
4992
|
-
* The message is marked role:"assistant" with isStreaming:false. Callers
|
|
4993
|
-
* that want to keep it out of the LLM context can post-filter by the
|
|
4994
|
-
* `metadata.overlayMessage` flag set here.
|
|
4995
|
-
*/
|
|
4996
|
-
appendOverlayMessage: create.reducer((state3, action2) => {
|
|
4997
|
-
const dialogId = extractCustomId(action2.payload.dialogKey);
|
|
4998
|
-
if (!dialogId) return;
|
|
4999
|
-
const dialogState = ensureMessageDialogState(state3, dialogId);
|
|
5000
|
-
const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
|
|
5001
|
-
upsertOneMessage(dialogState, {
|
|
5002
|
-
id: messageId,
|
|
5003
|
-
dbKey: msgKey,
|
|
5004
|
-
role: "assistant",
|
|
5005
|
-
content: action2.payload.text,
|
|
5006
|
-
isStreaming: false,
|
|
5007
|
-
metadata: { overlayMessage: true }
|
|
5008
|
-
});
|
|
5009
|
-
}),
|
|
5010
5049
|
prepareAndPersistMessage: create.asyncThunk(
|
|
5011
5050
|
async (args, thunkApi) => {
|
|
5012
5051
|
const { message, dialogConfig } = args;
|
|
@@ -5282,6 +5321,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
5282
5321
|
const {
|
|
5283
5322
|
finalContentBuffer,
|
|
5284
5323
|
totalUsage,
|
|
5324
|
+
billingUsageRecords,
|
|
5285
5325
|
msgKey,
|
|
5286
5326
|
agentConfig,
|
|
5287
5327
|
dialogId,
|
|
@@ -5382,23 +5422,26 @@ var messageSlice = createSliceWithThunks({
|
|
|
5382
5422
|
toolCalls
|
|
5383
5423
|
});
|
|
5384
5424
|
if (billingMode === "reported") {
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5425
|
+
const usageRecords = billingUsageRecords?.length ? billingUsageRecords : [{ callId: void 0, usage: billedUsage }];
|
|
5426
|
+
for (const usageRecord of usageRecords) {
|
|
5427
|
+
await dispatch(
|
|
5428
|
+
updateTokens({
|
|
5429
|
+
dialogId,
|
|
5430
|
+
dialogKey,
|
|
5431
|
+
usageRecord,
|
|
5432
|
+
agentConfig
|
|
5433
|
+
})
|
|
5434
|
+
).unwrap();
|
|
5435
|
+
}
|
|
5393
5436
|
} else if (billingMode === "estimated") {
|
|
5394
|
-
dispatch(
|
|
5437
|
+
await dispatch(
|
|
5395
5438
|
updateTokens({
|
|
5396
5439
|
dialogId,
|
|
5397
5440
|
dialogKey,
|
|
5398
5441
|
usage: billedEstimatedUsage,
|
|
5399
5442
|
agentConfig
|
|
5400
5443
|
})
|
|
5401
|
-
);
|
|
5444
|
+
).unwrap();
|
|
5402
5445
|
console.warn("[billing] Missing usage at messageStreamEnd; using estimated token update", {
|
|
5403
5446
|
dialogId,
|
|
5404
5447
|
dialogKey,
|
|
@@ -5586,16 +5629,17 @@ var messageSlice = createSliceWithThunks({
|
|
|
5586
5629
|
(m) => m?.dbKey ? dispatch(remove(m.dbKey)).unwrap() : Promise.resolve()
|
|
5587
5630
|
)
|
|
5588
5631
|
);
|
|
5589
|
-
const { agentKeyToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
|
|
5632
|
+
const { agentKeyToUse, agentConfigToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
|
|
5590
5633
|
dialogConfig,
|
|
5591
5634
|
targetAgentKey: args.targetAgentKey,
|
|
5592
5635
|
runtimeOptions: args.runtimeOptions
|
|
5593
5636
|
});
|
|
5594
5637
|
if (agentKeyToUse) {
|
|
5595
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
5638
|
+
const { streamAgentChatTurn } = await import("./agentSlice-OJBHIL34.js");
|
|
5596
5639
|
await dispatch(
|
|
5597
5640
|
streamAgentChatTurn({
|
|
5598
5641
|
agentKey: agentKeyToUse,
|
|
5642
|
+
...agentConfigToUse ? { agentConfig: agentConfigToUse } : {},
|
|
5599
5643
|
userInput: nextContent,
|
|
5600
5644
|
dialogKey,
|
|
5601
5645
|
parentMessageId: void 0,
|
|
@@ -5648,8 +5692,7 @@ var {
|
|
|
5648
5692
|
editUserMessageAndReplay,
|
|
5649
5693
|
addToolMessage,
|
|
5650
5694
|
updateToolMessage,
|
|
5651
|
-
removeMessagesByIds
|
|
5652
|
-
appendOverlayMessage
|
|
5695
|
+
removeMessagesByIds
|
|
5653
5696
|
} = messageSlice.actions;
|
|
5654
5697
|
var messageSlice_default = messageSlice.reducer;
|
|
5655
5698
|
|
|
@@ -5722,10 +5765,10 @@ var createTokenRecord = (data, { cost, inputPrice, outputPrice } = {}) => ({
|
|
|
5722
5765
|
inputPrice,
|
|
5723
5766
|
outputPrice
|
|
5724
5767
|
});
|
|
5725
|
-
var saveTokenRecord = async (tokenData, record, thunkApi) => {
|
|
5768
|
+
var saveTokenRecord = async (tokenData, record, thunkApi, callId) => {
|
|
5726
5769
|
const ownerUserId = tokenData.userId || record.userId;
|
|
5727
5770
|
const eventTime = tokenData.timestamp ?? record.createdAt ?? Date.now();
|
|
5728
|
-
const key = createTokenKey.record(ownerUserId, eventTime);
|
|
5771
|
+
const key = callId ? createTokenKey.recordForStableCall(ownerUserId, callId) : createTokenKey.record(ownerUserId, eventTime);
|
|
5729
5772
|
try {
|
|
5730
5773
|
await thunkApi.dispatch(
|
|
5731
5774
|
write({
|
|
@@ -7476,9 +7519,13 @@ var resolveEffectiveModelPrice = ({
|
|
|
7476
7519
|
model,
|
|
7477
7520
|
usage,
|
|
7478
7521
|
provider,
|
|
7479
|
-
billingServiceTier
|
|
7522
|
+
billingServiceTier,
|
|
7523
|
+
nowMs
|
|
7480
7524
|
}) => {
|
|
7481
7525
|
const resolvedPrice = resolveModelPrice(model, usage);
|
|
7526
|
+
if ((provider === "nolo" || provider === "deepseek") && isPlatformHostedDeepSeekV4Model(model.name)) {
|
|
7527
|
+
return getPlatformHostedDeepSeekV4Price(model.name, nowMs);
|
|
7528
|
+
}
|
|
7482
7529
|
if (provider === "google") {
|
|
7483
7530
|
return resolveGoogleServiceTierPrice(model, resolvedPrice, billingServiceTier);
|
|
7484
7531
|
}
|
|
@@ -7603,7 +7650,7 @@ var resolveOpenAIBuiltInImageSurcharge = (model, usage) => {
|
|
|
7603
7650
|
if (imageGenerationCount <= 0 || pricePerImage <= 0) return 0;
|
|
7604
7651
|
return imageGenerationCount * pricePerImage;
|
|
7605
7652
|
};
|
|
7606
|
-
var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceTier) => {
|
|
7653
|
+
var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceTier, nowMs) => {
|
|
7607
7654
|
if (!usage || typeof usage.input_tokens !== "number") {
|
|
7608
7655
|
throw new Error("Invalid usage data");
|
|
7609
7656
|
}
|
|
@@ -7611,7 +7658,8 @@ var calculateBasicCost = (model, usage, provider, externalPrice, billingServiceT
|
|
|
7611
7658
|
model,
|
|
7612
7659
|
usage,
|
|
7613
7660
|
provider,
|
|
7614
|
-
billingServiceTier
|
|
7661
|
+
billingServiceTier,
|
|
7662
|
+
nowMs
|
|
7615
7663
|
});
|
|
7616
7664
|
switch (provider) {
|
|
7617
7665
|
case "deepseek":
|
|
@@ -7688,12 +7736,26 @@ var calculatePrice = ({
|
|
|
7688
7736
|
// 不设默认值,undefined 表示 custom/未知 provider,走 zeroCostModel 路径
|
|
7689
7737
|
provider,
|
|
7690
7738
|
billingServiceTier,
|
|
7739
|
+
nowMs,
|
|
7691
7740
|
sharingLevel = "default"
|
|
7692
7741
|
}) => {
|
|
7693
7742
|
let model;
|
|
7694
7743
|
try {
|
|
7695
7744
|
model = getModelConfig(provider, modelName);
|
|
7696
7745
|
} catch {
|
|
7746
|
+
if ((provider === "nolo" || provider === "deepseek") && isPlatformHostedDeepSeekV4Model(modelName)) {
|
|
7747
|
+
const hostedModel = getModelConfig("nolo", modelName);
|
|
7748
|
+
const costs3 = calculateBasicCost(
|
|
7749
|
+
hostedModel,
|
|
7750
|
+
usage,
|
|
7751
|
+
provider,
|
|
7752
|
+
externalPrice,
|
|
7753
|
+
billingServiceTier,
|
|
7754
|
+
nowMs
|
|
7755
|
+
);
|
|
7756
|
+
const pay3 = calculatePayDistribution(costs3, externalPrice, sharingLevel);
|
|
7757
|
+
return { cost: sanitizeCost(costs3.charge), pay: pay3 };
|
|
7758
|
+
}
|
|
7697
7759
|
const zeroCostModel = {
|
|
7698
7760
|
name: modelName,
|
|
7699
7761
|
hasVision: false,
|
|
@@ -7704,7 +7766,8 @@ var calculatePrice = ({
|
|
|
7704
7766
|
usage,
|
|
7705
7767
|
"custom",
|
|
7706
7768
|
externalPrice,
|
|
7707
|
-
billingServiceTier
|
|
7769
|
+
billingServiceTier,
|
|
7770
|
+
nowMs
|
|
7708
7771
|
);
|
|
7709
7772
|
const pay2 = calculatePayDistribution(costs2, externalPrice, sharingLevel);
|
|
7710
7773
|
return { cost: sanitizeCost(costs2.charge), pay: pay2 };
|
|
@@ -7714,7 +7777,8 @@ var calculatePrice = ({
|
|
|
7714
7777
|
usage,
|
|
7715
7778
|
provider || "custom",
|
|
7716
7779
|
externalPrice,
|
|
7717
|
-
billingServiceTier
|
|
7780
|
+
billingServiceTier,
|
|
7781
|
+
nowMs
|
|
7718
7782
|
);
|
|
7719
7783
|
const openAIImageSurcharge = provider === "openai" ? resolveOpenAIBuiltInImageSurcharge(model, usage) : 0;
|
|
7720
7784
|
const adjustedCosts = openAIImageSurcharge > 0 ? {
|
|
@@ -7760,6 +7824,15 @@ var readFiniteNumberField = (usage, field) => {
|
|
|
7760
7824
|
};
|
|
7761
7825
|
var readCostInUsdTicks = (usage) => readFiniteNumberField(usage, "cost_in_usd_ticks");
|
|
7762
7826
|
var normalizeUsage = (usage) => {
|
|
7827
|
+
if (!usage || typeof usage !== "object") {
|
|
7828
|
+
return {
|
|
7829
|
+
input_tokens: 0,
|
|
7830
|
+
output_tokens: 0,
|
|
7831
|
+
total_tokens: 0,
|
|
7832
|
+
cache_creation_input_tokens: 0,
|
|
7833
|
+
cache_read_input_tokens: 0
|
|
7834
|
+
};
|
|
7835
|
+
}
|
|
7763
7836
|
const inputTokens = "input_tokens" in usage ? usage.input_tokens ?? 0 : "prompt_tokens" in usage ? usage.prompt_tokens : 0;
|
|
7764
7837
|
const outputTokens = "output_tokens" in usage ? usage.output_tokens ?? 0 : "completion_tokens" in usage ? usage.completion_tokens : 0;
|
|
7765
7838
|
const cacheCreationInputTokens = "cache_creation_input_tokens" in usage ? usage.cache_creation_input_tokens ?? 0 : "prompt_cache_miss_tokens" in usage ? usage.prompt_cache_miss_tokens : 0;
|
|
@@ -7777,6 +7850,8 @@ var normalizeUsage = (usage) => {
|
|
|
7777
7850
|
const billingModel = asOptionalTrimmedString(usage.billing_model);
|
|
7778
7851
|
const billingServiceTier = asOptionalTrimmedString(usage.billing_service_tier);
|
|
7779
7852
|
const billingEstimated = "billing_estimated" in usage && usage.billing_estimated === true;
|
|
7853
|
+
const serverBilled = "server_billed" in usage && usage.server_billed === true;
|
|
7854
|
+
const providerCallId = asOptionalTrimmedString(usage.provider_call_id);
|
|
7780
7855
|
const imageGenerationCount = "image_generation_count" in usage ? asOptionalFiniteNumber(usage.image_generation_count) : void 0;
|
|
7781
7856
|
const providerResponseIds = normalizeStringArray(
|
|
7782
7857
|
usage.provider_response_ids
|
|
@@ -7797,6 +7872,8 @@ var normalizeUsage = (usage) => {
|
|
|
7797
7872
|
...billingModel ? { billing_model: billingModel } : {},
|
|
7798
7873
|
...billingServiceTier ? { billing_service_tier: billingServiceTier } : {},
|
|
7799
7874
|
...billingEstimated ? { billing_estimated: true } : {},
|
|
7875
|
+
...serverBilled ? { server_billed: true } : {},
|
|
7876
|
+
...providerCallId ? { provider_call_id: providerCallId } : {},
|
|
7800
7877
|
...xaiTicks !== void 0 ? { cost_in_usd_ticks: xaiTicks } : {}
|
|
7801
7878
|
};
|
|
7802
7879
|
};
|
|
@@ -7828,46 +7905,6 @@ var resolveBillingTarget = ({
|
|
|
7828
7905
|
};
|
|
7829
7906
|
};
|
|
7830
7907
|
|
|
7831
|
-
// packages/agent-runtime/serverProxyPolicy.ts
|
|
7832
|
-
var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
|
|
7833
|
-
"antigravity",
|
|
7834
|
-
"xai",
|
|
7835
|
-
"chatgpt",
|
|
7836
|
-
"claude",
|
|
7837
|
-
"cursor"
|
|
7838
|
-
]);
|
|
7839
|
-
function isGoogleFamilyProvider(provider) {
|
|
7840
|
-
const normalized = asTrimmedLowercaseString(provider);
|
|
7841
|
-
return normalized === "google" || normalized.startsWith("google-");
|
|
7842
|
-
}
|
|
7843
|
-
function isOAuthApiKeyRef(value) {
|
|
7844
|
-
const ref = asTrimmedLowercaseString(value);
|
|
7845
|
-
return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
|
|
7846
|
-
}
|
|
7847
|
-
function shouldUseServerProxy(agentConfig, requestProvider) {
|
|
7848
|
-
const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
|
|
7849
|
-
if (isGoogleFamilyProvider(effectiveProvider)) {
|
|
7850
|
-
return true;
|
|
7851
|
-
}
|
|
7852
|
-
if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
|
|
7853
|
-
return true;
|
|
7854
|
-
}
|
|
7855
|
-
if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
|
|
7856
|
-
return true;
|
|
7857
|
-
}
|
|
7858
|
-
return !!agentConfig.useServerProxy;
|
|
7859
|
-
}
|
|
7860
|
-
var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
|
|
7861
|
-
function isRemoteCustomEndpoint(url) {
|
|
7862
|
-
if (typeof url !== "string") return false;
|
|
7863
|
-
try {
|
|
7864
|
-
const host = new URL(url).hostname.toLowerCase();
|
|
7865
|
-
return !LOCAL_HOSTS.has(host);
|
|
7866
|
-
} catch {
|
|
7867
|
-
return false;
|
|
7868
|
-
}
|
|
7869
|
-
}
|
|
7870
|
-
|
|
7871
7908
|
// packages/ai/token/prepareTokenUsageData.ts
|
|
7872
7909
|
function resolveBillable(input) {
|
|
7873
7910
|
const uid = input.userId?.trim();
|
|
@@ -7921,7 +7958,8 @@ var prepareTokenUsageData = ({
|
|
|
7921
7958
|
output: agentConfig.outputPrice ?? 0,
|
|
7922
7959
|
creatorId: agentConfig.userId ?? (agentConfig.id ? extractUserId(agentConfig.id) : "")
|
|
7923
7960
|
} : void 0,
|
|
7924
|
-
sharingLevel: agentConfig.sharingLevel
|
|
7961
|
+
sharingLevel: agentConfig.sharingLevel,
|
|
7962
|
+
nowMs: timestamp
|
|
7925
7963
|
});
|
|
7926
7964
|
const billable = resolveBillable({
|
|
7927
7965
|
usage,
|
|
@@ -8103,7 +8141,7 @@ var saveTokenUsage = async (data, thunkApi) => {
|
|
|
8103
8141
|
}
|
|
8104
8142
|
});
|
|
8105
8143
|
};
|
|
8106
|
-
var updateTokensAction = async ({ dialogId, dialogKey, usage:
|
|
8144
|
+
var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usageRecord, agentConfig }, thunkApi) => {
|
|
8107
8145
|
const state3 = thunkApi.getState();
|
|
8108
8146
|
const { currentUser } = state3.auth;
|
|
8109
8147
|
const dialogConfig = dialogKey ? selectById(state3, dialogKey) : null;
|
|
@@ -8114,9 +8152,17 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentCon
|
|
|
8114
8152
|
currentAccountUserId: currentUser?.userId ?? null
|
|
8115
8153
|
});
|
|
8116
8154
|
const timestamp = Date.now();
|
|
8155
|
+
const callId = typeof usageRecord?.callId === "string" && usageRecord.callId ? usageRecord.callId : void 0;
|
|
8156
|
+
const usageRaw = usageRecord?.usage ?? legacyUsage;
|
|
8157
|
+
const usageWithStableCallId = callId && !usageRaw?.provider_call_id ? { ...usageRaw, provider_call_id: callId } : usageRaw;
|
|
8158
|
+
const callAgentConfig = {
|
|
8159
|
+
...agentConfig,
|
|
8160
|
+
...typeof usageRecord?.model === "string" ? { model: usageRecord.model } : {},
|
|
8161
|
+
...typeof usageRecord?.provider === "string" ? { provider: usageRecord.provider } : {}
|
|
8162
|
+
};
|
|
8117
8163
|
const prepared = prepareTokenUsageData({
|
|
8118
|
-
rawUsage:
|
|
8119
|
-
agentConfig,
|
|
8164
|
+
rawUsage: usageWithStableCallId,
|
|
8165
|
+
agentConfig: callAgentConfig,
|
|
8120
8166
|
userId: ownerUserId,
|
|
8121
8167
|
username: currentUser?.username,
|
|
8122
8168
|
agentId: agentConfig.id,
|
|
@@ -8135,13 +8181,22 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentCon
|
|
|
8135
8181
|
// undefined when a prepare helper omits timestamp.
|
|
8136
8182
|
timestamp
|
|
8137
8183
|
};
|
|
8184
|
+
const stableTokenKey = callId ? createTokenKey.recordForStableCall(ownerUserId, callId) : null;
|
|
8185
|
+
const accountingAlreadyProjected = stableTokenKey ? Boolean(selectById(state3, stableTokenKey)) : false;
|
|
8138
8186
|
const billedCatalog = findModelConfig(recordProvider, billedModel)?.price;
|
|
8139
8187
|
const record = createTokenRecord(persistedTokenData, {
|
|
8140
8188
|
cost: result.cost,
|
|
8141
8189
|
inputPrice: billedCatalog?.input ?? agentConfig.inputPrice,
|
|
8142
8190
|
outputPrice: billedCatalog?.output ?? agentConfig.outputPrice
|
|
8143
8191
|
});
|
|
8144
|
-
await saveTokenRecord(persistedTokenData, record, thunkApi);
|
|
8192
|
+
await saveTokenRecord(persistedTokenData, record, thunkApi, callId);
|
|
8193
|
+
if (accountingAlreadyProjected) {
|
|
8194
|
+
return {
|
|
8195
|
+
input_tokens: usage.input_tokens,
|
|
8196
|
+
output_tokens: usage.output_tokens,
|
|
8197
|
+
cost: result.cost
|
|
8198
|
+
};
|
|
8199
|
+
}
|
|
8145
8200
|
await saveTokenUsage(persistedTokenData, thunkApi);
|
|
8146
8201
|
if (persistedTokenData.billable === true || persistedTokenData.billable === void 0 && result.cost > 0) {
|
|
8147
8202
|
thunkApi.dispatch(deductBalance(result.cost));
|
|
@@ -8319,7 +8374,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
8319
8374
|
}
|
|
8320
8375
|
if (isCurrentDialog) {
|
|
8321
8376
|
await thunkApi.dispatch(resetMsgs());
|
|
8322
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
8377
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-DJXC53YW.js");
|
|
8323
8378
|
dispatch(clearPendingAttachments2());
|
|
8324
8379
|
clearWorkflow();
|
|
8325
8380
|
}
|
|
@@ -8328,35 +8383,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
8328
8383
|
|
|
8329
8384
|
// packages/chat/dialog/dialogSlice.ts
|
|
8330
8385
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
8331
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
8386
|
+
const { createDialogAction } = await import("./createDialogAction-ORFRYI3C.js");
|
|
8332
8387
|
return createDialogAction(args, thunkApi);
|
|
8333
8388
|
};
|
|
8334
8389
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
8335
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
8390
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-PO62NUR7.js");
|
|
8336
8391
|
return createAgentAutomationAction(args, thunkApi);
|
|
8337
8392
|
};
|
|
8338
8393
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
8339
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
8394
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-LMHZUY4Q.js");
|
|
8340
8395
|
return updateDialogTitleAction(args, thunkApi);
|
|
8341
8396
|
};
|
|
8342
8397
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
8343
|
-
const { addDialogAgentAction } = await import("./addDialogAgentAction-
|
|
8398
|
+
const { addDialogAgentAction } = await import("./addDialogAgentAction-LJGNP2AO.js");
|
|
8344
8399
|
return addDialogAgentAction(args, thunkApi);
|
|
8345
8400
|
};
|
|
8346
8401
|
var runRemoveDialogAgentAction = async (args, thunkApi) => {
|
|
8347
|
-
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-
|
|
8402
|
+
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-QCFGIUIH.js");
|
|
8348
8403
|
return removeDialogAgentAction(args, thunkApi);
|
|
8349
8404
|
};
|
|
8350
8405
|
var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
|
|
8351
|
-
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-
|
|
8406
|
+
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-SJSO6N27.js");
|
|
8352
8407
|
return setPrimaryDialogAgentAction(args, thunkApi);
|
|
8353
8408
|
};
|
|
8409
|
+
var runSwitchDialogAgentAction = async (args, thunkApi) => {
|
|
8410
|
+
const { switchDialogAgentAction } = await import("./switchDialogAgentAction-4OAC6QRN.js");
|
|
8411
|
+
return switchDialogAgentAction(args, thunkApi);
|
|
8412
|
+
};
|
|
8354
8413
|
var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
8355
|
-
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-
|
|
8414
|
+
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-DK4CKERU.js");
|
|
8356
8415
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
8357
8416
|
};
|
|
8358
8417
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
8359
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
8418
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-ILFGZTN5.js");
|
|
8360
8419
|
return handleSendMessageAction(args, thunkApi);
|
|
8361
8420
|
};
|
|
8362
8421
|
function clearDialogState() {
|
|
@@ -8369,7 +8428,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
8369
8428
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
8370
8429
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
8371
8430
|
try {
|
|
8372
|
-
const { createDocState } = await import("./docStore-
|
|
8431
|
+
const { createDocState } = await import("./docStore-6LKLLFDW.js");
|
|
8373
8432
|
const pageKey = await createDocState(
|
|
8374
8433
|
{ slateData, title },
|
|
8375
8434
|
{ dispatch, getState }
|
|
@@ -8487,6 +8546,10 @@ var setPrimaryDialogAgent = createAsyncThunk(
|
|
|
8487
8546
|
"dialog/setPrimaryDialogAgent",
|
|
8488
8547
|
runSetPrimaryDialogAgentAction
|
|
8489
8548
|
);
|
|
8549
|
+
var switchDialogAgent = createAsyncThunk(
|
|
8550
|
+
"dialog/switchDialogAgent",
|
|
8551
|
+
runSwitchDialogAgentAction
|
|
8552
|
+
);
|
|
8490
8553
|
var setDialogExtraReferences = createAsyncThunk(
|
|
8491
8554
|
"dialog/setDialogExtraReferences",
|
|
8492
8555
|
runSetDialogExtraReferencesAction
|
|
@@ -13236,7 +13299,9 @@ var spaceListsUser = (spaceData, userId) => {
|
|
|
13236
13299
|
return Array.isArray(spaceData.members) && spaceData.members.includes(userId);
|
|
13237
13300
|
};
|
|
13238
13301
|
var membershipBelongsToUser = (membership, userId) => !membership.userId || membership.userId === userId;
|
|
13239
|
-
var
|
|
13302
|
+
var membershipFetchCache = /* @__PURE__ */ new Map();
|
|
13303
|
+
var MEMBERSHIP_FETCH_CACHE_TTL_MS = 3e4;
|
|
13304
|
+
async function fetchMembershipsFromServer(server, token, userId, timeoutMs) {
|
|
13240
13305
|
if (!token) return { ok: false, memberships: [] };
|
|
13241
13306
|
const controller = new AbortController();
|
|
13242
13307
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -13268,6 +13333,22 @@ var fetchRemoteUserSpaceMemberships = async (server, token, userId, timeoutMs =
|
|
|
13268
13333
|
console.error(`Error fetching memberships from ${server}:`, error);
|
|
13269
13334
|
return { ok: false, memberships: [] };
|
|
13270
13335
|
}
|
|
13336
|
+
}
|
|
13337
|
+
var fetchRemoteUserSpaceMemberships = (server, token, userId, timeoutMs = 5e3) => {
|
|
13338
|
+
const cacheKey = `${server}|${userId}`;
|
|
13339
|
+
const cached = membershipFetchCache.get(cacheKey);
|
|
13340
|
+
if (cached) return cached;
|
|
13341
|
+
const promise = fetchMembershipsFromServer(server, token, userId, timeoutMs);
|
|
13342
|
+
membershipFetchCache.set(cacheKey, promise);
|
|
13343
|
+
promise.catch(() => {
|
|
13344
|
+
}).finally(() => {
|
|
13345
|
+
setTimeout(() => {
|
|
13346
|
+
if (membershipFetchCache.get(cacheKey) === promise) {
|
|
13347
|
+
membershipFetchCache.delete(cacheKey);
|
|
13348
|
+
}
|
|
13349
|
+
}, MEMBERSHIP_FETCH_CACHE_TTL_MS);
|
|
13350
|
+
});
|
|
13351
|
+
return promise;
|
|
13271
13352
|
};
|
|
13272
13353
|
var fetchRemoteSpace = async (server, token, spaceId) => {
|
|
13273
13354
|
try {
|
|
@@ -14598,7 +14679,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
|
|
|
14598
14679
|
const spaceKey = createSpaceKey.space(spaceId);
|
|
14599
14680
|
const readSpace = async (dbKey) => {
|
|
14600
14681
|
try {
|
|
14601
|
-
const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-
|
|
14682
|
+
const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-5BKDURDL.js");
|
|
14602
14683
|
if (fresh) {
|
|
14603
14684
|
return await dispatch(readAndWait2(dbKey)).unwrap();
|
|
14604
14685
|
}
|
|
@@ -15197,6 +15278,16 @@ var selectCurrentSpace = createSelector(
|
|
|
15197
15278
|
return getSpaceUpdatedAt2(spaceEntity) > getSpaceUpdatedAt2(space.currentSpace) ? spaceEntity : space.currentSpace;
|
|
15198
15279
|
}
|
|
15199
15280
|
);
|
|
15281
|
+
var selectSpaceById = createSelector(
|
|
15282
|
+
[
|
|
15283
|
+
selectEntities,
|
|
15284
|
+
(_state, spaceId) => spaceId
|
|
15285
|
+
],
|
|
15286
|
+
(entities, spaceId) => {
|
|
15287
|
+
if (!spaceId) return null;
|
|
15288
|
+
return entities[createSpaceKey.space(spaceId)] || null;
|
|
15289
|
+
}
|
|
15290
|
+
);
|
|
15200
15291
|
var selectAllMemberSpaces = createSelector(
|
|
15201
15292
|
selectSpaceState,
|
|
15202
15293
|
(space) => {
|
|
@@ -15271,10 +15362,8 @@ var selectViewMode = createSelector(
|
|
|
15271
15362
|
var spaceSlice_default = spaceSlice.reducer;
|
|
15272
15363
|
|
|
15273
15364
|
export {
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
shouldUseServerProxy,
|
|
15277
|
-
prepareTokenUsageData,
|
|
15365
|
+
resolveBuiltinPlatformAgentConfig,
|
|
15366
|
+
resolveBuiltinPlatformAgentRecord,
|
|
15278
15367
|
instance,
|
|
15279
15368
|
initReactI18next,
|
|
15280
15369
|
i18nBaseConfig,
|
|
@@ -15302,7 +15391,6 @@ export {
|
|
|
15302
15391
|
messageStreamEnd,
|
|
15303
15392
|
addToolMessage,
|
|
15304
15393
|
updateToolMessage,
|
|
15305
|
-
appendOverlayMessage,
|
|
15306
15394
|
setWorkflow,
|
|
15307
15395
|
updateStep,
|
|
15308
15396
|
incrementStepsExecuted,
|
|
@@ -15350,6 +15438,7 @@ export {
|
|
|
15350
15438
|
appendRecoveredMemberships,
|
|
15351
15439
|
selectCurrentSpaceId,
|
|
15352
15440
|
selectCurrentSpace,
|
|
15441
|
+
selectSpaceById,
|
|
15353
15442
|
selectAllMemberSpaces,
|
|
15354
15443
|
selectOwnedMemberSpaces,
|
|
15355
15444
|
selectSpaceLoading,
|
|
@@ -15370,6 +15459,11 @@ export {
|
|
|
15370
15459
|
selectViewMode,
|
|
15371
15460
|
spaceSlice_default,
|
|
15372
15461
|
selectCurrentUserBalance,
|
|
15462
|
+
API_REPORTED_COST_MULTIPLIER,
|
|
15463
|
+
normalizeUsage,
|
|
15464
|
+
prepareTokenUsageData,
|
|
15465
|
+
applyTokenUsageToDayStats,
|
|
15466
|
+
runKeyed,
|
|
15373
15467
|
updateTokensAction,
|
|
15374
15468
|
clearDialogState,
|
|
15375
15469
|
createPageAndAddReference,
|
|
@@ -15384,6 +15478,7 @@ export {
|
|
|
15384
15478
|
addDialogAgent,
|
|
15385
15479
|
removeDialogAgent,
|
|
15386
15480
|
setPrimaryDialogAgent,
|
|
15481
|
+
switchDialogAgent,
|
|
15387
15482
|
setDialogExtraReferences,
|
|
15388
15483
|
selectCurrentDialogConfig,
|
|
15389
15484
|
selectCurrentDialogAgentIds,
|