import { MatrixActor } from '../core/MatrixActor';
import type { IMatrixContext } from '../engine/core/IMatrixContext';
/**
 * Constructor type for shell classes (typically HTMLElement subclasses).
 */
type ShellConstructor = new (...args: unknown[]) => HTMLElement;
/**
 * Shell info for rendering a component type.
 */
export interface IShellInfo {
    /** Custom element tag name (e.g., "fractal-tree") */
    shellTag: string;
    /** Module URL for dynamic import */
    moduleUrl?: string;
}
/**
 * ShellRegistryComponent - MatrixActor service for shell metadata.
 *
 * This is the REAL registry. The module-level `_pendingRegistrations` is just
 * a staging area for decorator-time registrations.
 *
 * ═══════════════════════════════════════════════════════════════════════════
 * COLLECTOR PATTERN (Expert Panel 2024-12)
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Joe Duffy (Midori OS):
 *   "The component is the consumer. On bootstrap, it drains the pending queue
 *    and becomes the single source of truth. No bidirectional sync needed."
 *
 * Robert C. Martin (Clean Code):
 *   "Instance owns the data. Static queue is consumed once, then ignored."
 *
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Mount at: system.registry.shell
 *
 * Accepts:
 *   - register: { componentClass: string, info: ShellInfo }
 *   - lookup: { componentClass: string } -> ShellInfo | null
 *   - list: {} -> string[]
 *   - has: { componentClass: string } -> boolean
 *
 * Emits:
 *   - registered: { componentClass: string, info: ShellInfo }
 *   - unregistered: { componentClass: string }
 */
export declare class ShellRegistryComponent extends MatrixActor {
    static accepts: {
        register: {
            componentClass: string;
            info: string;
        };
        lookup: {
            componentClass: string;
        };
        list: {};
        has: {
            componentClass: string;
        };
        unregister: {
            componentClass: string;
        };
    };
    static emits: {
        registered: {
            componentClass: string;
            info: string;
        };
        unregistered: {
            componentClass: string;
        };
    };
    /**
     * Instance-based registry storage.
     * This is the REAL registry - the single source of truth after bootstrap.
     */
    private _registry;
    /**
     * Handle 'register' command.
     *
     * NOTE: After bootstrap, all registrations go through the component.
     * We do NOT write back to the static pending queue - that's write-only for decorators.
     */
    onRegister(params: {
        componentClass: string;
        info: IShellInfo;
    }): void;
    /**
     * Handle 'lookup' command.
     */
    onLookup(params: {
        componentClass: string;
    }): IShellInfo | null;
    /**
     * Handle 'list' command.
     */
    onList(): string[];
    /**
     * Handle 'has' command.
     */
    onHas(params: {
        componentClass: string;
    }): boolean;
    /**
     * Handle 'unregister' command.
     *
     * NOTE: We do NOT modify the static pending queue - it's write-only for decorators.
     */
    onUnregister(params: {
        componentClass: string;
    }): boolean;
    /**
     * Bootstrap: Drain the pending registrations queue.
     *
     * Joe Duffy (Midori OS):
     *   "Consume once, then the instance is the authority. The pending queue
     *    is just a staging area for decorator-time registrations."
     *
     * After this runs, the component's `_registry` is the single source of truth.
     */
    protected onBootstrap(): Promise<void>;
}
/**
 * ShellRegistry - Static utility class for decorator-time registration.
 *
 * ═══════════════════════════════════════════════════════════════════════════
 * COLLECTOR PATTERN (Expert Panel 2024-12)
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * This class provides a WRITE-ONLY staging area for decorator registrations.
 * The REAL registry is `ShellRegistryComponent` (instance-based).
 *
 * Joe Duffy (Midori OS):
 *   "The pending queue is write-only for decorators. The component drains it
 *    on bootstrap and becomes the authority. Clean separation."
 *
 * Mark Miller (Capability Security):
 *   "The static lookup methods are for pre-bootstrap scenarios only. After
 *    bootstrap, use the component. The pending queue is NOT the registry."
 *
 * Robert C. Martin (Clean Code):
 *   "Naming matters: _pendingRegistrations makes clear this is a queue,
 *    not a registry. The component owns the real data."
 *
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Usage:
 * ```typescript
 * // At module load (via decorator) - writes to pending queue
 * @RegisterShell("fractal-tree")
 * class FractalTree extends MatrixActor { ... }
 *
 * // After bootstrap - query via component (the real registry)
 * const info = await RequestReply.execute(ctx, shellRegistryMount, 'lookup', { componentClass: 'FractalTree' });
 * ```
 *
 * DEPRECATED PATTERN (pre-bootstrap lookup):
 * ```typescript
 * // This works but is deprecated - use the component after bootstrap
 * const info = ShellRegistry.lookup('FractalTree');
 * ```
 */
export declare class ShellRegistry {
    /**
     * Pending registrations queue.
     *
     * WRITE-ONLY for decorators. ShellRegistryComponent drains this on bootstrap.
     * After bootstrap, the component's instance `_registry` is the authority.
     *
     * @internal - Use ShellRegistryComponent for lookups after bootstrap
     */
    static _pendingRegistrations: Map<string, IShellInfo>;
    /**
     * Register shell info for a component type.
     *
     * Called by decorators at module load time. Writes to the pending queue.
     * The ShellRegistryComponent will drain this queue on bootstrap.
     */
    static register(componentClass: string, info: IShellInfo): void;
    /**
     * Look up shell info from the pending queue.
     *
     * @deprecated After bootstrap, use ShellRegistryComponent via Matrix protocol.
     * This only checks the pending queue, not the component's registry.
     */
    static lookup(componentClass: string): IShellInfo | undefined;
    /**
     * Check if a component type has pending shell info.
     *
     * @deprecated After bootstrap, use ShellRegistryComponent via Matrix protocol.
     */
    static has(componentClass: string): boolean;
    /**
     * Get all pending component types.
     *
     * @deprecated After bootstrap, use ShellRegistryComponent via Matrix protocol.
     */
    static getRegisteredTypes(): string[];
    /**
     * Clear pending registrations (mainly for testing).
     *
     * NOTE: This only clears the pending queue. Any mounted
     * ShellRegistryComponent instances have their own copy of the data.
     */
    static clear(): void;
    /**
     * Mount a ShellRegistryComponent as a Matrix service.
     *
     * ═══════════════════════════════════════════════════════════════════════════
     * EXPERT PANEL REVIEW (2024-12): NO SINGLETON CACHING
     * ═══════════════════════════════════════════════════════════════════════════
     *
     * Robert C. Martin (Clean Code):
     *   "Each call creates a fresh component. The caller is responsible for
     *    storing the reference. No hidden getInstance() magic."
     *
     * Mark Miller (Capability Security):
     *   "The returned component IS the capability. Pass it explicitly to
     *    consumers who need it. No ambient authority."
     * ═══════════════════════════════════════════════════════════════════════════
     *
     * Call this during application bootstrap:
     * ```typescript
     * const registryContext = rootContext.derive('system').derive('registry').derive('shell');
     * const shellRegistry = await ShellRegistry.mount(registryContext);
     * // Store shellRegistry reference - no getInstance() available
     * ```
     *
     * After mounting, the registry is queryable via Matrix protocol:
     * ```typescript
     * const info = await RequestReply.execute(ctx, 'system.registry.shell', 'lookup', { componentClass: 'FractalTree' });
     * ```
     */
    static mount(context: IMatrixContext): Promise<ShellRegistryComponent>;
    /**
     * Register shell info from a Shell class.
     * Convenience method that extracts info from static members.
     */
    static registerShell(ShellClass: {
        getActorClass?: () => {
            name: string;
        };
        shellTag?: string;
        moduleUrl?: string;
        name: string;
    }): void;
}
/**
 * Decorator for auto-registering Shell classes.
 *
 * Two usage patterns:
 *
 * 1. Parameter-less (auto-derives from class):
 * ```typescript
 * @RegisterShell
 * class FractalTreeShell extends MatrixActorHtmlElement {
 *   static getActorClass() { return FractalTree; }
 *   static moduleUrl = import.meta.url;
 * }
 * ```
 *
 * 2. With explicit parameters (preferred for components):
 * ```typescript
 * @RegisterShell("fractal-tree", import.meta.url)
 * class FractalTree extends MatrixActor { ... }
 * ```
 */
export declare function RegisterShell<T extends ShellConstructor>(target: T): T;
export declare function RegisterShell(shellTag: string, moduleUrl?: string): <T extends ShellConstructor>(target: T) => T;
export {};
//# sourceMappingURL=ShellRegistry.d.ts.map