nolo-cli 0.14.0-alpha.9 → 0.15.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 (92) hide show
  1. package/{_executeModel-OQ6KPFSB.js → _executeModel-QAUS6B7J.js} +24 -24
  2. package/{action-N3KXFO5V.js → action-GUOZYYGN.js} +4 -4
  3. package/{addContentAction-4Z762DMR.js → addContentAction-QDGHGUBH.js} +3 -3
  4. package/{addDialogAgentAction-FALLEKPR.js → addDialogAgentAction-Z4YCYZIV.js} +2 -2
  5. package/{agentDeleteCommand-UBXH2FDO.js → agentDeleteCommand-QDO62EZA.js} +20 -20
  6. package/{agentEmailCommands-ZI2FIUBV.js → agentEmailCommands-UZ5BKX3P.js} +37 -37
  7. package/{agentListCommands-7M6FHCSH.js → agentListCommands-ZC33UDWT.js} +22 -22
  8. package/{agentMachineCommands-R3FW62QH.js → agentMachineCommands-RZGZEZRL.js} +20 -20
  9. package/{agentRecordCommands-WUY3C3HZ.js → agentRecordCommands-DGDXE2VH.js} +32 -32
  10. package/{agentRunCommand-CWXYVYPZ.js → agentRunCommand-SRZWFOPH.js} +34 -34
  11. package/{agentRuntimeLocal-BONMVACL.js → agentRuntimeLocal-4YCF6IRF.js} +11 -11
  12. package/{agentSlice-IHOSTSWC.js → agentSlice-IVE735EV.js} +3 -3
  13. package/appDeleteCommands-7I26L64I.js +124 -0
  14. package/appDeployCommands-TZLZNTJN.js +163 -0
  15. package/appDeployStatusCommands-OPPTLHRW.js +144 -0
  16. package/appGetCommands-N2S4HYKY.js +119 -0
  17. package/appListCommands-OBTPPKUM.js +122 -0
  18. package/{authCommand-IKIU4FZY.js → authCommand-YFTR3347.js} +5 -5
  19. package/{authCommands-QP43ADV3.js → authCommands-YXGOXNBZ.js} +3 -3
  20. package/{chunk-3B2LFO6R.js → browser-image-compression-MFDTD7K6.js} +4 -518
  21. package/{chunk-YQAG2J2T.js → chunk-472E5RMQ.js} +1 -1
  22. package/chunk-4QQFLN5C.js +552 -0
  23. package/{chunk-SZ7RUWAQ.js → chunk-5VMYGIIL.js} +97 -38
  24. package/{chunk-P6DRYHVM.js → chunk-6565R2TI.js} +16 -14
  25. package/{chunk-2ROIXEDX.js → chunk-6MHDWKOT.js} +2 -2
  26. package/{chunk-GGHFCK3X.js → chunk-AWDOJBHW.js} +426 -430
  27. package/{chunk-DUE6E46E.js → chunk-BFRVXJJJ.js} +43 -16
  28. package/{chunk-UONU6Q4P.js → chunk-G2MKOQCB.js} +1 -1
  29. package/chunk-GFUIQ4RY.js +136 -0
  30. package/{chunk-SRKNB2WB.js → chunk-HRQCKQA5.js} +4 -4
  31. package/{chunk-CDQ2ICPR.js → chunk-IOQ7IBPU.js} +1 -1
  32. package/{chunk-QLO2G5HP.js → chunk-ISYE6GZB.js} +1 -1
  33. package/{chunk-CXLGUR7M.js → chunk-IZ2QRVEU.js} +2 -2
  34. package/{chunk-U4J6ZZFY.js → chunk-JBKVPAYK.js} +7 -140
  35. package/{chunk-V6VXDXGY.js → chunk-JS33TCQ3.js} +2 -2
  36. package/{chunk-YG3CCS7C.js → chunk-K53477EY.js} +4 -4
  37. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  38. package/{chunk-BHK5ZAW7.js → chunk-N5424GSW.js} +1 -1
  39. package/chunk-NTC6I2FN.js +107 -0
  40. package/{chunk-QNXEDF7V.js → chunk-O53CP2QR.js} +3 -3
  41. package/{chunk-CY4TAX6S.js → chunk-OKSYPTDZ.js} +9 -9
  42. package/{chunk-NFHGY5T5.js → chunk-OQMPU2ML.js} +4 -4
  43. package/{chunk-NSZB7BYV.js → chunk-P4MJQWWF.js} +2 -2
  44. package/{chunk-JHFMRUGX.js → chunk-RKM3K52F.js} +1 -1
  45. package/{chunk-A5V7UEZJ.js → chunk-SFXYKGK2.js} +3 -3
  46. package/{chunk-S5UACFUP.js → chunk-TTGAVETO.js} +10 -2
  47. package/{chunk-BOJVWKNA.js → chunk-U7LEGLEB.js} +1 -1
  48. package/{chunk-YDOTMXTK.js → chunk-UXKQQ2MR.js} +9 -9
  49. package/{chunk-KUDUXBNE.js → chunk-VE6XMVKG.js} +189 -41
  50. package/{chunk-NJVPXLRY.js → chunk-VPTJB4HM.js} +1 -1
  51. package/{chunk-3AE4NQ5O.js → chunk-WA6KZL5V.js} +25 -6
  52. package/{chunk-T3X232L6.js → chunk-WNLPAOIT.js} +1 -1
  53. package/{chunk-MEXNTURY.js → chunk-WRN5EQT7.js} +1 -1
  54. package/{chunk-FVGJNXPJ.js → chunk-XGQZFBO5.js} +83 -206
  55. package/{chunk-3FCSMQAC.js → chunk-XVP3C2KY.js} +1 -1
  56. package/{chunk-SW3Q2OV5.js → chunk-YNHQIXX5.js} +774 -5735
  57. package/{chunk-7VKJDLPO.js → chunk-Z24FGIU2.js} +2 -2
  58. package/{createAgentAutomationAction-W4OZQ63I.js → createAgentAutomationAction-TS6NNZ4X.js} +9 -9
  59. package/{createDialogAction-G6XQLPAN.js → createDialogAction-5HVQ33EX.js} +10 -10
  60. package/{createPageAction-RNT4LCAX.js → createPageAction-4F3ZGQJD.js} +9 -9
  61. package/{dbSlice-7Q23HSWH.js → dbSlice-OP6UPXKA.js} +2 -2
  62. package/{dialogCommands-YUTOCICO.js → dialogCommands-3GEPXHFB.js} +16 -16
  63. package/{dialogSlice-QZZF4JXD.js → dialogSlice-FAWUQDJW.js} +9 -9
  64. package/{docCreateCommands-LQYOVE7D.js → docCreateCommands-ZE3S6BCP.js} +22 -20
  65. package/{docDeleteCommands-LNS5V76K.js → docDeleteCommands-TW6PGTRT.js} +21 -19
  66. package/{docReadCommands-IRCP66BG.js → docReadCommands-LDXL3B6J.js} +20 -18
  67. package/{docStore-66Q4JTTG.js → docStore-2UHVWLTV.js} +10 -10
  68. package/{docUpdateCommands-4VUX3Q7W.js → docUpdateCommands-GYD6XI5O.js} +21 -19
  69. package/{handleSendMessageAction-CB5UKK2X.js → handleSendMessageAction-LJPUYNOH.js} +9 -9
  70. package/index.js +92 -61
  71. package/{machineCommands-PX2BADIB.js → machineCommands-OKNDYS3M.js} +35 -35
  72. package/{machineWsRunDispatch-IBNCRCEQ.js → machineWsRunDispatch-ZX5AJ6FJ.js} +31 -31
  73. package/package.json +1 -1
  74. package/{read-SIWMJRHC.js → read-HXHAZBKH.js} +1 -1
  75. package/{readDocTool-TCYJY4PP.js → readDocTool-VPBDTO4G.js} +1 -1
  76. package/{readlineWorkspace-YIXJ2OOO.js → readlineWorkspace-MB3ANKHM.js} +92 -92
  77. package/{removeDialogAgentAction-WKHZT6VJ.js → removeDialogAgentAction-HUFVN35S.js} +4 -4
  78. package/{runAgentClientLoop-BXMDAQB2.js → runAgentClientLoop-A75BUU6D.js} +19 -19
  79. package/{setDialogExtraReferencesAction-GCI5QU6E.js → setDialogExtraReferencesAction-2VLGWQKG.js} +2 -2
  80. package/{setPrimaryDialogAgentAction-NRO57AS6.js → setPrimaryDialogAgentAction-VB4UV2CC.js} +4 -4
  81. package/{settingSlice-FTWZ5ZHT.js → settingSlice-7JYPQNAC.js} +3 -3
  82. package/{spaceCommands-7Z6DZFEE.js → spaceCommands-O3KJNCON.js} +21 -21
  83. package/{spaceSlice-3GLIRD3Q.js → spaceSlice-444MFUP6.js} +9 -9
  84. package/{streamAgentChatTurn-SN7YS2VV.js → streamAgentChatTurn-DJAE7USZ.js} +42 -39
  85. package/{tools-4JSNWHIK.js → tools-YB6LXSVN.js} +14 -14
  86. package/{tuiSummaryLlmCaller-PS5BDLHV.js → tuiSummaryLlmCaller-QQL3JA5I.js} +3 -3
  87. package/{updateDialogTitleAction-DUJ2JZXX.js → updateDialogTitleAction-6HGFBM64.js} +9 -9
  88. package/{agentGrantCommands-JMTM6U4B.js → agentGrantCommands-JNDE4RWR.js} +1 -1
  89. package/{agentPullCommand-UXANSFU3.js → agentPullCommand-6HWUT3SW.js} +1 -1
  90. package/{chunk-3QAF2LTL.js → chunk-DZ3XJVET.js} +3 -3
  91. package/{chunk-HBRZXXP5.js → chunk-KMQPSTMJ.js} +6 -6
  92. package/{tableCommands-V5O7QMXY.js → tableCommands-3P7MJ3PF.js} +3 -3
@@ -13,13 +13,16 @@ import {
13
13
  getUserDataItemTimestamp,
14
14
  mergeAndDedupUserData
15
15
  } from "./chunk-KQHGZWSV.js";
16
+ import {
17
+ createDocState
18
+ } from "./chunk-O53CP2QR.js";
16
19
  import {
17
20
  readDocFunc,
18
21
  readDocFunctionSchema,
19
22
  readPageFunc,
20
23
  readPageFunctionSchema,
21
24
  slateToSimplifiedMarkdown
22
- } from "./chunk-BOJVWKNA.js";
25
+ } from "./chunk-U7LEGLEB.js";
23
26
  import {
24
27
  markdownToSlate
25
28
  } from "./chunk-3LY4F7SV.js";
@@ -32,12 +35,9 @@ import {
32
35
  import {
33
36
  isSkillSummaryMarker
34
37
  } from "./chunk-VF4K2QE6.js";
35
- import {
36
- createDocState
37
- } from "./chunk-QNXEDF7V.js";
38
38
  import {
39
39
  createDialogAction
40
- } from "./chunk-7VKJDLPO.js";
40
+ } from "./chunk-Z24FGIU2.js";
41
41
  import {
42
42
  buildSkillDocMarkdown,
43
43
  normalizeSkillBudgetTier,
@@ -76,13 +76,13 @@ import {
76
76
  updateContentCategory,
77
77
  updateContentTitle,
78
78
  updateStep
79
- } from "./chunk-SW3Q2OV5.js";
79
+ } from "./chunk-YNHQIXX5.js";
80
80
  import {
81
81
  createAgent,
82
82
  runLlm,
83
83
  streamAgentChatTurn,
84
84
  updateAgent
85
- } from "./chunk-NFHGY5T5.js";
85
+ } from "./chunk-OQMPU2ML.js";
86
86
  import {
87
87
  NOLO_WORKSPACE_TOOL_NAMES,
88
88
  buildNoloSubjectRefQueryTarget,
@@ -101,7 +101,7 @@ import {
101
101
  } from "./chunk-B4KT7RN2.js";
102
102
  import {
103
103
  buildDatabaseFileContentUrl
104
- } from "./chunk-3B2LFO6R.js";
104
+ } from "./chunk-4QQFLN5C.js";
105
105
  import {
106
106
  DEFAULT_MODEL
107
107
  } from "./chunk-OGGHETUE.js";
@@ -130,7 +130,7 @@ import {
130
130
  } from "./chunk-HNMXYYJR.js";
131
131
  import {
132
132
  shareResourceAction
133
- } from "./chunk-BHK5ZAW7.js";
133
+ } from "./chunk-N5424GSW.js";
134
134
  import {
135
135
  AGENT_UPDATE_FIELD_NAMES,
136
136
  SYSTEM_AGENT_CAPABILITIES,
@@ -139,7 +139,7 @@ import {
139
139
  selectAutoApproveSelfUpdateFields,
140
140
  selectCurrentServer,
141
141
  selectSyncServers
142
- } from "./chunk-S5UACFUP.js";
142
+ } from "./chunk-TTGAVETO.js";
143
143
  import {
144
144
  asRecordOrEmpty
145
145
  } from "./chunk-KX6YBIHG.js";
@@ -147,7 +147,7 @@ import {
147
147
  addContentAction,
148
148
  createSpaceKey,
149
149
  normalizeSpaceId
150
- } from "./chunk-3FCSMQAC.js";
150
+ } from "./chunk-XVP3C2KY.js";
151
151
  import {
152
152
  patch,
153
153
  read,
@@ -155,7 +155,7 @@ import {
155
155
  readAndWaitAction,
156
156
  toTimestampMs,
157
157
  write
158
- } from "./chunk-A5V7UEZJ.js";
158
+ } from "./chunk-SFXYKGK2.js";
159
159
  import {
160
160
  SEPARATOR,
161
161
  createAgentKey,
@@ -180,7 +180,7 @@ import {
180
180
  } from "./chunk-QSJ3HFEF.js";
181
181
  import {
182
182
  readAction
183
- } from "./chunk-NJVPXLRY.js";
183
+ } from "./chunk-VPTJB4HM.js";
184
184
  import {
185
185
  createAsyncThunk,
186
186
  getRuntimeServerContext,
@@ -11268,14 +11268,6 @@ var CAPABILITY_PACKS = [
11268
11268
  defaultEnabled: false,
11269
11269
  icon: "\u{1F4BB}"
11270
11270
  },
11271
- {
11272
- id: "agent-orchestration",
11273
- label: "\u591A agent \u7F16\u6392",
11274
- description: "\u5148\u6309\u6536\u85CF\u3001\u7B80\u4ECB\u3001\u80FD\u529B\u548C\u6210\u672C\u5217\u51FA\u5B89\u5168 agent \u6458\u8981\uFF0C\u6309\u9700\u8BFB\u53D6\u5019\u9009\u914D\u7F6E\u89E3\u6790\u53EF\u8FD0\u884C key\uFF0C\u518D\u540E\u53F0\u542F\u52A8\u5176\u4ED6 agent \u6267\u884C\u5B50\u4EFB\u52A1\uFF0C\u5E76\u89C2\u5BDF\u3001\u67E5\u8BE2\u3001\u505C\u6B62\u8FD0\u884C\u4E2D\u7684 agent run\u2014\u2014\u9002\u5408\u5E76\u884C\u6D3E\u53D1\u3001\u957F\u4EFB\u52A1\u8DDF\u8E2A\u3001\u4E2D\u9014\u53EB\u505C\u7B49\u7F16\u6392\u573A\u666F\u3002",
11275
- tools: ["startAgentRun", "controlAgentRun", "listAgents"],
11276
- defaultEnabled: true,
11277
- icon: "\u{1F9E9}"
11278
- },
11279
11271
  {
11280
11272
  id: "skills",
11281
11273
  label: "\u6280\u80FD\u52A0\u8F7D",
@@ -11388,7 +11380,6 @@ var DEFAULT_ENABLED_PACKS = CAPABILITY_PACKS.filter(
11388
11380
  ).map((pack) => pack.id);
11389
11381
  var ALWAYS_ON_PACK_IDS = [
11390
11382
  "long-term-memory",
11391
- "agent-orchestration",
11392
11383
  "skills"
11393
11384
  ];
11394
11385
  function resolveEffectiveEnabledPacks(args) {
@@ -11404,6 +11395,14 @@ function resolveEffectiveEnabledPacks(args) {
11404
11395
  ];
11405
11396
  }
11406
11397
  var SYSTEM_BUILTIN_SKILL_PACK_IDS = SYSTEM_AGENT_CAPABILITY_IDS;
11398
+ var DEFAULT_MOUNT_SYSTEM_CAPABILITY_IDS = ["agent-orchestration"];
11399
+ function getDefaultSystemCapabilityTools() {
11400
+ const ids = DEFAULT_MOUNT_SYSTEM_CAPABILITY_IDS;
11401
+ return SYSTEM_AGENT_CAPABILITY_PACKS.filter((pack) => ids.includes(pack.id)).flatMap((pack) => [...pack.tools]);
11402
+ }
11403
+ function addDefaultSystemCapabilityTools(toolNames) {
11404
+ return [.../* @__PURE__ */ new Set([...toolNames, ...getDefaultSystemCapabilityTools()])];
11405
+ }
11407
11406
  function applySystemBuiltinSkillFilter(toolNames, systemBuiltinSkills) {
11408
11407
  if (!systemBuiltinSkills) return toolNames;
11409
11408
  const disabledToolSet = /* @__PURE__ */ new Set();
@@ -14155,7 +14154,7 @@ async function deleteDialogsFunc(args, thunkApi) {
14155
14154
  const deletedDialogIds = [];
14156
14155
  const deletedDialogKeys = [];
14157
14156
  const failures = [];
14158
- const { deleteDialog } = await import("./dialogSlice-QZZF4JXD.js");
14157
+ const { deleteDialog } = await import("./dialogSlice-FAWUQDJW.js");
14159
14158
  for (const target of targets) {
14160
14159
  try {
14161
14160
  await thunkApi.dispatch(deleteDialog(target.dbKey)).unwrap();
@@ -14419,7 +14418,7 @@ var readSkillDocFunctionSchema = {
14419
14418
  }
14420
14419
  };
14421
14420
  async function readSkillDocFunc(args, thunkApi) {
14422
- const { buildReadDocResult } = await import("./readDocTool-TCYJY4PP.js");
14421
+ const { buildReadDocResult } = await import("./readDocTool-VPBDTO4G.js");
14423
14422
  const id = args?.id ?? args?.doc ?? args?.docKey ?? args?.pageKey;
14424
14423
  if (typeof id !== "string" || !id.trim()) {
14425
14424
  throw new Error("readSkillDoc requires id or doc.");
@@ -19869,7 +19868,7 @@ var selectUserIdFromState = (state) => typeof state?.auth?.currentUser?.userId =
19869
19868
  var selectCurrentServerFromState = (state) => typeof state?.settings?.currentServer === "string" ? state.settings.currentServer : null;
19870
19869
  async function addImageContentToSpace(input) {
19871
19870
  const injectedAddContentAction = input.thunkApi?.extra?.addContentAction;
19872
- const addContentAction2 = typeof injectedAddContentAction === "function" ? injectedAddContentAction : (await import("./addContentAction-4Z762DMR.js")).addContentAction;
19871
+ const addContentAction2 = typeof injectedAddContentAction === "function" ? injectedAddContentAction : (await import("./addContentAction-QDGHGUBH.js")).addContentAction;
19873
19872
  await addContentAction2(
19874
19873
  {
19875
19874
  spaceId: input.spaceId,
@@ -20975,6 +20974,13 @@ function waitForAbortableDelay(ms, signal) {
20975
20974
  });
20976
20975
  }
20977
20976
 
20977
+ // packages/core/deployWindowRetrySignal.ts
20978
+ function isDeployWindowRetrySignal(e) {
20979
+ if (e.reason === CORE_DRAIN_REASON) return true;
20980
+ if (typeof e.status === "number") return isGatewayHttpStatus(e.status);
20981
+ return e.retryable === true;
20982
+ }
20983
+
20978
20984
  // packages/ai/chat/parseMultilineSSE.ts
20979
20985
  function createSSEParser() {
20980
20986
  let buffer = "";
@@ -21036,6 +21042,7 @@ var parseMultilineSSE = createSSEParser();
21036
21042
 
21037
21043
  // packages/ai/agent/runAgentBackground.ts
21038
21044
  var MAX_SSE_RETRIES = 3;
21045
+ var MAX_SSE_CORE_DRAINING_RETRIES = 30;
21039
21046
  var SSE_RETRY_DELAY_MS = 1500;
21040
21047
  var MAX_RUN_START_RETRIES = 1;
21041
21048
  var MAX_RUN_START_CORE_DRAINING_RETRIES = 30;
@@ -21045,12 +21052,15 @@ function createRetryableError(message, retryAfterMs) {
21045
21052
  retryAfterMs
21046
21053
  });
21047
21054
  }
21048
- function createSubscriptionError(status, hasBody, retryAfterMs) {
21055
+ function createSubscriptionError(status, hasBody, retryAfterMs, reason) {
21049
21056
  const message = !hasBody ? `\u4E8B\u4EF6\u6D41\u54CD\u5E94\u7F3A\u5C11 body (${status})` : `\u65E0\u6CD5\u8BA2\u9605\u4E8B\u4EF6\u6D41 (${status})`;
21050
21057
  if (status === 401 || status === 403) {
21051
21058
  return new Error(message);
21052
21059
  }
21053
- return createRetryableError(message, retryAfterMs);
21060
+ const err = createRetryableError(message, retryAfterMs);
21061
+ err.status = status;
21062
+ if (reason) err.reason = reason;
21063
+ return err;
21054
21064
  }
21055
21065
  async function waitForRetryDelay(retryAfterMs, signal) {
21056
21066
  await waitForAbortableDelay(retryAfterMs, signal);
@@ -21081,10 +21091,13 @@ async function listenToDialogEvents(dialogId, currentServer, authHeader, signal,
21081
21091
  throw createRetryableError("\u4E8B\u4EF6\u6D41\u8FDE\u63A5\u5931\u8D25");
21082
21092
  }
21083
21093
  if (!eventsRes.ok || !eventsRes.body) {
21094
+ const errText = await eventsRes.text().catch(() => "");
21095
+ const payload = parseRetryableJson(errText);
21084
21096
  throw createSubscriptionError(
21085
21097
  eventsRes.status,
21086
21098
  !!eventsRes.body,
21087
- resolveRetryAfterMs(eventsRes.headers, SSE_RETRY_DELAY_MS)
21099
+ resolveRetryAfterMs(eventsRes.headers, SSE_RETRY_DELAY_MS, payload?.retryAfterMs),
21100
+ payload?.reason
21088
21101
  );
21089
21102
  }
21090
21103
  const reader = eventsRes.body.getReader();
@@ -21139,7 +21152,7 @@ async function listenToDialogEvents(dialogId, currentServer, authHeader, signal,
21139
21152
  });
21140
21153
  }
21141
21154
  var runAgentBackground = createAsyncThunk("agent/runBackground", async (args, { getState, signal: thunkSignal }) => {
21142
- const { agentKey, userInput, serverBase, spaceId, parentDialogId, onStatusChange, onDone, onFailed } = args;
21155
+ const { agentKey, userInput, serverBase, spaceId, parentDialogId, ephemeral, onStatusChange, onDone, onFailed } = args;
21143
21156
  const state = getState();
21144
21157
  const currentServer = normalizeServerOrigin(serverBase) || selectCurrentServer(state);
21145
21158
  const token = selectIdentityToken(state);
@@ -21161,6 +21174,7 @@ var runAgentBackground = createAsyncThunk("agent/runBackground", async (args, {
21161
21174
  spaceId,
21162
21175
  background: true,
21163
21176
  ...parentDialogId ? { parentDialogId } : {},
21177
+ ...ephemeral ? { ephemeral: true } : {},
21164
21178
  runtimeContext: {
21165
21179
  surface: "web",
21166
21180
  host: "browser",
@@ -21209,8 +21223,9 @@ var runAgentBackground = createAsyncThunk("agent/runBackground", async (args, {
21209
21223
  return { dialogId, status: runResponse.status };
21210
21224
  }
21211
21225
  let lastError;
21226
+ let maxSseRetries = MAX_SSE_RETRIES;
21212
21227
  const eventServer = normalizeServerOrigin(routedServerBase) || currentServer;
21213
- for (let attempt = 0; attempt <= MAX_SSE_RETRIES; attempt++) {
21228
+ for (let attempt = 0; attempt <= maxSseRetries; attempt++) {
21214
21229
  try {
21215
21230
  return await listenToDialogEvents(
21216
21231
  dialogId,
@@ -21223,7 +21238,10 @@ var runAgentBackground = createAsyncThunk("agent/runBackground", async (args, {
21223
21238
  );
21224
21239
  } catch (e) {
21225
21240
  if (isAbortError(e)) throw e;
21226
- if (!e?.retryable || attempt >= MAX_SSE_RETRIES) throw e;
21241
+ if (!e?.retryable || attempt >= maxSseRetries) throw e;
21242
+ if (isDeployWindowRetrySignal(e)) {
21243
+ maxSseRetries = MAX_SSE_CORE_DRAINING_RETRIES;
21244
+ }
21227
21245
  lastError = e;
21228
21246
  onStatusChange?.("reconnecting");
21229
21247
  await waitForRetryDelay(e?.retryAfterMs ?? SSE_RETRY_DELAY_MS, effectiveSignal);
@@ -21261,7 +21279,7 @@ var callAgentFunctionSchema = {
21261
21279
  },
21262
21280
  task: {
21263
21281
  type: "string",
21264
- description: "\u59D4\u6258\u7ED9\u8BE5 Agent \u7684\u5B50\u4EFB\u52A1\u63CF\u8FF0\uFF08\u81EA\u7136\u8BED\u8A00\uFF09\u3002\u5EFA\u8BAE\u5728\u6B64\u5305\u542B\u5FC5\u8981\u7684\u4E0A\u4E0B\u6587\u8BF4\u660E\uFF08\u4F8B\u5982\u5F53\u524D\u8868\u7ED3\u6784\u3001\u9898\u5E93\u8BF4\u660E\u7B49\uFF09\u3002"
21282
+ description: "\u59D4\u6258\u7ED9\u8BE5 Agent \u7684\u5B50\u4EFB\u52A1\u63CF\u8FF0\uFF08\u81EA\u7136\u8BED\u8A00\uFF09\u3002\u5EFA\u8BAE\u5728\u6B64\u5305\u542B\u5FC5\u8981\u7684\u4E0A\u4E0B\u6587\u8BF4\u660E\uFF08\u4F8B\u5982\u5F53\u524D\u8868\u7ED3\u6784\u3001\u9898\u5E93\u8BF4\u660E\u7B49\uFF09\u3002\u5728 task \u91CC\u8981\u6C42\u5B50 agent '\u6700\u540E\u7528 1-3 \u53E5\u8BDD\u603B\u7ED3\u7ED3\u8BBA + \u5217\u51FA\u5173\u952E\u4EA7\u51FA'\uFF0C\u7236 agent \u7528 resultMode:summary \u65F6\u5C31\u53EA\u9700\u8BFB\u8FD9\u6BB5\u603B\u7ED3\uFF0C\u4E0D\u5FC5\u6D88\u5316\u5B8C\u6574\u8F93\u51FA\u3002"
21265
21283
  },
21266
21284
  input: {
21267
21285
  description: "\u53EF\u9009\u3002JSON \u6216\u5B57\u7B26\u4E32\uFF0C\u5C06\u4F5C\u4E3A\u672C\u6B21\u5B50\u4EFB\u52A1\u7684\u9644\u52A0\u8F93\u5165\u3002\u901A\u5E38\u7528\u4E8E\u4F20\u9012\u6293\u53D6\u5230\u7684\u539F\u59CB\u6570\u636E\u3001\u9898\u5E93\u3001\u4E0A\u4E0B\u6587\u7247\u6BB5\u7B49\u3002"
@@ -21270,13 +21288,19 @@ var callAgentFunctionSchema = {
21270
21288
  type: "boolean",
21271
21289
  description: "\u53EF\u9009\u3002\u5F53\u4E3A true \u65F6\u7ACB\u5373\u521B\u5EFA\u540E\u53F0\u5B50\u5BF9\u8BDD\u5E76\u8FD4\u56DE childDialogId\uFF0C\u7531\u8C03\u7528\u65B9\u7A0D\u540E\u67E5\u8BE2\u7ED3\u679C\uFF1B\u9002\u5408\u53EF\u80FD\u8D85\u8FC7 HTTP \u7F51\u5173\u7B49\u5F85\u7A97\u53E3\uFF08\u7EA6 100 \u79D2\uFF09\u7684\u957F\u4EFB\u52A1\uFF0C\u907F\u514D Cloudflare 524 \u5BFC\u81F4\u7ED3\u679C\u4E22\u5931\u3002\u9ED8\u8BA4 false\uFF0C\u5373\u7EE7\u7EED\u7B49\u5F85\u5B50\u4EFB\u52A1\u5B8C\u6210\u5E76\u8FD4\u56DE content\u3002",
21272
21290
  default: false
21291
+ },
21292
+ resultMode: {
21293
+ type: "string",
21294
+ enum: ["summary", "full"],
21295
+ description: "\u53EF\u9009\u3002\u63A7\u5236\u8FD4\u56DE\u7ED9\u7236 agent \u7684\u5185\u5BB9\u91CF\uFF0C\u51CF\u5C11\u7236 agent \u4E0A\u4E0B\u6587\u6210\u672C\u3002summary\uFF08\u9ED8\u8BA4\uFF09\uFF1A\u53EA\u8FD4\u56DE\u5B50 agent \u8F93\u51FA\u7684\u524D 2000 \u5B57 + \u672B\u5C3E\u603B\u7ED3\u6BB5\uFF0C\u9002\u5408\u7236 agent \u53EA\u9700\u7ED3\u8BBA\u800C\u975E\u5B8C\u6574\u8FC7\u7A0B\u3002full\uFF1A\u8FD4\u56DE\u5B50 agent \u5B8C\u6574\u8F93\u51FA\uFF0C\u9002\u5408\u9700\u8981\u5B8C\u6574 diff/\u65E5\u5FD7\u505A\u540E\u7EED\u5904\u7406\u3002\u7236 agent \u6BCF\u591A\u4E00\u4E2A turn \u5904\u7406\u5B50\u8F93\u51FA = \u5168\u524D\u7F00\u91CD\u65B0\u8BA1\u4EF7\uFF0C\u6240\u4EE5\u975E\u5FC5\u8981\u65F6\u7528 summary\u3002\u4EC5\u5728 foreground \u6A21\u5F0F\uFF08background \u672A\u8BBE\u6216 false\uFF09\u751F\u6548\uFF1Bbackground \u6A21\u5F0F\u65E0 content \u53EF\u622A\uFF0C\u6B64\u53C2\u6570\u88AB\u5FFD\u7565\u3002",
21296
+ default: "summary"
21273
21297
  }
21274
21298
  },
21275
21299
  required: ["agentKey", "task"]
21276
21300
  }
21277
21301
  };
21278
21302
  async function callAgentFunc(args, thunkApi, context) {
21279
- const { agentKey, task, input, background } = args;
21303
+ const { agentKey, task, input, background, resultMode } = args;
21280
21304
  const { dispatch } = thunkApi;
21281
21305
  if (!agentKey) {
21282
21306
  throw new Error("callAgent: \u7F3A\u5C11 agentKey \u53C2\u6570\u3002");
@@ -21302,15 +21326,29 @@ async function callAgentFunc(args, thunkApi, context) {
21302
21326
  displayData: `\u23F3 callAgent \u540E\u53F0\u5DF2\u542F\u52A8\uFF0CdialogId: ${bgResult.dialogId}\uFF0C\u8BF7\u7A0D\u540E\u67E5\u8BE2\u7ED3\u679C\u3002`
21303
21327
  };
21304
21328
  }
21329
+ const fullContent = bgResult.content ?? bgResult;
21330
+ const wantSummary = resultMode !== "full";
21331
+ const returnedContent = wantSummary ? summarizeChildContent(typeof fullContent === "string" ? fullContent : JSON.stringify(fullContent)) : fullContent;
21305
21332
  return {
21306
- rawData: bgResult.content ?? bgResult,
21307
- displayData: `\u2705 callAgent \u6267\u884C\u5B8C\u6210\uFF0CdialogId: ${bgResult.dialogId}`
21333
+ rawData: returnedContent,
21334
+ displayData: `\u2705 callAgent \u6267\u884C\u5B8C\u6210\uFF0CdialogId: ${bgResult.dialogId}${wantSummary ? "\uFF08summary\uFF09" : ""}`
21308
21335
  };
21309
21336
  } catch (e) {
21310
21337
  const msg = toErrorMessage(e);
21311
21338
  throw new Error(`callAgent \u8C03\u7528 Agent [${agentKey}] \u65F6\u51FA\u9519: ${msg}`);
21312
21339
  }
21313
21340
  }
21341
+ var SUMMARY_HEAD_CHARS = 1500;
21342
+ var SUMMARY_TAIL_CHARS = 500;
21343
+ var SUMMARY_MIN_LENGTH_THRESHOLD = SUMMARY_HEAD_CHARS + SUMMARY_TAIL_CHARS + 50;
21344
+ function summarizeChildContent(text) {
21345
+ if (text.length <= SUMMARY_MIN_LENGTH_THRESHOLD) return text;
21346
+ return `${text.slice(0, SUMMARY_HEAD_CHARS)}
21347
+
21348
+ \u2026\uFF08\u4E2D\u95F4\u90E8\u5206\u5DF2\u7701\u7565\uFF0CresultMode=full \u53EF\u770B\u5B8C\u6574\u8F93\u51FA\uFF09\u2026
21349
+
21350
+ ${text.slice(-SUMMARY_TAIL_CHARS)}`;
21351
+ }
21314
21352
 
21315
21353
  // packages/ai/agent/guidedCreation/capabilities.ts
21316
21354
  var GUIDED_AGENT_CAPABILITIES = {
@@ -22005,13 +22043,17 @@ var startAgentRunFunctionSchema = {
22005
22043
  agentName: {
22006
22044
  type: "string",
22007
22045
  description: "\u53EF\u9009\u3002\u7531 listAgents/readAgent \u5F97\u5230\u7684\u53EF\u8BFB Agent \u540D\u79F0\uFF0C\u7528\u4E8E TUI \u8FD0\u884C\u5361\u7247\u5C55\u793A\u3002"
22046
+ },
22047
+ ephemeral: {
22048
+ type: "boolean",
22049
+ description: "\u53EF\u9009\u3002\u4E3A true \u65F6\u672C\u6B21 run \u4E0D\u6301\u4E45\u5316 dialog\uFF08\u4E0D\u7559\u8BB0\u5F55\uFF09\u3002\u7528\u4E8E\u4E00\u6B21\u6027\u5BA1\u67E5\uFF08review\uFF09\u7B49\u4E0D\u9700\u7559\u75D5\u7684\u573A\u666F\u3002\u9ED8\u8BA4 false\u3002"
22008
22050
  }
22009
22051
  },
22010
22052
  required: ["agentKey", "task"]
22011
22053
  }
22012
22054
  };
22013
22055
  async function startAgentRunFunc(args, thunkApi, _context) {
22014
- const { agentKey, task, input, agentName } = args;
22056
+ const { agentKey, task, input, agentName, ephemeral } = args;
22015
22057
  const { dispatch } = thunkApi;
22016
22058
  if (!agentKey) {
22017
22059
  throw new Error("startAgentRun: \u7F3A\u5C11 agentKey \u53C2\u6570\u3002");
@@ -22028,7 +22070,8 @@ async function startAgentRunFunc(args, thunkApi, _context) {
22028
22070
  agentKey,
22029
22071
  userInput: content,
22030
22072
  waitForCompletion: false,
22031
- ...parentDialogId ? { parentDialogId } : {}
22073
+ ...parentDialogId ? { parentDialogId } : {},
22074
+ ...ephemeral ? { ephemeral: true } : {}
22032
22075
  })
22033
22076
  ).unwrap();
22034
22077
  const runId = bgResult.dialogId;
@@ -23361,7 +23404,7 @@ var executeToolRun = createAsyncThunk(
23361
23404
  if (!executionInput) {
23362
23405
  throw new Error(`ToolRun ${id} has no input to execute with.`);
23363
23406
  }
23364
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-4JSNWHIK.js");
23407
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-YB6LXSVN.js");
23365
23408
  const { executor } = findToolExecutor2(run.toolName);
23366
23409
  toolRunStarted({
23367
23410
  id: run.id,
@@ -23385,7 +23428,7 @@ var executeToolRun = createAsyncThunk(
23385
23428
  const latestState = thunkApi.getState();
23386
23429
  const userId = latestState.auth?.currentUser?.userId;
23387
23430
  if (userId) {
23388
- const { fetchUserSpaceMemberships } = await import("./spaceSlice-3GLIRD3Q.js");
23431
+ const { fetchUserSpaceMemberships } = await import("./spaceSlice-444MFUP6.js");
23389
23432
  await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
23390
23433
  }
23391
23434
  }
@@ -25078,6 +25121,86 @@ async function appFileReplaceFunc(args, thunkApi) {
25078
25121
  \u4E0B\u4E00\u6B65\uFF1A\u5148 appPreflight\uFF0C\u518D appDeploy\u3002`
25079
25122
  };
25080
25123
  }
25124
+ var appVersionListFunctionSchema = {
25125
+ name: "appVersionList",
25126
+ description: "\u5217\u51FA\u67D0\u4E2A\u5E94\u7528\u7684\u5386\u53F2\u7248\u672C\u5FEB\u7167\u3002\u5F53 appFileList/appFileRead \u8FD4\u56DE 409\uFF08\u6E90\u7801\u5DE5\u4F5C\u533A\u7F3A\u5931\uFF09\u65F6\uFF0C\u7528\u6B64\u5DE5\u5177\u67E5\u770B\u662F\u5426\u6709\u53EF\u6062\u590D\u7684\u5386\u53F2\u7248\u672C\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u7F16\u5360\u4F4D\u4EE3\u7801\u90E8\u7F72\u3002",
25127
+ parameters: {
25128
+ type: "object",
25129
+ properties: {
25130
+ appId: {
25131
+ type: "string",
25132
+ description: "\u5E94\u7528 ID\u3002"
25133
+ }
25134
+ },
25135
+ required: ["appId"]
25136
+ }
25137
+ };
25138
+ async function appVersionListFunc(args, thunkApi) {
25139
+ const { appId } = args;
25140
+ if (!appId) throw new Error("\u5FC5\u987B\u63D0\u4F9B appId \u53C2\u6570");
25141
+ const data = await callToolApi(thunkApi, "/api/version/list", { type: "app", entityId: appId }, { withAuth: true });
25142
+ if (!data.versions?.length) {
25143
+ return {
25144
+ rawData: data,
25145
+ displayData: `\u{1F4ED} \u5E94\u7528 ${appId} \u6CA1\u6709\u5386\u53F2\u7248\u672C\u5FEB\u7167\u3002`
25146
+ };
25147
+ }
25148
+ const list = data.versions.map((v, i) => {
25149
+ const date = v.createdAt ? new Date(v.createdAt).toISOString().slice(0, 16) : "?";
25150
+ const pin = v.pinned ? " \u{1F4CC}" : "";
25151
+ const label = v.label ? ` "${v.label}"` : "";
25152
+ return `${i + 1}. ${v.versionId} ${date}${pin}${label}`;
25153
+ }).join("\n");
25154
+ return {
25155
+ rawData: data,
25156
+ displayData: `\u{1F4CB} \u5E94\u7528 ${appId} \u7684\u5386\u53F2\u7248\u672C (${data.versions.length} \u4E2A):
25157
+ ${list}
25158
+
25159
+ \u7528 appVersionRestore(appId, versionId) \u53EF\u6062\u590D\u5230\u6307\u5B9A\u7248\u672C\u3002\u5EFA\u8BAE\u5148\u6062\u590D\u6700\u8FD1\u7684\u5B8C\u6574\u7248\u672C\uFF0C\u518D\u4FEE\u6539\u3002`
25160
+ };
25161
+ }
25162
+ var appVersionRestoreFunctionSchema = {
25163
+ name: "appVersionRestore",
25164
+ description: "\u5C06\u5E94\u7528\u6062\u590D\u5230\u6307\u5B9A\u7684\u5386\u53F2\u7248\u672C\u3002\u6062\u590D\u540E\u4EE3\u7801\u3001\u6E90\u7801\u6587\u4EF6\u3001framework\u3001renderMode\u3001SSR \u4EA7\u7269\u5168\u90E8\u56DE\u5230\u8BE5\u7248\u672C\u7684\u72B6\u6001\u3002\u9002\u7528\u4E8E\uFF1A\u6E90\u7801\u5DE5\u4F5C\u533A\u4E22\u5931\u3001\u4EE3\u7801\u88AB\u8BEF\u8986\u76D6\u3001\u9700\u8981\u56DE\u6EDA\u5230\u65E7\u7248\u672C\u3002",
25165
+ parameters: {
25166
+ type: "object",
25167
+ properties: {
25168
+ appId: {
25169
+ type: "string",
25170
+ description: "\u5E94\u7528 ID\u3002"
25171
+ },
25172
+ versionId: {
25173
+ type: "string",
25174
+ description: "\u8981\u6062\u590D\u5230\u7684\u7248\u672C ID\u3002\u5148\u7528 appVersionList \u83B7\u53D6\u7248\u672C\u5217\u8868\uFF0C\u9009\u62E9\u76EE\u6807 versionId\u3002"
25175
+ },
25176
+ restoreMode: {
25177
+ type: "string",
25178
+ enum: ["source_only", "full"],
25179
+ description: "source_only\uFF08\u9ED8\u8BA4\uFF09\uFF1A\u53EA\u6062\u590D\u4EE3\u7801/\u6E90\u7801/framework\uFF0C\u4FDD\u7559\u5F53\u524D name/visibility/customUrl\u3002full\uFF1A\u8FDE name/visibility/customUrl \u4E00\u8D77\u6062\u590D\u3002\u901A\u5E38\u7528 source_only \u5373\u53EF\u3002"
25180
+ }
25181
+ },
25182
+ required: ["appId", "versionId"]
25183
+ }
25184
+ };
25185
+ async function appVersionRestoreFunc(args, thunkApi) {
25186
+ const { appId, versionId, restoreMode } = args;
25187
+ if (!appId) throw new Error("\u5FC5\u987B\u63D0\u4F9B appId");
25188
+ if (!versionId) throw new Error("\u5FC5\u987B\u63D0\u4F9B versionId\uFF1B\u8BF7\u5148\u8C03\u7528 appVersionList \u83B7\u53D6\u7248\u672C\u5217\u8868");
25189
+ const data = await callToolApi(
25190
+ thunkApi,
25191
+ "/api/version/restore",
25192
+ { type: "app", entityId: appId, versionId, restoreMode: restoreMode ?? "source_only" },
25193
+ { withAuth: true, method: "POST" }
25194
+ );
25195
+ return {
25196
+ rawData: data,
25197
+ displayData: `\u21A9\uFE0F \u5DF2\u6062\u590D\u5E94\u7528 ${appId} \u5230\u7248\u672C ${versionId}
25198
+ - ${data.message}
25199
+ - restoreMode: ${data.restoreMode}
25200
+
25201
+ \u4E0B\u4E00\u6B65\uFF1A\u7528 appFileList \u786E\u8BA4\u6E90\u7801\u5DE5\u4F5C\u533A\u5DF2\u6062\u590D\uFF0C\u7136\u540E\u7528 appFileRead/appFileReplace \u4FEE\u6539\u4EE3\u7801\u3002`
25202
+ };
25203
+ }
25081
25204
 
25082
25205
  // packages/ai/tools/cfSpeechToTextTool.ts
25083
25206
  var cfSpeechToTextFunctionSchema = {
@@ -25788,7 +25911,7 @@ async function updateDocFunc(args, thunkApi) {
25788
25911
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
25789
25912
  };
25790
25913
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
25791
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-66Q4JTTG.js");
25914
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-2UHVWLTV.js");
25792
25915
  if (getDocState().pageKey === id) {
25793
25916
  applyExternalDocUpdate({
25794
25917
  slateData: finalSlateData,
@@ -25813,7 +25936,7 @@ async function updateDocFunc(args, thunkApi) {
25813
25936
  // packages/ai/tools/updateUserPreferenceProfileTool.ts
25814
25937
  async function dispatchSetSettings(thunkApi, changes) {
25815
25938
  const injectedSetSettings = thunkApi?.extra?.setSettings;
25816
- const setSettings = typeof injectedSetSettings === "function" ? injectedSetSettings : (await import("./settingSlice-FTWZ5ZHT.js")).setSettings;
25939
+ const setSettings = typeof injectedSetSettings === "function" ? injectedSetSettings : (await import("./settingSlice-7JYPQNAC.js")).setSettings;
25817
25940
  await thunkApi.dispatch(setSettings(changes)).unwrap();
25818
25941
  }
25819
25942
  var updateUserPreferenceProfileFunctionSchema = {
@@ -27821,6 +27944,30 @@ var baseToolDefinitions = [
27821
27944
  behavior: "data",
27822
27945
  uiGroup: "general"
27823
27946
  },
27947
+ {
27948
+ id: "appVersionList",
27949
+ schema: appVersionListFunctionSchema,
27950
+ executor: appVersionListFunc,
27951
+ description: {
27952
+ name: "appVersionList",
27953
+ description: "\u5217\u51FA\u5E94\u7528\u7684\u5386\u53F2\u7248\u672C\u5FEB\u7167\u3002\u5F53 appFileList \u8FD4\u56DE 409\uFF08\u6E90\u7801\u5DE5\u4F5C\u533A\u7F3A\u5931\uFF09\u65F6\u4F7F\u7528\uFF0C\u67E5\u770B\u662F\u5426\u6709\u53EF\u6062\u590D\u7684\u5386\u53F2\u7248\u672C\u3002",
27954
+ category: "\u5E94\u7528\u90E8\u7F72"
27955
+ },
27956
+ behavior: "data",
27957
+ uiGroup: "general"
27958
+ },
27959
+ {
27960
+ id: "appVersionRestore",
27961
+ schema: appVersionRestoreFunctionSchema,
27962
+ executor: appVersionRestoreFunc,
27963
+ description: {
27964
+ name: "appVersionRestore",
27965
+ description: "\u5C06\u5E94\u7528\u6062\u590D\u5230\u6307\u5B9A\u7684\u5386\u53F2\u7248\u672C\uFF0C\u4EE3\u7801/\u6E90\u7801/framework/SSR \u4EA7\u7269\u5168\u90E8\u56DE\u6EDA\u3002",
27966
+ category: "\u5E94\u7528\u90E8\u7F72"
27967
+ },
27968
+ behavior: "data",
27969
+ uiGroup: "general"
27970
+ },
27824
27971
  {
27825
27972
  id: "cfSpeechToText",
27826
27973
  schema: cfSpeechToTextFunctionSchema,
@@ -28038,6 +28185,7 @@ export {
28038
28185
  isAgentRunTerminalStatus,
28039
28186
  TOOL_PACKS,
28040
28187
  resolveEffectiveEnabledPacks,
28188
+ addDefaultSystemCapabilityTools,
28041
28189
  applySystemBuiltinSkillFilter,
28042
28190
  expandEnabledPacks,
28043
28191
  expandEnabledPackPromptPatches,
@@ -39,7 +39,7 @@ var PUBLIC_DEEPSEEK_V4_PRO_AGENT_ID = "01DSV4PROPUB00000001A9OLZN";
39
39
  var PUBLIC_DEEPSEEK_V4_PRO_AGENT_KEY = `agent-pub-${PUBLIC_DEEPSEEK_V4_PRO_AGENT_ID}`;
40
40
  var PUBLIC_KIMI_K27_CODING_AGENT_ID = "01KIMIK27CODEOL000000001";
41
41
  var PUBLIC_KIMI_K27_CODING_AGENT_KEY = `agent-pub-${PUBLIC_KIMI_K27_CODING_AGENT_ID}`;
42
- var PUBLIC_GLM_52_AGENT_ID = "01GLM52CHAT00000000001U721";
42
+ var PUBLIC_GLM_52_AGENT_ID = "01GLM52DIPB00000000I3E2MY";
43
43
  var PUBLIC_GLM_52_AGENT_KEY = `agent-pub-${PUBLIC_GLM_52_AGENT_ID}`;
44
44
  var PUBLIC_KIMI_K26_IMAGE_AGENT_ID = "01KIMIK26OLLAMA0000000001";
45
45
  var PUBLIC_KIMI_K26_IMAGE_AGENT_KEY = `agent-pub-${PUBLIC_KIMI_K26_IMAGE_AGENT_ID}`;
@@ -2,8 +2,10 @@ import {
2
2
  accumulateToolCallDelta,
3
3
  extractThinkContent,
4
4
  flushThinkParser,
5
+ flushToolCallTextParserIntoCallback,
6
+ processContentChunkWithToolCallStripping,
5
7
  processThinkChunk
6
- } from "./chunk-3WGLLTK4.js";
8
+ } from "./chunk-LSFAWXKC.js";
7
9
  import {
8
10
  buildProviderExecutionPlan,
9
11
  canUsePlatformChatProvider,
@@ -19,7 +21,7 @@ import {
19
21
  resolveProviderTransportDecision,
20
22
  toOpenAiCompatibleMessages,
21
23
  toResponsesTools
22
- } from "./chunk-SRKNB2WB.js";
24
+ } from "./chunk-HRQCKQA5.js";
23
25
  import {
24
26
  clipCompactText
25
27
  } from "./chunk-5MMAK75Q.js";
@@ -104,7 +106,16 @@ function applyChatCompletionDelta(parsed, state) {
104
106
  }
105
107
  const textChunk = typeof delta.content === "string" ? delta.content : "";
106
108
  if (textChunk) {
107
- const parsedChunk = processThinkChunk(textChunk, state.thinkState);
109
+ const { cleanedContent, state: newState } = processContentChunkWithToolCallStripping(
110
+ textChunk,
111
+ state.toolCallTextState,
112
+ (name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
113
+ { index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
114
+ ])
115
+ );
116
+ state.toolCallTextState = newState;
117
+ if (!cleanedContent) return true;
118
+ const parsedChunk = processThinkChunk(cleanedContent, state.thinkState);
108
119
  state.thinkState = parsedChunk.state;
109
120
  if (parsedChunk.content) {
110
121
  state.content += parsedChunk.content;
@@ -118,11 +129,19 @@ function applyChatCompletionDelta(parsed, state) {
118
129
  return true;
119
130
  }
120
131
  function flushChatCompletionStream(state) {
132
+ const { residualContent, state: tcState } = flushToolCallTextParserIntoCallback(
133
+ state.toolCallTextState,
134
+ (name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
135
+ { index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
136
+ ])
137
+ );
138
+ state.toolCallTextState = tcState;
121
139
  const flushed = flushThinkParser(state.thinkState);
122
140
  state.thinkState = flushed.state;
123
- if (flushed.content) {
124
- state.content += flushed.content;
125
- state.onTextDelta?.(flushed.content);
141
+ const combinedContent = residualContent + (flushed.content ?? "");
142
+ if (combinedContent) {
143
+ state.content += combinedContent;
144
+ state.onTextDelta?.(combinedContent);
126
145
  }
127
146
  if (flushed.reasoning) {
128
147
  state.reasoning += flushed.reasoning;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-S5UACFUP.js";
4
+ } from "./chunk-TTGAVETO.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-KUDUXBNE.js";
4
+ } from "./chunk-VE6XMVKG.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
7
  } from "./chunk-B4KT7RN2.js";