/** * Unified event bus — aggregates runtime events (tasks, scheduler, telegram, * webhooks, tool calls) into a single rolling log for context injection and * the ContextHUD. * * Pattern mirrors devduck's event_bus: any module fires a custom event with * a standard shape, the bus captures it into a ring buffer, and consumers * (system prompt builder, HUD, replay) read from it. */ interface BusEvent { id: string; timestamp: number; source: string; kind: 'started' | 'completed' | 'error' | 'received' | 'sent' | 'fired' | 'info' | 'spawned' | 'killed' | 'updated'; summary: string; data?: any; } declare class EventBus { private events; private listeners; private inited; init(): void; push(ev: Omit & Partial>): void; recent(limit?: number, maxAgeMs?: number): BusEvent[]; all(): BusEvent[]; clear(): void; subscribe(fn: (evs: BusEvent[]) => void): () => void; /** Format recent events as system-prompt context string. */ contextString(limit?: number, maxAgeMs?: number): string; } declare const eventBus: EventBus; /** Convenience: fire a bus event from anywhere. */ declare function fireBusEvent(ev: Omit): void; export { type BusEvent, eventBus, fireBusEvent };