@google/gemini-cli 0.52.0-preview.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-H4QBAJVE.js → chunk-27C6XFMY.js} +182 -85
- package/bundle/{chunk-2JOVER4Y.js → chunk-4OVORMGE.js} +1 -1
- package/bundle/{chunk-NA3AQERF.js → chunk-5RDOS7UZ.js} +168 -81
- package/bundle/{chunk-JIZMX5VA.js → chunk-6AD4A2WF.js} +1 -1
- package/bundle/{chunk-URY5Z7OD.js → chunk-7VUO7T2C.js} +3 -3
- package/bundle/{chunk-QPWNOZZA.js → chunk-BDSSP5BZ.js} +1 -1
- package/bundle/{chunk-RBAJ4USN.js → chunk-BRZT2CQU.js} +1 -1
- package/bundle/{chunk-G5GKJ24J.js → chunk-BX6DTJOD.js} +1 -1
- package/bundle/{chunk-7DP44OLX.js → chunk-CTNBR234.js} +2 -2
- package/bundle/{chunk-4POBROII.js → chunk-GHVD6PXK.js} +1 -1
- package/bundle/{chunk-PVW3N4AH.js → chunk-HF533LET.js} +184 -87
- package/bundle/{chunk-QWB2NQDU.js → chunk-HVYOZEAP.js} +3 -3
- package/bundle/{chunk-NX6KSZP7.js → chunk-IODN6H35.js} +1 -1
- package/bundle/{chunk-G4YQC4AV.js → chunk-LUM47MYE.js} +1 -1
- package/bundle/{chunk-GT4ZUA5O.js → chunk-PKFZO3SN.js} +1 -1
- package/bundle/{chunk-4PY4INPX.js → chunk-PLMRBJEA.js} +2 -2
- package/bundle/{chunk-TKB33QSB.js → chunk-PVCJCQWY.js} +1 -1
- package/bundle/{chunk-73WMB3MX.js → chunk-QSTUV3QH.js} +7 -7
- package/bundle/{chunk-A2UAPUDF.js → chunk-SLQKIE73.js} +1 -1
- package/bundle/{chunk-6QIR5QWV.js → chunk-SXKIOLLX.js} +7 -7
- package/bundle/{chunk-SO3OO5YC.js → chunk-UEI42N7R.js} +3 -3
- package/bundle/{chunk-PK356GGP.js → chunk-UJVAPQ7V.js} +1 -1
- package/bundle/{chunk-BTPQ2MQ6.js → chunk-WVDR5L2V.js} +7 -7
- package/bundle/{chunk-LXIJXSLZ.js → chunk-XH7QC2TB.js} +2 -2
- package/bundle/{cleanup-CNR4RPBP.js → cleanup-4FVUYQ7H.js} +2 -2
- package/bundle/{cleanup-UVL5TK4S.js → cleanup-XETKRH7X.js} +2 -2
- package/bundle/{cleanup-YMN2TL6U.js → cleanup-ZR34H2GU.js} +2 -2
- package/bundle/{core-KZ4XRQQ6.js → core-I73XKBPY.js} +3 -1
- package/bundle/{dist-SEFVUQID.js → core-PVG4D2MR.js} +3 -1
- package/bundle/{devtoolsService-7TGRNOVV.js → devtoolsService-IVPTF5ZJ.js} +2 -2
- package/bundle/{devtoolsService-PFO3BZC7.js → devtoolsService-OUX7PWP3.js} +2 -2
- package/bundle/{devtoolsService-SDOVVX7E.js → devtoolsService-QYDPHHFN.js} +2 -2
- package/bundle/{core-3UX5OSS4.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-IR6EZI53.js → gemini-E2E3U6PR.js} +13 -13
- package/bundle/{gemini-PV3DL2IX.js → gemini-LA6TNI44.js} +14 -14
- package/bundle/{gemini-BPKBGO4O.js → gemini-QKB55UV6.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-QLXRE74K.js → interactiveCli-ADLAWPXN.js} +8 -8
- package/bundle/{interactiveCli-A6PVVEMY.js → interactiveCli-FS3OVPXQ.js} +8 -8
- package/bundle/{interactiveCli-JYC6ZXT3.js → interactiveCli-OD2LO24X.js} +8 -8
- package/bundle/{liteRtServerManager-GH4QSUW6.js → liteRtServerManager-3SKK7MNE.js} +4 -4
- package/bundle/{liteRtServerManager-EMYCURQC.js → liteRtServerManager-O7PFOUFD.js} +4 -4
- package/bundle/{liteRtServerManager-UZTNT425.js → liteRtServerManager-T2Z3RLS3.js} +4 -4
- package/bundle/{oauth2-provider-NHVNIDFT.js → oauth2-provider-DFVE3NYF.js} +1 -1
- package/bundle/{oauth2-provider-NZYJE7VU.js → oauth2-provider-E3S5DGLL.js} +1 -1
- package/bundle/{oauth2-provider-2U3SDH5S.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-GDRL6IAP.js → start-3FPYJBRX.js} +6 -6
- package/bundle/{start-YXVG22DK.js → start-5G2UDZZ6.js} +6 -6
- package/bundle/{start-52AYSDXT.js → start-XMJ23QZN.js} +6 -6
- 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
|
-
|
|
278406
|
-
|
|
278407
|
-
|
|
278408
|
-
|
|
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
|
|
278411
|
-
|
|
278412
|
-
|
|
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
|
-
|
|
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
|
-
|
|
278432
|
+
const client2 = createBaseOAuth2Client();
|
|
278433
|
+
client2.setCredentials({
|
|
278430
278434
|
access_token: process.env["GOOGLE_CLOUD_ACCESS_TOKEN"]
|
|
278431
278435
|
});
|
|
278432
|
-
await fetchAndCacheUserInfo(
|
|
278433
|
-
return
|
|
278436
|
+
await fetchAndCacheUserInfo(client2);
|
|
278437
|
+
return client2;
|
|
278434
278438
|
}
|
|
278435
|
-
|
|
278436
|
-
|
|
278437
|
-
|
|
278438
|
-
|
|
278439
|
-
|
|
278440
|
-
|
|
278441
|
-
|
|
278442
|
-
|
|
278443
|
-
|
|
278444
|
-
|
|
278445
|
-
|
|
278446
|
-
|
|
278447
|
-
|
|
278448
|
-
|
|
278449
|
-
|
|
278450
|
-
|
|
278451
|
-
|
|
278452
|
-
|
|
278453
|
-
|
|
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
|
-
|
|
278457
|
-
|
|
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
|
|
278791
|
+
async function fetchCachedCredentialsList() {
|
|
278792
|
+
const credentialsList = [];
|
|
278773
278793
|
const useEncryptedStorage = getUseEncryptedStorageFlag();
|
|
278774
278794
|
if (useEncryptedStorage) {
|
|
278775
|
-
|
|
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
|
-
|
|
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
|
|
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 = "
|
|
282469
|
-
var CLI_VERSION = "0.
|
|
282496
|
+
var GIT_COMMIT_INFO = "9681621c6";
|
|
282497
|
+
var CLI_VERSION = "0.53.0-preview.0";
|
|
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.
|
|
305678
|
+
return "0.53.0-preview.0";
|
|
305647
305679
|
})();
|
|
305648
305680
|
return versionPromise;
|
|
305649
305681
|
}
|
|
@@ -310612,13 +310644,19 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
|
|
|
310612
310644
|
customHeaders,
|
|
310613
310645
|
vertexAiRouting
|
|
310614
310646
|
};
|
|
310647
|
+
const getEnv3 = (key) => {
|
|
310648
|
+
if (config2?.env && config2.env[key] !== void 0) {
|
|
310649
|
+
return config2.env[key];
|
|
310650
|
+
}
|
|
310651
|
+
return process.env[key];
|
|
310652
|
+
};
|
|
310615
310653
|
if (authType === AuthType2.LOGIN_WITH_GOOGLE || authType === AuthType2.COMPUTE_ADC) {
|
|
310616
310654
|
return contentGeneratorConfig;
|
|
310617
310655
|
}
|
|
310618
|
-
const geminiApiKey = apiKey ||
|
|
310619
|
-
const googleApiKey =
|
|
310620
|
-
const googleCloudProject =
|
|
310621
|
-
const googleCloudLocation =
|
|
310656
|
+
const geminiApiKey = apiKey || getEnv3("GEMINI_API_KEY") || await loadApiKey() || void 0;
|
|
310657
|
+
const googleApiKey = getEnv3("GOOGLE_API_KEY") || void 0;
|
|
310658
|
+
const googleCloudProject = getEnv3("GOOGLE_CLOUD_PROJECT") || getEnv3("GOOGLE_CLOUD_PROJECT_ID") || void 0;
|
|
310659
|
+
const googleCloudLocation = getEnv3("GOOGLE_CLOUD_LOCATION") || void 0;
|
|
310622
310660
|
if (authType === AuthType2.USE_GEMINI && geminiApiKey) {
|
|
310623
310661
|
contentGeneratorConfig.apiKey = geminiApiKey;
|
|
310624
310662
|
contentGeneratorConfig.vertexai = false;
|
|
@@ -310630,7 +310668,7 @@ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl,
|
|
|
310630
310668
|
return contentGeneratorConfig;
|
|
310631
310669
|
}
|
|
310632
310670
|
if (authType === AuthType2.GATEWAY) {
|
|
310633
|
-
contentGeneratorConfig.apiKey = apiKey ||
|
|
310671
|
+
contentGeneratorConfig.apiKey = apiKey || getEnv3("GEMINI_API_KEY") || "";
|
|
310634
310672
|
contentGeneratorConfig.vertexai = false;
|
|
310635
310673
|
return contentGeneratorConfig;
|
|
310636
310674
|
}
|
|
@@ -320914,7 +320952,7 @@ import { TextDecoder as TextDecoder2 } from "node:util";
|
|
|
320914
320952
|
import os28 from "node:os";
|
|
320915
320953
|
import fs47, { mkdirSync as mkdirSync4 } from "node:fs";
|
|
320916
320954
|
import path57 from "node:path";
|
|
320917
|
-
var
|
|
320955
|
+
var import_headless3 = __toESM(require_xterm_headless(), 1);
|
|
320918
320956
|
|
|
320919
320957
|
// packages/core/dist/src/utils/terminalSerializer.js
|
|
320920
320958
|
var Attribute;
|
|
@@ -321789,7 +321827,7 @@ var ExecutionLifecycleService = class {
|
|
|
321789
321827
|
};
|
|
321790
321828
|
|
|
321791
321829
|
// packages/core/dist/src/services/shellExecutionService.js
|
|
321792
|
-
var { Terminal } =
|
|
321830
|
+
var { Terminal } = import_headless3.default;
|
|
321793
321831
|
var MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024;
|
|
321794
321832
|
var GEMINI_CLI_IDENTIFICATION_ENV_VAR = "GEMINI_CLI";
|
|
321795
321833
|
var GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = "1";
|
|
@@ -321987,9 +322025,10 @@ ${truncated}`;
|
|
|
321987
322025
|
const guardedCommand = ensurePromptvarsDisabled(commandToExecute, shell);
|
|
321988
322026
|
const finalCommand = injectUtf8CodepageForPty(guardedCommand, shell, isWindows3, usingPty);
|
|
321989
322027
|
const spawnArgs = [...argsPrefix, finalCommand];
|
|
322028
|
+
const sourceEnv = shellExecutionConfig.env ?? process.env;
|
|
321990
322029
|
const gitConfigKeys = [];
|
|
321991
322030
|
if (!isInteractive) {
|
|
321992
|
-
for (const key in
|
|
322031
|
+
for (const key in sourceEnv) {
|
|
321993
322032
|
if (key.startsWith("GIT_CONFIG_")) {
|
|
321994
322033
|
gitConfigKeys.push(key);
|
|
321995
322034
|
}
|
|
@@ -322002,7 +322041,7 @@ ${truncated}`;
|
|
|
322002
322041
|
...gitConfigKeys
|
|
322003
322042
|
]
|
|
322004
322043
|
};
|
|
322005
|
-
const sanitizedEnv = sanitizeEnvironment(
|
|
322044
|
+
const sanitizedEnv = sanitizeEnvironment(sourceEnv, sanitizationConfig);
|
|
322006
322045
|
const baseEnv = {
|
|
322007
322046
|
...sanitizedEnv,
|
|
322008
322047
|
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]: GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
|
|
@@ -322012,7 +322051,7 @@ ${truncated}`;
|
|
|
322012
322051
|
};
|
|
322013
322052
|
if (!isInteractive) {
|
|
322014
322053
|
for (const key of gitConfigKeys) {
|
|
322015
|
-
baseEnv[key] =
|
|
322054
|
+
baseEnv[key] = sourceEnv[key];
|
|
322016
322055
|
}
|
|
322017
322056
|
const gitConfigCount = parseInt(baseEnv["GIT_CONFIG_COUNT"] || "0", 10);
|
|
322018
322057
|
const newKey = `GIT_CONFIG_KEY_${gitConfigCount}`;
|
|
@@ -323385,6 +323424,7 @@ exit $__code`;
|
|
|
323385
323424
|
}
|
|
323386
323425
|
}, combinedController.signal, this.context.config.isInteractiveShellEnabled(), {
|
|
323387
323426
|
...shellExecutionConfig,
|
|
323427
|
+
env: this.context.config.env,
|
|
323388
323428
|
sessionId: this.context.config?.getSessionId?.() ?? "default",
|
|
323389
323429
|
pager: "cat",
|
|
323390
323430
|
sanitizationConfig: shellExecutionConfig?.sanitizationConfig ?? this.context.config.sanitizationConfig,
|
|
@@ -330526,7 +330566,8 @@ var GeminiChat = class {
|
|
|
330526
330566
|
return binaryParts.length > 0 ? binaryParts : void 0;
|
|
330527
330567
|
}
|
|
330528
330568
|
async makeApiCallAndProcessStream(modelConfigKey, requestHistory, prompt_id, abortSignal, role, apiHistoryOverride) {
|
|
330529
|
-
|
|
330569
|
+
let scrubbedHistory = this.context.config.isContextManagementEnabled() ? scrubHistory([...requestHistory]) : [...requestHistory];
|
|
330570
|
+
scrubbedHistory = coalesceConsecutiveRoles(scrubbedHistory);
|
|
330530
330571
|
const scrubbedContents = scrubbedHistory.map((h2) => h2.content);
|
|
330531
330572
|
const requestContents = apiHistoryOverride ? scrubContents(apiHistoryOverride) : scrubbedContents;
|
|
330532
330573
|
const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
|
|
@@ -331046,6 +331087,29 @@ function stripToolCallIdPrefixes(contents) {
|
|
|
331046
331087
|
})
|
|
331047
331088
|
}));
|
|
331048
331089
|
}
|
|
331090
|
+
function coalesceConsecutiveRoles(history) {
|
|
331091
|
+
const result2 = [];
|
|
331092
|
+
for (const turn of history) {
|
|
331093
|
+
const lastIdx = result2.length - 1;
|
|
331094
|
+
const last2 = result2[lastIdx];
|
|
331095
|
+
if (last2 && last2.content.role && last2.content.role === turn.content.role) {
|
|
331096
|
+
const hasParts = last2.content.parts || turn.content.parts;
|
|
331097
|
+
result2[lastIdx] = {
|
|
331098
|
+
id: last2.id,
|
|
331099
|
+
content: {
|
|
331100
|
+
...last2.content,
|
|
331101
|
+
parts: hasParts ? [...last2.content.parts || [], ...turn.content.parts || []] : void 0
|
|
331102
|
+
}
|
|
331103
|
+
};
|
|
331104
|
+
} else {
|
|
331105
|
+
result2.push({
|
|
331106
|
+
id: turn.id,
|
|
331107
|
+
content: { ...turn.content }
|
|
331108
|
+
});
|
|
331109
|
+
}
|
|
331110
|
+
}
|
|
331111
|
+
return result2;
|
|
331112
|
+
}
|
|
331049
331113
|
|
|
331050
331114
|
// packages/core/dist/src/utils/ragLogger.js
|
|
331051
331115
|
import * as fs50 from "node:fs";
|
|
@@ -338173,7 +338237,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
338173
338237
|
return provider;
|
|
338174
338238
|
}
|
|
338175
338239
|
case "oauth2": {
|
|
338176
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
338240
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-E3S5DGLL.js");
|
|
338177
338241
|
const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
|
|
338178
338242
|
await provider.initialize();
|
|
338179
338243
|
return provider;
|
|
@@ -340320,8 +340384,7 @@ var LoopDetectionService = class {
|
|
|
340320
340384
|
promptId = "";
|
|
340321
340385
|
userPrompt = "";
|
|
340322
340386
|
// Tool call tracking
|
|
340323
|
-
|
|
340324
|
-
toolCallRepetitionCount = 0;
|
|
340387
|
+
toolCallHistory = [];
|
|
340325
340388
|
// Content streaming tracking
|
|
340326
340389
|
streamContentHistory = "";
|
|
340327
340390
|
contentStats = /* @__PURE__ */ new Map();
|
|
@@ -340443,14 +340506,31 @@ var LoopDetectionService = class {
|
|
|
340443
340506
|
}
|
|
340444
340507
|
checkToolCallLoop(toolCall) {
|
|
340445
340508
|
const key = this.getToolCallKey(toolCall);
|
|
340446
|
-
|
|
340447
|
-
|
|
340448
|
-
|
|
340449
|
-
this.
|
|
340450
|
-
|
|
340451
|
-
|
|
340452
|
-
|
|
340453
|
-
|
|
340509
|
+
this.toolCallHistory.push(key);
|
|
340510
|
+
const maxRequiredLength = 5 * TOOL_CALL_LOOP_THRESHOLD;
|
|
340511
|
+
if (this.toolCallHistory.length > maxRequiredLength) {
|
|
340512
|
+
this.toolCallHistory = this.toolCallHistory.slice(-maxRequiredLength);
|
|
340513
|
+
}
|
|
340514
|
+
const n3 = this.toolCallHistory.length;
|
|
340515
|
+
const R = TOOL_CALL_LOOP_THRESHOLD;
|
|
340516
|
+
for (let k = 1; k <= 5; k++) {
|
|
340517
|
+
const requiredLength = k * R;
|
|
340518
|
+
if (n3 >= requiredLength) {
|
|
340519
|
+
const cycle = this.toolCallHistory.slice(-k);
|
|
340520
|
+
let isPatternMatch = true;
|
|
340521
|
+
for (let i3 = 0; i3 < requiredLength; i3++) {
|
|
340522
|
+
const indexFromEnd = requiredLength - i3;
|
|
340523
|
+
const actualKey = this.toolCallHistory[n3 - indexFromEnd];
|
|
340524
|
+
const expectedKey = cycle[i3 % k];
|
|
340525
|
+
if (actualKey !== expectedKey) {
|
|
340526
|
+
isPatternMatch = false;
|
|
340527
|
+
break;
|
|
340528
|
+
}
|
|
340529
|
+
}
|
|
340530
|
+
if (isPatternMatch) {
|
|
340531
|
+
return true;
|
|
340532
|
+
}
|
|
340533
|
+
}
|
|
340454
340534
|
}
|
|
340455
340535
|
return false;
|
|
340456
340536
|
}
|
|
@@ -340708,8 +340788,7 @@ ${this.userPrompt}
|
|
|
340708
340788
|
this.loopDetected = false;
|
|
340709
340789
|
}
|
|
340710
340790
|
resetToolCallCount() {
|
|
340711
|
-
this.
|
|
340712
|
-
this.toolCallRepetitionCount = 0;
|
|
340791
|
+
this.toolCallHistory = [];
|
|
340713
340792
|
}
|
|
340714
340793
|
resetContentTracking(resetHistory = true) {
|
|
340715
340794
|
if (resetHistory) {
|
|
@@ -363616,7 +363695,9 @@ var CheckerRunner = class _CheckerRunner {
|
|
|
363616
363695
|
executeCheckerProcess(checkerPath, input, checkerName) {
|
|
363617
363696
|
return new Promise((resolve29) => {
|
|
363618
363697
|
const child = spawn9(checkerPath, [], {
|
|
363619
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
363698
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
363699
|
+
cwd: this.contextBuilder.config.getWorkingDir(),
|
|
363700
|
+
env: { ...process.env, ...this.contextBuilder.config.env }
|
|
363620
363701
|
});
|
|
363621
363702
|
let stdout = "";
|
|
363622
363703
|
let stderr = "";
|
|
@@ -363723,6 +363804,9 @@ var ContextBuilder = class {
|
|
|
363723
363804
|
constructor(context2) {
|
|
363724
363805
|
this.context = context2;
|
|
363725
363806
|
}
|
|
363807
|
+
get config() {
|
|
363808
|
+
return this.context.config;
|
|
363809
|
+
}
|
|
363726
363810
|
/**
|
|
363727
363811
|
* Builds the full context object with all available data.
|
|
363728
363812
|
*/
|
|
@@ -375825,6 +375909,7 @@ var Config = class {
|
|
|
375825
375909
|
useTerminalBuffer;
|
|
375826
375910
|
useRenderProcess;
|
|
375827
375911
|
shellExecutionConfig;
|
|
375912
|
+
env;
|
|
375828
375913
|
extensionManagement = true;
|
|
375829
375914
|
extensionRegistryURI;
|
|
375830
375915
|
truncateToolOutputThreshold;
|
|
@@ -375991,6 +376076,7 @@ var Config = class {
|
|
|
375991
376076
|
this.checkpointing = params.checkpointing ?? false;
|
|
375992
376077
|
this.proxy = params.proxy;
|
|
375993
376078
|
this.cwd = params.cwd ?? process15.cwd();
|
|
376079
|
+
this.env = params.env;
|
|
375994
376080
|
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
|
|
375995
376081
|
this.bugCommand = params.bugCommand;
|
|
375996
376082
|
this.model = params.model;
|
|
@@ -395851,6 +395937,7 @@ export {
|
|
|
395851
395937
|
isSchemaDepthError,
|
|
395852
395938
|
isInvalidArgumentError,
|
|
395853
395939
|
stripToolCallIdPrefixes,
|
|
395940
|
+
coalesceConsecutiveRoles,
|
|
395854
395941
|
populateToolDisplay,
|
|
395855
395942
|
toolResultDisplayToDisplayContent,
|
|
395856
395943
|
renderDisplayDiff,
|
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
exitCli,
|
|
4
4
|
require_source
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UJVAPQ7V.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_PORT,
|
|
8
8
|
SERVER_START_WAIT_MS,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
isServerRunning,
|
|
15
15
|
resolveGemmaConfig,
|
|
16
16
|
writeServerProcessInfo
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LUM47MYE.js";
|
|
18
18
|
import {
|
|
19
19
|
debugLogger
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5RDOS7UZ.js";
|
|
21
21
|
import {
|
|
22
22
|
__toESM
|
|
23
23
|
} from "./chunk-34MYV7JD.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
2
|
import {
|
|
3
3
|
checkExhaustive
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-27C6XFMY.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
2
|
import {
|
|
3
3
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PVCJCQWY.js";
|
|
5
5
|
import {
|
|
6
6
|
RELEASE_CHANNEL_STABILITY,
|
|
7
7
|
debugLogger,
|
|
8
8
|
getChannelFromVersion,
|
|
9
9
|
isGitRepository
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HF533LET.js";
|
|
11
11
|
|
|
12
12
|
// packages/cli/src/utils/installationInfo.ts
|
|
13
13
|
import * as fs from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
2
|
import {
|
|
3
3
|
checkExhaustive
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HF533LET.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM
|