import type { DaemonInfo } from './registry.js';
import type { DashboardEvent } from '../core/dashboard-events.js';
type Row = {
    sessionId: string;
    larkAppId: string;
    [k: string]: unknown;
};
type Sched = {
    id: string;
    [k: string]: unknown;
};
/**
 * Aggregates session and schedule state across all online daemons.
 * Pure state machine — no I/O. The dashboard process feeds it events from
 * each daemon's SSE stream (via subscribeDaemon below) and from initial
 * hydration calls (via GET /api/sessions /api/schedules).
 */
export declare class Aggregator {
    private sessions;
    private schedules;
    private listeners;
    applyEvent(larkAppId: string, ev: DashboardEvent): void;
    /** Bulk-load on dashboard start before SSE catches up. Idempotent. */
    hydrateSessions(larkAppId: string, rows: Row[]): void;
    hydrateSchedules(rows: Sched[]): void;
    getSessions(): Row[];
    getSchedules(): Sched[];
    /** sessionId → owning daemon's larkAppId (used for write routing). */
    ownerOf(sessionId: string): string | undefined;
    scheduleOwnerOf(id: string): string | undefined;
    on(fn: (e: DashboardEvent & {
        larkAppId: string;
    }) => void): () => void;
}
/**
 * Subscribe to one daemon's SSE stream and feed events into the aggregator.
 * Auto-reconnects on error with 1s backoff. Returns an abort function.
 */
export declare function subscribeDaemon(d: DaemonInfo, agg: Aggregator, onError: (e: Error) => void): () => void;
export {};
//# sourceMappingURL=aggregator.d.ts.map