import type { Plugin, PluginContext, PluginCommand, MessageInterceptor, MessageContext, CustomRenderer, SettingsSchema, PluginTheme, PluginLogEntry } from './PluginInterfaces.js';
import type { IPluginStorage } from './interfaces.js';
/**
 * Configuration options for the PluginRegistry.
 */
export interface PluginRegistryOptions {
    /**
     * Storage adapter for persisting plugin settings.
     * Defaults to in-memory storage if not provided.
     * Pass `localStorage` (or a wrapper) for browser environments.
     */
    storage?: IPluginStorage;
    /**
     * Called when a plugin registers a theme.
     * The host is responsible for injecting the CSS into the document.
     * Receives the full theme ID (used as the CSS class name) and the generated CSS string.
     */
    onThemeRegistered?: (themeId: string, className: string, css: string) => void;
    /**
     * Called when a plugin unregisters a theme.
     * The host is responsible for removing the injected CSS.
     */
    onThemeUnregistered?: (themeId: string) => void;
}
/**
 * Central registry that manages all loaded plugins and their side-effects.
 * Create a single instance and share it across your application.
 */
export declare class PluginRegistry {
    private readonly plugins;
    private readonly commands;
    private beforeSendInterceptors;
    private receiveInterceptors;
    private readonly renderers;
    private readonly settingsSchemas;
    private readonly pluginSettings;
    private readonly matrixHandlers;
    private readonly timers;
    private readonly themes;
    private logs;
    private readonly maxLogs;
    private readonly storage;
    private readonly onThemeRegistered?;
    private readonly onThemeUnregistered?;
    constructor(options?: PluginRegistryOptions);
    /** Register a plugin and its context. Called after the host has loaded the module. */
    registerPlugin(id: string, plugin: Plugin, context: PluginContext): void;
    /** Unregister a plugin, calling its onUnload hook and cleaning up all side-effects. */
    unregisterPlugin(id: string): Promise<void>;
    /** Register a command contributed by a plugin. */
    registerCommand(pluginId: string, command: PluginCommand): void;
    /** Remove a registered command by name. */
    unregisterCommand(name: string): void;
    /** Execute a command by name, passing raw argument string. */
    executeCommand(name: string, rawArgs: string): Promise<string | void>;
    private parseCommandArgs;
    /** Return all registered commands. */
    getCommands(): Array<{
        name: string;
        pluginId: string;
        command: PluginCommand;
    }>;
    /** Add a before-send interceptor for a plugin. */
    addBeforeSendInterceptor(pluginId: string, interceptor: MessageInterceptor): void;
    /** Add a receive interceptor for a plugin. */
    addReceiveInterceptor(pluginId: string, interceptor: MessageInterceptor): void;
    /** Run a message through all before-send interceptors in registration order. */
    processBeforeSend(msg: MessageContext): Promise<MessageContext>;
    /** Run a message through all receive interceptors in registration order. */
    processReceive(msg: MessageContext): Promise<MessageContext>;
    /** Register a custom renderer contributed by a plugin. */
    registerRenderer(pluginId: string, type: string, renderer: CustomRenderer): void;
    /** Remove a renderer by type. */
    unregisterRenderer(type: string): void;
    /** Get the renderer for a given type, if any. */
    getRenderer(type: string): CustomRenderer | undefined;
    /** Define the settings schema for a plugin and load persisted values. */
    defineSettings(pluginId: string, schema: SettingsSchema): void;
    /** Get a plugin setting value. */
    getPluginSetting<T = unknown>(pluginId: string, key: string): T | undefined;
    /** Set a plugin setting value and persist it. */
    setPluginSetting(pluginId: string, key: string, value: unknown): void;
    /** Get the settings schema for a plugin. */
    getPluginSettingsSchema(pluginId: string): SettingsSchema | undefined;
    /** Register a theme contributed by a plugin. */
    registerTheme(pluginId: string, theme: PluginTheme): void;
    /** Unregister a theme contributed by a plugin. */
    unregisterTheme(pluginId: string, themeId: string): void;
    /** Return all registered plugin themes. */
    getPluginThemes(): Array<{
        id: string;
        name: string;
        kind: 'light' | 'dark';
        className: string;
    }>;
    /** Track an event handler registered by a plugin. */
    addEventHandler(pluginId: string, eventType: string, handler: (...args: any[]) => void): void;
    /** Remove a previously tracked event handler. */
    removeEventHandler(pluginId: string, eventType: string, handler: (...args: any[]) => void): void;
    /** Get all tracked handlers for an event type. */
    getEventHandlers(eventType: string): Array<{
        pluginId: string;
        handler: (...args: any[]) => void;
    }>;
    /** Track a timer ID for a plugin so it can be cleared on unload. */
    addTimer(pluginId: string, timerId: number): void;
    /** Remove a timer ID from tracking (e.g. after manual clearInterval). */
    removeTimer(pluginId: string, timerId: number): void;
    /** Append a log entry from a plugin. */
    addLog(pluginId: string, level: 'log' | 'warn' | 'error', args: unknown[]): void;
    /** Return log entries, optionally filtered to a specific plugin. */
    getLogs(pluginId?: string): PluginLogEntry[];
    /** Clear log entries, optionally scoped to a specific plugin. */
    clearLogs(pluginId?: string): void;
    /** Get the public exports of a loaded plugin. */
    getPluginExports(pluginId: string): unknown;
    /** Unload the current plugin instance and load a new one in-place. */
    reloadPlugin(pluginId: string, newPlugin: Plugin, newContext: PluginContext): Promise<void>;
    /** Unload all plugins and clear all registry state. */
    clear(): void;
}
//# sourceMappingURL=PluginRegistry.d.ts.map