/**
 * A2ACheckInScheduler — Layer 4 cadence (THREADLINE-A2A-COHERENCE-SPEC).
 *
 * Drives the silence-breaker heartbeat: on a periodic tick it walks the active a2a threads and,
 * for each, runs the check-in flow (decide → summarize → guard → surface). The operator's
 * refinement is "every 5-10 min while a conversation is active and I've heard nothing" — so the
 * scheduler tracks the last surface time per thread (in memory) and lets A2ACheckInPolicy decide.
 *
 * First-sight semantics: when a thread is first seen the silence clock STARTS (set to now) and
 * nothing fires — so a heartbeat never fires the instant a conversation becomes active, only
 * after the full interval of subsequent silence. Salience check-ins fire from the inbound path
 * (not here) and call recordSurface() so the heartbeat clock resets.
 *
 * Deps are injected → the scheduler is testable without the server/timer. Ships gated on the
 * default-off config (start() is a no-op when disabled).
 */
import { type CheckInRequest, type CheckInOutcome } from './A2ACheckInProxy.js';
import type { SummaryKind } from './A2ACheckInSummarizer.js';
export interface ActiveThreadRef {
    threadId: string;
    peerName: string;
    topicId?: number;
}
export interface A2ACheckInSchedulerConfig {
    enabled: boolean;
    heartbeatEnabled: boolean;
    heartbeatIntervalMs: number;
}
export interface A2ACheckInSchedulerDeps {
    /** Active a2a threads to consider this tick (server: from ConversationStore.listActive()). */
    listActiveThreads: () => ActiveThreadRef[];
    /** Run the full check-in flow (server: runCheckIn bound with real summarize/surface/getHistory). */
    checkIn: (req: CheckInRequest) => Promise<CheckInOutcome>;
    /** Clock, injected for testability. */
    now: () => number;
    config: A2ACheckInSchedulerConfig;
    log?: (msg: string) => void;
}
export declare class A2ACheckInScheduler {
    private readonly deps;
    private timer?;
    private readonly lastSurfaceAt;
    constructor(deps: A2ACheckInSchedulerDeps);
    /** Start the cadence timer. No-op when the feature is disabled. */
    start(tickIntervalMs?: number): void;
    stop(): void;
    /** Record that a surface happened for a thread (e.g. a salience check-in) so the heartbeat resets. */
    recordSurface(threadId: string, at: number): void;
    /** One pass over active threads. Exposed for tests + the timer. Never throws to the caller. */
    tick(): Promise<void>;
}
/**
 * Factory — compose the concrete I/O deps into a wired scheduler. The server provides:
 *   listActiveThreads — from ThreadResumeMap.listActive() (filtered to topic-bound threads)
 *   summarize         — sharedLlmQueue.enqueue('background', () => intelligence.evaluate(prompt,{model:'fast'}))
 *   surface           — telegram.sendToTopic(topicId, body) (or the hub for parentless)
 *   getHistory        — formatted thread messages from MessageStore
 * Keeping this here (vs inline in server.ts) makes the full Layer 4 logic exercisable
 * end-to-end with mock deps — the wiring-integrity test the convergence round asked for.
 */
export interface A2ACheckInWiring {
    listActiveThreads: () => ActiveThreadRef[];
    summarize: (prompt: string) => Promise<string>;
    surface: (args: {
        threadId: string;
        topicId?: number;
        peerName: string;
        body: string;
        kind: SummaryKind;
    }) => Promise<void>;
    getHistory: (threadId: string) => Promise<string> | string;
    config: A2ACheckInSchedulerConfig;
    now?: () => number;
    log?: (msg: string) => void;
}
export declare function createA2ACheckInScheduler(w: A2ACheckInWiring): A2ACheckInScheduler;
//# sourceMappingURL=A2ACheckInScheduler.d.ts.map