/** * TaskEventBus — lightweight pub/sub for task events. * * Subscribers receive parsed event objects (not raw JSON strings). * Supports per-task subscriptions and wildcard ('*') subscriptions. * * Phase 1: Used to decouple event flow from inline handler code. * Phase 2: Wave orchestration subscribes here for progress streams. */ import type { ParsedProcessEvent } from '../process/types.js'; /** * Event delivered to subscribers. */ export interface TaskEvent { taskId: string; event: ParsedProcessEvent; } export type TaskEventCallback = (taskEvent: TaskEvent) => void; /** * Unsubscribe function returned by subscribe(). */ export type Unsubscribe = () => void; export declare class TaskEventBus { /** Per-task subscribers */ private readonly taskSubs; /** Wildcard subscribers (receive all events) */ private readonly wildcardSubs; /** * Subscribe to events for a specific task or all tasks ('*'). * Returns an unsubscribe function. */ subscribe(taskIdOrWildcard: string, callback: TaskEventCallback): Unsubscribe; /** * Emit an event for a task. * Delivers to per-task subscribers first, then wildcard subscribers. */ emit(taskId: string, event: ParsedProcessEvent): void; /** * Remove all subscriptions for a specific task. * Called when a task reaches a terminal state. */ removeTaskSubscriptions(taskId: string): void; /** * Remove all subscriptions (for shutdown/testing). */ clear(): void; /** * Get subscriber count (for diagnostics). */ get subscriberCount(): number; } export declare const taskEventBus: TaskEventBus; //# sourceMappingURL=bus.d.ts.map