/**
 * PluginLifecycleManager — plugin lifecycle and capability enforcement.
 *
 * Tracks all plugins through the 8-state lifecycle machine, resolves capability
 * manifests on load, and emits PluginEvents at every state transition.
 *
 * Gated by the `plugin-lifecycle` feature flag.
 */
import type { PluginLoaderDeps, LoadedPlugin } from '../../plugins/loader.js';
import { type PluginPathOptions } from '../../plugins/loader.js';
import type { PluginLifecycleState } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/plugins';
import { type PluginLifecycleManagerOptions, type PluginLifecycleRecord, type PluginManifestV2 } from './types.js';
import { PluginTrustStore, type PluginTrustTier } from './trust.js';
import { PluginQuarantineEngine } from './quarantine.js';
/**
 * PluginLifecycleManager tracks all plugins through structured lifecycle
 * transitions and emits typed PluginEvents at each state change.
 */
export declare class PluginLifecycleManager {
    private readonly records;
    private readonly sessionId;
    private readonly capabilityPolicy;
    private readonly trustTierResolver;
    private readonly runtimeBus;
    /** Trust store — manages tier records for all plugins. */
    readonly trustStore: PluginTrustStore;
    /** Quarantine engine — tracks and applies quarantine constraints. */
    readonly quarantine: PluginQuarantineEngine;
    constructor(options?: PluginLifecycleManagerOptions);
    /** Returns the lifecycle record for a plugin, or undefined if unknown. */
    getRecord(name: string): Readonly<PluginLifecycleRecord> | undefined;
    /** Returns all plugin lifecycle records as an array. */
    getAllRecords(): ReadonlyArray<Readonly<PluginLifecycleRecord>>;
    /** Returns names of all plugins in a given state. */
    getPluginsInState(state: PluginLifecycleState): string[];
    /** Returns names of all currently operational plugins (active or degraded). */
    getOperationalPlugins(): string[];
    /**
     * Register a discovered plugin. Creates its lifecycle record in the
     * `discovered` state and emits PLUGIN_DISCOVERED.
     */
    registerDiscovered(manifest: PluginManifestV2, pluginDir: string): void;
    /**
     * Load a plugin using the existing loader infrastructure.
     *
     * Transitions: discovered/disabled → loading → loaded → active
     * On failure:  loading → error
     */
    loadPlugin(manifest: PluginManifestV2, pluginDir: string, deps: PluginLoaderDeps, cacheBust?: number): Promise<boolean>;
    /**
     * Unload a plugin. Transitions active/loaded/degraded → unloading → disabled.
     */
    unloadPlugin(name: string, reason?: string, loaderDeps?: {
        getLoadedPlugin?: (name: string) => LoadedPlugin | undefined;
    }): Promise<void>;
    /**
     * setTrustTier — Assign a trust tier to a plugin and re-sync the record.
     *
     * If the plugin has an active lifecycle record, the trust tier in the record
     * is updated immediately. Capability re-resolution requires a reload.
     */
    setTrustTier(name: string, tier: PluginTrustTier, note?: string): void;
    /**
     * quarantinePlugin — Apply quarantine to a named plugin.
     *
     * Revokes high-risk capabilities from the live manifest and marks the record
     * as quarantined. Emits PLUGIN_DEGRADED to signal partial functionality.
     *
     * @returns true if quarantine was applied; false if not tracked or already quarantined.
     */
    quarantinePlugin(name: string, reason: string): boolean;
    /**
     * liftQuarantine — Remove quarantine from a plugin.
     *
     * Capabilities are NOT restored here; the operator should reload the plugin
     * after lifting so that trust-aware re-resolution can grant capabilities
     * appropriate for the updated tier.
     *
     * @returns true if quarantine was lifted; false if no active quarantine.
     */
    liftQuarantine(name: string): boolean;
    /**
     * Mark a plugin as degraded (partial functionality). Only valid from active.
     */
    degradePlugin(name: string, reason: string, affectedCapabilities?: string[]): void;
    /**
     * Record a non-fatal error without transitioning state.
     * If the plugin is active, it may optionally be moved to degraded.
     */
    recordError(name: string, error: string, fatal: boolean): void;
    /**
     * Scan for plugins and register newly discovered ones.
     * Existing records are not modified.
     */
    scanAndRegister(pathOptions: PluginPathOptions): void;
    /**
     * Apply a state machine transition for a named plugin.
     * Records the transition in the plugin's history.
     * Returns the TransitionResult from the state machine.
     */
    private transition;
    /**
     * Partially update a plugin record's mutable fields.
     */
    private updateRecord;
    private emit;
}
//# sourceMappingURL=manager.d.ts.map