nolo-cli 0.49.0-alpha.1 → 0.49.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 (71) hide show
  1. package/{_executeModel-4BPV4B2U.js → _executeModel-KE4PQSZ3.js} +19 -19
  2. package/{agentDeleteCommand-KZSETRE3.js → agentDeleteCommand-Z67TJG3W.js} +10 -10
  3. package/{agentEmailCommands-C33KPOFP.js → agentEmailCommands-7LPIK7JE.js} +23 -23
  4. package/{agentListCommands-KVLURCS7.js → agentListCommands-5J2IM3IT.js} +12 -12
  5. package/{agentMachineCommands-ICOLSVID.js → agentMachineCommands-YXH6FXUQ.js} +11 -11
  6. package/{agentRecordCommands-OWKWVY3Y.js → agentRecordCommands-GZLCDVUS.js} +22 -22
  7. package/{agentRunCommand-FINKBYUN.js → agentRunCommand-WYH5Q54Q.js} +22 -22
  8. package/{agentRuntimeLocal-SIQYQGSK.js → agentRuntimeLocal-A6EF3RUY.js} +10 -10
  9. package/{agentSlice-VD3BAJAU.js → agentSlice-ARTDF6VD.js} +1 -1
  10. package/{appDeleteCommands-LSIIQFYN.js → appDeleteCommands-V2B7ZCLC.js} +10 -10
  11. package/{appDeployCommands-VYGKN7HU.js → appDeployCommands-AXQU44RD.js} +10 -10
  12. package/{appDeployStatusCommands-ODFHFUR7.js → appDeployStatusCommands-FWGSC2UM.js} +10 -10
  13. package/{appGetCommands-DPQY67UZ.js → appGetCommands-67R3RFZK.js} +10 -10
  14. package/{appListCommands-EFXENXWX.js → appListCommands-TTASJPGV.js} +10 -10
  15. package/{authCommand-WLWOEVYI.js → authCommand-QOPOEYEK.js} +7 -7
  16. package/{chatQueueReduxAdapter-N5432EP2.js → chatQueueReduxAdapter-6CAHUQ4O.js} +7 -7
  17. package/{chunk-Y7TGWSUN.js → chunk-56W233KG.js} +1 -1
  18. package/{chunk-C2WF2OY7.js → chunk-5WADL4O7.js} +1 -1
  19. package/{chunk-7M72YPM2.js → chunk-6SMMK7MD.js} +2 -2
  20. package/{chunk-4ZL2KBI7.js → chunk-757BGY6Y.js} +1 -1
  21. package/{chunk-IERBSHMR.js → chunk-AVKUDHJO.js} +3 -3
  22. package/{chunk-VKSBVRGP.js → chunk-CVT7L2WZ.js} +1 -1
  23. package/{chunk-MCX2LX27.js → chunk-EURF2SV6.js} +11 -11
  24. package/{chunk-7GRFFW7R.js → chunk-EXDR5D6X.js} +3 -3
  25. package/{chunk-AZ6DT2UD.js → chunk-GBADO3SM.js} +1 -1
  26. package/{chunk-XB7ACJFH.js → chunk-GDGIEGHV.js} +2 -2
  27. package/{chunk-QDNFRWAX.js → chunk-GFD7TIZU.js} +2 -2
  28. package/{chunk-QAG4ZQZ7.js → chunk-GFUOVFQA.js} +1 -1
  29. package/{chunk-RPO6WAZV.js → chunk-HCMFFI2G.js} +2 -2
  30. package/{chunk-4YAMAMNA.js → chunk-HPZL4IBN.js} +11 -10
  31. package/{chunk-S3HB4CQY.js → chunk-IKSFDJXB.js} +112 -19
  32. package/{chunk-W3RZLXMA.js → chunk-IKTHA3JH.js} +2 -2
  33. package/{chunk-VZGLZTG7.js → chunk-IRJVFYOH.js} +255 -79
  34. package/{chunk-6L6UPZNH.js → chunk-K524MUQC.js} +8 -8
  35. package/{chunk-HMMOAG2I.js → chunk-NN3AMBY3.js} +7 -4
  36. package/{chunk-BO3YFOZR.js → chunk-QDHZCAH3.js} +1 -1
  37. package/{chunk-33BBDA67.js → chunk-QUCSAM43.js} +106 -34
  38. package/{chunk-Z7A54NFZ.js → chunk-RU5D3B22.js} +1 -1
  39. package/{chunk-JBL24PK6.js → chunk-SP3DPVBH.js} +2 -2
  40. package/{chunk-F22JQTSX.js → chunk-SW7RCUGA.js} +2 -2
  41. package/{chunk-3YVCM5PE.js → chunk-U5Z7LFZF.js} +1 -1
  42. package/{chunk-OZ4JNDIL.js → chunk-UQWFIWHX.js} +1 -1
  43. package/{chunk-AV4Z57LV.js → chunk-VRJUIUIY.js} +2 -2
  44. package/{chunk-72COHDZR.js → chunk-WKOEOQCI.js} +13 -13
  45. package/{chunk-VFN256RI.js → chunk-WL3UOGYO.js} +25 -0
  46. package/{chunk-5JXRVJAC.js → chunk-WX5E6HZS.js} +3 -3
  47. package/{createAgentAutomationAction-IHKV53QC.js → createAgentAutomationAction-7BBF5YXN.js} +8 -8
  48. package/{createDialogAction-4ARDCKPP.js → createDialogAction-B5URPHP4.js} +9 -9
  49. package/{createPageAction-GQOCPICU.js → createPageAction-ISJKM5Q3.js} +8 -8
  50. package/{dialogCommands-YOTCP26N.js → dialogCommands-XHH4MVA4.js} +10 -10
  51. package/{dialogSlice-NX26W623.js → dialogSlice-NRAN5X7F.js} +7 -7
  52. package/{docCreateCommands-JVAMHES4.js → docCreateCommands-FUN2Z7HQ.js} +10 -10
  53. package/{docDeleteCommands-LW5DWICT.js → docDeleteCommands-OZDPFXPF.js} +10 -10
  54. package/{docReadCommands-AQOZS3I5.js → docReadCommands-FIPK7LE3.js} +10 -10
  55. package/{docStore-YAE7GYHZ.js → docStore-LUS7SWC3.js} +9 -9
  56. package/{docUpdateCommands-FFGGX5RG.js → docUpdateCommands-BZ5GKAN4.js} +10 -10
  57. package/{getPricing-JNOCWYDH.js → getPricing-HAU62AFM.js} +3 -3
  58. package/{handleSendMessageAction-7YKH4UBI.js → handleSendMessageAction-RA4OD2ZH.js} +7 -7
  59. package/index.js +47 -47
  60. package/{machineCommands-X7YMGFMB.js → machineCommands-WDAYEFBE.js} +22 -22
  61. package/{machineWsRunDispatch-KWWJ4HTI.js → machineWsRunDispatch-TPQ2FQVS.js} +22 -22
  62. package/{models-N4NXQ44D.js → models-4QF4BJVY.js} +2 -2
  63. package/package.json +1 -1
  64. package/{readlineWorkspace-GEZVQ7IM.js → readlineWorkspace-HN44KGIF.js} +198 -96
  65. package/{runAgentClientLoop-6NCW5AS6.js → runAgentClientLoop-ZYUI22EA.js} +17 -17
  66. package/{spaceCommands-7MJVL4XR.js → spaceCommands-OJ2567D4.js} +10 -10
  67. package/{spaceSlice-JVVDCGA3.js → spaceSlice-F7JCOZEF.js} +8 -8
  68. package/{streamAgentChatTurn-UAKCHWFN.js → streamAgentChatTurn-FNFMMGNN.js} +20 -20
  69. package/{tools-ROUITGAR.js → tools-QCDR3UMD.js} +12 -12
  70. package/{tuiSummaryLlmCaller-U4EGD2SX.js → tuiSummaryLlmCaller-LCGT62QC.js} +5 -5
  71. package/{updateDialogTitleAction-R4M6ZXCX.js → updateDialogTitleAction-Y3OGJWDB.js} +8 -8
@@ -19,7 +19,7 @@ import {
19
19
  parseAgentRunEvent,
20
20
  t,
21
21
  toolLabel
22
- } from "./chunk-33BBDA67.js";
22
+ } from "./chunk-QUCSAM43.js";
23
23
  import {
24
24
  getReadableCliDb
25
25
  } from "./chunk-43CXXVJD.js";
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-LTRXGFMS.js";
53
53
  import {
54
54
  formatAgentListCard
55
- } from "./chunk-72COHDZR.js";
55
+ } from "./chunk-WKOEOQCI.js";
56
56
  import {
57
57
  isTransientFetchError
58
58
  } from "./chunk-5XTOKQLW.js";
@@ -74,12 +74,12 @@ import {
74
74
  chooseMemoryOwners,
75
75
  loadMemoryCandidatesFromDb,
76
76
  resolveAgentMemoryPolicy
77
- } from "./chunk-IERBSHMR.js";
77
+ } from "./chunk-AVKUDHJO.js";
78
78
  import {
79
79
  API_REPORTED_COST_MULTIPLIER,
80
80
  normalizeUsage,
81
81
  parseUiAskChoiceContent
82
- } from "./chunk-MCX2LX27.js";
82
+ } from "./chunk-EURF2SV6.js";
83
83
  import {
84
84
  getDefaultCliLocalRuntimeDb
85
85
  } from "./chunk-IA3A5373.js";
@@ -95,10 +95,10 @@ import {
95
95
  LOCAL_TURN_ABORTED_CODE,
96
96
  readActionGate,
97
97
  readCommandActionGatePayload
98
- } from "./chunk-S3HB4CQY.js";
98
+ } from "./chunk-IKSFDJXB.js";
99
99
  import {
100
100
  resolveAgentRuntimeConfigFromRecord
101
- } from "./chunk-VKSBVRGP.js";
101
+ } from "./chunk-CVT7L2WZ.js";
102
102
  import {
103
103
  createThinkParserState,
104
104
  flushThinkParser,
@@ -107,20 +107,20 @@ import {
107
107
  import {
108
108
  resolveClientVersion,
109
109
  resolvePlatformAuthToken
110
- } from "./chunk-JBL24PK6.js";
110
+ } from "./chunk-SP3DPVBH.js";
111
111
  import {
112
112
  isQuotaExhaustedError
113
113
  } from "./chunk-IWUMSAQF.js";
114
114
  import {
115
115
  DEFAULT_CONTEXT_WINDOW,
116
116
  getModelContextWindow
117
- } from "./chunk-F22JQTSX.js";
117
+ } from "./chunk-SW7RCUGA.js";
118
118
  import {
119
119
  clipCompactText
120
120
  } from "./chunk-HR5XDXYM.js";
121
121
  import {
122
122
  findModelConfig
123
- } from "./chunk-BO3YFOZR.js";
123
+ } from "./chunk-QDHZCAH3.js";
124
124
  import {
125
125
  compactWhitespace
126
126
  } from "./chunk-DWLEOOGR.js";
@@ -145,7 +145,7 @@ import {
145
145
  CLIENT_VERSION_TOO_OLD_CODE,
146
146
  NOLO_CLIENT_VERSION_HEADER,
147
147
  buildClientVersionUpgradeMessage
148
- } from "./chunk-VFN256RI.js";
148
+ } from "./chunk-WL3UOGYO.js";
149
149
  import {
150
150
  parsePositiveFiniteNumberOrFallback
151
151
  } from "./chunk-Y5GCAMGP.js";
@@ -3717,7 +3717,7 @@ function tokenize(value, options) {
3717
3717
  }
3718
3718
 
3719
3719
  // packages/cli/client/toolOutput.ts
3720
- function normalizeToolDisplayMode(raw, fallback = "compact") {
3720
+ function normalizeToolDisplayMode(raw, fallback = "normal") {
3721
3721
  const normalized = asTrimmedLowercaseString(raw);
3722
3722
  if (normalized === "hide" || normalized === "off" || normalized === "false" || normalized === "0") {
3723
3723
  return "hide";
@@ -3725,8 +3725,11 @@ function normalizeToolDisplayMode(raw, fallback = "compact") {
3725
3725
  if (normalized === "verbose" || normalized === "debug" || normalized === "trace" || normalized === "full") {
3726
3726
  return "verbose";
3727
3727
  }
3728
- if (normalized === "compact" || normalized === "minimal" || normalized === "short") {
3729
- return "compact";
3728
+ if (normalized === "normal" || normalized === "summary" || normalized === "on") {
3729
+ return "normal";
3730
+ }
3731
+ if (normalized === "pro" || normalized === "compact" || normalized === "minimal" || normalized === "short") {
3732
+ return "pro";
3730
3733
  }
3731
3734
  return fallback;
3732
3735
  }
@@ -3738,7 +3741,7 @@ function resolveToolDisplayMode(env = process.env) {
3738
3741
  if (legacyTrace === "verbose" || legacyTrace === "full") {
3739
3742
  return "verbose";
3740
3743
  }
3741
- return normalizeToolDisplayMode(env.NOLO_CLI_TOOLS ?? env.NOLO_TOOLS, "compact");
3744
+ return normalizeToolDisplayMode(env.NOLO_CLI_TOOLS ?? env.NOLO_TOOLS, "normal");
3742
3745
  }
3743
3746
  function shouldEmitToolEvents(mode) {
3744
3747
  return mode !== "hide";
@@ -3752,6 +3755,9 @@ function formatActiveToolLabel(event) {
3752
3755
  const label = toolLabel(toolName);
3753
3756
  return args ? `${label} ${args}` : label;
3754
3757
  }
3758
+ function formatConservativeActiveToolLabel(event) {
3759
+ return toolLabel(event.toolName || "tool");
3760
+ }
3755
3761
  function compactResultHint(event) {
3756
3762
  const gate = readActionGate(event.metadata?.actionGate);
3757
3763
  if (gate) {
@@ -3993,36 +3999,45 @@ function formatToolTraceLine(text, colorEnabled, accent = "none") {
3993
3999
  return `${dimCliText(text, true)}
3994
4000
  `;
3995
4001
  }
4002
+ var cleanUserText = (value) => stripAnsi2(value).replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
3996
4003
  function renderRunCard(snapshot, opts) {
3997
4004
  const labels = agentRunCardLabels();
3998
4005
  const timing = { startedAt: snapshot.startedAt, finishedAt: snapshot.finishedAt };
3999
- const name = snapshot.agentName ?? "agent";
4000
- if (isAgentRunTerminalStatus(snapshot.status)) {
4001
- return formatFinishedRunCard(name, snapshot.status, {
4002
- runId: snapshot.runId,
4003
- toolCallCount: snapshot.toolCallCount,
4004
- lastToolNames: snapshot.lastToolNames,
4005
- lastAssistantText: snapshot.lastAssistantText,
4006
- errorMessage: snapshot.errorMessage,
4007
- logLines: snapshot.logLines,
4008
- timing,
4009
- ...opts?.includeLogTail !== void 0 ? { includeLogTail: opts.includeLogTail } : {},
4010
- labels
4011
- });
4012
- }
4013
- return formatStatusRunCard(name, snapshot.status, {
4006
+ const safe = opts?.safe === true;
4007
+ const name = safe ? cleanUserText(snapshot.agentName ?? "agent") : snapshot.agentName ?? "agent";
4008
+ const source = safe ? {
4009
+ ...snapshot,
4010
+ agentName: snapshot.agentName ? cleanUserText(snapshot.agentName) : snapshot.agentName,
4011
+ taskPreview: snapshot.taskPreview ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview,
4012
+ lastAssistantText: snapshot.lastAssistantText ? cleanUserText(snapshot.lastAssistantText) : snapshot.lastAssistantText,
4013
+ lastToolNames: snapshot.lastToolNames?.map(cleanUserText)
4014
+ } : snapshot;
4015
+ const hadError = safe && Boolean(source.errorMessage?.trim());
4016
+ const errorFields = safe ? { errorMessage: void 0, logLines: void 0 } : { errorMessage: source.errorMessage, logLines: source.logLines };
4017
+ const body = isAgentRunTerminalStatus(snapshot.status) ? formatFinishedRunCard(name, snapshot.status, {
4014
4018
  runId: snapshot.runId,
4015
- toolCallCount: snapshot.toolCallCount,
4016
- lastToolNames: snapshot.lastToolNames,
4017
- lastAssistantText: snapshot.lastAssistantText,
4018
- errorMessage: snapshot.errorMessage,
4019
- logLines: snapshot.logLines,
4019
+ toolCallCount: source.toolCallCount,
4020
+ lastToolNames: source.lastToolNames,
4021
+ lastAssistantText: source.lastAssistantText,
4022
+ ...errorFields,
4023
+ timing,
4024
+ ...opts?.includeLogTail !== void 0 ? { includeLogTail: opts.includeLogTail } : {},
4025
+ labels
4026
+ }) : formatStatusRunCard(name, snapshot.status, {
4027
+ runId: snapshot.runId,
4028
+ toolCallCount: source.toolCallCount,
4029
+ lastToolNames: source.lastToolNames,
4030
+ lastAssistantText: source.lastAssistantText,
4031
+ ...errorFields,
4020
4032
  timing,
4021
4033
  ...opts?.includeLogTail !== void 0 ? { includeLogTail: opts.includeLogTail } : {},
4022
4034
  labels
4023
4035
  });
4036
+ return hadError ? `${body}
4037
+ error ${t("runDiagnosticsHidden")}` : body;
4024
4038
  }
4025
- function recoverOrchestrationCard(event, toolName) {
4039
+ function recoverOrchestrationCard(event, toolName, opts) {
4040
+ const safe = opts?.safe === true;
4026
4041
  const content = typeof event.content === "string" ? event.content : "";
4027
4042
  const trimmed = content.trim();
4028
4043
  if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return null;
@@ -4053,27 +4068,30 @@ function recoverOrchestrationCard(event, toolName) {
4053
4068
  if (!parsedEvent) return null;
4054
4069
  const { kind, snapshot } = parsedEvent;
4055
4070
  if (kind === "start") {
4056
- return formatStartRunCard(snapshot.agentName ?? "agent", snapshot.status, {
4057
- task: snapshot.taskPreview,
4071
+ const name = safe ? cleanUserText(snapshot.agentName ?? "agent") : snapshot.agentName ?? "agent";
4072
+ const task = snapshot.taskPreview ? safe ? cleanUserText(snapshot.taskPreview) : snapshot.taskPreview : snapshot.taskPreview;
4073
+ return formatStartRunCard(name, snapshot.status, {
4074
+ task,
4058
4075
  runId: snapshot.runId,
4059
4076
  labels
4060
4077
  });
4061
4078
  }
4062
4079
  if (kind === "gone") return formatNotFoundRunCard(labels);
4063
4080
  if (kind === "stop") return formatStopRunCard(snapshot.status, labels);
4064
- return renderRunCard(snapshot);
4081
+ return renderRunCard(snapshot, opts);
4065
4082
  }
4066
4083
  function parseControlAgentRunStatusEvent(event) {
4067
4084
  const parsed = parseAgentRunEvent(event);
4068
4085
  return parsed?.kind === "status" ? parsed.snapshot : null;
4069
4086
  }
4070
- function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
4087
+ function formatOrchestrationCardBlock(event, toolName, colorEnabled, opts) {
4088
+ const safe = opts?.safe === true;
4071
4089
  const rawLabel = toolLabel(toolName);
4072
4090
  const bakedCard = typeof event.metadata?.displayData === "string" && event.metadata.displayData.trim() ? event.metadata.displayData : "";
4073
- const rawDataStr = recoverOrchestrationCard(event, toolName) || bakedCard || (typeof event.content === "string" ? event.content : "");
4091
+ const rawDataStr = recoverOrchestrationCard(event, toolName, { safe }) || bakedCard || (typeof event.content === "string" ? event.content : "");
4074
4092
  const failed = event.type === "tool-error" || isFailedToolResult(event) || Boolean(event.metadata?.failed) || /^Error:/i.test(rawDataStr.trim());
4075
4093
  if (failed) {
4076
- const firstLine = rawDataStr.trim().split("\n")[0] || event.summary || event.message || t("toolFailed");
4094
+ const firstLine = safe ? t("toolFailed") : rawDataStr.trim().split("\n")[0] || event.summary || event.message || t("toolFailed");
4077
4095
  const message = clip(firstLine, 96);
4078
4096
  if (!colorEnabled) {
4079
4097
  return `\u2717 ${rawLabel} ${message}
@@ -4086,11 +4104,12 @@ function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
4086
4104
  `;
4087
4105
  }
4088
4106
  const displayData = rawDataStr.trim();
4089
- const lines = displayData ? displayData.split("\n").filter((line) => !/^\s*agent\s+agent\s*$/.test(line)) : [];
4107
+ const lines = displayData ? displayData.split("\n") : [];
4108
+ const projected = safe ? sanitizeRunCardForNormal(lines) : lines;
4090
4109
  if (!colorEnabled) {
4091
4110
  let out2 = `\u25CF ${rawLabel}
4092
4111
  `;
4093
- for (const line of lines) {
4112
+ for (const line of projected) {
4094
4113
  out2 += ` ${line}
4095
4114
  `;
4096
4115
  }
@@ -4100,12 +4119,40 @@ function formatOrchestrationCardBlock(event, toolName, colorEnabled) {
4100
4119
  const labelPart = themeText(rawLabel, "muted", true);
4101
4120
  let out = `${bullet} ${labelPart}
4102
4121
  `;
4103
- for (const line of lines) {
4122
+ for (const line of projected) {
4104
4123
  out += ` ${themeText(line, "muted", true)}
4105
4124
  `;
4106
4125
  }
4107
4126
  return out;
4108
4127
  }
4128
+ function sanitizeRunCardForNormal(lines) {
4129
+ const out = [];
4130
+ let errorIndent = null;
4131
+ for (const line of lines) {
4132
+ if (/^(log tail:?|日志尾部:?)$/i.test(line.trim())) {
4133
+ if (out.length > 0 && out[out.length - 1].trim() === "") out.pop();
4134
+ break;
4135
+ }
4136
+ if (/^\s*error\b/i.test(line)) {
4137
+ out.push(` error ${t("runDiagnosticsHidden")}`);
4138
+ errorIndent = line.length - line.trimStart().length;
4139
+ continue;
4140
+ }
4141
+ if (errorIndent !== null) {
4142
+ if (line.trim() === "") {
4143
+ errorIndent = null;
4144
+ out.push(line);
4145
+ continue;
4146
+ }
4147
+ const indent = line.length - line.trimStart().length;
4148
+ const isLabelRow = /^\s{2}[a-z][a-zA-Z0-9]*\s{2,}/.test(line);
4149
+ if (indent > errorIndent && !isLabelRow) continue;
4150
+ errorIndent = null;
4151
+ }
4152
+ out.push(line);
4153
+ }
4154
+ return out;
4155
+ }
4109
4156
  function mergeRunSnapshot(previous, next) {
4110
4157
  return {
4111
4158
  ...previous,
@@ -4160,6 +4207,36 @@ function formatVerboseToolEvent(event, colorEnabled) {
4160
4207
  colorEnabled
4161
4208
  );
4162
4209
  }
4210
+ function formatNormalToolLine(event, pending, colorEnabled) {
4211
+ if (event.type === "tool-call") return "";
4212
+ const toolName = event.toolName || pending?.toolName || "tool";
4213
+ const todoBlock = formatTodoListForCli(event, colorEnabled);
4214
+ if (todoBlock) return todoBlock;
4215
+ if (event.type === "tool-result" && (event.toolName === "ask_user" || event.metadata?.uiAskChoice)) {
4216
+ const block = formatUiAskChoiceBlock(event, colorEnabled);
4217
+ if (block) return block;
4218
+ }
4219
+ if (event.type === "tool-result" && (toolName === "listAgents" || toolName === "startAgentRun" || toolName === "controlAgentRun")) {
4220
+ return formatOrchestrationCardBlock(event, toolName, colorEnabled, { safe: true });
4221
+ }
4222
+ if (event.type === "tool-result" && toolName === "loadSkill") {
4223
+ return formatLoadSkillBlock(event, colorEnabled, { safe: true }) ?? "";
4224
+ }
4225
+ const label = toolLabel(toolName);
4226
+ if (readActionGate(event.metadata?.actionGate)) {
4227
+ return formatToolTraceLine(`\u25B8 ${label} ! ${t("toolNeedsAction")}`, colorEnabled, "error");
4228
+ }
4229
+ if (event.type === "tool-error") {
4230
+ return formatToolTraceLine(`\u25B8 ${label} \u2717 ${t("toolFailed")}`, colorEnabled, "error");
4231
+ }
4232
+ if (event.metadata?.timedOut) {
4233
+ return formatToolTraceLine(`\u25B8 ${label} \u2717 ${t("toolTimedOut")}`, colorEnabled, "error");
4234
+ }
4235
+ if (isFailedToolResult(event)) {
4236
+ return formatToolTraceLine(`\u25B8 ${label} \u2717 ${t("toolFailed")}`, colorEnabled, "error");
4237
+ }
4238
+ return formatToolTraceLine(`\u25B8 ${label} \u2713`, colorEnabled);
4239
+ }
4163
4240
  function isReadToolName(name) {
4164
4241
  if (!name) return false;
4165
4242
  return name === "read" || name === "readFile" || name === "read_file" || name === "readWorkspaceFile";
@@ -4346,6 +4423,26 @@ function formatTodoListForCli(event, colorEnabled) {
4346
4423
  const text = [`\u2611 Todo (${todos.length})`, ...lines].join("\n") + "\n";
4347
4424
  return colorEnabled ? themeText(text, "chrome") : text;
4348
4425
  }
4426
+ function formatLoadSkillBlock(event, colorEnabled, opts) {
4427
+ if (event.type !== "tool-result" || event.toolName !== "loadSkill") return null;
4428
+ const skillName = resolveLoadSkillName(event);
4429
+ const content = typeof event.content === "string" ? event.content : "";
4430
+ const failed = /^Skill\s+"[^"]*"\s+not found/.test(content) || isFailedToolResult(event);
4431
+ const labelText = t("usedSkillLabel");
4432
+ if (failed) {
4433
+ const message = opts?.safe === true ? t("toolFailed") : clip(content.split("\n")[0] || t("toolFailed"), 96);
4434
+ return formatToolTraceLine(`\u25B8 ${labelText} (${skillName}) \u2717 ${message}`, colorEnabled, "error");
4435
+ }
4436
+ if (!colorEnabled) {
4437
+ return `\u2726 ${labelText}: ${skillName}
4438
+ `;
4439
+ }
4440
+ const star = themeText("\u2726", "success", true);
4441
+ const labelPart = themeText(labelText, "muted", true);
4442
+ const namePart = themeText(skillName, "chrome", true);
4443
+ return `${star} ${labelPart}: ${namePart}
4444
+ `;
4445
+ }
4349
4446
  function formatCompactToolLine(event, pending, colorEnabled) {
4350
4447
  const toolName = event.toolName || pending?.toolName || "tool";
4351
4448
  const todoBlock = formatTodoListForCli(event, colorEnabled);
@@ -4376,25 +4473,8 @@ function formatCompactToolLine(event, pending, colorEnabled) {
4376
4473
  const message = clip(event.message ?? t("toolFailed"), 96);
4377
4474
  return formatToolTraceLine(`\u25B8 ${label} \u2717 ${message}`, colorEnabled, "error");
4378
4475
  }
4379
- if (event.type === "tool-result" && toolName === "loadSkill") {
4380
- const skillName = resolveLoadSkillName(event);
4381
- const content = typeof event.content === "string" ? event.content : "";
4382
- const failed2 = /^Skill\s+"[^"]*"\s+not found/.test(content) || isFailedToolResult(event);
4383
- const labelText = t("usedSkillLabel");
4384
- if (failed2) {
4385
- const message = clip(content.split("\n")[0] || t("toolFailed"), 96);
4386
- return formatToolTraceLine(`\u25B8 ${labelText} (${skillName}) \u2717 ${message}`, colorEnabled, "error");
4387
- }
4388
- if (!colorEnabled) {
4389
- return `\u2726 ${labelText}: ${skillName}
4390
- `;
4391
- }
4392
- const star = themeText("\u2726", "success", true);
4393
- const labelPart = themeText(labelText, "muted", true);
4394
- const namePart = themeText(skillName, "chrome", true);
4395
- return `${star} ${labelPart}: ${namePart}
4396
- `;
4397
- }
4476
+ const loadSkillBlock = formatLoadSkillBlock(event, colorEnabled);
4477
+ if (loadSkillBlock) return loadSkillBlock;
4398
4478
  if (event.type === "tool-result" && (toolName === "listAgents" || toolName === "startAgentRun" || toolName === "controlAgentRun")) {
4399
4479
  return formatOrchestrationCardBlock(event, toolName, colorEnabled);
4400
4480
  }
@@ -4561,6 +4641,18 @@ function createToolEventFormatter(mode, colorEnabled = resolveCliColorEnabled(),
4561
4641
  const formatter = (event) => {
4562
4642
  if (mode === "hide") return "";
4563
4643
  if (mode === "verbose") return formatVerboseToolEvent(event, colorEnabled);
4644
+ if (mode === "normal") {
4645
+ if (event.type === "tool-call") {
4646
+ pending.set(event.toolCallId, {
4647
+ toolName: event.toolName,
4648
+ argumentsPreview: event.argumentsPreview
4649
+ });
4650
+ return "";
4651
+ }
4652
+ const call2 = pending.get(event.toolCallId);
4653
+ pending.delete(event.toolCallId);
4654
+ return formatNormalToolLine(event, call2, colorEnabled);
4655
+ }
4564
4656
  if (event.toolName === "controlAgentRun") {
4565
4657
  if (event.type === "tool-call") {
4566
4658
  pending.set(event.toolCallId, {
@@ -4837,6 +4929,7 @@ ${this.text}
4837
4929
  };
4838
4930
 
4839
4931
  // packages/cli/client/agentRunOutput.ts
4932
+ var IDENTITY_LABEL_SEPARATOR = " > ";
4840
4933
  function formatCompactionSummaryLine(event) {
4841
4934
  if (!event) return "";
4842
4935
  const action = event.reason === "tool_stub" ? "stub \u5DE5\u5177\u8F93\u51FA" : "\u751F\u6210\u5386\u53F2\u6458\u8981";
@@ -4899,6 +4992,15 @@ function createCliTurnOutput(params) {
4899
4992
  let printedAssistantLabel = false;
4900
4993
  let thinkState = createThinkParserState();
4901
4994
  let compactionEvent = null;
4995
+ const assistantLabelManaged = options.output.assistantLabelManaged === true;
4996
+ const writeToolOutput = (chunk) => {
4997
+ if (!chunk) return;
4998
+ if (typeof options.output.writeToolBlock === "function") {
4999
+ options.output.writeToolBlock(chunk);
5000
+ } else {
5001
+ options.output.write(chunk);
5002
+ }
5003
+ };
4902
5004
  const renderWriter = createRenderAwareStreamWriter({
4903
5005
  write: (chunk) => options.output.write(chunk)
4904
5006
  });
@@ -4914,8 +5016,10 @@ function createCliTurnOutput(params) {
4914
5016
  spinner.stop();
4915
5017
  options.activityReporter?.(null);
4916
5018
  if (!printedAssistantLabel) {
4917
- options.output.write(`
4918
- ${options.agentName} > `);
5019
+ if (!assistantLabelManaged) {
5020
+ options.output.write(`
5021
+ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}`);
5022
+ }
4919
5023
  printedAssistantLabel = true;
4920
5024
  }
4921
5025
  streamedAssistantText = true;
@@ -4939,10 +5043,10 @@ ${options.agentName} > `);
4939
5043
  streamedAssistantText = false;
4940
5044
  }
4941
5045
  if (chunk) {
4942
- options.output.write(chunk);
5046
+ writeToolOutput(chunk);
4943
5047
  }
4944
- if (toolDisplayMode === "compact" && event.type === "tool-call") {
4945
- const activeLabel = formatActiveToolLabel(event);
5048
+ if ((toolDisplayMode === "compact" || toolDisplayMode === "pro" || toolDisplayMode === "normal") && event.type === "tool-call") {
5049
+ const activeLabel = toolDisplayMode === "normal" ? formatConservativeActiveToolLabel(event) : formatActiveToolLabel(event);
4946
5050
  spinner.show(activeLabel);
4947
5051
  options.activityReporter?.(activeLabel);
4948
5052
  }
@@ -4962,7 +5066,7 @@ ${options.agentName} > `);
4962
5066
  if (eventMode !== "jsonl" && formatToolEvent.flush) {
4963
5067
  const pendingToolOutput = formatToolEvent.flush();
4964
5068
  if (pendingToolOutput) {
4965
- options.output.write(pendingToolOutput);
5069
+ writeToolOutput(pendingToolOutput);
4966
5070
  }
4967
5071
  }
4968
5072
  writeVisibleAssistantChunk(chunk);
@@ -4990,7 +5094,7 @@ ${options.agentName} > `);
4990
5094
  }
4991
5095
  const pendingToolOutput = formatToolEvent.flush ? formatToolEvent.flush() : "";
4992
5096
  if (pendingToolOutput) {
4993
- options.output.write(pendingToolOutput);
5097
+ writeToolOutput(pendingToolOutput);
4994
5098
  }
4995
5099
  if (streamedAssistantText) {
4996
5100
  renderWriter.flush();
@@ -5000,13 +5104,18 @@ ${options.agentName} > `);
5000
5104
  } else {
5001
5105
  const content = fallbackContent ? formatAssistantResponseForCli(fallbackContent.trim()) : "";
5002
5106
  if (content) {
5003
- options.output.write(`
5004
- ${options.agentName} > ${content}
5005
- `);
5107
+ options.output.write(
5108
+ assistantLabelManaged ? `${content}
5109
+ ` : `
5110
+ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}${content}
5111
+ `
5112
+ );
5006
5113
  } else {
5007
- options.output.write(`
5008
- ${options.agentName} > (no text response)
5009
- `);
5114
+ options.output.write(
5115
+ assistantLabelManaged ? "(no text response)\n" : `
5116
+ ${options.agentName}${IDENTITY_LABEL_SEPARATOR}(no text response)
5117
+ `
5118
+ );
5010
5119
  }
5011
5120
  }
5012
5121
  const compactionLine = formatCompactionSummaryLine(compactionEvent);
@@ -5444,9 +5553,65 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
5444
5553
  // packages/cli/client/agentRun.ts
5445
5554
  import { ulid } from "ulid";
5446
5555
  async function loadRunLocalAgentTurn() {
5447
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-SIQYQGSK.js");
5556
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-A6EF3RUY.js");
5448
5557
  return runLocalAgentTurn;
5449
5558
  }
5559
+ 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();
5560
+ function extractEmbeddedErrorMessage(message) {
5561
+ const match = /"message"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(message);
5562
+ if (!match) return void 0;
5563
+ try {
5564
+ const decoded = JSON.parse(`"${match[1]}"`);
5565
+ if (typeof decoded !== "string" || !decoded.trim()) return void 0;
5566
+ const cleaned = decoded.replace(/[\u0000-\u001f\u007f]/g, "");
5567
+ return cleaned.trim() ? cleaned : void 0;
5568
+ } catch {
5569
+ return void 0;
5570
+ }
5571
+ }
5572
+ function parseEmbeddedBalanceDetails(message) {
5573
+ const jsonStart = message.indexOf('{"error"');
5574
+ if (jsonStart < 0) return void 0;
5575
+ try {
5576
+ let depth = 0;
5577
+ let inString = false;
5578
+ let escaped = false;
5579
+ let jsonEnd = -1;
5580
+ for (let i = jsonStart; i < message.length; i += 1) {
5581
+ const char = message[i];
5582
+ if (inString) {
5583
+ if (escaped) escaped = false;
5584
+ else if (char === "\\") escaped = true;
5585
+ else if (char === '"') inString = false;
5586
+ } else if (char === '"') {
5587
+ inString = true;
5588
+ } else if (char === "{") {
5589
+ depth += 1;
5590
+ } else if (char === "}" && --depth === 0) {
5591
+ jsonEnd = i + 1;
5592
+ break;
5593
+ }
5594
+ }
5595
+ if (jsonEnd < 0) return void 0;
5596
+ const parsed = JSON.parse(message.slice(jsonStart, jsonEnd));
5597
+ if (!parsed || typeof parsed !== "object") return void 0;
5598
+ const error = parsed.error;
5599
+ if (!error || typeof error !== "object") return void 0;
5600
+ const details = error.details;
5601
+ if (!details || typeof details !== "object") return void 0;
5602
+ const requiredBalance = details.requiredBalance;
5603
+ const currentBalance = details.currentBalance;
5604
+ if (typeof requiredBalance !== "number" || typeof currentBalance !== "number") {
5605
+ return void 0;
5606
+ }
5607
+ if (!Number.isFinite(requiredBalance) || !Number.isFinite(currentBalance) || requiredBalance <= 0) {
5608
+ return void 0;
5609
+ }
5610
+ return { required: String(requiredBalance), current: String(currentBalance) };
5611
+ } catch {
5612
+ return void 0;
5613
+ }
5614
+ }
5450
5615
  async function resolveCurrentMachineId(options) {
5451
5616
  return options.currentMachineIdResolver ? options.currentMachineIdResolver(options.env) : detectCurrentMachineId(options.env);
5452
5617
  }
@@ -5677,7 +5842,6 @@ function describeLocalRunFailure(message, rawError) {
5677
5842
  busyDetail = rawError.detail.trim();
5678
5843
  }
5679
5844
  if (/PLATFORM_LLM_BUSY|服务器紧张/.test(message)) {
5680
- const stripDebugNoise = (s) => s.replace(/\s*raw=".*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
5681
5845
  const shown = stripDebugNoise(
5682
5846
  message.replace(/\s*\(PLATFORM_LLM_BUSY\)\s*$/, "")
5683
5847
  );
@@ -5688,7 +5852,18 @@ function describeLocalRunFailure(message, rawError) {
5688
5852
  if (/UPSTREAM_402|Insufficient Balance|余额不足|insufficient\s+balance/i.test(
5689
5853
  message
5690
5854
  )) {
5691
- return `${RUN_UNAVAILABLE_PREFIX} (${message}). ${NO_FALLBACK} Top up your balance, then send again (or say "\u7EE7\u7EED") \u2014 if a dialog was kept, context is preserved.
5855
+ const cleanedMessage = stripDebugNoise(message);
5856
+ const fallback = cleanedMessage.replace(
5857
+ /^[^:]*provider failed: HTTP \d{3}\s*/,
5858
+ ""
5859
+ );
5860
+ const balanceDetails = parseEmbeddedBalanceDetails(cleanedMessage);
5861
+ const shownMessage = balanceDetails ? t(
5862
+ "balanceInsufficientReason",
5863
+ balanceDetails.required,
5864
+ balanceDetails.current
5865
+ ) : extractEmbeddedErrorMessage(cleanedMessage) ?? fallback;
5866
+ return `[nolo] ${shownMessage}
5692
5867
  `;
5693
5868
  }
5694
5869
  const cls = classifyLocalRunError(message);
@@ -6003,6 +6178,7 @@ async function runLocalAgentTurnForCli(options, settings) {
6003
6178
  contextReferenceResolver: (reference) => canResolveCollapsedPasteReference(options.pastedTextStore, reference)
6004
6179
  } : {},
6005
6180
  continueDialogId: currentDialogId,
6181
+ fileWriteSessionId: currentDialogId,
6006
6182
  spaceId: options.spaceId,
6007
6183
  category: options.category,
6008
6184
  inheritedFromDialogKey: options.inheritedFromDialogKey,
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-RPO6WAZV.js";
8
+ } from "./chunk-HCMFFI2G.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-4YAMAMNA.js";
15
+ } from "./chunk-HPZL4IBN.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,22 +23,22 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-72COHDZR.js";
26
+ } from "./chunk-WKOEOQCI.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
30
30
  import {
31
31
  getCurrentSpaceId
32
- } from "./chunk-7M72YPM2.js";
32
+ } from "./chunk-6SMMK7MD.js";
33
33
  import {
34
34
  addToolMessage,
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-MCX2LX27.js";
38
+ } from "./chunk-EURF2SV6.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-5JXRVJAC.js";
41
+ } from "./chunk-WX5E6HZS.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
@@ -56,10 +56,10 @@ import {
56
56
  import {
57
57
  EMPTY_ASSISTANT_REPAIR_PROMPT,
58
58
  getModelInfo
59
- } from "./chunk-F22JQTSX.js";
59
+ } from "./chunk-SW7RCUGA.js";
60
60
  import {
61
61
  getApiEndpoint
62
- } from "./chunk-BO3YFOZR.js";
62
+ } from "./chunk-QDHZCAH3.js";
63
63
  import {
64
64
  toErrorMessage
65
65
  } from "./chunk-HNMXYYJR.js";