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

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/bundle/gemini.js CHANGED
@@ -25910,7 +25910,7 @@ var require_backend = __commonJS({
25910
25910
  });
25911
25911
  return value;
25912
25912
  },
25913
- useEffect: function useEffect38(create4) {
25913
+ useEffect: function useEffect39(create4) {
25914
25914
  nextHook();
25915
25915
  hookLog.push({
25916
25916
  displayName: null,
@@ -25983,7 +25983,7 @@ var require_backend = __commonJS({
25983
25983
  return [initialArg, function() {
25984
25984
  }];
25985
25985
  },
25986
- useRef: function useRef14(initialValue) {
25986
+ useRef: function useRef15(initialValue) {
25987
25987
  var hook = nextHook();
25988
25988
  initialValue = null !== hook ? hook.memoizedState : {
25989
25989
  current: initialValue
@@ -25998,7 +25998,7 @@ var require_backend = __commonJS({
25998
25998
  });
25999
25999
  return initialValue;
26000
26000
  },
26001
- useState: function useState42(initialState2) {
26001
+ useState: function useState43(initialState2) {
26002
26002
  var hook = nextHook();
26003
26003
  initialState2 = null !== hook ? hook.memoizedState : "function" === typeof initialState2 ? initialState2() : initialState2;
26004
26004
  hookLog.push({
@@ -34598,7 +34598,7 @@ var require_backend = __commonJS({
34598
34598
  var symbolOrNumber = renderer_typeof(type) === "object" && type !== null ? type.$$typeof : type;
34599
34599
  return renderer_typeof(symbolOrNumber) === "symbol" ? symbolOrNumber.toString() : symbolOrNumber;
34600
34600
  }
34601
- var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, IncompleteFunctionComponent = _ReactTypeOfWork.IncompleteFunctionComponent, 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, Fragment7 = _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, Throw = _ReactTypeOfWork.Throw, ViewTransitionComponent = _ReactTypeOfWork.ViewTransitionComponent, ActivityComponent = _ReactTypeOfWork.ActivityComponent;
34601
+ var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, IncompleteFunctionComponent = _ReactTypeOfWork.IncompleteFunctionComponent, 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, Fragment6 = _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, Throw = _ReactTypeOfWork.Throw, ViewTransitionComponent = _ReactTypeOfWork.ViewTransitionComponent, ActivityComponent = _ReactTypeOfWork.ActivityComponent;
34602
34602
  function resolveFiberType(type) {
34603
34603
  var typeSymbol = getTypeSymbol(type);
34604
34604
  switch (typeSymbol) {
@@ -34655,7 +34655,7 @@ var require_backend = __commonJS({
34655
34655
  case HostPortal:
34656
34656
  case HostText:
34657
34657
  return null;
34658
- case Fragment7:
34658
+ case Fragment6:
34659
34659
  return "Fragment";
34660
34660
  case LazyComponent:
34661
34661
  return "Lazy";
@@ -34808,7 +34808,7 @@ var require_backend = __commonJS({
34808
34808
  function renderer_attach(hook, rendererID, renderer2, global2, shouldStartProfilingNow, profilingSettings) {
34809
34809
  var version3 = renderer2.reconcilerVersion || renderer2.version;
34810
34810
  var _getInternalReactCons = getInternalReactConstants(version3), getDisplayNameForFiber = _getInternalReactCons.getDisplayNameForFiber, getTypeSymbol = _getInternalReactCons.getTypeSymbol, ReactPriorityLevels = _getInternalReactCons.ReactPriorityLevels, ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork, StrictModeBits = _getInternalReactCons.StrictModeBits;
34811
- var ActivityComponent = ReactTypeOfWork.ActivityComponent, CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment7 = 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, IncompleteFunctionComponent = ReactTypeOfWork.IncompleteFunctionComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent, Throw = ReactTypeOfWork.Throw, ViewTransitionComponent = ReactTypeOfWork.ViewTransitionComponent;
34811
+ var ActivityComponent = ReactTypeOfWork.ActivityComponent, CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment6 = 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, IncompleteFunctionComponent = ReactTypeOfWork.IncompleteFunctionComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent, Throw = ReactTypeOfWork.Throw, ViewTransitionComponent = ReactTypeOfWork.ViewTransitionComponent;
34812
34812
  var ImmediatePriority = ReactPriorityLevels.ImmediatePriority, UserBlockingPriority = ReactPriorityLevels.UserBlockingPriority, NormalPriority = ReactPriorityLevels.NormalPriority, LowPriority = ReactPriorityLevels.LowPriority, IdlePriority = ReactPriorityLevels.IdlePriority, NoPriority = ReactPriorityLevels.NoPriority;
34813
34813
  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, getCurrentFiber = renderer2.getCurrentFiber;
34814
34814
  var supportsTogglingError = typeof setErrorHandler === "function" && typeof scheduleUpdate === "function";
@@ -35153,7 +35153,7 @@ var require_backend = __commonJS({
35153
35153
  return true;
35154
35154
  case HostRoot:
35155
35155
  return false;
35156
- case Fragment7:
35156
+ case Fragment6:
35157
35157
  return key === null;
35158
35158
  default:
35159
35159
  var typeSymbol = getTypeSymbol(type);
@@ -35227,7 +35227,7 @@ var require_backend = __commonJS({
35227
35227
  return ElementTypeHostComponent;
35228
35228
  case HostPortal:
35229
35229
  case HostText:
35230
- case Fragment7:
35230
+ case Fragment6:
35231
35231
  return ElementTypeOtherOrUnknown;
35232
35232
  case MemoComponent:
35233
35233
  case SimpleMemoComponent:
@@ -80631,7 +80631,7 @@ var init_codelyOAuth2 = __esm({
80631
80631
  import * as https2 from "https";
80632
80632
  import * as http3 from "http";
80633
80633
  import { URL as URL3 } from "url";
80634
- var import_https_proxy_agent3, getCodelyStorageEndpoint, CodelyLogger;
80634
+ var import_https_proxy_agent3, getCodelyStorageEndpoint, CODELY_LOGGER_NO_EMIT_ENV, CodelyLogger;
80635
80635
  var init_codely_logger = __esm({
80636
80636
  "packages/core/dist/src/telemetry/codely-logger/codely-logger.js"() {
80637
80637
  "use strict";
@@ -80641,6 +80641,7 @@ var init_codely_logger = __esm({
80641
80641
  init_codelyOAuth2();
80642
80642
  init_serverUrl();
80643
80643
  getCodelyStorageEndpoint = () => `${getServerBaseUrl()}/api/codely/storage`;
80644
+ CODELY_LOGGER_NO_EMIT_ENV = "CODELY_LOGGER_NO_EMIT";
80644
80645
  CodelyLogger = class _CodelyLogger {
80645
80646
  static instance;
80646
80647
  config;
@@ -80674,6 +80675,9 @@ var init_codely_logger = __esm({
80674
80675
  return this.accessToken;
80675
80676
  }
80676
80677
  async sendEventToCodely(event) {
80678
+ if (process.env[CODELY_LOGGER_NO_EMIT_ENV]?.trim()) {
80679
+ return;
80680
+ }
80677
80681
  if (process.env.CUSTOM_AUTH) {
80678
80682
  return;
80679
80683
  }
@@ -363862,13 +363866,21 @@ var init_activate_skill = __esm({
363862
363866
  init_getFolderStructure();
363863
363867
  ActivateSkillToolInvocation = class extends BaseToolInvocation {
363864
363868
  config;
363869
+ allowedSkillNames;
363865
363870
  cachedFolderStructure;
363866
- constructor(config4, params) {
363871
+ constructor(config4, params, allowedSkillNames) {
363867
363872
  super(params);
363868
363873
  this.config = config4;
363874
+ this.allowedSkillNames = allowedSkillNames;
363875
+ }
363876
+ isSkillAllowed(name3) {
363877
+ return this.allowedSkillNames ? this.allowedSkillNames.has(name3) : true;
363869
363878
  }
363870
363879
  getDescription() {
363871
363880
  const skillName = this.params.name;
363881
+ if (!this.isSkillAllowed(skillName)) {
363882
+ return `"${skillName}" (not allowed)`;
363883
+ }
363872
363884
  const skill = this.config.getSkillManager().getSkill(skillName);
363873
363885
  if (skill) {
363874
363886
  return `"${skillName}": ${skill.description}`;
@@ -363883,6 +363895,9 @@ var init_activate_skill = __esm({
363883
363895
  }
363884
363896
  async shouldConfirmExecute() {
363885
363897
  const skillName = this.params.name;
363898
+ if (!this.isSkillAllowed(skillName)) {
363899
+ return false;
363900
+ }
363886
363901
  const skill = this.config.getSkillManager().getSkill(skillName);
363887
363902
  if (!skill || skill.disabled) {
363888
363903
  return false;
@@ -363911,8 +363926,8 @@ ${folderStructure}`,
363911
363926
  const skillName = this.params.name;
363912
363927
  const skillManager = this.config.getSkillManager();
363913
363928
  const skill = skillManager.getSkill(skillName);
363914
- if (!skill || skill.disabled) {
363915
- const availableSkills = skillManager.getSkills().map((s3) => s3.name).join(", ");
363929
+ const availableSkills = skillManager.getSkills().map((s3) => s3.name).filter((name3) => this.isSkillAllowed(name3)).join(", ");
363930
+ if (!this.isSkillAllowed(skillName) || !skill || skill.disabled) {
363916
363931
  const errorMessage = `Skill "${skillName}" not found. Available skills are: ${availableSkills}`;
363917
363932
  return {
363918
363933
  llmContent: `Error: ${errorMessage}`,
@@ -363945,9 +363960,11 @@ ${folderStructure}`
363945
363960
  ActivateSkillTool = class _ActivateSkillTool extends BaseDeclarativeTool {
363946
363961
  config;
363947
363962
  static Name = ACTIVATE_SKILL_TOOL_NAME;
363948
- constructor(config4) {
363963
+ allowedSkillNames;
363964
+ constructor(config4, options2) {
363965
+ const allowlist = Array.isArray(options2?.allowedSkillNames) && options2.allowedSkillNames.length > 0 ? new Set(options2.allowedSkillNames) : null;
363949
363966
  const skills = config4.getSkillManager().getSkills();
363950
- const skillNames = skills.map((s3) => s3.name);
363967
+ const skillNames = skills.map((s3) => s3.name).filter((name3) => allowlist ? allowlist.has(name3) : true);
363951
363968
  const schema = skillNames.length === 0 ? {
363952
363969
  type: "object",
363953
363970
  properties: {
@@ -363985,11 +364002,19 @@ ${folderStructure}`
363985
364002
  false
363986
364003
  );
363987
364004
  this.config = config4;
364005
+ this.allowedSkillNames = allowlist;
364006
+ }
364007
+ isSkillAllowed(name3) {
364008
+ return this.allowedSkillNames ? this.allowedSkillNames.has(name3) : true;
363988
364009
  }
363989
364010
  validateToolParams(params) {
363990
364011
  if (!params.name || typeof params.name !== "string") {
363991
364012
  return 'Parameter "name" must be a non-empty string.';
363992
364013
  }
364014
+ if (!this.isSkillAllowed(params.name)) {
364015
+ const available = this.config.getSkillManager().getSkills().map((s3) => s3.name).filter((name3) => this.isSkillAllowed(name3));
364016
+ return `Skill "${params.name}" not found. Available skills: ${available.join(", ")}`;
364017
+ }
363993
364018
  const skill = this.config.getSkillManager().getSkill(params.name);
363994
364019
  if (!skill || skill.disabled) {
363995
364020
  const available = this.config.getSkillManager().getSkills().map((s3) => s3.name);
@@ -363998,7 +364023,7 @@ ${folderStructure}`
363998
364023
  return null;
363999
364024
  }
364000
364025
  createInvocation(params) {
364001
- return new ActivateSkillToolInvocation(this.config, params);
364026
+ return new ActivateSkillToolInvocation(this.config, params, this.allowedSkillNames);
364002
364027
  }
364003
364028
  };
364004
364029
  }
@@ -367485,7 +367510,10 @@ Original error: ${getErrorMessage(error41)}`);
367485
367510
  },
367486
367511
  config: {
367487
367512
  systemInstruction: { text: getCompressionPrompt() },
367488
- tools: []
367513
+ tools: [],
367514
+ // Compression summaries can be truncated if users configured a low global max output.
367515
+ // Override with a safe default so compression remains effective.
367516
+ maxOutputTokens: 5e3
367489
367517
  }
367490
367518
  }, prompt_id);
367491
367519
  let fullResponse = "";
@@ -375713,6 +375741,10 @@ var init_agentLoader = __esm({
375713
375741
  const parsedTools = parseStringList(toolsRaw)?.filter((t3) => t3 !== DELEGATE_TO_AGENT_TOOL_NAME).filter(Boolean);
375714
375742
  const toolList = parsedTools ?? [];
375715
375743
  const inheritTools = toolsRaw === void 0 || toolsRaw === null || toolList.length === 0;
375744
+ const skillsRaw = frontmatter["skills"];
375745
+ const parsedSkills = parseStringList(skillsRaw)?.filter(Boolean);
375746
+ const skillList = parsedSkills ?? [];
375747
+ const inheritSkills = skillsRaw === void 0 || skillsRaw === null || skillList.length === 0;
375716
375748
  const modelRaw = frontmatter["model"];
375717
375749
  const model = typeof modelRaw === "string" ? modelRaw.trim().toLowerCase() === "inherit" ? "" : modelRaw.trim() : "";
375718
375750
  const queryRaw = frontmatter["query"];
@@ -375737,6 +375769,8 @@ var init_agentLoader = __esm({
375737
375769
  };
375738
375770
  if (inheritTools)
375739
375771
  metadata["inheritTools"] = true;
375772
+ if (inheritSkills)
375773
+ metadata["inheritSkills"] = true;
375740
375774
  if (Object.keys(extraFrontmatter).length > 0) {
375741
375775
  metadata["frontmatter"] = extraFrontmatter;
375742
375776
  }
@@ -375759,6 +375793,7 @@ var init_agentLoader = __esm({
375759
375793
  stream: stream4
375760
375794
  },
375761
375795
  toolConfig: inheritTools ? void 0 : { tools: toolList },
375796
+ skillConfig: inheritSkills ? void 0 : { skills: skillList },
375762
375797
  // Claude-style YAML agents: keep inputs minimal and consistent. We always
375763
375798
  // expose a single required `task` param and do not support YAML-defined schemas.
375764
375799
  inputConfig: buildInputConfig(void 0),
@@ -375780,6 +375815,9 @@ var init_agentLoader = __esm({
375780
375815
  const rawAllowedTools = config4.agent.tools?.allowed_tools;
375781
375816
  const tools = (Array.isArray(rawAllowedTools) ? rawAllowedTools : []).filter((t3) => typeof t3 === "string" && t3.trim().length > 0).map((t3) => t3.trim()).filter((t3) => t3 !== DELEGATE_TO_AGENT_TOOL_NAME);
375782
375817
  const inheritTools = !rawAllowedTools || tools.length === 0;
375818
+ const rawAllowedSkills = config4.agent.skills?.allowed_skills;
375819
+ const skills = (Array.isArray(rawAllowedSkills) ? rawAllowedSkills : []).filter((s3) => typeof s3 === "string" && s3.trim().length > 0).map((s3) => s3.trim());
375820
+ const inheritSkills = !rawAllowedSkills || skills.length === 0;
375783
375821
  return {
375784
375822
  name: agentName,
375785
375823
  displayName: config4.agent.name || baseName,
@@ -375808,11 +375846,13 @@ var init_agentLoader = __esm({
375808
375846
  stream: config4.agent.run_config?.stream ?? false
375809
375847
  },
375810
375848
  toolConfig: inheritTools ? void 0 : { tools },
375849
+ skillConfig: inheritSkills ? void 0 : { skills },
375811
375850
  inputConfig: buildInputConfig(coerceStringRecord(config4.validation?.input_schema)),
375812
375851
  metadata: {
375813
375852
  source: filePath,
375814
375853
  scope,
375815
- ...inheritTools ? { inheritTools: true } : {}
375854
+ ...inheritTools ? { inheritTools: true } : {},
375855
+ ...inheritSkills ? { inheritSkills: true } : {}
375816
375856
  }
375817
375857
  };
375818
375858
  }
@@ -375833,6 +375873,9 @@ var init_agentLoader = __esm({
375833
375873
  const rawTools = Array.isArray(config4.tools) ? config4.tools : void 0;
375834
375874
  const tools = (Array.isArray(rawTools) ? rawTools : []).filter((t3) => typeof t3 === "string" && t3.trim().length > 0).map((t3) => t3.trim()).filter((t3) => t3 !== DELEGATE_TO_AGENT_TOOL_NAME);
375835
375875
  const inheritTools = !rawTools || tools.length === 0;
375876
+ const rawSkills = Array.isArray(config4.skills) ? config4.skills : void 0;
375877
+ const skills = (Array.isArray(rawSkills) ? rawSkills : []).filter((s3) => typeof s3 === "string" && s3.trim().length > 0).map((s3) => s3.trim());
375878
+ const inheritSkills = !rawSkills || skills.length === 0;
375836
375879
  const kindRaw = typeof config4.kind === "string" ? config4.kind : void 0;
375837
375880
  const kind = kindRaw === "remote" ? "remote" : "local";
375838
375881
  const validationInputSchema = coerceStringRecord(config4.validation?.input_schema);
@@ -375861,11 +375904,13 @@ var init_agentLoader = __esm({
375861
375904
  stream: typeof run?.stream === "boolean" ? run.stream : false
375862
375905
  },
375863
375906
  toolConfig: inheritTools ? void 0 : { tools },
375907
+ skillConfig: inheritSkills ? void 0 : { skills },
375864
375908
  inputConfig: buildInputConfig(inputSchema),
375865
375909
  metadata: {
375866
375910
  source: filePath,
375867
375911
  scope,
375868
- ...inheritTools ? { inheritTools: true } : {}
375912
+ ...inheritTools ? { inheritTools: true } : {},
375913
+ ...inheritSkills ? { inheritSkills: true } : {}
375869
375914
  }
375870
375915
  };
375871
375916
  }
@@ -375938,7 +375983,7 @@ You run as a non-interactive subagent (do NOT ask the user questions). Your job
375938
375983
  # thinking_budget = -1
375939
375984
 
375940
375985
  [agent.model_config.sampling_params]
375941
- # reasoning_effort = "high" # "minimal" | "low" | "medium" | "high"
375986
+ # reasoning_effort = "high" # "minimal" | "low" | "medium" | "high" | "xhigh"
375942
375987
  # max_completion_tokens = 8192
375943
375988
  # temperature = 0.2
375944
375989
  # top_p = 0.95
@@ -375960,6 +376005,11 @@ stream = false
375960
376005
  #### Tool allowlist (empty = ALL tools)
375961
376006
  allowed_tools = []
375962
376007
 
376008
+ [agent.skills]
376009
+ #### Skills allowlist (empty = ALL skills)
376010
+ #### Only relevant when the main session has --experimental-skills enabled.
376011
+ allowed_skills = []
376012
+
375963
376013
  #### Available tools (DisplayName (real_name)):
375964
376014
  ${toolHintLines}
375965
376015
 
@@ -376005,6 +376055,10 @@ kind = "local"
376005
376055
  #### Tool allowlist (empty = ALL tools)
376006
376056
  tools = []
376007
376057
 
376058
+ #### Skills allowlist (empty = ALL skills)
376059
+ #### Only relevant when the main session has --experimental-skills enabled.
376060
+ skills = []
376061
+
376008
376062
  #### Available tools (DisplayName (real_name)):
376009
376063
  ${toolHintLines}
376010
376064
 
@@ -376092,6 +376146,11 @@ description: ${description || `Specialized agent for ${displayName.toLowerCase()
376092
376146
  tools:
376093
376147
  # tools: read_file, search_file_content, glob
376094
376148
 
376149
+ #### Skills allowlist (Claude-style; empty/omitted = ALL skills)
376150
+ #### Only relevant when the main session has --experimental-skills enabled.
376151
+ skills:
376152
+ # skills: code-review, testing
376153
+
376095
376154
  #### Available tools (DisplayName (real_name)):
376096
376155
  ${toolHintLines}
376097
376156
 
@@ -379258,6 +379317,7 @@ var init_executor = __esm({
379258
379317
  init_modelSamplingParams();
379259
379318
  init_generateContentResponseUtilities();
379260
379319
  init_tool_names();
379320
+ init_activate_skill();
379261
379321
  TASK_COMPLETE_TOOL_NAME = "complete_task";
379262
379322
  MAX_IDLE_RESPONSES = 3;
379263
379323
  AgentExecutor = class _AgentExecutor {
@@ -379311,6 +379371,14 @@ var init_executor = __esm({
379311
379371
  }
379312
379372
  }
379313
379373
  }
379374
+ const skillAllowlist = effectiveDefinition.skillConfig?.skills ?? [];
379375
+ const shouldRestrictSkills = Array.isArray(skillAllowlist) && skillAllowlist.length > 0;
379376
+ const hasActivateSkillTool = Boolean(effectiveDefinition.toolConfig?.tools?.some((t3) => typeof t3 === "string" && t3 === ACTIVATE_SKILL_TOOL_NAME));
379377
+ if (shouldRestrictSkills && hasActivateSkillTool) {
379378
+ agentToolRegistry.registerTool(new ActivateSkillTool(runtimeContext, {
379379
+ allowedSkillNames: skillAllowlist
379380
+ }));
379381
+ }
379314
379382
  const parentPromptId = promptIdContext.getStore();
379315
379383
  return new _AgentExecutor(effectiveDefinition, runtimeContext, agentToolRegistry, parentPromptId, onActivity);
379316
379384
  }
@@ -381212,6 +381280,7 @@ var init_config2 = __esm({
381212
381280
  cliVersion;
381213
381281
  experimentalZedIntegration = false;
381214
381282
  experimentalSkills = false;
381283
+ enabledSkills;
381215
381284
  disabledSkills = [];
381216
381285
  agentRegistry;
381217
381286
  agentRegistryInitPromise;
@@ -381282,6 +381351,7 @@ var init_config2 = __esm({
381282
381351
  this.sessionTokenLimit = params.sessionTokenLimit ?? -1;
381283
381352
  this.experimentalZedIntegration = params.experimentalZedIntegration ?? false;
381284
381353
  this.experimentalSkills = params.experimentalSkills ?? false;
381354
+ this.enabledSkills = params.enabledSkills;
381285
381355
  this.disabledSkills = params.disabledSkills ?? [];
381286
381356
  this.listExtensions = params.listExtensions ?? false;
381287
381357
  this.storage = new Storage(this.targetDir);
@@ -381881,7 +381951,17 @@ var init_config2 = __esm({
381881
381951
  this.disabledSkills = disabledSkills;
381882
381952
  }
381883
381953
  await this.skillManager.discoverSkills();
381884
- this.skillManager.setDisabledSkills(this.disabledSkills);
381954
+ const allowlist = Array.isArray(this.enabledSkills) && this.enabledSkills.length > 0 ? new Set(this.enabledSkills) : null;
381955
+ const allowlistDisabled = [];
381956
+ if (allowlist) {
381957
+ for (const skill of this.skillManager.getAllSkills()) {
381958
+ if (!allowlist.has(skill.name)) {
381959
+ allowlistDisabled.push(skill.name);
381960
+ }
381961
+ }
381962
+ }
381963
+ const effectiveDisabled = Array.from(/* @__PURE__ */ new Set([...this.disabledSkills, ...allowlistDisabled]));
381964
+ this.skillManager.setDisabledSkills(effectiveDisabled);
381885
381965
  const registry2 = await this.getToolRegistry();
381886
381966
  registry2.registerTool(new ActivateSkillTool(this));
381887
381967
  try {
@@ -397923,7 +398003,7 @@ var require_react_is_development = __commonJS({
397923
398003
  var ContextProvider = REACT_PROVIDER_TYPE;
397924
398004
  var Element3 = REACT_ELEMENT_TYPE;
397925
398005
  var ForwardRef = REACT_FORWARD_REF_TYPE;
397926
- var Fragment7 = REACT_FRAGMENT_TYPE;
398006
+ var Fragment6 = REACT_FRAGMENT_TYPE;
397927
398007
  var Lazy = REACT_LAZY_TYPE;
397928
398008
  var Memo = REACT_MEMO_TYPE;
397929
398009
  var Portal = REACT_PORTAL_TYPE;
@@ -397982,7 +398062,7 @@ var require_react_is_development = __commonJS({
397982
398062
  exports2.ContextProvider = ContextProvider;
397983
398063
  exports2.Element = Element3;
397984
398064
  exports2.ForwardRef = ForwardRef;
397985
- exports2.Fragment = Fragment7;
398065
+ exports2.Fragment = Fragment6;
397986
398066
  exports2.Lazy = Lazy;
397987
398067
  exports2.Memo = Memo;
397988
398068
  exports2.Portal = Portal;
@@ -414994,7 +415074,7 @@ var NoColorTheme = new Theme(
414994
415074
 
414995
415075
  // packages/cli/src/ui/themes/theme-manager.ts
414996
415076
  import process26 from "node:process";
414997
- var DEFAULT_THEME = QwenDark;
415077
+ var DEFAULT_THEME = ANSI;
414998
415078
  var ThemeManager = class {
414999
415079
  availableThemes;
415000
415080
  activeTheme;
@@ -415181,15 +415261,16 @@ var USER_SETTINGS_DIR = path53.join(homedir15(), SETTINGS_DIRECTORY_NAME);
415181
415261
  var USER_SETTINGS_PATH = path53.join(USER_SETTINGS_DIR, "settings.json");
415182
415262
  var DEFAULT_EXCLUDED_ENV_VARS = ["DEBUG", "DEBUG_MODE"];
415183
415263
  function getSystemSettingsPath() {
415184
- if (process.env.GEMINI_CLI_SYSTEM_SETTINGS_PATH) {
415185
- return process.env.GEMINI_CLI_SYSTEM_SETTINGS_PATH;
415264
+ const override = process.env.CODELY_CLI_SYSTEM_SETTINGS_PATH;
415265
+ if (override) {
415266
+ return override;
415186
415267
  }
415187
415268
  if (platform8() === "darwin") {
415188
- return "/Library/Application Support/QwenCode/settings.json";
415269
+ return "/Library/Application Support/CodelyCLI/settings.json";
415189
415270
  } else if (platform8() === "win32") {
415190
- return "C:\\ProgramData\\qwen-code\\settings.json";
415271
+ return "C:\\ProgramData\\codely-cli\\settings.json";
415191
415272
  } else {
415192
- return "/etc/qwen-code/settings.json";
415273
+ return "/etc/codely-cli/settings.json";
415193
415274
  }
415194
415275
  }
415195
415276
  function getWorkspaceSettingsPath(workspaceDir) {
@@ -415225,23 +415306,24 @@ var LoadedSettings = class {
415225
415306
  const workspace = this.workspace.settings;
415226
415307
  const { folderTrust, ...workspaceWithoutFolderTrust } = workspace;
415227
415308
  return {
415309
+ // Precedence (low -> high): system < user < workspace.
415310
+ ...system,
415228
415311
  ...user,
415229
415312
  ...workspaceWithoutFolderTrust,
415230
- ...system,
415231
415313
  customThemes: {
415314
+ ...system.customThemes || {},
415232
415315
  ...user.customThemes || {},
415233
- ...workspace.customThemes || {},
415234
- ...system.customThemes || {}
415316
+ ...workspace.customThemes || {}
415235
415317
  },
415236
415318
  mcpServers: {
415319
+ ...system.mcpServers || {},
415237
415320
  ...user.mcpServers || {},
415238
- ...workspace.mcpServers || {},
415239
- ...system.mcpServers || {}
415321
+ ...workspace.mcpServers || {}
415240
415322
  },
415241
415323
  skills: {
415324
+ ...system.skills || {},
415242
415325
  ...user.skills || {},
415243
415326
  ...workspaceWithoutFolderTrust.skills || {},
415244
- ...system.skills || {},
415245
415327
  // Union disabled lists across scopes for Gemini-compat behavior.
415246
415328
  disabled: Array.from(
415247
415329
  /* @__PURE__ */ new Set([
@@ -417318,6 +417400,43 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417318
417400
  const [pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
417319
417401
  const processedMemoryToolsRef = (0, import_react37.useRef)(/* @__PURE__ */ new Set());
417320
417402
  const { startNewPrompt, getPromptCount } = useSessionStats();
417403
+ const pendingGeminiTextRef = (0, import_react37.useRef)("");
417404
+ const flushTimerRef = (0, import_react37.useRef)(null);
417405
+ const clearFlushTimer = (0, import_react37.useCallback)(() => {
417406
+ if (flushTimerRef.current) {
417407
+ clearTimeout(flushTimerRef.current);
417408
+ flushTimerRef.current = null;
417409
+ }
417410
+ }, []);
417411
+ const flushPendingGeminiText = (0, import_react37.useCallback)(
417412
+ (options2) => {
417413
+ const force = options2?.force ?? false;
417414
+ if (!force && flushTimerRef.current) {
417415
+ return;
417416
+ }
417417
+ const doFlush = () => {
417418
+ flushTimerRef.current = null;
417419
+ if (pendingHistoryItemRef.current?.type !== "gemini" && pendingHistoryItemRef.current?.type !== "gemini_content") {
417420
+ return;
417421
+ }
417422
+ setPendingHistoryItem((item) => {
417423
+ if (!item) return item;
417424
+ if (item.type !== "gemini" && item.type !== "gemini_content")
417425
+ return item;
417426
+ if (item.text === pendingGeminiTextRef.current) return item;
417427
+ return { ...item, text: pendingGeminiTextRef.current };
417428
+ });
417429
+ };
417430
+ if (force) {
417431
+ clearFlushTimer();
417432
+ doFlush();
417433
+ return;
417434
+ }
417435
+ flushTimerRef.current = setTimeout(doFlush, 50);
417436
+ },
417437
+ [clearFlushTimer, pendingHistoryItemRef, setPendingHistoryItem]
417438
+ );
417439
+ (0, import_react37.useEffect)(() => clearFlushTimer, [clearFlushTimer]);
417321
417440
  const gitService = (0, import_react37.useMemo)(() => {
417322
417441
  if (!config4.getProjectRoot()) {
417323
417442
  return;
@@ -417396,6 +417515,7 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417396
417515
  turnCancelledRef.current = true;
417397
417516
  isSubmittingQueryRef.current = false;
417398
417517
  abortControllerRef.current?.abort();
417518
+ flushPendingGeminiText({ force: true });
417399
417519
  if (pendingHistoryItemRef.current) {
417400
417520
  addItem(pendingHistoryItemRef.current, Date.now());
417401
417521
  }
@@ -417412,6 +417532,7 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417412
417532
  }, [
417413
417533
  streamingState,
417414
417534
  addItem,
417535
+ flushPendingGeminiText,
417415
417536
  setPendingHistoryItem,
417416
417537
  onCancelSubmit,
417417
417538
  pendingHistoryItemRef,
@@ -417534,20 +417655,23 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417534
417655
  return "";
417535
417656
  }
417536
417657
  let newGeminiMessageBuffer = currentGeminiMessageBuffer + eventValue;
417658
+ const shouldForceFlush = eventValue.includes("\n") || eventValue.toLowerCase().includes("</think>") || eventValue.toLowerCase().includes("</thinking>");
417537
417659
  if (pendingHistoryItemRef.current?.type !== "gemini" && pendingHistoryItemRef.current?.type !== "gemini_content") {
417538
417660
  if (pendingHistoryItemRef.current) {
417539
417661
  addItem(pendingHistoryItemRef.current, userMessageTimestamp);
417540
417662
  }
417541
417663
  setPendingHistoryItem({ type: "gemini", text: "" });
417542
417664
  newGeminiMessageBuffer = eventValue;
417665
+ pendingGeminiTextRef.current = newGeminiMessageBuffer;
417666
+ flushPendingGeminiText({ force: true });
417667
+ return newGeminiMessageBuffer;
417543
417668
  }
417669
+ pendingGeminiTextRef.current = newGeminiMessageBuffer;
417544
417670
  const splitPoint = findLastSafeSplitPoint(newGeminiMessageBuffer);
417545
417671
  if (splitPoint === newGeminiMessageBuffer.length) {
417546
- setPendingHistoryItem((item) => ({
417547
- type: item?.type,
417548
- text: newGeminiMessageBuffer
417549
- }));
417672
+ flushPendingGeminiText({ force: shouldForceFlush });
417550
417673
  } else {
417674
+ flushPendingGeminiText({ force: true });
417551
417675
  const beforeText = newGeminiMessageBuffer.substring(0, splitPoint);
417552
417676
  const afterText = newGeminiMessageBuffer.substring(splitPoint);
417553
417677
  addItem(
@@ -417559,16 +417683,24 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417559
417683
  );
417560
417684
  setPendingHistoryItem({ type: "gemini_content", text: afterText });
417561
417685
  newGeminiMessageBuffer = afterText;
417686
+ pendingGeminiTextRef.current = newGeminiMessageBuffer;
417687
+ flushPendingGeminiText({ force: true });
417562
417688
  }
417563
417689
  return newGeminiMessageBuffer;
417564
417690
  },
417565
- [addItem, pendingHistoryItemRef, setPendingHistoryItem]
417691
+ [
417692
+ addItem,
417693
+ flushPendingGeminiText,
417694
+ pendingHistoryItemRef,
417695
+ setPendingHistoryItem
417696
+ ]
417566
417697
  );
417567
417698
  const handleUserCancelledEvent = (0, import_react37.useCallback)(
417568
417699
  (userMessageTimestamp) => {
417569
417700
  if (turnCancelledRef.current) {
417570
417701
  return;
417571
417702
  }
417703
+ flushPendingGeminiText({ force: true });
417572
417704
  if (pendingHistoryItemRef.current) {
417573
417705
  if (pendingHistoryItemRef.current.type === "tool_group") {
417574
417706
  const updatedTools = pendingHistoryItemRef.current.tools.map(
@@ -417591,10 +417723,17 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417591
417723
  setIsResponding(false);
417592
417724
  setThought(null);
417593
417725
  },
417594
- [addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
417726
+ [
417727
+ addItem,
417728
+ flushPendingGeminiText,
417729
+ pendingHistoryItemRef,
417730
+ setPendingHistoryItem,
417731
+ setThought
417732
+ ]
417595
417733
  );
417596
417734
  const handleErrorEvent = (0, import_react37.useCallback)(
417597
417735
  (eventValue, userMessageTimestamp) => {
417736
+ flushPendingGeminiText({ force: true });
417598
417737
  if (pendingHistoryItemRef.current) {
417599
417738
  addItem(pendingHistoryItemRef.current, userMessageTimestamp);
417600
417739
  setPendingHistoryItem(null);
@@ -417614,7 +417753,14 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417614
417753
  );
417615
417754
  setThought(null);
417616
417755
  },
417617
- [addItem, pendingHistoryItemRef, setPendingHistoryItem, config4, setThought]
417756
+ [
417757
+ addItem,
417758
+ flushPendingGeminiText,
417759
+ pendingHistoryItemRef,
417760
+ setPendingHistoryItem,
417761
+ config4,
417762
+ setThought
417763
+ ]
417618
417764
  );
417619
417765
  const handleFinishedEvent = (0, import_react37.useCallback)(
417620
417766
  (event, userMessageTimestamp) => {
@@ -417840,6 +417986,7 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417840
417986
  return;
417841
417987
  }
417842
417988
  if (pendingHistoryItemRef.current) {
417989
+ flushPendingGeminiText({ force: true });
417843
417990
  addItem(pendingHistoryItemRef.current, userMessageTimestamp);
417844
417991
  setPendingHistoryItem(null);
417845
417992
  }
@@ -417896,7 +418043,9 @@ var useGeminiStream = (geminiClient, history, addItem, config4, logger7, onDebug
417896
418043
  config4,
417897
418044
  startNewPrompt,
417898
418045
  getPromptCount,
417899
- handleLoopDetectedEvent
418046
+ handleLoopDetectedEvent,
418047
+ cancelOngoingRequest,
418048
+ flushPendingGeminiText
417900
418049
  ]
417901
418050
  );
417902
418051
  const handleCompletedTools = (0, import_react37.useCallback)(
@@ -419219,7 +419368,7 @@ async function getPackageJson2() {
419219
419368
  // packages/cli/src/utils/version.ts
419220
419369
  async function getCliVersion() {
419221
419370
  const pkgJson = await getPackageJson2();
419222
- return "1.0.0-beta.44";
419371
+ return "1.0.0-beta.45";
419223
419372
  }
419224
419373
 
419225
419374
  // packages/cli/src/ui/commands/types.ts
@@ -419752,7 +419901,7 @@ import process30 from "node:process";
419752
419901
 
419753
419902
  // packages/cli/src/generated/git-commit.ts
419754
419903
  init_esbuild_polyfill();
419755
- var GIT_COMMIT_INFO = "107c4b52";
419904
+ var GIT_COMMIT_INFO = "b8a99db1";
419756
419905
 
419757
419906
  // packages/cli/src/ui/commands/bugCommand.ts
419758
419907
  var bugCommand = {
@@ -421524,7 +421673,7 @@ Analyze the current directory and generate a comprehensive **${contextFileName}*
421524
421673
  - Based on the initial view, pick the most informative files. Typical priorities (choose any that exist, up to ten):
421525
421674
  - \`ProjectSettings/ProjectVersion.txt\` \u2013 Unity version.
421526
421675
  - \`Packages/manifest.json\` \u2013 package list, target platforms, render pipeline.
421527
- - \`Assets/Scenes/*.unity\` \u2013 entry/start scene(s).
421676
+ - \`Assets/Scenes/*.unity\` or \`Assets/Scenes/*.scene\` \u2013 entry/start scene(s). Note: Unity engine uses \`.unity\` extension, while Tuanjie engine uses \`.scene\` extension. Check both patterns when searching for scene files.
421528
421677
  - \`Assets/Prefabs/*.prefab\` \u2013 key game objects (player, UI manager, etc.).
421529
421678
  - \`Assets/Scripts/**/*.cs\` \u2013 main scripts (e.g., \`GameManager.cs\`, \`PlayerController.cs\`).
421530
421679
  - Any \`*.asmdef\` files \u2013 code\u2011assembly boundaries.
@@ -421554,8 +421703,8 @@ Analyze the current directory and generate a comprehensive **${contextFileName}*
421554
421703
  - Render pipeline (URP/HDRP/Legacy) and any major packages (Cinemachine, Input System, DOTS, etc.).
421555
421704
 
421556
421705
  - **Key Scenes & Entry Point**
421557
- - List the main scenes (\`*.unity\`).
421558
- - Indicate which scene is loaded first (often \`Boot.unity\` or \`Main.unity\`).
421706
+ - List the main scenes (\`*.unity\` for Unity engine or \`*.scene\` for Tuanjie engine). When searching for scene files, check both patterns: \`*.unity\` and \`*.scene\`.
421707
+ - Indicate which scene is loaded first (often \`Boot.unity\`/\`Boot.scene\` or \`Main.unity\`/\`Main.scene\`).
421559
421708
 
421560
421709
  - **Core Assets**
421561
421710
  - Important prefabs (Player, UI Canvas, GameManager, etc.).
@@ -425656,6 +425805,7 @@ init_esbuild_polyfill();
425656
425805
  var UNITY_EXTENSIONS = [
425657
425806
  ".cs",
425658
425807
  ".unity",
425808
+ ".scene",
425659
425809
  ".prefab",
425660
425810
  ".mat",
425661
425811
  ".asset",
@@ -426526,7 +426676,7 @@ ManageEditorTool.Name = "unity_editor";
426526
426676
  init_esbuild_polyfill();
426527
426677
  var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426528
426678
  constructor() {
426529
- super(_ManageGameObjectTool.Name, "Unity GameObject Manager", "Manages Unity GameObjects with comprehensive operations including create, modify, delete, find, and component management. Supports primitives, prefabs, transforms, and advanced component manipulation with property setting and reference assignments.", {
426679
+ super(_ManageGameObjectTool.Name, "Unity GameObject Manager", "Manages Unity GameObjects with comprehensive operations including create, modify, delete, find, list_children, and component management. Supports primitives, prefabs, transforms, and advanced component manipulation with property setting and reference assignments.", {
426530
426680
  type: "object",
426531
426681
  properties: {
426532
426682
  action: {
@@ -426540,13 +426690,14 @@ var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426540
426690
  "modify",
426541
426691
  "delete",
426542
426692
  "find",
426693
+ "list_children",
426543
426694
  "select",
426544
426695
  "add_component",
426545
426696
  "remove_component",
426546
426697
  "set_component_property",
426547
426698
  "get_components"
426548
426699
  ],
426549
- description: 'Operation to perform. Ensure operations are idempotent (safe to call multiple times). Use "select" to set Unity Editor selection.'
426700
+ description: 'Operation to perform. Ensure operations are idempotent (safe to call multiple times). Use "list_children" to retrieve a depth-limited *tree-structured* children hierarchy for a specific GameObject (large results can be written to a JSON file under Assets/). Use "select" to set Unity Editor selection. For full-scene hierarchy roots, prefer unity_scene action="get_hierarchy".'
426550
426701
  },
426551
426702
  component_type: {
426552
426703
  type: "string",
@@ -426570,7 +426721,7 @@ var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426570
426721
  },
426571
426722
  target: {
426572
426723
  oneOf: [{ type: "string" }, { type: "number" }],
426573
- description: "GameObject identifier (name or path string) for modify/delete/component actions"
426724
+ description: "GameObject identifier (name/path/instance ID) for modify/delete/component actions. For list_children, this is the root GameObject whose subtree will be returned."
426574
426725
  },
426575
426726
  searchMethod: {
426576
426727
  type: "string",
@@ -426676,7 +426827,34 @@ var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426676
426827
  searchInactive: {
426677
426828
  type: "boolean",
426678
426829
  description: "Include inactive GameObjects in search",
426679
- default: false
426830
+ default: true
426831
+ },
426832
+ depth: {
426833
+ type: "integer",
426834
+ description: 'For list_children action: how many levels below target to traverse (1 = direct children). The returned result keeps a tree structure (nested "children") up to this depth.',
426835
+ minimum: 1,
426836
+ default: 1
426837
+ },
426838
+ includeInactive: {
426839
+ type: "boolean",
426840
+ description: "For list_children action: whether to include inactive objects in the returned results (alias of searchInactive).",
426841
+ default: true
426842
+ },
426843
+ resultMode: {
426844
+ type: "string",
426845
+ enum: ["auto", "inline", "file"],
426846
+ description: "For list_children action: 'auto' returns inline unless the result exceeds maxInlineItems, then writes the full tree JSON to a file and returns its path; 'inline' errors if too large (no truncation); 'file' always writes JSON to disk and returns its path.",
426847
+ default: "auto"
426848
+ },
426849
+ maxInlineItems: {
426850
+ type: "integer",
426851
+ description: "For list_children action: maximum number of descendant nodes (within depth) allowed for inline output before switching to file (or erroring in inline mode).",
426852
+ minimum: 1,
426853
+ default: 200
426854
+ },
426855
+ outputPath: {
426856
+ type: "string",
426857
+ description: "For list_children action with resultMode='file' (or auto overflow): output JSON path under Assets/. The tool returns this path so callers can read the full, untruncated result."
426680
426858
  },
426681
426859
  selectAll: {
426682
426860
  type: "boolean",
@@ -426719,6 +426897,7 @@ var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426719
426897
  "modify",
426720
426898
  "delete",
426721
426899
  "find",
426900
+ "list_children",
426722
426901
  "select",
426723
426902
  "add_component",
426724
426903
  "remove_component",
@@ -426833,6 +427012,46 @@ var ManageGameObjectTool = class _ManageGameObjectTool extends UnityToolBase {
426833
427012
  return "target or searchTerm is required for find";
426834
427013
  }
426835
427014
  break;
427015
+ case "list_children":
427016
+ if (!params.target) {
427017
+ return "target is required for list_children action";
427018
+ }
427019
+ if (params.includeInactive !== void 0 && params.searchInactive === void 0) {
427020
+ params.searchInactive = params.includeInactive;
427021
+ }
427022
+ if (params.depth !== void 0) {
427023
+ try {
427024
+ const parsedDepth = UnityToolBase.parseInteger(params.depth, "depth");
427025
+ if (parsedDepth !== void 0) {
427026
+ if (parsedDepth < 1) {
427027
+ return "depth must be >= 1";
427028
+ }
427029
+ params.depth = parsedDepth;
427030
+ }
427031
+ } catch (error41) {
427032
+ return error41 instanceof Error ? error41.message : "Invalid depth parameter";
427033
+ }
427034
+ }
427035
+ if (params.maxInlineItems !== void 0) {
427036
+ try {
427037
+ const parsedMaxInline = UnityToolBase.parseInteger(params.maxInlineItems, "maxInlineItems");
427038
+ if (parsedMaxInline !== void 0) {
427039
+ if (parsedMaxInline < 1) {
427040
+ return "maxInlineItems must be >= 1";
427041
+ }
427042
+ params.maxInlineItems = parsedMaxInline;
427043
+ }
427044
+ } catch (error41) {
427045
+ return error41 instanceof Error ? error41.message : "Invalid maxInlineItems parameter";
427046
+ }
427047
+ }
427048
+ if (params.outputPath && !params.outputPath.startsWith("Assets/")) {
427049
+ return "outputPath must start with Assets/";
427050
+ }
427051
+ if (params.resultMode && !["auto", "inline", "file"].includes(params.resultMode)) {
427052
+ return `Invalid resultMode: ${params.resultMode}. Valid values are: auto, inline, file`;
427053
+ }
427054
+ break;
426836
427055
  case "select":
426837
427056
  break;
426838
427057
  default:
@@ -427017,8 +427236,12 @@ ManagePackageTool.Name = "unity_package";
427017
427236
  // packages/codely-unity-client/dist/src/tools/unity-tools/manage-scene/ManageSceneTool.js
427018
427237
  init_esbuild_polyfill();
427019
427238
  var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427239
+ static hasAllowedSceneExtension(path96) {
427240
+ const lower2 = path96.toLowerCase();
427241
+ return _ManageSceneTool.AllowedSceneExtensions.some((ext3) => lower2.endsWith(ext3));
427242
+ }
427020
427243
  constructor() {
427021
- super(_ManageSceneTool.Name, "Unity Scene Manager", "Manages Unity scenes: create, load, save, get hierarchy, get active scene info, and build settings. Provides comprehensive scene operations for Unity projects.", {
427244
+ super(_ManageSceneTool.Name, "Unity Scene Manager", "Manages Unity scenes: create, load, save, get hierarchy, get active scene info, and build settings. IMPORTANT: Scene files use .unity extension for Unity engine and .scene extension for Tuanjie engine (the tool validates/accepts both). Note: for very large scenes, get_hierarchy may return only scene root objects (roots-only) with hints to drill down using unity_gameobject list_children.", {
427022
427245
  type: "object",
427023
427246
  properties: {
427024
427247
  action: {
@@ -427033,15 +427256,15 @@ var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427033
427256
  "get_active",
427034
427257
  "get_build_settings"
427035
427258
  ],
427036
- description: "Scene operation to perform. ensure_scene_open requires full scene path ending with .unity"
427259
+ description: "Scene operation to perform. ensure_scene_open requires full scene path ending with .unity or .scene. get_hierarchy may return roots-only for very large scenes."
427037
427260
  },
427038
427261
  name: {
427039
427262
  type: "string",
427040
- description: "Scene name (without .unity extension). Used for create, load, save actions."
427263
+ description: "Scene name (without .unity/.scene extension). Used for create, load, save actions."
427041
427264
  },
427042
427265
  path: {
427043
427266
  type: "string",
427044
- description: 'For ensure_scene_open: full scene path ending with .unity (e.g., "Assets/Scenes/MyScene.unity"). For create/load/save: directory path (default: "Assets/Scenes/").'
427267
+ description: 'For ensure_scene_open: full scene path ending with .unity or .scene (e.g., "Assets/Scenes/MyScene.unity"). For create/load/save: directory path (default: "Assets/Scenes/").'
427045
427268
  },
427046
427269
  build_index: {
427047
427270
  type: "integer",
@@ -427080,8 +427303,8 @@ var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427080
427303
  if (!params.path.startsWith("Assets/")) {
427081
427304
  return 'path must start with "Assets/"';
427082
427305
  }
427083
- if (!params.path.endsWith(".unity")) {
427084
- return 'path must end with ".unity" for scene files';
427306
+ if (!_ManageSceneTool.hasAllowedSceneExtension(params.path)) {
427307
+ return 'path must end with ".unity" or ".scene" for scene files';
427085
427308
  }
427086
427309
  break;
427087
427310
  case "ensure_scene_saved":
@@ -427090,8 +427313,8 @@ var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427090
427313
  if (!params.name) {
427091
427314
  return "name is required for create action";
427092
427315
  }
427093
- if (params.name.toLowerCase().endsWith(".unity")) {
427094
- return "name should not include .unity extension";
427316
+ if (_ManageSceneTool.hasAllowedSceneExtension(params.name)) {
427317
+ return "name should not include .unity/.scene extension";
427095
427318
  }
427096
427319
  break;
427097
427320
  case "load":
@@ -427100,8 +427323,8 @@ var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427100
427323
  }
427101
427324
  break;
427102
427325
  case "save":
427103
- if (params.name && params.name.toLowerCase().endsWith(".unity")) {
427104
- return "name should not include .unity extension";
427326
+ if (params.name && _ManageSceneTool.hasAllowedSceneExtension(params.name)) {
427327
+ return "name should not include .unity/.scene extension";
427105
427328
  }
427106
427329
  break;
427107
427330
  case "get_hierarchy":
@@ -427131,6 +427354,7 @@ var ManageSceneTool = class _ManageSceneTool extends UnityToolBase {
427131
427354
  }
427132
427355
  };
427133
427356
  ManageSceneTool.Name = "unity_scene";
427357
+ ManageSceneTool.AllowedSceneExtensions = [".unity", ".scene"];
427134
427358
 
427135
427359
  // packages/codely-unity-client/dist/src/tools/unity-tools/manage-screenshot/ScreenShotTool.js
427136
427360
  init_esbuild_polyfill();
@@ -428094,7 +428318,7 @@ var UnityToolsManager = class {
428094
428318
  Available Unity Builtin Tools (13 total):
428095
428319
 
428096
428320
  - \`unity_editor\`: Controls editor state, compilation, long-task waiting, and queries Unity project info (use get_current_state for full state, and start_compilation_pipeline + wait_for_compile for script edits)
428097
- - \`unity_scene\`: Creates, loads, saves scenes with ensure operations for idempotent scene workflows
428321
+ - \`unity_scene\`: Creates, loads, saves scenes with ensure operations for idempotent scene workflows. **IMPORTANT**: Scene files use \`.unity\` extension for Unity engine and \`.scene\` extension for Tuanjie engine. When searching for scene files (e.g., using FindFiles), always check both patterns: \`*.unity\` and \`*.scene\`.
428098
428322
  - \`unity_gameobject\`: Creates, modifies, deletes GameObjects with ensure operations for components/materials
428099
428323
  - \`unity_script\`: Creates, edits, and manages C# script files (used together with compile + console check)
428100
428324
  - \`unity_asset\`: Creates, imports, and manages prefabs and assets with meta safety operations
@@ -461300,10 +461524,16 @@ function spawnAcpAgent(args) {
461300
461524
  var webUiServeCommand = {
461301
461525
  command: "web-ui",
461302
461526
  describe: "Start Codely Web UI (localhost) by proxying ACP over WebSocket to a spawned agent process",
461303
- builder: (yargs) => yargs.usage("Usage: codely serve web-ui [--port <port>] [options]").option("port", {
461527
+ builder: (yargs) => yargs.usage(
461528
+ "Usage: codely serve web-ui [--port <port>] [--host <host>] [options]"
461529
+ ).option("port", {
461304
461530
  type: "number",
461305
461531
  default: 3939,
461306
461532
  describe: "HTTP server port for Web UI (default: 3939)"
461533
+ }).option("host", {
461534
+ type: "string",
461535
+ default: "127.0.0.1",
461536
+ describe: "HTTP server host for Web UI (default: 127.0.0.1). Use 0.0.0.0 to accept connections from any network interface."
461307
461537
  }).option("open", {
461308
461538
  type: "boolean",
461309
461539
  default: false,
@@ -461315,11 +461545,16 @@ var webUiServeCommand = {
461315
461545
  describe: "Enable debug logging"
461316
461546
  }).example([
461317
461547
  ["$0 serve web-ui", "Start Web UI on http://127.0.0.1:3939"],
461318
- ["$0 serve web-ui --port 3000", "Start Web UI on port 3000"]
461548
+ ["$0 serve web-ui --port 3000", "Start Web UI on port 3000"],
461549
+ [
461550
+ "$0 serve web-ui --host 0.0.0.0",
461551
+ "Start Web UI accessible from any network interface"
461552
+ ]
461319
461553
  ]).version(false),
461320
461554
  handler: async (argv) => {
461321
461555
  const args = argv;
461322
461556
  const port = args.port ?? 3939;
461557
+ const host = args.host ?? "127.0.0.1";
461323
461558
  const debug3 = Boolean(args.debug);
461324
461559
  const cwd3 = process.cwd();
461325
461560
  const { staticDir, indexPath } = resolveStaticDir();
@@ -461423,11 +461658,11 @@ If you're running an installed bundle, your package may be missing bundled Web U
461423
461658
  });
461424
461659
  await new Promise((resolve26, reject) => {
461425
461660
  server.once("error", reject);
461426
- server.listen(port, "127.0.0.1", () => resolve26());
461661
+ server.listen(port, host, () => resolve26());
461427
461662
  });
461428
- const url4 = `http://127.0.0.1:${port}`;
461663
+ const url4 = `http://${host}:${port}`;
461429
461664
  console.error(`\u2705 Web UI listening on ${url4}`);
461430
- console.error(` WS endpoint: ws://127.0.0.1:${port}/ws`);
461665
+ console.error(` WS endpoint: ws://${host}:${port}/ws`);
461431
461666
  if (args.open) {
461432
461667
  try {
461433
461668
  await open_default(url4, { wait: false });
@@ -461707,6 +461942,13 @@ async function parseArguments() {
461707
461942
  type: "boolean",
461708
461943
  description: "Enable experimental Skills feature",
461709
461944
  default: false
461945
+ }).option("skills", {
461946
+ type: "array",
461947
+ string: true,
461948
+ description: "Limit enabled skills to the provided list (requires --experimental-skills). Supports comma-separated values or repeated --skills flags.",
461949
+ coerce: (skills) => skills.flatMap(
461950
+ (value) => String(value ?? "").split(",").map((s3) => s3.trim()).filter(Boolean)
461951
+ )
461710
461952
  }).option("allowed-mcp-server-names", {
461711
461953
  type: "array",
461712
461954
  string: true,
@@ -461743,8 +461985,8 @@ async function parseArguments() {
461743
461985
  }).option("reasoning_effort", {
461744
461986
  type: "string",
461745
461987
  alias: ["reasoningEffort"],
461746
- choices: ["minimal", "low", "medium", "high"],
461747
- description: "OpenAI reasoning_effort for reasoning/compatible models (minimal|low|medium|high)"
461988
+ choices: ["minimal", "low", "medium", "high", "xhigh"],
461989
+ description: "OpenAI reasoning_effort for reasoning/compatible models (minimal|low|medium|high|xhigh)"
461748
461990
  }).option("enable_thinking", {
461749
461991
  type: "boolean",
461750
461992
  alias: ["enableThinking"],
@@ -461812,6 +462054,11 @@ async function parseArguments() {
461812
462054
  "Cannot use both --example-prompt and --prompt-interactive (-i) together"
461813
462055
  );
461814
462056
  }
462057
+ if (Array.isArray(argv.skills) && argv.skills.filter(Boolean).length > 0 && !argv.experimentalSkills) {
462058
+ throw new Error(
462059
+ "Cannot use --skills without --experimental-skills. Enable skills first with --experimental-skills."
462060
+ );
462061
+ }
461815
462062
  return true;
461816
462063
  })
461817
462064
  ).command(mcpCommand2).command(extensionsCommand2).command(serveCommand).version(await getCliVersion()).alias("v", "version").help().alias("h", "help").strict().demandCommand(0, 0);
@@ -462125,6 +462372,7 @@ async function loadCliConfig(settings, extensions, sessionId2, argv, cwd3 = proc
462125
462372
  sessionTokenLimit: settings.sessionTokenLimit ?? -1,
462126
462373
  experimentalZedIntegration: argv.experimentalAcp || false,
462127
462374
  experimentalSkills: argv.experimentalSkills || false,
462375
+ enabledSkills: argv.experimentalSkills && argv.skills && argv.skills.length > 0 ? argv.skills : void 0,
462128
462376
  disabledSkills: settings.skills?.disabled ?? [],
462129
462377
  listExtensions: argv.listExtensions || false,
462130
462378
  extensions: allExtensions,
@@ -466379,8 +466627,11 @@ var AutoAcceptIndicator = ({
466379
466627
  init_esbuild_polyfill();
466380
466628
  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
466381
466629
  var ShellModeIndicator = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: Colors.AccentYellow, children: [
466382
- "shell mode enabled",
466383
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: Colors.Gray, children: " (esc to disable)" })
466630
+ "SHELL MODE: type a command and press Enter to run",
466631
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { color: Colors.Gray, children: [
466632
+ " ",
466633
+ "(Esc to exit; press ! on empty input to toggle)"
466634
+ ] })
466384
466635
  ] }) });
466385
466636
 
466386
466637
  // packages/cli/src/ui/components/InputPrompt.tsx
@@ -487183,6 +487434,15 @@ var EMPTY_LINE_HEIGHT = 1;
487183
487434
  var CODE_BLOCK_PREFIX_PADDING = 1;
487184
487435
  var LIST_ITEM_PREFIX_PADDING = 1;
487185
487436
  var LIST_ITEM_TEXT_FLEX_GROW = 1;
487437
+ var HEADER_REGEX = /^ *(#{1,4}) +(.*)/;
487438
+ var CODE_FENCE_REGEX = /^ *(`{3,}|~{3,}) *(\w*?) *$/;
487439
+ var UL_ITEM_REGEX = /^([ \t]*)([-*+]) +(.*)/;
487440
+ var OL_ITEM_REGEX = /^([ \t]*)(\d+)\. +(.*)/;
487441
+ var HR_REGEX = /^ *([-*_] *){3,} *$/;
487442
+ var TABLE_ROW_REGEX = /^\s*\|(.+)\|\s*$/;
487443
+ var TABLE_SEPARATOR_REGEX = /^\s*\|?\s*(:?-+:?)\s*(\|\s*(:?-+:?)\s*)+\|?\s*$/;
487444
+ var THINK_START_REGEX = /^__THINK_START__$/;
487445
+ var THINK_END_REGEX = /^__THINK_END__$/;
487186
487446
  function processThinkTags(text) {
487187
487447
  if (!text) return text;
487188
487448
  const firstNonWhitespaceIndex = text.search(/\S/);
@@ -487227,257 +487487,253 @@ var MarkdownDisplayInternal = ({
487227
487487
  terminalWidth,
487228
487488
  enableThinkTags = true
487229
487489
  }) => {
487230
- if (!text) return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {});
487231
- const processedText = enableThinkTags ? processThinkTags(text) : text.replace(/\n\n+/g, "\n\n");
487232
- const lines = processedText.split("\n");
487233
- const headerRegex = /^ *(#{1,4}) +(.*)/;
487234
- const codeFenceRegex = /^ *(`{3,}|~{3,}) *(\w*?) *$/;
487235
- const ulItemRegex = /^([ \t]*)([-*+]) +(.*)/;
487236
- const olItemRegex = /^([ \t]*)(\d+)\. +(.*)/;
487237
- const hrRegex = /^ *([-*_] *){3,} *$/;
487238
- const tableRowRegex = /^\s*\|(.+)\|\s*$/;
487239
- const tableSeparatorRegex = /^\s*\|?\s*(:?-+:?)\s*(\|\s*(:?-+:?)\s*)+\|?\s*$/;
487240
- const thinkStartRegex = /^__THINK_START__$/;
487241
- const thinkEndRegex = /^__THINK_END__$/;
487242
- const contentBlocks = [];
487243
- let inCodeBlock = false;
487244
- let lastLineEmpty = true;
487245
- let codeBlockContent = [];
487246
- let codeBlockLang = null;
487247
- let codeBlockFence = "";
487248
- let inTable = false;
487249
- let tableRows = [];
487250
- let tableHeaders = [];
487251
- let inThinkBlock = false;
487252
- let thinkContent = [];
487253
- function addContentBlock(block2) {
487254
- if (block2) {
487255
- contentBlocks.push(block2);
487256
- lastLineEmpty = false;
487257
- }
487258
- }
487259
- lines.forEach((line, index) => {
487260
- const key = `line-${index}`;
487261
- if (inCodeBlock) {
487262
- const fenceMatch = line.match(codeFenceRegex);
487263
- if (fenceMatch && fenceMatch[1].startsWith(codeBlockFence[0]) && fenceMatch[1].length >= codeBlockFence.length) {
487490
+ const processedText = import_react76.default.useMemo(() => {
487491
+ if (!text) return "";
487492
+ return enableThinkTags ? processThinkTags(text) : text.replace(/\n\n+/g, "\n\n");
487493
+ }, [text, enableThinkTags]);
487494
+ const lines = import_react76.default.useMemo(() => processedText.split("\n"), [processedText]);
487495
+ const contentBlocks = import_react76.default.useMemo(() => {
487496
+ const blocks = [];
487497
+ let inCodeBlock = false;
487498
+ let lastLineEmpty = true;
487499
+ let codeBlockContent = [];
487500
+ let codeBlockLang = null;
487501
+ let codeBlockFence = "";
487502
+ let inTable = false;
487503
+ let tableRows = [];
487504
+ let tableHeaders = [];
487505
+ let inThinkBlock = false;
487506
+ let thinkContent = [];
487507
+ function addContentBlock(block2) {
487508
+ if (block2) {
487509
+ blocks.push(block2);
487510
+ lastLineEmpty = false;
487511
+ }
487512
+ }
487513
+ lines.forEach((line, index) => {
487514
+ const key = `line-${index}`;
487515
+ if (inCodeBlock) {
487516
+ const fenceMatch = line.match(CODE_FENCE_REGEX);
487517
+ if (fenceMatch && fenceMatch[1].startsWith(codeBlockFence[0]) && fenceMatch[1].length >= codeBlockFence.length) {
487518
+ addContentBlock(
487519
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487520
+ RenderCodeBlock,
487521
+ {
487522
+ content: codeBlockContent,
487523
+ lang: codeBlockLang,
487524
+ isPending,
487525
+ availableTerminalHeight,
487526
+ terminalWidth
487527
+ },
487528
+ key
487529
+ )
487530
+ );
487531
+ inCodeBlock = false;
487532
+ codeBlockContent = [];
487533
+ codeBlockLang = null;
487534
+ codeBlockFence = "";
487535
+ } else {
487536
+ codeBlockContent.push(line);
487537
+ }
487538
+ return;
487539
+ }
487540
+ if (inThinkBlock) {
487541
+ if (line.match(THINK_END_REGEX)) {
487542
+ addContentBlock(
487543
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487544
+ RenderThinkBlock,
487545
+ {
487546
+ content: thinkContent,
487547
+ isPending,
487548
+ isStreaming: false,
487549
+ terminalWidth
487550
+ },
487551
+ key
487552
+ )
487553
+ );
487554
+ inThinkBlock = false;
487555
+ thinkContent = [];
487556
+ } else if (!line.match(THINK_START_REGEX)) {
487557
+ thinkContent.push(line);
487558
+ }
487559
+ return;
487560
+ }
487561
+ const codeFenceMatch = line.match(CODE_FENCE_REGEX);
487562
+ const headerMatch = line.match(HEADER_REGEX);
487563
+ const ulMatch = line.match(UL_ITEM_REGEX);
487564
+ const olMatch = line.match(OL_ITEM_REGEX);
487565
+ const hrMatch = line.match(HR_REGEX);
487566
+ const tableRowMatch = line.match(TABLE_ROW_REGEX);
487567
+ const tableSeparatorMatch = line.match(TABLE_SEPARATOR_REGEX);
487568
+ const thinkStartMatch = line.match(THINK_START_REGEX);
487569
+ const thinkEndMatch = line.match(THINK_END_REGEX);
487570
+ if (thinkStartMatch) {
487571
+ inThinkBlock = true;
487572
+ } else if (thinkEndMatch) {
487573
+ return;
487574
+ } else if (codeFenceMatch) {
487575
+ inCodeBlock = true;
487576
+ codeBlockFence = codeFenceMatch[1];
487577
+ codeBlockLang = codeFenceMatch[2] || null;
487578
+ } else if (tableRowMatch && !inTable) {
487579
+ if (index + 1 < lines.length && lines[index + 1].match(TABLE_SEPARATOR_REGEX)) {
487580
+ inTable = true;
487581
+ tableHeaders = tableRowMatch[1].split("|").map((cell) => cell.trim());
487582
+ tableRows = [];
487583
+ } else {
487584
+ addContentBlock(
487585
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487586
+ );
487587
+ }
487588
+ } else if (inTable && tableSeparatorMatch) {
487589
+ } else if (inTable && tableRowMatch) {
487590
+ const cells = tableRowMatch[1].split("|").map((cell) => cell.trim());
487591
+ while (cells.length < tableHeaders.length) {
487592
+ cells.push("");
487593
+ }
487594
+ if (cells.length > tableHeaders.length) {
487595
+ cells.length = tableHeaders.length;
487596
+ }
487597
+ tableRows.push(cells);
487598
+ } else if (inTable && !tableRowMatch) {
487599
+ if (tableHeaders.length > 0 && tableRows.length > 0) {
487600
+ addContentBlock(
487601
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487602
+ RenderTable,
487603
+ {
487604
+ headers: tableHeaders,
487605
+ rows: tableRows,
487606
+ terminalWidth
487607
+ },
487608
+ `table-${blocks.length}`
487609
+ )
487610
+ );
487611
+ }
487612
+ inTable = false;
487613
+ tableRows = [];
487614
+ tableHeaders = [];
487615
+ if (line.trim().length > 0) {
487616
+ addContentBlock(
487617
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487618
+ );
487619
+ }
487620
+ } else if (hrMatch) {
487264
487621
  addContentBlock(
487265
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487266
- RenderCodeBlock,
487267
- {
487268
- content: codeBlockContent,
487269
- lang: codeBlockLang,
487270
- isPending,
487271
- availableTerminalHeight,
487272
- terminalWidth
487273
- },
487274
- key
487275
- )
487622
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { dimColor: true, children: "---" }) }, key)
487276
487623
  );
487277
- inCodeBlock = false;
487278
- codeBlockContent = [];
487279
- codeBlockLang = null;
487280
- codeBlockFence = "";
487281
- } else {
487282
- codeBlockContent.push(line);
487283
- }
487284
- return;
487285
- }
487286
- if (inThinkBlock) {
487287
- if (line.match(thinkEndRegex)) {
487624
+ } else if (headerMatch) {
487625
+ const level = headerMatch[1].length;
487626
+ const headerText = headerMatch[2];
487627
+ let headerNode = null;
487628
+ switch (level) {
487629
+ case 1:
487630
+ headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, color: Colors.AccentCyan, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487631
+ break;
487632
+ case 2:
487633
+ headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, color: Colors.AccentBlue, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487634
+ break;
487635
+ case 3:
487636
+ headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487637
+ break;
487638
+ case 4:
487639
+ headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { italic: true, color: Colors.Gray, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487640
+ break;
487641
+ default:
487642
+ headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487643
+ break;
487644
+ }
487645
+ if (headerNode) addContentBlock(/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: headerNode }, key));
487646
+ } else if (ulMatch) {
487647
+ const leadingWhitespace = ulMatch[1];
487648
+ const marker = ulMatch[2];
487649
+ const itemText = ulMatch[3];
487288
487650
  addContentBlock(
487289
487651
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487290
- RenderThinkBlock,
487652
+ RenderListItem,
487291
487653
  {
487292
- content: thinkContent,
487293
- isPending,
487294
- isStreaming: false,
487295
- terminalWidth
487654
+ itemText,
487655
+ type: "ul",
487656
+ marker,
487657
+ leadingWhitespace
487296
487658
  },
487297
487659
  key
487298
487660
  )
487299
487661
  );
487300
- inThinkBlock = false;
487301
- thinkContent = [];
487302
- } else if (!line.match(thinkStartRegex)) {
487303
- thinkContent.push(line);
487304
- }
487305
- return;
487306
- }
487307
- const codeFenceMatch = line.match(codeFenceRegex);
487308
- const headerMatch = line.match(headerRegex);
487309
- const ulMatch = line.match(ulItemRegex);
487310
- const olMatch = line.match(olItemRegex);
487311
- const hrMatch = line.match(hrRegex);
487312
- const tableRowMatch = line.match(tableRowRegex);
487313
- const tableSeparatorMatch = line.match(tableSeparatorRegex);
487314
- const thinkStartMatch = line.match(thinkStartRegex);
487315
- const thinkEndMatch = line.match(thinkEndRegex);
487316
- if (thinkStartMatch) {
487317
- inThinkBlock = true;
487318
- } else if (thinkEndMatch) {
487319
- return;
487320
- } else if (codeFenceMatch) {
487321
- inCodeBlock = true;
487322
- codeBlockFence = codeFenceMatch[1];
487323
- codeBlockLang = codeFenceMatch[2] || null;
487324
- } else if (tableRowMatch && !inTable) {
487325
- if (index + 1 < lines.length && lines[index + 1].match(tableSeparatorRegex)) {
487326
- inTable = true;
487327
- tableHeaders = tableRowMatch[1].split("|").map((cell) => cell.trim());
487328
- tableRows = [];
487329
- } else {
487330
- addContentBlock(
487331
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487332
- );
487333
- }
487334
- } else if (inTable && tableSeparatorMatch) {
487335
- } else if (inTable && tableRowMatch) {
487336
- const cells = tableRowMatch[1].split("|").map((cell) => cell.trim());
487337
- while (cells.length < tableHeaders.length) {
487338
- cells.push("");
487339
- }
487340
- if (cells.length > tableHeaders.length) {
487341
- cells.length = tableHeaders.length;
487342
- }
487343
- tableRows.push(cells);
487344
- } else if (inTable && !tableRowMatch) {
487345
- if (tableHeaders.length > 0 && tableRows.length > 0) {
487662
+ } else if (olMatch) {
487663
+ const leadingWhitespace = olMatch[1];
487664
+ const marker = olMatch[2];
487665
+ const itemText = olMatch[3];
487346
487666
  addContentBlock(
487347
487667
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487348
- RenderTable,
487668
+ RenderListItem,
487349
487669
  {
487350
- headers: tableHeaders,
487351
- rows: tableRows,
487352
- terminalWidth
487670
+ itemText,
487671
+ type: "ol",
487672
+ marker,
487673
+ leadingWhitespace
487353
487674
  },
487354
- `table-${contentBlocks.length}`
487675
+ key
487355
487676
  )
487356
487677
  );
487678
+ } else {
487679
+ if (line.trim().length === 0 && !inCodeBlock) {
487680
+ if (!lastLineEmpty) {
487681
+ blocks.push(
487682
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { height: EMPTY_LINE_HEIGHT }, `spacer-${index}`)
487683
+ );
487684
+ lastLineEmpty = true;
487685
+ }
487686
+ } else {
487687
+ addContentBlock(
487688
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487689
+ );
487690
+ }
487357
487691
  }
487358
- inTable = false;
487359
- tableRows = [];
487360
- tableHeaders = [];
487361
- if (line.trim().length > 0) {
487362
- addContentBlock(
487363
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487364
- );
487365
- }
487366
- } else if (hrMatch) {
487692
+ });
487693
+ if (inCodeBlock) {
487367
487694
  addContentBlock(
487368
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { dimColor: true, children: "---" }) }, key)
487695
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487696
+ RenderCodeBlock,
487697
+ {
487698
+ content: codeBlockContent,
487699
+ lang: codeBlockLang,
487700
+ isPending,
487701
+ availableTerminalHeight,
487702
+ terminalWidth
487703
+ },
487704
+ "line-eof"
487705
+ )
487369
487706
  );
487370
- } else if (headerMatch) {
487371
- const level = headerMatch[1].length;
487372
- const headerText = headerMatch[2];
487373
- let headerNode = null;
487374
- switch (level) {
487375
- case 1:
487376
- headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, color: Colors.AccentCyan, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487377
- break;
487378
- case 2:
487379
- headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, color: Colors.AccentBlue, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487380
- break;
487381
- case 3:
487382
- headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { bold: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487383
- break;
487384
- case 4:
487385
- headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { italic: true, color: Colors.Gray, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487386
- break;
487387
- default:
487388
- headerNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: headerText }) });
487389
- break;
487390
- }
487391
- if (headerNode) addContentBlock(/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: headerNode }, key));
487392
- } else if (ulMatch) {
487393
- const leadingWhitespace = ulMatch[1];
487394
- const marker = ulMatch[2];
487395
- const itemText = ulMatch[3];
487707
+ }
487708
+ if (inThinkBlock) {
487396
487709
  addContentBlock(
487397
487710
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487398
- RenderListItem,
487711
+ RenderThinkBlock,
487399
487712
  {
487400
- itemText,
487401
- type: "ul",
487402
- marker,
487403
- leadingWhitespace
487713
+ content: thinkContent,
487714
+ isPending,
487715
+ isStreaming: true,
487716
+ terminalWidth
487404
487717
  },
487405
- key
487718
+ "think-eof"
487406
487719
  )
487407
487720
  );
487408
- } else if (olMatch) {
487409
- const leadingWhitespace = olMatch[1];
487410
- const marker = olMatch[2];
487411
- const itemText = olMatch[3];
487721
+ }
487722
+ if (inTable && tableHeaders.length > 0 && tableRows.length > 0) {
487412
487723
  addContentBlock(
487413
487724
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487414
- RenderListItem,
487725
+ RenderTable,
487415
487726
  {
487416
- itemText,
487417
- type: "ol",
487418
- marker,
487419
- leadingWhitespace
487727
+ headers: tableHeaders,
487728
+ rows: tableRows,
487729
+ terminalWidth
487420
487730
  },
487421
- key
487731
+ `table-${blocks.length}`
487422
487732
  )
487423
487733
  );
487424
- } else {
487425
- if (line.trim().length === 0 && !inCodeBlock) {
487426
- if (!lastLineEmpty) {
487427
- contentBlocks.push(
487428
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { height: EMPTY_LINE_HEIGHT }, `spacer-${index}`)
487429
- );
487430
- lastLineEmpty = true;
487431
- }
487432
- } else {
487433
- addContentBlock(
487434
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { wrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderInline, { text: line }) }) }, key)
487435
- );
487436
- }
487437
487734
  }
487438
- });
487439
- if (inCodeBlock) {
487440
- addContentBlock(
487441
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487442
- RenderCodeBlock,
487443
- {
487444
- content: codeBlockContent,
487445
- lang: codeBlockLang,
487446
- isPending,
487447
- availableTerminalHeight,
487448
- terminalWidth
487449
- },
487450
- "line-eof"
487451
- )
487452
- );
487453
- }
487454
- if (inThinkBlock) {
487455
- addContentBlock(
487456
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487457
- RenderThinkBlock,
487458
- {
487459
- content: thinkContent,
487460
- isPending,
487461
- isStreaming: true,
487462
- terminalWidth
487463
- },
487464
- "think-eof"
487465
- )
487466
- );
487467
- }
487468
- if (inTable && tableHeaders.length > 0 && tableRows.length > 0) {
487469
- addContentBlock(
487470
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
487471
- RenderTable,
487472
- {
487473
- headers: tableHeaders,
487474
- rows: tableRows,
487475
- terminalWidth
487476
- },
487477
- `table-${contentBlocks.length}`
487478
- )
487479
- );
487480
- }
487735
+ return blocks;
487736
+ }, [lines, isPending, availableTerminalHeight, terminalWidth]);
487481
487737
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { flexDirection: "column", alignItems: "flex-start", children: contentBlocks });
487482
487738
  };
487483
487739
  var RenderCodeBlockInternal = ({
@@ -487570,8 +487826,8 @@ var RenderThinkBlockInternal = ({
487570
487826
  terminalWidth: _terminalWidth
487571
487827
  }) => {
487572
487828
  const MAX_VISIBLE_THINK_LINES = 10;
487829
+ const MAX_THINK_LINES_WHEN_NOT_PENDING = 50;
487573
487830
  const MAX_VISIBLE_THINK_CHARS_WHEN_COLLAPSED = 500;
487574
- const shouldCollapse = isPending && isStreaming;
487575
487831
  const filteredContent = content.filter((line) => line.trim().length > 0);
487576
487832
  if (filteredContent.length === 0) {
487577
487833
  return null;
@@ -487582,6 +487838,8 @@ var RenderThinkBlockInternal = ({
487582
487838
  if (cleanedContent.length === 0) {
487583
487839
  return null;
487584
487840
  }
487841
+ void isStreaming;
487842
+ const shouldCollapse = isPending || cleanedContent.length > MAX_THINK_LINES_WHEN_NOT_PENDING;
487585
487843
  let visibleContent = cleanedContent;
487586
487844
  let hiddenLineCount = 0;
487587
487845
  if (shouldCollapse) {
@@ -487642,7 +487900,23 @@ var RenderThinkBlockInternal = ({
487642
487900
  }
487643
487901
  );
487644
487902
  };
487645
- var RenderThinkBlock = import_react76.default.memo(RenderThinkBlockInternal);
487903
+ var RenderThinkBlock = import_react76.default.memo(
487904
+ RenderThinkBlockInternal,
487905
+ (prevProps, nextProps) => {
487906
+ if (prevProps.isPending !== nextProps.isPending || prevProps.isStreaming !== nextProps.isStreaming || prevProps.terminalWidth !== nextProps.terminalWidth) {
487907
+ return false;
487908
+ }
487909
+ if (prevProps.content.length !== nextProps.content.length) {
487910
+ return false;
487911
+ }
487912
+ for (let i3 = 0; i3 < prevProps.content.length; i3++) {
487913
+ if (prevProps.content[i3] !== nextProps.content[i3]) {
487914
+ return false;
487915
+ }
487916
+ }
487917
+ return true;
487918
+ }
487919
+ );
487646
487920
  var MarkdownDisplay = import_react76.default.memo(MarkdownDisplayInternal);
487647
487921
 
487648
487922
  // packages/cli/src/ui/components/messages/GeminiMessage.tsx
@@ -487704,7 +487978,7 @@ var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
487704
487978
  var STATIC_HEIGHT = 1;
487705
487979
  var RESERVED_LINE_COUNT = 5;
487706
487980
  var STATUS_INDICATOR_WIDTH = 3;
487707
- var MIN_LINES_SHOWN = 2;
487981
+ var MIN_LINES_SHOWN = 4;
487708
487982
  var MAX_TOOL_DESCRIPTION_CHARACTERS = 240;
487709
487983
  var MAXIMUM_RESULT_DISPLAY_CHARACTERS = 1e6;
487710
487984
  function formatToolDescription(description) {
@@ -487729,11 +488003,10 @@ var ToolMessage = ({
487729
488003
  emphasis = "medium",
487730
488004
  renderOutputAsMarkdown = true
487731
488005
  }) => {
487732
- const availableHeight = availableTerminalHeight ? Math.max(
488006
+ const availableHeight = availableTerminalHeight === void 0 ? void 0 : Math.max(
487733
488007
  availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT,
487734
- MIN_LINES_SHOWN + 1
487735
- // enforce minimum lines shown
487736
- ) : void 0;
488008
+ MIN_LINES_SHOWN
488009
+ );
487737
488010
  if (availableHeight) {
487738
488011
  renderOutputAsMarkdown = false;
487739
488012
  }
@@ -487763,7 +488036,7 @@ var ToolMessage = ({
487763
488036
  {
487764
488037
  paddingLeft: STATUS_INDICATOR_WIDTH,
487765
488038
  width: "100%",
487766
- marginTop: 1,
488039
+ marginTop: availableHeight === void 0 ? 1 : 0,
487767
488040
  alignItems: "flex-start",
487768
488041
  children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", alignItems: "flex-start", width: "100%", children: [
487769
488042
  typeof resultDisplay === "string" && renderOutputAsMarkdown && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { flexDirection: "column", alignItems: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -487777,7 +488050,14 @@ var ToolMessage = ({
487777
488050
  }
487778
488051
  ) }),
487779
488052
  typeof resultDisplay === "string" && !renderOutputAsMarkdown && // PowerShell output handling - split by lines for better formatting
487780
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MaxSizedBox, { maxHeight: availableHeight, maxWidth: childWidth, children: resultDisplay.split(/\r?\n/).map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { alignItems: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { wrap: "wrap", children: line || " " }) }, index)) }),
488053
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MaxSizedBox, { maxHeight: availableHeight, maxWidth: childWidth, children: (() => {
488054
+ const lines = resultDisplay.split(/\r?\n/);
488055
+ while (lines.length > 0 && (lines[lines.length - 1] ?? "").trim() === "") {
488056
+ lines.pop();
488057
+ }
488058
+ const displayLines = lines.length > 0 ? lines : [" "];
488059
+ return displayLines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { alignItems: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { wrap: "wrap", children: line || " " }) }, index));
488060
+ })() }),
487781
488061
  typeof resultDisplay !== "string" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
487782
488062
  DiffRenderer,
487783
488063
  {
@@ -488057,6 +488337,85 @@ var ToolConfirmationMessage = ({
488057
488337
 
488058
488338
  // packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
488059
488339
  var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
488340
+ var LARGE_TOOL_GROUP_THRESHOLD = 10;
488341
+ var TOOL_GROUP_RENDER_QUEUE_DELAY_MS = 100;
488342
+ var TOOL_GROUP_RENDER_QUEUE_DELAY_MS_LARGE = 1e3;
488343
+ var TOOL_GROUP_TICK_INTERVAL_MS = 100;
488344
+ var TERMINAL_TOOL_STATUSES = /* @__PURE__ */ new Set([
488345
+ "Success" /* Success */,
488346
+ "Error" /* Error */,
488347
+ "Canceled" /* Canceled */
488348
+ ]);
488349
+ var COMPACT_TOOL_OUTPUT_PREVIEW_LINES = 3;
488350
+ var COMPACT_DESCRIPTION_MAX_CHARS = 80;
488351
+ function renderCadenceMs(toolCount) {
488352
+ return toolCount > LARGE_TOOL_GROUP_THRESHOLD ? TOOL_GROUP_RENDER_QUEUE_DELAY_MS_LARGE : TOOL_GROUP_RENDER_QUEUE_DELAY_MS;
488353
+ }
488354
+ function statusSymbol(status) {
488355
+ switch (status) {
488356
+ case "Pending" /* Pending */:
488357
+ return TOOL_STATUS.PENDING;
488358
+ case "Executing" /* Executing */:
488359
+ return TOOL_STATUS.EXECUTING;
488360
+ case "Success" /* Success */:
488361
+ return TOOL_STATUS.SUCCESS;
488362
+ case "Confirming" /* Confirming */:
488363
+ return TOOL_STATUS.CONFIRMING;
488364
+ case "Canceled" /* Canceled */:
488365
+ return TOOL_STATUS.CANCELED;
488366
+ case "Error" /* Error */:
488367
+ return TOOL_STATUS.ERROR;
488368
+ default: {
488369
+ const exhaustiveCheck = status;
488370
+ return String(exhaustiveCheck);
488371
+ }
488372
+ }
488373
+ }
488374
+ function compactDescription(description) {
488375
+ const singleLine = description.replace(/\s+/g, " ").trim();
488376
+ if (singleLine.length <= COMPACT_DESCRIPTION_MAX_CHARS) return singleLine;
488377
+ return `${singleLine.slice(0, COMPACT_DESCRIPTION_MAX_CHARS - 1)}\u2026`;
488378
+ }
488379
+ function toolOutputPreviewLines(tool, maxLines) {
488380
+ const rd = tool.resultDisplay;
488381
+ if (typeof rd === "string") {
488382
+ const lines = rd.split(/\r?\n/);
488383
+ while (lines.length > 0 && (lines[lines.length - 1] ?? "").trim() === "") {
488384
+ lines.pop();
488385
+ }
488386
+ if (lines.length === 0) return [];
488387
+ return lines.slice(Math.max(0, lines.length - maxLines));
488388
+ }
488389
+ if (rd && typeof rd === "object") {
488390
+ const fileName = rd.fileName;
488391
+ if (typeof fileName === "string" && fileName.trim() !== "") {
488392
+ return [`(diff) ${fileName}`];
488393
+ }
488394
+ return ["(diff)"];
488395
+ }
488396
+ return [];
488397
+ }
488398
+ function toolCallsRenderSignature(toolCalls) {
488399
+ let signature = `${toolCalls.length}|`;
488400
+ for (const t3 of toolCalls) {
488401
+ signature += `${t3.callId}:${t3.status}:`;
488402
+ const rd = t3.resultDisplay;
488403
+ if (typeof rd === "string") {
488404
+ signature += `s${rd.length}`;
488405
+ } else if (rd && typeof rd === "object") {
488406
+ const maybeFileDiff = rd.fileDiff;
488407
+ if (typeof maybeFileDiff === "string") {
488408
+ signature += `d${maybeFileDiff.length}`;
488409
+ } else {
488410
+ signature += "o";
488411
+ }
488412
+ } else {
488413
+ signature += "n";
488414
+ }
488415
+ signature += ";";
488416
+ }
488417
+ return signature;
488418
+ }
488060
488419
  var ToolGroupMessage = ({
488061
488420
  toolCalls,
488062
488421
  availableTerminalHeight,
@@ -488064,44 +488423,154 @@ var ToolGroupMessage = ({
488064
488423
  config: config4,
488065
488424
  isFocused = true
488066
488425
  }) => {
488067
- const hasPending = !toolCalls.every(
488426
+ const [renderToolCalls, setRenderToolCalls] = (0, import_react78.useState)(toolCalls);
488427
+ const latestToolCallsRef = (0, import_react78.useRef)(toolCalls);
488428
+ const scheduledFlushRef = (0, import_react78.useRef)(
488429
+ void 0
488430
+ );
488431
+ const lastRenderedSignatureRef = (0, import_react78.useRef)(
488432
+ toolCallsRenderSignature(toolCalls)
488433
+ );
488434
+ const lastRenderedAtRef = (0, import_react78.useRef)(Date.now());
488435
+ const compactDesiredHeightRef = (0, import_react78.useRef)(void 0);
488436
+ const toolCallsSignature = toolCallsRenderSignature(toolCalls);
488437
+ const cadenceMs = renderCadenceMs(toolCalls.length);
488438
+ (0, import_react78.useEffect)(() => {
488439
+ latestToolCallsRef.current = toolCalls;
488440
+ const needsImmediateRender = toolCalls.some(
488441
+ (t3) => t3.status === "Confirming" /* Confirming */
488442
+ );
488443
+ if (needsImmediateRender) {
488444
+ if (scheduledFlushRef.current !== void 0) {
488445
+ clearTimeout(scheduledFlushRef.current);
488446
+ scheduledFlushRef.current = void 0;
488447
+ }
488448
+ lastRenderedSignatureRef.current = toolCallsSignature;
488449
+ lastRenderedAtRef.current = Date.now();
488450
+ setRenderToolCalls([...toolCalls]);
488451
+ return;
488452
+ }
488453
+ if (scheduledFlushRef.current !== void 0) return;
488454
+ scheduledFlushRef.current = setTimeout(() => {
488455
+ scheduledFlushRef.current = void 0;
488456
+ lastRenderedSignatureRef.current = toolCallsRenderSignature(
488457
+ latestToolCallsRef.current
488458
+ );
488459
+ lastRenderedAtRef.current = Date.now();
488460
+ setRenderToolCalls([...latestToolCallsRef.current]);
488461
+ }, cadenceMs);
488462
+ }, [toolCallsSignature, toolCalls, cadenceMs]);
488463
+ (0, import_react78.useEffect)(
488464
+ () => () => {
488465
+ if (scheduledFlushRef.current !== void 0) {
488466
+ clearTimeout(scheduledFlushRef.current);
488467
+ }
488468
+ },
488469
+ []
488470
+ );
488471
+ (0, import_react78.useEffect)(() => {
488472
+ const interval = setInterval(() => {
488473
+ const current = latestToolCallsRef.current;
488474
+ const currentSignature = toolCallsRenderSignature(current);
488475
+ if (currentSignature === lastRenderedSignatureRef.current) return;
488476
+ const now = Date.now();
488477
+ const currentCadence = renderCadenceMs(current.length);
488478
+ if (now - lastRenderedAtRef.current < currentCadence) return;
488479
+ lastRenderedSignatureRef.current = currentSignature;
488480
+ lastRenderedAtRef.current = now;
488481
+ setRenderToolCalls([...current]);
488482
+ const anyConfirming = current.some(
488483
+ (t3) => t3.status === "Confirming" /* Confirming */
488484
+ );
488485
+ const allTerminal = current.every(
488486
+ (t3) => TERMINAL_TOOL_STATUSES.has(t3.status)
488487
+ );
488488
+ if (!anyConfirming && allTerminal) {
488489
+ clearInterval(interval);
488490
+ }
488491
+ }, TOOL_GROUP_TICK_INTERVAL_MS);
488492
+ return () => clearInterval(interval);
488493
+ }, []);
488494
+ const isConfirmingNow = toolCalls.some(
488495
+ (t3) => t3.status === "Confirming" /* Confirming */
488496
+ );
488497
+ const isGroupCompleteNow = toolCalls.every(
488498
+ (t3) => TERMINAL_TOOL_STATUSES.has(t3.status)
488499
+ );
488500
+ const toolCallsForRender = isConfirmingNow || isGroupCompleteNow ? toolCalls : renderToolCalls;
488501
+ const hasPending = !toolCallsForRender.every(
488068
488502
  (t3) => t3.status === "Success" /* Success */
488069
488503
  );
488070
- const isShellCommand = toolCalls.some((t3) => t3.name === SHELL_COMMAND_NAME);
488071
- const borderColor = hasPending || isShellCommand ? Colors.AccentYellow : Colors.Gray;
488072
- const staticHeight = (
488073
- /* border */
488074
- 2 + /* marginBottom */
488075
- 1
488504
+ const isShellCommand = toolCallsForRender.some(
488505
+ (t3) => t3.name === SHELL_COMMAND_NAME
488076
488506
  );
488077
- const innerWidth = terminalWidth - 4;
488507
+ const borderColor = hasPending || isShellCommand ? Colors.AccentYellow : Colors.Gray;
488508
+ const boxChromeHeight = 2;
488078
488509
  const toolAwaitingApproval = (0, import_react78.useMemo)(
488079
- () => toolCalls.find((tc) => tc.status === "Confirming" /* Confirming */),
488080
- [toolCalls]
488510
+ () => toolCallsForRender.find((tc) => tc.status === "Confirming" /* Confirming */),
488511
+ [toolCallsForRender]
488081
488512
  );
488082
- let countToolCallsWithResults = 0;
488083
- for (const tool of toolCalls) {
488084
- if (tool.resultDisplay !== void 0 && tool.resultDisplay !== "") {
488085
- countToolCallsWithResults++;
488086
- }
488087
- }
488088
- const countOneLineToolCalls = toolCalls.length - countToolCallsWithResults;
488089
- const availableTerminalHeightPerToolMessage = availableTerminalHeight ? Math.max(
488513
+ const availableTerminalHeightPerToolMessage = availableTerminalHeight !== void 0 && !isGroupCompleteNow ? Math.max(
488090
488514
  Math.floor(
488091
- (availableTerminalHeight - staticHeight - countOneLineToolCalls) / Math.max(1, countToolCallsWithResults)
488515
+ (availableTerminalHeight - boxChromeHeight) / Math.max(toolCallsForRender.length, 1)
488092
488516
  ),
488093
488517
  1
488094
488518
  ) : void 0;
488519
+ const shouldUseCompactMode = availableTerminalHeight !== void 0 && toolCallsForRender.length > 1 && !isConfirmingNow && !isGroupCompleteNow;
488520
+ const desiredCompactHeight = shouldUseCompactMode && availableTerminalHeight !== void 0 ? (() => {
488521
+ let compactLines = 0;
488522
+ for (const tool of toolCallsForRender) {
488523
+ const preview = toolOutputPreviewLines(
488524
+ tool,
488525
+ COMPACT_TOOL_OUTPUT_PREVIEW_LINES
488526
+ );
488527
+ compactLines += 1 + preview.length;
488528
+ }
488529
+ const candidate = boxChromeHeight + compactLines;
488530
+ if (toolCallsForRender.length > LARGE_TOOL_GROUP_THRESHOLD) {
488531
+ const prev = compactDesiredHeightRef.current;
488532
+ const next = prev === void 0 ? candidate : Math.max(prev, candidate);
488533
+ compactDesiredHeightRef.current = next;
488534
+ return next;
488535
+ }
488536
+ if (compactDesiredHeightRef.current !== void 0) {
488537
+ compactDesiredHeightRef.current = void 0;
488538
+ }
488539
+ return candidate;
488540
+ })() : void 0;
488541
+ if (!shouldUseCompactMode && compactDesiredHeightRef.current !== void 0) {
488542
+ compactDesiredHeightRef.current = void 0;
488543
+ }
488544
+ const isCompactClamped = desiredCompactHeight !== void 0 && availableTerminalHeight !== void 0 && desiredCompactHeight > availableTerminalHeight;
488545
+ const effectiveCompactHeight = desiredCompactHeight !== void 0 && availableTerminalHeight !== void 0 ? Math.min(desiredCompactHeight, availableTerminalHeight) : void 0;
488546
+ const compactMaxHeight = effectiveCompactHeight !== void 0 ? Math.max(effectiveCompactHeight - boxChromeHeight, MINIMUM_MAX_HEIGHT) : void 0;
488547
+ const groupMarginLeft = shouldUseCompactMode && isCompactClamped ? 0 : 1;
488548
+ const innerWidth = terminalWidth - (groupMarginLeft === 1 ? 4 : 3);
488095
488549
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
488096
488550
  Box_default,
488097
488551
  {
488098
488552
  flexDirection: "column",
488099
488553
  borderStyle: "round",
488100
488554
  width: "100%",
488101
- marginLeft: 1,
488555
+ marginLeft: groupMarginLeft,
488102
488556
  borderDimColor: hasPending,
488103
488557
  borderColor,
488104
- children: toolCalls.map((tool) => {
488558
+ height: shouldUseCompactMode ? effectiveCompactHeight : void 0,
488559
+ overflow: shouldUseCompactMode ? "hidden" : void 0,
488560
+ children: shouldUseCompactMode ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MaxSizedBox, { maxHeight: compactMaxHeight, maxWidth: innerWidth, children: toolCallsForRender.flatMap((tool) => {
488561
+ const head = `${statusSymbol(tool.status)} ${tool.name}: ${compactDescription(tool.description)}`;
488562
+ const preview = toolOutputPreviewLines(
488563
+ tool,
488564
+ COMPACT_TOOL_OUTPUT_PREVIEW_LINES
488565
+ );
488566
+ return [
488567
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box_default, { alignItems: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { wrap: "truncate", children: head }) }, `${tool.callId}-h`),
488568
+ ...preview.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box_default, { alignItems: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { color: Colors.Gray, wrap: "truncate", children: [
488569
+ " ",
488570
+ line
488571
+ ] }) }, `${tool.callId}-o-${index}`))
488572
+ ];
488573
+ }) }) : toolCallsForRender.map((tool) => {
488105
488574
  const isConfirming = toolAwaitingApproval?.callId === tool.callId;
488106
488575
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", minHeight: 1, children: [
488107
488576
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -490880,6 +491349,18 @@ var appEvents = new EventEmitter14();
490880
491349
  // packages/cli/src/ui/App.tsx
490881
491350
  var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
490882
491351
  var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
491352
+ function getInputPlaceholder({
491353
+ shellModeActive,
491354
+ vimModeEnabled
491355
+ }) {
491356
+ if (shellModeActive) {
491357
+ return " Shell command only";
491358
+ }
491359
+ if (vimModeEnabled) {
491360
+ return " Press 'i' for INSERT mode and 'Esc' for NORMAL mode.";
491361
+ }
491362
+ return " Type your message or @path/to/file";
491363
+ }
490883
491364
  var AppWrapper = (props) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SessionStatsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VimModeProvider, { settings: props.settings, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(App2, { ...props }) }) });
490884
491365
  var App2 = ({ config: config4, settings, startupWarnings = [], version: version3 }) => {
490885
491366
  const isFocused = useFocus();
@@ -491534,7 +492015,10 @@ var App2 = ({ config: config4, settings, startupWarnings = [], version: version3
491534
492015
  const mainAreaWidth = Math.floor(terminalWidth * 0.9);
491535
492016
  const debugConsoleMaxHeight = Math.floor(Math.max(terminalHeight * 0.2, 5));
491536
492017
  const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
491537
- const placeholder = vimModeEnabled ? " Press 'i' for INSERT mode and 'Esc' for NORMAL mode." : " Type your message or @path/to/file";
492018
+ const placeholder = getInputPlaceholder({
492019
+ shellModeActive,
492020
+ vimModeEnabled
492021
+ });
491538
492022
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Box_default, { flexDirection: "column", width: "90%", children: [
491539
492023
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
491540
492024
  Static,
@@ -506064,6 +506548,195 @@ var RequestError3 = class _RequestError extends Error {
506064
506548
  init_esbuild_polyfill();
506065
506549
  init_strip_ansi();
506066
506550
  init_dist6();
506551
+ function toText(value) {
506552
+ return typeof value === "string" ? value : "";
506553
+ }
506554
+ function toToolStatus(status) {
506555
+ const s3 = typeof status === "string" ? status.toLowerCase() : "";
506556
+ if (s3 === "pending") return "pending";
506557
+ if (s3 === "confirming" || s3 === "executing") return "in_progress";
506558
+ if (s3 === "success") return "completed";
506559
+ if (s3 === "error" || s3 === "canceled" || s3 === "cancelled") return "failed";
506560
+ return "completed";
506561
+ }
506562
+ function toToolKind(kind) {
506563
+ switch (kind) {
506564
+ case "read":
506565
+ case "edit":
506566
+ case "delete":
506567
+ case "move":
506568
+ case "search":
506569
+ case "execute":
506570
+ case "think":
506571
+ case "fetch":
506572
+ case "other":
506573
+ return kind;
506574
+ default:
506575
+ return "other";
506576
+ }
506577
+ }
506578
+ function historyToUiMessages(history) {
506579
+ const out = [];
506580
+ for (const item of history) {
506581
+ switch (item.type) {
506582
+ case "user": {
506583
+ out.push({ role: "user", type: "text", text: toText(item.text) });
506584
+ break;
506585
+ }
506586
+ case "user_shell": {
506587
+ const text = toText(item.text);
506588
+ if (text.trim().length > 0) {
506589
+ out.push({ role: "user", type: "text", text });
506590
+ }
506591
+ break;
506592
+ }
506593
+ case "gemini":
506594
+ case "gemini_content": {
506595
+ out.push({ role: "assistant", type: "text", text: toText(item.text) });
506596
+ break;
506597
+ }
506598
+ case "info": {
506599
+ const text = toText(item.text);
506600
+ if (text.trim().length > 0) {
506601
+ out.push({ role: "assistant", type: "text", text });
506602
+ }
506603
+ break;
506604
+ }
506605
+ case "error": {
506606
+ const text = toText(item.text);
506607
+ if (text.trim().length > 0) {
506608
+ out.push({ role: "assistant", type: "text", text: `Error: ${text}` });
506609
+ }
506610
+ break;
506611
+ }
506612
+ case "tool_group": {
506613
+ const tools = Array.isArray(item.tools) ? item.tools : [];
506614
+ const lines = tools.map((t3) => {
506615
+ const name3 = typeof t3?.name === "string" ? t3.name : "tool";
506616
+ const status = typeof t3?.status === "string" ? t3.status : "";
506617
+ return status ? `- ${name3} (${status})` : `- ${name3}`;
506618
+ }).filter((l2) => l2.trim().length > 0);
506619
+ if (lines.length > 0) {
506620
+ out.push({
506621
+ role: "assistant",
506622
+ type: "text",
506623
+ text: `Tool calls:
506624
+ ${lines.join("\n")}`
506625
+ });
506626
+ }
506627
+ break;
506628
+ }
506629
+ default:
506630
+ break;
506631
+ }
506632
+ }
506633
+ return out.filter((m2) => m2.text.trim().length > 0);
506634
+ }
506635
+ function historyToUiFeedAndTools(history) {
506636
+ const feed = [];
506637
+ const tools = [];
506638
+ for (const item of history) {
506639
+ switch (item.type) {
506640
+ case "user": {
506641
+ const text = toText(item.text);
506642
+ if (text.trim().length > 0) {
506643
+ feed.push({
506644
+ kind: "message",
506645
+ message: { role: "user", type: "text", text }
506646
+ });
506647
+ }
506648
+ break;
506649
+ }
506650
+ case "user_shell": {
506651
+ const text = toText(item.text);
506652
+ if (text.trim().length > 0) {
506653
+ feed.push({
506654
+ kind: "message",
506655
+ message: { role: "user", type: "text", text }
506656
+ });
506657
+ }
506658
+ break;
506659
+ }
506660
+ case "gemini":
506661
+ case "gemini_content": {
506662
+ const text = toText(item.text);
506663
+ if (text.trim().length > 0) {
506664
+ feed.push({
506665
+ kind: "message",
506666
+ message: { role: "assistant", type: "text", text }
506667
+ });
506668
+ }
506669
+ break;
506670
+ }
506671
+ case "info": {
506672
+ const text = toText(item.text);
506673
+ if (text.trim().length > 0) {
506674
+ feed.push({
506675
+ kind: "message",
506676
+ message: { role: "assistant", type: "text", text }
506677
+ });
506678
+ }
506679
+ break;
506680
+ }
506681
+ case "error": {
506682
+ const text = toText(item.text);
506683
+ if (text.trim().length > 0) {
506684
+ feed.push({
506685
+ kind: "message",
506686
+ message: {
506687
+ role: "assistant",
506688
+ type: "text",
506689
+ text: `Error: ${text}`
506690
+ }
506691
+ });
506692
+ }
506693
+ break;
506694
+ }
506695
+ case "tool_group": {
506696
+ const groupTools = Array.isArray(item.tools) ? item.tools : [];
506697
+ for (const t3 of groupTools) {
506698
+ const toolCallId = typeof t3?.callId === "string" && t3.callId.trim().length > 0 ? t3.callId : `tool_${Date.now()}_${Math.random().toString(16).slice(2)}`;
506699
+ const title = typeof t3?.name === "string" ? t3.name : "Tool call";
506700
+ const status = toToolStatus(t3?.status);
506701
+ const kind = toToolKind(t3?.kind);
506702
+ const resultDisplay = typeof t3?.resultDisplay === "string" ? t3.resultDisplay : "";
506703
+ tools.push({
506704
+ toolCallId,
506705
+ title,
506706
+ status,
506707
+ kind,
506708
+ ...resultDisplay.trim().length > 0 ? {
506709
+ content: [
506710
+ {
506711
+ type: "content",
506712
+ content: { type: "text", text: resultDisplay }
506713
+ }
506714
+ ]
506715
+ } : {}
506716
+ });
506717
+ feed.push({ kind: "tool", toolCallId });
506718
+ }
506719
+ break;
506720
+ }
506721
+ default:
506722
+ break;
506723
+ }
506724
+ }
506725
+ return { feed, tools };
506726
+ }
506727
+ function toReplaceHistoryMeta(history) {
506728
+ const { feed, tools } = historyToUiFeedAndTools(history);
506729
+ return {
506730
+ codely: {
506731
+ ui: {
506732
+ action: "replace_history",
506733
+ feed,
506734
+ tools,
506735
+ messages: historyToUiMessages(history)
506736
+ }
506737
+ }
506738
+ };
506739
+ }
506067
506740
  function buildCommandNameList(commands) {
506068
506741
  const seen = /* @__PURE__ */ new Set();
506069
506742
  const names = [];
@@ -506136,6 +506809,54 @@ var AcpSlashCommandRunner = class {
506136
506809
  }
506137
506810
  return available;
506138
506811
  }
506812
+ /**
506813
+ * Returns argument completion candidates for the given raw slash command line.
506814
+ *
506815
+ * Example:
506816
+ * - "/chat resume " -> ["tag1", "tag2", ...]
506817
+ * - "/model use gpt" -> ["gpt-4.1", "gpt-4o", ...]
506818
+ */
506819
+ async complete(rawQuery, signal, maxResults = 20) {
506820
+ const trimmed2 = rawQuery.trimStart();
506821
+ if (!trimmed2.startsWith("/")) return [];
506822
+ await this.ensureCommandsLoaded(signal);
506823
+ const afterSlash = trimmed2.substring(1);
506824
+ const hasTrailingSpace = /\s$/.test(afterSlash);
506825
+ const parts = afterSlash.trim().split(/\s+/).filter(Boolean);
506826
+ if (parts.length === 0) return [];
506827
+ let currentCommands = this.commands;
506828
+ let commandToExecute;
506829
+ let pathIndex = 0;
506830
+ for (const part of parts) {
506831
+ let found = currentCommands.find((cmd) => cmd.name === part);
506832
+ if (!found) {
506833
+ found = currentCommands.find((cmd) => cmd.altNames?.includes(part));
506834
+ }
506835
+ if (!found) break;
506836
+ commandToExecute = found;
506837
+ pathIndex++;
506838
+ if (found.subCommands) {
506839
+ currentCommands = found.subCommands;
506840
+ } else {
506841
+ break;
506842
+ }
506843
+ }
506844
+ if (!commandToExecute?.completion) return [];
506845
+ const argsParts = parts.slice(pathIndex);
506846
+ const fixedArgsParts = hasTrailingSpace ? argsParts : argsParts.slice(0, -1);
506847
+ const partialArg = !hasTrailingSpace && argsParts.length > 0 ? argsParts[argsParts.length - 1] : "";
506848
+ const { context: context2 } = this.createCommandContext(
506849
+ trimmed2,
506850
+ commandToExecute.name,
506851
+ fixedArgsParts.join(" ")
506852
+ );
506853
+ try {
506854
+ const items = await commandToExecute.completion(context2, partialArg);
506855
+ return items.slice(0, maxResults);
506856
+ } catch {
506857
+ return [];
506858
+ }
506859
+ }
506139
506860
  createCommandContext(rawCommand, commandName, args) {
506140
506861
  const collectedOutput = [];
506141
506862
  const gitService = this.config.getProjectRoot() ? new GitService(this.config.getProjectRoot()) : void 0;
@@ -506194,7 +506915,7 @@ var AcpSlashCommandRunner = class {
506194
506915
  getCollectedOutput: () => collectedOutput.join("\n")
506195
506916
  };
506196
506917
  }
506197
- processCommandResult(result) {
506918
+ async processCommandResult(result) {
506198
506919
  switch (result.type) {
506199
506920
  case "message":
506200
506921
  return { handled: true, response: result.content };
@@ -506215,10 +506936,25 @@ Tool execution via slash commands is not supported in ACP mode yet.`
506215
506936
  response: `Dialog "${result.dialog}" is not supported in ACP mode.`
506216
506937
  };
506217
506938
  case "load_history":
506939
+ try {
506940
+ await this.config.getGeminiClient().setHistory(result.clientHistory);
506941
+ } catch (e3) {
506942
+ const msg = e3 instanceof Error ? e3.message : String(e3);
506943
+ return {
506944
+ handled: true,
506945
+ response: `Failed to restore model history: ${msg}`
506946
+ };
506947
+ }
506948
+ return {
506949
+ handled: true,
506950
+ // Keep a small human-readable message for ACP clients that don't support our meta.
506951
+ response: "Conversation restored.",
506952
+ meta: toReplaceHistoryMeta(result.history)
506953
+ };
506218
506954
  case "load_history_with_resume":
506219
506955
  return {
506220
506956
  handled: true,
506221
- response: "History loading is not supported in ACP mode."
506957
+ response: "Use /chat resume to restore conversation history."
506222
506958
  };
506223
506959
  case "confirm_shell_commands":
506224
506960
  case "confirm_action":
@@ -506306,7 +507042,7 @@ Supported commands in ACP mode:
506306
507042
  content: stripAnsi(output)
506307
507043
  };
506308
507044
  }
506309
- const processed = this.processCommandResult(result);
507045
+ const processed = await this.processCommandResult(result);
506310
507046
  if (!processed.handled && processed.forwardToModelText) {
506311
507047
  return {
506312
507048
  handled: false,
@@ -506321,7 +507057,8 @@ Supported commands in ACP mode:
506321
507057
  return {
506322
507058
  handled: true,
506323
507059
  messageType: "info",
506324
- content: finalText
507060
+ content: finalText,
507061
+ ...processed.meta ? { meta: processed.meta } : {}
506325
507062
  };
506326
507063
  } catch (error41) {
506327
507064
  const msg = error41 instanceof Error ? error41.message : String(error41);
@@ -506336,6 +507073,84 @@ Supported commands in ACP mode:
506336
507073
 
506337
507074
  // packages/cli/src/zed-integration/zedIntegration.ts
506338
507075
  import { randomUUID as randomUUID7 } from "crypto";
507076
+
507077
+ // packages/cli/src/zed-integration/autoCompress.ts
507078
+ init_esbuild_polyfill();
507079
+ init_dist6();
507080
+ async function* streamWithAutoCompressAndRetry(options2) {
507081
+ const { createStream, compress, isRetryableError, onRetry } = options2;
507082
+ let alreadyRetried = false;
507083
+ while (true) {
507084
+ let emittedChunk = false;
507085
+ try {
507086
+ const stream4 = await createStream();
507087
+ for await (const event of stream4) {
507088
+ if (event.type === StreamEventType.CHUNK) {
507089
+ emittedChunk = true;
507090
+ }
507091
+ yield event;
507092
+ }
507093
+ return;
507094
+ } catch (error41) {
507095
+ if (alreadyRetried || emittedChunk || !isRetryableError(error41)) {
507096
+ throw error41;
507097
+ }
507098
+ alreadyRetried = true;
507099
+ const didCompress = await compress();
507100
+ if (!didCompress) {
507101
+ throw error41;
507102
+ }
507103
+ if (onRetry) {
507104
+ await onRetry();
507105
+ }
507106
+ yield { type: StreamEventType.RETRY };
507107
+ }
507108
+ }
507109
+ }
507110
+
507111
+ // packages/cli/src/zed-integration/acpTelemetry.ts
507112
+ init_esbuild_polyfill();
507113
+ init_dist6();
507114
+ function extractPromptTextForTelemetry(blocks) {
507115
+ return blocks.filter(
507116
+ (p) => p.type === "text" && typeof p.text === "string"
507117
+ ).map((p) => p.text).join("\n");
507118
+ }
507119
+ function emitAcpUserPromptTelemetry(params) {
507120
+ const prompt = extractPromptTextForTelemetry(params.promptBlocks);
507121
+ logUserPrompt(
507122
+ params.config,
507123
+ new UserPromptEvent(
507124
+ prompt.length,
507125
+ params.promptId,
507126
+ params.authType,
507127
+ prompt
507128
+ )
507129
+ );
507130
+ }
507131
+ function emitAcpApiRequestTelemetry(params) {
507132
+ logApiRequest(
507133
+ params.config,
507134
+ new ApiRequestEvent(params.model, params.promptId)
507135
+ );
507136
+ }
507137
+ function emitAcpApiResponseTelemetry(params) {
507138
+ const responseId = typeof params.responseId === "string" && params.responseId.trim().length > 0 ? params.responseId : `${params.promptId}-${Date.now()}`;
507139
+ logApiResponse(
507140
+ params.config,
507141
+ new ApiResponseEvent(
507142
+ responseId,
507143
+ params.model,
507144
+ params.durationMs,
507145
+ params.promptId,
507146
+ params.authType,
507147
+ params.usageMetadata,
507148
+ params.responseText
507149
+ )
507150
+ );
507151
+ }
507152
+
507153
+ // packages/cli/src/zed-integration/zedIntegration.ts
506339
507154
  function getAcpAuthMethods() {
506340
507155
  if (!process.env.CUSTOM_AUTH) {
506341
507156
  return [
@@ -506618,6 +507433,45 @@ var GeminiAgent = class {
506618
507433
  }
506619
507434
  return session.prompt(params);
506620
507435
  }
507436
+ async extMethod(method, params) {
507437
+ if (method === "workspace/suggest_paths") {
507438
+ const parsed = external_exports.object({
507439
+ sessionId: external_exports.string(),
507440
+ pattern: external_exports.string(),
507441
+ maxResults: external_exports.number().optional()
507442
+ }).safeParse(params);
507443
+ if (!parsed.success) {
507444
+ throw RequestError3.invalidParams(parsed.error.format());
507445
+ }
507446
+ const { sessionId: sessionId2, pattern, maxResults } = parsed.data;
507447
+ const session = this.sessions.get(sessionId2);
507448
+ if (!session) {
507449
+ throw new Error(`Session not found: ${sessionId2}`);
507450
+ }
507451
+ const max = maxResults ?? 20;
507452
+ const paths = await session.suggestPaths(pattern, max);
507453
+ return { paths };
507454
+ }
507455
+ if (method === "slash/complete") {
507456
+ const parsed = external_exports.object({
507457
+ sessionId: external_exports.string(),
507458
+ line: external_exports.string(),
507459
+ maxResults: external_exports.number().optional()
507460
+ }).safeParse(params);
507461
+ if (!parsed.success) {
507462
+ throw RequestError3.invalidParams(parsed.error.format());
507463
+ }
507464
+ const { sessionId: sessionId2, line, maxResults } = parsed.data;
507465
+ const session = this.sessions.get(sessionId2);
507466
+ if (!session) {
507467
+ throw new Error(`Session not found: ${sessionId2}`);
507468
+ }
507469
+ const max = maxResults ?? 20;
507470
+ const items = await session.completeSlash(line, max);
507471
+ return { items };
507472
+ }
507473
+ throw RequestError3.methodNotFound(`_${method}`);
507474
+ }
506621
507475
  };
506622
507476
  var Session2 = class {
506623
507477
  constructor(id, config4, settings, client) {
@@ -506629,9 +507483,41 @@ var Session2 = class {
506629
507483
  }
506630
507484
  pendingPrompt = null;
506631
507485
  slashCommands;
507486
+ fileSearch = null;
506632
507487
  getChat() {
506633
507488
  return this.config.getGeminiClient().getChat();
506634
507489
  }
507490
+ async ensureFileSearch() {
507491
+ if (this.fileSearch) return this.fileSearch;
507492
+ const root = this.config.getTargetDir();
507493
+ const opts = this.config.getFileFilteringOptions?.();
507494
+ const searcher = new FileSearch({
507495
+ projectRoot: root,
507496
+ ignoreDirs: [],
507497
+ useGitignore: opts?.respectGitIgnore ?? true,
507498
+ useGeminiignore: opts?.respectGeminiIgnore ?? true,
507499
+ cache: true,
507500
+ cacheTtl: 30,
507501
+ maxDepth: !(this.config.getEnableRecursiveFileSearch?.() ?? true) ? 0 : void 0
507502
+ });
507503
+ await searcher.initialize();
507504
+ this.fileSearch = searcher;
507505
+ return searcher;
507506
+ }
507507
+ async suggestPaths(pattern, maxResults) {
507508
+ const searcher = await this.ensureFileSearch();
507509
+ const results = await searcher.search(pattern, { maxResults });
507510
+ return results.filter((p) => !/\s/.test(p)).slice(0, maxResults);
507511
+ }
507512
+ async completeSlash(line, maxResults) {
507513
+ const controller = new AbortController();
507514
+ const items = await this.slashCommands.complete(
507515
+ line,
507516
+ controller.signal,
507517
+ maxResults
507518
+ );
507519
+ return items.slice(0, maxResults);
507520
+ }
506635
507521
  async advertiseAvailableCommands() {
506636
507522
  const controller = new AbortController();
506637
507523
  const availableCommands = await this.slashCommands.getAvailableCommands(
@@ -506654,7 +507540,8 @@ var Session2 = class {
506654
507540
  const pendingSend = new AbortController();
506655
507541
  this.pendingPrompt = pendingSend;
506656
507542
  const promptId = Math.random().toString(16).slice(2);
506657
- const chat = this.getChat();
507543
+ const geminiClient = this.config.getGeminiClient();
507544
+ const authType = this.config.getContentGeneratorConfig()?.authType;
506658
507545
  const firstText = params.prompt.find(
506659
507546
  (p) => p.type === "text" && typeof p.text === "string"
506660
507547
  )?.text ?? "";
@@ -506668,7 +507555,8 @@ var Session2 = class {
506668
507555
  const prefix = slashResult.messageType === "error" ? "Error: " : "";
506669
507556
  await this.sendUpdate({
506670
507557
  sessionUpdate: "agent_message_chunk",
506671
- content: { type: "text", text: `${prefix}${slashResult.content}` }
507558
+ content: { type: "text", text: `${prefix}${slashResult.content}` },
507559
+ ...slashResult.meta ? { _meta: slashResult.meta } : {}
506672
507560
  });
506673
507561
  return { stopReason: "end_turn" };
506674
507562
  }
@@ -506688,6 +507576,12 @@ var Session2 = class {
506688
507576
  }
506689
507577
  }
506690
507578
  }
507579
+ emitAcpUserPromptTelemetry({
507580
+ config: this.config,
507581
+ promptId,
507582
+ authType,
507583
+ promptBlocks: promptBlocksForModel
507584
+ });
506691
507585
  const parts = await this.#resolvePrompt(
506692
507586
  promptBlocksForModel,
506693
507587
  pendingSend.signal
@@ -506695,21 +507589,68 @@ var Session2 = class {
506695
507589
  let nextMessage = { role: "user", parts };
506696
507590
  while (nextMessage !== null) {
506697
507591
  if (pendingSend.signal.aborted) {
506698
- chat.addHistory(nextMessage);
507592
+ this.getChat().addHistory(nextMessage);
506699
507593
  return { stopReason: "cancelled" };
506700
507594
  }
506701
507595
  const functionCalls = [];
507596
+ const currentMessageParts = nextMessage.parts ?? [];
506702
507597
  try {
506703
- const responseStream = await chat.sendMessageStream(
506704
- this.config.getModel(),
506705
- {
506706
- message: nextMessage?.parts ?? [],
506707
- config: {
506708
- abortSignal: pendingSend.signal
507598
+ const modelForRequest = this.config.getModel();
507599
+ const requestStartedAt = Date.now();
507600
+ let aggregatedResponseText = "";
507601
+ let usageMetadata;
507602
+ let responseId = "";
507603
+ emitAcpApiRequestTelemetry({
507604
+ config: this.config,
507605
+ promptId,
507606
+ model: modelForRequest
507607
+ });
507608
+ const responseStream = streamWithAutoCompressAndRetry({
507609
+ createStream: async () => {
507610
+ const preCompressed = await geminiClient.tryCompressChat(
507611
+ promptId,
507612
+ false
507613
+ );
507614
+ if (preCompressed && this.config.getDebugMode()) {
507615
+ await this.sendUpdate({
507616
+ sessionUpdate: "agent_thought_chunk",
507617
+ content: {
507618
+ type: "text",
507619
+ text: `[Auto-Compress] Pre-send compression: ${preCompressed.originalTokenCount} \u2192 ${preCompressed.newTokenCount} tokens`
507620
+ }
507621
+ });
506709
507622
  }
507623
+ const chat = this.getChat();
507624
+ return await chat.sendMessageStream(
507625
+ this.config.getModel(),
507626
+ {
507627
+ message: currentMessageParts,
507628
+ config: {
507629
+ abortSignal: pendingSend.signal
507630
+ }
507631
+ },
507632
+ promptId
507633
+ );
506710
507634
  },
506711
- promptId
506712
- );
507635
+ compress: async () => {
507636
+ const compressed = await geminiClient.tryCompressChat(
507637
+ promptId,
507638
+ true
507639
+ );
507640
+ return compressed !== null;
507641
+ },
507642
+ isRetryableError: (error41) => !pendingSend.signal.aborted && isContextWindowExceededError(error41),
507643
+ onRetry: async () => {
507644
+ if (!this.config.getDebugMode()) return;
507645
+ await this.sendUpdate({
507646
+ sessionUpdate: "agent_thought_chunk",
507647
+ content: {
507648
+ type: "text",
507649
+ text: "[Auto-Compress] Context too long; compressed history and retrying."
507650
+ }
507651
+ });
507652
+ }
507653
+ });
506713
507654
  nextMessage = null;
506714
507655
  const thinkTagProcessor2 = new ThinkTagStreamProcessor();
506715
507656
  thinkTagProcessor2.reset();
@@ -506721,6 +507662,14 @@ var Session2 = class {
506721
507662
  continue;
506722
507663
  }
506723
507664
  const resp = event.type === StreamEventType.CHUNK ? event.value : event;
507665
+ const maybeResponseId = resp?.responseId ?? resp?.response_id;
507666
+ if (typeof maybeResponseId === "string" && maybeResponseId) {
507667
+ responseId = maybeResponseId;
507668
+ }
507669
+ const maybeUsage = resp?.usageMetadata;
507670
+ if (maybeUsage && typeof maybeUsage === "object") {
507671
+ usageMetadata = maybeUsage;
507672
+ }
506724
507673
  if (resp.candidates && resp.candidates.length > 0) {
506725
507674
  const candidate = resp.candidates[0];
506726
507675
  const parts2 = candidate.content?.parts ?? [];
@@ -506747,6 +507696,7 @@ var Session2 = class {
506747
507696
  });
506748
507697
  }
506749
507698
  if (content.length > 0) {
507699
+ aggregatedResponseText += content;
506750
507700
  this.sendUpdate({
506751
507701
  sessionUpdate: "agent_message_chunk",
506752
507702
  content: { type: "text", text: content }
@@ -506759,6 +507709,17 @@ var Session2 = class {
506759
507709
  functionCalls.push(...resp.functionCalls);
506760
507710
  }
506761
507711
  }
507712
+ const durationMs = Date.now() - requestStartedAt;
507713
+ emitAcpApiResponseTelemetry({
507714
+ config: this.config,
507715
+ promptId,
507716
+ authType,
507717
+ model: modelForRequest,
507718
+ responseId,
507719
+ durationMs,
507720
+ usageMetadata,
507721
+ responseText: aggregatedResponseText
507722
+ });
506762
507723
  } catch (error41) {
506763
507724
  if (getErrorStatus(error41) === 429) {
506764
507725
  throw new RequestError3(
@@ -506785,10 +507746,10 @@ var Session2 = class {
506785
507746
  } else {
506786
507747
  if (!pendingSend.signal.aborted) {
506787
507748
  try {
506788
- const geminiClient = this.config.getGeminiClient();
507749
+ const geminiClient2 = this.config.getGeminiClient();
506789
507750
  const nextSpeakerCheck = await checkNextSpeaker(
506790
507751
  this.getChat(),
506791
- geminiClient,
507752
+ geminiClient2,
506792
507753
  pendingSend.signal
506793
507754
  );
506794
507755
  logNextSpeakerCheck(
@@ -506980,7 +507941,25 @@ var Session2 = class {
506980
507941
  });
506981
507942
  }
506982
507943
  try {
506983
- const toolResult = await invocation.execute(abortSignal);
507944
+ const updateOutput2 = (output) => {
507945
+ void (async () => {
507946
+ await this.sendUpdate({
507947
+ sessionUpdate: "tool_call_update",
507948
+ toolCallId: callId,
507949
+ status: "in_progress",
507950
+ content: [
507951
+ {
507952
+ type: "content",
507953
+ content: { type: "text", text: output }
507954
+ }
507955
+ ]
507956
+ });
507957
+ })();
507958
+ };
507959
+ const toolResult = await invocation.execute(
507960
+ abortSignal,
507961
+ updateOutput2
507962
+ );
506984
507963
  const content = toToolCallContent(toolResult);
506985
507964
  await this.sendUpdate({
506986
507965
  sessionUpdate: "tool_call_update",