nolo-cli 0.29.1 → 0.30.0-alpha.1

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.
Files changed (138) hide show
  1. package/{_executeModel-TN7FW73L.js → _executeModel-VBHHG7LT.js} +62 -68
  2. package/{action-6BM26ZYM.js → action-FENWPT3C.js} +14 -15
  3. package/{addContentAction-HLTFX56O.js → addContentAction-Z5S5ZQ7I.js} +12 -12
  4. package/{addDialogAgentAction-Q2TYWDO6.js → addDialogAgentAction-VUNVD2XR.js} +11 -11
  5. package/{agentDeleteCommand-VP4VLCMG.js → agentDeleteCommand-LLGZXUYJ.js} +60 -39
  6. package/{agentEmailCommands-N32KWVCX.js → agentEmailCommands-LC2FPN6G.js} +76 -81
  7. package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
  8. package/{agentListCommands-MXITEBUS.js → agentListCommands-A6OBQ3QX.js} +57 -40
  9. package/{agentMachineCommands-47Y2XEZZ.js → agentMachineCommands-4O4Q5B5X.js} +53 -35
  10. package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
  11. package/{agentRecordCommands-AK6ZRJLD.js → agentRecordCommands-W22RIQRV.js} +73 -78
  12. package/{agentRunCommand-24SNVDNC.js → agentRunCommand-V4OBU4FB.js} +77 -82
  13. package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
  14. package/{agentRuntimeLocal-VI3NHLDU.js → agentRuntimeLocal-I57YSGH4.js} +52 -34
  15. package/{agentSlice-D666DABC.js → agentSlice-3ZHY7RAO.js} +12 -13
  16. package/{appDeleteCommands-SF2V6QYZ.js → appDeleteCommands-DJJF466K.js} +53 -35
  17. package/{appDeployCommands-3EPVR545.js → appDeployCommands-WJZGIOEZ.js} +53 -35
  18. package/{appDeployStatusCommands-O65Y747J.js → appDeployStatusCommands-ICYXUJNO.js} +53 -35
  19. package/{appGetCommands-AHDOF4SS.js → appGetCommands-UOCWYJPV.js} +53 -35
  20. package/{appListCommands-Y7YCXODU.js → appListCommands-EOKWTXPW.js} +53 -35
  21. package/{authCommand-XMQHBK5L.js → authCommand-H5KE7K7K.js} +16 -16
  22. package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
  23. package/{chunk-SNMJPH7J.js → chunk-2XM5KUNE.js} +4 -2
  24. package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
  25. package/{chunk-FVY6KI5A.js → chunk-3RIWR23B.js} +1 -1
  26. package/{chunk-ENUJPSZN.js → chunk-446VANPP.js} +18 -14
  27. package/{chunk-PB7G5MAM.js → chunk-44HACRCK.js} +4 -4
  28. package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
  29. package/{chunk-I5TJCJQP.js → chunk-56IUA7RU.js} +3 -3
  30. package/{chunk-STOUEEBU.js → chunk-66O5MZYH.js} +1 -1
  31. package/{chunk-PSK2RUHV.js → chunk-7CD24PU4.js} +360 -2
  32. package/{chunk-JYSXE6LE.js → chunk-A4JDTA5T.js} +13 -13
  33. package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
  34. package/{chunk-SKDNBYZK.js → chunk-BOL2D2JW.js} +1 -1
  35. package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
  36. package/{chunk-2TYLTEAH.js → chunk-CV6I4HBA.js} +1 -1
  37. package/chunk-DCDL3GC4.js +171 -0
  38. package/{chunk-WNENLKKI.js → chunk-DCWBP2O7.js} +42 -393
  39. package/{chunk-Y52E3TIS.js → chunk-DI6MXJK5.js} +37 -37
  40. package/{chunk-Z3LLUGD5.js → chunk-DKRT67FG.js} +11 -11
  41. package/{chunk-NWT2WUCY.js → chunk-DWQNDGO7.js} +20 -8
  42. package/{chunk-BPZSJH5X.js → chunk-FS5TTXPS.js} +6 -6
  43. package/chunk-G5JHHUAK.js +73 -0
  44. package/{chunk-GFVFYNL7.js → chunk-G6VITLCZ.js} +3 -3
  45. package/{chunk-MUI34IA2.js → chunk-GAGUBI42.js} +302 -14
  46. package/{chunk-YBHJZVWO.js → chunk-GVKTKT3O.js} +15 -8
  47. package/{chunk-GVYU3EVI.js → chunk-HI7QZNWX.js} +17 -10
  48. package/{chunk-MHHYH3JA.js → chunk-HLG6GAUD.js} +1 -1
  49. package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
  50. package/{chunk-INWBJPQC.js → chunk-IZ3CBMD5.js} +3 -3
  51. package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
  52. package/chunk-KW47OSRJ.js +3246 -0
  53. package/{chunk-F7S2SH5C.js → chunk-KWKD3BCC.js} +189 -122
  54. package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
  55. package/{chunk-XISENOC2.js → chunk-L3VQOVKK.js} +8 -8
  56. package/{chunk-HALKDXKP.js → chunk-MEUZFIAJ.js} +8 -4
  57. package/{chunk-XMAMUPXU.js → chunk-MMCVBEAD.js} +174 -149
  58. package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
  59. package/chunk-OYK7PA5U.js +1707 -0
  60. package/{chunk-WPRSBZYN.js → chunk-Q24P6TUS.js} +1 -1
  61. package/{chunk-7CP4UOUV.js → chunk-QLV2GKU5.js} +16 -178
  62. package/{chunk-2AX4ZWSG.js → chunk-SWOTB2TX.js} +135 -1166
  63. package/{chunk-BOPFLKHA.js → chunk-SWYMCHM7.js} +1 -69
  64. package/{chunk-YRMUYZ5H.js → chunk-SZ5CBYMZ.js} +4 -4
  65. package/chunk-T27IEBNQ.js +149 -0
  66. package/{chunk-WX3ZOSTL.js → chunk-T3Y5EMJS.js} +24 -26
  67. package/{chunk-RD6AOXQI.js → chunk-THTAR67C.js} +1056 -137
  68. package/{chunk-2FX23RGA.js → chunk-TJYWZ3LO.js} +4 -4
  69. package/{chunk-SLOGKB7M.js → chunk-TOW4E763.js} +9 -1
  70. package/{chunk-33K2M3AU.js → chunk-UKC5HU2C.js} +33 -40
  71. package/{chunk-STRCGEC6.js → chunk-UTQZ73QQ.js} +13 -9
  72. package/{chunk-GT3GG2H7.js → chunk-VSTUQGLT.js} +1 -1
  73. package/{chunk-4MCHUZUI.js → chunk-W2YKDXT7.js} +95 -95
  74. package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
  75. package/{chunk-XS7UPVR7.js → chunk-XD5NQEOH.js} +5 -5
  76. package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
  77. package/{chunk-DBUNOYLF.js → chunk-YLADSPDU.js} +3 -3
  78. package/{chunk-FRN5QOKN.js → chunk-YWGSCF37.js} +19 -4
  79. package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
  80. package/{createAgentAutomationAction-VK3N263U.js → createAgentAutomationAction-3GMH6ORX.js} +30 -37
  81. package/{createDialogAction-KWZ74S2G.js → createDialogAction-R5MCL4RE.js} +32 -38
  82. package/{createPageAction-3CIZL5ZL.js → createPageAction-QYTG656R.js} +43 -50
  83. package/{db-W5UHK4P3.js → db-IPCJ43PW.js} +10 -6
  84. package/{dbSlice-GOKRGQ47.js → dbSlice-OBV7VFCF.js} +11 -11
  85. package/{deleteFile-WDZ3VM7B.js → deleteFile-AC45HYSM.js} +5 -5
  86. package/{dialogCommands-N4XKI6ZU.js → dialogCommands-NUQGIXVZ.js} +53 -37
  87. package/{dialogSlice-TKYB6VLO.js → dialogSlice-CFDECXEU.js} +27 -34
  88. package/{docCreateCommands-DTDKANXX.js → docCreateCommands-UNFCXB5N.js} +52 -36
  89. package/{docDeleteCommands-U4NB6OHK.js → docDeleteCommands-NG5IVKE5.js} +54 -38
  90. package/{docReadCommands-SDVQM3BH.js → docReadCommands-6J7MUUX6.js} +52 -36
  91. package/{docStore-E5QAM75M.js → docStore-MZZWJM4F.js} +28 -35
  92. package/{docUpdateCommands-O2O644FV.js → docUpdateCommands-6AW3VZOX.js} +55 -39
  93. package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
  94. package/{getPricing-X6I23RN6.js → getPricing-XQYSSVV6.js} +6 -7
  95. package/{handleSendMessageAction-7OVC2SVU.js → handleSendMessageAction-IU2QNTLM.js} +30 -37
  96. package/index.js +72 -72
  97. package/localDialogRead-P72W2U2R.js +38 -0
  98. package/{machineCommands-6GNFKAVC.js → machineCommands-Z2QEWTHZ.js} +76 -81
  99. package/{machineWsRunDispatch-2DCHVG3U.js → machineWsRunDispatch-SJTYHZHN.js} +71 -76
  100. package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
  101. package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
  102. package/package.json +1 -1
  103. package/{read-A23NKT3O.js → read-QK7ZRX6G.js} +6 -6
  104. package/{readDocTool-JAM5BI5Q.js → readDocTool-EYDMVRBL.js} +2 -1
  105. package/{readlineWorkspace-KELDMUNZ.js → readlineWorkspace-EY3BPXIU.js} +151 -163
  106. package/{removeDialogAgentAction-K4HOWFHO.js → removeDialogAgentAction-TBW3UZJW.js} +15 -16
  107. package/{runAgentClientLoop-R3S7YN6Z.js → runAgentClientLoop-N3YDLTMS.js} +61 -66
  108. package/{setDialogExtraReferencesAction-JD7J7JM4.js → setDialogExtraReferencesAction-Q3ANF2NR.js} +12 -12
  109. package/{setPrimaryDialogAgentAction-YWSA5XEU.js → setPrimaryDialogAgentAction-FQ5R3EFJ.js} +15 -16
  110. package/{settingSlice-22GTX6CA.js → settingSlice-JKKV2T7O.js} +13 -14
  111. package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
  112. package/{spaceCommands-WM6W3WMQ.js → spaceCommands-R6AEQNLG.js} +57 -40
  113. package/{spaceSlice-RC2APBOD.js → spaceSlice-MCH7RLLP.js} +27 -34
  114. package/{streamAgentChatTurn-Q655CCVP.js → streamAgentChatTurn-Q4U2CVMI.js} +130 -1300
  115. package/{switchDialogAgentAction-6JKFBJVR.js → switchDialogAgentAction-QQGVE4SL.js} +11 -11
  116. package/{toolApiClient-ISM4ZQX4.js → toolApiClient-ARGFDJAG.js} +3 -3
  117. package/{tools-A6MUIA3Q.js → tools-Y3UBLLYW.js} +50 -56
  118. package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-4474IBTI.js} +12 -12
  119. package/{updateDialogTitleAction-DQYY564Y.js → updateDialogTitleAction-3J7GH67I.js} +35 -43
  120. package/chunk-3LJ4RSSF.js +0 -231
  121. package/chunk-5CS33IBL.js +0 -301
  122. package/chunk-5MMAK75Q.js +0 -15
  123. package/chunk-MRC4Q34M.js +0 -188
  124. package/chunk-P6TB7JIA.js +0 -1791
  125. package/chunk-PFTK5SEB.js +0 -620
  126. package/chunk-PMSG3OGF.js +0 -669
  127. package/chunk-SIZQB7BD.js +0 -91
  128. package/chunk-VIDPVFP3.js +0 -20
  129. package/chunk-Y5GCAMGP.js +0 -9
  130. package/chunk-YYLHWIW6.js +0 -48
  131. package/chunk-ZZ2MH7LE.js +0 -84
  132. package/localDialogRead-JXTAHW2E.js +0 -26
  133. package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
  134. package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
  135. package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
  136. package/{chunk-XMLRJUU5.js → chunk-ZFTCLBEX.js} +9 -9
  137. package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
  138. package/{tableCommands-QSZILI7I.js → tableCommands-PRJNWN6Q.js} +6 -6
@@ -1,27 +1,15 @@
1
1
  import {
2
2
  BUILTIN_SUMMARY_LLM_CONFIG,
3
3
  buildBuiltinSummaryContent
4
- } from "./chunk-XOIF2TNF.js";
4
+ } from "./chunk-OB6FBSH3.js";
5
5
  import {
6
- authRoutes
7
- } from "./chunk-MRC4Q34M.js";
8
- import {
9
- buildDialogAttachmentPlan,
10
- extractFileContentIds
11
- } from "./chunk-SIZQB7BD.js";
6
+ cleanupCliSessionForDialog
7
+ } from "./chunk-IZ3CBMD5.js";
12
8
  import {
9
+ createFileCredentialBroker,
13
10
  deleteServerSyncedCredential,
14
11
  runLlm
15
- } from "./chunk-MUI34IA2.js";
16
- import {
17
- isOAuthApiKeyRef
18
- } from "./chunk-YYLHWIW6.js";
19
- import {
20
- getApproxPricePerImage
21
- } from "./chunk-CWMSB67P.js";
22
- import {
23
- cleanupCliSessionForDialog
24
- } from "./chunk-INWBJPQC.js";
12
+ } from "./chunk-GAGUBI42.js";
25
13
  import {
26
14
  getActiveDialogAgentId,
27
15
  getDialogAgentIds,
@@ -31,26 +19,8 @@ import {
31
19
  require_date_fns
32
20
  } from "./chunk-M76ECQRD.js";
33
21
  import {
34
- fetchMessages
35
- } from "./chunk-L65QKSVJ.js";
36
- import {
37
- DEFAULT_AUTO_EXECUTION_PROFILE,
38
- DEFAULT_CONTEXT_WINDOW,
39
- getModelContextWindow,
40
- getModelInfo,
41
- normalizeAssistantContentBuffer,
42
- planCompression,
43
- resolveAutoExecutionProfile,
44
- resolveBuiltinPlatformAgentRecord,
45
- serializeMessageContent
46
- } from "./chunk-PMSG3OGF.js";
47
- import {
48
- createFileCredentialBroker
49
- } from "./chunk-5CS33IBL.js";
50
- import {
51
- findModelConfig,
52
- getModelConfig
53
- } from "./chunk-GT3GG2H7.js";
22
+ toErrorMessage
23
+ } from "./chunk-HNMXYYJR.js";
54
24
  import {
55
25
  abortActiveControllers,
56
26
  addPageReferenceToRuntime,
@@ -69,30 +39,38 @@ import {
69
39
  setDialogConfigError
70
40
  } from "./chunk-3ASDTTEI.js";
71
41
  import {
72
- toErrorMessage
73
- } from "./chunk-HNMXYYJR.js";
42
+ UNCATEGORIZED_ID,
43
+ addContentAction,
44
+ checkSpaceMembership,
45
+ createSpaceKey,
46
+ localSpaceAuthorityPatchStamp,
47
+ normalizeSpaceId
48
+ } from "./chunk-YLADSPDU.js";
49
+ import {
50
+ ALL_MODELS
51
+ } from "./chunk-WTGCTVJG.js";
52
+ import {
53
+ getApproxPricePerImage
54
+ } from "./chunk-CWMSB67P.js";
55
+ import {
56
+ MODEL_LOOKUP_MAP,
57
+ findModelConfig,
58
+ getModelConfig
59
+ } from "./chunk-VSTUQGLT.js";
74
60
  import {
75
61
  getPlatformHostedDeepSeekV4Price,
76
62
  isPlatformHostedDeepSeekV4Model
77
- } from "./chunk-YTA2QOEE.js";
63
+ } from "./chunk-CAENRKNJ.js";
78
64
  import {
79
65
  isSystemAdmin,
80
66
  nolotusId,
81
67
  selectRemoteServer,
82
68
  selectRemoteServers,
83
69
  selectRemoteSyncServers
84
- } from "./chunk-ENUJPSZN.js";
70
+ } from "./chunk-446VANPP.js";
85
71
  import {
86
72
  asRecordOrEmpty
87
73
  } from "./chunk-KX6YBIHG.js";
88
- import {
89
- UNCATEGORIZED_ID,
90
- addContentAction,
91
- checkSpaceMembership,
92
- createSpaceKey,
93
- localSpaceAuthorityPatchStamp,
94
- normalizeSpaceId
95
- } from "./chunk-DBUNOYLF.js";
96
74
  import {
97
75
  patch,
98
76
  read,
@@ -102,48 +80,24 @@ import {
102
80
  selectById,
103
81
  selectEntities,
104
82
  toTimestampMs,
83
+ upload,
105
84
  uploadFileAction,
106
85
  upsertSSREntity,
107
86
  write
108
- } from "./chunk-JYSXE6LE.js";
109
- import {
110
- DB_PREFIX,
111
- SEPARATOR,
112
- TYPE_STORAGE_PREFIXES,
113
- buildDialogAgentListIndexDeleteOps,
114
- createDialogMessageKeyAndId,
115
- createKey,
116
- createTokenKey,
117
- createTokenStatsKey,
118
- dialogMessageKey,
119
- fileKey,
120
- isAgentKey,
121
- isAppKey,
122
- isDialogKey,
123
- isDialogRecordKey,
124
- isFileKey,
125
- isPageKey,
126
- isTableMetaKey,
127
- isTaskKey,
128
- metaKey,
129
- rowKey,
130
- splitKey,
131
- toTrimmedString,
132
- ulid
133
- } from "./chunk-NRY4GCKJ.js";
134
- import {
135
- asOptionalFiniteNumber
136
- } from "./chunk-WWC7I6TA.js";
137
- import {
138
- asNonEmptyStringArray,
139
- asTrimmedNonEmptyStringArray
140
- } from "./chunk-I42VC5KR.js";
87
+ } from "./chunk-A4JDTA5T.js";
141
88
  import {
142
89
  asTrimmedLowercaseString
143
90
  } from "./chunk-QSJ3HFEF.js";
144
91
  import {
92
+ PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
93
+ builtinRuntimeFallbackEntries,
145
94
  readAction
146
- } from "./chunk-NWT2WUCY.js";
95
+ } from "./chunk-DWQNDGO7.js";
96
+ import {
97
+ extractCustomId,
98
+ extractUserId,
99
+ publicAgentKey
100
+ } from "./chunk-TOW4E763.js";
147
101
  import {
148
102
  DEVICE_LOCAL_OWNER_ID,
149
103
  asyncThunkCreator,
@@ -164,7 +118,7 @@ import {
164
118
  selectIdentityToken,
165
119
  selectIdentityUserId,
166
120
  selectRuntimeSnapshot
167
- } from "./chunk-XMLRJUU5.js";
121
+ } from "./chunk-ZFTCLBEX.js";
168
122
  import {
169
123
  createClientLogger,
170
124
  fetchFromServer,
@@ -173,6 +127,44 @@ import {
173
127
  isAbortError,
174
128
  logger
175
129
  } from "./chunk-R5V5G73M.js";
130
+ import {
131
+ API_ENDPOINTS,
132
+ API_VERSION
133
+ } from "./chunk-LCBAMY2M.js";
134
+ import {
135
+ normalizeServerOrigin
136
+ } from "./chunk-CF7PE763.js";
137
+ import {
138
+ fetchMessages
139
+ } from "./chunk-L3GCUVOH.js";
140
+ import {
141
+ DB_PREFIX,
142
+ SEPARATOR,
143
+ TYPE_STORAGE_PREFIXES,
144
+ buildDialogAgentListIndexDeleteOps,
145
+ createDialogMessageKeyAndId,
146
+ createKey,
147
+ createTokenKey,
148
+ createTokenStatsKey,
149
+ dialogMessageKey,
150
+ fileKey,
151
+ isAgentKey,
152
+ isAppKey,
153
+ isDialogKey,
154
+ isDialogRecordKey,
155
+ isFileKey,
156
+ isPageKey,
157
+ isTableMetaKey,
158
+ isTaskKey,
159
+ metaKey,
160
+ rowKey,
161
+ splitKey,
162
+ toTrimmedString,
163
+ ulid
164
+ } from "./chunk-WHLVPK32.js";
165
+ import {
166
+ asOptionalFiniteNumber
167
+ } from "./chunk-WWC7I6TA.js";
176
168
  import {
177
169
  buildTombstoneRecord,
178
170
  isTombstoneRecord,
@@ -184,17 +176,13 @@ import {
184
176
  import {
185
177
  asOptionalPositiveFiniteNumber
186
178
  } from "./chunk-U6VC4MU4.js";
187
- import {
188
- extractCustomId,
189
- extractUserId
190
- } from "./chunk-SLOGKB7M.js";
191
179
  import {
192
180
  isRecord
193
181
  } from "./chunk-KUG52IAP.js";
194
182
  import {
195
- API_ENDPOINTS,
196
- API_VERSION
197
- } from "./chunk-LCBAMY2M.js";
183
+ asNonEmptyStringArray,
184
+ asTrimmedNonEmptyStringArray
185
+ } from "./chunk-I42VC5KR.js";
198
186
  import {
199
187
  asOptionalTrimmedString
200
188
  } from "./chunk-G3SUCT4W.js";
@@ -3407,6 +3395,545 @@ var fetchAndCacheMessages = async (options) => {
3407
3395
  return remotePromise;
3408
3396
  };
3409
3397
 
3398
+ // packages/app/utils/imageUtils.ts
3399
+ var BYTES_PER_MB = 1024 * 1024;
3400
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3401
+ var parseDataUrl = (dataUrl) => {
3402
+ const trimmed = dataUrl.trim();
3403
+ const parts = trimmed.split(",");
3404
+ if (parts.length < 2 || !parts[0] || !parts[1]) {
3405
+ console.warn("[imageUtils] parseDataUrl: invalid data URL", {
3406
+ hasHeader: !!parts[0],
3407
+ hasBody: !!parts[1]
3408
+ });
3409
+ return null;
3410
+ }
3411
+ const header = parts[0];
3412
+ const base64 = parts[1];
3413
+ const mimeMatch = header.match(/:(.*?);/);
3414
+ const mime = mimeMatch?.[1];
3415
+ if (!mime) {
3416
+ console.warn("[imageUtils] parseDataUrl: cannot extract mime from", header);
3417
+ return null;
3418
+ }
3419
+ return { mime, base64 };
3420
+ };
3421
+ function dataURLtoFile(dataUrl, filename) {
3422
+ try {
3423
+ const parsed = parseDataUrl(dataUrl);
3424
+ if (!parsed) return null;
3425
+ const { mime, base64 } = parsed;
3426
+ const binaryString = atob(base64);
3427
+ const length = binaryString.length;
3428
+ const u8arr = new Uint8Array(length);
3429
+ for (let i = 0; i < length; i++) {
3430
+ u8arr[i] = binaryString.charCodeAt(i);
3431
+ }
3432
+ return new File([u8arr], filename, { type: mime });
3433
+ } catch (error) {
3434
+ console.error("[imageUtils] Error converting data URL to File:", error);
3435
+ return null;
3436
+ }
3437
+ }
3438
+ var appendNoCacheQuery = (url) => {
3439
+ const stamp = `_t=${Date.now()}`;
3440
+ return url.includes("?") ? `${url}&${stamp}` : `${url}?${stamp}`;
3441
+ };
3442
+ var tryLoadImage = (url) => new Promise((resolve) => {
3443
+ const img = new Image();
3444
+ const cleanup = () => {
3445
+ img.onload = null;
3446
+ img.onerror = null;
3447
+ };
3448
+ img.onload = () => {
3449
+ cleanup();
3450
+ resolve(true);
3451
+ };
3452
+ img.onerror = () => {
3453
+ cleanup();
3454
+ resolve(false);
3455
+ };
3456
+ img.src = url;
3457
+ });
3458
+ var waitForFileReady = async (url, {
3459
+ maxWaitMs = 4e3,
3460
+ intervalMs = 250
3461
+ } = {}) => {
3462
+ const start = Date.now();
3463
+ while (Date.now() - start < maxWaitMs) {
3464
+ const tryUrl = appendNoCacheQuery(url);
3465
+ const ok2 = await tryLoadImage(tryUrl);
3466
+ if (ok2) {
3467
+ console.debug("[imageUtils] waitForFileReady: image loaded for", url);
3468
+ return true;
3469
+ }
3470
+ await sleep(intervalMs);
3471
+ }
3472
+ console.warn("[imageUtils] waitForFileReady: timeout for", url);
3473
+ return false;
3474
+ };
3475
+
3476
+ // packages/database/fileUrl.ts
3477
+ var normalizeFileId = (fileId) => {
3478
+ if (typeof fileId !== "string") return "";
3479
+ return fileId.trim();
3480
+ };
3481
+ var buildDatabaseFileContentUrl = (serverOrigin, fileId) => {
3482
+ const normalizedServer = normalizeServerOrigin(serverOrigin);
3483
+ const normalizedFileId = normalizeFileId(fileId);
3484
+ if (!normalizedServer || !normalizedFileId) {
3485
+ return null;
3486
+ }
3487
+ return `${normalizedServer}${API_ENDPOINTS.DATABASE}/file/content/${normalizedFileId}`;
3488
+ };
3489
+
3490
+ // packages/chat/messages/fileUrl.ts
3491
+ var buildMessageFileContentUrl = (serverOrigin, fileId) => buildDatabaseFileContentUrl(serverOrigin, fileId);
3492
+
3493
+ // packages/chat/messages/imagePayloadPersistence.ts
3494
+ var stripDurableImageInlinePayload = (part) => {
3495
+ if (!part || typeof part !== "object") return part;
3496
+ const { original_data_url: _originalDataUrl, ...withoutOriginalDataUrl } = part;
3497
+ if (withoutOriginalDataUrl.type !== "image_url" || !withoutOriginalDataUrl.google_native || typeof withoutOriginalDataUrl.google_native !== "object") {
3498
+ return withoutOriginalDataUrl;
3499
+ }
3500
+ const { google_native: _googleNative, ...durablePart } = withoutOriginalDataUrl;
3501
+ return durablePart;
3502
+ };
3503
+
3504
+ // packages/core/chat/messageContentSerialize.ts
3505
+ var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
3506
+ if (typeof content === "string") {
3507
+ return content.trim() || null;
3508
+ }
3509
+ if (Array.isArray(content)) {
3510
+ const fragments = [];
3511
+ for (const part of content) {
3512
+ if (!part || typeof part !== "object") continue;
3513
+ if (part.type === "text" && typeof part.text === "string") {
3514
+ const text = part.text.trim();
3515
+ if (text) fragments.push(text);
3516
+ } else if (part.type === "image_url") {
3517
+ fragments.push(imagePlaceholder);
3518
+ }
3519
+ }
3520
+ const joined = fragments.join("\n").trim();
3521
+ return joined || null;
3522
+ }
3523
+ return null;
3524
+ };
3525
+
3526
+ // packages/chat/messages/messageContent.ts
3527
+ var isDataUrlImage = (url) => typeof url === "string" && url.startsWith("data:image");
3528
+ var uploadGeneratedImageDataUrl = async (url, dialogId, messageId, index, dispatch, getState, options) => {
3529
+ const fileName = `generated-image-${dialogId}-${messageId}-${index}.png`;
3530
+ const file = dataURLtoFile(url, fileName);
3531
+ if (!file) {
3532
+ console.warn(
3533
+ "[messageContent] dataURLtoFile failed, drop generated image inline payload"
3534
+ );
3535
+ return null;
3536
+ }
3537
+ const customKey = `generated-image-${dialogId}-${messageId}-${index}`;
3538
+ let metadata;
3539
+ try {
3540
+ metadata = await dispatch(upload({ file, customKey })).unwrap();
3541
+ } catch (err2) {
3542
+ console.warn(
3543
+ "[messageContent] upload generated image failed, drop inline payload:",
3544
+ err2
3545
+ );
3546
+ return null;
3547
+ }
3548
+ const state3 = getState();
3549
+ const { currentServer } = getRuntimeServerContext(state3);
3550
+ const fileId = metadata?.dbKey || metadata?.id;
3551
+ if (!currentServer || !fileId) {
3552
+ console.warn(
3553
+ "[messageContent] missing currentServer or fileId, drop inline payload",
3554
+ { currentServer, fileId }
3555
+ );
3556
+ return null;
3557
+ }
3558
+ if (options?.spaceId) {
3559
+ try {
3560
+ const agentPrefix = options.agentName ? `[${options.agentName}] ` : "";
3561
+ const title = `${agentPrefix}Generated Image ${index + 1}`;
3562
+ await addContentAction({
3563
+ spaceId: options.spaceId,
3564
+ contentKey: fileId,
3565
+ title,
3566
+ type: "image" /* IMAGE */
3567
+ }, { dispatch, getState });
3568
+ console.log(`[messageContent] Saved generated image to space: ${options.spaceId}`);
3569
+ } catch (err2) {
3570
+ console.error("[messageContent] Failed to save generated image to space:", err2);
3571
+ }
3572
+ }
3573
+ const imageUrl = buildMessageFileContentUrl(currentServer, fileId);
3574
+ if (!imageUrl) {
3575
+ return null;
3576
+ }
3577
+ const ready = await waitForFileReady(imageUrl);
3578
+ if (!ready) {
3579
+ console.warn(
3580
+ "[messageContent] uploaded generated image not ready, drop inline payload:",
3581
+ imageUrl
3582
+ );
3583
+ return null;
3584
+ }
3585
+ return imageUrl;
3586
+ };
3587
+ var normalizeAssistantContentBuffer = async (contentBuffer, dialogId, messageId, dispatch, getState, options) => {
3588
+ if (!Array.isArray(contentBuffer) || contentBuffer.length === 0) {
3589
+ return contentBuffer;
3590
+ }
3591
+ const updated = await Promise.all(
3592
+ contentBuffer.map(async (part, index) => {
3593
+ if (!part || part.type !== "image_url" || !part.image_url || !isDataUrlImage(part.image_url.url)) {
3594
+ return part;
3595
+ }
3596
+ const newUrl = await uploadGeneratedImageDataUrl(
3597
+ part.image_url.url,
3598
+ dialogId,
3599
+ messageId,
3600
+ index,
3601
+ dispatch,
3602
+ getState,
3603
+ options
3604
+ );
3605
+ if (!newUrl) {
3606
+ return {
3607
+ type: "text",
3608
+ text: "[\u56FE\u7247\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u751F\u6210\u56FE\u7247]"
3609
+ };
3610
+ }
3611
+ return stripDurableImageInlinePayload({
3612
+ ...part,
3613
+ image_url: {
3614
+ ...part.image_url,
3615
+ url: newUrl
3616
+ }
3617
+ });
3618
+ })
3619
+ );
3620
+ return updated;
3621
+ };
3622
+
3623
+ // packages/ai/llm/getModelContextWindow.ts
3624
+ var DEFAULT_CONTEXT_WINDOW = 256e3;
3625
+ var QWEN_3_6_CONTEXT_WINDOW = 262144;
3626
+ var GLM_5_2_CONTEXT_WINDOW = 1e6;
3627
+ var ANTIGRAVITY_EFFORT_SUFFIXES = [
3628
+ "-tiered",
3629
+ "-extra-low",
3630
+ "-low",
3631
+ "-medium",
3632
+ "-high"
3633
+ ];
3634
+ function stripEffortSuffix(model) {
3635
+ for (const suffix of ANTIGRAVITY_EFFORT_SUFFIXES) {
3636
+ if (model.endsWith(suffix) && model.length > suffix.length) {
3637
+ return model.slice(0, -suffix.length);
3638
+ }
3639
+ }
3640
+ return model;
3641
+ }
3642
+ function stripPreviewSuffix(model) {
3643
+ const suffix = "-preview";
3644
+ if (model.endsWith(suffix) && model.length > suffix.length) {
3645
+ return model.slice(0, -suffix.length);
3646
+ }
3647
+ return model;
3648
+ }
3649
+ var fullModelMap = null;
3650
+ var getFullModelMap = () => {
3651
+ if (!fullModelMap) {
3652
+ fullModelMap = /* @__PURE__ */ new Map();
3653
+ for (const [provider, models] of Object.entries(MODEL_LOOKUP_MAP)) {
3654
+ for (const model of models) {
3655
+ const entry = { ...model, provider };
3656
+ fullModelMap.set(model.name, entry);
3657
+ if (model.displayName) {
3658
+ fullModelMap.set(model.displayName.toLowerCase(), entry);
3659
+ }
3660
+ }
3661
+ }
3662
+ }
3663
+ return fullModelMap;
3664
+ };
3665
+ var legacyModelMap = null;
3666
+ var getLegacyModelMap = () => {
3667
+ if (!legacyModelMap) {
3668
+ legacyModelMap = /* @__PURE__ */ new Map();
3669
+ for (const model of ALL_MODELS) {
3670
+ legacyModelMap.set(model.name, model);
3671
+ if (model.displayName) {
3672
+ legacyModelMap.set(model.displayName.toLowerCase(), model);
3673
+ }
3674
+ }
3675
+ }
3676
+ return legacyModelMap;
3677
+ };
3678
+ function fuzzyContextWindow(normalizedName) {
3679
+ if (normalizedName.includes("qwen-long") || normalizedName.includes("qwen3-long")) return 10485760;
3680
+ if (normalizedName.includes("qwen-coder") || normalizedName.includes("qwen3-coder")) return 1048576;
3681
+ if (normalizedName.includes("qwen3.8") || normalizedName.includes("qwen3p8")) return 1e6;
3682
+ if (normalizedName.includes("minimax-m3") || normalizedName.includes("minimax_m3")) return 1e6;
3683
+ if (normalizedName.includes("glm-5.2") || normalizedName.includes("glm5.2")) return GLM_5_2_CONTEXT_WINDOW;
3684
+ if (normalizedName.includes("deepseek")) return 1e6;
3685
+ if (normalizedName.includes("gpt-5") || normalizedName.includes("gpt-4.1")) return 1047576;
3686
+ if (normalizedName.startsWith("cursor-grok-4.5")) return 1e6;
3687
+ if (normalizedName.includes("claude-4.6")) return 1e6;
3688
+ if (normalizedName.includes("gemini-3.1")) return 1e6;
3689
+ if (normalizedName.includes("gemini")) return 1048576;
3690
+ if (normalizedName.includes("qwen3.6") || normalizedName.includes("qwen3p6")) return QWEN_3_6_CONTEXT_WINDOW;
3691
+ if (normalizedName.includes("qwen3.7") || normalizedName.includes("qwen3p7")) return 262144;
3692
+ if (normalizedName.includes("minimax-m2") || normalizedName.includes("minimax_m2")) return 262144;
3693
+ if (normalizedName.includes("claude")) return 2e5;
3694
+ return void 0;
3695
+ }
3696
+ var getModelContextWindow = (modelName) => {
3697
+ if (!modelName) return DEFAULT_CONTEXT_WINDOW;
3698
+ const normalizedName = modelName.toLowerCase();
3699
+ const map = getFullModelMap();
3700
+ const candidates = [modelName, normalizedName];
3701
+ const strippedEffort = stripEffortSuffix(modelName);
3702
+ if (strippedEffort !== modelName) {
3703
+ candidates.push(strippedEffort, strippedEffort.toLowerCase());
3704
+ }
3705
+ const strippedPreview = stripPreviewSuffix(modelName);
3706
+ if (strippedPreview !== modelName) {
3707
+ candidates.push(strippedPreview, strippedPreview.toLowerCase());
3708
+ }
3709
+ if (strippedEffort !== modelName) {
3710
+ const strippedBoth = stripPreviewSuffix(strippedEffort);
3711
+ if (strippedBoth !== strippedEffort) {
3712
+ candidates.push(strippedBoth, strippedBoth.toLowerCase());
3713
+ }
3714
+ }
3715
+ for (const candidate of candidates) {
3716
+ const model = map.get(candidate);
3717
+ if (model?.contextWindow) {
3718
+ return typeof model.contextWindow === "number" ? model.contextWindow : DEFAULT_CONTEXT_WINDOW;
3719
+ }
3720
+ }
3721
+ return fuzzyContextWindow(normalizedName) ?? DEFAULT_CONTEXT_WINDOW;
3722
+ };
3723
+ var getModelInfo = (modelName) => {
3724
+ if (!modelName) return null;
3725
+ const map = getLegacyModelMap();
3726
+ return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
3727
+ };
3728
+
3729
+ // packages/ai/context/tokenUtils.ts
3730
+ var estimateTokenCount = (text) => {
3731
+ if (!text) return 0;
3732
+ const chineseChars = (text.match(/[\u4e00-\u9fa5\u3400-\u4dbf]/g) || []).length;
3733
+ const otherChars = text.length - chineseChars;
3734
+ return Math.ceil(chineseChars * 1.5 + otherChars * 0.25);
3735
+ };
3736
+
3737
+ // packages/ai/context/retention.ts
3738
+ var SAFE_BUFFER_RATIO = 0.95;
3739
+ var CACHE_FIRST_RETENTION_STRENGTH = 0.95;
3740
+ var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
3741
+ var planContextUsage = (params) => {
3742
+ const { contextWindow, summaryTokens, recentLoad } = params;
3743
+ const safeWindowLimit = Math.floor(contextWindow * SAFE_BUFFER_RATIO);
3744
+ const iq = CACHE_FIRST_RETENTION_STRENGTH;
3745
+ const isLargeWindow = contextWindow >= 512e3;
3746
+ const isSmallWindow = contextWindow <= 64e3;
3747
+ let baseHistoryRatio;
3748
+ if (isLargeWindow) {
3749
+ baseHistoryRatio = 0.8 + 0.2 * iq;
3750
+ } else if (isSmallWindow) {
3751
+ baseHistoryRatio = 0.35 + 0.3 * iq;
3752
+ } else {
3753
+ baseHistoryRatio = 0.55 + 0.3 * iq;
3754
+ }
3755
+ let historyRatio = baseHistoryRatio;
3756
+ switch (recentLoad) {
3757
+ case "light": {
3758
+ const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
3759
+ historyRatio = clamp(historyRatio * 1.05, 0.3, maxRatio);
3760
+ break;
3761
+ }
3762
+ case "heavy": {
3763
+ const maxRatio = isLargeWindow ? 0.98 : isSmallWindow ? 0.7 : 0.8;
3764
+ const multiplier = isLargeWindow ? 0.98 : isSmallWindow ? 0.9 : 0.9;
3765
+ historyRatio = clamp(historyRatio * multiplier, 0.3, maxRatio);
3766
+ break;
3767
+ }
3768
+ case "medium":
3769
+ default: {
3770
+ const maxRatio = isLargeWindow ? 1 : isSmallWindow ? 0.75 : 0.85;
3771
+ historyRatio = clamp(historyRatio, 0.3, maxRatio);
3772
+ break;
3773
+ }
3774
+ }
3775
+ const historyBudget = Math.max(
3776
+ 0,
3777
+ Math.floor(safeWindowLimit * historyRatio)
3778
+ );
3779
+ const minRawRatio = isSmallWindow ? 0.5 : isLargeWindow ? 0.2 : 0.3;
3780
+ const rawMessageBudget = Math.max(
3781
+ Math.floor(historyBudget * minRawRatio),
3782
+ historyBudget - summaryTokens,
3783
+ 0
3784
+ );
3785
+ let minTailTokens;
3786
+ if (recentLoad === "light") {
3787
+ minTailTokens = Math.min(
3788
+ Math.floor(safeWindowLimit * 0.3),
3789
+ 8e3
3790
+ );
3791
+ } else if (recentLoad === "heavy") {
3792
+ minTailTokens = Math.max(
3793
+ Math.floor(safeWindowLimit * 0.25),
3794
+ 16e3
3795
+ );
3796
+ } else {
3797
+ minTailTokens = Math.floor(safeWindowLimit * 0.2);
3798
+ }
3799
+ return { historyBudget, rawMessageBudget, minTailTokens };
3800
+ };
3801
+
3802
+ // packages/ai/context/planCompression.ts
3803
+ var MIN_COMPRESS_COUNT = 5;
3804
+ var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
3805
+ var getMessageTokenCount = (msg) => {
3806
+ if (msg.usage?.completion_tokens) {
3807
+ return msg.usage.completion_tokens;
3808
+ }
3809
+ const content = serializeMessageContent(msg.content) || "";
3810
+ return estimateTokenCount(content);
3811
+ };
3812
+ var hasOpenEndedToolCall = (msg) => !!msg && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
3813
+ var isActiveSummaryWorthDoing = (pendingTokens, contextWindow) => {
3814
+ const minTokens = Math.min(
3815
+ 4e4,
3816
+ Math.max(1e4, Math.floor(contextWindow * 0.05))
3817
+ );
3818
+ return pendingTokens >= minTokens;
3819
+ };
3820
+ var classifyConversationLoad = (msgs) => {
3821
+ const N = 20;
3822
+ if (!Array.isArray(msgs) || msgs.length === 0) return "light";
3823
+ const tail = msgs.slice(-N);
3824
+ const tokenSamples = tail.map(getMessageTokenCount);
3825
+ if (tokenSamples.length === 0) return "light";
3826
+ const sum = tokenSamples.reduce((acc, v) => acc + v, 0);
3827
+ const avg = sum / tokenSamples.length;
3828
+ const sorted = [...tokenSamples].sort((a, b) => a - b);
3829
+ const p95 = sorted[Math.floor((sorted.length - 1) * 0.95)];
3830
+ if (p95 < 200 && avg < 120) {
3831
+ return "light";
3832
+ }
3833
+ if (p95 > 2e3 || avg > 1200) {
3834
+ return "heavy";
3835
+ }
3836
+ return "medium";
3837
+ };
3838
+ var normalizeContextUsageRatio = (value) => {
3839
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
3840
+ const ratio = value > 1 ? value / 100 : value;
3841
+ return ratio >= 0 && ratio <= 1 ? ratio : void 0;
3842
+ };
3843
+ var emptyPlan = (startIndex) => ({
3844
+ shouldCompress: false,
3845
+ compressCount: 0,
3846
+ msgsToCompress: [],
3847
+ msgsToKeep: [],
3848
+ newSummarizedBeforeId: void 0,
3849
+ startIndex
3850
+ });
3851
+ function planCompression(input) {
3852
+ const {
3853
+ allMsgs,
3854
+ summarizedBeforeId,
3855
+ summary,
3856
+ contextWindow,
3857
+ force = false,
3858
+ reason,
3859
+ realContextUsagePercent
3860
+ } = input;
3861
+ let startIndex = 0;
3862
+ if (summarizedBeforeId) {
3863
+ const found = allMsgs.findIndex((m) => m.id === summarizedBeforeId);
3864
+ if (found !== -1) {
3865
+ startIndex = found + 1;
3866
+ }
3867
+ }
3868
+ const pendingMsgs = allMsgs.slice(startIndex);
3869
+ if (pendingMsgs.length === 0) {
3870
+ return emptyPlan(startIndex);
3871
+ }
3872
+ const summaryTokens = estimateTokenCount(summary || "");
3873
+ const pendingTokens = pendingMsgs.reduce(
3874
+ (sum, msg) => sum + getMessageTokenCount(msg),
3875
+ 0
3876
+ );
3877
+ const totalUsed = summaryTokens + pendingTokens;
3878
+ const adjustedSummaryTokens = Math.max(summaryTokens, 1e3);
3879
+ const recentLoad = classifyConversationLoad(pendingMsgs);
3880
+ const { historyBudget, rawMessageBudget } = planContextUsage({
3881
+ contextWindow,
3882
+ summaryTokens: adjustedSummaryTokens,
3883
+ recentLoad
3884
+ });
3885
+ let shouldTriggerByUsage = false;
3886
+ const usageRatio = normalizeContextUsageRatio(realContextUsagePercent);
3887
+ if (usageRatio !== void 0) {
3888
+ if (usageRatio >= 0.78) {
3889
+ shouldTriggerByUsage = true;
3890
+ } else if (usageRatio >= 0.65 && isActiveSummaryWorthDoing(pendingTokens, contextWindow)) {
3891
+ shouldTriggerByUsage = true;
3892
+ }
3893
+ }
3894
+ if (totalUsed >= historyBudget) {
3895
+ shouldTriggerByUsage = true;
3896
+ }
3897
+ const shouldRunActiveSummary = force && reason === "manual" && !hasOpenEndedToolCall(pendingMsgs[pendingMsgs.length - 1]) && isActiveSummaryWorthDoing(pendingTokens, contextWindow);
3898
+ if (!shouldTriggerByUsage && !shouldRunActiveSummary) {
3899
+ return emptyPlan(startIndex);
3900
+ }
3901
+ let tokensToKeep = 0;
3902
+ let keepCount = 0;
3903
+ for (let i = pendingMsgs.length - 1; i >= 0; i--) {
3904
+ const t2 = getMessageTokenCount(pendingMsgs[i]);
3905
+ if (tokensToKeep + t2 > rawMessageBudget) break;
3906
+ tokensToKeep += t2;
3907
+ keepCount++;
3908
+ }
3909
+ const triggeredByRealUsage = usageRatio !== void 0 && shouldTriggerByUsage;
3910
+ let compressCount = (shouldRunActiveSummary || triggeredByRealUsage) && totalUsed < historyBudget ? Math.max(0, pendingMsgs.length - ACTIVE_SUMMARY_TAIL_KEEP_COUNT) : pendingMsgs.length - keepCount;
3911
+ while (compressCount > 0 && compressCount < pendingMsgs.length && pendingMsgs[compressCount].role === "tool") {
3912
+ compressCount--;
3913
+ }
3914
+ if (compressCount > 0) {
3915
+ const lastCompressed = pendingMsgs[compressCount - 1];
3916
+ const hasToolCalls = Array.isArray(lastCompressed.tool_calls) && lastCompressed.tool_calls.length > 0;
3917
+ if (hasToolCalls) {
3918
+ compressCount--;
3919
+ }
3920
+ }
3921
+ if (compressCount < MIN_COMPRESS_COUNT) {
3922
+ return emptyPlan(startIndex);
3923
+ }
3924
+ const msgsToCompress = pendingMsgs.slice(0, compressCount);
3925
+ const msgsToKeep = pendingMsgs.slice(compressCount);
3926
+ const newSummarizedBeforeId = msgsToCompress[msgsToCompress.length - 1].id;
3927
+ return {
3928
+ shouldCompress: true,
3929
+ compressCount,
3930
+ msgsToCompress,
3931
+ msgsToKeep,
3932
+ newSummarizedBeforeId,
3933
+ startIndex
3934
+ };
3935
+ }
3936
+
3410
3937
  // packages/chat/messages/parseJsonRecord.ts
3411
3938
  function asOptionalJsonRecord(value) {
3412
3939
  if (typeof value === "string") {
@@ -3803,6 +4330,84 @@ var buildPersonalizationDialogPolicyContext = () => [
3803
4330
  "\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"
3804
4331
  ].join("\n");
3805
4332
 
4333
+ // packages/agent-runtime/autoExecutionProfiles.ts
4334
+ var createProfile = (input) => ({
4335
+ id: input.id,
4336
+ tier: input.tier,
4337
+ legacyAgentKey: input.legacyAgentKey,
4338
+ key: input.legacyAgentKey,
4339
+ name: input.name,
4340
+ provider: "nolo",
4341
+ model: input.model,
4342
+ apiSource: "platform",
4343
+ useServerProxy: true,
4344
+ rawRecord: {
4345
+ dbKey: input.legacyAgentKey,
4346
+ isPublic: true,
4347
+ provider: "nolo",
4348
+ model: input.model,
4349
+ apiSource: "platform",
4350
+ useServerProxy: true
4351
+ }
4352
+ });
4353
+ var FLASH_PROFILE = createProfile({
4354
+ id: "builtin:auto:deepseek-v4-flash",
4355
+ tier: "flash",
4356
+ legacyAgentKey: PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
4357
+ name: "DeepSeek V4 Flash",
4358
+ model: "deepseek-v4-flash"
4359
+ });
4360
+ var AUTO_EXECUTION_PROFILES = {
4361
+ flash: FLASH_PROFILE,
4362
+ balanced: { ...FLASH_PROFILE, tier: "balanced" },
4363
+ quality: { ...FLASH_PROFILE, tier: "quality" },
4364
+ image: { ...FLASH_PROFILE, tier: "image" }
4365
+ };
4366
+ var DEFAULT_AUTO_EXECUTION_TIER = "flash";
4367
+ var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUTION_TIER];
4368
+ var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
4369
+
4370
+ // packages/agent-runtime/builtinPlatformAgentConfigs.ts
4371
+ function buildConfig(e) {
4372
+ const key = publicAgentKey(e.id);
4373
+ const rawRecord = {
4374
+ dbKey: key,
4375
+ isPublic: true,
4376
+ provider: e.provider,
4377
+ model: e.model,
4378
+ apiSource: e.apiSource ?? "platform",
4379
+ useServerProxy: e.useServerProxy ?? true
4380
+ };
4381
+ if (e.hasImageOutput) rawRecord.hasImageOutput = true;
4382
+ if (e.imageModel) rawRecord.imageModel = e.imageModel;
4383
+ if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
4384
+ if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
4385
+ return {
4386
+ key,
4387
+ name: e.name,
4388
+ provider: e.provider,
4389
+ model: e.model,
4390
+ apiSource: e.apiSource ?? "platform",
4391
+ useServerProxy: e.useServerProxy ?? true,
4392
+ rawRecord
4393
+ };
4394
+ }
4395
+ var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
4396
+ builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
4397
+ );
4398
+ function resolveBuiltinPlatformAgentConfig(agentRef) {
4399
+ return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
4400
+ }
4401
+ function resolveBuiltinPlatformAgentRecord(agentRef) {
4402
+ const config = resolveBuiltinPlatformAgentConfig(agentRef);
4403
+ if (!config) return null;
4404
+ return {
4405
+ ...config.rawRecord,
4406
+ dbKey: agentRef,
4407
+ ...config.name ? { name: config.name } : {}
4408
+ };
4409
+ }
4410
+
3806
4411
  // packages/chat/dialog/dialogAgentPolicy.ts
3807
4412
  var resolveDialogAgentMode = (dialog) => {
3808
4413
  if (dialog?.agentMode === "auto") return "auto";
@@ -3812,7 +4417,8 @@ var resolveDialogAgentMode = (dialog) => {
3812
4417
  var isAutoDialog = (dialog) => resolveDialogAgentMode(dialog) === "auto";
3813
4418
  var resolveDialogAutoTier = (dialog) => {
3814
4419
  const tier = asOptionalTrimmedString(dialog?.autoRoute?.stickyTier);
3815
- return tier === "flash" || tier === "balanced" || tier === "quality" || tier === "image" ? tier : void 0;
4420
+ if (tier === "image") return "flash";
4421
+ return tier === "flash" || tier === "balanced" || tier === "quality" ? tier : void 0;
3816
4422
  };
3817
4423
  var resolveDialogRuntimeAgentKey = (dialog, explicitAgentKey) => {
3818
4424
  const explicit = asOptionalTrimmedString(explicitAgentKey);
@@ -3865,13 +4471,13 @@ function assemblePersistedUserMessage(input) {
3865
4471
  dialogKey,
3866
4472
  currentAccountUserId
3867
4473
  });
3868
- const { key: messageDbKey, messageId } = createDialogMessageKeyAndId(
4474
+ const { key: messageDbKey2, messageId } = createDialogMessageKeyAndId(
3869
4475
  dialogId
3870
4476
  );
3871
4477
  const fullMessage = {
3872
4478
  ...message,
3873
4479
  id: messageId,
3874
- dbKey: messageDbKey,
4480
+ dbKey: messageDbKey2,
3875
4481
  userId
3876
4482
  };
3877
4483
  return { fullMessage, dialogId, dialogKey };
@@ -5567,7 +6173,7 @@ var messageSlice = createSliceWithThunks({
5567
6173
  runtimeOptions: args.runtimeOptions
5568
6174
  });
5569
6175
  if (agentKeyToUse) {
5570
- const { streamAgentChatTurn } = await import("./agentSlice-D666DABC.js");
6176
+ const { streamAgentChatTurn } = await import("./agentSlice-3ZHY7RAO.js");
5571
6177
  await dispatch(
5572
6178
  streamAgentChatTurn({
5573
6179
  agentKey: agentKeyToUse,
@@ -6928,6 +7534,187 @@ var signUpAction = async (user, thunkAPI) => {
6928
7534
  return { user: parsedUser, token };
6929
7535
  };
6930
7536
 
7537
+ // packages/auth/routes.ts
7538
+ var authRoutes = {
7539
+ login: {
7540
+ path: `${API_VERSION}/users/login`,
7541
+ method: "POST",
7542
+ createPath: () => `${API_VERSION}/users/login`
7543
+ },
7544
+ signup: {
7545
+ path: `${API_VERSION}/users/signup`,
7546
+ method: "POST",
7547
+ createPath: () => `${API_VERSION}/users/signup`
7548
+ },
7549
+ users: {
7550
+ cliLoginStart: {
7551
+ path: `${API_VERSION}/users/cli-login/start`,
7552
+ method: "POST",
7553
+ createPath: () => `${API_VERSION}/users/cli-login/start`
7554
+ },
7555
+ cliLoginAuthorize: {
7556
+ path: `${API_VERSION}/users/cli-login/authorize`,
7557
+ method: "POST",
7558
+ createPath: () => `${API_VERSION}/users/cli-login/authorize`
7559
+ },
7560
+ cliLoginPoll: {
7561
+ path: `${API_VERSION}/users/cli-login/poll`,
7562
+ method: "POST",
7563
+ createPath: () => `${API_VERSION}/users/cli-login/poll`
7564
+ },
7565
+ list: {
7566
+ path: `${API_VERSION}/users`,
7567
+ method: "GET",
7568
+ createPath: () => `${API_VERSION}/users`
7569
+ },
7570
+ usageReport: {
7571
+ path: `${API_VERSION}/users/usage-report`,
7572
+ method: "GET",
7573
+ createPath: () => `${API_VERSION}/users/usage-report`
7574
+ },
7575
+ growthReport: {
7576
+ path: `${API_VERSION}/users/growth-report`,
7577
+ method: "GET",
7578
+ createPath: () => `${API_VERSION}/users/growth-report`
7579
+ },
7580
+ providerBillingHealth: {
7581
+ path: `${API_VERSION}/users/provider-billing-health`,
7582
+ method: "GET",
7583
+ createPath: () => `${API_VERSION}/users/provider-billing-health`
7584
+ },
7585
+ providerBillingDrilldown: {
7586
+ path: `${API_VERSION}/users/provider-billing-drilldown`,
7587
+ method: "GET",
7588
+ createPath: () => `${API_VERSION}/users/provider-billing-drilldown`
7589
+ },
7590
+ providerCredentials: {
7591
+ path: `${API_VERSION}/users/provider-credentials`,
7592
+ method: "GET",
7593
+ createPath: () => `${API_VERSION}/users/provider-credentials`
7594
+ },
7595
+ providerCredentialLifecycle: {
7596
+ path: `${API_VERSION}/users/provider-credentials/lifecycle`,
7597
+ method: "POST",
7598
+ createPath: () => `${API_VERSION}/users/provider-credentials/lifecycle`
7599
+ },
7600
+ billingAnomalyLifecycle: {
7601
+ path: `${API_VERSION}/users/billing-anomalies/lifecycle`,
7602
+ method: "POST",
7603
+ createPath: () => `${API_VERSION}/users/billing-anomalies/lifecycle`
7604
+ },
7605
+ billingAnomalyDrilldown: {
7606
+ path: `${API_VERSION}/users/billing-anomalies/drilldown`,
7607
+ method: "GET",
7608
+ createPath: () => `${API_VERSION}/users/billing-anomalies/drilldown`
7609
+ },
7610
+ billingAnomalyAudit: {
7611
+ path: `${API_VERSION}/users/billing-anomalies/audit`,
7612
+ method: "POST",
7613
+ createPath: () => `${API_VERSION}/users/billing-anomalies/audit`
7614
+ },
7615
+ detail: {
7616
+ path: `${API_VERSION}/users/:userId`,
7617
+ method: "GET",
7618
+ createPath: (params) => `${API_VERSION}/users/${params.userId}`
7619
+ },
7620
+ sessionRevoke: {
7621
+ path: `${API_VERSION}/users/session-revoke`,
7622
+ method: "POST",
7623
+ createPath: () => `${API_VERSION}/users/session-revoke`
7624
+ },
7625
+ transfer: {
7626
+ path: `${API_VERSION}/users/:userId/transfer`,
7627
+ method: "POST",
7628
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/transfer`
7629
+ },
7630
+ delete: {
7631
+ path: `${API_VERSION}/users/:userId`,
7632
+ method: "DELETE",
7633
+ createPath: (params) => `${API_VERSION}/users/${params.userId}`
7634
+ },
7635
+ disable: {
7636
+ path: `${API_VERSION}/users/:userId/disable`,
7637
+ method: "POST",
7638
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/disable`
7639
+ },
7640
+ enable: {
7641
+ path: `${API_VERSION}/users/:userId/enable`,
7642
+ method: "POST",
7643
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/enable`
7644
+ },
7645
+ adminPermissions: {
7646
+ path: `${API_VERSION}/users/:userId/admin-permissions`,
7647
+ method: "POST",
7648
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/admin-permissions`
7649
+ },
7650
+ sendEmail: {
7651
+ path: `${API_VERSION}/users/send-email`,
7652
+ method: "POST",
7653
+ createPath: () => `${API_VERSION}/users/send-email`
7654
+ },
7655
+ spaceInvite: {
7656
+ path: `${API_VERSION}/users/space-invite`,
7657
+ method: "POST",
7658
+ createPath: () => `${API_VERSION}/users/space-invite`
7659
+ },
7660
+ spaceInviteStatus: {
7661
+ path: `${API_VERSION}/users/space-invite/status`,
7662
+ method: "GET",
7663
+ createPath: () => `${API_VERSION}/users/space-invite/status`
7664
+ },
7665
+ spaceInviteAccept: {
7666
+ path: `${API_VERSION}/users/space-invite/accept`,
7667
+ method: "POST",
7668
+ createPath: () => `${API_VERSION}/users/space-invite/accept`
7669
+ },
7670
+ emailPreferencesGet: {
7671
+ path: `${API_VERSION}/users/email-preferences`,
7672
+ method: "GET",
7673
+ createPath: () => `${API_VERSION}/users/email-preferences`
7674
+ },
7675
+ emailPreferencesUpdate: {
7676
+ path: `${API_VERSION}/users/email-preferences`,
7677
+ method: "POST",
7678
+ createPath: () => `${API_VERSION}/users/email-preferences`
7679
+ },
7680
+ emailReport: {
7681
+ path: `${API_VERSION}/users/email-report`,
7682
+ method: "GET",
7683
+ createPath: () => `${API_VERSION}/users/email-report`
7684
+ },
7685
+ emailRetryRun: {
7686
+ path: `${API_VERSION}/users/email-retry/run`,
7687
+ method: "POST",
7688
+ createPath: () => `${API_VERSION}/users/email-retry/run`
7689
+ },
7690
+ emailReplayFailures: {
7691
+ path: `${API_VERSION}/users/email-replay-failures`,
7692
+ method: "POST",
7693
+ createPath: () => `${API_VERSION}/users/email-replay-failures`
7694
+ },
7695
+ emailConfigGet: {
7696
+ path: `${API_VERSION}/users/email-config`,
7697
+ method: "GET",
7698
+ createPath: () => `${API_VERSION}/users/email-config`
7699
+ },
7700
+ emailConfigUpdate: {
7701
+ path: `${API_VERSION}/users/email-config`,
7702
+ method: "POST",
7703
+ createPath: () => `${API_VERSION}/users/email-config`
7704
+ },
7705
+ emailUnsubscribe: {
7706
+ path: `${API_VERSION}/users/email-unsubscribe`,
7707
+ method: "GET",
7708
+ createPath: () => `${API_VERSION}/users/email-unsubscribe`
7709
+ },
7710
+ rechargeHistory: {
7711
+ path: `${API_VERSION}/users/:userId/recharge-history`,
7712
+ method: "POST",
7713
+ createPath: (params) => `${API_VERSION}/users/${params.userId}/recharge-history`
7714
+ }
7715
+ }
7716
+ };
7717
+
6931
7718
  // packages/auth/client/loginRequest.ts
6932
7719
  var loginRequest = async (currentServer, data) => {
6933
7720
  const path = authRoutes.login.createPath();
@@ -7837,6 +8624,46 @@ var resolveBillingTarget = ({
7837
8624
  };
7838
8625
  };
7839
8626
 
8627
+ // packages/agent-runtime/serverProxyPolicy.ts
8628
+ var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
8629
+ "antigravity",
8630
+ "xai",
8631
+ "chatgpt",
8632
+ "claude",
8633
+ "cursor"
8634
+ ]);
8635
+ function isGoogleFamilyProvider(provider) {
8636
+ const normalized = asTrimmedLowercaseString(provider);
8637
+ return normalized === "google" || normalized.startsWith("google-");
8638
+ }
8639
+ function isOAuthApiKeyRef(value) {
8640
+ const ref = asTrimmedLowercaseString(value);
8641
+ return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
8642
+ }
8643
+ function shouldUseServerProxy(agentConfig, requestProvider) {
8644
+ const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
8645
+ if (isGoogleFamilyProvider(effectiveProvider)) {
8646
+ return true;
8647
+ }
8648
+ if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
8649
+ return true;
8650
+ }
8651
+ if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
8652
+ return true;
8653
+ }
8654
+ return !!agentConfig.useServerProxy;
8655
+ }
8656
+ var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
8657
+ function isRemoteCustomEndpoint(url) {
8658
+ if (typeof url !== "string") return false;
8659
+ try {
8660
+ const host = new URL(url).hostname.toLowerCase();
8661
+ return !LOCAL_HOSTS.has(host);
8662
+ } catch {
8663
+ return false;
8664
+ }
8665
+ }
8666
+
7840
8667
  // packages/ai/token/prepareTokenUsageData.ts
7841
8668
  function resolveBillable(input) {
7842
8669
  const uid = input.userId?.trim();
@@ -8166,6 +8993,83 @@ var mergeDialogTokenStats = (dialogConfig, runtimeTokens) => ({
8166
8993
  totalCost: (dialogConfig?.totalCost ?? 0) + runtimeTokens.totalCost
8167
8994
  });
8168
8995
 
8996
+ // packages/core/chat/dialogAttachmentCleanup.ts
8997
+ var FILE_CONTENT_RE = /(?:https?:\/\/[^/"'\s]+)?\/api\/v1\/db\/file\/content\/([^?#"'\s)]+)/g;
8998
+ function extractFileContentIds(value) {
8999
+ const ids = /* @__PURE__ */ new Set();
9000
+ const visit = (input) => {
9001
+ if (typeof input === "string") {
9002
+ for (const match of input.matchAll(FILE_CONTENT_RE)) {
9003
+ const fileId = decodeURIComponent(match[1] ?? "").trim();
9004
+ if (fileId) ids.add(fileId);
9005
+ }
9006
+ return;
9007
+ }
9008
+ if (Array.isArray(input)) {
9009
+ for (const item of input) visit(item);
9010
+ return;
9011
+ }
9012
+ if (input && typeof input === "object") {
9013
+ for (const item of Object.values(input)) visit(item);
9014
+ }
9015
+ };
9016
+ visit(value);
9017
+ return [...ids];
9018
+ }
9019
+ function messageDbKey(dialogId, message) {
9020
+ const dbKey = asOptionalTrimmedString(message.dbKey);
9021
+ if (dbKey) return dbKey;
9022
+ const id = asOptionalTrimmedString(message.id);
9023
+ if (id) return dialogMessageKey(dialogId, id);
9024
+ return null;
9025
+ }
9026
+ function asText(value) {
9027
+ return asOptionalTrimmedString(value) ?? null;
9028
+ }
9029
+ function buildDialogAttachmentPlan(args) {
9030
+ const messageKeys = new Set(
9031
+ args.messages.map((message) => messageDbKey(args.dialogId, message)).filter((key) => Boolean(key))
9032
+ );
9033
+ const referencedFileIds = [
9034
+ ...new Set(args.messages.flatMap((message) => extractFileContentIds(message)))
9035
+ ];
9036
+ const candidates = referencedFileIds.map((fileId) => {
9037
+ const metadata = args.metadataByFileId[fileId];
9038
+ const ownerType = asText(metadata?.ownerType);
9039
+ const ownerId = asText(metadata?.ownerId);
9040
+ const ownerDbKey = asText(metadata?.ownerDbKey);
9041
+ const fileDbKey = asText(metadata?.dbKey);
9042
+ const source = asText(metadata?.source);
9043
+ const ownedByDialog = ownerType === "dialog" && ownerId === args.dialogId;
9044
+ const ownedByMessage = Boolean(ownerDbKey && messageKeys.has(ownerDbKey));
9045
+ const userOwnedReferenced = args.includeUserOwnedReferenced === true && Boolean(args.ownerId) && ownerType === "user" && ownerId === args.ownerId;
9046
+ const canDelete = Boolean(fileDbKey && (ownedByDialog || ownedByMessage || userOwnedReferenced));
9047
+ return {
9048
+ fileId,
9049
+ fileDbKey,
9050
+ size: asOptionalFiniteNumber(metadata?.size) ?? null,
9051
+ ownerType,
9052
+ ownerId,
9053
+ ownerDbKey,
9054
+ source,
9055
+ status: canDelete ? "delete" : "retain",
9056
+ reason: canDelete ? ownedByMessage ? "ownerDbKey matches a message in this dialog" : userOwnedReferenced ? "user-owned file is referenced by this dialog and explicit referenced-attachment deletion is enabled" : "ownerType/ownerId matches this dialog" : fileDbKey ? "file ownership is not exclusive to this dialog" : "file metadata not found"
9057
+ };
9058
+ });
9059
+ const deleteCandidates = candidates.filter((candidate) => candidate.status === "delete");
9060
+ const retainedCandidates = candidates.filter((candidate) => candidate.status === "retain");
9061
+ return {
9062
+ dialogId: args.dialogId,
9063
+ messageCount: args.messages.length,
9064
+ referencedFileIds,
9065
+ candidates,
9066
+ deleteCandidates,
9067
+ retainedCandidates,
9068
+ bytesToDelete: deleteCandidates.reduce((sum, candidate) => sum + (candidate.size ?? 0), 0),
9069
+ metadataReadFailures: args.metadataReadFailures ?? []
9070
+ };
9071
+ }
9072
+
8169
9073
  // packages/chat/dialog/deleteDialogOrchestration.ts
8170
9074
  var collectKeys = async (prefix, db) => {
8171
9075
  const keys = [];
@@ -8244,7 +9148,7 @@ var deleteOwnedDialogAttachments = async (args) => {
8244
9148
  metadataReadFailures
8245
9149
  });
8246
9150
  if (!plan.deleteCandidates.length) return plan;
8247
- const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
9151
+ const { deleteFileAction } = await import("./deleteFile-AC45HYSM.js");
8248
9152
  for (const candidate of plan.deleteCandidates) {
8249
9153
  if (candidate.fileDbKey) {
8250
9154
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -8306,7 +9210,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8306
9210
  }
8307
9211
  if (isCurrentDialog) {
8308
9212
  await thunkApi.dispatch(resetMsgs());
8309
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-TKYB6VLO.js");
9213
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-CFDECXEU.js");
8310
9214
  dispatch(clearPendingAttachments2());
8311
9215
  clearWorkflow();
8312
9216
  }
@@ -8315,39 +9219,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
8315
9219
 
8316
9220
  // packages/chat/dialog/dialogSlice.ts
8317
9221
  var runCreateDialogAction = async (args, thunkApi) => {
8318
- const { createDialogAction } = await import("./createDialogAction-KWZ74S2G.js");
9222
+ const { createDialogAction } = await import("./createDialogAction-R5MCL4RE.js");
8319
9223
  return createDialogAction(args, thunkApi);
8320
9224
  };
8321
9225
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
8322
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-VK3N263U.js");
9226
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-3GMH6ORX.js");
8323
9227
  return createAgentAutomationAction(args, thunkApi);
8324
9228
  };
8325
9229
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
8326
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-DQYY564Y.js");
9230
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-3J7GH67I.js");
8327
9231
  return updateDialogTitleAction(args, thunkApi);
8328
9232
  };
8329
9233
  var runAddDialogAgentAction = async (args, thunkApi) => {
8330
- const { addDialogAgentAction } = await import("./addDialogAgentAction-Q2TYWDO6.js");
9234
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-VUNVD2XR.js");
8331
9235
  return addDialogAgentAction(args, thunkApi);
8332
9236
  };
8333
9237
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
8334
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-K4HOWFHO.js");
9238
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-TBW3UZJW.js");
8335
9239
  return removeDialogAgentAction(args, thunkApi);
8336
9240
  };
8337
9241
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
8338
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-YWSA5XEU.js");
9242
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-FQ5R3EFJ.js");
8339
9243
  return setPrimaryDialogAgentAction(args, thunkApi);
8340
9244
  };
8341
9245
  var runSwitchDialogAgentAction = async (args, thunkApi) => {
8342
- const { switchDialogAgentAction } = await import("./switchDialogAgentAction-6JKFBJVR.js");
9246
+ const { switchDialogAgentAction } = await import("./switchDialogAgentAction-QQGVE4SL.js");
8343
9247
  return switchDialogAgentAction(args, thunkApi);
8344
9248
  };
8345
9249
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
8346
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-JD7J7JM4.js");
9250
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-Q3ANF2NR.js");
8347
9251
  return setDialogExtraReferencesAction(args, thunkApi);
8348
9252
  };
8349
9253
  var runHandleSendMessageAction = async (args, thunkApi) => {
8350
- const { handleSendMessageAction } = await import("./handleSendMessageAction-7OVC2SVU.js");
9254
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-IU2QNTLM.js");
8351
9255
  return handleSendMessageAction(args, thunkApi);
8352
9256
  };
8353
9257
  function clearDialogState() {
@@ -8360,7 +9264,7 @@ var createPageAndAddReference = createAsyncThunk(
8360
9264
  async (payload, { dispatch, getState, rejectWithValue }) => {
8361
9265
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
8362
9266
  try {
8363
- const { createDocState } = await import("./docStore-E5QAM75M.js");
9267
+ const { createDocState } = await import("./docStore-MZZWJM4F.js");
8364
9268
  const pageKey = await createDocState(
8365
9269
  { slateData, title },
8366
9270
  { dispatch, getState }
@@ -12394,11 +13298,11 @@ var ENTITY_DELETE_STRATEGIES = {
12394
13298
  await dispatch(deleteTable({ dbKey: key })).unwrap();
12395
13299
  },
12396
13300
  file: async (key, { thunkAPI }) => {
12397
- const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
13301
+ const { deleteFileAction } = await import("./deleteFile-AC45HYSM.js");
12398
13302
  await deleteFileAction(key, thunkAPI);
12399
13303
  },
12400
13304
  image: async (key, { thunkAPI }) => {
12401
- const { deleteFileAction } = await import("./deleteFile-WDZ3VM7B.js");
13305
+ const { deleteFileAction } = await import("./deleteFile-AC45HYSM.js");
12402
13306
  await deleteFileAction(key, thunkAPI);
12403
13307
  },
12404
13308
  agent: async (key, { dispatch, userId, sourceServerOrigin }) => {
@@ -14611,7 +15515,7 @@ var fetchSpaceAction = async (input, thunkAPI) => {
14611
15515
  const spaceKey = createSpaceKey.space(spaceId);
14612
15516
  const readSpace = async (dbKey) => {
14613
15517
  try {
14614
- const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-GOKRGQ47.js");
15518
+ const { read: read2, readAndWait: readAndWait2 } = await import("./dbSlice-OBV7VFCF.js");
14615
15519
  if (fresh) {
14616
15520
  return await dispatch(readAndWait2(dbKey)).unwrap();
14617
15521
  }
@@ -15294,38 +16198,21 @@ var selectViewMode = createSelector(
15294
16198
  var spaceSlice_default = spaceSlice.reducer;
15295
16199
 
15296
16200
  export {
15297
- instance,
15298
- initReactI18next,
15299
- i18nBaseConfig,
15300
- isAssistantToolStub,
16201
+ resolveBuiltinPlatformAgentConfig,
16202
+ resolveBuiltinPlatformAgentRecord,
15301
16203
  fetchAndCacheMessages,
15302
- extractReferenceKeysFromMessage,
15303
- normalizeAppRouteId,
15304
- uiAskChoiceFunctionSchema,
15305
- uiAskChoiceFunc,
15306
- parseUiAskChoiceContent,
15307
- PERSONALIZATION_DIALOG_CATEGORY,
15308
- buildPersonalizationDialogPolicyContext,
15309
- resolveDialogRuntimeAgentKey,
15310
- resolveHandleSendMessageContext,
15311
- estimateMissingUsage,
15312
- selectCurrentDialogId,
15313
- selectAllMsgs,
15314
- selectMsgById,
15315
- addUserMessage,
15316
- messageStreaming,
15317
- removeTransientMessage,
15318
- finalizeTransientMessageOnError,
15319
- prepareAndPersistMessage,
15320
- prepareAndPersistUserMessage,
15321
- messageStreamEnd,
15322
- addToolMessage,
15323
- updateToolMessage,
16204
+ fetchAndCacheTableRows,
16205
+ estimateTokenCount,
16206
+ isAssistantToolStub,
16207
+ isOAuthApiKeyRef,
16208
+ shouldUseServerProxy,
15324
16209
  setWorkflow,
15325
16210
  updateStep,
15326
16211
  incrementStepsExecuted,
15327
16212
  incrementFailedSteps,
15328
- fetchAndCacheTableRows,
16213
+ instance,
16214
+ initReactI18next,
16215
+ i18nBaseConfig,
15329
16216
  client_default,
15330
16217
  createTable,
15331
16218
  addRow,
@@ -15388,13 +16275,45 @@ export {
15388
16275
  selectIsDialogUnreadFromEntity,
15389
16276
  selectViewMode,
15390
16277
  spaceSlice_default,
16278
+ authRoutes,
15391
16279
  selectCurrentUserBalance,
16280
+ buildDatabaseFileContentUrl,
16281
+ uiAskChoiceFunctionSchema,
16282
+ uiAskChoiceFunc,
16283
+ parseUiAskChoiceContent,
16284
+ resolveDialogRuntimeAgentKey,
16285
+ normalizeAppRouteId,
16286
+ DEFAULT_CONTEXT_WINDOW,
16287
+ getModelContextWindow,
16288
+ getModelInfo,
15392
16289
  API_REPORTED_COST_MULTIPLIER,
15393
16290
  normalizeUsage,
15394
16291
  prepareTokenUsageData,
15395
16292
  applyTokenUsageToDayStats,
15396
16293
  runKeyed,
15397
16294
  updateTokensAction,
16295
+ extractReferenceKeysFromMessage,
16296
+ estimateMissingUsage,
16297
+ serializeMessageContent,
16298
+ planContextUsage,
16299
+ planCompression,
16300
+ PERSONALIZATION_DIALOG_CATEGORY,
16301
+ buildPersonalizationDialogPolicyContext,
16302
+ resolveHandleSendMessageContext,
16303
+ selectCurrentDialogId,
16304
+ selectAllMsgs,
16305
+ selectMsgById,
16306
+ addUserMessage,
16307
+ messageStreaming,
16308
+ removeTransientMessage,
16309
+ finalizeTransientMessageOnError,
16310
+ prepareAndPersistMessage,
16311
+ prepareAndPersistUserMessage,
16312
+ messageStreamEnd,
16313
+ addToolMessage,
16314
+ updateToolMessage,
16315
+ extractFileContentIds,
16316
+ buildDialogAttachmentPlan,
15398
16317
  clearDialogState,
15399
16318
  createPageAndAddReference,
15400
16319
  deleteDialog,