import type { Session } from "./server-session.js";
import type { ParsedSummarizeRequest } from "./server-summarize-request.js";
export declare function buildActiveSummarizeKey(request: ParsedSummarizeRequest): string;
export declare function resolveDaemonMaxActiveSummaries(env: Record<string, string | undefined>): number;
export declare function closeAfterActiveTasks({ activeTasks, timeoutMs, close, }: {
    activeTasks: Set<Promise<void>>;
    timeoutMs: number;
    close: () => void;
}): Promise<boolean>;
export declare class DaemonRuntime {
    readonly sessions: Map<string, Session>;
    readonly refreshSessions: Map<string, Session>;
    readonly maxActiveSummaries: number;
    private readonly activeTasks;
    private readonly activeSummarizeRequests;
    private activeSummarizeCount;
    private currentRefreshSessionId;
    constructor(options: {
        maxActiveSummaries: number;
    });
    get activeRefreshSessionId(): string | null;
    registerRefreshSession(session: Session): void;
    finishRefreshSession(sessionId: string): void;
    findActiveSummarizeSession(key: string): Session | null;
    registerActiveSummarizeRequest(key: string, sessionId: string): void;
    clearActiveSummarizeRequest(key: string, sessionId: string): void;
    reserveSummarizeSlot(): (() => void) | null;
    trackSummarizeTask(task: Promise<unknown>, releaseSlot: () => void): void;
    trackRequestTask(task: Promise<void>): void;
    closeAfterActiveTasks(options: {
        timeoutMs: number;
        close: () => void;
    }): Promise<boolean>;
}
