nolo-cli 0.54.0-alpha.2 → 0.54.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.
Files changed (133) hide show
  1. package/{_executeModel-ANY4SIAS.js → _executeModel-OPTKYHJA.js} +48 -42
  2. package/{action-Q4W5JPI5.js → action-ORXWW2ZG.js} +8 -8
  3. package/{addContentAction-O25HFR37.js → addContentAction-53BZ34AE.js} +8 -7
  4. package/{addDialogAgentAction-GH7AUPPB.js → addDialogAgentAction-JRYUS54Y.js} +10 -9
  5. package/{agentDeleteCommand-JWIKNWWI.js → agentDeleteCommand-FJIWU2BS.js} +30 -28
  6. package/{agentEmailCommands-PL22BEU5.js → agentEmailCommands-CE32L43B.js} +57 -52
  7. package/{agentListCommands-6NR7AQEK.js → agentListCommands-VJNKULIK.js} +42 -33
  8. package/{agentMachineCommands-TASPU6OA.js → agentMachineCommands-HCJ3WQXL.js} +30 -28
  9. package/{agentRecordCommands-Z64TA63M.js → agentRecordCommands-QFWERED4.js} +55 -50
  10. package/{agentRunCommand-4QJQLPRW.js → agentRunCommand-G3GQMUNN.js} +65 -53
  11. package/{agentRunControl-4GHHSXFZ.js → agentRunControl-INKFDXDA.js} +3 -1
  12. package/{agentRuntimeLocal-PCJJ56J2.js → agentRuntimeLocal-K327ELSL.js} +30 -26
  13. package/{agentSlice-KYLDUSNN.js → agentSlice-ODKF4J6M.js} +8 -8
  14. package/{agentSuperviseCommands-VB6BUS5H.js → agentSuperviseCommands-5AR3DKNN.js} +2 -2
  15. package/{appDeleteCommands-WLHMJAVT.js → appDeleteCommands-XUXMFDI4.js} +31 -29
  16. package/{appDeployCommands-CKON7N2E.js → appDeployCommands-37F4GPCU.js} +31 -29
  17. package/{appDeployStatusCommands-PXRLDASH.js → appDeployStatusCommands-WSPU7TUK.js} +31 -29
  18. package/{appGetCommands-RAB5RM4M.js → appGetCommands-YLOBA3EM.js} +31 -29
  19. package/{appListCommands-GU57FB62.js → appListCommands-UD62R5ME.js} +31 -29
  20. package/{authCommand-QOPOEYEK.js → authCommand-OK6HLHGS.js} +13 -13
  21. package/{authCommands-SBQVTD6V.js → authCommands-2DUIUEMT.js} +2 -2
  22. package/{chatQueueReduxAdapter-5O2WLITN.js → chatQueueReduxAdapter-TV2TUOQS.js} +26 -23
  23. package/{chunk-7CH6U3FL.js → chunk-2GRGFCF6.js} +2 -4
  24. package/{chunk-T27IEBNQ.js → chunk-2QDDKFG5.js} +74 -1
  25. package/{chunk-VULELK4T.js → chunk-2WBFJHQA.js} +4 -26
  26. package/{chunk-IKTHA3JH.js → chunk-3LKZRP7E.js} +2 -2
  27. package/{chunk-INXBNYCG.js → chunk-3Y2K5O2R.js} +64 -6
  28. package/{chunk-VRZIH5JO.js → chunk-3ZTR7ZO4.js} +1 -1
  29. package/{chunk-GV35EHNA.js → chunk-5FCIPEKT.js} +262 -96
  30. package/{chunk-RTLJUGQH.js → chunk-5UAYZEXO.js} +2 -2
  31. package/{chunk-TI5BCZCH.js → chunk-6COJEAYH.js} +32 -101
  32. package/{chunk-Y7LNKP32.js → chunk-6HDYSFLO.js} +4 -6
  33. package/chunk-6IGD47IC.js +19 -0
  34. package/chunk-6YTOJY35.js +352 -0
  35. package/{chunk-6FGXGFAH.js → chunk-75MSWWUE.js} +1 -1
  36. package/{chunk-3Z3DXZBD.js → chunk-7FAS3NEF.js} +16 -16
  37. package/{chunk-AV6KQCM5.js → chunk-7NYDJAQ7.js} +19 -14
  38. package/{chunk-CVT7L2WZ.js → chunk-A65UV3M5.js} +4 -4
  39. package/{chunk-7APQB6R6.js → chunk-AUVFJGPC.js} +3 -3
  40. package/{chunk-H4RYESI6.js → chunk-BBTN4NQD.js} +4 -4
  41. package/{chunk-757BGY6Y.js → chunk-BG7J6Y5X.js} +1 -1
  42. package/chunk-BY2FF2C4.js +526 -0
  43. package/{chunk-FA4SY4F5.js → chunk-BYEJ7K2Z.js} +1 -1
  44. package/chunk-BYXBJQAS.js +0 -0
  45. package/{chunk-3AOLVADY.js → chunk-DVINR3PL.js} +1 -1
  46. package/{chunk-UITMHBVK.js → chunk-EA5OYZVD.js} +1 -1
  47. package/{chunk-4NN3EK7H.js → chunk-EICIFHVS.js} +1 -1
  48. package/chunk-EJE33XNR.js +19059 -0
  49. package/{chunk-6SZ52ORL.js → chunk-FJHMLRDQ.js} +9 -9
  50. package/{chunk-RU5D3B22.js → chunk-GRFK2XP4.js} +2 -2
  51. package/{chunk-J3UALFHL.js → chunk-HJTAGT3W.js} +1 -1
  52. package/{chunk-WL3UOGYO.js → chunk-HPW5MNDQ.js} +38 -98
  53. package/{chunk-H2G6JXTR.js → chunk-HQUORJTM.js} +1 -1
  54. package/{chunk-OYNDYVSE.js → chunk-JON2PHYT.js} +1 -1
  55. package/{chunk-7K5VMB4Q.js → chunk-JXIP6ZWH.js} +7 -7
  56. package/{chunk-KUUTWU4I.js → chunk-K4NISKOR.js} +46 -8
  57. package/{chunk-SP3DPVBH.js → chunk-KLIBF3BY.js} +2 -2
  58. package/chunk-LRGKOI5Y.js +297 -0
  59. package/{chunk-LN3OQJGG.js → chunk-MLEZPE3U.js} +2 -2
  60. package/{chunk-FGEYVPPR.js → chunk-MYMBBB6Q.js} +5 -64
  61. package/{chunk-VRJUIUIY.js → chunk-N4JKMCY3.js} +2 -2
  62. package/{chunk-U5Z7LFZF.js → chunk-NFLA6GSU.js} +4 -4
  63. package/{chunk-SVEUG45B.js → chunk-NHRQCXIQ.js} +0 -24
  64. package/{chunk-56W233KG.js → chunk-NJUQBYFJ.js} +3 -1
  65. package/{chunk-Q24S4NDF.js → chunk-Q4XZVZPN.js} +1 -1
  66. package/{chunk-UW4INMD2.js → chunk-RHMDMTDK.js} +2 -2
  67. package/{chunk-MFI4FGHX.js → chunk-SAJSBPI2.js} +1 -1
  68. package/{chunk-WHVQA7PJ.js → chunk-SSXTSPSG.js} +27 -6
  69. package/{chunk-2BWU4ORW.js → chunk-SUEIAK5N.js} +1 -1
  70. package/{chunk-3QJTD6DO.js → chunk-SVC3GGUA.js} +5 -5
  71. package/{chunk-QDHZCAH3.js → chunk-SVDMVX4G.js} +118 -2
  72. package/{chunk-GBADO3SM.js → chunk-SWJGJMTW.js} +1 -1
  73. package/{chunk-DQLYEGP7.js → chunk-SYYUU7EV.js} +2 -2
  74. package/{chunk-U2A47SVI.js → chunk-TC6P4NDR.js} +7 -7
  75. package/{chunk-V4KZGLOI.js → chunk-TR4DXUYX.js} +1983 -447
  76. package/{chunk-BANYWEYY.js → chunk-TY3ADTX5.js} +1 -1
  77. package/chunk-UAD2WT54.js +64 -0
  78. package/{chunk-PAHILFNT.js → chunk-UGBHDMHI.js} +4 -4
  79. package/{chunk-6FQ2552G.js → chunk-UOWXD4VN.js} +799 -956
  80. package/{chunk-5WADL4O7.js → chunk-UR66XPVF.js} +3 -3
  81. package/{chunk-6BYAXNH5.js → chunk-VZMUOPYG.js} +12 -2
  82. package/{chunk-LA4IDAK7.js → chunk-WQHGJHAL.js} +440 -2981
  83. package/{chunk-GLGD2JGY.js → chunk-XIJZOCSP.js} +7 -7
  84. package/{chunk-BJLYCOZK.js → chunk-YBFJQC2M.js} +93 -776
  85. package/{chunk-MRWGHF56.js → chunk-YDH3FDFQ.js} +12 -356
  86. package/{chunk-32I5RVMY.js → chunk-YLCUU3WM.js} +3 -3
  87. package/{chunk-D3JQPONH.js → chunk-YQBXOHE6.js} +1 -1
  88. package/chunk-ZJ7UHBJS.js +89 -0
  89. package/{chunk-TNPCQNGQ.js → chunk-ZVOHVJI3.js} +4 -9
  90. package/contentThunks-KNI6VXLT.js +71 -0
  91. package/{createAgentAutomationAction-UJLNFFFC.js → createAgentAutomationAction-OK4L33KF.js} +27 -23
  92. package/{createDialogAction-TJCX6GUE.js → createDialogAction-JDSMY4AY.js} +28 -24
  93. package/{createPageAction-N3IYABHV.js → createPageAction-T7RA3HCG.js} +29 -24
  94. package/{dbSlice-D5CNGWPD.js → dbSlice-TVX6SN2T.js} +6 -6
  95. package/{deleteFile-44TUM34Y.js → deleteFile-JYKRT7C3.js} +3 -3
  96. package/{dialogCommands-35M6RBAC.js → dialogCommands-UQZYWOOV.js} +32 -30
  97. package/{dialogSlice-KO7ADD7H.js → dialogSlice-TYW2G7IL.js} +26 -23
  98. package/{docCreateCommands-VXHZWQ3P.js → docCreateCommands-OA6HZBWO.js} +34 -32
  99. package/{docDeleteCommands-4WFAJR6A.js → docDeleteCommands-KBB3YQI2.js} +31 -29
  100. package/{docReadCommands-OYREEFAR.js → docReadCommands-ZLMFVC67.js} +30 -28
  101. package/{docStore-5BU76DFK.js → docStore-2URPBVCS.js} +8 -33
  102. package/{docUpdateCommands-A7QERSME.js → docUpdateCommands-HMH5KUON.js} +34 -32
  103. package/{fetchMessages-KZQVBXKY.js → fetchMessages-DRABNDPZ.js} +3 -3
  104. package/{getPricing-HAU62AFM.js → getPricing-RFOPUWHY.js} +4 -4
  105. package/{handleSendMessageAction-OSGQJQ45.js → handleSendMessageAction-GO53TY7U.js} +28 -25
  106. package/index.js +56 -56
  107. package/{localDialogRead-NQ33HBSI.js → localDialogRead-PUQKFI73.js} +1 -1
  108. package/{machineCommands-J43U3TX5.js → machineCommands-RK6L7ZWL.js} +59 -54
  109. package/{machineWsRunDispatch-Z2Z6STXZ.js → machineWsRunDispatch-3X64DW2Z.js} +54 -49
  110. package/memberThunks-THZYZFSN.js +638 -0
  111. package/{models-4QF4BJVY.js → models-JVKUEER5.js} +2 -2
  112. package/package.json +1 -1
  113. package/{read-RGNPI5H2.js → read-K4JU4MQC.js} +3 -3
  114. package/{readDocTool-6ESWKTXD.js → readDocTool-LQGR6FUN.js} +1 -1
  115. package/{readlineWorkspace-YRPV6JPN.js → readlineWorkspace-XUFJV3RS.js} +604 -263
  116. package/{removeDialogAgentAction-JYT73FU2.js → removeDialogAgentAction-ECHCFB7N.js} +12 -11
  117. package/{runAgentClientLoop-5YM5WMAY.js → runAgentClientLoop-24GQ2AW6.js} +46 -40
  118. package/{setDialogExtraReferencesAction-D564LMYQ.js → setDialogExtraReferencesAction-KCVJNGMB.js} +9 -8
  119. package/{setPrimaryDialogAgentAction-ACY3BLYA.js → setPrimaryDialogAgentAction-VDOBOMKC.js} +12 -11
  120. package/{settingSlice-MKI3MNZJ.js → settingSlice-VR2IJSXC.js} +7 -7
  121. package/{skillDiscovery-GPUDHDTZ.js → skillDiscovery-2QTZINON.js} +3 -3
  122. package/{spaceCommands-MY26V52L.js → spaceCommands-S5YJJXL7.js} +30 -28
  123. package/{streamAgentChatTurn-XV5X5TNQ.js → streamAgentChatTurn-QHKP3ABO.js} +77 -64
  124. package/{switchDialogAgentAction-CJ5H6SAR.js → switchDialogAgentAction-5L4UP7VI.js} +10 -9
  125. package/{toolApiClient-B2MFXMEG.js → toolApiClient-53U4UDFF.js} +3 -2
  126. package/{tools-MIMELA2Y.js → tools-SSXSTC3O.js} +37 -32
  127. package/{tuiSummaryLlmCaller-XJ5BKNNS.js → tuiSummaryLlmCaller-URFJHFC5.js} +17 -15
  128. package/{updateDialogTitleAction-EIZUSWHR.js → updateDialogTitleAction-YFYAEW3T.js} +28 -24
  129. package/chunk-6BGAQ3KR.js +0 -7081
  130. package/chunk-YBV6QJKM.js +0 -441
  131. package/spaceSlice-JUIXC365.js +0 -127
  132. package/{chunk-NQ4N4IGO.js → chunk-CS6TCJ7E.js} +3 -3
  133. package/{chunk-PYKV6FSC.js → chunk-XOJRZUPF.js} +3 -3
@@ -0,0 +1,352 @@
1
+ import {
2
+ require_react
3
+ } from "./chunk-YDH3FDFQ.js";
4
+ import {
5
+ __toESM
6
+ } from "./chunk-4VNS5WPM.js";
7
+
8
+ // packages/chat/dialog/dialogRuntimeTypes.ts
9
+ var GLOBAL_DIALOG_RUNTIME_KEY = "__global__";
10
+
11
+ // packages/chat/dialog/dialogRuntimeStore.ts
12
+ var import_react = __toESM(require_react());
13
+ var createEmptyTokenStats = () => ({
14
+ inputTokens: 0,
15
+ outputTokens: 0,
16
+ totalCost: 0
17
+ });
18
+ var createEmptyDialogRuntimeState = () => ({
19
+ tokens: createEmptyTokenStats(),
20
+ pendingFiles: [],
21
+ activeControllers: {},
22
+ pendingRawData: {},
23
+ loopStopReason: null,
24
+ pendingUserInputQueue: []
25
+ });
26
+ var activeDialogKey = null;
27
+ var configError = null;
28
+ var runtimeByKey = {
29
+ [GLOBAL_DIALOG_RUNTIME_KEY]: createEmptyDialogRuntimeState()
30
+ };
31
+ var listeners = /* @__PURE__ */ new Set();
32
+ var version = 0;
33
+ var notify = () => {
34
+ version += 1;
35
+ for (const listener of listeners) {
36
+ try {
37
+ listener();
38
+ } catch {
39
+ }
40
+ }
41
+ };
42
+ var action = (type, payload) => ({ type, payload });
43
+ function setActiveDialogKey(key) {
44
+ activeDialogKey = key;
45
+ configError = null;
46
+ notify();
47
+ }
48
+ function getActiveDialogKey() {
49
+ return activeDialogKey;
50
+ }
51
+ function setDialogConfigError(error) {
52
+ configError = error;
53
+ notify();
54
+ }
55
+ function getDialogConfigError() {
56
+ return configError;
57
+ }
58
+ var resolveDialogRuntimeKey = (dialogKey) => dialogKey ?? activeDialogKey ?? GLOBAL_DIALOG_RUNTIME_KEY;
59
+ var ensureDialogRuntimeState = (dialogKey) => {
60
+ const runtimeKey = resolveDialogRuntimeKey(dialogKey);
61
+ if (!runtimeByKey[runtimeKey]) {
62
+ runtimeByKey[runtimeKey] = createEmptyDialogRuntimeState();
63
+ }
64
+ return runtimeByKey[runtimeKey];
65
+ };
66
+ function resetDialogRuntimeSessionState(dialogKey) {
67
+ const runtime = ensureDialogRuntimeState(dialogKey);
68
+ runtime.tokens = createEmptyTokenStats();
69
+ runtime.loopStopReason = null;
70
+ runtime.pendingUserInputQueue = [];
71
+ notify();
72
+ }
73
+ function addPendingFile(payload) {
74
+ const targetRuntimeKey = payload.targetDialogKey ?? payload.runtimeDialogKey ?? (payload.type === "dialog" ? activeDialogKey : payload.dialogKey);
75
+ const runtime = ensureDialogRuntimeState(targetRuntimeKey);
76
+ if (!runtime.pendingFiles.some((f) => f.id === payload.id)) {
77
+ runtime.pendingFiles.push(payload);
78
+ notify();
79
+ }
80
+ return action("dialogRuntime/addPendingFile", payload);
81
+ }
82
+ function removePendingFile(fileId) {
83
+ const runtime = ensureDialogRuntimeState();
84
+ const fileToRemove = runtime.pendingFiles.find((f) => f.id === fileId);
85
+ if (fileToRemove) {
86
+ if (fileToRemove.pageKey) {
87
+ delete runtime.pendingRawData[fileToRemove.pageKey];
88
+ }
89
+ runtime.pendingFiles = runtime.pendingFiles.filter(
90
+ (file) => file.id !== fileId
91
+ );
92
+ notify();
93
+ }
94
+ return action("dialogRuntime/removePendingFile", fileId);
95
+ }
96
+ function clearPendingAttachments(payload) {
97
+ if (payload?.all) {
98
+ Object.values(runtimeByKey).forEach((runtime2) => {
99
+ runtime2.pendingFiles = [];
100
+ runtime2.pendingRawData = {};
101
+ });
102
+ notify();
103
+ return action("dialogRuntime/clearPendingAttachments", payload);
104
+ }
105
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
106
+ runtime.pendingFiles = [];
107
+ runtime.pendingRawData = {};
108
+ notify();
109
+ return action("dialogRuntime/clearPendingAttachments", payload);
110
+ }
111
+ function setLoopStopReason(payload) {
112
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
113
+ runtime.loopStopReason = payload.reason;
114
+ notify();
115
+ return action("dialogRuntime/setLoopStopReason", payload);
116
+ }
117
+ function clearDialogRuntimeState(payload) {
118
+ delete runtimeByKey[payload.dialogKey];
119
+ notify();
120
+ return action("dialogRuntime/clearDialogRuntimeState", payload);
121
+ }
122
+ function addActiveController(payload) {
123
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
124
+ runtime.activeControllers[payload.messageId] = payload.controller;
125
+ notify();
126
+ return action("dialogRuntime/addActiveController", payload);
127
+ }
128
+ function removeActiveController(payload) {
129
+ const normalized = typeof payload === "string" ? { messageId: payload } : payload;
130
+ const runtime = ensureDialogRuntimeState(normalized.dialogKey);
131
+ delete runtime.activeControllers[normalized.messageId];
132
+ notify();
133
+ return action("dialogRuntime/removeActiveController", normalized);
134
+ }
135
+ function clearActiveControllers(payload) {
136
+ if (payload?.all) {
137
+ Object.values(runtimeByKey).forEach((runtime2) => {
138
+ runtime2.activeControllers = {};
139
+ });
140
+ notify();
141
+ return action("dialogRuntime/clearActiveControllers", payload);
142
+ }
143
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
144
+ runtime.activeControllers = {};
145
+ notify();
146
+ return action("dialogRuntime/clearActiveControllers", payload);
147
+ }
148
+ function enqueueUserInput(payload) {
149
+ const normalized = typeof payload === "string" ? { text: payload } : payload;
150
+ const runtime = ensureDialogRuntimeState(normalized.dialogKey);
151
+ runtime.pendingUserInputQueue.push(normalized.text);
152
+ notify();
153
+ return action("dialogRuntime/enqueueUserInput", normalized);
154
+ }
155
+ function dequeueUserInput(payload) {
156
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
157
+ runtime.pendingUserInputQueue.shift();
158
+ notify();
159
+ return action("dialogRuntime/dequeueUserInput", payload);
160
+ }
161
+ function clearPendingUserInputQueue(payload) {
162
+ if (payload?.all) {
163
+ Object.values(runtimeByKey).forEach((runtime2) => {
164
+ runtime2.pendingUserInputQueue = [];
165
+ });
166
+ notify();
167
+ return action("dialogRuntime/clearPendingUserInputQueue", payload);
168
+ }
169
+ const runtime = ensureDialogRuntimeState(payload?.dialogKey);
170
+ runtime.pendingUserInputQueue = [];
171
+ notify();
172
+ return action("dialogRuntime/clearPendingUserInputQueue", payload);
173
+ }
174
+ function tokenUsageLiveUpdate(payload) {
175
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
176
+ runtime.tokens.inputTokens += payload.input_tokens;
177
+ runtime.tokens.outputTokens += payload.output_tokens;
178
+ runtime.tokens.totalCost += payload.cost ?? 0;
179
+ notify();
180
+ return action("dialogRuntime/tokenUsageLiveUpdate", payload);
181
+ }
182
+ function addPageReferenceToRuntime(payload) {
183
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
184
+ runtime.pendingFiles.push(payload.reference);
185
+ if (payload.rawData?.pageKey) {
186
+ runtime.pendingRawData[payload.rawData.pageKey] = payload.rawData;
187
+ }
188
+ notify();
189
+ }
190
+ function applyUpdateTokensFulfilled(payload) {
191
+ const runtime = runtimeByKey[payload.dialogKey];
192
+ if (!runtime) return;
193
+ runtime.tokens.inputTokens = Math.max(
194
+ 0,
195
+ runtime.tokens.inputTokens - (payload.input_tokens ?? 0)
196
+ );
197
+ runtime.tokens.outputTokens = Math.max(
198
+ 0,
199
+ runtime.tokens.outputTokens - (payload.output_tokens ?? 0)
200
+ );
201
+ runtime.tokens.totalCost = Math.max(
202
+ 0,
203
+ runtime.tokens.totalCost - (payload.cost ?? 0)
204
+ );
205
+ notify();
206
+ }
207
+ function applyClearDialogStateRuntime() {
208
+ const previousDialogKey = activeDialogKey;
209
+ const previousRuntime = previousDialogKey ? runtimeByKey[previousDialogKey] : null;
210
+ const globalRuntime = ensureDialogRuntimeState(GLOBAL_DIALOG_RUNTIME_KEY);
211
+ if (previousRuntime) {
212
+ if (previousRuntime.pendingFiles.length > 0) {
213
+ globalRuntime.pendingFiles = previousRuntime.pendingFiles;
214
+ previousRuntime.pendingFiles = [];
215
+ }
216
+ previousRuntime.pendingRawData = {};
217
+ previousRuntime.pendingUserInputQueue = [];
218
+ }
219
+ activeDialogKey = null;
220
+ configError = null;
221
+ globalRuntime.pendingRawData = {};
222
+ globalRuntime.pendingUserInputQueue = [];
223
+ notify();
224
+ }
225
+ function deleteDialogRuntime(dialogKey) {
226
+ delete runtimeByKey[dialogKey];
227
+ notify();
228
+ }
229
+ function abortActiveControllers(args) {
230
+ const runtimes = args?.all ? Object.values(runtimeByKey) : [ensureDialogRuntimeState(args?.dialogKey)];
231
+ runtimes.forEach((runtime) => {
232
+ Object.values(runtime.activeControllers).forEach(
233
+ (controller) => controller.abort()
234
+ );
235
+ });
236
+ }
237
+ function getDialogRuntimeState(dialogKey) {
238
+ return runtimeByKey[resolveDialogRuntimeKey(dialogKey)] ?? createEmptyDialogRuntimeState();
239
+ }
240
+ function getPendingFiles(dialogKey) {
241
+ return getDialogRuntimeState(dialogKey).pendingFiles;
242
+ }
243
+ function getActiveControllers(dialogKey) {
244
+ return getDialogRuntimeState(dialogKey).activeControllers;
245
+ }
246
+ function getPendingRawData(dialogKey) {
247
+ return getDialogRuntimeState(dialogKey).pendingRawData;
248
+ }
249
+ function getDialogRuntimeTokens(dialogKey) {
250
+ return getDialogRuntimeState(dialogKey).tokens;
251
+ }
252
+ function getPendingRawDataByPageKey(pageKey) {
253
+ return getDialogRuntimeState().pendingRawData[pageKey];
254
+ }
255
+ function getPendingUserInputQueue(dialogKey) {
256
+ return getDialogRuntimeState(dialogKey).pendingUserInputQueue;
257
+ }
258
+ function getLoopStopReason(dialogKey) {
259
+ return getDialogRuntimeState(dialogKey).loopStopReason;
260
+ }
261
+ var selectDialogRuntimeByKey = (_state, dialogKey) => getDialogRuntimeState(dialogKey);
262
+ var selectPendingFiles = (_state, dialogKey) => getPendingFiles(dialogKey);
263
+ var selectActiveControllers = (_state, dialogKey) => getActiveControllers(dialogKey);
264
+ var selectPendingRawData = (_state, dialogKey) => getPendingRawData(dialogKey);
265
+ var selectDialogRuntimeTokens = (_state, dialogKey) => getDialogRuntimeTokens(dialogKey);
266
+ var selectPendingRawDataByPageKey = (_state, pageKey) => getPendingRawDataByPageKey(pageKey);
267
+ var selectPendingUserInputQueue = (_state, dialogKey) => getPendingUserInputQueue(dialogKey);
268
+ var selectLoopStopReason = (_state, dialogKey) => getLoopStopReason(dialogKey);
269
+ var selectCurrentDialogKey = (_state) => getActiveDialogKey();
270
+ var selectConfigError = (_state) => getDialogConfigError();
271
+ function subscribe(listener) {
272
+ listeners.add(listener);
273
+ return () => {
274
+ listeners.delete(listener);
275
+ };
276
+ }
277
+ function getSnapshot() {
278
+ return version;
279
+ }
280
+ function usePendingFiles(dialogKey) {
281
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
282
+ return getPendingFiles(dialogKey);
283
+ }
284
+ function useActiveControllers(dialogKey) {
285
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
286
+ return getActiveControllers(dialogKey);
287
+ }
288
+ function usePendingUserInputQueue(dialogKey) {
289
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
290
+ return getPendingUserInputQueue(dialogKey);
291
+ }
292
+ function useLoopStopReason(dialogKey) {
293
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
294
+ return getLoopStopReason(dialogKey);
295
+ }
296
+ function useDialogRuntimeTokens(dialogKey) {
297
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
298
+ return getDialogRuntimeTokens(dialogKey);
299
+ }
300
+ function useCurrentDialogKey() {
301
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
302
+ return getActiveDialogKey();
303
+ }
304
+ function useDialogConfigError() {
305
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
306
+ return getDialogConfigError();
307
+ }
308
+
309
+ export {
310
+ GLOBAL_DIALOG_RUNTIME_KEY,
311
+ setActiveDialogKey,
312
+ getActiveDialogKey,
313
+ setDialogConfigError,
314
+ resetDialogRuntimeSessionState,
315
+ addPendingFile,
316
+ removePendingFile,
317
+ clearPendingAttachments,
318
+ setLoopStopReason,
319
+ clearDialogRuntimeState,
320
+ addActiveController,
321
+ removeActiveController,
322
+ clearActiveControllers,
323
+ enqueueUserInput,
324
+ dequeueUserInput,
325
+ clearPendingUserInputQueue,
326
+ tokenUsageLiveUpdate,
327
+ addPageReferenceToRuntime,
328
+ applyUpdateTokensFulfilled,
329
+ applyClearDialogStateRuntime,
330
+ deleteDialogRuntime,
331
+ abortActiveControllers,
332
+ getDialogRuntimeTokens,
333
+ getPendingUserInputQueue,
334
+ getLoopStopReason,
335
+ selectDialogRuntimeByKey,
336
+ selectPendingFiles,
337
+ selectActiveControllers,
338
+ selectPendingRawData,
339
+ selectDialogRuntimeTokens,
340
+ selectPendingRawDataByPageKey,
341
+ selectPendingUserInputQueue,
342
+ selectLoopStopReason,
343
+ selectCurrentDialogKey,
344
+ selectConfigError,
345
+ usePendingFiles,
346
+ useActiveControllers,
347
+ usePendingUserInputQueue,
348
+ useLoopStopReason,
349
+ useDialogRuntimeTokens,
350
+ useCurrentDialogKey,
351
+ useDialogConfigError
352
+ };
@@ -23,7 +23,7 @@ import {
23
23
  createMemoryOwnerIndexKey,
24
24
  createMemorySubjectKindIndexKey,
25
25
  memoryOwnerRange
26
- } from "./chunk-SVEUG45B.js";
26
+ } from "./chunk-NHRQCXIQ.js";
27
27
  import {
28
28
  asTrimmedNonEmptyStringArray
29
29
  } from "./chunk-I42VC5KR.js";
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-UW4INMD2.js";
8
+ } from "./chunk-RHMDMTDK.js";
9
9
  import {
10
10
  INVALID_TOOL_ARGS_REPLACEMENT,
11
11
  buildInvalidToolCallSelfHealResult,
12
12
  parseToolCallArguments,
13
13
  performFetchRequest,
14
14
  sanitizeOutboundMessages
15
- } from "./chunk-TI5BCZCH.js";
15
+ } from "./chunk-6COJEAYH.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,27 +23,27 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-V4KZGLOI.js";
26
+ } from "./chunk-TR4DXUYX.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
30
30
  import {
31
31
  getCurrentSpaceId
32
- } from "./chunk-LA4IDAK7.js";
32
+ } from "./chunk-ZJ7UHBJS.js";
33
33
  import {
34
34
  addToolMessage,
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-BJLYCOZK.js";
38
+ } from "./chunk-YBFJQC2M.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-U2A47SVI.js";
41
+ } from "./chunk-TC6P4NDR.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
45
45
  tokenUsageLiveUpdate
46
- } from "./chunk-MRWGHF56.js";
46
+ } from "./chunk-6YTOJY35.js";
47
47
  import {
48
48
  accumulateToolCallDelta,
49
49
  createThinkParserState,
@@ -56,40 +56,40 @@ import {
56
56
  import {
57
57
  EMPTY_ASSISTANT_REPAIR_PROMPT,
58
58
  getModelInfo
59
- } from "./chunk-KUUTWU4I.js";
59
+ } from "./chunk-K4NISKOR.js";
60
60
  import {
61
61
  getApiEndpoint
62
- } from "./chunk-QDHZCAH3.js";
62
+ } from "./chunk-SVDMVX4G.js";
63
63
  import {
64
64
  toErrorMessage
65
65
  } from "./chunk-HNMXYYJR.js";
66
66
  import {
67
67
  selectCurrentServer
68
- } from "./chunk-3QJTD6DO.js";
68
+ } from "./chunk-SVC3GGUA.js";
69
69
  import {
70
70
  write
71
- } from "./chunk-AV6KQCM5.js";
71
+ } from "./chunk-7NYDJAQ7.js";
72
72
  import {
73
73
  createDialogMessageKeyAndId,
74
74
  dialogMessageKey,
75
75
  toTrimmedString
76
- } from "./chunk-SVEUG45B.js";
76
+ } from "./chunk-NHRQCXIQ.js";
77
77
  import {
78
78
  extractCustomId
79
79
  } from "./chunk-BJIRLHJR.js";
80
80
  import {
81
81
  createAsyncThunk,
82
82
  selectIdentityToken
83
- } from "./chunk-PYKV6FSC.js";
83
+ } from "./chunk-XOJRZUPF.js";
84
84
  import {
85
85
  isAbortError
86
86
  } from "./chunk-QOKAKDPE.js";
87
- import {
88
- isRecord
89
- } from "./chunk-KUG52IAP.js";
90
87
  import {
91
88
  asTrimmedString
92
89
  } from "./chunk-3EUW3WEO.js";
90
+ import {
91
+ isRecord
92
+ } from "./chunk-KUG52IAP.js";
93
93
  import {
94
94
  asOptionalTrimmedString
95
95
  } from "./chunk-G3SUCT4W.js";
@@ -1,19 +1,18 @@
1
1
  import {
2
- DataType,
3
2
  fileKey,
4
3
  getFileIdFromKey,
5
4
  ulid
6
- } from "./chunk-SVEUG45B.js";
5
+ } from "./chunk-NHRQCXIQ.js";
7
6
  import {
8
7
  loadFileFromIndexedDb,
9
8
  removeAction,
10
9
  saveFileToIndexedDb
11
- } from "./chunk-MFI4FGHX.js";
10
+ } from "./chunk-SAJSBPI2.js";
12
11
  import {
13
12
  readAction,
14
13
  readRequestManager,
15
14
  resolveAgentReadServers
16
- } from "./chunk-VULELK4T.js";
15
+ } from "./chunk-2WBFJHQA.js";
17
16
  import {
18
17
  asyncThunkCreator,
19
18
  buildCreateSlice,
@@ -33,7 +32,7 @@ import {
33
32
  shouldReplaceLocalWithRemoteRecord,
34
33
  shouldReplicateLocalRecord,
35
34
  uploadToCurrentServer
36
- } from "./chunk-PYKV6FSC.js";
35
+ } from "./chunk-XOJRZUPF.js";
37
36
  import {
38
37
  fetchFromClientDb,
39
38
  fetchFromServer,
@@ -254,7 +253,7 @@ var writeAction = async (writeConfig, thunkApi) => {
254
253
  "table_row" /* TABLE_ROW */,
255
254
  "email" /* EMAIL */,
256
255
  "agent" /* AGENT */,
257
- DataType.AUTOMATION
256
+ "agent-automation" /* AGENT_AUTOMATION */
258
257
  ];
259
258
  if (!data.type || !VALID_TYPES.includes(data.type)) {
260
259
  logger.warn(
@@ -294,7 +293,7 @@ var writeAction = async (writeConfig, thunkApi) => {
294
293
  return willSaveData;
295
294
  } catch (error) {
296
295
  const errorMessage = `Write action failed for ${customKey}: ${error?.message || "Unknown error"}`;
297
- logger.error("[writeAction] Error:", error);
296
+ logger.error({ error }, "[writeAction] Error");
298
297
  actionToast.error(`Failed to save data for ${customKey}.`);
299
298
  throw new Error(errorMessage);
300
299
  }
@@ -361,13 +360,19 @@ var patchAction = async ({
361
360
  throw new Error(errorMsg);
362
361
  }
363
362
  const state = thunkApi.getState();
364
- const { currentServer, syncServers: configuredSyncServers } = getRuntimeServerContext(state);
363
+ const { currentServer, syncServers: configuredSyncServers, currentToken } = getRuntimeServerContext(state);
365
364
  try {
366
- const currentData = await db.get(dbKey);
365
+ let currentData = await db.get(dbKey);
367
366
  if (!currentData) {
368
- throw new Error(
369
- `Cannot apply patch: Data not found locally for key: ${dbKey}.`
370
- );
367
+ const hydrateServer = preferredServerOrigin ?? currentServer;
368
+ const remoteData = hydrateServer ? await fetchFromServer(hydrateServer, dbKey, currentToken) : null;
369
+ if (!remoteData) {
370
+ throw new Error(
371
+ `Cannot apply patch: Data not found locally or on server for key: ${dbKey}.`
372
+ );
373
+ }
374
+ const latestLocal = await db.get(dbKey);
375
+ currentData = latestLocal ?? remoteData;
371
376
  }
372
377
  const patchChanges = Object.prototype.hasOwnProperty.call(changes, "updatedAt") ? changes : {
373
378
  ...changes,
@@ -707,7 +712,7 @@ var dbSlice = createSliceWithThunks({
707
712
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
708
713
  read: create.asyncThunk(
709
714
  async (payload, thunkApi) => {
710
- const { readAction: readAction2 } = await import("./read-RGNPI5H2.js");
715
+ const { readAction: readAction2 } = await import("./read-K4JU4MQC.js");
711
716
  return readAction2(payload, thunkApi);
712
717
  },
713
718
  {
@@ -781,7 +786,7 @@ var dbSlice = createSliceWithThunks({
781
786
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
782
787
  share: create.asyncThunk(
783
788
  async (config, thunkApi) => {
784
- const { shareResourceAction } = await import("./action-Q4W5JPI5.js");
789
+ const { shareResourceAction } = await import("./action-ORXWW2ZG.js");
785
790
  return shareResourceAction(config, thunkApi);
786
791
  }
787
792
  ),
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  findModelConfig,
3
3
  getProviderByModelName
4
- } from "./chunk-QDHZCAH3.js";
4
+ } from "./chunk-SVDMVX4G.js";
5
5
  import {
6
6
  asOptionalFiniteNumber
7
7
  } from "./chunk-WWC7I6TA.js";
8
8
  import {
9
9
  asTrimmedLowercaseString
10
10
  } from "./chunk-QSJ3HFEF.js";
11
- import {
12
- isRecord
13
- } from "./chunk-KUG52IAP.js";
14
11
  import {
15
12
  asTrimmedString
16
13
  } from "./chunk-3EUW3WEO.js";
14
+ import {
15
+ isRecord
16
+ } from "./chunk-KUG52IAP.js";
17
17
  import {
18
18
  asOptionalTrimmedString
19
19
  } from "./chunk-G3SUCT4W.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  selectCurrentServer,
3
3
  selectRemoteServers
4
- } from "./chunk-3QJTD6DO.js";
4
+ } from "./chunk-SVC3GGUA.js";
5
5
  import {
6
6
  createUserKey,
7
7
  extractAgentInfo,
@@ -10,13 +10,13 @@ import {
10
10
  sanitizeShareData,
11
11
  shareKey,
12
12
  toNonEmptyString
13
- } from "./chunk-SVEUG45B.js";
13
+ } from "./chunk-NHRQCXIQ.js";
14
14
  import {
15
15
  noloDeleteRequest,
16
16
  noloWriteRequest,
17
17
  selectIdentityUser,
18
18
  selectIdentityUserId
19
- } from "./chunk-PYKV6FSC.js";
19
+ } from "./chunk-XOJRZUPF.js";
20
20
  import {
21
21
  normalizeTimeFields
22
22
  } from "./chunk-QOKAKDPE.js";
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-DWLEOOGR.js";
4
4
  import {
5
5
  addContentAction
6
- } from "./chunk-FGEYVPPR.js";
6
+ } from "./chunk-MYMBBB6Q.js";
7
7
  import {
8
8
  upload
9
- } from "./chunk-AV6KQCM5.js";
9
+ } from "./chunk-7NYDJAQ7.js";
10
10
  import {
11
11
  getRuntimeServerContext
12
- } from "./chunk-PYKV6FSC.js";
12
+ } from "./chunk-XOJRZUPF.js";
13
13
  import {
14
14
  API_ENDPOINTS
15
15
  } from "./chunk-LCBAMY2M.js";
@@ -710,8 +710,8 @@ function clipCompactText(value, max, ellipsis = "...") {
710
710
 
711
711
  export {
712
712
  clipCompactText,
713
- planContextUsage,
714
713
  estimateTokenCount,
714
+ planContextUsage,
715
715
  buildDatabaseFileContentUrl,
716
716
  serializeMessageContent,
717
717
  normalizeAssistantContentBuffer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-SP3DPVBH.js";
3
+ } from "./chunk-KLIBF3BY.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";