import { Registry } from '@effect-atom/atom-react';
import { Event } from '@dxos/async';
import { type Live } from '@dxos/live-object';
import { type MaybePromise } from '@dxos/util';
import { PluginContext } from './capabilities';
import { type ActivationEvent } from './events';
import { type Plugin, type PluginModule } from './plugin';
export type PluginManagerOptions = {
    pluginLoader: (id: string) => MaybePromise<Plugin>;
    plugins?: Plugin[];
    core?: string[];
    enabled?: string[];
    registry?: Registry.Registry;
};
export declare class PluginManager {
    readonly activation: Event<{
        event: string;
        state: "activating" | "activated" | "error";
        error?: any;
    }>;
    readonly context: PluginContext;
    readonly registry: Registry.Registry;
    private readonly _state;
    private readonly _pluginLoader;
    private readonly _capabilities;
    private readonly _moduleMemoMap;
    private readonly _activatingEvents;
    private readonly _activatingModules;
    constructor({ pluginLoader, plugins, core, enabled, registry, }: PluginManagerOptions);
    /**
     * Plugins that are currently registered.
     *
     * @reactive
     */
    get plugins(): Live<readonly Plugin[]>;
    /**
     * Ids of plugins that are core and cannot be removed.
     *
     * @reactive
     */
    get core(): Live<readonly string[]>;
    /**
     * Ids of plugins that are currently enabled.
     *
     * @reactive
     */
    get enabled(): Live<readonly string[]>;
    /**
     * Modules of plugins which are currently enabled.
     *
     * @reactive
     */
    get modules(): Live<readonly PluginModule[]>;
    /**
     * Ids of modules which are currently active.
     *
     * @reactive
     */
    get active(): Live<readonly string[]>;
    /**
     * Ids of events which have been fired.
     *
     * @reactive
     */
    get eventsFired(): Live<readonly string[]>;
    /**
     * Ids of modules which are pending reset.
     *
     * @reactive
     */
    get pendingReset(): Live<readonly string[]>;
    /**
     * Adds a plugin to the manager via the plugin loader.
     * @param id The id of the plugin.
     */
    add(id: string): Promise<boolean>;
    /**
     * Enables a plugin.
     * @param id The id of the plugin.
     */
    enable(id: string): Promise<boolean>;
    /**
     * Removes a plugin from the manager.
     * @param id The id of the plugin.
     */
    remove(id: string): boolean;
    /**
     * Disables a plugin.
     * @param id The id of the plugin.
     */
    disable(id: string): Promise<boolean>;
    /**
     * Activates plugins based on the activation event.
     * @param event The activation event.
     * @returns Whether the activation was successful.
     */
    activate(event: ActivationEvent | string): Promise<boolean>;
    /**
     * Deactivates all of the modules for a plugin.
     * @param id The id of the plugin.
     * @returns Whether the deactivation was successful.
     */
    deactivate(id: string): Promise<boolean>;
    /**
     * Re-activates the modules that were activated by the event.
     * @param event The activation event.
     * @returns Whether the reset was successful.
     */
    reset(event: ActivationEvent | string): Promise<boolean>;
    private _addPlugin;
    private _removePlugin;
    private _addModule;
    private _removeModule;
    private _getPlugin;
    private _getActiveModules;
    private _getInactiveModules;
    private _getActiveModulesByEvent;
    private _getInactiveModulesByEvent;
    private _setPendingResetByModule;
    private _loadModule;
    private _contributeCapabilities;
    private _deactivate;
    private _deactivateModule;
    private _reset;
}
//# sourceMappingURL=manager.d.ts.map