/**
 * EventBus — Typed event emitter for the execution runtime.
 *
 * Provides a type-safe publish/subscribe mechanism for runtime events.
 * Uses a simple listener map instead of Node's EventEmitter for full
 * type safety on both emit() and on() without casting.
 */
import type { RuntimeEventMap, RuntimeEventName } from './events.js';
/** Listener function type for a specific event. */
export type EventListener<K extends RuntimeEventName> = (payload: RuntimeEventMap[K]) => void;
/**
 * Typed event bus for runtime events.
 *
 * Usage:
 * ```ts
 * const bus = new EventBus()
 * const unsub = bus.on('agent:spawned', (event) => {
 *   console.log(`Agent ${event.sessionId} spawned`)
 * })
 * bus.emit('agent:spawned', { sessionId: '...', ... })
 * unsub() // unsubscribe
 * ```
 */
export declare class EventBus {
    private listeners;
    /**
     * Subscribe to an event.
     * Returns an unsubscribe function.
     */
    on<K extends RuntimeEventName>(event: K, listener: EventListener<K>): () => void;
    /**
     * Subscribe to an event for a single emission only.
     * Returns an unsubscribe function (in case you want to cancel early).
     */
    once<K extends RuntimeEventName>(event: K, listener: EventListener<K>): () => void;
    /**
     * Emit an event to all subscribed listeners.
     * Listeners are called synchronously in subscription order.
     */
    emit<K extends RuntimeEventName>(event: K, payload: RuntimeEventMap[K]): void;
    /** Remove all listeners for a specific event, or all events if no name given. */
    removeAllListeners(event?: RuntimeEventName): void;
    /** Get the number of listeners for a specific event. */
    listenerCount(event: RuntimeEventName): number;
}
/**
 * Get the global default EventBus instance.
 * Creates one on first access. Use this for application-wide event routing.
 */
export declare function getEventBus(): EventBus;
/**
 * Reset the global EventBus (primarily for testing).
 */
export declare function resetEventBus(): void;
