import type { StudioRow } from "./db.js";
import type { LokiClient } from "./loki.js";
/**
 * In-process idle detector — the housekeeping counterpart to the studio-pool
 * keeper. Runs inside the switchboard reactor (started in the subgraph's
 * onSetup), so it dispatches `SLEEP_ENVIRONMENT` directly as a system action via
 * the reactor client — no auth token, nothing that expires.
 *
 * Each pass: enumerate claimed READY studios, drop the ineligible ones, ask Loki
 * whether each had a *proper* request in the idle window, and sleep the ones
 * that didn't. Gated by `enabled` and `dryRun` for a safe rollout.
 */
export interface KeeperConfig {
    /** Master switch — the keeper does nothing unless true. */
    enabled: boolean;
    /** Log intended sleeps without dispatching. */
    dryRun: boolean;
    /** No proper request for this long ⇒ sleep. */
    idleThresholdSeconds: number;
    /** Scan cadence (ms). */
    scanIntervalMs: number;
    /** Wildcard base domain studios live under. */
    baseDomain: string;
    /** tenantIds/subdomains never to sleep. */
    allowlist: string[];
}
export declare function loadKeeperConfig(env?: NodeJS.ProcessEnv): KeeperConfig;
/** Apex studio host for a subdomain (CLINT studios are served at the apex). */
export declare function studioHost(subdomain: string, baseDomain: string): string;
export interface KeeperDeps {
    /** Source of claimed READY studios (pre-eligibility) — injected for testability. */
    listStudios: () => Promise<StudioRow[]>;
    loki: LokiClient;
    /** Dispatch SLEEP_ENVIRONMENT on the env document (system action, in-process). */
    sleepEnv: (documentId: string) => Promise<void>;
    config: KeeperConfig;
    logger?: {
        info: (m: string) => void;
        warn: (m: string) => void;
    };
}
export declare class HousekeepingKeeper {
    private readonly deps;
    private timer;
    private running;
    constructor(deps: KeeperDeps);
    /** One detection pass. Returns the hosts slept (or that would be, in dry-run). */
    reconcileOnce(): Promise<string[]>;
    start(): void;
    stop(): void;
}
//# sourceMappingURL=keeper.d.ts.map