/**
 * Tool Manager
 *
 * Centralized tool management with permissions and configuration (mistral-vibe style).
 * Handles tool discovery, lazy instantiation, and permission checks.
 *
 * Uses TypedEventEmitterAdapter for type-safe events with backward compatibility.
 */
import { ToolConfig, ToolPermission } from '../config/toml-config.js';
import { TypedEventEmitterAdapter, ToolEvents, ToolEvent } from '../events/index.js';
/**
 * Base tool interface
 */
export interface Tool {
    name: string;
    description: string;
    execute(args: Record<string, unknown>): Promise<ToolResult>;
}
/**
 * Tool result
 */
export interface ToolResult {
    success: boolean;
    output?: string;
    error?: string;
    metadata?: Record<string, unknown>;
}
/**
 * Tool registration info
 */
export interface ToolRegistration {
    /** Tool class constructor */
    factory: () => Tool;
    /** Tool name */
    name: string;
    /** Tool description */
    description: string;
    /** Default permission level */
    defaultPermission: ToolPermission;
    /** Default timeout in seconds */
    defaultTimeout: number;
    /** Whether tool is read-only (safe for parallel execution) */
    readOnly: boolean;
    /** Tags for categorization */
    tags?: string[];
}
/**
 * Permission check result
 */
export interface PermissionCheckResult {
    allowed: boolean;
    reason?: string;
    requiresConfirmation: boolean;
}
/**
 * Extended tool events including execution events
 */
interface ToolManagerEvents extends ToolEvents {
    'tool:executed': ToolEvent;
}
/**
 * Centralized tool manager with type-safe events.
 *
 * Emits the following events:
 * - 'tool:registered' - When a tool is registered
 * - 'tool:instantiated' - When a tool instance is created (lazy)
 * - 'tool:executed' - When a tool is successfully executed
 * - 'tool:error' - When a tool execution fails
 */
export declare class ToolManager extends TypedEventEmitterAdapter<ToolManagerEvents> {
    private registrations;
    private instances;
    private permissionCache;
    constructor();
    /**
     * Register a tool
     */
    register(registration: ToolRegistration): void;
    /**
     * Register multiple tools
     */
    registerAll(registrations: ToolRegistration[]): void;
    /**
     * Get a tool instance (lazy instantiation)
     */
    get(name: string): Tool | undefined;
    /**
     * Check if tool exists
     */
    has(name: string): boolean;
    /**
     * Get all registered tool names
     */
    getNames(): string[];
    /**
     * Get tools by tag
     */
    getByTag(tag: string): string[];
    /**
     * Get read-only tools (safe for parallel execution)
     */
    getReadOnlyTools(): string[];
    /**
     * Get tool registration info
     */
    getRegistration(name: string): ToolRegistration | undefined;
    /**
     * Get effective permission for a tool
     */
    getPermission(toolName: string): ToolPermission;
    /**
     * Get timeout for a tool
     */
    getTimeout(toolName: string): number;
    /**
     * Check if a tool call is allowed
     */
    checkPermission(toolName: string, args: Record<string, unknown>): PermissionCheckResult;
    /**
     * Execute a tool with permission check
     */
    execute(toolName: string, args: Record<string, unknown>, options?: {
        skipPermissionCheck?: boolean;
        onConfirmation?: (tool: string, args: Record<string, unknown>) => Promise<boolean>;
    }): Promise<ToolResult>;
    /**
     * Get tool config from TOML
     */
    getConfig(toolName: string): ToolConfig | undefined;
    /**
     * Clear instance cache
     */
    clearCache(): void;
    /**
     * Get tool stats
     */
    getStats(): {
        registered: number;
        instantiated: number;
        readOnly: number;
        byPermission: Record<ToolPermission, number>;
    };
    /**
     * Dispose and cleanup resources
     */
    dispose(): void;
}
/**
 * Create default tool registrations
 */
export declare function createDefaultRegistrations(): ToolRegistration[];
export declare function getToolManager(): ToolManager;
/**
 * Create a new tool manager instance (for testing)
 */
export declare function createToolManager(): ToolManager;
/**
 * Reset the tool manager singleton (for testing)
 */
export declare function resetToolManager(): void;
export {};
