@google/gemini-cli 0.53.0-preview.0 → 0.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/bundle/{chunk-5RDOS7UZ.js → chunk-2NH5AG3B.js} +175 -39
  2. package/bundle/{chunk-PVCJCQWY.js → chunk-2W4AGAXV.js} +1 -1
  3. package/bundle/{chunk-HF533LET.js → chunk-3A32ZSG7.js} +7774 -14246
  4. package/bundle/{chunk-BX6DTJOD.js → chunk-3QXIQPRB.js} +1 -1
  5. package/bundle/{chunk-SLQKIE73.js → chunk-4SJPXUBO.js} +1 -1
  6. package/bundle/{chunk-XH7QC2TB.js → chunk-4TO4ZFXG.js} +2 -2
  7. package/bundle/{chunk-PKFZO3SN.js → chunk-5544MKWC.js} +1 -1
  8. package/bundle/{chunk-27C6XFMY.js → chunk-5Y7N3RFB.js} +198 -42
  9. package/bundle/{chunk-4OVORMGE.js → chunk-AGHZJVUR.js} +1 -1
  10. package/bundle/{chunk-UJVAPQ7V.js → chunk-AT7LBPDZ.js} +1 -1
  11. package/bundle/{chunk-7VUO7T2C.js → chunk-EVNGSSTE.js} +3 -3
  12. package/bundle/{chunk-SXKIOLLX.js → chunk-I2LQOUTQ.js} +7 -7
  13. package/bundle/chunk-IU6WDAMY.js +1571 -0
  14. package/bundle/chunk-JEAU27VO.js +154 -0
  15. package/bundle/chunk-JR6IZCRZ.js +397034 -0
  16. package/bundle/{chunk-WVDR5L2V.js → chunk-KELPZKO5.js} +67 -54
  17. package/bundle/{chunk-PLMRBJEA.js → chunk-KNB5JW7H.js} +2 -2
  18. package/bundle/{chunk-IODN6H35.js → chunk-KUOIDGSH.js} +1 -1
  19. package/bundle/{chunk-UEI42N7R.js → chunk-KW3DD4IB.js} +3 -3
  20. package/bundle/{chunk-BDSSP5BZ.js → chunk-LPTVZ4FJ.js} +1 -1
  21. package/bundle/{chunk-BRZT2CQU.js → chunk-N2KH22XD.js} +1 -1
  22. package/bundle/{chunk-LUM47MYE.js → chunk-N4JX5RHY.js} +1 -1
  23. package/bundle/{chunk-6AD4A2WF.js → chunk-OFMYNLJO.js} +8 -5
  24. package/bundle/chunk-QUZIMBPB.js +102505 -0
  25. package/bundle/{chunk-HVYOZEAP.js → chunk-RDVVXMLN.js} +3 -3
  26. package/bundle/chunk-TAOISOL2.js +118 -0
  27. package/bundle/{chunk-CTNBR234.js → chunk-TIUOC6Z4.js} +2 -2
  28. package/bundle/chunk-UQGV7WFA.js +398 -0
  29. package/bundle/{chunk-GHVD6PXK.js → chunk-VQ5JKD47.js} +9 -8
  30. package/bundle/chunk-XV2XVUWW.js +512 -0
  31. package/bundle/{chunk-QSTUV3QH.js → chunk-YF4RJFUM.js} +7 -7
  32. package/bundle/chunk-ZJENN63T.js +17332 -0
  33. package/bundle/{cleanup-4FVUYQ7H.js → cleanup-CLX27ZSM.js} +2 -2
  34. package/bundle/{cleanup-XETKRH7X.js → cleanup-HE6L3KVJ.js} +2 -2
  35. package/bundle/{cleanup-ZR34H2GU.js → cleanup-QTYIWJJQ.js} +2 -2
  36. package/bundle/cleanup-WQLF5LTO.js +32 -0
  37. package/bundle/{core-PVG4D2MR.js → core-FG5GQN5T.js} +15 -1
  38. package/bundle/{devtoolsService-OUX7PWP3.js → devtoolsService-6MCOO7GD.js} +2 -2
  39. package/bundle/{devtoolsService-IVPTF5ZJ.js → devtoolsService-ALVEJOWU.js} +2 -2
  40. package/bundle/{devtoolsService-QYDPHHFN.js → devtoolsService-LWOTA4XY.js} +4 -3
  41. package/bundle/devtoolsService-NLJPFQBD.js +4359 -0
  42. package/bundle/{dist-PRJQFPSQ.js → dist-FACZYJNK.js} +15 -1
  43. package/bundle/{core-I73XKBPY.js → dist-KYMVPMD2.js} +15 -1
  44. package/bundle/dist-YR3L73K3.js +2168 -0
  45. package/bundle/{gemini-LA6TNI44.js → gemini-2TTBMK7L.js} +84 -20
  46. package/bundle/{gemini-QKB55UV6.js → gemini-EEGDTU6Z.js} +282 -202
  47. package/bundle/{gemini-E2E3U6PR.js → gemini-HMY2YBVR.js} +84 -20
  48. package/bundle/gemini-RNN5D7OL.js +16491 -0
  49. package/bundle/gemini.js +7 -7
  50. package/bundle/{interactiveCli-OD2LO24X.js → interactiveCli-47BG5E33.js} +99 -9
  51. package/bundle/{interactiveCli-ADLAWPXN.js → interactiveCli-HJK54NFF.js} +406 -297
  52. package/bundle/{interactiveCli-FS3OVPXQ.js → interactiveCli-PIOEDBQZ.js} +99 -9
  53. package/bundle/interactiveCli-UQQGETBL.js +34906 -0
  54. package/bundle/{liteRtServerManager-O7PFOUFD.js → liteRtServerManager-BZXTWG2T.js} +4 -4
  55. package/bundle/{liteRtServerManager-T2Z3RLS3.js → liteRtServerManager-ULQCSZ6V.js} +4 -4
  56. package/bundle/{liteRtServerManager-3SKK7MNE.js → liteRtServerManager-YXO26SKL.js} +4 -4
  57. package/bundle/liteRtServerManager-ZN3L6BPO.js +65 -0
  58. package/bundle/{oauth2-provider-Q433RA6I.js → oauth2-provider-G4XOGQD7.js} +1 -1
  59. package/bundle/{oauth2-provider-E3S5DGLL.js → oauth2-provider-H33CP2XJ.js} +1 -1
  60. package/bundle/{oauth2-provider-DFVE3NYF.js → oauth2-provider-KEB5OWVK.js} +38 -72
  61. package/bundle/oauth2-provider-MZRAKSIZ.js +235 -0
  62. package/bundle/{start-5G2UDZZ6.js → start-AOVRZOK6.js} +6 -6
  63. package/bundle/{start-XMJ23QZN.js → start-JQESP66T.js} +6 -6
  64. package/bundle/{start-3FPYJBRX.js → start-KJPOXM4W.js} +6 -6
  65. package/bundle/start-UN2U7AFE.js +18 -0
  66. package/package.json +1 -1
@@ -253529,6 +253529,13 @@ var REFERENCE_CONTENT_END = "--- End of content ---";
253529
253529
  var DEFAULT_MAX_LINES_TEXT_FILE = 2e3;
253530
253530
  var MAX_LINE_LENGTH_TEXT_FILE = 2e3;
253531
253531
  var MAX_FILE_SIZE_MB = 20;
253532
+ var EMPTY_RESPONSE_COMPRESS_SUGGESTION = "The model returned an empty text response. If your context window is near capacity, try using /compress.";
253533
+ var THINKING_ONLY_COMPRESS_SUGGESTION = "The model returned reasoning thoughts but no final response text. If your context window is near capacity, try using /compress.";
253534
+ var MAX_TOKENS_EXCEEDED_SUGGESTION = "Model response was truncated because it exceeded the token limit. Try using /compress to free up context space.";
253535
+ var SAFETY_BLOCKED_MESSAGE = "The model response was blocked due to safety settings.";
253536
+ var RECITATION_BLOCKED_MESSAGE = "The model response was blocked due to recitation/copyright filters.";
253537
+ var OTHER_BLOCKED_MESSAGE = "The model response was blocked due to other policy settings.";
253538
+ var TRUE_EMPTY_RESPONSE_MESSAGE = "The model returned an empty response with no text or thoughts. This may be a transient API issue; please try again.";
253532
253539
 
253533
253540
  // packages/core/dist/src/utils/fileUtils.js
253534
253541
  var requireModule = createModuleRequire(import.meta.url);
@@ -282493,8 +282500,8 @@ function isValidToolName(name3, options = {}) {
282493
282500
  }
282494
282501
 
282495
282502
  // packages/core/dist/src/generated/git-commit.js
282496
- var GIT_COMMIT_INFO = "9681621c6";
282497
- var CLI_VERSION = "0.53.0-preview.0";
282503
+ var GIT_COMMIT_INFO = "983af5d58";
282504
+ var CLI_VERSION = "0.53.1";
282498
282505
 
282499
282506
  // packages/core/dist/src/ide/detect-ide.js
282500
282507
  var IDE_DEFINITIONS = {
@@ -284971,6 +284978,15 @@ var AgentChatHistory = class {
284971
284978
  clear() {
284972
284979
  this.history = [];
284973
284980
  }
284981
+ /**
284982
+ * Rolls back the history to a specified length.
284983
+ * Useful when a stream fails and we need to remove the un-responded turn(s).
284984
+ */
284985
+ rollback(length) {
284986
+ if (length >= 0 && length <= this.history.length) {
284987
+ this.history = this.history.slice(0, length);
284988
+ }
284989
+ }
284974
284990
  get() {
284975
284991
  return this.history;
284976
284992
  }
@@ -285839,7 +285855,8 @@ var createInitialModelMetrics = () => ({
285839
285855
  api: {
285840
285856
  totalRequests: 0,
285841
285857
  totalErrors: 0,
285842
- totalLatencyMs: 0
285858
+ totalLatencyMs: 0,
285859
+ errorsByType: {}
285843
285860
  },
285844
285861
  tokens: {
285845
285862
  input: 0,
@@ -285894,6 +285911,19 @@ var UiTelemetryService = class extends EventEmitter3 {
285894
285911
  lastPromptTokenCount: this.#lastPromptTokenCount
285895
285912
  });
285896
285913
  }
285914
+ recordSemanticValidationError(model, errorType) {
285915
+ const modelMetrics = this.getOrCreateModelMetrics(model);
285916
+ modelMetrics.api.totalErrors++;
285917
+ if (!modelMetrics.api.errorsByType) {
285918
+ modelMetrics.api.errorsByType = {};
285919
+ }
285920
+ const type2 = errorType || "INVALID_STREAM";
285921
+ modelMetrics.api.errorsByType[type2] = (modelMetrics.api.errorsByType[type2] || 0) + 1;
285922
+ this.emit("update", {
285923
+ metrics: this.#metrics,
285924
+ lastPromptTokenCount: this.#lastPromptTokenCount
285925
+ });
285926
+ }
285897
285927
  getMetrics() {
285898
285928
  return this.#metrics;
285899
285929
  }
@@ -286015,6 +286045,11 @@ var UiTelemetryService = class extends EventEmitter3 {
286015
286045
  modelMetrics.api.totalRequests++;
286016
286046
  modelMetrics.api.totalErrors++;
286017
286047
  modelMetrics.api.totalLatencyMs += event.duration_ms;
286048
+ if (!modelMetrics.api.errorsByType) {
286049
+ modelMetrics.api.errorsByType = {};
286050
+ }
286051
+ const errorType = event.error_type || "UNKNOWN";
286052
+ modelMetrics.api.errorsByType[errorType] = (modelMetrics.api.errorsByType[errorType] || 0) + 1;
286018
286053
  if (event.role) {
286019
286054
  if (!modelMetrics.roles[event.role]) {
286020
286055
  modelMetrics.roles[event.role] = createInitialRoleMetrics();
@@ -305675,7 +305710,7 @@ function getVersion() {
305675
305710
  }
305676
305711
  versionPromise = (async () => {
305677
305712
  const pkgJson = await getPackageJson(__dirname4);
305678
- return "0.53.0-preview.0";
305713
+ return "0.53.1";
305679
305714
  })();
305680
305715
  return versionPromise;
305681
305716
  }
@@ -329864,10 +329899,10 @@ import { randomUUID as randomUUID5 } from "node:crypto";
329864
329899
 
329865
329900
  // packages/core/dist/src/utils/messageInspectors.js
329866
329901
  function isFunctionResponse(content) {
329867
- return content.role === "user" && !!content.parts && content.parts.every((part) => !!part.functionResponse);
329902
+ return content.role === "user" && !!content.parts && content.parts.some((part) => !!part.functionResponse);
329868
329903
  }
329869
329904
  function isFunctionCall(content) {
329870
- return content.role === "model" && !!content.parts && content.parts.every((part) => !!part.functionCall);
329905
+ return content.role === "model" && !!content.parts && content.parts.length > 0 && content.parts.every((part) => !!part.functionCall);
329871
329906
  }
329872
329907
 
329873
329908
  // packages/core/dist/src/utils/historyHardening.js
@@ -330387,15 +330422,18 @@ var GeminiChat = class {
330387
330422
  */
330388
330423
  async sendMessageStream(modelConfigKey, message, prompt_id, signal, role, displayContent, apiHistoryOverride) {
330389
330424
  await this.sendPromise;
330425
+ const historyLengthBefore = this.agentHistory.length;
330426
+ const baselinePromptTokenCount = this.lastPromptTokenCount;
330390
330427
  let streamDoneResolver;
330391
330428
  const streamDonePromise = new Promise((resolve29) => {
330392
330429
  streamDoneResolver = resolve29;
330393
330430
  });
330394
330431
  this.sendPromise = streamDonePromise;
330395
330432
  let userContent = createUserContent(message);
330433
+ const isOriginalFunctionResponse = isFunctionResponse(userContent);
330396
330434
  const { model } = this.context.config.modelConfigService.getResolvedConfig(modelConfigKey);
330397
330435
  const isContextManagementEnabled = this.context.config.isContextManagementEnabled();
330398
- if (!isFunctionResponse(userContent)) {
330436
+ if (!isOriginalFunctionResponse) {
330399
330437
  const userMessageParts = userContent.parts || [];
330400
330438
  const userMessageContent = partListUnionToString(userMessageParts);
330401
330439
  let finalDisplayContent = void 0;
@@ -330474,13 +330512,14 @@ var GeminiChat = class {
330474
330512
  const streamWithRetries = async function* () {
330475
330513
  try {
330476
330514
  const maxAttempts = this.context.config.getMaxAttempts();
330515
+ let lastStreamError = void 0;
330477
330516
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
330478
330517
  let isConnectionPhase = true;
330479
330518
  try {
330480
330519
  if (attempt > 0) {
330481
330520
  yield { type: StreamEventType.RETRY };
330482
330521
  }
330483
- const currentConfigKey = attempt > 0 ? { ...modelConfigKey, isRetry: true } : modelConfigKey;
330522
+ const currentConfigKey = attempt > 0 ? { ...modelConfigKey, isRetry: true, lastStreamError } : modelConfigKey;
330484
330523
  isConnectionPhase = true;
330485
330524
  const stream2 = await this.makeApiCallAndProcessStream(currentConfigKey, requestHistory, prompt_id, signal, role, apiHistoryOverride);
330486
330525
  isConnectionPhase = false;
@@ -330489,6 +330528,9 @@ var GeminiChat = class {
330489
330528
  }
330490
330529
  return;
330491
330530
  } catch (error40) {
330531
+ if (error40 instanceof InvalidStreamError) {
330532
+ lastStreamError = error40;
330533
+ }
330492
330534
  if (error40 instanceof AgentExecutionStoppedError) {
330493
330535
  yield {
330494
330536
  type: StreamEventType.AGENT_EXECUTION_STOPPED,
@@ -330514,7 +330556,7 @@ var GeminiChat = class {
330514
330556
  }
330515
330557
  const isRetryable = isRetryableError(error40, this.context.config.getRetryFetchErrors());
330516
330558
  const isContentError = error40 instanceof InvalidStreamError;
330517
- const isRetryableContentError = isContentError && error40.type !== "NO_RESPONSE_TEXT";
330559
+ const isRetryableContentError = isContentError;
330518
330560
  const errorType = isContentError ? error40.type : getRetryErrorType(error40);
330519
330561
  if (isRetryableContentError || isRetryable && !signal.aborted) {
330520
330562
  const maxMidStreamAttempts = MID_STREAM_RETRY_OPTIONS.maxAttempts;
@@ -330543,6 +330585,13 @@ var GeminiChat = class {
330543
330585
  throw error40;
330544
330586
  }
330545
330587
  }
330588
+ } catch (error40) {
330589
+ if (!isOriginalFunctionResponse) {
330590
+ this.agentHistory.rollback(historyLengthBefore);
330591
+ this.chatRecordingService.updateMessagesFromHistory(this.agentHistory.get());
330592
+ this.lastPromptTokenCount = baselinePromptTokenCount;
330593
+ }
330594
+ throw error40;
330546
330595
  } finally {
330547
330596
  streamDoneResolver();
330548
330597
  }
@@ -330601,6 +330650,22 @@ var GeminiChat = class {
330601
330650
  tools: this.tools,
330602
330651
  abortSignal
330603
330652
  };
330653
+ if (modelConfigKey.isRetry && modelConfigKey.lastStreamError instanceof InvalidStreamError) {
330654
+ const lastError = modelConfigKey.lastStreamError;
330655
+ let nudgeMessage = "";
330656
+ if (lastError.type === "THINKING_ONLY_RESPONSE") {
330657
+ nudgeMessage = "\n[System: You previously generated thoughts but failed to provide a final user-facing response. Please ensure you provide your final answer or call a tool now.]";
330658
+ } else if (lastError.type === "NO_RESPONSE_TEXT") {
330659
+ nudgeMessage = "\n[System: You previously returned an empty response with no text or thoughts. Please ensure you provide your final answer or call a tool now.]";
330660
+ }
330661
+ if (nudgeMessage) {
330662
+ if (typeof config2.systemInstruction === "string") {
330663
+ config2.systemInstruction += nudgeMessage;
330664
+ } else if (config2.systemInstruction === void 0) {
330665
+ config2.systemInstruction = nudgeMessage;
330666
+ }
330667
+ }
330668
+ }
330604
330669
  let contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
330605
330670
  const hookSystem = this.context.config.getHookSystem();
330606
330671
  if (hookSystem) {
@@ -330843,6 +330908,8 @@ This error was probably caused by cyclic schema references in one of the followi
330843
330908
  let hasToolCall = false;
330844
330909
  let hasThoughts = false;
330845
330910
  let finishReason;
330911
+ const bufferedThoughts = [];
330912
+ let bufferedUsageMetadata = void 0;
330846
330913
  const finalFunctionCallsMap = /* @__PURE__ */ new Map();
330847
330914
  const legacyFunctionCalls = [];
330848
330915
  const callIndexToId = /* @__PURE__ */ new Map();
@@ -330888,7 +330955,10 @@ This error was probably caused by cyclic schema references in one of the followi
330888
330955
  if (content?.parts) {
330889
330956
  if (content.parts.some((part) => part.thought)) {
330890
330957
  hasThoughts = true;
330891
- this.recordThoughtFromContent(content);
330958
+ const thought = this.extractThoughtFromContent(content);
330959
+ if (thought) {
330960
+ bufferedThoughts.push(thought);
330961
+ }
330892
330962
  }
330893
330963
  if (content.parts.some((part) => part.functionCall)) {
330894
330964
  hasToolCall = true;
@@ -330910,10 +330980,7 @@ This error was probably caused by cyclic schema references in one of the followi
330910
330980
  }
330911
330981
  }
330912
330982
  if (chunk.usageMetadata) {
330913
- this.chatRecordingService.recordMessageTokens(chunk.usageMetadata);
330914
- if (chunk.usageMetadata.promptTokenCount !== void 0) {
330915
- this.lastPromptTokenCount = chunk.usageMetadata.promptTokenCount;
330916
- }
330983
+ bufferedUsageMetadata = chunk.usageMetadata;
330917
330984
  }
330918
330985
  const hookSystem = this.context.config.getHookSystem();
330919
330986
  if (originalRequest && chunk && hookSystem) {
@@ -330969,17 +331036,14 @@ This error was probably caused by cyclic schema references in one of the followi
330969
331036
  }
330970
331037
  }
330971
331038
  }
330972
- const responseText = consolidatedParts.filter((part) => part.text).map((part) => part.text).join("").trim();
330973
- let id;
330974
- if (responseText || hasThoughts || hasToolCall) {
330975
- id = this.chatRecordingService.recordMessage({
330976
- model,
330977
- type: "gemini",
330978
- content: responseText
330979
- });
330980
- } else {
330981
- id = this.chatRecordingService.recordSyntheticMessage("gemini", consolidatedParts);
330982
- }
331039
+ const rawResponseText = consolidatedParts.filter((part) => part.text).map((part) => part.text).join("");
331040
+ let responseText = rawResponseText.replace(/[\u200B-\u200D\uFEFF\u200E\u200F]/g, "");
331041
+ let previous;
331042
+ do {
331043
+ previous = responseText;
331044
+ responseText = responseText.replace(/<!--[\s\S]*?-->/g, "");
331045
+ } while (responseText !== previous);
331046
+ responseText = responseText.trim();
330983
331047
  if (!hasToolCall) {
330984
331048
  if (!finishReason) {
330985
331049
  throw new InvalidStreamError("Model stream ended without a finish reason.", "NO_FINISH_REASON");
@@ -330991,9 +331055,43 @@ This error was probably caused by cyclic schema references in one of the followi
330991
331055
  throw new InvalidStreamError("Model stream ended with unexpected tool call.", "UNEXPECTED_TOOL_CALL");
330992
331056
  }
330993
331057
  if (!responseText) {
331058
+ if (finishReason === FinishReason.MAX_TOKENS) {
331059
+ throw new InvalidStreamError("Model stream ended due to token limit exhaustion (MAX_TOKENS) with empty response text.", "MAX_TOKENS_EXCEEDED");
331060
+ }
331061
+ if (finishReason === FinishReason.SAFETY) {
331062
+ throw new InvalidStreamError("Model stream ended due to safety settings (SAFETY) with empty response text.", "SAFETY_BLOCKED");
331063
+ }
331064
+ if (finishReason === FinishReason.RECITATION) {
331065
+ throw new InvalidStreamError("Model stream ended due to recitation settings (RECITATION) with empty response text.", "RECITATION_BLOCKED");
331066
+ }
331067
+ if (finishReason === FinishReason.OTHER) {
331068
+ throw new InvalidStreamError("Model stream ended due to other settings (OTHER) with empty response text.", "OTHER_BLOCKED");
331069
+ }
331070
+ if (hasThoughts) {
331071
+ throw new InvalidStreamError("Model stream ended with empty response text but contained reasoning thoughts.", "THINKING_ONLY_RESPONSE");
331072
+ }
330994
331073
  throw new InvalidStreamError("Model stream ended with empty response text.", "NO_RESPONSE_TEXT");
330995
331074
  }
330996
331075
  }
331076
+ for (const thought of bufferedThoughts) {
331077
+ this.chatRecordingService.recordThought(thought);
331078
+ }
331079
+ if (bufferedUsageMetadata) {
331080
+ this.chatRecordingService.recordMessageTokens(bufferedUsageMetadata);
331081
+ if (bufferedUsageMetadata.promptTokenCount !== void 0) {
331082
+ this.lastPromptTokenCount = bufferedUsageMetadata.promptTokenCount;
331083
+ }
331084
+ }
331085
+ let id;
331086
+ if (responseText || hasThoughts || hasToolCall) {
331087
+ id = this.chatRecordingService.recordMessage({
331088
+ model,
331089
+ type: "gemini",
331090
+ content: responseText
331091
+ });
331092
+ } else {
331093
+ id = this.chatRecordingService.recordSyntheticMessage("gemini", consolidatedParts);
331094
+ }
330997
331095
  this.agentHistory.push({
330998
331096
  id,
330999
331097
  content: { role: "model", parts: consolidatedParts }
@@ -331031,11 +331129,11 @@ This error was probably caused by cyclic schema references in one of the followi
331031
331129
  this.chatRecordingService.recordToolCalls(model, toolCallRecords);
331032
331130
  }
331033
331131
  /**
331034
- * Extracts and records thought from thought content.
331132
+ * Extracts thought from thought content.
331035
331133
  */
331036
- recordThoughtFromContent(content) {
331134
+ extractThoughtFromContent(content) {
331037
331135
  if (!content.parts || content.parts.length === 0) {
331038
- return;
331136
+ return void 0;
331039
331137
  }
331040
331138
  const thoughtPart = content.parts[0];
331041
331139
  if (thoughtPart.text) {
@@ -331043,11 +331141,12 @@ This error was probably caused by cyclic schema references in one of the followi
331043
331141
  const subjectStringMatches = rawText.match(/\*\*(.*?)\*\*/s);
331044
331142
  const subject = subjectStringMatches ? subjectStringMatches[1].trim() : "";
331045
331143
  const description = rawText.replace(/\*\*(.*?)\*\*/s, "").trim();
331046
- this.chatRecordingService.recordThought({
331144
+ return {
331047
331145
  subject,
331048
331146
  description
331049
- });
331147
+ };
331050
331148
  }
331149
+ return void 0;
331051
331150
  }
331052
331151
  };
331053
331152
  function isSchemaDepthError(errorMessage) {
@@ -331348,7 +331447,13 @@ ${[...this.pendingCitations].sort().join("\n")}`
331348
331447
  return;
331349
331448
  }
331350
331449
  if (e2 instanceof InvalidStreamError) {
331351
- yield { type: GeminiEventType.InvalidStream };
331450
+ yield {
331451
+ type: GeminiEventType.InvalidStream,
331452
+ value: {
331453
+ type: e2.type,
331454
+ message: e2.message
331455
+ }
331456
+ };
331352
331457
  return;
331353
331458
  }
331354
331459
  const error40 = toFriendlyError(e2);
@@ -331694,6 +331799,16 @@ function renderOperationalGuidelines(options) {
331694
331799
  - **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
331695
331800
 
331696
331801
  ## Tool Usage
331802
+ - **Tool Execution Response Rules:**
331803
+ 1. After receiving a \`functionResponse\`, you MUST ALWAYS execute one of the following two actions:
331804
+ a) Call another tool to proceed with the task.
331805
+ b) Provide a user-facing text response explaining the tool output, your analysis, and next steps.
331806
+ 2. You MUST NEVER return an empty response with no text and no tool calls.
331807
+ - **Post-Edit Response Rules:**
331808
+ 1. After an edit tool execution (e.g. ${formatToolName(EDIT_TOOL_NAME)}, ${formatToolName(WRITE_FILE_TOOL_NAME)}), you MUST ALWAYS generate a user-facing text response summarizing:
331809
+ - What changes were made to the file.
331810
+ - Your verification plan or next steps (e.g. running tests).
331811
+ 2. You MUST NEVER return an empty response with 0 text tokens after completing an edit.
331697
331812
  - **Parallelism & Sequencing:** Tools execute in parallel by default. Execute multiple independent tool calls in parallel when feasible (e.g., searching, reading files, independent shell commands, or editing *different* files). If a tool depends on the output or side-effects of a previous tool in the same turn (e.g., running a shell command that depends on the success of a previous command), you MUST set the \`wait_for_previous\` parameter to \`true\` on the dependent tool to ensure sequential execution.
331698
331813
  - **File Editing Collisions:** Do NOT make multiple calls to the ${formatToolName(EDIT_TOOL_NAME)} tool for the SAME file in a single turn. To make multiple edits to the same file, you MUST perform them sequentially across multiple conversational turns to prevent race conditions and ensure the file state is accurate before each edit.
331699
331814
  - **Command Execution:** Use the ${formatToolName(SHELL_TOOL_NAME)} tool for running shell commands, remembering the safety rule to explain modifying commands first.${toolUsageInteractive(options.interactive, options.interactiveShellEnabled)}${toolUsageRememberingFacts(options)}
@@ -338237,7 +338352,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
338237
338352
  return provider;
338238
338353
  }
338239
338354
  case "oauth2": {
338240
- const { OAuth2AuthProvider } = await import("./oauth2-provider-E3S5DGLL.js");
338355
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-MZRAKSIZ.js");
338241
338356
  const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
338242
338357
  await provider.initialize();
338243
338358
  return provider;
@@ -345647,6 +345762,7 @@ var Scheduler = class {
345647
345762
  for (const activeCall of activeCalls) {
345648
345763
  if (!this.isTerminal(activeCall.status)) {
345649
345764
  this.state.updateStatus(activeCall.request.callId, CoreToolCallStatus.Cancelled, "Operation cancelled by user");
345765
+ this.state.finalizeCall(activeCall.request.callId);
345650
345766
  }
345651
345767
  }
345652
345768
  this.state.cancelAllQueued("Operation cancelled by user");
@@ -345761,6 +345877,12 @@ var Scheduler = class {
345761
345877
  */
345762
345878
  async _processNextItem(signal) {
345763
345879
  if (signal.aborted || this.isCancelling) {
345880
+ const activeCalls2 = this.state.allActiveCalls;
345881
+ for (const call of activeCalls2) {
345882
+ if (this.isTerminal(call.status)) {
345883
+ this.state.finalizeCall(call.request.callId);
345884
+ }
345885
+ }
345764
345886
  this.state.cancelAllQueued("Operation cancelled");
345765
345887
  return false;
345766
345888
  }
@@ -386467,8 +386589,13 @@ function translateEvent(event, state) {
386467
386589
  ensureStreamStart(state, out2);
386468
386590
  out2.push(makeEvent("error", state, {
386469
386591
  status: "INTERNAL",
386470
- message: "Invalid stream received from model",
386471
- fatal: true
386592
+ message: event.value?.message?.trim() || "Invalid stream received from model",
386593
+ fatal: true,
386594
+ _meta: {
386595
+ code: "INVALID_STREAM",
386596
+ errorType: event.value?.type,
386597
+ rawMessage: event.value?.message
386598
+ }
386472
386599
  }));
386473
386600
  break;
386474
386601
  case GeminiEventType.ToolCallRequest:
@@ -386727,6 +386854,7 @@ var LegacyAgentProtocol = class {
386727
386854
  return;
386728
386855
  }
386729
386856
  const toolCallRequests = [];
386857
+ let finishedReason = void 0;
386730
386858
  const responseStream = this._client.sendMessageStream(currentParts, this._abortController.signal, this._promptId, void 0, currentDisplayContent);
386731
386859
  currentDisplayContent = void 0;
386732
386860
  for await (const event of responseStream) {
@@ -386745,10 +386873,7 @@ var LegacyAgentProtocol = class {
386745
386873
  this._finishStream("failed");
386746
386874
  return;
386747
386875
  case GeminiEventType.Finished:
386748
- if (toolCallRequests.length === 0) {
386749
- this._finishStream(mapFinishReason(event.value.reason));
386750
- return;
386751
- }
386876
+ finishedReason = event.value.reason;
386752
386877
  break;
386753
386878
  case GeminiEventType.AgentExecutionStopped:
386754
386879
  case GeminiEventType.UserCancelled:
@@ -386764,7 +386889,11 @@ var LegacyAgentProtocol = class {
386764
386889
  return;
386765
386890
  }
386766
386891
  if (toolCallRequests.length === 0) {
386767
- this._finishStream("completed");
386892
+ if (finishedReason !== void 0) {
386893
+ this._finishStream(mapFinishReason(finishedReason));
386894
+ } else {
386895
+ this._finishStream("completed");
386896
+ }
386768
386897
  return;
386769
386898
  }
386770
386899
  const completedToolCalls = await this._scheduler.schedule(toolCallRequests, this._abortController.signal);
@@ -395229,6 +395358,13 @@ export {
395229
395358
  DEFAULT_MAX_LINES_TEXT_FILE,
395230
395359
  MAX_LINE_LENGTH_TEXT_FILE,
395231
395360
  MAX_FILE_SIZE_MB,
395361
+ EMPTY_RESPONSE_COMPRESS_SUGGESTION,
395362
+ THINKING_ONLY_COMPRESS_SUGGESTION,
395363
+ MAX_TOKENS_EXCEEDED_SUGGESTION,
395364
+ SAFETY_BLOCKED_MESSAGE,
395365
+ RECITATION_BLOCKED_MESSAGE,
395366
+ OTHER_BLOCKED_MESSAGE,
395367
+ TRUE_EMPTY_RESPONSE_MESSAGE,
395232
395368
  readWasmBinaryFromDisk,
395233
395369
  loadWasmBinary,
395234
395370
  DEFAULT_ENCODING,
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-HF533LET.js";
8
+ } from "./chunk-3A32ZSG7.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";