@unity-china/codely-cli 1.0.0-beta.42 → 1.0.0-beta.44

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/bundle/gemini.js +53 -66
  2. package/package.json +1 -1
package/bundle/gemini.js CHANGED
@@ -72954,7 +72954,7 @@ var init_models = __esm({
72954
72954
  "packages/core/dist/src/config/models.js"() {
72955
72955
  "use strict";
72956
72956
  init_esbuild_polyfill();
72957
- DEFAULT_QWEN_MODEL = "qwen3-coder-480b-a35b-instruct-fp8";
72957
+ DEFAULT_QWEN_MODEL = "qwen3-flash";
72958
72958
  DEFAULT_QWEN_FLASH_MODEL = "qwen3-flash";
72959
72959
  DEFAULT_CODELY_MODEL = "glm-4.7-fp8";
72960
72960
  DEFAULT_GEMINI_MODEL = DEFAULT_CODELY_MODEL;
@@ -269948,13 +269948,18 @@ var init_codelyContentGenerator = __esm({
269948
269948
 
269949
269949
  // packages/core/dist/src/core/contentGenerator.js
269950
269950
  function createContentGeneratorConfig(config4, authType) {
269951
- const geminiApiKey = process.env.GEMINI_API_KEY || void 0;
269952
- const googleApiKey = process.env.GOOGLE_API_KEY || void 0;
269953
- const googleCloudProject = process.env.GOOGLE_CLOUD_PROJECT || void 0;
269954
- const googleCloudLocation = process.env.GOOGLE_CLOUD_LOCATION || void 0;
269955
- const openaiApiKey = process.env.OPENAI_API_KEY;
269956
- const openaiBaseUrl = process.env.OPENAI_BASE_URL || "https://codely-litellm.tuanjie.cn/v1";
269957
- const openaiModel = process.env.OPENAI_MODEL || DEFAULT_QWEN_MODEL;
269951
+ const CODELY_DEFAULT_OPENAI_COMPAT_BASE_URL = "https://codely-litellm.tuanjie.cn/v1";
269952
+ const customAuthEnabled = !!process.env.CUSTOM_AUTH;
269953
+ const allowGeminiEnv = customAuthEnabled && authType === AuthType3.USE_GEMINI;
269954
+ const allowVertexEnv = customAuthEnabled && authType === AuthType3.USE_VERTEX_AI;
269955
+ const allowOpenAIEnv = customAuthEnabled && authType === AuthType3.USE_OPENAI;
269956
+ const geminiApiKey = allowGeminiEnv ? process.env.GEMINI_API_KEY : void 0;
269957
+ const googleApiKey = allowVertexEnv ? process.env.GOOGLE_API_KEY : void 0;
269958
+ const googleCloudProject = allowVertexEnv ? process.env.GOOGLE_CLOUD_PROJECT : void 0;
269959
+ const googleCloudLocation = allowVertexEnv ? process.env.GOOGLE_CLOUD_LOCATION : void 0;
269960
+ const openaiApiKey = allowOpenAIEnv ? process.env.OPENAI_API_KEY : void 0;
269961
+ const openaiBaseUrl = allowOpenAIEnv ? process.env.OPENAI_BASE_URL || CODELY_DEFAULT_OPENAI_COMPAT_BASE_URL : CODELY_DEFAULT_OPENAI_COMPAT_BASE_URL;
269962
+ const openaiModel = allowOpenAIEnv ? process.env.OPENAI_MODEL || DEFAULT_QWEN_MODEL : void 0;
269958
269963
  const configModel = config4.getModel();
269959
269964
  const effectiveModel = configModel && typeof configModel === "string" ? configModel : DEFAULT_GEMINI_MODEL;
269960
269965
  const mergedSamplingParams = config4.getContentGeneratorSamplingParams();
@@ -270002,10 +270007,9 @@ function createContentGeneratorConfig(config4, authType) {
270002
270007
  return contentGeneratorConfig;
270003
270008
  }
270004
270009
  if (authType === AuthType3.CODELY_OAUTH) {
270005
- contentGeneratorConfig.apiKey = openaiApiKey || "CODELY_OAUTH_DYNAMIC_TOKEN";
270006
- contentGeneratorConfig.baseUrl = openaiBaseUrl;
270010
+ contentGeneratorConfig.apiKey = "CODELY_OAUTH_DYNAMIC_TOKEN";
270011
+ contentGeneratorConfig.baseUrl = CODELY_DEFAULT_OPENAI_COMPAT_BASE_URL;
270007
270012
  contentGeneratorConfig.model = config4.getModel() || // Use the model from config (e.g. from --model CLI arg)
270008
- openaiModel || // Fall back to OPENAI_MODEL env var
270009
270013
  DEFAULT_QWEN_MODEL;
270010
270014
  return contentGeneratorConfig;
270011
270015
  }
@@ -365232,7 +365236,7 @@ function urlMatches(urlArray, targetUrl) {
365232
365236
  const normalizedTarget = normalizeUrl2(targetUrl);
365233
365237
  return urlArray.some((url4) => normalizeUrl2(url4) === normalizedTarget);
365234
365238
  }
365235
- function getCoreSystemPrompt(userMemory, config4, additionalPrompts) {
365239
+ function getCoreSystemPrompt(userMemory, config4, additionalPrompts, runtimeContext) {
365236
365240
  const enableSequentialThinking = config4?.enableSequentialThinking ?? true;
365237
365241
  const planToolingGuidance = enableSequentialThinking ? [
365238
365242
  ` - Use the '${SequentialThinkTool.Name}' and '${TodoWriteTool.Name}' together to plan before implementing the task.`,
@@ -365264,9 +365268,9 @@ function getCoreSystemPrompt(userMemory, config4, additionalPrompts) {
365264
365268
  }
365265
365269
  }
365266
365270
  }
365267
- if (config4?.systemPromptMappings) {
365268
- const currentModel = process23.env.OPENAI_MODEL || "";
365269
- const currentBaseUrl = process23.env.OPENAI_BASE_URL || "";
365271
+ if (config4?.systemPromptMappings && process23.env.CUSTOM_AUTH && runtimeContext?.authType === AuthType3.USE_OPENAI) {
365272
+ const currentModel = runtimeContext.model || "";
365273
+ const currentBaseUrl = runtimeContext.baseUrl || "";
365270
365274
  const matchedMapping = config4.systemPromptMappings.find((mapping) => {
365271
365275
  const { baseUrls, modelNames } = mapping;
365272
365276
  if (baseUrls && modelNames && urlMatches(baseUrls, currentBaseUrl) && modelNames.includes(currentModel)) {
@@ -365798,6 +365802,7 @@ var init_prompts = __esm({
365798
365802
  init_gitUtils();
365799
365803
  init_memoryTool();
365800
365804
  init_tool_names();
365805
+ init_contentGenerator();
365801
365806
  SystemPromptExtensions = class _SystemPromptExtensions {
365802
365807
  static instance;
365803
365808
  extensions = [];
@@ -379968,7 +379973,7 @@ Your result MUST be a concise but informative summary for the caller (main agent
379968
379973
  let finalPrompt = getCoreSystemPrompt(userMemory, {
379969
379974
  systemPromptMappings,
379970
379975
  enableSequentialThinking: !this.runtimeContext.isThinkingSupportedModel()
379971
- });
379976
+ }, void 0, this.runtimeContext.getContentGeneratorConfig());
379972
379977
  finalPrompt += `
379973
379978
 
379974
379979
  # Agent Specialization
@@ -419214,7 +419219,7 @@ async function getPackageJson2() {
419214
419219
  // packages/cli/src/utils/version.ts
419215
419220
  async function getCliVersion() {
419216
419221
  const pkgJson = await getPackageJson2();
419217
- return "1.0.0-beta.42";
419222
+ return "1.0.0-beta.44";
419218
419223
  }
419219
419224
 
419220
419225
  // packages/cli/src/ui/commands/types.ts
@@ -419747,7 +419752,7 @@ import process30 from "node:process";
419747
419752
 
419748
419753
  // packages/cli/src/generated/git-commit.ts
419749
419754
  init_esbuild_polyfill();
419750
- var GIT_COMMIT_INFO = "9ad807a5";
419755
+ var GIT_COMMIT_INFO = "107c4b52";
419751
419756
 
419752
419757
  // packages/cli/src/ui/commands/bugCommand.ts
419753
419758
  var bugCommand = {
@@ -461883,10 +461888,14 @@ async function loadCliConfig(settings, extensions, sessionId2, argv, cwd3 = proc
461883
461888
  (_, i3) => allExtensions[i3].isActive
461884
461889
  );
461885
461890
  if (argv.openaiApiKey) {
461886
- process33.env.OPENAI_API_KEY = argv.openaiApiKey;
461891
+ if (process33.env.CUSTOM_AUTH && settings.selectedAuthType === AuthType3.USE_OPENAI) {
461892
+ process33.env.OPENAI_API_KEY = argv.openaiApiKey;
461893
+ }
461887
461894
  }
461888
461895
  if (argv.openaiBaseUrl) {
461889
- process33.env.OPENAI_BASE_URL = argv.openaiBaseUrl;
461896
+ if (process33.env.CUSTOM_AUTH && settings.selectedAuthType === AuthType3.USE_OPENAI) {
461897
+ process33.env.OPENAI_BASE_URL = argv.openaiBaseUrl;
461898
+ }
461890
461899
  }
461891
461900
  if (argv.tavilyApiKey) {
461892
461901
  process33.env.TAVILY_API_KEY = argv.tavilyApiKey;
@@ -462108,7 +462117,7 @@ async function loadCliConfig(settings, extensions, sessionId2, argv, cwd3 = proc
462108
462117
  cwd: cwd3,
462109
462118
  fileDiscoveryService: fileService,
462110
462119
  bugCommand: settings.bugCommand,
462111
- model: argv.model || settings.model || process33.env.OPENAI_MODEL || DEFAULT_CODELY_MODEL,
462120
+ model: argv.model || settings.model || (process33.env.CUSTOM_AUTH && settings.selectedAuthType === AuthType3.USE_OPENAI ? process33.env.OPENAI_MODEL : void 0) || DEFAULT_CODELY_MODEL,
462112
462121
  flashModel: argv.flash || settings.flashModel,
462113
462122
  multimodalModel: argv.multimodal || settings.multimodalModel,
462114
462123
  extensionContextFilePaths,
@@ -485846,6 +485855,12 @@ init_esbuild_polyfill();
485846
485855
  init_dist6();
485847
485856
  var validateAuthMethod = (authMethod) => {
485848
485857
  loadEnvironment();
485858
+ if (!Object.values(AuthType3).includes(authMethod)) {
485859
+ return "Invalid auth method selected.";
485860
+ }
485861
+ if (!process.env.CUSTOM_AUTH && authMethod !== AuthType3.CODELY_OAUTH && authMethod !== AuthType3.LOGIN_WITH_GOOGLE && authMethod !== AuthType3.CLOUD_SHELL) {
485862
+ return "CUSTOM_AUTH is required for non-default authentication providers.";
485863
+ }
485849
485864
  if (authMethod === AuthType3.LOGIN_WITH_GOOGLE || authMethod === AuthType3.CLOUD_SHELL) {
485850
485865
  return null;
485851
485866
  }
@@ -486031,12 +486046,6 @@ function OpenAIKeyPrompt({
486031
486046
 
486032
486047
  // packages/cli/src/ui/components/AuthDialog.tsx
486033
486048
  var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
486034
- function parseDefaultAuthType(defaultAuthType) {
486035
- if (defaultAuthType && Object.values(AuthType3).includes(defaultAuthType)) {
486036
- return defaultAuthType;
486037
- }
486038
- return null;
486039
- }
486040
486049
  function AuthDialog({
486041
486050
  onSelect,
486042
486051
  settings,
@@ -486061,19 +486070,7 @@ function AuthDialog({
486061
486070
  if (settings.merged.selectedAuthType) {
486062
486071
  return item.value === settings.merged.selectedAuthType;
486063
486072
  }
486064
- const defaultAuthType = parseDefaultAuthType(
486065
- process.env.GEMINI_DEFAULT_AUTH_TYPE
486066
- );
486067
- if (defaultAuthType) {
486068
- return item.value === defaultAuthType;
486069
- }
486070
- if (process.env.GEMINI_API_KEY) {
486071
- return item.value === AuthType3.USE_GEMINI;
486072
- }
486073
- if (process.env.QWEN_OAUTH_TOKEN) {
486074
- return item.value === AuthType3.QWEN_OAUTH;
486075
- }
486076
- return item.value === AuthType3.LOGIN_WITH_GOOGLE;
486073
+ return item.value === AuthType3.CODELY_OAUTH;
486077
486074
  })
486078
486075
  );
486079
486076
  const handleAuthSelect = (authMethod) => {
@@ -492269,18 +492266,20 @@ async function start_sandbox(config4, nodeArgs = [], cliConfig) {
492269
492266
  if (process.env.GOOGLE_API_KEY) {
492270
492267
  args.push("--env", `GOOGLE_API_KEY=${process.env.GOOGLE_API_KEY}`);
492271
492268
  }
492272
- if (process.env.OPENAI_API_KEY) {
492273
- args.push("--env", `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}`);
492269
+ if (process.env.CUSTOM_AUTH) {
492270
+ if (process.env.OPENAI_API_KEY) {
492271
+ args.push("--env", `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}`);
492272
+ }
492273
+ if (process.env.OPENAI_BASE_URL) {
492274
+ args.push("--env", `OPENAI_BASE_URL=${process.env.OPENAI_BASE_URL}`);
492275
+ }
492276
+ if (process.env.OPENAI_MODEL) {
492277
+ args.push("--env", `OPENAI_MODEL=${process.env.OPENAI_MODEL}`);
492278
+ }
492274
492279
  }
492275
492280
  if (process.env.TAVILY_API_KEY) {
492276
492281
  args.push("--env", `TAVILY_API_KEY=${process.env.TAVILY_API_KEY}`);
492277
492282
  }
492278
- if (process.env.OPENAI_BASE_URL) {
492279
- args.push("--env", `OPENAI_BASE_URL=${process.env.OPENAI_BASE_URL}`);
492280
- }
492281
- if (process.env.OPENAI_MODEL) {
492282
- args.push("--env", `OPENAI_MODEL=${process.env.OPENAI_MODEL}`);
492283
- }
492284
492283
  if (process.env.GOOGLE_GENAI_USE_VERTEXAI) {
492285
492284
  args.push(
492286
492285
  "--env",
@@ -493170,29 +493169,17 @@ init_dist6();
493170
493169
  // packages/cli/src/validateNonInterActiveAuth.ts
493171
493170
  init_esbuild_polyfill();
493172
493171
  init_dist6();
493173
- function getAuthTypeFromEnv() {
493174
- if (process.env.GOOGLE_GENAI_USE_GCA === "true") {
493175
- return AuthType3.LOGIN_WITH_GOOGLE;
493176
- }
493177
- if (process.env.GOOGLE_GENAI_USE_VERTEXAI === "true") {
493178
- return AuthType3.USE_VERTEX_AI;
493179
- }
493180
- if (process.env.GEMINI_API_KEY) {
493181
- return AuthType3.USE_GEMINI;
493182
- }
493183
- if (process.env.OPENAI_API_KEY) {
493184
- return AuthType3.USE_OPENAI;
493185
- }
493186
- if (process.env.QWEN_OAUTH_TOKEN) {
493187
- return AuthType3.QWEN_OAUTH;
493172
+ function resolveEffectiveAuthType(configuredAuthType) {
493173
+ if (!process.env.CUSTOM_AUTH) {
493174
+ return AuthType3.CODELY_OAUTH;
493188
493175
  }
493189
- return void 0;
493176
+ return configuredAuthType || AuthType3.CODELY_OAUTH;
493190
493177
  }
493191
493178
  async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, nonInteractiveConfig) {
493192
- const effectiveAuthType = configuredAuthType || getAuthTypeFromEnv() || AuthType3.CODELY_OAUTH;
493179
+ const effectiveAuthType = resolveEffectiveAuthType(configuredAuthType);
493193
493180
  if (!effectiveAuthType) {
493194
493181
  console.error(
493195
- `Please set an Auth method in your ${USER_SETTINGS_PATH} or specify one of the following environment variables before running: GEMINI_API_KEY, OPENAI_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_GENAI_USE_GCA`
493182
+ `Please set an Auth method in your ${USER_SETTINGS_PATH} (or pass --auth-type).`
493196
493183
  );
493197
493184
  process.exit(1);
493198
493185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unity-china/codely-cli",
3
- "version": "1.0.0-beta.42",
3
+ "version": "1.0.0-beta.44",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },