/**
 * OpenClaw-inspired Plugin Conflict Detection System
 *
 * Features:
 * - Conflict detection between plugin IDs and tool names
 * - Allowlist filtering (exact match, plugin ID, group membership)
 * - Metadata tracking for plugin tool origins
 * - Safe plugin tool registration
 */
import { EventEmitter } from 'events';
export interface PluginTool {
    name: string;
    description: string;
    parameters?: Record<string, unknown>;
    execute: (args: Record<string, unknown>) => Promise<unknown>;
}
export interface Plugin {
    id: string;
    name: string;
    version: string;
    description?: string;
    required?: boolean;
    tools?: PluginTool[] | ((context: PluginContext) => PluginTool[] | Promise<PluginTool[]>);
    dependencies?: string[];
    priority?: number;
}
export interface PluginContext {
    workspaceRoot: string;
    configDir: string;
    agentId?: string;
    sessionId?: string;
}
export interface PluginToolMeta {
    pluginId: string;
    pluginName: string;
    optional: boolean;
    loadedAt: Date;
}
export interface ConflictReport {
    hasConflicts: boolean;
    conflicts: ConflictInfo[];
    warnings: string[];
}
export interface ConflictInfo {
    type: 'plugin_id_vs_tool' | 'duplicate_tool' | 'dependency_missing';
    pluginId: string;
    conflictsWith: string;
    message: string;
    resolution?: string;
}
export interface AllowlistConfig {
    /** Exact tool names to allow */
    tools?: string[];
    /** Plugin IDs to allow (all tools from these plugins) */
    plugins?: string[];
    /** Groups to allow (e.g., 'group:plugins' allows all plugins) */
    groups?: string[];
    /** Default behavior when no match found */
    defaultAllow?: boolean;
}
export declare class PluginConflictDetector extends EventEmitter {
    private builtInTools;
    private registeredPlugins;
    private toolMeta;
    private toolsByName;
    private allowlist;
    constructor(builtInTools?: string[], allowlist?: AllowlistConfig);
    /**
     * Check for conflicts before registering a plugin
     */
    checkConflicts(plugin: Plugin): ConflictReport;
    /**
     * Check tool conflicts within a plugin
     */
    checkToolConflicts(plugin: Plugin, tools: PluginTool[]): ConflictReport;
    /**
     * Check if a tool is allowed by the allowlist
     */
    isToolAllowed(toolName: string, pluginId: string, isRequired: boolean): boolean;
    /**
     * Register a plugin and resolve its tools
     */
    registerPlugin(plugin: Plugin, context: PluginContext): Promise<{
        success: boolean;
        registeredTools: PluginTool[];
        skippedTools: string[];
        errors: string[];
    }>;
    /**
     * Unregister a plugin and its tools
     */
    unregisterPlugin(pluginId: string): boolean;
    /**
     * Get tool metadata
     */
    getToolMeta(tool: PluginTool): PluginToolMeta | undefined;
    /**
     * Get all registered tools
     */
    getAllTools(): PluginTool[];
    /**
     * Get tools by plugin
     */
    getToolsByPlugin(pluginId: string): PluginTool[];
    /**
     * Update allowlist
     */
    updateAllowlist(config: Partial<AllowlistConfig>): void;
    /**
     * Add built-in tool names
     */
    addBuiltInTools(tools: string[]): void;
    /**
     * Get registry statistics
     */
    getStats(): {
        plugins: number;
        tools: number;
        builtInTools: number;
        allowlistRules: number;
    };
    /**
     * Generate a conflict report for all registered plugins
     */
    generateFullReport(): string;
    /**
     * Clear all registrations
     */
    clear(): void;
}
export declare function getPluginConflictDetector(builtInTools?: string[], allowlist?: AllowlistConfig): PluginConflictDetector;
export declare function resetPluginConflictDetector(): void;
/**
 * Convenience: Register multiple plugins
 */
export declare function registerPlugins(plugins: Plugin[], context: PluginContext, builtInTools?: string[]): Promise<{
    registered: string[];
    failed: string[];
    totalTools: number;
}>;
