@qwen-code/qwen-code 0.18.1 → 0.18.2

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 (74) hide show
  1. package/README.md +2 -1
  2. package/bundled/qc-helper/docs/common-workflow.md +4 -4
  3. package/bundled/qc-helper/docs/configuration/model-providers.md +1 -1
  4. package/bundled/qc-helper/docs/configuration/settings.md +77 -77
  5. package/bundled/qc-helper/docs/features/channels/feishu.md +16 -0
  6. package/bundled/qc-helper/docs/features/mcp.md +1 -1
  7. package/bundled/qc-helper/docs/features/sub-agents.md +3 -3
  8. package/bundled/qc-helper/docs/qwen-serve.md +24 -12
  9. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
  10. package/bundled/review/SKILL.md +10 -4
  11. package/bundled/simplify/SKILL.md +1 -1
  12. package/chunks/{agent-XT7NHZ5H.js → agent-P5U6QLWL.js} +5 -5
  13. package/chunks/{agent-headless-LNRE63ZL.js → agent-headless-24356DC7.js} +5 -5
  14. package/chunks/{anthropicContentGenerator-DCI26OQF.js → anthropicContentGenerator-KLBHYGH6.js} +1 -1
  15. package/chunks/{askUserQuestion-ITYUTWLR.js → askUserQuestion-QPZXR3UO.js} +1 -1
  16. package/chunks/{chunk-RON7LFNH.js → chunk-25FFAMED.js} +6 -6
  17. package/chunks/{chunk-7KPZFE5A.js → chunk-C64WAJOC.js} +1 -1
  18. package/chunks/{chunk-6T7Y7USE.js → chunk-EQ5NHJBY.js} +1354 -1028
  19. package/chunks/{chunk-IS7UA4W3.js → chunk-JZEKEWO5.js} +4 -4
  20. package/chunks/{chunk-XZTNBSMW.js → chunk-M7OBURJM.js} +1 -1
  21. package/chunks/{chunk-3NRO6NHX.js → chunk-MN5RAXVB.js} +3 -3
  22. package/chunks/{chunk-WJ3SND6W.js → chunk-NGDXHX3A.js} +2 -2
  23. package/chunks/{chunk-BXYRCW2C.js → chunk-QFJ67S5R.js} +10 -5
  24. package/chunks/{chunk-Y7KMDUEP.js → chunk-QP4R5FTG.js} +1 -1
  25. package/chunks/{chunk-QILTEBWS.js → chunk-RTTAC5VW.js} +1 -1
  26. package/chunks/{chunk-HQUWWSSP.js → chunk-VIEIRAK3.js} +1 -1
  27. package/chunks/{chunk-HED55F43.js → chunk-VU6A2OBJ.js} +15 -5
  28. package/chunks/{chunk-DHZREJTG.js → chunk-YJDVHAGL.js} +1 -1
  29. package/chunks/{chunk-A2ZIEEGJ.js → chunk-ZNUMXPNK.js} +592 -43
  30. package/chunks/{computer-use-4YX3JGBV.js → computer-use-EGW2I2HZ.js} +5 -5
  31. package/chunks/{contextCommand-KS2H7MW5.js → contextCommand-HI2X2Y7I.js} +7 -7
  32. package/chunks/{cron-create-CAPUKK7I.js → cron-create-DQKRQMCP.js} +1 -1
  33. package/chunks/{cron-delete-G3KAR26Q.js → cron-delete-DOFPHFTI.js} +1 -1
  34. package/chunks/{cron-list-ZA4ZIUS5.js → cron-list-RCVOO3CB.js} +1 -1
  35. package/chunks/{dist-VEGFONCF.js → dist-2UCAYOX7.js} +2 -2
  36. package/chunks/{dist-X4EXN7W6.js → dist-33LHH26D.js} +1 -1
  37. package/chunks/{dist-YLS6NI7H.js → dist-KF43SZZV.js} +1 -1
  38. package/chunks/{dist-7YWFWOCJ.js → dist-UH7CYT7F.js} +2 -2
  39. package/chunks/{edit-2ARPEO4B.js → edit-FJSOCDO2.js} +7 -9
  40. package/chunks/{enter-worktree-IXNXNAW5.js → enter-worktree-X6MVFDLR.js} +5 -5
  41. package/chunks/{enterPlanMode-TAKAGAYP.js → enterPlanMode-MZAEQZH3.js} +5 -5
  42. package/chunks/{exit-worktree-LHTRV7ML.js → exit-worktree-RM2UPOYQ.js} +5 -5
  43. package/chunks/{exitPlanMode-MK5UAITL.js → exitPlanMode-7BVY3CWJ.js} +7 -6
  44. package/chunks/{geminiContentGenerator-HFJIGO77.js → geminiContentGenerator-A6JHLUHK.js} +1 -1
  45. package/chunks/{glob-I2USLUSC.js → glob-L3AZLCV6.js} +5 -5
  46. package/chunks/{grep-WBIF7THR.js → grep-SNCPCXIP.js} +5 -5
  47. package/chunks/{ls-2R5RHLX5.js → ls-TRD77UTS.js} +1 -1
  48. package/chunks/{lsp-XKH6ZIAN.js → lsp-2VFWQPZS.js} +1 -1
  49. package/chunks/{monitor-WU7UFATU.js → monitor-TS6WL6DN.js} +5 -5
  50. package/chunks/{notebook-edit-KUHYPXEM.js → notebook-edit-26RNH24J.js} +6 -6
  51. package/chunks/{openaiContentGenerator-5PLHYJQL.js → openaiContentGenerator-7CA63X5G.js} +5 -5
  52. package/chunks/{qwenContentGenerator-TSKW73KY.js → qwenContentGenerator-4WJTJXFZ.js} +7 -7
  53. package/chunks/{read-file-VIPF2PS6.js → read-file-EUIHK6HD.js} +3 -3
  54. package/chunks/{ripGrep-XLIZTYE7.js → ripGrep-7J5B22W2.js} +5 -5
  55. package/chunks/{scheduler-O66SLJGU.js → scheduler-J3OUGTTS.js} +5 -5
  56. package/chunks/{send-message-CTME7DXD.js → send-message-QZOC5GA2.js} +1 -1
  57. package/chunks/{serve-BWOLYT62.js → serve-VF4ZNUJP.js} +709 -26
  58. package/chunks/{shell-XE7UYKOO.js → shell-G6XCJAG3.js} +5 -5
  59. package/chunks/{skill-RZWM6XMC.js → skill-7OVC6JIH.js} +3 -3
  60. package/chunks/{src-L5P7K4MH.js → src-XV5MLRND.js} +11 -5
  61. package/chunks/{syntheticOutput-ZJGSU7OQ.js → syntheticOutput-WJSUK4SZ.js} +2 -2
  62. package/chunks/{task-create-EE6JEM7G.js → task-create-GGSC27HO.js} +2 -2
  63. package/chunks/{task-list-EESYAC65.js → task-list-EDHHHSK4.js} +1 -1
  64. package/chunks/{task-stop-XZVCFFYY.js → task-stop-WR5PDVZY.js} +1 -1
  65. package/chunks/{task-update-EIO4HNE3.js → task-update-UR7NUHBV.js} +2 -2
  66. package/chunks/{team-create-R2H7Y3SG.js → team-create-JXSC7ROC.js} +5 -5
  67. package/chunks/{team-delete-A7LXPGV7.js → team-delete-FC33URJK.js} +1 -1
  68. package/chunks/{todoWrite-VRKSGAWM.js → todoWrite-GO2ME7ZV.js} +1 -1
  69. package/chunks/{tool-search-USSQMTMS.js → tool-search-YRWSWA2H.js} +3 -3
  70. package/chunks/{web-fetch-GHAZUA54.js → web-fetch-NLLATYIL.js} +2 -2
  71. package/chunks/{workflow-5LNNLNUR.js → workflow-ZN3DYFMU.js} +249 -24
  72. package/chunks/{write-file-2I7HP24C.js → write-file-355M4V7Z.js} +6 -6
  73. package/cli.js +1092 -491
  74. package/package.json +2 -2
package/cli.js CHANGED
@@ -7,13 +7,13 @@ import {
7
7
  clearAccount,
8
8
  loadAccount,
9
9
  saveAccount
10
- } from "./chunks/chunk-Y7KMDUEP.js";
10
+ } from "./chunks/chunk-QP4R5FTG.js";
11
11
  import {
12
12
  AcpBridge,
13
13
  PairingStore,
14
14
  SessionRouter,
15
15
  resolvePath
16
- } from "./chunks/chunk-HED55F43.js";
16
+ } from "./chunks/chunk-VU6A2OBJ.js";
17
17
  import {
18
18
  ACP_PREFLIGHT_KINDS,
19
19
  CORRUPTED_SUFFIX,
@@ -23,6 +23,7 @@ import {
23
23
  ENV_CORRUPTED_PATH,
24
24
  ENV_WAS_RECOVERED,
25
25
  IDLE_HOOK_EVENTS,
26
+ MID_TURN_QUEUE_DRAIN_METHOD,
26
27
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
27
28
  OUTPUT_LANGUAGE_AUTO,
28
29
  SERVE_CONTROL_EXT_METHODS,
@@ -91,7 +92,7 @@ import {
91
92
  updateOutputLanguageFile,
92
93
  validateCustomTheme,
93
94
  writeOutputLanguageAndRegisterPath
94
- } from "./chunks/chunk-BXYRCW2C.js";
95
+ } from "./chunks/chunk-QFJ67S5R.js";
95
96
  import {
96
97
  AgentSideConnection,
97
98
  PROTOCOL_VERSION,
@@ -104,7 +105,7 @@ import {
104
105
  formatContextUsageText,
105
106
  isTerminalGoalStatusKind,
106
107
  require_react
107
- } from "./chunks/chunk-IS7UA4W3.js";
108
+ } from "./chunks/chunk-JZEKEWO5.js";
108
109
  import {
109
110
  SUPPORTED_LANGUAGES,
110
111
  clearScreen,
@@ -117,7 +118,7 @@ import {
117
118
  ta,
118
119
  writeStderrLine,
119
120
  writeStdoutLine
120
- } from "./chunks/chunk-XZTNBSMW.js";
121
+ } from "./chunks/chunk-M7OBURJM.js";
121
122
  import {
122
123
  noteInteraction
123
124
  } from "./chunks/chunk-MRO43B25.js";
@@ -137,6 +138,7 @@ import {
137
138
  DISPLAY_MODE,
138
139
  EXTENSIONS_CONFIG_FILENAME,
139
140
  ExtensionManager,
141
+ FORK_SUBAGENT_TYPE,
140
142
  FileDiscoveryService,
141
143
  FileSearchFactory,
142
144
  GitWorktreeService,
@@ -340,13 +342,13 @@ import {
340
342
  writeRuntimeStatus,
341
343
  writeWorktreeSession,
342
344
  writeWorktreeSessionMarker
343
- } from "./chunks/chunk-6T7Y7USE.js";
345
+ } from "./chunks/chunk-EQ5NHJBY.js";
344
346
  import {
345
347
  external_exports
346
348
  } from "./chunks/chunk-K5PGHDBN.js";
347
349
  import {
348
350
  runSideQuery
349
- } from "./chunks/chunk-HQUWWSSP.js";
351
+ } from "./chunks/chunk-VIEIRAK3.js";
350
352
  import "./chunks/chunk-O4PICXES.js";
351
353
  import "./chunks/chunk-TW522KN6.js";
352
354
  import "./chunks/chunk-BJ5HQ23U.js";
@@ -416,7 +418,7 @@ import {
416
418
  stripRuntimeSnapshotPrefix,
417
419
  uiTelemetryService,
418
420
  withInteractionSpan
419
- } from "./chunks/chunk-RON7LFNH.js";
421
+ } from "./chunks/chunk-25FFAMED.js";
420
422
  import "./chunks/chunk-3PJXIDKI.js";
421
423
  import "./chunks/chunk-UWCTAVOD.js";
422
424
  import {
@@ -430,13 +432,13 @@ import {
430
432
  isAnyAutoMemPath
431
433
  } from "./chunks/chunk-IQHSD7K5.js";
432
434
  import "./chunks/chunk-LYRSMKLS.js";
433
- import "./chunks/chunk-QILTEBWS.js";
435
+ import "./chunks/chunk-RTTAC5VW.js";
434
436
  import {
435
437
  SchemaValidator,
436
438
  ToolConfirmationOutcome,
437
439
  ToolDisplayNames,
438
440
  ToolNames
439
- } from "./chunks/chunk-A2ZIEEGJ.js";
441
+ } from "./chunks/chunk-ZNUMXPNK.js";
440
442
  import {
441
443
  clearCachedCredentialFile,
442
444
  openBrowserSecurely,
@@ -11232,7 +11234,7 @@ var require_supports_color = __commonJS({
11232
11234
  "node_modules/chalk/node_modules/supports-color/index.js"(exports, module) {
11233
11235
  "use strict";
11234
11236
  init_esbuild_shims();
11235
- var os33 = __require("os");
11237
+ var os32 = __require("os");
11236
11238
  var tty4 = __require("tty");
11237
11239
  var hasFlag3 = require_has_flag();
11238
11240
  var { env: env5 } = process;
@@ -11281,7 +11283,7 @@ var require_supports_color = __commonJS({
11281
11283
  return min;
11282
11284
  }
11283
11285
  if (process.platform === "win32") {
11284
- const osRelease = os33.release().split(".");
11286
+ const osRelease = os32.release().split(".");
11285
11287
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
11286
11288
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
11287
11289
  }
@@ -32580,7 +32582,7 @@ var require_supports_color2 = __commonJS({
32580
32582
  "node_modules/ink-link/node_modules/supports-color/index.js"(exports, module) {
32581
32583
  "use strict";
32582
32584
  init_esbuild_shims();
32583
- var os33 = __require("os");
32585
+ var os32 = __require("os");
32584
32586
  var tty4 = __require("tty");
32585
32587
  var hasFlag3 = require_has_flag();
32586
32588
  var { env: env5 } = process;
@@ -32629,7 +32631,7 @@ var require_supports_color2 = __commonJS({
32629
32631
  return min;
32630
32632
  }
32631
32633
  if (process.platform === "win32") {
32632
- const osRelease = os33.release().split(".");
32634
+ const osRelease = os32.release().split(".");
32633
32635
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
32634
32636
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
32635
32637
  }
@@ -36808,9 +36810,9 @@ var require_defaults = __commonJS({
36808
36810
  "node_modules/@pnpm/npm-conf/lib/defaults.js"(exports) {
36809
36811
  "use strict";
36810
36812
  init_esbuild_shims();
36811
- var os33 = __require("os");
36813
+ var os32 = __require("os");
36812
36814
  var path60 = __require("path");
36813
- var temp = os33.tmpdir();
36815
+ var temp = os32.tmpdir();
36814
36816
  var uidOrPid = process.getuid ? process.getuid() : process.pid;
36815
36817
  var hasUnicode = /* @__PURE__ */ __name(() => true, "hasUnicode");
36816
36818
  var isWindows4 = process.platform === "win32";
@@ -36821,7 +36823,7 @@ var require_defaults = __commonJS({
36821
36823
  var umask = {
36822
36824
  fromString: /* @__PURE__ */ __name(() => process.umask(), "fromString")
36823
36825
  };
36824
- var home = os33.homedir();
36826
+ var home = os32.homedir();
36825
36827
  if (home) {
36826
36828
  process.env.HOME = home;
36827
36829
  } else {
@@ -49241,7 +49243,7 @@ var measure_element_default = measureElement;
49241
49243
  // packages/cli/src/gemini.tsx
49242
49244
  var import_react233 = __toESM(require_react(), 1);
49243
49245
  import dns from "node:dns";
49244
- import os32 from "node:os";
49246
+ import os31 from "node:os";
49245
49247
  import path59, { basename as basename13 } from "node:path";
49246
49248
  import v83 from "node:v8";
49247
49249
 
@@ -56776,10 +56778,10 @@ function ensureBuiltins() {
56776
56778
  if (!builtinsPromise) {
56777
56779
  builtinsPromise = (async () => {
56778
56780
  const [telegram, weixin, dingtalk, feishu] = await Promise.all([
56779
- import("./chunks/dist-YLS6NI7H.js"),
56780
- import("./chunks/dist-VEGFONCF.js"),
56781
- import("./chunks/dist-7YWFWOCJ.js"),
56782
- import("./chunks/dist-X4EXN7W6.js")
56781
+ import("./chunks/dist-KF43SZZV.js"),
56782
+ import("./chunks/dist-2UCAYOX7.js"),
56783
+ import("./chunks/dist-UH7CYT7F.js"),
56784
+ import("./chunks/dist-33LHH26D.js")
56783
56785
  ]);
56784
56786
  for (const mod of [telegram, weixin, dingtalk, feishu]) {
56785
56787
  registry.set(mod.plugin.channelType, mod.plugin);
@@ -59187,7 +59189,7 @@ var serveCommand = {
59187
59189
  process.exit(1);
59188
59190
  }
59189
59191
  }
59190
- const { runQwenServe } = await import("./chunks/serve-BWOLYT62.js");
59192
+ const { runQwenServe } = await import("./chunks/serve-VF4ZNUJP.js");
59191
59193
  try {
59192
59194
  await runQwenServe({
59193
59195
  port: argv.port,
@@ -59226,6 +59228,432 @@ var serveCommand = {
59226
59228
  }, "handler")
59227
59229
  };
59228
59230
 
59231
+ // packages/cli/src/commands/sessions.ts
59232
+ init_esbuild_shims();
59233
+
59234
+ // packages/cli/src/commands/sessions/list.ts
59235
+ init_esbuild_shims();
59236
+
59237
+ // packages/cli/node_modules/string-width/index.js
59238
+ init_esbuild_shims();
59239
+ var import_emoji_regex = __toESM(require_emoji_regex(), 1);
59240
+ var segmenter4 = new Intl.Segmenter();
59241
+ var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
59242
+ function stringWidth2(string, options = {}) {
59243
+ if (typeof string !== "string" || string.length === 0) {
59244
+ return 0;
59245
+ }
59246
+ const {
59247
+ ambiguousIsNarrow = true,
59248
+ countAnsiEscapeCodes = false
59249
+ } = options;
59250
+ if (!countAnsiEscapeCodes) {
59251
+ string = stripAnsi(string);
59252
+ }
59253
+ if (string.length === 0) {
59254
+ return 0;
59255
+ }
59256
+ let width = 0;
59257
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
59258
+ for (const { segment: character } of segmenter4.segment(string)) {
59259
+ const codePoint = character.codePointAt(0);
59260
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
59261
+ continue;
59262
+ }
59263
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
59264
+ continue;
59265
+ }
59266
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
59267
+ continue;
59268
+ }
59269
+ if (codePoint >= 55296 && codePoint <= 57343) {
59270
+ continue;
59271
+ }
59272
+ if (codePoint >= 65024 && codePoint <= 65039) {
59273
+ continue;
59274
+ }
59275
+ if (defaultIgnorableCodePointRegex.test(character)) {
59276
+ continue;
59277
+ }
59278
+ if ((0, import_emoji_regex.default)().test(character)) {
59279
+ width += 2;
59280
+ continue;
59281
+ }
59282
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
59283
+ }
59284
+ return width;
59285
+ }
59286
+ __name(stringWidth2, "stringWidth");
59287
+
59288
+ // packages/cli/src/ui/utils/textUtils.ts
59289
+ init_esbuild_shims();
59290
+ init_ansi_regex();
59291
+ import { stripVTControlCharacters } from "node:util";
59292
+ var getAsciiArtWidth = /* @__PURE__ */ __name((asciiArt) => {
59293
+ if (!asciiArt) {
59294
+ return 0;
59295
+ }
59296
+ const lines = asciiArt.split("\n");
59297
+ return Math.max(...lines.map((line) => getCachedStringWidth(line)));
59298
+ }, "getAsciiArtWidth");
59299
+ var codePointsCache = /* @__PURE__ */ new Map();
59300
+ var MAX_STRING_LENGTH_TO_CACHE = 1e3;
59301
+ function toCodePoints(str) {
59302
+ let isAscii = true;
59303
+ for (let i = 0; i < str.length; i++) {
59304
+ if (str.charCodeAt(i) > 127) {
59305
+ isAscii = false;
59306
+ break;
59307
+ }
59308
+ }
59309
+ if (isAscii) {
59310
+ return str.split("");
59311
+ }
59312
+ if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
59313
+ const cached = codePointsCache.get(str);
59314
+ if (cached) {
59315
+ return cached;
59316
+ }
59317
+ }
59318
+ const result = Array.from(str);
59319
+ if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
59320
+ codePointsCache.set(str, result);
59321
+ }
59322
+ return result;
59323
+ }
59324
+ __name(toCodePoints, "toCodePoints");
59325
+ function cpLen(str) {
59326
+ return toCodePoints(str).length;
59327
+ }
59328
+ __name(cpLen, "cpLen");
59329
+ function cpSlice(str, start, end) {
59330
+ const arr = toCodePoints(str).slice(start, end);
59331
+ return arr.join("");
59332
+ }
59333
+ __name(cpSlice, "cpSlice");
59334
+ function stripUnsafeCharacters(str) {
59335
+ const strippedAnsi = stripAnsi(str);
59336
+ const strippedVT = stripVTControlCharacters(strippedAnsi);
59337
+ return toCodePoints(strippedVT).filter((char) => {
59338
+ const code = char.codePointAt(0);
59339
+ if (code === void 0) return false;
59340
+ if (code === 9 || code === 10 || code === 13) return true;
59341
+ if (code >= 0 && code <= 31) return false;
59342
+ if (code >= 128 && code <= 159) return false;
59343
+ return true;
59344
+ }).join("");
59345
+ }
59346
+ __name(stripUnsafeCharacters, "stripUnsafeCharacters");
59347
+ var stringWidthCache = /* @__PURE__ */ new Map();
59348
+ var getCachedStringWidth = /* @__PURE__ */ __name((str) => {
59349
+ if (/^[\x20-\x7E]*$/.test(str)) {
59350
+ return str.length;
59351
+ }
59352
+ if (stringWidthCache.has(str)) {
59353
+ return stringWidthCache.get(str);
59354
+ }
59355
+ const width = stringWidth2(str);
59356
+ stringWidthCache.set(str, width);
59357
+ return width;
59358
+ }, "getCachedStringWidth");
59359
+ var regex = ansiRegex();
59360
+ function escapeAnsiCtrlCodes(obj) {
59361
+ if (typeof obj === "string") {
59362
+ if (obj.search(regex) === -1) {
59363
+ return obj;
59364
+ }
59365
+ regex.lastIndex = 0;
59366
+ return obj.replace(
59367
+ regex,
59368
+ (match) => JSON.stringify(match).slice(1, -1)
59369
+ );
59370
+ }
59371
+ if (obj === null || typeof obj !== "object") {
59372
+ return obj;
59373
+ }
59374
+ if (Array.isArray(obj)) {
59375
+ let newArr = null;
59376
+ for (let i = 0; i < obj.length; i++) {
59377
+ const value = obj[i];
59378
+ const escapedValue = escapeAnsiCtrlCodes(value);
59379
+ if (escapedValue !== value) {
59380
+ if (newArr === null) {
59381
+ newArr = [...obj];
59382
+ }
59383
+ newArr[i] = escapedValue;
59384
+ }
59385
+ }
59386
+ return newArr !== null ? newArr : obj;
59387
+ }
59388
+ let newObj = null;
59389
+ const keys = Object.keys(obj);
59390
+ for (const key of keys) {
59391
+ const value = obj[key];
59392
+ const escapedValue = escapeAnsiCtrlCodes(value);
59393
+ if (escapedValue !== value) {
59394
+ if (newObj === null) {
59395
+ newObj = { ...obj };
59396
+ }
59397
+ newObj[key] = escapedValue;
59398
+ }
59399
+ }
59400
+ return newObj !== null ? newObj : obj;
59401
+ }
59402
+ __name(escapeAnsiCtrlCodes, "escapeAnsiCtrlCodes");
59403
+ var SENSITIVE_PATTERNS = [
59404
+ // API keys with common prefixes
59405
+ {
59406
+ pattern: /(sk-[a-zA-Z0-9]{20,})/g,
59407
+ replacement: "sk-***REDACTED***"
59408
+ },
59409
+ {
59410
+ pattern: /(api[_-]?key[_-]?[=:]\s*)[a-zA-Z0-9_-]{20,}/gi,
59411
+ replacement: "$1***REDACTED***"
59412
+ },
59413
+ // Bearer tokens
59414
+ {
59415
+ pattern: /(Bearer\s+)[a-zA-Z0-9._-]+/gi,
59416
+ replacement: "$1***REDACTED***"
59417
+ },
59418
+ // Generic tokens
59419
+ {
59420
+ pattern: /(token[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
59421
+ replacement: "$1***REDACTED***"
59422
+ },
59423
+ // Passwords in connection strings or assignments
59424
+ {
59425
+ pattern: /(password[_-]?[=:]\s*)[^\s]+/gi,
59426
+ replacement: "$1***REDACTED***"
59427
+ },
59428
+ {
59429
+ pattern: /(pwd[_-]?[=:]\s*)[^\s]+/gi,
59430
+ replacement: "$1***REDACTED***"
59431
+ },
59432
+ // AWS keys
59433
+ {
59434
+ pattern: /(AKIA[A-Z0-9]{16})/g,
59435
+ replacement: "***REDACTED***"
59436
+ },
59437
+ // Generic secret patterns
59438
+ {
59439
+ pattern: /(secret[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
59440
+ replacement: "$1***REDACTED***"
59441
+ }
59442
+ ];
59443
+ function sanitizeSensitiveText(text, maxLength = 200) {
59444
+ let result = text;
59445
+ for (const { pattern, replacement } of SENSITIVE_PATTERNS) {
59446
+ result = result.replace(pattern, replacement);
59447
+ }
59448
+ if (result.length > maxLength) {
59449
+ if (maxLength <= 3) {
59450
+ return result.slice(0, maxLength);
59451
+ }
59452
+ return result.slice(0, maxLength - 3) + "...";
59453
+ }
59454
+ return result;
59455
+ }
59456
+ __name(sanitizeSensitiveText, "sanitizeSensitiveText");
59457
+ var FILENAME_CONTROL_CHARS_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
59458
+ function escapeFilenameControlChar(ch) {
59459
+ switch (ch) {
59460
+ case "\b":
59461
+ return "\\b";
59462
+ case " ":
59463
+ return "\\t";
59464
+ case "\n":
59465
+ return "\\n";
59466
+ case "\f":
59467
+ return "\\f";
59468
+ case "\r":
59469
+ return "\\r";
59470
+ default: {
59471
+ const code = ch.charCodeAt(0);
59472
+ return `\\u${code.toString(16).padStart(4, "0")}`;
59473
+ }
59474
+ }
59475
+ }
59476
+ __name(escapeFilenameControlChar, "escapeFilenameControlChar");
59477
+ function sanitizeFilenameForDisplay(name) {
59478
+ return escapeAnsiCtrlCodes(name).replace(
59479
+ FILENAME_CONTROL_CHARS_REGEX,
59480
+ escapeFilenameControlChar
59481
+ );
59482
+ }
59483
+ __name(sanitizeFilenameForDisplay, "sanitizeFilenameForDisplay");
59484
+
59485
+ // packages/cli/src/commands/sessions/common.ts
59486
+ init_esbuild_shims();
59487
+ function initSessionService() {
59488
+ const settings = loadSettings();
59489
+ Storage.setRuntimeBaseDir(
59490
+ settings.merged.advanced?.runtimeOutputDir,
59491
+ process.cwd()
59492
+ );
59493
+ return new SessionService(process.cwd());
59494
+ }
59495
+ __name(initSessionService, "initSessionService");
59496
+
59497
+ // packages/cli/src/commands/sessions/list.ts
59498
+ var SESSION_COL = 38;
59499
+ var TIME_COL = 16;
59500
+ var TITLE_COL = 24;
59501
+ var BRANCH_COL = 12;
59502
+ function formatTime(iso) {
59503
+ const d = new Date(iso);
59504
+ if (isNaN(d.getTime())) return iso;
59505
+ const pad2 = /* @__PURE__ */ __name((n) => String(n).padStart(2, "0"), "pad");
59506
+ return `${d.getUTCFullYear()}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())} ${pad2(d.getUTCHours())}:${pad2(d.getUTCMinutes())}`;
59507
+ }
59508
+ __name(formatTime, "formatTime");
59509
+ function sanitize(value) {
59510
+ const stripped = value.replace(/[\r\n\t]/g, "");
59511
+ const escaped = escapeAnsiCtrlCodes(stripped);
59512
+ return escaped.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, "");
59513
+ }
59514
+ __name(sanitize, "sanitize");
59515
+ function padDisplay(str, width) {
59516
+ const currentWidth = stringWidth2(str);
59517
+ if (currentWidth >= width) return str;
59518
+ return str + " ".repeat(width - currentWidth);
59519
+ }
59520
+ __name(padDisplay, "padDisplay");
59521
+ function truncate(str, maxLen) {
59522
+ const width = stringWidth2(str);
59523
+ if (width <= maxLen) return str;
59524
+ const suffix = maxLen > 3 ? "..." : "";
59525
+ const target = maxLen - stringWidth2(suffix);
59526
+ let result = "";
59527
+ let w = 0;
59528
+ for (const char of str) {
59529
+ w += stringWidth2(char);
59530
+ if (w > target) break;
59531
+ result += char;
59532
+ }
59533
+ return result + suffix;
59534
+ }
59535
+ __name(truncate, "truncate");
59536
+ function outputHuman(items) {
59537
+ if (items.length === 0) {
59538
+ writeStdoutLine("No sessions found.");
59539
+ return;
59540
+ }
59541
+ const termWidth = process.stdout.columns ?? 80;
59542
+ const PROMPT_COL = Math.max(
59543
+ 20,
59544
+ termWidth - SESSION_COL - TIME_COL - TITLE_COL - BRANCH_COL - 4
59545
+ );
59546
+ const header = padDisplay("SESSION ID", SESSION_COL) + " " + padDisplay("STARTED", TIME_COL) + " " + padDisplay("TITLE", TITLE_COL) + " " + padDisplay("BRANCH", BRANCH_COL) + " PROMPT";
59547
+ writeStdoutLine(header);
59548
+ for (const item of items) {
59549
+ const sessionId = truncate(
59550
+ sanitize(String(item.sessionId ?? "")),
59551
+ SESSION_COL
59552
+ );
59553
+ const time = truncate(sanitize(formatTime(item.startTime)), TIME_COL);
59554
+ const sanitizedPrompt = sanitize(item.prompt ?? "");
59555
+ const title = truncate(
59556
+ item.customTitle != null ? sanitize(item.customTitle) : sanitizedPrompt,
59557
+ TITLE_COL
59558
+ );
59559
+ const branch = truncate(
59560
+ item.gitBranch != null ? sanitize(item.gitBranch) : "-",
59561
+ BRANCH_COL
59562
+ );
59563
+ const prompt = truncate(sanitizedPrompt, PROMPT_COL);
59564
+ writeStdoutLine(
59565
+ `${padDisplay(sessionId, SESSION_COL)} ${padDisplay(time, TIME_COL)} ${padDisplay(title, TITLE_COL)} ${padDisplay(branch, BRANCH_COL)} ${prompt}`
59566
+ );
59567
+ }
59568
+ }
59569
+ __name(outputHuman, "outputHuman");
59570
+ function toJsonItem(item) {
59571
+ return {
59572
+ sessionId: item.sessionId,
59573
+ startTime: item.startTime,
59574
+ mtime: item.mtime,
59575
+ prompt: item.prompt,
59576
+ gitBranch: item.gitBranch ?? null,
59577
+ customTitle: item.customTitle ?? null,
59578
+ titleSource: item.titleSource ?? null,
59579
+ filePath: item.filePath,
59580
+ cwd: item.cwd
59581
+ };
59582
+ }
59583
+ __name(toJsonItem, "toJsonItem");
59584
+ function formatError2(err) {
59585
+ return err instanceof Error ? err.message : String(err);
59586
+ }
59587
+ __name(formatError2, "formatError");
59588
+ async function handleList2(argv) {
59589
+ let svc;
59590
+ try {
59591
+ svc = initSessionService();
59592
+ } catch (err) {
59593
+ writeStderrLine(
59594
+ `Error: failed to initialize session service: ${formatError2(err)}`
59595
+ );
59596
+ process.exit(1);
59597
+ return;
59598
+ }
59599
+ let result;
59600
+ try {
59601
+ result = await svc.listSessions({
59602
+ size: argv.limit ?? 20
59603
+ });
59604
+ } catch (err) {
59605
+ writeStderrLine(`Error: failed to list sessions: ${formatError2(err)}`);
59606
+ process.exit(1);
59607
+ return;
59608
+ }
59609
+ if (argv.json) {
59610
+ for (const item of result.items) {
59611
+ writeStdoutLine(JSON.stringify(toJsonItem(item)));
59612
+ }
59613
+ if (result.items.length > 0 && result.hasMore) {
59614
+ writeStderrLine(
59615
+ `Note: ${result.items.length} sessions shown, more available. Use --limit to show more.`
59616
+ );
59617
+ }
59618
+ } else {
59619
+ outputHuman(result.items);
59620
+ if (result.items.length > 0 && result.hasMore) {
59621
+ writeStdoutLine(
59622
+ `Showing ${result.items.length} sessions. Use --limit to show more.`
59623
+ );
59624
+ }
59625
+ }
59626
+ }
59627
+ __name(handleList2, "handleList");
59628
+ var listCommand4 = {
59629
+ command: "list",
59630
+ describe: "List sessions",
59631
+ builder: /* @__PURE__ */ __name((yargs) => yargs.option("json", {
59632
+ type: "boolean",
59633
+ describe: "Output as JSON Lines",
59634
+ default: false
59635
+ }).option("limit", {
59636
+ type: "number",
59637
+ describe: "Maximum number of sessions to show",
59638
+ default: 20,
59639
+ coerce: /* @__PURE__ */ __name((v) => Number.isInteger(v) && v > 0 ? v : 20, "coerce")
59640
+ }), "builder"),
59641
+ handler: /* @__PURE__ */ __name(async (argv) => {
59642
+ await handleList2(argv);
59643
+ }, "handler")
59644
+ };
59645
+
59646
+ // packages/cli/src/commands/sessions.ts
59647
+ var sessionsCommand = {
59648
+ command: "sessions",
59649
+ describe: "Manage Qwen Code sessions",
59650
+ builder: /* @__PURE__ */ __name((yargs) => yargs.command(listCommand4).demandCommand(1, "You need at least one command before continuing.").version(false), "builder"),
59651
+ // demandCommand(1) ensures a subcommand is always required;
59652
+ // yargs automatically shows help when none is provided.
59653
+ handler: /* @__PURE__ */ __name(() => {
59654
+ }, "handler")
59655
+ };
59656
+
59229
59657
  // packages/cli/src/utils/runBudget.ts
59230
59658
  init_esbuild_shims();
59231
59659
  var SECOND = 1e3;
@@ -59931,11 +60359,11 @@ async function parseArguments() {
59931
60359
  }
59932
60360
  return true;
59933
60361
  })
59934
- ).command(mcpCommand).command(extensionsCommand).command(authCommand).command(hooksCommand).command(channelCommand).command(reviewCommand).command(serveCommand);
60362
+ ).command(mcpCommand).command(extensionsCommand).command(authCommand).command(hooksCommand).command(channelCommand).command(reviewCommand).command(serveCommand).command(sessionsCommand);
59935
60363
  yargsInstance.version(await getCliVersion()).alias("v", "version").help().alias("h", "help").strict().demandCommand(0, 0);
59936
60364
  yargsInstance.wrap(yargsInstance.terminalWidth());
59937
60365
  const result = await yargsInstance.parse();
59938
- if (result._.length > 0 && (result._[0] === "mcp" || result._[0] === "extensions" || result._[0] === "auth" || result._[0] === "hooks" || result._[0] === "channel" || result._[0] === "review")) {
60366
+ if (result._.length > 0 && (result._[0] === "mcp" || result._[0] === "extensions" || result._[0] === "auth" || result._[0] === "hooks" || result._[0] === "channel" || result._[0] === "review" || result._[0] === "sessions")) {
59939
60367
  process.exit(0);
59940
60368
  }
59941
60369
  const queryArg = result.query;
@@ -64477,258 +64905,6 @@ var aboutCommand = {
64477
64905
 
64478
64906
  // packages/cli/src/ui/commands/tasksCommand.ts
64479
64907
  init_esbuild_shims();
64480
-
64481
- // packages/cli/src/ui/utils/textUtils.ts
64482
- init_esbuild_shims();
64483
- init_ansi_regex();
64484
- import { stripVTControlCharacters } from "node:util";
64485
-
64486
- // packages/cli/node_modules/string-width/index.js
64487
- init_esbuild_shims();
64488
- var import_emoji_regex = __toESM(require_emoji_regex(), 1);
64489
- var segmenter4 = new Intl.Segmenter();
64490
- var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
64491
- function stringWidth2(string, options = {}) {
64492
- if (typeof string !== "string" || string.length === 0) {
64493
- return 0;
64494
- }
64495
- const {
64496
- ambiguousIsNarrow = true,
64497
- countAnsiEscapeCodes = false
64498
- } = options;
64499
- if (!countAnsiEscapeCodes) {
64500
- string = stripAnsi(string);
64501
- }
64502
- if (string.length === 0) {
64503
- return 0;
64504
- }
64505
- let width = 0;
64506
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
64507
- for (const { segment: character } of segmenter4.segment(string)) {
64508
- const codePoint = character.codePointAt(0);
64509
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
64510
- continue;
64511
- }
64512
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
64513
- continue;
64514
- }
64515
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
64516
- continue;
64517
- }
64518
- if (codePoint >= 55296 && codePoint <= 57343) {
64519
- continue;
64520
- }
64521
- if (codePoint >= 65024 && codePoint <= 65039) {
64522
- continue;
64523
- }
64524
- if (defaultIgnorableCodePointRegex.test(character)) {
64525
- continue;
64526
- }
64527
- if ((0, import_emoji_regex.default)().test(character)) {
64528
- width += 2;
64529
- continue;
64530
- }
64531
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
64532
- }
64533
- return width;
64534
- }
64535
- __name(stringWidth2, "stringWidth");
64536
-
64537
- // packages/cli/src/ui/utils/textUtils.ts
64538
- var getAsciiArtWidth = /* @__PURE__ */ __name((asciiArt) => {
64539
- if (!asciiArt) {
64540
- return 0;
64541
- }
64542
- const lines = asciiArt.split("\n");
64543
- return Math.max(...lines.map((line) => getCachedStringWidth(line)));
64544
- }, "getAsciiArtWidth");
64545
- var codePointsCache = /* @__PURE__ */ new Map();
64546
- var MAX_STRING_LENGTH_TO_CACHE = 1e3;
64547
- function toCodePoints(str) {
64548
- let isAscii = true;
64549
- for (let i = 0; i < str.length; i++) {
64550
- if (str.charCodeAt(i) > 127) {
64551
- isAscii = false;
64552
- break;
64553
- }
64554
- }
64555
- if (isAscii) {
64556
- return str.split("");
64557
- }
64558
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
64559
- const cached = codePointsCache.get(str);
64560
- if (cached) {
64561
- return cached;
64562
- }
64563
- }
64564
- const result = Array.from(str);
64565
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
64566
- codePointsCache.set(str, result);
64567
- }
64568
- return result;
64569
- }
64570
- __name(toCodePoints, "toCodePoints");
64571
- function cpLen(str) {
64572
- return toCodePoints(str).length;
64573
- }
64574
- __name(cpLen, "cpLen");
64575
- function cpSlice(str, start, end) {
64576
- const arr = toCodePoints(str).slice(start, end);
64577
- return arr.join("");
64578
- }
64579
- __name(cpSlice, "cpSlice");
64580
- function stripUnsafeCharacters(str) {
64581
- const strippedAnsi = stripAnsi(str);
64582
- const strippedVT = stripVTControlCharacters(strippedAnsi);
64583
- return toCodePoints(strippedVT).filter((char) => {
64584
- const code = char.codePointAt(0);
64585
- if (code === void 0) return false;
64586
- if (code === 9 || code === 10 || code === 13) return true;
64587
- if (code >= 0 && code <= 31) return false;
64588
- if (code >= 128 && code <= 159) return false;
64589
- return true;
64590
- }).join("");
64591
- }
64592
- __name(stripUnsafeCharacters, "stripUnsafeCharacters");
64593
- var stringWidthCache = /* @__PURE__ */ new Map();
64594
- var getCachedStringWidth = /* @__PURE__ */ __name((str) => {
64595
- if (/^[\x20-\x7E]*$/.test(str)) {
64596
- return str.length;
64597
- }
64598
- if (stringWidthCache.has(str)) {
64599
- return stringWidthCache.get(str);
64600
- }
64601
- const width = stringWidth2(str);
64602
- stringWidthCache.set(str, width);
64603
- return width;
64604
- }, "getCachedStringWidth");
64605
- var regex = ansiRegex();
64606
- function escapeAnsiCtrlCodes(obj) {
64607
- if (typeof obj === "string") {
64608
- if (obj.search(regex) === -1) {
64609
- return obj;
64610
- }
64611
- regex.lastIndex = 0;
64612
- return obj.replace(
64613
- regex,
64614
- (match) => JSON.stringify(match).slice(1, -1)
64615
- );
64616
- }
64617
- if (obj === null || typeof obj !== "object") {
64618
- return obj;
64619
- }
64620
- if (Array.isArray(obj)) {
64621
- let newArr = null;
64622
- for (let i = 0; i < obj.length; i++) {
64623
- const value = obj[i];
64624
- const escapedValue = escapeAnsiCtrlCodes(value);
64625
- if (escapedValue !== value) {
64626
- if (newArr === null) {
64627
- newArr = [...obj];
64628
- }
64629
- newArr[i] = escapedValue;
64630
- }
64631
- }
64632
- return newArr !== null ? newArr : obj;
64633
- }
64634
- let newObj = null;
64635
- const keys = Object.keys(obj);
64636
- for (const key of keys) {
64637
- const value = obj[key];
64638
- const escapedValue = escapeAnsiCtrlCodes(value);
64639
- if (escapedValue !== value) {
64640
- if (newObj === null) {
64641
- newObj = { ...obj };
64642
- }
64643
- newObj[key] = escapedValue;
64644
- }
64645
- }
64646
- return newObj !== null ? newObj : obj;
64647
- }
64648
- __name(escapeAnsiCtrlCodes, "escapeAnsiCtrlCodes");
64649
- var SENSITIVE_PATTERNS = [
64650
- // API keys with common prefixes
64651
- {
64652
- pattern: /(sk-[a-zA-Z0-9]{20,})/g,
64653
- replacement: "sk-***REDACTED***"
64654
- },
64655
- {
64656
- pattern: /(api[_-]?key[_-]?[=:]\s*)[a-zA-Z0-9_-]{20,}/gi,
64657
- replacement: "$1***REDACTED***"
64658
- },
64659
- // Bearer tokens
64660
- {
64661
- pattern: /(Bearer\s+)[a-zA-Z0-9._-]+/gi,
64662
- replacement: "$1***REDACTED***"
64663
- },
64664
- // Generic tokens
64665
- {
64666
- pattern: /(token[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
64667
- replacement: "$1***REDACTED***"
64668
- },
64669
- // Passwords in connection strings or assignments
64670
- {
64671
- pattern: /(password[_-]?[=:]\s*)[^\s]+/gi,
64672
- replacement: "$1***REDACTED***"
64673
- },
64674
- {
64675
- pattern: /(pwd[_-]?[=:]\s*)[^\s]+/gi,
64676
- replacement: "$1***REDACTED***"
64677
- },
64678
- // AWS keys
64679
- {
64680
- pattern: /(AKIA[A-Z0-9]{16})/g,
64681
- replacement: "***REDACTED***"
64682
- },
64683
- // Generic secret patterns
64684
- {
64685
- pattern: /(secret[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
64686
- replacement: "$1***REDACTED***"
64687
- }
64688
- ];
64689
- function sanitizeSensitiveText(text, maxLength = 200) {
64690
- let result = text;
64691
- for (const { pattern, replacement } of SENSITIVE_PATTERNS) {
64692
- result = result.replace(pattern, replacement);
64693
- }
64694
- if (result.length > maxLength) {
64695
- if (maxLength <= 3) {
64696
- return result.slice(0, maxLength);
64697
- }
64698
- return result.slice(0, maxLength - 3) + "...";
64699
- }
64700
- return result;
64701
- }
64702
- __name(sanitizeSensitiveText, "sanitizeSensitiveText");
64703
- var FILENAME_CONTROL_CHARS_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
64704
- function escapeFilenameControlChar(ch) {
64705
- switch (ch) {
64706
- case "\b":
64707
- return "\\b";
64708
- case " ":
64709
- return "\\t";
64710
- case "\n":
64711
- return "\\n";
64712
- case "\f":
64713
- return "\\f";
64714
- case "\r":
64715
- return "\\r";
64716
- default: {
64717
- const code = ch.charCodeAt(0);
64718
- return `\\u${code.toString(16).padStart(4, "0")}`;
64719
- }
64720
- }
64721
- }
64722
- __name(escapeFilenameControlChar, "escapeFilenameControlChar");
64723
- function sanitizeFilenameForDisplay(name) {
64724
- return escapeAnsiCtrlCodes(name).replace(
64725
- FILENAME_CONTROL_CHARS_REGEX,
64726
- escapeFilenameControlChar
64727
- );
64728
- }
64729
- __name(sanitizeFilenameForDisplay, "sanitizeFilenameForDisplay");
64730
-
64731
- // packages/cli/src/ui/commands/tasksCommand.ts
64732
64908
  function statusLabel(entry) {
64733
64909
  switch (entry.kind) {
64734
64910
  case "agent": {
@@ -64928,6 +65104,147 @@ var tasksCommand = {
64928
65104
  }, "action")
64929
65105
  };
64930
65106
 
65107
+ // packages/cli/src/ui/commands/workflowsCommand.ts
65108
+ init_esbuild_shims();
65109
+ function rowLine(entry, now) {
65110
+ const endTime = entry.endTime ?? now;
65111
+ const runtime = formatDuration(endTime - entry.startTime, {
65112
+ hideTrailingZeros: true
65113
+ });
65114
+ const label = entry.meta?.name ?? entry.runId;
65115
+ const phase = entry.currentPhase ? ` \xB7 ${entry.currentPhase}` : "";
65116
+ const counts = entry.agentsDispatched > 0 ? ` \xB7 ${entry.agentsCompleted}/${entry.agentsDispatched} agents` : "";
65117
+ const phaseCount = entry.phases.length > 0 ? ` \xB7 ${entry.phases.length} ${entry.phases.length === 1 ? "phase" : "phases"}` : "";
65118
+ const errorTail = entry.status === "failed" && entry.error ? ` \u2014 ${entry.error.slice(0, 80)}` : "";
65119
+ return ` ${entry.runId.padEnd(20)} ${entry.status.padEnd(10)} ${runtime.padStart(8)} ${label}${phase}${counts}${phaseCount}${errorTail}`;
65120
+ }
65121
+ __name(rowLine, "rowLine");
65122
+ function detailLines(entry, now) {
65123
+ const lines = [];
65124
+ const endTime = entry.endTime ?? now;
65125
+ const runtime = formatDuration(endTime - entry.startTime, {
65126
+ hideTrailingZeros: true
65127
+ });
65128
+ lines.push(`Workflow ${entry.runId}`);
65129
+ if (entry.meta?.name) {
65130
+ lines.push(` name : ${entry.meta.name}`);
65131
+ }
65132
+ if (entry.meta?.description) {
65133
+ lines.push(` description : ${entry.meta.description}`);
65134
+ }
65135
+ if (entry.meta?.whenToUse) {
65136
+ lines.push(` whenToUse : ${entry.meta.whenToUse}`);
65137
+ }
65138
+ lines.push(` status : ${entry.status}`);
65139
+ lines.push(` runtime : ${runtime}`);
65140
+ if (entry.currentPhase) {
65141
+ lines.push(` currentPhase: ${entry.currentPhase}`);
65142
+ }
65143
+ lines.push(
65144
+ ` agents : ${entry.agentsCompleted}/${entry.agentsDispatched}`
65145
+ );
65146
+ if (entry.error) {
65147
+ lines.push(` error : ${entry.error}`);
65148
+ }
65149
+ if (entry.phases.length > 0) {
65150
+ lines.push("");
65151
+ lines.push(` Phases (${entry.phases.length})`);
65152
+ for (const phase of entry.phases) {
65153
+ lines.push(` \xB7 ${phase}`);
65154
+ }
65155
+ }
65156
+ if (entry.recentLogs.length > 0) {
65157
+ lines.push("");
65158
+ lines.push(` Logs (last ${entry.recentLogs.length})`);
65159
+ for (const line of entry.recentLogs) {
65160
+ lines.push(` ${line}`);
65161
+ }
65162
+ }
65163
+ return lines;
65164
+ }
65165
+ __name(detailLines, "detailLines");
65166
+ var workflowsCommand = {
65167
+ name: "workflows",
65168
+ get description() {
65169
+ return t(
65170
+ "List active and completed workflow runs (text dump \u2014 interactive dialog opens via the footer pill)"
65171
+ );
65172
+ },
65173
+ get argumentHint() {
65174
+ return t("[runId]");
65175
+ },
65176
+ kind: "built-in" /* BUILT_IN */,
65177
+ // Same triple-mode coverage as `/tasks`: the dialog is richer in
65178
+ // interactive mode but headless / acp consumers need the text dump
65179
+ // as their only inspection path.
65180
+ supportedModes: ["interactive", "non_interactive", "acp"],
65181
+ action: /* @__PURE__ */ __name(async (context, args) => {
65182
+ const { config } = context.services;
65183
+ if (!config) {
65184
+ return {
65185
+ type: "message",
65186
+ messageType: "error",
65187
+ content: "Config not available."
65188
+ };
65189
+ }
65190
+ const registry2 = config.getWorkflowRunRegistry();
65191
+ const allEntries = registry2.list();
65192
+ const trimmedArgs = (args ?? "").trim();
65193
+ if (trimmedArgs.length > 0) {
65194
+ const target = registry2.get(trimmedArgs);
65195
+ if (!target) {
65196
+ return {
65197
+ type: "message",
65198
+ messageType: "error",
65199
+ content: `Unknown workflow runId: ${trimmedArgs}`
65200
+ };
65201
+ }
65202
+ return {
65203
+ type: "message",
65204
+ messageType: "info",
65205
+ content: detailLines(target, Date.now()).join("\n")
65206
+ };
65207
+ }
65208
+ if (allEntries.length === 0) {
65209
+ return {
65210
+ type: "message",
65211
+ messageType: "info",
65212
+ content: "No workflow runs recorded yet."
65213
+ };
65214
+ }
65215
+ const now = Date.now();
65216
+ const running = allEntries.filter((e) => e.status === "running").sort((a, b) => a.startTime - b.startTime);
65217
+ const terminal = allEntries.filter((e) => e.status !== "running").sort((a, b) => (b.endTime ?? 0) - (a.endTime ?? 0));
65218
+ const lines = [];
65219
+ if (context.executionMode === "interactive") {
65220
+ lines.push(
65221
+ t(
65222
+ "Tip: use `/workflows <runId>` for the per-run detail view (name, description, phase tree, recent logs)."
65223
+ ),
65224
+ ""
65225
+ );
65226
+ }
65227
+ lines.push(
65228
+ `Workflow runs (${allEntries.length} total \xB7 ${running.length} running)`,
65229
+ ""
65230
+ );
65231
+ if (running.length > 0) {
65232
+ lines.push("Active");
65233
+ for (const entry of running) lines.push(rowLine(entry, now));
65234
+ lines.push("");
65235
+ }
65236
+ if (terminal.length > 0) {
65237
+ lines.push("Recent");
65238
+ for (const entry of terminal) lines.push(rowLine(entry, now));
65239
+ }
65240
+ return {
65241
+ type: "message",
65242
+ messageType: "info",
65243
+ content: lines.join("\n")
65244
+ };
65245
+ }, "action")
65246
+ };
65247
+
64931
65248
  // packages/cli/src/ui/commands/agentsCommand.ts
64932
65249
  init_esbuild_shims();
64933
65250
  var agentsCommand = {
@@ -67500,13 +67817,18 @@ init_esbuild_shims();
67500
67817
  // packages/cli/src/ui/utils/backgroundWorkUtils.ts
67501
67818
  init_esbuild_shims();
67502
67819
  function hasBlockingBackgroundWork(config) {
67503
- return config.getBackgroundTaskRegistry().hasUnfinalizedTasks() || config.getMonitorRegistry().getRunning().length > 0 || config.getBackgroundShellRegistry().hasRunningEntries();
67820
+ return config.getBackgroundTaskRegistry().hasUnfinalizedTasks() || config.getMonitorRegistry().getRunning().length > 0 || config.getBackgroundShellRegistry().hasRunningEntries() || // R7 (wenshao): the WorkflowRunRegistry is a 4th sibling that the
67821
+ // earlier P4b commit forgot to wire here. Without this OR clause,
67822
+ // /clear and session-resume happily ran while a workflow was
67823
+ // mid-run, orphaning the dispatch loop.
67824
+ config.getWorkflowRunRegistry().hasRunningEntries();
67504
67825
  }
67505
67826
  __name(hasBlockingBackgroundWork, "hasBlockingBackgroundWork");
67506
67827
  function resetBackgroundStateForSessionSwitch(config) {
67507
67828
  config.getBackgroundTaskRegistry().reset();
67508
67829
  config.getMonitorRegistry().reset();
67509
67830
  config.getBackgroundShellRegistry().reset();
67831
+ config.getWorkflowRunRegistry().reset();
67510
67832
  }
67511
67833
  __name(resetBackgroundStateForSessionSwitch, "resetBackgroundStateForSessionSwitch");
67512
67834
 
@@ -69783,7 +70105,6 @@ __name(rollbackStandaloneUpdate, "rollbackStandaloneUpdate");
69783
70105
  // packages/cli/src/utils/installationInfo.ts
69784
70106
  init_esbuild_shims();
69785
70107
  import * as fs16 from "node:fs";
69786
- import * as os14 from "node:os";
69787
70108
  import * as path18 from "node:path";
69788
70109
  import * as childProcess from "node:child_process";
69789
70110
  var debugLogger14 = createDebugLogger("INSTALLATION_INFO");
@@ -69896,27 +70217,11 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
69896
70217
  npmPrefixWritable = true;
69897
70218
  } catch {
69898
70219
  }
69899
- if (!npmPrefixWritable && isAutoUpdateEnabled) {
69900
- const installRoot = process.env["HOME"] || os14.homedir();
69901
- if (!installRoot || installRoot === "/") {
69902
- return {
69903
- packageManager: "npm" /* NPM */,
69904
- isGlobal: true,
69905
- updateMessage: "Update requires sudo. Run: sudo npm install -g @qwen-code/qwen-code@latest"
69906
- };
69907
- }
69908
- const fallbackStandaloneDir = path18.join(
69909
- installRoot,
69910
- ".local",
69911
- "lib",
69912
- "qwen-code"
69913
- );
70220
+ if (!npmPrefixWritable) {
69914
70221
  return {
69915
70222
  packageManager: "npm" /* NPM */,
69916
70223
  isGlobal: true,
69917
- isStandalone: true,
69918
- standaloneDir: fallbackStandaloneDir,
69919
- updateMessage: "npm install requires sudo. Migrating to standalone installer for automatic updates."
70224
+ updateMessage: "Update requires sudo. Please run: sudo npm install -g @qwen-code/qwen-code@latest"
69920
70225
  };
69921
70226
  }
69922
70227
  const updateCommand2 = "npm install -g @qwen-code/qwen-code@latest";
@@ -71729,7 +72034,7 @@ async function extractMetadata(conversation, config) {
71729
72034
  const gitBranch = firstRecord?.gitBranch;
71730
72035
  let gitRepo;
71731
72036
  if (cwd5) {
71732
- const { getGitRepoName } = await import("./chunks/src-L5P7K4MH.js");
72037
+ const { getGitRepoName } = await import("./chunks/src-XV5MLRND.js");
71733
72038
  gitRepo = getGitRepoName(cwd5);
71734
72039
  }
71735
72040
  let model;
@@ -72995,6 +73300,7 @@ var forkCommand = {
72995
73300
  const params = {
72996
73301
  description: deriveForkDescription(directive),
72997
73302
  prompt: directive,
73303
+ subagent_type: FORK_SUBAGENT_TYPE,
72998
73304
  run_in_background: true
72999
73305
  };
73000
73306
  let result;
@@ -73924,7 +74230,7 @@ function formatHookSource(source) {
73924
74230
  }
73925
74231
  }
73926
74232
  __name(formatHookSource, "formatHookSource");
73927
- var listCommand4 = {
74233
+ var listCommand5 = {
73928
74234
  name: "list",
73929
74235
  get description() {
73930
74236
  return t("List all configured hooks");
@@ -74047,7 +74353,7 @@ var hooksCommand2 = {
74047
74353
  dialog: "hooks"
74048
74354
  };
74049
74355
  }
74050
- const result = await listCommand4.action?.(context, args);
74356
+ const result = await listCommand5.action?.(context, args);
74051
74357
  return result ?? { type: "message", messageType: "info", content: "" };
74052
74358
  }, "action")
74053
74359
  };
@@ -74344,7 +74650,7 @@ init_esbuild_shims();
74344
74650
  init_esbuild_shims();
74345
74651
  var import_strip_json_comments4 = __toESM(require_strip_json_comments(), 1);
74346
74652
  import * as fs18 from "node:fs";
74347
- import * as os15 from "node:os";
74653
+ import * as os14 from "node:os";
74348
74654
  import * as path21 from "node:path";
74349
74655
  function isRecord(value) {
74350
74656
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -74430,11 +74736,11 @@ function getClaudeProjectSettings(projects, cwd5) {
74430
74736
  return void 0;
74431
74737
  }
74432
74738
  __name(getClaudeProjectSettings, "getClaudeProjectSettings");
74433
- function getClaudeCodeConfigPath(homeDir = os15.homedir()) {
74739
+ function getClaudeCodeConfigPath(homeDir = os14.homedir()) {
74434
74740
  return path21.join(homeDir, ".claude.json");
74435
74741
  }
74436
74742
  __name(getClaudeCodeConfigPath, "getClaudeCodeConfigPath");
74437
- function getClaudeDesktopConfigPath(homeDir = os15.homedir(), platform5 = process.platform, env5 = process.env) {
74743
+ function getClaudeDesktopConfigPath(homeDir = os14.homedir(), platform5 = process.platform, env5 = process.env) {
74438
74744
  if (platform5 === "win32") {
74439
74745
  const appData = env5["APPDATA"] ?? path21.win32.join(homeDir, "AppData", "Roaming");
74440
74746
  return path21.win32.join(appData, "Claude", "claude_desktop_config.json");
@@ -74600,7 +74906,7 @@ function loadClaudeDesktopMcpServers(homeDir, platform5, env5) {
74600
74906
  }
74601
74907
  __name(loadClaudeDesktopMcpServers, "loadClaudeDesktopMcpServers");
74602
74908
  function loadClaudeMcpSources(options) {
74603
- const homeDir = options.homeDir ?? os15.homedir();
74909
+ const homeDir = options.homeDir ?? os14.homedir();
74604
74910
  const cwd5 = options.cwd ?? process.cwd();
74605
74911
  const platform5 = options.platform ?? process.platform;
74606
74912
  const env5 = options.env ?? process.env;
@@ -76863,7 +77169,7 @@ init_esbuild_shims();
76863
77169
  // packages/cli/src/ui/utils/terminalSetup.ts
76864
77170
  init_esbuild_shims();
76865
77171
  import { promises as fs21 } from "node:fs";
76866
- import * as os16 from "node:os";
77172
+ import * as os15 from "node:os";
76867
77173
  import * as path26 from "node:path";
76868
77174
  import { exec as exec3 } from "node:child_process";
76869
77175
  import { promisify } from "node:util";
@@ -76982,7 +77288,7 @@ async function detectTerminal2() {
76982
77288
  if (termProgram === "vscode" || process.env["VSCODE_GIT_IPC_HANDLE"]) {
76983
77289
  return "vscode";
76984
77290
  }
76985
- if (os16.platform() !== "win32") {
77291
+ if (os15.platform() !== "win32") {
76986
77292
  try {
76987
77293
  const { stdout } = await execAsync("ps -o comm= -p $PPID");
76988
77294
  const parentName = stdout.trim();
@@ -77012,10 +77318,10 @@ async function backupFile(filePath) {
77012
77318
  }
77013
77319
  __name(backupFile, "backupFile");
77014
77320
  function getVSCodeStyleConfigDir(appName) {
77015
- const platform5 = os16.platform();
77321
+ const platform5 = os15.platform();
77016
77322
  if (platform5 === "darwin") {
77017
77323
  return path26.join(
77018
- os16.homedir(),
77324
+ os15.homedir(),
77019
77325
  "Library",
77020
77326
  "Application Support",
77021
77327
  appName,
@@ -77027,7 +77333,7 @@ function getVSCodeStyleConfigDir(appName) {
77027
77333
  }
77028
77334
  return path26.join(process.env["APPDATA"], appName, "User");
77029
77335
  } else {
77030
- return path26.join(os16.homedir(), ".config", appName, "User");
77336
+ return path26.join(os15.homedir(), ".config", appName, "User");
77031
77337
  }
77032
77338
  }
77033
77339
  __name(getVSCodeStyleConfigDir, "getVSCodeStyleConfigDir");
@@ -79279,6 +79585,12 @@ var BuiltinCommandLoader = class {
79279
79585
  aboutCommand,
79280
79586
  agentsCommand,
79281
79587
  tasksCommand,
79588
+ // Gated behind isWorkflowsEnabled — feature flag honors
79589
+ // QWEN_CODE_ENABLE_WORKFLOWS (opt-in) and QWEN_CODE_DISABLE_WORKFLOWS
79590
+ // (kill switch). When the flag is off the command vanishes entirely
79591
+ // from typeahead and help, matching the established convention for
79592
+ // experimental builtins.
79593
+ this.config?.isWorkflowsEnabled() ? workflowsCommand : null,
79282
79594
  arenaCommand,
79283
79595
  approvalModeCommand,
79284
79596
  authCommand2,
@@ -82903,6 +83215,10 @@ ${text}
82903
83215
  if (options.captureMonitorNotifications !== false) {
82904
83216
  monitorRegistry.setNotificationCallback(
82905
83217
  (displayText, modelText, meta) => {
83218
+ if (meta.status === "running" && typeof monitorRegistry.get === "function") {
83219
+ const entry = monitorRegistry.get(meta.monitorId);
83220
+ if (!entry || entry.status !== "running") return;
83221
+ }
82906
83222
  const queueItem = {
82907
83223
  displayText,
82908
83224
  modelText,
@@ -83189,10 +83505,25 @@ ${text}
83189
83505
  if (pendingTeammateMessages.length > 0) {
83190
83506
  continue;
83191
83507
  }
83192
- const drainOneItem = /* @__PURE__ */ __name(async () => {
83508
+ const drainBatch = /* @__PURE__ */ __name(async () => {
83193
83509
  if (localQueue.length === 0) return;
83194
- const item = localQueue.shift();
83195
- emitNotificationToSdk(item);
83510
+ const targetType = localQueue[0].sendMessageType;
83511
+ let splitIdx = targetType === "cron" /* Cron */ ? 1 : 0;
83512
+ if (splitIdx === 0) {
83513
+ while (splitIdx < localQueue.length && localQueue[splitIdx].sendMessageType === targetType) {
83514
+ splitIdx++;
83515
+ }
83516
+ }
83517
+ const batch = localQueue.splice(0, splitIdx);
83518
+ if (batch.length === 0) return;
83519
+ for (const queueItem of batch) {
83520
+ emitNotificationToSdk(queueItem);
83521
+ }
83522
+ const item = {
83523
+ displayText: batch.map((i) => i.displayText).join("; "),
83524
+ modelText: batch.map((i) => i.modelText).join("\n\n"),
83525
+ sendMessageType: targetType
83526
+ };
83196
83527
  turnCount++;
83197
83528
  if (config.getMaxSessionTurns() >= 0 && turnCount > config.getMaxSessionTurns()) {
83198
83529
  await handleMaxTurnsExceededError(config);
@@ -83260,14 +83591,14 @@ ${text}
83260
83591
  break;
83261
83592
  }
83262
83593
  }
83263
- }, "drainOneItem");
83594
+ }, "drainBatch");
83264
83595
  let drainPromise = null;
83265
83596
  const drainLocalQueue = /* @__PURE__ */ __name(() => {
83266
83597
  if (drainPromise) return drainPromise;
83267
83598
  const p = (async () => {
83268
83599
  while (localQueue.length > 0) {
83269
83600
  if (structuredSubmission !== void 0) return;
83270
- await drainOneItem();
83601
+ await drainBatch();
83271
83602
  }
83272
83603
  })();
83273
83604
  drainPromise = p;
@@ -83902,7 +84233,7 @@ var SystemController = class extends BaseController {
83902
84233
  throw new Error("Request aborted");
83903
84234
  }
83904
84235
  try {
83905
- const mod = await import("./chunks/contextCommand-KS2H7MW5.js");
84236
+ const mod = await import("./chunks/contextCommand-HI2X2Y7I.js");
83906
84237
  if (signal.aborted) {
83907
84238
  throw new Error("Request aborted");
83908
84239
  }
@@ -85303,6 +85634,10 @@ var Session = class {
85303
85634
  if (this.isShuttingDown || this.abortController.signal.aborted) {
85304
85635
  return;
85305
85636
  }
85637
+ if (meta.status === "running" && typeof registry2.get === "function") {
85638
+ const entry = registry2.get(meta.monitorId);
85639
+ if (!entry || entry.status !== "running") return;
85640
+ }
85306
85641
  this.enqueueMonitorNotification({
85307
85642
  displayText,
85308
85643
  modelText,
@@ -85507,25 +85842,29 @@ var Session = class {
85507
85842
  debugLogger33.error("[Session] Query execution error:", error);
85508
85843
  }
85509
85844
  }
85510
- async processMonitorNotification(notification) {
85845
+ async processMonitorNotificationBatch(batch) {
85511
85846
  await this.waitForInitialization();
85512
- this.outputAdapter.emitUserMessage([{ text: notification.displayText }]);
85513
- this.outputAdapter.emitSystemMessage(
85514
- "task_notification",
85515
- notification.sdkNotification
85516
- );
85847
+ for (const item of batch) {
85848
+ this.outputAdapter.emitUserMessage([{ text: item.displayText }]);
85849
+ this.outputAdapter.emitSystemMessage(
85850
+ "task_notification",
85851
+ item.sdkNotification
85852
+ );
85853
+ }
85854
+ const combinedModelText = batch.map((n) => n.modelText).join("\n\n");
85855
+ const combinedDisplayText = batch.map((n) => n.displayText).join("; ");
85517
85856
  const promptId = this.getNextPromptId();
85518
85857
  await runNonInteractive(
85519
85858
  this.config,
85520
85859
  this.settings,
85521
- notification.modelText,
85860
+ combinedModelText,
85522
85861
  promptId,
85523
85862
  {
85524
85863
  abortController: this.abortController,
85525
85864
  adapter: this.outputAdapter,
85526
85865
  controlService: this.controlService ?? void 0,
85527
85866
  sendMessageType: "notification" /* Notification */,
85528
- notificationDisplayText: notification.displayText,
85867
+ notificationDisplayText: combinedDisplayText,
85529
85868
  captureMonitorNotifications: false,
85530
85869
  captureMonitorRegistrations: false
85531
85870
  }
@@ -85551,15 +85890,15 @@ var Session = class {
85551
85890
  this.outputAdapter.emitSystemMessage("task_started", started);
85552
85891
  continue;
85553
85892
  }
85554
- const notification = this.monitorQueue.shift();
85555
- if (!notification) {
85893
+ if (this.monitorQueue.length === 0) {
85556
85894
  continue;
85557
85895
  }
85896
+ const batch = this.monitorQueue.splice(0);
85558
85897
  try {
85559
- await this.processMonitorNotification(notification);
85898
+ await this.processMonitorNotificationBatch(batch);
85560
85899
  } catch (error) {
85561
85900
  debugLogger33.error(
85562
- "[Session] Error processing monitor notification:",
85901
+ "[Session] Error processing monitor notification batch:",
85563
85902
  error
85564
85903
  );
85565
85904
  this.emitErrorResult(error);
@@ -87745,6 +88084,22 @@ __name(loadLowlight, "loadLowlight");
87745
88084
  // packages/cli/src/ui/utils/CodeColorizer.tsx
87746
88085
  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
87747
88086
  var debugLogger37 = createDebugLogger("CODE_COLORIZER");
88087
+ var STRUCTURAL_BOX_RE = /[│├└┌┐┘┬┴┼]/;
88088
+ var CJK_RE = /[\u4E00-\u9FFF\u3400-\u4DBF]/g;
88089
+ function looksLikeDiagramOrArt(line) {
88090
+ const trimmed = line.trim();
88091
+ if (trimmed.length === 0) return false;
88092
+ if (STRUCTURAL_BOX_RE.test(trimmed)) {
88093
+ return true;
88094
+ }
88095
+ const cjkMatches = trimmed.match(CJK_RE) || [];
88096
+ const totalChars = trimmed.replace(/\s/g, "").length;
88097
+ if (totalChars > 0 && cjkMatches.length / totalChars > 0.3) {
88098
+ return true;
88099
+ }
88100
+ return false;
88101
+ }
88102
+ __name(looksLikeDiagramOrArt, "looksLikeDiagramOrArt");
87748
88103
  function renderHastNode(node, theme2, inheritedColor) {
87749
88104
  if (node.type === "text") {
87750
88105
  const color2 = inheritedColor || theme2.defaultColor;
@@ -87790,6 +88145,9 @@ function highlightAndRenderLine(line, language, theme2, lowlight) {
87790
88145
  if (!lowlight) {
87791
88146
  return line;
87792
88147
  }
88148
+ if (!language && looksLikeDiagramOrArt(line)) {
88149
+ return line;
88150
+ }
87793
88151
  try {
87794
88152
  const getHighlightedLine = /* @__PURE__ */ __name(() => !language || !lowlight.registered(language) ? lowlight.highlightAuto(line) : lowlight.highlight(language, line), "getHighlightedLine");
87795
88153
  const renderedNode = renderHastNode(getHighlightedLine(), theme2, void 0);
@@ -90749,7 +91107,7 @@ __name(renderMermaidVisual, "renderMermaidVisual");
90749
91107
  init_esbuild_shims();
90750
91108
  import crypto2 from "node:crypto";
90751
91109
  import fs27 from "node:fs";
90752
- import os17 from "node:os";
91110
+ import os16 from "node:os";
90753
91111
  import path35 from "node:path";
90754
91112
  import { spawn as spawn4, spawnSync } from "node:child_process";
90755
91113
  var CACHE_LIMIT = 40;
@@ -91313,7 +91671,7 @@ function isExecutable(filePath) {
91313
91671
  __name(isExecutable, "isExecutable");
91314
91672
  async function renderPngWithMmdcAsync(source, mmdc, env5, signal) {
91315
91673
  const tempDir = await fs27.promises.mkdtemp(
91316
- path35.join(os17.tmpdir(), "qwen-mermaid-")
91674
+ path35.join(os16.tmpdir(), "qwen-mermaid-")
91317
91675
  );
91318
91676
  const inputPath = path35.join(tempDir, "diagram.mmd");
91319
91677
  const outputPath = path35.join(tempDir, "diagram.png");
@@ -91410,7 +91768,7 @@ function getMermaidCellAspectRatio(env5) {
91410
91768
  __name(getMermaidCellAspectRatio, "getMermaidCellAspectRatio");
91411
91769
  async function renderPngWithChafaAsync(png, widthCells, rows, chafa, env5, signal) {
91412
91770
  const tempDir = await fs27.promises.mkdtemp(
91413
- path35.join(os17.tmpdir(), "qwen-mermaid-")
91771
+ path35.join(os16.tmpdir(), "qwen-mermaid-")
91414
91772
  );
91415
91773
  const imagePath = path35.join(tempDir, "diagram.png");
91416
91774
  try {
@@ -92639,39 +92997,143 @@ var AssistantMessageContent = /* @__PURE__ */ __name(({
92639
92997
  sourceCopyIndexOffsets
92640
92998
  }
92641
92999
  ), "AssistantMessageContent");
93000
+ var MAX_STREAMING_THINKING_VISUAL_LINES = 4;
93001
+ function wrapToVisualLines(text, width) {
93002
+ if (width <= 0) {
93003
+ return [""];
93004
+ }
93005
+ const visualLines = [];
93006
+ for (const logicalLine of text.split("\n")) {
93007
+ if (logicalLine === "") {
93008
+ visualLines.push("");
93009
+ continue;
93010
+ }
93011
+ let currentLine = "";
93012
+ let currentWidth = 0;
93013
+ for (const char of logicalLine) {
93014
+ const charWidth = getCachedStringWidth(char);
93015
+ if (currentWidth + charWidth > width && currentWidth > 0) {
93016
+ visualLines.push(currentLine);
93017
+ currentLine = "";
93018
+ currentWidth = 0;
93019
+ }
93020
+ currentLine += char;
93021
+ currentWidth += charWidth;
93022
+ }
93023
+ if (currentLine) {
93024
+ visualLines.push(currentLine);
93025
+ }
93026
+ }
93027
+ if (visualLines.length === 0) {
93028
+ visualLines.push("");
93029
+ }
93030
+ return visualLines;
93031
+ }
93032
+ __name(wrapToVisualLines, "wrapToVisualLines");
93033
+ function tailVisualLines(text, width, maxLines) {
93034
+ const charBudget = maxLines * width * 2;
93035
+ let sliceStart = Math.max(0, text.length - charBudget);
93036
+ if (sliceStart > 0) {
93037
+ const nl = text.indexOf("\n", sliceStart);
93038
+ if (nl !== -1 && nl < text.length - 1) {
93039
+ sliceStart = nl + 1;
93040
+ }
93041
+ }
93042
+ const lines = wrapToVisualLines(text.slice(sliceStart), width);
93043
+ return lines.slice(-maxLines).join("\n");
93044
+ }
93045
+ __name(tailVisualLines, "tailVisualLines");
93046
+ function formatDuration2(ms) {
93047
+ const totalSeconds = Math.round(ms / 1e3);
93048
+ if (totalSeconds < 60) {
93049
+ return `${totalSeconds}s`;
93050
+ }
93051
+ const minutes = Math.floor(totalSeconds / 60);
93052
+ const seconds = totalSeconds % 60;
93053
+ return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
93054
+ }
93055
+ __name(formatDuration2, "formatDuration");
92642
93056
  var ThinkMessage = /* @__PURE__ */ __name(({
92643
93057
  text,
92644
93058
  isPending,
93059
+ expanded = false,
92645
93060
  availableTerminalHeight,
92646
- contentWidth
92647
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
92648
- PrefixedMarkdownMessage,
92649
- {
92650
- text,
92651
- prefix: "\u2726",
92652
- prefixColor: theme.text.secondary,
92653
- isPending,
92654
- availableTerminalHeight,
92655
- contentWidth,
92656
- textColor: theme.text.secondary
93061
+ contentWidth,
93062
+ durationMs
93063
+ }) => {
93064
+ const durationSuffix = durationMs != null ? ` ${formatDuration2(durationMs)}` : "";
93065
+ if (!isPending && !expanded) {
93066
+ const label = durationMs != null ? `${t("Thought for")} ${formatDuration2(durationMs)}` : t("Thinking");
93067
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { dimColor: true, italic: true, children: label });
93068
+ }
93069
+ if (isPending) {
93070
+ const innerWidth = Math.max(contentWidth - 2, 20);
93071
+ const maxLines = availableTerminalHeight != null ? Math.max(
93072
+ 1,
93073
+ Math.min(
93074
+ MAX_STREAMING_THINKING_VISUAL_LINES,
93075
+ Math.floor(availableTerminalHeight / 3)
93076
+ )
93077
+ ) : MAX_STREAMING_THINKING_VISUAL_LINES;
93078
+ const display = tailVisualLines(text, innerWidth, maxLines);
93079
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", children: [
93080
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { dimColor: true, italic: true, children: [
93081
+ "\u27E1 ",
93082
+ t("Thinking"),
93083
+ "\u2026",
93084
+ durationSuffix
93085
+ ] }),
93086
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { dimColor: true, wrap: "truncate", children: display }) })
93087
+ ] });
92657
93088
  }
92658
- ), "ThinkMessage");
93089
+ const expandedLabel = durationMs != null ? `${t("Thought for")} ${formatDuration2(durationMs)}` : `${t("Thinking")}\u2026`;
93090
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box_default, { flexDirection: "column", children: [
93091
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { dimColor: true, italic: true, children: expandedLabel }),
93092
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { paddingLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
93093
+ MarkdownDisplay,
93094
+ {
93095
+ text,
93096
+ isPending: false,
93097
+ availableTerminalHeight,
93098
+ contentWidth: contentWidth - 2,
93099
+ textColor: theme.text.secondary
93100
+ }
93101
+ ) })
93102
+ ] });
93103
+ }, "ThinkMessage");
92659
93104
  var ThinkMessageContent = /* @__PURE__ */ __name(({
92660
93105
  text,
92661
93106
  isPending,
93107
+ expanded = false,
92662
93108
  availableTerminalHeight,
92663
93109
  contentWidth
92664
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
92665
- ContinuationMarkdownMessage,
92666
- {
92667
- text,
92668
- isPending,
92669
- availableTerminalHeight,
92670
- contentWidth,
92671
- basePrefix: "\u2726",
92672
- textColor: theme.text.secondary
93110
+ }) => {
93111
+ if (!isPending && !expanded) {
93112
+ return null;
93113
+ }
93114
+ if (isPending) {
93115
+ const innerWidth = Math.max(contentWidth - 2, 20);
93116
+ const maxLines = availableTerminalHeight != null ? Math.max(
93117
+ 1,
93118
+ Math.min(
93119
+ MAX_STREAMING_THINKING_VISUAL_LINES,
93120
+ Math.floor(availableTerminalHeight / 3)
93121
+ )
93122
+ ) : MAX_STREAMING_THINKING_VISUAL_LINES;
93123
+ const display = tailVisualLines(text, innerWidth, maxLines);
93124
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { dimColor: true, wrap: "truncate", children: display }) });
92673
93125
  }
92674
- ), "ThinkMessageContent");
93126
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box_default, { paddingLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
93127
+ MarkdownDisplay,
93128
+ {
93129
+ text,
93130
+ isPending: false,
93131
+ availableTerminalHeight,
93132
+ contentWidth: contentWidth - 2,
93133
+ textColor: theme.text.secondary
93134
+ }
93135
+ ) });
93136
+ }, "ThinkMessageContent");
92675
93137
 
92676
93138
  // packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
92677
93139
  init_esbuild_shims();
@@ -93093,7 +93555,7 @@ init_esbuild_shims();
93093
93555
  var import_react58 = __toESM(require_react(), 1);
93094
93556
  import { spawnSync as spawnSync2 } from "node:child_process";
93095
93557
  import fs28 from "node:fs";
93096
- import os18 from "node:os";
93558
+ import os17 from "node:os";
93097
93559
  import pathMod from "node:path";
93098
93560
 
93099
93561
  // packages/cli/src/ui/components/shared/vim-buffer-actions.ts
@@ -95445,7 +95907,7 @@ function useTextBuffer({
95445
95907
  let tmpDir;
95446
95908
  let filePath;
95447
95909
  try {
95448
- tmpDir = fs28.mkdtempSync(pathMod.join(os18.tmpdir(), "qwen-edit-"));
95910
+ tmpDir = fs28.mkdtempSync(pathMod.join(os17.tmpdir(), "qwen-edit-"));
95449
95911
  filePath = pathMod.join(tmpDir, "buffer.txt");
95450
95912
  } catch (err) {
95451
95913
  debugLogger39.error(
@@ -101189,20 +101651,23 @@ var HistoryItemDisplayComponent = /* @__PURE__ */ __name(({
101189
101651
  sourceCopyIndexOffsets
101190
101652
  }
101191
101653
  ),
101192
- !compactMode && itemForDisplay.type === "gemini_thought" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
101654
+ itemForDisplay.type === "gemini_thought" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
101193
101655
  ThinkMessage,
101194
101656
  {
101195
101657
  text: itemForDisplay.text.trimEnd(),
101196
101658
  isPending,
101659
+ expanded: false,
101197
101660
  availableTerminalHeight: availableTerminalHeightGemini ?? availableTerminalHeight,
101198
- contentWidth
101661
+ contentWidth,
101662
+ durationMs: itemForDisplay.durationMs
101199
101663
  }
101200
101664
  ),
101201
- !compactMode && itemForDisplay.type === "gemini_thought_content" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
101665
+ itemForDisplay.type === "gemini_thought_content" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
101202
101666
  ThinkMessageContent,
101203
101667
  {
101204
101668
  text: itemForDisplay.text.trimEnd(),
101205
101669
  isPending,
101670
+ expanded: false,
101206
101671
  availableTerminalHeight: availableTerminalHeightGemini ?? availableTerminalHeight,
101207
101672
  contentWidth
101208
101673
  }
@@ -105930,12 +106395,12 @@ __name(StatusLineDialog, "StatusLineDialog");
105930
106395
  init_esbuild_shims();
105931
106396
  var import_react100 = __toESM(require_react(), 1);
105932
106397
  var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
105933
- function formatTime(seconds) {
106398
+ function formatTime2(seconds) {
105934
106399
  const minutes = Math.floor(seconds / 60);
105935
106400
  const remainingSeconds = seconds % 60;
105936
106401
  return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`;
105937
106402
  }
105938
- __name(formatTime, "formatTime");
106403
+ __name(formatTime2, "formatTime");
105939
106404
  function QwenOAuthProgress({
105940
106405
  onTimeout,
105941
106406
  onCancel,
@@ -106032,7 +106497,7 @@ function QwenOAuthProgress({
106032
106497
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text, { children: [
106033
106498
  t("Time remaining:"),
106034
106499
  " ",
106035
- formatTime(timeRemaining)
106500
+ formatTime2(timeRemaining)
106036
106501
  ] })
106037
106502
  ] }),
106038
106503
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text, { color: theme.text.secondary, children: t("Esc to cancel") }) })
@@ -106060,7 +106525,7 @@ function QwenOAuthProgress({
106060
106525
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text, { children: [
106061
106526
  t("Time remaining:"),
106062
106527
  " ",
106063
- formatTime(timeRemaining)
106528
+ formatTime2(timeRemaining)
106064
106529
  ] })
106065
106530
  ] }),
106066
106531
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text, { color: theme.text.secondary, children: t("Esc to cancel") }) })
@@ -107983,7 +108448,7 @@ __name(TrustDialog, "TrustDialog");
107983
108448
  init_esbuild_shims();
107984
108449
  var import_react108 = __toESM(require_react(), 1);
107985
108450
  import * as fs31 from "node:fs";
107986
- import * as os19 from "node:os";
108451
+ import * as os18 from "node:os";
107987
108452
  import * as nodePath2 from "node:path";
107988
108453
  var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
107989
108454
  function getPermScopeItems() {
@@ -108098,7 +108563,7 @@ function PermissionsDialog({
108098
108563
  const dirCompletions = (0, import_react108.useMemo)(() => {
108099
108564
  const trimmed = newDirInput.trim();
108100
108565
  if (!trimmed) return [];
108101
- const expanded = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) : trimmed;
108566
+ const expanded = trimmed.startsWith("~") ? trimmed.replace(/^~/, os18.homedir()) : trimmed;
108102
108567
  const endsWithSep = expanded.endsWith("/") || expanded.endsWith(nodePath2.sep);
108103
108568
  const searchDir = endsWithSep ? expanded : nodePath2.dirname(expanded);
108104
108569
  const prefix = endsWithSep ? "" : nodePath2.basename(expanded);
@@ -108172,7 +108637,7 @@ function PermissionsDialog({
108172
108637
  const handleAddDirSubmit = (0, import_react108.useCallback)(() => {
108173
108638
  const trimmed = newDirInput.trim();
108174
108639
  if (!trimmed) return;
108175
- const expanded = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) : trimmed;
108640
+ const expanded = trimmed.startsWith("~") ? trimmed.replace(/^~/, os18.homedir()) : trimmed;
108176
108641
  const absoluteExpanded = nodePath2.isAbsolute(expanded) ? expanded : nodePath2.resolve(expanded);
108177
108642
  if (!fs31.existsSync(absoluteExpanded)) {
108178
108643
  setDirInputError(t("Directory does not exist."));
@@ -108840,7 +109305,9 @@ function ModelDialog({
108840
109305
  const availableModelEntries = (0, import_react109.useMemo)(() => {
108841
109306
  const allModels = config ? config.getAllConfiguredModels() : [];
108842
109307
  const runtimeModels = allModels.filter((m) => m.isRuntimeModel);
108843
- const registryModels = allModels.filter((m) => !m.isRuntimeModel);
109308
+ const registryModels = allModels.filter(
109309
+ (m) => !m.isRuntimeModel && (m.authType !== "qwen-oauth" /* QWEN_OAUTH */ || authType === "qwen-oauth" /* QWEN_OAUTH */)
109310
+ );
108844
109311
  const modelsByAuthTypeMap = /* @__PURE__ */ new Map();
108845
109312
  for (const model of registryModels) {
108846
109313
  const authType2 = model.authType;
@@ -108875,7 +109342,7 @@ function ModelDialog({
108875
109342
  }
108876
109343
  }
108877
109344
  return result;
108878
- }, [config]);
109345
+ }, [authType, config]);
108879
109346
  const MODEL_OPTIONS = (0, import_react109.useMemo)(
108880
109347
  () => availableModelEntries.map(
108881
109348
  ({ authType: t2, model, isRuntime, snapshotId }) => {
@@ -109747,11 +110214,11 @@ var import_react113 = __toESM(require_react(), 1);
109747
110214
  var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
109748
110215
  var STATUS_REFRESH_INTERVAL_MS = 2e3;
109749
110216
  var IN_PROCESS_REFRESH_INTERVAL_MS = 1e3;
109750
- function truncate(str, maxLen) {
110217
+ function truncate2(str, maxLen) {
109751
110218
  if (str.length <= maxLen) return str;
109752
110219
  return str.slice(0, maxLen - 1) + "\u2026";
109753
110220
  }
109754
- __name(truncate, "truncate");
110221
+ __name(truncate2, "truncate");
109755
110222
  function pad(str, len, align2 = "left") {
109756
110223
  if (str.length >= len) return str.slice(0, len);
109757
110224
  const padding = " ".repeat(len - str.length);
@@ -109878,7 +110345,7 @@ function ArenaStatusDialog({
109878
110345
  const successfulToolCalls = live?.successfulToolCalls ?? agent.stats.successfulToolCalls;
109879
110346
  const failedToolCalls = live?.failedToolCalls ?? agent.stats.failedToolCalls;
109880
110347
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Box_default, { children: [
109881
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { color: theme.text.primary, children: truncate(label, MAX_MODEL_NAME_LENGTH) }) }),
110348
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { color: theme.text.primary, children: truncate2(label, MAX_MODEL_NAME_LENGTH) }) }),
109882
110349
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { width: colStatus, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { color: color2, children: statusText }) }),
109883
110350
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { width: colTime, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { color: theme.text.primary, children: pad(formatDuration(elapsed), colTime - 1, "right") }) }),
109884
110351
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { width: colTokens, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { color: theme.text.primary, children: pad(totalTokens.toLocaleString(), colTokens - 1, "right") }) }),
@@ -112378,11 +112845,11 @@ function sortSkills(skills) {
112378
112845
  );
112379
112846
  }
112380
112847
  __name(sortSkills, "sortSkills");
112381
- function truncate2(text, max) {
112848
+ function truncate3(text, max) {
112382
112849
  if (text.length <= max) return text;
112383
112850
  return `${text.slice(0, Math.max(0, max - 1))}\u2026`;
112384
112851
  }
112385
- __name(truncate2, "truncate");
112852
+ __name(truncate3, "truncate");
112386
112853
  function SkillsManagerDialog({
112387
112854
  settings,
112388
112855
  config,
@@ -112473,7 +112940,7 @@ function SkillsManagerDialog({
112473
112940
  () => filteredUnlocked.map((s) => ({
112474
112941
  key: s.name,
112475
112942
  value: { name: s.name, description: s.description, level: s.level },
112476
- label: `${truncate2(s.name, NAME_COLUMN).padEnd(NAME_COLUMN)} ${truncate2(
112943
+ label: `${truncate3(s.name, NAME_COLUMN).padEnd(NAME_COLUMN)} ${truncate3(
112477
112944
  s.description,
112478
112945
  80
112479
112946
  )} (${levelLabel(s.level)})`
@@ -112718,8 +113185,8 @@ function SkillsManagerDialog({
112718
113185
  filteredLocked.map((s) => {
112719
113186
  const scopeName = higher.scopeOf(s.name) ?? t("higher scope");
112720
113187
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Text, { dimColor: true, wrap: "truncate", children: t(" {{name}} {{description}} [locked: {{scope}}]", {
112721
- name: truncate2(s.name, NAME_COLUMN).padEnd(NAME_COLUMN),
112722
- description: truncate2(s.description, 60),
113188
+ name: truncate3(s.name, NAME_COLUMN).padEnd(NAME_COLUMN),
113189
+ description: truncate3(s.description, 60),
112723
113190
  scope: scopeName
112724
113191
  }) }, s.name);
112725
113192
  })
@@ -117862,7 +118329,7 @@ function convertToHistoryItems(conversation, config) {
117862
118329
  }
117863
118330
  case "assistant": {
117864
118331
  const parts = record.message?.parts;
117865
- const thoughtText = !config || !config.getContentGenerator().useSummarizedThinking() ? extractThoughtTextFromParts(parts) : "";
118332
+ const thoughtText = !config ? extractThoughtTextFromParts(parts) : "";
117866
118333
  const text = extractTextFromParts(parts);
117867
118334
  const functionCalls = extractFunctionCalls(parts);
117868
118335
  if (thoughtText) {
@@ -119339,7 +119806,7 @@ __name(emptyMessage, "emptyMessage");
119339
119806
  init_esbuild_shims();
119340
119807
  var import_react146 = __toESM(require_react(), 1);
119341
119808
  import fs32 from "node:fs/promises";
119342
- import os20 from "node:os";
119809
+ import os19 from "node:os";
119343
119810
  import path39 from "node:path";
119344
119811
  import { spawnSync as spawnSync4 } from "node:child_process";
119345
119812
  var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
@@ -119391,7 +119858,7 @@ async function ensureFileExists(filePath) {
119391
119858
  }
119392
119859
  __name(ensureFileExists, "ensureFileExists");
119393
119860
  function formatDisplayPath(filePath) {
119394
- const home = os20.homedir();
119861
+ const home = os19.homedir();
119395
119862
  if (filePath.startsWith(home)) {
119396
119863
  return `~${filePath.slice(home.length)}`;
119397
119864
  }
@@ -119726,6 +120193,8 @@ function entryId(entry) {
119726
120193
  return entry.shellId;
119727
120194
  case "monitor":
119728
120195
  return entry.monitorId;
120196
+ case "workflow":
120197
+ return entry.runId;
119729
120198
  case "dream":
119730
120199
  return entry.dreamId;
119731
120200
  default: {
@@ -119744,6 +120213,7 @@ function useBackgroundTaskView(config) {
119744
120213
  const agentRegistry = config.getBackgroundTaskRegistry();
119745
120214
  const shellRegistry = config.getBackgroundShellRegistry();
119746
120215
  const monitorRegistry = config.getMonitorRegistry();
120216
+ const workflowRegistry = config.getWorkflowRunRegistry();
119747
120217
  const memoryManager = config.getMemoryManager();
119748
120218
  const projectRoot = config.getProjectRoot();
119749
120219
  let lastDreamSig = "";
@@ -119752,6 +120222,7 @@ function useBackgroundTaskView(config) {
119752
120222
  const agentEntries = [...agentRegistry.getAll()];
119753
120223
  const shellEntries = [...shellRegistry.getAll()];
119754
120224
  const monitorEntries = [...monitorRegistry.getAll()];
120225
+ const workflowEntries = [...workflowRegistry.list()];
119755
120226
  const allDreams = dreamSnapshot ?? memoryManager.listTasksByType("dream", projectRoot);
119756
120227
  const runningDreams = allDreams.filter((t2) => t2.status === "running");
119757
120228
  const terminalDreams = allDreams.filter(
@@ -119784,6 +120255,7 @@ function useBackgroundTaskView(config) {
119784
120255
  ...agentEntries,
119785
120256
  ...shellEntries,
119786
120257
  ...monitorEntries,
120258
+ ...workflowEntries,
119787
120259
  ...dreamEntries
119788
120260
  ].sort((a, b) => {
119789
120261
  const aActive = isActive(a);
@@ -119800,6 +120272,7 @@ function useBackgroundTaskView(config) {
119800
120272
  agentRegistry.setStatusChangeCallback(refreshFromRegistry);
119801
120273
  shellRegistry.setStatusChangeCallback(refreshFromRegistry);
119802
120274
  monitorRegistry.setStatusChangeCallback(refreshFromRegistry);
120275
+ workflowRegistry.setStatusChangeCallback(refreshFromRegistry);
119803
120276
  agentRegistry.setApprovalChangeCallback(refreshFromRegistry);
119804
120277
  const memoryListener = /* @__PURE__ */ __name(() => {
119805
120278
  const dreams = memoryManager.listTasksByType("dream", projectRoot);
@@ -119814,6 +120287,7 @@ function useBackgroundTaskView(config) {
119814
120287
  agentRegistry.setStatusChangeCallback(void 0);
119815
120288
  shellRegistry.setStatusChangeCallback(void 0);
119816
120289
  monitorRegistry.setStatusChangeCallback(void 0);
120290
+ workflowRegistry.setStatusChangeCallback(void 0);
119817
120291
  agentRegistry.setApprovalChangeCallback(void 0);
119818
120292
  unsubscribeMemory();
119819
120293
  };
@@ -119948,6 +120422,9 @@ function BackgroundTaskViewProvider({
119948
120422
  }
119949
120423
  break;
119950
120424
  }
120425
+ case "workflow":
120426
+ config.getWorkflowRunRegistry().cancel(target.runId, Date.now());
120427
+ break;
119951
120428
  default: {
119952
120429
  const _exhaustive = target;
119953
120430
  throw new Error(
@@ -120124,6 +120601,12 @@ function rowLabel(entry) {
120124
120601
  return `${SHELL_ROW_PREFIX} ${entry.command}`;
120125
120602
  case "monitor":
120126
120603
  return `[monitor] ${entry.description}`;
120604
+ case "workflow": {
120605
+ const label = entry.meta?.name ?? entry.runId;
120606
+ const phase = entry.currentPhase ? ` \xB7 ${entry.currentPhase}` : "";
120607
+ const counts = entry.agentsDispatched > 0 ? ` (${entry.agentsCompleted}/${entry.agentsDispatched})` : "";
120608
+ return `[workflow] ${label}${phase}${counts}`;
120609
+ }
120127
120610
  case "dream":
120128
120611
  return formatDreamRowLabel(entry);
120129
120612
  default: {
@@ -120238,6 +120721,15 @@ var DetailBody = /* @__PURE__ */ __name(({ entry, maxHeight, maxWidth }) => {
120238
120721
  maxWidth
120239
120722
  }
120240
120723
  );
120724
+ case "workflow":
120725
+ return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
120726
+ WorkflowDetailBody,
120727
+ {
120728
+ entry,
120729
+ maxHeight,
120730
+ maxWidth
120731
+ }
120732
+ );
120241
120733
  case "dream":
120242
120734
  return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
120243
120735
  DreamDetailBody,
@@ -120496,6 +120988,69 @@ var MonitorDetailBody = /* @__PURE__ */ __name(({ entry, maxHeight, maxWidth })
120496
120988
  }
120497
120989
  );
120498
120990
  }, "MonitorDetailBody");
120991
+ var MAX_VISIBLE_PHASES = 20;
120992
+ var MAX_VISIBLE_LOG_LINES = 10;
120993
+ var WorkflowDetailBody = /* @__PURE__ */ __name(({ entry, maxHeight, maxWidth }) => {
120994
+ const title = `${t("Workflow")} \u203A ${entry.meta?.name ?? entry.runId}`;
120995
+ const terminal = terminalStatusPresentation(entry.status);
120996
+ const dimSubtitleParts = [elapsedFor(entry)];
120997
+ if (entry.agentsDispatched > 0) {
120998
+ dimSubtitleParts.push(
120999
+ `${entry.agentsCompleted}/${entry.agentsDispatched} ${t("agents")}`
121000
+ );
121001
+ }
121002
+ dimSubtitleParts.push(
121003
+ `${entry.phases.length} ${entry.phases.length === 1 ? t("phase") : t("phases")}`
121004
+ );
121005
+ const phaseOverflow = Math.max(0, entry.phases.length - MAX_VISIBLE_PHASES);
121006
+ const visiblePhases = entry.phases.slice(-MAX_VISIBLE_PHASES);
121007
+ const logOverflow = Math.max(
121008
+ 0,
121009
+ entry.recentLogs.length - MAX_VISIBLE_LOG_LINES
121010
+ );
121011
+ const visibleLogs = entry.recentLogs.slice(-MAX_VISIBLE_LOG_LINES);
121012
+ const hasError = Boolean(entry.error);
121013
+ return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
121014
+ MaxSizedBox,
121015
+ {
121016
+ maxHeight,
121017
+ maxWidth,
121018
+ overflowDirection: "bottom",
121019
+ children: [
121020
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { bold: true, color: theme.text.accent, children: title }) }),
121021
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(Box_default, { children: [
121022
+ terminal && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { color: terminal.color, children: `${terminal.icon} ${statusVerb(entry.status)} \xB7 ` }),
121023
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { color: theme.text.secondary, children: dimSubtitleParts.join(" \xB7 ") })
121024
+ ] }),
121025
+ entry.meta?.description && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_react149.Fragment, { children: [
121026
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, {}),
121027
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { wrap: "wrap", children: entry.meta.description }) })
121028
+ ] }),
121029
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, {}),
121030
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { bold: true, dimColor: true, children: t("Phases") }) }),
121031
+ entry.phases.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { dimColor: true, children: t("(no phase recorded yet)") }) }) : /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_react149.Fragment, { children: [
121032
+ phaseOverflow > 0 && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { dimColor: true, children: `+${phaseOverflow} ${t("more above")}` }) }),
121033
+ visiblePhases.map((phaseTitle, i) => {
121034
+ const isCurrent = entry.status === "running" && i === visiblePhases.length - 1 && entry.currentPhase === phaseTitle;
121035
+ const marker = isCurrent ? "\u25B8" : "\xB7";
121036
+ return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { color: isCurrent ? theme.status.success : void 0, children: ` ${marker} ${phaseTitle}` }) }, `${phaseTitle}-${i}`);
121037
+ })
121038
+ ] }),
121039
+ entry.recentLogs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_react149.Fragment, { children: [
121040
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, {}),
121041
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { bold: true, dimColor: true, children: t("Logs") }) }),
121042
+ logOverflow > 0 && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { dimColor: true, children: `+${logOverflow} ${t("more above")}` }) }),
121043
+ visibleLogs.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { wrap: "truncate-end", dimColor: true, children: line }) }, `log-${i}`))
121044
+ ] }),
121045
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_react149.Fragment, { children: [
121046
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, {}),
121047
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { bold: true, color: theme.status.error, children: t("Error") }) }),
121048
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Text, { color: theme.status.error, wrap: "wrap", children: entry.error }) })
121049
+ ] })
121050
+ ]
121051
+ }
121052
+ );
121053
+ }, "WorkflowDetailBody");
120499
121054
  var BackgroundTasksDialog = /* @__PURE__ */ __name(({
120500
121055
  availableTerminalHeight,
120501
121056
  terminalWidth
@@ -121318,7 +121873,6 @@ var LoadingIndicator = /* @__PURE__ */ __name(({
121318
121873
  currentLoadingPhrase,
121319
121874
  elapsedTime,
121320
121875
  rightContent,
121321
- thought,
121322
121876
  candidatesTokens,
121323
121877
  streamingCharsRef,
121324
121878
  isStreaming,
@@ -121335,7 +121889,7 @@ var LoadingIndicator = /* @__PURE__ */ __name(({
121335
121889
  if (streamingState === "idle" /* Idle */) {
121336
121890
  return null;
121337
121891
  }
121338
- const primaryText = thought?.subject || currentLoadingPhrase;
121892
+ const primaryText = currentLoadingPhrase;
121339
121893
  const streamingTokens = streamingCharsRef ? Math.round(animatedChars / 4) : 0;
121340
121894
  const outputTokens = (candidatesTokens ?? 0) + streamingTokens;
121341
121895
  const showTokens = !isNarrow && outputTokens > 0;
@@ -125056,6 +125610,7 @@ var KIND_NAMES = {
125056
125610
  agent: { singular: "local agent", plural: "local agents" },
125057
125611
  shell: { singular: "shell", plural: "shells" },
125058
125612
  monitor: { singular: "monitor", plural: "monitors" },
125613
+ workflow: { singular: "workflow", plural: "workflows" },
125059
125614
  dream: { singular: "dream", plural: "dreams" }
125060
125615
  };
125061
125616
  function hasPendingApproval(entries) {
@@ -125080,12 +125635,13 @@ function getPillLabel(entries) {
125080
125635
  }
125081
125636
  __name(getPillLabel, "getPillLabel");
125082
125637
  function groupAndFormat(entries) {
125083
- const counts = { agent: 0, shell: 0, monitor: 0, dream: 0 };
125638
+ const counts = { agent: 0, shell: 0, monitor: 0, workflow: 0, dream: 0 };
125084
125639
  for (const e of entries) counts[e.kind]++;
125085
125640
  const parts = [];
125086
125641
  if (counts.shell > 0) parts.push(formatCount("shell", counts.shell));
125087
125642
  if (counts.agent > 0) parts.push(formatCount("agent", counts.agent));
125088
125643
  if (counts.monitor > 0) parts.push(formatCount("monitor", counts.monitor));
125644
+ if (counts.workflow > 0) parts.push(formatCount("workflow", counts.workflow));
125089
125645
  if (counts.dream > 0) parts.push(formatCount("dream", counts.dream));
125090
125646
  return parts.join(", ");
125091
125647
  }
@@ -125994,7 +126550,6 @@ var Composer = /* @__PURE__ */ __name(() => {
125994
126550
  !uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
125995
126551
  LoadingIndicator,
125996
126552
  {
125997
- thought: uiState.streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ || config.getAccessibility()?.enableLoadingPhrases === false ? void 0 : uiState.thought,
125998
126553
  currentLoadingPhrase: config.getAccessibility()?.enableLoadingPhrases === false ? void 0 : uiState.currentLoadingPhrase,
125999
126554
  elapsedTime: uiState.elapsedTime,
126000
126555
  candidatesTokens: agentTokens,
@@ -127444,12 +127999,12 @@ import process38 from "node:process";
127444
127999
  init_esbuild_shims();
127445
128000
  var import_react184 = __toESM(require_react(), 1);
127446
128001
  import process25 from "node:process";
127447
- import os21 from "node:os";
128002
+ import os20 from "node:os";
127448
128003
  import v82 from "v8";
127449
128004
  var debugLogger61 = createDebugLogger("MEMORY_MONITOR");
127450
128005
  var MEMORY_WARNING_THRESHOLD = Math.min(
127451
128006
  7 * 1024 * 1024 * 1024,
127452
- Math.floor(os21.totalmem() * 0.85)
128007
+ Math.floor(os20.totalmem() * 0.85)
127453
128008
  );
127454
128009
  var MEMORY_UI_COMPACT_THRESHOLD = /* @__PURE__ */ __name(() => Math.floor(v82.getHeapStatistics().heap_size_limit * 0.65), "MEMORY_UI_COMPACT_THRESHOLD");
127455
128010
  var MEMORY_CHECK_INTERVAL = 60 * 1e3;
@@ -129161,7 +129716,7 @@ init_esbuild_shims();
129161
129716
  var import_react198 = __toESM(require_react(), 1);
129162
129717
  import crypto4 from "node:crypto";
129163
129718
  import path42 from "node:path";
129164
- import os22 from "node:os";
129719
+ import os21 from "node:os";
129165
129720
  import fs36 from "node:fs";
129166
129721
  var OUTPUT_UPDATE_INTERVAL_MS = 1e3;
129167
129722
  var MAX_OUTPUT_LENGTH = 1e4;
@@ -129199,14 +129754,14 @@ var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPend
129199
129754
  { type: "user_shell", text: rawQuery },
129200
129755
  userMessageTimestamp
129201
129756
  );
129202
- const isWindows4 = os22.platform() === "win32";
129757
+ const isWindows4 = os21.platform() === "win32";
129203
129758
  const targetDir = config.getTargetDir();
129204
129759
  let commandToExecute = rawQuery;
129205
129760
  let pwdFilePath;
129206
129761
  if (!isWindows4) {
129207
129762
  let command2 = rawQuery.trim();
129208
129763
  const pwdFileName = `shell_pwd_${crypto4.randomBytes(6).toString("hex")}.tmp`;
129209
- pwdFilePath = path42.join(os22.tmpdir(), pwdFileName);
129764
+ pwdFilePath = path42.join(os21.tmpdir(), pwdFileName);
129210
129765
  if (!command2.endsWith(";") && !command2.endsWith("&")) {
129211
129766
  command2 += ";";
129212
129767
  }
@@ -129882,6 +130437,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
129882
130437
  }, [history]);
129883
130438
  const summaryAbortRefsRef = (0, import_react202.useRef)(/* @__PURE__ */ new Set());
129884
130439
  const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
130440
+ const [pendingThoughtItem, pendingThoughtItemRef, setPendingThoughtItem] = useStateAndRef(null);
130441
+ const thoughtStartTimeRef = (0, import_react202.useRef)(null);
129885
130442
  const [
129886
130443
  pendingRetryErrorItem,
129887
130444
  pendingRetryErrorItemRef,
@@ -130294,7 +130851,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130294
130851
  [setThought]
130295
130852
  );
130296
130853
  const handleThoughtEvent = (0, import_react202.useCallback)(
130297
- (eventValue, currentThoughtBuffer, userMessageTimestamp) => {
130854
+ (eventValue, currentThoughtBuffer) => {
130298
130855
  if (turnCancelledRef.current) {
130299
130856
  return "";
130300
130857
  }
@@ -130302,56 +130859,41 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130302
130859
  if (!thoughtText) {
130303
130860
  return currentThoughtBuffer;
130304
130861
  }
130305
- let newThoughtBuffer = currentThoughtBuffer + thoughtText;
130306
- if (debugLogger66.isEnabled()) {
130307
- debugLogger66.debug(
130308
- `[THOUGHT_BUFFER] Buffer growing: current=${currentThoughtBuffer.length}, incoming=${thoughtText.length}, total=${newThoughtBuffer.length}`
130309
- );
130862
+ const newThoughtBuffer = currentThoughtBuffer + thoughtText;
130863
+ if (newThoughtBuffer.trim().length === 0) {
130864
+ return newThoughtBuffer;
130310
130865
  }
130311
- const pendingType = pendingHistoryItemRef.current?.type;
130312
- const isPendingThought = pendingType === "gemini_thought" || pendingType === "gemini_thought_content";
130313
- let thoughtToMerge = eventValue;
130314
- if (!isPendingThought) {
130315
- if (newThoughtBuffer.trim().length === 0) {
130316
- return newThoughtBuffer;
130317
- }
130318
- if (pendingHistoryItemRef.current) {
130319
- addItem(pendingHistoryItemRef.current, userMessageTimestamp);
130320
- }
130321
- newThoughtBuffer = stripLeadingBlankLines(newThoughtBuffer);
130322
- thoughtToMerge = {
130323
- ...eventValue,
130324
- description: newThoughtBuffer
130325
- };
130326
- setPendingHistoryItem({ type: "gemini_thought", text: "" });
130866
+ const startingNewThought = currentThoughtBuffer.trim().length === 0;
130867
+ const description = startingNewThought ? stripLeadingBlankLines(newThoughtBuffer) : thoughtText;
130868
+ if (startingNewThought) {
130869
+ thoughtStartTimeRef.current = Date.now();
130327
130870
  }
130328
- const splitPoint = findLastSafeSplitPoint(newThoughtBuffer);
130329
- const nextPendingType = isPendingThought && pendingType === "gemini_thought_content" ? "gemini_thought_content" : "gemini_thought";
130330
- if (splitPoint === newThoughtBuffer.length) {
130331
- setPendingHistoryItem({
130332
- type: nextPendingType,
130333
- text: newThoughtBuffer
130334
- });
130335
- } else {
130336
- const beforeText = newThoughtBuffer.substring(0, splitPoint);
130337
- const afterText = newThoughtBuffer.substring(splitPoint);
130338
- addItem(
130339
- {
130340
- type: nextPendingType,
130341
- text: beforeText
130342
- },
130343
- userMessageTimestamp
130344
- );
130345
- setPendingHistoryItem({
130346
- type: "gemini_thought_content",
130347
- text: afterText
130348
- });
130349
- newThoughtBuffer = afterText;
130871
+ mergeThought({
130872
+ ...eventValue,
130873
+ description
130874
+ });
130875
+ setPendingThoughtItem({
130876
+ type: "gemini_thought",
130877
+ text: stripLeadingBlankLines(newThoughtBuffer),
130878
+ durationMs: thoughtStartTimeRef.current ? Date.now() - thoughtStartTimeRef.current : 0
130879
+ });
130880
+ return startingNewThought ? description : newThoughtBuffer;
130881
+ },
130882
+ [mergeThought, setPendingThoughtItem]
130883
+ );
130884
+ const commitPendingThought = (0, import_react202.useCallback)(
130885
+ (userMessageTimestamp) => {
130886
+ if (pendingThoughtItemRef.current) {
130887
+ const item = { ...pendingThoughtItemRef.current };
130888
+ if (item.type === "gemini_thought" && thoughtStartTimeRef.current) {
130889
+ item.durationMs = Date.now() - thoughtStartTimeRef.current;
130890
+ }
130891
+ addItem(item, userMessageTimestamp);
130350
130892
  }
130351
- mergeThought(thoughtToMerge);
130352
- return newThoughtBuffer;
130893
+ setPendingThoughtItem(null);
130894
+ thoughtStartTimeRef.current = null;
130353
130895
  },
130354
- [addItem, pendingHistoryItemRef, setPendingHistoryItem, mergeThought]
130896
+ [addItem, pendingThoughtItemRef, setPendingThoughtItem]
130355
130897
  );
130356
130898
  const handleUserCancelledEvent = (0, import_react202.useCallback)(
130357
130899
  (userMessageTimestamp) => {
@@ -130359,6 +130901,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130359
130901
  return;
130360
130902
  }
130361
130903
  lastPromptErroredRef.current = false;
130904
+ commitPendingThought(userMessageTimestamp);
130362
130905
  if (pendingHistoryItemRef.current) {
130363
130906
  if (pendingHistoryItemRef.current.type === "tool_group") {
130364
130907
  const updatedTools = pendingHistoryItemRef.current.tools.map(
@@ -130384,6 +130927,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130384
130927
  },
130385
130928
  [
130386
130929
  addItem,
130930
+ commitPendingThought,
130387
130931
  pendingHistoryItemRef,
130388
130932
  setPendingHistoryItem,
130389
130933
  setThought,
@@ -130393,6 +130937,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130393
130937
  const handleErrorEvent = (0, import_react202.useCallback)(
130394
130938
  (eventValue, userMessageTimestamp) => {
130395
130939
  lastPromptErroredRef.current = true;
130940
+ commitPendingThought(userMessageTimestamp);
130396
130941
  if (pendingHistoryItemRef.current) {
130397
130942
  addItem(pendingHistoryItemRef.current, userMessageTimestamp);
130398
130943
  setPendingHistoryItem(null);
@@ -130423,6 +130968,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130423
130968
  },
130424
130969
  [
130425
130970
  addItem,
130971
+ commitPendingThought,
130426
130972
  pendingHistoryItemRef,
130427
130973
  setPendingHistoryItem,
130428
130974
  setPendingRetryErrorItem,
@@ -130673,11 +131219,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130673
131219
  description: `${mergedThought.description ?? ""}${queuedThought.value.description ?? ""}`
130674
131220
  };
130675
131221
  }
130676
- thoughtBuffer = handleThoughtEvent(
130677
- mergedThought,
130678
- thoughtBuffer,
130679
- userMessageTimestamp
130680
- );
131222
+ thoughtBuffer = handleThoughtEvent(mergedThought, thoughtBuffer);
130681
131223
  }
130682
131224
  }, "flushBufferedStreamEvents");
130683
131225
  const scheduleBufferedStreamFlush = /* @__PURE__ */ __name(() => {
@@ -130704,11 +131246,20 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130704
131246
  }
130705
131247
  break;
130706
131248
  case "content" /* Content */:
131249
+ if (pendingThoughtItemRef.current || bufferedEvents.some((e) => e.kind === "thought")) {
131250
+ flushBufferedStreamEvents();
131251
+ commitPendingThought(userMessageTimestamp);
131252
+ thoughtBuffer = "";
131253
+ }
131254
+ setThought((prev) => prev ? null : prev);
130707
131255
  bufferedEvents.push({ kind: "content", value: event.value });
130708
131256
  scheduleBufferedStreamFlush();
130709
131257
  break;
130710
131258
  case "tool_call_request" /* ToolCallRequest */:
130711
131259
  flushBufferedStreamEvents();
131260
+ commitPendingThought(userMessageTimestamp);
131261
+ thoughtBuffer = "";
131262
+ setThought((prev) => prev ? null : prev);
130712
131263
  toolCallRequests.push(event.value);
130713
131264
  try {
130714
131265
  const argsJson = JSON.stringify(event.value.args);
@@ -130743,6 +131294,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130743
131294
  break;
130744
131295
  case "finished" /* Finished */:
130745
131296
  flushBufferedStreamEvents();
131297
+ commitPendingThought(userMessageTimestamp);
130746
131298
  handleFinishedEvent(
130747
131299
  event,
130748
131300
  userMessageTimestamp
@@ -130753,6 +131305,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130753
131305
  }
130754
131306
  geminiMessageBuffer = "";
130755
131307
  thoughtBuffer = "";
131308
+ setThought(null);
130756
131309
  break;
130757
131310
  case "citation" /* Citation */:
130758
131311
  flushBufferedStreamEvents();
@@ -130768,8 +131321,10 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130768
131321
  if (pendingHistoryItemRef.current) {
130769
131322
  setPendingHistoryItem(null);
130770
131323
  }
130771
- geminiMessageBuffer = "";
131324
+ commitPendingThought(userMessageTimestamp);
130772
131325
  thoughtBuffer = "";
131326
+ setThought(null);
131327
+ geminiMessageBuffer = "";
130773
131328
  } else {
130774
131329
  flushBufferedStreamEvents();
130775
131330
  }
@@ -130816,6 +131371,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130816
131371
  }
130817
131372
  } finally {
130818
131373
  flushBufferedStreamEvents();
131374
+ commitPendingThought(userMessageTimestamp);
130819
131375
  discardBufferedStreamEvents();
130820
131376
  flushBufferedStreamEventsRef.current.delete(flushBufferedStreamEvents);
130821
131377
  }
@@ -130839,7 +131395,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130839
131395
  startRetryCountdown,
130840
131396
  clearRetryCountdown,
130841
131397
  setThought,
131398
+ commitPendingThought,
130842
131399
  pendingHistoryItemRef,
131400
+ pendingThoughtItemRef,
130843
131401
  setPendingHistoryItem,
130844
131402
  handleUserPromptSubmitBlockedEvent,
130845
131403
  handleStopHookLoopEvent,
@@ -130926,6 +131484,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
130926
131484
  );
130927
131485
  }
130928
131486
  setThought(null);
131487
+ setPendingThoughtItem(null);
130929
131488
  }
130930
131489
  if (submitType === "retry" /* Retry */) {
130931
131490
  logUserRetry(config, new UserRetryEvent(prompt_id));
@@ -131047,6 +131606,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
131047
131606
  pendingRetryCountdownItemRef,
131048
131607
  pendingRetryErrorItemRef,
131049
131608
  setPendingRetryErrorItem,
131609
+ setPendingThoughtItem,
131050
131610
  dualOutput
131051
131611
  ]
131052
131612
  );
@@ -131289,12 +131849,15 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
131289
131849
  );
131290
131850
  const pendingHistoryItems = (0, import_react202.useMemo)(
131291
131851
  () => [
131852
+ // Reasoning renders above the streaming answer.
131853
+ pendingThoughtItem,
131292
131854
  pendingHistoryItem,
131293
131855
  pendingRetryErrorItem,
131294
131856
  pendingRetryCountdownItem,
131295
131857
  pendingToolCallGroupDisplay
131296
131858
  ].filter((i) => i !== void 0 && i !== null),
131297
131859
  [
131860
+ pendingThoughtItem,
131298
131861
  pendingHistoryItem,
131299
131862
  pendingRetryErrorItem,
131300
131863
  pendingRetryCountdownItem,
@@ -131439,7 +132002,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
131439
132002
  }, [config]);
131440
132003
  (0, import_react202.useEffect)(() => {
131441
132004
  const registry2 = config.getMonitorRegistry();
131442
- registry2.setNotificationCallback((displayText, modelText) => {
132005
+ registry2.setNotificationCallback((displayText, modelText, meta) => {
132006
+ if (meta.status === "running" && typeof registry2.get === "function") {
132007
+ const entry = registry2.get(meta.monitorId);
132008
+ if (!entry || entry.status !== "running") return;
132009
+ }
131443
132010
  notificationQueueRef.current.push({
131444
132011
  displayText,
131445
132012
  modelText,
@@ -131453,13 +132020,32 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
131453
132020
  }, [config]);
131454
132021
  (0, import_react202.useEffect)(() => {
131455
132022
  if (streamingState === "idle" /* Idle */ && !isSubmittingQueryRef.current && notificationQueueRef.current.length > 0) {
131456
- const item = notificationQueueRef.current.shift();
131457
- addItem(
131458
- { type: "notification", text: item.displayText },
131459
- Date.now()
131460
- );
131461
- submitQuery(item.modelText, item.sendMessageType, void 0, {
131462
- notificationDisplayText: item.displayText
132023
+ const queue = notificationQueueRef.current;
132024
+ const targetType = queue[0].sendMessageType;
132025
+ if (targetType === "cron" /* Cron */) {
132026
+ const item = queue.shift();
132027
+ addItem(
132028
+ { type: "notification", text: item.displayText },
132029
+ Date.now()
132030
+ );
132031
+ submitQuery(item.modelText, item.sendMessageType, void 0, {
132032
+ notificationDisplayText: item.displayText
132033
+ });
132034
+ return;
132035
+ }
132036
+ let splitIdx = 0;
132037
+ while (splitIdx < queue.length && queue[splitIdx].sendMessageType === targetType) {
132038
+ splitIdx++;
132039
+ }
132040
+ const batch = queue.splice(0, splitIdx);
132041
+ const now = Date.now();
132042
+ for (const item of batch) {
132043
+ addItem({ type: "notification", text: item.displayText }, now);
132044
+ }
132045
+ const combinedModelText = batch.map((e) => e.modelText).join("\n\n");
132046
+ const combinedDisplayText = batch.map((e) => e.displayText).join("; ");
132047
+ submitQuery(combinedModelText, targetType, void 0, {
132048
+ notificationDisplayText: combinedDisplayText
131463
132049
  });
131464
132050
  }
131465
132051
  }, [streamingState, submitQuery, notificationTrigger, addItem]);
@@ -133706,13 +134292,13 @@ import { format as format3 } from "node:util";
133706
134292
  init_esbuild_shims();
133707
134293
  var import_graceful_fs = __toESM(require_graceful_fs(), 1);
133708
134294
  import path49 from "node:path";
133709
- import os25 from "node:os";
134295
+ import os24 from "node:os";
133710
134296
 
133711
134297
  // node_modules/xdg-basedir/index.js
133712
134298
  init_esbuild_shims();
133713
- import os23 from "os";
134299
+ import os22 from "os";
133714
134300
  import path46 from "path";
133715
- var homeDirectory = os23.homedir();
134301
+ var homeDirectory = os22.homedir();
133716
134302
  var { env: env3 } = process;
133717
134303
  var xdgData = env3.XDG_DATA_HOME || (homeDirectory ? path46.join(homeDirectory, ".local", "share") : void 0);
133718
134304
  var xdgConfig = env3.XDG_CONFIG_HOME || (homeDirectory ? path46.join(homeDirectory, ".config") : void 0);
@@ -133947,14 +134533,14 @@ var dist_default6 = FS;
133947
134533
 
133948
134534
  // node_modules/atomically/dist/constants.js
133949
134535
  init_esbuild_shims();
133950
- import os24 from "node:os";
134536
+ import os23 from "node:os";
133951
134537
  import process30 from "node:process";
133952
134538
  var DEFAULT_ENCODING = "utf8";
133953
134539
  var DEFAULT_FILE_MODE = 438;
133954
134540
  var DEFAULT_FOLDER_MODE = 511;
133955
134541
  var DEFAULT_WRITE_OPTIONS = {};
133956
- var DEFAULT_USER_UID = os24.userInfo().uid;
133957
- var DEFAULT_USER_GID = os24.userInfo().gid;
134542
+ var DEFAULT_USER_UID = os23.userInfo().uid;
134543
+ var DEFAULT_USER_GID = os23.userInfo().gid;
133958
134544
  var DEFAULT_TIMEOUT_SYNC = 1e3;
133959
134545
  var IS_POSIX = !!process30.getuid;
133960
134546
  var IS_USER_ROOT2 = process30.getuid ? !process30.getuid() : false;
@@ -134407,7 +134993,7 @@ __name(hasProperty, "hasProperty");
134407
134993
  // node_modules/configstore/index.js
134408
134994
  function getConfigDirectory(id, globalConfigPath) {
134409
134995
  const pathPrefix = globalConfigPath ? path49.join(id, "config.json") : path49.join("configstore", `${id}.json`);
134410
- const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os25.tmpdir()) + path49.sep);
134996
+ const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os24.tmpdir()) + path49.sep);
134411
134997
  return path49.join(configDirectory, pathPrefix);
134412
134998
  }
134413
134999
  __name(getConfigDirectory, "getConfigDirectory");
@@ -134686,7 +135272,7 @@ var ansi_styles_default5 = ansiStyles5;
134686
135272
  // node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.js
134687
135273
  init_esbuild_shims();
134688
135274
  import process33 from "node:process";
134689
- import os26 from "node:os";
135275
+ import os25 from "node:os";
134690
135276
  import tty3 from "node:tty";
134691
135277
  function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process33.argv) {
134692
135278
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -134754,7 +135340,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
134754
135340
  return min;
134755
135341
  }
134756
135342
  if (process33.platform === "win32") {
134757
- const osRelease = os26.release().split(".");
135343
+ const osRelease = os25.release().split(".");
134758
135344
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
134759
135345
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
134760
135346
  }
@@ -135751,7 +136337,7 @@ init_esbuild_shims();
135751
136337
  var import_ini = __toESM(require_ini3(), 1);
135752
136338
  import process35 from "node:process";
135753
136339
  import path50 from "node:path";
135754
- import os27 from "node:os";
136340
+ import os26 from "node:os";
135755
136341
  import fs41 from "node:fs";
135756
136342
  var isWindows3 = process35.platform === "win32";
135757
136343
  var readRc = /* @__PURE__ */ __name((filePath) => {
@@ -135786,7 +136372,7 @@ var getNpmPrefix = /* @__PURE__ */ __name(() => {
135786
136372
  if (envPrefix) {
135787
136373
  return envPrefix;
135788
136374
  }
135789
- const homePrefix = readRc(path50.join(os27.homedir(), ".npmrc"));
136375
+ const homePrefix = readRc(path50.join(os26.homedir(), ".npmrc"));
135790
136376
  if (homePrefix) {
135791
136377
  return homePrefix;
135792
136378
  }
@@ -135817,11 +136403,11 @@ var getYarnPrefix = /* @__PURE__ */ __name(() => {
135817
136403
  if (windowsPrefix) {
135818
136404
  return windowsPrefix;
135819
136405
  }
135820
- const configPrefix = path50.join(os27.homedir(), ".config/yarn");
136406
+ const configPrefix = path50.join(os26.homedir(), ".config/yarn");
135821
136407
  if (fs41.existsSync(configPrefix)) {
135822
136408
  return configPrefix;
135823
136409
  }
135824
- const homePrefix = path50.join(os27.homedir(), ".yarn-config");
136410
+ const homePrefix = path50.join(os26.homedir(), ".yarn-config");
135825
136411
  if (fs41.existsSync(homePrefix)) {
135826
136412
  return homePrefix;
135827
136413
  }
@@ -136954,7 +137540,7 @@ import { spawn as spawn6 } from "node:child_process";
136954
137540
  var spawnWrapper = spawn6;
136955
137541
 
136956
137542
  // packages/cli/src/utils/handleAutoUpdate.ts
136957
- import os28 from "node:os";
137543
+ import os27 from "node:os";
136958
137544
  var UPDATE_SUCCESS_MESSAGE = "Update successful! Please restart Qwen Code to use the new version. Switching model providers before restarting may not work correctly.";
136959
137545
  var UPDATE_FAILED_MESSAGE = "Automatic update failed. Please try updating manually.";
136960
137546
  function handleAutoUpdate(info, settings, projectRoot, spawnFn = spawnWrapper) {
@@ -136993,7 +137579,7 @@ ${installationInfo.updateMessage}`;
136993
137579
  "@latest",
136994
137580
  isNightly ? "@nightly" : `@${info.update.latest}`
136995
137581
  );
136996
- const isWindows4 = os28.platform() === "win32";
137582
+ const isWindows4 = os27.platform() === "win32";
136997
137583
  const shell = isWindows4 ? "cmd.exe" : "bash";
136998
137584
  const shellArgs = isWindows4 ? ["/c", updateCommand2] : ["-c", updateCommand2];
136999
137585
  const updateProcess = spawnFn(shell, shellArgs, { stdio: "pipe" });
@@ -138251,6 +138837,10 @@ function dedupeNewestFirst(messages) {
138251
138837
  return result;
138252
138838
  }
138253
138839
  __name(dedupeNewestFirst, "dedupeNewestFirst");
138840
+ function mergeStartupWarnings(currentWarnings, nextWarnings) {
138841
+ return [.../* @__PURE__ */ new Set([...currentWarnings, ...nextWarnings])];
138842
+ }
138843
+ __name(mergeStartupWarnings, "mergeStartupWarnings");
138254
138844
  var SHELL_WIDTH_FRACTION = 0.89;
138255
138845
  var SHELL_HEIGHT_PADDING = 10;
138256
138846
  var AppContainer = /* @__PURE__ */ __name((props) => {
@@ -138383,6 +138973,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
138383
138973
  computeWindowTitle(basename11(config.getTargetDir()))
138384
138974
  );
138385
138975
  const lastTitleRef = (0, import_react230.useRef)(null);
138976
+ const [startupWarnings, setStartupWarnings] = (0, import_react230.useState)(
138977
+ () => props.startupWarnings || []
138978
+ );
138386
138979
  const staticExtraHeight = 3;
138387
138980
  (0, import_react230.useEffect)(() => {
138388
138981
  void loadLowlight().catch((err) => {
@@ -138395,6 +138988,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
138395
138988
  (async () => {
138396
138989
  profileCheckpoint("config_initialize_start");
138397
138990
  await config.initialize();
138991
+ setStartupWarnings(
138992
+ (currentWarnings) => mergeStartupWarnings(currentWarnings, config.getWarnings())
138993
+ );
138398
138994
  profileCheckpoint("config_initialize_end");
138399
138995
  setConfigInitialized(true);
138400
138996
  profileCheckpoint("input_enabled");
@@ -140693,7 +141289,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
140693
141289
  {
140694
141290
  value: {
140695
141291
  version: props.version,
140696
- startupWarnings: props.startupWarnings || []
141292
+ startupWarnings
140697
141293
  },
140698
141294
  children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(CompactModeProvider, { value: compactModeValue, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(RenderModeProvider, { value: renderModeValue, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TerminalOutputProvider, { value: writeRaw, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(App2, {}) }) }) }) })
140699
141295
  }
@@ -140830,7 +141426,7 @@ __name(relaunchAppInChildProcess, "relaunchAppInChildProcess");
140830
141426
  init_esbuild_shims();
140831
141427
  var import_shell_quote = __toESM(require_shell_quote(), 1);
140832
141428
  import { exec as exec7, execSync as execSync5, spawn as spawn8 } from "node:child_process";
140833
- import os29 from "node:os";
141429
+ import os28 from "node:os";
140834
141430
  import path56 from "node:path";
140835
141431
  import fs46 from "node:fs";
140836
141432
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -140838,7 +141434,7 @@ import { promisify as promisify3 } from "node:util";
140838
141434
  import { randomBytes } from "node:crypto";
140839
141435
  var execAsync2 = promisify3(exec7);
140840
141436
  function getContainerPath(hostPath) {
140841
- if (os29.platform() !== "win32") {
141437
+ if (os28.platform() !== "win32") {
140842
141438
  return hostPath;
140843
141439
  }
140844
141440
  const withForwardSlashes = hostPath.replace(/\\/g, "/");
@@ -140875,7 +141471,7 @@ async function shouldUseCurrentUserInSandbox() {
140875
141471
  if (envVar === "0" || envVar === "false") {
140876
141472
  return false;
140877
141473
  }
140878
- if (os29.platform() === "linux") {
141474
+ if (os28.platform() === "linux") {
140879
141475
  const debugEnv = [process.env["DEBUG"], process.env["DEBUG_MODE"]].some(
140880
141476
  (v) => v === "true" || v === "1"
140881
141477
  );
@@ -140900,7 +141496,7 @@ function ports() {
140900
141496
  }
140901
141497
  __name(ports, "ports");
140902
141498
  function entrypoint(workdir, cliArgs) {
140903
- const isWindows4 = os29.platform() === "win32";
141499
+ const isWindows4 = os28.platform() === "win32";
140904
141500
  const containerWorkdir = getContainerPath(workdir);
140905
141501
  const shellCmds = [];
140906
141502
  const pathSeparator = isWindows4 ? ";" : ":";
@@ -140983,9 +141579,9 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
140983
141579
  "-D",
140984
141580
  `TARGET_DIR=${fs46.realpathSync(process.cwd())}`,
140985
141581
  "-D",
140986
- `TMP_DIR=${fs46.realpathSync(os29.tmpdir())}`,
141582
+ `TMP_DIR=${fs46.realpathSync(os28.tmpdir())}`,
140987
141583
  "-D",
140988
- `HOME_DIR=${fs46.realpathSync(os29.homedir())}`,
141584
+ `HOME_DIR=${fs46.realpathSync(os28.homedir())}`,
140989
141585
  "-D",
140990
141586
  `CACHE_DIR=${fs46.realpathSync(execSync5(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`,
140991
141587
  "-D",
@@ -141181,8 +141777,8 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
141181
141777
  if (!runtimeSameAsUserSettings) {
141182
141778
  args.push("--env", `QWEN_RUNTIME_DIR=${runtimeBaseDirContainerPath}`);
141183
141779
  }
141184
- args.push("--volume", `${os29.tmpdir()}:${getContainerPath(os29.tmpdir())}`);
141185
- const gcloudConfigDir = path56.join(os29.homedir(), ".config", "gcloud");
141780
+ args.push("--volume", `${os28.tmpdir()}:${getContainerPath(os28.tmpdir())}`);
141781
+ const gcloudConfigDir = path56.join(os28.homedir(), ".config", "gcloud");
141186
141782
  if (fs46.existsSync(gcloudConfigDir)) {
141187
141783
  args.push(
141188
141784
  "--volume",
@@ -141393,7 +141989,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
141393
141989
  }
141394
141990
  args.push("--env", `SANDBOX=${containerName}`);
141395
141991
  if (config.command === "podman") {
141396
- const emptyAuthFilePath = path56.join(os29.tmpdir(), "empty_auth.json");
141992
+ const emptyAuthFilePath = path56.join(os28.tmpdir(), "empty_auth.json");
141397
141993
  fs46.writeFileSync(emptyAuthFilePath, "{}", "utf-8");
141398
141994
  args.push("--authfile", emptyAuthFilePath);
141399
141995
  }
@@ -141405,7 +142001,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
141405
142001
  const uid = execSync5("id -u").toString().trim();
141406
142002
  const gid = execSync5("id -g").toString().trim();
141407
142003
  const username = "qwen";
141408
- const homeDir = getContainerPath(os29.homedir());
142004
+ const homeDir = getContainerPath(os28.homedir());
141409
142005
  const setupUserCommands = [
141410
142006
  // Use -f with groupadd to avoid errors if the group already exists.
141411
142007
  `groupadd -f -g ${gid} ${username}`,
@@ -141417,7 +142013,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
141417
142013
  const suCommand = `su -p ${username} -c '${escapedOriginalCommand}'`;
141418
142014
  finalEntrypoint[2] = `${setupUserCommands} && ${suCommand}`;
141419
142015
  userFlag = `--user ${uid}:${gid}`;
141420
- args.push("--env", `HOME=${os29.homedir()}`);
142016
+ args.push("--env", `HOME=${os28.homedir()}`);
141421
142017
  } else if (isIntegrationTest) {
141422
142018
  args.push("--user", "root");
141423
142019
  userFlag = "--user root";
@@ -141428,7 +142024,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
141428
142024
  let sandboxProcess = void 0;
141429
142025
  if (proxyCommand) {
141430
142026
  const proxyContainerCommand = `${config.command} run --rm --init ${userFlag} --name ${SANDBOX_PROXY_NAME} --network ${SANDBOX_PROXY_NAME} -p 8877:8877 -v ${process.cwd()}:${workdir} --workdir ${workdir} ${image2} ${proxyCommand}`;
141431
- const isWindows4 = os29.platform() === "win32";
142027
+ const isWindows4 = os28.platform() === "win32";
141432
142028
  const proxyShell = isWindows4 ? "cmd.exe" : "bash";
141433
142029
  const proxyShellArgs = isWindows4 ? ["/c", proxyContainerCommand] : ["-c", proxyContainerCommand];
141434
142030
  proxyProcess = spawn8(proxyShell, proxyShellArgs, {
@@ -141594,9 +142190,9 @@ __name(ensureSandboxImageIsPresent, "ensureSandboxImageIsPresent");
141594
142190
  // packages/cli/src/utils/startupWarnings.ts
141595
142191
  init_esbuild_shims();
141596
142192
  import fs47 from "node:fs/promises";
141597
- import os30 from "node:os";
142193
+ import os29 from "node:os";
141598
142194
  import { join as pathJoin } from "node:path";
141599
- var warningsFilePath = pathJoin(os30.tmpdir(), "qwen-code-warnings.txt");
142195
+ var warningsFilePath = pathJoin(os29.tmpdir(), "qwen-code-warnings.txt");
141600
142196
  async function getStartupWarnings() {
141601
142197
  try {
141602
142198
  await fs47.access(warningsFilePath);
@@ -141620,7 +142216,7 @@ __name(getStartupWarnings, "getStartupWarnings");
141620
142216
  // packages/cli/src/utils/userStartupWarnings.ts
141621
142217
  init_esbuild_shims();
141622
142218
  import fs48 from "node:fs/promises";
141623
- import * as os31 from "node:os";
142219
+ import * as os30 from "node:os";
141624
142220
  import path57 from "node:path";
141625
142221
  var homeDirectoryCheck = {
141626
142222
  id: "home-directory",
@@ -141628,7 +142224,7 @@ var homeDirectoryCheck = {
141628
142224
  try {
141629
142225
  const [workspaceRealPath, homeRealPath] = await Promise.all([
141630
142226
  fs48.realpath(options.workspaceRoot),
141631
- fs48.realpath(os31.homedir())
142227
+ fs48.realpath(os30.homedir())
141632
142228
  ]);
141633
142229
  if (workspaceRealPath === homeRealPath) {
141634
142230
  return "You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory.";
@@ -143651,7 +144247,6 @@ function maskApiKeyForDisplay(apiKey) {
143651
144247
  return `${trimmed.slice(0, 3)}...${trimmed.slice(-4)}`;
143652
144248
  }
143653
144249
  __name(maskApiKeyForDisplay, "maskApiKeyForDisplay");
143654
- var MID_TURN_QUEUE_DRAIN_METHOD = "craft/drainMidTurnQueue";
143655
144250
  var MID_TURN_QUEUE_DRAIN_TIMEOUT_MS = 2e3;
143656
144251
  var MID_TURN_QUEUE_DRAIN_MAX_TIMEOUT_STRIKES = 3;
143657
144252
  var MidTurnDrainTimeoutError = class extends Error {
@@ -145171,7 +145766,10 @@ ${this.pendingWorktreeNotice}
145171
145766
  break;
145172
145767
  }
145173
145768
  const item = this.notificationQueue.shift();
145174
- await this.#executeBackgroundNotificationPrompt(item);
145769
+ await sessionIdContext.run(
145770
+ this.config.getSessionId(),
145771
+ () => this.#executeBackgroundNotificationPromptInner(item)
145772
+ );
145175
145773
  }
145176
145774
  } finally {
145177
145775
  this.notificationProcessing = false;
@@ -145183,12 +145781,6 @@ ${this.pendingWorktreeNotice}
145183
145781
  }
145184
145782
  }
145185
145783
  }
145186
- async #executeBackgroundNotificationPrompt(item) {
145187
- return sessionIdContext.run(
145188
- this.config.getSessionId(),
145189
- () => this.#executeBackgroundNotificationPromptInner(item)
145190
- );
145191
- }
145192
145784
  async #executeBackgroundNotificationPromptInner(item) {
145193
145785
  return Storage.runWithRuntimeBaseDir(
145194
145786
  this.runtimeBaseDir,
@@ -148190,7 +148782,7 @@ var QwenAgent = class {
148190
148782
  async initialize(args) {
148191
148783
  this.clientCapabilities = args.clientCapabilities;
148192
148784
  const authMethods = buildAuthMethods();
148193
- const version = "0.18.1";
148785
+ const version = "0.18.2";
148194
148786
  return {
148195
148787
  protocolVersion: PROTOCOL_VERSION,
148196
148788
  agentInfo: {
@@ -151547,7 +152139,10 @@ ${outputText}
151547
152139
  settings,
151548
152140
  argvForSession,
151549
152141
  cwd5,
151550
- [],
152142
+ // ACP sessions do not provide an extension override. Passing [] is a
152143
+ // truthy override and prevents default/argv extension commands from
152144
+ // loading, so leave it unset to preserve normal CLI behavior.
152145
+ void 0,
151551
152146
  // Pass separated hooks for proper source attribution
151552
152147
  {
151553
152148
  userHooks: this.settings.getUserHooks(),
@@ -151773,7 +152368,7 @@ function validateDnsResolutionOrder(order) {
151773
152368
  }
151774
152369
  __name(validateDnsResolutionOrder, "validateDnsResolutionOrder");
151775
152370
  function getNodeMemoryArgs(isDebugMode3) {
151776
- const totalMemoryMB = os32.totalmem() / (1024 * 1024);
152371
+ const totalMemoryMB = os31.totalmem() / (1024 * 1024);
151777
152372
  const heapStats = v83.getHeapStatistics();
151778
152373
  const currentMaxOldSpaceSizeMb = Math.floor(
151779
152374
  heapStats.heap_size_limit / 1024 / 1024
@@ -152275,7 +152870,7 @@ ${finalArgs[promptIndex + 1]}`;
152275
152870
  process.exit(0);
152276
152871
  }
152277
152872
  if (config.isInteractive()) {
152278
- void import("./chunks/scheduler-O66SLJGU.js").then((m) => m.startBackgroundHousekeeping(config, settings)).catch((err) => {
152873
+ void import("./chunks/scheduler-J3OUGTTS.js").then((m) => m.startBackgroundHousekeeping(config, settings)).catch((err) => {
152279
152874
  debugLogger80.warn("failed to start background housekeeping:", err);
152280
152875
  });
152281
152876
  }
@@ -152295,6 +152890,7 @@ ${finalArgs[promptIndex + 1]}`;
152295
152890
  ] : []
152296
152891
  ])
152297
152892
  ];
152893
+ const emittedStartupWarnings = new Set(startupWarnings);
152298
152894
  for (const warning of startupWarnings) {
152299
152895
  writeStderrLine(warning);
152300
152896
  }
@@ -152339,6 +152935,11 @@ ${finalArgs[promptIndex + 1]}`;
152339
152935
  if (inputFormat !== "stream-json" /* STREAM_JSON */) {
152340
152936
  profileCheckpoint("config_initialize_start");
152341
152937
  await config.initialize();
152938
+ for (const warning of config.getWarnings()) {
152939
+ if (emittedStartupWarnings.has(warning)) continue;
152940
+ emittedStartupWarnings.add(warning);
152941
+ writeStderrLine(warning);
152942
+ }
152342
152943
  profileCheckpoint("config_initialize_end");
152343
152944
  await config.waitForMcpReady();
152344
152945
  const failedMcpServers = typeof config.getFailedMcpServerNames === "function" ? config.getFailedMcpServerNames() : [];