fix: patch autoapprovals for alt toolsets
This commit is contained in:
@@ -311,17 +311,26 @@ function getDefaultDecision(toolName: string): PermissionDecision {
|
||||
"BashOutput",
|
||||
"ExitPlanMode",
|
||||
"LS",
|
||||
// Codex toolset - tools that don't require approval
|
||||
// Codex toolset (snake_case) - tools that don't require approval
|
||||
"read_file",
|
||||
"list_dir",
|
||||
"grep_files",
|
||||
"update_plan",
|
||||
// Gemini toolset - tools that don't require approval (using server names)
|
||||
// Codex toolset (PascalCase) - tools that don't require approval
|
||||
"ReadFile",
|
||||
"ListDir",
|
||||
"GrepFiles",
|
||||
"UpdatePlan",
|
||||
// Gemini toolset (snake_case) - tools that don't require approval
|
||||
"list_directory",
|
||||
"search_file_content",
|
||||
"write_todos",
|
||||
"read_many_files",
|
||||
// Note: read_file, glob already covered above (shared across toolsets)
|
||||
// Gemini toolset (PascalCase) - tools that don't require approval
|
||||
"ListDirectory",
|
||||
"SearchFileContent",
|
||||
"WriteTodos",
|
||||
"ReadManyFiles",
|
||||
];
|
||||
|
||||
if (autoAllowTools.includes(toolName)) {
|
||||
|
||||
@@ -116,16 +116,45 @@ class PermissionModeManager {
|
||||
return null;
|
||||
|
||||
case "plan": {
|
||||
// Read-only mode: allow analysis tools, deny modification tools
|
||||
// Read-only mode: allow analysis tools, deny everything else
|
||||
const allowedInPlan = [
|
||||
// Anthropic toolset
|
||||
"Read",
|
||||
"Glob",
|
||||
"Grep",
|
||||
"NotebookRead",
|
||||
"TodoWrite",
|
||||
// Codex toolset (snake_case)
|
||||
"read_file",
|
||||
"list_dir",
|
||||
"grep_files",
|
||||
"update_plan",
|
||||
// Codex toolset (PascalCase)
|
||||
"ReadFile",
|
||||
"ListDir",
|
||||
"GrepFiles",
|
||||
"UpdatePlan",
|
||||
// Gemini toolset (snake_case)
|
||||
"list_directory",
|
||||
"search_file_content",
|
||||
"write_todos",
|
||||
"read_many_files",
|
||||
// Gemini toolset (PascalCase)
|
||||
"ListDirectory",
|
||||
"SearchFileContent",
|
||||
"WriteTodos",
|
||||
"ReadManyFiles",
|
||||
];
|
||||
const writeTools = [
|
||||
// Anthropic toolset
|
||||
"Write",
|
||||
"Edit",
|
||||
"MultiEdit",
|
||||
"NotebookEdit",
|
||||
// Codex toolset
|
||||
"apply_patch",
|
||||
"ApplyPatch",
|
||||
];
|
||||
const writeTools = ["Write", "Edit", "MultiEdit", "NotebookEdit"];
|
||||
const deniedInPlan = ["Bash", "WebFetch"];
|
||||
|
||||
if (allowedInPlan.includes(toolName)) {
|
||||
return "allow";
|
||||
@@ -140,13 +169,10 @@ class PermissionModeManager {
|
||||
if (planFilePath && targetPath && targetPath === planFilePath) {
|
||||
return "allow";
|
||||
}
|
||||
return "deny";
|
||||
}
|
||||
|
||||
if (deniedInPlan.includes(toolName)) {
|
||||
return "deny";
|
||||
}
|
||||
return null;
|
||||
// Everything else denied in plan mode
|
||||
return "deny";
|
||||
}
|
||||
|
||||
case "default":
|
||||
|
||||
Reference in New Issue
Block a user