import { AddonDeclaration, ICamstackAddon, IScopedLogger } from '@camstack/types';
export interface RegisteredAddon {
    readonly declaration: AddonDeclaration;
    readonly packageName: string;
    readonly packageVersion: string;
    /** Human-readable package name from camstack.displayName in package.json */
    readonly packageDisplayName?: string;
    /**
     * Optional bundle metadata when the npm package ships multiple addon
     * entries. Mirrors `AddonPackageManifest.bundle`. Drives the
     * collapsible bundle card in the Addons admin UI.
     */
    readonly bundle?: {
        displayName: string;
        description?: string;
        icon?: string;
    };
    readonly addonClass: new () => ICamstackAddon;
    /**
     * Full raw module namespace. Consumers can read additional named exports
     * (e.g. `customActions`) without instantiating the addon — lets the hub
     * register a forkable addon's custom-action catalog with real zod
     * schemas before the child process is up.
     */
    readonly module: Readonly<Record<string, unknown>>;
}
/**
 * Per-package failure record. Surfaced via `listLoadFailures()` so the
 * AddonRegistry can hand the failures to the kernel's
 * `AddonHealthMonitor` after `loadFromDirectory()` completes — the
 * health monitor then schedules the retry loop and emits operator-
 * visible alerts post-grace.
 *
 * Two failure shapes are tracked:
 *   - **package-level**: package.json couldn't be read/parsed, or the
 *     manifest was malformed. `addonId` undefined.
 *   - **declaration-level**: per-addon load failure inside
 *     `loadDeclaration` (entry import threw, addon class resolution
 *     failed, etc). `addonId` set to `declaration.id`.
 */
export interface AddonLoadFailure {
    readonly packageName: string;
    readonly addonDir: string;
    readonly addonId?: string;
    readonly error: Error;
    readonly timestamp: number;
}
export declare class AddonLoader {
    private addons;
    private readonly loadFailures;
    private readonly logger;
    constructor(logger?: IScopedLogger);
    /**
     * Failures encountered during the most recent `loadFromDirectory` /
     * `loadFromAddonDir` pass. Cleared (per-package) on a successful
     * subsequent reload so retries don't see stale entries. Cumulative
     * across multiple loads otherwise.
     */
    listLoadFailures(): readonly AddonLoadFailure[];
    /** Forget any tracked failures for a given package — uninstall path. */
    clearLoadFailures(packageName: string): void;
    /** Scan addons directory and load all addon packages.
     *  Supports scoped layout: addons/@scope/package-name/ */
    loadFromDirectory(addonsDir: string): Promise<void>;
    private tryLoadAddon;
    /** Load addon from a specific directory (package.json + dist/) */
    loadFromAddonDir(addonDir: string): Promise<void>;
    private loadDeclaration;
    /** Load addon from a direct path (for development/testing) */
    loadFromPath(addonId: string, modulePath: string, packageName: string, declaration?: Partial<AddonDeclaration>, packageVersion?: string): Promise<void>;
    /** Get a registered addon by ID */
    getAddon(addonId: string): RegisteredAddon | undefined;
    /** List all registered addons */
    listAddons(): RegisteredAddon[];
    /** Check if an addon is registered */
    hasAddon(addonId: string): boolean;
    /**
     * Create a new instance of an addon (not yet initialized).
     * Injects the manifest from package.json (AddonDeclaration) so the
     * addon class doesn't need to declare it.
     */
    createInstance(addonId: string): ICamstackAddon;
}
//# sourceMappingURL=addon-loader.d.ts.map