summaryrefslogtreecommitdiff
path: root/packages/cli/src/config/settings.ts
diff options
context:
space:
mode:
authorJacob MacDonald <[email protected]>2025-08-07 07:34:40 -0700
committerGitHub <[email protected]>2025-08-07 14:34:40 +0000
commit6ae75c9f32a968efa50857a8f24b958a58a84fd6 (patch)
tree6daccaf6fba4ac462a19ed75e198c02840f6a1a3 /packages/cli/src/config/settings.ts
parent36750ca49b1b2fa43a3d7904416b876203a1850f (diff)
Add a context percentage threshold setting for auto compression (#5721)
Diffstat (limited to 'packages/cli/src/config/settings.ts')
-rw-r--r--packages/cli/src/config/settings.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/cli/src/config/settings.ts b/packages/cli/src/config/settings.ts
index 64500845..8005ad65 100644
--- a/packages/cli/src/config/settings.ts
+++ b/packages/cli/src/config/settings.ts
@@ -13,6 +13,7 @@ import {
GEMINI_CONFIG_DIR as GEMINI_DIR,
getErrorMessage,
BugCommandSettings,
+ ChatCompressionSettings,
TelemetrySettings,
AuthType,
} from '@google/gemini-cli-core';
@@ -134,6 +135,8 @@ export interface Settings {
includeDirectories?: string[];
loadMemoryFromIncludeDirectories?: boolean;
+
+ chatCompression?: ChatCompressionSettings;
}
export interface SettingsError {
@@ -194,6 +197,11 @@ export class LoadedSettings {
...(user.includeDirectories || []),
...(workspace.includeDirectories || []),
],
+ chatCompression: {
+ ...(system.chatCompression || {}),
+ ...(user.chatCompression || {}),
+ ...(workspace.chatCompression || {}),
+ },
};
}
@@ -482,6 +490,19 @@ export function loadSettings(workspaceDir: string): LoadedSettings {
settingsErrors,
);
+ // Validate chatCompression settings
+ const chatCompression = loadedSettings.merged.chatCompression;
+ const threshold = chatCompression?.contextPercentageThreshold;
+ if (
+ threshold != null &&
+ (typeof threshold !== 'number' || threshold < 0 || threshold > 1)
+ ) {
+ console.warn(
+ `Invalid value for chatCompression.contextPercentageThreshold: "${threshold}". Please use a value between 0 and 1. Using default compression settings.`,
+ );
+ delete loadedSettings.merged.chatCompression;
+ }
+
// Load environment with merged settings
loadEnvironment(loadedSettings.merged);