feat(context): add remote configuration for tool output masking thresholds (#18553)

This commit is contained in:
Abhi
2026-02-07 22:04:46 -05:00
committed by GitHub
parent 86bd7dbd4f
commit bc8ffa6631
4 changed files with 77 additions and 6 deletions
+33 -2
View File
@@ -1433,8 +1433,39 @@ export class Config {
return this.toolOutputMasking.enabled;
}
getToolOutputMaskingConfig(): ToolOutputMaskingConfig {
return this.toolOutputMasking;
async getToolOutputMaskingConfig(): Promise<ToolOutputMaskingConfig> {
await this.ensureExperimentsLoaded();
const remoteProtection =
this.experiments?.flags[ExperimentFlags.MASKING_PROTECTION_THRESHOLD]
?.intValue;
const remotePrunable =
this.experiments?.flags[ExperimentFlags.MASKING_PRUNABLE_THRESHOLD]
?.intValue;
const remoteProtectLatest =
this.experiments?.flags[ExperimentFlags.MASKING_PROTECT_LATEST_TURN]
?.boolValue;
const parsedProtection = remoteProtection
? parseInt(remoteProtection, 10)
: undefined;
const parsedPrunable = remotePrunable
? parseInt(remotePrunable, 10)
: undefined;
return {
enabled: this.toolOutputMasking.enabled,
toolProtectionThreshold:
parsedProtection !== undefined && !isNaN(parsedProtection)
? parsedProtection
: this.toolOutputMasking.toolProtectionThreshold,
minPrunableTokensThreshold:
parsedPrunable !== undefined && !isNaN(parsedPrunable)
? parsedPrunable
: this.toolOutputMasking.minPrunableTokensThreshold,
protectLatestTurn:
remoteProtectLatest ?? this.toolOutputMasking.protectLatestTurn,
};
}
getGeminiMdFileCount(): number {