@google/gemini-cli 0.52.0-nightly.20260723.g9681621c6 → 0.52.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 (71) hide show
  1. package/bundle/{chunk-3XOIA5WR.js → chunk-24R3JJRB.js} +1 -1
  2. package/bundle/{chunk-UEI42N7R.js → chunk-6Z2GQGII.js} +3 -3
  3. package/bundle/{chunk-GJXPH6YT.js → chunk-7LQRUKPT.js} +81 -168
  4. package/bundle/{chunk-XH7QC2TB.js → chunk-ALVMXQYL.js} +2 -2
  5. package/bundle/{chunk-CPNBBB75.js → chunk-B54TROKV.js} +2 -2
  6. package/bundle/{chunk-27C6XFMY.js → chunk-BG2B4WV5.js} +87 -184
  7. package/bundle/{chunk-BDSSP5BZ.js → chunk-F7WLNK6O.js} +1 -1
  8. package/bundle/{chunk-MGWKBHYO.js → chunk-FBGJOW3X.js} +2 -2
  9. package/bundle/{chunk-IKE3IJFJ.js → chunk-ILANJJAD.js} +3 -3
  10. package/bundle/{chunk-NGVS6ZAJ.js → chunk-IQDAUFS5.js} +14275 -7764
  11. package/bundle/{chunk-GNNMAEXD.js → chunk-JB342GRK.js} +1 -1
  12. package/bundle/{chunk-PKFZO3SN.js → chunk-OFOMMM4A.js} +1 -1
  13. package/bundle/{chunk-IODN6H35.js → chunk-P4IYYRKC.js} +1 -1
  14. package/bundle/{chunk-ZEZVEPHU.js → chunk-PTIIH33O.js} +3 -3
  15. package/bundle/{chunk-4OVORMGE.js → chunk-RHQ5RWRW.js} +1 -1
  16. package/bundle/{chunk-H4LWAALI.js → chunk-SDT3SMSX.js} +7 -7
  17. package/bundle/{chunk-QSTUV3QH.js → chunk-SNUSRD5O.js} +7 -7
  18. package/bundle/{chunk-APLH5ANQ.js → chunk-SZMWXEEI.js} +5 -8
  19. package/bundle/{chunk-2EQTAQD4.js → chunk-THWSXFSH.js} +1 -1
  20. package/bundle/{chunk-DBBRJYJF.js → chunk-UB6EWNWI.js} +8 -9
  21. package/bundle/{chunk-KDCDG5VZ.js → chunk-Y5NBDPUP.js} +1 -1
  22. package/bundle/{chunk-2277V7JH.js → chunk-ZINRZXUN.js} +1 -1
  23. package/bundle/{chunk-IOKXRXYH.js → chunk-ZLL3UXFN.js} +1 -1
  24. package/bundle/{chunk-QWQ2TM4M.js → chunk-ZNHHIFQN.js} +54 -67
  25. package/bundle/{cleanup-FXLZG47P.js → cleanup-2EKCP4Q4.js} +2 -2
  26. package/bundle/{cleanup-HUYNLL74.js → cleanup-G4HKUFT2.js} +2 -2
  27. package/bundle/{cleanup-SZCNPC5U.js → cleanup-X3KOZTUK.js} +2 -2
  28. package/bundle/{core-PVG4D2MR.js → core-JDFTBJXX.js} +1 -3
  29. package/bundle/{dist-4MRXBLX6.js → core-ZIYDWN4V.js} +1 -3
  30. package/bundle/{devtoolsService-QYDPHHFN.js → devtoolsService-KJJEIBQ2.js} +2 -2
  31. package/bundle/{devtoolsService-UWV2FJ5W.js → devtoolsService-NFNYJGMS.js} +3 -4
  32. package/bundle/{devtoolsService-BLOOTSX5.js → devtoolsService-UB2E5377.js} +2 -2
  33. package/bundle/{dist-JKGOFUTJ.js → dist-WD2ZO2DC.js} +1 -3
  34. package/bundle/docs/CONTRIBUTING.md +3 -3
  35. package/bundle/docs/cli/sandbox.md +2 -3
  36. package/bundle/docs/reference/configuration.md +4 -4
  37. package/bundle/{gemini-RB4VRLKB.js → gemini-6K6USV55.js} +14 -14
  38. package/bundle/{gemini-E2E3U6PR.js → gemini-NJ7GQJ2G.js} +14 -14
  39. package/bundle/{gemini-6757TORA.js → gemini-Y4OW3GPV.js} +196 -212
  40. package/bundle/gemini.js +7 -7
  41. package/bundle/{interactiveCli-FS3OVPXQ.js → interactiveCli-3B23G3WW.js} +8 -8
  42. package/bundle/{interactiveCli-YTSJUZI4.js → interactiveCli-3XBP73G4.js} +8 -8
  43. package/bundle/{interactiveCli-GSB4RL5O.js → interactiveCli-NNJDT7RS.js} +296 -315
  44. package/bundle/{liteRtServerManager-LW25SW2L.js → liteRtServerManager-A77B57ZY.js} +4 -4
  45. package/bundle/{liteRtServerManager-QQQFW2CP.js → liteRtServerManager-MQS4LI5P.js} +4 -4
  46. package/bundle/{liteRtServerManager-T2Z3RLS3.js → liteRtServerManager-PYCXZRAL.js} +4 -4
  47. package/bundle/{oauth2-provider-EAM256AQ.js → oauth2-provider-5JL2PKRR.js} +1 -1
  48. package/bundle/{oauth2-provider-DFVE3NYF.js → oauth2-provider-6EE3JV6M.js} +1 -1
  49. package/bundle/{oauth2-provider-LIH733TF.js → oauth2-provider-THDZ27ZX.js} +72 -38
  50. package/bundle/sandbox-macos-permissive-open.sb +4 -113
  51. package/bundle/sandbox-macos-permissive-proxied.sb +9 -111
  52. package/bundle/{start-5G2UDZZ6.js → start-K5QQG7K4.js} +6 -6
  53. package/bundle/{start-5PGXX77Z.js → start-SV5TPWOH.js} +6 -6
  54. package/bundle/{start-JRR6N5UF.js → start-YON746V5.js} +6 -6
  55. package/package.json +1 -1
  56. package/bundle/chunk-2PPBVVNC.js +0 -1571
  57. package/bundle/chunk-H56TFQ33.js +0 -398
  58. package/bundle/chunk-LFBOFVXO.js +0 -118
  59. package/bundle/chunk-TWHN6YWJ.js +0 -17332
  60. package/bundle/chunk-V37HWFI3.js +0 -154
  61. package/bundle/chunk-VDXWWVGC.js +0 -396898
  62. package/bundle/chunk-YNU3KMOW.js +0 -512
  63. package/bundle/chunk-ZEJHAENL.js +0 -102505
  64. package/bundle/cleanup-XETKRH7X.js +0 -32
  65. package/bundle/devtoolsService-YCULQ2T3.js +0 -4359
  66. package/bundle/dist-U3H5J2OD.js +0 -2154
  67. package/bundle/gemini-F4UJ3SXK.js +0 -16427
  68. package/bundle/interactiveCli-QWKN4PM7.js +0 -34816
  69. package/bundle/liteRtServerManager-VLV27PAS.js +0 -65
  70. package/bundle/oauth2-provider-WWQFEGLU.js +0 -235
  71. package/bundle/start-JVS5QRER.js +0 -18
@@ -278743,96 +278743,72 @@ var oauthClientPromises = /* @__PURE__ */ new Map();
278743
278743
  function getUseEncryptedStorageFlag() {
278744
278744
  return process.env[FORCE_ENCRYPTED_FILE_ENV_VAR] === "true";
278745
278745
  }
278746
- function isAdcCredentials(credentials3) {
278747
- if (credentials3 && typeof credentials3 === "object" && "type" in credentials3) {
278748
- const type2 = credentials3.type;
278749
- return typeof type2 === "string" && type2 !== "authorized_user";
278750
- }
278751
- return false;
278752
- }
278753
278746
  async function initOauthClient(authType, config2) {
278754
- function createBaseOAuth2Client() {
278755
- const client2 = new import_google_auth_library3.OAuth2Client({
278756
- clientId: OAUTH_CLIENT_ID,
278757
- clientSecret: OAUTH_CLIENT_SECRET,
278758
- transporterOptions: {
278759
- proxy: config2.getProxy()
278760
- }
278747
+ const credentials3 = await fetchCachedCredentials();
278748
+ if (credentials3 && typeof credentials3 === "object" && "type" in credentials3 && (credentials3.type === "external_account_authorized_user" || credentials3.type === "service_account")) {
278749
+ const auth2 = new import_google_auth_library3.GoogleAuth({
278750
+ scopes: OAUTH_SCOPE
278761
278751
  });
278762
- const useEncryptedStorage = getUseEncryptedStorageFlag();
278763
- client2.on("tokens", async (tokens) => {
278764
- if (useEncryptedStorage) {
278765
- await OAuthCredentialStorage.saveCredentials(tokens);
278766
- } else {
278767
- await cacheCredentials(tokens);
278768
- }
278769
- await triggerPostAuthCallbacks(tokens);
278752
+ const byoidClient = auth2.fromJSON({
278753
+ ...credentials3,
278754
+ refresh_token: credentials3.refresh_token ?? void 0
278770
278755
  });
278771
- return client2;
278756
+ const token2 = await byoidClient.getAccessToken();
278757
+ if (token2) {
278758
+ debugLogger.debug(`Created ${credentials3.type} auth client.`);
278759
+ return byoidClient;
278760
+ }
278772
278761
  }
278762
+ const client = new import_google_auth_library3.OAuth2Client({
278763
+ clientId: OAUTH_CLIENT_ID,
278764
+ clientSecret: OAUTH_CLIENT_SECRET,
278765
+ transporterOptions: {
278766
+ proxy: config2.getProxy()
278767
+ }
278768
+ });
278769
+ const useEncryptedStorage = getUseEncryptedStorageFlag();
278773
278770
  if (process.env["GOOGLE_GENAI_USE_GCA"] && process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]) {
278774
- const client2 = createBaseOAuth2Client();
278775
- client2.setCredentials({
278771
+ client.setCredentials({
278776
278772
  access_token: process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]
278777
278773
  });
278778
- await fetchAndCacheUserInfo(client2);
278779
- return client2;
278774
+ await fetchAndCacheUserInfo(client);
278775
+ return client;
278780
278776
  }
278781
- const credentialsList = await fetchCachedCredentialsList();
278782
- for (const credentials3 of credentialsList) {
278783
- if (isAdcCredentials(credentials3)) {
278784
- try {
278785
- const auth2 = new import_google_auth_library3.GoogleAuth({
278786
- scopes: OAUTH_SCOPE
278787
- });
278788
- const adcClient = auth2.fromJSON({
278789
- ...credentials3,
278790
- refresh_token: credentials3.refresh_token ?? void 0
278791
- });
278792
- const response = await adcClient.getAccessToken();
278793
- const token2 = response.token ?? null;
278794
- if (token2) {
278795
- debugLogger.debug("Created " + credentials3.type + " auth client.");
278796
- return adcClient;
278797
- }
278798
- } catch (error40) {
278799
- debugLogger.debug(
278800
- "ADC credentials verification failed:",
278801
- getErrorMessage(error40)
278802
- );
278803
- }
278804
- } else if (credentials3) {
278805
- const client2 = createBaseOAuth2Client();
278806
- client2.setCredentials(credentials3);
278807
- try {
278808
- const { token: token2 } = await client2.getAccessToken();
278809
- if (token2) {
278810
- await client2.getTokenInfo(token2);
278811
- if (!userAccountManager2.getCachedGoogleAccount()) {
278812
- try {
278813
- await fetchAndCacheUserInfo(client2);
278814
- } catch (error40) {
278815
- debugLogger.warn(
278816
- "Failed to fetch user info:",
278817
- getErrorMessage(error40)
278818
- );
278819
- }
278777
+ client.on("tokens", async (tokens) => {
278778
+ if (useEncryptedStorage) {
278779
+ await OAuthCredentialStorage.saveCredentials(tokens);
278780
+ } else {
278781
+ await cacheCredentials(tokens);
278782
+ }
278783
+ await triggerPostAuthCallbacks(tokens);
278784
+ });
278785
+ if (credentials3) {
278786
+ client.setCredentials(credentials3);
278787
+ try {
278788
+ const { token: token2 } = await client.getAccessToken();
278789
+ if (token2) {
278790
+ await client.getTokenInfo(token2);
278791
+ if (!userAccountManager2.getCachedGoogleAccount()) {
278792
+ try {
278793
+ await fetchAndCacheUserInfo(client);
278794
+ } catch (error40) {
278795
+ debugLogger.warn(
278796
+ "Failed to fetch user info:",
278797
+ getErrorMessage(error40)
278798
+ );
278820
278799
  }
278821
- debugLogger.log("Loaded cached credentials.");
278822
- await triggerPostAuthCallbacks(
278823
- client2.credentials || credentials3
278824
- );
278825
- return client2;
278826
278800
  }
278827
- } catch (error40) {
278828
- debugLogger.debug(
278829
- "Cached credentials are not valid:",
278830
- getErrorMessage(error40)
278831
- );
278801
+ debugLogger.log("Loaded cached credentials.");
278802
+ await triggerPostAuthCallbacks(credentials3);
278803
+ return client;
278832
278804
  }
278805
+ } catch (error40) {
278806
+ debugLogger.debug(
278807
+ `Cached credentials are not valid:`,
278808
+ getErrorMessage(error40)
278809
+ );
278833
278810
  }
278834
278811
  }
278835
- const client = createBaseOAuth2Client();
278836
278812
  if (authType === "compute-default-credentials" /* COMPUTE_ADC */) {
278837
278813
  try {
278838
278814
  debugLogger.log(
@@ -279212,24 +279188,13 @@ function getAvailablePort() {
279212
279188
  }
279213
279189
  });
279214
279190
  }
279215
- async function fetchCachedCredentialsList() {
279216
- const credentialsList = [];
279191
+ async function fetchCachedCredentials() {
279217
279192
  const useEncryptedStorage = getUseEncryptedStorageFlag();
279218
279193
  if (useEncryptedStorage) {
279219
- try {
279220
- const creds = await OAuthCredentialStorage.loadCredentials();
279221
- if (creds) {
279222
- credentialsList.push(creds);
279223
- }
279224
- } catch (error40) {
279225
- debugLogger.debug(
279226
- "Failed to load credentials from encrypted storage:",
279227
- error40
279228
- );
279229
- }
279194
+ return OAuthCredentialStorage.loadCredentials();
279230
279195
  }
279231
279196
  const pathsToTry = [
279232
- ...!useEncryptedStorage ? [Storage.getOAuthCredsPath()] : [],
279197
+ Storage.getOAuthCredsPath(),
279233
279198
  process.env["GOOGLE_APPLICATION_CREDENTIALS"]
279234
279199
  ].filter((p) => !!p);
279235
279200
  for (const keyFile of pathsToTry) {
@@ -279238,10 +279203,9 @@ async function fetchCachedCredentialsList() {
279238
279203
  const parsed = JSON.parse(keyFileString);
279239
279204
  const isOAuthCreds = (val) => typeof val === "object" && val !== null;
279240
279205
  if (isOAuthCreds(parsed)) {
279241
- credentialsList.push(parsed);
279242
- } else {
279243
- throw new Error("Invalid credentials format");
279206
+ return parsed;
279244
279207
  }
279208
+ throw new Error("Invalid credentials format");
279245
279209
  } catch (error40) {
279246
279210
  debugLogger.debug(
279247
279211
  `Failed to load credentials from ${keyFile}:`,
@@ -279249,7 +279213,7 @@ async function fetchCachedCredentialsList() {
279249
279213
  );
279250
279214
  }
279251
279215
  }
279252
- return credentialsList;
279216
+ return null;
279253
279217
  }
279254
279218
  function clearOauthClientCache() {
279255
279219
  oauthClientPromises.clear();
@@ -282763,8 +282727,8 @@ function isValidToolName(name3, options = {}) {
282763
282727
  }
282764
282728
 
282765
282729
  // packages/core/src/generated/git-commit.ts
282766
- var GIT_COMMIT_INFO = "9681621c6";
282767
- var CLI_VERSION = "0.52.0-nightly.20260715.gfa975395b";
282730
+ var GIT_COMMIT_INFO = "5de3b24af";
282731
+ var CLI_VERSION = "0.52.0";
282768
282732
 
282769
282733
  // packages/core/src/ide/detect-ide.ts
282770
282734
  var IDE_DEFINITIONS = {
@@ -290508,12 +290472,6 @@ function getDiffCommand(oldPath, newPath, editor) {
290508
290472
  }
290509
290473
  }
290510
290474
  async function openDiff(oldPath, newPath, editor) {
290511
- if (isHeadlessMode()) {
290512
- debugLogger.warn(
290513
- "External editor spawning is disabled in headless/server mode."
290514
- );
290515
- return;
290516
- }
290517
290475
  const diffCommand = getDiffCommand(oldPath, newPath, editor);
290518
290476
  if (!diffCommand) {
290519
290477
  debugLogger.error("No diff tool available. Install a supported editor.");
@@ -306258,7 +306216,7 @@ function getVersion() {
306258
306216
  }
306259
306217
  versionPromise = (async () => {
306260
306218
  const pkgJson = await getPackageJson(__dirname4);
306261
- return "0.52.0-nightly.20260715.gfa975395b";
306219
+ return "0.52.0";
306262
306220
  })();
306263
306221
  return versionPromise;
306264
306222
  }
@@ -312106,19 +312064,13 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
312106
312064
  customHeaders,
312107
312065
  vertexAiRouting
312108
312066
  };
312109
- const getEnv3 = (key) => {
312110
- if (config2?.env && config2.env[key] !== void 0) {
312111
- return config2.env[key];
312112
- }
312113
- return process.env[key];
312114
- };
312115
312067
  if (authType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ || authType === "compute-default-credentials" /* COMPUTE_ADC */) {
312116
312068
  return contentGeneratorConfig;
312117
312069
  }
312118
- const geminiApiKey = apiKey || getEnv3("GEMINI_API_KEY") || await loadApiKey() || void 0;
312119
- const googleApiKey = getEnv3("GOOGLE_API_KEY") || void 0;
312120
- const googleCloudProject = getEnv3("GOOGLE_CLOUD_PROJECT") || getEnv3("GOOGLE_CLOUD_PROJECT_ID") || void 0;
312121
- const googleCloudLocation = getEnv3("GOOGLE_CLOUD_LOCATION") || void 0;
312070
+ const geminiApiKey = apiKey || process.env["GEMINI_API_KEY"] || await loadApiKey() || void 0;
312071
+ const googleApiKey = process.env["GOOGLE_API_KEY"] || void 0;
312072
+ const googleCloudProject = process.env["GOOGLE_CLOUD_PROJECT"] || process.env["GOOGLE_CLOUD_PROJECT_ID"] || void 0;
312073
+ const googleCloudLocation = process.env["GOOGLE_CLOUD_LOCATION"] || void 0;
312122
312074
  if (authType === "gemini-api-key" /* USE_GEMINI */ && geminiApiKey) {
312123
312075
  contentGeneratorConfig.apiKey = geminiApiKey;
312124
312076
  contentGeneratorConfig.vertexai = false;
@@ -312130,7 +312082,7 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
312130
312082
  return contentGeneratorConfig;
312131
312083
  }
312132
312084
  if (authType === "gateway" /* GATEWAY */) {
312133
- contentGeneratorConfig.apiKey = apiKey || getEnv3("GEMINI_API_KEY") || "";
312085
+ contentGeneratorConfig.apiKey = apiKey || process.env["GEMINI_API_KEY"] || "";
312134
312086
  contentGeneratorConfig.vertexai = false;
312135
312087
  return contentGeneratorConfig;
312136
312088
  }
@@ -322860,7 +322812,7 @@ import { TextDecoder as TextDecoder2 } from "node:util";
322860
322812
  import os28 from "node:os";
322861
322813
  import fs47, { mkdirSync as mkdirSync4 } from "node:fs";
322862
322814
  import path57 from "node:path";
322863
- var import_headless3 = __toESM(require_xterm_headless(), 1);
322815
+ var import_headless2 = __toESM(require_xterm_headless(), 1);
322864
322816
 
322865
322817
  // packages/core/src/utils/terminalSerializer.ts
322866
322818
  var ColorMode = /* @__PURE__ */ ((ColorMode2) => {
@@ -323737,7 +323689,7 @@ var ExecutionLifecycleService = class {
323737
323689
  };
323738
323690
 
323739
323691
  // packages/core/src/services/shellExecutionService.ts
323740
- var { Terminal } = import_headless3.default;
323692
+ var { Terminal } = import_headless2.default;
323741
323693
  var MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024;
323742
323694
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR = "GEMINI_CLI";
323743
323695
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = "1";
@@ -323951,10 +323903,9 @@ ${truncated}`;
323951
323903
  usingPty
323952
323904
  );
323953
323905
  const spawnArgs = [...argsPrefix, finalCommand];
323954
- const sourceEnv = shellExecutionConfig.env ?? process.env;
323955
323906
  const gitConfigKeys = [];
323956
323907
  if (!isInteractive) {
323957
- for (const key in sourceEnv) {
323908
+ for (const key in process.env) {
323958
323909
  if (key.startsWith("GIT_CONFIG_")) {
323959
323910
  gitConfigKeys.push(key);
323960
323911
  }
@@ -323967,7 +323918,7 @@ ${truncated}`;
323967
323918
  ...gitConfigKeys
323968
323919
  ]
323969
323920
  };
323970
- const sanitizedEnv = sanitizeEnvironment(sourceEnv, sanitizationConfig);
323921
+ const sanitizedEnv = sanitizeEnvironment(process.env, sanitizationConfig);
323971
323922
  const baseEnv = {
323972
323923
  ...sanitizedEnv,
323973
323924
  [GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
@@ -323977,7 +323928,7 @@ ${truncated}`;
323977
323928
  };
323978
323929
  if (!isInteractive) {
323979
323930
  for (const key of gitConfigKeys) {
323980
- baseEnv[key] = sourceEnv[key];
323931
+ baseEnv[key] = process.env[key];
323981
323932
  }
323982
323933
  const gitConfigCount = parseInt(baseEnv["GIT_CONFIG_COUNT"] || "0", 10);
323983
323934
  const newKey = `GIT_CONFIG_KEY_${gitConfigCount}`;
@@ -325463,7 +325414,6 @@ exit $__code`;
325463
325414
  this.context.config.isInteractiveShellEnabled(),
325464
325415
  {
325465
325416
  ...shellExecutionConfig,
325466
- env: this.context.config.env,
325467
325417
  sessionId: this.context.config?.getSessionId?.() ?? "default",
325468
325418
  pager: "cat",
325469
325419
  sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.context.config.sanitizationConfig,
@@ -332836,8 +332786,7 @@ var GeminiChat = class {
332836
332786
  return binaryParts.length > 0 ? binaryParts : void 0;
332837
332787
  }
332838
332788
  async makeApiCallAndProcessStream(modelConfigKey, requestHistory, prompt_id, abortSignal, role, apiHistoryOverride) {
332839
- let scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
332840
- scrubbedHistory = coalesceConsecutiveRoles(scrubbedHistory);
332789
+ const scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
332841
332790
  const scrubbedContents = scrubbedHistory.map((h2) => h2.content);
332842
332791
  const requestContents = apiHistoryOverride ? scrubContents(apiHistoryOverride) : scrubbedContents;
332843
332792
  const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
@@ -333439,29 +333388,6 @@ function stripToolCallIdPrefixes(contents) {
333439
333388
  })
333440
333389
  }));
333441
333390
  }
333442
- function coalesceConsecutiveRoles(history) {
333443
- const result2 = [];
333444
- for (const turn of history) {
333445
- const lastIdx = result2.length - 1;
333446
- const last2 = result2[lastIdx];
333447
- if (last2 && last2.content.role && last2.content.role === turn.content.role) {
333448
- const hasParts = last2.content.parts || turn.content.parts;
333449
- result2[lastIdx] = {
333450
- id: last2.id,
333451
- content: {
333452
- ...last2.content,
333453
- parts: hasParts ? [...last2.content.parts || [], ...turn.content.parts || []] : void 0
333454
- }
333455
- };
333456
- } else {
333457
- result2.push({
333458
- id: turn.id,
333459
- content: { ...turn.content }
333460
- });
333461
- }
333462
- }
333463
- return result2;
333464
- }
333465
333391
 
333466
333392
  // packages/core/src/utils/ragLogger.ts
333467
333393
  import * as fs50 from "node:fs";
@@ -340877,7 +340803,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
340877
340803
  return provider;
340878
340804
  }
340879
340805
  case "oauth2": {
340880
- const { OAuth2AuthProvider } = await import("./oauth2-provider-DFVE3NYF.js");
340806
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-THDZ27ZX.js");
340881
340807
  const provider = new OAuth2AuthProvider(
340882
340808
  authConfig,
340883
340809
  options.agentName ?? "unknown",
@@ -343232,7 +343158,8 @@ var LoopDetectionService = class {
343232
343158
  promptId = "";
343233
343159
  userPrompt = "";
343234
343160
  // Tool call tracking
343235
- toolCallHistory = [];
343161
+ lastToolCallKey = null;
343162
+ toolCallRepetitionCount = 0;
343236
343163
  // Content streaming tracking
343237
343164
  streamContentHistory = "";
343238
343165
  contentStats = /* @__PURE__ */ new Map();
@@ -343374,31 +343301,14 @@ var LoopDetectionService = class {
343374
343301
  }
343375
343302
  checkToolCallLoop(toolCall) {
343376
343303
  const key = this.getToolCallKey(toolCall);
343377
- this.toolCallHistory.push(key);
343378
- const maxRequiredLength = 5 * TOOL_CALL_LOOP_THRESHOLD;
343379
- if (this.toolCallHistory.length > maxRequiredLength) {
343380
- this.toolCallHistory = this.toolCallHistory.slice(-maxRequiredLength);
343381
- }
343382
- const n3 = this.toolCallHistory.length;
343383
- const R = TOOL_CALL_LOOP_THRESHOLD;
343384
- for (let k = 1; k <= 5; k++) {
343385
- const requiredLength = k * R;
343386
- if (n3 >= requiredLength) {
343387
- const cycle = this.toolCallHistory.slice(-k);
343388
- let isPatternMatch = true;
343389
- for (let i3 = 0; i3 < requiredLength; i3++) {
343390
- const indexFromEnd = requiredLength - i3;
343391
- const actualKey = this.toolCallHistory[n3 - indexFromEnd];
343392
- const expectedKey = cycle[i3 % k];
343393
- if (actualKey !== expectedKey) {
343394
- isPatternMatch = false;
343395
- break;
343396
- }
343397
- }
343398
- if (isPatternMatch) {
343399
- return true;
343400
- }
343401
- }
343304
+ if (this.lastToolCallKey === key) {
343305
+ this.toolCallRepetitionCount++;
343306
+ } else {
343307
+ this.lastToolCallKey = key;
343308
+ this.toolCallRepetitionCount = 1;
343309
+ }
343310
+ if (this.toolCallRepetitionCount >= TOOL_CALL_LOOP_THRESHOLD) {
343311
+ return true;
343402
343312
  }
343403
343313
  return false;
343404
343314
  }
@@ -343698,7 +343608,8 @@ ${this.userPrompt}
343698
343608
  this.loopDetected = false;
343699
343609
  }
343700
343610
  resetToolCallCount() {
343701
- this.toolCallHistory = [];
343611
+ this.lastToolCallKey = null;
343612
+ this.toolCallRepetitionCount = 0;
343702
343613
  }
343703
343614
  resetContentTracking(resetHistory = true) {
343704
343615
  if (resetHistory) {
@@ -368770,9 +368681,7 @@ var CheckerRunner = class _CheckerRunner {
368770
368681
  executeCheckerProcess(checkerPath, input, checkerName) {
368771
368682
  return new Promise((resolve29) => {
368772
368683
  const child = spawn9(checkerPath, [], {
368773
- stdio: ["pipe", "pipe", "pipe"],
368774
- cwd: this.contextBuilder.config.getWorkingDir(),
368775
- env: { ...process.env, ...this.contextBuilder.config.env }
368684
+ stdio: ["pipe", "pipe", "pipe"]
368776
368685
  });
368777
368686
  let stdout = "";
368778
368687
  let stderr = "";
@@ -368878,9 +368787,6 @@ var ContextBuilder = class {
368878
368787
  constructor(context2) {
368879
368788
  this.context = context2;
368880
368789
  }
368881
- get config() {
368882
- return this.context.config;
368883
- }
368884
368790
  /**
368885
368791
  * Builds the full context object with all available data.
368886
368792
  */
@@ -381649,7 +381555,6 @@ var Config = class {
381649
381555
  useTerminalBuffer;
381650
381556
  useRenderProcess;
381651
381557
  shellExecutionConfig;
381652
- env;
381653
381558
  extensionManagement = true;
381654
381559
  extensionRegistryURI;
381655
381560
  truncateToolOutputThreshold;
@@ -381823,7 +381728,6 @@ var Config = class {
381823
381728
  this.checkpointing = params.checkpointing ?? false;
381824
381729
  this.proxy = params.proxy;
381825
381730
  this.cwd = params.cwd ?? process15.cwd();
381826
- this.env = params.env;
381827
381731
  this.fileDiscoveryService = params.fileDiscoveryService ?? null;
381828
381732
  this.bugCommand = params.bugCommand;
381829
381733
  this.model = params.model;
@@ -402545,7 +402449,6 @@ export {
402545
402449
  isSchemaDepthError,
402546
402450
  isInvalidArgumentError,
402547
402451
  stripToolCallIdPrefixes,
402548
- coalesceConsecutiveRoles,
402549
402452
  populateToolDisplay,
402550
402453
  toolResultDisplayToDisplayContent,
402551
402454
  renderDisplayDiff,
@@ -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-27C6XFMY.js";
4
+ } from "./chunk-IQDAUFS5.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __toESM
@@ -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-GNNMAEXD.js";
4
+ } from "./chunk-Y5NBDPUP.js";
5
5
  import {
6
6
  RELEASE_CHANNEL_STABILITY,
7
7
  debugLogger,
8
8
  getChannelFromVersion,
9
9
  isGitRepository
10
- } from "./chunk-NGVS6ZAJ.js";
10
+ } from "./chunk-7LQRUKPT.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-2EQTAQD4.js";
5
+ } from "./chunk-RHQ5RWRW.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-APLH5ANQ.js";
17
+ } from "./chunk-SZMWXEEI.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-VDXWWVGC.js";
20
+ } from "./chunk-IQDAUFS5.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";