/** * @octomil/browser — Models namespace * * Provides a `ModelsClient` that exposes model lifecycle status * (`not_cached | downloading | ready | error`), load/unload, * cached model listing, and cache clearing. * * Because the browser SDK's `OctomilClient` is model-specific * (constructed with a single model URL/ref), this client wraps * the existing {@link ModelManager} and tracks runtime state * (downloading, error) in memory. */ import type { ModelManager } from "./model-manager.js"; /** Lifecycle status of a model in the browser SDK. */ export type ModelStatus = "not_cached" | "downloading" | "ready" | "error"; /** Summary info for a cached model. */ export interface CachedModelInfo { /** The model reference (URL or registry name). */ modelRef: string; /** ISO-8601 timestamp of when the model was cached. */ cachedAt?: string; /** Size of the cached model in bytes. */ sizeBytes?: number; } export declare class ModelsClient { private readonly modelId; private readonly manager; private readonly onLoaded; /** Models currently being downloaded. */ private downloading; /** Models that failed to load, keyed by modelId -> error message. */ private errors; constructor(modelId: string, manager: ModelManager, onLoaded: () => void); /** * Return the current lifecycle status of the configured model. * * - `"downloading"` — a `load()` call is in progress. * - `"error"` — the last `load()` call failed. * - `"ready"` — the model binary is cached locally. * - `"not_cached"` — the model is not cached and not loading. */ status(modelId?: string): Promise; /** * Download the model (if not cached) and mark it as ready. * * Tracks downloading/error state so that `status()` reflects * the current lifecycle phase. Delegates the actual work to * the underlying {@link ModelManager}. */ load(modelId?: string): Promise; /** * Remove the cached model binary. * * Note: this does not release the in-memory ONNX session. * Call `OctomilClient.close()` for full cleanup. */ unload(_modelId?: string): Promise; /** * List cached models. * * Because the browser SDK manages a single model per client, * this returns zero or one entries. */ list(): Promise; /** * Remove the cached model and clear any tracked error state. */ clearCache(): Promise; /** * Return the error message for the model, if the last load failed. */ getError(modelId?: string): string | undefined; } //# sourceMappingURL=models.d.ts.map