| 1 | import { ToolPermissionPolicy } from "./types.js"; |
| 2 | |
| 3 | /** |
| 4 | * Default permission policies for all built-in tools. |
| 5 | * These policies are applied in order - first match wins. |
| 6 | */ |
| 7 | export const DEFAULT_TOOL_POLICIES: ToolPermissionPolicy[] = [ |
| 8 | // Read-only tools are generally safe to allow |
| 9 | { tool: "Read", permission: "allow" }, |
| 10 | { tool: "List", permission: "allow" }, |
| 11 | { tool: "Search", permission: "allow" }, |
| 12 | { tool: "Fetch", permission: "allow" }, |
| 13 | |
| 14 | // Write operations should require confirmation |
| 15 | { tool: "Write", permission: "ask" }, |
| 16 | { tool: "Edit", permission: "ask" }, |
| 17 | { tool: "MultiEdit", permission: "ask" }, |
| 18 | |
| 19 | // Write to a checklist |
| 20 | { tool: "Checklist", permission: "allow" }, |
| 21 | |
| 22 | // Terminal commands should require confirmation by default |
| 23 | { tool: "Bash", permission: "ask" }, |
| 24 | |
| 25 | // Exit tool is generally safe (headless mode only) |
| 26 | { tool: "Exit", permission: "allow" }, |
| 27 | |
| 28 | // View diff is read-only |
| 29 | { tool: "Diff", permission: "allow" }, |
| 30 | |
| 31 | // Default fallback - ask for any unmatched tools |
| 32 | { tool: "*", permission: "ask" }, |
| 33 | ]; |