/**
 * Typed Event Bus
 *
 * Type-safe event bus for inter-extension communication.
 *
 * Features:
 * - Type-safe event emission and listening
 * - Request-response pattern (RPC)
 * - Wildcard pattern matching for events
 * - Automatic cleanup on extension unload
 * - Error handling with optional error catching
 */
import type { EventMap, RequestMap, EventHandler, WildcardEventHandler, TypedEventBusOptions, RequestOptions } from './types/events.js';
/**
 * Type-safe event bus for inter-extension communication
 *
 * @example
 * ```typescript
 * interface MyEvents {
 *   'user:login': { userId: string; timestamp: number };
 *   'message:received': { chatId: string; content: string };
 * }
 *
 * interface MyRequests {
 *   'user:get': { userId: string };
 * }
 *
 * interface MyResponses {
 *   'user:get': { name: string; email: string };
 * }
 *
 * const bus = new TypedEventBus<MyEvents, MyRequests, MyResponses>();
 *
 * // Listen for events
 * bus.on('user:login', (data) => {
 *   console.log(`User ${data.userId} logged in`);
 * });
 *
 * // Emit events
 * bus.emit('user:login', { userId: 'user123', timestamp: Date.now() });
 *
 * // Request-response
 * bus.onRequest('user:get', async (params) => {
 *   return { name: 'John', email: 'john@example.com' };
 * });
 *
 * const user = await bus.request('user:get', { userId: 'user123' });
 * ```
 */
export declare class TypedEventBus<TEvents extends EventMap = EventMap, TRequests extends RequestMap = RequestMap, _TResponses extends RequestMap = RequestMap> {
    private eventHandlers;
    private wildcardHandlers;
    private requestHandlers;
    private pendingRequests;
    private options;
    private requestIdCounter;
    constructor(options?: TypedEventBusOptions);
    /**
     * Subscribe to an event
     *
     * @param event - Event name
     * @param handler - Event handler function
     * @param options - Handler options (extensionId, once)
     * @returns Unsubscribe function
     */
    on<K extends keyof TEvents>(event: K, handler: EventHandler<TEvents[K]>, options?: {
        extensionId?: string;
        once?: boolean;
    }): () => void;
    /**
     * Unsubscribe from an event
     *
     * @param event - Event name
     * @param handler - Handler to remove
     */
    off<K extends keyof TEvents>(event: K, handler: EventHandler<TEvents[K]>): void;
    /**
     * Emit an event
     *
     * @param event - Event name
     * @param data - Event data
     */
    emit<K extends keyof TEvents>(event: K, data: TEvents[K]): void;
    /**
     * Subscribe to events matching a wildcard pattern
     *
     * @param pattern - Wildcard pattern (e.g., 'user:*', '*:update')
     * @param handler - Handler function
     * @param options - Handler options (extensionId)
     * @returns Unsubscribe function
     */
    onWildcard(pattern: string, handler: WildcardEventHandler, options?: {
        extensionId?: string;
    }): () => void;
    /**
     * Check if an event matches a wildcard pattern
     */
    private matchWildcard;
    /**
     * Register a request handler
     */
    onRequest<K extends keyof TRequests>(method: K, handler: (params: TRequests[K]) => unknown | Promise<unknown>, options?: {
        extensionId?: string;
    }): void;
    /**
     * Make a request and wait for response
     */
    request<K extends keyof TRequests>(method: K, params: TRequests[K], _options?: RequestOptions): Promise<unknown>;
    /**
     * Remove all listeners and handlers for a specific extension
     *
     * @param extensionId - Extension ID to cleanup
     */
    cleanup(extensionId: string): void;
    cleanupAll(): void;
    /**
     * Get number of active event handlers for an event
     */
    listenerCount<K extends keyof TEvents>(event: K): number;
    /**
     * Get all registered event names
     */
    eventNames(): (keyof TEvents)[];
    /**
     * Remove all listeners (use with caution)
     */
    removeAllListeners(): void;
    private handleError;
    private createDefaultLogger;
}
