@google/gemini-cli 0.57.0-preview.0 → 0.57.0

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 (50) hide show
  1. package/bundle/{chunk-XDJMDRLM.js → chunk-4H4K2RBL.js} +3 -3
  2. package/bundle/{chunk-2UICYJMD.js → chunk-7HKQGPWB.js} +108 -22
  3. package/bundle/{chunk-2UGGPOEV.js → chunk-7IKUWYZO.js} +1 -1
  4. package/bundle/{chunk-IKGOC5B6.js → chunk-7ZGWPQVZ.js} +1 -1
  5. package/bundle/{chunk-NXS624CI.js → chunk-AOE6E7MU.js} +2 -2
  6. package/bundle/{chunk-73OHVDUZ.js → chunk-ASZFEU6C.js} +7 -7
  7. package/bundle/{chunk-FWGOOSQK.js → chunk-DFPYJMVX.js} +114 -22
  8. package/bundle/{chunk-ZY7Z5W6K.js → chunk-FVC4WCSP.js} +1 -1
  9. package/bundle/{chunk-ACDZS2RE.js → chunk-FYAMITQ2.js} +1 -1
  10. package/bundle/{chunk-QVDXZMEX.js → chunk-GAROUUGQ.js} +1 -1
  11. package/bundle/{chunk-OFFEM74O.js → chunk-GAS2GAYB.js} +1 -1
  12. package/bundle/{chunk-WH63Z45A.js → chunk-GPOBVDAD.js} +1 -1
  13. package/bundle/{chunk-EBKNEOAO.js → chunk-HY6GN2F7.js} +1 -1
  14. package/bundle/{chunk-HKTHSWSS.js → chunk-IKHAM2LG.js} +7 -7
  15. package/bundle/{chunk-O3QB4SVS.js → chunk-ISXOUBN5.js} +2 -2
  16. package/bundle/{chunk-W4CY7TCG.js → chunk-LQJHQ4BU.js} +2 -2
  17. package/bundle/{chunk-H2URGA7U.js → chunk-MNBBUQQS.js} +3 -3
  18. package/bundle/{chunk-6S4UF4JM.js → chunk-O7TOZUUB.js} +3 -3
  19. package/bundle/{chunk-3C6JYNPC.js → chunk-QJ33O2NH.js} +7 -7
  20. package/bundle/{chunk-M6E5CLIH.js → chunk-RLDNVR77.js} +1 -1
  21. package/bundle/{chunk-R3JDAZVL.js → chunk-S3MXVTTY.js} +114 -22
  22. package/bundle/{chunk-QB46S6FV.js → chunk-TAWZWX2B.js} +1 -1
  23. package/bundle/{chunk-SHIJDXMN.js → chunk-XG56CL6B.js} +1 -1
  24. package/bundle/{chunk-XZF4EZOQ.js → chunk-YW7SDLZQ.js} +1 -1
  25. package/bundle/{cleanup-JP2FD3CQ.js → cleanup-2HUWGXK6.js} +2 -2
  26. package/bundle/{cleanup-YFIFTNZ6.js → cleanup-7N2HFE2E.js} +2 -2
  27. package/bundle/{cleanup-Z65H2CUW.js → cleanup-DA7OSZS5.js} +2 -2
  28. package/bundle/{core-UBOS4Q6R.js → core-2NMRPWUN.js} +7 -1
  29. package/bundle/{dist-B7OLK6PK.js → core-CFPIDJ4Z.js} +7 -1
  30. package/bundle/{devtoolsService-A34WT2MQ.js → devtoolsService-7YYOUGVF.js} +2 -2
  31. package/bundle/{devtoolsService-BHG3WQEY.js → devtoolsService-VQSLUOYF.js} +2 -2
  32. package/bundle/{devtoolsService-ACKZ7HRR.js → devtoolsService-WMEEEXY6.js} +2 -2
  33. package/bundle/{core-EKXLT2AG.js → dist-AMP5W5P2.js} +7 -1
  34. package/bundle/{gemini-NJXFBFVJ.js → gemini-5LF4JAP7.js} +14 -14
  35. package/bundle/{gemini-7Z3ODIIX.js → gemini-OYYGXMHL.js} +14 -14
  36. package/bundle/{gemini-3U3DNSSI.js → gemini-PSRJNVY5.js} +14 -14
  37. package/bundle/gemini.js +7 -7
  38. package/bundle/{interactiveCli-LMXAWUCU.js → interactiveCli-5E2C3XOC.js} +40 -18
  39. package/bundle/{interactiveCli-FIWFPOOG.js → interactiveCli-5O6FZS57.js} +40 -18
  40. package/bundle/{interactiveCli-DNV4GCM5.js → interactiveCli-PP7WTUZL.js} +40 -18
  41. package/bundle/{liteRtServerManager-P62A6ZVG.js → liteRtServerManager-5QBFCLBK.js} +4 -4
  42. package/bundle/{liteRtServerManager-VBKDVKLU.js → liteRtServerManager-LK6HOSMO.js} +4 -4
  43. package/bundle/{liteRtServerManager-LQMOE7JK.js → liteRtServerManager-ZPDALIDY.js} +4 -4
  44. package/bundle/{oauth2-provider-FWKP5A4D.js → oauth2-provider-BGMEA7RS.js} +1 -1
  45. package/bundle/{oauth2-provider-BKNKX6FS.js → oauth2-provider-BYKBBEKI.js} +1 -1
  46. package/bundle/{oauth2-provider-UPRM4Y2J.js → oauth2-provider-CO22I6UM.js} +1 -1
  47. package/bundle/{start-DG3DHS3K.js → start-JRTTCV3K.js} +6 -6
  48. package/bundle/{start-Y2JKSYXK.js → start-KH6WSP5C.js} +6 -6
  49. package/bundle/{start-BMBCT2CF.js → start-O6LWZY6K.js} +6 -6
  50. package/package.json +1 -1
@@ -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-XZF4EZOQ.js";
5
+ } from "./chunk-FYAMITQ2.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-QVDXZMEX.js";
17
+ } from "./chunk-GAROUUGQ.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-2UICYJMD.js";
20
+ } from "./chunk-7HKQGPWB.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";
@@ -282559,8 +282559,8 @@ function isValidToolName(name3, options = {}) {
282559
282559
  }
282560
282560
 
282561
282561
  // packages/core/dist/src/generated/git-commit.js
282562
- var GIT_COMMIT_INFO = "eaa30429a";
282563
- var CLI_VERSION = "0.57.0-preview.0";
282562
+ var GIT_COMMIT_INFO = "1110ce8bc";
282563
+ var CLI_VERSION = "0.57.0";
282564
282564
 
282565
282565
  // packages/core/dist/src/ide/detect-ide.js
282566
282566
  var IDE_DEFINITIONS = {
@@ -305854,7 +305854,7 @@ function getVersion() {
305854
305854
  }
305855
305855
  versionPromise = (async () => {
305856
305856
  const pkgJson = await getPackageJson(__dirname4);
305857
- return "0.57.0-preview.0";
305857
+ return "0.57.0";
305858
305858
  })();
305859
305859
  return versionPromise;
305860
305860
  }
@@ -308120,8 +308120,8 @@ function getErrorReplaceResult(params, occurrences, finalOldString, finalNewStri
308120
308120
  let error40 = void 0;
308121
308121
  if (occurrences === 0) {
308122
308122
  error40 = {
308123
- display: `Failed to edit, could not find the string to replace.`,
308124
- raw: `Failed to edit, 0 occurrences found for old_string in ${params.file_path}. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${READ_FILE_TOOL_NAME} tool to verify.`,
308123
+ display: `Could not find an exact match for old_string in '${params.file_path}'.`,
308124
+ raw: `Could not find an exact match for 'old_string' in '${params.file_path}'. If previous edits modified the file or you are modifying lines outside your recent read window, please use ReadFile to inspect the target lines before retrying with an exact 'old_string'.`,
308125
308125
  type: ToolErrorType.EDIT_NO_OCCURRENCE_FOUND
308126
308126
  };
308127
308127
  } else if (!params.allow_multiple && occurrences !== 1) {
@@ -308197,6 +308197,20 @@ var EditToolInvocation = class extends BaseToolInvocation {
308197
308197
  };
308198
308198
  }
308199
308199
  async attemptSelfCorrection(params, currentContent, initialError, abortSignal, originalLineEnding) {
308200
+ if (!params.old_string || params.old_string.trim() === "") {
308201
+ return {
308202
+ currentContent,
308203
+ newContent: currentContent,
308204
+ occurrences: 0,
308205
+ isNewFile: false,
308206
+ error: {
308207
+ display: "Edit failed: 'old_string' cannot be empty.",
308208
+ raw: "The 'old_string' parameter is required. The Edit tool performs localized search-and-replace. If you are modifying a section of the file you have not viewed recently, call ReadFile on the target line range to inspect the current code, then provide the exact matching lines in 'old_string'.",
308209
+ type: ToolErrorType.INVALID_TOOL_PARAMS
308210
+ },
308211
+ originalLineEnding
308212
+ };
308213
+ }
308200
308214
  let errorForLlmEditFixer = initialError.raw;
308201
308215
  let contentForLlmEditFixer = currentContent;
308202
308216
  const initialContentHash = hashContent(currentContent);
@@ -308535,7 +308549,7 @@ ${snippet2}`);
308535
308549
  llmSuccessMessageParts.push(fuzzyFeedback);
308536
308550
  }
308537
308551
  if (this.params.modified_by_user) {
308538
- llmSuccessMessageParts.push(`User modified the \`new_string\` content to be: ${this.params.new_string}.`);
308552
+ llmSuccessMessageParts.push(`The confirmation step modified the \`new_string\` content to be: ${this.params.new_string}.`);
308539
308553
  }
308540
308554
  const jitContext = await discoverJitContext(this.config, this.resolvedPath);
308541
308555
  let llmContent = llmSuccessMessageParts.join(" ");
@@ -330568,6 +330582,46 @@ function extractCuratedHistory2(comprehensiveHistory) {
330568
330582
  }
330569
330583
  return curatedHistory;
330570
330584
  }
330585
+ var THINKING_ONLY_NUDGE_MESSAGE = "[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.]";
330586
+ var NO_RESPONSE_TEXT_NUDGE_MESSAGE = "[System: You previously returned an empty response with no text or thoughts. Please ensure you provide your final answer or call a tool now.]";
330587
+ function applyRetryNudge(contents, nudgeMessage) {
330588
+ if (!nudgeMessage) {
330589
+ return contents;
330590
+ }
330591
+ const lastTurn = contents[contents.length - 1];
330592
+ const hasNudge = lastTurn?.parts?.some((p) => p.text?.includes(nudgeMessage));
330593
+ if (hasNudge) {
330594
+ return contents;
330595
+ }
330596
+ const cloned = contents.map((c4) => ({
330597
+ ...c4,
330598
+ parts: c4.parts ? [...c4.parts] : []
330599
+ }));
330600
+ const clonedLastTurn = cloned[cloned.length - 1];
330601
+ const hasFunctionResponse = clonedLastTurn?.parts?.some((p) => p.functionResponse);
330602
+ if (clonedLastTurn?.role === "user" && hasFunctionResponse) {
330603
+ cloned.push({
330604
+ role: "model",
330605
+ parts: [{ text: "[Tool execution completed.]" }]
330606
+ });
330607
+ cloned.push({
330608
+ role: "user",
330609
+ parts: [{ text: nudgeMessage }]
330610
+ });
330611
+ } else if (clonedLastTurn?.role === "user") {
330612
+ if (!clonedLastTurn.parts) {
330613
+ clonedLastTurn.parts = [];
330614
+ }
330615
+ clonedLastTurn.parts.push({ text: `
330616
+ ${nudgeMessage}` });
330617
+ } else {
330618
+ cloned.push({
330619
+ role: "user",
330620
+ parts: [{ text: nudgeMessage }]
330621
+ });
330622
+ }
330623
+ return cloned;
330624
+ }
330571
330625
  var InvalidStreamError = class extends Error {
330572
330626
  type;
330573
330627
  constructor(message, type2) {
@@ -330956,23 +331010,19 @@ var GeminiChat = class {
330956
331010
  tools: this.tools,
330957
331011
  abortSignal
330958
331012
  };
331013
+ let nudgeMessage = "";
330959
331014
  if (modelConfigKey.isRetry && modelConfigKey.lastStreamError instanceof InvalidStreamError) {
330960
331015
  const lastError = modelConfigKey.lastStreamError;
330961
- let nudgeMessage = "";
330962
331016
  if (lastError.type === "THINKING_ONLY_RESPONSE") {
330963
- 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.]";
331017
+ nudgeMessage = THINKING_ONLY_NUDGE_MESSAGE;
330964
331018
  } else if (lastError.type === "NO_RESPONSE_TEXT") {
330965
- 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.]";
330966
- }
330967
- if (nudgeMessage) {
330968
- if (typeof config2.systemInstruction === "string") {
330969
- config2.systemInstruction += nudgeMessage;
330970
- } else if (config2.systemInstruction === void 0) {
330971
- config2.systemInstruction = nudgeMessage;
330972
- }
331019
+ nudgeMessage = NO_RESPONSE_TEXT_NUDGE_MESSAGE;
330973
331020
  }
330974
331021
  }
330975
331022
  let contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
331023
+ if (nudgeMessage) {
331024
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
331025
+ }
330976
331026
  const hookSystem = this.context.config.getHookSystem();
330977
331027
  if (hookSystem) {
330978
331028
  const beforeModelResult = await hookSystem.fireBeforeModelEvent({
@@ -330996,12 +331046,18 @@ var GeminiChat = class {
330996
331046
  modelToUse = resolveModel(beforeModelResult.modifiedModel, useGemini3_1, false, hasAccessToPreview, this.context.config, this.context.config.hasGemini35FlashGAAccess?.() ?? false);
330997
331047
  lastModelToUse = modelToUse;
330998
331048
  contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
331049
+ if (nudgeMessage) {
331050
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
331051
+ }
330999
331052
  }
331000
331053
  if (beforeModelResult.modifiedConfig) {
331001
331054
  Object.assign(config2, beforeModelResult.modifiedConfig);
331002
331055
  }
331003
331056
  if (beforeModelResult.modifiedContents && Array.isArray(beforeModelResult.modifiedContents)) {
331004
331057
  contentsToUse = beforeModelResult.modifiedContents;
331058
+ if (nudgeMessage) {
331059
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
331060
+ }
331005
331061
  }
331006
331062
  const toolSelectionResult = await hookSystem.fireBeforeToolSelectionEvent({
331007
331063
  model: modelToUse,
@@ -331473,9 +331529,8 @@ function isInvalidArgumentError(errorMessage) {
331473
331529
  return errorMessage.includes("Request contains an invalid argument");
331474
331530
  }
331475
331531
  function stripToolCallIdPrefixes(contents) {
331476
- return contents.map((content) => ({
331477
- ...content,
331478
- parts: (content.parts || []).map((part) => {
331532
+ return contents.map((content) => {
331533
+ const parts2 = (content.parts || []).map((part) => {
331479
331534
  const newPart = { ...part };
331480
331535
  if (newPart.functionCall) {
331481
331536
  const fc = newPart.functionCall;
@@ -331499,9 +331554,23 @@ function stripToolCallIdPrefixes(contents) {
331499
331554
  };
331500
331555
  }
331501
331556
  }
331557
+ const hasOtherKeys = Object.keys(newPart).some((key) => key !== "text" && key !== "thought" && key !== "callIndex" && newPart[key] !== void 0);
331558
+ if (newPart.text !== void 0 && newPart.text === "" && hasOtherKeys) {
331559
+ delete newPart.text;
331560
+ }
331502
331561
  return newPart;
331503
- })
331504
- }));
331562
+ }).filter((part) => {
331563
+ const hasOtherKeys = Object.keys(part).some((key) => key !== "text" && key !== "thought" && key !== "callIndex" && part[key] !== void 0);
331564
+ if (part.text !== void 0 && part.text === "" && !hasOtherKeys) {
331565
+ return false;
331566
+ }
331567
+ return true;
331568
+ });
331569
+ return {
331570
+ ...content,
331571
+ parts: parts2
331572
+ };
331573
+ });
331505
331574
  }
331506
331575
  function coalesceConsecutiveRoles(history) {
331507
331576
  const result2 = [];
@@ -338716,7 +338785,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
338716
338785
  return provider;
338717
338786
  }
338718
338787
  case "oauth2": {
338719
- const { OAuth2AuthProvider } = await import("./oauth2-provider-BKNKX6FS.js");
338788
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-BYKBBEKI.js");
338720
338789
  const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
338721
338790
  await provider.initialize();
338722
338791
  return provider;
@@ -387316,6 +387385,7 @@ var LegacyAgentProtocol = class {
387316
387385
  let currentDisplayContent = initialDisplayContent;
387317
387386
  let turnCount = 0;
387318
387387
  const maxTurns = this._config.getMaxSessionTurns();
387388
+ let isAfterToolResponse = false;
387319
387389
  while (true) {
387320
387390
  turnCount++;
387321
387391
  if (maxTurns >= 0 && turnCount > maxTurns) {
@@ -387328,6 +387398,7 @@ var LegacyAgentProtocol = class {
387328
387398
  }
387329
387399
  const toolCallRequests = [];
387330
387400
  let finishedReason = void 0;
387401
+ let hasVisibleText = false;
387331
387402
  const responseStream = this._client.sendMessageStream(currentParts, this._abortController.signal, this._promptId, void 0, currentDisplayContent);
387332
387403
  currentDisplayContent = void 0;
387333
387404
  for await (const event of responseStream) {
@@ -387338,6 +387409,11 @@ var LegacyAgentProtocol = class {
387338
387409
  if (event.type === GeminiEventType.ToolCallRequest) {
387339
387410
  toolCallRequests.push(event.value);
387340
387411
  }
387412
+ if (event.type === GeminiEventType.Content) {
387413
+ if (typeof event.value === "string" && event.value.trim() !== "") {
387414
+ hasVisibleText = true;
387415
+ }
387416
+ }
387341
387417
  this._emit(translateEvent(event, this._translationState));
387342
387418
  switch (event.type) {
387343
387419
  case GeminiEventType.Error:
@@ -387362,6 +387438,12 @@ var LegacyAgentProtocol = class {
387362
387438
  return;
387363
387439
  }
387364
387440
  if (toolCallRequests.length === 0) {
387441
+ if (isAfterToolResponse && !hasVisibleText) {
387442
+ const nudgeMessage = "[System: You successfully executed a tool but returned an empty response. Please analyze the tool output and explain your progress or final answer.]";
387443
+ currentParts = [{ text: nudgeMessage }];
387444
+ isAfterToolResponse = false;
387445
+ continue;
387446
+ }
387365
387447
  if (finishedReason !== void 0) {
387366
387448
  this._finishStream(mapFinishReason(finishedReason));
387367
387449
  } else {
@@ -387419,6 +387501,7 @@ var LegacyAgentProtocol = class {
387419
387501
  return;
387420
387502
  }
387421
387503
  currentParts = toolResponseParts;
387504
+ isAfterToolResponse = completedToolCalls.length > 0;
387422
387505
  }
387423
387506
  }
387424
387507
  _emit(events) {
@@ -396547,6 +396630,9 @@ export {
396547
396630
  SYNTHETIC_THOUGHT_SIGNATURE2 as SYNTHETIC_THOUGHT_SIGNATURE,
396548
396631
  INTERRUPTED_RESPONSE_PLACEHOLDER,
396549
396632
  isValidNonThoughtTextPart,
396633
+ THINKING_ONLY_NUDGE_MESSAGE,
396634
+ NO_RESPONSE_TEXT_NUDGE_MESSAGE,
396635
+ applyRetryNudge,
396550
396636
  InvalidStreamError,
396551
396637
  AgentExecutionStoppedError,
396552
396638
  AgentExecutionBlockedError,
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-R3JDAZVL.js";
8
+ } from "./chunk-S3MXVTTY.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";
@@ -28,7 +28,7 @@ import {
28
28
  partListUnionToString,
29
29
  require_strip_json_comments,
30
30
  sanitizeFilenamePart
31
- } from "./chunk-FWGOOSQK.js";
31
+ } from "./chunk-S3MXVTTY.js";
32
32
  import {
33
33
  __commonJS,
34
34
  __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-OFFEM74O.js";
4
+ } from "./chunk-7IKUWYZO.js";
5
5
  import {
6
6
  RELEASE_CHANNEL_STABILITY,
7
7
  debugLogger,
8
8
  getChannelFromVersion,
9
9
  isGitRepository
10
- } from "./chunk-FWGOOSQK.js";
10
+ } from "./chunk-S3MXVTTY.js";
11
11
 
12
12
  // packages/cli/src/utils/installationInfo.ts
13
13
  import * as fs from "node:fs";
@@ -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-XZF4EZOQ.js";
5
+ } from "./chunk-FYAMITQ2.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-QVDXZMEX.js";
62
+ } from "./chunk-GAROUUGQ.js";
63
63
  import {
64
64
  isDevelopment
65
- } from "./chunk-O3QB4SVS.js";
65
+ } from "./chunk-LQJHQ4BU.js";
66
66
  import {
67
67
  emptyIcon,
68
68
  require_react
69
- } from "./chunk-SHIJDXMN.js";
69
+ } from "./chunk-XG56CL6B.js";
70
70
  import {
71
71
  ALL_EDITORS,
72
72
  ApprovalMode,
@@ -244,7 +244,7 @@ import {
244
244
  tokenLimit,
245
245
  uiTelemetryService,
246
246
  unescapePath
247
- } from "./chunk-2UICYJMD.js";
247
+ } from "./chunk-7HKQGPWB.js";
248
248
  import {
249
249
  require_src
250
250
  } from "./chunk-TUDYL3X4.js";
@@ -77177,7 +77177,7 @@ var authCommand = {
77177
77177
  import process29 from "node:process";
77178
77178
 
77179
77179
  // packages/cli/src/generated/git-commit.ts
77180
- var GIT_COMMIT_INFO = "fad162661";
77180
+ var GIT_COMMIT_INFO = "6b0ae9a6c";
77181
77181
 
77182
77182
  // packages/cli/src/ui/utils/historyExportUtils.ts
77183
77183
  import * as fsPromises from "node:fs/promises";
@@ -82958,7 +82958,7 @@ Use /mcp auth <server-name> to authenticate.`
82958
82958
  type: "info",
82959
82959
  text: `Starting OAuth authentication for MCP server '${serverName}'...`
82960
82960
  });
82961
- const { MCPOAuthProvider } = await import("./dist-B7OLK6PK.js");
82961
+ const { MCPOAuthProvider } = await import("./dist-AMP5W5P2.js");
82962
82962
  let oauthConfig = server.oauth;
82963
82963
  if (!oauthConfig) {
82964
82964
  oauthConfig = { enabled: false };
@@ -282830,8 +282830,8 @@ function isValidToolName(name3, options = {}) {
282830
282830
  }
282831
282831
 
282832
282832
  // packages/core/src/generated/git-commit.ts
282833
- var GIT_COMMIT_INFO = "eaa30429a";
282834
- var CLI_VERSION = "0.57.0-preview.0";
282833
+ var GIT_COMMIT_INFO = "1110ce8bc";
282834
+ var CLI_VERSION = "0.57.0-preview.1";
282835
282835
 
282836
282836
  // packages/core/src/ide/detect-ide.ts
282837
282837
  var IDE_DEFINITIONS = {
@@ -306451,7 +306451,7 @@ function getVersion() {
306451
306451
  }
306452
306452
  versionPromise = (async () => {
306453
306453
  const pkgJson = await getPackageJson(__dirname4);
306454
- return "0.57.0-preview.0";
306454
+ return "0.57.0-preview.1";
306455
306455
  })();
306456
306456
  return versionPromise;
306457
306457
  }
@@ -309081,8 +309081,8 @@ function getErrorReplaceResult(params, occurrences, finalOldString, finalNewStri
309081
309081
  let error40 = void 0;
309082
309082
  if (occurrences === 0) {
309083
309083
  error40 = {
309084
- display: `Failed to edit, could not find the string to replace.`,
309085
- raw: `Failed to edit, 0 occurrences found for old_string in ${params.file_path}. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${READ_FILE_TOOL_NAME} tool to verify.`,
309084
+ display: `Could not find an exact match for old_string in '${params.file_path}'.`,
309085
+ raw: `Could not find an exact match for 'old_string' in '${params.file_path}'. If previous edits modified the file or you are modifying lines outside your recent read window, please use ReadFile to inspect the target lines before retrying with an exact 'old_string'.`,
309086
309086
  type: "edit_no_occurrence_found" /* EDIT_NO_OCCURRENCE_FOUND */
309087
309087
  };
309088
309088
  } else if (!params.allow_multiple && occurrences !== 1) {
@@ -309181,6 +309181,20 @@ var EditToolInvocation = class extends BaseToolInvocation {
309181
309181
  };
309182
309182
  }
309183
309183
  async attemptSelfCorrection(params, currentContent, initialError, abortSignal, originalLineEnding) {
309184
+ if (!params.old_string || params.old_string.trim() === "") {
309185
+ return {
309186
+ currentContent,
309187
+ newContent: currentContent,
309188
+ occurrences: 0,
309189
+ isNewFile: false,
309190
+ error: {
309191
+ display: "Edit failed: 'old_string' cannot be empty.",
309192
+ raw: "The 'old_string' parameter is required. The Edit tool performs localized search-and-replace. If you are modifying a section of the file you have not viewed recently, call ReadFile on the target line range to inspect the current code, then provide the exact matching lines in 'old_string'.",
309193
+ type: "invalid_tool_params" /* INVALID_TOOL_PARAMS */
309194
+ },
309195
+ originalLineEnding
309196
+ };
309197
+ }
309184
309198
  let errorForLlmEditFixer = initialError.raw;
309185
309199
  let contentForLlmEditFixer = currentContent;
309186
309200
  const initialContentHash = hashContent(currentContent);
@@ -309565,7 +309579,7 @@ ${snippet2}`);
309565
309579
  }
309566
309580
  if (this.params.modified_by_user) {
309567
309581
  llmSuccessMessageParts.push(
309568
- `User modified the \`new_string\` content to be: ${this.params.new_string}.`
309582
+ `The confirmation step modified the \`new_string\` content to be: ${this.params.new_string}.`
309569
309583
  );
309570
309584
  }
309571
309585
  const jitContext = await discoverJitContext(
@@ -332839,6 +332853,48 @@ function extractCuratedHistory2(comprehensiveHistory) {
332839
332853
  }
332840
332854
  return curatedHistory;
332841
332855
  }
332856
+ var THINKING_ONLY_NUDGE_MESSAGE = "[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.]";
332857
+ var NO_RESPONSE_TEXT_NUDGE_MESSAGE = "[System: You previously returned an empty response with no text or thoughts. Please ensure you provide your final answer or call a tool now.]";
332858
+ function applyRetryNudge(contents, nudgeMessage) {
332859
+ if (!nudgeMessage) {
332860
+ return contents;
332861
+ }
332862
+ const lastTurn = contents[contents.length - 1];
332863
+ const hasNudge = lastTurn?.parts?.some((p) => p.text?.includes(nudgeMessage));
332864
+ if (hasNudge) {
332865
+ return contents;
332866
+ }
332867
+ const cloned = contents.map((c4) => ({
332868
+ ...c4,
332869
+ parts: c4.parts ? [...c4.parts] : []
332870
+ }));
332871
+ const clonedLastTurn = cloned[cloned.length - 1];
332872
+ const hasFunctionResponse = clonedLastTurn?.parts?.some(
332873
+ (p) => p.functionResponse
332874
+ );
332875
+ if (clonedLastTurn?.role === "user" && hasFunctionResponse) {
332876
+ cloned.push({
332877
+ role: "model",
332878
+ parts: [{ text: "[Tool execution completed.]" }]
332879
+ });
332880
+ cloned.push({
332881
+ role: "user",
332882
+ parts: [{ text: nudgeMessage }]
332883
+ });
332884
+ } else if (clonedLastTurn?.role === "user") {
332885
+ if (!clonedLastTurn.parts) {
332886
+ clonedLastTurn.parts = [];
332887
+ }
332888
+ clonedLastTurn.parts.push({ text: `
332889
+ ${nudgeMessage}` });
332890
+ } else {
332891
+ cloned.push({
332892
+ role: "user",
332893
+ parts: [{ text: nudgeMessage }]
332894
+ });
332895
+ }
332896
+ return cloned;
332897
+ }
332842
332898
  var InvalidStreamError = class extends Error {
332843
332899
  type;
332844
332900
  constructor(message, type2) {
@@ -333288,23 +333344,19 @@ var GeminiChat = class {
333288
333344
  tools: this.tools,
333289
333345
  abortSignal
333290
333346
  };
333347
+ let nudgeMessage = "";
333291
333348
  if (modelConfigKey.isRetry && modelConfigKey.lastStreamError instanceof InvalidStreamError) {
333292
333349
  const lastError = modelConfigKey.lastStreamError;
333293
- let nudgeMessage = "";
333294
333350
  if (lastError.type === "THINKING_ONLY_RESPONSE") {
333295
- 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.]";
333351
+ nudgeMessage = THINKING_ONLY_NUDGE_MESSAGE;
333296
333352
  } else if (lastError.type === "NO_RESPONSE_TEXT") {
333297
- 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.]";
333298
- }
333299
- if (nudgeMessage) {
333300
- if (typeof config2.systemInstruction === "string") {
333301
- config2.systemInstruction += nudgeMessage;
333302
- } else if (config2.systemInstruction === void 0) {
333303
- config2.systemInstruction = nudgeMessage;
333304
- }
333353
+ nudgeMessage = NO_RESPONSE_TEXT_NUDGE_MESSAGE;
333305
333354
  }
333306
333355
  }
333307
333356
  let contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
333357
+ if (nudgeMessage) {
333358
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
333359
+ }
333308
333360
  const hookSystem = this.context.config.getHookSystem();
333309
333361
  if (hookSystem) {
333310
333362
  const beforeModelResult = await hookSystem.fireBeforeModelEvent({
@@ -333340,12 +333392,18 @@ var GeminiChat = class {
333340
333392
  );
333341
333393
  lastModelToUse = modelToUse;
333342
333394
  contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
333395
+ if (nudgeMessage) {
333396
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
333397
+ }
333343
333398
  }
333344
333399
  if (beforeModelResult.modifiedConfig) {
333345
333400
  Object.assign(config2, beforeModelResult.modifiedConfig);
333346
333401
  }
333347
333402
  if (beforeModelResult.modifiedContents && Array.isArray(beforeModelResult.modifiedContents)) {
333348
333403
  contentsToUse = beforeModelResult.modifiedContents;
333404
+ if (nudgeMessage) {
333405
+ contentsToUse = applyRetryNudge(contentsToUse, nudgeMessage);
333406
+ }
333349
333407
  }
333350
333408
  const toolSelectionResult = await hookSystem.fireBeforeToolSelectionEvent({
333351
333409
  model: modelToUse,
@@ -333885,9 +333943,8 @@ function isInvalidArgumentError(errorMessage) {
333885
333943
  return errorMessage.includes("Request contains an invalid argument");
333886
333944
  }
333887
333945
  function stripToolCallIdPrefixes(contents) {
333888
- return contents.map((content) => ({
333889
- ...content,
333890
- parts: (content.parts || []).map((part) => {
333946
+ return contents.map((content) => {
333947
+ const parts2 = (content.parts || []).map((part) => {
333891
333948
  const newPart = { ...part };
333892
333949
  if (newPart.functionCall) {
333893
333950
  const fc = newPart.functionCall;
@@ -333911,9 +333968,27 @@ function stripToolCallIdPrefixes(contents) {
333911
333968
  };
333912
333969
  }
333913
333970
  }
333971
+ const hasOtherKeys = Object.keys(newPart).some(
333972
+ (key) => key !== "text" && key !== "thought" && key !== "callIndex" && newPart[key] !== void 0
333973
+ );
333974
+ if (newPart.text !== void 0 && newPart.text === "" && hasOtherKeys) {
333975
+ delete newPart.text;
333976
+ }
333914
333977
  return newPart;
333915
- })
333916
- }));
333978
+ }).filter((part) => {
333979
+ const hasOtherKeys = Object.keys(part).some(
333980
+ (key) => key !== "text" && key !== "thought" && key !== "callIndex" && part[key] !== void 0
333981
+ );
333982
+ if (part.text !== void 0 && part.text === "" && !hasOtherKeys) {
333983
+ return false;
333984
+ }
333985
+ return true;
333986
+ });
333987
+ return {
333988
+ ...content,
333989
+ parts: parts2
333990
+ };
333991
+ });
333917
333992
  }
333918
333993
  function coalesceConsecutiveRoles(history) {
333919
333994
  const result2 = [];
@@ -341420,7 +341495,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
341420
341495
  return provider;
341421
341496
  }
341422
341497
  case "oauth2": {
341423
- const { OAuth2AuthProvider } = await import("./oauth2-provider-FWKP5A4D.js");
341498
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-CO22I6UM.js");
341424
341499
  const provider = new OAuth2AuthProvider(
341425
341500
  authConfig,
341426
341501
  options.agentName ?? "unknown",
@@ -393858,6 +393933,7 @@ var LegacyAgentProtocol = class {
393858
393933
  let currentDisplayContent = initialDisplayContent;
393859
393934
  let turnCount = 0;
393860
393935
  const maxTurns = this._config.getMaxSessionTurns();
393936
+ let isAfterToolResponse = false;
393861
393937
  while (true) {
393862
393938
  turnCount++;
393863
393939
  if (maxTurns >= 0 && turnCount > maxTurns) {
@@ -393870,6 +393946,7 @@ var LegacyAgentProtocol = class {
393870
393946
  }
393871
393947
  const toolCallRequests = [];
393872
393948
  let finishedReason = void 0;
393949
+ let hasVisibleText = false;
393873
393950
  const responseStream = this._client.sendMessageStream(
393874
393951
  currentParts,
393875
393952
  this._abortController.signal,
@@ -393886,6 +393963,11 @@ var LegacyAgentProtocol = class {
393886
393963
  if (event.type === "tool_call_request" /* ToolCallRequest */) {
393887
393964
  toolCallRequests.push(event.value);
393888
393965
  }
393966
+ if (event.type === "content" /* Content */) {
393967
+ if (typeof event.value === "string" && event.value.trim() !== "") {
393968
+ hasVisibleText = true;
393969
+ }
393970
+ }
393889
393971
  this._emit(translateEvent(event, this._translationState));
393890
393972
  switch (event.type) {
393891
393973
  case "error" /* Error */:
@@ -393910,6 +393992,12 @@ var LegacyAgentProtocol = class {
393910
393992
  return;
393911
393993
  }
393912
393994
  if (toolCallRequests.length === 0) {
393995
+ if (isAfterToolResponse && !hasVisibleText) {
393996
+ const nudgeMessage = "[System: You successfully executed a tool but returned an empty response. Please analyze the tool output and explain your progress or final answer.]";
393997
+ currentParts = [{ text: nudgeMessage }];
393998
+ isAfterToolResponse = false;
393999
+ continue;
394000
+ }
393913
394001
  if (finishedReason !== void 0) {
393914
394002
  this._finishStream(mapFinishReason(finishedReason));
393915
394003
  } else {
@@ -393976,6 +394064,7 @@ var LegacyAgentProtocol = class {
393976
394064
  return;
393977
394065
  }
393978
394066
  currentParts = toolResponseParts;
394067
+ isAfterToolResponse = completedToolCalls.length > 0;
393979
394068
  }
393980
394069
  }
393981
394070
  _emit(events) {
@@ -403225,6 +403314,9 @@ export {
403225
403314
  SYNTHETIC_THOUGHT_SIGNATURE2 as SYNTHETIC_THOUGHT_SIGNATURE,
403226
403315
  INTERRUPTED_RESPONSE_PLACEHOLDER,
403227
403316
  isValidNonThoughtTextPart,
403317
+ THINKING_ONLY_NUDGE_MESSAGE,
403318
+ NO_RESPONSE_TEXT_NUDGE_MESSAGE,
403319
+ applyRetryNudge,
403228
403320
  InvalidStreamError,
403229
403321
  AgentExecutionStoppedError,
403230
403322
  AgentExecutionBlockedError,
@@ -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
  checkExhaustive
4
- } from "./chunk-FWGOOSQK.js";
4
+ } from "./chunk-DFPYJMVX.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __toESM
@@ -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-2UGGPOEV.js";
4
+ } from "./chunk-GAS2GAYB.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -31,7 +31,7 @@ import {
31
31
  partListUnionToString,
32
32
  require_strip_json_comments,
33
33
  sanitizeFilenamePart
34
- } from "./chunk-2UICYJMD.js";
34
+ } from "./chunk-7HKQGPWB.js";
35
35
  import {
36
36
  __commonJS,
37
37
  __require,