export type NexusEventType = 'system.boot' | 'planner.stage' | 'memory.store' | 'memory.dedup' | 'memory.recall' | 'memory.flushed' | 'memory.snapshot' | 'memory.health.tick' | 'memory.sqlite.retry' | 'pod.signal' | 'tokens.optimized' | 'tokens.searchSaved' | 'orchestration.decomposed' | 'orchestration.completed' | 'session.summaryBootstrap' | 'phantom.worker.start' | 'phantom.worker.complete' | 'phantom.merge.complete' | 'phantom.merge' | 'guardrail.check' | 'ghost.pass' | 'graph.query' | 'graph.sync.failed' | 'graph.coverage.low' | 'graph.cr.build.start' | 'graph.cr.build.complete' | 'graph.cr.build.failed' | 'darwin.cycle' | 'darwin.cycle.complete' | 'session.dna' | 'skill.register' | 'skill.deploy' | 'skill.revoke' | 'hook.deploy' | 'hook.revoke' | 'hook.fire' | 'hook.error' | 'workflow.deploy' | 'workflow.run' | 'automation.deploy' | 'automation.revoke' | 'automation.run' | 'shield.decision' | 'memory.audit' | 'federation.heartbeat' | 'client.heartbeat' | 'client.inferred' | 'client.status' | 'dashboard.action' | 'workspace.changed' | 'nexus.shutdown' | 'nexus.daemon.error' | 'orchestrator.disposed' | 'orchestrator.funnel.stage' | 'orchestrator.warn' | 'nexusnet.publish' | 'nexusnet.sync' | 'mcp.call.start' | 'mcp.call.stream' | 'mcp.call.complete' | 'mcp.handler.complete' | 'mcp.handler.failed' | 'mcp.handler.retry' | 'mcp.handler.best-effort-failed' | 'tool.invocation' | 'nexus.deprecation.used' | 'memory.tier.promoted' | 'memory.tier.promoted.failed' | 'memory.pre-compaction' | 'memory.flush-requested' | 'entanglement.create' | 'entanglement.collapse' | 'entanglement.correlate' | 'cas.encode' | 'cas.decode' | 'cas.pattern_learned' | 'kv.merge' | 'kv.adapt' | 'kv.consensus' | 'byzantine.vote.started' | 'byzantine.vote.result' | 'synapse.ready' | 'synapse.operative.hired' | 'synapse.operative.retired' | 'synapse.operative.health.changed' | 'synapse.striketeam.deployed' | 'synapse.striketeam.completed' | 'synapse.striketeam.finished' | 'synapse.mission.assigned' | 'synapse.mission.completed' | 'synapse.sortie.started' | 'synapse.sortie.selection' | 'synapse.sortie.completed' | 'synapse.sortie.failed' | 'synapse.fieldreport.submitted' | 'synapse.echo.fired' | 'synapse.budget.warning' | 'synapse.budget.exceeded' | 'synapse.approval.requested' | 'synapse.approval.resolved' | 'synapse.compaction.standdown' | 'synapse.compaction.resumed' | 'synapse.coordination.publish.failed' | 'synapse.watchdog.stall' | 'synapse.watchdog.zombie' | 'architects.ready' | 'architects.blueprint.instantiated' | 'architects.worklist.created' | 'architects.workitem.claimed' | 'architects.workitem.completed' | 'architects.workitem.blocked' | 'architects.constructionlock.acquired' | 'architects.constructionlock.renewed' | 'architects.constructionlock.released' | 'architects.constructionlock.contested' | 'architects.relay.sent' | 'architects.relay.read' | 'architects.sentinel.patrol' | 'architects.sentinel.stall' | 'architects.sentinel.zombie' | 'architects.ward.patrol' | 'architects.ward.escalation' | 'architects.convergence.started' | 'architects.convergence.merged' | 'architects.convergence.failed' | 'architects.dispatch.go' | 'architects.dispatch.queued' | 'architects.relay.failed' | 'architects.event.failed' | 'ledger.duplicate-prevented' | 'nexus.circuit-open' | 'nexus.circuit-tripped' | 'license.activated' | 'license.deactivated' | 'license.expired' | 'license.cap.warning' | 'license.cap.reached' | 'dispatch.started' | 'dispatch.event' | 'dispatch.token-usage' | 'dispatch.complete' | 'dispatch.failed' | 'dispatch.cancelled' | 'dispatch.budget-exceeded' | 'mcp.auto-memory.failed' | 'daemon.self-heal.db-corrupt' | 'feature.time_to_first_bootstrap' | 'feature.time_to_first_memory' | 'feature.time_to_first_interaction' | 'feature.time_to_first_mission_complete' | 'async_gate.completed' | 'async_gate.failed' | 'install.step' | 'license.tierChanged' | 'license.upgradeNudge' | 'orchestrator.run.start' | 'orchestrator.run.complete';
export interface NexusEventPayloads {
    'system.boot': {
        version: string;
        toolsCount: number;
    };
    'planner.stage': {
        runId?: string;
        stage: string;
        status: string;
        owner: string;
        assets: number;
    };
    'memory.store': {
        id: string;
        priority: number;
        tags: string[];
        tier: string;
    };
    'memory.dedup': {
        existingId: string;
        fingerprint: string;
    };
    'memory.recall': {
        query: string;
        count: number;
        k?: number;
        crossClient?: boolean;
        format?: string;
        preview?: string[];
    };
    'memory.flushed': {
        count: number;
        reason: string;
        ts: number;
    };
    'memory.snapshot': {
        kind: string;
        [key: string]: unknown;
    };
    'memory.health.tick': {
        counts: Array<{
            state: string;
            c: number;
        }>;
        ts: number;
    };
    'memory.sqlite.retry': {
        operation: string;
        attempt: number;
        maxAttempts: number;
        delayMs: number;
        message: string;
    };
    'pod.signal': {
        workerId: string;
        type: string;
        content: string;
        confidence?: number;
        tags?: string[];
        runId?: string | null;
        workItemId?: string | null;
        correlationId?: string | null;
    };
    'tokens.optimized': {
        savings: number;
        pct: number;
        files?: number;
        inputTokens?: number;
        outputTokens?: number;
        compressionRatio?: number;
        runId?: string;
        sessionId?: string;
        phase?: string;
        subsystem?: string;
        source?: string;
    };
    'tokens.searchSaved': {
        query: string;
        resultCount: number;
        tokensSaved: number;
        source?: string;
    };
    'orchestration.decomposed': {
        runId: string;
        sessionId?: string;
        goal: string;
        intent?: string;
        crew?: string | null;
        specialists: string[];
        skills: string[];
        workflows: string[];
        files: string[];
        workers: number;
        phases: number;
    };
    'orchestration.completed': {
        runId: string;
        sessionId?: string;
        state: string;
        verifiedWorkers: number;
        totalWorkers: number;
        savedTokens: number;
        compressionPct: number;
        durationMs: number;
        result: string;
    };
    'session.summaryBootstrap': {
        originalTokens: number;
        summaryTokens: number;
        savedTokens: number;
    };
    'phantom.worker.start': {
        workerId: string;
        approach: string;
        goal: string;
    };
    'phantom.worker.complete': {
        workerId: string;
        confidence: number;
    };
    'phantom.merge.complete': {
        workerId: string;
        confidence: number;
    };
    'phantom.merge': {
        action: string;
        winner: string;
    };
    'guardrail.check': {
        action: string;
        passed: boolean;
        score: number;
    };
    'ghost.pass': {
        task: string;
        risks: number;
        workers: number;
    };
    'graph.query': {
        query: string;
        resultsCount: number;
    };
    'graph.sync.failed': {
        reason: string;
        memoryId?: string;
        ts: number;
    };
    'graph.coverage.low': {
        memCount: number;
        graphEntities: number;
    };
    'graph.cr.build.start': {
        repoRoot: string;
    };
    'graph.cr.build.complete': {
        repoRoot: string;
    };
    'graph.cr.build.failed': {
        repoRoot: string;
    };
    'darwin.cycle': {
        hypothesis: string;
        outcome: string;
    };
    'darwin.cycle.complete': {
        id: string;
        outcome: string;
        targetFile: string;
    };
    'session.dna': {
        sessionId: string;
        action: 'generated' | 'loaded';
    };
    'skill.register': {
        name: string;
        id: string;
    };
    'skill.deploy': {
        skillId: string;
        scope: string;
        status: string;
    };
    'skill.revoke': {
        skillId: string;
        status: string;
    };
    'hook.deploy': {
        hookId: string;
        scope: string;
        status: string;
    };
    'hook.revoke': {
        hookId: string;
        status: string;
    };
    'hook.fire': {
        hookId: string;
        name: string;
        trigger: string;
        blocked: boolean;
    };
    'hook.error': {
        hookId: string;
        error: string;
    };
    'workflow.deploy': {
        workflowId: string;
        scope: string;
        status: string;
    };
    'workflow.run': {
        workflowId: string;
        runId: string;
        status: string;
    };
    'automation.deploy': {
        automationId: string;
        scope: string;
        status: string;
    };
    'automation.revoke': {
        automationId: string;
        status: string;
    };
    'automation.run': {
        automationId: string;
        trigger: string;
        queued: boolean;
    };
    'shield.decision': {
        target: string;
        stage: string;
        action: string;
        blocked: boolean;
    };
    'memory.audit': {
        scanned: number;
        quarantined: number;
    };
    'federation.heartbeat': {
        peerId: string;
        source: string;
        health: string;
        capabilities: number;
    };
    'client.heartbeat': {
        clientId: string;
        displayName: string;
        source: string;
        state: string;
    };
    'client.inferred': {
        clientId: string;
        displayName: string;
        source: string;
        state: string;
        evidence: string[];
    };
    'client.status': {
        clientId: string;
        displayName: string;
        previous: string;
        next: string;
        source: string;
    };
    'dashboard.action': {
        action: string;
        status: string;
        target?: string;
    };
    'workspace.changed': {
        repoRoot: string;
        repoName: string;
    };
    'nexus.shutdown': {
        signal: string;
    };
    'nexus.daemon.error': {
        kind: 'uncaughtException' | 'unhandledRejection';
        message: string;
        stack: string | null;
    };
    'orchestrator.disposed': {
        ts: number;
    };
    'orchestrator.warn': {
        kind: string;
        message: string;
    };
    'orchestrator.funnel.stage': {
        stage: 'classify' | 'shortlist' | 'vote' | 'compose' | 'execute';
        at: string;
        goal?: string;
        kind?: string;
        beforeCount?: number;
        afterCount?: number;
        selectionSummary?: Record<string, number>;
        taskType?: string;
        elapsedMs?: number;
    };
    'nexusnet.publish': {
        type: string;
        byteSize: number;
    };
    'nexusnet.sync': {
        newItemsCount: number;
    };
    'mcp.call.start': {
        callId: string;
        serverName: string;
        toolName: string;
        args: any;
    };
    'mcp.call.stream': {
        callId: string;
        chunk: string;
    };
    'mcp.call.complete': {
        callId: string;
        serverName: string;
        toolName: string;
        durationMs: number;
        resultByteSize: number;
        result?: any;
        error?: string;
    };
    'mcp.handler.complete': {
        toolName: string;
        attempts: number;
        durationMs: number;
    };
    'mcp.handler.failed': {
        toolName: string;
        code: string;
        attempts: number;
        durationMs: number;
    };
    'mcp.handler.retry': {
        toolName: string;
        code: string;
        attempt: number;
        delayMs: number;
    };
    'mcp.handler.best-effort-failed': {
        toolName: string;
        stage: string;
        error: string;
    };
    'tool.invocation': {
        toolName: string;
        durationMs: number;
        status: 'ok' | 'error';
    };
    'nexus.deprecation.used': {
        toolName: string;
    };
    'memory.tier.promoted': {
        memoryId: string;
        from: string;
        to: string;
    };
    'memory.tier.promoted.failed': {
        toolName: string;
        error: string;
    };
    'memory.pre-compaction': {
        tokensRemaining: number;
        reason: string;
        sessionAgeMinutes: number;
    };
    'memory.flush-requested': {
        force: boolean;
        reason: string;
        itemsFlushed: number;
    };
    'entanglement.create': {
        stateId: string;
        agents: number;
        dimension: number;
        type: string;
    };
    'entanglement.collapse': {
        stateId: string;
        agentId: string;
        strategy: number;
        probability: number;
        remainingAgents: number;
    };
    'entanglement.correlate': {
        stateId: string;
        pairs: number;
        avgCorrelation: number;
    };
    'cas.encode': {
        inputTokens: number;
        outputTokens: number;
        compressionRatio: number;
    };
    'cas.decode': {
        tokens: number;
    };
    'cas.pattern_learned': {
        pattern: string;
        codebookSize: number;
    };
    'kv.merge': {
        layerPair: string;
        compressionRatio: number;
    };
    'kv.adapt': {
        taskType: string;
        shots: number;
        adaptationTime: number;
    };
    'kv.consensus': {
        agents: number;
        syncOverhead: number;
        conflicts: number;
    };
    'byzantine.vote.started': {
        proposalId: string;
        proposerId: string;
        layerIndex: number;
        agentCount: number;
        quorum: number;
    };
    'byzantine.vote.result': {
        proposalId: string;
        accepted: boolean;
        votesFor: number;
        votesAgainst: number;
        votesPending: number;
        total: number;
        quorum: number;
        agentVotes: Array<{
            agentId: string;
            approved: boolean;
            reliability: number;
        }>;
    };
    'synapse.ready': {
        version: string;
    };
    'synapse.operative.hired': {
        operativeId: string;
        name: string;
        skillId: string | null;
        specialistId?: string | null;
        roleTitle?: string | null;
        reportsToOperativeId?: string | null;
        strikeTeamId: string | null;
    };
    'synapse.operative.retired': {
        operativeId: string;
    };
    'synapse.operative.health.changed': {
        operativeId: string;
        healthState: string;
    };
    'synapse.striketeam.deployed': {
        strikeTeamId: string;
        operativeCount: number;
        missionCount: number;
        selectionSummary?: unknown;
        worklistId?: string | null;
        correlationId?: string | null;
    };
    'synapse.striketeam.completed': {
        strikeTeamId: string;
        worklistId?: string | null;
        correlationId?: string | null;
    };
    'synapse.striketeam.finished': {
        strikeTeamId: string;
        intent: 'read' | 'orchestrate' | 'mutate';
        outcome: 'completed' | 'cancelled' | 'failed';
        worklistId?: string | null;
    };
    'synapse.mission.assigned': {
        operativeId: string;
        missionId: string;
        title: string;
        strikeTeamId?: string | null;
        worklistId?: string | null;
        correlationId?: string | null;
    };
    'synapse.mission.completed': {
        missionId: string;
    };
    'synapse.sortie.started': {
        sortieId: string;
        operativeId: string;
        missionId: string | null;
        workItemId?: string | null;
        strikeTeamId?: string | null;
        worklistId?: string | null;
        correlationId?: string | null;
    };
    'synapse.sortie.selection': {
        sortieId: string;
        operativeId: string;
        missionId: string | null;
        strikeTeamId?: string | null;
        skillId?: string | null;
        specialistId?: string | null;
        workflowSelectors: string[];
        workerCount: number;
    };
    'synapse.sortie.completed': {
        sortieId: string;
        operativeId: string;
        missionId: string | null;
        workItemId: string | null;
        strikeTeamId?: string | null;
        worklistId?: string | null;
        correlationId?: string | null;
        runId?: string | null;
        status: string;
        tokensUsed: number;
    };
    'synapse.sortie.failed': {
        sortieId: string;
        operativeId: string;
        missionId?: string | null;
        workItemId?: string | null;
        strikeTeamId?: string | null;
        worklistId?: string | null;
        correlationId?: string | null;
        error: string;
    };
    'synapse.fieldreport.submitted': {
        fieldReportId: string;
        operativeId: string;
        status: string;
        missionId?: string | null;
        strikeTeamId?: string | null;
        worklistId?: string | null;
        correlationId?: string | null;
        runId?: string | null;
    };
    'synapse.echo.fired': {
        operativeId: string;
        predecessorCount: number;
    };
    'synapse.budget.warning': {
        operativeId: string;
        spentUsd: number;
        capUsd: number;
        pct: number;
        budgetScope?: string;
        budgetScopeId?: string | null;
    };
    'synapse.budget.exceeded': {
        operativeId: string;
        spentUsd: number;
        capUsd: number;
        budgetScope?: string;
        budgetScopeId?: string | null;
    };
    'synapse.approval.requested': {
        approvalId: string;
        operativeId: string;
        action: string;
    };
    'synapse.approval.resolved': {
        approvalId: string;
        decision: string;
    };
    'synapse.compaction.standdown': {
        operativesPaused: number;
    };
    'synapse.compaction.resumed': {
        operativesResumed: number;
    };
    'synapse.coordination.publish.failed': {
        stage: string;
        phase: string;
        operativeId?: string;
        missionId?: string;
        sortieId?: string;
        error: string;
    };
    'synapse.watchdog.stall': {
        operativeId: string;
    };
    'synapse.watchdog.zombie': {
        operativeId: string;
    };
    'architects.ready': {
        version: string;
    };
    'architects.blueprint.instantiated': {
        blueprintId: string;
        worklistId: string;
        workItemCount: number;
    };
    'architects.worklist.created': {
        worklistId: string;
        blueprintId: string;
    };
    'architects.workitem.claimed': {
        workItemId: string;
        operativeId: string;
    };
    'architects.workitem.completed': {
        workItemId: string;
        operativeId: string;
        status: string;
    };
    'architects.workitem.blocked': {
        workItemId: string;
        operativeId: string;
        reason: string;
    };
    'architects.constructionlock.acquired': {
        lockId: string;
        workItemId: string;
        operativeId: string;
    };
    'architects.constructionlock.renewed': {
        lockId: string;
        workItemId: string;
        operativeId: string;
        leaseExpiresAt: number;
    };
    'architects.constructionlock.released': {
        lockId: string;
        workItemId: string;
        finalStatus: string;
    };
    'architects.constructionlock.contested': {
        workItemId: string;
        byOperativeId: string;
        requestedBy: string;
    };
    'architects.relay.sent': {
        messageId: string;
        from: string;
        target: string;
        toId: string;
        subject: string;
    };
    'architects.relay.read': {
        messageId: string;
        byOperativeId: string;
    };
    'architects.sentinel.patrol': {
        strikeTeamId: string;
        operativeReports: Array<Record<string, unknown>>;
        overallHealth: string;
        stalledCount: number;
        zombieCount: number;
        generatedAt: string;
    };
    'architects.sentinel.stall': {
        operativeId: string;
        strikeTeamId: string;
    };
    'architects.sentinel.zombie': {
        operativeId: string;
        strikeTeamId: string;
    };
    'architects.ward.patrol': {
        teamsChecked: number;
    };
    'architects.ward.escalation': {
        strikeTeamId: string;
        consecutiveCriticalPatrols: number;
        message: string;
        report?: unknown;
    };
    'architects.convergence.started': {
        runId: string;
        worklistId: string;
        itemCount: number;
    };
    'architects.convergence.merged': {
        runId: string;
        worklistId: string;
    };
    'architects.convergence.failed': {
        runId: string;
        worklistId: string;
        error: string;
    };
    'architects.dispatch.go': {
        operativeId: string;
        workItemId: string;
    };
    'architects.dispatch.queued': {
        operativeId: string;
        workItemId: string;
        depth: number;
    };
    'architects.relay.failed': {
        messageId: string;
        from: string;
        target: string;
        toId: string;
        subject: string;
        error: string;
    };
    'architects.event.failed': {
        event: string;
        operativeId?: string;
        missionId?: string;
        strikeTeamId?: string;
        error: string;
    };
    'ledger.duplicate-prevented': {
        fingerprint: string;
        existingId: string;
    };
    'nexus.circuit-open': {
        remainingMs: number;
        consecutiveFailures: number;
    };
    'nexus.circuit-tripped': {
        consecutiveFailures: number;
    };
    'license.activated': {
        tier: string;
        expiresAt: number | null;
    };
    'license.deactivated': {
        previousTier: string;
    };
    'license.expired': {
        previousTier: string;
    };
    'license.cap.warning': {
        type: string;
        current: number;
        limit: number;
        tier: string;
    };
    'license.cap.reached': {
        type: string;
        current: number;
        limit: number;
        tier: string;
        upgradeUrl: string;
    };
    'dispatch.started': {
        runId: string;
        operativeId: string;
        invokerId: string;
        pid: number;
    };
    'dispatch.event': {
        runId: string;
        operativeId: string;
        kind: string;
        [key: string]: unknown;
    };
    'dispatch.token-usage': {
        runId: string;
        operativeId: string;
        prompt: number;
        completion: number;
    };
    'dispatch.complete': {
        runId: string;
        operativeId: string;
        success: boolean;
        tokensUsed: number;
        costUsd: number;
        filesChanged: number;
        durationMs: number;
        summary: string;
    };
    'dispatch.failed': {
        runId: string;
        operativeId: string;
        error: string;
    };
    'dispatch.cancelled': {
        runId: string;
        operativeId: string;
    };
    'dispatch.budget-exceeded': {
        runId: string;
        operativeId: string;
        spentUsd: number;
        capUsd: number;
    };
    'mcp.auto-memory.failed': {
        toolName: string;
        error: string;
    };
    'daemon.self-heal.db-corrupt': {
        db: string;
        dbPath: string;
        outcome: 'repaired' | 'failed';
        at: number;
    };
    'feature.time_to_first_bootstrap': {
        durationMs: number;
        at: number;
    };
    'feature.time_to_first_memory': {
        durationMs: number;
        at: number;
    };
    'feature.time_to_first_interaction': {
        durationMs: number;
        at: number;
    };
    'feature.time_to_first_mission_complete': {
        durationMs: number;
        at: number;
    };
    'async_gate.completed': {
        runId: string;
        tool: string;
    };
    'async_gate.failed': {
        runId: string;
        tool: string;
        error: string;
    };
    'install.step': {
        step: number;
        total: number;
        label: string;
        status: 'pending' | 'running' | 'ok' | 'skip' | 'fail';
        detail?: string;
    };
    'license.tierChanged': {
        from: string;
        to: string;
        reason: 'activate' | 'sync' | 'deactivate';
    };
    'license.upgradeNudge': {
        currentTier: string;
        feature: string;
        message: string;
        ctaUrl: string;
    };
    'orchestrator.run.start': {
        goal: string;
        sessionId?: string;
        mode?: string;
    };
    'orchestrator.run.complete': {
        goal: string;
        sessionId?: string;
        runId?: string;
        state?: string;
        durationMs?: number;
    };
}
export interface NexusEvent<T extends NexusEventType = NexusEventType> {
    id: string;
    type: T;
    timestamp: number;
    data: NexusEventPayloads[T];
}
declare class EventBusEngine {
    private emitter;
    private history;
    private readonly MAX_HISTORY;
    private seenIds;
    private fileOffset;
    private pollHandle;
    constructor();
    /**
     * Emit a strongly-typed Nexus Prime event
     */
    emit<T extends NexusEventType>(type: T, data: NexusEventPayloads[T]): void;
    /**
     * Poll the JSONL file for events from other processes.
     * Call this from DashboardServer to bridge cross-process events.
     */
    startFilePolling(intervalMs?: number): void;
    isFilePollingActive(): boolean;
    /** Stop file polling */
    stopFilePolling(): void;
    /**
     * Listen to all events (useful for SSE streams)
     */
    onEvent(handler: (event: NexusEvent) => void): () => void;
    /**
     * Listen to specific event types
     */
    on<T extends NexusEventType>(type: T, handler: (data: NexusEventPayloads[T]) => void): () => void;
    /**
     * Get historical events
     */
    getHistory(sinceTimestamp?: number): NexusEvent[];
    /**
     * Clear history
     */
    clear(): void;
    private recordEvent;
    private trimHistory;
    private rehydrateHistoryFromDisk;
    private rotateEventsFileIfNeeded;
    private pruneArchivedEvents;
}
export declare const nexusEventBus: EventBusEngine;
export {};
