@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
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-5RDOS7UZ.js";
8
+ } from "./chunk-5Y7N3RFB.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";
@@ -1,7 +1,7 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  runExitCleanup
4
- } from "./chunk-PVCJCQWY.js";
4
+ } from "./chunk-3QXIQPRB.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -1,13 +1,13 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  runExitCleanup
4
- } from "./chunk-PKFZO3SN.js";
4
+ } from "./chunk-2W4AGAXV.js";
5
5
  import {
6
6
  RELEASE_CHANNEL_STABILITY,
7
7
  debugLogger,
8
8
  getChannelFromVersion,
9
9
  isGitRepository
10
- } from "./chunk-27C6XFMY.js";
10
+ } from "./chunk-3A32ZSG7.js";
11
11
 
12
12
  // packages/cli/src/utils/installationInfo.ts
13
13
  import * as fs from "node:fs";
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-27C6XFMY.js";
8
+ } from "./chunk-2NH5AG3B.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";
@@ -253597,6 +253597,13 @@ var REFERENCE_CONTENT_END = "--- End of content ---";
253597
253597
  var DEFAULT_MAX_LINES_TEXT_FILE = 2e3;
253598
253598
  var MAX_LINE_LENGTH_TEXT_FILE = 2e3;
253599
253599
  var MAX_FILE_SIZE_MB = 20;
253600
+ var EMPTY_RESPONSE_COMPRESS_SUGGESTION = "The model returned an empty text response. If your context window is near capacity, try using /compress.";
253601
+ 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.";
253602
+ var MAX_TOKENS_EXCEEDED_SUGGESTION = "Model response was truncated because it exceeded the token limit. Try using /compress to free up context space.";
253603
+ var SAFETY_BLOCKED_MESSAGE = "The model response was blocked due to safety settings.";
253604
+ var RECITATION_BLOCKED_MESSAGE = "The model response was blocked due to recitation/copyright filters.";
253605
+ var OTHER_BLOCKED_MESSAGE = "The model response was blocked due to other policy settings.";
253606
+ 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.";
253600
253607
 
253601
253608
  // packages/core/src/utils/fileUtils.ts
253602
253609
  var requireModule = createModuleRequire(import.meta.url);
@@ -282763,8 +282770,8 @@ function isValidToolName(name3, options = {}) {
282763
282770
  }
282764
282771
 
282765
282772
  // packages/core/src/generated/git-commit.ts
282766
- var GIT_COMMIT_INFO = "9681621c6";
282767
- var CLI_VERSION = "0.52.0-nightly.20260715.gfa975395b";
282773
+ var GIT_COMMIT_INFO = "983af5d58";
282774
+ var CLI_VERSION = "0.53.0";
282768
282775
 
282769
282776
  // packages/core/src/ide/detect-ide.ts
282770
282777
  var IDE_DEFINITIONS = {
@@ -285298,6 +285305,15 @@ var AgentChatHistory = class {
285298
285305
  clear() {
285299
285306
  this.history = [];
285300
285307
  }
285308
+ /**
285309
+ * Rolls back the history to a specified length.
285310
+ * Useful when a stream fails and we need to remove the un-responded turn(s).
285311
+ */
285312
+ rollback(length) {
285313
+ if (length >= 0 && length <= this.history.length) {
285314
+ this.history = this.history.slice(0, length);
285315
+ }
285316
+ }
285301
285317
  get() {
285302
285318
  return this.history;
285303
285319
  }
@@ -286210,7 +286226,8 @@ var createInitialModelMetrics = () => ({
286210
286226
  api: {
286211
286227
  totalRequests: 0,
286212
286228
  totalErrors: 0,
286213
- totalLatencyMs: 0
286229
+ totalLatencyMs: 0,
286230
+ errorsByType: {}
286214
286231
  },
286215
286232
  tokens: {
286216
286233
  input: 0,
@@ -286265,6 +286282,19 @@ var UiTelemetryService = class extends EventEmitter3 {
286265
286282
  lastPromptTokenCount: this.#lastPromptTokenCount
286266
286283
  });
286267
286284
  }
286285
+ recordSemanticValidationError(model, errorType) {
286286
+ const modelMetrics = this.getOrCreateModelMetrics(model);
286287
+ modelMetrics.api.totalErrors++;
286288
+ if (!modelMetrics.api.errorsByType) {
286289
+ modelMetrics.api.errorsByType = {};
286290
+ }
286291
+ const type2 = errorType || "INVALID_STREAM";
286292
+ modelMetrics.api.errorsByType[type2] = (modelMetrics.api.errorsByType[type2] || 0) + 1;
286293
+ this.emit("update", {
286294
+ metrics: this.#metrics,
286295
+ lastPromptTokenCount: this.#lastPromptTokenCount
286296
+ });
286297
+ }
286268
286298
  getMetrics() {
286269
286299
  return this.#metrics;
286270
286300
  }
@@ -286395,6 +286425,11 @@ var UiTelemetryService = class extends EventEmitter3 {
286395
286425
  modelMetrics.api.totalRequests++;
286396
286426
  modelMetrics.api.totalErrors++;
286397
286427
  modelMetrics.api.totalLatencyMs += event.duration_ms;
286428
+ if (!modelMetrics.api.errorsByType) {
286429
+ modelMetrics.api.errorsByType = {};
286430
+ }
286431
+ const errorType = event.error_type || "UNKNOWN";
286432
+ modelMetrics.api.errorsByType[errorType] = (modelMetrics.api.errorsByType[errorType] || 0) + 1;
286398
286433
  if (event.role) {
286399
286434
  if (!modelMetrics.roles[event.role]) {
286400
286435
  modelMetrics.roles[event.role] = createInitialRoleMetrics();
@@ -306258,7 +306293,7 @@ function getVersion() {
306258
306293
  }
306259
306294
  versionPromise = (async () => {
306260
306295
  const pkgJson = await getPackageJson(__dirname4);
306261
- return "0.52.0-nightly.20260715.gfa975395b";
306296
+ return "0.53.0";
306262
306297
  })();
306263
306298
  return versionPromise;
306264
306299
  }
@@ -332085,10 +332120,10 @@ import { randomUUID as randomUUID5 } from "node:crypto";
332085
332120
 
332086
332121
  // packages/core/src/utils/messageInspectors.ts
332087
332122
  function isFunctionResponse(content) {
332088
- return content.role === "user" && !!content.parts && content.parts.every((part) => !!part.functionResponse);
332123
+ return content.role === "user" && !!content.parts && content.parts.some((part) => !!part.functionResponse);
332089
332124
  }
332090
332125
  function isFunctionCall(content) {
332091
- return content.role === "model" && !!content.parts && content.parts.every((part) => !!part.functionCall);
332126
+ return content.role === "model" && !!content.parts && content.parts.length > 0 && content.parts.every((part) => !!part.functionCall);
332092
332127
  }
332093
332128
 
332094
332129
  // packages/core/src/utils/historyHardening.ts
@@ -332621,15 +332656,18 @@ var GeminiChat = class {
332621
332656
  */
332622
332657
  async sendMessageStream(modelConfigKey, message, prompt_id, signal, role, displayContent, apiHistoryOverride) {
332623
332658
  await this.sendPromise;
332659
+ const historyLengthBefore = this.agentHistory.length;
332660
+ const baselinePromptTokenCount = this.lastPromptTokenCount;
332624
332661
  let streamDoneResolver;
332625
332662
  const streamDonePromise = new Promise((resolve29) => {
332626
332663
  streamDoneResolver = resolve29;
332627
332664
  });
332628
332665
  this.sendPromise = streamDonePromise;
332629
332666
  let userContent = createUserContent(message);
332667
+ const isOriginalFunctionResponse = isFunctionResponse(userContent);
332630
332668
  const { model } = this.context.config.modelConfigService.getResolvedConfig(modelConfigKey);
332631
332669
  const isContextManagementEnabled = this.context.config.isContextManagementEnabled();
332632
- if (!isFunctionResponse(userContent)) {
332670
+ if (!isOriginalFunctionResponse) {
332633
332671
  const userMessageParts = userContent.parts || [];
332634
332672
  const userMessageContent = partListUnionToString(userMessageParts);
332635
332673
  let finalDisplayContent = void 0;
@@ -332719,13 +332757,14 @@ var GeminiChat = class {
332719
332757
  const streamWithRetries = async function* () {
332720
332758
  try {
332721
332759
  const maxAttempts = this.context.config.getMaxAttempts();
332760
+ let lastStreamError = void 0;
332722
332761
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
332723
332762
  let isConnectionPhase = true;
332724
332763
  try {
332725
332764
  if (attempt > 0) {
332726
332765
  yield { type: "retry" /* RETRY */ };
332727
332766
  }
332728
- const currentConfigKey = attempt > 0 ? { ...modelConfigKey, isRetry: true } : modelConfigKey;
332767
+ const currentConfigKey = attempt > 0 ? { ...modelConfigKey, isRetry: true, lastStreamError } : modelConfigKey;
332729
332768
  isConnectionPhase = true;
332730
332769
  const stream2 = await this.makeApiCallAndProcessStream(
332731
332770
  currentConfigKey,
@@ -332741,6 +332780,9 @@ var GeminiChat = class {
332741
332780
  }
332742
332781
  return;
332743
332782
  } catch (error40) {
332783
+ if (error40 instanceof InvalidStreamError) {
332784
+ lastStreamError = error40;
332785
+ }
332744
332786
  if (error40 instanceof AgentExecutionStoppedError) {
332745
332787
  yield {
332746
332788
  type: "agent_execution_stopped" /* AGENT_EXECUTION_STOPPED */,
@@ -332769,7 +332811,7 @@ var GeminiChat = class {
332769
332811
  this.context.config.getRetryFetchErrors()
332770
332812
  );
332771
332813
  const isContentError = error40 instanceof InvalidStreamError;
332772
- const isRetryableContentError = isContentError && error40.type !== "NO_RESPONSE_TEXT";
332814
+ const isRetryableContentError = isContentError;
332773
332815
  const errorType = isContentError ? error40.type : getRetryErrorType(error40);
332774
332816
  if (isRetryableContentError || isRetryable && !signal.aborted) {
332775
332817
  const maxMidStreamAttempts = MID_STREAM_RETRY_OPTIONS.maxAttempts;
@@ -332813,6 +332855,15 @@ var GeminiChat = class {
332813
332855
  throw error40;
332814
332856
  }
332815
332857
  }
332858
+ } catch (error40) {
332859
+ if (!isOriginalFunctionResponse) {
332860
+ this.agentHistory.rollback(historyLengthBefore);
332861
+ this.chatRecordingService.updateMessagesFromHistory(
332862
+ this.agentHistory.get()
332863
+ );
332864
+ this.lastPromptTokenCount = baselinePromptTokenCount;
332865
+ }
332866
+ throw error40;
332816
332867
  } finally {
332817
332868
  streamDoneResolver();
332818
332869
  }
@@ -332892,6 +332943,22 @@ var GeminiChat = class {
332892
332943
  tools: this.tools,
332893
332944
  abortSignal
332894
332945
  };
332946
+ if (modelConfigKey.isRetry && modelConfigKey.lastStreamError instanceof InvalidStreamError) {
332947
+ const lastError = modelConfigKey.lastStreamError;
332948
+ let nudgeMessage = "";
332949
+ if (lastError.type === "THINKING_ONLY_RESPONSE") {
332950
+ 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.]";
332951
+ } else if (lastError.type === "NO_RESPONSE_TEXT") {
332952
+ 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.]";
332953
+ }
332954
+ if (nudgeMessage) {
332955
+ if (typeof config2.systemInstruction === "string") {
332956
+ config2.systemInstruction += nudgeMessage;
332957
+ } else if (config2.systemInstruction === void 0) {
332958
+ config2.systemInstruction = nudgeMessage;
332959
+ }
332960
+ }
332961
+ }
332895
332962
  let contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
332896
332963
  const hookSystem = this.context.config.getHookSystem();
332897
332964
  if (hookSystem) {
@@ -333168,6 +333235,8 @@ This error was probably caused by cyclic schema references in one of the followi
333168
333235
  let hasToolCall = false;
333169
333236
  let hasThoughts = false;
333170
333237
  let finishReason;
333238
+ const bufferedThoughts = [];
333239
+ let bufferedUsageMetadata = void 0;
333171
333240
  const finalFunctionCallsMap = /* @__PURE__ */ new Map();
333172
333241
  const legacyFunctionCalls = [];
333173
333242
  const callIndexToId = /* @__PURE__ */ new Map();
@@ -333215,7 +333284,10 @@ This error was probably caused by cyclic schema references in one of the followi
333215
333284
  if (content?.parts) {
333216
333285
  if (content.parts.some((part) => part.thought)) {
333217
333286
  hasThoughts = true;
333218
- this.recordThoughtFromContent(content);
333287
+ const thought = this.extractThoughtFromContent(content);
333288
+ if (thought) {
333289
+ bufferedThoughts.push(thought);
333290
+ }
333219
333291
  }
333220
333292
  if (content.parts.some((part) => part.functionCall)) {
333221
333293
  hasToolCall = true;
@@ -333239,10 +333311,7 @@ This error was probably caused by cyclic schema references in one of the followi
333239
333311
  }
333240
333312
  }
333241
333313
  if (chunk.usageMetadata) {
333242
- this.chatRecordingService.recordMessageTokens(chunk.usageMetadata);
333243
- if (chunk.usageMetadata.promptTokenCount !== void 0) {
333244
- this.lastPromptTokenCount = chunk.usageMetadata.promptTokenCount;
333245
- }
333314
+ bufferedUsageMetadata = chunk.usageMetadata;
333246
333315
  }
333247
333316
  const hookSystem = this.context.config.getHookSystem();
333248
333317
  if (originalRequest && chunk && hookSystem) {
@@ -333306,20 +333375,17 @@ This error was probably caused by cyclic schema references in one of the followi
333306
333375
  }
333307
333376
  }
333308
333377
  }
333309
- const responseText = consolidatedParts.filter((part) => part.text).map((part) => part.text).join("").trim();
333310
- let id;
333311
- if (responseText || hasThoughts || hasToolCall) {
333312
- id = this.chatRecordingService.recordMessage({
333313
- model,
333314
- type: "gemini",
333315
- content: responseText
333316
- });
333317
- } else {
333318
- id = this.chatRecordingService.recordSyntheticMessage(
333319
- "gemini",
333320
- consolidatedParts
333321
- );
333322
- }
333378
+ const rawResponseText = consolidatedParts.filter((part) => part.text).map((part) => part.text).join("");
333379
+ let responseText = rawResponseText.replace(
333380
+ /[\u200B-\u200D\uFEFF\u200E\u200F]/g,
333381
+ ""
333382
+ );
333383
+ let previous;
333384
+ do {
333385
+ previous = responseText;
333386
+ responseText = responseText.replace(/<!--[\s\S]*?-->/g, "");
333387
+ } while (responseText !== previous);
333388
+ responseText = responseText.trim();
333323
333389
  if (!hasToolCall) {
333324
333390
  if (!finishReason) {
333325
333391
  throw new InvalidStreamError(
@@ -333340,12 +333406,64 @@ This error was probably caused by cyclic schema references in one of the followi
333340
333406
  );
333341
333407
  }
333342
333408
  if (!responseText) {
333409
+ if (finishReason === FinishReason.MAX_TOKENS) {
333410
+ throw new InvalidStreamError(
333411
+ "Model stream ended due to token limit exhaustion (MAX_TOKENS) with empty response text.",
333412
+ "MAX_TOKENS_EXCEEDED"
333413
+ );
333414
+ }
333415
+ if (finishReason === FinishReason.SAFETY) {
333416
+ throw new InvalidStreamError(
333417
+ "Model stream ended due to safety settings (SAFETY) with empty response text.",
333418
+ "SAFETY_BLOCKED"
333419
+ );
333420
+ }
333421
+ if (finishReason === FinishReason.RECITATION) {
333422
+ throw new InvalidStreamError(
333423
+ "Model stream ended due to recitation settings (RECITATION) with empty response text.",
333424
+ "RECITATION_BLOCKED"
333425
+ );
333426
+ }
333427
+ if (finishReason === FinishReason.OTHER) {
333428
+ throw new InvalidStreamError(
333429
+ "Model stream ended due to other settings (OTHER) with empty response text.",
333430
+ "OTHER_BLOCKED"
333431
+ );
333432
+ }
333433
+ if (hasThoughts) {
333434
+ throw new InvalidStreamError(
333435
+ "Model stream ended with empty response text but contained reasoning thoughts.",
333436
+ "THINKING_ONLY_RESPONSE"
333437
+ );
333438
+ }
333343
333439
  throw new InvalidStreamError(
333344
333440
  "Model stream ended with empty response text.",
333345
333441
  "NO_RESPONSE_TEXT"
333346
333442
  );
333347
333443
  }
333348
333444
  }
333445
+ for (const thought of bufferedThoughts) {
333446
+ this.chatRecordingService.recordThought(thought);
333447
+ }
333448
+ if (bufferedUsageMetadata) {
333449
+ this.chatRecordingService.recordMessageTokens(bufferedUsageMetadata);
333450
+ if (bufferedUsageMetadata.promptTokenCount !== void 0) {
333451
+ this.lastPromptTokenCount = bufferedUsageMetadata.promptTokenCount;
333452
+ }
333453
+ }
333454
+ let id;
333455
+ if (responseText || hasThoughts || hasToolCall) {
333456
+ id = this.chatRecordingService.recordMessage({
333457
+ model,
333458
+ type: "gemini",
333459
+ content: responseText
333460
+ });
333461
+ } else {
333462
+ id = this.chatRecordingService.recordSyntheticMessage(
333463
+ "gemini",
333464
+ consolidatedParts
333465
+ );
333466
+ }
333349
333467
  this.agentHistory.push({
333350
333468
  id,
333351
333469
  content: { role: "model", parts: consolidatedParts }
@@ -333383,11 +333501,11 @@ This error was probably caused by cyclic schema references in one of the followi
333383
333501
  this.chatRecordingService.recordToolCalls(model, toolCallRecords);
333384
333502
  }
333385
333503
  /**
333386
- * Extracts and records thought from thought content.
333504
+ * Extracts thought from thought content.
333387
333505
  */
333388
- recordThoughtFromContent(content) {
333506
+ extractThoughtFromContent(content) {
333389
333507
  if (!content.parts || content.parts.length === 0) {
333390
- return;
333508
+ return void 0;
333391
333509
  }
333392
333510
  const thoughtPart = content.parts[0];
333393
333511
  if (thoughtPart.text) {
@@ -333395,11 +333513,12 @@ This error was probably caused by cyclic schema references in one of the followi
333395
333513
  const subjectStringMatches = rawText.match(/\*\*(.*?)\*\*/s);
333396
333514
  const subject = subjectStringMatches ? subjectStringMatches[1].trim() : "";
333397
333515
  const description = rawText.replace(/\*\*(.*?)\*\*/s, "").trim();
333398
- this.chatRecordingService.recordThought({
333516
+ return {
333399
333517
  subject,
333400
333518
  description
333401
- });
333519
+ };
333402
333520
  }
333521
+ return void 0;
333403
333522
  }
333404
333523
  };
333405
333524
  function isSchemaDepthError(errorMessage) {
@@ -333721,7 +333840,13 @@ ${[...this.pendingCitations].sort().join("\n")}`
333721
333840
  return;
333722
333841
  }
333723
333842
  if (e2 instanceof InvalidStreamError) {
333724
- yield { type: "invalid_stream" /* InvalidStream */ };
333843
+ yield {
333844
+ type: "invalid_stream" /* InvalidStream */,
333845
+ value: {
333846
+ type: e2.type,
333847
+ message: e2.message
333848
+ }
333849
+ };
333725
333850
  return;
333726
333851
  }
333727
333852
  const error40 = toFriendlyError(e2);
@@ -334068,6 +334193,16 @@ function renderOperationalGuidelines(options) {
334068
334193
  - **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
334069
334194
 
334070
334195
  ## Tool Usage
334196
+ - **Tool Execution Response Rules:**
334197
+ 1. After receiving a \`functionResponse\`, you MUST ALWAYS execute one of the following two actions:
334198
+ a) Call another tool to proceed with the task.
334199
+ b) Provide a user-facing text response explaining the tool output, your analysis, and next steps.
334200
+ 2. You MUST NEVER return an empty response with no text and no tool calls.
334201
+ - **Post-Edit Response Rules:**
334202
+ 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:
334203
+ - What changes were made to the file.
334204
+ - Your verification plan or next steps (e.g. running tests).
334205
+ 2. You MUST NEVER return an empty response with 0 text tokens after completing an edit.
334071
334206
  - **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.
334072
334207
  - **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.
334073
334208
  - **Command Execution:** Use the ${formatToolName(SHELL_TOOL_NAME)} tool for running shell commands, remembering the safety rule to explain modifying commands first.${toolUsageInteractive(
@@ -340877,7 +341012,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
340877
341012
  return provider;
340878
341013
  }
340879
341014
  case "oauth2": {
340880
- const { OAuth2AuthProvider } = await import("./oauth2-provider-DFVE3NYF.js");
341015
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-G4XOGQD7.js");
340881
341016
  const provider = new OAuth2AuthProvider(
340882
341017
  authConfig,
340883
341018
  options.agentName ?? "unknown",
@@ -349214,6 +349349,7 @@ var Scheduler = class {
349214
349349
  "cancelled" /* Cancelled */,
349215
349350
  "Operation cancelled by user"
349216
349351
  );
349352
+ this.state.finalizeCall(activeCall.request.callId);
349217
349353
  }
349218
349354
  }
349219
349355
  this.state.cancelAllQueued("Operation cancelled by user");
@@ -349343,6 +349479,12 @@ var Scheduler = class {
349343
349479
  */
349344
349480
  async _processNextItem(signal) {
349345
349481
  if (signal.aborted || this.isCancelling) {
349482
+ const activeCalls2 = this.state.allActiveCalls;
349483
+ for (const call of activeCalls2) {
349484
+ if (this.isTerminal(call.status)) {
349485
+ this.state.finalizeCall(call.request.callId);
349486
+ }
349487
+ }
349346
349488
  this.state.cancelAllQueued("Operation cancelled");
349347
349489
  return false;
349348
349490
  }
@@ -392926,8 +393068,13 @@ function translateEvent(event, state) {
392926
393068
  out2.push(
392927
393069
  makeEvent("error", state, {
392928
393070
  status: "INTERNAL",
392929
- message: "Invalid stream received from model",
392930
- fatal: true
393071
+ message: event.value?.message?.trim() || "Invalid stream received from model",
393072
+ fatal: true,
393073
+ _meta: {
393074
+ code: "INVALID_STREAM",
393075
+ errorType: event.value?.type,
393076
+ rawMessage: event.value?.message
393077
+ }
392931
393078
  })
392932
393079
  );
392933
393080
  break;
@@ -393199,6 +393346,7 @@ var LegacyAgentProtocol = class {
393199
393346
  return;
393200
393347
  }
393201
393348
  const toolCallRequests = [];
393349
+ let finishedReason = void 0;
393202
393350
  const responseStream = this._client.sendMessageStream(
393203
393351
  currentParts,
393204
393352
  this._abortController.signal,
@@ -393223,10 +393371,7 @@ var LegacyAgentProtocol = class {
393223
393371
  this._finishStream("failed");
393224
393372
  return;
393225
393373
  case "finished" /* Finished */:
393226
- if (toolCallRequests.length === 0) {
393227
- this._finishStream(mapFinishReason(event.value.reason));
393228
- return;
393229
- }
393374
+ finishedReason = event.value.reason;
393230
393375
  break;
393231
393376
  case "agent_execution_stopped" /* AgentExecutionStopped */:
393232
393377
  case "user_cancelled" /* UserCancelled */:
@@ -393242,7 +393387,11 @@ var LegacyAgentProtocol = class {
393242
393387
  return;
393243
393388
  }
393244
393389
  if (toolCallRequests.length === 0) {
393245
- this._finishStream("completed");
393390
+ if (finishedReason !== void 0) {
393391
+ this._finishStream(mapFinishReason(finishedReason));
393392
+ } else {
393393
+ this._finishStream("completed");
393394
+ }
393246
393395
  return;
393247
393396
  }
393248
393397
  const completedToolCalls = await this._scheduler.schedule(
@@ -401837,6 +401986,13 @@ export {
401837
401986
  DEFAULT_MAX_LINES_TEXT_FILE,
401838
401987
  MAX_LINE_LENGTH_TEXT_FILE,
401839
401988
  MAX_FILE_SIZE_MB,
401989
+ EMPTY_RESPONSE_COMPRESS_SUGGESTION,
401990
+ THINKING_ONLY_COMPRESS_SUGGESTION,
401991
+ MAX_TOKENS_EXCEEDED_SUGGESTION,
401992
+ SAFETY_BLOCKED_MESSAGE,
401993
+ RECITATION_BLOCKED_MESSAGE,
401994
+ OTHER_BLOCKED_MESSAGE,
401995
+ TRUE_EMPTY_RESPONSE_MESSAGE,
401840
401996
  readWasmBinaryFromDisk,
401841
401997
  loadWasmBinary,
401842
401998
  DEFAULT_ENCODING,
@@ -1,7 +1,7 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  runExitCleanup
4
- } from "./chunk-PKFZO3SN.js";
4
+ } from "./chunk-5544MKWC.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -1,7 +1,7 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  runExitCleanup
4
- } from "./chunk-BX6DTJOD.js";
4
+ } from "./chunk-JEAU27VO.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-UJVAPQ7V.js";
5
+ } from "./chunk-4SJPXUBO.js";
6
6
  import {
7
7
  DEFAULT_PORT,
8
8
  SERVER_START_WAIT_MS,
@@ -14,10 +14,10 @@ import {
14
14
  isServerRunning,
15
15
  resolveGemmaConfig,
16
16
  writeServerProcessInfo
17
- } from "./chunk-LUM47MYE.js";
17
+ } from "./chunk-KUOIDGSH.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-5RDOS7UZ.js";
20
+ } from "./chunk-5Y7N3RFB.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-UJVAPQ7V.js";
5
+ } from "./chunk-IU6WDAMY.js";
6
6
  import {
7
7
  AppEvent,
8
8
  appEvents
@@ -59,14 +59,14 @@ import {
59
59
  stripUnsafeCharacters,
60
60
  toCodePoints,
61
61
  validateCustomTheme
62
- } from "./chunk-LUM47MYE.js";
62
+ } from "./chunk-N4JX5RHY.js";
63
63
  import {
64
64
  isDevelopment
65
- } from "./chunk-PLMRBJEA.js";
65
+ } from "./chunk-4TO4ZFXG.js";
66
66
  import {
67
67
  emptyIcon,
68
68
  require_react
69
- } from "./chunk-BRZT2CQU.js";
69
+ } from "./chunk-VQ5JKD47.js";
70
70
  import {
71
71
  ALL_EDITORS,
72
72
  ApprovalMode,
@@ -243,7 +243,7 @@ import {
243
243
  tokenLimit,
244
244
  uiTelemetryService,
245
245
  unescapePath
246
- } from "./chunk-5RDOS7UZ.js";
246
+ } from "./chunk-3A32ZSG7.js";
247
247
  import {
248
248
  require_src
249
249
  } from "./chunk-TUDYL3X4.js";
@@ -77176,7 +77176,7 @@ var authCommand = {
77176
77176
  import process29 from "node:process";
77177
77177
 
77178
77178
  // packages/cli/src/generated/git-commit.ts
77179
- var GIT_COMMIT_INFO = "02abfab45";
77179
+ var GIT_COMMIT_INFO = "983af5d58";
77180
77180
 
77181
77181
  // packages/cli/src/ui/utils/historyExportUtils.ts
77182
77182
  import * as fsPromises from "node:fs/promises";
@@ -82957,7 +82957,7 @@ Use /mcp auth <server-name> to authenticate.`
82957
82957
  type: "info",
82958
82958
  text: `Starting OAuth authentication for MCP server '${serverName}'...`
82959
82959
  });
82960
- const { MCPOAuthProvider } = await import("./dist-PRJQFPSQ.js");
82960
+ const { MCPOAuthProvider } = await import("./dist-KYMVPMD2.js");
82961
82961
  let oauthConfig = server.oauth;
82962
82962
  if (!oauthConfig) {
82963
82963
  oauthConfig = { enabled: false };