@unity-china/codely-cli 1.0.0-beta.36 → 1.0.0-beta.38

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 +161 -200
  2. package/package.json +2 -1
package/bundle/gemini.js CHANGED
@@ -267781,6 +267781,8 @@ var init_openaiContentGenerator = __esm({
267781
267781
  };
267782
267782
  }
267783
267783
  async buildCreateParams(request3, userPromptId) {
267784
+ const isPlainObject4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
267785
+ const extraBodyParams = isPlainObject4(this.contentGeneratorConfig.extra_body) ? this.contentGeneratorConfig.extra_body : void 0;
267784
267786
  const baseParams = {
267785
267787
  model: this.resolveRequestModel(request3),
267786
267788
  messages: this.convertToOpenAIFormat(request3),
@@ -267790,10 +267792,25 @@ var init_openaiContentGenerator = __esm({
267790
267792
  const toolParams = await this.buildToolParams(request3);
267791
267793
  const extensions = {};
267792
267794
  const enableThinking = this.resolveEnableThinking(request3);
267795
+ const requestChatTemplateKwargs = request3.config?.chat_template_kwargs;
267796
+ const extraBodyChatTemplateKwargs = isPlainObject4(extraBodyParams?.chat_template_kwargs) ? extraBodyParams?.chat_template_kwargs : void 0;
267797
+ const mergedChatTemplateKwargs = {
267798
+ ...isPlainObject4(this.contentGeneratorConfig.chat_template_kwargs) ? this.contentGeneratorConfig.chat_template_kwargs : {},
267799
+ ...extraBodyChatTemplateKwargs ?? {},
267800
+ ...isPlainObject4(requestChatTemplateKwargs) ? requestChatTemplateKwargs : {}
267801
+ };
267793
267802
  if (enableThinking !== void 0) {
267794
- extensions.chat_template_kwargs = { enable_thinking: enableThinking };
267803
+ mergedChatTemplateKwargs.enable_thinking = enableThinking;
267804
+ }
267805
+ if (Object.keys(mergedChatTemplateKwargs).length > 0) {
267806
+ extensions.chat_template_kwargs = mergedChatTemplateKwargs;
267795
267807
  }
267796
- return { ...baseParams, ...toolParams, ...extensions };
267808
+ return {
267809
+ ...extraBodyParams ?? {},
267810
+ ...baseParams,
267811
+ ...toolParams,
267812
+ ...extensions
267813
+ };
267797
267814
  }
267798
267815
  /**
267799
267816
  * Prefer per-request model override when provided (e.g. internal utility calls
@@ -267835,6 +267852,8 @@ var init_openaiContentGenerator = __esm({
267835
267852
  const createParams = await this.buildCreateParams(request3, userPromptId);
267836
267853
  const requestModel = createParams.model;
267837
267854
  try {
267855
+ delete createParams.stream;
267856
+ delete createParams.stream_options;
267838
267857
  const completion2 = await this.client.chat.completions.create(createParams);
267839
267858
  const response = this.convertToGeminiFormat(completion2);
267840
267859
  const durationMs = Date.now() - startTime;
@@ -268693,17 +268712,18 @@ ${reasoningChunk}` });
268693
268712
  parts.push({ text: "\n</think>\n" });
268694
268713
  this.accumulatedReasoningContent = "";
268695
268714
  }
268696
- response.candidates = [
268697
- {
268698
- content: {
268699
- parts,
268700
- role: "model"
268701
- },
268702
- finishReason: choice2.finish_reason ? this.mapFinishReason(choice2.finish_reason) : FinishReason2.FINISH_REASON_UNSPECIFIED,
268703
- index: 0,
268704
- safetyRatings: []
268705
- }
268706
- ];
268715
+ const candidate = {
268716
+ content: {
268717
+ parts,
268718
+ role: "model"
268719
+ },
268720
+ index: 0,
268721
+ safetyRatings: []
268722
+ };
268723
+ if (choice2.finish_reason) {
268724
+ candidate.finishReason = this.mapFinishReason(choice2.finish_reason);
268725
+ }
268726
+ response.candidates = [candidate];
268707
268727
  } else {
268708
268728
  response.candidates = [];
268709
268729
  }
@@ -269828,6 +269848,7 @@ function createContentGeneratorConfig(config3, authType) {
269828
269848
  const effectiveModel = configModel && typeof configModel === "string" ? configModel : DEFAULT_GEMINI_MODEL;
269829
269849
  const mergedSamplingParams = config3.getContentGeneratorSamplingParams();
269830
269850
  const chatTemplateKwargs = config3.getContentGeneratorChatTemplateKwargs?.();
269851
+ const extraBody = config3.getContentGeneratorExtraBody?.();
269831
269852
  const contentGeneratorConfig = {
269832
269853
  model: effectiveModel,
269833
269854
  authType,
@@ -269840,6 +269861,9 @@ function createContentGeneratorConfig(config3, authType) {
269840
269861
  if (chatTemplateKwargs !== void 0) {
269841
269862
  contentGeneratorConfig.chat_template_kwargs = chatTemplateKwargs;
269842
269863
  }
269864
+ if (extraBody !== void 0) {
269865
+ contentGeneratorConfig.extra_body = extraBody;
269866
+ }
269843
269867
  if (authType === AuthType3.LOGIN_WITH_GOOGLE || authType === AuthType3.CLOUD_SHELL) {
269844
269868
  return contentGeneratorConfig;
269845
269869
  }
@@ -364250,7 +364274,8 @@ This error was probably caused by cyclic schema references in one of the followi
364250
364274
  let hasToolCall = false;
364251
364275
  let hasFinishReason = false;
364252
364276
  for await (const chunk2 of this.stopBeforeSecondMutator(streamResponse)) {
364253
- hasFinishReason = chunk2?.candidates?.some((candidate) => candidate.finishReason) ?? false;
364277
+ const chunkHasFinishReason = chunk2?.candidates?.some((candidate) => candidate.finishReason != null) ?? false;
364278
+ hasFinishReason = hasFinishReason || chunkHasFinishReason;
364254
364279
  if (isValidResponse2(chunk2)) {
364255
364280
  const content = chunk2.candidates?.[0]?.content;
364256
364281
  if (content?.parts) {
@@ -380031,6 +380056,9 @@ var init_config2 = __esm({
380031
380056
  getContentGeneratorChatTemplateKwargs() {
380032
380057
  return this.contentGeneratorOptions?.chat_template_kwargs;
380033
380058
  }
380059
+ getContentGeneratorExtraBody() {
380060
+ return this.contentGeneratorOptions?.extra_body;
380061
+ }
380034
380062
  getToolExecutionConfig() {
380035
380063
  return this.toolExecution;
380036
380064
  }
@@ -417144,7 +417172,7 @@ async function getPackageJson2() {
417144
417172
  // packages/cli/src/utils/version.ts
417145
417173
  async function getCliVersion() {
417146
417174
  const pkgJson = await getPackageJson2();
417147
- return "1.0.0-beta.36";
417175
+ return "1.0.0-beta.38";
417148
417176
  }
417149
417177
 
417150
417178
  // packages/cli/src/ui/commands/types.ts
@@ -417636,7 +417664,7 @@ import process30 from "node:process";
417636
417664
 
417637
417665
  // packages/cli/src/generated/git-commit.ts
417638
417666
  init_esbuild_polyfill();
417639
- var GIT_COMMIT_INFO = "ddcee55b";
417667
+ var GIT_COMMIT_INFO = "f42af402";
417640
417668
 
417641
417669
  // packages/cli/src/ui/commands/bugCommand.ts
417642
417670
  var bugCommand = {
@@ -459191,6 +459219,10 @@ async function parseArguments() {
459191
459219
  type: "boolean",
459192
459220
  alias: ["enableReasoning"],
459193
459221
  description: "Alias of --enable_thinking: set chat_template_kwargs.enable_thinking (omit field when not provided)"
459222
+ }).option("extra_body", {
459223
+ type: "string",
459224
+ alias: ["extraBody"],
459225
+ description: "OpenAI-compatible extra_body as a JSON object string (merged into request body)"
459194
459226
  }).option("tavily-api-key", {
459195
459227
  type: "string",
459196
459228
  description: "Tavily API key for web search functionality"
@@ -459466,7 +459498,23 @@ async function loadCliConfig(settings, extensions, sessionId2, argv, cwd3 = proc
459466
459498
  const cliVersion = await getCliVersion();
459467
459499
  const reasoningEffort = argv.reasoning_effort ?? argv.reasoningEffort;
459468
459500
  const enableThinking = argv.enable_thinking ?? argv.enableThinking ?? argv.enable_reasoning ?? argv.enableReasoning;
459469
- const mergedContentGenerator = reasoningEffort !== void 0 || enableThinking !== void 0 ? {
459501
+ const extraBodyRaw = argv.extra_body ?? argv.extraBody;
459502
+ let extraBody;
459503
+ if (extraBodyRaw !== void 0) {
459504
+ try {
459505
+ const parsed = JSON.parse(extraBodyRaw);
459506
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
459507
+ throw new Error("Value must be a JSON object");
459508
+ }
459509
+ extraBody = parsed;
459510
+ } catch (error2) {
459511
+ const message = error2 instanceof Error ? error2.message : `Unknown error: ${error2}`;
459512
+ throw new Error(
459513
+ `Invalid value for --extra_body: must be a JSON object string. ${message}`
459514
+ );
459515
+ }
459516
+ }
459517
+ const mergedContentGenerator = reasoningEffort !== void 0 || enableThinking !== void 0 || extraBody !== void 0 ? {
459470
459518
  ...settings.contentGenerator || {},
459471
459519
  ...reasoningEffort !== void 0 ? {
459472
459520
  samplingParams: {
@@ -459481,6 +459529,12 @@ async function loadCliConfig(settings, extensions, sessionId2, argv, cwd3 = proc
459481
459529
  ...settings.contentGenerator?.chat_template_kwargs || {},
459482
459530
  enable_thinking: enableThinking
459483
459531
  }
459532
+ } : {},
459533
+ ...extraBody !== void 0 ? {
459534
+ extra_body: {
459535
+ ...typeof settings.contentGenerator?.extra_body === "object" && settings.contentGenerator?.extra_body !== null && !Array.isArray(settings.contentGenerator?.extra_body) ? settings.contentGenerator?.extra_body || {} : {},
459536
+ ...extraBody
459537
+ }
459484
459538
  } : {}
459485
459539
  } : settings.contentGenerator;
459486
459540
  return new Config({
@@ -461366,18 +461420,6 @@ var COLOR_CYAN4 = "\x1B[36m";
461366
461420
  var COLOR_GREY3 = "\x1B[90m";
461367
461421
  var COLOR_RED4 = "\x1B[31m";
461368
461422
  var RESET_COLOR5 = "\x1B[0m";
461369
- function getUserAddedModels(context2) {
461370
- const settings = context2.services.settings;
461371
- const customModels = settings.merged.availableModels;
461372
- if (Array.isArray(customModels)) {
461373
- return customModels;
461374
- }
461375
- return [];
461376
- }
461377
- async function saveAvailableModels(context2, models) {
461378
- const { settings } = context2.services;
461379
- settings.setValue("User" /* User */, "availableModels", models);
461380
- }
461381
461423
  async function fetchModelsFromProvider(providerName, config3, context2) {
461382
461424
  if (!config3.baseUrl || !config3.apiKey) {
461383
461425
  return {
@@ -461484,61 +461526,23 @@ function getProviderName(config3) {
461484
461526
  return "Unknown Provider";
461485
461527
  }
461486
461528
  }
461487
- var listCommand6 = {
461488
- name: "list",
461489
- description: "List available models",
461490
- kind: "built-in" /* BUILT_IN */,
461491
- action: async (context2) => {
461492
- const { config: config3 } = context2.services;
461493
- if (!config3) {
461494
- return {
461495
- type: "message",
461496
- messageType: "error",
461497
- content: "Config not loaded."
461498
- };
461499
- }
461500
- const userAddedModels = getUserAddedModels(context2);
461501
- const currentModel = config3.getModel();
461502
- let message = `${COLOR_CYAN4}Available Models:${RESET_COLOR5}
461503
-
461504
- `;
461505
- if (userAddedModels.length === 0) {
461506
- message += `${COLOR_GREEN5}\u25CF ${currentModel}${RESET_COLOR5} ${COLOR_GREEN5}(current)${RESET_COLOR5}
461507
- `;
461508
- message += `
461509
- ${COLOR_GREY3}Use "/model add <model_name>" to add more models to this list${RESET_COLOR5}`;
461510
- message += `
461511
- ${COLOR_GREY3}Use "/model list-provider" to discover available models from your provider${RESET_COLOR5}`;
461512
- } else {
461513
- for (const model of userAddedModels) {
461514
- const isCurrentModel = model === currentModel;
461515
- const indicator = isCurrentModel ? `${COLOR_GREEN5}\u25CF ${RESET_COLOR5}` : `${COLOR_GREY3}\u25CB ${RESET_COLOR5}`;
461516
- const modelDisplay = isCurrentModel ? `${COLOR_GREEN5}${model}${RESET_COLOR5}` : model;
461517
- const suffix = isCurrentModel ? ` ${COLOR_GREEN5}(current)${RESET_COLOR5}` : "";
461518
- message += `${indicator}${modelDisplay}${suffix}
461519
- `;
461520
- }
461521
- if (!userAddedModels.includes(currentModel)) {
461522
- message += `
461523
- ${COLOR_YELLOW5}Current model not in list:${RESET_COLOR5}
461524
- `;
461525
- message += `${COLOR_GREEN5}\u25CF ${currentModel}${RESET_COLOR5} ${COLOR_GREEN5}(current)${RESET_COLOR5}
461526
- `;
461527
- message += `
461528
- ${COLOR_GREY3}Use "/model add ${currentModel}" to add it to your list${RESET_COLOR5}`;
461529
- }
461530
- message += `
461531
- ${COLOR_GREY3}Use "/model use <model_name>" to switch models${RESET_COLOR5}`;
461532
- message += `
461533
- ${COLOR_GREY3}Use "/model add <model_name>" to add more models${RESET_COLOR5}`;
461534
- }
461535
- return {
461536
- type: "message",
461537
- messageType: "info",
461538
- content: message
461539
- };
461529
+ var PROVIDER_MODELS_CACHE_TTL_MS = 5 * 60 * 1e3;
461530
+ var providerModelsCache = null;
461531
+ function getProviderModelsCacheKey(config3) {
461532
+ return `${config3.authType || "unknown"}|${config3.baseUrl || ""}`;
461533
+ }
461534
+ function getCachedProviderModels(key) {
461535
+ if (!providerModelsCache || providerModelsCache.key !== key) {
461536
+ return null;
461540
461537
  }
461541
- };
461538
+ if (Date.now() - providerModelsCache.updatedAt > PROVIDER_MODELS_CACHE_TTL_MS) {
461539
+ return null;
461540
+ }
461541
+ return providerModelsCache.models;
461542
+ }
461543
+ function setCachedProviderModels(key, models) {
461544
+ providerModelsCache = { key, models, updatedAt: Date.now() };
461545
+ }
461542
461546
  var useCommand = {
461543
461547
  name: "use",
461544
461548
  description: "Switch to a specific model",
@@ -461591,53 +461595,43 @@ var useCommand = {
461591
461595
  }
461592
461596
  },
461593
461597
  completion: async (context2, partialArg) => {
461594
- const userAddedModels = getUserAddedModels(context2);
461595
- return userAddedModels.filter(
461596
- (model) => model.toLowerCase().includes(partialArg.toLowerCase())
461597
- );
461598
- }
461599
- };
461600
- var addCommand2 = {
461601
- name: "add",
461602
- description: "Add a new model to the available models list",
461603
- kind: "built-in" /* BUILT_IN */,
461604
- action: async (context2, args) => {
461605
- const modelName = args.trim();
461606
- if (!modelName) {
461607
- return {
461608
- type: "message",
461609
- messageType: "error",
461610
- content: "Please specify a model name. Usage: /model add <model_name>"
461611
- };
461598
+ const { config: config3 } = context2.services;
461599
+ if (!config3) {
461600
+ return [];
461612
461601
  }
461613
- try {
461614
- const userAddedModels = getUserAddedModels(context2);
461615
- if (userAddedModels.includes(modelName)) {
461616
- return {
461617
- type: "message",
461618
- messageType: "error",
461619
- content: `Model "${modelName}" is already in your models list.`
461620
- };
461621
- }
461622
- const updatedModels = [...userAddedModels, modelName];
461623
- await saveAvailableModels(context2, updatedModels);
461624
- return {
461625
- type: "message",
461626
- messageType: "info",
461627
- content: `${COLOR_GREEN5}\u2713${RESET_COLOR5} Added "${COLOR_CYAN4}${modelName}${RESET_COLOR5}" to available models list.`
461628
- };
461629
- } catch (error2) {
461630
- return {
461631
- type: "message",
461632
- messageType: "error",
461633
- content: `Failed to add model: ${error2 instanceof Error ? error2.message : "Unknown error"}`
461634
- };
461602
+ const contentGeneratorConfig = config3.getContentGeneratorConfig();
461603
+ if (!contentGeneratorConfig) {
461604
+ return [];
461635
461605
  }
461606
+ const cacheKey = getProviderModelsCacheKey(contentGeneratorConfig);
461607
+ const cached = getCachedProviderModels(cacheKey);
461608
+ if (cached) {
461609
+ const normalized3 = partialArg.trim();
461610
+ const query2 = normalized3.split(/\s+/).pop() || "";
461611
+ return cached.filter(
461612
+ (model) => model.toLowerCase().includes(query2.toLowerCase())
461613
+ );
461614
+ }
461615
+ const providerName = getProviderName(contentGeneratorConfig);
461616
+ const result = await fetchModelsFromProvider(
461617
+ providerName,
461618
+ contentGeneratorConfig,
461619
+ context2
461620
+ );
461621
+ if (result.error) {
461622
+ return [];
461623
+ }
461624
+ setCachedProviderModels(cacheKey, result.models);
461625
+ const normalized2 = partialArg.trim();
461626
+ const query = normalized2.split(/\s+/).pop() || "";
461627
+ return result.models.filter(
461628
+ (model) => model.toLowerCase().includes(query.toLowerCase())
461629
+ );
461636
461630
  }
461637
461631
  };
461638
461632
  var listProviderCommand = {
461639
461633
  name: "list-provider",
461640
- altNames: ["list-providers", "lp"],
461634
+ altNames: ["list", "list-providers", "ls"],
461641
461635
  description: "List models available from configured providers via /v1/models API",
461642
461636
  kind: "built-in" /* BUILT_IN */,
461643
461637
  action: async (context2) => {
@@ -461658,6 +461652,7 @@ var listProviderCommand = {
461658
461652
  };
461659
461653
  }
461660
461654
  const providerName = getProviderName(contentGeneratorConfig);
461655
+ const cacheKey = getProviderModelsCacheKey(contentGeneratorConfig);
461661
461656
  context2.ui.addItem(
461662
461657
  {
461663
461658
  type: "info",
@@ -461713,10 +461708,11 @@ var listProviderCommand = {
461713
461708
  `;
461714
461709
  }
461715
461710
  message += `
461716
- ${COLOR_GREY3}Use "/model add <model_name>" to add models to your available list${RESET_COLOR5}`;
461717
- message += `
461718
461711
  ${COLOR_GREY3}Use "/model use <model_name>" to switch to a different model${RESET_COLOR5}`;
461719
461712
  }
461713
+ if (!result.error) {
461714
+ setCachedProviderModels(cacheKey, result.models);
461715
+ }
461720
461716
  return {
461721
461717
  type: "message",
461722
461718
  messageType: result.error ? "error" : "info",
@@ -461724,90 +461720,21 @@ ${COLOR_GREY3}Use "/model use <model_name>" to switch to a different model${RESE
461724
461720
  };
461725
461721
  }
461726
461722
  };
461727
- var removeCommand2 = {
461728
- name: "remove",
461729
- altNames: ["rm"],
461730
- description: "Remove a model from the available models list",
461731
- kind: "built-in" /* BUILT_IN */,
461732
- action: async (context2, args) => {
461733
- const { config: config3 } = context2.services;
461734
- if (!config3) {
461735
- return {
461736
- type: "message",
461737
- messageType: "error",
461738
- content: "Config not loaded."
461739
- };
461740
- }
461741
- const modelName = args.trim();
461742
- if (!modelName) {
461743
- return {
461744
- type: "message",
461745
- messageType: "error",
461746
- content: "Please specify a model name. Usage: /model remove <model_name>"
461747
- };
461748
- }
461749
- try {
461750
- const userAddedModels = getUserAddedModels(context2);
461751
- if (!userAddedModels.includes(modelName)) {
461752
- return {
461753
- type: "message",
461754
- messageType: "error",
461755
- content: `Model "${modelName}" is not in your models list.`
461756
- };
461757
- }
461758
- const currentModel = config3.getModel();
461759
- if (currentModel === modelName) {
461760
- return {
461761
- type: "message",
461762
- messageType: "error",
461763
- content: `Cannot remove "${modelName}" because it is currently active. Switch to another model first.`
461764
- };
461765
- }
461766
- const updatedModels = userAddedModels.filter(
461767
- (model) => model !== modelName
461768
- );
461769
- await saveAvailableModels(context2, updatedModels);
461770
- return {
461771
- type: "message",
461772
- messageType: "info",
461773
- content: `${COLOR_GREEN5}\u2713${RESET_COLOR5} Removed "${COLOR_YELLOW5}${modelName}${RESET_COLOR5}" from available models list.`
461774
- };
461775
- } catch (error2) {
461776
- return {
461777
- type: "message",
461778
- messageType: "error",
461779
- content: `Failed to remove model: ${error2 instanceof Error ? error2.message : "Unknown error"}`
461780
- };
461781
- }
461782
- },
461783
- completion: async (context2, partialArg) => {
461784
- const userAddedModels = getUserAddedModels(context2);
461785
- return userAddedModels.filter(
461786
- (model) => model.toLowerCase().includes(partialArg.toLowerCase())
461787
- );
461788
- }
461789
- };
461790
461723
  var modelCommand = {
461791
461724
  name: "model",
461792
461725
  description: "Manage and switch between available AI models",
461793
461726
  kind: "built-in" /* BUILT_IN */,
461794
- subCommands: [
461795
- listCommand6,
461796
- useCommand,
461797
- addCommand2,
461798
- removeCommand2,
461799
- listProviderCommand
461800
- ],
461727
+ subCommands: [listProviderCommand, useCommand],
461801
461728
  // Default action when no subcommand is provided
461802
461729
  action: async (context2, args) => {
461803
461730
  if (args.trim()) {
461804
461731
  return {
461805
461732
  type: "message",
461806
461733
  messageType: "error",
461807
- content: `Unknown subcommand: "${args.trim()}". Available subcommands: list, use, add, remove, list-provider`
461734
+ content: `Unknown subcommand: "${args.trim()}". Available subcommands: list-provider (aliases: list, list-providers, ls), use`
461808
461735
  };
461809
461736
  }
461810
- return listCommand6.action(context2, args);
461737
+ return listProviderCommand.action(context2, args);
461811
461738
  }
461812
461739
  };
461813
461740
 
@@ -484541,6 +484468,7 @@ var RenderThinkBlockInternal = ({
484541
484468
  terminalWidth: _terminalWidth
484542
484469
  }) => {
484543
484470
  const MAX_VISIBLE_THINK_LINES = 10;
484471
+ const MAX_VISIBLE_THINK_CHARS_WHEN_COLLAPSED = 500;
484544
484472
  const shouldCollapse = isPending && isStreaming;
484545
484473
  const filteredContent = content.filter((line) => line.trim().length > 0);
484546
484474
  if (filteredContent.length === 0) {
@@ -484552,8 +484480,41 @@ var RenderThinkBlockInternal = ({
484552
484480
  if (cleanedContent.length === 0) {
484553
484481
  return null;
484554
484482
  }
484555
- const hiddenLineCount = shouldCollapse ? Math.max(0, cleanedContent.length - MAX_VISIBLE_THINK_LINES) : 0;
484556
- const visibleContent = shouldCollapse && hiddenLineCount > 0 ? cleanedContent.slice(-MAX_VISIBLE_THINK_LINES) : cleanedContent;
484483
+ let visibleContent = cleanedContent;
484484
+ let hiddenLineCount = 0;
484485
+ if (shouldCollapse) {
484486
+ const lastIndex = cleanedContent.length - 1;
484487
+ const lastLine = cleanedContent[lastIndex] ?? "";
484488
+ let lastOverlongIndex = -1;
484489
+ for (let i3 = lastIndex; i3 >= 0; i3--) {
484490
+ if (cleanedContent[i3].length > MAX_VISIBLE_THINK_CHARS_WHEN_COLLAPSED) {
484491
+ lastOverlongIndex = i3;
484492
+ break;
484493
+ }
484494
+ }
484495
+ if (lastLine.length > MAX_VISIBLE_THINK_CHARS_WHEN_COLLAPSED) {
484496
+ visibleContent = [lastLine];
484497
+ hiddenLineCount = Math.max(0, cleanedContent.length - 1);
484498
+ } else {
484499
+ const resetStartIndex = lastOverlongIndex === -1 ? 0 : lastOverlongIndex + 1;
484500
+ const candidate = cleanedContent.slice(resetStartIndex);
484501
+ const selectedReversed = [];
484502
+ let totalChars = 0;
484503
+ for (let i3 = candidate.length - 1; i3 >= 0; i3--) {
484504
+ if (selectedReversed.length >= MAX_VISIBLE_THINK_LINES) break;
484505
+ const line = candidate[i3];
484506
+ const nextTotal = totalChars + line.length;
484507
+ if (nextTotal > MAX_VISIBLE_THINK_CHARS_WHEN_COLLAPSED) break;
484508
+ selectedReversed.push(line);
484509
+ totalChars = nextTotal;
484510
+ }
484511
+ if (selectedReversed.length === 0 && candidate.length > 0) {
484512
+ selectedReversed.push(candidate[candidate.length - 1]);
484513
+ }
484514
+ visibleContent = selectedReversed.reverse();
484515
+ hiddenLineCount = resetStartIndex + Math.max(0, candidate.length - visibleContent.length);
484516
+ }
484517
+ }
484557
484518
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
484558
484519
  Box_default,
484559
484520
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unity-china/codely-cli",
3
- "version": "1.0.0-beta.36",
3
+ "version": "1.0.0-beta.38",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },
@@ -60,6 +60,7 @@
60
60
  "files": [
61
61
  "bundle/",
62
62
  "README.md",
63
+ "README.zh-CN.md",
63
64
  "LICENSE"
64
65
  ],
65
66
  "publishConfig": {