@qwen-code/qwen-code 0.7.0-preview.0 → 0.7.0-preview.1

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 +122 -72
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -132293,31 +132293,13 @@ 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 },
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
- }
132296
+ capabilities: { vision: false }
132306
132297
  },
132307
132298
  {
132308
132299
  id: "vision-model",
132309
132300
  name: "Qwen Vision",
132310
132301
  description: "The latest Qwen Vision model from Alibaba Cloud ModelStudio (version: qwen3-vl-plus-2025-09-23)",
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
- }
132302
+ capabilities: { vision: true }
132321
132303
  }
132322
132304
  ];
132323
132305
  }
@@ -132854,7 +132836,7 @@ var init_modelsConfig = __esm({
132854
132836
  */
132855
132837
  syncAfterAuthRefresh(authType, modelId) {
132856
132838
  const preserveManualCredentials = this.hasManualCredentials;
132857
- if (preserveManualCredentials) {
132839
+ if (preserveManualCredentials && authType === AuthType2.USE_OPENAI) {
132858
132840
  this.strictModelProviderSelection = false;
132859
132841
  this.currentAuthType = authType;
132860
132842
  if (modelId) {
@@ -132871,6 +132853,10 @@ var init_modelsConfig = __esm({
132871
132853
  }
132872
132854
  } else {
132873
132855
  this.currentAuthType = authType;
132856
+ const defaultModel = this.modelRegistry.getDefaultModelForAuthType(authType);
132857
+ if (defaultModel) {
132858
+ this.applyResolvedModelDefaults(defaultModel);
132859
+ }
132874
132860
  }
132875
132861
  }
132876
132862
  /**
@@ -143484,12 +143470,93 @@ async function getQwenOAuthClient(config2, options2) {
143484
143470
  return client;
143485
143471
  }
143486
143472
  }
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
+ }
143487
143530
  async function authWithQwenDeviceFlow(client, config2) {
143488
143531
  let isCancelled = false;
143489
143532
  const cancelHandler = /* @__PURE__ */ __name(() => {
143490
143533
  isCancelled = true;
143491
143534
  }, "cancelHandler");
143492
143535
  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");
143493
143560
  try {
143494
143561
  const { code_verifier, code_challenge } = generatePKCEPair();
143495
143562
  const deviceAuth = await client.requestDeviceAuthorization({
@@ -143502,39 +143569,18 @@ async function authWithQwenDeviceFlow(client, config2) {
143502
143569
  throw new Error(`Device authorization failed: ${errorData?.error || "Unknown error"} - ${errorData?.error_description || "No details provided"}`);
143503
143570
  }
143504
143571
  qwenOAuth2Events.emit(QwenOAuth2Event.AuthUri, deviceAuth);
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
- }
143572
+ showFallbackMessage(deviceAuth.verification_uri_complete);
143573
+ if (!config2.isBrowserLaunchSuppressed()) {
143574
+ await launchBrowser(deviceAuth.verification_uri_complete);
143527
143575
  }
143528
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "polling", "Waiting for authorization...");
143576
+ emitAuthProgress("polling", "Waiting for authorization...");
143529
143577
  console.debug("Waiting for authorization...\n");
143530
143578
  let pollInterval = 2e3;
143531
143579
  const maxAttempts = Math.ceil(deviceAuth.expires_in / (pollInterval / 1e3));
143532
143580
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
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 };
143581
+ const cancellationResult = checkCancellation();
143582
+ if (cancellationResult) {
143583
+ return cancellationResult;
143538
143584
  }
143539
143585
  try {
143540
143586
  console.debug("polling for token...");
@@ -143558,7 +143604,7 @@ ${deviceAuth.verification_uri_complete}
143558
143604
  SharedTokenManager.getInstance().clearCache();
143559
143605
  } catch {
143560
143606
  }
143561
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "success", "Authentication successful! Access token obtained.");
143607
+ emitAuthProgress("success", "Authentication successful! Access token obtained.");
143562
143608
  console.debug("Authentication successful! Access token obtained.");
143563
143609
  return { success: true };
143564
143610
  }
@@ -143571,7 +143617,7 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143571
143617
  } else {
143572
143618
  pollInterval = 2e3;
143573
143619
  }
143574
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "polling", `Polling... (attempt ${attempt + 1}/${maxAttempts})`);
143620
+ emitAuthProgress("polling", `Polling... (attempt ${attempt + 1}/${maxAttempts})`);
143575
143621
  await new Promise((resolve27) => {
143576
143622
  const checkInterval = 100;
143577
143623
  let elapsedTime = 0;
@@ -143589,11 +143635,9 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143589
143635
  }
143590
143636
  }, checkInterval);
143591
143637
  });
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 };
143638
+ const cancellationResult2 = checkCancellation();
143639
+ if (cancellationResult2) {
143640
+ return cancellationResult2;
143597
143641
  }
143598
143642
  continue;
143599
143643
  }
@@ -143605,10 +143649,14 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143605
143649
  const errorMessage = error2 instanceof Error ? error2.message : String(error2);
143606
143650
  const statusCode = error2 instanceof Error ? error2.status : null;
143607
143651
  const handleError2 = /* @__PURE__ */ __name((reason, message2, eventType = "error") => {
143608
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, eventType, message2);
143652
+ emitAuthProgress(eventType, message2);
143609
143653
  console.error("\n" + message2);
143610
143654
  return { success: false, reason, message: message2 };
143611
143655
  }, "handleError");
143656
+ const cancellationResult2 = checkCancellation();
143657
+ if (cancellationResult2) {
143658
+ return cancellationResult2;
143659
+ }
143612
143660
  if (errorMessage.includes("Failed to cache credentials")) {
143613
143661
  return handleError2("error", errorMessage);
143614
143662
  }
@@ -143619,16 +143667,12 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143619
143667
  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");
143620
143668
  }
143621
143669
  const message = `Error polling for token: ${errorMessage}`;
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
- }
143670
+ emitAuthProgress("error", message);
143627
143671
  await new Promise((resolve27) => setTimeout(resolve27, pollInterval));
143628
143672
  }
143629
143673
  }
143630
143674
  const timeoutMessage = "Authorization timeout, please restart the process.";
143631
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "timeout", timeoutMessage);
143675
+ emitAuthProgress("timeout", timeoutMessage);
143632
143676
  console.error("\n" + timeoutMessage);
143633
143677
  return { success: false, reason: "timeout", message: timeoutMessage };
143634
143678
  } catch (error2) {
@@ -143636,7 +143680,7 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`);
143636
143680
  url: QWEN_OAUTH_BASE_URL
143637
143681
  });
143638
143682
  const message = `Device authorization flow failed: ${fullErrorMessage}`;
143639
- qwenOAuth2Events.emit(QwenOAuth2Event.AuthProgress, "error", message);
143683
+ emitAuthProgress("error", message);
143640
143684
  console.error(message);
143641
143685
  return { success: false, reason: "error", message };
143642
143686
  } finally {
@@ -143856,6 +143900,7 @@ var init_qwenOAuth2 = __esm({
143856
143900
  })(QwenOAuth2Event || (QwenOAuth2Event = {}));
143857
143901
  qwenOAuth2Events = new EventEmitter2();
143858
143902
  __name(getQwenOAuthClient, "getQwenOAuthClient");
143903
+ __name(showFallbackMessage, "showFallbackMessage");
143859
143904
  __name(authWithQwenDeviceFlow, "authWithQwenDeviceFlow");
143860
143905
  __name(cacheQwenCredentials, "cacheQwenCredentials");
143861
143906
  __name(clearQwenCredentials, "clearQwenCredentials");
@@ -155370,7 +155415,7 @@ __export(geminiContentGenerator_exports, {
155370
155415
  createGeminiContentGenerator: () => createGeminiContentGenerator
155371
155416
  });
155372
155417
  function createGeminiContentGenerator(config2, gcConfig) {
155373
- const version2 = "0.7.0-preview.0";
155418
+ const version2 = "0.7.0-preview.1";
155374
155419
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
155375
155420
  const baseHeaders = {
155376
155421
  "User-Agent": userAgent2
@@ -359628,7 +359673,7 @@ function resolveCliGenerationConfig(inputs) {
359628
359673
  };
359629
359674
  const resolved = resolveModelConfig(configSources);
359630
359675
  for (const warning of resolved.warnings) {
359631
- console.warn(`[modelProviderUtils] ${warning}`);
359676
+ console.warn(warning);
359632
359677
  }
359633
359678
  const enableOpenAILogging = (typeof argv.openaiLogging === "undefined" ? settings.model?.enableOpenAILogging : argv.openaiLogging) ?? false;
359634
359679
  const openAILoggingDir = argv.openaiLoggingDir || settings.model?.openAILoggingDir;
@@ -359907,7 +359952,7 @@ __name(getPackageJson, "getPackageJson");
359907
359952
  // packages/cli/src/utils/version.ts
359908
359953
  async function getCliVersion() {
359909
359954
  const pkgJson = await getPackageJson();
359910
- return "0.7.0-preview.0";
359955
+ return "0.7.0-preview.1";
359911
359956
  }
359912
359957
  __name(getCliVersion, "getCliVersion");
359913
359958
 
@@ -367807,7 +367852,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
367807
367852
 
367808
367853
  // packages/cli/src/generated/git-commit.ts
367809
367854
  init_esbuild_shims();
367810
- var GIT_COMMIT_INFO2 = "505b18c4";
367855
+ var GIT_COMMIT_INFO2 = "a574cd4b";
367811
367856
 
367812
367857
  // packages/cli/src/utils/systemInfo.ts
367813
367858
  async function getNpmVersion() {
@@ -407012,6 +407057,14 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
407012
407057
  "security.auth.selectedType",
407013
407058
  authType
407014
407059
  );
407060
+ const contentGeneratorConfig = config2.getContentGeneratorConfig();
407061
+ if (contentGeneratorConfig?.model) {
407062
+ settings.setValue(
407063
+ authTypeScope,
407064
+ "model.name",
407065
+ contentGeneratorConfig.model
407066
+ );
407067
+ }
407015
407068
  if (authType !== AuthType2.QWEN_OAUTH && credentials) {
407016
407069
  if (credentials?.apiKey != null) {
407017
407070
  settings.setValue(
@@ -407027,9 +407080,6 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
407027
407080
  credentials.baseUrl
407028
407081
  );
407029
407082
  }
407030
- if (credentials?.model != null) {
407031
- settings.setValue(authTypeScope, "model.name", credentials.model);
407032
- }
407033
407083
  }
407034
407084
  } catch (error2) {
407035
407085
  handleAuthFailure(error2);
@@ -419241,7 +419291,7 @@ var GeminiAgent = class {
419241
419291
  name: APPROVAL_MODE_INFO[mode].name,
419242
419292
  description: APPROVAL_MODE_INFO[mode].description
419243
419293
  }));
419244
- const version2 = "0.7.0-preview.0";
419294
+ const version2 = "0.7.0-preview.1";
419245
419295
  return {
419246
419296
  protocolVersion: PROTOCOL_VERSION,
419247
419297
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/qwen-code",
3
- "version": "0.7.0-preview.0",
3
+ "version": "0.7.0-preview.1",
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-preview.0"
23
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.7.0-preview.1"
24
24
  },
25
25
  "dependencies": {
26
26
  "tiktoken": "^1.0.21"