@google/gemini-cli 0.52.0 → 0.53.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-BG2B4WV5.js → chunk-27C6XFMY.js} +184 -87
- package/bundle/{chunk-24R3JJRB.js → chunk-4OVORMGE.js} +1 -1
- package/bundle/{chunk-7LQRUKPT.js → chunk-5RDOS7UZ.js} +168 -81
- package/bundle/{chunk-P4IYYRKC.js → chunk-6AD4A2WF.js} +1 -1
- package/bundle/{chunk-ILANJJAD.js → chunk-7VUO7T2C.js} +3 -3
- package/bundle/{chunk-UB6EWNWI.js → chunk-BDSSP5BZ.js} +1 -1
- package/bundle/{chunk-ZLL3UXFN.js → chunk-BRZT2CQU.js} +1 -1
- package/bundle/{chunk-Y5NBDPUP.js → chunk-BX6DTJOD.js} +1 -1
- package/bundle/{chunk-B54TROKV.js → chunk-CTNBR234.js} +2 -2
- package/bundle/{chunk-F7WLNK6O.js → chunk-GHVD6PXK.js} +1 -1
- package/bundle/{chunk-IQDAUFS5.js → chunk-HF533LET.js} +184 -87
- package/bundle/{chunk-6Z2GQGII.js → chunk-HVYOZEAP.js} +3 -3
- package/bundle/{chunk-SZMWXEEI.js → chunk-IODN6H35.js} +1 -1
- package/bundle/{chunk-ZINRZXUN.js → chunk-LUM47MYE.js} +1 -1
- package/bundle/{chunk-JB342GRK.js → chunk-PKFZO3SN.js} +1 -1
- package/bundle/{chunk-FBGJOW3X.js → chunk-PLMRBJEA.js} +2 -2
- package/bundle/{chunk-OFOMMM4A.js → chunk-PVCJCQWY.js} +1 -1
- package/bundle/{chunk-SNUSRD5O.js → chunk-QSTUV3QH.js} +7 -7
- package/bundle/{chunk-RHQ5RWRW.js → chunk-SLQKIE73.js} +1 -1
- package/bundle/{chunk-SDT3SMSX.js → chunk-SXKIOLLX.js} +7 -7
- package/bundle/{chunk-PTIIH33O.js → chunk-UEI42N7R.js} +3 -3
- package/bundle/{chunk-THWSXFSH.js → chunk-UJVAPQ7V.js} +1 -1
- package/bundle/{chunk-ZNHHIFQN.js → chunk-WVDR5L2V.js} +7 -7
- package/bundle/{chunk-ALVMXQYL.js → chunk-XH7QC2TB.js} +2 -2
- package/bundle/{cleanup-2EKCP4Q4.js → cleanup-4FVUYQ7H.js} +2 -2
- package/bundle/{cleanup-G4HKUFT2.js → cleanup-XETKRH7X.js} +2 -2
- package/bundle/{cleanup-X3KOZTUK.js → cleanup-ZR34H2GU.js} +2 -2
- package/bundle/{core-ZIYDWN4V.js → core-I73XKBPY.js} +3 -1
- package/bundle/{dist-WD2ZO2DC.js → core-PVG4D2MR.js} +3 -1
- package/bundle/{devtoolsService-KJJEIBQ2.js → devtoolsService-IVPTF5ZJ.js} +2 -2
- package/bundle/{devtoolsService-UB2E5377.js → devtoolsService-OUX7PWP3.js} +2 -2
- package/bundle/{devtoolsService-NFNYJGMS.js → devtoolsService-QYDPHHFN.js} +2 -2
- package/bundle/{core-JDFTBJXX.js → dist-PRJQFPSQ.js} +3 -1
- package/bundle/docs/CONTRIBUTING.md +3 -3
- package/bundle/docs/cli/sandbox.md +3 -2
- package/bundle/docs/reference/configuration.md +4 -4
- package/bundle/{gemini-Y4OW3GPV.js → gemini-E2E3U6PR.js} +14 -14
- package/bundle/{gemini-6K6USV55.js → gemini-LA6TNI44.js} +14 -14
- package/bundle/{gemini-NJ7GQJ2G.js → gemini-QKB55UV6.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-NNJDT7RS.js → interactiveCli-ADLAWPXN.js} +8 -8
- package/bundle/{interactiveCli-3B23G3WW.js → interactiveCli-FS3OVPXQ.js} +8 -8
- package/bundle/{interactiveCli-3XBP73G4.js → interactiveCli-OD2LO24X.js} +8 -8
- package/bundle/{liteRtServerManager-MQS4LI5P.js → liteRtServerManager-3SKK7MNE.js} +4 -4
- package/bundle/{liteRtServerManager-PYCXZRAL.js → liteRtServerManager-O7PFOUFD.js} +4 -4
- package/bundle/{liteRtServerManager-A77B57ZY.js → liteRtServerManager-T2Z3RLS3.js} +4 -4
- package/bundle/{oauth2-provider-6EE3JV6M.js → oauth2-provider-DFVE3NYF.js} +1 -1
- package/bundle/{oauth2-provider-5JL2PKRR.js → oauth2-provider-E3S5DGLL.js} +1 -1
- package/bundle/{oauth2-provider-THDZ27ZX.js → oauth2-provider-Q433RA6I.js} +1 -1
- package/bundle/sandbox-macos-permissive-open.sb +113 -4
- package/bundle/sandbox-macos-permissive-proxied.sb +111 -9
- package/bundle/{start-SV5TPWOH.js → start-3FPYJBRX.js} +6 -6
- package/bundle/{start-YON746V5.js → start-5G2UDZZ6.js} +6 -6
- package/bundle/{start-K5QQG7K4.js → start-XMJ23QZN.js} +6 -6
- 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
|
-
|
|
278748
|
-
|
|
278749
|
-
|
|
278750
|
-
|
|
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
|
|
278753
|
-
|
|
278754
|
-
|
|
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
|
-
|
|
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
|
-
|
|
278774
|
+
const client2 = createBaseOAuth2Client();
|
|
278775
|
+
client2.setCredentials({
|
|
278772
278776
|
access_token: process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]
|
|
278773
278777
|
});
|
|
278774
|
-
await fetchAndCacheUserInfo(
|
|
278775
|
-
return
|
|
278778
|
+
await fetchAndCacheUserInfo(client2);
|
|
278779
|
+
return client2;
|
|
278776
278780
|
}
|
|
278777
|
-
|
|
278778
|
-
|
|
278779
|
-
|
|
278780
|
-
|
|
278781
|
-
|
|
278782
|
-
|
|
278783
|
-
|
|
278784
|
-
|
|
278785
|
-
|
|
278786
|
-
|
|
278787
|
-
|
|
278788
|
-
|
|
278789
|
-
|
|
278790
|
-
|
|
278791
|
-
|
|
278792
|
-
|
|
278793
|
-
|
|
278794
|
-
|
|
278795
|
-
|
|
278796
|
-
|
|
278797
|
-
|
|
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
|
-
|
|
278802
|
-
|
|
278803
|
-
|
|
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
|
|
279215
|
+
async function fetchCachedCredentialsList() {
|
|
279216
|
+
const credentialsList = [];
|
|
279192
279217
|
const useEncryptedStorage = getUseEncryptedStorageFlag();
|
|
279193
279218
|
if (useEncryptedStorage) {
|
|
279194
|
-
|
|
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
|
-
|
|
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
|
|
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 = "
|
|
282731
|
-
var CLI_VERSION = "0.52.0";
|
|
282766
|
+
var GIT_COMMIT_INFO = "9681621c6";
|
|
282767
|
+
var CLI_VERSION = "0.52.0-nightly.20260715.gfa975395b";
|
|
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.52.0-nightly.20260715.gfa975395b";
|
|
306220
306262
|
})();
|
|
306221
306263
|
return versionPromise;
|
|
306222
306264
|
}
|
|
@@ -312064,13 +312106,19 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
|
|
|
312064
312106
|
customHeaders,
|
|
312065
312107
|
vertexAiRouting
|
|
312066
312108
|
};
|
|
312109
|
+
const getEnv3 = (key) => {
|
|
312110
|
+
if (config2?.env && config2.env[key] !== void 0) {
|
|
312111
|
+
return config2.env[key];
|
|
312112
|
+
}
|
|
312113
|
+
return process.env[key];
|
|
312114
|
+
};
|
|
312067
312115
|
if (authType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ || authType === "compute-default-credentials" /* COMPUTE_ADC */) {
|
|
312068
312116
|
return contentGeneratorConfig;
|
|
312069
312117
|
}
|
|
312070
|
-
const geminiApiKey = apiKey ||
|
|
312071
|
-
const googleApiKey =
|
|
312072
|
-
const googleCloudProject =
|
|
312073
|
-
const googleCloudLocation =
|
|
312118
|
+
const geminiApiKey = apiKey || getEnv3("GEMINI_API_KEY") || await loadApiKey() || void 0;
|
|
312119
|
+
const googleApiKey = getEnv3("GOOGLE_API_KEY") || void 0;
|
|
312120
|
+
const googleCloudProject = getEnv3("GOOGLE_CLOUD_PROJECT") || getEnv3("GOOGLE_CLOUD_PROJECT_ID") || void 0;
|
|
312121
|
+
const googleCloudLocation = getEnv3("GOOGLE_CLOUD_LOCATION") || void 0;
|
|
312074
312122
|
if (authType === "gemini-api-key" /* USE_GEMINI */ && geminiApiKey) {
|
|
312075
312123
|
contentGeneratorConfig.apiKey = geminiApiKey;
|
|
312076
312124
|
contentGeneratorConfig.vertexai = false;
|
|
@@ -312082,7 +312130,7 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
|
|
|
312082
312130
|
return contentGeneratorConfig;
|
|
312083
312131
|
}
|
|
312084
312132
|
if (authType === "gateway" /* GATEWAY */) {
|
|
312085
|
-
contentGeneratorConfig.apiKey = apiKey ||
|
|
312133
|
+
contentGeneratorConfig.apiKey = apiKey || getEnv3("GEMINI_API_KEY") || "";
|
|
312086
312134
|
contentGeneratorConfig.vertexai = false;
|
|
312087
312135
|
return contentGeneratorConfig;
|
|
312088
312136
|
}
|
|
@@ -322812,7 +322860,7 @@ import { TextDecoder as TextDecoder2 } from "node:util";
|
|
|
322812
322860
|
import os28 from "node:os";
|
|
322813
322861
|
import fs47, { mkdirSync as mkdirSync4 } from "node:fs";
|
|
322814
322862
|
import path57 from "node:path";
|
|
322815
|
-
var
|
|
322863
|
+
var import_headless3 = __toESM(require_xterm_headless(), 1);
|
|
322816
322864
|
|
|
322817
322865
|
// packages/core/src/utils/terminalSerializer.ts
|
|
322818
322866
|
var ColorMode = /* @__PURE__ */ ((ColorMode2) => {
|
|
@@ -323689,7 +323737,7 @@ var ExecutionLifecycleService = class {
|
|
|
323689
323737
|
};
|
|
323690
323738
|
|
|
323691
323739
|
// packages/core/src/services/shellExecutionService.ts
|
|
323692
|
-
var { Terminal } =
|
|
323740
|
+
var { Terminal } = import_headless3.default;
|
|
323693
323741
|
var MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024;
|
|
323694
323742
|
var GEMINI_CLI_IDENTIFICATION_ENV_VAR = "GEMINI_CLI";
|
|
323695
323743
|
var GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = "1";
|
|
@@ -323903,9 +323951,10 @@ ${truncated}`;
|
|
|
323903
323951
|
usingPty
|
|
323904
323952
|
);
|
|
323905
323953
|
const spawnArgs = [...argsPrefix, finalCommand];
|
|
323954
|
+
const sourceEnv = shellExecutionConfig.env ?? process.env;
|
|
323906
323955
|
const gitConfigKeys = [];
|
|
323907
323956
|
if (!isInteractive) {
|
|
323908
|
-
for (const key in
|
|
323957
|
+
for (const key in sourceEnv) {
|
|
323909
323958
|
if (key.startsWith("GIT_CONFIG_")) {
|
|
323910
323959
|
gitConfigKeys.push(key);
|
|
323911
323960
|
}
|
|
@@ -323918,7 +323967,7 @@ ${truncated}`;
|
|
|
323918
323967
|
...gitConfigKeys
|
|
323919
323968
|
]
|
|
323920
323969
|
};
|
|
323921
|
-
const sanitizedEnv = sanitizeEnvironment(
|
|
323970
|
+
const sanitizedEnv = sanitizeEnvironment(sourceEnv, sanitizationConfig);
|
|
323922
323971
|
const baseEnv = {
|
|
323923
323972
|
...sanitizedEnv,
|
|
323924
323973
|
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
|
|
@@ -323928,7 +323977,7 @@ ${truncated}`;
|
|
|
323928
323977
|
};
|
|
323929
323978
|
if (!isInteractive) {
|
|
323930
323979
|
for (const key of gitConfigKeys) {
|
|
323931
|
-
baseEnv[key] =
|
|
323980
|
+
baseEnv[key] = sourceEnv[key];
|
|
323932
323981
|
}
|
|
323933
323982
|
const gitConfigCount = parseInt(baseEnv["GIT_CONFIG_COUNT"] || "0", 10);
|
|
323934
323983
|
const newKey = `GIT_CONFIG_KEY_${gitConfigCount}`;
|
|
@@ -325414,6 +325463,7 @@ exit $__code`;
|
|
|
325414
325463
|
this.context.config.isInteractiveShellEnabled(),
|
|
325415
325464
|
{
|
|
325416
325465
|
...shellExecutionConfig,
|
|
325466
|
+
env: this.context.config.env,
|
|
325417
325467
|
sessionId: this.context.config?.getSessionId?.() ?? "default",
|
|
325418
325468
|
pager: "cat",
|
|
325419
325469
|
sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.context.config.sanitizationConfig,
|
|
@@ -332786,7 +332836,8 @@ var GeminiChat = class {
|
|
|
332786
332836
|
return binaryParts.length > 0 ? binaryParts : void 0;
|
|
332787
332837
|
}
|
|
332788
332838
|
async makeApiCallAndProcessStream(modelConfigKey, requestHistory, prompt_id, abortSignal, role, apiHistoryOverride) {
|
|
332789
|
-
|
|
332839
|
+
let scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
|
|
332840
|
+
scrubbedHistory = coalesceConsecutiveRoles(scrubbedHistory);
|
|
332790
332841
|
const scrubbedContents = scrubbedHistory.map((h2) => h2.content);
|
|
332791
332842
|
const requestContents = apiHistoryOverride ? scrubContents(apiHistoryOverride) : scrubbedContents;
|
|
332792
332843
|
const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
|
|
@@ -333388,6 +333439,29 @@ function stripToolCallIdPrefixes(contents) {
|
|
|
333388
333439
|
})
|
|
333389
333440
|
}));
|
|
333390
333441
|
}
|
|
333442
|
+
function coalesceConsecutiveRoles(history) {
|
|
333443
|
+
const result2 = [];
|
|
333444
|
+
for (const turn of history) {
|
|
333445
|
+
const lastIdx = result2.length - 1;
|
|
333446
|
+
const last2 = result2[lastIdx];
|
|
333447
|
+
if (last2 && last2.content.role && last2.content.role === turn.content.role) {
|
|
333448
|
+
const hasParts = last2.content.parts || turn.content.parts;
|
|
333449
|
+
result2[lastIdx] = {
|
|
333450
|
+
id: last2.id,
|
|
333451
|
+
content: {
|
|
333452
|
+
...last2.content,
|
|
333453
|
+
parts: hasParts ? [...last2.content.parts || [], ...turn.content.parts || []] : void 0
|
|
333454
|
+
}
|
|
333455
|
+
};
|
|
333456
|
+
} else {
|
|
333457
|
+
result2.push({
|
|
333458
|
+
id: turn.id,
|
|
333459
|
+
content: { ...turn.content }
|
|
333460
|
+
});
|
|
333461
|
+
}
|
|
333462
|
+
}
|
|
333463
|
+
return result2;
|
|
333464
|
+
}
|
|
333391
333465
|
|
|
333392
333466
|
// packages/core/src/utils/ragLogger.ts
|
|
333393
333467
|
import * as fs50 from "node:fs";
|
|
@@ -340803,7 +340877,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
340803
340877
|
return provider;
|
|
340804
340878
|
}
|
|
340805
340879
|
case "oauth2": {
|
|
340806
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
340880
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-DFVE3NYF.js");
|
|
340807
340881
|
const provider = new OAuth2AuthProvider(
|
|
340808
340882
|
authConfig,
|
|
340809
340883
|
options.agentName ?? "unknown",
|
|
@@ -343158,8 +343232,7 @@ var LoopDetectionService = class {
|
|
|
343158
343232
|
promptId = "";
|
|
343159
343233
|
userPrompt = "";
|
|
343160
343234
|
// Tool call tracking
|
|
343161
|
-
|
|
343162
|
-
toolCallRepetitionCount = 0;
|
|
343235
|
+
toolCallHistory = [];
|
|
343163
343236
|
// Content streaming tracking
|
|
343164
343237
|
streamContentHistory = "";
|
|
343165
343238
|
contentStats = /* @__PURE__ */ new Map();
|
|
@@ -343301,14 +343374,31 @@ var LoopDetectionService = class {
|
|
|
343301
343374
|
}
|
|
343302
343375
|
checkToolCallLoop(toolCall) {
|
|
343303
343376
|
const key = this.getToolCallKey(toolCall);
|
|
343304
|
-
|
|
343305
|
-
|
|
343306
|
-
|
|
343307
|
-
this.
|
|
343308
|
-
|
|
343309
|
-
|
|
343310
|
-
|
|
343311
|
-
|
|
343377
|
+
this.toolCallHistory.push(key);
|
|
343378
|
+
const maxRequiredLength = 5 * TOOL_CALL_LOOP_THRESHOLD;
|
|
343379
|
+
if (this.toolCallHistory.length > maxRequiredLength) {
|
|
343380
|
+
this.toolCallHistory = this.toolCallHistory.slice(-maxRequiredLength);
|
|
343381
|
+
}
|
|
343382
|
+
const n3 = this.toolCallHistory.length;
|
|
343383
|
+
const R = TOOL_CALL_LOOP_THRESHOLD;
|
|
343384
|
+
for (let k = 1; k <= 5; k++) {
|
|
343385
|
+
const requiredLength = k * R;
|
|
343386
|
+
if (n3 >= requiredLength) {
|
|
343387
|
+
const cycle = this.toolCallHistory.slice(-k);
|
|
343388
|
+
let isPatternMatch = true;
|
|
343389
|
+
for (let i3 = 0; i3 < requiredLength; i3++) {
|
|
343390
|
+
const indexFromEnd = requiredLength - i3;
|
|
343391
|
+
const actualKey = this.toolCallHistory[n3 - indexFromEnd];
|
|
343392
|
+
const expectedKey = cycle[i3 % k];
|
|
343393
|
+
if (actualKey !== expectedKey) {
|
|
343394
|
+
isPatternMatch = false;
|
|
343395
|
+
break;
|
|
343396
|
+
}
|
|
343397
|
+
}
|
|
343398
|
+
if (isPatternMatch) {
|
|
343399
|
+
return true;
|
|
343400
|
+
}
|
|
343401
|
+
}
|
|
343312
343402
|
}
|
|
343313
343403
|
return false;
|
|
343314
343404
|
}
|
|
@@ -343608,8 +343698,7 @@ ${this.userPrompt}
|
|
|
343608
343698
|
this.loopDetected = false;
|
|
343609
343699
|
}
|
|
343610
343700
|
resetToolCallCount() {
|
|
343611
|
-
this.
|
|
343612
|
-
this.toolCallRepetitionCount = 0;
|
|
343701
|
+
this.toolCallHistory = [];
|
|
343613
343702
|
}
|
|
343614
343703
|
resetContentTracking(resetHistory = true) {
|
|
343615
343704
|
if (resetHistory) {
|
|
@@ -368681,7 +368770,9 @@ var CheckerRunner = class _CheckerRunner {
|
|
|
368681
368770
|
executeCheckerProcess(checkerPath, input, checkerName) {
|
|
368682
368771
|
return new Promise((resolve29) => {
|
|
368683
368772
|
const child = spawn9(checkerPath, [], {
|
|
368684
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
368773
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
368774
|
+
cwd: this.contextBuilder.config.getWorkingDir(),
|
|
368775
|
+
env: { ...process.env, ...this.contextBuilder.config.env }
|
|
368685
368776
|
});
|
|
368686
368777
|
let stdout = "";
|
|
368687
368778
|
let stderr = "";
|
|
@@ -368787,6 +368878,9 @@ var ContextBuilder = class {
|
|
|
368787
368878
|
constructor(context2) {
|
|
368788
368879
|
this.context = context2;
|
|
368789
368880
|
}
|
|
368881
|
+
get config() {
|
|
368882
|
+
return this.context.config;
|
|
368883
|
+
}
|
|
368790
368884
|
/**
|
|
368791
368885
|
* Builds the full context object with all available data.
|
|
368792
368886
|
*/
|
|
@@ -381555,6 +381649,7 @@ var Config = class {
|
|
|
381555
381649
|
useTerminalBuffer;
|
|
381556
381650
|
useRenderProcess;
|
|
381557
381651
|
shellExecutionConfig;
|
|
381652
|
+
env;
|
|
381558
381653
|
extensionManagement = true;
|
|
381559
381654
|
extensionRegistryURI;
|
|
381560
381655
|
truncateToolOutputThreshold;
|
|
@@ -381728,6 +381823,7 @@ var Config = class {
|
|
|
381728
381823
|
this.checkpointing = params.checkpointing ?? false;
|
|
381729
381824
|
this.proxy = params.proxy;
|
|
381730
381825
|
this.cwd = params.cwd ?? process15.cwd();
|
|
381826
|
+
this.env = params.env;
|
|
381731
381827
|
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
|
|
381732
381828
|
this.bugCommand = params.bugCommand;
|
|
381733
381829
|
this.model = params.model;
|
|
@@ -402449,6 +402545,7 @@ export {
|
|
|
402449
402545
|
isSchemaDepthError,
|
|
402450
402546
|
isInvalidArgumentError,
|
|
402451
402547
|
stripToolCallIdPrefixes,
|
|
402548
|
+
coalesceConsecutiveRoles,
|
|
402452
402549
|
populateToolDisplay,
|
|
402453
402550
|
toolResultDisplayToDisplayContent,
|
|
402454
402551
|
renderDisplayDiff,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
2
|
import {
|
|
3
3
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PKFZO3SN.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require
|