@qwen-code/qwen-code 0.7.0-nightly.20260114.d20f2a41 → 0.7.0-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 +72 -122
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -132293,13 +132293,31 @@ var init_constants3 = __esm({
132293
132293
  id: "coder-model",
132294
132294
  name: "Qwen Coder",
132295
132295
  description: "The latest Qwen Coder model from Alibaba Cloud ModelStudio (version: qwen3-coder-plus-2025-09-23)",
132296
- capabilities: { vision: false }
132296
+ capabilities: { vision: false },
132297
+ generationConfig: {
132298
+ samplingParams: {
132299
+ temperature: 0.7,
132300
+ top_p: 0.9,
132301
+ max_tokens: 8192
132302
+ },
132303
+ timeout: 6e4,
132304
+ maxRetries: 3
132305
+ }
132297
132306
  },
132298
132307
  {
132299
132308
  id: "vision-model",
132300
132309
  name: "Qwen Vision",
132301
132310
  description: "The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)",
132302
- capabilities: { vision: true }
132311
+ capabilities: { vision: true },
132312
+ generationConfig: {
132313
+ samplingParams: {
132314
+ temperature: 0.7,
132315
+ top_p: 0.9,
132316
+ max_tokens: 8192
132317
+ },
132318
+ timeout: 6e4,
132319
+ maxRetries: 3
132320
+ }
132303
132321
  }
132304
132322
  ];
132305
132323
  }
@@ -132836,7 +132854,7 @@ var init_modelsConfig = __esm({
132836
132854
  */
132837
132855
  syncAfterAuthRefresh(authType, modelId) {
132838
132856
  const preserveManualCredentials = this.hasManualCredentials;
132839
- if (preserveManualCredentials && authType === AuthType2.USE_OPENAI) {
132857
+ if (preserveManualCredentials) {
132840
132858
  this.strictModelProviderSelection = false;
132841
132859
  this.currentAuthType = authType;
132842
132860
  if (modelId) {
@@ -132853,10 +132871,6 @@ var init_modelsConfig = __esm({
132853
132871
  }
132854
132872
  } else {
132855
132873
  this.currentAuthType = authType;
132856
- const defaultModel = this.modelRegistry.getDefaultModelForAuthType(authType);
132857
- if (defaultModel) {
132858
- this.applyResolvedModelDefaults(defaultModel);
132859
- }
132860
132874
  }
132861
132875
  }
132862
132876
  /**
@@ -143470,93 +143484,12 @@ async function getQwenOAuthClient(config2, options2) {
143470
143484
  return client;
143471
143485
  }
143472
143486
  }
143473
- function showFallbackMessage(verificationUriComplete) {
143474
- const title = "Qwen OAuth Device Authorization";
143475
- const url2 = verificationUriComplete;
143476
- const minWidth = 70;
143477
- const maxWidth = 80;
143478
- const boxWidth = Math.min(Math.max(title.length + 4, minWidth), maxWidth);
143479
- const contentWidth = boxWidth - 4;
143480
- const wrapText2 = /* @__PURE__ */ __name((text, width) => {
143481
- if (text.startsWith("http://") || text.startsWith("https://")) {
143482
- const lines2 = [];
143483
- for (let i3 = 0; i3 < text.length; i3 += width) {
143484
- lines2.push(text.substring(i3, i3 + width));
143485
- }
143486
- return lines2;
143487
- }
143488
- const words = text.split(" ");
143489
- const lines = [];
143490
- let currentLine = "";
143491
- for (const word of words) {
143492
- if (currentLine.length + word.length + 1 <= width) {
143493
- currentLine += (currentLine ? " " : "") + word;
143494
- } else {
143495
- if (currentLine) {
143496
- lines.push(currentLine);
143497
- }
143498
- currentLine = word.length > width ? word.substring(0, width) : word;
143499
- }
143500
- }
143501
- if (currentLine) {
143502
- lines.push(currentLine);
143503
- }
143504
- return lines;
143505
- }, "wrapText");
143506
- const titleWithSpaces = " " + title + " ";
143507
- const totalDashes = boxWidth - 2 - titleWithSpaces.length;
143508
- const leftDashes = Math.floor(totalDashes / 2);
143509
- const rightDashes = totalDashes - leftDashes;
143510
- const topBorder = "+" + "-".repeat(leftDashes) + titleWithSpaces + "-".repeat(rightDashes) + "+";
143511
- const emptyLine = "|" + " ".repeat(boxWidth - 2) + "|";
143512
- const bottomBorder = "+" + "-".repeat(boxWidth - 2) + "+";
143513
- const instructionLines = wrapText2("Please visit the following URL in your browser to authorize:", contentWidth);
143514
- const urlLines = wrapText2(url2, contentWidth);
143515
- const waitingLine = "Waiting for authorization to complete...";
143516
- process.stderr.write("\n" + topBorder + "\n");
143517
- process.stderr.write(emptyLine + "\n");
143518
- for (const line of instructionLines) {
143519
- process.stderr.write("| " + line + " ".repeat(contentWidth - line.length) + " |\n");
143520
- }
143521
- process.stderr.write(emptyLine + "\n");
143522
- for (const line of urlLines) {
143523
- process.stderr.write("| " + line + " ".repeat(contentWidth - line.length) + " |\n");
143524
- }
143525
- process.stderr.write(emptyLine + "\n");
143526
- process.stderr.write("| " + waitingLine + " ".repeat(contentWidth - waitingLine.length) + " |\n");
143527
- process.stderr.write(emptyLine + "\n");
143528
- process.stderr.write(bottomBorder + "\n\n");
143529
- }
143530
143487
  async function authWithQwenDeviceFlow(client, config2) {
143531
143488
  let isCancelled = false;
143532
143489
  const cancelHandler = /* @__PURE__ */ __name(() => {
143533
143490
  isCancelled = true;
143534
143491
  }, "cancelHandler");
143535
143492
  qwenOAuth2Events.once(QwenOAuth2Event.AuthCancel, cancelHandler);
143536
- const checkCancellation = /* @__PURE__ */ __name(() => {
143537
- if (!isCancelled) {
143538
- return null;
143539
- }
143540
- const message = "Authentication cancelled by user.";
143541
- console.debug("\n" + message);
143542
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143543
- return { success: false, reason: "cancelled", message };
143544
- }, "checkCancellation");
143545
- const emitAuthProgress = /* @__PURE__ */ __name((status, message) => {
143546
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, status, message);
143547
- }, "emitAuthProgress");
143548
- const launchBrowser = /* @__PURE__ */ __name(async (url2) => {
143549
- try {
143550
- const childProcess3 = await open_default(url2);
143551
- if (childProcess3) {
143552
- childProcess3.on("error", (err) => {
143553
- console.debug("Browser launch failed:", err.message || "Unknown error");
143554
- });
143555
- }
143556
- } catch (err) {
143557
- console.debug("Failed to open browser:", err instanceof Error ? err.message : "Unknown error");
143558
- }
143559
- }, "launchBrowser");
143560
143493
  try {
143561
143494
  const { code_verifier, code_challenge } = generatePKCEPair();
143562
143495
  const deviceAuth = await client.requestDeviceAuthorization({
@@ -143569,18 +143502,39 @@ async function authWithQwenDeviceFlow(client, config2) {
143569
143502
  throw new Error(`Device authorization failed: ${errorData?.error || "Unknown error"} - ${errorData?.error_description || "No details provided"}`);
143570
143503
  }
143571
143504
  qwenOAuth2Events.emit(QwenOAuth2Event.AuthUri, deviceAuth);
143572
- showFallbackMessage(deviceAuth.verification_uri_complete);
143573
- if (!config2.isBrowserLaunchSuppressed()) {
143574
- await launchBrowser(deviceAuth.verification_uri_complete);
143505
+ const showFallbackMessage = /* @__PURE__ */ __name(() => {
143506
+ console.log("\n=== Qwen OAuth Device Authorization ===");
143507
+ console.log("Please visit the following URL in your browser to authorize:");
143508
+ console.log(`
143509
+ ${deviceAuth.verification_uri_complete}
143510
+ `);
143511
+ console.log("Waiting for authorization to complete...\n");
143512
+ }, "showFallbackMessage");
143513
+ if (config2.isBrowserLaunchSuppressed()) {
143514
+ showFallbackMessage();
143515
+ } else {
143516
+ showFallbackMessage();
143517
+ try {
143518
+ const childProcess3 = await open_default(deviceAuth.verification_uri_complete);
143519
+ if (childProcess3) {
143520
+ childProcess3.on("error", (err) => {
143521
+ console.debug("Browser launch failed:", err.message || "Unknown error");
143522
+ });
143523
+ }
143524
+ } catch (err) {
143525
+ console.debug("Failed to open browser:", err instanceof Error ? err.message : "Unknown error");
143526
+ }
143575
143527
  }
143576
- emitAuthProgress("polling", "Waiting for authorization...");
143528
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "polling", "Waiting for authorization...");
143577
143529
  console.debug("Waiting for authorization...\n");
143578
143530
  let pollInterval = 2e3;
143579
143531
  const maxAttempts = Math.ceil(deviceAuth.expires_in / (pollInterval / 1e3));
143580
143532
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
143581
- const cancellationResult = checkCancellation();
143582
- if (cancellationResult) {
143583
- return cancellationResult;
143533
+ if (isCancelled) {
143534
+ const message = "Authentication cancelled by user.";
143535
+ console.debug("\n" + message);
143536
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143537
+ return { success: false, reason: "cancelled", message };
143584
143538
  }
143585
143539
  try {
143586
143540
  console.debug("polling for token...");
@@ -143604,7 +143558,7 @@ async function authWithQwenDeviceFlow(client, config2) {
143604
143558
  SharedTokenManager.getInstance().clearCache();
143605
143559
  } catch {
143606
143560
  }
143607
- emitAuthProgress("success", "Authentication successful! Access token obtained.");
143561
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "success", "Authentication successful! Access token obtained.");
143608
143562
  console.debug("Authentication successful! Access token obtained.");
143609
143563
  return { success: true };
143610
143564
  }
@@ -143617,7 +143571,7 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143617
143571
  } else {
143618
143572
  pollInterval = 2e3;
143619
143573
  }
143620
- emitAuthProgress("polling", `Polling... (attempt ${attempt + 1}/${maxAttempts})`);
143574
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "polling", `Polling... (attempt ${attempt + 1}/${maxAttempts})`);
143621
143575
  await new Promise((resolve27) => {
143622
143576
  const checkInterval = 100;
143623
143577
  let elapsedTime = 0;
@@ -143635,9 +143589,11 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143635
143589
  }
143636
143590
  }, checkInterval);
143637
143591
  });
143638
- const cancellationResult2 = checkCancellation();
143639
- if (cancellationResult2) {
143640
- return cancellationResult2;
143592
+ if (isCancelled) {
143593
+ const message = "Authentication cancelled by user.";
143594
+ console.debug("\n" + message);
143595
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143596
+ return { success: false, reason: "cancelled", message };
143641
143597
  }
143642
143598
  continue;
143643
143599
  }
@@ -143649,14 +143605,10 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143649
143605
  const errorMessage = error2 instanceof Error ? error2.message : String(error2);
143650
143606
  const statusCode = error2 instanceof Error ? error2.status : null;
143651
143607
  const handleError2 = /* @__PURE__ */ __name((reason, message2, eventType = "error") => {
143652
- emitAuthProgress(eventType, message2);
143608
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, eventType, message2);
143653
143609
  console.error("\n" + message2);
143654
143610
  return { success: false, reason, message: message2 };
143655
143611
  }, "handleError");
143656
- const cancellationResult2 = checkCancellation();
143657
- if (cancellationResult2) {
143658
- return cancellationResult2;
143659
- }
143660
143612
  if (errorMessage.includes("Failed to cache credentials")) {
143661
143613
  return handleError2("error", errorMessage);
143662
143614
  }
@@ -143667,12 +143619,16 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143667
143619
  return handleError2("rate_limit", "Too many requests. The server is rate limiting our requests. Please select a different authentication method or try again later.", "rate_limit");
143668
143620
  }
143669
143621
  const message = `Error polling for token: ${errorMessage}`;
143670
- emitAuthProgress("error", message);
143622
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143623
+ if (isCancelled) {
143624
+ const message2 = "Authentication cancelled by user.";
143625
+ return { success: false, reason: "cancelled", message: message2 };
143626
+ }
143671
143627
  await new Promise((resolve27) => setTimeout(resolve27, pollInterval));
143672
143628
  }
143673
143629
  }
143674
143630
  const timeoutMessage = "Authorization timeout, please restart the process.";
143675
- emitAuthProgress("timeout", timeoutMessage);
143631
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "timeout", timeoutMessage);
143676
143632
  console.error("\n" + timeoutMessage);
143677
143633
  return { success: false, reason: "timeout", message: timeoutMessage };
143678
143634
  } catch (error2) {
@@ -143680,7 +143636,7 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143680
143636
  url: QWEN_OAUTH_BASE_URL
143681
143637
  });
143682
143638
  const message = `Device authorization flow failed: ${fullErrorMessage}`;
143683
- emitAuthProgress("error", message);
143639
+ qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143684
143640
  console.error(message);
143685
143641
  return { success: false, reason: "error", message };
143686
143642
  } finally {
@@ -143900,7 +143856,6 @@ var init_qwenOAuth2 = __esm({
143900
143856
  })(QwenOAuth2Event || (QwenOAuth2Event = {}));
143901
143857
  qwenOAuth2Events = new EventEmitter2();
143902
143858
  __name(getQwenOAuthClient, "getQwenOAuthClient");
143903
- __name(showFallbackMessage, "showFallbackMessage");
143904
143859
  __name(authWithQwenDeviceFlow, "authWithQwenDeviceFlow");
143905
143860
  __name(cacheQwenCredentials, "cacheQwenCredentials");
143906
143861
  __name(clearQwenCredentials, "clearQwenCredentials");
@@ -155415,7 +155370,7 @@ __export(geminiContentGenerator_exports, {
155415
155370
  createGeminiContentGenerator: () => createGeminiContentGenerator
155416
155371
  });
155417
155372
  function createGeminiContentGenerator(config2, gcConfig) {
155418
- const version2 = "0.7.0-nightly.20260114.d20f2a41";
155373
+ const version2 = "0.7.0-preview.0";
155419
155374
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
155420
155375
  const baseHeaders = {
155421
155376
  "User-Agent": userAgent2
@@ -359673,7 +359628,7 @@ function resolveCliGenerationConfig(inputs) {
359673
359628
  };
359674
359629
  const resolved = resolveModelConfig(configSources);
359675
359630
  for (const warning of resolved.warnings) {
359676
- console.warn(warning);
359631
+ console.warn(`[modelProviderUtils] ${warning}`);
359677
359632
  }
359678
359633
  const enableOpenAILogging = (typeof argv.openaiLogging === "undefined" ? settings.model?.enableOpenAILogging : argv.openaiLogging) ?? false;
359679
359634
  const openAILoggingDir = argv.openaiLoggingDir || settings.model?.openAILoggingDir;
@@ -359952,7 +359907,7 @@ __name(getPackageJson, "getPackageJson");
359952
359907
  // packages/cli/src/utils/version.ts
359953
359908
  async function getCliVersion() {
359954
359909
  const pkgJson = await getPackageJson();
359955
- return "0.7.0-nightly.20260114.d20f2a41";
359910
+ return "0.7.0-preview.0";
359956
359911
  }
359957
359912
  __name(getCliVersion, "getCliVersion");
359958
359913
 
@@ -367852,7 +367807,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
367852
367807
 
367853
367808
  // packages/cli/src/generated/git-commit.ts
367854
367809
  init_esbuild_shims();
367855
- var GIT_COMMIT_INFO2 = "1da17f8f";
367810
+ var GIT_COMMIT_INFO2 = "505b18c4";
367856
367811
 
367857
367812
  // packages/cli/src/utils/systemInfo.ts
367858
367813
  async function getNpmVersion() {
@@ -407057,14 +407012,6 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
407057
407012
  "security.auth.selectedType",
407058
407013
  authType
407059
407014
  );
407060
- const contentGeneratorConfig = config2.getContentGeneratorConfig();
407061
- if (contentGeneratorConfig?.model) {
407062
- settings.setValue(
407063
- authTypeScope,
407064
- "model.name",
407065
- contentGeneratorConfig.model
407066
- );
407067
- }
407068
407015
  if (authType !== AuthType2.QWEN_OAUTH && credentials) {
407069
407016
  if (credentials?.apiKey != null) {
407070
407017
  settings.setValue(
@@ -407080,6 +407027,9 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
407080
407027
  credentials.baseUrl
407081
407028
  );
407082
407029
  }
407030
+ if (credentials?.model != null) {
407031
+ settings.setValue(authTypeScope, "model.name", credentials.model);
407032
+ }
407083
407033
  }
407084
407034
  } catch (error2) {
407085
407035
  handleAuthFailure(error2);
@@ -419291,7 +419241,7 @@ var GeminiAgent = class {
419291
419241
  name: APPROVAL_MODE_INFO[mode].name,
419292
419242
  description: APPROVAL_MODE_INFO[mode].description
419293
419243
  }));
419294
- const version2 = "0.7.0-nightly.20260114.d20f2a41";
419244
+ const version2 = "0.7.0-preview.0";
419295
419245
  return {
419296
419246
  protocolVersion: PROTOCOL_VERSION,
419297
419247
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/qwen-code",
3
- "version": "0.7.0-nightly.20260114.d20f2a41",
3
+ "version": "0.7.0-preview.0",
4
4
  "description": "Qwen Code - AI-powered coding assistant",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "locales"
21
21
  ],
22
22
  "config": {
23
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.7.0-nightly.20260114.d20f2a41"
23
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.7.0-preview.0"
24
24
  },
25
25
  "dependencies": {
26
26
  "tiktoken": "^1.0.21"