import { Disposable } from './disposable'; export type CoreEventMap = { 'plugin:activated': { pluginId: string; }; 'plugin:deactivated': { pluginId: string; }; 'navigation:before': { from: string; to: string; }; 'navigation:after': { path: string; }; 'shell:theme-changed': { colorMode: 'light' | 'dark'; }; 'shell:locale-changed': { locale: string; }; 'shell:sidebar-toggled': { collapsed: boolean; }; 'context:workspace-changed': { workspaceId: string; }; 'context:tenant-changed': { tenantId: string; }; 'context:project-changed': { projectId: string; }; 'data:created': { entityType: string; entityId: string; pluginId: string; }; 'data:updated': { entityType: string; entityId: string; pluginId: string; }; 'data:deleted': { entityType: string; entityId: string; pluginId: string; }; }; export interface VibeControlsEventMap extends CoreEventMap { 'vc:agent-connected': { agentId: string; }; 'vc:agent-disconnected': { agentId: string; }; 'vc:session-started': { sessionId: string; agentId: string; }; 'vc:session-ended': { sessionId: string; agentId: string; }; 'vc:vibe-activated': { vibeId: string; }; 'vc:vibe-deactivated': { vibeId: string; }; } export type EventMiddleware = (event: string, payload: unknown) => unknown | void; export declare class EventBus = CoreEventMap> { private listeners; private middlewares; /** * Subscribe to an event. Returns a Disposable for cleanup. */ on(event: K, handler: (payload: TEventMap[K]) => void): Disposable; on(event: string, handler: (payload: unknown) => void): Disposable; /** * Subscribe to an event once. Auto-disposes after first invocation. */ once(event: K, handler: (payload: TEventMap[K]) => void): Disposable; once(event: string, handler: (payload: unknown) => void): Disposable; /** * Emit an event to all listeners. Runs through middleware chain first. */ emit(event: K, payload: TEventMap[K]): void; emit(event: string, payload: unknown): void; /** * Add middleware that intercepts all events before delivery. */ addMiddleware(mw: EventMiddleware): Disposable; /** * Remove all listeners and middleware. */ clear(): void; } /** * React hook that subscribes to an event bus event with automatic cleanup. * * @example * ```tsx * const eventBus = usePluginRuntime().eventBus; * usePluginEvent(eventBus, 'context:workspace-changed', ({ workspaceId }) => { * console.log('Workspace changed:', workspaceId); * }); * ``` */ export declare function usePluginEvent, K extends keyof TEventMap & string>(eventBus: EventBus, event: K, handler: (payload: TEventMap[K]) => void): void; //# sourceMappingURL=event-bus.d.ts.map