@qwen-code/qwen-code 0.10.0-preview.2 → 0.10.0-preview.4

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.
package/cli.js CHANGED
@@ -132808,11 +132808,16 @@ var init_modelRegistry = __esm({
132808
132808
  }
132809
132809
  }
132810
132810
  /**
132811
- * Register models for an authType
132811
+ * Register models for an authType.
132812
+ * If multiple models have the same id, the first one takes precedence.
132812
132813
  */
132813
132814
  registerAuthTypeModels(authType, models) {
132814
132815
  const modelMap = /* @__PURE__ */ new Map();
132815
132816
  for (const config2 of models) {
132817
+ if (modelMap.has(config2.id)) {
132818
+ debugLogger5.warn(`Duplicate model id "${config2.id}" for authType "${authType}". Using the first registered config.`);
132819
+ continue;
132820
+ }
132816
132821
  const resolved = this.resolveModelConfig(config2, authType);
132817
132822
  modelMap.set(config2.id, resolved);
132818
132823
  }
@@ -132886,6 +132891,31 @@ var init_modelRegistry = __esm({
132886
132891
  throw new Error(`Model config in authType '${authType}' missing required field: id`);
132887
132892
  }
132888
132893
  }
132894
+ /**
132895
+ * Reload models from updated configuration.
132896
+ * Clears existing user-configured models and re-registers from new config.
132897
+ * Preserves hard-coded qwen-oauth models.
132898
+ */
132899
+ reloadModels(modelProvidersConfig) {
132900
+ for (const authType of this.modelsByAuthType.keys()) {
132901
+ if (authType !== AuthType2.QWEN_OAUTH) {
132902
+ this.modelsByAuthType.delete(authType);
132903
+ }
132904
+ }
132905
+ if (modelProvidersConfig) {
132906
+ for (const [rawKey, models] of Object.entries(modelProvidersConfig)) {
132907
+ const authType = validateAuthTypeKey(rawKey);
132908
+ if (!authType) {
132909
+ debugLogger5.warn(`Invalid authType key "${rawKey}" in modelProviders config. Expected one of: ${Object.values(AuthType2).join(", ")}. Skipping.`);
132910
+ continue;
132911
+ }
132912
+ if (authType === AuthType2.QWEN_OAUTH) {
132913
+ continue;
132914
+ }
132915
+ this.registerAuthTypeModels(authType, models);
132916
+ }
132917
+ }
132918
+ }
132889
132919
  };
132890
132920
  }
132891
132921
  });
@@ -133698,6 +133728,15 @@ var init_modelsConfig = __esm({
133698
133728
  this.activeRuntimeModelSnapshotId = void 0;
133699
133729
  }
133700
133730
  }
133731
+ /**
133732
+ * Reload model providers configuration at runtime.
133733
+ * This enables hot-reloading of modelProviders settings without restarting the CLI.
133734
+ *
133735
+ * @param modelProvidersConfig - The updated model providers configuration
133736
+ */
133737
+ reloadModelProvidersConfig(modelProvidersConfig) {
133738
+ this.modelRegistry.reloadModels(modelProvidersConfig);
133739
+ }
133701
133740
  };
133702
133741
  }
133703
133742
  });
@@ -156312,7 +156351,7 @@ __export(geminiContentGenerator_exports, {
156312
156351
  createGeminiContentGenerator: () => createGeminiContentGenerator
156313
156352
  });
156314
156353
  function createGeminiContentGenerator(config2, gcConfig) {
156315
- const version2 = "0.10.0-preview.2";
156354
+ const version2 = "0.10.0-preview.4";
156316
156355
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
156317
156356
  const baseHeaders = {
156318
156357
  "User-Agent": userAgent2
@@ -242415,6 +242454,16 @@ var init_config3 = __esm({
242415
242454
  updateCredentials(credentials, settingsGenerationConfig) {
242416
242455
  this.modelsConfig.updateCredentials(credentials, settingsGenerationConfig);
242417
242456
  }
242457
+ /**
242458
+ * Reload model providers configuration at runtime.
242459
+ * This enables hot-reloading of modelProviders settings without restarting the CLI.
242460
+ * Should be called before refreshAuth when settings.json has been updated.
242461
+ *
242462
+ * @param modelProvidersConfig - The updated model providers configuration
242463
+ */
242464
+ reloadModelProvidersConfig(modelProvidersConfig) {
242465
+ this.modelsConfig.reloadModelProvidersConfig(modelProvidersConfig);
242466
+ }
242418
242467
  /**
242419
242468
  * Refresh authentication and rebuild ContentGenerator.
242420
242469
  */
@@ -281618,7 +281667,7 @@ var require_backend = __commonJS({
281618
281667
  ) : symbolOrNumber;
281619
281668
  }
281620
281669
  __name(getTypeSymbol, "getTypeSymbol");
281621
- var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText, Fragment15 = _ReactTypeOfWork.Fragment, LazyComponent = _ReactTypeOfWork.LazyComponent, LegacyHiddenComponent = _ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = _ReactTypeOfWork.MemoComponent, OffscreenComponent = _ReactTypeOfWork.OffscreenComponent, Profiler = _ReactTypeOfWork.Profiler, ScopeComponent = _ReactTypeOfWork.ScopeComponent, SimpleMemoComponent = _ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = _ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = _ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = _ReactTypeOfWork.TracingMarkerComponent;
281670
+ var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText, Fragment16 = _ReactTypeOfWork.Fragment, LazyComponent = _ReactTypeOfWork.LazyComponent, LegacyHiddenComponent = _ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = _ReactTypeOfWork.MemoComponent, OffscreenComponent = _ReactTypeOfWork.OffscreenComponent, Profiler = _ReactTypeOfWork.Profiler, ScopeComponent = _ReactTypeOfWork.ScopeComponent, SimpleMemoComponent = _ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = _ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = _ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = _ReactTypeOfWork.TracingMarkerComponent;
281622
281671
  function resolveFiberType(type) {
281623
281672
  var typeSymbol = getTypeSymbol(type);
281624
281673
  switch (typeSymbol) {
@@ -281664,7 +281713,7 @@ var require_backend = __commonJS({
281664
281713
  case HostPortal:
281665
281714
  case HostText:
281666
281715
  return null;
281667
- case Fragment15:
281716
+ case Fragment16:
281668
281717
  return "Fragment";
281669
281718
  case LazyComponent:
281670
281719
  return "Lazy";
@@ -281730,7 +281779,7 @@ var require_backend = __commonJS({
281730
281779
  function attach(hook2, rendererID, renderer2, global2) {
281731
281780
  var version2 = renderer2.reconcilerVersion || renderer2.version;
281732
281781
  var _getInternalReactCons = getInternalReactConstants(version2), getDisplayNameForFiber = _getInternalReactCons.getDisplayNameForFiber, getTypeSymbol = _getInternalReactCons.getTypeSymbol, ReactPriorityLevels = _getInternalReactCons.ReactPriorityLevels, ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork, StrictModeBits = _getInternalReactCons.StrictModeBits;
281733
- var CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment15 = ReactTypeOfWork.Fragment, FunctionComponent = ReactTypeOfWork.FunctionComponent, HostRoot = ReactTypeOfWork.HostRoot, HostHoistable = ReactTypeOfWork.HostHoistable, HostSingleton = ReactTypeOfWork.HostSingleton, HostPortal = ReactTypeOfWork.HostPortal, HostComponent = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, IncompleteClassComponent = ReactTypeOfWork.IncompleteClassComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent;
281782
+ var CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment16 = ReactTypeOfWork.Fragment, FunctionComponent = ReactTypeOfWork.FunctionComponent, HostRoot = ReactTypeOfWork.HostRoot, HostHoistable = ReactTypeOfWork.HostHoistable, HostSingleton = ReactTypeOfWork.HostSingleton, HostPortal = ReactTypeOfWork.HostPortal, HostComponent = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, IncompleteClassComponent = ReactTypeOfWork.IncompleteClassComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent;
281734
281783
  var ImmediatePriority = ReactPriorityLevels.ImmediatePriority, UserBlockingPriority = ReactPriorityLevels.UserBlockingPriority, NormalPriority = ReactPriorityLevels.NormalPriority, LowPriority = ReactPriorityLevels.LowPriority, IdlePriority = ReactPriorityLevels.IdlePriority, NoPriority = ReactPriorityLevels.NoPriority;
281735
281784
  var getLaneLabelMap = renderer2.getLaneLabelMap, injectProfilingHooks = renderer2.injectProfilingHooks, overrideHookState = renderer2.overrideHookState, overrideHookStateDeletePath = renderer2.overrideHookStateDeletePath, overrideHookStateRenamePath = renderer2.overrideHookStateRenamePath, overrideProps = renderer2.overrideProps, overridePropsDeletePath = renderer2.overridePropsDeletePath, overridePropsRenamePath = renderer2.overridePropsRenamePath, scheduleRefresh = renderer2.scheduleRefresh, setErrorHandler = renderer2.setErrorHandler, setSuspenseHandler = renderer2.setSuspenseHandler, scheduleUpdate = renderer2.scheduleUpdate;
281736
281785
  var supportsTogglingError = typeof setErrorHandler === "function" && typeof scheduleUpdate === "function";
@@ -281945,7 +281994,7 @@ var require_backend = __commonJS({
281945
281994
  return true;
281946
281995
  case HostRoot:
281947
281996
  return false;
281948
- case Fragment15:
281997
+ case Fragment16:
281949
281998
  return key === null;
281950
281999
  default:
281951
282000
  var typeSymbol = getTypeSymbol(type);
@@ -282020,7 +282069,7 @@ var require_backend = __commonJS({
282020
282069
  return ElementTypeHostComponent;
282021
282070
  case HostPortal:
282022
282071
  case HostText:
282023
- case Fragment15:
282072
+ case Fragment16:
282024
282073
  return ElementTypeOtherOrUnknown;
282025
282074
  case MemoComponent:
282026
282075
  case SimpleMemoComponent:
@@ -297254,7 +297303,17 @@ var init_de = __esm({
297254
297303
  "Opening extensions page in your browser: {{url}}": "Erweiterungsseite wird im Browser ge\xF6ffnet: {{url}}",
297255
297304
  "Failed to open browser. Check out the extensions gallery at {{url}}": "Browser konnte nicht ge\xF6ffnet werden. Besuchen Sie die Erweiterungsgalerie unter {{url}}",
297256
297305
  "You can switch permission mode quickly with Shift+Tab or /approval-mode.": "Sie k\xF6nnen den Berechtigungsmodus schnell mit Shift+Tab oder /approval-mode wechseln.",
297257
- "You can switch permission mode quickly with Tab or /approval-mode.": "Sie k\xF6nnen den Berechtigungsmodus schnell mit Tab oder /approval-mode wechseln."
297306
+ "You can switch permission mode quickly with Tab or /approval-mode.": "Sie k\xF6nnen den Berechtigungsmodus schnell mit Tab oder /approval-mode wechseln.",
297307
+ // ============================================================================
297308
+ // Custom API-KEY Configuration
297309
+ // ============================================================================
297310
+ "For advanced users who want to configure models manually.": "F\xFCr fortgeschrittene Benutzer, die Modelle manuell konfigurieren m\xF6chten.",
297311
+ "Please configure your models in settings.json:": "Bitte konfigurieren Sie Ihre Modelle in settings.json:",
297312
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "API-Schl\xFCssel \xFCber Umgebungsvariable setzen (z.B. OPENAI_API_KEY)",
297313
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "Modellkonfiguration zu modelProviders['openai'] (oder anderen Authentifizierungstypen) hinzuf\xFCgen",
297314
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "Jeder Anbieter ben\xF6tigt: id, envKey (erforderlich), plus optionale baseUrl, generationConfig",
297315
+ "Use /model command to select your preferred model from the configured list": "Verwenden Sie den /model-Befehl, um Ihr bevorzugtes Modell aus der konfigurierten Liste auszuw\xE4hlen",
297316
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "Unterst\xFCtzte Authentifizierungstypen: openai, anthropic, gemini, vertex-ai, usw."
297258
297317
  };
297259
297318
  }
297260
297319
  });
@@ -298292,7 +298351,32 @@ var init_en3 = __esm({
298292
298351
  "Would open extensions page in your browser: {{url}} (skipped in test environment)": "Would open extensions page in your browser: {{url}} (skipped in test environment)",
298293
298352
  "View available extensions at {{url}}": "View available extensions at {{url}}",
298294
298353
  "Opening extensions page in your browser: {{url}}": "Opening extensions page in your browser: {{url}}",
298295
- "Failed to open browser. Check out the extensions gallery at {{url}}": "Failed to open browser. Check out the extensions gallery at {{url}}"
298354
+ "Failed to open browser. Check out the extensions gallery at {{url}}": "Failed to open browser. Check out the extensions gallery at {{url}}",
298355
+ // ============================================================================
298356
+ // Coding Plan Authentication
298357
+ // ============================================================================
298358
+ "Please enter your API key:": "Please enter your API key:",
298359
+ "API key cannot be empty.": "API key cannot be empty.",
298360
+ "API key is stored in settings.env. You can migrate it to a .env file for better security.": "API key is stored in settings.env. You can migrate it to a .env file for better security.",
298361
+ // ============================================================================
298362
+ // Custom API-KEY Configuration
298363
+ // ============================================================================
298364
+ "For advanced users who want to configure models manually.": "For advanced users who want to configure models manually.",
298365
+ "Please configure your models in settings.json:": "Please configure your models in settings.json:",
298366
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "Set API key via environment variable (e.g., OPENAI_API_KEY)",
298367
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "Add model configuration to modelProviders['openai'] (or other auth types)",
298368
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig",
298369
+ "Use /model command to select your preferred model from the configured list": "Use /model command to select your preferred model from the configured list",
298370
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.",
298371
+ // ============================================================================
298372
+ // Auth Dialog - View Titles and Labels
298373
+ // ============================================================================
298374
+ "API-KEY": "API-KEY",
298375
+ "Coding Plan": "Coding Plan",
298376
+ Custom: "Custom",
298377
+ "Select API-KEY configuration mode:": "Select API-KEY configuration mode:",
298378
+ "(Press Escape to go back)": "(Press Escape to go back)",
298379
+ "(Press Enter to submit, Escape to cancel)": "(Press Enter to submit, Escape to cancel)"
298296
298380
  };
298297
298381
  }
298298
298382
  });
@@ -298974,7 +299058,17 @@ var init_ja = __esm({
298974
299058
  "\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC\u304C\u30C0\u30FC\u30AF\u30E2\u30FC\u30C9\u306A\u306E\u306F\u30D0\u30B0\u3092\u898B\u305F\u304F\u306A\u3044\u304B\u3089...",
298975
299059
  "\u30B3\u30FC\u30C9\u304C\u58CA\u308C\u305F?\u53E9\u3051\u3070\u6CBB\u308B\u3055",
298976
299060
  "USB\u306E\u5DEE\u3057\u8FBC\u307F\u306B\u6311\u6226\u4E2D..."
298977
- ]
299061
+ ],
299062
+ // ============================================================================
299063
+ // Custom API-KEY Configuration
299064
+ // ============================================================================
299065
+ "For advanced users who want to configure models manually.": "\u30E2\u30C7\u30EB\u3092\u624B\u52D5\u3067\u8A2D\u5B9A\u3057\u305F\u3044\u4E0A\u7D1A\u30E6\u30FC\u30B6\u30FC\u5411\u3051\u3002",
299066
+ "Please configure your models in settings.json:": "settings.json \u3067\u30E2\u30C7\u30EB\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF1A",
299067
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "\u74B0\u5883\u5909\u6570\u3092\u4F7F\u7528\u3057\u3066 API \u30AD\u30FC\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B\uFF1AOPENAI_API_KEY\uFF09",
299068
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "modelProviders['openai']\uFF08\u307E\u305F\u306F\u4ED6\u306E\u8A8D\u8A3C\u30BF\u30A4\u30D7\uFF09\u306B\u30E2\u30C7\u30EB\u8A2D\u5B9A\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044",
299069
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "\u5404\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u306B\u306F\uFF1Aid\u3001envKey\uFF08\u5FC5\u9808\uFF09\u3001\u304A\u3088\u3073\u30AA\u30D7\u30B7\u30E7\u30F3\u306E baseUrl\u3001generationConfig \u304C\u5FC5\u8981\u3067\u3059",
299070
+ "Use /model command to select your preferred model from the configured list": "/model \u30B3\u30DE\u30F3\u30C9\u3092\u4F7F\u7528\u3057\u3066\u3001\u8A2D\u5B9A\u6E08\u307F\u30EA\u30B9\u30C8\u304B\u3089\u304A\u597D\u307F\u306E\u30E2\u30C7\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
299071
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u308B\u8A8D\u8A3C\u30BF\u30A4\u30D7\uFF1Aopenai\u3001anthropic\u3001gemini\u3001vertex-ai \u306A\u3069"
298978
299072
  };
298979
299073
  }
298980
299074
  });
@@ -300002,7 +300096,17 @@ var init_pt = __esm({
300002
300096
  "Would open extensions page in your browser: {{url}} (skipped in test environment)": "Abriria a p\xE1gina de extens\xF5es no seu navegador: {{url}} (pulado no ambiente de teste)",
300003
300097
  "View available extensions at {{url}}": "Ver extens\xF5es dispon\xEDveis em {{url}}",
300004
300098
  "Opening extensions page in your browser: {{url}}": "Abrindo p\xE1gina de extens\xF5es no seu navegador: {{url}}",
300005
- "Failed to open browser. Check out the extensions gallery at {{url}}": "Falha ao abrir o navegador. Confira a galeria de extens\xF5es em {{url}}"
300099
+ "Failed to open browser. Check out the extensions gallery at {{url}}": "Falha ao abrir o navegador. Confira a galeria de extens\xF5es em {{url}}",
300100
+ // ============================================================================
300101
+ // Custom API-KEY Configuration
300102
+ // ============================================================================
300103
+ "For advanced users who want to configure models manually.": "Para usu\xE1rios avan\xE7ados que desejam configurar modelos manualmente.",
300104
+ "Please configure your models in settings.json:": "Por favor, configure seus modelos em settings.json:",
300105
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "Defina a chave de API via vari\xE1vel de ambiente (ex: OPENAI_API_KEY)",
300106
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "Adicione a configura\xE7\xE3o do modelo a modelProviders['openai'] (ou outros tipos de autentica\xE7\xE3o)",
300107
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "Cada provedor precisa de: id, envKey (obrigat\xF3rio), al\xE9m de baseUrl e generationConfig opcionais",
300108
+ "Use /model command to select your preferred model from the configured list": "Use o comando /model para selecionar seu modelo preferido da lista configurada",
300109
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "Tipos de autentica\xE7\xE3o suportados: openai, anthropic, gemini, vertex-ai, etc."
300006
300110
  };
300007
300111
  }
300008
300112
  });
@@ -301038,7 +301142,17 @@ var init_ru = __esm({
301038
301142
  "Opening extensions page in your browser: {{url}}": "\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u043C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0439 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435: {{url}}",
301039
301143
  "Failed to open browser. Check out the extensions gallery at {{url}}": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440. \u041F\u043E\u0441\u0435\u0442\u0438\u0442\u0435 \u0433\u0430\u043B\u0435\u0440\u0435\u044E \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0439 \u043F\u043E \u0430\u0434\u0440\u0435\u0441\u0443 {{url}}",
301040
301144
  "You can switch permission mode quickly with Shift+Tab or /approval-mode.": "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0431\u044B\u0441\u0442\u0440\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0440\u0435\u0436\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0439 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E Shift+Tab \u0438\u043B\u0438 /approval-mode.",
301041
- "You can switch permission mode quickly with Tab or /approval-mode.": "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0431\u044B\u0441\u0442\u0440\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0440\u0435\u0436\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0439 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E Tab \u0438\u043B\u0438 /approval-mode."
301145
+ "You can switch permission mode quickly with Tab or /approval-mode.": "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0431\u044B\u0441\u0442\u0440\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0440\u0435\u0436\u0438\u043C \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0439 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E Tab \u0438\u043B\u0438 /approval-mode.",
301146
+ // ============================================================================
301147
+ // Custom API-KEY Configuration
301148
+ // ============================================================================
301149
+ "For advanced users who want to configure models manually.": "\u0414\u043B\u044F \u043F\u0440\u043E\u0434\u0432\u0438\u043D\u0443\u0442\u044B\u0445 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0445\u043E\u0442\u044F\u0442 \u043D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044C \u043C\u043E\u0434\u0435\u043B\u0438 \u0432\u0440\u0443\u0447\u043D\u0443\u044E.",
301150
+ "Please configure your models in settings.json:": "\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u0442\u0435 \u0432\u0430\u0448\u0438 \u043C\u043E\u0434\u0435\u043B\u0438 \u0432 settings.json:",
301151
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u043A\u043B\u044E\u0447 API \u0447\u0435\u0440\u0435\u0437 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0443\u044E \u043E\u043A\u0440\u0443\u0436\u0435\u043D\u0438\u044F (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, OPENAI_API_KEY)",
301152
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E \u043C\u043E\u0434\u0435\u043B\u0438 \u0432 modelProviders['openai'] (\u0438\u043B\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043F\u044B \u0430\u0443\u0442\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438)",
301153
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "\u041A\u0430\u0436\u0434\u043E\u043C\u0443 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0443 \u043D\u0443\u0436\u043D\u044B: id, envKey (\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E), \u0430 \u0442\u0430\u043A\u0436\u0435 \u043E\u043F\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0435 baseUrl, generationConfig",
301154
+ "Use /model command to select your preferred model from the configured list": "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043A\u043E\u043C\u0430\u043D\u0434\u0443 /model, \u0447\u0442\u043E\u0431\u044B \u0432\u044B\u0431\u0440\u0430\u0442\u044C \u043F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u0443\u044E \u043C\u043E\u0434\u0435\u043B\u044C \u0438\u0437 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0441\u043F\u0438\u0441\u043A\u0430",
301155
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0435 \u0442\u0438\u043F\u044B \u0430\u0443\u0442\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438: openai, anthropic, gemini, vertex-ai \u0438 \u0434\u0440."
301042
301156
  };
301043
301157
  }
301044
301158
  });
@@ -301975,7 +302089,32 @@ var init_zh = __esm({
301975
302089
  "Would open extensions page in your browser: {{url}} (skipped in test environment)": "\u5C06\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u6269\u5C55\u9875\u9762\uFF1A{{url}}\uFF08\u6D4B\u8BD5\u73AF\u5883\u4E2D\u5DF2\u8DF3\u8FC7\uFF09",
301976
302090
  "View available extensions at {{url}}": "\u5728 {{url}} \u67E5\u770B\u53EF\u7528\u6269\u5C55",
301977
302091
  "Opening extensions page in your browser: {{url}}": "\u6B63\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u6269\u5C55\u9875\u9762\uFF1A{{url}}",
301978
- "Failed to open browser. Check out the extensions gallery at {{url}}": "\u6253\u5F00\u6D4F\u89C8\u5668\u5931\u8D25\u3002\u8BF7\u8BBF\u95EE\u6269\u5C55\u5E02\u573A\uFF1A{{url}}"
302092
+ "Failed to open browser. Check out the extensions gallery at {{url}}": "\u6253\u5F00\u6D4F\u89C8\u5668\u5931\u8D25\u3002\u8BF7\u8BBF\u95EE\u6269\u5C55\u5E02\u573A\uFF1A{{url}}",
302093
+ // ============================================================================
302094
+ // Coding Plan Authentication
302095
+ // ============================================================================
302096
+ "Please enter your API key:": "\u8BF7\u8F93\u5165\u60A8\u7684 API Key\uFF1A",
302097
+ "API key cannot be empty.": "API Key \u4E0D\u80FD\u4E3A\u7A7A\u3002",
302098
+ "API key is stored in settings.env. You can migrate it to a .env file for better security.": "API Key \u5DF2\u5B58\u50A8\u5728 settings.env \u4E2D\u3002\u60A8\u53EF\u4EE5\u5C06\u5176\u8FC1\u79FB\u5230 .env \u6587\u4EF6\u4EE5\u83B7\u5F97\u66F4\u597D\u7684\u5B89\u5168\u6027\u3002",
302099
+ // ============================================================================
302100
+ // Custom API-KEY Configuration
302101
+ // ============================================================================
302102
+ "For advanced users who want to configure models manually.": "\u9002\u5408\u9700\u8981\u624B\u52A8\u914D\u7F6E\u6A21\u578B\u7684\u9AD8\u7EA7\u7528\u6237\u3002",
302103
+ "Please configure your models in settings.json:": "\u8BF7\u5728 settings.json \u4E2D\u914D\u7F6E\u60A8\u7684\u6A21\u578B\uFF1A",
302104
+ "Set API key via environment variable (e.g., OPENAI_API_KEY)": "\u901A\u8FC7\u73AF\u5883\u53D8\u91CF\u8BBE\u7F6E API Key\uFF08\u4F8B\u5982\uFF1AOPENAI_API_KEY\uFF09",
302105
+ "Add model configuration to modelProviders['openai'] (or other auth types)": "\u5C06\u6A21\u578B\u914D\u7F6E\u6DFB\u52A0\u5230 modelProviders['openai']\uFF08\u6216\u5176\u4ED6\u8BA4\u8BC1\u7C7B\u578B\uFF09",
302106
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig": "\u6BCF\u4E2A\u63D0\u4F9B\u5546\u9700\u8981\uFF1Aid\u3001envKey\uFF08\u5FC5\u9700\uFF09\uFF0C\u4EE5\u53CA\u53EF\u9009\u7684 baseUrl\u3001generationConfig",
302107
+ "Use /model command to select your preferred model from the configured list": "\u4F7F\u7528 /model \u547D\u4EE4\u4ECE\u914D\u7F6E\u5217\u8868\u4E2D\u9009\u62E9\u60A8\u504F\u597D\u7684\u6A21\u578B",
302108
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc.": "\u652F\u6301\u7684\u8BA4\u8BC1\u7C7B\u578B\uFF1Aopenai\u3001anthropic\u3001gemini\u3001vertex-ai \u7B49",
302109
+ // ============================================================================
302110
+ // Auth Dialog - View Titles and Labels
302111
+ // ============================================================================
302112
+ "API-KEY": "API-KEY",
302113
+ "Coding Plan": "Coding Plan",
302114
+ Custom: "\u81EA\u5B9A\u4E49",
302115
+ "Select API-KEY configuration mode:": "\u9009\u62E9 API-KEY \u914D\u7F6E\u6A21\u5F0F\uFF1A",
302116
+ "(Press Escape to go back)": "(\u6309 Escape \u952E\u8FD4\u56DE)",
302117
+ "(Press Enter to submit, Escape to cancel)": "(\u6309 Enter \u63D0\u4EA4\uFF0CEscape \u53D6\u6D88)"
301979
302118
  };
301980
302119
  }
301981
302120
  });
@@ -337483,7 +337622,7 @@ var require_react_is_development = __commonJS({
337483
337622
  var ContextProvider = REACT_PROVIDER_TYPE;
337484
337623
  var Element2 = REACT_ELEMENT_TYPE;
337485
337624
  var ForwardRef = REACT_FORWARD_REF_TYPE;
337486
- var Fragment15 = REACT_FRAGMENT_TYPE;
337625
+ var Fragment16 = REACT_FRAGMENT_TYPE;
337487
337626
  var Lazy = REACT_LAZY_TYPE;
337488
337627
  var Memo = REACT_MEMO_TYPE;
337489
337628
  var Portal = REACT_PORTAL_TYPE;
@@ -337555,7 +337694,7 @@ var require_react_is_development = __commonJS({
337555
337694
  exports2.ContextProvider = ContextProvider;
337556
337695
  exports2.Element = Element2;
337557
337696
  exports2.ForwardRef = ForwardRef;
337558
- exports2.Fragment = Fragment15;
337697
+ exports2.Fragment = Fragment16;
337559
337698
  exports2.Lazy = Lazy;
337560
337699
  exports2.Memo = Memo;
337561
337700
  exports2.Portal = Portal;
@@ -373022,7 +373161,7 @@ __name(getPackageJson, "getPackageJson");
373022
373161
  // packages/cli/src/utils/version.ts
373023
373162
  async function getCliVersion() {
373024
373163
  const pkgJson = await getPackageJson();
373025
- return "0.10.0-preview.2";
373164
+ return "0.10.0-preview.4";
373026
373165
  }
373027
373166
  __name(getCliVersion, "getCliVersion");
373028
373167
 
@@ -380545,7 +380684,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
380545
380684
 
380546
380685
  // packages/cli/src/generated/git-commit.ts
380547
380686
  init_esbuild_shims();
380548
- var GIT_COMMIT_INFO = "18a7235d";
380687
+ var GIT_COMMIT_INFO = "3f4cd8cb";
380549
380688
 
380550
380689
  // packages/cli/src/utils/systemInfo.ts
380551
380690
  async function getNpmVersion() {
@@ -414993,9 +415132,10 @@ var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
414993
415132
  var AppHeader = /* @__PURE__ */ __name(({ version: version2 }) => {
414994
415133
  const settings = useSettings();
414995
415134
  const config2 = useConfig();
415135
+ const uiState = useUIState();
414996
415136
  const contentGeneratorConfig = config2.getContentGeneratorConfig();
414997
415137
  const authType = contentGeneratorConfig?.authType;
414998
- const model = config2.getModel();
415138
+ const model = uiState.currentModel;
414999
415139
  const targetDir = config2.getTargetDir();
415000
415140
  const showBanner = !config2.getScreenReader();
415001
415141
  const showTips = !(settings.merged.ui?.hideTips || config2.getScreenReader());
@@ -415070,7 +415210,7 @@ var MainContent = /* @__PURE__ */ __name(() => {
415070
415210
  ],
415071
415211
  children: (item) => item
415072
415212
  },
415073
- uiState.historyRemountKey
415213
+ `${uiState.historyRemountKey}-${uiState.currentModel}`
415074
415214
  ),
415075
415215
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(OverflowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Box_default, { flexDirection: "column", children: [
415076
415216
  pendingHistoryItems.map((item, i3) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
@@ -417329,13 +417469,47 @@ __name(QwenOAuthProgress, "QwenOAuthProgress");
417329
417469
  init_esbuild_shims();
417330
417470
  var import_react81 = __toESM(require_react(), 1);
417331
417471
 
417472
+ // packages/cli/src/ui/components/ApiKeyInput.tsx
417473
+ init_esbuild_shims();
417474
+ var import_react79 = __toESM(require_react(), 1);
417475
+ var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
417476
+ function ApiKeyInput({
417477
+ onSubmit,
417478
+ onCancel
417479
+ }) {
417480
+ const [apiKey, setApiKey] = (0, import_react79.useState)("");
417481
+ const [error2, setError] = (0, import_react79.useState)(null);
417482
+ useKeypress(
417483
+ (key) => {
417484
+ if (key.name === "escape") {
417485
+ onCancel();
417486
+ } else if (key.name === "return") {
417487
+ const trimmedKey = apiKey.trim();
417488
+ if (!trimmedKey) {
417489
+ setError(t4("API key cannot be empty."));
417490
+ return;
417491
+ }
417492
+ onSubmit(trimmedKey);
417493
+ }
417494
+ },
417495
+ { isActive: true }
417496
+ );
417497
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Box_default, { flexDirection: "column", children: [
417498
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { children: t4("Please enter your API key:") }) }),
417499
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TextInput, { value: apiKey, onChange: setApiKey, placeholder: "sk-..." }),
417500
+ error2 && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: Colors.AccentRed, children: error2 }) }),
417501
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: Colors.Gray, children: t4("(Press Enter to submit, Escape to cancel)") }) })
417502
+ ] });
417503
+ }
417504
+ __name(ApiKeyInput, "ApiKeyInput");
417505
+
417332
417506
  // packages/cli/src/ui/contexts/UIActionsContext.tsx
417333
417507
  init_esbuild_shims();
417334
417508
  var import_react80 = __toESM(require_react(), 1);
417335
417509
 
417336
417510
  // packages/cli/src/ui/components/ModelSwitchDialog.tsx
417337
417511
  init_esbuild_shims();
417338
- var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
417512
+ var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
417339
417513
  var ModelSwitchDialog = /* @__PURE__ */ __name(({
417340
417514
  onSelect
417341
417515
  }) => {
@@ -417367,7 +417541,7 @@ var ModelSwitchDialog = /* @__PURE__ */ __name(({
417367
417541
  const handleSelect = /* @__PURE__ */ __name((outcome) => {
417368
417542
  onSelect(outcome);
417369
417543
  }, "handleSelect");
417370
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
417544
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
417371
417545
  Box_default,
417372
417546
  {
417373
417547
  flexDirection: "column",
@@ -417377,12 +417551,12 @@ var ModelSwitchDialog = /* @__PURE__ */ __name(({
417377
417551
  width: "100%",
417378
417552
  marginLeft: 1,
417379
417553
  children: [
417380
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
417381
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { bold: true, children: "Vision Model Switch Required" }),
417382
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { children: "Your message contains an image, but the current model doesn't support vision." }),
417383
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { children: "How would you like to proceed?" })
417554
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
417555
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { bold: true, children: "Vision Model Switch Required" }),
417556
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { children: "Your message contains an image, but the current model doesn't support vision." }),
417557
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { children: "How would you like to proceed?" })
417384
417558
  ] }),
417385
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
417559
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
417386
417560
  RadioButtonSelect,
417387
417561
  {
417388
417562
  items: options2,
@@ -417391,209 +417565,12 @@ var ModelSwitchDialog = /* @__PURE__ */ __name(({
417391
417565
  isFocused: true
417392
417566
  }
417393
417567
  ) }),
417394
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: Colors.Gray, children: "Press Enter to select, Esc to cancel" }) })
417568
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { color: Colors.Gray, children: "Press Enter to select, Esc to cancel" }) })
417395
417569
  ]
417396
417570
  }
417397
417571
  );
417398
417572
  }, "ModelSwitchDialog");
417399
417573
 
417400
- // packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
417401
- init_esbuild_shims();
417402
- var import_react79 = __toESM(require_react(), 1);
417403
- init_zod();
417404
- var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
417405
- var credentialSchema = external_exports.object({
417406
- apiKey: external_exports.string().min(1, "API key is required"),
417407
- baseUrl: external_exports.union([external_exports.string().url("Base URL must be a valid URL"), external_exports.literal("")]).optional(),
417408
- model: external_exports.string().min(1, "Model must be a non-empty string").optional()
417409
- });
417410
- function OpenAIKeyPrompt({
417411
- onSubmit,
417412
- onCancel,
417413
- defaultApiKey,
417414
- defaultBaseUrl,
417415
- defaultModel
417416
- }) {
417417
- const [apiKey, setApiKey] = (0, import_react79.useState)(defaultApiKey || "");
417418
- const [baseUrl, setBaseUrl] = (0, import_react79.useState)(defaultBaseUrl || "");
417419
- const [model, setModel] = (0, import_react79.useState)(defaultModel || "");
417420
- const [currentField, setCurrentField] = (0, import_react79.useState)("apiKey");
417421
- const [validationError, setValidationError] = (0, import_react79.useState)(null);
417422
- const validateAndSubmit = /* @__PURE__ */ __name(() => {
417423
- setValidationError(null);
417424
- try {
417425
- const validated = credentialSchema.parse({
417426
- apiKey: apiKey.trim(),
417427
- baseUrl: baseUrl.trim() || void 0,
417428
- model: model.trim() || void 0
417429
- });
417430
- onSubmit(
417431
- validated.apiKey,
417432
- validated.baseUrl === "" ? "" : validated.baseUrl || "",
417433
- validated.model || ""
417434
- );
417435
- } catch (error2) {
417436
- if (error2 instanceof external_exports.ZodError) {
417437
- const errorMessage = error2.errors.map((e4) => `${e4.path.join(".")}: ${e4.message}`).join(", ");
417438
- setValidationError(
417439
- t4("Invalid credentials: {{errorMessage}}", { errorMessage })
417440
- );
417441
- } else {
417442
- setValidationError(t4("Failed to validate credentials"));
417443
- }
417444
- }
417445
- }, "validateAndSubmit");
417446
- useKeypress(
417447
- (key) => {
417448
- if (key.name === "escape") {
417449
- onCancel();
417450
- return;
417451
- }
417452
- if (key.name === "return") {
417453
- if (currentField === "apiKey") {
417454
- setCurrentField("baseUrl");
417455
- return;
417456
- } else if (currentField === "baseUrl") {
417457
- setCurrentField("model");
417458
- return;
417459
- } else if (currentField === "model") {
417460
- if (apiKey.trim()) {
417461
- validateAndSubmit();
417462
- } else {
417463
- setCurrentField("apiKey");
417464
- }
417465
- }
417466
- return;
417467
- }
417468
- if (key.name === "tab") {
417469
- if (currentField === "apiKey") {
417470
- setCurrentField("baseUrl");
417471
- } else if (currentField === "baseUrl") {
417472
- setCurrentField("model");
417473
- } else if (currentField === "model") {
417474
- setCurrentField("apiKey");
417475
- }
417476
- return;
417477
- }
417478
- if (key.name === "up") {
417479
- if (currentField === "baseUrl") {
417480
- setCurrentField("apiKey");
417481
- } else if (currentField === "model") {
417482
- setCurrentField("baseUrl");
417483
- }
417484
- return;
417485
- }
417486
- if (key.name === "down") {
417487
- if (currentField === "apiKey") {
417488
- setCurrentField("baseUrl");
417489
- } else if (currentField === "baseUrl") {
417490
- setCurrentField("model");
417491
- }
417492
- return;
417493
- }
417494
- if (key.name === "backspace" || key.name === "delete") {
417495
- if (currentField === "apiKey") {
417496
- setApiKey((prev) => prev.slice(0, -1));
417497
- } else if (currentField === "baseUrl") {
417498
- setBaseUrl((prev) => prev.slice(0, -1));
417499
- } else if (currentField === "model") {
417500
- setModel((prev) => prev.slice(0, -1));
417501
- }
417502
- return;
417503
- }
417504
- if (key.paste && key.sequence) {
417505
- let cleanInput = key.sequence.replace(/\u001b\[[0-9;]*[a-zA-Z]/g, "").replace(/\[200~/g, "").replace(/\[201~/g, "").replace(/^\[|~$/g, "");
417506
- cleanInput = cleanInput.split("").filter((ch) => ch.charCodeAt(0) >= 32).join("");
417507
- if (cleanInput.length > 0) {
417508
- if (currentField === "apiKey") {
417509
- setApiKey((prev) => prev + cleanInput);
417510
- } else if (currentField === "baseUrl") {
417511
- setBaseUrl((prev) => prev + cleanInput);
417512
- } else if (currentField === "model") {
417513
- setModel((prev) => prev + cleanInput);
417514
- }
417515
- }
417516
- return;
417517
- }
417518
- if (key.sequence && !key.ctrl && !key.meta) {
417519
- const cleanInput = key.sequence.split("").filter((ch) => ch.charCodeAt(0) >= 32).join("");
417520
- if (cleanInput.length > 0) {
417521
- if (currentField === "apiKey") {
417522
- setApiKey((prev) => prev + cleanInput);
417523
- } else if (currentField === "baseUrl") {
417524
- setBaseUrl((prev) => prev + cleanInput);
417525
- } else if (currentField === "model") {
417526
- setModel((prev) => prev + cleanInput);
417527
- }
417528
- }
417529
- }
417530
- },
417531
- { isActive: true }
417532
- );
417533
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
417534
- Box_default,
417535
- {
417536
- borderStyle: "round",
417537
- borderColor: Colors.AccentBlue,
417538
- flexDirection: "column",
417539
- padding: 1,
417540
- width: "100%",
417541
- children: [
417542
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { bold: true, color: Colors.AccentBlue, children: t4("OpenAI Configuration Required") }),
417543
- validationError && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { color: Colors.AccentRed, children: validationError }) }),
417544
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Text3, { children: [
417545
- t4(
417546
- "Please enter your OpenAI configuration. You can get an API key from"
417547
- ),
417548
- " ",
417549
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { color: Colors.AccentBlue, children: "https://bailian.console.aliyun.com/?tab=model#/api-key" })
417550
- ] }) }),
417551
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
417552
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { width: 12, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
417553
- Text3,
417554
- {
417555
- color: currentField === "apiKey" ? Colors.AccentBlue : Colors.Gray,
417556
- children: t4("API Key:")
417557
- }
417558
- ) }),
417559
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Text3, { children: [
417560
- currentField === "apiKey" ? "> " : " ",
417561
- apiKey || " "
417562
- ] }) })
417563
- ] }),
417564
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
417565
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { width: 12, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
417566
- Text3,
417567
- {
417568
- color: currentField === "baseUrl" ? Colors.AccentBlue : Colors.Gray,
417569
- children: t4("Base URL:")
417570
- }
417571
- ) }),
417572
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Text3, { children: [
417573
- currentField === "baseUrl" ? "> " : " ",
417574
- baseUrl
417575
- ] }) })
417576
- ] }),
417577
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
417578
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { width: 12, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
417579
- Text3,
417580
- {
417581
- color: currentField === "model" ? Colors.AccentBlue : Colors.Gray,
417582
- children: t4("Model:")
417583
- }
417584
- ) }),
417585
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Text3, { children: [
417586
- currentField === "model" ? "> " : " ",
417587
- model
417588
- ] }) })
417589
- ] }),
417590
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Text3, { color: Colors.Gray, children: t4("Press Enter to continue, Tab/\u2191\u2193 to navigate, Esc to cancel") }) })
417591
- ]
417592
- }
417593
- );
417594
- }
417595
- __name(OpenAIKeyPrompt, "OpenAIKeyPrompt");
417596
-
417597
417574
  // packages/cli/src/ui/contexts/UIActionsContext.tsx
417598
417575
  var UIActionsContext = (0, import_react80.createContext)(null);
417599
417576
  var useUIActions = /* @__PURE__ */ __name(() => {
@@ -417615,25 +417592,39 @@ function parseDefaultAuthType(defaultAuthType) {
417615
417592
  __name(parseDefaultAuthType, "parseDefaultAuthType");
417616
417593
  function AuthDialog() {
417617
417594
  const { pendingAuthType, authError } = useUIState();
417618
- const { handleAuthSelect: onAuthSelect } = useUIActions();
417595
+ const { handleAuthSelect: onAuthSelect, handleCodingPlanSubmit } = useUIActions();
417619
417596
  const config2 = useConfig();
417620
417597
  const [errorMessage, setErrorMessage] = (0, import_react81.useState)(null);
417621
417598
  const [selectedIndex, setSelectedIndex] = (0, import_react81.useState)(null);
417622
- const items = [
417599
+ const [viewLevel, setViewLevel] = (0, import_react81.useState)("main");
417600
+ const [apiKeySubModeIndex, setApiKeySubModeIndex] = (0, import_react81.useState)(0);
417601
+ const mainItems = [
417623
417602
  {
417624
417603
  key: AuthType2.QWEN_OAUTH,
417625
417604
  label: t4("Qwen OAuth"),
417626
417605
  value: AuthType2.QWEN_OAUTH
417627
417606
  },
417628
417607
  {
417629
- key: AuthType2.USE_OPENAI,
417630
- label: t4("OpenAI"),
417631
- value: AuthType2.USE_OPENAI
417608
+ key: "API-KEY",
417609
+ label: t4("API-KEY"),
417610
+ value: "API-KEY"
417611
+ }
417612
+ ];
417613
+ const apiKeySubItems = [
417614
+ {
417615
+ key: "coding-plan",
417616
+ label: t4("Coding Plan"),
417617
+ value: "coding-plan"
417618
+ },
417619
+ {
417620
+ key: "custom",
417621
+ label: t4("Custom"),
417622
+ value: "custom"
417632
417623
  }
417633
417624
  ];
417634
417625
  const initialAuthIndex = Math.max(
417635
417626
  0,
417636
- items.findIndex((item) => {
417627
+ mainItems.findIndex((item) => {
417637
417628
  if (pendingAuthType) {
417638
417629
  return item.value === pendingAuthType;
417639
417630
  }
@@ -417651,18 +417642,50 @@ function AuthDialog() {
417651
417642
  })
417652
417643
  );
417653
417644
  const hasApiKey = Boolean(config2.getContentGeneratorConfig()?.apiKey);
417654
- const currentSelectedAuthType = selectedIndex !== null ? items[selectedIndex]?.value : items[initialAuthIndex]?.value;
417655
- const handleAuthSelect = /* @__PURE__ */ __name(async (authMethod) => {
417645
+ const currentSelectedAuthType = selectedIndex !== null ? mainItems[selectedIndex]?.value : mainItems[initialAuthIndex]?.value;
417646
+ const handleMainSelect = /* @__PURE__ */ __name(async (value) => {
417656
417647
  setErrorMessage(null);
417657
- await onAuthSelect(authMethod);
417658
- }, "handleAuthSelect");
417659
- const handleHighlight = /* @__PURE__ */ __name((authMethod) => {
417660
- const index = items.findIndex((item) => item.value === authMethod);
417661
- setSelectedIndex(index);
417662
- }, "handleHighlight");
417648
+ if (value === "API-KEY") {
417649
+ setViewLevel("api-key-sub");
417650
+ return;
417651
+ }
417652
+ await onAuthSelect(value);
417653
+ }, "handleMainSelect");
417654
+ const handleApiKeySubSelect = /* @__PURE__ */ __name(async (subMode) => {
417655
+ setErrorMessage(null);
417656
+ if (subMode === "coding-plan") {
417657
+ setViewLevel("api-key-input");
417658
+ } else {
417659
+ setViewLevel("custom-info");
417660
+ }
417661
+ }, "handleApiKeySubSelect");
417662
+ const handleApiKeyInputSubmit = /* @__PURE__ */ __name(async (apiKey) => {
417663
+ setErrorMessage(null);
417664
+ if (!apiKey.trim()) {
417665
+ setErrorMessage(t4("API key cannot be empty."));
417666
+ return;
417667
+ }
417668
+ await handleCodingPlanSubmit(apiKey);
417669
+ }, "handleApiKeyInputSubmit");
417670
+ const handleGoBack = /* @__PURE__ */ __name(() => {
417671
+ setErrorMessage(null);
417672
+ if (viewLevel === "api-key-sub") {
417673
+ setViewLevel("main");
417674
+ } else if (viewLevel === "api-key-input" || viewLevel === "custom-info") {
417675
+ setViewLevel("api-key-sub");
417676
+ }
417677
+ }, "handleGoBack");
417663
417678
  useKeypress(
417664
417679
  (key) => {
417665
417680
  if (key.name === "escape") {
417681
+ if (viewLevel === "api-key-sub") {
417682
+ handleGoBack();
417683
+ return;
417684
+ }
417685
+ if (viewLevel === "api-key-input" || viewLevel === "custom-info") {
417686
+ handleGoBack();
417687
+ return;
417688
+ }
417666
417689
  if (errorMessage) {
417667
417690
  return;
417668
417691
  }
@@ -417679,6 +417702,88 @@ function AuthDialog() {
417679
417702
  },
417680
417703
  { isActive: true }
417681
417704
  );
417705
+ const renderMainView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
417706
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("How would you like to authenticate for this project?") }) }),
417707
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
417708
+ RadioButtonSelect,
417709
+ {
417710
+ items: mainItems,
417711
+ initialIndex: initialAuthIndex,
417712
+ onSelect: handleMainSelect,
417713
+ onHighlight: (value) => {
417714
+ const index = mainItems.findIndex((item) => item.value === value);
417715
+ setSelectedIndex(index);
417716
+ }
417717
+ }
417718
+ ) })
417719
+ ] }), "renderMainView");
417720
+ const renderApiKeySubView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
417721
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("Select API-KEY configuration mode:") }) }),
417722
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
417723
+ RadioButtonSelect,
417724
+ {
417725
+ items: apiKeySubItems,
417726
+ initialIndex: apiKeySubModeIndex,
417727
+ onSelect: handleApiKeySubSelect,
417728
+ onHighlight: (value) => {
417729
+ const index = apiKeySubItems.findIndex(
417730
+ (item) => item.value === value
417731
+ );
417732
+ setApiKeySubModeIndex(index);
417733
+ }
417734
+ }
417735
+ ) }),
417736
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.Gray, children: t4("(Press Escape to go back)") }) })
417737
+ ] }), "renderApiKeySubView");
417738
+ const renderApiKeyInputView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ApiKeyInput, { onSubmit: handleApiKeyInputSubmit, onCancel: handleGoBack }) }), "renderApiKeyInputView");
417739
+ const renderCustomInfoView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
417740
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { bold: true, children: t4("Custom API-KEY Configuration") }) }),
417741
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("For advanced users who want to configure models manually.") }) }),
417742
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("Please configure your models in settings.json:") }) }),
417743
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Text3, { color: Colors.AccentYellow, children: [
417744
+ "1. ",
417745
+ t4("Set API key via environment variable (e.g., OPENAI_API_KEY)")
417746
+ ] }) }),
417747
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 0, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Text3, { color: Colors.AccentYellow, children: [
417748
+ "2.",
417749
+ " ",
417750
+ t4(
417751
+ "Add model configuration to modelProviders['openai'] (or other auth types)"
417752
+ )
417753
+ ] }) }),
417754
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 0, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Text3, { color: Colors.AccentYellow, children: [
417755
+ "3.",
417756
+ " ",
417757
+ t4(
417758
+ "Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig"
417759
+ )
417760
+ ] }) }),
417761
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 0, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Text3, { color: Colors.AccentYellow, children: [
417762
+ "4.",
417763
+ " ",
417764
+ t4(
417765
+ "Use /model command to select your preferred model from the configured list"
417766
+ )
417767
+ ] }) }),
417768
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.Gray, children: t4(
417769
+ "Supported auth types: openai, anthropic, gemini, vertex-ai, etc."
417770
+ ) }) }),
417771
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.Gray, children: t4("(Press Escape to go back)") }) })
417772
+ ] }), "renderCustomInfoView");
417773
+ const getViewTitle = /* @__PURE__ */ __name(() => {
417774
+ switch (viewLevel) {
417775
+ case "main":
417776
+ return t4("Get started");
417777
+ case "api-key-sub":
417778
+ return t4("API-KEY Configuration");
417779
+ case "api-key-input":
417780
+ return t4("Coding Plan Setup");
417781
+ case "custom-info":
417782
+ return t4("Custom Configuration");
417783
+ default:
417784
+ return t4("Get started");
417785
+ }
417786
+ }, "getViewTitle");
417682
417787
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
417683
417788
  Box_default,
417684
417789
  {
@@ -417688,24 +417793,20 @@ function AuthDialog() {
417688
417793
  padding: 1,
417689
417794
  width: "100%",
417690
417795
  children: [
417691
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { bold: true, children: t4("Get started") }),
417692
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("How would you like to authenticate for this project?") }) }),
417693
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
417694
- RadioButtonSelect,
417695
- {
417696
- items,
417697
- initialIndex: initialAuthIndex,
417698
- onSelect: handleAuthSelect,
417699
- onHighlight: handleHighlight
417700
- }
417701
- ) }),
417796
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { bold: true, children: getViewTitle() }),
417797
+ viewLevel === "main" && renderMainView(),
417798
+ viewLevel === "api-key-sub" && renderApiKeySubView(),
417799
+ viewLevel === "api-key-input" && renderApiKeyInputView(),
417800
+ viewLevel === "custom-info" && renderCustomInfoView(),
417702
417801
  (authError || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.AccentRed, children: authError || errorMessage }) }),
417703
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.AccentPurple, children: t4("(Use Enter to Set Auth)") }) }),
417704
- hasApiKey && currentSelectedAuthType === AuthType2.QWEN_OAUTH && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.Gray, children: t4(
417705
- "Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed."
417706
- ) }) }),
417707
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("Terms of Services and Privacy Notice for Qwen Code") }) }),
417708
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.AccentBlue, children: "https://github.com/QwenLM/Qwen3-Coder/blob/main/README.md" }) })
417802
+ viewLevel === "main" && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
417803
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.AccentPurple, children: t4("(Use Enter to Set Auth)") }) }),
417804
+ hasApiKey && currentSelectedAuthType === AuthType2.QWEN_OAUTH && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.Gray, children: t4(
417805
+ "Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed."
417806
+ ) }) }),
417807
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { children: t4("Terms of Services and Privacy Notice for Qwen Code") }) }),
417808
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Text3, { color: Colors.AccentBlue, children: "https://github.com/QwenLM/Qwen3-Coder/blob/main/README.md" }) })
417809
+ ] })
417709
417810
  ]
417710
417811
  }
417711
417812
  );
@@ -419115,15 +419216,6 @@ var DialogManager = /* @__PURE__ */ __name(({
419115
419216
  const uiState = useUIState();
419116
419217
  const uiActions = useUIActions();
419117
419218
  const { constrainHeight, terminalHeight, staticExtraHeight, mainAreaWidth } = uiState;
419118
- const getDefaultOpenAIConfig = /* @__PURE__ */ __name(() => {
419119
- const fromSettings = settings.merged.security?.auth;
419120
- const modelSettings = settings.merged.model;
419121
- return {
419122
- apiKey: fromSettings?.apiKey || process35.env["OPENAI_API_KEY"] || "",
419123
- baseUrl: fromSettings?.baseUrl || process35.env["OPENAI_BASE_URL"] || "",
419124
- model: modelSettings?.name || process35.env["OPENAI_MODEL"] || ""
419125
- };
419126
- }, "getDefaultOpenAIConfig");
419127
419219
  if (uiState.showWelcomeBackDialog && uiState.welcomeBackInfo?.hasHistory) {
419128
419220
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
419129
419221
  WelcomeBackDialog,
@@ -419297,28 +419389,6 @@ var DialogManager = /* @__PURE__ */ __name(({
419297
419389
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(AuthDialog, {}) });
419298
419390
  }
419299
419391
  if (uiState.isAuthenticating) {
419300
- if (uiState.pendingAuthType === AuthType2.USE_OPENAI) {
419301
- const defaults3 = getDefaultOpenAIConfig();
419302
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
419303
- OpenAIKeyPrompt,
419304
- {
419305
- onSubmit: (apiKey, baseUrl, model) => {
419306
- uiActions.handleAuthSelect(AuthType2.USE_OPENAI, {
419307
- apiKey,
419308
- baseUrl,
419309
- model
419310
- });
419311
- },
419312
- onCancel: () => {
419313
- uiActions.cancelAuthentication();
419314
- uiActions.setAuthState("updating" /* Updating */);
419315
- },
419316
- defaultApiKey: defaults3.apiKey,
419317
- defaultBaseUrl: defaults3.baseUrl,
419318
- defaultModel: defaults3.model
419319
- }
419320
- );
419321
- }
419322
419392
  if (uiState.pendingAuthType === AuthType2.QWEN_OAUTH) {
419323
419393
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
419324
419394
  QwenOAuthProgress,
@@ -422705,6 +422775,31 @@ var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) =>
422705
422775
  };
422706
422776
  }, "useQwenAuth");
422707
422777
 
422778
+ // packages/cli/src/constants/codingPlanTemplates.ts
422779
+ init_esbuild_shims();
422780
+ var CODING_PLAN_ENV_KEY = "BAILIAN_CODING_PLAN_API_KEY";
422781
+ var CODING_PLAN_TEMPLATE = [
422782
+ {
422783
+ id: "qwen3-coder-plus",
422784
+ name: "qwen3-coder-plur",
422785
+ baseUrl: "https://coding.dashscope.aliyuncs.com/v1",
422786
+ description: "Qwen3 Coder Plus model from Bailian Coding Plan",
422787
+ envKey: CODING_PLAN_ENV_KEY
422788
+ },
422789
+ {
422790
+ id: "qwen3-max-2026-01-23",
422791
+ name: "qwen3-max-2026-01-23",
422792
+ description: "Qwen3 Max Thinking model from Bailian Coding Plan",
422793
+ baseUrl: "https://coding.dashscope.aliyuncs.com/v1",
422794
+ envKey: CODING_PLAN_ENV_KEY,
422795
+ generationConfig: {
422796
+ extra_body: {
422797
+ enable_thinking: true
422798
+ }
422799
+ }
422800
+ }
422801
+ ];
422802
+
422708
422803
  // packages/cli/src/ui/auth/useAuth.ts
422709
422804
  var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem, onAuthChange) => {
422710
422805
  const unAuthenticated = config2.getAuthType() === void 0;
@@ -422897,6 +422992,74 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem, onAuthC
422897
422992
  setIsAuthDialogOpen(true);
422898
422993
  setAuthError(null);
422899
422994
  }, [isAuthenticating, pendingAuthType, cancelQwenAuth, config2]);
422995
+ const handleCodingPlanSubmit = (0, import_react103.useCallback)(
422996
+ async (apiKey) => {
422997
+ try {
422998
+ setIsAuthenticating(true);
422999
+ setAuthError(null);
423000
+ const envKeyName = CODING_PLAN_ENV_KEY;
423001
+ const persistScope = getPersistScopeForModelSelection(settings);
423002
+ settings.setValue(persistScope, `env.${envKeyName}`, apiKey);
423003
+ process.env[envKeyName] = apiKey;
423004
+ const newConfigs = CODING_PLAN_TEMPLATE.map(
423005
+ (templateConfig) => ({
423006
+ ...templateConfig,
423007
+ envKey: envKeyName
423008
+ })
423009
+ );
423010
+ const existingConfigs = settings.merged.modelProviders?.[AuthType2.USE_OPENAI] || [];
423011
+ const isDuplicate = /* @__PURE__ */ __name((config3) => existingConfigs.some(
423012
+ (existing) => existing.id === config3.id && existing.baseUrl === config3.baseUrl && existing.envKey === config3.envKey
423013
+ ), "isDuplicate");
423014
+ const uniqueNewConfigs = newConfigs.filter(
423015
+ (config3) => !isDuplicate(config3)
423016
+ );
423017
+ const updatedConfigs = [...uniqueNewConfigs, ...existingConfigs];
423018
+ settings.setValue(
423019
+ persistScope,
423020
+ `modelProviders.${AuthType2.USE_OPENAI}`,
423021
+ updatedConfigs
423022
+ );
423023
+ settings.setValue(
423024
+ persistScope,
423025
+ "security.auth.selectedType",
423026
+ AuthType2.USE_OPENAI
423027
+ );
423028
+ if (updatedConfigs.length > 0 && updatedConfigs[0]?.id) {
423029
+ settings.setValue(persistScope, "model.name", updatedConfigs[0].id);
423030
+ }
423031
+ const updatedModelProviders = {
423032
+ ...settings.merged.modelProviders,
423033
+ [AuthType2.USE_OPENAI]: updatedConfigs
423034
+ };
423035
+ config2.reloadModelProvidersConfig(updatedModelProviders);
423036
+ await config2.refreshAuth(AuthType2.USE_OPENAI);
423037
+ setAuthError(null);
423038
+ setAuthState("authenticated" /* Authenticated */);
423039
+ setIsAuthDialogOpen(false);
423040
+ setIsAuthenticating(false);
423041
+ onAuthChange?.();
423042
+ addItem(
423043
+ {
423044
+ type: "info" /* INFO */,
423045
+ text: t4(
423046
+ "Authenticated successfully with Coding Plan. API key is stored in settings.env."
423047
+ )
423048
+ },
423049
+ Date.now()
423050
+ );
423051
+ const authEvent = new AuthEvent(
423052
+ AuthType2.USE_OPENAI,
423053
+ "coding-plan",
423054
+ "success"
423055
+ );
423056
+ logAuth(config2, authEvent);
423057
+ } catch (error2) {
423058
+ handleAuthFailure(error2);
423059
+ }
423060
+ },
423061
+ [settings, config2, handleAuthFailure, addItem, onAuthChange]
423062
+ );
422900
423063
  (0, import_react103.useEffect)(() => {
422901
423064
  const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
422902
423065
  if (defaultAuthType && ![
@@ -422933,6 +423096,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem, onAuthC
422933
423096
  pendingAuthType,
422934
423097
  qwenAuthState,
422935
423098
  handleAuthSelect,
423099
+ handleCodingPlanSubmit,
422936
423100
  openAuthDialog,
422937
423101
  cancelAuthentication
422938
423102
  };
@@ -430854,6 +431018,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
430854
431018
  pendingAuthType,
430855
431019
  qwenAuthState,
430856
431020
  handleAuthSelect,
431021
+ handleCodingPlanSubmit,
430857
431022
  openAuthDialog,
430858
431023
  cancelAuthentication
430859
431024
  } = useAuthCommand(settings, config2, historyManager.addItem, refreshStatic);
@@ -431719,6 +431884,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
431719
431884
  setAuthState,
431720
431885
  onAuthError,
431721
431886
  cancelAuthentication,
431887
+ handleCodingPlanSubmit,
431722
431888
  handleEditorSelect,
431723
431889
  exitEditorDialog,
431724
431890
  closeSettingsDialog,
@@ -431763,6 +431929,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
431763
431929
  setAuthState,
431764
431930
  onAuthError,
431765
431931
  cancelAuthentication,
431932
+ handleCodingPlanSubmit,
431766
431933
  handleEditorSelect,
431767
431934
  exitEditorDialog,
431768
431935
  closeSettingsDialog,
@@ -434813,7 +434980,7 @@ var GeminiAgent = class {
434813
434980
  name: APPROVAL_MODE_INFO[mode].name,
434814
434981
  description: APPROVAL_MODE_INFO[mode].description
434815
434982
  }));
434816
- const version2 = "0.10.0-preview.2";
434983
+ const version2 = "0.10.0-preview.4";
434817
434984
  return {
434818
434985
  protocolVersion: PROTOCOL_VERSION,
434819
434986
  agentInfo: {
package/locales/de.js CHANGED
@@ -1371,4 +1371,22 @@ export default {
1371
1371
  'Sie können den Berechtigungsmodus schnell mit Shift+Tab oder /approval-mode wechseln.',
1372
1372
  'You can switch permission mode quickly with Tab or /approval-mode.':
1373
1373
  'Sie können den Berechtigungsmodus schnell mit Tab oder /approval-mode wechseln.',
1374
+
1375
+ // ============================================================================
1376
+ // Custom API-KEY Configuration
1377
+ // ============================================================================
1378
+ 'For advanced users who want to configure models manually.':
1379
+ 'Für fortgeschrittene Benutzer, die Modelle manuell konfigurieren möchten.',
1380
+ 'Please configure your models in settings.json:':
1381
+ 'Bitte konfigurieren Sie Ihre Modelle in settings.json:',
1382
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
1383
+ 'API-Schlüssel über Umgebungsvariable setzen (z.B. OPENAI_API_KEY)',
1384
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
1385
+ "Modellkonfiguration zu modelProviders['openai'] (oder anderen Authentifizierungstypen) hinzufügen",
1386
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
1387
+ 'Jeder Anbieter benötigt: id, envKey (erforderlich), plus optionale baseUrl, generationConfig',
1388
+ 'Use /model command to select your preferred model from the configured list':
1389
+ 'Verwenden Sie den /model-Befehl, um Ihr bevorzugtes Modell aus der konfigurierten Liste auszuwählen',
1390
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
1391
+ 'Unterstützte Authentifizierungstypen: openai, anthropic, gemini, vertex-ai, usw.',
1374
1392
  };
package/locales/en.js CHANGED
@@ -1362,4 +1362,41 @@ export default {
1362
1362
  'Opening extensions page in your browser: {{url}}',
1363
1363
  'Failed to open browser. Check out the extensions gallery at {{url}}':
1364
1364
  'Failed to open browser. Check out the extensions gallery at {{url}}',
1365
+
1366
+ // ============================================================================
1367
+ // Coding Plan Authentication
1368
+ // ============================================================================
1369
+ 'Please enter your API key:': 'Please enter your API key:',
1370
+ 'API key cannot be empty.': 'API key cannot be empty.',
1371
+ 'API key is stored in settings.env. You can migrate it to a .env file for better security.':
1372
+ 'API key is stored in settings.env. You can migrate it to a .env file for better security.',
1373
+
1374
+ // ============================================================================
1375
+ // Custom API-KEY Configuration
1376
+ // ============================================================================
1377
+ 'For advanced users who want to configure models manually.':
1378
+ 'For advanced users who want to configure models manually.',
1379
+ 'Please configure your models in settings.json:':
1380
+ 'Please configure your models in settings.json:',
1381
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
1382
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)',
1383
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
1384
+ "Add model configuration to modelProviders['openai'] (or other auth types)",
1385
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
1386
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig',
1387
+ 'Use /model command to select your preferred model from the configured list':
1388
+ 'Use /model command to select your preferred model from the configured list',
1389
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
1390
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.',
1391
+
1392
+ // ============================================================================
1393
+ // Auth Dialog - View Titles and Labels
1394
+ // ============================================================================
1395
+ 'API-KEY': 'API-KEY',
1396
+ 'Coding Plan': 'Coding Plan',
1397
+ Custom: 'Custom',
1398
+ 'Select API-KEY configuration mode:': 'Select API-KEY configuration mode:',
1399
+ '(Press Escape to go back)': '(Press Escape to go back)',
1400
+ '(Press Enter to submit, Escape to cancel)':
1401
+ '(Press Enter to submit, Escape to cancel)',
1365
1402
  };
package/locales/ja.js CHANGED
@@ -882,4 +882,22 @@ export default {
882
882
  'コードが壊れた?叩けば治るさ',
883
883
  'USBの差し込みに挑戦中...',
884
884
  ],
885
+
886
+ // ============================================================================
887
+ // Custom API-KEY Configuration
888
+ // ============================================================================
889
+ 'For advanced users who want to configure models manually.':
890
+ 'モデルを手動で設定したい上級ユーザー向け。',
891
+ 'Please configure your models in settings.json:':
892
+ 'settings.json でモデルを設定してください:',
893
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
894
+ '環境変数を使用して API キーを設定してください(例:OPENAI_API_KEY)',
895
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
896
+ "modelProviders['openai'](または他の認証タイプ)にモデル設定を追加してください",
897
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
898
+ '各プロバイダーには:id、envKey(必須)、およびオプションの baseUrl、generationConfig が必要です',
899
+ 'Use /model command to select your preferred model from the configured list':
900
+ '/model コマンドを使用して、設定済みリストからお好みのモデルを選択してください',
901
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
902
+ 'サポートされている認証タイプ:openai、anthropic、gemini、vertex-ai など',
885
903
  };
package/locales/pt.js CHANGED
@@ -1385,4 +1385,22 @@ export default {
1385
1385
  'Abrindo página de extensões no seu navegador: {{url}}',
1386
1386
  'Failed to open browser. Check out the extensions gallery at {{url}}':
1387
1387
  'Falha ao abrir o navegador. Confira a galeria de extensões em {{url}}',
1388
+
1389
+ // ============================================================================
1390
+ // Custom API-KEY Configuration
1391
+ // ============================================================================
1392
+ 'For advanced users who want to configure models manually.':
1393
+ 'Para usuários avançados que desejam configurar modelos manualmente.',
1394
+ 'Please configure your models in settings.json:':
1395
+ 'Por favor, configure seus modelos em settings.json:',
1396
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
1397
+ 'Defina a chave de API via variável de ambiente (ex: OPENAI_API_KEY)',
1398
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
1399
+ "Adicione a configuração do modelo a modelProviders['openai'] (ou outros tipos de autenticação)",
1400
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
1401
+ 'Cada provedor precisa de: id, envKey (obrigatório), além de baseUrl e generationConfig opcionais',
1402
+ 'Use /model command to select your preferred model from the configured list':
1403
+ 'Use o comando /model para selecionar seu modelo preferido da lista configurada',
1404
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
1405
+ 'Tipos de autenticação suportados: openai, anthropic, gemini, vertex-ai, etc.',
1388
1406
  };
package/locales/ru.js CHANGED
@@ -1375,4 +1375,22 @@ export default {
1375
1375
  'Вы можете быстро переключать режим разрешений с помощью Shift+Tab или /approval-mode.',
1376
1376
  'You can switch permission mode quickly with Tab or /approval-mode.':
1377
1377
  'Вы можете быстро переключать режим разрешений с помощью Tab или /approval-mode.',
1378
+
1379
+ // ============================================================================
1380
+ // Custom API-KEY Configuration
1381
+ // ============================================================================
1382
+ 'For advanced users who want to configure models manually.':
1383
+ 'Для продвинутых пользователей, которые хотят настраивать модели вручную.',
1384
+ 'Please configure your models in settings.json:':
1385
+ 'Пожалуйста, настройте ваши модели в settings.json:',
1386
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
1387
+ 'Установите ключ API через переменную окружения (например, OPENAI_API_KEY)',
1388
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
1389
+ "Добавьте конфигурацию модели в modelProviders['openai'] (или другие типы аутентификации)",
1390
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
1391
+ 'Каждому провайдеру нужны: id, envKey (обязательно), а также опциональные baseUrl, generationConfig',
1392
+ 'Use /model command to select your preferred model from the configured list':
1393
+ 'Используйте команду /model, чтобы выбрать предпочитаемую модель из настроенного списка',
1394
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
1395
+ 'Поддерживаемые типы аутентификации: openai, anthropic, gemini, vertex-ai и др.',
1378
1396
  };
package/locales/zh.js CHANGED
@@ -1198,4 +1198,40 @@ export default {
1198
1198
  '正在浏览器中打开扩展页面:{{url}}',
1199
1199
  'Failed to open browser. Check out the extensions gallery at {{url}}':
1200
1200
  '打开浏览器失败。请访问扩展市场:{{url}}',
1201
+
1202
+ // ============================================================================
1203
+ // Coding Plan Authentication
1204
+ // ============================================================================
1205
+ 'Please enter your API key:': '请输入您的 API Key:',
1206
+ 'API key cannot be empty.': 'API Key 不能为空。',
1207
+ 'API key is stored in settings.env. You can migrate it to a .env file for better security.':
1208
+ 'API Key 已存储在 settings.env 中。您可以将其迁移到 .env 文件以获得更好的安全性。',
1209
+
1210
+ // ============================================================================
1211
+ // Custom API-KEY Configuration
1212
+ // ============================================================================
1213
+ 'For advanced users who want to configure models manually.':
1214
+ '适合需要手动配置模型的高级用户。',
1215
+ 'Please configure your models in settings.json:':
1216
+ '请在 settings.json 中配置您的模型:',
1217
+ 'Set API key via environment variable (e.g., OPENAI_API_KEY)':
1218
+ '通过环境变量设置 API Key(例如:OPENAI_API_KEY)',
1219
+ "Add model configuration to modelProviders['openai'] (or other auth types)":
1220
+ "将模型配置添加到 modelProviders['openai'](或其他认证类型)",
1221
+ 'Each provider needs: id, envKey (required), plus optional baseUrl, generationConfig':
1222
+ '每个提供商需要:id、envKey(必需),以及可选的 baseUrl、generationConfig',
1223
+ 'Use /model command to select your preferred model from the configured list':
1224
+ '使用 /model 命令从配置列表中选择您偏好的模型',
1225
+ 'Supported auth types: openai, anthropic, gemini, vertex-ai, etc.':
1226
+ '支持的认证类型:openai、anthropic、gemini、vertex-ai 等',
1227
+
1228
+ // ============================================================================
1229
+ // Auth Dialog - View Titles and Labels
1230
+ // ============================================================================
1231
+ 'API-KEY': 'API-KEY',
1232
+ 'Coding Plan': 'Coding Plan',
1233
+ Custom: '自定义',
1234
+ 'Select API-KEY configuration mode:': '选择 API-KEY 配置模式:',
1235
+ '(Press Escape to go back)': '(按 Escape 键返回)',
1236
+ '(Press Enter to submit, Escape to cancel)': '(按 Enter 提交,Escape 取消)',
1201
1237
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/qwen-code",
3
- "version": "0.10.0-preview.2",
3
+ "version": "0.10.0-preview.4",
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.10.0-preview.2"
23
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.10.0-preview.4"
24
24
  },
25
25
  "dependencies": {},
26
26
  "optionalDependencies": {