/** * Shared prefetch helper for embedding models. * * Consumed by: * - scripts/prefetch-test-models.mjs (CI warm-up) * - src/cli/models.ts (`models prefetch` / `models check` subcommands) * * Key behaviours: * - Loads via `pipeline('feature-extraction', model, { dtype: 'q8' })`. * - On corrupt-cache / Protobuf / "Unable to get model file" errors: wipes * the model's cache subdir and retries with exponential backoff. * - Probes a 1-token embed to confirm the model actually works end-to-end. * - Returns dim + metadata without leaving the pipeline loaded. */ export interface PrefetchOptions { /** Maximum load attempts (default 3). */ maxAttempts?: number; /** Base backoff interval in ms — doubles each retry (default 1000). */ backoffBaseMs?: number; /** Override cache root (default: TRANSFORMERS_CACHE ?? HF_HOME). */ cacheDir?: string; } export interface PrefetchResult { model: string; dim: number; attempts: number; cachedAt: string; } /** * Download (if needed) and probe an embedding model. * * @throws If all attempts fail, throws the last error with an `attempts` * property attached. */ export declare function prefetchModel(model: string, opts?: PrefetchOptions): Promise;