@qwen-code/qwen-code 0.16.1 → 0.16.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 (83) hide show
  1. package/bundled/new-app/SKILL.md +22 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +9 -4
  3. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/headless.md +32 -0
  5. package/bundled/qc-helper/docs/features/memory.md +22 -5
  6. package/bundled/qc-helper/docs/features/worktree.md +345 -0
  7. package/chunks/{agent-2JCG7FDJ.js → agent-RY5EB3XR.js} +15 -15
  8. package/chunks/{anthropicContentGenerator-RQJNXJIY.js → anthropicContentGenerator-LYI3OHBB.js} +4 -4
  9. package/chunks/{askUserQuestion-PQPMPNM3.js → askUserQuestion-R3MKD2JT.js} +2 -2
  10. package/chunks/{ca-UZ7BANMN.js → ca-NMZFEGAU.js} +1 -0
  11. package/chunks/{chunk-JCR2WRXZ.js → chunk-4YNZFYJY.js} +666 -29
  12. package/chunks/{chunk-HW5S7L73.js → chunk-66CJCYYZ.js} +11 -11
  13. package/chunks/{chunk-MAY32HXD.js → chunk-6NUSWV4M.js} +1 -1
  14. package/chunks/{chunk-BAZDG3QU.js → chunk-7HM6OB7M.js} +2801 -1894
  15. package/chunks/{chunk-GGNTZ2NH.js → chunk-7YJIR2FX.js} +2 -2
  16. package/chunks/{chunk-XP27SJMH.js → chunk-ACBGEKB7.js} +10 -1
  17. package/chunks/{chunk-CAVZVZX6.js → chunk-C27V5A2J.js} +1 -1
  18. package/chunks/{chunk-G7YTSRES.js → chunk-EY6BDW7Y.js} +1 -1
  19. package/chunks/{chunk-YJLGXDQJ.js → chunk-FO7BIVSR.js} +1 -1
  20. package/chunks/{chunk-D6LBYOCX.js → chunk-GQXXO5HJ.js} +109 -17
  21. package/chunks/{chunk-F23NCRJ2.js → chunk-GVWPJCXU.js} +1 -1
  22. package/chunks/{chunk-CSWBPY3P.js → chunk-JVD46YJV.js} +1 -1
  23. package/chunks/{chunk-4AOCVI6J.js → chunk-K72FHBFO.js} +1 -1
  24. package/chunks/{chunk-PR4T27R7.js → chunk-NQ3E7YLD.js} +1 -1
  25. package/chunks/{chunk-D5NTAHYL.js → chunk-ODPVJ6JJ.js} +1 -1
  26. package/chunks/{chunk-KXZ4TJB4.js → chunk-OIL7KDWV.js} +1 -1
  27. package/chunks/{chunk-7LMPOVYW.js → chunk-PJLEMR7N.js} +38 -16
  28. package/chunks/{chunk-L5E26RN6.js → chunk-TXQI3VZ7.js} +1 -1
  29. package/chunks/{chunk-N6GSJHZ4.js → chunk-UE5LPQF7.js} +9 -14
  30. package/chunks/{chunk-DMIMF3CG.js → chunk-VMOWXTRC.js} +2 -2
  31. package/chunks/{chunk-PVVL5Q3W.js → chunk-YMDXEEOW.js} +1 -1
  32. package/chunks/{contextCommand-XVRGKS3Q.js → contextCommand-DDGVLQSF.js} +17 -17
  33. package/chunks/{cron-create-IGYXQVG4.js → cron-create-BTEOGHPH.js} +2 -2
  34. package/chunks/{cron-delete-ETKIZCWT.js → cron-delete-56CEWELN.js} +2 -2
  35. package/chunks/{cron-list-BVCUSWRU.js → cron-list-SV6QRZW2.js} +2 -2
  36. package/chunks/{de-V4IE2OOZ.js → de-OIMT3OMI.js} +1 -0
  37. package/chunks/{dist-4L54HRX2.js → dist-R2SXPG74.js} +22 -3
  38. package/chunks/{edit-3MLXHQPW.js → edit-4LLGNYVZ.js} +16 -16
  39. package/chunks/{en-HGJ2SPLM.js → en-2IFZ5THF.js} +1 -0
  40. package/chunks/{enter-worktree-OCA4SG6D.js → enter-worktree-E2R5XAFT.js} +18 -16
  41. package/chunks/{exit-worktree-6EDLXVEV.js → exit-worktree-YVBYYYDD.js} +15 -15
  42. package/chunks/{exitPlanMode-H75KHRX4.js → exitPlanMode-WD5IH7NS.js} +15 -15
  43. package/chunks/{fr-CJULI7ZX.js → fr-PVELSHTV.js} +1 -0
  44. package/chunks/{geminiContentGenerator-E7Y6TCPU.js → geminiContentGenerator-LM65ADWM.js} +3 -3
  45. package/chunks/{glob-JFFSKARO.js → glob-6X6OCEWE.js} +15 -15
  46. package/chunks/{grep-7TAFR7MX.js → grep-2UUPSSIQ.js} +15 -15
  47. package/chunks/{ja-L7CHRQEW.js → ja-P5TK5GNN.js} +1 -0
  48. package/chunks/{keychain-token-storage-335UOLJ6.js → keychain-token-storage-3552ENXE.js} +2 -2
  49. package/chunks/{ls-7HD6XG3V.js → ls-MYXAM7LJ.js} +3 -3
  50. package/chunks/{lsp-ZZSFCIWD.js → lsp-PFGI35JL.js} +2 -2
  51. package/chunks/{monitor-YX2ABLXH.js → monitor-VUHPEGUW.js} +25 -20
  52. package/chunks/{notebook-edit-EEJEGFZR.js → notebook-edit-P4QVLW6I.js} +16 -16
  53. package/chunks/{openaiContentGenerator-BSAWHGQJ.js → openaiContentGenerator-JH4YNZ3H.js} +10 -10
  54. package/chunks/{pt-M6JULLEQ.js → pt-A5GHG66T.js} +1 -0
  55. package/chunks/{qwenContentGenerator-47XRHQXM.js → qwenContentGenerator-5FE4UYUT.js} +17 -17
  56. package/chunks/{qwenOAuth2-EEJGROP7.js → qwenOAuth2-BAN2EGSH.js} +3 -3
  57. package/chunks/{read-file-O53WD46Y.js → read-file-J7DH4OKV.js} +7 -7
  58. package/chunks/{ripGrep-OXNZ5Z3T.js → ripGrep-33DECY4F.js} +15 -15
  59. package/chunks/{ru-QILM4HBC.js → ru-66XKB4QX.js} +1 -0
  60. package/chunks/{send-message-ULK4MQXJ.js → send-message-JUFP62VD.js} +2 -2
  61. package/chunks/{serve-H2REZAYD.js → serve-7FX7MREA.js} +17 -17
  62. package/chunks/{shell-DET66JID.js → shell-ZNTQIRK6.js} +15 -15
  63. package/chunks/{skill-ZIXPX3L3.js → skill-CFCUIY23.js} +9 -9
  64. package/chunks/{src-PN3XGQYP.js → src-AHV2CWEQ.js} +39 -15
  65. package/chunks/{syntheticOutput-IS2X5OZ2.js → syntheticOutput-AKTXC6FR.js} +3 -3
  66. package/chunks/{task-stop-7QSJGSSP.js → task-stop-2NYFR2ES.js} +2 -2
  67. package/chunks/{todoWrite-7CVACFUX.js → todoWrite-WHZ2O2XP.js} +3 -3
  68. package/chunks/{tool-search-GTYLSGZ3.js → tool-search-C2EMLFBJ.js} +7 -7
  69. package/chunks/{web-fetch-ENQ2I5JA.js → web-fetch-S6MZXPZ5.js} +4 -4
  70. package/chunks/{write-file-NILNEZCR.js → write-file-EEPVRS4Q.js} +16 -16
  71. package/chunks/{zh-PWL2NKY3.js → zh-OB5P2ZDO.js} +1 -0
  72. package/chunks/{zh-TW-S3YGWICZ.js → zh-TW-3ND6DQRX.js} +1 -0
  73. package/cli.js +5666 -4466
  74. package/locales/ca.js +1 -0
  75. package/locales/de.js +1 -0
  76. package/locales/en.js +1 -0
  77. package/locales/fr.js +1 -0
  78. package/locales/ja.js +1 -0
  79. package/locales/pt.js +1 -0
  80. package/locales/ru.js +1 -0
  81. package/locales/zh-TW.js +1 -0
  82. package/locales/zh.js +1 -0
  83. package/package.json +2 -2
@@ -2,11 +2,11 @@
2
2
  "use strict";
3
3
  import {
4
4
  formatFetchErrorForUser
5
- } from "./chunk-KXZ4TJB4.js";
5
+ } from "./chunk-OIL7KDWV.js";
6
6
  import {
7
7
  Storage,
8
8
  createDebugLogger
9
- } from "./chunk-XP27SJMH.js";
9
+ } from "./chunk-ACBGEKB7.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";
@@ -135,6 +135,14 @@ var FatalToolExecutionError = class extends FatalError {
135
135
  super(message, 54);
136
136
  }
137
137
  };
138
+ var FatalBudgetExceededError = class extends FatalError {
139
+ static {
140
+ __name(this, "FatalBudgetExceededError");
141
+ }
142
+ constructor(message) {
143
+ super(message, 55);
144
+ }
145
+ };
138
146
  var FatalCancellationError = class extends FatalError {
139
147
  static {
140
148
  __name(this, "FatalCancellationError");
@@ -199,7 +207,7 @@ function _resetValidatePathCacheForTest() {
199
207
  isDirectoryCache.clear();
200
208
  }
201
209
  __name(_resetValidatePathCacheForTest, "_resetValidatePathCacheForTest");
202
- var SHELL_SPECIAL_CHARS = /[ \t()[\]{};|*?$`'"#&<>!~]/;
210
+ var SHELL_SPECIAL_CHARS = /[ \t()[\]{};|*?$`'"#&<>!~,]/;
203
211
  var PATH_ARG_KEYS = [
204
212
  "file_path",
205
213
  "path",
@@ -913,6 +921,7 @@ export {
913
921
  FatalConfigError,
914
922
  FatalTurnLimitedError,
915
923
  FatalToolExecutionError,
924
+ FatalBudgetExceededError,
916
925
  FatalCancellationError,
917
926
  ForbiddenError,
918
927
  UnauthorizedError,
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OFEVLU4C.js";
6
6
  import {
7
7
  SchemaValidator
8
- } from "./chunk-PVVL5Q3W.js";
8
+ } from "./chunk-YMDXEEOW.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-ACBGEKB7.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -5,7 +5,7 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-PVVL5Q3W.js";
8
+ } from "./chunk-YMDXEEOW.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -6,7 +6,7 @@ import {
6
6
  getLanguageSettingsOptions,
7
7
  t,
8
8
  writeStderrLine
9
- } from "./chunk-HW5S7L73.js";
9
+ } from "./chunk-66CJCYYZ.js";
10
10
  import {
11
11
  DEFAULT_STOP_HOOK_BLOCK_CAP,
12
12
  DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
@@ -15,17 +15,17 @@ import {
15
15
  SkillError,
16
16
  ideContextStore,
17
17
  require_main
18
- } from "./chunk-BAZDG3QU.js";
18
+ } from "./chunk-7HM6OB7M.js";
19
19
  import {
20
20
  isWithinRoot
21
- } from "./chunk-JCR2WRXZ.js";
21
+ } from "./chunk-4YNZFYJY.js";
22
22
  import {
23
23
  FatalConfigError,
24
24
  QWEN_DIR,
25
25
  Storage,
26
26
  createDebugLogger,
27
27
  getErrorMessage
28
- } from "./chunk-XP27SJMH.js";
28
+ } from "./chunk-ACBGEKB7.js";
29
29
  import {
30
30
  init_esbuild_shims
31
31
  } from "./chunk-A4BMJM77.js";
@@ -15484,6 +15484,26 @@ var SETTINGS_SCHEMA = {
15484
15484
  additionalProperties: true
15485
15485
  }
15486
15486
  },
15487
+ outboundCorrelation: {
15488
+ type: "object",
15489
+ label: "Outbound Correlation",
15490
+ category: "Advanced",
15491
+ requiresRestart: true,
15492
+ default: void 0,
15493
+ description: "SECURITY-RELEVANT. Controls what client-side correlation data qwen-code writes into outbound LLM API requests (DashScope, OpenAI, Anthropic, etc.) \u2014 separate from `telemetry.*` which governs data flow into the operator's OWN OTLP collector. All values default to off. Opt in only when the LLM provider also reports into your OTel collector for cross-process trace stitching (e.g. ARMS Tracing + DashScope).",
15494
+ showInDialog: false,
15495
+ jsonSchemaOverride: {
15496
+ type: "object",
15497
+ properties: {
15498
+ propagateTraceContext: {
15499
+ description: "Requires `telemetry.enabled: true`. Inject W3C `traceparent` header on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...). Default: false \u2014 trace context stays internal to the operator's OTLP collector and is NOT written onto third-party request streams. Set true only when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope). Client HTTP spans are still emitted in either case; this flag only governs the wire `traceparent` header.",
15500
+ type: "boolean",
15501
+ default: false
15502
+ }
15503
+ },
15504
+ additionalProperties: false
15505
+ }
15506
+ },
15487
15507
  fastModel: {
15488
15508
  type: "string",
15489
15509
  label: "Fast Model",
@@ -15520,6 +15540,24 @@ var SETTINGS_SCHEMA = {
15520
15540
  description: "Maximum number of user/model/tool turns to keep in a session. -1 means unlimited.",
15521
15541
  showInDialog: false
15522
15542
  },
15543
+ maxWallTimeSeconds: {
15544
+ type: "number",
15545
+ label: "Max Wall-Clock Time (seconds)",
15546
+ category: "Model",
15547
+ requiresRestart: false,
15548
+ default: -1,
15549
+ description: "Run-level wall-clock budget for headless / unattended runs, in seconds. -1 means unlimited; otherwise must be in [1, ~2,147,483] (sub-second values and values above ~24 days are rejected as typos). Overridable per-invocation via --max-wall-time (which also accepts duration suffixes like 5m, 1.5h).",
15550
+ showInDialog: false
15551
+ },
15552
+ maxToolCalls: {
15553
+ type: "number",
15554
+ label: "Max Tool Calls",
15555
+ category: "Model",
15556
+ requiresRestart: false,
15557
+ default: -1,
15558
+ description: 'Cumulative tool-call budget for a run (counts every executed tool, success or failure; structured_output under --json-schema is exempt). -1 means unlimited; 0 means "no tool calls allowed" (first call aborts). Capped at 1,000,000 to catch typos. Overridable via --max-tool-calls.',
15559
+ showInDialog: false
15560
+ },
15523
15561
  chatCompression: {
15524
15562
  type: "object",
15525
15563
  label: "Chat Compression",
@@ -15553,7 +15591,7 @@ var SETTINGS_SCHEMA = {
15553
15591
  category: "Model",
15554
15592
  requiresRestart: false,
15555
15593
  default: true,
15556
- description: "Disable all loop detection checks (streaming and LLM).",
15594
+ description: "Skip streaming loop detection. Defaults to true to avoid false-positive interruptions; set to false to re-enable as an unattended-run guardrail.",
15557
15595
  showInDialog: false
15558
15596
  },
15559
15597
  skipStartupContext: {
@@ -15816,7 +15854,7 @@ var SETTINGS_SCHEMA = {
15816
15854
  label: "Enable Managed Auto-Dream",
15817
15855
  category: "Memory",
15818
15856
  requiresRestart: false,
15819
- default: false,
15857
+ default: true,
15820
15858
  description: "Enable automatic consolidation (dream) of collected memories.",
15821
15859
  showInDialog: false
15822
15860
  },
@@ -15825,7 +15863,7 @@ var SETTINGS_SCHEMA = {
15825
15863
  label: "Enable Auto Skill",
15826
15864
  category: "Memory",
15827
15865
  requiresRestart: false,
15828
- default: false,
15866
+ default: true,
15829
15867
  description: "Enable background review for reusable project skills after tool-heavy sessions.",
15830
15868
  showInDialog: false
15831
15869
  }
@@ -16630,6 +16668,26 @@ var SETTINGS_SCHEMA = {
16630
16668
  showInDialog: true
16631
16669
  }
16632
16670
  }
16671
+ },
16672
+ worktree: {
16673
+ type: "object",
16674
+ label: "Worktree",
16675
+ category: "Advanced",
16676
+ requiresRestart: false,
16677
+ default: {},
16678
+ description: 'Configuration for general-purpose git worktrees created by the CLI (the `enter_worktree` tool, the `agent isolation: "worktree"` parameter, and the startup `--worktree` flag). Does NOT affect Agent Arena worktrees \u2014 see `agents.arena.worktreeBaseDir` for those.',
16679
+ showInDialog: false,
16680
+ properties: {
16681
+ symlinkDirectories: {
16682
+ type: "array",
16683
+ label: "Symlink Directories Into Worktrees",
16684
+ category: "Advanced",
16685
+ requiresRestart: false,
16686
+ default: void 0,
16687
+ description: "Directories under the main repository to symlink into every general-purpose worktree on creation. Useful for sharing large opt-in dirs like `node_modules` so the model can run tests / builds inside the worktree without a fresh install. Paths must be relative to the repo root; absolute paths, anything containing `..`, and any path inside `.git` or `.qwen` (the CLI-managed metadata tree, which contains the worktrees directory itself) are rejected. Missing source dirs and existing destination paths are silently skipped (no overwrite, no failure).",
16688
+ showInDialog: false
16689
+ }
16690
+ }
16633
16691
  }
16634
16692
  };
16635
16693
  function getSettingsSchema() {
@@ -17139,7 +17197,7 @@ function writeWithBackupSync(targetPath, content, options = {}) {
17139
17197
  __name(writeWithBackupSync, "writeWithBackupSync");
17140
17198
 
17141
17199
  // packages/cli/src/utils/commentJson.ts
17142
- function updateSettingsFilePreservingFormat(filePath, updates, sync = false) {
17200
+ function updateSettingsFilePreservingFormat(filePath, updates, sync = false, replacePath = []) {
17143
17201
  if (!fs5.existsSync(filePath)) {
17144
17202
  const content = (0, import_comment_json.stringify)(updates, null, 2);
17145
17203
  writeWithBackupSync(filePath, content);
@@ -17156,7 +17214,7 @@ function updateSettingsFilePreservingFormat(filePath, updates, sync = false) {
17156
17214
  );
17157
17215
  return false;
17158
17216
  }
17159
- const updatedStructure = applyUpdates(parsed, updates, sync);
17217
+ const updatedStructure = applyUpdates(parsed, updates, sync, replacePath);
17160
17218
  const updatedContent = (0, import_comment_json.stringify)(updatedStructure, null, 2);
17161
17219
  try {
17162
17220
  (0, import_comment_json.parse)(updatedContent);
@@ -17173,7 +17231,7 @@ function updateSettingsFilePreservingFormat(filePath, updates, sync = false) {
17173
17231
  return true;
17174
17232
  }
17175
17233
  __name(updateSettingsFilePreservingFormat, "updateSettingsFilePreservingFormat");
17176
- function applyUpdates(current, updates, sync = false) {
17234
+ function applyUpdates(current, updates, sync = false, replacePath = [], currentPath = []) {
17177
17235
  const result = current;
17178
17236
  if (sync) {
17179
17237
  const keysToRemove = Object.keys(result).filter((key) => !(key in updates));
@@ -17182,12 +17240,31 @@ function applyUpdates(current, updates, sync = false) {
17182
17240
  }
17183
17241
  }
17184
17242
  for (const key of Object.getOwnPropertyNames(updates)) {
17243
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
17244
+ continue;
17245
+ }
17185
17246
  const value = updates[key];
17186
- if (typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0 && typeof result[key] === "object" && result[key] !== null && !Array.isArray(result[key])) {
17247
+ const nextPath = [...currentPath, key];
17248
+ const valueIsObject = typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
17249
+ if (pathsEqual(nextPath, replacePath)) {
17250
+ result[key] = valueIsObject ? applyUpdates({}, value) : value;
17251
+ continue;
17252
+ }
17253
+ if (valueIsObject && (typeof result[key] !== "object" || result[key] === null || Array.isArray(result[key]))) {
17254
+ result[key] = applyUpdates(
17255
+ {},
17256
+ value,
17257
+ sync,
17258
+ replacePath,
17259
+ nextPath
17260
+ );
17261
+ } else if (valueIsObject && typeof result[key] === "object" && result[key] !== null && !Array.isArray(result[key])) {
17187
17262
  result[key] = applyUpdates(
17188
17263
  result[key],
17189
17264
  value,
17190
- sync
17265
+ sync,
17266
+ replacePath,
17267
+ nextPath
17191
17268
  );
17192
17269
  } else {
17193
17270
  result[key] = value;
@@ -17196,6 +17273,10 @@ function applyUpdates(current, updates, sync = false) {
17196
17273
  return result;
17197
17274
  }
17198
17275
  __name(applyUpdates, "applyUpdates");
17276
+ function pathsEqual(left, right) {
17277
+ return left.length === right.length && left.every((segment, index) => segment === right[index]);
17278
+ }
17279
+ __name(pathsEqual, "pathsEqual");
17199
17280
 
17200
17281
  // packages/cli/src/config/migration/index.ts
17201
17282
  init_esbuild_shims();
@@ -18048,7 +18129,8 @@ var LoadedSettings = class {
18048
18129
  setNestedPropertySafe(settingsFile.settings, key, value);
18049
18130
  setNestedPropertySafe(settingsFile.originalSettings, key, value);
18050
18131
  this._merged = this.computeMergedSettings();
18051
- saveSettings(settingsFile, createSettingsUpdate(key, value));
18132
+ const replacePath = key === "mcpServers" ? key.split(".") : [];
18133
+ saveSettings(settingsFile, createSettingsUpdate(key, value), replacePath);
18052
18134
  }
18053
18135
  recomputeMerged() {
18054
18136
  this._merged = this.computeMergedSettings();
@@ -18511,13 +18593,23 @@ function createSettingsUpdate(key, value) {
18511
18593
  return root;
18512
18594
  }
18513
18595
  __name(createSettingsUpdate, "createSettingsUpdate");
18514
- function saveSettings(settingsFile, updates = settingsFile.originalSettings) {
18596
+ function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = []) {
18515
18597
  try {
18516
18598
  const dirPath = path3.dirname(settingsFile.path);
18517
18599
  if (!fs6.existsSync(dirPath)) {
18518
18600
  fs6.mkdirSync(dirPath, { recursive: true });
18519
18601
  }
18520
- updateSettingsFilePreservingFormat(settingsFile.path, updates);
18602
+ const written = updateSettingsFilePreservingFormat(
18603
+ settingsFile.path,
18604
+ updates,
18605
+ false,
18606
+ replacePath
18607
+ );
18608
+ if (!written) {
18609
+ debugLogger3.error(
18610
+ `saveSettings: updateSettingsFilePreservingFormat returned false for ${settingsFile.path}`
18611
+ );
18612
+ }
18521
18613
  } catch (error) {
18522
18614
  debugLogger3.error("Error saving user settings file.");
18523
18615
  debugLogger3.error(error instanceof Error ? error.message : String(error));
@@ -18760,7 +18852,7 @@ __name(getPackageJson, "getPackageJson");
18760
18852
  // packages/cli/src/utils/version.ts
18761
18853
  async function getCliVersion() {
18762
18854
  const pkgJson = await getPackageJson();
18763
- return "0.16.1";
18855
+ return "0.16.2";
18764
18856
  }
18765
18857
  __name(getCliVersion, "getCliVersion");
18766
18858
 
@@ -18855,7 +18947,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds, options) => {
18855
18947
 
18856
18948
  // packages/cli/src/generated/git-commit.ts
18857
18949
  init_esbuild_shims();
18858
- var GIT_COMMIT_INFO = "f875ec770";
18950
+ var GIT_COMMIT_INFO = "7aba6967c";
18859
18951
 
18860
18952
  // packages/cli/src/utils/systemInfo.ts
18861
18953
  var debugLogger4 = createDebugLogger("STATUS");
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-ACBGEKB7.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-ACBGEKB7.js";
6
6
  import {
7
7
  require_undici
8
8
  } from "./chunk-E7E2MFYM.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-ACBGEKB7.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -4,7 +4,7 @@ import {
4
4
  QWEN_DIR,
5
5
  Storage,
6
6
  sanitizeCwd
7
- } from "./chunk-XP27SJMH.js";
7
+ } from "./chunk-ACBGEKB7.js";
8
8
  import {
9
9
  init_esbuild_shims
10
10
  } from "./chunk-A4BMJM77.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  Storage,
5
5
  createDebugLogger
6
- } from "./chunk-XP27SJMH.js";
6
+ } from "./chunk-ACBGEKB7.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  getErrorMessage,
5
5
  isNodeError
6
- } from "./chunk-XP27SJMH.js";
6
+ } from "./chunk-ACBGEKB7.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -2,23 +2,24 @@
2
2
  "use strict";
3
3
  import {
4
4
  t
5
- } from "./chunk-HW5S7L73.js";
5
+ } from "./chunk-66CJCYYZ.js";
6
6
  import {
7
+ computeThresholds,
7
8
  getCoreSystemPrompt
8
- } from "./chunk-BAZDG3QU.js";
9
+ } from "./chunk-7HM6OB7M.js";
9
10
  import {
10
11
  buildSkillLlmContent
11
- } from "./chunk-G7YTSRES.js";
12
+ } from "./chunk-EY6BDW7Y.js";
12
13
  import {
13
14
  DiscoveredMCPTool,
14
15
  uiTelemetryService
15
- } from "./chunk-JCR2WRXZ.js";
16
+ } from "./chunk-4YNZFYJY.js";
16
17
  import {
17
18
  DEFAULT_TOKEN_LIMIT
18
- } from "./chunk-MAY32HXD.js";
19
+ } from "./chunk-6NUSWV4M.js";
19
20
  import {
20
21
  ToolNames
21
- } from "./chunk-PVVL5Q3W.js";
22
+ } from "./chunk-YMDXEEOW.js";
22
23
  import {
23
24
  init_esbuild_shims
24
25
  } from "./chunk-A4BMJM77.js";
@@ -519,7 +520,13 @@ function isTerminalGoalStatusKind(kind) {
519
520
  __name(isTerminalGoalStatusKind, "isTerminalGoalStatusKind");
520
521
 
521
522
  // packages/cli/src/ui/commands/contextCommand.ts
522
- var DEFAULT_COMPRESSION_THRESHOLD = 0.7;
523
+ function currentTier(tokens, thresholds) {
524
+ if (tokens >= thresholds.hard) return "hard";
525
+ if (tokens >= thresholds.auto) return "auto";
526
+ if (tokens >= thresholds.warn) return "warn";
527
+ return "safe";
528
+ }
529
+ __name(currentTier, "currentTier");
523
530
  function estimateTokens(text) {
524
531
  if (!text || text.length === 0) return 0;
525
532
  let asciiChars = 0;
@@ -567,12 +574,15 @@ async function collectContextData(config, showDetails) {
567
574
  const systemPromptTokens = estimateTokens(systemPromptText);
568
575
  const toolRegistry = config.getToolRegistry();
569
576
  const allTools = toolRegistry ? toolRegistry.getAllTools() : [];
570
- const toolDeclarations = toolRegistry ? toolRegistry.getFunctionDeclarations({ includeDeferred: true }) : [];
577
+ const toolDeclarations = toolRegistry ? toolRegistry.getFunctionDeclarations() : [];
571
578
  const toolsJsonStr = JSON.stringify(toolDeclarations);
572
579
  const allToolsTokens = estimateTokens(toolsJsonStr);
573
580
  const builtinTools = [];
574
581
  const mcpTools = [];
575
582
  for (const tool of allTools) {
583
+ if (tool.shouldDefer && !tool.alwaysLoad && !toolRegistry?.isDeferredToolRevealed(tool.name)) {
584
+ continue;
585
+ }
576
586
  const toolJsonStr = JSON.stringify(tool.schema);
577
587
  const tokens = estimateTokens(toolJsonStr);
578
588
  if (tool instanceof DiscoveredMCPTool) {
@@ -625,8 +635,11 @@ ${skill.level}
625
635
  };
626
636
  });
627
637
  const skillsTokens = skillToolDefinitionTokens + loadedBodiesTokens;
628
- const compressionThreshold = config.getChatCompression()?.contextPercentageThreshold ?? DEFAULT_COMPRESSION_THRESHOLD;
629
- const autocompactBuffer = compressionThreshold > 0 ? Math.round((1 - compressionThreshold) * contextWindowSize) : 0;
638
+ const thresholds = computeThresholds(contextWindowSize);
639
+ const autocompactBuffer = Math.max(
640
+ 0,
641
+ Math.round(contextWindowSize - thresholds.auto)
642
+ );
630
643
  const rawOverhead = systemPromptTokens + allToolsTokens + memoryFilesTokens + loadedBodiesTokens;
631
644
  const isEstimated = apiTotalTokens === 0;
632
645
  const mcpToolsTotalTokens = mcpTools.reduce(
@@ -703,6 +716,7 @@ ${skill.level}
703
716
  bodyTokens: item.bodyTokens ? Math.round(item.bodyTokens * overheadScale) : void 0
704
717
  })) : skills;
705
718
  }
719
+ const tierTokens = isEstimated ? rawOverhead : apiTotalTokens;
706
720
  const breakdown = {
707
721
  systemPrompt: displaySystemPrompt,
708
722
  builtinTools: displayBuiltinTools,
@@ -711,7 +725,9 @@ ${skill.level}
711
725
  skills: displaySkills,
712
726
  messages: messagesTokens,
713
727
  freeSpace,
714
- autocompactBuffer
728
+ autocompactBuffer,
729
+ thresholds,
730
+ currentTier: currentTier(tierTokens, thresholds)
715
731
  };
716
732
  return {
717
733
  type: "context_usage" /* CONTEXT_USAGE */,
@@ -744,6 +760,10 @@ function fmtCategoryRow(label, tokens, contextWindowSize, indent = " ") {
744
760
  return `${leftPart}${" ".repeat(dots)}${right}`;
745
761
  }
746
762
  __name(fmtCategoryRow, "fmtCategoryRow");
763
+ function formatNum(n) {
764
+ return Math.round(n).toLocaleString("en-US");
765
+ }
766
+ __name(formatNum, "formatNum");
747
767
  function formatContextUsageText(data) {
748
768
  const {
749
769
  modelName,
@@ -775,13 +795,15 @@ function formatContextUsageText(data) {
775
795
  lines.push("");
776
796
  lines.push(fmtCategoryRow("Used", totalTokens, contextWindowSize));
777
797
  lines.push(fmtCategoryRow("Free", breakdown.freeSpace, contextWindowSize));
798
+ lines.push("");
799
+ lines.push("**Compaction thresholds**");
778
800
  lines.push(
779
- fmtCategoryRow(
780
- "Autocompact buffer",
781
- breakdown.autocompactBuffer,
782
- contextWindowSize
783
- )
801
+ ` Effective window: ${formatNum(breakdown.thresholds.effectiveWindow)} (window \u2212 ${formatNum(contextWindowSize - breakdown.thresholds.effectiveWindow)} reserve)`
784
802
  );
803
+ lines.push(` Warn threshold: ${formatNum(breakdown.thresholds.warn)}`);
804
+ lines.push(` Auto threshold: ${formatNum(breakdown.thresholds.auto)}`);
805
+ lines.push(` Hard threshold: ${formatNum(breakdown.thresholds.hard)}`);
806
+ lines.push(` Current tier: ${breakdown.currentTier}`);
785
807
  lines.push("");
786
808
  lines.push("**Usage by category**");
787
809
  }
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  ToolNames
5
- } from "./chunk-PVVL5Q3W.js";
5
+ } from "./chunk-YMDXEEOW.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -2,16 +2,16 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestTokenizer
5
- } from "./chunk-DMIMF3CG.js";
5
+ } from "./chunk-VMOWXTRC.js";
6
6
  import {
7
7
  buildRuntimeFetchOptions,
8
8
  redactProxyError
9
- } from "./chunk-CSWBPY3P.js";
9
+ } from "./chunk-JVD46YJV.js";
10
10
  import {
11
11
  OpenAIContentConverter,
12
12
  TaggedThinkingParser,
13
13
  openaiRequestCaptureContext
14
- } from "./chunk-JCR2WRXZ.js";
14
+ } from "./chunk-4YNZFYJY.js";
15
15
  import {
16
16
  CAPPED_DEFAULT_MAX_TOKENS,
17
17
  DASHSCOPE_PROXY_BASE_URL,
@@ -22,14 +22,14 @@ import {
22
22
  runtimeDiagnostics,
23
23
  safeJsonParse,
24
24
  tokenLimit
25
- } from "./chunk-MAY32HXD.js";
25
+ } from "./chunk-6NUSWV4M.js";
26
26
  import {
27
27
  GenerateContentResponse
28
28
  } from "./chunk-T4VD6OJ4.js";
29
29
  import {
30
30
  createDebugLogger,
31
31
  isAbortError
32
- } from "./chunk-XP27SJMH.js";
32
+ } from "./chunk-ACBGEKB7.js";
33
33
  import {
34
34
  init_esbuild_shims
35
35
  } from "./chunk-A4BMJM77.js";
@@ -7074,6 +7074,7 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7074
7074
  /**
7075
7075
  * Determines whether to use the DashScope-compatible provider.
7076
7076
  * Covers dashscope.aliyuncs.com, dashscope-intl.aliyuncs.com,
7077
+ * Token Plan endpoints under token-plan.<region>.maas.aliyuncs.com,
7077
7078
  * internal Alibaba domains (*.alibaba-inc.com, *.aliyun-inc.com),
7078
7079
  * and proxy matches.
7079
7080
  *
@@ -7093,12 +7094,13 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7093
7094
  hostname = null;
7094
7095
  }
7095
7096
  const isDashscopeOrigin = hostname !== null && (hostname === "dashscope.aliyuncs.com" || hostname === "dashscope-intl.aliyuncs.com" || hostname.endsWith(".dashscope.aliyuncs.com") || hostname.endsWith(".dashscope-intl.aliyuncs.com"));
7097
+ const isTokenPlanOrigin = hostname !== null && hostname.startsWith("token-plan.") && hostname.endsWith(".maas.aliyuncs.com");
7096
7098
  const isInternalOrigin = hostname !== null && (hostname.endsWith(".alibaba-inc.com") || hostname.endsWith(".aliyun-inc.com"));
7097
7099
  const normalizedProxyUrl = DASHSCOPE_PROXY_BASE_URL?.endsWith("/") ? DASHSCOPE_PROXY_BASE_URL.slice(0, -1) : DASHSCOPE_PROXY_BASE_URL;
7098
7100
  const isProxyMatch = Boolean(
7099
7101
  normalizedProxyUrl && normalizedBaseUrl.toLowerCase() === normalizedProxyUrl.toLowerCase()
7100
7102
  );
7101
- if (normalizedProxyUrl && !isDashscopeOrigin && !isInternalOrigin && !isProxyMatch) {
7103
+ if (normalizedProxyUrl && !isDashscopeOrigin && !isTokenPlanOrigin && !isInternalOrigin && !isProxyMatch) {
7102
7104
  debugLogger.debug(
7103
7105
  `DASHSCOPE_PROXY_BASE_URL is configured but the request baseUrl does not match. DashScope headers/cache control will be skipped.`
7104
7106
  );
@@ -7108,7 +7110,7 @@ var DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider
7108
7110
  `DashScope provider activated via internal origin: ${hostname}`
7109
7111
  );
7110
7112
  }
7111
- return isDashscopeOrigin || isInternalOrigin || isProxyMatch;
7113
+ return isDashscopeOrigin || isTokenPlanOrigin || isInternalOrigin || isProxyMatch;
7112
7114
  }
7113
7115
  buildHeaders() {
7114
7116
  const version = this.cliConfig.getCliVersion() || "unknown";
@@ -7596,7 +7598,6 @@ var MiMoOpenAICompatibleProvider = class extends DefaultOpenAICompatibleProvider
7596
7598
 
7597
7599
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7598
7600
  init_esbuild_shims();
7599
- import { setMaxListeners } from "node:events";
7600
7601
 
7601
7602
  // packages/core/src/core/openaiContentGenerator/streamingToolCallParser.ts
7602
7603
  init_esbuild_shims();
@@ -7913,10 +7914,6 @@ var StreamingToolCallParser = class {
7913
7914
  };
7914
7915
 
7915
7916
  // packages/core/src/core/openaiContentGenerator/pipeline.ts
7916
- function raiseAbortListenerCap(signal) {
7917
- if (signal) setMaxListeners(0, signal);
7918
- }
7919
- __name(raiseAbortListenerCap, "raiseAbortListenerCap");
7920
7917
  var StreamContentError = class extends Error {
7921
7918
  static {
7922
7919
  __name(this, "StreamContentError");
@@ -7938,7 +7935,6 @@ var ContentGenerationPipeline = class {
7938
7935
  client;
7939
7936
  contentGeneratorConfig;
7940
7937
  async execute(request, userPromptId) {
7941
- raiseAbortListenerCap(request.config?.abortSignal);
7942
7938
  return this.executeWithErrorHandling(
7943
7939
  request,
7944
7940
  userPromptId,
@@ -7959,7 +7955,6 @@ var ContentGenerationPipeline = class {
7959
7955
  );
7960
7956
  }
7961
7957
  async executeStream(request, userPromptId) {
7962
- raiseAbortListenerCap(request.config?.abortSignal);
7963
7958
  return this.executeWithErrorHandling(
7964
7959
  request,
7965
7960
  userPromptId,
@@ -3,10 +3,10 @@
3
3
  import {
4
4
  TextTokenizer,
5
5
  isSupportedImageMimeType
6
- } from "./chunk-CSWBPY3P.js";
6
+ } from "./chunk-JVD46YJV.js";
7
7
  import {
8
8
  createDebugLogger
9
- } from "./chunk-XP27SJMH.js";
9
+ } from "./chunk-ACBGEKB7.js";
10
10
  import {
11
11
  init_esbuild_shims
12
12
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-ACBGEKB7.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";