nolo-cli 0.115.0-alpha.1 → 0.116.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 (63) hide show
  1. package/{_executeModel-RQXGTKAT.js → _executeModel-BPUR2QYH.js} +15 -14
  2. package/{addDialogAgentAction-MCEABSBA.js → addDialogAgentAction-S2NRBCWW.js} +1 -1
  3. package/{agentDeleteCommand-S4GW4PKE.js → agentDeleteCommand-MNAA6MIG.js} +2 -2
  4. package/{agentEmailCommands-M26R6BO4.js → agentEmailCommands-SK34WJKU.js} +14 -14
  5. package/{agentListCommands-3YRR3FOM.js → agentListCommands-I26MKI4T.js} +2 -2
  6. package/{agentMachineCommands-ZFEQOZG3.js → agentMachineCommands-M6QDR6P3.js} +3 -3
  7. package/{agentRecordCommands-LZ4G5INZ.js → agentRecordCommands-HTHLO2MM.js} +14 -14
  8. package/{agentRunCommand-GOP4T77I.js → agentRunCommand-IAIRCMTH.js} +14 -14
  9. package/{agentRuntimeLocal-FXCNGFFT.js → agentRuntimeLocal-3WTYYIT2.js} +2 -2
  10. package/{agentSlice-PKMID4S2.js → agentSlice-TVP3HINW.js} +1 -1
  11. package/{appDeleteCommands-2LIWMMJP.js → appDeleteCommands-SB5TNLKY.js} +2 -2
  12. package/{appDeployCommands-WOTKY2LM.js → appDeployCommands-2IPKZINV.js} +2 -2
  13. package/{appDeployStatusCommands-6QQWIFCK.js → appDeployStatusCommands-K63TFUID.js} +2 -2
  14. package/{appGetCommands-Z4RHYUKS.js → appGetCommands-VU2SLNEH.js} +2 -2
  15. package/{appListCommands-SOBFAS4W.js → appListCommands-S3T4DJ36.js} +2 -2
  16. package/{chatQueueReduxAdapter-KMULSV7M.js → chatQueueReduxAdapter-TWIYKVIZ.js} +3 -3
  17. package/{chunk-2MMIOYAF.js → chunk-3BGIKIPF.js} +12 -12
  18. package/{chunk-SQCF7OWL.js → chunk-3IUWIAHP.js} +1 -1
  19. package/{chunk-SWM3OJR7.js → chunk-3VUWPRFW.js} +5 -4
  20. package/{chunk-RB3EETRZ.js → chunk-52Q2IW2X.js} +429 -53
  21. package/{chunk-TUBKLG3S.js → chunk-5MEYHVIB.js} +1 -1
  22. package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
  23. package/{chunk-X767IQBD.js → chunk-DD6XE56O.js} +9 -62
  24. package/{chunk-KEQNY22P.js → chunk-FP76KI2Y.js} +54 -11
  25. package/{chunk-VLTIYV3X.js → chunk-HYJFRTLW.js} +1 -1
  26. package/{chunk-6P47Q5OH.js → chunk-KAUSRTO6.js} +2 -2
  27. package/{chunk-5F3OZ7L2.js → chunk-LMREEBWT.js} +35 -5
  28. package/{chunk-ANFQ4KPL.js → chunk-MZYBSTMH.js} +2 -2
  29. package/chunk-OCZKATRC.js +129 -0
  30. package/{chunk-22CGS5BQ.js → chunk-PMAIQX7A.js} +2 -2
  31. package/{chunk-NGEWETHC.js → chunk-RPJUFEGR.js} +3 -3
  32. package/{chunk-LZLZNZ4H.js → chunk-U4OKDZFH.js} +1 -1
  33. package/{chunk-DE7R7ZAP.js → chunk-UDVH2P4A.js} +3 -3
  34. package/{chunk-QTGQ2LTL.js → chunk-UEVXFHQB.js} +1 -1
  35. package/{chunk-Q4U2WKQY.js → chunk-XP3VVAPG.js} +90 -14
  36. package/{chunk-SBDFSHSS.js → chunk-Z2PV6O2T.js} +9 -0
  37. package/{contentThunks-EHSBUA4D.js → contentThunks-JYWI7G7I.js} +4 -4
  38. package/{createAgentAutomationAction-G2MK4LVL.js → createAgentAutomationAction-Z4SUJ54Y.js} +4 -4
  39. package/{createDialogAction-JH7ZCV5Z.js → createDialogAction-RCHFLVJ2.js} +5 -5
  40. package/{createPageAction-SRPNANEQ.js → createPageAction-YK2253XQ.js} +4 -4
  41. package/{dialogCommands-JCDHSPHY.js → dialogCommands-X4UOZQWX.js} +2 -2
  42. package/{dialogSlice-YUPGRKPA.js → dialogSlice-IVTWLCE2.js} +9 -3
  43. package/{docCreateCommands-HDV5VRAK.js → docCreateCommands-VD6TGHG4.js} +2 -2
  44. package/{docDeleteCommands-77BE7WA3.js → docDeleteCommands-OT3R2G4W.js} +2 -2
  45. package/{docReadCommands-4Z7DUAHQ.js → docReadCommands-2G7BIXSH.js} +2 -2
  46. package/{docStore-F3LR3M6Z.js → docStore-UENKCCDX.js} +1 -1
  47. package/{docUpdateCommands-L45KOOSF.js → docUpdateCommands-45MVJKZA.js} +2 -2
  48. package/{handleSendMessageAction-GCKW2H7N.js → handleSendMessageAction-LM2J4HC3.js} +40 -6
  49. package/index.js +41 -41
  50. package/{machineCommands-N3XF6SYH.js → machineCommands-6N6MQIE6.js} +14 -14
  51. package/{machineWsRunDispatch-UJX7MT2Z.js → machineWsRunDispatch-7MFKVQCR.js} +14 -14
  52. package/package.json +1 -1
  53. package/{readlineWorkspace-FFZEUHR4.js → readlineWorkspace-JWBON5CX.js} +34 -16
  54. package/{removeDialogAgentAction-J6X5QMTA.js → removeDialogAgentAction-W66BJ7CF.js} +1 -1
  55. package/{runAgentClientLoop-UGNX7QRL.js → runAgentClientLoop-TA4SSPHE.js} +12 -12
  56. package/{setDialogExtraReferencesAction-WX5VTY6O.js → setDialogExtraReferencesAction-2ALKG3WA.js} +2 -2
  57. package/{setPrimaryDialogAgentAction-FN22THHT.js → setPrimaryDialogAgentAction-TQZB55F6.js} +1 -1
  58. package/{spaceCommands-TCEN2CRN.js → spaceCommands-6NSAXB7D.js} +2 -2
  59. package/{streamAgentChatTurn-DKVJJ2BL.js → streamAgentChatTurn-X5ENGUIS.js} +76 -18
  60. package/{switchDialogAgentAction-LVTEV3FR.js → switchDialogAgentAction-3KI72HHS.js} +1 -1
  61. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-G3M73RTB.js} +2 -2
  62. package/{tools-IHD7PL23.js → tools-XRQR7ZZR.js} +9 -9
  63. package/{updateDialogTitleAction-QKUFUNTO.js → updateDialogTitleAction-ESUUD3GT.js} +4 -4
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-SWM3OJR7.js";
4
+ } from "./chunk-3VUWPRFW.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -21,6 +21,8 @@ var createEmptyDialogRuntimeState = () => ({
21
21
  activeControllers: {},
22
22
  pendingRawData: {},
23
23
  loopStopReason: null,
24
+ turnPhase: null,
25
+ turnPhaseTurnId: null,
24
26
  pendingUserInputQueue: []
25
27
  });
26
28
  var activeDialogKey = null;
@@ -67,6 +69,8 @@ function resetDialogRuntimeSessionState(dialogKey) {
67
69
  const runtime = ensureDialogRuntimeState(dialogKey);
68
70
  runtime.tokens = createEmptyTokenStats();
69
71
  runtime.loopStopReason = null;
72
+ runtime.turnPhase = null;
73
+ runtime.turnPhaseTurnId = null;
70
74
  runtime.pendingUserInputQueue = [];
71
75
  notify();
72
76
  }
@@ -114,6 +118,26 @@ function setLoopStopReason(payload) {
114
118
  notify();
115
119
  return action("dialogRuntime/setLoopStopReason", payload);
116
120
  }
121
+ function claimDialogTurnPhase(payload) {
122
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
123
+ runtime.turnPhaseTurnId = payload.turnId;
124
+ runtime.turnPhase = null;
125
+ notify();
126
+ return action("dialogRuntime/claimDialogTurnPhase", payload);
127
+ }
128
+ function setDialogTurnPhase(payload) {
129
+ const runtime = ensureDialogRuntimeState(payload.dialogKey);
130
+ if (typeof payload.turnId === "string" && runtime.turnPhaseTurnId !== null && runtime.turnPhaseTurnId !== payload.turnId) {
131
+ return action("dialogRuntime/setDialogTurnPhase:rejected", payload);
132
+ }
133
+ runtime.turnPhase = payload.phase;
134
+ runtime.turnPhaseTurnId = payload.phase === null ? null : payload.turnId ?? null;
135
+ notify();
136
+ return action("dialogRuntime/setDialogTurnPhase", payload);
137
+ }
138
+ function clearDialogTurnPhase(payload = {}) {
139
+ return setDialogTurnPhase({ phase: null, dialogKey: payload.dialogKey, turnId: payload.turnId });
140
+ }
117
141
  function clearDialogRuntimeState(payload) {
118
142
  delete runtimeByKey[payload.dialogKey];
119
143
  notify();
@@ -258,6 +282,9 @@ function getPendingUserInputQueue(dialogKey) {
258
282
  function getLoopStopReason(dialogKey) {
259
283
  return getDialogRuntimeState(dialogKey).loopStopReason;
260
284
  }
285
+ function getDialogTurnPhase(dialogKey) {
286
+ return getDialogRuntimeState(dialogKey).turnPhase;
287
+ }
261
288
  var selectDialogRuntimeByKey = (_state, dialogKey) => getDialogRuntimeState(dialogKey);
262
289
  var selectPendingFiles = (_state, dialogKey) => getPendingFiles(dialogKey);
263
290
  var selectActiveControllers = (_state, dialogKey) => getActiveControllers(dialogKey);
@@ -293,6 +320,10 @@ function useLoopStopReason(dialogKey) {
293
320
  (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
294
321
  return getLoopStopReason(dialogKey);
295
322
  }
323
+ function useDialogTurnPhase(dialogKey) {
324
+ (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
325
+ return getDialogTurnPhase(dialogKey);
326
+ }
296
327
  function useDialogRuntimeTokens(dialogKey) {
297
328
  (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
298
329
  return getDialogRuntimeTokens(dialogKey);
@@ -316,6 +347,9 @@ export {
316
347
  removePendingFile,
317
348
  clearPendingAttachments,
318
349
  setLoopStopReason,
350
+ claimDialogTurnPhase,
351
+ setDialogTurnPhase,
352
+ clearDialogTurnPhase,
319
353
  clearDialogRuntimeState,
320
354
  addActiveController,
321
355
  removeActiveController,
@@ -346,6 +380,7 @@ export {
346
380
  useActiveControllers,
347
381
  usePendingUserInputQueue,
348
382
  useLoopStopReason,
383
+ useDialogTurnPhase,
349
384
  useDialogRuntimeTokens,
350
385
  useCurrentDialogKey,
351
386
  useDialogConfigError
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-6P47Q5OH.js";
8
+ } from "./chunk-KAUSRTO6.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-SWM3OJR7.js";
15
+ } from "./chunk-3VUWPRFW.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,10 +23,13 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-2MMIOYAF.js";
26
+ } from "./chunk-3BGIKIPF.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
30
+ import {
31
+ parseApiError
32
+ } from "./chunk-OCZKATRC.js";
30
33
  import {
31
34
  getCurrentSpaceId
32
35
  } from "./chunk-ZJ7UHBJS.js";
@@ -35,15 +38,15 @@ import {
35
38
  messageStreamEnd,
36
39
  messageStreaming,
37
40
  updateToolMessage
38
- } from "./chunk-Q4U2WKQY.js";
41
+ } from "./chunk-XP3VVAPG.js";
39
42
  import {
40
43
  streamAgentChatTurn
41
- } from "./chunk-DE7R7ZAP.js";
44
+ } from "./chunk-UDVH2P4A.js";
42
45
  import {
43
46
  addActiveController,
44
47
  removeActiveController,
45
48
  tokenUsageLiveUpdate
46
- } from "./chunk-6YTOJY35.js";
49
+ } from "./chunk-6D2JFXLY.js";
47
50
  import {
48
51
  accumulateToolCallDelta,
49
52
  createThinkParserState,
@@ -794,61 +797,6 @@ var handleToolCalls = createAsyncThunk(
794
797
  }
795
798
  );
796
799
 
797
- // packages/ai/chat/parseApiError.ts
798
- async function parseApiError(response) {
799
- const errorBody = await response.text();
800
- const truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
801
- const isContextOverflow = (message) => /maximum context length|context length|context_length_exceeded|requested about .*tokens|too many tokens/i.test(message);
802
- let defaultMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
803
- let errorMessage = defaultMessage;
804
- let errorCode = `E${response.status}`;
805
- try {
806
- const errorJson = JSON.parse(errorBody);
807
- errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || defaultMessage;
808
- errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
809
- } catch (_e) {
810
- if (errorBody) {
811
- errorMessage = errorBody;
812
- }
813
- }
814
- switch (response.status) {
815
- case 400:
816
- if (isContextOverflow(errorMessage) || isContextOverflow(errorBody) || errorCode === "UPSTREAM_400") {
817
- return "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002";
818
- }
819
- if (errorCode === "MISSING_PROVIDER_API_KEY") {
820
- return truncateErrorMessage(errorMessage);
821
- }
822
- if (errorMessage && errorMessage !== defaultMessage) {
823
- return `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`;
824
- }
825
- return "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165";
826
- case 413:
827
- return "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002";
828
- case 401:
829
- switch (errorCode) {
830
- case "AUTH_TOKEN_EXPIRED":
831
- return "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55";
832
- case "AUTH_ACCOUNT_INVALID":
833
- return "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458";
834
- case "AUTH_NO_TOKEN":
835
- return "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55";
836
- case "AUTH_INVALID_TOKEN":
837
- return "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55";
838
- case "AUTH_TOKEN_NOT_ACTIVE":
839
- return "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5";
840
- default:
841
- return errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55";
842
- }
843
- case 503:
844
- return errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5";
845
- case 504:
846
- return "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5";
847
- default:
848
- return `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`;
849
- }
850
- }
851
-
852
800
  // packages/ai/chat/accumulateToolCallChunks.ts
853
801
  function accumulateToolCallChunks(currentAccumulatedCalls, toolCallChunks) {
854
802
  const accumulator = {
@@ -1839,7 +1787,6 @@ export {
1839
1787
  filterAndCleanMessages,
1840
1788
  persistToolMessages,
1841
1789
  handleToolCalls,
1842
- parseApiError,
1843
1790
  updateTotalUsage,
1844
1791
  readStreamChunk,
1845
1792
  sendOpenAICompletionsRequest
@@ -31,7 +31,7 @@ import {
31
31
  t,
32
32
  toolLabel,
33
33
  toolLabelVariants
34
- } from "./chunk-5F3OZ7L2.js";
34
+ } from "./chunk-LMREEBWT.js";
35
35
  import {
36
36
  createRunActivityTracker,
37
37
  popSingleQueueMessage,
@@ -65,7 +65,7 @@ import {
65
65
  } from "./chunk-LTRXGFMS.js";
66
66
  import {
67
67
  formatAgentListCard
68
- } from "./chunk-2MMIOYAF.js";
68
+ } from "./chunk-3BGIKIPF.js";
69
69
  import {
70
70
  isTransientFetchError
71
71
  } from "./chunk-5UTFL4QJ.js";
@@ -89,11 +89,11 @@ import {
89
89
  chooseMemoryOwners,
90
90
  loadMemoryCandidatesFromDb,
91
91
  resolveAgentMemoryPolicy
92
- } from "./chunk-ANFQ4KPL.js";
92
+ } from "./chunk-MZYBSTMH.js";
93
93
  import {
94
94
  API_REPORTED_COST_MULTIPLIER,
95
95
  parseUiAskChoiceContent
96
- } from "./chunk-Q4U2WKQY.js";
96
+ } from "./chunk-XP3VVAPG.js";
97
97
  import {
98
98
  isOAuthApiKeyRef
99
99
  } from "./chunk-YYLHWIW6.js";
@@ -116,7 +116,7 @@ import {
116
116
  LOCAL_AGENT_CONFIG_MISSING_CODE,
117
117
  LOCAL_TURN_ABORTED_CODE,
118
118
  readActionGate
119
- } from "./chunk-RB3EETRZ.js";
119
+ } from "./chunk-52Q2IW2X.js";
120
120
  import {
121
121
  resolveAgentRuntimeConfigFromRecord
122
122
  } from "./chunk-4MK3I7Y4.js";
@@ -10174,6 +10174,21 @@ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
10174
10174
  spinner.show(activeLabel);
10175
10175
  options.activityReporter?.(activeLabel);
10176
10176
  },
10177
+ /**
10178
+ * Pre-delta turn phase label (ctx-overflow-feedback batch 3).
10179
+ *
10180
+ * localLoop 在首个 provider delta 之前依次发出 turn-phase 事件
10181
+ * (validating-context → compacting → waiting-provider);此前 CLI 只有
10182
+ * llm-start 才进入明确 working 状态,压缩期间 spinner 停在通用
10183
+ * working 文案上,用户无法区分「卡在检查上下文 / 压缩 / 等模型」。
10184
+ * 两个显示面(bare CLI 的 spinner 与 TUI 的 dock activityReporter)与
10185
+ * showWorking 走同一条投影,保证两端文案不漂移。
10186
+ */
10187
+ showPhase(phase) {
10188
+ const label = phase === "validating-context" ? t("contextChecking") : phase === "compacting" ? t("contextCompacting") : t("waitingForModel");
10189
+ spinner.show(label);
10190
+ options.activityReporter?.(label);
10191
+ },
10177
10192
  finish(fallbackContent) {
10178
10193
  const flushedThink = flushThinkParser(thinkState);
10179
10194
  thinkState = flushedThink.state;
@@ -10609,7 +10624,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
10609
10624
  // packages/cli/client/agentRun.ts
10610
10625
  import { ulid as ulid2 } from "ulid";
10611
10626
  async function loadRunLocalAgentTurn() {
10612
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-FXCNGFFT.js");
10627
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-3WTYYIT2.js");
10613
10628
  return runLocalAgentTurn;
10614
10629
  }
10615
10630
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -10987,6 +11002,17 @@ function buildUpstreamFailure(ctx) {
10987
11002
  return `${RUN_UNAVAILABLE_PREFIX} (${ctx.where} returned HTTP ${ctx.status}). Detail: ${ctx.message} ${NO_FALLBACK} ${fix}, ${SERVER_FALLBACK_HINT}.
10988
11003
  `;
10989
11004
  }
11005
+ function formatLocalTurnFailureLine(error) {
11006
+ const message = toErrorMessage(error);
11007
+ if (error?.code === "LLM_REQUEST_TIMEOUT") {
11008
+ const msMatch = /after (\d+)ms/.exec(message);
11009
+ const deadline = msMatch && Number.isFinite(Number(msMatch[1])) ? formatElapsed(Math.round(Number(msMatch[1]) / 1e3)) : "the configured window";
11010
+ return `[nolo] ${t("llmRequestTimedOut", deadline)}
11011
+ `;
11012
+ }
11013
+ return `[nolo] Local agent run failed: ${message}
11014
+ `;
11015
+ }
10990
11016
  var FAILURE_BUILDERS = {
10991
11017
  auth: buildAuthFailure,
10992
11018
  "rejected-payload": buildRejectedPayloadFailure,
@@ -11391,6 +11417,18 @@ async function runLocalAgentTurnForCli(options, settings) {
11391
11417
  if (event.kind === "llm-start") {
11392
11418
  turnOutput.showWorking();
11393
11419
  }
11420
+ if (event.kind === "turn-phase") {
11421
+ turnOutput.showPhase(event.phase);
11422
+ }
11423
+ if (event.kind === "compaction-start") {
11424
+ turnOutput.showPhase("compacting");
11425
+ }
11426
+ if (event.kind === "compaction-end" || // 压缩失败(timeout/provider-error)时 localLoop 按失败原子性语义
11427
+ // 带着裁剪后的历史继续本轮,切回等待模型文案;aborted 时 turn 随即
11428
+ // 结束,不再切文案(终态由 abort 路径收尾)。
11429
+ event.kind === "compaction-failed" && event.reason !== "aborted") {
11430
+ turnOutput.showPhase("waiting-provider");
11431
+ }
11394
11432
  if (event.kind === "image-downgraded") {
11395
11433
  options.output.write(
11396
11434
  "[nolo] \u5F53\u524D agent \u88AB\u914D\u7F6E\u4E3A\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u56FE\u7247\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\u8BF7\u68C0\u67E5\u6A21\u578B\u7684\u56FE\u7247\u80FD\u529B\u914D\u7F6E\uFF0C\u6216\u7528 /switch \u9009\u62E9\u652F\u6301\u56FE\u7247\u7684 agent \u540E\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002\n"
@@ -11462,10 +11500,12 @@ async function runLocalAgentTurnForCli(options, settings) {
11462
11500
  error.cooldownUntil = cooldownUntil;
11463
11501
  }
11464
11502
  if (settings.reportFailure) {
11465
- options.output.write(
11466
- `[nolo] Local agent run failed: ${toErrorMessage(error)}
11467
- `
11468
- );
11503
+ const failureLine = formatLocalTurnFailureLine(error);
11504
+ if (typeof options.output.writeErr === "function") {
11505
+ options.output.writeErr(failureLine);
11506
+ } else {
11507
+ options.output.write(failureLine);
11508
+ }
11469
11509
  if (cooldownUntil) {
11470
11510
  options.output.write(
11471
11511
  `[nolo] \u5DF2\u6807\u8BB0\u51B7\u5374\u81F3 ${cooldownUntil}\uFF0C\u5230\u671F\u524D\u6D3E\u53D1\u8BE5 agent \u4F1A\u88AB\u51B7\u5374\u95E8\u63A7\u62E6\u622A\u3002
@@ -13723,7 +13763,10 @@ async function resolveAgentRunAgentKey(args) {
13723
13763
  }
13724
13764
  async function runAgentRunCommand(args, deps) {
13725
13765
  const env = deps.env ?? process.env;
13726
- const output = deps.output ?? process.stdout;
13766
+ const output = deps.output ?? {
13767
+ write: (chunk) => process.stdout.write(chunk),
13768
+ writeErr: (chunk) => process.stderr.write(chunk)
13769
+ };
13727
13770
  if (args.includes("--help") || args.includes("-h")) {
13728
13771
  writeUsage(output, deps.commandPath);
13729
13772
  return 0;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getActiveDialogKey
3
- } from "./chunk-6YTOJY35.js";
3
+ } from "./chunk-6D2JFXLY.js";
4
4
  import {
5
5
  compactWhitespace
6
6
  } from "./chunk-DWLEOOGR.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-2MMIOYAF.js";
3
+ } from "./chunk-3BGIKIPF.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-Q4U2WKQY.js";
6
+ } from "./chunk-XP3VVAPG.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  import {
62
62
  inlineImageUrlsForCustomProvider,
63
63
  prepareTools
64
- } from "./chunk-6P47Q5OH.js";
64
+ } from "./chunk-KAUSRTO6.js";
65
65
  import {
66
66
  getServerProviderSecret
67
67
  } from "./chunk-HS7MLR74.js";
@@ -80,7 +80,7 @@ import {
80
80
  rememberMemoryFunctionSchema,
81
81
  resolveAgentRequiredPackIds,
82
82
  setTodoListFunc
83
- } from "./chunk-2MMIOYAF.js";
83
+ } from "./chunk-3BGIKIPF.js";
84
84
  import {
85
85
  fetchWithTransientRetry,
86
86
  isTransientFetchError
@@ -109,14 +109,14 @@ import {
109
109
  prepareTokenUsageData,
110
110
  resolveBuiltinPlatformAgentConfig,
111
111
  runKeyed
112
- } from "./chunk-Q4U2WKQY.js";
112
+ } from "./chunk-XP3VVAPG.js";
113
113
  import {
114
114
  BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
115
115
  BUILTIN_TITLE_LLM_CONFIG
116
116
  } from "./chunk-MC4XLIJ7.js";
117
117
  import {
118
118
  fetchServerSyncedCredential
119
- } from "./chunk-DE7R7ZAP.js";
119
+ } from "./chunk-UDVH2P4A.js";
120
120
  import {
121
121
  require_date_fns
122
122
  } from "./chunk-M76ECQRD.js";
@@ -162,7 +162,7 @@ import {
162
162
  readDevinUpstreamFailure,
163
163
  resolveOpenAiCompatibleProviderConfig,
164
164
  summarizeToolArguments
165
- } from "./chunk-RB3EETRZ.js";
165
+ } from "./chunk-52Q2IW2X.js";
166
166
  import {
167
167
  PlatformStreamInterruptedError,
168
168
  buildPlatformChatCompletionRequest,
@@ -712,6 +712,35 @@ var STRINGS = {
712
712
  en: "Thinking: {0}",
713
713
  zh: "\u601D\u8003\u4E2D\uFF1A{0}"
714
714
  },
715
+ // --- Pre-delta turn phase labels (ctx-overflow-feedback batch 3) ----------
716
+ // Rendered on the spinner / activity line while the local runtime checks the
717
+ // context window, compacts history, or waits for the first model delta —
718
+ // the previously silent pre-delta window (batch 1/2a 修好 runtime 与 SSE,
719
+ // 这里补齐 CLI/TUI 的状态行投影)。compacting 行附带可取消提示:Esc /
720
+ // Ctrl+C 即 abort,语义与 localLoop 的 abortSignal 一致。
721
+ contextChecking: {
722
+ en: "Checking this model's context window\u2026",
723
+ zh: "\u6B63\u5728\u68C0\u67E5\u5F53\u524D\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3\u2026"
724
+ },
725
+ contextCompacting: {
726
+ en: "Compacting history\u2026 (Esc/Ctrl+C to cancel)",
727
+ zh: "\u6B63\u5728\u538B\u7F29\u5386\u53F2\u8BB0\u5F55\u2026\uFF08Esc/Ctrl+C \u53D6\u6D88\uFF09"
728
+ },
729
+ waitingForModel: {
730
+ en: "Waiting for the model\u2026",
731
+ zh: "\u6B63\u5728\u7B49\u5F85\u6A21\u578B\u54CD\u5E94\u2026"
732
+ },
733
+ // --- Local turn deadline failure (single actionable line) -----------------
734
+ // localLoop 主请求 idle deadline(DEFAULT_LLM_REQUEST_TIMEOUT_MS 兜底或调用方
735
+ // timeoutMs)到达后抛 code=LLM_REQUEST_TIMEOUT;generic 分支的「修本地
736
+ // 凭据」文案在这里是错误指引(请求已发出,问题在上游无响应)。
737
+ // 语义是 idle(静默窗):{0} 内没有任何新输出才放弃,不是说模型「完全没
738
+ // 响应」——文案必须与这个语义一致,否则会把正在生成的用户推向重复发送
739
+ // (2026-10 ctx-overflow-feedback review 修复 1)。
740
+ llmRequestTimedOut: {
741
+ en: "No new model output for {0}, so this turn was stopped. Your message was kept. Retry in this conversation, switch to another model, or run /compact first.",
742
+ zh: "\u6A21\u578B\u5DF2 {0} \u6CA1\u6709\u65B0\u8F93\u51FA\uFF0C\u672C\u8F6E\u5DF2\u505C\u6B62\u7B49\u5F85\uFF08\u53EF\u80FD\u4ECD\u5728\u751F\u6210\uFF09\u3002\u4F60\u7684\u6D88\u606F\u5DF2\u4FDD\u7559\u3002\u53EF\u5728\u672C\u5BF9\u8BDD\u91CD\u8BD5\u3001\u5207\u6362\u5230\u5176\u4ED6\u6A21\u578B\uFF0C\u6216\u5148 /compact \u538B\u7F29\u5BF9\u8BDD\u3002"
743
+ },
715
744
  thinkingTraceLine: {
716
745
  en: "\u273B Thought for {0}",
717
746
  zh: "\u273B \u601D\u8003 {0}"
@@ -9280,6 +9309,7 @@ function createCursorProvider(config) {
9280
9309
  ...config.executeTool ? { executeTool: config.executeTool } : {},
9281
9310
  ...config.searchWorkspace ? { searchWorkspace: config.searchWorkspace } : {},
9282
9311
  ...config.listWorkspaceEntries ? { listWorkspaceEntries: config.listWorkspaceEntries } : {},
9312
+ ...options?.signal ? { signal: options.signal } : {},
9283
9313
  ...options?.onTextDelta ? { onTextDelta: options.onTextDelta } : {},
9284
9314
  ...options?.onReasoningDelta ? { onReasoningDelta: options.onReasoningDelta } : {},
9285
9315
  ...options?.onToolEvent ? { onToolEvent: options.onToolEvent } : {},
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-SQCF7OWL.js";
3
+ } from "./chunk-3IUWIAHP.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-Q4U2WKQY.js";
8
+ } from "./chunk-XP3VVAPG.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
@@ -0,0 +1,129 @@
1
+ // packages/ai/chat/parseApiError.ts
2
+ var CONTEXT_OVERFLOW_ACTIONS = [
3
+ "compact-and-retry",
4
+ "new-dialog",
5
+ "switch-model",
6
+ "retry"
7
+ ];
8
+ var CONTEXT_TOO_LARGE_ACTIONS = [
9
+ "new-dialog",
10
+ "switch-model",
11
+ "retry"
12
+ ];
13
+ var truncateErrorMessage = (message, maxChars = 320) => message.length <= maxChars ? message : `${message.slice(0, maxChars)}\u2026`;
14
+ var isContextOverflowText = (message) => /maximum context|context (length|window|overflow|limit)|context_length_exceed\w*|requested about .*tokens|too many tokens|prompt is too long|exceeds? (the )?(model|max)/i.test(
15
+ message
16
+ );
17
+ function classifyApiError(input) {
18
+ const { status, message, body, code } = input;
19
+ const errorMessage = message;
20
+ let defaultMessage = `\u72B6\u6001\u7801 ${status} ${input.statusText ?? ""}`;
21
+ switch (status) {
22
+ case 400:
23
+ if (isContextOverflowText(errorMessage) || isContextOverflowText(body) || code === "UPSTREAM_400") {
24
+ return {
25
+ kind: "context_overflow",
26
+ message: "\u4E0A\u4E0B\u6587\u8FC7\u957F\uFF1A\u672C\u8F6E\u6D88\u606F\u6216\u5DE5\u5177\u7ED3\u679C\u592A\u5927\u3002\u8BF7\u7F29\u5C0F\u8303\u56F4\uFF0C\u6216\u5148\u8BFB\u53D6\u66F4\u5C0F\u7247\u6BB5\u540E\u518D\u7EE7\u7EED\u3002",
27
+ code,
28
+ status,
29
+ retryable: true,
30
+ actions: [...CONTEXT_OVERFLOW_ACTIONS]
31
+ };
32
+ }
33
+ if (code === "MISSING_PROVIDER_API_KEY") {
34
+ return {
35
+ kind: "generic",
36
+ message: truncateErrorMessage(errorMessage),
37
+ code,
38
+ status,
39
+ retryable: false
40
+ };
41
+ }
42
+ if (errorMessage && errorMessage !== defaultMessage) {
43
+ return {
44
+ kind: "generic",
45
+ message: `\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}`,
46
+ code,
47
+ status,
48
+ retryable: false
49
+ };
50
+ }
51
+ return { kind: "generic", message: "\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165", code, status, retryable: false };
52
+ case 413:
53
+ return {
54
+ kind: "context_too_large",
55
+ message: "\u8BF7\u6C42\u5185\u5BB9\u8FC7\u5927\uFF1A\u8BF7\u51CF\u5C11\u4E00\u6B21\u53D1\u9001\u7684\u6D88\u606F\u3001\u6587\u4EF6\u6216\u5DE5\u5177\u7ED3\u679C\u3002",
56
+ code,
57
+ status,
58
+ retryable: true,
59
+ actions: [...CONTEXT_TOO_LARGE_ACTIONS]
60
+ };
61
+ case 401:
62
+ return {
63
+ kind: "auth",
64
+ message: code === "AUTH_TOKEN_EXPIRED" ? "\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_ACCOUNT_INVALID" ? "\u8D26\u6237\u65E0\u6548\u6216\u5DF2\u88AB\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458" : code === "AUTH_NO_TOKEN" ? "\u672A\u68C0\u6D4B\u5230\u767B\u5F55\u72B6\u6001\uFF0C\u8BF7\u5148\u767B\u5F55" : code === "AUTH_INVALID_TOKEN" ? "\u767B\u5F55\u51ED\u8BC1\u65E0\u6548\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55" : code === "AUTH_TOKEN_NOT_ACTIVE" ? "\u4EE4\u724C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5" : errorMessage && errorMessage !== `\u72B6\u6001\u7801 401 Unauthorized` ? `\u8BA4\u8BC1\u9519\u8BEF: ${truncateErrorMessage(errorMessage)}` : "\u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25\uFF0C\u8BF7\u5148\u767B\u51FA\u540E\u91CD\u65B0\u767B\u5F55",
65
+ code,
66
+ status,
67
+ retryable: true,
68
+ actions: ["retry"]
69
+ };
70
+ case 503:
71
+ return {
72
+ kind: "server",
73
+ message: errorMessage && errorMessage !== `\u72B6\u6001\u7801 503 Service Unavailable` ? truncateErrorMessage(errorMessage) : "\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
74
+ code,
75
+ status,
76
+ retryable: true,
77
+ actions: ["retry"]
78
+ };
79
+ case 504:
80
+ return {
81
+ kind: "timeout",
82
+ message: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
83
+ code,
84
+ status,
85
+ retryable: true,
86
+ actions: ["retry"]
87
+ };
88
+ default:
89
+ return {
90
+ kind: "generic",
91
+ message: `API\u8BF7\u6C42\u5931\u8D25: ${truncateErrorMessage(errorMessage)}`,
92
+ code,
93
+ status,
94
+ retryable: true,
95
+ actions: ["retry"]
96
+ };
97
+ }
98
+ }
99
+ async function parseApiErrorInfo(response) {
100
+ const errorBody = await response.text();
101
+ let errorMessage = `\u72B6\u6001\u7801 ${response.status} ${response.statusText}`;
102
+ let errorCode = `E${response.status}`;
103
+ try {
104
+ const errorJson = JSON.parse(errorBody);
105
+ errorMessage = errorJson?.error?.message || errorJson?.message || errorJson?.msg || errorBody || errorMessage;
106
+ errorCode = errorJson?.error?.code || errorJson?.code || errorCode;
107
+ } catch (_e) {
108
+ if (errorBody) {
109
+ errorMessage = errorBody;
110
+ }
111
+ }
112
+ return classifyApiError({
113
+ status: response.status,
114
+ statusText: response.statusText,
115
+ message: errorMessage,
116
+ body: errorBody,
117
+ code: errorCode
118
+ });
119
+ }
120
+ async function parseApiError(response) {
121
+ return (await parseApiErrorInfo(response)).message;
122
+ }
123
+
124
+ export {
125
+ CONTEXT_OVERFLOW_ACTIONS,
126
+ CONTEXT_TOO_LARGE_ACTIONS,
127
+ isContextOverflowText,
128
+ parseApiError
129
+ };
@@ -326,7 +326,7 @@ async function saveDocState(arg, { dispatch, getState }) {
326
326
  ).unwrap();
327
327
  if (dbSpaceId) {
328
328
  try {
329
- const { updateContentTitle } = await import("./contentThunks-EHSBUA4D.js");
329
+ const { updateContentTitle } = await import("./contentThunks-JYWI7G7I.js");
330
330
  await dispatch(
331
331
  updateContentTitle({
332
332
  spaceId: dbSpaceId,
@@ -365,7 +365,7 @@ async function saveDocState(arg, { dispatch, getState }) {
365
365
  }
366
366
  }
367
367
  async function createDocState(args, thunkApi) {
368
- const { createPageAction } = await import("./createPageAction-SRPNANEQ.js");
368
+ const { createPageAction } = await import("./createPageAction-YK2253XQ.js");
369
369
  return createPageAction(args, thunkApi);
370
370
  }
371
371
  function subscribe(listener) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-5F3OZ7L2.js";
4
+ } from "./chunk-LMREEBWT.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-2MMIOYAF.js";
7
+ } from "./chunk-3BGIKIPF.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-RB3EETRZ.js";
10
+ } from "./chunk-52Q2IW2X.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
13
  } from "./chunk-HCT7U36O.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-5F3OZ7L2.js";
3
+ } from "./chunk-LMREEBWT.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-LS2ZANRJ.js";
@@ -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-RQXGTKAT.js");
307
+ const { _executeModel } = await import("./_executeModel-BPUR2QYH.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-UGNX7QRL.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-TA4SSPHE.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-DKVJJ2BL.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-X5ENGUIS.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**