/**
 * EventBus -- File-based event system for inter-agent communication.
 *
 * Replaces polling with file-watching for instant handoff detection.
 * Uses chokidar-compatible patterns but falls back to fs.watchFile
 * for zero-dependency operation.
 *
 * @connexum/ai-governance
 */
export type EventType = 'handoff:created' | 'handoff:received' | 'governance:tampered' | 'circuit:opened' | 'circuit:closed' | 'anomaly:detected' | 'approval:requested' | 'approval:granted' | 'approval:denied' | 'approval:expired' | 'session:started' | 'session:ended' | 'memory:tampered' | 'license:validated' | 'license:expired' | 'license:revoked' | 'agent:registered' | 'agent:suspended' | 'agent:resumed' | 'agent:heartbeat' | 'pack:activated' | 'pack:deactivated' | 'pack:amended' | 'webhook:delivered' | 'webhook:failed' | 'action:allowed' | 'action:denied' | 'action:approval_required' | 'governance:default-deny-fired' | 'incident:created' | 'incident:resolved' | 'custom';
export interface EventPayload {
    type: EventType;
    source: string;
    target?: string;
    data: Record<string, unknown>;
    timestamp: string;
    /** Organization/tenant ID for multi-tenant filtering */
    orgId?: string;
}
export type EventHandler = (event: EventPayload) => void;
export interface EventBusConfig {
    /** Directory to watch for events */
    eventDir: string;
    /** Agent name (for filtering) */
    agentName: string;
    /** Polling interval in ms (default: 2000) */
    pollIntervalMs?: number;
    /**
     * AIAG-017: rotate events.jsonl when it exceeds this size (bytes).
     * Default: 50 MB. Set to 0 to disable rotation (not recommended in prod).
     */
    maxEventFileBytes?: number;
    /**
     * AIAG-017: keep this many rotated files (events.jsonl.1, .2, ...).
     * Older rotations are deleted. Default: 5.
     */
    maxRotatedFiles?: number;
}
export declare class EventBus {
    private handlers;
    private eventDir;
    private agentName;
    private pollInterval;
    private watcher;
    private lastProcessedOffset;
    private eventFile;
    private maxEventFileBytes;
    private maxRotatedFiles;
    constructor(config: EventBusConfig);
    /**
     * AIAG-017: Rotate events.jsonl when it exceeds maxEventFileBytes.
     * events.jsonl -> events.jsonl.1, events.jsonl.1 -> events.jsonl.2, ...
     * Files beyond maxRotatedFiles are deleted.
     */
    private rotateIfNeeded;
    /**
     * Subscribe to an event type.
     */
    on(type: EventType | '*', handler: EventHandler): void;
    /**
     * Emit an event (writes to event file).
     */
    emit(type: EventType, data: Record<string, unknown>, target?: string): void;
    /**
     * Start watching for events.
     */
    start(): void;
    /**
     * Stop watching for events.
     */
    stop(): void;
    /**
     * Get recent events (for dashboard/monitoring).
     */
    getRecentEvents(limit?: number): EventPayload[];
    private processNewEvents;
    private dispatch;
}
//# sourceMappingURL=event-bus.d.ts.map