/** * AI Provider Event System * * Typed EventEmitter for rate limits, authentication, and process events. */ import { EventEmitter } from 'events'; export interface RateLimitHitPayload { message: string; timestamp?: number; } export interface AuthFailedPayload { error: string; suggestion: string; } export interface ProcessSpawnedPayload { requestId: string; workingDirectory?: string; } export interface ProcessCompletedPayload { requestId: string; durationMs: number; success: boolean; } export interface ProcessFailedPayload { requestId: string; error: string; errorType?: string; } export interface CircuitStateChangePayload { previousState: string; newState: string; } export interface AIProviderEvents { 'rate_limit:hit': RateLimitHitPayload; 'rate_limit:cleared': void; 'auth:failed': AuthFailedPayload; 'auth:success': void; 'process:spawned': ProcessSpawnedPayload; 'process:completed': ProcessCompletedPayload; 'process:failed': ProcessFailedPayload; 'circuit_breaker:opened': CircuitStateChangePayload; 'circuit_breaker:half_open': CircuitStateChangePayload; 'circuit_breaker:closed': CircuitStateChangePayload; 'shutdown:started': void; 'shutdown:completed': void; } declare class TypedEventEmitter extends EventEmitter { emit(event: K, payload?: AIProviderEvents[K]): boolean; on(event: K, listener: (payload: AIProviderEvents[K]) => void): this; once(event: K, listener: (payload: AIProviderEvents[K]) => void): this; off(event: K, listener: (payload: AIProviderEvents[K]) => void): this; removeAllListeners(event?: K): this; listeners(event: K): Function[]; } export declare const aiProviderEvents: TypedEventEmitter; /** * Subscribe to rate limit events */ export declare function onRateLimitHit(callback: (payload: RateLimitHitPayload) => void): () => void; /** * Subscribe to auth failure events */ export declare function onAuthFailed(callback: (payload: AuthFailedPayload) => void): () => void; /** * Subscribe to process events */ export declare function onProcessEvent(event: 'spawned' | 'completed' | 'failed', callback: (payload: ProcessSpawnedPayload | ProcessCompletedPayload | ProcessFailedPayload) => void): () => void; /** * Subscribe to circuit breaker state changes */ export declare function onCircuitBreakerChange(callback: (payload: CircuitStateChangePayload) => void): () => void; export {}; //# sourceMappingURL=events.d.ts.map