@qwen-code/qwen-code 0.18.1-preview.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 (35) hide show
  1. package/chunks/{agent-ZLVQLNIP.js → agent-P5U6QLWL.js} +2 -2
  2. package/chunks/{agent-headless-H4ZT46GX.js → agent-headless-24356DC7.js} +2 -2
  3. package/chunks/{chunk-L6F7VZPZ.js → chunk-25FFAMED.js} +3 -3
  4. package/chunks/{chunk-UKLVRIWE.js → chunk-EQ5NHJBY.js} +25 -25
  5. package/chunks/{chunk-HISY5FYZ.js → chunk-JZEKEWO5.js} +3 -3
  6. package/chunks/{chunk-R53CLQY7.js → chunk-M7OBURJM.js} +1 -1
  7. package/chunks/{chunk-Q6WOQSR4.js → chunk-NGDXHX3A.js} +1 -1
  8. package/chunks/{chunk-BRU4Z5BG.js → chunk-QFJ67S5R.js} +5 -5
  9. package/chunks/{computer-use-SWC45S44.js → computer-use-EGW2I2HZ.js} +2 -2
  10. package/chunks/{contextCommand-O5DLQUIZ.js → contextCommand-HI2X2Y7I.js} +4 -4
  11. package/chunks/{edit-J7M33W4D.js → edit-FJSOCDO2.js} +2 -2
  12. package/chunks/{enter-worktree-RCCPIOG6.js → enter-worktree-X6MVFDLR.js} +2 -2
  13. package/chunks/{enterPlanMode-EC7HWVXV.js → enterPlanMode-MZAEQZH3.js} +2 -2
  14. package/chunks/{exit-worktree-V3OVN22U.js → exit-worktree-RM2UPOYQ.js} +2 -2
  15. package/chunks/{exitPlanMode-P3F5VTWX.js → exitPlanMode-7BVY3CWJ.js} +2 -2
  16. package/chunks/{geminiContentGenerator-E2LZQIFZ.js → geminiContentGenerator-A6JHLUHK.js} +1 -1
  17. package/chunks/{glob-ENPPHN24.js → glob-L3AZLCV6.js} +2 -2
  18. package/chunks/{grep-RXZMZKHV.js → grep-SNCPCXIP.js} +2 -2
  19. package/chunks/{monitor-YYWM7RUX.js → monitor-TS6WL6DN.js} +2 -2
  20. package/chunks/{notebook-edit-L6OODJTK.js → notebook-edit-26RNH24J.js} +2 -2
  21. package/chunks/{openaiContentGenerator-BPRGR5FJ.js → openaiContentGenerator-7CA63X5G.js} +2 -2
  22. package/chunks/{qwenContentGenerator-ENMXX47B.js → qwenContentGenerator-4WJTJXFZ.js} +3 -3
  23. package/chunks/{read-file-3VASWJKO.js → read-file-EUIHK6HD.js} +1 -1
  24. package/chunks/{ripGrep-67IQWCR7.js → ripGrep-7J5B22W2.js} +2 -2
  25. package/chunks/{scheduler-TAPJOQHX.js → scheduler-J3OUGTTS.js} +2 -2
  26. package/chunks/{serve-CQF2R7SG.js → serve-VF4ZNUJP.js} +4 -4
  27. package/chunks/{shell-ZLBFZ75G.js → shell-G6XCJAG3.js} +2 -2
  28. package/chunks/{skill-BZ2NCCJN.js → skill-7OVC6JIH.js} +1 -1
  29. package/chunks/{src-ASRB3EO3.js → src-XV5MLRND.js} +2 -2
  30. package/chunks/{team-create-NXTYUYLE.js → team-create-JXSC7ROC.js} +2 -2
  31. package/chunks/{tool-search-GYO3ZDMH.js → tool-search-YRWSWA2H.js} +1 -1
  32. package/chunks/{workflow-KZLZUDHE.js → workflow-ZN3DYFMU.js} +3 -3
  33. package/chunks/{write-file-AUXVL5D2.js → write-file-355M4V7Z.js} +2 -2
  34. package/cli.js +456 -279
  35. package/package.json +2 -2
package/cli.js CHANGED
@@ -92,7 +92,7 @@ import {
92
92
  updateOutputLanguageFile,
93
93
  validateCustomTheme,
94
94
  writeOutputLanguageAndRegisterPath
95
- } from "./chunks/chunk-BRU4Z5BG.js";
95
+ } from "./chunks/chunk-QFJ67S5R.js";
96
96
  import {
97
97
  AgentSideConnection,
98
98
  PROTOCOL_VERSION,
@@ -105,7 +105,7 @@ import {
105
105
  formatContextUsageText,
106
106
  isTerminalGoalStatusKind,
107
107
  require_react
108
- } from "./chunks/chunk-HISY5FYZ.js";
108
+ } from "./chunks/chunk-JZEKEWO5.js";
109
109
  import {
110
110
  SUPPORTED_LANGUAGES,
111
111
  clearScreen,
@@ -118,7 +118,7 @@ import {
118
118
  ta,
119
119
  writeStderrLine,
120
120
  writeStdoutLine
121
- } from "./chunks/chunk-R53CLQY7.js";
121
+ } from "./chunks/chunk-M7OBURJM.js";
122
122
  import {
123
123
  noteInteraction
124
124
  } from "./chunks/chunk-MRO43B25.js";
@@ -342,7 +342,7 @@ import {
342
342
  writeRuntimeStatus,
343
343
  writeWorktreeSession,
344
344
  writeWorktreeSessionMarker
345
- } from "./chunks/chunk-UKLVRIWE.js";
345
+ } from "./chunks/chunk-EQ5NHJBY.js";
346
346
  import {
347
347
  external_exports
348
348
  } from "./chunks/chunk-K5PGHDBN.js";
@@ -418,7 +418,7 @@ import {
418
418
  stripRuntimeSnapshotPrefix,
419
419
  uiTelemetryService,
420
420
  withInteractionSpan
421
- } from "./chunks/chunk-L6F7VZPZ.js";
421
+ } from "./chunks/chunk-25FFAMED.js";
422
422
  import "./chunks/chunk-3PJXIDKI.js";
423
423
  import "./chunks/chunk-UWCTAVOD.js";
424
424
  import {
@@ -59189,7 +59189,7 @@ var serveCommand = {
59189
59189
  process.exit(1);
59190
59190
  }
59191
59191
  }
59192
- const { runQwenServe } = await import("./chunks/serve-CQF2R7SG.js");
59192
+ const { runQwenServe } = await import("./chunks/serve-VF4ZNUJP.js");
59193
59193
  try {
59194
59194
  await runQwenServe({
59195
59195
  port: argv.port,
@@ -59228,6 +59228,432 @@ var serveCommand = {
59228
59228
  }, "handler")
59229
59229
  };
59230
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
+
59231
59657
  // packages/cli/src/utils/runBudget.ts
59232
59658
  init_esbuild_shims();
59233
59659
  var SECOND = 1e3;
@@ -59933,11 +60359,11 @@ async function parseArguments() {
59933
60359
  }
59934
60360
  return true;
59935
60361
  })
59936
- ).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);
59937
60363
  yargsInstance.version(await getCliVersion()).alias("v", "version").help().alias("h", "help").strict().demandCommand(0, 0);
59938
60364
  yargsInstance.wrap(yargsInstance.terminalWidth());
59939
60365
  const result = await yargsInstance.parse();
59940
- 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")) {
59941
60367
  process.exit(0);
59942
60368
  }
59943
60369
  const queryArg = result.query;
@@ -64479,258 +64905,6 @@ var aboutCommand = {
64479
64905
 
64480
64906
  // packages/cli/src/ui/commands/tasksCommand.ts
64481
64907
  init_esbuild_shims();
64482
-
64483
- // packages/cli/src/ui/utils/textUtils.ts
64484
- init_esbuild_shims();
64485
- init_ansi_regex();
64486
- import { stripVTControlCharacters } from "node:util";
64487
-
64488
- // packages/cli/node_modules/string-width/index.js
64489
- init_esbuild_shims();
64490
- var import_emoji_regex = __toESM(require_emoji_regex(), 1);
64491
- var segmenter4 = new Intl.Segmenter();
64492
- var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
64493
- function stringWidth2(string, options = {}) {
64494
- if (typeof string !== "string" || string.length === 0) {
64495
- return 0;
64496
- }
64497
- const {
64498
- ambiguousIsNarrow = true,
64499
- countAnsiEscapeCodes = false
64500
- } = options;
64501
- if (!countAnsiEscapeCodes) {
64502
- string = stripAnsi(string);
64503
- }
64504
- if (string.length === 0) {
64505
- return 0;
64506
- }
64507
- let width = 0;
64508
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
64509
- for (const { segment: character } of segmenter4.segment(string)) {
64510
- const codePoint = character.codePointAt(0);
64511
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
64512
- continue;
64513
- }
64514
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
64515
- continue;
64516
- }
64517
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
64518
- continue;
64519
- }
64520
- if (codePoint >= 55296 && codePoint <= 57343) {
64521
- continue;
64522
- }
64523
- if (codePoint >= 65024 && codePoint <= 65039) {
64524
- continue;
64525
- }
64526
- if (defaultIgnorableCodePointRegex.test(character)) {
64527
- continue;
64528
- }
64529
- if ((0, import_emoji_regex.default)().test(character)) {
64530
- width += 2;
64531
- continue;
64532
- }
64533
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
64534
- }
64535
- return width;
64536
- }
64537
- __name(stringWidth2, "stringWidth");
64538
-
64539
- // packages/cli/src/ui/utils/textUtils.ts
64540
- var getAsciiArtWidth = /* @__PURE__ */ __name((asciiArt) => {
64541
- if (!asciiArt) {
64542
- return 0;
64543
- }
64544
- const lines = asciiArt.split("\n");
64545
- return Math.max(...lines.map((line) => getCachedStringWidth(line)));
64546
- }, "getAsciiArtWidth");
64547
- var codePointsCache = /* @__PURE__ */ new Map();
64548
- var MAX_STRING_LENGTH_TO_CACHE = 1e3;
64549
- function toCodePoints(str) {
64550
- let isAscii = true;
64551
- for (let i = 0; i < str.length; i++) {
64552
- if (str.charCodeAt(i) > 127) {
64553
- isAscii = false;
64554
- break;
64555
- }
64556
- }
64557
- if (isAscii) {
64558
- return str.split("");
64559
- }
64560
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
64561
- const cached = codePointsCache.get(str);
64562
- if (cached) {
64563
- return cached;
64564
- }
64565
- }
64566
- const result = Array.from(str);
64567
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
64568
- codePointsCache.set(str, result);
64569
- }
64570
- return result;
64571
- }
64572
- __name(toCodePoints, "toCodePoints");
64573
- function cpLen(str) {
64574
- return toCodePoints(str).length;
64575
- }
64576
- __name(cpLen, "cpLen");
64577
- function cpSlice(str, start, end) {
64578
- const arr = toCodePoints(str).slice(start, end);
64579
- return arr.join("");
64580
- }
64581
- __name(cpSlice, "cpSlice");
64582
- function stripUnsafeCharacters(str) {
64583
- const strippedAnsi = stripAnsi(str);
64584
- const strippedVT = stripVTControlCharacters(strippedAnsi);
64585
- return toCodePoints(strippedVT).filter((char) => {
64586
- const code = char.codePointAt(0);
64587
- if (code === void 0) return false;
64588
- if (code === 9 || code === 10 || code === 13) return true;
64589
- if (code >= 0 && code <= 31) return false;
64590
- if (code >= 128 && code <= 159) return false;
64591
- return true;
64592
- }).join("");
64593
- }
64594
- __name(stripUnsafeCharacters, "stripUnsafeCharacters");
64595
- var stringWidthCache = /* @__PURE__ */ new Map();
64596
- var getCachedStringWidth = /* @__PURE__ */ __name((str) => {
64597
- if (/^[\x20-\x7E]*$/.test(str)) {
64598
- return str.length;
64599
- }
64600
- if (stringWidthCache.has(str)) {
64601
- return stringWidthCache.get(str);
64602
- }
64603
- const width = stringWidth2(str);
64604
- stringWidthCache.set(str, width);
64605
- return width;
64606
- }, "getCachedStringWidth");
64607
- var regex = ansiRegex();
64608
- function escapeAnsiCtrlCodes(obj) {
64609
- if (typeof obj === "string") {
64610
- if (obj.search(regex) === -1) {
64611
- return obj;
64612
- }
64613
- regex.lastIndex = 0;
64614
- return obj.replace(
64615
- regex,
64616
- (match) => JSON.stringify(match).slice(1, -1)
64617
- );
64618
- }
64619
- if (obj === null || typeof obj !== "object") {
64620
- return obj;
64621
- }
64622
- if (Array.isArray(obj)) {
64623
- let newArr = null;
64624
- for (let i = 0; i < obj.length; i++) {
64625
- const value = obj[i];
64626
- const escapedValue = escapeAnsiCtrlCodes(value);
64627
- if (escapedValue !== value) {
64628
- if (newArr === null) {
64629
- newArr = [...obj];
64630
- }
64631
- newArr[i] = escapedValue;
64632
- }
64633
- }
64634
- return newArr !== null ? newArr : obj;
64635
- }
64636
- let newObj = null;
64637
- const keys = Object.keys(obj);
64638
- for (const key of keys) {
64639
- const value = obj[key];
64640
- const escapedValue = escapeAnsiCtrlCodes(value);
64641
- if (escapedValue !== value) {
64642
- if (newObj === null) {
64643
- newObj = { ...obj };
64644
- }
64645
- newObj[key] = escapedValue;
64646
- }
64647
- }
64648
- return newObj !== null ? newObj : obj;
64649
- }
64650
- __name(escapeAnsiCtrlCodes, "escapeAnsiCtrlCodes");
64651
- var SENSITIVE_PATTERNS = [
64652
- // API keys with common prefixes
64653
- {
64654
- pattern: /(sk-[a-zA-Z0-9]{20,})/g,
64655
- replacement: "sk-***REDACTED***"
64656
- },
64657
- {
64658
- pattern: /(api[_-]?key[_-]?[=:]\s*)[a-zA-Z0-9_-]{20,}/gi,
64659
- replacement: "$1***REDACTED***"
64660
- },
64661
- // Bearer tokens
64662
- {
64663
- pattern: /(Bearer\s+)[a-zA-Z0-9._-]+/gi,
64664
- replacement: "$1***REDACTED***"
64665
- },
64666
- // Generic tokens
64667
- {
64668
- pattern: /(token[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
64669
- replacement: "$1***REDACTED***"
64670
- },
64671
- // Passwords in connection strings or assignments
64672
- {
64673
- pattern: /(password[_-]?[=:]\s*)[^\s]+/gi,
64674
- replacement: "$1***REDACTED***"
64675
- },
64676
- {
64677
- pattern: /(pwd[_-]?[=:]\s*)[^\s]+/gi,
64678
- replacement: "$1***REDACTED***"
64679
- },
64680
- // AWS keys
64681
- {
64682
- pattern: /(AKIA[A-Z0-9]{16})/g,
64683
- replacement: "***REDACTED***"
64684
- },
64685
- // Generic secret patterns
64686
- {
64687
- pattern: /(secret[_-]?[=:]\s*)[a-zA-Z0-9._-]{10,}/gi,
64688
- replacement: "$1***REDACTED***"
64689
- }
64690
- ];
64691
- function sanitizeSensitiveText(text, maxLength = 200) {
64692
- let result = text;
64693
- for (const { pattern, replacement } of SENSITIVE_PATTERNS) {
64694
- result = result.replace(pattern, replacement);
64695
- }
64696
- if (result.length > maxLength) {
64697
- if (maxLength <= 3) {
64698
- return result.slice(0, maxLength);
64699
- }
64700
- return result.slice(0, maxLength - 3) + "...";
64701
- }
64702
- return result;
64703
- }
64704
- __name(sanitizeSensitiveText, "sanitizeSensitiveText");
64705
- var FILENAME_CONTROL_CHARS_REGEX = /[\x00-\x1f\x7f-\x9f]/g;
64706
- function escapeFilenameControlChar(ch) {
64707
- switch (ch) {
64708
- case "\b":
64709
- return "\\b";
64710
- case " ":
64711
- return "\\t";
64712
- case "\n":
64713
- return "\\n";
64714
- case "\f":
64715
- return "\\f";
64716
- case "\r":
64717
- return "\\r";
64718
- default: {
64719
- const code = ch.charCodeAt(0);
64720
- return `\\u${code.toString(16).padStart(4, "0")}`;
64721
- }
64722
- }
64723
- }
64724
- __name(escapeFilenameControlChar, "escapeFilenameControlChar");
64725
- function sanitizeFilenameForDisplay(name) {
64726
- return escapeAnsiCtrlCodes(name).replace(
64727
- FILENAME_CONTROL_CHARS_REGEX,
64728
- escapeFilenameControlChar
64729
- );
64730
- }
64731
- __name(sanitizeFilenameForDisplay, "sanitizeFilenameForDisplay");
64732
-
64733
- // packages/cli/src/ui/commands/tasksCommand.ts
64734
64908
  function statusLabel(entry) {
64735
64909
  switch (entry.kind) {
64736
64910
  case "agent": {
@@ -71860,7 +72034,7 @@ async function extractMetadata(conversation, config) {
71860
72034
  const gitBranch = firstRecord?.gitBranch;
71861
72035
  let gitRepo;
71862
72036
  if (cwd5) {
71863
- const { getGitRepoName } = await import("./chunks/src-ASRB3EO3.js");
72037
+ const { getGitRepoName } = await import("./chunks/src-XV5MLRND.js");
71864
72038
  gitRepo = getGitRepoName(cwd5);
71865
72039
  }
71866
72040
  let model;
@@ -74056,7 +74230,7 @@ function formatHookSource(source) {
74056
74230
  }
74057
74231
  }
74058
74232
  __name(formatHookSource, "formatHookSource");
74059
- var listCommand4 = {
74233
+ var listCommand5 = {
74060
74234
  name: "list",
74061
74235
  get description() {
74062
74236
  return t("List all configured hooks");
@@ -74179,7 +74353,7 @@ var hooksCommand2 = {
74179
74353
  dialog: "hooks"
74180
74354
  };
74181
74355
  }
74182
- const result = await listCommand4.action?.(context, args);
74356
+ const result = await listCommand5.action?.(context, args);
74183
74357
  return result ?? { type: "message", messageType: "info", content: "" };
74184
74358
  }, "action")
74185
74359
  };
@@ -84059,7 +84233,7 @@ var SystemController = class extends BaseController {
84059
84233
  throw new Error("Request aborted");
84060
84234
  }
84061
84235
  try {
84062
- const mod = await import("./chunks/contextCommand-O5DLQUIZ.js");
84236
+ const mod = await import("./chunks/contextCommand-HI2X2Y7I.js");
84063
84237
  if (signal.aborted) {
84064
84238
  throw new Error("Request aborted");
84065
84239
  }
@@ -106221,12 +106395,12 @@ __name(StatusLineDialog, "StatusLineDialog");
106221
106395
  init_esbuild_shims();
106222
106396
  var import_react100 = __toESM(require_react(), 1);
106223
106397
  var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
106224
- function formatTime(seconds) {
106398
+ function formatTime2(seconds) {
106225
106399
  const minutes = Math.floor(seconds / 60);
106226
106400
  const remainingSeconds = seconds % 60;
106227
106401
  return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`;
106228
106402
  }
106229
- __name(formatTime, "formatTime");
106403
+ __name(formatTime2, "formatTime");
106230
106404
  function QwenOAuthProgress({
106231
106405
  onTimeout,
106232
106406
  onCancel,
@@ -106323,7 +106497,7 @@ function QwenOAuthProgress({
106323
106497
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text, { children: [
106324
106498
  t("Time remaining:"),
106325
106499
  " ",
106326
- formatTime(timeRemaining)
106500
+ formatTime2(timeRemaining)
106327
106501
  ] })
106328
106502
  ] }),
106329
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") }) })
@@ -106351,7 +106525,7 @@ function QwenOAuthProgress({
106351
106525
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text, { children: [
106352
106526
  t("Time remaining:"),
106353
106527
  " ",
106354
- formatTime(timeRemaining)
106528
+ formatTime2(timeRemaining)
106355
106529
  ] })
106356
106530
  ] }),
106357
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") }) })
@@ -110040,11 +110214,11 @@ var import_react113 = __toESM(require_react(), 1);
110040
110214
  var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
110041
110215
  var STATUS_REFRESH_INTERVAL_MS = 2e3;
110042
110216
  var IN_PROCESS_REFRESH_INTERVAL_MS = 1e3;
110043
- function truncate(str, maxLen) {
110217
+ function truncate2(str, maxLen) {
110044
110218
  if (str.length <= maxLen) return str;
110045
110219
  return str.slice(0, maxLen - 1) + "\u2026";
110046
110220
  }
110047
- __name(truncate, "truncate");
110221
+ __name(truncate2, "truncate");
110048
110222
  function pad(str, len, align2 = "left") {
110049
110223
  if (str.length >= len) return str.slice(0, len);
110050
110224
  const padding = " ".repeat(len - str.length);
@@ -110171,7 +110345,7 @@ function ArenaStatusDialog({
110171
110345
  const successfulToolCalls = live?.successfulToolCalls ?? agent.stats.successfulToolCalls;
110172
110346
  const failedToolCalls = live?.failedToolCalls ?? agent.stats.failedToolCalls;
110173
110347
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Box_default, { children: [
110174
- /* @__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) }) }),
110175
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 }) }),
110176
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") }) }),
110177
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") }) }),
@@ -112671,11 +112845,11 @@ function sortSkills(skills) {
112671
112845
  );
112672
112846
  }
112673
112847
  __name(sortSkills, "sortSkills");
112674
- function truncate2(text, max) {
112848
+ function truncate3(text, max) {
112675
112849
  if (text.length <= max) return text;
112676
112850
  return `${text.slice(0, Math.max(0, max - 1))}\u2026`;
112677
112851
  }
112678
- __name(truncate2, "truncate");
112852
+ __name(truncate3, "truncate");
112679
112853
  function SkillsManagerDialog({
112680
112854
  settings,
112681
112855
  config,
@@ -112766,7 +112940,7 @@ function SkillsManagerDialog({
112766
112940
  () => filteredUnlocked.map((s) => ({
112767
112941
  key: s.name,
112768
112942
  value: { name: s.name, description: s.description, level: s.level },
112769
- label: `${truncate2(s.name, NAME_COLUMN).padEnd(NAME_COLUMN)} ${truncate2(
112943
+ label: `${truncate3(s.name, NAME_COLUMN).padEnd(NAME_COLUMN)} ${truncate3(
112770
112944
  s.description,
112771
112945
  80
112772
112946
  )} (${levelLabel(s.level)})`
@@ -113011,8 +113185,8 @@ function SkillsManagerDialog({
113011
113185
  filteredLocked.map((s) => {
113012
113186
  const scopeName = higher.scopeOf(s.name) ?? t("higher scope");
113013
113187
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Text, { dimColor: true, wrap: "truncate", children: t(" {{name}} {{description}} [locked: {{scope}}]", {
113014
- name: truncate2(s.name, NAME_COLUMN).padEnd(NAME_COLUMN),
113015
- description: truncate2(s.description, 60),
113188
+ name: truncate3(s.name, NAME_COLUMN).padEnd(NAME_COLUMN),
113189
+ description: truncate3(s.description, 60),
113016
113190
  scope: scopeName
113017
113191
  }) }, s.name);
113018
113192
  })
@@ -148608,7 +148782,7 @@ var QwenAgent = class {
148608
148782
  async initialize(args) {
148609
148783
  this.clientCapabilities = args.clientCapabilities;
148610
148784
  const authMethods = buildAuthMethods();
148611
- const version = "0.18.1-preview.1";
148785
+ const version = "0.18.2";
148612
148786
  return {
148613
148787
  protocolVersion: PROTOCOL_VERSION,
148614
148788
  agentInfo: {
@@ -151965,7 +152139,10 @@ ${outputText}
151965
152139
  settings,
151966
152140
  argvForSession,
151967
152141
  cwd5,
151968
- [],
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,
151969
152146
  // Pass separated hooks for proper source attribution
151970
152147
  {
151971
152148
  userHooks: this.settings.getUserHooks(),
@@ -152693,7 +152870,7 @@ ${finalArgs[promptIndex + 1]}`;
152693
152870
  process.exit(0);
152694
152871
  }
152695
152872
  if (config.isInteractive()) {
152696
- void import("./chunks/scheduler-TAPJOQHX.js").then((m) => m.startBackgroundHousekeeping(config, settings)).catch((err) => {
152873
+ void import("./chunks/scheduler-J3OUGTTS.js").then((m) => m.startBackgroundHousekeeping(config, settings)).catch((err) => {
152697
152874
  debugLogger80.warn("failed to start background housekeeping:", err);
152698
152875
  });
152699
152876
  }