nolo-cli 0.8.0-alpha.7 → 0.9.0
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-XIGO7HW5.js → _executeModel-UD44KGZ4.js} +33 -28
- package/{action-PAXRPJJF.js → action-ZJWE3Y5S.js} +5 -4
- package/{addContentAction-CZVWF3QZ.js → addContentAction-TVDBNJM5.js} +4 -3
- package/{addDialogAgentAction-CCIDTPHC.js → addDialogAgentAction-EKH774VT.js} +3 -2
- package/{agentDeleteCommand-47B24JYG.js → agentDeleteCommand-TCPEFJTF.js} +15 -11
- package/{agentEmailCommands-D4FC6OZJ.js → agentEmailCommands-CZ3UILZ4.js} +36 -31
- package/{agentListCommands-UFET7CC4.js → agentListCommands-SJKO2FFB.js} +16 -12
- package/{agentMachineCommands-LH7QDQPP.js → agentMachineCommands-PSNABISZ.js} +15 -11
- package/{agentRecordCommands-CWS2B5IA.js → agentRecordCommands-MH2JKFHS.js} +36 -31
- package/{agentRunCommand-3FRPISLG.js → agentRunCommand-4KH6MIZR.js} +42 -34
- package/{agentRuntimeLocal-JNQQC2WG.js → agentRuntimeLocal-SKHJUWSS.js} +20 -15
- package/{agentSlice-XDFSELFJ.js → agentSlice-3WXXN4VK.js} +5 -4
- package/{authCommand-WXMD3IPR.js → authCommand-PXFX6JDT.js} +8 -1
- package/{authCommands-X74AFDTC.js → authCommands-356AYWEK.js} +10 -1
- package/{chunk-E5HMHIKL.js → chunk-2K2ECKSG.js} +4 -4
- package/{chunk-364VYAX2.js → chunk-2PUGVR6E.js} +1 -1
- package/chunk-3TZDXYSF.js +71 -0
- package/{chunk-YIJFUVKA.js → chunk-3WYQEUBI.js} +1 -1
- package/{chunk-543C7RDK.js → chunk-4K2KKCSD.js} +23 -8
- package/chunk-4ZDM73SD.js +34 -0
- package/{chunk-TDIQFT2F.js → chunk-5CS33IBL.js} +1 -1
- package/chunk-5KLGBAAR.js +386 -0
- package/{chunk-YD43KPCK.js → chunk-5PJ3VWCS.js} +3 -3
- package/{chunk-IAXBCTTE.js → chunk-63SLEOLK.js} +2 -2
- package/{chunk-BSTNFPHD.js → chunk-6GANEXVO.js} +1 -1
- package/{chunk-6PWWWMI7.js → chunk-7OOXPE3N.js} +2 -2
- package/{chunk-KK6SWS5B.js → chunk-7QRKCBOP.js} +5 -5
- package/{chunk-LM25IZBJ.js → chunk-AUQ747NZ.js} +2 -2
- package/{chunk-572EKYLF.js → chunk-BBYVOSU2.js} +1 -1
- package/{chunk-2MALU52L.js → chunk-C3RUNRHT.js} +1 -1
- package/{chunk-G5H7RNFL.js → chunk-COMXDWNM.js} +2 -2
- package/{chunk-2LMT6K6N.js → chunk-CPB2YM4D.js} +2 -2
- package/{chunk-USZMK5UT.js → chunk-DCOA4QSN.js} +1 -1
- package/{chunk-OF5H3QWS.js → chunk-EXTIQUCI.js} +182 -0
- package/{chunk-B76D3JJK.js → chunk-G43KEVSC.js} +4 -4
- package/{chunk-USZDUWOV.js → chunk-GG4AJPSR.js} +2 -2
- package/chunk-I42VC5KR.js +15 -0
- package/{chunk-BR2WP3DF.js → chunk-IWX4UW2E.js} +9 -9
- package/chunk-JEXVIMYZ.js +55 -0
- package/{chunk-XDVAYP26.js → chunk-JRKKFRAV.js} +1 -1
- package/{chunk-DA2OEKS6.js → chunk-KKY4B2Q2.js} +2 -8
- package/{chunk-A3X4Y7MO.js → chunk-KOCA5FCS.js} +482 -26
- package/{chunk-IYQV26RA.js → chunk-KTVVPRJS.js} +2 -2
- package/{chunk-V2F4OGYM.js → chunk-LARL2V6G.js} +22 -18
- package/{chunk-H2RMRZJE.js → chunk-MGOJ5R6J.js} +1 -1
- package/{chunk-UVPF33PW.js → chunk-MKMWT7SA.js} +63 -19862
- package/chunk-OPZYGHUC.js +89 -0
- package/chunk-PAKN26FP.js +239 -0
- package/{chunk-OVGXXUVI.js → chunk-PCWC3JTN.js} +2 -2
- package/{chunk-AR7ZSGDI.js → chunk-PG5PNA7Y.js} +16 -6
- package/{chunk-HEIIIZBX.js → chunk-Q2YZULBH.js} +1 -1
- package/{chunk-2JHWPW5B.js → chunk-SBR32ZZS.js} +77 -303
- package/{chunk-PN7AFLOK.js → chunk-SH2CFQOH.js} +3 -13
- package/{chunk-CM54RSSA.js → chunk-SL35K7AH.js} +21 -1
- package/{chunk-VEJLAVTC.js → chunk-TSS3XJY4.js} +4 -4
- package/{chunk-IECI4YHR.js → chunk-UUJDGGAK.js} +3 -3
- package/{chunk-GEKCOPTN.js → chunk-WKM6FH35.js} +1 -1
- package/{chunk-SL3EPWB4.js → chunk-XE635NI4.js} +21 -22
- package/{chunk-NE3E3XJ2.js → chunk-XS466O7S.js} +96 -99
- package/{chunk-5XH3NZ4T.js → chunk-YBWOP46I.js} +20 -379
- package/{chunk-VQ2AJRGD.js → chunk-YPRZSPF3.js} +1 -1
- package/{chunk-AUGHVUFE.js → chunk-YYUCRDOK.js} +1 -1
- package/{chunk-KTI2WDDG.js → chunk-ZIG5LJ7X.js} +357 -266
- package/{chunk-NXZGF7F7.js → chunk-ZQ2UM4KG.js} +1 -1
- package/{createAgentAutomationAction-3QTGNYJC.js → createAgentAutomationAction-63OIP6X5.js} +15 -13
- package/{createDialogAction-5YX3ARBK.js → createDialogAction-ZLYZDYBB.js} +18 -16
- package/{createPageAction-EQNQQRCW.js → createPageAction-AL5FSDCK.js} +16 -14
- package/{dbSlice-C4UJLRZP.js → dbSlice-PR44QPXY.js} +3 -2
- package/{dialogCommands-AOQS23FV.js → dialogCommands-F6YI5742.js} +17 -13
- package/{dialogSlice-GZE3NCMC.js → dialogSlice-JSBNZRLR.js} +15 -13
- package/{docCreateCommands-GVOQVJON.js → docCreateCommands-4CTO7ERT.js} +16 -12
- package/{docDeleteCommands-GEB7YAUZ.js → docDeleteCommands-VBWERDRG.js} +17 -13
- package/{docReadCommands-XYKI2DF2.js → docReadCommands-KNP4MFYB.js} +16 -12
- package/{docStore-MLM5AME5.js → docStore-ADP5VYY4.js} +16 -14
- package/{docUpdateCommands-4L3RAMHZ.js → docUpdateCommands-4BCBJQHA.js} +16 -12
- package/{fetchMessages-JOCYIFKL.js → fetchMessages-U6ZHN56A.js} +3 -2
- package/{getPricing-PWPJ6MNV.js → getPricing-3E6UNPKL.js} +3 -3
- package/{handleSendMessageAction-WG2GKTGZ.js → handleSendMessageAction-IJDQ6ARA.js} +15 -13
- package/index.js +60 -56
- package/lib-FYYBQIXS.js +19839 -0
- package/{localDialogRead-D3BELSTF.js → localDialogRead-Z5UTAJPU.js} +1 -1
- package/{machineCommands-ZNXKLH6Q.js → machineCommands-EA3M4XTN.js} +38 -33
- package/{machineWsRunDispatch-7WRG6HNV.js → machineWsRunDispatch-NAPKE5ZA.js} +34 -29
- package/{models-XLEOET3E.js → models-4OPOOLFS.js} +2 -2
- package/package.json +1 -1
- package/{readlineWorkspace-AQURUDN4.js → readlineWorkspace-KMWT4T4S.js} +196 -44
- package/{removeDialogAgentAction-CXLST3N6.js → removeDialogAgentAction-GJQJNDW6.js} +5 -4
- package/{runAgentClientLoop-VQUEKGA5.js → runAgentClientLoop-U5Q6NDTJ.js} +28 -25
- package/{setDialogExtraReferencesAction-LP6VYGU7.js → setDialogExtraReferencesAction-M7OQG54N.js} +3 -2
- package/{setPrimaryDialogAgentAction-D3GGH23T.js → setPrimaryDialogAgentAction-46UNFJDL.js} +5 -4
- package/{settingSlice-J4I3Z5H7.js → settingSlice-FVUUH4JA.js} +4 -3
- package/{spaceCommands-R2RXD5UY.js → spaceCommands-E2CFRPZJ.js} +15 -11
- package/{spaceSlice-5UT4JNIN.js → spaceSlice-L3R6IMXE.js} +15 -13
- package/{streamAgentChatTurn-NRWSQKFN.js → streamAgentChatTurn-UBDAOQWE.js} +60 -35
- package/{tableCommands-66XEWHAK.js → tableCommands-GOFP7QKA.js} +1 -1
- package/{tools-TNMUDDRK.js → tools-TMJXZTCA.js} +22 -20
- package/tuiSummaryLlmCaller-RV3THLZF.js +78 -0
- package/{understanding-HCSFPE7R.js → understanding-GQKNDDWM.js} +7 -54
- package/{updateDialogTitleAction-IXOKAVX3.js → updateDialogTitleAction-ZTWRDXI2.js} +17 -14
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BUILTIN_SUMMARY_LLM_CONFIG,
|
|
3
|
+
buildBuiltinSummaryContent
|
|
4
|
+
} from "./chunk-4ZDM73SD.js";
|
|
1
5
|
import {
|
|
2
6
|
authRoutes
|
|
3
7
|
} from "./chunk-MRC4Q34M.js";
|
|
4
8
|
import {
|
|
5
9
|
buildDialogAttachmentPlan,
|
|
6
10
|
extractFileContentIds
|
|
7
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PCWC3JTN.js";
|
|
8
12
|
import {
|
|
9
13
|
getApproxPricePerImage
|
|
10
14
|
} from "./chunk-CWMSB67P.js";
|
|
11
15
|
import {
|
|
12
16
|
deleteServerSyncedCredential,
|
|
13
17
|
runLlm
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4K2KKCSD.js";
|
|
15
19
|
import {
|
|
16
20
|
cleanupCliSessionForDialog
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KTVVPRJS.js";
|
|
18
22
|
import {
|
|
19
23
|
getDialogAgentIds,
|
|
20
24
|
getPrimaryDialogAgentId
|
|
@@ -24,28 +28,28 @@ import {
|
|
|
24
28
|
} from "./chunk-M76ECQRD.js";
|
|
25
29
|
import {
|
|
26
30
|
fetchMessages
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YYUCRDOK.js";
|
|
28
32
|
import {
|
|
29
33
|
UNCATEGORIZED_ID,
|
|
30
34
|
addContentAction,
|
|
31
35
|
checkSpaceMembership,
|
|
32
36
|
localSpaceAuthorityPatchStamp
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-MGOJ5R6J.js";
|
|
34
38
|
import {
|
|
35
39
|
createSpaceKey,
|
|
36
40
|
normalizeSpaceId
|
|
37
41
|
} from "./chunk-UAD2WT54.js";
|
|
38
42
|
import {
|
|
39
43
|
ALL_MODELS
|
|
40
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DCOA4QSN.js";
|
|
41
45
|
import {
|
|
42
46
|
MODEL_LOOKUP_MAP,
|
|
43
47
|
findModelConfig,
|
|
44
48
|
getModelConfig
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-BBYVOSU2.js";
|
|
46
50
|
import {
|
|
47
51
|
createFileCredentialBroker
|
|
48
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-5CS33IBL.js";
|
|
49
53
|
import {
|
|
50
54
|
extractCustomId,
|
|
51
55
|
extractUserId
|
|
@@ -76,7 +80,7 @@ import {
|
|
|
76
80
|
selectRemoteServer,
|
|
77
81
|
selectRemoteServers,
|
|
78
82
|
selectRemoteSyncServers
|
|
79
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-TSS3XJY4.js";
|
|
80
84
|
import {
|
|
81
85
|
patch,
|
|
82
86
|
read,
|
|
@@ -89,7 +93,7 @@ import {
|
|
|
89
93
|
uploadFileAction,
|
|
90
94
|
upsertSSREntity,
|
|
91
95
|
write
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-COMXDWNM.js";
|
|
93
97
|
import {
|
|
94
98
|
resolveFileCategory
|
|
95
99
|
} from "./chunk-AZPCASRE.js";
|
|
@@ -100,8 +104,6 @@ import {
|
|
|
100
104
|
DB_PREFIX,
|
|
101
105
|
SEPARATOR,
|
|
102
106
|
TYPE_STORAGE_PREFIXES,
|
|
103
|
-
asNonEmptyStringArray,
|
|
104
|
-
asTrimmedNonEmptyStringArray,
|
|
105
107
|
buildDialogAgentListIndexDeleteOps,
|
|
106
108
|
createDialogMessageKeyAndId,
|
|
107
109
|
createKey,
|
|
@@ -123,7 +125,11 @@ import {
|
|
|
123
125
|
splitKey,
|
|
124
126
|
toTrimmedString,
|
|
125
127
|
ulid
|
|
126
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-SH2CFQOH.js";
|
|
129
|
+
import {
|
|
130
|
+
asNonEmptyStringArray,
|
|
131
|
+
asTrimmedNonEmptyStringArray
|
|
132
|
+
} from "./chunk-I42VC5KR.js";
|
|
127
133
|
import {
|
|
128
134
|
asOptionalFiniteNumber
|
|
129
135
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -11961,6 +11967,9 @@ function add(message, type, options) {
|
|
|
11961
11967
|
title: message,
|
|
11962
11968
|
type,
|
|
11963
11969
|
icon: options?.icon,
|
|
11970
|
+
description: options?.description,
|
|
11971
|
+
action: options?.action,
|
|
11972
|
+
position: options?.position,
|
|
11964
11973
|
// loading toasts stay until explicitly replaced/closed (timeout=0)
|
|
11965
11974
|
timeout: type === "loading" ? timeout ?? 0 : timeout ?? DEFAULT_TIMEOUT
|
|
11966
11975
|
});
|
|
@@ -12345,35 +12354,6 @@ var fetchAndCacheMessages = async (options) => {
|
|
|
12345
12354
|
return remotePromise;
|
|
12346
12355
|
};
|
|
12347
12356
|
|
|
12348
|
-
// packages/chat/dialog/actions/builtinDialogLlm.ts
|
|
12349
|
-
var BASE_BUILTIN_DIALOG_LLM_CONFIG = {
|
|
12350
|
-
apiSource: "platform",
|
|
12351
|
-
useServerProxy: true
|
|
12352
|
-
};
|
|
12353
|
-
var BUILTIN_TITLE_LLM_CONFIG = {
|
|
12354
|
-
...BASE_BUILTIN_DIALOG_LLM_CONFIG,
|
|
12355
|
-
provider: "deepseek",
|
|
12356
|
-
id: "builtin-dialog-title-llm",
|
|
12357
|
-
name: "Builtin Dialog Title LLM",
|
|
12358
|
-
model: "deepseek-v4-flash",
|
|
12359
|
-
prompt: "You are a title generator for chat history. \u4F60\u53EA\u505A\u4E00\u4EF6\u4E8B\uFF1A\u6839\u636E\u5BF9\u8BDD\u5185\u5BB9\u8F93\u51FA\u6700\u7EC8\u6807\u9898\u3002\u786C\u6027\u89C4\u5219\uFF1A1) \u53EA\u8F93\u51FA\u6807\u9898\u8FD9\u4E00\u884C\uFF1B\u4E25\u7981\u8F93\u51FA\u63A8\u7406\u3001\u5206\u6790\u3001\u6B65\u9AA4\u3001\u89E3\u91CA\u3001\u524D\u8A00\u3001\u540E\u8BB0\u3001\u7FFB\u8BD1\u3001\u81F4\u6B49\u6216\u4EFB\u4F55\u989D\u5916\u8BF4\u660E\u30022) \u4E0D\u8981\u56DE\u7B54\u7528\u6237\u8BF7\u6C42\uFF0C\u4E0D\u8981\u5199\u6458\u8981\uFF0C\u53EA\u7ED9\u6807\u9898\u7ED3\u679C\u30023) \u6807\u9898\u5C3D\u91CF\u77ED\uFF1A\u901A\u5E38 2-5 \u4E2A\u8BCD\uFF0C\u82F1\u6587\u4E0D\u8D85\u8FC7 6 \u4E2A\u8BCD\u30024) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u7528\u6237\u4E3B\u8981\u8BED\u8A00\u30025) \u4F18\u5148\u590D\u7528\u5BF9\u8BDD\u4E2D\u7684\u5177\u4F53\u4E3B\u9898\u8BCD\uFF0C\u907F\u514D issue\u3001help\u3001discussion\u3001analysis\u3001update \u8FD9\u7C7B\u7A7A\u6CDB\u8BCD\u30026) \u5FFD\u7565 tool JSON\u3001\u51FD\u6570\u540D\u3001branch label\u3001agent \u540D\u3001\u7CFB\u7EDF\u6307\u4EE4\u548C\u7F16\u6392\u75D5\u8FF9\uFF08\u5982 GPT\u3001Claude\u3001Gemini\uFF09\uFF1B\u6807\u9898\u8981\u843D\u5728\u7528\u6237\u771F\u6B63\u8BA8\u8BBA\u7684\u5BF9\u8C61\u6216\u51B3\u7B56\u4E0A\u30027) \u66F4\u504F\u597D\u201C\u5BF9\u8C61 + \u52A8\u4F5C/\u5224\u65AD\u201D\u7684\u77ED\u6807\u9898\uFF0C\u4F8B\u5982\u201CAI \u90AE\u4EF6\u52A9\u624B\u53D6\u820D\u201D\u201C\u4E1C\u4EAC\u56DB\u65E5\u6162\u65C5\u884C\u201D\u201C\u91CD\u590D\u6263\u8D39\u9000\u6B3E\u201D\u30028) \u7EAF\u6587\u672C\uFF0C\u4E0D\u8981\u9879\u76EE\u7B26\u53F7\u3001\u7F16\u53F7\u3001markdown\u3001emoji\u3002\u6700\u7EC8\u53EA\u8FD4\u56DE\u6807\u9898\u6587\u672C\u3002 Output only the title text."
|
|
12360
|
-
};
|
|
12361
|
-
var BUILTIN_SUMMARY_LLM_CONFIG = {
|
|
12362
|
-
...BASE_BUILTIN_DIALOG_LLM_CONFIG,
|
|
12363
|
-
provider: "deepseek",
|
|
12364
|
-
id: "builtin-dialog-summary-llm",
|
|
12365
|
-
name: "Builtin Dialog Summary LLM",
|
|
12366
|
-
model: "deepseek-v4-pro",
|
|
12367
|
-
prompt: "\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u52A9\u7406\u3002\u8BF7\u57FA\u4E8E\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u548C\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF0C\u8F93\u51FA\u4E00\u4EFD\u66F4\u65B0\u540E\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u6863\u6848\u3002\u4E25\u683C\u53EA\u8F93\u51FA\u4E0B\u9762\u4E24\u90E8\u5206\uFF0C\u6807\u9898\u5FC5\u987B\u5B8C\u5168\u4E00\u81F4\uFF1A\n\u5173\u952E\u4E8B\u5B9E\u6863\u6848\n- ...\n\u5BF9\u8BDD\u5267\u60C5\u6458\u8981\n- ...\n\u8981\u6C42\uFF1A1) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u8DDF\u968F\u7528\u6237\u4E3B\u8981\u8BED\u8A00\uFF0C\u4E13\u6709\u540D\u8BCD\u4FDD\u7559\u539F\u6587\u30022) \u5173\u952E\u4E8B\u5B9E\u6863\u6848\u53EA\u4FDD\u7559\u4E4B\u540E\u7EE7\u7EED\u5BF9\u8BDD\u4ECD\u6709\u4EF7\u503C\u7684\u4FE1\u606F\uFF0C\u4F8B\u5982\u7528\u6237\u504F\u597D\u3001\u76EE\u6807\u3001\u7EA6\u675F\u3001\u6280\u672F\u6808\u3001\u786E\u5B9A\u7684\u6587\u4EF6\u540D/\u53D8\u91CF\u540D\u3001\u6838\u5FC3\u51B3\u7B56\u3001\u5F85\u529E\u4E8B\u9879\u30023) \u5BF9\u8BDD\u5267\u60C5\u6458\u8981\u5148\u6781\u7B80\u6982\u62EC\u65E7\u4E0A\u4E0B\u6587\uFF0C\u518D\u66F4\u8BE6\u7EC6\u8BB0\u5F55\u6700\u8FD1\u65B0\u589E\u7684\u8FDB\u5C55\u3001\u5206\u6B67\u3001\u7ED3\u8BBA\u548C\u4E0B\u4E00\u6B65\u30024) \u5FFD\u7565\u5BD2\u6684\u3001\u91CD\u590D\u5C1D\u8BD5\u3001\u5DF2\u653E\u5F03\u65B9\u6848\u548C\u65E0\u4EF7\u503C\u5E9F\u8BDD\u30025) \u4E0D\u8981\u7F16\u9020\u672A\u51FA\u73B0\u7684\u4FE1\u606F\uFF0C\u4E0D\u8981\u8F93\u51FA\u5F00\u573A\u767D\u3001\u7ED3\u675F\u8BED\u3001markdown \u4EE3\u7801\u5757\u6216\u989D\u5916\u7AE0\u8282\u3002"
|
|
12368
|
-
};
|
|
12369
|
-
var buildBuiltinSummaryContent = (previousSummary, messagesText) => `
|
|
12370
|
-
\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\uFF1A
|
|
12371
|
-
${previousSummary || "(\u65E0)"}
|
|
12372
|
-
|
|
12373
|
-
\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF1A
|
|
12374
|
-
${messagesText}
|
|
12375
|
-
`.trim();
|
|
12376
|
-
|
|
12377
12357
|
// packages/app/utils/imageUtils.ts
|
|
12378
12358
|
var import_browser_image_compression = __toESM(require_browser_image_compression());
|
|
12379
12359
|
var BYTES_PER_MB = 1024 * 1024;
|
|
@@ -12481,7 +12461,7 @@ var stripDurableImageInlinePayload = (part) => {
|
|
|
12481
12461
|
return durablePart;
|
|
12482
12462
|
};
|
|
12483
12463
|
|
|
12484
|
-
// packages/chat/
|
|
12464
|
+
// packages/core/chat/messageContentSerialize.ts
|
|
12485
12465
|
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
12486
12466
|
if (typeof content === "string") {
|
|
12487
12467
|
return content.trim() || null;
|
|
@@ -12679,32 +12659,32 @@ var planContextUsage = (params) => {
|
|
|
12679
12659
|
const { contextWindow, summaryTokens, recentLoad } = params;
|
|
12680
12660
|
const safeWindowLimit = Math.floor(contextWindow * SAFE_BUFFER_RATIO);
|
|
12681
12661
|
const iq = CACHE_FIRST_RETENTION_STRENGTH;
|
|
12682
|
-
const
|
|
12683
|
-
const isSmallWindow = contextWindow <=
|
|
12662
|
+
const isLargeWindow = contextWindow >= 512e3;
|
|
12663
|
+
const isSmallWindow = contextWindow <= 64e3;
|
|
12684
12664
|
let baseHistoryRatio;
|
|
12685
|
-
if (
|
|
12665
|
+
if (isLargeWindow) {
|
|
12686
12666
|
baseHistoryRatio = 0.8 + 0.2 * iq;
|
|
12687
12667
|
} else if (isSmallWindow) {
|
|
12688
|
-
baseHistoryRatio = 0.35 + 0.
|
|
12668
|
+
baseHistoryRatio = 0.35 + 0.3 * iq;
|
|
12689
12669
|
} else {
|
|
12690
|
-
baseHistoryRatio = 0.
|
|
12670
|
+
baseHistoryRatio = 0.55 + 0.3 * iq;
|
|
12691
12671
|
}
|
|
12692
12672
|
let historyRatio = baseHistoryRatio;
|
|
12693
12673
|
switch (recentLoad) {
|
|
12694
12674
|
case "light": {
|
|
12695
|
-
const maxRatio =
|
|
12675
|
+
const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
|
|
12696
12676
|
historyRatio = clamp(historyRatio * 1.05, 0.3, maxRatio);
|
|
12697
12677
|
break;
|
|
12698
12678
|
}
|
|
12699
12679
|
case "heavy": {
|
|
12700
|
-
const maxRatio =
|
|
12701
|
-
const multiplier =
|
|
12680
|
+
const maxRatio = isLargeWindow ? 0.98 : isSmallWindow ? 0.7 : 0.8;
|
|
12681
|
+
const multiplier = isLargeWindow ? 0.98 : isSmallWindow ? 0.9 : 0.9;
|
|
12702
12682
|
historyRatio = clamp(historyRatio * multiplier, 0.3, maxRatio);
|
|
12703
12683
|
break;
|
|
12704
12684
|
}
|
|
12705
12685
|
case "medium":
|
|
12706
12686
|
default: {
|
|
12707
|
-
const maxRatio =
|
|
12687
|
+
const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
|
|
12708
12688
|
historyRatio = clamp(historyRatio, 0.3, maxRatio);
|
|
12709
12689
|
break;
|
|
12710
12690
|
}
|
|
@@ -12713,7 +12693,7 @@ var planContextUsage = (params) => {
|
|
|
12713
12693
|
0,
|
|
12714
12694
|
Math.floor(safeWindowLimit * historyRatio)
|
|
12715
12695
|
);
|
|
12716
|
-
const minRawRatio =
|
|
12696
|
+
const minRawRatio = isSmallWindow ? 0.5 : isLargeWindow ? 0.2 : 0.3;
|
|
12717
12697
|
const rawMessageBudget = Math.max(
|
|
12718
12698
|
Math.floor(historyBudget * minRawRatio),
|
|
12719
12699
|
historyBudget - summaryTokens,
|
|
@@ -12736,6 +12716,122 @@ var planContextUsage = (params) => {
|
|
|
12736
12716
|
return { historyBudget, rawMessageBudget, minTailTokens };
|
|
12737
12717
|
};
|
|
12738
12718
|
|
|
12719
|
+
// packages/ai/context/planCompression.ts
|
|
12720
|
+
var MIN_COMPRESS_COUNT = 5;
|
|
12721
|
+
var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
|
|
12722
|
+
var getMessageTokenCount = (msg) => {
|
|
12723
|
+
if (msg.usage?.completion_tokens) {
|
|
12724
|
+
return msg.usage.completion_tokens;
|
|
12725
|
+
}
|
|
12726
|
+
const content = serializeMessageContent(msg.content) || "";
|
|
12727
|
+
return estimateTokenCount(content);
|
|
12728
|
+
};
|
|
12729
|
+
var hasOpenEndedToolCall = (msg) => !!msg && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
|
|
12730
|
+
var isActiveSummaryWorthDoing = (pendingTokens, contextWindow) => {
|
|
12731
|
+
const minTokens = Math.min(
|
|
12732
|
+
4e4,
|
|
12733
|
+
Math.max(1e4, Math.floor(contextWindow * 0.05))
|
|
12734
|
+
);
|
|
12735
|
+
return pendingTokens >= minTokens;
|
|
12736
|
+
};
|
|
12737
|
+
var classifyConversationLoad = (msgs) => {
|
|
12738
|
+
const N = 20;
|
|
12739
|
+
if (!Array.isArray(msgs) || msgs.length === 0) return "light";
|
|
12740
|
+
const tail = msgs.slice(-N);
|
|
12741
|
+
const tokenSamples = tail.map(getMessageTokenCount);
|
|
12742
|
+
if (tokenSamples.length === 0) return "light";
|
|
12743
|
+
const sum = tokenSamples.reduce((acc, v) => acc + v, 0);
|
|
12744
|
+
const avg = sum / tokenSamples.length;
|
|
12745
|
+
const sorted = [...tokenSamples].sort((a, b) => a - b);
|
|
12746
|
+
const p95 = sorted[Math.floor((sorted.length - 1) * 0.95)];
|
|
12747
|
+
if (p95 < 200 && avg < 120) {
|
|
12748
|
+
return "light";
|
|
12749
|
+
}
|
|
12750
|
+
if (p95 > 2e3 || avg > 1200) {
|
|
12751
|
+
return "heavy";
|
|
12752
|
+
}
|
|
12753
|
+
return "medium";
|
|
12754
|
+
};
|
|
12755
|
+
var emptyPlan = (startIndex) => ({
|
|
12756
|
+
shouldCompress: false,
|
|
12757
|
+
compressCount: 0,
|
|
12758
|
+
msgsToCompress: [],
|
|
12759
|
+
msgsToKeep: [],
|
|
12760
|
+
newSummarizedBeforeId: void 0,
|
|
12761
|
+
startIndex
|
|
12762
|
+
});
|
|
12763
|
+
function planCompression(input) {
|
|
12764
|
+
const {
|
|
12765
|
+
allMsgs,
|
|
12766
|
+
summarizedBeforeId,
|
|
12767
|
+
summary,
|
|
12768
|
+
contextWindow,
|
|
12769
|
+
force = false,
|
|
12770
|
+
reason
|
|
12771
|
+
} = input;
|
|
12772
|
+
let startIndex = 0;
|
|
12773
|
+
if (summarizedBeforeId) {
|
|
12774
|
+
const found = allMsgs.findIndex((m) => m.id === summarizedBeforeId);
|
|
12775
|
+
if (found !== -1) {
|
|
12776
|
+
startIndex = found + 1;
|
|
12777
|
+
}
|
|
12778
|
+
}
|
|
12779
|
+
const pendingMsgs = allMsgs.slice(startIndex);
|
|
12780
|
+
if (pendingMsgs.length === 0) {
|
|
12781
|
+
return emptyPlan(startIndex);
|
|
12782
|
+
}
|
|
12783
|
+
const summaryTokens = estimateTokenCount(summary || "");
|
|
12784
|
+
const pendingTokens = pendingMsgs.reduce(
|
|
12785
|
+
(sum, msg) => sum + getMessageTokenCount(msg),
|
|
12786
|
+
0
|
|
12787
|
+
);
|
|
12788
|
+
const totalUsed = summaryTokens + pendingTokens;
|
|
12789
|
+
const adjustedSummaryTokens = Math.max(summaryTokens, 1e3);
|
|
12790
|
+
const recentLoad = classifyConversationLoad(pendingMsgs);
|
|
12791
|
+
const { historyBudget, rawMessageBudget } = planContextUsage({
|
|
12792
|
+
contextWindow,
|
|
12793
|
+
summaryTokens: adjustedSummaryTokens,
|
|
12794
|
+
recentLoad
|
|
12795
|
+
});
|
|
12796
|
+
const shouldRunActiveSummary = force && reason === "manual" && !hasOpenEndedToolCall(pendingMsgs[pendingMsgs.length - 1]) && isActiveSummaryWorthDoing(pendingTokens, contextWindow);
|
|
12797
|
+
if (totalUsed < historyBudget && !shouldRunActiveSummary) {
|
|
12798
|
+
return emptyPlan(startIndex);
|
|
12799
|
+
}
|
|
12800
|
+
let tokensToKeep = 0;
|
|
12801
|
+
let keepCount = 0;
|
|
12802
|
+
for (let i = pendingMsgs.length - 1; i >= 0; i--) {
|
|
12803
|
+
const t2 = getMessageTokenCount(pendingMsgs[i]);
|
|
12804
|
+
if (tokensToKeep + t2 > rawMessageBudget) break;
|
|
12805
|
+
tokensToKeep += t2;
|
|
12806
|
+
keepCount++;
|
|
12807
|
+
}
|
|
12808
|
+
let compressCount = shouldRunActiveSummary && totalUsed < historyBudget ? Math.max(0, pendingMsgs.length - ACTIVE_SUMMARY_TAIL_KEEP_COUNT) : pendingMsgs.length - keepCount;
|
|
12809
|
+
while (compressCount > 0 && compressCount < pendingMsgs.length && pendingMsgs[compressCount].role === "tool") {
|
|
12810
|
+
compressCount--;
|
|
12811
|
+
}
|
|
12812
|
+
if (compressCount > 0) {
|
|
12813
|
+
const lastCompressed = pendingMsgs[compressCount - 1];
|
|
12814
|
+
const hasToolCalls = Array.isArray(lastCompressed.tool_calls) && lastCompressed.tool_calls.length > 0;
|
|
12815
|
+
if (hasToolCalls) {
|
|
12816
|
+
compressCount--;
|
|
12817
|
+
}
|
|
12818
|
+
}
|
|
12819
|
+
if (compressCount < MIN_COMPRESS_COUNT) {
|
|
12820
|
+
return emptyPlan(startIndex);
|
|
12821
|
+
}
|
|
12822
|
+
const msgsToCompress = pendingMsgs.slice(0, compressCount);
|
|
12823
|
+
const msgsToKeep = pendingMsgs.slice(compressCount);
|
|
12824
|
+
const newSummarizedBeforeId = msgsToCompress[msgsToCompress.length - 1].id;
|
|
12825
|
+
return {
|
|
12826
|
+
shouldCompress: true,
|
|
12827
|
+
compressCount,
|
|
12828
|
+
msgsToCompress,
|
|
12829
|
+
msgsToKeep,
|
|
12830
|
+
newSummarizedBeforeId,
|
|
12831
|
+
startIndex
|
|
12832
|
+
};
|
|
12833
|
+
}
|
|
12834
|
+
|
|
12739
12835
|
// packages/chat/messages/parseJsonRecord.ts
|
|
12740
12836
|
function asOptionalJsonRecord(value) {
|
|
12741
12837
|
if (typeof value === "string") {
|
|
@@ -12826,15 +12922,6 @@ var extractReferenceKeysFromMessage = (msg) => {
|
|
|
12826
12922
|
};
|
|
12827
12923
|
|
|
12828
12924
|
// packages/chat/dialog/actions/updateDialogSummaryAction.ts
|
|
12829
|
-
var MIN_COMPRESS_COUNT = 5;
|
|
12830
|
-
var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
|
|
12831
|
-
var getMessageTokenCount = (msg) => {
|
|
12832
|
-
if (msg.usage?.completion_tokens) {
|
|
12833
|
-
return msg.usage.completion_tokens;
|
|
12834
|
-
}
|
|
12835
|
-
const content = serializeMessageContent(msg.content) || "";
|
|
12836
|
-
return estimateTokenCount(content);
|
|
12837
|
-
};
|
|
12838
12925
|
var getMessagesForDialogFromState = (state3, dialogId) => {
|
|
12839
12926
|
const msgsState = state3.message.dialogStateById[dialogId]?.msgs;
|
|
12840
12927
|
if (!msgsState || !msgsState.ids) return [];
|
|
@@ -12847,45 +12934,6 @@ var formatMessagesForSummary = (msgs) => msgs.map((m) => {
|
|
|
12847
12934
|
const content = serializeMessageContent(m.content) || "[\u975E\u6587\u672C\u5185\u5BB9]";
|
|
12848
12935
|
return `${m.role}: ${content}`;
|
|
12849
12936
|
}).join("\n");
|
|
12850
|
-
var findMessageIndexById = (msgs, id) => id ? msgs.findIndex((m) => m.id === id) : -1;
|
|
12851
|
-
var hasOpenEndedToolCall = (msg) => !!msg && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
|
|
12852
|
-
var buildPreviousSummaryWithProactive = (dialogConfig, shouldConsumeProactive) => {
|
|
12853
|
-
const base = dialogConfig.summary || "";
|
|
12854
|
-
const proactive = shouldConsumeProactive ? dialogConfig.proactiveSummary || "" : "";
|
|
12855
|
-
if (!base && !proactive) return "";
|
|
12856
|
-
if (!proactive) return base;
|
|
12857
|
-
if (!base) return `\u3010\u4E3B\u52A8\u5DE5\u4F5C\u6458\u8981\u3011
|
|
12858
|
-
${proactive}`;
|
|
12859
|
-
return `${base}
|
|
12860
|
-
|
|
12861
|
-
\u3010\u4E3B\u52A8\u5DE5\u4F5C\u6458\u8981\u3011
|
|
12862
|
-
${proactive}`;
|
|
12863
|
-
};
|
|
12864
|
-
var isActiveSummaryWorthDoing = (pendingTokens, contextWindow) => {
|
|
12865
|
-
const minTokens = Math.min(
|
|
12866
|
-
4e4,
|
|
12867
|
-
Math.max(1e4, Math.floor(contextWindow * 0.05))
|
|
12868
|
-
);
|
|
12869
|
-
return pendingTokens >= minTokens;
|
|
12870
|
-
};
|
|
12871
|
-
var classifyConversationLoad = (msgs) => {
|
|
12872
|
-
const N = 20;
|
|
12873
|
-
if (!Array.isArray(msgs) || msgs.length === 0) return "light";
|
|
12874
|
-
const tail = msgs.slice(-N);
|
|
12875
|
-
const tokenSamples = tail.map(getMessageTokenCount);
|
|
12876
|
-
if (tokenSamples.length === 0) return "light";
|
|
12877
|
-
const sum = tokenSamples.reduce((acc, v) => acc + v, 0);
|
|
12878
|
-
const avg = sum / tokenSamples.length;
|
|
12879
|
-
const sorted = [...tokenSamples].sort((a, b) => a - b);
|
|
12880
|
-
const p95 = sorted[Math.floor((sorted.length - 1) * 0.95)];
|
|
12881
|
-
if (p95 < 200 && avg < 120) {
|
|
12882
|
-
return "light";
|
|
12883
|
-
}
|
|
12884
|
-
if (p95 > 2e3 || avg > 1200) {
|
|
12885
|
-
return "heavy";
|
|
12886
|
-
}
|
|
12887
|
-
return "medium";
|
|
12888
|
-
};
|
|
12889
12937
|
var summarizingDialogs = /* @__PURE__ */ new Set();
|
|
12890
12938
|
var updateDialogSummaryAction = async (args, thunkApi) => {
|
|
12891
12939
|
const { dialogKey, preFetchedMessages, force = false } = args;
|
|
@@ -12906,69 +12954,23 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
|
|
|
12906
12954
|
}
|
|
12907
12955
|
}
|
|
12908
12956
|
const allMsgs = preFetchedMessages || getMessagesForDialogFromState(state3, dialogId);
|
|
12909
|
-
const
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
if (found !== -1) {
|
|
12914
|
-
startIndex = found + 1;
|
|
12915
|
-
}
|
|
12916
|
-
}
|
|
12917
|
-
const pendingMsgs = allMsgs.slice(startIndex);
|
|
12918
|
-
if (pendingMsgs.length === 0) return;
|
|
12919
|
-
const summaryTokens = estimateTokenCount(dialogConfig.summary || "");
|
|
12920
|
-
const pendingTokens = pendingMsgs.reduce((sum, msg) => sum + getMessageTokenCount(msg), 0);
|
|
12921
|
-
const totalUsed = summaryTokens + pendingTokens;
|
|
12922
|
-
const adjustedSummaryTokens = Math.max(summaryTokens, 1e3);
|
|
12923
|
-
const recentLoad = classifyConversationLoad(pendingMsgs);
|
|
12924
|
-
const { historyBudget, rawMessageBudget } = planContextUsage({
|
|
12957
|
+
const plan = planCompression({
|
|
12958
|
+
allMsgs,
|
|
12959
|
+
summarizedBeforeId: dialogConfig.summarizedBeforeId,
|
|
12960
|
+
summary: dialogConfig.summary || "",
|
|
12925
12961
|
contextWindow,
|
|
12926
|
-
|
|
12927
|
-
|
|
12962
|
+
force,
|
|
12963
|
+
reason: args.reason
|
|
12928
12964
|
});
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
return;
|
|
12932
|
-
}
|
|
12933
|
-
let tokensToKeep = 0;
|
|
12934
|
-
let keepCount = 0;
|
|
12935
|
-
for (let i = pendingMsgs.length - 1; i >= 0; i--) {
|
|
12936
|
-
const t2 = getMessageTokenCount(pendingMsgs[i]);
|
|
12937
|
-
if (tokensToKeep + t2 > rawMessageBudget) break;
|
|
12938
|
-
tokensToKeep += t2;
|
|
12939
|
-
keepCount++;
|
|
12940
|
-
}
|
|
12941
|
-
let compressCount = shouldRunActiveSummary && totalUsed < historyBudget ? Math.max(0, pendingMsgs.length - ACTIVE_SUMMARY_TAIL_KEEP_COUNT) : pendingMsgs.length - keepCount;
|
|
12942
|
-
while (compressCount > 0 && compressCount < pendingMsgs.length && pendingMsgs[compressCount].role === "tool") {
|
|
12943
|
-
compressCount--;
|
|
12944
|
-
}
|
|
12945
|
-
if (compressCount > 0) {
|
|
12946
|
-
const lastCompressed = pendingMsgs[compressCount - 1];
|
|
12947
|
-
const hasToolCalls = Array.isArray(lastCompressed.tool_calls) && lastCompressed.tool_calls.length > 0;
|
|
12948
|
-
if (hasToolCalls) {
|
|
12949
|
-
compressCount--;
|
|
12950
|
-
}
|
|
12951
|
-
}
|
|
12952
|
-
if (compressCount < MIN_COMPRESS_COUNT) {
|
|
12953
|
-
return;
|
|
12954
|
-
}
|
|
12955
|
-
const msgsToCompress = pendingMsgs.slice(0, compressCount);
|
|
12956
|
-
const newSummarizedBeforeId = msgsToCompress[msgsToCompress.length - 1].id;
|
|
12965
|
+
if (!plan.shouldCompress) return;
|
|
12966
|
+
const { msgsToCompress, newSummarizedBeforeId } = plan;
|
|
12957
12967
|
const extractedKeys = new Set(dialogConfig.referenceKeys || []);
|
|
12958
12968
|
for (const msg of msgsToCompress) {
|
|
12959
12969
|
for (const key of extractReferenceKeysFromMessage(msg)) {
|
|
12960
12970
|
extractedKeys.add(key);
|
|
12961
12971
|
}
|
|
12962
12972
|
}
|
|
12963
|
-
const
|
|
12964
|
-
allMsgs,
|
|
12965
|
-
dialogConfig.proactiveSummaryBeforeId
|
|
12966
|
-
);
|
|
12967
|
-
const shouldConsumeProactive = !!dialogConfig.proactiveSummary && proactiveBeforeIndex !== -1 && proactiveBeforeIndex < startIndex + compressCount;
|
|
12968
|
-
const previousSummary = buildPreviousSummaryWithProactive(
|
|
12969
|
-
dialogConfig,
|
|
12970
|
-
shouldConsumeProactive
|
|
12971
|
-
);
|
|
12973
|
+
const previousSummary = dialogConfig.summary || "";
|
|
12972
12974
|
const messagesText = formatMessagesForSummary(msgsToCompress);
|
|
12973
12975
|
const promptContent = buildBuiltinSummaryContent(
|
|
12974
12976
|
previousSummary,
|
|
@@ -12992,16 +12994,12 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
|
|
|
12992
12994
|
summarizedBeforeId: newSummarizedBeforeId,
|
|
12993
12995
|
referenceKeys: Array.from(extractedKeys),
|
|
12994
12996
|
compressionCount: currentCount + 1,
|
|
12995
|
-
summaryPending: false
|
|
12997
|
+
summaryPending: false
|
|
12996
12998
|
// Explicitly clear pending flag
|
|
12997
|
-
...shouldConsumeProactive ? {
|
|
12998
|
-
proactiveSummary: "",
|
|
12999
|
-
proactiveSummaryBeforeId: void 0
|
|
13000
|
-
} : {}
|
|
13001
12999
|
}
|
|
13002
13000
|
})
|
|
13003
13001
|
).unwrap();
|
|
13004
|
-
console.log(`[ContextCompression] Compressed ${compressCount} messages. New summary len: ${newSummary.length}`);
|
|
13002
|
+
console.log(`[ContextCompression] Compressed ${plan.compressCount} messages. New summary len: ${newSummary.length}`);
|
|
13005
13003
|
}
|
|
13006
13004
|
} catch (err) {
|
|
13007
13005
|
console.error("[ContextCompression] Failed:", err);
|
|
@@ -13385,7 +13383,7 @@ var estimateMissingUsage = ({
|
|
|
13385
13383
|
Math.ceil(text.length / APPROX_CHARS_PER_TOKEN)
|
|
13386
13384
|
);
|
|
13387
13385
|
return {
|
|
13388
|
-
input_tokens:
|
|
13386
|
+
input_tokens: 0,
|
|
13389
13387
|
output_tokens: estimatedOutputTokens,
|
|
13390
13388
|
cache_creation_input_tokens: 0,
|
|
13391
13389
|
cache_read_input_tokens: 0,
|
|
@@ -14039,7 +14037,7 @@ async function captureUnderstandingFromCompletedUiTurn(input) {
|
|
|
14039
14037
|
if (!input.agentKey) return;
|
|
14040
14038
|
const latestUserInput = getLatestUserInputFromMessages(input.messages);
|
|
14041
14039
|
if (!latestUserInput) return;
|
|
14042
|
-
const { captureUnderstandingMemoryFromDialog } = await import("./understanding-
|
|
14040
|
+
const { captureUnderstandingMemoryFromDialog } = await import("./understanding-GQKNDDWM.js");
|
|
14043
14041
|
await captureUnderstandingMemoryFromDialog({
|
|
14044
14042
|
db: input.db,
|
|
14045
14043
|
userId: selectIdentityUserId(input.state),
|
|
@@ -14949,9 +14947,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
14949
14947
|
dbKey: dialogKey,
|
|
14950
14948
|
changes: {
|
|
14951
14949
|
summary: null,
|
|
14952
|
-
summarizedBeforeId: null
|
|
14953
|
-
proactiveSummary: null,
|
|
14954
|
-
proactiveSummaryBeforeId: null
|
|
14950
|
+
summarizedBeforeId: null
|
|
14955
14951
|
}
|
|
14956
14952
|
})
|
|
14957
14953
|
).unwrap();
|
|
@@ -14966,7 +14962,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
14966
14962
|
runtimeOptions: args.runtimeOptions
|
|
14967
14963
|
});
|
|
14968
14964
|
if (agentKeyToUse) {
|
|
14969
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
14965
|
+
const { streamAgentChatTurn } = await import("./agentSlice-3WXXN4VK.js");
|
|
14970
14966
|
await dispatch(
|
|
14971
14967
|
streamAgentChatTurn({
|
|
14972
14968
|
agentKey: agentKeyToUse,
|
|
@@ -15105,12 +15101,9 @@ var saveTokenRecord = async (tokenData, record, thunkApi) => {
|
|
|
15105
15101
|
write({
|
|
15106
15102
|
data: { ...record, id: key, type: "token" /* TOKEN */, userId: ownerUserId },
|
|
15107
15103
|
customKey: key,
|
|
15108
|
-
// writeAction stamps record.userId from writeConfig.userId ||
|
|
15109
|
-
// currentUserId; without this, logged-out local token rows lose
|
|
15110
|
-
// the authoritative "local" owner before replication planning.
|
|
15111
15104
|
userId: ownerUserId
|
|
15112
15105
|
})
|
|
15113
|
-
);
|
|
15106
|
+
).unwrap();
|
|
15114
15107
|
} catch (error) {
|
|
15115
15108
|
logger2.error(
|
|
15116
15109
|
{
|
|
@@ -16793,6 +16786,10 @@ var selectCurrentToken = (state3) => state3.auth.currentToken;
|
|
|
16793
16786
|
var selectCurrentUserBalance = (state3) => state3.auth.currentUser?.balance;
|
|
16794
16787
|
|
|
16795
16788
|
// packages/ai/token/calculatePrice.ts
|
|
16789
|
+
var sanitizeCost = (raw) => {
|
|
16790
|
+
const rounded = Number(raw.toFixed(6));
|
|
16791
|
+
return Number.isFinite(rounded) && rounded > 0 ? rounded : 0;
|
|
16792
|
+
};
|
|
16796
16793
|
var resolveModelPrice = (model, usage) => {
|
|
16797
16794
|
let activePrice = { ...model.price };
|
|
16798
16795
|
if (model.pricingStrategy?.type === "tiered_context") {
|
|
@@ -17068,7 +17065,7 @@ var calculatePrice = ({
|
|
|
17068
17065
|
billingServiceTier
|
|
17069
17066
|
);
|
|
17070
17067
|
const pay2 = calculatePayDistribution(costs2, externalPrice, sharingLevel);
|
|
17071
|
-
return { cost:
|
|
17068
|
+
return { cost: sanitizeCost(costs2.charge), pay: pay2 };
|
|
17072
17069
|
}
|
|
17073
17070
|
const costs = calculateBasicCost(
|
|
17074
17071
|
model,
|
|
@@ -17089,7 +17086,7 @@ var calculatePrice = ({
|
|
|
17089
17086
|
} : costs;
|
|
17090
17087
|
const pay = calculatePayDistribution(adjustedCosts, externalPrice, sharingLevel);
|
|
17091
17088
|
return {
|
|
17092
|
-
cost:
|
|
17089
|
+
cost: sanitizeCost(adjustedCosts.charge),
|
|
17093
17090
|
pay
|
|
17094
17091
|
};
|
|
17095
17092
|
};
|
|
@@ -17189,7 +17186,59 @@ var resolveBillingTarget = ({
|
|
|
17189
17186
|
};
|
|
17190
17187
|
};
|
|
17191
17188
|
|
|
17189
|
+
// packages/agent-runtime/serverProxyPolicy.ts
|
|
17190
|
+
var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
|
|
17191
|
+
"antigravity",
|
|
17192
|
+
"xai",
|
|
17193
|
+
"chatgpt",
|
|
17194
|
+
"claude",
|
|
17195
|
+
"cursor"
|
|
17196
|
+
]);
|
|
17197
|
+
function isGoogleFamilyProvider(provider) {
|
|
17198
|
+
const normalized = asTrimmedLowercaseString(provider);
|
|
17199
|
+
return normalized === "google" || normalized.startsWith("google-");
|
|
17200
|
+
}
|
|
17201
|
+
function isOAuthApiKeyRef(value) {
|
|
17202
|
+
const ref = asTrimmedLowercaseString(value);
|
|
17203
|
+
return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
|
|
17204
|
+
}
|
|
17205
|
+
function shouldUseServerProxy(agentConfig, requestProvider) {
|
|
17206
|
+
const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
|
|
17207
|
+
if (isGoogleFamilyProvider(effectiveProvider)) {
|
|
17208
|
+
return true;
|
|
17209
|
+
}
|
|
17210
|
+
if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
|
|
17211
|
+
return true;
|
|
17212
|
+
}
|
|
17213
|
+
if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
|
|
17214
|
+
return true;
|
|
17215
|
+
}
|
|
17216
|
+
return !!agentConfig.useServerProxy;
|
|
17217
|
+
}
|
|
17218
|
+
var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
|
|
17219
|
+
function isRemoteCustomEndpoint(url) {
|
|
17220
|
+
if (typeof url !== "string") return false;
|
|
17221
|
+
try {
|
|
17222
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
17223
|
+
return !LOCAL_HOSTS.has(host);
|
|
17224
|
+
} catch {
|
|
17225
|
+
return false;
|
|
17226
|
+
}
|
|
17227
|
+
}
|
|
17228
|
+
|
|
17192
17229
|
// packages/ai/token/prepareTokenUsageData.ts
|
|
17230
|
+
function resolveBillable(input) {
|
|
17231
|
+
const uid = input.userId?.trim();
|
|
17232
|
+
if (!uid || uid === "local") return false;
|
|
17233
|
+
const apiSource = input.apiSource;
|
|
17234
|
+
if (apiSource === "cli") return false;
|
|
17235
|
+
if (isOAuthApiKeyRef(input.apiKeyRef)) return false;
|
|
17236
|
+
if (input.cost <= 0) return false;
|
|
17237
|
+
if (apiSource === "platform") return true;
|
|
17238
|
+
if (apiSource === "custom") return input.hasExternalPrice;
|
|
17239
|
+
if (apiSource == null || apiSource === "") return true;
|
|
17240
|
+
return false;
|
|
17241
|
+
}
|
|
17193
17242
|
var prepareTokenUsageData = ({
|
|
17194
17243
|
rawUsage,
|
|
17195
17244
|
agentConfig,
|
|
@@ -17209,18 +17258,27 @@ var prepareTokenUsageData = ({
|
|
|
17209
17258
|
const billedModel = billingTarget.model;
|
|
17210
17259
|
const billedServiceTier = billingTarget.serviceTier;
|
|
17211
17260
|
const recordProvider = billedProvider ?? agentConfig.provider ?? "unknown";
|
|
17261
|
+
const hasExternalPrice = agentConfig.inputPrice !== void 0 && agentConfig.inputPrice > 0 || agentConfig.outputPrice !== void 0 && agentConfig.outputPrice > 0;
|
|
17212
17262
|
const { cost, pay } = calculatePrice({
|
|
17213
17263
|
provider: billedProvider,
|
|
17214
17264
|
modelName: billedModel,
|
|
17215
17265
|
billingServiceTier: billedServiceTier,
|
|
17216
17266
|
usage,
|
|
17217
|
-
externalPrice:
|
|
17267
|
+
externalPrice: hasExternalPrice ? {
|
|
17218
17268
|
input: agentConfig.inputPrice ?? 0,
|
|
17219
17269
|
output: agentConfig.outputPrice ?? 0,
|
|
17220
|
-
creatorId: agentConfig.userId ?? extractUserId(agentConfig.id)
|
|
17270
|
+
creatorId: agentConfig.userId ?? (agentConfig.id ? extractUserId(agentConfig.id) : "")
|
|
17221
17271
|
} : void 0,
|
|
17222
17272
|
sharingLevel: agentConfig.sharingLevel
|
|
17223
17273
|
});
|
|
17274
|
+
const billable = resolveBillable({
|
|
17275
|
+
usage,
|
|
17276
|
+
userId,
|
|
17277
|
+
apiSource: agentConfig.apiSource,
|
|
17278
|
+
apiKeyRef: agentConfig.apiKeyRef,
|
|
17279
|
+
cost,
|
|
17280
|
+
hasExternalPrice
|
|
17281
|
+
});
|
|
17224
17282
|
return {
|
|
17225
17283
|
usage,
|
|
17226
17284
|
billedProvider,
|
|
@@ -17238,11 +17296,66 @@ var prepareTokenUsageData = ({
|
|
|
17238
17296
|
dialogId,
|
|
17239
17297
|
cost,
|
|
17240
17298
|
pay,
|
|
17241
|
-
timestamp
|
|
17299
|
+
timestamp,
|
|
17300
|
+
billable
|
|
17242
17301
|
}
|
|
17243
17302
|
};
|
|
17244
17303
|
};
|
|
17245
17304
|
|
|
17305
|
+
// packages/ai/token/applyTokenUsageToDayStats.ts
|
|
17306
|
+
var ZERO_STATS = { count: 0, tokens: { input: 0, output: 0 }, cost: 0 };
|
|
17307
|
+
function applyTokenUsageToDayStats(prev, delta) {
|
|
17308
|
+
const base = prev ?? {
|
|
17309
|
+
userId: delta.userId,
|
|
17310
|
+
period: "day",
|
|
17311
|
+
timeKey: delta.timeKey,
|
|
17312
|
+
total: { ...ZERO_STATS },
|
|
17313
|
+
models: {},
|
|
17314
|
+
providers: {}
|
|
17315
|
+
};
|
|
17316
|
+
const modelName = delta.model || "unknown";
|
|
17317
|
+
const providerName2 = delta.provider || "unknown";
|
|
17318
|
+
const inc = (s) => ({
|
|
17319
|
+
count: (s?.count ?? 0) + 1,
|
|
17320
|
+
tokens: {
|
|
17321
|
+
input: (s?.tokens.input ?? 0) + delta.input_tokens,
|
|
17322
|
+
output: (s?.tokens.output ?? 0) + delta.output_tokens
|
|
17323
|
+
},
|
|
17324
|
+
cost: Number(((s?.cost ?? 0) + delta.cost).toFixed(6))
|
|
17325
|
+
});
|
|
17326
|
+
return {
|
|
17327
|
+
...base,
|
|
17328
|
+
total: inc(base.total),
|
|
17329
|
+
models: {
|
|
17330
|
+
...base.models,
|
|
17331
|
+
[modelName]: inc(base.models[modelName])
|
|
17332
|
+
},
|
|
17333
|
+
providers: {
|
|
17334
|
+
...base.providers,
|
|
17335
|
+
[providerName2]: inc(base.providers[providerName2])
|
|
17336
|
+
}
|
|
17337
|
+
};
|
|
17338
|
+
}
|
|
17339
|
+
|
|
17340
|
+
// packages/core/keyedTaskQueue.ts
|
|
17341
|
+
var queues = /* @__PURE__ */ new Map();
|
|
17342
|
+
async function runKeyed(key, task) {
|
|
17343
|
+
const previous = queues.get(key) ?? Promise.resolve();
|
|
17344
|
+
const next = previous.catch(() => void 0).then(task);
|
|
17345
|
+
const cleanup = next.then(
|
|
17346
|
+
() => void 0,
|
|
17347
|
+
() => void 0
|
|
17348
|
+
);
|
|
17349
|
+
queues.set(key, cleanup);
|
|
17350
|
+
try {
|
|
17351
|
+
return await next;
|
|
17352
|
+
} finally {
|
|
17353
|
+
if (queues.get(key) === cleanup) {
|
|
17354
|
+
queues.delete(key);
|
|
17355
|
+
}
|
|
17356
|
+
}
|
|
17357
|
+
}
|
|
17358
|
+
|
|
17246
17359
|
// packages/chat/dialog/actions/updateTokensAction.ts
|
|
17247
17360
|
var logger3 = (0, import_pino2.pino)({ name: "token-usage", level: "info" });
|
|
17248
17361
|
var dialogTokenPatchQueue = /* @__PURE__ */ new Map();
|
|
@@ -17262,53 +17375,26 @@ var queueDialogTokenPatch = async (dialogKey, task) => {
|
|
|
17262
17375
|
}
|
|
17263
17376
|
}
|
|
17264
17377
|
};
|
|
17265
|
-
var updateStatsCounter = (data, stats = { count: 0, tokens: { input: 0, output: 0 }, cost: 0 }) => ({
|
|
17266
|
-
count: stats.count + 1,
|
|
17267
|
-
tokens: {
|
|
17268
|
-
input: stats.tokens.input + data.input_tokens,
|
|
17269
|
-
output: stats.tokens.output + data.output_tokens
|
|
17270
|
-
},
|
|
17271
|
-
cost: stats.cost + data.cost
|
|
17272
|
-
});
|
|
17273
17378
|
var updateStats = async (data, existingStats, key, thunkApi) => {
|
|
17274
17379
|
try {
|
|
17275
|
-
const
|
|
17276
|
-
|
|
17277
|
-
|
|
17278
|
-
timeKey:
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17282
|
-
|
|
17283
|
-
|
|
17284
|
-
|
|
17285
|
-
const cleanModels = Object.fromEntries(
|
|
17286
|
-
Object.entries(stats.models).filter(
|
|
17287
|
-
([key2]) => !["unknown", "undefined"].includes(key2)
|
|
17288
|
-
)
|
|
17289
|
-
);
|
|
17290
|
-
const updatedStats = {
|
|
17291
|
-
...stats,
|
|
17292
|
-
total: updateStatsCounter(data, stats.total),
|
|
17293
|
-
models: {
|
|
17294
|
-
...cleanModels,
|
|
17295
|
-
[modelName]: updateStatsCounter(data, cleanModels[modelName])
|
|
17296
|
-
},
|
|
17297
|
-
providers: {
|
|
17298
|
-
...stats.providers,
|
|
17299
|
-
[providerName2]: updateStatsCounter(data, stats.providers[providerName2])
|
|
17300
|
-
}
|
|
17301
|
-
};
|
|
17380
|
+
const dateKey = (0, import_date_fns.format)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
|
|
17381
|
+
const newStats = applyTokenUsageToDayStats(existingStats, {
|
|
17382
|
+
userId: data.userId ?? "",
|
|
17383
|
+
timeKey: dateKey,
|
|
17384
|
+
model: data.model || "unknown",
|
|
17385
|
+
provider: data.provider || "unknown",
|
|
17386
|
+
input_tokens: data.input_tokens,
|
|
17387
|
+
output_tokens: data.output_tokens,
|
|
17388
|
+
cost: data.cost
|
|
17389
|
+
});
|
|
17302
17390
|
await thunkApi.dispatch(
|
|
17303
17391
|
write({
|
|
17304
|
-
data: { ...
|
|
17392
|
+
data: { ...newStats, id: key, type: "token" /* TOKEN */ },
|
|
17305
17393
|
customKey: key,
|
|
17306
|
-
// Must stamp owner on writeConfig: writeAction overwrites data.userId
|
|
17307
|
-
// from writeConfig.userId || currentUserId (empty when logged out).
|
|
17308
17394
|
userId: data.userId
|
|
17309
17395
|
})
|
|
17310
|
-
);
|
|
17311
|
-
return
|
|
17396
|
+
).unwrap();
|
|
17397
|
+
return newStats;
|
|
17312
17398
|
} catch (error) {
|
|
17313
17399
|
logger3.error(
|
|
17314
17400
|
{ key, userId: data.userId, error: error.message },
|
|
@@ -17319,45 +17405,47 @@ var updateStats = async (data, existingStats, key, thunkApi) => {
|
|
|
17319
17405
|
}
|
|
17320
17406
|
};
|
|
17321
17407
|
var saveTokenUsage = async (data, thunkApi) => {
|
|
17322
|
-
const dateKey = (0, import_date_fns.format)(Date.now(), "yyyy-MM-dd");
|
|
17408
|
+
const dateKey = (0, import_date_fns.format)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
|
|
17323
17409
|
const tokenDayStatsKey = createTokenStatsKey(data.userId ?? "", dateKey);
|
|
17324
|
-
|
|
17325
|
-
let currentStats = null;
|
|
17410
|
+
return runKeyed(tokenDayStatsKey, async () => {
|
|
17326
17411
|
try {
|
|
17327
|
-
currentStats =
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17412
|
+
let currentStats = null;
|
|
17413
|
+
try {
|
|
17414
|
+
currentStats = await thunkApi.dispatch(read({
|
|
17415
|
+
dbKey: tokenDayStatsKey
|
|
17416
|
+
})).unwrap();
|
|
17417
|
+
} catch (err) {
|
|
17418
|
+
logger3.warn({ tokenDayStatsKey }, "No existing stats found");
|
|
17419
|
+
}
|
|
17420
|
+
const updatedStats = await updateStats(
|
|
17421
|
+
data,
|
|
17422
|
+
currentStats,
|
|
17423
|
+
tokenDayStatsKey,
|
|
17424
|
+
thunkApi
|
|
17425
|
+
);
|
|
17426
|
+
return {
|
|
17427
|
+
success: true,
|
|
17428
|
+
id: (0, import_ulid2.ulid)(Date.now()),
|
|
17429
|
+
record: updatedStats
|
|
17430
|
+
};
|
|
17431
|
+
} catch (error) {
|
|
17432
|
+
logger3.error(
|
|
17433
|
+
{
|
|
17434
|
+
key: tokenDayStatsKey,
|
|
17435
|
+
userId: data.userId,
|
|
17436
|
+
error: error.message,
|
|
17437
|
+
tokenData: {
|
|
17438
|
+
input: data.input_tokens,
|
|
17439
|
+
output: data.output_tokens,
|
|
17440
|
+
model: data.model
|
|
17441
|
+
}
|
|
17442
|
+
},
|
|
17443
|
+
"Failed to process token usage"
|
|
17444
|
+
);
|
|
17445
|
+
toast.error("Failed to process token usage");
|
|
17446
|
+
throw error;
|
|
17332
17447
|
}
|
|
17333
|
-
|
|
17334
|
-
data,
|
|
17335
|
-
currentStats,
|
|
17336
|
-
tokenDayStatsKey,
|
|
17337
|
-
thunkApi
|
|
17338
|
-
);
|
|
17339
|
-
return {
|
|
17340
|
-
success: true,
|
|
17341
|
-
id: (0, import_ulid2.ulid)(Date.now()),
|
|
17342
|
-
record: updatedStats
|
|
17343
|
-
};
|
|
17344
|
-
} catch (error) {
|
|
17345
|
-
logger3.error(
|
|
17346
|
-
{
|
|
17347
|
-
key: tokenDayStatsKey,
|
|
17348
|
-
userId: data.userId,
|
|
17349
|
-
error: error.message,
|
|
17350
|
-
tokenData: {
|
|
17351
|
-
input: data.input_tokens,
|
|
17352
|
-
output: data.output_tokens,
|
|
17353
|
-
model: data.model
|
|
17354
|
-
}
|
|
17355
|
-
},
|
|
17356
|
-
"Failed to process token usage"
|
|
17357
|
-
);
|
|
17358
|
-
toast.error("Failed to process token usage");
|
|
17359
|
-
throw error;
|
|
17360
|
-
}
|
|
17448
|
+
});
|
|
17361
17449
|
};
|
|
17362
17450
|
var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentConfig }, thunkApi) => {
|
|
17363
17451
|
const state3 = thunkApi.getState();
|
|
@@ -17398,7 +17486,7 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: usageRaw, agentCon
|
|
|
17398
17486
|
});
|
|
17399
17487
|
await saveTokenRecord(persistedTokenData, record, thunkApi);
|
|
17400
17488
|
await saveTokenUsage(persistedTokenData, thunkApi);
|
|
17401
|
-
if (result.cost > 0) {
|
|
17489
|
+
if (persistedTokenData.billable === true || persistedTokenData.billable === void 0 && result.cost > 0) {
|
|
17402
17490
|
thunkApi.dispatch(deductBalance(result.cost));
|
|
17403
17491
|
}
|
|
17404
17492
|
if (dialogKey) {
|
|
@@ -17574,7 +17662,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
17574
17662
|
}
|
|
17575
17663
|
if (isCurrentDialog) {
|
|
17576
17664
|
await thunkApi.dispatch(resetMsgs());
|
|
17577
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
17665
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-JSBNZRLR.js");
|
|
17578
17666
|
dispatch(clearPendingAttachments2());
|
|
17579
17667
|
clearWorkflow();
|
|
17580
17668
|
}
|
|
@@ -17583,35 +17671,35 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
17583
17671
|
|
|
17584
17672
|
// packages/chat/dialog/dialogSlice.ts
|
|
17585
17673
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
17586
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
17674
|
+
const { createDialogAction } = await import("./createDialogAction-ZLYZDYBB.js");
|
|
17587
17675
|
return createDialogAction(args, thunkApi);
|
|
17588
17676
|
};
|
|
17589
17677
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
17590
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
17678
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-63OIP6X5.js");
|
|
17591
17679
|
return createAgentAutomationAction(args, thunkApi);
|
|
17592
17680
|
};
|
|
17593
17681
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
17594
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
17682
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-ZTWRDXI2.js");
|
|
17595
17683
|
return updateDialogTitleAction(args, thunkApi);
|
|
17596
17684
|
};
|
|
17597
17685
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
17598
|
-
const { addDialogAgentAction } = await import("./addDialogAgentAction-
|
|
17686
|
+
const { addDialogAgentAction } = await import("./addDialogAgentAction-EKH774VT.js");
|
|
17599
17687
|
return addDialogAgentAction(args, thunkApi);
|
|
17600
17688
|
};
|
|
17601
17689
|
var runRemoveDialogAgentAction = async (args, thunkApi) => {
|
|
17602
|
-
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-
|
|
17690
|
+
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-GJQJNDW6.js");
|
|
17603
17691
|
return removeDialogAgentAction(args, thunkApi);
|
|
17604
17692
|
};
|
|
17605
17693
|
var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
|
|
17606
|
-
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-
|
|
17694
|
+
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-46UNFJDL.js");
|
|
17607
17695
|
return setPrimaryDialogAgentAction(args, thunkApi);
|
|
17608
17696
|
};
|
|
17609
17697
|
var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
17610
|
-
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-
|
|
17698
|
+
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-M7OQG54N.js");
|
|
17611
17699
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
17612
17700
|
};
|
|
17613
17701
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
17614
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
17702
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-IJDQ6ARA.js");
|
|
17615
17703
|
return handleSendMessageAction(args, thunkApi);
|
|
17616
17704
|
};
|
|
17617
17705
|
function clearDialogState() {
|
|
@@ -17624,7 +17712,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
17624
17712
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
17625
17713
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
17626
17714
|
try {
|
|
17627
|
-
const { createDocState } = await import("./docStore-
|
|
17715
|
+
const { createDocState } = await import("./docStore-ADP5VYY4.js");
|
|
17628
17716
|
const pageKey = await createDocState(
|
|
17629
17717
|
{ slateData, title },
|
|
17630
17718
|
{ dispatch, getState }
|
|
@@ -23764,7 +23852,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
|
|
|
23764
23852
|
const spaceKey = createSpaceKey.space(spaceId);
|
|
23765
23853
|
const readSpace = async (dbKey) => {
|
|
23766
23854
|
try {
|
|
23767
|
-
const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-
|
|
23855
|
+
const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-PR44QPXY.js");
|
|
23768
23856
|
if (fresh) {
|
|
23769
23857
|
return await dispatch(readAndWait2(dbKey)).unwrap();
|
|
23770
23858
|
}
|
|
@@ -24554,7 +24642,6 @@ var selectViewMode = createSelector(
|
|
|
24554
24642
|
var spaceSlice_default = spaceSlice.reducer;
|
|
24555
24643
|
|
|
24556
24644
|
export {
|
|
24557
|
-
BUILTIN_TITLE_LLM_CONFIG,
|
|
24558
24645
|
instance,
|
|
24559
24646
|
initReactI18next,
|
|
24560
24647
|
i18nBaseConfig,
|
|
@@ -24562,10 +24649,12 @@ export {
|
|
|
24562
24649
|
fetchAndCacheMessages,
|
|
24563
24650
|
buildDatabaseFileContentUrl,
|
|
24564
24651
|
serializeMessageContent,
|
|
24652
|
+
DEFAULT_CONTEXT_WINDOW,
|
|
24565
24653
|
getModelContextWindow,
|
|
24566
24654
|
getModelInfo,
|
|
24567
24655
|
estimateTokenCount,
|
|
24568
24656
|
planContextUsage,
|
|
24657
|
+
planCompression,
|
|
24569
24658
|
extractReferenceKeysFromMessage,
|
|
24570
24659
|
normalizeAppRouteId,
|
|
24571
24660
|
uiAskChoiceFunctionSchema,
|
|
@@ -24574,6 +24663,7 @@ export {
|
|
|
24574
24663
|
PERSONALIZATION_DIALOG_CATEGORY,
|
|
24575
24664
|
buildPersonalizationDialogPolicyContext,
|
|
24576
24665
|
resolveHandleSendMessageContext,
|
|
24666
|
+
estimateMissingUsage,
|
|
24577
24667
|
selectCurrentDialogId,
|
|
24578
24668
|
selectAllMsgs,
|
|
24579
24669
|
selectMsgById,
|
|
@@ -24650,6 +24740,7 @@ export {
|
|
|
24650
24740
|
selectViewMode,
|
|
24651
24741
|
spaceSlice_default,
|
|
24652
24742
|
selectCurrentUserBalance,
|
|
24743
|
+
shouldUseServerProxy,
|
|
24653
24744
|
updateTokensAction,
|
|
24654
24745
|
clearDialogState,
|
|
24655
24746
|
createPageAndAddReference,
|