UNPKG

@ai2070/l0

Version:

L0: The Missing Reliability Substrate for AI

29 lines 1.25 kB
import type { L0EventHandler, EventType } from "../types/observability"; export interface EventDispatcherConfig { context?: Record<string, unknown>; highPerformance?: boolean; batchSize?: number; batchFlushMs?: number; } export declare class EventDispatcher { private handlers; private readonly streamId; private readonly _context; private readonly highPerformance; private readonly batchSize; private readonly batchFlushMs; private eventBatch; private batchTimeout; constructor(contextOrConfig?: Record<string, unknown> | EventDispatcherConfig); onEvent(handler: L0EventHandler): void; offEvent(handler: L0EventHandler): void; flush(): void; private dispatchToHandlers; emit<T extends Record<string, unknown>>(type: EventType, payload?: Omit<T, "type" | "ts" | "streamId" | "context">): void; emitSync<T extends Record<string, unknown>>(type: EventType, payload?: Omit<T, "type" | "ts" | "streamId" | "context">): void; getStreamId(): string; getContext(): Record<string, unknown>; getHandlerCount(): number; } export declare function createEventDispatcher(context?: Record<string, unknown>): EventDispatcher; //# sourceMappingURL=event-dispatcher.d.ts.map