@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
@@ -278401,66 +278401,85 @@ var oauthClientPromises = /* @__PURE__ */ new Map();
278401
278401
  function getUseEncryptedStorageFlag() {
278402
278402
  return process.env[FORCE_ENCRYPTED_FILE_ENV_VAR] === "true";
278403
278403
  }
278404
+ function isAdcCredentials(credentials3) {
278405
+ if (credentials3 && typeof credentials3 === "object" && "type" in credentials3) {
278406
+ const type2 = credentials3.type;
278407
+ return typeof type2 === "string" && type2 !== "authorized_user";
278408
+ }
278409
+ return false;
278410
+ }
278404
278411
  async function initOauthClient(authType, config2) {
278405
- const credentials3 = await fetchCachedCredentials();
278406
- if (credentials3 && typeof credentials3 === "object" && "type" in credentials3 && (credentials3.type === "external_account_authorized_user" || credentials3.type === "service_account")) {
278407
- const auth2 = new import_google_auth_library3.GoogleAuth({
278408
- scopes: OAUTH_SCOPE
278412
+ function createBaseOAuth2Client() {
278413
+ const client2 = new import_google_auth_library3.OAuth2Client({
278414
+ clientId: OAUTH_CLIENT_ID,
278415
+ clientSecret: OAUTH_CLIENT_SECRET,
278416
+ transporterOptions: {
278417
+ proxy: config2.getProxy()
278418
+ }
278409
278419
  });
278410
- const byoidClient = auth2.fromJSON({
278411
- ...credentials3,
278412
- refresh_token: credentials3.refresh_token ?? void 0
278420
+ const useEncryptedStorage = getUseEncryptedStorageFlag();
278421
+ client2.on("tokens", async (tokens) => {
278422
+ if (useEncryptedStorage) {
278423
+ await OAuthCredentialStorage.saveCredentials(tokens);
278424
+ } else {
278425
+ await cacheCredentials(tokens);
278426
+ }
278427
+ await triggerPostAuthCallbacks(tokens);
278413
278428
  });
278414
- const token2 = await byoidClient.getAccessToken();
278415
- if (token2) {
278416
- debugLogger.debug(`Created ${credentials3.type} auth client.`);
278417
- return byoidClient;
278418
- }
278429
+ return client2;
278419
278430
  }
278420
- const client = new import_google_auth_library3.OAuth2Client({
278421
- clientId: OAUTH_CLIENT_ID,
278422
- clientSecret: OAUTH_CLIENT_SECRET,
278423
- transporterOptions: {
278424
- proxy: config2.getProxy()
278425
- }
278426
- });
278427
- const useEncryptedStorage = getUseEncryptedStorageFlag();
278428
278431
  if (process.env["GOOGLE_GENAI_USE_GCA"] && process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]) {
278429
- client.setCredentials({
278432
+ const client2 = createBaseOAuth2Client();
278433
+ client2.setCredentials({
278430
278434
  access_token: process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]
278431
278435
  });
278432
- await fetchAndCacheUserInfo(client);
278433
- return client;
278436
+ await fetchAndCacheUserInfo(client2);
278437
+ return client2;
278434
278438
  }
278435
- client.on("tokens", async (tokens) => {
278436
- if (useEncryptedStorage) {
278437
- await OAuthCredentialStorage.saveCredentials(tokens);
278438
- } else {
278439
- await cacheCredentials(tokens);
278440
- }
278441
- await triggerPostAuthCallbacks(tokens);
278442
- });
278443
- if (credentials3) {
278444
- client.setCredentials(credentials3);
278445
- try {
278446
- const { token: token2 } = await client.getAccessToken();
278447
- if (token2) {
278448
- await client.getTokenInfo(token2);
278449
- if (!userAccountManager2.getCachedGoogleAccount()) {
278450
- try {
278451
- await fetchAndCacheUserInfo(client);
278452
- } catch (error40) {
278453
- debugLogger.warn("Failed to fetch user info:", getErrorMessage(error40));
278439
+ const credentialsList = await fetchCachedCredentialsList();
278440
+ for (const credentials3 of credentialsList) {
278441
+ if (isAdcCredentials(credentials3)) {
278442
+ try {
278443
+ const auth2 = new import_google_auth_library3.GoogleAuth({
278444
+ scopes: OAUTH_SCOPE
278445
+ });
278446
+ const adcClient = auth2.fromJSON({
278447
+ ...credentials3,
278448
+ refresh_token: credentials3.refresh_token ?? void 0
278449
+ });
278450
+ const response = await adcClient.getAccessToken();
278451
+ const token2 = response.token ?? null;
278452
+ if (token2) {
278453
+ debugLogger.debug("Created " + credentials3.type + " auth client.");
278454
+ return adcClient;
278455
+ }
278456
+ } catch (error40) {
278457
+ debugLogger.debug("ADC credentials verification failed:", getErrorMessage(error40));
278458
+ }
278459
+ } else if (credentials3) {
278460
+ const client2 = createBaseOAuth2Client();
278461
+ client2.setCredentials(credentials3);
278462
+ try {
278463
+ const { token: token2 } = await client2.getAccessToken();
278464
+ if (token2) {
278465
+ await client2.getTokenInfo(token2);
278466
+ if (!userAccountManager2.getCachedGoogleAccount()) {
278467
+ try {
278468
+ await fetchAndCacheUserInfo(client2);
278469
+ } catch (error40) {
278470
+ debugLogger.warn("Failed to fetch user info:", getErrorMessage(error40));
278471
+ }
278454
278472
  }
278473
+ debugLogger.log("Loaded cached credentials.");
278474
+ await triggerPostAuthCallbacks(client2.credentials || credentials3);
278475
+ return client2;
278455
278476
  }
278456
- debugLogger.log("Loaded cached credentials.");
278457
- await triggerPostAuthCallbacks(credentials3);
278458
- return client;
278477
+ } catch (error40) {
278478
+ debugLogger.debug("Cached credentials are not valid:", getErrorMessage(error40));
278459
278479
  }
278460
- } catch (error40) {
278461
- debugLogger.debug(`Cached credentials are not valid:`, getErrorMessage(error40));
278462
278480
  }
278463
278481
  }
278482
+ const client = createBaseOAuth2Client();
278464
278483
  if (authType === AuthType2.COMPUTE_ADC) {
278465
278484
  try {
278466
278485
  debugLogger.log("Attempting to authenticate via metadata server application default credentials.");
@@ -278769,13 +278788,21 @@ function getAvailablePort() {
278769
278788
  }
278770
278789
  });
278771
278790
  }
278772
- async function fetchCachedCredentials() {
278791
+ async function fetchCachedCredentialsList() {
278792
+ const credentialsList = [];
278773
278793
  const useEncryptedStorage = getUseEncryptedStorageFlag();
278774
278794
  if (useEncryptedStorage) {
278775
- return OAuthCredentialStorage.loadCredentials();
278795
+ try {
278796
+ const creds = await OAuthCredentialStorage.loadCredentials();
278797
+ if (creds) {
278798
+ credentialsList.push(creds);
278799
+ }
278800
+ } catch (error40) {
278801
+ debugLogger.debug("Failed to load credentials from encrypted storage:", error40);
278802
+ }
278776
278803
  }
278777
278804
  const pathsToTry = [
278778
- Storage.getOAuthCredsPath(),
278805
+ ...!useEncryptedStorage ? [Storage.getOAuthCredsPath()] : [],
278779
278806
  process.env["GOOGLE_APPLICATION_CREDENTIALS"]
278780
278807
  ].filter((p) => !!p);
278781
278808
  for (const keyFile of pathsToTry) {
@@ -278784,14 +278811,15 @@ async function fetchCachedCredentials() {
278784
278811
  const parsed = JSON.parse(keyFileString);
278785
278812
  const isOAuthCreds = (val) => typeof val === "object" && val !== null;
278786
278813
  if (isOAuthCreds(parsed)) {
278787
- return parsed;
278814
+ credentialsList.push(parsed);
278815
+ } else {
278816
+ throw new Error("Invalid credentials format");
278788
278817
  }
278789
- throw new Error("Invalid credentials format");
278790
278818
  } catch (error40) {
278791
278819
  debugLogger.debug(`Failed to load credentials from ${keyFile}:`, getErrorMessage(error40));
278792
278820
  }
278793
278821
  }
278794
- return null;
278822
+ return credentialsList;
278795
278823
  }
278796
278824
  function clearOauthClientCache() {
278797
278825
  oauthClientPromises.clear();
@@ -282465,8 +282493,8 @@ function isValidToolName(name3, options = {}) {
282465
282493
  }
282466
282494
 
282467
282495
  // packages/core/dist/src/generated/git-commit.js
282468
- var GIT_COMMIT_INFO = "5de3b24af";
282469
- var CLI_VERSION = "0.52.0";
282496
+ var GIT_COMMIT_INFO = "3818efbbf";
282497
+ var CLI_VERSION = "0.54.0-nightly.20260722.gf743ab579";
282470
282498
 
282471
282499
  // packages/core/dist/src/ide/detect-ide.js
282472
282500
  var IDE_DEFINITIONS = {
@@ -289959,6 +289987,10 @@ function getDiffCommand(oldPath, newPath, editor) {
289959
289987
  }
289960
289988
  }
289961
289989
  async function openDiff(oldPath, newPath, editor) {
289990
+ if (isHeadlessMode()) {
289991
+ debugLogger.warn("External editor spawning is disabled in headless/server mode.");
289992
+ return;
289993
+ }
289962
289994
  const diffCommand = getDiffCommand(oldPath, newPath, editor);
289963
289995
  if (!diffCommand) {
289964
289996
  debugLogger.error("No diff tool available. Install a supported editor.");
@@ -305643,7 +305675,7 @@ function getVersion() {
305643
305675
  }
305644
305676
  versionPromise = (async () => {
305645
305677
  const pkgJson = await getPackageJson(__dirname4);
305646
- return "0.52.0";
305678
+ return "0.54.0-nightly.20260726.g3818efbbf";
305647
305679
  })();
305648
305680
  return versionPromise;
305649
305681
  }
@@ -306084,6 +306116,12 @@ ${errorMessage}`, true);
306084
306116
  // packages/core/dist/src/utils/llm-edit-fixer.js
306085
306117
  import { createHash as createHash5 } from "node:crypto";
306086
306118
 
306119
+ // packages/core/dist/src/utils/session.js
306120
+ import { randomUUID as randomUUID5 } from "node:crypto";
306121
+ function createSessionId() {
306122
+ return randomUUID5();
306123
+ }
306124
+
306087
306125
  // packages/core/dist/src/utils/secure-browser-launcher.js
306088
306126
  import { execFile as execFile6 } from "node:child_process";
306089
306127
  import { promisify as promisify7 } from "node:util";
@@ -306802,6 +306840,7 @@ async function handleUpgrade() {
306802
306840
  async function processIntent(config2, intent, fallbackModel, failedModel) {
306803
306841
  switch (intent) {
306804
306842
  case "retry_always":
306843
+ config2.rotateSessionId(createSessionId());
306805
306844
  config2.activateFallbackMode(fallbackModel, failedModel);
306806
306845
  return true;
306807
306846
  case "retry_once":
@@ -309298,6 +309337,9 @@ var CodeAssistServer = class {
309298
309337
  this.paidTier = paidTier;
309299
309338
  this.config = config2;
309300
309339
  }
309340
+ getEffectiveSessionId() {
309341
+ return this.config?.getSessionId() ?? this.sessionId;
309342
+ }
309301
309343
  async generateContentStream(req, userPromptId, role) {
309302
309344
  const autoUse = this.config ? shouldAutoUseCredits(this.config.getBillingSettings().overageStrategy, getG1CreditBalance(this.paidTier)) : false;
309303
309345
  const modelIsEligible = isOverageEligibleModel(req.model);
@@ -309307,7 +309349,7 @@ var CodeAssistServer = class {
309307
309349
  coreEvents.emitFeedback("info", "Using AI Credits for this request.");
309308
309350
  }
309309
309351
  const enabledCreditTypes = shouldEnableCredits ? [G1_CREDIT_TYPE] : void 0;
309310
- const responses = await this.requestStreamingPost("streamGenerateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.sessionId, enabledCreditTypes), req.config?.abortSignal);
309352
+ const responses = await this.requestStreamingPost("streamGenerateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.getEffectiveSessionId(), enabledCreditTypes), req.config?.abortSignal);
309311
309353
  const streamingLatency = {};
309312
309354
  const start2 = Date.now();
309313
309355
  let isFirst = true;
@@ -309321,7 +309363,7 @@ var CodeAssistServer = class {
309321
309363
  }
309322
309364
  streamingLatency.totalLatency = formatProtoJsonDuration(Date.now() - start2);
309323
309365
  const translatedResponse = fromGenerateContentResponse(response);
309324
- await recordConversationOffered(server, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, server.sessionId);
309366
+ await recordConversationOffered(server, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, server.getEffectiveSessionId());
309325
309367
  if (response.consumedCredits) {
309326
309368
  for (const credit of response.consumedCredits) {
309327
309369
  if (credit.creditType === G1_CREDIT_TYPE && credit.creditAmount) {
@@ -309347,14 +309389,14 @@ var CodeAssistServer = class {
309347
309389
  }
309348
309390
  async generateContent(req, userPromptId, role) {
309349
309391
  const start2 = Date.now();
309350
- const response = await this.requestPost("generateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.sessionId, void 0), req.config?.abortSignal, GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS);
309392
+ const response = await this.requestPost("generateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.getEffectiveSessionId(), void 0), req.config?.abortSignal, GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS);
309351
309393
  const duration3 = formatProtoJsonDuration(Date.now() - start2);
309352
309394
  const streamingLatency = {
309353
309395
  totalLatency: duration3,
309354
309396
  firstMessageLatency: duration3
309355
309397
  };
309356
309398
  const translatedResponse = fromGenerateContentResponse(response);
309357
- await recordConversationOffered(this, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, this.sessionId);
309399
+ await recordConversationOffered(this, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, this.getEffectiveSessionId());
309358
309400
  if (response.remainingCredits) {
309359
309401
  this.updateCredits(response.remainingCredits);
309360
309402
  }
@@ -310612,13 +310654,19 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
310612
310654
  customHeaders,
310613
310655
  vertexAiRouting
310614
310656
  };
310657
+ const getEnv3 = (key) => {
310658
+ if (config2?.env && config2.env[key] !== void 0) {
310659
+ return config2.env[key];
310660
+ }
310661
+ return process.env[key];
310662
+ };
310615
310663
  if (authType === AuthType2.LOGIN_WITH_GOOGLE || authType === AuthType2.COMPUTE_ADC) {
310616
310664
  return contentGeneratorConfig;
310617
310665
  }
310618
- const geminiApiKey = apiKey || process.env["GEMINI_API_KEY"] || await loadApiKey() || void 0;
310619
- const googleApiKey = process.env["GOOGLE_API_KEY"] || void 0;
310620
- const googleCloudProject = process.env["GOOGLE_CLOUD_PROJECT"] || process.env["GOOGLE_CLOUD_PROJECT_ID"] || void 0;
310621
- const googleCloudLocation = process.env["GOOGLE_CLOUD_LOCATION"] || void 0;
310666
+ const geminiApiKey = apiKey || getEnv3("GEMINI_API_KEY") || await loadApiKey() || void 0;
310667
+ const googleApiKey = getEnv3("GOOGLE_API_KEY") || void 0;
310668
+ const googleCloudProject = getEnv3("GOOGLE_CLOUD_PROJECT") || getEnv3("GOOGLE_CLOUD_PROJECT_ID") || void 0;
310669
+ const googleCloudLocation = getEnv3("GOOGLE_CLOUD_LOCATION") || void 0;
310622
310670
  if (authType === AuthType2.USE_GEMINI && geminiApiKey) {
310623
310671
  contentGeneratorConfig.apiKey = geminiApiKey;
310624
310672
  contentGeneratorConfig.vertexai = false;
@@ -310630,7 +310678,7 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
310630
310678
  return contentGeneratorConfig;
310631
310679
  }
310632
310680
  if (authType === AuthType2.GATEWAY) {
310633
- contentGeneratorConfig.apiKey = apiKey || process.env["GEMINI_API_KEY"] || "";
310681
+ contentGeneratorConfig.apiKey = apiKey || getEnv3("GEMINI_API_KEY") || "";
310634
310682
  contentGeneratorConfig.vertexai = false;
310635
310683
  return contentGeneratorConfig;
310636
310684
  }
@@ -320914,7 +320962,7 @@ import { TextDecoder as TextDecoder2 } from "node:util";
320914
320962
  import os28 from "node:os";
320915
320963
  import fs47, { mkdirSync as mkdirSync4 } from "node:fs";
320916
320964
  import path57 from "node:path";
320917
- var import_headless2 = __toESM(require_xterm_headless(), 1);
320965
+ var import_headless3 = __toESM(require_xterm_headless(), 1);
320918
320966
 
320919
320967
  // packages/core/dist/src/utils/terminalSerializer.js
320920
320968
  var Attribute;
@@ -321789,7 +321837,7 @@ var ExecutionLifecycleService = class {
321789
321837
  };
321790
321838
 
321791
321839
  // packages/core/dist/src/services/shellExecutionService.js
321792
- var { Terminal } = import_headless2.default;
321840
+ var { Terminal } = import_headless3.default;
321793
321841
  var MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024;
321794
321842
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR = "GEMINI_CLI";
321795
321843
  var GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = "1";
@@ -321987,9 +322035,10 @@ ${truncated}`;
321987
322035
  const guardedCommand = ensurePromptvarsDisabled(commandToExecute, shell);
321988
322036
  const finalCommand = injectUtf8CodepageForPty(guardedCommand, shell, isWindows3, usingPty);
321989
322037
  const spawnArgs = [...argsPrefix, finalCommand];
322038
+ const sourceEnv = shellExecutionConfig.env ?? process.env;
321990
322039
  const gitConfigKeys = [];
321991
322040
  if (!isInteractive) {
321992
- for (const key in process.env) {
322041
+ for (const key in sourceEnv) {
321993
322042
  if (key.startsWith("GIT_CONFIG_")) {
321994
322043
  gitConfigKeys.push(key);
321995
322044
  }
@@ -322002,7 +322051,7 @@ ${truncated}`;
322002
322051
  ...gitConfigKeys
322003
322052
  ]
322004
322053
  };
322005
- const sanitizedEnv = sanitizeEnvironment(process.env, sanitizationConfig);
322054
+ const sanitizedEnv = sanitizeEnvironment(sourceEnv, sanitizationConfig);
322006
322055
  const baseEnv = {
322007
322056
  ...sanitizedEnv,
322008
322057
  [GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
@@ -322012,7 +322061,7 @@ ${truncated}`;
322012
322061
  };
322013
322062
  if (!isInteractive) {
322014
322063
  for (const key of gitConfigKeys) {
322015
- baseEnv[key] = process.env[key];
322064
+ baseEnv[key] = sourceEnv[key];
322016
322065
  }
322017
322066
  const gitConfigCount = parseInt(baseEnv["GIT_CONFIG_COUNT"] || "0", 10);
322018
322067
  const newKey = `GIT_CONFIG_KEY_${gitConfigCount}`;
@@ -323385,6 +323434,7 @@ exit $__code`;
323385
323434
  }
323386
323435
  }, combinedController.signal, this.context.config.isInteractiveShellEnabled(), {
323387
323436
  ...shellExecutionConfig,
323437
+ env: this.context.config.env,
323388
323438
  sessionId: this.context.config?.getSessionId?.() ?? "default",
323389
323439
  pager: "cat",
323390
323440
  sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.context.config.sanitizationConfig,
@@ -329817,10 +329867,10 @@ var TopicState = class {
329817
329867
  };
329818
329868
 
329819
329869
  // packages/core/dist/src/agents/local-executor.js
329820
- import { randomUUID as randomUUID12 } from "node:crypto";
329870
+ import { randomUUID as randomUUID13 } from "node:crypto";
329821
329871
 
329822
329872
  // packages/core/dist/src/core/geminiChat.js
329823
- import { randomUUID as randomUUID5 } from "node:crypto";
329873
+ import { randomUUID as randomUUID6 } from "node:crypto";
329824
329874
 
329825
329875
  // packages/core/dist/src/utils/messageInspectors.js
329826
329876
  function isFunctionResponse(content) {
@@ -330286,7 +330336,7 @@ var GeminiChat = class {
330286
330336
  validateHistory2(history);
330287
330337
  let initialHistory;
330288
330338
  if (history.length > 0) {
330289
- initialHistory = history.map((item) => "id" in item && "content" in item ? item : { id: randomUUID5(), content: item });
330339
+ initialHistory = history.map((item) => "id" in item && "content" in item ? item : { id: randomUUID6(), content: item });
330290
330340
  } else if (resumedSessionData) {
330291
330341
  initialHistory = resumedSessionData.conversation.messages.filter((m) => m.type === "user" || m.type === "gemini").map((m) => ({
330292
330342
  id: m.id,
@@ -330526,7 +330576,8 @@ var GeminiChat = class {
330526
330576
  return binaryParts.length > 0 ? binaryParts : void 0;
330527
330577
  }
330528
330578
  async makeApiCallAndProcessStream(modelConfigKey, requestHistory, prompt_id, abortSignal, role, apiHistoryOverride) {
330529
- const scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
330579
+ let scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
330580
+ scrubbedHistory = coalesceConsecutiveRoles(scrubbedHistory);
330530
330581
  const scrubbedContents = scrubbedHistory.map((h2) => h2.content);
330531
330582
  const requestContents = apiHistoryOverride ? scrubContents(apiHistoryOverride) : scrubbedContents;
330532
330583
  const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
@@ -330560,7 +330611,7 @@ var GeminiChat = class {
330560
330611
  tools: this.tools,
330561
330612
  abortSignal
330562
330613
  };
330563
- let contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
330614
+ let contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
330564
330615
  const hookSystem = this.context.config.getHookSystem();
330565
330616
  if (hookSystem) {
330566
330617
  const beforeModelResult = await hookSystem.fireBeforeModelEvent({
@@ -330583,7 +330634,7 @@ var GeminiChat = class {
330583
330634
  if (beforeModelResult.modifiedModel) {
330584
330635
  modelToUse = resolveModel(beforeModelResult.modifiedModel, useGemini3_1, false, hasAccessToPreview, this.context.config, this.context.config.hasGemini35FlashGAAccess?.() ?? false);
330585
330636
  lastModelToUse = modelToUse;
330586
- contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
330637
+ contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
330587
330638
  }
330588
330639
  if (beforeModelResult.modifiedConfig) {
330589
330640
  Object.assign(config2, beforeModelResult.modifiedConfig);
@@ -330680,7 +330731,14 @@ var GeminiChat = class {
330680
330731
  */
330681
330732
  getHistoryTurns(curated = false) {
330682
330733
  const history = curated ? extractCuratedHistory2(this.agentHistory.get()) : [...this.agentHistory.get()];
330683
- return this.context.config.isContextManagementEnabled() ? scrubHistory(history) : history;
330734
+ if (this.context.config.isContextManagementEnabled()) {
330735
+ return scrubHistory(history);
330736
+ }
330737
+ const model = this.context.config.getModel();
330738
+ if (isGemini2Model(model) || supportsModernFeatures(model)) {
330739
+ return coalesceConsecutiveRoles(stripThoughts2(history));
330740
+ }
330741
+ return history;
330684
330742
  }
330685
330743
  /**
330686
330744
  * Clears the chat history.
@@ -331046,6 +331104,46 @@ function stripToolCallIdPrefixes(contents) {
331046
331104
  })
331047
331105
  }));
331048
331106
  }
331107
+ function coalesceConsecutiveRoles(history) {
331108
+ const result2 = [];
331109
+ for (const turn of history) {
331110
+ const lastIdx = result2.length - 1;
331111
+ const last2 = result2[lastIdx];
331112
+ if (last2 && last2.content.role && last2.content.role === turn.content.role) {
331113
+ const hasParts = last2.content.parts || turn.content.parts;
331114
+ result2[lastIdx] = {
331115
+ id: last2.id,
331116
+ content: {
331117
+ ...last2.content,
331118
+ parts: hasParts ? [...last2.content.parts || [], ...turn.content.parts || []] : void 0
331119
+ }
331120
+ };
331121
+ } else {
331122
+ result2.push({
331123
+ id: turn.id,
331124
+ content: { ...turn.content }
331125
+ });
331126
+ }
331127
+ }
331128
+ return result2;
331129
+ }
331130
+ function stripThoughts2(history) {
331131
+ return history.map((turn) => {
331132
+ if (!turn.content.parts)
331133
+ return turn;
331134
+ const hasThought = turn.content.parts.some((p) => p && p.thought);
331135
+ if (!hasThought)
331136
+ return turn;
331137
+ const nonThoughtParts = turn.content.parts.filter((p) => p && !p.thought);
331138
+ return {
331139
+ ...turn,
331140
+ content: {
331141
+ ...turn.content,
331142
+ parts: nonThoughtParts
331143
+ }
331144
+ };
331145
+ }).filter((turn) => !turn.content.parts || turn.content.parts.length > 0);
331146
+ }
331049
331147
 
331050
331148
  // packages/core/dist/src/utils/ragLogger.js
331051
331149
  import * as fs50 from "node:fs";
@@ -338074,7 +338172,11 @@ var GoogleCredentialsAuthProvider = class extends BaseA2AAuthProvider {
338074
338172
  if (!targetUrl) {
338075
338173
  throw new Error("targetUrl must be provided to GoogleCredentialsAuthProvider to determine token audience.");
338076
338174
  }
338077
- const hostname3 = new URL(targetUrl).hostname;
338175
+ const urlObj = new URL(targetUrl);
338176
+ if (urlObj.protocol !== "https:") {
338177
+ throw new Error(`Protocol "${urlObj.protocol}" is not secure. Google Credential provider requires HTTPS.`);
338178
+ }
338179
+ const hostname3 = urlObj.hostname;
338078
338180
  const isRunAppHost = CLOUD_RUN_HOST_REGEX.test(hostname3);
338079
338181
  if (isRunAppHost) {
338080
338182
  this.useIdToken = true;
@@ -338173,7 +338275,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
338173
338275
  return provider;
338174
338276
  }
338175
338277
  case "oauth2": {
338176
- const { OAuth2AuthProvider } = await import("./oauth2-provider-5JL2PKRR.js");
338278
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-NVAVQTFM.js");
338177
338279
  const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
338178
338280
  await provider.initialize();
338179
338281
  return provider;
@@ -339732,7 +339834,7 @@ var SchedulerStateManager = class {
339732
339834
 
339733
339835
  // packages/core/dist/src/scheduler/confirmation.js
339734
339836
  import { on } from "node:events";
339735
- import { randomUUID as randomUUID6 } from "node:crypto";
339837
+ import { randomUUID as randomUUID7 } from "node:crypto";
339736
339838
  async function awaitConfirmation(messageBus, correlationId, signal) {
339737
339839
  if (signal.aborted) {
339738
339840
  throw new Error("Operation cancelled");
@@ -339778,7 +339880,7 @@ async function resolveConfirmation(toolCall, signal, deps) {
339778
339880
  details.systemMessage = deps.systemMessage;
339779
339881
  }
339780
339882
  await notifyHooks(deps, details);
339781
- const correlationId = randomUUID6();
339883
+ const correlationId = randomUUID7();
339782
339884
  const serializableDetails = details;
339783
339885
  lastDetails = serializableDetails;
339784
339886
  const ideConfirmation = "ideConfirmation" in details ? details.ideConfirmation : void 0;
@@ -340320,8 +340422,7 @@ var LoopDetectionService = class {
340320
340422
  promptId = "";
340321
340423
  userPrompt = "";
340322
340424
  // Tool call tracking
340323
- lastToolCallKey = null;
340324
- toolCallRepetitionCount = 0;
340425
+ toolCallHistory = [];
340325
340426
  // Content streaming tracking
340326
340427
  streamContentHistory = "";
340327
340428
  contentStats = /* @__PURE__ */ new Map();
@@ -340443,14 +340544,31 @@ var LoopDetectionService = class {
340443
340544
  }
340444
340545
  checkToolCallLoop(toolCall) {
340445
340546
  const key = this.getToolCallKey(toolCall);
340446
- if (this.lastToolCallKey === key) {
340447
- this.toolCallRepetitionCount++;
340448
- } else {
340449
- this.lastToolCallKey = key;
340450
- this.toolCallRepetitionCount = 1;
340451
- }
340452
- if (this.toolCallRepetitionCount >= TOOL_CALL_LOOP_THRESHOLD) {
340453
- return true;
340547
+ this.toolCallHistory.push(key);
340548
+ const maxRequiredLength = 5 * TOOL_CALL_LOOP_THRESHOLD;
340549
+ if (this.toolCallHistory.length > maxRequiredLength) {
340550
+ this.toolCallHistory = this.toolCallHistory.slice(-maxRequiredLength);
340551
+ }
340552
+ const n3 = this.toolCallHistory.length;
340553
+ const R = TOOL_CALL_LOOP_THRESHOLD;
340554
+ for (let k = 1; k <= 5; k++) {
340555
+ const requiredLength = k * R;
340556
+ if (n3 >= requiredLength) {
340557
+ const cycle = this.toolCallHistory.slice(-k);
340558
+ let isPatternMatch = true;
340559
+ for (let i3 = 0; i3 < requiredLength; i3++) {
340560
+ const indexFromEnd = requiredLength - i3;
340561
+ const actualKey = this.toolCallHistory[n3 - indexFromEnd];
340562
+ const expectedKey = cycle[i3 % k];
340563
+ if (actualKey !== expectedKey) {
340564
+ isPatternMatch = false;
340565
+ break;
340566
+ }
340567
+ }
340568
+ if (isPatternMatch) {
340569
+ return true;
340570
+ }
340571
+ }
340454
340572
  }
340455
340573
  return false;
340456
340574
  }
@@ -340708,8 +340826,7 @@ ${this.userPrompt}
340708
340826
  this.loopDetected = false;
340709
340827
  }
340710
340828
  resetToolCallCount() {
340711
- this.lastToolCallKey = null;
340712
- this.toolCallRepetitionCount = 0;
340829
+ this.toolCallHistory = [];
340713
340830
  }
340714
340831
  resetContentTracking(resetHistory = true) {
340715
340832
  if (resetHistory) {
@@ -341266,7 +341383,7 @@ Output too large. Full output available at: ${filePath}
341266
341383
  };
341267
341384
 
341268
341385
  // packages/core/dist/src/core/client.js
341269
- import { randomUUID as randomUUID10 } from "node:crypto";
341386
+ import { randomUUID as randomUUID11 } from "node:crypto";
341270
341387
 
341271
341388
  // packages/core/dist/src/context/config/registry.js
341272
341389
  var ContextProcessorRegistry = class {
@@ -341825,7 +341942,7 @@ function formatNodesForLlm(nodes, options = {}) {
341825
341942
  }
341826
341943
 
341827
341944
  // packages/core/dist/src/context/utils/snapshotGenerator.js
341828
- import { randomUUID as randomUUID7 } from "node:crypto";
341945
+ import { randomUUID as randomUUID8 } from "node:crypto";
341829
341946
  function isStringArray(value) {
341830
341947
  return Array.isArray(value) && value.every((item) => typeof item === "string");
341831
341948
  }
@@ -342029,7 +342146,7 @@ ${formatNodesForLlm(nodes)}`;
342029
342146
  const desc = t2["description"];
342030
342147
  if (typeof desc === "string" && desc) {
342031
342148
  newState.active_tasks.push({
342032
- id: `task_${randomUUID7().slice(0, 8)}`,
342149
+ id: `task_${randomUUID8().slice(0, 8)}`,
342033
342150
  description: desc
342034
342151
  });
342035
342152
  }
@@ -342571,7 +342688,7 @@ async function loadContextManagementConfig(sidecarPath, registry2) {
342571
342688
  // packages/core/dist/src/context/tracer.js
342572
342689
  import * as fsSync3 from "node:fs";
342573
342690
  import * as path69 from "node:path";
342574
- import { randomUUID as randomUUID8 } from "node:crypto";
342691
+ import { randomUUID as randomUUID9 } from "node:crypto";
342575
342692
  var ContextTracer = class {
342576
342693
  traceDir;
342577
342694
  assetsDir;
@@ -342623,7 +342740,7 @@ var ContextTracer = class {
342623
342740
  if (!this.enabled)
342624
342741
  return "asset-recording-disabled";
342625
342742
  try {
342626
- const assetId = `${Date.now()}-${randomUUID8()}-${assetName}.json`;
342743
+ const assetId = `${Date.now()}-${randomUUID9()}-${assetName}.json`;
342627
342744
  const assetPath = path69.join(this.assetsDir, assetId);
342628
342745
  fsSync3.writeFileSync(assetPath, JSON.stringify(data, null, 2), "utf-8");
342629
342746
  this.logEvent(component, `Saved asset: ${assetName}`, { assetId });
@@ -342679,12 +342796,12 @@ var ContextEventBus = class extends EventEmitter5 {
342679
342796
  };
342680
342797
 
342681
342798
  // packages/core/dist/src/context/pipeline/inbox.js
342682
- import { randomUUID as randomUUID9 } from "node:crypto";
342799
+ import { randomUUID as randomUUID10 } from "node:crypto";
342683
342800
  var LiveInbox = class {
342684
342801
  messages = [];
342685
342802
  publish(topic, payload) {
342686
342803
  this.messages.push({
342687
- id: randomUUID9(),
342804
+ id: randomUUID10(),
342688
342805
  topic,
342689
342806
  payload,
342690
342807
  timestamp: Date.now()
@@ -344586,7 +344703,7 @@ var GeminiClient = class {
344586
344703
  if (this.contextManager) {
344587
344704
  const rawPendingRequest = createUserContent(request);
344588
344705
  const pendingRequest = {
344589
- id: randomUUID10(),
344706
+ id: randomUUID11(),
344590
344707
  content: rawPendingRequest
344591
344708
  };
344592
344709
  const { history: newHistory, apiHistory, pendingApiHistory, baseUnits } = await this.contextManager.renderHistory(pendingRequest, void 0, signal);
@@ -346444,7 +346561,7 @@ function createScopedWorkspaceContext(parentContext, additionalDirectories) {
346444
346561
  }
346445
346562
 
346446
346563
  // packages/core/dist/src/confirmation-bus/message-bus.js
346447
- import { randomUUID as randomUUID11 } from "node:crypto";
346564
+ import { randomUUID as randomUUID12 } from "node:crypto";
346448
346565
  import { EventEmitter as EventEmitter6 } from "node:events";
346449
346566
  var MessageBus = class _MessageBus extends EventEmitter6 {
346450
346567
  policyEngine;
@@ -346596,7 +346713,7 @@ var MessageBus = class _MessageBus extends EventEmitter6 {
346596
346713
  * The correlation ID is generated internally and added to the request
346597
346714
  */
346598
346715
  async request(request, responseType, timeoutMs = 6e4) {
346599
- const correlationId = randomUUID11();
346716
+ const correlationId = randomUUID12();
346600
346717
  return new Promise((resolve29, reject) => {
346601
346718
  const timeoutId = setTimeout(() => {
346602
346719
  cleanup();
@@ -346845,7 +346962,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
346845
346962
  this.compressionService = new ChatCompressionService();
346846
346963
  this.parentCallId = parentCallId;
346847
346964
  this.cache = new import_lru_cache.default(10);
346848
- this.agentId = randomUUID12();
346965
+ this.agentId = randomUUID13();
346849
346966
  }
346850
346967
  /**
346851
346968
  * Executes a single turn of the agent's logic, from calling the model
@@ -347225,7 +347342,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
347225
347342
  } else if (info2.compressionStatus === CompressionStatus.COMPRESSED) {
347226
347343
  if (newHistory) {
347227
347344
  const turns = newHistory.map((c4) => ({
347228
- id: randomUUID12(),
347345
+ id: randomUUID13(),
347229
347346
  content: c4
347230
347347
  }));
347231
347348
  chat.setHistory(turns);
@@ -347234,7 +347351,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
347234
347351
  } else if (info2.compressionStatus === CompressionStatus.CONTENT_TRUNCATED) {
347235
347352
  if (newHistory) {
347236
347353
  const turns = newHistory.map((c4) => ({
347237
- id: randomUUID12(),
347354
+ id: randomUUID13(),
347238
347355
  content: c4
347239
347356
  }));
347240
347357
  chat.setHistory(turns);
@@ -347652,7 +347769,7 @@ Important Rules:
347652
347769
  };
347653
347770
 
347654
347771
  // packages/core/dist/src/agents/local-invocation.js
347655
- import { randomUUID as randomUUID13 } from "node:crypto";
347772
+ import { randomUUID as randomUUID14 } from "node:crypto";
347656
347773
 
347657
347774
  // packages/core/dist/src/utils/agent-sanitization-utils.js
347658
347775
  var SENSITIVE_KEY_PATTERNS = [
@@ -347812,7 +347929,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
347812
347929
  lastItem.content = sanitizeThoughtContent(text);
347813
347930
  } else {
347814
347931
  recentActivity.push({
347815
- id: randomUUID13(),
347932
+ id: randomUUID14(),
347816
347933
  type: "thought",
347817
347934
  content: sanitizeThoughtContent(text),
347818
347935
  status: SubagentState.RUNNING
@@ -347830,7 +347947,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
347830
347947
  const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"])) : void 0;
347831
347948
  const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
347832
347949
  const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
347833
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID13();
347950
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID14();
347834
347951
  recentActivity.push({
347835
347952
  id: callId,
347836
347953
  type: "tool_call",
@@ -347881,7 +347998,7 @@ var LocalSubagentInvocation = class extends BaseToolInvocation {
347881
347998
  }
347882
347999
  }
347883
348000
  recentActivity.push({
347884
- id: randomUUID13(),
348001
+ id: randomUUID14(),
347885
348002
  type: "thought",
347886
348003
  content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
347887
348004
  status: isCancellation || isRejection ? SubagentState.CANCELLED : SubagentState.ERROR
@@ -347952,7 +348069,7 @@ ${output.result}`;
347952
348069
  const lastActivity = recentActivity[recentActivity.length - 1];
347953
348070
  if (!lastActivity || lastActivity.status !== SubagentState.ERROR) {
347954
348071
  recentActivity.push({
347955
- id: randomUUID13(),
348072
+ id: randomUUID14(),
347956
348073
  type: "thought",
347957
348074
  content: `Error: ${errorMessage}`,
347958
348075
  status: SubagentState.ERROR
@@ -348388,7 +348505,7 @@ ${errorMessage}` : errorMessage;
348388
348505
  };
348389
348506
 
348390
348507
  // packages/core/dist/src/agents/local-session-invocation.js
348391
- import { randomUUID as randomUUID15 } from "node:crypto";
348508
+ import { randomUUID as randomUUID16 } from "node:crypto";
348392
348509
 
348393
348510
  // packages/core/dist/src/utils/checks.js
348394
348511
  function assumeExhaustive(_value) {
@@ -348399,7 +348516,7 @@ function checkExhaustive(value, msg = `unexpected value ${value}!`) {
348399
348516
  }
348400
348517
 
348401
348518
  // packages/core/dist/src/agents/local-subagent-protocol.js
348402
- import { randomUUID as randomUUID14 } from "node:crypto";
348519
+ import { randomUUID as randomUUID15 } from "node:crypto";
348403
348520
 
348404
348521
  // packages/core/dist/src/agent/agent-session.js
348405
348522
  var AgentSession = class {
@@ -348584,7 +348701,7 @@ var LocalSubagentProtocol = class {
348584
348701
  _rawActivityCallback;
348585
348702
  _events = [];
348586
348703
  _subscribers = /* @__PURE__ */ new Set();
348587
- _streamId = randomUUID14();
348704
+ _streamId = randomUUID15();
348588
348705
  _eventCounter = 0;
348589
348706
  _agentStartEmitted = false;
348590
348707
  _agentEndEmitted = false;
@@ -348662,7 +348779,7 @@ var LocalSubagentProtocol = class {
348662
348779
  // Core: execution
348663
348780
  // ---------------------------------------------------------------------------
348664
348781
  _beginNewStream() {
348665
- this._streamId = randomUUID14();
348782
+ this._streamId = randomUUID15();
348666
348783
  this._eventCounter = 0;
348667
348784
  this._abortController = new AbortController();
348668
348785
  this._agentStartEmitted = false;
@@ -348724,7 +348841,7 @@ var LocalSubagentProtocol = class {
348724
348841
  }
348725
348842
  case "TOOL_CALL_START": {
348726
348843
  const rawCallId = activity.data["callId"];
348727
- const callId = String(rawCallId ?? randomUUID14());
348844
+ const callId = String(rawCallId ?? randomUUID15());
348728
348845
  const rawName = activity.data["name"];
348729
348846
  const name3 = String(rawName ?? "unknown");
348730
348847
  const rawArgs = activity.data["args"];
@@ -348742,7 +348859,7 @@ var LocalSubagentProtocol = class {
348742
348859
  }
348743
348860
  case "TOOL_CALL_END": {
348744
348861
  const rawId = activity.data["id"];
348745
- const requestId = String(rawId ?? randomUUID14());
348862
+ const requestId = String(rawId ?? randomUUID15());
348746
348863
  const rawName = activity.data["name"];
348747
348864
  const name3 = String(rawName ?? "unknown");
348748
348865
  const rawOutput = activity.data["output"];
@@ -348921,7 +349038,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
348921
349038
  lastItem.content = sanitizeThoughtContent(text);
348922
349039
  } else {
348923
349040
  recentActivity.push({
348924
- id: randomUUID15(),
349041
+ id: randomUUID16(),
348925
349042
  type: "thought",
348926
349043
  content: sanitizeThoughtContent(text),
348927
349044
  status: SubagentState.RUNNING
@@ -348940,7 +349057,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
348940
349057
  const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"]).trim()) : void 0;
348941
349058
  const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
348942
349059
  const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
348943
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID15();
349060
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID16();
348944
349061
  recentActivity.push({
348945
349062
  id: callId,
348946
349063
  type: "tool_call",
@@ -348992,7 +349109,7 @@ var LocalSessionInvocation = class extends BaseToolInvocation {
348992
349109
  }
348993
349110
  }
348994
349111
  recentActivity.push({
348995
- id: randomUUID15(),
349112
+ id: randomUUID16(),
348996
349113
  type: "thought",
348997
349114
  content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
348998
349115
  status: isCancellation || isRejection ? SubagentState.CANCELLED : SubagentState.ERROR
@@ -349090,7 +349207,7 @@ ${output.result}`;
349090
349207
  const lastActivity = recentActivity[recentActivity.length - 1];
349091
349208
  if (!lastActivity || lastActivity.status !== SubagentState.ERROR) {
349092
349209
  recentActivity.push({
349093
- id: randomUUID15(),
349210
+ id: randomUUID16(),
349094
349211
  type: "thought",
349095
349212
  content: `Error: ${errorMessage}`,
349096
349213
  status: SubagentState.ERROR
@@ -349124,7 +349241,7 @@ ${output.result}`;
349124
349241
  };
349125
349242
 
349126
349243
  // packages/core/dist/src/agents/remote-subagent-protocol.js
349127
- import { randomUUID as randomUUID16 } from "node:crypto";
349244
+ import { randomUUID as randomUUID17 } from "node:crypto";
349128
349245
  function isAbortLikeError2(err2) {
349129
349246
  return err2 instanceof Error && err2.name === "AbortError";
349130
349247
  }
@@ -349133,7 +349250,7 @@ var RemoteSubagentProtocol = class {
349133
349250
  context;
349134
349251
  _events = [];
349135
349252
  _subscribers = /* @__PURE__ */ new Set();
349136
- _streamId = randomUUID16();
349253
+ _streamId = randomUUID17();
349137
349254
  _eventCounter = 0;
349138
349255
  _agentStartEmitted = false;
349139
349256
  _agentEndEmitted = false;
@@ -349213,7 +349330,7 @@ var RemoteSubagentProtocol = class {
349213
349330
  // Core: A2A streaming
349214
349331
  // ---------------------------------------------------------------------------
349215
349332
  _beginNewStream() {
349216
- this._streamId = randomUUID16();
349333
+ this._streamId = randomUUID17();
349217
349334
  this._eventCounter = 0;
349218
349335
  this._abortController = new AbortController();
349219
349336
  this._agentStartEmitted = false;
@@ -349588,7 +349705,7 @@ ${errorMessage}` : errorMessage;
349588
349705
  };
349589
349706
 
349590
349707
  // packages/core/dist/src/agents/browser/browserAgentInvocation.js
349591
- import { randomUUID as randomUUID17 } from "node:crypto";
349708
+ import { randomUUID as randomUUID18 } from "node:crypto";
349592
349709
 
349593
349710
  // packages/core/dist/src/utils/browserConsent.js
349594
349711
  import * as fs59 from "node:fs/promises";
@@ -351073,7 +351190,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
351073
351190
  const printOutput = updateOutput ? (msg) => {
351074
351191
  const sanitizedMsg = sanitizeThoughtContent(msg);
351075
351192
  recentActivity.push({
351076
- id: randomUUID17(),
351193
+ id: randomUUID18(),
351077
351194
  type: "thought",
351078
351195
  content: sanitizedMsg,
351079
351196
  status: SubagentState.COMPLETED
@@ -351105,7 +351222,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
351105
351222
  lastItem.content = sanitizeThoughtContent(text);
351106
351223
  } else {
351107
351224
  recentActivity.push({
351108
- id: randomUUID17(),
351225
+ id: randomUUID18(),
351109
351226
  type: "thought",
351110
351227
  content: sanitizeThoughtContent(text),
351111
351228
  status: SubagentState.RUNNING
@@ -351119,7 +351236,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
351119
351236
  const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"])) : void 0;
351120
351237
  const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
351121
351238
  const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
351122
- const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID17();
351239
+ const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID18();
351123
351240
  recentActivity.push({
351124
351241
  id: callId,
351125
351242
  type: "tool_call",
@@ -351168,7 +351285,7 @@ var BrowserAgentInvocation = class extends BaseToolInvocation {
351168
351285
  }
351169
351286
  const sanitizedError = sanitizeErrorMessage(error40);
351170
351287
  recentActivity.push({
351171
- id: randomUUID17(),
351288
+ id: randomUUID18(),
351172
351289
  type: "thought",
351173
351290
  content: isCancellation ? sanitizedError : `Error: ${sanitizedError}`,
351174
351291
  status: newStatus
@@ -363616,7 +363733,9 @@ var CheckerRunner = class _CheckerRunner {
363616
363733
  executeCheckerProcess(checkerPath, input, checkerName) {
363617
363734
  return new Promise((resolve29) => {
363618
363735
  const child = spawn9(checkerPath, [], {
363619
- stdio: ["pipe", "pipe", "pipe"]
363736
+ stdio: ["pipe", "pipe", "pipe"],
363737
+ cwd: this.contextBuilder.config.getWorkingDir(),
363738
+ env: { ...process.env, ...this.contextBuilder.config.env }
363620
363739
  });
363621
363740
  let stdout = "";
363622
363741
  let stderr = "";
@@ -363723,6 +363842,9 @@ var ContextBuilder = class {
363723
363842
  constructor(context2) {
363724
363843
  this.context = context2;
363725
363844
  }
363845
+ get config() {
363846
+ return this.context.config;
363847
+ }
363726
363848
  /**
363727
363849
  * Builds the full context object with all available data.
363728
363850
  */
@@ -365287,7 +365409,7 @@ var McpComplianceTransport = class extends EventEmitter8 {
365287
365409
  // packages/core/dist/src/tools/mcp-client.js
365288
365410
  import { basename as basename7 } from "node:path";
365289
365411
  import { pathToFileURL } from "node:url";
365290
- import { randomUUID as randomUUID18 } from "node:crypto";
365412
+ import { randomUUID as randomUUID19 } from "node:crypto";
365291
365413
 
365292
365414
  // packages/core/dist/src/mcp/oauth-token-storage.js
365293
365415
  import { promises as fs75 } from "node:fs";
@@ -366907,7 +367029,7 @@ var McpCallableTool2 = class {
366907
367029
  throw new Error("McpCallableTool only supports single function call");
366908
367030
  }
366909
367031
  const call = functionCalls[0];
366910
- const progressToken = randomUUID18();
367032
+ const progressToken = randomUUID19();
366911
367033
  const context2 = getToolCallContext();
366912
367034
  if (context2 && this.progressReporter) {
366913
367035
  this.progressReporter.registerProgressToken(progressToken, context2.callId);
@@ -375408,8 +375530,8 @@ function rng3() {
375408
375530
  }
375409
375531
 
375410
375532
  // packages/core/node_modules/uuid/dist-node/native.js
375411
- import { randomUUID as randomUUID19 } from "node:crypto";
375412
- var native_default2 = { randomUUID: randomUUID19 };
375533
+ import { randomUUID as randomUUID20 } from "node:crypto";
375534
+ var native_default2 = { randomUUID: randomUUID20 };
375413
375535
 
375414
375536
  // packages/core/node_modules/uuid/dist-node/v4.js
375415
375537
  function _v4(options, buf, offset) {
@@ -375825,6 +375947,7 @@ var Config = class {
375825
375947
  useTerminalBuffer;
375826
375948
  useRenderProcess;
375827
375949
  shellExecutionConfig;
375950
+ env;
375828
375951
  extensionManagement = true;
375829
375952
  extensionRegistryURI;
375830
375953
  truncateToolOutputThreshold;
@@ -375991,6 +376114,7 @@ var Config = class {
375991
376114
  this.checkpointing = params.checkpointing ?? false;
375992
376115
  this.proxy = params.proxy;
375993
376116
  this.cwd = params.cwd ?? process15.cwd();
376117
+ this.env = params.env;
375994
376118
  this.fileDiscoveryService = params.fileDiscoveryService ?? null;
375995
376119
  this.bugCommand = params.bugCommand;
375996
376120
  this.model = params.model;
@@ -376497,6 +376621,9 @@ var Config = class {
376497
376621
  this.refreshSessionScopedPlansDirectory(previousPlansDir);
376498
376622
  }
376499
376623
  }
376624
+ rotateSessionId(sessionId) {
376625
+ this._sessionId = sessionId;
376626
+ }
376500
376627
  resetNewSessionState(sessionId) {
376501
376628
  this.setSessionId(sessionId);
376502
376629
  }
@@ -378742,7 +378869,7 @@ Write the complete content to the \`GEMINI.md\` file. The output must be well-fo
378742
378869
  }
378743
378870
 
378744
378871
  // packages/core/dist/src/commands/memory.js
378745
- import { randomUUID as randomUUID21 } from "node:crypto";
378872
+ import { randomUUID as randomUUID22 } from "node:crypto";
378746
378873
  import { constants as fsConstants3 } from "node:fs";
378747
378874
  import * as fs81 from "node:fs/promises";
378748
378875
  import * as path93 from "node:path";
@@ -379161,7 +379288,7 @@ async function resolveTargetWithinAllowedRoots(targetPath, allowedRoots) {
379161
379288
  import * as fs80 from "node:fs/promises";
379162
379289
  import * as path92 from "node:path";
379163
379290
  import { constants as fsConstants2 } from "node:fs";
379164
- import { randomUUID as randomUUID20 } from "node:crypto";
379291
+ import { randomUUID as randomUUID21 } from "node:crypto";
379165
379292
 
379166
379293
  // packages/core/dist/src/agents/skill-extraction-agent.js
379167
379294
  var SkillExtractionSchema = external_exports.object({
@@ -380149,7 +380276,7 @@ function buildAgentLoopContext(config2) {
380149
380276
  const autoApproveBus = new MessageBus(autoApprovePolicy);
380150
380277
  return {
380151
380278
  config: config2,
380152
- promptId: `skill-extraction-${randomUUID20().slice(0, 8)}`,
380279
+ promptId: `skill-extraction-${randomUUID21().slice(0, 8)}`,
380153
380280
  toolRegistry: config2.getToolRegistry(),
380154
380281
  promptRegistry: new PromptRegistry(),
380155
380282
  resourceRegistry: new ResourceRegistry(),
@@ -381180,7 +381307,7 @@ async function restoreCommittedInboxPatchTarget(stagedTarget) {
381180
381307
  return;
381181
381308
  }
381182
381309
  const restoreDir = await findNearestExistingDirectory(path93.dirname(stagedTarget.targetPath));
381183
- const restorePath = path93.join(restoreDir, `.${path93.basename(stagedTarget.targetPath)}.${randomUUID21()}.rollback`);
381310
+ const restorePath = path93.join(restoreDir, `.${path93.basename(stagedTarget.targetPath)}.${randomUUID22()}.rollback`);
381184
381311
  await writeExclusiveFile(restorePath, stagedTarget.original, stagedTarget.mode);
381185
381312
  await fs81.rename(restorePath, stagedTarget.targetPath);
381186
381313
  }
@@ -381194,7 +381321,7 @@ async function stageInboxPatchTargets(targets) {
381194
381321
  mode = (await fs81.stat(target.targetPath)).mode;
381195
381322
  }
381196
381323
  const tempDir = await findNearestExistingDirectory(path93.dirname(target.targetPath));
381197
- const tempPath = path93.join(tempDir, `.${path93.basename(target.targetPath)}.${randomUUID21()}.patch-tmp`);
381324
+ const tempPath = path93.join(tempDir, `.${path93.basename(target.targetPath)}.${randomUUID22()}.patch-tmp`);
381198
381325
  await writeExclusiveFile(tempPath, target.patched, mode);
381199
381326
  stagedTargets.push({
381200
381327
  targetPath: target.targetPath,
@@ -387164,12 +387291,6 @@ var ReadManyFilesTool = class _ReadManyFilesTool extends BaseDeclarativeTool {
387164
387291
  }
387165
387292
  };
387166
387293
 
387167
- // packages/core/dist/src/utils/session.js
387168
- import { randomUUID as randomUUID22 } from "node:crypto";
387169
- function createSessionId() {
387170
- return randomUUID22();
387171
- }
387172
-
387173
387294
  // packages/core/dist/src/utils/compatibility.js
387174
387295
  import os32 from "node:os";
387175
387296
  function isWindows10() {
@@ -395714,6 +395835,7 @@ export {
395714
395835
  resetVersionCache,
395715
395836
  IDEConnectionStatus,
395716
395837
  IdeClient,
395838
+ createSessionId,
395717
395839
  openBrowserSecurely,
395718
395840
  shouldLaunchBrowser,
395719
395841
  getErrorStatus,
@@ -395851,6 +395973,8 @@ export {
395851
395973
  isSchemaDepthError,
395852
395974
  isInvalidArgumentError,
395853
395975
  stripToolCallIdPrefixes,
395976
+ coalesceConsecutiveRoles,
395977
+ stripThoughts2 as stripThoughts,
395854
395978
  populateToolDisplay,
395855
395979
  toolResultDisplayToDisplayContent,
395856
395980
  renderDisplayDiff,
@@ -396140,7 +396264,6 @@ export {
396140
396264
  LegacyAgentProtocol,
396141
396265
  LegacyAgentSession,
396142
396266
  ReadManyFilesTool,
396143
- createSessionId,
396144
396267
  isWindows10,
396145
396268
  isJetBrainsTerminal,
396146
396269
  isTmux,