/**
 * Hook Registry System - Phase 2C of T5237
 *
 * Central registry for managing hook handlers with priority-based execution,
 * async dispatch, and best-effort error handling. Integrates with CAAMP 1.9.1
 * canonical event definitions while providing CLEO's execution engine.
 *
 * @module @cleocode/cleo/hooks/registry
 */
import type { HookConfig, HookEvent, HookPayload, HookRegistration } from './types.js';
/**
 * Central registry for hook handlers.
 *
 * Manages registration, priority-based ordering, and async dispatch
 * of hook handlers. Provides best-effort execution where errors in
 * one handler do not block others.
 *
 * Backward compatibility: handlers registered with legacy `on`-prefix
 * event names (e.g. `onSessionStart`) are automatically remapped to their
 * canonical equivalents (e.g. `SessionStart`) with a deprecation warning.
 */
export declare class HookRegistry {
    private handlers;
    private config;
    /**
     * Resolve a potentially-legacy event name to its canonical equivalent.
     *
     * If the event name matches a known legacy `on`-prefix name, it is
     * remapped and a deprecation warning is logged. Unknown names pass through
     * unchanged so callers using the new canonical names are unaffected.
     */
    private resolveEvent;
    /**
     * Register a hook handler for a specific event.
     *
     * Handlers are sorted by priority (highest first) and executed
     * in parallel when the event is dispatched.
     *
     * Backward compatibility: legacy `on`-prefix event names are automatically
     * remapped to their canonical equivalents.
     *
     * @param registration - The hook registration containing event, handler, priority, and ID
     * @returns A function to unregister the handler
     *
     * @example
     * ```typescript
     * const unregister = hooks.register({
     *   id: 'my-handler',
     *   event: 'SessionStart',
     *   handler: async (root, payload) => { console.log('Session started'); },
     *   priority: 100
     * });
     *
     * // Later: unregister()
     * ```
     */
    register<T extends HookPayload>(registration: HookRegistration<T>): () => void;
    /**
     * Dispatch an event to all registered handlers.
     *
     * Executes handlers in parallel using Promise.allSettled for best-effort
     * execution. Errors in individual handlers are logged but do not block
     * other handlers or propagate to the caller.
     *
     * Backward compatibility: legacy `on`-prefix event names are automatically
     * remapped to their canonical equivalents.
     *
     * @param event - The CAAMP canonical hook event to dispatch
     * @param projectRoot - The project root directory path
     * @param payload - The event payload (typed by event)
     * @returns Promise that resolves when all handlers have completed
     *
     * @example
     * ```typescript
     * await hooks.dispatch('SessionStart', '/project', {
     *   timestamp: new Date().toISOString(),
     *   sessionId: 'sess-123',
     *   name: 'My Session',
     *   scope: 'feature'
     * });
     * ```
     */
    dispatch<T extends HookPayload>(event: HookEvent, projectRoot: string, payload: T): Promise<void>;
    /**
     * Check if a specific event is currently enabled.
     *
     * Both the global enabled flag and the per-event flag must be true.
     * Automatically resolves legacy `on`-prefix event names.
     *
     * @param event - The CAAMP hook event to check
     * @returns True if the event is enabled
     */
    isEnabled(event: HookEvent): boolean;
    /**
     * Update the hook system configuration.
     *
     * Merges the provided config with the existing config.
     *
     * @param config - Partial configuration to apply
     *
     * @example
     * ```typescript
     * hooks.setConfig({ enabled: false }); // Disable all hooks
     * hooks.setConfig({ events: { PostToolUseFailure: false } }); // Disable specific event
     * ```
     */
    setConfig(config: Partial<HookConfig>): void;
    /**
     * Get the current hook configuration.
     *
     * @returns A copy of the current configuration
     */
    getConfig(): HookConfig;
    /**
     * List all registered handlers for a specific event.
     *
     * Returns handlers in priority order (highest first).
     * Automatically resolves legacy `on`-prefix event names.
     *
     * @param event - The CAAMP hook event
     * @returns Array of hook registrations
     */
    listHandlers(event: HookEvent): HookRegistration[];
}
/**
 * Singleton instance of the HookRegistry.
 *
 * Use this instance for all hook operations throughout the application.
 */
export declare const hooks: HookRegistry;
//# sourceMappingURL=registry.d.ts.map