/** * Forced model rescans on request. * * The runner rescans its model providers every 15 min (connection.ts). When * the desktop app launches an engine (Ollama / LM Studio started, a Claude * Code / Codex / Copilot sign-in finished) it sends { type: "rescan_models" } * (hostChannel.ts), so the new models reach Melaya in seconds instead. * * Requests are cheap to send and may arrive in bursts (the app after a launch, * the web page every 10 s while it waits), so: * - a request while a forced scan runs shares that scan; * - at most one forced scan starts per `minIntervalMs` (5 s); * - a request inside that window is not dropped: it schedules one trailing * scan at the end of the window, shared by every request until then. */ export interface ForcedRescanOptions { /** One forced provider scan (scanProviders({ force: true })). */ scan: () => Promise; /** Publish the result the way the periodic rescan does (runner:models). */ publish: (result: T) => void; /** Minimum gap between two forced scan starts. Default 5 s. */ minIntervalMs?: number; /** Called when a scan or publish throws; the last good list stays. */ onError?: (e: unknown) => void; /** Test seams. */ now?: () => number; setTimer?: (fn: () => void, ms: number) => () => void; } export interface ForcedRescan { /** Ask for a forced rescan. Resolves once the scan that serves it has published (or failed). */ request(): Promise; /** Cancel a pending trailing scan (shutdown). */ dispose(): void; } export declare const FORCED_RESCAN_MIN_INTERVAL_MS = 5000; export declare function createForcedRescan(opts: ForcedRescanOptions): ForcedRescan;