@google/gemini-cli 0.52.0 → 0.54.0-nightly.20260726.g3818efbbf

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 (74) hide show
  1. package/bundle/{chunk-7LQRUKPT.js → chunk-2VCRWD5A.js} +269 -146
  2. package/bundle/{chunk-Y5NBDPUP.js → chunk-4DF43WY7.js} +1 -1
  3. package/bundle/{chunk-ILANJJAD.js → chunk-5IDNNCKI.js} +3 -3
  4. package/bundle/{chunk-24R3JJRB.js → chunk-6EXP7MNC.js} +1 -1
  5. package/bundle/{chunk-SNUSRD5O.js → chunk-6FGJ26XP.js} +7 -7
  6. package/bundle/{chunk-B54TROKV.js → chunk-6FQUF3NB.js} +2 -2
  7. package/bundle/{chunk-6Z2GQGII.js → chunk-C52C3QZP.js} +3 -3
  8. package/bundle/{chunk-IQDAUFS5.js → chunk-CP4PCA5K.js} +7857 -14332
  9. package/bundle/{chunk-PTIIH33O.js → chunk-DJN5ASV2.js} +3 -3
  10. package/bundle/{chunk-JB342GRK.js → chunk-DLH2UGEO.js} +1 -1
  11. package/bundle/{chunk-ZINRZXUN.js → chunk-DZDRGXE7.js} +1 -1
  12. package/bundle/chunk-F6U6G4L3.js +118 -0
  13. package/bundle/{chunk-SZMWXEEI.js → chunk-GKMUOHQH.js} +8 -5
  14. package/bundle/{chunk-FBGJOW3X.js → chunk-HG5ARHEH.js} +2 -2
  15. package/bundle/{chunk-BG2B4WV5.js → chunk-ISVXSEBZ.js} +285 -152
  16. package/bundle/{chunk-OFOMMM4A.js → chunk-JFK64ABJ.js} +1 -1
  17. package/bundle/{chunk-ZLL3UXFN.js → chunk-MHTDGIIL.js} +1 -1
  18. package/bundle/{chunk-ALVMXQYL.js → chunk-NNV4Z6XR.js} +2 -2
  19. package/bundle/{chunk-P4IYYRKC.js → chunk-NPRNIWWX.js} +1 -1
  20. package/bundle/{chunk-F7WLNK6O.js → chunk-OC4O5R3B.js} +9 -8
  21. package/bundle/chunk-OEJGR4OM.js +396934 -0
  22. package/bundle/{chunk-RHQ5RWRW.js → chunk-PHD2HIVW.js} +1 -1
  23. package/bundle/{chunk-UB6EWNWI.js → chunk-QG7OFP4D.js} +1 -1
  24. package/bundle/{chunk-THWSXFSH.js → chunk-QGDYKVWX.js} +1 -1
  25. package/bundle/chunk-RVYNXMAI.js +154 -0
  26. package/bundle/chunk-SUGVZSZP.js +512 -0
  27. package/bundle/{chunk-SDT3SMSX.js → chunk-TIAQUEGU.js} +7 -7
  28. package/bundle/chunk-TUTBB2EI.js +17332 -0
  29. package/bundle/{chunk-ZNHHIFQN.js → chunk-UFVHQWHK.js} +67 -54
  30. package/bundle/chunk-XUMLHXHF.js +102505 -0
  31. package/bundle/chunk-Y76OKNPF.js +1571 -0
  32. package/bundle/chunk-YONEX6IX.js +398 -0
  33. package/bundle/{cleanup-2EKCP4Q4.js → cleanup-CJUVYQV5.js} +2 -2
  34. package/bundle/{cleanup-G4HKUFT2.js → cleanup-IA6XG6SC.js} +2 -2
  35. package/bundle/{cleanup-X3KOZTUK.js → cleanup-QIBIT7JQ.js} +2 -2
  36. package/bundle/cleanup-QUPE4ZH5.js +32 -0
  37. package/bundle/{core-ZIYDWN4V.js → core-UHW46BQ2.js} +5 -1
  38. package/bundle/{devtoolsService-UB2E5377.js → devtoolsService-465M2LE6.js} +2 -2
  39. package/bundle/{devtoolsService-KJJEIBQ2.js → devtoolsService-7KPRZCZM.js} +2 -2
  40. package/bundle/{devtoolsService-NFNYJGMS.js → devtoolsService-F7ASQSK7.js} +4 -3
  41. package/bundle/devtoolsService-ZJWYFVKM.js +4359 -0
  42. package/bundle/{dist-WD2ZO2DC.js → dist-A3MEBURU.js} +5 -1
  43. package/bundle/{core-JDFTBJXX.js → dist-QVREEUKF.js} +5 -1
  44. package/bundle/dist-Y4VJWSZD.js +2156 -0
  45. package/bundle/docs/CONTRIBUTING.md +3 -3
  46. package/bundle/docs/changelogs/index.md +20 -0
  47. package/bundle/docs/changelogs/latest.md +53 -18
  48. package/bundle/docs/changelogs/preview.md +35 -46
  49. package/bundle/docs/cli/sandbox.md +3 -2
  50. package/bundle/docs/reference/configuration.md +4 -4
  51. package/bundle/{gemini-6K6USV55.js → gemini-7SBFMAVQ.js} +14 -14
  52. package/bundle/{gemini-Y4OW3GPV.js → gemini-HIS5LQZQ.js} +212 -196
  53. package/bundle/{gemini-NJ7GQJ2G.js → gemini-VBI43GZ4.js} +14 -14
  54. package/bundle/gemini-VNJSIRD3.js +16427 -0
  55. package/bundle/gemini.js +7 -7
  56. package/bundle/{interactiveCli-NNJDT7RS.js → interactiveCli-7CJ3QII7.js} +8 -8
  57. package/bundle/{interactiveCli-3XBP73G4.js → interactiveCli-HO3K7ZQC.js} +8 -8
  58. package/bundle/{interactiveCli-3B23G3WW.js → interactiveCli-J27JH7NJ.js} +315 -296
  59. package/bundle/interactiveCli-QQIQEHF4.js +34816 -0
  60. package/bundle/{liteRtServerManager-MQS4LI5P.js → liteRtServerManager-ADM43JXF.js} +4 -4
  61. package/bundle/{liteRtServerManager-PYCXZRAL.js → liteRtServerManager-FGXFYVBT.js} +4 -4
  62. package/bundle/{liteRtServerManager-A77B57ZY.js → liteRtServerManager-IZIEAP3T.js} +4 -4
  63. package/bundle/liteRtServerManager-NRGCTYJQ.js +65 -0
  64. package/bundle/{oauth2-provider-6EE3JV6M.js → oauth2-provider-3THMIWTP.js} +1 -1
  65. package/bundle/{oauth2-provider-5JL2PKRR.js → oauth2-provider-ASKQ7P2C.js} +1 -1
  66. package/bundle/{oauth2-provider-THDZ27ZX.js → oauth2-provider-NVAVQTFM.js} +38 -72
  67. package/bundle/oauth2-provider-TZOUW4Q5.js +235 -0
  68. package/bundle/sandbox-macos-permissive-open.sb +113 -4
  69. package/bundle/sandbox-macos-permissive-proxied.sb +111 -9
  70. package/bundle/{start-SV5TPWOH.js → start-72YJPZDV.js} +6 -6
  71. package/bundle/{start-YON746V5.js → start-A4ZY5O7I.js} +6 -6
  72. package/bundle/{start-K5QQG7K4.js → start-GCMULBVZ.js} +6 -6
  73. package/bundle/start-HAMF674K.js +18 -0
  74. package/package.json +1 -1
@@ -278743,72 +278743,96 @@ 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
+ }
278746
278753
  async function initOauthClient(authType, config2) {
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
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
+ }
278751
278761
  });
278752
- const byoidClient = auth2.fromJSON({
278753
- ...credentials3,
278754
- refresh_token: credentials3.refresh_token ?? void 0
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);
278755
278770
  });
278756
- const token2 = await byoidClient.getAccessToken();
278757
- if (token2) {
278758
- debugLogger.debug(`Created ${credentials3.type} auth client.`);
278759
- return byoidClient;
278760
- }
278771
+ return client2;
278761
278772
  }
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();
278770
278773
  if (process.env["GOOGLE_GENAI_USE_GCA"] && process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]) {
278771
- client.setCredentials({
278774
+ const client2 = createBaseOAuth2Client();
278775
+ client2.setCredentials({
278772
278776
  access_token: process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]
278773
278777
  });
278774
- await fetchAndCacheUserInfo(client);
278775
- return client;
278778
+ await fetchAndCacheUserInfo(client2);
278779
+ return client2;
278776
278780
  }
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
- );
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
+ }
278799
278820
  }
278821
+ debugLogger.log("Loaded cached credentials.");
278822
+ await triggerPostAuthCallbacks(
278823
+ client2.credentials || credentials3
278824
+ );
278825
+ return client2;
278800
278826
  }
278801
- debugLogger.log("Loaded cached credentials.");
278802
- await triggerPostAuthCallbacks(credentials3);
278803
- return client;
278827
+ } catch (error40) {
278828
+ debugLogger.debug(
278829
+ "Cached credentials are not valid:",
278830
+ getErrorMessage(error40)
278831
+ );
278804
278832
  }
278805
- } catch (error40) {
278806
- debugLogger.debug(
278807
- `Cached credentials are not valid:`,
278808
- getErrorMessage(error40)
278809
- );
278810
278833
  }
278811
278834
  }
278835
+ const client = createBaseOAuth2Client();
278812
278836
  if (authType === "compute-default-credentials" /* COMPUTE_ADC */) {
278813
278837
  try {
278814
278838
  debugLogger.log(
@@ -279188,13 +279212,24 @@ function getAvailablePort() {
279188
279212
  }
279189
279213
  });
279190
279214
  }
279191
- async function fetchCachedCredentials() {
279215
+ async function fetchCachedCredentialsList() {
279216
+ const credentialsList = [];
279192
279217
  const useEncryptedStorage = getUseEncryptedStorageFlag();
279193
279218
  if (useEncryptedStorage) {
279194
- return OAuthCredentialStorage.loadCredentials();
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
+ }
279195
279230
  }
279196
279231
  const pathsToTry = [
279197
- Storage.getOAuthCredsPath(),
279232
+ ...!useEncryptedStorage ? [Storage.getOAuthCredsPath()] : [],
279198
279233
  process.env["GOOGLE_APPLICATION_CREDENTIALS"]
279199
279234
  ].filter((p) => !!p);
279200
279235
  for (const keyFile of pathsToTry) {
@@ -279203,9 +279238,10 @@ async function fetchCachedCredentials() {
279203
279238
  const parsed = JSON.parse(keyFileString);
279204
279239
  const isOAuthCreds = (val) => typeof val === "object" && val !== null;
279205
279240
  if (isOAuthCreds(parsed)) {
279206
- return parsed;
279241
+ credentialsList.push(parsed);
279242
+ } else {
279243
+ throw new Error("Invalid credentials format");
279207
279244
  }
279208
- throw new Error("Invalid credentials format");
279209
279245
  } catch (error40) {
279210
279246
  debugLogger.debug(
279211
279247
  `Failed to load credentials from ${keyFile}:`,
@@ -279213,7 +279249,7 @@ async function fetchCachedCredentials() {
279213
279249
  );
279214
279250
  }
279215
279251
  }
279216
- return null;
279252
+ return credentialsList;
279217
279253
  }
279218
279254
  function clearOauthClientCache() {
279219
279255
  oauthClientPromises.clear();
@@ -282727,8 +282763,8 @@ function isValidToolName(name3, options = {}) {
282727
282763
  }
282728
282764
 
282729
282765
  // packages/core/src/generated/git-commit.ts
282730
- var GIT_COMMIT_INFO = "5de3b24af";
282731
- var CLI_VERSION = "0.52.0";
282766
+ var GIT_COMMIT_INFO = "3818efbbf";
282767
+ var CLI_VERSION = "0.54.0-nightly.20260722.gf743ab579";
282732
282768
 
282733
282769
  // packages/core/src/ide/detect-ide.ts
282734
282770
  var IDE_DEFINITIONS = {
@@ -290472,6 +290508,12 @@ function getDiffCommand(oldPath, newPath, editor) {
290472
290508
  }
290473
290509
  }
290474
290510
  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
+ }
290475
290517
  const diffCommand = getDiffCommand(oldPath, newPath, editor);
290476
290518
  if (!diffCommand) {
290477
290519
  debugLogger.error("No diff tool available. Install a supported editor.");
@@ -306216,7 +306258,7 @@ function getVersion() {
306216
306258
  }
306217
306259
  versionPromise = (async () => {
306218
306260
  const pkgJson = await getPackageJson(__dirname4);
306219
- return "0.52.0";
306261
+ return "0.54.0-nightly.20260722.gf743ab579";
306220
306262
  })();
306221
306263
  return versionPromise;
306222
306264
  }
@@ -306735,6 +306777,12 @@ ${errorMessage}`,
306735
306777
  // packages/core/src/utils/llm-edit-fixer.ts
306736
306778
  import { createHash as createHash5 } from "node:crypto";
306737
306779
 
306780
+ // packages/core/src/utils/session.ts
306781
+ import { randomUUID as randomUUID5 } from "node:crypto";
306782
+ function createSessionId() {
306783
+ return randomUUID5();
306784
+ }
306785
+
306738
306786
  // packages/core/src/utils/secure-browser-launcher.ts
306739
306787
  import { execFile as execFile6 } from "node:child_process";
306740
306788
  import { promisify as promisify7 } from "node:util";
@@ -307555,6 +307603,7 @@ async function handleUpgrade() {
307555
307603
  async function processIntent(config2, intent, fallbackModel, failedModel) {
307556
307604
  switch (intent) {
307557
307605
  case "retry_always":
307606
+ config2.rotateSessionId(createSessionId());
307558
307607
  config2.activateFallbackMode(fallbackModel, failedModel);
307559
307608
  return true;
307560
307609
  case "retry_once":
@@ -310474,6 +310523,9 @@ var CodeAssistServer = class {
310474
310523
  this.paidTier = paidTier;
310475
310524
  this.config = config2;
310476
310525
  }
310526
+ getEffectiveSessionId() {
310527
+ return this.config?.getSessionId() ?? this.sessionId;
310528
+ }
310477
310529
  async generateContentStream(req, userPromptId, role) {
310478
310530
  const autoUse = this.config ? shouldAutoUseCredits(
310479
310531
  this.config.getBillingSettings().overageStrategy,
@@ -310492,7 +310544,7 @@ var CodeAssistServer = class {
310492
310544
  req,
310493
310545
  userPromptId,
310494
310546
  this.projectId,
310495
- this.sessionId,
310547
+ this.getEffectiveSessionId(),
310496
310548
  enabledCreditTypes
310497
310549
  ),
310498
310550
  req.config?.abortSignal
@@ -310520,7 +310572,7 @@ var CodeAssistServer = class {
310520
310572
  translatedResponse,
310521
310573
  streamingLatency,
310522
310574
  req.config?.abortSignal,
310523
- server.sessionId
310575
+ server.getEffectiveSessionId()
310524
310576
  // Use sessionId as trajectoryId
310525
310577
  );
310526
310578
  if (response.consumedCredits) {
@@ -310561,7 +310613,7 @@ var CodeAssistServer = class {
310561
310613
  req,
310562
310614
  userPromptId,
310563
310615
  this.projectId,
310564
- this.sessionId,
310616
+ this.getEffectiveSessionId(),
310565
310617
  void 0
310566
310618
  ),
310567
310619
  req.config?.abortSignal,
@@ -310579,7 +310631,7 @@ var CodeAssistServer = class {
310579
310631
  translatedResponse,
310580
310632
  streamingLatency,
310581
310633
  req.config?.abortSignal,
310582
- this.sessionId
310634
+ this.getEffectiveSessionId()
310583
310635
  // Use sessionId as trajectoryId
310584
310636
  );
310585
310637
  if (response.remainingCredits) {
@@ -312064,13 +312116,19 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
312064
312116
  customHeaders,
312065
312117
  vertexAiRouting
312066
312118
  };
312119
+ const getEnv3 = (key) => {
312120
+ if (config2?.env && config2.env[key] !== void 0) {
312121
+ return config2.env[key];
312122
+ }
312123
+ return process.env[key];
312124
+ };
312067
312125
  if (authType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ || authType === "compute-default-credentials" /* COMPUTE_ADC */) {
312068
312126
  return contentGeneratorConfig;
312069
312127
  }
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;
312128
+ const geminiApiKey = apiKey || getEnv3("GEMINI_API_KEY") || await loadApiKey() || void 0;
312129
+ const googleApiKey = getEnv3("GOOGLE_API_KEY") || void 0;
312130
+ const googleCloudProject = getEnv3("GOOGLE_CLOUD_PROJECT") || getEnv3("GOOGLE_CLOUD_PROJECT_ID") || void 0;
312131
+ const googleCloudLocation = getEnv3("GOOGLE_CLOUD_LOCATION") || void 0;
312074
312132
  if (authType === "gemini-api-key" /* USE_GEMINI */ && geminiApiKey) {
312075
312133
  contentGeneratorConfig.apiKey = geminiApiKey;
312076
312134
  contentGeneratorConfig.vertexai = false;
@@ -312082,7 +312140,7 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
312082
312140
  return contentGeneratorConfig;
312083
312141
  }
312084
312142
  if (authType === "gateway" /* GATEWAY */) {
312085
- contentGeneratorConfig.apiKey = apiKey || process.env["GEMINI_API_KEY"] || "";
312143
+ contentGeneratorConfig.apiKey = apiKey || getEnv3("GEMINI_API_KEY") || "";
312086
312144
  contentGeneratorConfig.vertexai = false;
312087
312145
  return contentGeneratorConfig;
312088
312146
  }
@@ -322812,7 +322870,7 @@ import { TextDecoder as TextDecoder2 } from "node:util";
322812
322870
  import os28 from "node:os";
322813
322871
  import fs47, { mkdirSync as mkdirSync4 } from "node:fs";
322814
322872
  import path57 from "node:path";
322815
- var import_headless2 = __toESM(require_xterm_headless(), 1);
322873
+ var import_headless3 = __toESM(require_xterm_headless(), 1);
322816
322874
 
322817
322875
  // packages/core/src/utils/terminalSerializer.ts
322818
322876
  var ColorMode = /* @__PURE__ */ ((ColorMode2) => {
@@ -323689,7 +323747,7 @@ var ExecutionLifecycleService = class {
323689
323747
  };
323690
323748
 
323691
323749
  // packages/core/src/services/shellExecutionService.ts
323692
- var { Terminal } = import_headless2.default;
323750
+ var { Terminal } = import_headless3.default;
323693
323751
  var MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024;
323694
323752
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR = "GEMINI_CLI";
323695
323753
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = "1";
@@ -323903,9 +323961,10 @@ ${truncated}`;
323903
323961
  usingPty
323904
323962
  );
323905
323963
  const spawnArgs = [...argsPrefix, finalCommand];
323964
+ const sourceEnv = shellExecutionConfig.env ?? process.env;
323906
323965
  const gitConfigKeys = [];
323907
323966
  if (!isInteractive) {
323908
- for (const key in process.env) {
323967
+ for (const key in sourceEnv) {
323909
323968
  if (key.startsWith("GIT_CONFIG_")) {
323910
323969
  gitConfigKeys.push(key);
323911
323970
  }
@@ -323918,7 +323977,7 @@ ${truncated}`;
323918
323977
  ...gitConfigKeys
323919
323978
  ]
323920
323979
  };
323921
- const sanitizedEnv = sanitizeEnvironment(process.env, sanitizationConfig);
323980
+ const sanitizedEnv = sanitizeEnvironment(sourceEnv, sanitizationConfig);
323922
323981
  const baseEnv = {
323923
323982
  ...sanitizedEnv,
323924
323983
  [GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
@@ -323928,7 +323987,7 @@ ${truncated}`;
323928
323987
  };
323929
323988
  if (!isInteractive) {
323930
323989
  for (const key of gitConfigKeys) {
323931
- baseEnv[key] = process.env[key];
323990
+ baseEnv[key] = sourceEnv[key];
323932
323991
  }
323933
323992
  const gitConfigCount = parseInt(baseEnv["GIT_CONFIG_COUNT"] || "0", 10);
323934
323993
  const newKey = `GIT_CONFIG_KEY_${gitConfigCount}`;
@@ -325414,6 +325473,7 @@ exit $__code`;
325414
325473
  this.context.config.isInteractiveShellEnabled(),
325415
325474
  {
325416
325475
  ...shellExecutionConfig,
325476
+ env: this.context.config.env,
325417
325477
  sessionId: this.context.config?.getSessionId?.() ?? "default",
325418
325478
  pager: "cat",
325419
325479
  sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.context.config.sanitizationConfig,
@@ -332028,10 +332088,10 @@ var TopicState = class {
332028
332088
  };
332029
332089
 
332030
332090
  // packages/core/src/agents/local-executor.ts
332031
- import { randomUUID as randomUUID12 } from "node:crypto";
332091
+ import { randomUUID as randomUUID13 } from "node:crypto";
332032
332092
 
332033
332093
  // packages/core/src/core/geminiChat.ts
332034
- import { randomUUID as randomUUID5 } from "node:crypto";
332094
+ import { randomUUID as randomUUID6 } from "node:crypto";
332035
332095
 
332036
332096
  // packages/core/src/utils/messageInspectors.ts
332037
332097
  function isFunctionResponse(content) {
@@ -332498,7 +332558,7 @@ var GeminiChat = class {
332498
332558
  let initialHistory;
332499
332559
  if (history.length > 0) {
332500
332560
  initialHistory = history.map(
332501
- (item) => "id" in item && "content" in item ? item : { id: randomUUID5(), content: item }
332561
+ (item) => "id" in item && "content" in item ? item : { id: randomUUID6(), content: item }
332502
332562
  );
332503
332563
  } else if (resumedSessionData) {
332504
332564
  initialHistory = resumedSessionData.conversation.messages.filter((m) => m.type === "user" || m.type === "gemini").map((m) => ({
@@ -332786,7 +332846,8 @@ var GeminiChat = class {
332786
332846
  return binaryParts.length > 0 ? binaryParts : void 0;
332787
332847
  }
332788
332848
  async makeApiCallAndProcessStream(modelConfigKey, requestHistory, prompt_id, abortSignal, role, apiHistoryOverride) {
332789
- const scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
332849
+ let scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
332850
+ scrubbedHistory = coalesceConsecutiveRoles(scrubbedHistory);
332790
332851
  const scrubbedContents = scrubbedHistory.map((h2) => h2.content);
332791
332852
  const requestContents = apiHistoryOverride ? scrubContents(apiHistoryOverride) : scrubbedContents;
332792
332853
  const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
@@ -332841,7 +332902,7 @@ var GeminiChat = class {
332841
332902
  tools: this.tools,
332842
332903
  abortSignal
332843
332904
  };
332844
- let contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
332905
+ let contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
332845
332906
  const hookSystem = this.context.config.getHookSystem();
332846
332907
  if (hookSystem) {
332847
332908
  const beforeModelResult = await hookSystem.fireBeforeModelEvent({
@@ -332876,7 +332937,7 @@ var GeminiChat = class {
332876
332937
  this.context.config.hasGemini35FlashGAAccess?.() ?? false
332877
332938
  );
332878
332939
  lastModelToUse = modelToUse;
332879
- contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
332940
+ contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
332880
332941
  }
332881
332942
  if (beforeModelResult.modifiedConfig) {
332882
332943
  Object.assign(config2, beforeModelResult.modifiedConfig);
@@ -332985,7 +333046,14 @@ var GeminiChat = class {
332985
333046
  */
332986
333047
  getHistoryTurns(curated = false) {
332987
333048
  const history = curated ? extractCuratedHistory2(this.agentHistory.get()) : [...this.agentHistory.get()];
332988
- return this.context.config.isContextManagementEnabled() ? scrubHistory(history) : history;
333049
+ if (this.context.config.isContextManagementEnabled()) {
333050
+ return scrubHistory(history);
333051
+ }
333052
+ const model = this.context.config.getModel();
333053
+ if (isGemini2Model(model) || supportsModernFeatures(model)) {
333054
+ return coalesceConsecutiveRoles(stripThoughts2(history));
333055
+ }
333056
+ return history;
332989
333057
  }
332990
333058
  /**
332991
333059
  * Clears the chat history.
@@ -333388,6 +333456,44 @@ function stripToolCallIdPrefixes(contents) {
333388
333456
  })
333389
333457
  }));
333390
333458
  }
333459
+ function coalesceConsecutiveRoles(history) {
333460
+ const result2 = [];
333461
+ for (const turn of history) {
333462
+ const lastIdx = result2.length - 1;
333463
+ const last2 = result2[lastIdx];
333464
+ if (last2 && last2.content.role && last2.content.role === turn.content.role) {
333465
+ const hasParts = last2.content.parts || turn.content.parts;
333466
+ result2[lastIdx] = {
333467
+ id: last2.id,
333468
+ content: {
333469
+ ...last2.content,
333470
+ parts: hasParts ? [...last2.content.parts || [], ...turn.content.parts || []] : void 0
333471
+ }
333472
+ };
333473
+ } else {
333474
+ result2.push({
333475
+ id: turn.id,
333476
+ content: { ...turn.content }
333477
+ });
333478
+ }
333479
+ }
333480
+ return result2;
333481
+ }
333482
+ function stripThoughts2(history) {
333483
+ return history.map((turn) => {
333484
+ if (!turn.content.parts) return turn;
333485
+ const hasThought = turn.content.parts.some((p) => p && p.thought);
333486
+ if (!hasThought) return turn;
333487
+ const nonThoughtParts = turn.content.parts.filter((p) => p && !p.thought);
333488
+ return {
333489
+ ...turn,
333490
+ content: {
333491
+ ...turn.content,
333492
+ parts: nonThoughtParts
333493
+ }
333494
+ };
333495
+ }).filter((turn) => !turn.content.parts || turn.content.parts.length > 0);
333496
+ }
333391
333497
 
333392
333498
  // packages/core/src/utils/ragLogger.ts
333393
333499
  import * as fs50 from "node:fs";
@@ -340689,7 +340795,13 @@ var GoogleCredentialsAuthProvider = class extends BaseA2AAuthProvider {
340689
340795
  "targetUrl must be provided to GoogleCredentialsAuthProvider to determine token audience."
340690
340796
  );
340691
340797
  }
340692
- const hostname3 = new URL(targetUrl).hostname;
340798
+ const urlObj = new URL(targetUrl);
340799
+ if (urlObj.protocol !== "https:") {
340800
+ throw new Error(
340801
+ `Protocol "${urlObj.protocol}" is not secure. Google Credential provider requires HTTPS.`
340802
+ );
340803
+ }
340804
+ const hostname3 = urlObj.hostname;
340693
340805
  const isRunAppHost = CLOUD_RUN_HOST_REGEX.test(hostname3);
340694
340806
  if (isRunAppHost) {
340695
340807
  this.useIdToken = true;
@@ -340803,7 +340915,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
340803
340915
  return provider;
340804
340916
  }
340805
340917
  case "oauth2": {
340806
- const { OAuth2AuthProvider } = await import("./oauth2-provider-THDZ27ZX.js");
340918
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-3THMIWTP.js");
340807
340919
  const provider = new OAuth2AuthProvider(
340808
340920
  authConfig,
340809
340921
  options.agentName ?? "unknown",
@@ -342497,7 +342609,7 @@ var SchedulerStateManager = class {
342497
342609
 
342498
342610
  // packages/core/src/scheduler/confirmation.ts
342499
342611
  import { on } from "node:events";
342500
- import { randomUUID as randomUUID6 } from "node:crypto";
342612
+ import { randomUUID as randomUUID7 } from "node:crypto";
342501
342613
  async function awaitConfirmation(messageBus, correlationId, signal) {
342502
342614
  if (signal.aborted) {
342503
342615
  throw new Error("Operation cancelled");
@@ -342549,7 +342661,7 @@ async function resolveConfirmation(toolCall, signal, deps) {
342549
342661
  details.systemMessage = deps.systemMessage;
342550
342662
  }
342551
342663
  await notifyHooks(deps, details);
342552
- const correlationId = randomUUID6();
342664
+ const correlationId = randomUUID7();
342553
342665
  const serializableDetails = details;
342554
342666
  lastDetails = serializableDetails;
342555
342667
  const ideConfirmation = "ideConfirmation" in details ? details.ideConfirmation : void 0;
@@ -343158,8 +343270,7 @@ var LoopDetectionService = class {
343158
343270
  promptId = "";
343159
343271
  userPrompt = "";
343160
343272
  // Tool call tracking
343161
- lastToolCallKey = null;
343162
- toolCallRepetitionCount = 0;
343273
+ toolCallHistory = [];
343163
343274
  // Content streaming tracking
343164
343275
  streamContentHistory = "";
343165
343276
  contentStats = /* @__PURE__ */ new Map();
@@ -343301,14 +343412,31 @@ var LoopDetectionService = class {
343301
343412
  }
343302
343413
  checkToolCallLoop(toolCall) {
343303
343414
  const key = this.getToolCallKey(toolCall);
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;
343415
+ this.toolCallHistory.push(key);
343416
+ const maxRequiredLength = 5 * TOOL_CALL_LOOP_THRESHOLD;
343417
+ if (this.toolCallHistory.length > maxRequiredLength) {
343418
+ this.toolCallHistory = this.toolCallHistory.slice(-maxRequiredLength);
343419
+ }
343420
+ const n3 = this.toolCallHistory.length;
343421
+ const R = TOOL_CALL_LOOP_THRESHOLD;
343422
+ for (let k = 1; k <= 5; k++) {
343423
+ const requiredLength = k * R;
343424
+ if (n3 >= requiredLength) {
343425
+ const cycle = this.toolCallHistory.slice(-k);
343426
+ let isPatternMatch = true;
343427
+ for (let i3 = 0; i3 < requiredLength; i3++) {
343428
+ const indexFromEnd = requiredLength - i3;
343429
+ const actualKey = this.toolCallHistory[n3 - indexFromEnd];
343430
+ const expectedKey = cycle[i3 % k];
343431
+ if (actualKey !== expectedKey) {
343432
+ isPatternMatch = false;
343433
+ break;
343434
+ }
343435
+ }
343436
+ if (isPatternMatch) {
343437
+ return true;
343438
+ }
343439
+ }
343312
343440
  }
343313
343441
  return false;
343314
343442
  }
@@ -343608,8 +343736,7 @@ ${this.userPrompt}
343608
343736
  this.loopDetected = false;
343609
343737
  }
343610
343738
  resetToolCallCount() {
343611
- this.lastToolCallKey = null;
343612
- this.toolCallRepetitionCount = 0;
343739
+ this.toolCallHistory = [];
343613
343740
  }
343614
343741
  resetContentTracking(resetHistory = true) {
343615
343742
  if (resetHistory) {
@@ -344211,7 +344338,7 @@ Output too large. Full output available at: ${filePath}
344211
344338
  };
344212
344339
 
344213
344340
  // packages/core/src/core/client.ts
344214
- import { randomUUID as randomUUID10 } from "node:crypto";
344341
+ import { randomUUID as randomUUID11 } from "node:crypto";
344215
344342
 
344216
344343
  // packages/core/src/context/config/registry.ts
344217
344344
  var ContextProcessorRegistry = class {
@@ -344793,7 +344920,7 @@ function formatNodesForLlm(nodes, options = {}) {
344793
344920
  }
344794
344921
 
344795
344922
  // packages/core/src/context/utils/snapshotGenerator.ts
344796
- import { randomUUID as randomUUID7 } from "node:crypto";
344923
+ import { randomUUID as randomUUID8 } from "node:crypto";
344797
344924
  function isStringArray(value) {
344798
344925
  return Array.isArray(value) && value.every((item) => typeof item === "string");
344799
344926
  }
@@ -345006,7 +345133,7 @@ ${formatNodesForLlm(nodes)}`;
345006
345133
  const desc = t2["description"];
345007
345134
  if (typeof desc === "string" && desc) {
345008
345135
  newState.active_tasks.push({
345009
- id: `task_${randomUUID7().slice(0, 8)}`,
345136
+ id: `task_${randomUUID8().slice(0, 8)}`,
345010
345137
  description: desc
345011
345138
  });
345012
345139
  }
@@ -345664,7 +345791,7 @@ async function loadContextManagementConfig(sidecarPath, registry2) {
345664
345791
  // packages/core/src/context/tracer.ts
345665
345792
  import * as fsSync3 from "node:fs";
345666
345793
  import * as path69 from "node:path";
345667
- import { randomUUID as randomUUID8 } from "node:crypto";
345794
+ import { randomUUID as randomUUID9 } from "node:crypto";
345668
345795
  var ContextTracer = class {
345669
345796
  traceDir;
345670
345797
  assetsDir;
@@ -345718,7 +345845,7 @@ var ContextTracer = class {
345718
345845
  saveAsset(component, assetName, data) {
345719
345846
  if (!this.enabled) return "asset-recording-disabled";
345720
345847
  try {
345721
- const assetId = `${Date.now()}-${randomUUID8()}-${assetName}.json`;
345848
+ const assetId = `${Date.now()}-${randomUUID9()}-${assetName}.json`;
345722
345849
  const assetPath = path69.join(this.assetsDir, assetId);
345723
345850
  fsSync3.writeFileSync(assetPath, JSON.stringify(data, null, 2), "utf-8");
345724
345851
  this.logEvent(component, `Saved asset: ${assetName}`, { assetId });
@@ -345774,12 +345901,12 @@ var ContextEventBus = class extends EventEmitter5 {
345774
345901
  };
345775
345902
 
345776
345903
  // packages/core/src/context/pipeline/inbox.ts
345777
- import { randomUUID as randomUUID9 } from "node:crypto";
345904
+ import { randomUUID as randomUUID10 } from "node:crypto";
345778
345905
  var LiveInbox = class {
345779
345906
  messages = [];
345780
345907
  publish(topic, payload) {
345781
345908
  this.messages.push({
345782
- id: randomUUID9(),
345909
+ id: randomUUID10(),
345783
345910
  topic,
345784
345911
  payload,
345785
345912
  timestamp: Date.now()
@@ -347876,7 +348003,7 @@ var GeminiClient = class {
347876
348003
  if (this.contextManager) {
347877
348004
  const rawPendingRequest = createUserContent(request);
347878
348005
  const pendingRequest = {
347879
- id: randomUUID10(),
348006
+ id: randomUUID11(),
347880
348007
  content: rawPendingRequest
347881
348008
  };
347882
348009
  const {
@@ -350157,7 +350284,7 @@ function createScopedWorkspaceContext(parentContext, additionalDirectories) {
350157
350284
  }
350158
350285
 
350159
350286
  // packages/core/src/confirmation-bus/message-bus.ts
350160
- import { randomUUID as randomUUID11 } from "node:crypto";
350287
+ import { randomUUID as randomUUID12 } from "node:crypto";
350161
350288
  import { EventEmitter as EventEmitter6 } from "node:events";
350162
350289
  var MessageBus = class _MessageBus extends EventEmitter6 {
350163
350290
  constructor(policyEngine, debug2 = false, isTrusted = true) {
@@ -350318,7 +350445,7 @@ var MessageBus = class _MessageBus extends EventEmitter6 {
350318
350445
  * The correlation ID is generated internally and added to the request
350319
350446
  */
350320
350447
  async request(request, responseType, timeoutMs = 6e4) {
350321
- const correlationId = randomUUID11();
350448
+ const correlationId = randomUUID12();
350322
350449
  return new Promise((resolve29, reject) => {
350323
350450
  const timeoutId = setTimeout(() => {
350324
350451
  cleanup();
@@ -350602,7 +350729,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
350602
350729
  this.compressionService = new ChatCompressionService();
350603
350730
  this.parentCallId = parentCallId;
350604
350731
  this.cache = new import_lru_cache.default(10);
350605
- this.agentId = randomUUID12();
350732
+ this.agentId = randomUUID13();
350606
350733
  }
350607
350734
  /**
350608
350735
  * Executes a single turn of the agent's logic, from calling the model
@@ -351047,7 +351174,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
351047
351174
  } else if (info2.compressionStatus === 1 /* COMPRESSED */) {
351048
351175
  if (newHistory) {
351049
351176
  const turns = newHistory.map((c4) => ({
351050
- id: randomUUID12(),
351177
+ id: randomUUID13(),
351051
351178
  content: c4
351052
351179
  }));
351053
351180
  chat.setHistory(turns);
@@ -351056,7 +351183,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
351056
351183
  } else if (info2.compressionStatus === 6 /* CONTENT_TRUNCATED */) {
351057
351184
  if (newHistory) {
351058
351185
  const turns = newHistory.map((c4) => ({
351059
- id: randomUUID12(),
351186
+ id: randomUUID13(),
351060
351187
  content: c4
351061
351188
  }));
351062
351189
  chat.setHistory(turns);
@@ -351510,7 +351637,7 @@ Important Rules:
351510
351637
  };
351511
351638
 
351512
351639
  // packages/core/src/agents/local-invocation.ts
351513
- import { randomUUID as randomUUID13 } from "node:crypto";
351640
+ import { randomUUID as randomUUID14 } from "node:crypto";
351514
351641
 
351515
351642
  // packages/core/src/utils/agent-sanitization-utils.ts
351516
351643
  var SENSITIVE_KEY_PATTERNS = [
@@ -351686,7 +351813,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
351686
351813
  lastItem.content = sanitizeThoughtContent(text);
351687
351814
  } else {
351688
351815
  recentActivity.push({
351689
- id: randomUUID13(),
351816
+ id: randomUUID14(),
351690
351817
  type: "thought",
351691
351818
  content: sanitizeThoughtContent(text),
351692
351819
  status: "running" /* RUNNING */
@@ -351706,7 +351833,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
351706
351833
  const args2 = JSON.stringify(
351707
351834
  sanitizeToolArgs(activity.data["args"])
351708
351835
  );
351709
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID13();
351836
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID14();
351710
351837
  recentActivity.push({
351711
351838
  id: callId,
351712
351839
  type: "tool_call",
@@ -351757,7 +351884,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
351757
351884
  }
351758
351885
  }
351759
351886
  recentActivity.push({
351760
- id: randomUUID13(),
351887
+ id: randomUUID14(),
351761
351888
  type: "thought",
351762
351889
  content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
351763
351890
  status: isCancellation || isRejection ? "cancelled" /* CANCELLED */ : "error" /* ERROR */
@@ -351832,7 +351959,7 @@ ${output.result}`;
351832
351959
  const lastActivity = recentActivity[recentActivity.length - 1];
351833
351960
  if (!lastActivity || lastActivity.status !== "error" /* ERROR */) {
351834
351961
  recentActivity.push({
351835
- id: randomUUID13(),
351962
+ id: randomUUID14(),
351836
351963
  type: "thought",
351837
351964
  content: `Error: ${errorMessage}`,
351838
351965
  status: "error" /* ERROR */
@@ -352288,7 +352415,7 @@ ${errorMessage}` : errorMessage;
352288
352415
  };
352289
352416
 
352290
352417
  // packages/core/src/agents/local-session-invocation.ts
352291
- import { randomUUID as randomUUID15 } from "node:crypto";
352418
+ import { randomUUID as randomUUID16 } from "node:crypto";
352292
352419
 
352293
352420
  // packages/core/src/utils/checks.ts
352294
352421
  function assumeExhaustive(_value) {
@@ -352299,7 +352426,7 @@ function checkExhaustive(value, msg = `unexpected value ${value}!`) {
352299
352426
  }
352300
352427
 
352301
352428
  // packages/core/src/agents/local-subagent-protocol.ts
352302
- import { randomUUID as randomUUID14 } from "node:crypto";
352429
+ import { randomUUID as randomUUID15 } from "node:crypto";
352303
352430
 
352304
352431
  // packages/core/src/agent/agent-session.ts
352305
352432
  var AgentSession = class {
@@ -352494,7 +352621,7 @@ var LocalSubagentProtocol = class {
352494
352621
  }
352495
352622
  _events = [];
352496
352623
  _subscribers = /* @__PURE__ */ new Set();
352497
- _streamId = randomUUID14();
352624
+ _streamId = randomUUID15();
352498
352625
  _eventCounter = 0;
352499
352626
  _agentStartEmitted = false;
352500
352627
  _agentEndEmitted = false;
@@ -352569,7 +352696,7 @@ var LocalSubagentProtocol = class {
352569
352696
  // Core: execution
352570
352697
  // ---------------------------------------------------------------------------
352571
352698
  _beginNewStream() {
352572
- this._streamId = randomUUID14();
352699
+ this._streamId = randomUUID15();
352573
352700
  this._eventCounter = 0;
352574
352701
  this._abortController = new AbortController();
352575
352702
  this._agentStartEmitted = false;
@@ -352635,7 +352762,7 @@ var LocalSubagentProtocol = class {
352635
352762
  }
352636
352763
  case "TOOL_CALL_START": {
352637
352764
  const rawCallId = activity.data["callId"];
352638
- const callId = String(rawCallId ?? randomUUID14());
352765
+ const callId = String(rawCallId ?? randomUUID15());
352639
352766
  const rawName = activity.data["name"];
352640
352767
  const name3 = String(rawName ?? "unknown");
352641
352768
  const rawArgs = activity.data["args"];
@@ -352653,7 +352780,7 @@ var LocalSubagentProtocol = class {
352653
352780
  }
352654
352781
  case "TOOL_CALL_END": {
352655
352782
  const rawId = activity.data["id"];
352656
- const requestId = String(rawId ?? randomUUID14());
352783
+ const requestId = String(rawId ?? randomUUID15());
352657
352784
  const rawName = activity.data["name"];
352658
352785
  const name3 = String(rawName ?? "unknown");
352659
352786
  const rawOutput = activity.data["output"];
@@ -352838,7 +352965,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
352838
352965
  lastItem.content = sanitizeThoughtContent(text);
352839
352966
  } else {
352840
352967
  recentActivity.push({
352841
- id: randomUUID15(),
352968
+ id: randomUUID16(),
352842
352969
  type: "thought",
352843
352970
  content: sanitizeThoughtContent(text),
352844
352971
  status: "running" /* RUNNING */
@@ -352857,7 +352984,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
352857
352984
  const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"]).trim()) : void 0;
352858
352985
  const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
352859
352986
  const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
352860
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID15();
352987
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID16();
352861
352988
  recentActivity.push({
352862
352989
  id: callId,
352863
352990
  type: "tool_call",
@@ -352909,7 +353036,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
352909
353036
  }
352910
353037
  }
352911
353038
  recentActivity.push({
352912
- id: randomUUID15(),
353039
+ id: randomUUID16(),
352913
353040
  type: "thought",
352914
353041
  content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
352915
353042
  status: isCancellation || isRejection ? "cancelled" /* CANCELLED */ : "error" /* ERROR */
@@ -353012,7 +353139,7 @@ ${output.result}`;
353012
353139
  const lastActivity = recentActivity[recentActivity.length - 1];
353013
353140
  if (!lastActivity || lastActivity.status !== "error" /* ERROR */) {
353014
353141
  recentActivity.push({
353015
- id: randomUUID15(),
353142
+ id: randomUUID16(),
353016
353143
  type: "thought",
353017
353144
  content: `Error: ${errorMessage}`,
353018
353145
  status: "error" /* ERROR */
@@ -353046,7 +353173,7 @@ ${output.result}`;
353046
353173
  };
353047
353174
 
353048
353175
  // packages/core/src/agents/remote-subagent-protocol.ts
353049
- import { randomUUID as randomUUID16 } from "node:crypto";
353176
+ import { randomUUID as randomUUID17 } from "node:crypto";
353050
353177
  function isAbortLikeError2(err2) {
353051
353178
  return err2 instanceof Error && err2.name === "AbortError";
353052
353179
  }
@@ -353062,7 +353189,7 @@ var RemoteSubagentProtocol = class {
353062
353189
  }
353063
353190
  _events = [];
353064
353191
  _subscribers = /* @__PURE__ */ new Set();
353065
- _streamId = randomUUID16();
353192
+ _streamId = randomUUID17();
353066
353193
  _eventCounter = 0;
353067
353194
  _agentStartEmitted = false;
353068
353195
  _agentEndEmitted = false;
@@ -353135,7 +353262,7 @@ var RemoteSubagentProtocol = class {
353135
353262
  // Core: A2A streaming
353136
353263
  // ---------------------------------------------------------------------------
353137
353264
  _beginNewStream() {
353138
- this._streamId = randomUUID16();
353265
+ this._streamId = randomUUID17();
353139
353266
  this._eventCounter = 0;
353140
353267
  this._abortController = new AbortController();
353141
353268
  this._agentStartEmitted = false;
@@ -353549,7 +353676,7 @@ ${errorMessage}` : errorMessage;
353549
353676
  };
353550
353677
 
353551
353678
  // packages/core/src/agents/browser/browserAgentInvocation.ts
353552
- import { randomUUID as randomUUID17 } from "node:crypto";
353679
+ import { randomUUID as randomUUID18 } from "node:crypto";
353553
353680
 
353554
353681
  // packages/core/src/utils/browserConsent.ts
353555
353682
  import * as fs59 from "node:fs/promises";
@@ -355229,7 +355356,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
355229
355356
  const printOutput = updateOutput ? (msg) => {
355230
355357
  const sanitizedMsg = sanitizeThoughtContent(msg);
355231
355358
  recentActivity.push({
355232
- id: randomUUID17(),
355359
+ id: randomUUID18(),
355233
355360
  type: "thought",
355234
355361
  content: sanitizedMsg,
355235
355362
  status: "completed" /* COMPLETED */
@@ -355264,7 +355391,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
355264
355391
  lastItem.content = sanitizeThoughtContent(text);
355265
355392
  } else {
355266
355393
  recentActivity.push({
355267
- id: randomUUID17(),
355394
+ id: randomUUID18(),
355268
355395
  type: "thought",
355269
355396
  content: sanitizeThoughtContent(text),
355270
355397
  status: "running" /* RUNNING */
@@ -355280,7 +355407,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
355280
355407
  const args2 = JSON.stringify(
355281
355408
  sanitizeToolArgs(activity.data["args"])
355282
355409
  );
355283
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID17();
355410
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID18();
355284
355411
  recentActivity.push({
355285
355412
  id: callId,
355286
355413
  type: "tool_call",
@@ -355329,7 +355456,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
355329
355456
  }
355330
355457
  const sanitizedError = sanitizeErrorMessage(error40);
355331
355458
  recentActivity.push({
355332
- id: randomUUID17(),
355459
+ id: randomUUID18(),
355333
355460
  type: "thought",
355334
355461
  content: isCancellation ? sanitizedError : `Error: ${sanitizedError}`,
355335
355462
  status: newStatus
@@ -368681,7 +368808,9 @@ var CheckerRunner = class _CheckerRunner {
368681
368808
  executeCheckerProcess(checkerPath, input, checkerName) {
368682
368809
  return new Promise((resolve29) => {
368683
368810
  const child = spawn9(checkerPath, [], {
368684
- stdio: ["pipe", "pipe", "pipe"]
368811
+ stdio: ["pipe", "pipe", "pipe"],
368812
+ cwd: this.contextBuilder.config.getWorkingDir(),
368813
+ env: { ...process.env, ...this.contextBuilder.config.env }
368685
368814
  });
368686
368815
  let stdout = "";
368687
368816
  let stderr = "";
@@ -368787,6 +368916,9 @@ var ContextBuilder = class {
368787
368916
  constructor(context2) {
368788
368917
  this.context = context2;
368789
368918
  }
368919
+ get config() {
368920
+ return this.context.config;
368921
+ }
368790
368922
  /**
368791
368923
  * Builds the full context object with all available data.
368792
368924
  */
@@ -370439,7 +370571,7 @@ var McpComplianceTransport = class extends EventEmitter8 {
370439
370571
  // packages/core/src/tools/mcp-client.ts
370440
370572
  import { basename as basename7 } from "node:path";
370441
370573
  import { pathToFileURL } from "node:url";
370442
- import { randomUUID as randomUUID18 } from "node:crypto";
370574
+ import { randomUUID as randomUUID19 } from "node:crypto";
370443
370575
 
370444
370576
  // packages/core/src/mcp/oauth-token-storage.ts
370445
370577
  import { promises as fs75 } from "node:fs";
@@ -372412,7 +372544,7 @@ var McpCallableTool2 = class {
372412
372544
  throw new Error("McpCallableTool only supports single function call");
372413
372545
  }
372414
372546
  const call = functionCalls[0];
372415
- const progressToken = randomUUID18();
372547
+ const progressToken = randomUUID19();
372416
372548
  const context2 = getToolCallContext();
372417
372549
  if (context2 && this.progressReporter) {
372418
372550
  this.progressReporter.registerProgressToken(
@@ -381149,8 +381281,8 @@ function rng3() {
381149
381281
  }
381150
381282
 
381151
381283
  // packages/core/node_modules/uuid/dist-node/native.js
381152
- import { randomUUID as randomUUID19 } from "node:crypto";
381153
- var native_default2 = { randomUUID: randomUUID19 };
381284
+ import { randomUUID as randomUUID20 } from "node:crypto";
381285
+ var native_default2 = { randomUUID: randomUUID20 };
381154
381286
 
381155
381287
  // packages/core/node_modules/uuid/dist-node/v4.js
381156
381288
  function _v4(options, buf, offset) {
@@ -381555,6 +381687,7 @@ var Config = class {
381555
381687
  useTerminalBuffer;
381556
381688
  useRenderProcess;
381557
381689
  shellExecutionConfig;
381690
+ env;
381558
381691
  extensionManagement = true;
381559
381692
  extensionRegistryURI;
381560
381693
  truncateToolOutputThreshold;
@@ -381728,6 +381861,7 @@ var Config = class {
381728
381861
  this.checkpointing = params.checkpointing ?? false;
381729
381862
  this.proxy = params.proxy;
381730
381863
  this.cwd = params.cwd ?? process15.cwd();
381864
+ this.env = params.env;
381731
381865
  this.fileDiscoveryService = params.fileDiscoveryService ?? null;
381732
381866
  this.bugCommand = params.bugCommand;
381733
381867
  this.model = params.model;
@@ -382289,6 +382423,9 @@ var Config = class {
382289
382423
  this.refreshSessionScopedPlansDirectory(previousPlansDir);
382290
382424
  }
382291
382425
  }
382426
+ rotateSessionId(sessionId) {
382427
+ this._sessionId = sessionId;
382428
+ }
382292
382429
  resetNewSessionState(sessionId) {
382293
382430
  this.setSessionId(sessionId);
382294
382431
  }
@@ -384760,7 +384897,7 @@ Write the complete content to the \`GEMINI.md\` file. The output must be well-fo
384760
384897
  }
384761
384898
 
384762
384899
  // packages/core/src/commands/memory.ts
384763
- import { randomUUID as randomUUID21 } from "node:crypto";
384900
+ import { randomUUID as randomUUID22 } from "node:crypto";
384764
384901
  import { constants as fsConstants3 } from "node:fs";
384765
384902
  import * as fs81 from "node:fs/promises";
384766
384903
  import * as path93 from "node:path";
@@ -385249,7 +385386,7 @@ async function resolveTargetWithinAllowedRoots(targetPath, allowedRoots) {
385249
385386
  import * as fs80 from "node:fs/promises";
385250
385387
  import * as path92 from "node:path";
385251
385388
  import { constants as fsConstants2 } from "node:fs";
385252
- import { randomUUID as randomUUID20 } from "node:crypto";
385389
+ import { randomUUID as randomUUID21 } from "node:crypto";
385253
385390
 
385254
385391
  // packages/core/src/agents/skill-extraction-agent.ts
385255
385392
  var SkillExtractionSchema = external_exports.object({
@@ -386268,7 +386405,7 @@ function buildAgentLoopContext(config2) {
386268
386405
  const autoApproveBus = new MessageBus(autoApprovePolicy);
386269
386406
  return {
386270
386407
  config: config2,
386271
- promptId: `skill-extraction-${randomUUID20().slice(0, 8)}`,
386408
+ promptId: `skill-extraction-${randomUUID21().slice(0, 8)}`,
386272
386409
  toolRegistry: config2.getToolRegistry(),
386273
386410
  promptRegistry: new PromptRegistry(),
386274
386411
  resourceRegistry: new ResourceRegistry(),
@@ -387436,7 +387573,7 @@ async function restoreCommittedInboxPatchTarget(stagedTarget) {
387436
387573
  );
387437
387574
  const restorePath = path93.join(
387438
387575
  restoreDir,
387439
- `.${path93.basename(stagedTarget.targetPath)}.${randomUUID21()}.rollback`
387576
+ `.${path93.basename(stagedTarget.targetPath)}.${randomUUID22()}.rollback`
387440
387577
  );
387441
387578
  await writeExclusiveFile(
387442
387579
  restorePath,
@@ -387459,7 +387596,7 @@ async function stageInboxPatchTargets(targets) {
387459
387596
  );
387460
387597
  const tempPath = path93.join(
387461
387598
  tempDir,
387462
- `.${path93.basename(target.targetPath)}.${randomUUID21()}.patch-tmp`
387599
+ `.${path93.basename(target.targetPath)}.${randomUUID22()}.patch-tmp`
387463
387600
  );
387464
387601
  await writeExclusiveFile(tempPath, target.patched, mode);
387465
387602
  stagedTargets.push({
@@ -393690,12 +393827,6 @@ var ReadManyFilesTool = class _ReadManyFilesTool extends BaseDeclarativeTool {
393690
393827
  }
393691
393828
  };
393692
393829
 
393693
- // packages/core/src/utils/session.ts
393694
- import { randomUUID as randomUUID22 } from "node:crypto";
393695
- function createSessionId() {
393696
- return randomUUID22();
393697
- }
393698
-
393699
393830
  // packages/core/src/utils/compatibility.ts
393700
393831
  import os32 from "node:os";
393701
393832
  function isWindows10() {
@@ -402312,6 +402443,7 @@ export {
402312
402443
  resetVersionCache,
402313
402444
  IDEConnectionStatus,
402314
402445
  IdeClient,
402446
+ createSessionId,
402315
402447
  openBrowserSecurely,
402316
402448
  shouldLaunchBrowser,
402317
402449
  getErrorStatus,
@@ -402449,6 +402581,8 @@ export {
402449
402581
  isSchemaDepthError,
402450
402582
  isInvalidArgumentError,
402451
402583
  stripToolCallIdPrefixes,
402584
+ coalesceConsecutiveRoles,
402585
+ stripThoughts2 as stripThoughts,
402452
402586
  populateToolDisplay,
402453
402587
  toolResultDisplayToDisplayContent,
402454
402588
  renderDisplayDiff,
@@ -402738,7 +402872,6 @@ export {
402738
402872
  LegacyAgentProtocol,
402739
402873
  LegacyAgentSession,
402740
402874
  ReadManyFilesTool,
402741
- createSessionId,
402742
402875
  isWindows10,
402743
402876
  isJetBrainsTerminal,
402744
402877
  isTmux,