nolo-cli 0.138.0-alpha.1 → 0.140.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 (57) hide show
  1. package/{_executeModel-JWLH2Z7S.js → _executeModel-GJGGE6JX.js} +14 -13
  2. package/{agentDeleteCommand-UZGJZS5J.js → agentDeleteCommand-DAM4LEEO.js} +1 -1
  3. package/{agentEmailCommands-2SVG6LS3.js → agentEmailCommands-BTUG55AL.js} +13 -13
  4. package/{agentListCommands-GADYFX2S.js → agentListCommands-T3V5EL27.js} +1 -1
  5. package/{agentMachineCommands-JALXFO3Y.js → agentMachineCommands-5NBFFTBT.js} +2 -2
  6. package/{agentRecordCommands-INRNLAFR.js → agentRecordCommands-GFA7RVTG.js} +13 -13
  7. package/{agentRunCommand-TKHBLWSI.js → agentRunCommand-NXT7TWBS.js} +13 -13
  8. package/{agentRuntimeLocal-F44W2XTL.js → agentRuntimeLocal-DKFAWMRZ.js} +1 -1
  9. package/{agentSlice-T53NW4SS.js → agentSlice-WQVGFRLD.js} +1 -1
  10. package/{appDeleteCommands-GEVEUPWJ.js → appDeleteCommands-PBCGWJZQ.js} +1 -1
  11. package/{appDeployCommands-FMAHPMA2.js → appDeployCommands-E7KRDPZ5.js} +1 -1
  12. package/{appDeployStatusCommands-7DRR4X7F.js → appDeployStatusCommands-TZ64EREZ.js} +1 -1
  13. package/{appGetCommands-EOULTSHM.js → appGetCommands-3M2OIBJ3.js} +1 -1
  14. package/{appListCommands-ARJVCFDJ.js → appListCommands-D7H6I62Y.js} +1 -1
  15. package/{chatQueueReduxAdapter-GSD7C24T.js → chatQueueReduxAdapter-FUXS7NRR.js} +2 -2
  16. package/{chunk-TNYKI3LI.js → chunk-44YE37DR.js} +5 -5
  17. package/chunk-6OTOA5MH.js +108 -0
  18. package/{chunk-ZTQANKS2.js → chunk-AA2TX625.js} +2 -2
  19. package/{chunk-ZWJ6WQBO.js → chunk-AR7XM7CQ.js} +1 -1
  20. package/{chunk-MLXQO7X4.js → chunk-C6EZXUCB.js} +3 -3
  21. package/{chunk-DXXCZYEZ.js → chunk-CZNXUKLA.js} +9 -9
  22. package/{chunk-2LFG5CGH.js → chunk-ENU52AJZ.js} +1 -1
  23. package/chunk-GOMR6S5Z.js +83 -0
  24. package/{chunk-FSEVS4U3.js → chunk-KFMLZ3B5.js} +16 -8
  25. package/{chunk-3SPFKUP5.js → chunk-LJVUX3LF.js} +1 -1
  26. package/{chunk-27YNIIBN.js → chunk-NRXXVGOQ.js} +2 -2
  27. package/chunk-PWOXYPE6.js +194 -0
  28. package/{chunk-PA2BRUNR.js → chunk-QFDNAM7T.js} +3 -3
  29. package/{chunk-KQW2EHWB.js → chunk-RY3FI23Y.js} +19 -78
  30. package/{chunk-VIOF5352.js → chunk-TJUQIJQR.js} +8 -6
  31. package/{chunk-J2RGIFX5.js → chunk-UOCZAVYF.js} +2 -2
  32. package/{chunk-IEEGKL6X.js → chunk-YBUA6LCU.js} +2068 -1700
  33. package/{chunk-TTMVLXU5.js → chunk-ZOOAFELH.js} +6 -108
  34. package/{commandRegistry-DMS5KFOK.js → commandRegistry-XMFDAEN3.js} +40 -40
  35. package/{contentThunks-SDVFY3MX.js → contentThunks-CDGRYZSO.js} +3 -3
  36. package/{createAgentAutomationAction-CD6QYRC2.js → createAgentAutomationAction-HJZH45UP.js} +3 -3
  37. package/{createDialogAction-MB6BOVJJ.js → createDialogAction-W2U3KOFN.js} +4 -4
  38. package/{createPageAction-Y2A5MARX.js → createPageAction-4VGPW4AZ.js} +3 -3
  39. package/{dialogCommands-G7ZTYMIA.js → dialogCommands-FBSQ4KJR.js} +2 -2
  40. package/{dialogSlice-5C3POHWD.js → dialogSlice-MGEPXTGX.js} +2 -2
  41. package/{docCreateCommands-AEZC5UXB.js → docCreateCommands-N2TPCEZ7.js} +1 -1
  42. package/{docDeleteCommands-DXXYWOXH.js → docDeleteCommands-FJA7Q6CI.js} +1 -1
  43. package/{docReadCommands-G6PL2543.js → docReadCommands-2UZB5OR7.js} +1 -1
  44. package/{docStore-ZX7AIY5W.js → docStore-P6JMWIVK.js} +1 -1
  45. package/{docUpdateCommands-TWKJOXYT.js → docUpdateCommands-BID4C3QP.js} +1 -1
  46. package/{handleSendMessageAction-2AF42N6F.js → handleSendMessageAction-HAVG5ANU.js} +397 -6
  47. package/index.js +2 -2
  48. package/{machineCommands-ZY5BB4O3.js → machineCommands-WDAQIYYL.js} +13 -13
  49. package/{machineWsRunDispatch-5XE37H4C.js → machineWsRunDispatch-Y3MHLPCI.js} +13 -13
  50. package/package.json +1 -1
  51. package/{readlineWorkspace-HDAVBAL5.js → readlineWorkspace-AGIDALGO.js} +13 -13
  52. package/{runAgentClientLoop-TVA5UASR.js → runAgentClientLoop-7RNZVACU.js} +12 -11
  53. package/{spaceCommands-G2UBKO4F.js → spaceCommands-TKFZFVCA.js} +1 -1
  54. package/{streamAgentChatTurn-B6H35UWR.js → streamAgentChatTurn-T3WC62NT.js} +30 -210
  55. package/{tools-EEAEICHM.js → tools-UHCAPZ22.js} +9 -9
  56. package/{updateDialogTitleAction-UPPVYQ7R.js → updateDialogTitleAction-WBIR5A4A.js} +3 -3
  57. package/chunk-N4G4PKQ6.js +0 -23
@@ -0,0 +1,83 @@
1
+ // packages/core/abortableDelay.ts
2
+ function waitForAbortableDelay(ms, signal) {
3
+ const delayMs = Number.isFinite(ms) && ms >= 0 ? Math.round(ms) : 0;
4
+ if (signal?.aborted) {
5
+ return Promise.reject(new DOMException("Aborted", "AbortError"));
6
+ }
7
+ return new Promise((resolve, reject) => {
8
+ const onAbort = () => {
9
+ clearTimeout(timeoutId);
10
+ signal?.removeEventListener("abort", onAbort);
11
+ reject(new DOMException("Aborted", "AbortError"));
12
+ };
13
+ const timeoutId = setTimeout(() => {
14
+ signal?.removeEventListener("abort", onAbort);
15
+ resolve();
16
+ }, delayMs);
17
+ signal?.addEventListener("abort", onAbort, { once: true });
18
+ });
19
+ }
20
+
21
+ // packages/ai/chat/parseMultilineSSE.ts
22
+ function createSSEParser() {
23
+ let buffer = "";
24
+ return function parseSSE(chunk) {
25
+ const results = [];
26
+ if (!chunk) return results;
27
+ buffer += chunk;
28
+ const events = buffer.split(/\r?\n\r?\n/);
29
+ buffer = events.pop() ?? "";
30
+ for (const ev of events) {
31
+ if (!ev.trim()) continue;
32
+ const lines = ev.split(/\r?\n/);
33
+ let accumulator = "";
34
+ for (const line of lines) {
35
+ const t = line.trim();
36
+ if (t === "data: [DONE]") {
37
+ if (accumulator.trim()) {
38
+ try {
39
+ results.push(JSON.parse(accumulator));
40
+ } catch (e) {
41
+ }
42
+ accumulator = "";
43
+ }
44
+ results.push("[DONE]");
45
+ continue;
46
+ }
47
+ let content = "";
48
+ let isDataLine = false;
49
+ if (t.startsWith("data:")) {
50
+ content = line.substring(line.indexOf("data:") + 5).trim();
51
+ isDataLine = true;
52
+ } else if (accumulator && t && !t.startsWith("event:") && !t.startsWith("id:") && !t.startsWith("retry:")) {
53
+ content = line;
54
+ } else {
55
+ continue;
56
+ }
57
+ if (isDataLine && !accumulator) {
58
+ try {
59
+ const obj = JSON.parse(content);
60
+ results.push(obj);
61
+ continue;
62
+ } catch (e) {
63
+ }
64
+ }
65
+ accumulator += content;
66
+ }
67
+ if (accumulator.trim()) {
68
+ try {
69
+ const obj = JSON.parse(accumulator);
70
+ results.push(obj);
71
+ } catch (e) {
72
+ }
73
+ }
74
+ }
75
+ return results;
76
+ };
77
+ }
78
+ var parseMultilineSSE = createSSEParser();
79
+
80
+ export {
81
+ waitForAbortableDelay,
82
+ createSSEParser
83
+ };
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-6O4IK4V2.js";
12
12
  import {
13
13
  runLlm
14
- } from "./chunk-PA2BRUNR.js";
14
+ } from "./chunk-QFDNAM7T.js";
15
15
  import {
16
16
  cleanupCliSessionForDialog
17
17
  } from "./chunk-D76D3RTR.js";
@@ -23119,6 +23119,10 @@ function setStreamingMessageId(dialogId, messageId) {
23119
23119
  session.streamingMessageId = messageId;
23120
23120
  notify();
23121
23121
  }
23122
+ function getStreamingMessageId(dialogId) {
23123
+ if (dialogId === null) return null;
23124
+ return getMessageSession(dialogId).streamingMessageId;
23125
+ }
23122
23126
  function getHasStreamingMessage(dialogId) {
23123
23127
  if (dialogId === null) return false;
23124
23128
  return !!getMessageSession(dialogId).streamingMessageId;
@@ -23310,6 +23314,9 @@ var messageSlice = createSliceWithThunks({
23310
23314
  const dialogId = payload.dialogId ?? findDialogIdByMessageId(state, payload.id);
23311
23315
  const dialogState = ensureMessageDialogState(state, dialogId);
23312
23316
  removeOneMessage(dialogState, payload.id);
23317
+ if (dialogId && getStreamingMessageId(dialogId) === payload.id) {
23318
+ setStreamingMessageId(dialogId, null);
23319
+ }
23313
23320
  }
23314
23321
  ),
23315
23322
  // Error-path finalizer: keep whatever the transient message already shows
@@ -23930,7 +23937,7 @@ var messageSlice = createSliceWithThunks({
23930
23937
  runtimeOptions: args.runtimeOptions
23931
23938
  });
23932
23939
  if (agentKeyToUse) {
23933
- const { streamAgentChatTurn } = await import("./agentSlice-T53NW4SS.js");
23940
+ const { streamAgentChatTurn } = await import("./agentSlice-WQVGFRLD.js");
23934
23941
  await dispatch(
23935
23942
  streamAgentChatTurn({
23936
23943
  agentKey: agentKeyToUse,
@@ -25066,7 +25073,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
25066
25073
  }
25067
25074
  if (isCurrentDialog) {
25068
25075
  await thunkApi.dispatch(resetMsgs());
25069
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-5C3POHWD.js");
25076
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-MGEPXTGX.js");
25070
25077
  dispatch(clearPendingAttachments2());
25071
25078
  }
25072
25079
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -25074,15 +25081,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
25074
25081
 
25075
25082
  // packages/chat/dialog/dialogSlice.ts
25076
25083
  var runCreateDialogAction = async (args, thunkApi) => {
25077
- const { createDialogAction } = await import("./createDialogAction-MB6BOVJJ.js");
25084
+ const { createDialogAction } = await import("./createDialogAction-W2U3KOFN.js");
25078
25085
  return createDialogAction(args, thunkApi);
25079
25086
  };
25080
25087
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
25081
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-CD6QYRC2.js");
25088
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-HJZH45UP.js");
25082
25089
  return createAgentAutomationAction(args, thunkApi);
25083
25090
  };
25084
25091
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
25085
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-UPPVYQ7R.js");
25092
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-WBIR5A4A.js");
25086
25093
  return updateDialogTitleAction(args, thunkApi);
25087
25094
  };
25088
25095
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -25106,7 +25113,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
25106
25113
  return setDialogExtraReferencesAction(args, thunkApi);
25107
25114
  };
25108
25115
  var runHandleSendMessageAction = async (args, thunkApi) => {
25109
- const { handleSendMessageAction } = await import("./handleSendMessageAction-2AF42N6F.js");
25116
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-HAVG5ANU.js");
25110
25117
  return handleSendMessageAction(args, thunkApi);
25111
25118
  };
25112
25119
  function clearDialogState() {
@@ -25119,7 +25126,7 @@ var createPageAndAddReference = createAsyncThunk(
25119
25126
  async (payload, { dispatch, getState, rejectWithValue }) => {
25120
25127
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
25121
25128
  try {
25122
- const { createDocState } = await import("./docStore-ZX7AIY5W.js");
25129
+ const { createDocState } = await import("./docStore-P6JMWIVK.js");
25123
25130
  const pageKey = await createDocState(
25124
25131
  { slateData, title },
25125
25132
  { dispatch, getState }
@@ -25314,6 +25321,7 @@ export {
25314
25321
  finalizeTransientMessageOnError,
25315
25322
  prepareAndPersistMessage,
25316
25323
  prepareAndPersistUserMessage,
25324
+ initMsgs,
25317
25325
  messageStreamEnd,
25318
25326
  addToolMessage,
25319
25327
  updateToolMessage,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-TTMVLXU5.js";
4
+ } from "./chunk-ZOOAFELH.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-ZWJ6WQBO.js";
3
+ } from "./chunk-AR7XM7CQ.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-FSEVS4U3.js";
8
+ } from "./chunk-KFMLZ3B5.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
@@ -0,0 +1,194 @@
1
+ import {
2
+ isAbortError
3
+ } from "./chunk-QOKAKDPE.js";
4
+
5
+ // packages/ai/agent/foregroundTurnAdmissionFetch.ts
6
+ var FOREGROUND_TURN_KEEPALIVE_MAX_BODY_BYTES = 60 * 1024;
7
+ function getUtf8ByteLength(value) {
8
+ return new TextEncoder().encode(value).byteLength;
9
+ }
10
+ function shouldKeepForegroundTurnAdmissionAlive(serializedBody) {
11
+ return serializedBody.length > 0 && getUtf8ByteLength(serializedBody) <= FOREGROUND_TURN_KEEPALIVE_MAX_BODY_BYTES;
12
+ }
13
+ function buildForegroundTurnAdmissionFetchInit(args) {
14
+ return {
15
+ method: "POST",
16
+ headers: args.headers,
17
+ body: args.body,
18
+ ...args.signal ? { signal: args.signal } : {},
19
+ ...shouldKeepForegroundTurnAdmissionAlive(args.body) ? { keepalive: true } : {}
20
+ };
21
+ }
22
+
23
+ // packages/ai/agent/foregroundExecutionClientState.ts
24
+ var stateByDialogId = /* @__PURE__ */ new Map();
25
+ var MAX_TRACKED_DIALOGS = 256;
26
+ function trimmed(value) {
27
+ return typeof value === "string" ? value.trim() : "";
28
+ }
29
+ function trimCache() {
30
+ while (stateByDialogId.size > MAX_TRACKED_DIALOGS) {
31
+ const oldest = stateByDialogId.keys().next().value;
32
+ if (!oldest) return;
33
+ stateByDialogId.delete(oldest);
34
+ }
35
+ }
36
+ function setForegroundExecutionClientState(args) {
37
+ const dialogId = trimmed(args.dialogId);
38
+ const executionId = trimmed(args.executionId);
39
+ if (!dialogId || !executionId) return;
40
+ stateByDialogId.delete(dialogId);
41
+ stateByDialogId.set(dialogId, { dialogId, executionId, status: "running" });
42
+ trimCache();
43
+ }
44
+ function clearForegroundExecutionClientState(dialogId, expectedExecutionId) {
45
+ const normalizedDialogId = trimmed(dialogId);
46
+ if (!normalizedDialogId) return;
47
+ if (expectedExecutionId) {
48
+ const current = stateByDialogId.get(normalizedDialogId);
49
+ if (current && current.executionId !== expectedExecutionId) return;
50
+ }
51
+ stateByDialogId.delete(normalizedDialogId);
52
+ }
53
+ function observeForegroundExecutionPayload(payload) {
54
+ if (!payload || typeof payload !== "object") return;
55
+ const event = payload;
56
+ const type = trimmed(event.type);
57
+ const dialogId = trimmed(event.dialogId);
58
+ const executionId = trimmed(event.executionId);
59
+ if ((type === "dialog" || type === "foreground_turn_status") && event.status === "running" && dialogId && executionId) {
60
+ setForegroundExecutionClientState({ dialogId, executionId });
61
+ return;
62
+ }
63
+ if (type === "foreground_turn_terminal" || type === "done" || type === "cancelled" || type === "error" || type === "failed") {
64
+ if (dialogId && executionId) {
65
+ clearForegroundExecutionClientState(dialogId, executionId);
66
+ }
67
+ }
68
+ }
69
+
70
+ // packages/ai/agent/streamTurnStreamConsumer.ts
71
+ async function readAgentRunStreamChunk(reader, signal, isAborted) {
72
+ if (isAborted() || signal?.aborted) {
73
+ void reader.cancel().catch(() => {
74
+ });
75
+ throw new DOMException("The operation was aborted.", "AbortError");
76
+ }
77
+ if (!signal) {
78
+ return reader.read();
79
+ }
80
+ let settled = false;
81
+ return new Promise((resolve, reject) => {
82
+ const finish = (cb) => {
83
+ if (settled) return;
84
+ settled = true;
85
+ signal.removeEventListener("abort", onAbort);
86
+ cb();
87
+ };
88
+ const onAbort = () => {
89
+ void reader.cancel().catch(() => {
90
+ });
91
+ finish(
92
+ () => reject(new DOMException("The operation was aborted.", "AbortError"))
93
+ );
94
+ };
95
+ signal.addEventListener("abort", onAbort);
96
+ reader.read().then(
97
+ (result) => finish(() => resolve(result)),
98
+ (err) => finish(() => reject(err))
99
+ );
100
+ });
101
+ }
102
+ async function consumeAgentRunStream(handlers) {
103
+ const {
104
+ reader,
105
+ decoder,
106
+ parseChunk,
107
+ onPayload,
108
+ isDoneEvent,
109
+ isAborted,
110
+ signal,
111
+ onAbort
112
+ } = handlers;
113
+ let sawDone = false;
114
+ let observedDialogId = "";
115
+ let observedExecutionId = "";
116
+ const clearObservedExecution = () => {
117
+ if (!observedDialogId || !observedExecutionId) return;
118
+ clearForegroundExecutionClientState(
119
+ observedDialogId,
120
+ observedExecutionId
121
+ );
122
+ };
123
+ try {
124
+ while (true) {
125
+ let done;
126
+ let value;
127
+ try {
128
+ ({ done, value } = await readAgentRunStreamChunk(
129
+ reader,
130
+ signal,
131
+ isAborted
132
+ ));
133
+ } catch (error) {
134
+ if (isAbortError(error) || isAborted() || signal?.aborted) {
135
+ clearObservedExecution();
136
+ await onAbort();
137
+ return { outcome: "aborted" };
138
+ }
139
+ throw error;
140
+ }
141
+ if (isAborted() || signal?.aborted) {
142
+ clearObservedExecution();
143
+ await onAbort();
144
+ return { outcome: "aborted" };
145
+ }
146
+ if (done) {
147
+ clearObservedExecution();
148
+ return { outcome: "streamEnded", sawDone };
149
+ }
150
+ const payloads = parseChunk(
151
+ decoder.decode(value, { stream: true })
152
+ );
153
+ for (const payload of payloads) {
154
+ if (isAborted() || signal?.aborted) {
155
+ clearObservedExecution();
156
+ await onAbort();
157
+ return { outcome: "aborted" };
158
+ }
159
+ if (payload && typeof payload === "object") {
160
+ if (payload.type === "dialog" && typeof payload.dialogId === "string") {
161
+ observedDialogId = payload.dialogId.trim();
162
+ observedExecutionId = typeof payload.executionId === "string" ? payload.executionId.trim() : "";
163
+ }
164
+ observeForegroundExecutionPayload(payload);
165
+ }
166
+ const directive = await onPayload(payload);
167
+ if (directive?.reject !== void 0) {
168
+ clearObservedExecution();
169
+ return { outcome: "rejected", message: directive.reject };
170
+ }
171
+ if (directive?.abort) {
172
+ clearObservedExecution();
173
+ await onAbort();
174
+ return { outcome: "aborted" };
175
+ }
176
+ if (isDoneEvent(payload)) {
177
+ sawDone = true;
178
+ }
179
+ }
180
+ }
181
+ } catch (error) {
182
+ clearObservedExecution();
183
+ if (isAbortError(error) || isAborted() || signal?.aborted) {
184
+ await onAbort();
185
+ return { outcome: "aborted" };
186
+ }
187
+ throw error;
188
+ }
189
+ }
190
+
191
+ export {
192
+ buildForegroundTurnAdmissionFetchInit,
193
+ consumeAgentRunStream
194
+ };
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
304
304
  const overrides = {};
305
305
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
306
306
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
307
- const { _executeModel } = await import("./_executeModel-JWLH2Z7S.js");
307
+ const { _executeModel } = await import("./_executeModel-GJGGE6JX.js");
308
308
  return _executeModel(
309
309
  {
310
310
  isStreaming: args.isStreaming ?? false,
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
325
325
  * - 循环直到无工具调用或触发其他运行时停止条件
326
326
  */
327
327
  runAgent: create.asyncThunk(async (args, thunkApi) => {
328
- const { runAgentClientLoop } = await import("./runAgentClientLoop-TVA5UASR.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-7RNZVACU.js");
329
329
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
330
330
  {
331
331
  agentKey: args.agentKey,
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
341
341
  * 聊天轮次流式 Agent 调用
342
342
  */
343
343
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
344
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-B6H35UWR.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-T3WC62NT.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**
@@ -1,6 +1,3 @@
1
- import {
2
- isGatewayHttpStatus
3
- } from "./chunk-NF64D32W.js";
4
1
  import {
5
2
  assembleAgentDiscoveryResult,
6
3
  resolveDiscoveryScope
@@ -8,6 +5,17 @@ import {
8
5
  import {
9
6
  fetchWithTransientRetry
10
7
  } from "./chunk-5UTFL4QJ.js";
8
+ import {
9
+ getUserDataItemTimestamp,
10
+ mergeAndDedupUserData
11
+ } from "./chunk-KQHGZWSV.js";
12
+ import {
13
+ createSSEParser,
14
+ waitForAbortableDelay
15
+ } from "./chunk-GOMR6S5Z.js";
16
+ import {
17
+ isGatewayHttpStatus
18
+ } from "./chunk-NF64D32W.js";
11
19
  import {
12
20
  CORE_DRAIN_REASON,
13
21
  DRAIN_EXHAUSTED_USER_MESSAGE,
@@ -15,13 +23,6 @@ import {
15
23
  normalizeNonNegativeMs,
16
24
  parseRetryAfterHeaderMs
17
25
  } from "./chunk-3L2WKC3W.js";
18
- import {
19
- getUserDataItemTimestamp,
20
- mergeAndDedupUserData
21
- } from "./chunk-KQHGZWSV.js";
22
- import {
23
- waitForAbortableDelay
24
- } from "./chunk-N4G4PKQ6.js";
25
26
  import {
26
27
  TASK_PREVIEW_MAX,
27
28
  buildDelegatedTaskContent,
@@ -35,7 +36,7 @@ import {
35
36
  } from "./chunk-3VNWWVKB.js";
36
37
  import {
37
38
  createDialogAction
38
- } from "./chunk-27YNIIBN.js";
39
+ } from "./chunk-NRXXVGOQ.js";
39
40
  import {
40
41
  addMemberSpace,
41
42
  fetchAuthoritativeRemoteSpace,
@@ -59,7 +60,7 @@ import {
59
60
  } from "./chunk-VF4K2QE6.js";
60
61
  import {
61
62
  createDocState
62
- } from "./chunk-ZTQANKS2.js";
63
+ } from "./chunk-AA2TX625.js";
63
64
  import {
64
65
  setDialogExtraReferencesAction
65
66
  } from "./chunk-Z7IZQF56.js";
@@ -98,7 +99,7 @@ import {
98
99
  updateContentCategory,
99
100
  updateContentTitle,
100
101
  writeStoredCollapsedCategories
101
- } from "./chunk-ZWJ6WQBO.js";
102
+ } from "./chunk-AR7XM7CQ.js";
102
103
  import {
103
104
  getCurrentSpaceId,
104
105
  getCurrentSpaceIdRaw,
@@ -120,14 +121,14 @@ import {
120
121
  selectMsgById,
121
122
  uiAskChoiceFunc,
122
123
  uiAskChoiceFunctionSchema
123
- } from "./chunk-FSEVS4U3.js";
124
+ } from "./chunk-KFMLZ3B5.js";
124
125
  import {
125
126
  createAgent,
126
127
  deleteServerSyncedCredential,
127
128
  runLlm,
128
129
  streamAgentChatTurn,
129
130
  updateAgent
130
- } from "./chunk-PA2BRUNR.js";
131
+ } from "./chunk-QFDNAM7T.js";
131
132
  import {
132
133
  getActiveDialogKey,
133
134
  selectCurrentDialogKey,
@@ -3975,7 +3976,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3975
3976
  const deletedDialogIds = [];
3976
3977
  const deletedDialogKeys = [];
3977
3978
  const failures = [];
3978
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-5C3POHWD.js");
3979
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-MGEPXTGX.js");
3979
3980
  for (const target of targets) {
3980
3981
  try {
3981
3982
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -12906,65 +12907,6 @@ function isDeployWindowRetrySignal(e) {
12906
12907
  return e.retryable === true;
12907
12908
  }
12908
12909
 
12909
- // packages/ai/chat/parseMultilineSSE.ts
12910
- function createSSEParser() {
12911
- let buffer = "";
12912
- return function parseSSE(chunk) {
12913
- const results = [];
12914
- if (!chunk) return results;
12915
- buffer += chunk;
12916
- const events = buffer.split(/\r?\n\r?\n/);
12917
- buffer = events.pop() ?? "";
12918
- for (const ev of events) {
12919
- if (!ev.trim()) continue;
12920
- const lines = ev.split(/\r?\n/);
12921
- let accumulator = "";
12922
- for (const line of lines) {
12923
- const t = line.trim();
12924
- if (t === "data: [DONE]") {
12925
- if (accumulator.trim()) {
12926
- try {
12927
- results.push(JSON.parse(accumulator));
12928
- } catch (e) {
12929
- }
12930
- accumulator = "";
12931
- }
12932
- results.push("[DONE]");
12933
- continue;
12934
- }
12935
- let content = "";
12936
- let isDataLine = false;
12937
- if (t.startsWith("data:")) {
12938
- content = line.substring(line.indexOf("data:") + 5).trim();
12939
- isDataLine = true;
12940
- } else if (accumulator && t && !t.startsWith("event:") && !t.startsWith("id:") && !t.startsWith("retry:")) {
12941
- content = line;
12942
- } else {
12943
- continue;
12944
- }
12945
- if (isDataLine && !accumulator) {
12946
- try {
12947
- const obj = JSON.parse(content);
12948
- results.push(obj);
12949
- continue;
12950
- } catch (e) {
12951
- }
12952
- }
12953
- accumulator += content;
12954
- }
12955
- if (accumulator.trim()) {
12956
- try {
12957
- const obj = JSON.parse(accumulator);
12958
- results.push(obj);
12959
- } catch (e) {
12960
- }
12961
- }
12962
- }
12963
- return results;
12964
- };
12965
- }
12966
- var parseMultilineSSE = createSSEParser();
12967
-
12968
12910
  // packages/ai/agent/runAgentBackground.ts
12969
12911
  var MAX_SSE_RETRIES = 3;
12970
12912
  var MAX_SSE_CORE_DRAINING_RETRIES = 30;
@@ -15093,7 +15035,7 @@ var executeToolRun = createAsyncThunk(
15093
15035
  if (!executionInput) {
15094
15036
  throw new Error(`ToolRun ${id} has no input to execute with.`);
15095
15037
  }
15096
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-EEAEICHM.js");
15038
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-UHCAPZ22.js");
15097
15039
  const { executor } = findToolExecutor2(run.toolName);
15098
15040
  toolRunStarted({
15099
15041
  id: run.id,
@@ -17600,7 +17542,7 @@ async function updateDocFunc(args, thunkApi) {
17600
17542
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
17601
17543
  };
17602
17544
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
17603
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-ZX7AIY5W.js");
17545
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-P6JMWIVK.js");
17604
17546
  if (getDocState().pageKey === id) {
17605
17547
  applyExternalDocUpdate({
17606
17548
  slateData: finalSlateData,
@@ -19930,7 +19872,6 @@ export {
19930
19872
  rememberMemoryFunctionSchema,
19931
19873
  deleteMemoryFunctionSchema,
19932
19874
  queryMemoryFunctionSchema,
19933
- createSSEParser,
19934
19875
  checkCredentialFanout,
19935
19876
  buildStartAgentRunFunctionSchema,
19936
19877
  CONTROL_AGENT_RUN_ACTIONS,
@@ -5,7 +5,7 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-J2RGIFX5.js";
8
+ } from "./chunk-UOCZAVYF.js";
9
9
  import {
10
10
  parseApiError
11
11
  } from "./chunk-OCZKATRC.js";
@@ -15,9 +15,8 @@ import {
15
15
  parseToolCallArguments,
16
16
  performFetchRequest,
17
17
  sanitizeOutboundMessages
18
- } from "./chunk-TTMVLXU5.js";
18
+ } from "./chunk-ZOOAFELH.js";
19
19
  import {
20
- createSSEParser,
21
20
  createToolRunId,
22
21
  findToolExecutor,
23
22
  getToolResultErrorData,
@@ -26,7 +25,10 @@ import {
26
25
  toolRunSetPending,
27
26
  toolRunStarted,
28
27
  toolRunSucceeded
29
- } from "./chunk-KQW2EHWB.js";
28
+ } from "./chunk-RY3FI23Y.js";
29
+ import {
30
+ createSSEParser
31
+ } from "./chunk-GOMR6S5Z.js";
30
32
  import {
31
33
  getCurrentSpaceId
32
34
  } from "./chunk-ZJ7UHBJS.js";
@@ -35,10 +37,10 @@ import {
35
37
  messageStreamEnd,
36
38
  messageStreaming,
37
39
  updateToolMessage
38
- } from "./chunk-FSEVS4U3.js";
40
+ } from "./chunk-KFMLZ3B5.js";
39
41
  import {
40
42
  streamAgentChatTurn
41
- } from "./chunk-PA2BRUNR.js";
43
+ } from "./chunk-QFDNAM7T.js";
42
44
  import {
43
45
  addActiveController,
44
46
  removeActiveController,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-KQW2EHWB.js";
3
+ } from "./chunk-RY3FI23Y.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-FSEVS4U3.js";
6
+ } from "./chunk-KFMLZ3B5.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";