@qwen-code/qwen-code 0.12.4 → 0.12.5-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +286 -212
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -17012,7 +17012,7 @@ var require_util7 = __commonJS({
17012
17012
  var { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = require_symbols5();
17013
17013
  var { states, opcodes } = require_constants5();
17014
17014
  var { ErrorEvent: ErrorEvent2, createFastMessageEvent } = require_events();
17015
- var { isUtf8 } = __require("node:buffer");
17015
+ var { isUtf8: isUtf82 } = __require("node:buffer");
17016
17016
  var { collectASequenceOfCodePointsFast, removeHTTPWhitespace } = require_data_url();
17017
17017
  function isConnecting(ws2) {
17018
17018
  return ws2[kReadyState] === states.CONNECTING;
@@ -17164,7 +17164,7 @@ var require_util7 = __commonJS({
17164
17164
  var hasIntl = typeof process.versions.icu === "string";
17165
17165
  var fatalDecoder = hasIntl ? new TextDecoder("utf-8", { fatal: true }) : void 0;
17166
17166
  var utf8Decode = hasIntl ? fatalDecoder.decode.bind(fatalDecoder) : function(buffer) {
17167
- if (isUtf8(buffer)) {
17167
+ if (isUtf82(buffer)) {
17168
17168
  return buffer.toString("utf-8");
17169
17169
  }
17170
17170
  throw new TypeError("Invalid utf-8 received.");
@@ -20733,7 +20733,7 @@ var require_supports_color = __commonJS({
20733
20733
  "node_modules/supports-color/index.js"(exports2, module2) {
20734
20734
  "use strict";
20735
20735
  init_esbuild_shims();
20736
- var os47 = __require("os");
20736
+ var os48 = __require("os");
20737
20737
  var hasFlag3 = require_has_flag();
20738
20738
  var env7 = process.env;
20739
20739
  var forceColor;
@@ -20772,7 +20772,7 @@ var require_supports_color = __commonJS({
20772
20772
  }
20773
20773
  const min = forceColor ? 1 : 0;
20774
20774
  if (process.platform === "win32") {
20775
- const osRelease = os47.release().split(".");
20775
+ const osRelease = os48.release().split(".");
20776
20776
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
20777
20777
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
20778
20778
  }
@@ -32035,7 +32035,7 @@ var require_util10 = __commonJS({
32035
32035
  exports2.isValidFile = isValidFile;
32036
32036
  exports2.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
32037
32037
  var fs116 = __require("fs");
32038
- var os47 = __require("os");
32038
+ var os48 = __require("os");
32039
32039
  var path128 = __require("path");
32040
32040
  var WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
32041
32041
  var CLOUDSDK_CONFIG_DIRECTORY = "gcloud";
@@ -32142,7 +32142,7 @@ var require_util10 = __commonJS({
32142
32142
  }
32143
32143
  __name(getWellKnownCertificateConfigFileLocation, "getWellKnownCertificateConfigFileLocation");
32144
32144
  function _isWindows() {
32145
- return os47.platform().startsWith("win");
32145
+ return os48.platform().startsWith("win");
32146
32146
  }
32147
32147
  __name(_isWindows, "_isWindows");
32148
32148
  }
@@ -37698,7 +37698,7 @@ var require_googleauth = __commonJS({
37698
37698
  var fs116 = __require("fs");
37699
37699
  var gaxios_1 = require_src2();
37700
37700
  var gcpMetadata = require_src4();
37701
- var os47 = __require("os");
37701
+ var os48 = __require("os");
37702
37702
  var path128 = __require("path");
37703
37703
  var crypto_1 = require_crypto3();
37704
37704
  var computeclient_1 = require_computeclient();
@@ -38204,7 +38204,7 @@ var require_googleauth = __commonJS({
38204
38204
  * @api private
38205
38205
  */
38206
38206
  _isWindows() {
38207
- const sys = os47.platform();
38207
+ const sys = os48.platform();
38208
38208
  if (sys && sys.length >= 3) {
38209
38209
  if (sys.substring(0, 3).toLowerCase() === "win") {
38210
38210
  return true;
@@ -39425,7 +39425,7 @@ var require_validation = __commonJS({
39425
39425
  "node_modules/ws/lib/validation.js"(exports2, module2) {
39426
39426
  "use strict";
39427
39427
  init_esbuild_shims();
39428
- var { isUtf8 } = __require("buffer");
39428
+ var { isUtf8: isUtf82 } = __require("buffer");
39429
39429
  var { hasBlob } = require_constants6();
39430
39430
  var tokenChars = [
39431
39431
  0,
@@ -39609,9 +39609,9 @@ var require_validation = __commonJS({
39609
39609
  isValidUTF8: _isValidUTF8,
39610
39610
  tokenChars
39611
39611
  };
39612
- if (isUtf8) {
39612
+ if (isUtf82) {
39613
39613
  module2.exports.isValidUTF8 = function(buf) {
39614
- return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
39614
+ return buf.length < 24 ? _isValidUTF8(buf) : isUtf82(buf);
39615
39615
  };
39616
39616
  } else if (!process.env.WS_NO_UTF_8_VALIDATE) {
39617
39617
  try {
@@ -83692,7 +83692,7 @@ var require_service_config = __commonJS({
83692
83692
  exports2.validateRetryThrottling = validateRetryThrottling;
83693
83693
  exports2.validateServiceConfig = validateServiceConfig;
83694
83694
  exports2.extractAndSelectServiceConfig = extractAndSelectServiceConfig;
83695
- var os47 = __require("os");
83695
+ var os48 = __require("os");
83696
83696
  var constants_1 = require_constants8();
83697
83697
  var DURATION_REGEX = /^\d+(\.\d{1,9})?s$/;
83698
83698
  var CLIENT_LANGUAGE_STRING = "node";
@@ -83999,7 +83999,7 @@ var require_service_config = __commonJS({
83999
83999
  if (Array.isArray(validatedConfig.clientHostname)) {
84000
84000
  let hostnameMatched = false;
84001
84001
  for (const hostname4 of validatedConfig.clientHostname) {
84002
- if (hostname4 === os47.hostname()) {
84002
+ if (hostname4 === os48.hostname()) {
84003
84003
  hostnameMatched = true;
84004
84004
  }
84005
84005
  }
@@ -97965,7 +97965,7 @@ var require_subchannel_call = __commonJS({
97965
97965
  Object.defineProperty(exports2, "__esModule", { value: true });
97966
97966
  exports2.Http2SubchannelCall = void 0;
97967
97967
  var http22 = __require("http2");
97968
- var os47 = __require("os");
97968
+ var os48 = __require("os");
97969
97969
  var constants_1 = require_constants8();
97970
97970
  var metadata_1 = require_metadata3();
97971
97971
  var stream_decoder_1 = require_stream_decoder();
@@ -97973,7 +97973,7 @@ var require_subchannel_call = __commonJS({
97973
97973
  var constants_2 = require_constants8();
97974
97974
  var TRACER_NAME = "subchannel_call";
97975
97975
  function getSystemErrorName(errno) {
97976
- for (const [name3, num] of Object.entries(os47.constants.errno)) {
97976
+ for (const [name3, num] of Object.entries(os48.constants.errno)) {
97977
97977
  if (num === errno) {
97978
97978
  return name3;
97979
97979
  }
@@ -117941,7 +117941,7 @@ var require_ProcessDetector = __commonJS({
117941
117941
  exports2.processDetector = void 0;
117942
117942
  var api_1 = (init_esm2(), __toCommonJS(esm_exports2));
117943
117943
  var semconv_1 = require_semconv2();
117944
- var os47 = __require("os");
117944
+ var os48 = __require("os");
117945
117945
  var ProcessDetector = class {
117946
117946
  static {
117947
117947
  __name(this, "ProcessDetector");
@@ -117964,7 +117964,7 @@ var require_ProcessDetector = __commonJS({
117964
117964
  attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
117965
117965
  }
117966
117966
  try {
117967
- const userInfo2 = os47.userInfo();
117967
+ const userInfo2 = os48.userInfo();
117968
117968
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo2.username;
117969
117969
  } catch (e4) {
117970
117970
  api_1.diag.debug(`error obtaining process owner: ${e4}`);
@@ -124314,8 +124314,8 @@ var require_homedir = __commonJS({
124314
124314
  "node_modules/resolve/lib/homedir.js"(exports2, module2) {
124315
124315
  "use strict";
124316
124316
  init_esbuild_shims();
124317
- var os47 = __require("os");
124318
- module2.exports = os47.homedir || /* @__PURE__ */ __name(function homedir24() {
124317
+ var os48 = __require("os");
124318
+ module2.exports = os48.homedir || /* @__PURE__ */ __name(function homedir24() {
124319
124319
  var home = process.env.HOME;
124320
124320
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
124321
124321
  if (process.platform === "win32") {
@@ -133792,6 +133792,10 @@ function normalize2(model) {
133792
133792
  s5 = s5.replace(/-(?:\d?bit|int[48]|bf16|fp16|q[45]|quantized)$/g, "");
133793
133793
  return s5;
133794
133794
  }
133795
+ function hasExplicitOutputLimit(model) {
133796
+ const norm = normalize2(model);
133797
+ return OUTPUT_PATTERNS.some(([regex3]) => regex3.test(norm));
133798
+ }
133795
133799
  function tokenLimit(model, type = "input") {
133796
133800
  const norm = normalize2(model);
133797
133801
  const patterns = type === "output" ? OUTPUT_PATTERNS : PATTERNS;
@@ -133808,7 +133812,7 @@ var init_tokenLimits = __esm({
133808
133812
  "use strict";
133809
133813
  init_esbuild_shims();
133810
133814
  DEFAULT_TOKEN_LIMIT = 131072;
133811
- DEFAULT_OUTPUT_TOKEN_LIMIT = 16384;
133815
+ DEFAULT_OUTPUT_TOKEN_LIMIT = 32e3;
133812
133816
  LIMITS = {
133813
133817
  "32k": 32768,
133814
133818
  "64k": 65536,
@@ -133932,6 +133936,7 @@ var init_tokenLimits = __esm({
133932
133936
  // Kimi
133933
133937
  [/^kimi-k2\.5/, LIMITS["32k"]]
133934
133938
  ];
133939
+ __name(hasExplicitOutputLimit, "hasExplicitOutputLimit");
133935
133940
  __name(tokenLimit, "tokenLimit");
133936
133941
  }
133937
133942
  });
@@ -134801,18 +134806,6 @@ var init_modelsConfig = __esm({
134801
134806
  detail: "auto-detected from model"
134802
134807
  };
134803
134808
  }
134804
- if (!this._generationConfig.samplingParams?.max_tokens) {
134805
- const outputLimit = tokenLimit(model.id, "output");
134806
- if (!this._generationConfig.samplingParams) {
134807
- this._generationConfig.samplingParams = {};
134808
- }
134809
- this._generationConfig.samplingParams.max_tokens = outputLimit;
134810
- const existingSource = this.generationConfigSources["samplingParams"];
134811
- this.generationConfigSources["samplingParams"] = {
134812
- kind: "computed",
134813
- detail: existingSource ? `max_tokens auto-detected from model (other params from ${existingSource.kind})` : "max_tokens auto-detected from model"
134814
- };
134815
- }
134816
134809
  if (gc.modalities === void 0) {
134817
134810
  this._generationConfig.modalities = defaultModalities(model.id);
134818
134811
  this.generationConfigSources["modalities"] = {
@@ -142713,6 +142706,7 @@ var init_default = __esm({
142713
142706
  init_openai();
142714
142707
  init_constants2();
142715
142708
  init_runtimeFetchOptions();
142709
+ init_tokenLimits();
142716
142710
  DefaultOpenAICompatibleProvider = class {
142717
142711
  static {
142718
142712
  __name(this, "DefaultOpenAICompatibleProvider");
@@ -142747,15 +142741,66 @@ var init_default = __esm({
142747
142741
  }
142748
142742
  buildRequest(request4, _userPromptId) {
142749
142743
  const extraBody = this.contentGeneratorConfig.extra_body;
142744
+ const requestWithTokenLimits = this.applyOutputTokenLimit(request4);
142750
142745
  return {
142751
- ...request4,
142752
- // Preserve all original parameters including sampling params
142746
+ ...requestWithTokenLimits,
142753
142747
  ...extraBody ? extraBody : {}
142754
142748
  };
142755
142749
  }
142756
142750
  getDefaultGenerationConfig() {
142757
142751
  return {};
142758
142752
  }
142753
+ /**
142754
+ * Apply output token limit to a request's max_tokens parameter.
142755
+ *
142756
+ * Purpose:
142757
+ * Some APIs (e.g., OpenAI-compatible) default to a very small max_tokens value,
142758
+ * which can cause responses to be truncated mid-output. This function ensures
142759
+ * a reasonable default is set while respecting user configuration.
142760
+ *
142761
+ * Logic:
142762
+ * 1. If user explicitly configured max_tokens:
142763
+ * - For known models (in OUTPUT_PATTERNS): use the user's value, but cap at
142764
+ * model's max output limit to avoid API errors
142765
+ * (input + max_output > contextWindowSize would cause 400 errors on some APIs)
142766
+ * - For unknown models (deployment aliases, self-hosted): respect user's
142767
+ * configured value entirely (backend may support larger limits)
142768
+ * 2. If user didn't configure max_tokens:
142769
+ * - Use min(modelLimit, DEFAULT_OUTPUT_TOKEN_LIMIT)
142770
+ * - This provides a conservative default (32K) that avoids truncating output
142771
+ * while preserving input quota (not occupying too much context window)
142772
+ * 3. If model has no specific limit (tokenLimit returns default):
142773
+ * - Still apply DEFAULT_OUTPUT_TOKEN_LIMIT as safeguard
142774
+ *
142775
+ * Examples:
142776
+ * - User sets 4K, known model limit 64K → uses 4K (respects user preference)
142777
+ * - User sets 100K, known model limit 64K → uses 64K (capped to avoid API error)
142778
+ * - User sets 100K, unknown model → uses 100K (respects user, backend may support it)
142779
+ * - User not set, model limit 64K → uses 32K (conservative default)
142780
+ * - User not set, model limit 8K → uses 8K (model limit is lower)
142781
+ *
142782
+ * @param request - The chat completion request parameters
142783
+ * @returns The request with max_tokens adjusted according to the logic
142784
+ */
142785
+ applyOutputTokenLimit(request4) {
142786
+ const userMaxTokens = request4.max_tokens;
142787
+ const modelLimit = tokenLimit(request4.model, "output");
142788
+ const isKnownModel = hasExplicitOutputLimit(request4.model);
142789
+ let effectiveMaxTokens;
142790
+ if (userMaxTokens !== void 0 && userMaxTokens !== null) {
142791
+ if (isKnownModel) {
142792
+ effectiveMaxTokens = Math.min(userMaxTokens, modelLimit);
142793
+ } else {
142794
+ effectiveMaxTokens = userMaxTokens;
142795
+ }
142796
+ } else {
142797
+ effectiveMaxTokens = Math.min(modelLimit, DEFAULT_OUTPUT_TOKEN_LIMIT);
142798
+ }
142799
+ return {
142800
+ ...request4,
142801
+ max_tokens: effectiveMaxTokens
142802
+ };
142803
+ }
142759
142804
  };
142760
142805
  }
142761
142806
  });
@@ -142802,16 +142847,13 @@ var init_dashscope = __esm({
142802
142847
  init_contentGenerator();
142803
142848
  init_constants2();
142804
142849
  init_runtimeFetchOptions();
142805
- init_tokenLimits();
142806
- DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider {
142850
+ init_default();
142851
+ DashScopeOpenAICompatibleProvider = class _DashScopeOpenAICompatibleProvider extends DefaultOpenAICompatibleProvider {
142807
142852
  static {
142808
142853
  __name(this, "DashScopeOpenAICompatibleProvider");
142809
142854
  }
142810
- contentGeneratorConfig;
142811
- cliConfig;
142812
142855
  constructor(contentGeneratorConfig, cliConfig) {
142813
- this.cliConfig = cliConfig;
142814
- this.contentGeneratorConfig = contentGeneratorConfig;
142856
+ super(contentGeneratorConfig, cliConfig);
142815
142857
  }
142816
142858
  static isDashScopeProvider(contentGeneratorConfig) {
142817
142859
  const { authType, baseUrl } = contentGeneratorConfig;
@@ -143003,29 +143045,6 @@ var init_dashscope = __esm({
143003
143045
  }
143004
143046
  return false;
143005
143047
  }
143006
- /**
143007
- * Apply output token limit to a request's max_tokens parameter.
143008
- *
143009
- * Ensures that existing max_tokens parameters don't exceed the model's maximum output
143010
- * token limit. Only modifies max_tokens when already present in the request.
143011
- *
143012
- * @param request - The chat completion request parameters
143013
- * @returns The request with max_tokens adjusted to respect the model's limits (if present)
143014
- */
143015
- applyOutputTokenLimit(request4) {
143016
- const currentMaxTokens = request4.max_tokens;
143017
- if (currentMaxTokens === void 0 || currentMaxTokens === null) {
143018
- return request4;
143019
- }
143020
- const modelLimit = tokenLimit(request4.model, "output");
143021
- if (currentMaxTokens > modelLimit) {
143022
- return {
143023
- ...request4,
143024
- max_tokens: modelLimit
143025
- };
143026
- }
143027
- return request4;
143028
- }
143029
143048
  /**
143030
143049
  * Check if cache control should be disabled based on configuration.
143031
143050
  *
@@ -157264,6 +157283,7 @@ var init_anthropicContentGenerator = __esm({
157264
157283
  init_runtimeFetchOptions();
157265
157284
  init_constants2();
157266
157285
  init_debugLogger();
157286
+ init_tokenLimits();
157267
157287
  debugLogger14 = createDebugLogger("ANTHROPIC");
157268
157288
  AnthropicContentGenerator = class {
157269
157289
  static {
@@ -157373,7 +157393,11 @@ var init_anthropicContentGenerator = __esm({
157373
157393
  const requestValue = requestKey ? requestConfig[requestKey] : void 0;
157374
157394
  return configValue !== void 0 ? configValue : requestValue;
157375
157395
  }, "getParam");
157376
- const maxTokens = getParam("max_tokens", "maxOutputTokens") ?? 1e4;
157396
+ const userMaxTokens = getParam("max_tokens", "maxOutputTokens");
157397
+ const modelId = this.contentGeneratorConfig.model;
157398
+ const modelLimit = tokenLimit(modelId, "output");
157399
+ const isKnownModel = hasExplicitOutputLimit(modelId);
157400
+ const maxTokens = userMaxTokens !== void 0 && userMaxTokens !== null ? isKnownModel ? Math.min(userMaxTokens, modelLimit) : userMaxTokens : Math.min(modelLimit, DEFAULT_OUTPUT_TOKEN_LIMIT);
157377
157401
  return {
157378
157402
  max_tokens: maxTokens,
157379
157403
  temperature: getParam("temperature", "temperature") ?? 1,
@@ -157778,7 +157802,7 @@ __export(geminiContentGenerator_exports, {
157778
157802
  createGeminiContentGenerator: () => createGeminiContentGenerator
157779
157803
  });
157780
157804
  function createGeminiContentGenerator(config2, gcConfig) {
157781
- const version2 = "0.12.4";
157805
+ const version2 = "0.12.5-preview.0";
157782
157806
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
157783
157807
  const baseHeaders = {
157784
157808
  "User-Agent": userAgent2
@@ -172818,22 +172842,24 @@ var require_lib4 = __commonJS({
172818
172842
  });
172819
172843
 
172820
172844
  // packages/core/dist/src/utils/systemEncoding.js
172845
+ import { isUtf8 } from "node:buffer";
172821
172846
  import { execSync as execSync3 } from "node:child_process";
172822
172847
  import os10 from "node:os";
172823
172848
  function getCachedEncodingForBuffer(buffer) {
172849
+ if (isUtf8(buffer)) {
172850
+ return "utf-8";
172851
+ }
172852
+ const detected = detectEncodingFromBuffer(buffer);
172853
+ if (detected) {
172854
+ return detected;
172855
+ }
172824
172856
  if (cachedSystemEncoding === void 0) {
172825
172857
  cachedSystemEncoding = getSystemEncoding();
172826
172858
  }
172827
172859
  if (cachedSystemEncoding) {
172828
- if (cachedSystemEncoding !== "utf-8") {
172829
- const detected = detectEncodingFromBuffer(buffer);
172830
- if (detected === "utf-8") {
172831
- return "utf-8";
172832
- }
172833
- }
172834
172860
  return cachedSystemEncoding;
172835
172861
  }
172836
- return detectEncodingFromBuffer(buffer) || "utf-8";
172862
+ return "utf-8";
172837
172863
  }
172838
172864
  function getSystemEncoding() {
172839
172865
  if (os10.platform() === "win32") {
@@ -172879,7 +172905,7 @@ function windowsCodePageToEncoding(cp3) {
172879
172905
  866: "cp866",
172880
172906
  874: "windows-874",
172881
172907
  932: "shift_jis",
172882
- 936: "gb2312",
172908
+ 936: "gbk",
172883
172909
  949: "euc-kr",
172884
172910
  950: "big5",
172885
172911
  1200: "utf-16le",
@@ -178877,7 +178903,13 @@ function normalizePathEnvForWindows(env7) {
178877
178903
  }
178878
178904
  return normalized2;
178879
178905
  }
178880
- var import_headless, Terminal, SIGKILL_TIMEOUT_MS, WINDOWS_PATH_DELIMITER, cachedWindowsPathFingerprint, cachedMergedWindowsPath, REPLAY_TERMINAL_COLS, REPLAY_TERMINAL_ROWS, REPLAY_TERMINAL_SCROLLBACK, getFullBufferText, replayTerminalOutput, windowsStrategy, posixStrategy, getCleanupStrategy, ShellExecutionService;
178906
+ function applyPowerShellUtf8Prefix(command2, shell2) {
178907
+ if (os12.platform() === "win32" && shell2 === "powershell") {
178908
+ return "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" + command2;
178909
+ }
178910
+ return command2;
178911
+ }
178912
+ var import_headless, Terminal, SIGKILL_TIMEOUT_MS, WINDOWS_PATH_DELIMITER, cachedWindowsPathFingerprint, cachedMergedWindowsPath, getFullBufferText, replayTerminalOutput, windowsStrategy, posixStrategy, getCleanupStrategy, ShellExecutionService;
178881
178913
  var init_shellExecutionService = __esm({
178882
178914
  "packages/core/dist/src/services/shellExecutionService.js"() {
178883
178915
  "use strict";
@@ -178895,9 +178927,7 @@ var init_shellExecutionService = __esm({
178895
178927
  __name(mergeWindowsPathValues, "mergeWindowsPathValues");
178896
178928
  __name(getWindowsPathFingerprint, "getWindowsPathFingerprint");
178897
178929
  __name(normalizePathEnvForWindows, "normalizePathEnvForWindows");
178898
- REPLAY_TERMINAL_COLS = 1024;
178899
- REPLAY_TERMINAL_ROWS = 24;
178900
- REPLAY_TERMINAL_SCROLLBACK = 2e3;
178930
+ __name(applyPowerShellUtf8Prefix, "applyPowerShellUtf8Prefix");
178901
178931
  getFullBufferText = /* @__PURE__ */ __name((terminal) => {
178902
178932
  const buffer = terminal.buffer.active;
178903
178933
  const lines = [];
@@ -178908,12 +178938,12 @@ var init_shellExecutionService = __esm({
178908
178938
  }
178909
178939
  return lines.join("\n").trimEnd();
178910
178940
  }, "getFullBufferText");
178911
- replayTerminalOutput = /* @__PURE__ */ __name(async (output) => {
178941
+ replayTerminalOutput = /* @__PURE__ */ __name(async (output, cols, rows) => {
178912
178942
  const replayTerminal = new Terminal({
178913
178943
  allowProposedApi: true,
178914
- cols: REPLAY_TERMINAL_COLS,
178915
- rows: REPLAY_TERMINAL_ROWS,
178916
- scrollback: REPLAY_TERMINAL_SCROLLBACK,
178944
+ cols,
178945
+ rows,
178946
+ scrollback: 1e4,
178917
178947
  convertEol: true
178918
178948
  });
178919
178949
  await new Promise((resolve30) => {
@@ -178999,6 +179029,7 @@ var init_shellExecutionService = __esm({
178999
179029
  try {
179000
179030
  const isWindows9 = os12.platform() === "win32";
179001
179031
  const { executable, argsPrefix, shell: shell2 } = getShellConfiguration();
179032
+ commandToExecute = applyPowerShellUtf8Prefix(commandToExecute, shell2);
179002
179033
  const shellArgs = [...argsPrefix, commandToExecute];
179003
179034
  const child = cpSpawn(executable, shellArgs, {
179004
179035
  cwd: cwd7,
@@ -179156,6 +179187,7 @@ var init_shellExecutionService = __esm({
179156
179187
  const cols = shellExecutionConfig.terminalWidth ?? 80;
179157
179188
  const rows = shellExecutionConfig.terminalHeight ?? 30;
179158
179189
  const { executable, argsPrefix, shell: shell2 } = getShellConfiguration();
179190
+ commandToExecute = applyPowerShellUtf8Prefix(commandToExecute, shell2);
179159
179191
  const args = os12.platform() === "win32" && shell2 === "cmd" ? [...argsPrefix, commandToExecute].join(" ") : [...argsPrefix, commandToExecute];
179160
179192
  const ptyProcess = ptyInfo.module.spawn(executable, args, {
179161
179193
  cwd: cwd7,
@@ -179181,7 +179213,6 @@ var init_shellExecutionService = __esm({
179181
179213
  this.activePtys.set(ptyProcess.pid, { ptyProcess, headlessTerminal });
179182
179214
  let processingChain = Promise.resolve();
179183
179215
  let decoder = null;
179184
- let outputEncoding = "utf-8";
179185
179216
  let output = null;
179186
179217
  const outputChunks = [];
179187
179218
  const error40 = null;
@@ -179284,10 +179315,8 @@ var init_shellExecutionService = __esm({
179284
179315
  const encoding = getCachedEncodingForBuffer(data);
179285
179316
  try {
179286
179317
  decoder = new TextDecoder2(encoding);
179287
- outputEncoding = encoding;
179288
179318
  } catch {
179289
179319
  decoder = new TextDecoder2("utf-8");
179290
- outputEncoding = "utf-8";
179291
179320
  }
179292
179321
  }, "ensureDecoder");
179293
179322
  const handleOutput = /* @__PURE__ */ __name((data) => {
@@ -179335,8 +179364,9 @@ var init_shellExecutionService = __esm({
179335
179364
  let fullOutput = "";
179336
179365
  try {
179337
179366
  if (isStreamingRawContent) {
179338
- const decodedOutput = new TextDecoder2(outputEncoding).decode(finalBuffer);
179339
- fullOutput = await replayTerminalOutput(decodedOutput);
179367
+ const finalEncoding = getCachedEncodingForBuffer(finalBuffer);
179368
+ const decodedOutput = new TextDecoder2(finalEncoding).decode(finalBuffer);
179369
+ fullOutput = await replayTerminalOutput(decodedOutput, cols, rows);
179340
179370
  } else {
179341
179371
  fullOutput = getFullBufferText(headlessTerminal);
179342
179372
  }
@@ -195434,7 +195464,33 @@ var init_esm11 = __esm({
195434
195464
 
195435
195465
  // packages/core/dist/src/services/fileSystemService.js
195436
195466
  import fs32 from "node:fs/promises";
195467
+ import os14 from "node:os";
195437
195468
  import * as path31 from "node:path";
195469
+ function needsUtf8Bom(filePath) {
195470
+ const ext2 = path31.extname(filePath).toLowerCase();
195471
+ if (!UTF8_BOM_EXTENSIONS.has(ext2)) {
195472
+ return false;
195473
+ }
195474
+ if (cachedIsNonUtf8Windows === void 0) {
195475
+ if (os14.platform() !== "win32") {
195476
+ cachedIsNonUtf8Windows = false;
195477
+ } else {
195478
+ const sysEnc = getSystemEncoding();
195479
+ cachedIsNonUtf8Windows = sysEnc !== "utf-8";
195480
+ }
195481
+ }
195482
+ return cachedIsNonUtf8Windows;
195483
+ }
195484
+ function needsCrlfLineEndings(filePath) {
195485
+ if (os14.platform() !== "win32") {
195486
+ return false;
195487
+ }
195488
+ const ext2 = path31.extname(filePath).toLowerCase();
195489
+ return CRLF_EXTENSIONS.has(ext2);
195490
+ }
195491
+ function ensureCrlfLineEndings(content) {
195492
+ return content.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
195493
+ }
195438
195494
  function getBOMBytesForEncoding(encoding) {
195439
195495
  const lower3 = encoding.toLowerCase().replace(/[^a-z0-9]/g, "");
195440
195496
  switch (lower3) {
@@ -195454,7 +195510,7 @@ function getBOMBytesForEncoding(encoding) {
195454
195510
  return null;
195455
195511
  }
195456
195512
  }
195457
- var FileEncoding, StandardFileSystemService;
195513
+ var FileEncoding, CRLF_EXTENSIONS, UTF8_BOM_EXTENSIONS, cachedIsNonUtf8Windows, StandardFileSystemService;
195458
195514
  var init_fileSystemService = __esm({
195459
195515
  "packages/core/dist/src/services/fileSystemService.js"() {
195460
195516
  "use strict";
@@ -195462,10 +195518,16 @@ var init_fileSystemService = __esm({
195462
195518
  init_esm11();
195463
195519
  init_fileUtils();
195464
195520
  init_iconvHelper();
195521
+ init_systemEncoding();
195465
195522
  FileEncoding = {
195466
195523
  UTF8: "utf-8",
195467
195524
  UTF8_BOM: "utf-8-bom"
195468
195525
  };
195526
+ CRLF_EXTENSIONS = /* @__PURE__ */ new Set([".bat", ".cmd"]);
195527
+ UTF8_BOM_EXTENSIONS = /* @__PURE__ */ new Set([".ps1"]);
195528
+ __name(needsUtf8Bom, "needsUtf8Bom");
195529
+ __name(needsCrlfLineEndings, "needsCrlfLineEndings");
195530
+ __name(ensureCrlfLineEndings, "ensureCrlfLineEndings");
195469
195531
  __name(getBOMBytesForEncoding, "getBOMBytesForEncoding");
195470
195532
  StandardFileSystemService = class {
195471
195533
  static {
@@ -195481,7 +195543,8 @@ var init_fileSystemService = __esm({
195481
195543
  return { content, _meta: { bom, encoding, originalLineCount } };
195482
195544
  }
195483
195545
  async writeTextFile(params) {
195484
- const { content, path: filePath, _meta } = params;
195546
+ const { path: filePath, _meta } = params;
195547
+ const content = needsCrlfLineEndings(filePath) ? ensureCrlfLineEndings(params.content) : params.content;
195485
195548
  const bom = _meta?.["bom"] ?? false;
195486
195549
  const encoding = _meta?.["encoding"];
195487
195550
  const isNonUtf8Encoding = encoding && !isUtf8CompatibleEncoding(encoding) && iconvEncodingExists(encoding);
@@ -200759,7 +200822,7 @@ var init_detect_ide = __esm({
200759
200822
  // packages/core/dist/src/ide/process-utils.js
200760
200823
  import { exec, execFile as execFile7 } from "node:child_process";
200761
200824
  import { promisify as promisify7 } from "node:util";
200762
- import os14 from "node:os";
200825
+ import os15 from "node:os";
200763
200826
  import path33 from "node:path";
200764
200827
  async function getProcessInfo(pid) {
200765
200828
  try {
@@ -200870,7 +200933,7 @@ async function getIdeProcessInfoForWindows() {
200870
200933
  return { pid: myPid, command: myProc.command };
200871
200934
  }
200872
200935
  async function getIdeProcessInfo() {
200873
- const platform15 = os14.platform();
200936
+ const platform15 = os15.platform();
200874
200937
  if (platform15 === "win32") {
200875
200938
  return getIdeProcessInfoForWindows();
200876
200939
  }
@@ -219077,7 +219140,7 @@ var init_stdio2 = __esm({
219077
219140
  // packages/core/dist/src/ide/ide-client.js
219078
219141
  import * as dns from "node:dns";
219079
219142
  import * as fs34 from "node:fs";
219080
- import * as os15 from "node:os";
219143
+ import * as os16 from "node:os";
219081
219144
  import * as path34 from "node:path";
219082
219145
  function getRealPath(path128) {
219083
219146
  try {
@@ -219531,7 +219594,7 @@ var init_ide_client = __esm({
219531
219594
  async getLegacyConnectionConfig(portFromEnv) {
219532
219595
  if (this.ideProcessInfo) {
219533
219596
  try {
219534
- const portFile = path34.join(os15.tmpdir(), `qwen-code-ide-server-${this.ideProcessInfo.pid}.json`);
219597
+ const portFile = path34.join(os16.tmpdir(), `qwen-code-ide-server-${this.ideProcessInfo.pid}.json`);
219535
219598
  const portFileContents = await fs34.promises.readFile(portFile, "utf8");
219536
219599
  return JSON.parse(portFileContents);
219537
219600
  } catch (_2) {
@@ -219539,7 +219602,7 @@ var init_ide_client = __esm({
219539
219602
  }
219540
219603
  if (portFromEnv) {
219541
219604
  try {
219542
- const portFile = path34.join(os15.tmpdir(), `qwen-code-ide-server-${portFromEnv}.json`);
219605
+ const portFile = path34.join(os16.tmpdir(), `qwen-code-ide-server-${portFromEnv}.json`);
219543
219606
  const portFileContents = await fs34.promises.readFile(portFile, "utf8");
219544
219607
  return JSON.parse(portFileContents);
219545
219608
  } catch (_2) {
@@ -220343,7 +220406,13 @@ var init_edit = __esm({
220343
220406
  try {
220344
220407
  this.ensureParentDirectoriesExist(this.params.file_path);
220345
220408
  if (editData.isNewFile) {
220346
- const useBOM = this.config.getDefaultFileEncoding() === FileEncoding.UTF8_BOM;
220409
+ const userEncoding = this.config.getDefaultFileEncoding();
220410
+ let useBOM = false;
220411
+ if (userEncoding === FileEncoding.UTF8_BOM) {
220412
+ useBOM = true;
220413
+ } else if (userEncoding === void 0) {
220414
+ useBOM = needsUtf8Bom(this.params.file_path);
220415
+ }
220347
220416
  await this.config.getFileSystemService().writeTextFile({
220348
220417
  path: this.params.file_path,
220349
220418
  content: editData.newContent,
@@ -223354,7 +223423,7 @@ var init_base_token_storage = __esm({
223354
223423
  // packages/core/dist/src/mcp/token-storage/file-token-storage.js
223355
223424
  import { promises as fs40 } from "node:fs";
223356
223425
  import * as path43 from "node:path";
223357
- import * as os16 from "node:os";
223426
+ import * as os17 from "node:os";
223358
223427
  import * as crypto8 from "node:crypto";
223359
223428
  var FileTokenStorage;
223360
223429
  var init_file_token_storage = __esm({
@@ -223370,12 +223439,12 @@ var init_file_token_storage = __esm({
223370
223439
  encryptionKey;
223371
223440
  constructor(serviceName) {
223372
223441
  super(serviceName);
223373
- const configDir = path43.join(os16.homedir(), ".qwen");
223442
+ const configDir = path43.join(os17.homedir(), ".qwen");
223374
223443
  this.tokenFilePath = path43.join(configDir, "mcp-oauth-tokens-v2.json");
223375
223444
  this.encryptionKey = this.deriveEncryptionKey();
223376
223445
  }
223377
223446
  deriveEncryptionKey() {
223378
- const salt = `${os16.hostname()}-${os16.userInfo().username}-qwen-code`;
223447
+ const salt = `${os17.hostname()}-${os17.userInfo().username}-qwen-code`;
223379
223448
  return crypto8.scryptSync("qwen-code-oauth", salt, 32);
223380
223449
  }
223381
223450
  encrypt(text) {
@@ -231849,10 +231918,10 @@ var init_google_provider = __esm({
231849
231918
 
231850
231919
  // packages/core/dist/src/tools/web-search/providers/dashscope-provider.js
231851
231920
  import { promises as fs42 } from "node:fs";
231852
- import * as os17 from "os";
231921
+ import * as os18 from "os";
231853
231922
  import * as path45 from "path";
231854
231923
  function getQwenCachedCredentialPath2() {
231855
- return path45.join(os17.homedir(), QWEN_DIR5, QWEN_CREDENTIAL_FILENAME3);
231924
+ return path45.join(os18.homedir(), QWEN_DIR5, QWEN_CREDENTIAL_FILENAME3);
231856
231925
  }
231857
231926
  async function loadQwenCredentials() {
231858
231927
  try {
@@ -232317,7 +232386,12 @@ var init_write_file = __esm({
232317
232386
  }
232318
232387
  if (!fileExists2) {
232319
232388
  fs43.mkdirSync(dirName, { recursive: true });
232320
- useBOM = this.config.getDefaultFileEncoding() === FileEncoding.UTF8_BOM;
232389
+ const userEncoding = this.config.getDefaultFileEncoding();
232390
+ if (userEncoding === FileEncoding.UTF8_BOM) {
232391
+ useBOM = true;
232392
+ } else if (userEncoding === void 0) {
232393
+ useBOM = needsUtf8Bom(file_path);
232394
+ }
232321
232395
  detectedEncoding = void 0;
232322
232396
  }
232323
232397
  try {
@@ -235414,7 +235488,7 @@ var init_skill_load = __esm({
235414
235488
  import * as fs45 from "fs/promises";
235415
235489
  import * as fsSync2 from "fs";
235416
235490
  import * as path49 from "path";
235417
- import * as os18 from "os";
235491
+ import * as os19 from "os";
235418
235492
  import { fileURLToPath as fileURLToPath7 } from "url";
235419
235493
  var debugLogger58, QWEN_CONFIG_DIR2, SKILLS_CONFIG_DIR, SKILL_MANIFEST_FILE2, SkillManager;
235420
235494
  var init_skill_manager = __esm({
@@ -235728,7 +235802,7 @@ var init_skill_manager = __esm({
235728
235802
  case "project":
235729
235803
  return path49.join(this.config.getProjectRoot(), QWEN_CONFIG_DIR2, SKILLS_CONFIG_DIR);
235730
235804
  case "user":
235731
- return path49.join(os18.homedir(), QWEN_CONFIG_DIR2, SKILLS_CONFIG_DIR);
235805
+ return path49.join(os19.homedir(), QWEN_CONFIG_DIR2, SKILLS_CONFIG_DIR);
235732
235806
  case "bundled":
235733
235807
  return this.bundledSkillsDir;
235734
235808
  case "extension":
@@ -235745,7 +235819,7 @@ var init_skill_manager = __esm({
235745
235819
  */
235746
235820
  async listSkillsAtLevel(level) {
235747
235821
  const projectRoot = this.config.getProjectRoot();
235748
- const homeDir = os18.homedir();
235822
+ const homeDir = os19.homedir();
235749
235823
  const isHomeDirectory = path49.resolve(projectRoot) === path49.resolve(homeDir);
235750
235824
  if (level === "project" && isHomeDirectory) {
235751
235825
  debugLogger58.debug("Skipping project-level skills: project root is home directory");
@@ -236259,7 +236333,7 @@ Notes:
236259
236333
  // packages/core/dist/src/subagents/subagent-manager.js
236260
236334
  import * as fs46 from "fs/promises";
236261
236335
  import * as path50 from "path";
236262
- import * as os19 from "os";
236336
+ import * as os20 from "os";
236263
236337
  async function loadSubagentFromDir(baseDir) {
236264
236338
  try {
236265
236339
  const files = await fs46.readdir(baseDir);
@@ -236797,7 +236871,7 @@ ${config2.systemPrompt}
236797
236871
  if (level === "session") {
236798
236872
  return `<session:${name3}>`;
236799
236873
  }
236800
- const baseDir = level === "project" ? path50.join(this.config.getProjectRoot(), QWEN_CONFIG_DIR3, AGENT_CONFIG_DIR) : path50.join(os19.homedir(), QWEN_CONFIG_DIR3, AGENT_CONFIG_DIR);
236874
+ const baseDir = level === "project" ? path50.join(this.config.getProjectRoot(), QWEN_CONFIG_DIR3, AGENT_CONFIG_DIR) : path50.join(os20.homedir(), QWEN_CONFIG_DIR3, AGENT_CONFIG_DIR);
236801
236875
  return path50.join(baseDir, `${name3}.md`);
236802
236876
  }
236803
236877
  /**
@@ -236816,7 +236890,7 @@ ${config2.systemPrompt}
236816
236890
  return extensions.flatMap((extension) => extension.agents || []);
236817
236891
  }
236818
236892
  const projectRoot = this.config.getProjectRoot();
236819
- const homeDir = os19.homedir();
236893
+ const homeDir = os20.homedir();
236820
236894
  const isHomeDirectory = path50.resolve(projectRoot) === path50.resolve(homeDir);
236821
236895
  if (level === "project" && isHomeDirectory) {
236822
236896
  return [];
@@ -243505,8 +243579,8 @@ var require_yauzl = __commonJS({
243505
243579
  readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err2) {
243506
243580
  if (err2) return emitErrorAndAutoClose(self2, err2);
243507
243581
  if (self2.emittedError) return;
243508
- var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
243509
- entry.fileName = self2.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) : buffer.slice(0, entry.fileNameLength);
243582
+ var isUtf82 = (entry.generalPurposeBitFlag & 2048) !== 0;
243583
+ entry.fileName = self2.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf82) : buffer.slice(0, entry.fileNameLength);
243510
243584
  var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
243511
243585
  var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
243512
243586
  entry.extraFields = [];
@@ -243525,7 +243599,7 @@ var require_yauzl = __commonJS({
243525
243599
  });
243526
243600
  i3 = dataEnd;
243527
243601
  }
243528
- entry.fileComment = self2.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
243602
+ entry.fileComment = self2.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf82) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
243529
243603
  entry.comment = entry.fileComment;
243530
243604
  self2.readEntryCursor += buffer.length;
243531
243605
  self2.entriesRead += 1;
@@ -243888,8 +243962,8 @@ var require_yauzl = __commonJS({
243888
243962
  this.context.unref();
243889
243963
  };
243890
243964
  var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
243891
- function decodeBuffer(buffer, start, end, isUtf8) {
243892
- if (isUtf8) {
243965
+ function decodeBuffer(buffer, start, end, isUtf82) {
243966
+ if (isUtf82) {
243893
243967
  return buffer.toString("utf8", start, end);
243894
243968
  } else {
243895
243969
  var result = "";
@@ -244064,7 +244138,7 @@ var require_extract_zip = __commonJS({
244064
244138
  });
244065
244139
 
244066
244140
  // packages/core/dist/src/extension/github.js
244067
- import * as os20 from "node:os";
244141
+ import * as os21 from "node:os";
244068
244142
  import * as https4 from "node:https";
244069
244143
  import * as fs57 from "node:fs";
244070
244144
  import * as path59 from "node:path";
@@ -244088,7 +244162,7 @@ async function cloneFromGit(installMetadata, destination) {
244088
244162
  } catch {
244089
244163
  }
244090
244164
  }
244091
- const symlinkValue = os20.platform() === "win32" ? "false" : "true";
244165
+ const symlinkValue = os21.platform() === "win32" ? "false" : "true";
244092
244166
  await git.clone(sourceUrl, "./", [
244093
244167
  "-c",
244094
244168
  `core.symlinks=${symlinkValue}`,
@@ -244261,8 +244335,8 @@ async function downloadFromGitHubRelease(installMetadata, destination) {
244261
244335
  }
244262
244336
  }
244263
244337
  function findReleaseAsset(assets) {
244264
- const platform15 = os20.platform();
244265
- const arch3 = os20.arch();
244338
+ const platform15 = os21.platform();
244339
+ const arch3 = os21.arch();
244266
244340
  const platformArchPrefix = `${platform15}.${arch3}.`;
244267
244341
  const platformPrefix = `${platform15}.`;
244268
244342
  const platformArchAsset = assets.find((asset) => asset.name.toLowerCase().startsWith(platformArchPrefix));
@@ -244438,7 +244512,7 @@ var init_override = __esm({
244438
244512
 
244439
244513
  // packages/core/dist/src/extension/storage.js
244440
244514
  import path60 from "node:path";
244441
- import * as os21 from "node:os";
244515
+ import * as os22 from "node:os";
244442
244516
  import * as fs58 from "node:fs";
244443
244517
  var ExtensionStorage;
244444
244518
  var init_storage2 = __esm({
@@ -244465,9 +244539,9 @@ var init_storage2 = __esm({
244465
244539
  return path60.join(this.getExtensionDir(), EXTENSION_SETTINGS_FILENAME);
244466
244540
  }
244467
244541
  static getUserExtensionsDir() {
244468
- const homeDir = os21.homedir();
244542
+ const homeDir = os22.homedir();
244469
244543
  if (!homeDir) {
244470
- const tmpDir = os21.tmpdir();
244544
+ const tmpDir = os22.tmpdir();
244471
244545
  if (!tmpDir) {
244472
244546
  return "/tmp/.qwen/extensions";
244473
244547
  }
@@ -244477,7 +244551,7 @@ var init_storage2 = __esm({
244477
244551
  return storage.getExtensionsDir();
244478
244552
  }
244479
244553
  static async createTmpDir() {
244480
- return await fs58.promises.mkdtemp(path60.join(os21.tmpdir(), "qwen-extension"));
244554
+ return await fs58.promises.mkdtemp(path60.join(os22.tmpdir(), "qwen-extension"));
244481
244555
  }
244482
244556
  };
244483
244557
  }
@@ -247235,7 +247309,7 @@ var require_main = __commonJS({
247235
247309
  init_esbuild_shims();
247236
247310
  var fs116 = __require("fs");
247237
247311
  var path128 = __require("path");
247238
- var os47 = __require("os");
247312
+ var os48 = __require("os");
247239
247313
  var crypto14 = __require("crypto");
247240
247314
  var packageJson4 = require_package5();
247241
247315
  var version2 = packageJson4.version;
@@ -247390,7 +247464,7 @@ var require_main = __commonJS({
247390
247464
  }
247391
247465
  __name(_vaultPath, "_vaultPath");
247392
247466
  function _resolveHome(envPath) {
247393
- return envPath[0] === "~" ? path128.join(os47.homedir(), envPath.slice(1)) : envPath;
247467
+ return envPath[0] === "~" ? path128.join(os48.homedir(), envPath.slice(1)) : envPath;
247394
247468
  }
247395
247469
  __name(_resolveHome, "_resolveHome");
247396
247470
  function _configVault(options2) {
@@ -252830,7 +252904,7 @@ var init_extensionSettings = __esm({
252830
252904
  // packages/core/dist/src/extension/extensionManager.js
252831
252905
  import * as fs62 from "node:fs";
252832
252906
  import * as path64 from "node:path";
252833
- import * as os22 from "node:os";
252907
+ import * as os23 from "node:os";
252834
252908
  import { createHash as createHash5 } from "node:crypto";
252835
252909
  function ensureLeadingAndTrailingSlash2(dirPath) {
252836
252910
  let result = dirPath.replace(/\\/g, "/");
@@ -253074,7 +253148,7 @@ var init_extensionManager = __esm({
253074
253148
  if (!extension) {
253075
253149
  throw new Error(`Extension with name ${name3} does not exist.`);
253076
253150
  }
253077
- const scopePath = scope === SettingScope.Workspace ? currentDir : os22.homedir();
253151
+ const scopePath = scope === SettingScope.Workspace ? currentDir : os23.homedir();
253078
253152
  this.enableByPath(name3, true, scopePath);
253079
253153
  const config2 = getTelemetryConfig(currentDir, this.telemetrySettings);
253080
253154
  logExtensionEnable(config2, new ExtensionEnableEvent(name3, scope));
@@ -253094,7 +253168,7 @@ var init_extensionManager = __esm({
253094
253168
  if (!extension) {
253095
253169
  throw new Error(`Extension with name ${name3} does not exist.`);
253096
253170
  }
253097
- const scopePath = scope === SettingScope.Workspace ? currentDir : os22.homedir();
253171
+ const scopePath = scope === SettingScope.Workspace ? currentDir : os23.homedir();
253098
253172
  this.disableByPath(name3, true, scopePath);
253099
253173
  logExtensionDisable(config2, new ExtensionDisableEvent(name3, scope));
253100
253174
  extension.isActive = false;
@@ -253151,7 +253225,7 @@ var init_extensionManager = __esm({
253151
253225
  */
253152
253226
  async refreshCache() {
253153
253227
  this.extensionCache = /* @__PURE__ */ new Map();
253154
- const extensions = await this.loadExtensionsFromDir(os22.homedir());
253228
+ const extensions = await this.loadExtensionsFromDir(os23.homedir());
253155
253229
  extensions.forEach((extension) => {
253156
253230
  this.extensionCache.set(extension.name, extension);
253157
253231
  });
@@ -258186,7 +258260,7 @@ var init_config3 = __esm({
258186
258260
  this.truncateToolOutputThreshold = params.truncateToolOutputThreshold ?? DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD;
258187
258261
  this.truncateToolOutputLines = params.truncateToolOutputLines ?? DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES;
258188
258262
  this.channel = params.channel;
258189
- this.defaultFileEncoding = params.defaultFileEncoding ?? FileEncoding.UTF8;
258263
+ this.defaultFileEncoding = params.defaultFileEncoding;
258190
258264
  this.storage = new Storage(this.targetDir);
258191
258265
  this.inputFormat = params.inputFormat ?? InputFormat.TEXT;
258192
258266
  this.fileExclusions = new FileExclusions(this);
@@ -259452,7 +259526,7 @@ import * as child_process from "node:child_process";
259452
259526
  import * as process15 from "node:process";
259453
259527
  import * as path71 from "node:path";
259454
259528
  import * as fs68 from "node:fs";
259455
- import * as os23 from "node:os";
259529
+ import * as os24 from "node:os";
259456
259530
  function getVsCodeCommand(platform15 = process15.platform) {
259457
259531
  return platform15 === "win32" ? "code.cmd" : "code";
259458
259532
  }
@@ -259474,7 +259548,7 @@ async function findVsCodeCommand(platform15 = process15.platform) {
259474
259548
  } catch {
259475
259549
  }
259476
259550
  const locations = [];
259477
- const homeDir = os23.homedir();
259551
+ const homeDir = os24.homedir();
259478
259552
  if (platform15 === "darwin") {
259479
259553
  locations.push("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", path71.join(homeDir, "Library/Application Support/Code/bin/code"));
259480
259554
  } else if (platform15 === "linux") {
@@ -320346,7 +320420,7 @@ var require_supports_color2 = __commonJS({
320346
320420
  "node_modules/chalk/node_modules/supports-color/index.js"(exports2, module2) {
320347
320421
  "use strict";
320348
320422
  init_esbuild_shims();
320349
- var os47 = __require("os");
320423
+ var os48 = __require("os");
320350
320424
  var tty3 = __require("tty");
320351
320425
  var hasFlag3 = require_has_flag2();
320352
320426
  var { env: env7 } = process;
@@ -320395,7 +320469,7 @@ var require_supports_color2 = __commonJS({
320395
320469
  return min;
320396
320470
  }
320397
320471
  if (process.platform === "win32") {
320398
- const osRelease = os47.release().split(".");
320472
+ const osRelease = os48.release().split(".");
320399
320473
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
320400
320474
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
320401
320475
  }
@@ -348917,7 +348991,7 @@ var require_util28 = __commonJS({
348917
348991
  var { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = require_symbols10();
348918
348992
  var { states, opcodes } = require_constants18();
348919
348993
  var { ErrorEvent: ErrorEvent2, createFastMessageEvent } = require_events2();
348920
- var { isUtf8 } = __require("node:buffer");
348994
+ var { isUtf8: isUtf82 } = __require("node:buffer");
348921
348995
  var { collectASequenceOfCodePointsFast, removeHTTPWhitespace } = require_data_url2();
348922
348996
  function isConnecting(ws2) {
348923
348997
  return ws2[kReadyState] === states.CONNECTING;
@@ -349069,7 +349143,7 @@ var require_util28 = __commonJS({
349069
349143
  var hasIntl = typeof process.versions.icu === "string";
349070
349144
  var fatalDecoder = hasIntl ? new TextDecoder("utf-8", { fatal: true }) : void 0;
349071
349145
  var utf8Decode = hasIntl ? fatalDecoder.decode.bind(fatalDecoder) : function(buffer) {
349072
- if (isUtf8(buffer)) {
349146
+ if (isUtf82(buffer)) {
349073
349147
  return buffer.toString("utf-8");
349074
349148
  }
349075
349149
  throw new TypeError("Invalid utf-8 received.");
@@ -356952,7 +357026,7 @@ var require_supports_color3 = __commonJS({
356952
357026
  "node_modules/ink-link/node_modules/supports-color/index.js"(exports2, module2) {
356953
357027
  "use strict";
356954
357028
  init_esbuild_shims();
356955
- var os47 = __require("os");
357029
+ var os48 = __require("os");
356956
357030
  var tty3 = __require("tty");
356957
357031
  var hasFlag3 = require_has_flag2();
356958
357032
  var { env: env7 } = process;
@@ -357001,7 +357075,7 @@ var require_supports_color3 = __commonJS({
357001
357075
  return min;
357002
357076
  }
357003
357077
  if (process.platform === "win32") {
357004
- const osRelease = os47.release().split(".");
357078
+ const osRelease = os48.release().split(".");
357005
357079
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
357006
357080
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
357007
357081
  }
@@ -360879,7 +360953,7 @@ var require_util31 = __commonJS({
360879
360953
  exports2.isValidFile = isValidFile;
360880
360954
  exports2.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
360881
360955
  var fs116 = __require("fs");
360882
- var os47 = __require("os");
360956
+ var os48 = __require("os");
360883
360957
  var path128 = __require("path");
360884
360958
  var WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
360885
360959
  var CLOUDSDK_CONFIG_DIRECTORY = "gcloud";
@@ -360986,7 +361060,7 @@ var require_util31 = __commonJS({
360986
361060
  }
360987
361061
  __name(getWellKnownCertificateConfigFileLocation, "getWellKnownCertificateConfigFileLocation");
360988
361062
  function _isWindows() {
360989
- return os47.platform().startsWith("win");
361063
+ return os48.platform().startsWith("win");
360990
361064
  }
360991
361065
  __name(_isWindows, "_isWindows");
360992
361066
  }
@@ -365958,7 +366032,7 @@ var require_googleauth2 = __commonJS({
365958
366032
  var fs116 = __require("fs");
365959
366033
  var gaxios_1 = require_src40();
365960
366034
  var gcpMetadata = require_src42();
365961
- var os47 = __require("os");
366035
+ var os48 = __require("os");
365962
366036
  var path128 = __require("path");
365963
366037
  var crypto_1 = require_crypto6();
365964
366038
  var computeclient_1 = require_computeclient2();
@@ -366464,7 +366538,7 @@ var require_googleauth2 = __commonJS({
366464
366538
  * @api private
366465
366539
  */
366466
366540
  _isWindows() {
366467
- const sys = os47.platform();
366541
+ const sys = os48.platform();
366468
366542
  if (sys && sys.length >= 3) {
366469
366543
  if (sys.substring(0, 3).toLowerCase() === "win") {
366470
366544
  return true;
@@ -370595,9 +370669,9 @@ var require_defaults4 = __commonJS({
370595
370669
  "node_modules/@pnpm/npm-conf/lib/defaults.js"(exports2) {
370596
370670
  "use strict";
370597
370671
  init_esbuild_shims();
370598
- var os47 = __require("os");
370672
+ var os48 = __require("os");
370599
370673
  var path128 = __require("path");
370600
- var temp = os47.tmpdir();
370674
+ var temp = os48.tmpdir();
370601
370675
  var uidOrPid = process.getuid ? process.getuid() : process.pid;
370602
370676
  var hasUnicode = /* @__PURE__ */ __name(() => true, "hasUnicode");
370603
370677
  var isWindows9 = process.platform === "win32";
@@ -370608,7 +370682,7 @@ var require_defaults4 = __commonJS({
370608
370682
  var umask = {
370609
370683
  fromString: /* @__PURE__ */ __name(() => process.umask(), "fromString")
370610
370684
  };
370611
- var home = os47.homedir();
370685
+ var home = os48.homedir();
370612
370686
  if (home) {
370613
370687
  process.env.HOME = home;
370614
370688
  } else {
@@ -376625,7 +376699,7 @@ var ansi_styles_default3 = ansiStyles3;
376625
376699
  // node_modules/ink/node_modules/chalk/source/vendor/supports-color/index.js
376626
376700
  init_esbuild_shims();
376627
376701
  import process18 from "node:process";
376628
- import os24 from "node:os";
376702
+ import os25 from "node:os";
376629
376703
  import tty from "node:tty";
376630
376704
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process18.argv) {
376631
376705
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -376693,7 +376767,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
376693
376767
  return min;
376694
376768
  }
376695
376769
  if (process18.platform === "win32") {
376696
- const osRelease = os24.release().split(".");
376770
+ const osRelease = os25.release().split(".");
376697
376771
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
376698
376772
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
376699
376773
  }
@@ -379305,7 +379379,7 @@ var measure_element_default = measureElement;
379305
379379
  // packages/cli/src/gemini.tsx
379306
379380
  var import_react148 = __toESM(require_react(), 1);
379307
379381
  import dns2 from "node:dns";
379308
- import os46 from "node:os";
379382
+ import os47 from "node:os";
379309
379383
  import { basename as basename25 } from "node:path";
379310
379384
  import v8 from "node:v8";
379311
379385
 
@@ -383870,7 +383944,7 @@ init_esbuild_shims();
383870
383944
  // packages/cli/src/commands/extensions/utils.ts
383871
383945
  init_esbuild_shims();
383872
383946
  var import_chalk5 = __toESM(require_source(), 1);
383873
- import * as os25 from "node:os";
383947
+ import * as os26 from "node:os";
383874
383948
  async function getExtensionManager() {
383875
383949
  const workspaceDir = process.cwd();
383876
383950
  const extensionManager = new ExtensionManager({
@@ -383890,7 +383964,7 @@ function extensionToOutputString(extension, extensionManager, workspaceDir, inli
383890
383964
  const cwd7 = workspaceDir;
383891
383965
  const userEnabled = extensionManager.isEnabled(
383892
383966
  extension.config.name,
383893
- os25.homedir()
383967
+ os26.homedir()
383894
383968
  );
383895
383969
  const workspaceEnabled = extensionManager.isEnabled(
383896
383970
  extension.config.name,
@@ -385550,7 +385624,7 @@ yargsParser.looksLikeNumber = looksLikeNumber;
385550
385624
  var lib_default = yargsParser;
385551
385625
 
385552
385626
  // node_modules/yargs/lib/platform-shims/esm.mjs
385553
- import { basename as basename18, dirname as dirname24, extname as extname5, relative as relative9, resolve as resolve26 } from "path";
385627
+ import { basename as basename18, dirname as dirname24, extname as extname6, relative as relative9, resolve as resolve26 } from "path";
385554
385628
 
385555
385629
  // node_modules/yargs/build/lib/utils/process-argv.js
385556
385630
  init_esbuild_shims();
@@ -385818,7 +385892,7 @@ var esm_default3 = {
385818
385892
  path: {
385819
385893
  basename: basename18,
385820
385894
  dirname: dirname24,
385821
- extname: extname5,
385895
+ extname: extname6,
385822
385896
  relative: relative9,
385823
385897
  resolve: resolve26
385824
385898
  },
@@ -389752,7 +389826,7 @@ import { homedir as homedir19 } from "node:os";
389752
389826
 
389753
389827
  // packages/cli/src/utils/resolvePath.ts
389754
389828
  init_esbuild_shims();
389755
- import * as os26 from "node:os";
389829
+ import * as os27 from "node:os";
389756
389830
  import * as path87 from "node:path";
389757
389831
  function resolvePath2(p2) {
389758
389832
  if (!p2) {
@@ -389760,9 +389834,9 @@ function resolvePath2(p2) {
389760
389834
  }
389761
389835
  let expandedPath = p2;
389762
389836
  if (p2.toLowerCase().startsWith("%userprofile%")) {
389763
- expandedPath = os26.homedir() + p2.substring("%userprofile%".length);
389837
+ expandedPath = os27.homedir() + p2.substring("%userprofile%".length);
389764
389838
  } else if (p2 === "~" || p2.startsWith("~/")) {
389765
- expandedPath = os26.homedir() + p2.substring(1);
389839
+ expandedPath = os27.homedir() + p2.substring(1);
389766
389840
  }
389767
389841
  return path87.normalize(expandedPath);
389768
389842
  }
@@ -390002,14 +390076,14 @@ __name(getPackageJson, "getPackageJson");
390002
390076
  // packages/cli/src/utils/version.ts
390003
390077
  async function getCliVersion() {
390004
390078
  const pkgJson = await getPackageJson();
390005
- return "0.12.4";
390079
+ return "0.12.5-preview.0";
390006
390080
  }
390007
390081
  __name(getCliVersion, "getCliVersion");
390008
390082
 
390009
390083
  // packages/cli/src/config/sandboxConfig.ts
390010
390084
  init_esbuild_shims();
390011
390085
  var import_command_exists = __toESM(require_command_exists2(), 1);
390012
- import * as os27 from "node:os";
390086
+ import * as os28 from "node:os";
390013
390087
  var VALID_SANDBOX_COMMANDS = [
390014
390088
  "docker",
390015
390089
  "podman",
@@ -390045,7 +390119,7 @@ function getSandboxCommand(sandbox) {
390045
390119
  `Missing sandbox command '${sandbox}' (from QWEN_SANDBOX)`
390046
390120
  );
390047
390121
  }
390048
- if (os27.platform() === "darwin" && import_command_exists.default.sync("sandbox-exec")) {
390122
+ if (os28.platform() === "darwin" && import_command_exists.default.sync("sandbox-exec")) {
390049
390123
  return "sandbox-exec";
390050
390124
  } else if (import_command_exists.default.sync("docker") && sandbox === true) {
390051
390125
  return "docker";
@@ -394612,7 +394686,7 @@ async function loadCliConfig(settings, argv, cwd7 = process.cwd(), overrideExten
394612
394686
  // NOTE: do NOT set a yargs default for `chat-recording`, otherwise argv will
394613
394687
  // always be true and the settings file can never disable recording.
394614
394688
  chatRecording: argv.chatRecording ?? settings.general?.chatRecording ?? true,
394615
- defaultFileEncoding: settings.general?.defaultFileEncoding ?? FileEncoding.UTF8,
394689
+ defaultFileEncoding: settings.general?.defaultFileEncoding,
394616
394690
  lsp: {
394617
394691
  enabled: lspEnabled
394618
394692
  }
@@ -396417,7 +396491,7 @@ var QwenDark = new Theme(
396417
396491
  // packages/cli/src/ui/themes/theme-manager.ts
396418
396492
  import * as fs87 from "node:fs";
396419
396493
  import * as path93 from "node:path";
396420
- import * as os28 from "node:os";
396494
+ import * as os29 from "node:os";
396421
396495
 
396422
396496
  // packages/cli/src/ui/themes/ansi.ts
396423
396497
  init_esbuild_shims();
@@ -397069,7 +397143,7 @@ var ThemeManager = class {
397069
397143
  if (this.customThemes.has(canonicalPath)) {
397070
397144
  return this.customThemes.get(canonicalPath);
397071
397145
  }
397072
- const homeDir = path93.resolve(os28.homedir());
397146
+ const homeDir = path93.resolve(os29.homedir());
397073
397147
  if (!canonicalPath.startsWith(homeDir)) {
397074
397148
  debugLogger84.warn(
397075
397149
  `Theme file at "${themePath}" is outside your home directory. Only load themes from trusted sources.`
@@ -397488,7 +397562,7 @@ var import_react26 = __toESM(require_react(), 1);
397488
397562
  // packages/cli/src/utils/systemInfo.ts
397489
397563
  init_esbuild_shims();
397490
397564
  import process30 from "node:process";
397491
- import os29 from "node:os";
397565
+ import os30 from "node:os";
397492
397566
  import { execSync as execSync5 } from "node:child_process";
397493
397567
 
397494
397568
  // packages/cli/src/ui/utils/formatters.ts
@@ -397563,7 +397637,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
397563
397637
 
397564
397638
  // packages/cli/src/generated/git-commit.ts
397565
397639
  init_esbuild_shims();
397566
- var GIT_COMMIT_INFO = "0a93ad616";
397640
+ var GIT_COMMIT_INFO = "896aa6bf8";
397567
397641
 
397568
397642
  // packages/cli/src/utils/systemInfo.ts
397569
397643
  async function getNpmVersion() {
@@ -397604,7 +397678,7 @@ __name(getSandboxEnv, "getSandboxEnv");
397604
397678
  async function getSystemInfo(context2) {
397605
397679
  const osPlatform = process30.platform;
397606
397680
  const osArch = process30.arch;
397607
- const osRelease = os29.release();
397681
+ const osRelease = os30.release();
397608
397682
  const nodeVersion2 = process30.version;
397609
397683
  const npmVersion = await getNpmVersion();
397610
397684
  const sandboxEnv = getSandboxEnv();
@@ -398423,7 +398497,7 @@ var docsCommand = {
398423
398497
 
398424
398498
  // packages/cli/src/ui/commands/directoryCommand.tsx
398425
398499
  init_esbuild_shims();
398426
- import * as os30 from "node:os";
398500
+ import * as os31 from "node:os";
398427
398501
  import * as path94 from "node:path";
398428
398502
  function expandHomeDir(p2) {
398429
398503
  if (!p2) {
@@ -398431,9 +398505,9 @@ function expandHomeDir(p2) {
398431
398505
  }
398432
398506
  let expandedPath = p2;
398433
398507
  if (p2.toLowerCase().startsWith("%userprofile%")) {
398434
- expandedPath = os30.homedir() + p2.substring("%userprofile%".length);
398508
+ expandedPath = os31.homedir() + p2.substring("%userprofile%".length);
398435
398509
  } else if (p2 === "~" || p2.startsWith("~/")) {
398436
- expandedPath = os30.homedir() + p2.substring(1);
398510
+ expandedPath = os31.homedir() + p2.substring(1);
398437
398511
  }
398438
398512
  return path94.normalize(expandedPath);
398439
398513
  }
@@ -401307,7 +401381,7 @@ var mcpCommand2 = {
401307
401381
  // packages/cli/src/ui/commands/memoryCommand.ts
401308
401382
  init_esbuild_shims();
401309
401383
  import path98 from "node:path";
401310
- import os31 from "node:os";
401384
+ import os32 from "node:os";
401311
401385
  import fs90 from "node:fs/promises";
401312
401386
  var memoryCommand = {
401313
401387
  name: "memory",
@@ -401392,7 +401466,7 @@ ${memoryContent}
401392
401466
  action: /* @__PURE__ */ __name(async (context2) => {
401393
401467
  try {
401394
401468
  const globalMemoryPath = path98.join(
401395
- os31.homedir(),
401469
+ os32.homedir(),
401396
401470
  QWEN_DIR,
401397
401471
  getCurrentGeminiMdFilename()
401398
401472
  );
@@ -402265,7 +402339,7 @@ init_esbuild_shims();
402265
402339
  // packages/cli/src/ui/utils/terminalSetup.ts
402266
402340
  init_esbuild_shims();
402267
402341
  import { promises as fs92 } from "node:fs";
402268
- import * as os32 from "node:os";
402342
+ import * as os33 from "node:os";
402269
402343
  import * as path101 from "node:path";
402270
402344
  import { exec as exec3 } from "node:child_process";
402271
402345
  import { promisify as promisify9 } from "node:util";
@@ -402390,7 +402464,7 @@ async function detectTerminal() {
402390
402464
  if (termProgram === "vscode" || process.env["VSCODE_GIT_IPC_HANDLE"]) {
402391
402465
  return "vscode";
402392
402466
  }
402393
- if (os32.platform() !== "win32") {
402467
+ if (os33.platform() !== "win32") {
402394
402468
  try {
402395
402469
  const { stdout } = await execAsync2("ps -o comm= -p $PPID");
402396
402470
  const parentName = stdout.trim();
@@ -402420,10 +402494,10 @@ async function backupFile(filePath) {
402420
402494
  }
402421
402495
  __name(backupFile, "backupFile");
402422
402496
  function getVSCodeStyleConfigDir(appName) {
402423
- const platform15 = os32.platform();
402497
+ const platform15 = os33.platform();
402424
402498
  if (platform15 === "darwin") {
402425
402499
  return path101.join(
402426
- os32.homedir(),
402500
+ os33.homedir(),
402427
402501
  "Library",
402428
402502
  "Application Support",
402429
402503
  appName,
@@ -402435,7 +402509,7 @@ function getVSCodeStyleConfigDir(appName) {
402435
402509
  }
402436
402510
  return path101.join(process.env["APPDATA"], appName, "User");
402437
402511
  } else {
402438
- return path101.join(os32.homedir(), ".config", appName, "User");
402512
+ return path101.join(os33.homedir(), ".config", appName, "User");
402439
402513
  }
402440
402514
  }
402441
402515
  __name(getVSCodeStyleConfigDir, "getVSCodeStyleConfigDir");
@@ -402977,13 +403051,13 @@ var setupGithubCommand = {
402977
403051
  // packages/cli/src/ui/commands/insightCommand.ts
402978
403052
  init_esbuild_shims();
402979
403053
  import { join as join43 } from "path";
402980
- import os34 from "os";
403054
+ import os35 from "os";
402981
403055
 
402982
403056
  // packages/cli/src/services/insight/generators/StaticInsightGenerator.ts
402983
403057
  init_esbuild_shims();
402984
403058
  import fs95 from "fs/promises";
402985
403059
  import path104 from "path";
402986
- import os33 from "os";
403060
+ import os34 from "os";
402987
403061
 
402988
403062
  // packages/cli/src/services/insight/generators/DataProcessor.ts
402989
403063
  init_esbuild_shims();
@@ -404091,7 +404165,7 @@ var StaticInsightGenerator = class {
404091
404165
  }
404092
404166
  // Ensure the output directory exists
404093
404167
  async ensureOutputDirectory() {
404094
- const outputDir = path104.join(os33.homedir(), ".qwen", "insights");
404168
+ const outputDir = path104.join(os34.homedir(), ".qwen", "insights");
404095
404169
  await fs95.mkdir(outputDir, { recursive: true });
404096
404170
  return outputDir;
404097
404171
  }
@@ -404144,7 +404218,7 @@ var insightCommand = {
404144
404218
  action: /* @__PURE__ */ __name(async (context2) => {
404145
404219
  try {
404146
404220
  context2.ui.setDebugMessage(t4("Generating insights..."));
404147
- const projectsDir = join43(os34.homedir(), ".qwen", "projects");
404221
+ const projectsDir = join43(os35.homedir(), ".qwen", "projects");
404148
404222
  if (!context2.services.config) {
404149
404223
  throw new Error("Config service is not available");
404150
404224
  }
@@ -426656,7 +426730,7 @@ init_esbuild_shims();
426656
426730
  var import_react46 = __toESM(require_react(), 1);
426657
426731
  import { spawnSync as spawnSync4 } from "node:child_process";
426658
426732
  import fs99 from "node:fs";
426659
- import os35 from "node:os";
426733
+ import os36 from "node:os";
426660
426734
  import pathMod from "node:path";
426661
426735
 
426662
426736
  // packages/cli/src/ui/components/shared/vim-buffer-actions.ts
@@ -428489,7 +428563,7 @@ function useTextBuffer({
428489
428563
  const openInExternalEditor = (0, import_react46.useCallback)(
428490
428564
  async (opts = {}) => {
428491
428565
  const editor = opts.editor ?? process.env["VISUAL"] ?? process.env["EDITOR"] ?? (process.platform === "win32" ? "notepad" : "vi");
428492
- const tmpDir = fs99.mkdtempSync(pathMod.join(os35.tmpdir(), "qwen-edit-"));
428566
+ const tmpDir = fs99.mkdtempSync(pathMod.join(os36.tmpdir(), "qwen-edit-"));
428493
428567
  const filePath = pathMod.join(tmpDir, "buffer.txt");
428494
428568
  fs99.writeFileSync(filePath, text, "utf8");
428495
428569
  dispatch({ type: "create_undo_snapshot" });
@@ -444980,7 +445054,7 @@ init_esbuild_shims();
444980
445054
  var import_react122 = __toESM(require_react(), 1);
444981
445055
  import crypto13 from "node:crypto";
444982
445056
  import path113 from "node:path";
444983
- import os36 from "node:os";
445057
+ import os37 from "node:os";
444984
445058
  import fs103 from "node:fs";
444985
445059
  var OUTPUT_UPDATE_INTERVAL_MS2 = 1e3;
444986
445060
  var MAX_OUTPUT_LENGTH2 = 1e4;
@@ -445018,14 +445092,14 @@ var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPend
445018
445092
  { type: "user_shell", text: rawQuery },
445019
445093
  userMessageTimestamp
445020
445094
  );
445021
- const isWindows9 = os36.platform() === "win32";
445095
+ const isWindows9 = os37.platform() === "win32";
445022
445096
  const targetDir = config2.getTargetDir();
445023
445097
  let commandToExecute = rawQuery;
445024
445098
  let pwdFilePath;
445025
445099
  if (!isWindows9) {
445026
445100
  let command2 = rawQuery.trim();
445027
445101
  const pwdFileName = `shell_pwd_${crypto13.randomBytes(6).toString("hex")}.tmp`;
445028
- pwdFilePath = path113.join(os36.tmpdir(), pwdFileName);
445102
+ pwdFilePath = path113.join(os37.tmpdir(), pwdFileName);
445029
445103
  if (!command2.endsWith(";") && !command2.endsWith("&")) {
445030
445104
  command2 += ";";
445031
445105
  }
@@ -447559,13 +447633,13 @@ import { format as format3 } from "node:util";
447559
447633
  init_esbuild_shims();
447560
447634
  var import_graceful_fs = __toESM(require_graceful_fs(), 1);
447561
447635
  import path119 from "node:path";
447562
- import os39 from "node:os";
447636
+ import os40 from "node:os";
447563
447637
 
447564
447638
  // node_modules/xdg-basedir/index.js
447565
447639
  init_esbuild_shims();
447566
- import os37 from "os";
447640
+ import os38 from "os";
447567
447641
  import path116 from "path";
447568
- var homeDirectory = os37.homedir();
447642
+ var homeDirectory = os38.homedir();
447569
447643
  var { env: env5 } = process;
447570
447644
  var xdgData = env5.XDG_DATA_HOME || (homeDirectory ? path116.join(homeDirectory, ".local", "share") : void 0);
447571
447645
  var xdgConfig = env5.XDG_CONFIG_HOME || (homeDirectory ? path116.join(homeDirectory, ".config") : void 0);
@@ -447800,14 +447874,14 @@ var dist_default7 = FS;
447800
447874
 
447801
447875
  // node_modules/atomically/dist/constants.js
447802
447876
  init_esbuild_shims();
447803
- import os38 from "node:os";
447877
+ import os39 from "node:os";
447804
447878
  import process40 from "node:process";
447805
447879
  var DEFAULT_ENCODING = "utf8";
447806
447880
  var DEFAULT_FILE_MODE = 438;
447807
447881
  var DEFAULT_FOLDER_MODE = 511;
447808
447882
  var DEFAULT_WRITE_OPTIONS = {};
447809
- var DEFAULT_USER_UID = os38.userInfo().uid;
447810
- var DEFAULT_USER_GID = os38.userInfo().gid;
447883
+ var DEFAULT_USER_UID = os39.userInfo().uid;
447884
+ var DEFAULT_USER_GID = os39.userInfo().gid;
447811
447885
  var DEFAULT_TIMEOUT_SYNC = 1e3;
447812
447886
  var IS_POSIX = !!process40.getuid;
447813
447887
  var IS_USER_ROOT2 = process40.getuid ? !process40.getuid() : false;
@@ -448260,7 +448334,7 @@ __name(hasProperty, "hasProperty");
448260
448334
  // node_modules/configstore/index.js
448261
448335
  function getConfigDirectory(id, globalConfigPath) {
448262
448336
  const pathPrefix = globalConfigPath ? path119.join(id, "config.json") : path119.join("configstore", `${id}.json`);
448263
- const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os39.tmpdir()) + path119.sep);
448337
+ const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os40.tmpdir()) + path119.sep);
448264
448338
  return path119.join(configDirectory, pathPrefix);
448265
448339
  }
448266
448340
  __name(getConfigDirectory, "getConfigDirectory");
@@ -448539,7 +448613,7 @@ var ansi_styles_default6 = ansiStyles6;
448539
448613
  // node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.js
448540
448614
  init_esbuild_shims();
448541
448615
  import process43 from "node:process";
448542
- import os40 from "node:os";
448616
+ import os41 from "node:os";
448543
448617
  import tty2 from "node:tty";
448544
448618
  function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process43.argv) {
448545
448619
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -448607,7 +448681,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
448607
448681
  return min;
448608
448682
  }
448609
448683
  if (process43.platform === "win32") {
448610
- const osRelease = os40.release().split(".");
448684
+ const osRelease = os41.release().split(".");
448611
448685
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
448612
448686
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
448613
448687
  }
@@ -449604,7 +449678,7 @@ init_esbuild_shims();
449604
449678
  var import_ini2 = __toESM(require_ini3(), 1);
449605
449679
  import process45 from "node:process";
449606
449680
  import path120 from "node:path";
449607
- import os41 from "node:os";
449681
+ import os42 from "node:os";
449608
449682
  import fs108 from "node:fs";
449609
449683
  var isWindows8 = process45.platform === "win32";
449610
449684
  var readRc = /* @__PURE__ */ __name((filePath) => {
@@ -449639,7 +449713,7 @@ var getNpmPrefix = /* @__PURE__ */ __name(() => {
449639
449713
  if (envPrefix) {
449640
449714
  return envPrefix;
449641
449715
  }
449642
- const homePrefix = readRc(path120.join(os41.homedir(), ".npmrc"));
449716
+ const homePrefix = readRc(path120.join(os42.homedir(), ".npmrc"));
449643
449717
  if (homePrefix) {
449644
449718
  return homePrefix;
449645
449719
  }
@@ -449670,11 +449744,11 @@ var getYarnPrefix = /* @__PURE__ */ __name(() => {
449670
449744
  if (windowsPrefix) {
449671
449745
  return windowsPrefix;
449672
449746
  }
449673
- const configPrefix = path120.join(os41.homedir(), ".config/yarn");
449747
+ const configPrefix = path120.join(os42.homedir(), ".config/yarn");
449674
449748
  if (fs108.existsSync(configPrefix)) {
449675
449749
  return configPrefix;
449676
449750
  }
449677
- const homePrefix = path120.join(os41.homedir(), ".yarn-config");
449751
+ const homePrefix = path120.join(os42.homedir(), ".yarn-config");
449678
449752
  if (fs108.existsSync(homePrefix)) {
449679
449753
  return homePrefix;
449680
449754
  }
@@ -450521,7 +450595,7 @@ import { spawn as spawn11 } from "node:child_process";
450521
450595
  var spawnWrapper = spawn11;
450522
450596
 
450523
450597
  // packages/cli/src/utils/handleAutoUpdate.ts
450524
- import os42 from "node:os";
450598
+ import os43 from "node:os";
450525
450599
  function handleAutoUpdate(info, settings, projectRoot, spawnFn = spawnWrapper) {
450526
450600
  if (!info) {
450527
450601
  return;
@@ -450547,7 +450621,7 @@ ${installationInfo.updateMessage}`;
450547
450621
  "@latest",
450548
450622
  isNightly ? "@nightly" : `@${info.update.latest}`
450549
450623
  );
450550
- const isWindows9 = os42.platform() === "win32";
450624
+ const isWindows9 = os43.platform() === "win32";
450551
450625
  const shell2 = isWindows9 ? "cmd.exe" : "bash";
450552
450626
  const shellArgs = isWindows9 ? ["/c", updateCommand2] : ["-c", updateCommand2];
450553
450627
  const updateProcess = spawnFn(shell2, shellArgs, { stdio: "pipe" });
@@ -452635,7 +452709,7 @@ __name(relaunchAppInChildProcess, "relaunchAppInChildProcess");
452635
452709
  init_esbuild_shims();
452636
452710
  var import_shell_quote5 = __toESM(require_shell_quote(), 1);
452637
452711
  import { exec as exec4, execSync as execSync8, spawn as spawn13 } from "node:child_process";
452638
- import os43 from "node:os";
452712
+ import os44 from "node:os";
452639
452713
  import path126 from "node:path";
452640
452714
  import fs113 from "node:fs";
452641
452715
  import { fileURLToPath as fileURLToPath17 } from "node:url";
@@ -452643,7 +452717,7 @@ import { promisify as promisify12 } from "node:util";
452643
452717
  import { randomBytes as randomBytes5 } from "node:crypto";
452644
452718
  var execAsync3 = promisify12(exec4);
452645
452719
  function getContainerPath(hostPath) {
452646
- if (os43.platform() !== "win32") {
452720
+ if (os44.platform() !== "win32") {
452647
452721
  return hostPath;
452648
452722
  }
452649
452723
  const withForwardSlashes = hostPath.replace(/\\/g, "/");
@@ -452673,7 +452747,7 @@ async function shouldUseCurrentUserInSandbox() {
452673
452747
  if (envVar === "0" || envVar === "false") {
452674
452748
  return false;
452675
452749
  }
452676
- if (os43.platform() === "linux") {
452750
+ if (os44.platform() === "linux") {
452677
452751
  const debugEnv = [process.env["DEBUG"], process.env["DEBUG_MODE"]].some(
452678
452752
  (v2) => v2 === "true" || v2 === "1"
452679
452753
  );
@@ -452698,7 +452772,7 @@ function ports() {
452698
452772
  }
452699
452773
  __name(ports, "ports");
452700
452774
  function entrypoint(workdir, cliArgs) {
452701
- const isWindows9 = os43.platform() === "win32";
452775
+ const isWindows9 = os44.platform() === "win32";
452702
452776
  const containerWorkdir = getContainerPath(workdir);
452703
452777
  const shellCmds = [];
452704
452778
  const pathSeparator = isWindows9 ? ";" : ":";
@@ -452777,9 +452851,9 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
452777
452851
  "-D",
452778
452852
  `TARGET_DIR=${fs113.realpathSync(process.cwd())}`,
452779
452853
  "-D",
452780
- `TMP_DIR=${fs113.realpathSync(os43.tmpdir())}`,
452854
+ `TMP_DIR=${fs113.realpathSync(os44.tmpdir())}`,
452781
452855
  "-D",
452782
- `HOME_DIR=${fs113.realpathSync(os43.homedir())}`,
452856
+ `HOME_DIR=${fs113.realpathSync(os44.homedir())}`,
452783
452857
  "-D",
452784
452858
  `CACHE_DIR=${fs113.realpathSync(execSync8(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`
452785
452859
  ];
@@ -452943,8 +453017,8 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
452943
453017
  `${userSettingsDirOnHost}:${getContainerPath(userSettingsDirOnHost)}`
452944
453018
  );
452945
453019
  }
452946
- args.push("--volume", `${os43.tmpdir()}:${getContainerPath(os43.tmpdir())}`);
452947
- const gcloudConfigDir = path126.join(os43.homedir(), ".config", "gcloud");
453020
+ args.push("--volume", `${os44.tmpdir()}:${getContainerPath(os44.tmpdir())}`);
453021
+ const gcloudConfigDir = path126.join(os44.homedir(), ".config", "gcloud");
452948
453022
  if (fs113.existsSync(gcloudConfigDir)) {
452949
453023
  args.push(
452950
453024
  "--volume",
@@ -453142,7 +453216,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
453142
453216
  }
453143
453217
  args.push("--env", `SANDBOX=${containerName}`);
453144
453218
  if (config2.command === "podman") {
453145
- const emptyAuthFilePath = path126.join(os43.tmpdir(), "empty_auth.json");
453219
+ const emptyAuthFilePath = path126.join(os44.tmpdir(), "empty_auth.json");
453146
453220
  fs113.writeFileSync(emptyAuthFilePath, "{}", "utf-8");
453147
453221
  args.push("--authfile", emptyAuthFilePath);
453148
453222
  }
@@ -453154,7 +453228,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
453154
453228
  const uid = execSync8("id -u").toString().trim();
453155
453229
  const gid = execSync8("id -g").toString().trim();
453156
453230
  const username = "qwen";
453157
- const homeDir = getContainerPath(os43.homedir());
453231
+ const homeDir = getContainerPath(os44.homedir());
453158
453232
  const setupUserCommands = [
453159
453233
  // Use -f with groupadd to avoid errors if the group already exists.
453160
453234
  `groupadd -f -g ${gid} ${username}`,
@@ -453166,7 +453240,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
453166
453240
  const suCommand = `su -p ${username} -c '${escapedOriginalCommand}'`;
453167
453241
  finalEntrypoint[2] = `${setupUserCommands} && ${suCommand}`;
453168
453242
  userFlag = `--user ${uid}:${gid}`;
453169
- args.push("--env", `HOME=${os43.homedir()}`);
453243
+ args.push("--env", `HOME=${os44.homedir()}`);
453170
453244
  } else if (isIntegrationTest) {
453171
453245
  args.push("--user", "root");
453172
453246
  userFlag = "--user root";
@@ -453177,7 +453251,7 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
453177
453251
  let sandboxProcess = void 0;
453178
453252
  if (proxyCommand) {
453179
453253
  const proxyContainerCommand = `${config2.command} run --rm --init ${userFlag} --name ${SANDBOX_PROXY_NAME} --network ${SANDBOX_PROXY_NAME} -p 8877:8877 -v ${process.cwd()}:${workdir} --workdir ${workdir} ${image2} ${proxyCommand}`;
453180
- const isWindows9 = os43.platform() === "win32";
453254
+ const isWindows9 = os44.platform() === "win32";
453181
453255
  const proxyShell = isWindows9 ? "cmd.exe" : "bash";
453182
453256
  const proxyShellArgs = isWindows9 ? ["/c", proxyContainerCommand] : ["-c", proxyContainerCommand];
453183
453257
  proxyProcess = spawn13(proxyShell, proxyShellArgs, {
@@ -453345,9 +453419,9 @@ __name(ensureSandboxImageIsPresent, "ensureSandboxImageIsPresent");
453345
453419
  // packages/cli/src/utils/startupWarnings.ts
453346
453420
  init_esbuild_shims();
453347
453421
  import fs114 from "node:fs/promises";
453348
- import os44 from "node:os";
453422
+ import os45 from "node:os";
453349
453423
  import { join as pathJoin } from "node:path";
453350
- var warningsFilePath = pathJoin(os44.tmpdir(), "qwen-code-warnings.txt");
453424
+ var warningsFilePath = pathJoin(os45.tmpdir(), "qwen-code-warnings.txt");
453351
453425
  async function getStartupWarnings() {
453352
453426
  try {
453353
453427
  await fs114.access(warningsFilePath);
@@ -453371,7 +453445,7 @@ __name(getStartupWarnings, "getStartupWarnings");
453371
453445
  // packages/cli/src/utils/userStartupWarnings.ts
453372
453446
  init_esbuild_shims();
453373
453447
  import fs115 from "node:fs/promises";
453374
- import * as os45 from "node:os";
453448
+ import * as os46 from "node:os";
453375
453449
  import path127 from "node:path";
453376
453450
  var homeDirectoryCheck = {
453377
453451
  id: "home-directory",
@@ -453379,7 +453453,7 @@ var homeDirectoryCheck = {
453379
453453
  try {
453380
453454
  const [workspaceRealPath, homeRealPath] = await Promise.all([
453381
453455
  fs115.realpath(options2.workspaceRoot),
453382
- fs115.realpath(os45.homedir())
453456
+ fs115.realpath(os46.homedir())
453383
453457
  ]);
453384
453458
  if (workspaceRealPath === homeRealPath) {
453385
453459
  return "You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory.";
@@ -456240,7 +456314,7 @@ var QwenAgent = class {
456240
456314
  async initialize(args) {
456241
456315
  this.clientCapabilities = args.clientCapabilities;
456242
456316
  const authMethods = buildAuthMethods();
456243
- const version2 = "0.12.4";
456317
+ const version2 = "0.12.5-preview.0";
456244
456318
  return {
456245
456319
  protocolVersion: PROTOCOL_VERSION,
456246
456320
  agentInfo: {
@@ -456636,7 +456710,7 @@ function validateDnsResolutionOrder(order) {
456636
456710
  }
456637
456711
  __name(validateDnsResolutionOrder, "validateDnsResolutionOrder");
456638
456712
  function getNodeMemoryArgs(isDebugMode2) {
456639
- const totalMemoryMB = os46.totalmem() / (1024 * 1024);
456713
+ const totalMemoryMB = os47.totalmem() / (1024 * 1024);
456640
456714
  const heapStats = v8.getHeapStatistics();
456641
456715
  const currentMaxOldSpaceSizeMb = Math.floor(
456642
456716
  heapStats.heap_size_limit / 1024 / 1024