import { AiMode } from "@superblocksteam/library-shared/types";
import { SubagentType } from "../subagents/types.js";
import { ToolCategory, type AccessControlRule, PermissionLevel, type Tool, type AccessControlContext } from "./types.js";
/**
 * Access control utilities and common patterns.
 */
/**
 * Block tools by name pattern.
 *
 * @param pattern - String or regex pattern to match tool names
 * @returns Access control rule that blocks matching tools
 *
 * @example
 * registry.addAccessRule(blockTools(/^delete-/));
 * registry.addAccessRule(blockTools("drop-database"));
 */
export declare function blockTools(pattern: string | RegExp | (string | RegExp)[]): AccessControlRule;
/**
 * Require prompt for tools by name pattern.
 *
 * @param pattern - String or regex pattern to match tool names
 * @returns Access control rule that prompts for matching tools
 *
 * @example
 * registry.addAccessRule(promptForTools(/^delete-/));
 * registry.addAccessRule(promptForTools(["delete-file", "drop-table"]));
 */
export declare function promptForTools(pattern: string | RegExp | (string | RegExp)[]): AccessControlRule;
/**
 * Require specific user role.
 *
 * @param allowedRoles - Role or array of roles allowed to execute
 * @param permission - Permission level to return if role doesn't match
 * @returns Access control rule that checks user role
 *
 * @example
 * registry.addAccessRule(requireRole("admin", PermissionLevel.BLOCK));
 * registry.addAccessRule(requireRole(["admin", "editor"], PermissionLevel.PROMPT));
 */
export declare function requireRole(allowedRoles: string | string[], permission?: PermissionLevel): AccessControlRule;
/**
 * Combine multiple rules with AND logic (most restrictive wins).
 *
 * @param rules - Array of rules to combine
 * @returns Access control rule that evaluates all rules
 *
 * @example
 * const rule = combineRules([
 *   requireRole("admin"),
 *   blockTools(/^delete-/)
 * ]);
 */
export declare function combineRules(rules: AccessControlRule[]): AccessControlRule;
/**
 * Create a rule that only applies to specific tools.
 *
 * @param toolNames - Tool name or array of tool names
 * @param rule - Rule to apply to those tools
 * @returns Access control rule that conditionally applies
 *
 * @example
 * const rule = forTools(["delete-file", "delete-api"], requireRole("admin"));
 */
export declare function forTools(toolNames: string | string[], rule: AccessControlRule): AccessControlRule;
/**
 * Create a rule based on tool category.
 *
 * @param category - Category name to match
 * @param permission - Permission level to return for matching category
 * @returns Access control rule that checks tool category
 *
 * @example
 * const rule = forCategory("filesystem", PermissionLevel.PROMPT);
 */
export declare function forCategory(category: string, rule: AccessControlRule): AccessControlRule;
/**
 * Create a rule based on AI mode.
 *
 * Requires ToolRegistry to be passed in to look up metadata.
 *
 * @param mode - AI mode to match
 * @param rule - Rule to apply for that mode
 * @returns Access control rule that checks AI mode
 *
 * @example
 * const rule = forMode(AiMode.PLAN, readOnly());
 */
export declare function forMode(mode: AiMode, rule: AccessControlRule): AccessControlRule;
type AccessControlPredicate = (params: {
    tool: Tool;
    context: AccessControlContext;
    input?: any;
}) => boolean;
export declare function require(predicate: AccessControlPredicate, permission?: PermissionLevel): AccessControlRule;
/**
 * Read-only access rule.
 * Allows tools marked as readOnly, blocks others.
 */
export declare function readOnly(): AccessControlRule;
export declare function forSubagent(subagent: SubagentType, rule: AccessControlRule): AccessControlRule;
/**
 * Map subagent types to the tool categories they can access
 *
 * If a subagent is not in the mapping, it has no category restrictions.
 *
 * @param map - Map of subagent types to their allowed categories
 * @returns Access control rule that enforces category restrictions per subagent
 *
 * @example
 * ```typescript
 * registry.addAccessRule(
 *   subagentCategoryFilter({
 *     [SubagentType.MAIN]: [ToolCategory.COMPONENT, ToolCategory.FILE, ToolCategory.GENERAL],
 *     [SubagentType.TEST]: [ToolCategory.TEST],
 *     // Subagents not listed = no restrictions
 *   })
 * );
 * ```
 */
export declare function subagentCategoryMapping(map: Partial<Record<SubagentType, ToolCategory[]>>): AccessControlRule;
/**
 * Common access control presets.
 */
export declare const presets: {
    /**
     * Base rules applied in all modes.
     *
     * - Primary filtering by subagent and tool category
     * - PLAN mode: only read-only, debug, git, and test tools are available unless the user has approved execution
     */
    base: () => AccessControlRule[];
    /**
     * Development mode: Allow everything.
     */
    development: () => AccessControlRule[];
    /**
     * Production mode: Prompt for destructive operations.
     */
    production: () => AccessControlRule[];
    /**
     * Restricted mode: Block destructive operations entirely.
     */
    restricted: () => AccessControlRule[];
    /**
     * Guest mode: Read-only access.
     */
    guest: () => AccessControlRule[];
};
export {};
//# sourceMappingURL=access-control.d.ts.map