/**
 * Isolated Plugin Runner
 * Manages Worker Thread lifecycle for isolated plugin execution
 *
 * Security features:
 * - Worker threads run with restricted resourceLimits
 * - All messages are validated before processing
 * - Timeouts prevent runaway plugins
 * - Permissions are enforced via sandboxed environment in worker
 */
import { EventEmitter } from 'events';
import { PluginPermissions } from './types.js';
export interface IsolatedPluginConfig {
    pluginPath: string;
    pluginId: string;
    dataDir: string;
    config: Record<string, unknown>;
    permissions: PluginPermissions;
    timeout?: number;
    memoryLimitMb?: number;
}
export declare class IsolatedPluginRunner extends EventEmitter {
    private worker;
    private config;
    private logger;
    private pendingRequests;
    private messageIdCounter;
    private isTerminated;
    private readonly defaultTimeout;
    constructor(config: IsolatedPluginConfig);
    /**
     * Generate a unique message ID
     */
    private generateMessageId;
    /**
     * Send a message to the worker and wait for response
     */
    private sendMessage;
    /**
     * Handle messages from the worker
     * All messages are validated before processing
     */
    private handleWorkerMessage;
    /** Message count for stats */
    private messageCount;
    /** Error count for stats */
    private errorCount;
    /**
     * Start the worker and initialize the plugin
     */
    start(): Promise<void>;
    /**
     * Initialize the plugin in the worker
     */
    private initializePlugin;
    /**
     * Activate the plugin
     */
    activate(): Promise<void>;
    /**
     * Deactivate the plugin
     */
    deactivate(): Promise<void>;
    /**
     * Call a method on the plugin
     */
    call<T>(method: string, ...args: unknown[]): Promise<T>;
    /**
     * Terminate the worker immediately
     */
    terminate(): Promise<void>;
    /**
     * Check if the worker is running
     */
    isRunning(): boolean;
    /**
     * Get the plugin ID
     */
    getPluginId(): string;
    /**
     * Get execution statistics for this plugin
     */
    getStats(): {
        pluginId: string;
        isRunning: boolean;
        messageCount: number;
        errorCount: number;
        memoryLimitMb: number;
        timeoutMs: number;
    };
    /**
     * Get a safe subset of environment variables
     * Filters out sensitive variables that shouldn't be passed to plugins
     */
    private getSafeEnv;
}
/**
 * Factory function to create an isolated plugin runner
 */
export declare function createIsolatedPluginRunner(config: IsolatedPluginConfig): IsolatedPluginRunner;
