refactor(tools): Move all tool names into tool-names.ts (#11493)

This commit is contained in:
Abhi
2025-10-19 20:53:53 -04:00
committed by GitHub
parent 0fd9ff0f53
commit c8518d6a63
17 changed files with 90 additions and 100 deletions
+11 -11
View File
@@ -10,30 +10,30 @@ import {
type PolicyRule,
ApprovalMode,
// Read-only tools
GlobTool,
LSTool,
GREP_TOOL_NAME,
LS_TOOL_NAME,
READ_MANY_FILES_TOOL_NAME,
READ_FILE_TOOL_NAME,
// Write tools
EditTool,
MemoryTool,
SHELL_TOOL_NAME,
WRITE_FILE_TOOL_NAME,
WEB_FETCH_TOOL_NAME,
WebSearchTool,
GLOB_TOOL_NAME,
EDIT_TOOL_NAME,
MEMORY_TOOL_NAME,
WEB_SEARCH_TOOL_NAME,
} from '@google/gemini-cli-core';
import type { Settings } from './settings.js';
// READ_ONLY_TOOLS is a list of built-in tools that do not modify the user's
// files or system state.
const READ_ONLY_TOOLS = new Set([
GlobTool.Name,
GLOB_TOOL_NAME,
GREP_TOOL_NAME,
LSTool.Name,
LS_TOOL_NAME,
READ_FILE_TOOL_NAME,
READ_MANY_FILES_TOOL_NAME,
WebSearchTool.Name,
WEB_SEARCH_TOOL_NAME,
]);
// WRITE_TOOLS is a list of built-in tools that can modify the user's files or
@@ -43,8 +43,8 @@ const READ_ONLY_TOOLS = new Set([
// any tool that isn't read only will require a confirmation unless altered by
// config and policy.
const WRITE_TOOLS = new Set([
EditTool.Name,
MemoryTool.Name,
EDIT_TOOL_NAME,
MEMORY_TOOL_NAME,
SHELL_TOOL_NAME,
WRITE_FILE_TOOL_NAME,
WEB_FETCH_TOOL_NAME,
@@ -168,7 +168,7 @@ export function createPolicyEngineConfig(
});
} else if (approvalMode === ApprovalMode.AUTO_EDIT) {
rules.push({
toolName: EditTool.Name,
toolName: EDIT_TOOL_NAME,
decision: PolicyDecision.ALLOW,
priority: 15, // Higher than write tools (10) to override ASK_USER
});