import { EventEmitter } from 'events';
import { PluginMetadata, PluginIsolationConfig, PluginProvider, PluginProviderType } from './types.js';
export type { PluginProvider } from './types.js';
export interface PluginManagerConfig {
    pluginDir: string;
    autoLoad?: boolean;
    /** Default isolation settings for all plugins */
    isolation?: PluginIsolationConfig;
    /** Force isolation for all plugins (ignore manifest.isolated setting) */
    forceIsolation?: boolean;
}
export declare class PluginManager extends EventEmitter {
    private plugins;
    private isolatedRunners;
    private providers;
    private providersByType;
    private pluginConfigs;
    private config;
    private logger;
    constructor(config?: Partial<PluginManagerConfig>);
    /**
     * Discover and load all plugins from the plugin directory
     */
    discover(): Promise<void>;
    /**
     * Determine if a plugin should run in isolation
     */
    private shouldIsolate;
    /**
     * Load plugin-specific configuration
     *
     * Configuration is loaded from multiple sources with the following priority (highest first):
     * 1. User config: ~/.codebuddy/plugins/<plugin-id>/config.json
     * 2. Default config from manifest: manifest.defaultConfig
     *
     * The final config is merged and validated against the plugin's configSchema if provided.
     */
    private loadPluginConfig;
    /**
     * Get the loaded configuration for a plugin
     */
    getPluginConfig(pluginId: string): Record<string, unknown> | undefined;
    /**
     * Load a specific plugin from a directory
     */
    loadPlugin(pluginPath: string): Promise<boolean>;
    /**
     * Activate a loaded plugin
     */
    activatePlugin(id: string): Promise<boolean>;
    /**
     * Activate a plugin in an isolated Worker Thread
     */
    private activateIsolatedPlugin;
    /**
     * Deactivate a plugin
     */
    deactivatePlugin(id: string): Promise<boolean>;
    /**
     * Deactivate an isolated plugin and terminate its worker
     */
    private deactivateIsolatedPlugin;
    /**
     * Create the context object passed to the plugin
     */
    private createPluginContext;
    /**
     * Validate that a provider has the required methods based on its type
     */
    private validateProvider;
    /**
     * Register a provider from a plugin
     *
     * @param provider - The provider to register
     * @param pluginId - Optional: the ID of the plugin registering this provider
     * @throws Error if provider validation fails
     */
    registerProvider(provider: PluginProvider, pluginId?: string): Promise<void>;
    /**
     * Unregister a provider
     *
     * @param providerId - The ID of the provider to unregister
     */
    unregisterProvider(providerId: string): Promise<boolean>;
    /**
     * Get a provider by ID
     */
    getProvider(id: string): PluginProvider | undefined;
    /**
     * Get all providers of a specific type
     * Returns providers sorted by priority (highest first)
     */
    getProvidersByType(type: PluginProviderType): PluginProvider[];
    /**
     * Get all registered providers
     */
    getAllProviders(): PluginProvider[];
    /**
     * Get the highest priority provider of a specific type
     */
    getPrimaryProvider(type: PluginProviderType): PluginProvider | undefined;
    /**
     * Get all plugins
     */
    getAllPlugins(): PluginMetadata[];
    /**
     * Get a specific plugin
     */
    getPlugin(id: string): PluginMetadata | undefined;
}
export declare function getPluginManager(): PluginManager;
