@unity-china/codely-cli 1.0.0-beta.41 → 1.0.0-beta.43

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 +84 -62
  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
  }
@@ -399554,21 +399558,21 @@ var require_tinycolor = __commonJS({
399554
399558
  };
399555
399559
  }
399556
399560
  function rgbToHex(r4, g, b, allow3Char) {
399557
- var hex = [pad2(Math.round(r4).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
399561
+ var hex = [pad22(Math.round(r4).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16))];
399558
399562
  if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
399559
399563
  return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
399560
399564
  }
399561
399565
  return hex.join("");
399562
399566
  }
399563
399567
  function rgbaToHex(r4, g, b, a2, allow4Char) {
399564
- var hex = [pad2(Math.round(r4).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a2))];
399568
+ var hex = [pad22(Math.round(r4).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16)), pad22(convertDecimalToHex(a2))];
399565
399569
  if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
399566
399570
  return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
399567
399571
  }
399568
399572
  return hex.join("");
399569
399573
  }
399570
399574
  function rgbaToArgbHex(r4, g, b, a2) {
399571
- var hex = [pad2(convertDecimalToHex(a2)), pad2(Math.round(r4).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
399575
+ var hex = [pad22(convertDecimalToHex(a2)), pad22(Math.round(r4).toString(16)), pad22(Math.round(g).toString(16)), pad22(Math.round(b).toString(16))];
399572
399576
  return hex.join("");
399573
399577
  }
399574
399578
  tinycolor.equals = function(color1, color2) {
@@ -399944,7 +399948,7 @@ var require_tinycolor = __commonJS({
399944
399948
  function isPercentage(n3) {
399945
399949
  return typeof n3 === "string" && n3.indexOf("%") != -1;
399946
399950
  }
399947
- function pad2(c5) {
399951
+ function pad22(c5) {
399948
399952
  return c5.length == 1 ? "0" + c5 : "" + c5;
399949
399953
  }
399950
399954
  function convertToPercentage(n3) {
@@ -419214,7 +419218,7 @@ async function getPackageJson2() {
419214
419218
  // packages/cli/src/utils/version.ts
419215
419219
  async function getCliVersion() {
419216
419220
  const pkgJson = await getPackageJson2();
419217
- return "1.0.0-beta.41";
419221
+ return "1.0.0-beta.43";
419218
419222
  }
419219
419223
 
419220
419224
  // packages/cli/src/ui/commands/types.ts
@@ -419747,7 +419751,7 @@ import process30 from "node:process";
419747
419751
 
419748
419752
  // packages/cli/src/generated/git-commit.ts
419749
419753
  init_esbuild_polyfill();
419750
- var GIT_COMMIT_INFO = "eb48b723";
419754
+ var GIT_COMMIT_INFO = "92247f00";
419751
419755
 
419752
419756
  // packages/cli/src/ui/commands/bugCommand.ts
419753
419757
  var bugCommand = {
@@ -419815,7 +419819,51 @@ init_esbuild_polyfill();
419815
419819
  init_strip_ansi();
419816
419820
  import * as fsPromises5 from "fs/promises";
419817
419821
  import path59 from "path";
419818
- var formatExportTimestampForFilename = (date5 = /* @__PURE__ */ new Date()) => date5.toISOString().replace(/[:.]/g, "-").replace("T", "-").replace(/\.\d{3}Z$/, "");
419822
+ var pad2 = (n3) => String(n3).padStart(2, "0");
419823
+ var pad3 = (n3) => String(n3).padStart(3, "0");
419824
+ var formatLocalDateTime = (date5) => {
419825
+ if (!(date5 instanceof Date) || Number.isNaN(date5.getTime())) {
419826
+ return "Invalid Date";
419827
+ }
419828
+ const y = date5.getFullYear();
419829
+ const m2 = pad2(date5.getMonth() + 1);
419830
+ const d = pad2(date5.getDate());
419831
+ const hh = pad2(date5.getHours());
419832
+ const mm = pad2(date5.getMinutes());
419833
+ const ss = pad2(date5.getSeconds());
419834
+ return `${y}-${m2}-${d} ${hh}:${mm}:${ss}`;
419835
+ };
419836
+ var formatLocalTimestampWithOffset = (date5 = /* @__PURE__ */ new Date()) => {
419837
+ if (!(date5 instanceof Date) || Number.isNaN(date5.getTime())) {
419838
+ return "Invalid Date";
419839
+ }
419840
+ const y = date5.getFullYear();
419841
+ const m2 = pad2(date5.getMonth() + 1);
419842
+ const d = pad2(date5.getDate());
419843
+ const hh = pad2(date5.getHours());
419844
+ const mm = pad2(date5.getMinutes());
419845
+ const ss = pad2(date5.getSeconds());
419846
+ const ms = pad3(date5.getMilliseconds());
419847
+ const offsetMinutes = -date5.getTimezoneOffset();
419848
+ const sign = offsetMinutes >= 0 ? "+" : "-";
419849
+ const abs = Math.abs(offsetMinutes);
419850
+ const offH = pad2(Math.floor(abs / 60));
419851
+ const offM = pad2(abs % 60);
419852
+ return `${y}-${m2}-${d}T${hh}:${mm}:${ss}.${ms}${sign}${offH}:${offM}`;
419853
+ };
419854
+ var formatExportTimestampForFilename = (date5 = /* @__PURE__ */ new Date()) => {
419855
+ if (!(date5 instanceof Date) || Number.isNaN(date5.getTime())) {
419856
+ return "invalid-date";
419857
+ }
419858
+ const y = date5.getFullYear();
419859
+ const m2 = pad2(date5.getMonth() + 1);
419860
+ const d = pad2(date5.getDate());
419861
+ const hh = pad2(date5.getHours());
419862
+ const mm = pad2(date5.getMinutes());
419863
+ const ss = pad2(date5.getSeconds());
419864
+ const ms = pad3(date5.getMilliseconds());
419865
+ return `${y}-${m2}-${d}-${hh}-${mm}-${ss}-${ms}`;
419866
+ };
419819
419867
  var formatDuration2 = (durationMs) => {
419820
419868
  if (!durationMs) return "N/A";
419821
419869
  if (durationMs < 1e3) {
@@ -419906,7 +419954,7 @@ var extractToolResultText = (result) => {
419906
419954
  return joined.trim() ? joined : void 0;
419907
419955
  };
419908
419956
  var convertConversationToMarkdown = (conversation, chatName) => {
419909
- const exportTimestamp = (/* @__PURE__ */ new Date()).toISOString();
419957
+ const exportTimestamp = formatLocalTimestampWithOffset(/* @__PURE__ */ new Date());
419910
419958
  let markdown2 = `# \u{1F680} Enhanced Chat Export`;
419911
419959
  if (chatName) {
419912
419960
  markdown2 += ` - ${chatName}`;
@@ -420080,7 +420128,7 @@ var convertConversationToMarkdown = (conversation, chatName) => {
420080
420128
  return markdown2;
420081
420129
  };
420082
420130
  var convertLegacyHistoryToConversationRecord = (history, _chatName) => {
420083
- const now = (/* @__PURE__ */ new Date()).toISOString();
420131
+ const now = formatLocalTimestampWithOffset(/* @__PURE__ */ new Date());
420084
420132
  return {
420085
420133
  sessionId: "legacy-export",
420086
420134
  projectHash: "unknown",
@@ -420226,9 +420274,7 @@ var listCommand2 = {
420226
420274
  let message = "List of saved conversations:\n\n";
420227
420275
  for (const chat of chatDetails) {
420228
420276
  const paddedName = chat.name.padEnd(maxNameLength, " ");
420229
- const isoString = chat.mtime.toISOString();
420230
- const match3 = isoString.match(/(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/);
420231
- const formattedDate = match3 ? `${match3[1]} ${match3[2]}` : "Invalid Date";
420277
+ const formattedDate = formatLocalDateTime(chat.mtime);
420232
420278
  message += ` - \x1B[36m${paddedName}\x1B[0m \x1B[90m(saved on ${formattedDate})\x1B[0m
420233
420279
  `;
420234
420280
  }
@@ -420665,7 +420711,7 @@ var sessionsCommand = {
420665
420711
  let message = "Available chat recording sessions:\n\n";
420666
420712
  for (const session of sessions.slice(0, 10)) {
420667
420713
  const sessionDisplay = session.sessionId.substring(0, 20);
420668
- const formattedDate = session.mtime.toISOString().replace("T", " ").substring(0, 19);
420714
+ const formattedDate = formatLocalDateTime(session.mtime);
420669
420715
  message += ` - \`${sessionDisplay}...\` (${formattedDate})
420670
420716
  `;
420671
420717
  }
@@ -465455,7 +465501,7 @@ ${formatErrorSection(error41)}
465455
465501
  }
465456
465502
  const checkpoint = {
465457
465503
  tag: tag2,
465458
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
465504
+ timestamp: formatLocalTimestampWithOffset(/* @__PURE__ */ new Date()),
465459
465505
  type: "automatic",
465460
465506
  history: uiHistory,
465461
465507
  clientHistory: clientHistoryForResume,
@@ -485804,6 +485850,12 @@ init_esbuild_polyfill();
485804
485850
  init_dist6();
485805
485851
  var validateAuthMethod = (authMethod) => {
485806
485852
  loadEnvironment();
485853
+ if (!Object.values(AuthType3).includes(authMethod)) {
485854
+ return "Invalid auth method selected.";
485855
+ }
485856
+ if (!process.env.CUSTOM_AUTH && authMethod !== AuthType3.CODELY_OAUTH && authMethod !== AuthType3.LOGIN_WITH_GOOGLE && authMethod !== AuthType3.CLOUD_SHELL) {
485857
+ return "CUSTOM_AUTH is required for non-default authentication providers.";
485858
+ }
485807
485859
  if (authMethod === AuthType3.LOGIN_WITH_GOOGLE || authMethod === AuthType3.CLOUD_SHELL) {
485808
485860
  return null;
485809
485861
  }
@@ -485989,12 +486041,6 @@ function OpenAIKeyPrompt({
485989
486041
 
485990
486042
  // packages/cli/src/ui/components/AuthDialog.tsx
485991
486043
  var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
485992
- function parseDefaultAuthType(defaultAuthType) {
485993
- if (defaultAuthType && Object.values(AuthType3).includes(defaultAuthType)) {
485994
- return defaultAuthType;
485995
- }
485996
- return null;
485997
- }
485998
486044
  function AuthDialog({
485999
486045
  onSelect,
486000
486046
  settings,
@@ -486019,19 +486065,7 @@ function AuthDialog({
486019
486065
  if (settings.merged.selectedAuthType) {
486020
486066
  return item.value === settings.merged.selectedAuthType;
486021
486067
  }
486022
- const defaultAuthType = parseDefaultAuthType(
486023
- process.env.GEMINI_DEFAULT_AUTH_TYPE
486024
- );
486025
- if (defaultAuthType) {
486026
- return item.value === defaultAuthType;
486027
- }
486028
- if (process.env.GEMINI_API_KEY) {
486029
- return item.value === AuthType3.USE_GEMINI;
486030
- }
486031
- if (process.env.QWEN_OAUTH_TOKEN) {
486032
- return item.value === AuthType3.QWEN_OAUTH;
486033
- }
486034
- return item.value === AuthType3.LOGIN_WITH_GOOGLE;
486068
+ return item.value === AuthType3.CODELY_OAUTH;
486035
486069
  })
486036
486070
  );
486037
486071
  const handleAuthSelect = (authMethod) => {
@@ -493128,29 +493162,17 @@ init_dist6();
493128
493162
  // packages/cli/src/validateNonInterActiveAuth.ts
493129
493163
  init_esbuild_polyfill();
493130
493164
  init_dist6();
493131
- function getAuthTypeFromEnv() {
493132
- if (process.env.GOOGLE_GENAI_USE_GCA === "true") {
493133
- return AuthType3.LOGIN_WITH_GOOGLE;
493134
- }
493135
- if (process.env.GOOGLE_GENAI_USE_VERTEXAI === "true") {
493136
- return AuthType3.USE_VERTEX_AI;
493137
- }
493138
- if (process.env.GEMINI_API_KEY) {
493139
- return AuthType3.USE_GEMINI;
493140
- }
493141
- if (process.env.OPENAI_API_KEY) {
493142
- return AuthType3.USE_OPENAI;
493143
- }
493144
- if (process.env.QWEN_OAUTH_TOKEN) {
493145
- return AuthType3.QWEN_OAUTH;
493165
+ function resolveEffectiveAuthType(configuredAuthType) {
493166
+ if (!process.env.CUSTOM_AUTH) {
493167
+ return AuthType3.CODELY_OAUTH;
493146
493168
  }
493147
- return void 0;
493169
+ return configuredAuthType || AuthType3.CODELY_OAUTH;
493148
493170
  }
493149
493171
  async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, nonInteractiveConfig) {
493150
- const effectiveAuthType = configuredAuthType || getAuthTypeFromEnv() || AuthType3.CODELY_OAUTH;
493172
+ const effectiveAuthType = resolveEffectiveAuthType(configuredAuthType);
493151
493173
  if (!effectiveAuthType) {
493152
493174
  console.error(
493153
- `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`
493175
+ `Please set an Auth method in your ${USER_SETTINGS_PATH} (or pass --auth-type).`
493154
493176
  );
493155
493177
  process.exit(1);
493156
493178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unity-china/codely-cli",
3
- "version": "1.0.0-beta.41",
3
+ "version": "1.0.0-beta.43",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },