/**
 * Plugin Manager — discovery, loading, lifecycle, and persistence.
 *
 * Extension directories are scanned for `jait.plugin.json` manifests.
 * Enabled plugins are dynamically imported and their contributions
 * are registered with the tool / provider registries.
 */
import type { PluginManifest } from "./manifest.js";
import type { InstalledPlugin } from "./contracts.js";
import type { ToolRegistry } from "../tools/registry.js";
import type { SqliteDatabase } from "../db/sqlite-shim.js";
import type { ChannelManager } from "../channels/manager.js";
/** Default extensions root: ~/.jait/extensions/ */
export declare function defaultExtensionsDir(): string;
export interface PluginManagerDeps {
    sqlite: SqliteDatabase;
    toolRegistry: ToolRegistry;
    channelManager?: ChannelManager;
    gatewayVersion: string;
    projectRoot: string;
    extensionsDir?: string;
    /** Additional directories to scan for OpenClaw-format plugins. */
    openclawExtensionsDirs?: string[];
}
export declare class PluginManager {
    private readonly sqlite;
    private readonly toolRegistry;
    private readonly channelManager?;
    private readonly gatewayVersion;
    private readonly projectRoot;
    private readonly extensionsDir;
    private readonly openclawExtensionsDirs;
    /** In-memory map of loaded plugins keyed by id. */
    private readonly loaded;
    /** OpenClaw plugin modules keyed by jait id (openclaw:<id>). */
    private readonly openclawModules;
    constructor(deps: PluginManagerDeps);
    private getInstalled;
    private upsertInstalled;
    private deleteInstalled;
    discover(): Promise<PluginManifest[]>;
    /**
     * Discover all plugins, sync them with DB, and load enabled ones.
     * Called once at gateway startup.
     */
    syncAndLoad(): Promise<void>;
    private buildContext;
    private loadPlugin;
    /** Load a plugin using a pre-built module (used for OpenClaw adapter). */
    private loadPluginWithModule;
    private unloadPlugin;
    /** List all installed plugins (from DB). */
    listInstalled(): InstalledPlugin[];
    /** Get a single installed plugin. */
    getPlugin(id: string): InstalledPlugin | null;
    /** Enable a plugin and load it. */
    enable(id: string): Promise<InstalledPlugin>;
    /** Disable a plugin and unload it. */
    disable(id: string): Promise<InstalledPlugin>;
    /** Uninstall a plugin (unload + remove from DB). Does NOT delete files. */
    uninstall(id: string): Promise<void>;
    /** Get / set plugin config. */
    getPluginConfig(id: string): Record<string, unknown>;
    setPluginConfig(id: string, config: Record<string, unknown>): Promise<void>;
    /** Gracefully dispose of all loaded plugins. */
    disposeAll(): Promise<void>;
}
//# sourceMappingURL=manager.d.ts.map