/**
 * OpenClaw-inspired Tool Policy System
 *
 * Implements allow/deny pattern matching with hierarchy:
 * 1. Agent-level settings (highest priority)
 * 2. Global configuration
 * 3. Default constants (lowest priority)
 *
 * Features:
 * - Exact match, wildcard patterns, and "all" wildcard
 * - Essential tools auto-inclusion (e.g., image for multimodal)
 * - Pattern compilation and caching for performance
 */
import { EventEmitter } from 'events';
export interface ToolPolicyConfig {
    /** Tools explicitly allowed (supports wildcards) */
    allow?: string[];
    /** Tools explicitly denied (supports wildcards) */
    deny?: string[];
    /** Essential tools that are always included unless explicitly denied */
    essential?: string[];
    /** Whether to log policy decisions */
    verbose?: boolean;
}
export interface PolicyHierarchy {
    agent?: ToolPolicyConfig;
    global?: ToolPolicyConfig;
    defaults?: ToolPolicyConfig;
}
export interface PolicyDecision {
    allowed: boolean;
    reason: string;
    matchedPattern?: string;
    source: 'agent' | 'global' | 'defaults' | 'essential' | 'no-allowlist';
}
export declare class ToolPolicyEngine extends EventEmitter {
    private compiledPatterns;
    private hierarchy;
    private resolvedConfig;
    constructor(hierarchy?: PolicyHierarchy);
    /**
     * Resolve configuration following hierarchy:
     * Agent > Global > Defaults
     */
    private resolveConfig;
    /**
     * Compile patterns for efficient matching
     */
    private compilePatterns;
    /**
     * Compile a list of patterns into optimized matchers
     */
    private compilePatternList;
    /**
     * Check if a tool name matches a pattern
     */
    private matchesPattern;
    /**
     * Check if a tool name matches any pattern in a list
     */
    private matchesAnyPattern;
    /**
     * Check if a tool is allowed by the policy
     */
    isToolAllowed(toolName: string): PolicyDecision;
    /**
     * Filter a list of tools by policy
     */
    filterTools<T extends {
        name: string;
    }>(tools: T[]): T[];
    /**
     * Get the source level for a pattern type
     */
    private getPatternSource;
    /**
     * Log a policy decision if verbose mode is enabled
     */
    private logDecision;
    /**
     * Update the policy hierarchy
     */
    updatePolicy(hierarchy: Partial<PolicyHierarchy>): void;
    /**
     * Update agent-level policy
     */
    setAgentPolicy(config: ToolPolicyConfig): void;
    /**
     * Update global policy
     */
    setGlobalPolicy(config: ToolPolicyConfig): void;
    /**
     * Get the resolved configuration
     */
    getConfig(): ToolPolicyConfig;
    /**
     * Get policy statistics
     */
    getStats(): {
        allowPatterns: number;
        denyPatterns: number;
        essentialTools: number;
    };
    /**
     * Check multiple tools at once
     */
    checkTools(toolNames: string[]): Map<string, PolicyDecision>;
    /**
     * Create a policy report
     */
    generateReport(toolNames: string[]): string;
}
export declare function getToolPolicyEngine(hierarchy?: PolicyHierarchy): ToolPolicyEngine;
export declare function resetToolPolicyEngine(): void;
/**
 * Convenience function to check if a tool is allowed
 */
export declare function isToolAllowed(toolName: string, hierarchy?: PolicyHierarchy): boolean;
/**
 * Convenience function to filter tools
 */
export declare function filterToolsByPolicy<T extends {
    name: string;
}>(tools: T[], hierarchy?: PolicyHierarchy): T[];
