import type { PermissionResult } from "../agentic/types.js"; import type { Bash } from "../Bash.js"; export interface PermissionHandler { ask(message: string): Promise; } export interface PermissionRule { /** Pattern for tool names (e.g., "read_file", "write:*") */ toolPattern: string | RegExp; /** Pattern for file paths (if applicable) */ pathPattern?: string | RegExp; /** The behavior for this rule */ behavior: "allow" | "deny" | "ask"; /** Optional behavior behavior for specific modes (e.g., "plan", "execute") */ mode?: "plan" | "execute"; /** Optional reason for the behavior */ reason?: string; } /** * PermissionManager - Centralized permission control for Ag-Bash. * * Handles tool execution permissions, including interactive prompts and rule-based policies. */ export declare class PermissionManager { private handler?; private rules; private strictMode; private planAllowlist; constructor(handler?: PermissionHandler); private initDefaultRules; setHandler(handler: PermissionHandler): void; /** * Enables strict allowlist mode. When enabled and in plan mode, * only tools explicitly in the allowlist can execute. All others are denied. * This prevents bypass of the deny-list via non-standard tool names. */ enableStrictMode(): void; /** * Disables strict allowlist mode. Falls back to the default deny-list behavior. */ disableStrictMode(): void; /** * Returns whether strict mode is currently enabled. */ isStrictMode(): boolean; /** * Replaces the plan-mode allowlist with a custom set of tool names. * Only effective when strict mode is enabled. */ setAllowedPlanTools(tools: string[]): void; /** * Returns the current plan-mode allowlist as an array (for inspection/debugging). */ getAllowedPlanTools(): string[]; /** * Adds a permission rule. Rules added later take precedence (LIFO). */ addRule(rule: PermissionRule): void; /** * Checks if a tool is allowed to execute. */ checkPermission(bash: Bash, toolName: string, args: any, checkFn?: (bash: Bash, args: any) => Promise): Promise; private matches; }