mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 21:44:25 -07:00
feat(core): exempt high-signal tools from output masking (#18545)
This commit is contained in:
@@ -12,7 +12,14 @@ import { debugLogger } from '../utils/debugLogger.js';
|
||||
import { sanitizeFilenamePart } from '../utils/fileUtils.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { logToolOutputMasking } from '../telemetry/loggers.js';
|
||||
import { SHELL_TOOL_NAME } from '../tools/tool-names.js';
|
||||
import {
|
||||
SHELL_TOOL_NAME,
|
||||
ACTIVATE_SKILL_TOOL_NAME,
|
||||
MEMORY_TOOL_NAME,
|
||||
ASK_USER_TOOL_NAME,
|
||||
ENTER_PLAN_MODE_TOOL_NAME,
|
||||
EXIT_PLAN_MODE_TOOL_NAME,
|
||||
} from '../tools/tool-names.js';
|
||||
import { ToolOutputMaskingEvent } from '../telemetry/types.js';
|
||||
|
||||
// Tool output masking defaults
|
||||
@@ -23,6 +30,18 @@ export const MASKING_INDICATOR_TAG = 'tool_output_masked';
|
||||
|
||||
export const TOOL_OUTPUTS_DIR = 'tool-outputs';
|
||||
|
||||
/**
|
||||
* Tools whose outputs are always high-signal and should never be masked,
|
||||
* regardless of their position in the conversation history.
|
||||
*/
|
||||
const EXEMPT_TOOLS = new Set([
|
||||
ACTIVATE_SKILL_TOOL_NAME,
|
||||
MEMORY_TOOL_NAME,
|
||||
ASK_USER_TOOL_NAME,
|
||||
ENTER_PLAN_MODE_TOOL_NAME,
|
||||
EXIT_PLAN_MODE_TOOL_NAME,
|
||||
]);
|
||||
|
||||
export interface MaskingResult {
|
||||
newHistory: Content[];
|
||||
maskedCount: number;
|
||||
@@ -89,6 +108,11 @@ export class ToolOutputMaskingService {
|
||||
// core intent and logic, which are harder for the model to recover if lost.
|
||||
if (!part.functionResponse) continue;
|
||||
|
||||
const toolName = part.functionResponse.name;
|
||||
if (toolName && EXEMPT_TOOLS.has(toolName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const toolOutputContent = this.getToolOutputContent(part);
|
||||
if (!toolOutputContent || this.isAlreadyMasked(toolOutputContent)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user