/** Which engine runs a model. GGUF files run in-process through llama.cpp. * MLX models run in mlx_lm.server, and diffusers models in Agency's image * server; `agency local serve` starts both. */ export type Backend = "llama-cpp" | "mlx" | "diffusers"; /** The backends whose models `agency local serve` runs. Each is named with * a URI of its own prefix and downloaded into a folder of its own name. */ export type ServedBackend = "mlx" | "diffusers"; export declare function isGgufPath(v: string): boolean; export type ServedUri = { backend: ServedBackend; repo: string; revision: string | undefined; }; export declare function isServedUri(v: string): boolean; /** Split "diffusers:org/repo@rev" or "mlx:org/repo@rev" into its parts. * Throws on any other shape. */ export declare function parseServedUri(v: string): ServedUri; export declare function isMlxUri(v: string): boolean; /** Split "mlx:org/repo@rev" into its parts. Throws on any other shape. */ export declare function parseMlxUri(v: string): { repo: string; revision: string | undefined; }; export type ModelDirEntry = { name: string; size: number; }; /** The files in a model directory, by name and size. This follows symlinks, * which `contained.ts` does not, because a Hugging Face cache snapshot * (`hf/hub/models--org--repo/snapshots//`) is all links into * `blobs/` and should work without copying. It reads names and sizes * only. A dangling link is skipped. */ export declare function modelDirEntries(dir: string): ModelDirEntry[]; /** A Hugging Face model directory: config.json plus at least one weights * file. This is the layout `mlx_lm.server` loads. A GGUF model is one file * with that information inside it, so it never has a config.json. */ export declare function isModelDir(p: string): boolean; /** A diffusers model directory: `model_index.json` at the top and its * weights one level down, in a folder per component (`transformer/`, * `vae/`, and so on). It has no top-level config.json, so it is never also * an MLX model directory. */ export declare function isDiffusersDir(p: string): boolean; /** Which served backend a model directory is for, or null when it is * neither kind. */ export declare function servedDirBackend(p: string): ServedBackend | null; export declare function isServedModelDir(p: string): boolean; /** The bytes a model directory holds: its files, and for a diffusers model * the files in its component folders too. Follows symlinks the way * `modelDirEntries` does. */ export declare function modelDirSizeBytes(p: string): number; /** Which engine runs a resolved target. Throws for a path that is neither a * GGUF file nor a model directory. */ export declare function backendOfTarget(target: string): Backend; /** The repo id a Hub cache folder name stands for, or null when the name is * not one. The Hub writes `org/repo` as `org--repo`, so the first `--` after * the prefix is the separator and any later one belongs to the repo name. */ export declare function hubRepoOfDirName(name: string): string | null; /** The model directory inside a Hugging Face cache folder * (`models--org--repo/snapshots//`), or null when `p` is not one. * `refs/main` names the snapshot to use; without it, a lone snapshot is * taken. Several snapshots and no ref is ambiguous, and throws rather than * guessing which revision you meant. */ export declare function hubSnapshotDir(p: string): string | null; /** The cache folder name for a repo id: `org/repo` becomes * `models--org--repo`. */ export declare function hubDirNameOfRepo(repo: string): string; /** Whether a path looks like a snapshot inside a Hugging Face cache: * `/models--org--repo/snapshots/`. Used to classify a * directory Agency did not scan, such as the target of an alias. */ export declare function isHubSnapshotPath(p: string): boolean; /** The revision a Hub snapshot directory came from: the sha in its name. */ export declare function hubSnapshotRevision(snapshotDir: string): string; /** The parsed contents of one JSON file in a model directory, or null when * it is missing, not JSON, not a regular file, or over * `MAX_MODEL_JSON_BYTES`. Only `config.json` and `model_index.json` are * read this way, and only to decide what the directory holds. * * A symlink is refused, except in a Hub cache snapshot, which links every * file into its repo folder's `blobs/`. There the link is followed only * when it stays inside that repo folder. */ export declare function readModelJson(dir: string, name: string): Record | null;