// Enum values stored in text columns (see schema.ts), with their types. No imports: client // components may use these, unlike schema.ts, whose table definitions pull in drizzle-orm. // Models export const MODEL_STATUSES = [ "pending", // added, nothing downloaded yet "downloading", "ready", // all selected files present at pinned SHA "incomplete", // verify found missing/broken files, or an update/repair didn't finish "failed", // last download failed "deleting", ] as const; export type ModelStatus = (typeof MODEL_STATUSES)[number]; /** Is the repo (at the pinned commit) still on the Hub? Local files are never touched either way. */ export const HUB_STATES = ["available", "repo_missing", "commit_missing"] as const; export type HubState = (typeof HUB_STATES)[number]; export const MODEL_FILE_STATES = [ "pending", // not downloaded yet / not checked "present", // exists with the expected size "missing", "size_mismatch", "hash_mismatch", "verified", // deep verify: hash matches ] as const; export type ModelFileState = (typeof MODEL_FILE_STATES)[number]; // Jobs export const JOB_KINDS = ["download", "verify", "deep_verify", "delete"] as const; export type JobKind = (typeof JOB_KINDS)[number]; /** Download purposes; "remove" is a delete job that removes only some files (the model stays). */ export const JOB_PURPOSES = ["initial", "add", "import", "repair", "update", "remove"] as const; export type JobPurpose = (typeof JOB_PURPOSES)[number]; export const JOB_STATES = [ "queued", "downloading", "verifying", "completed", "failed", "cancelled", "interrupted", ] as const; export type JobState = (typeof JOB_STATES)[number]; export const ACTIVE_JOB_STATES = ["downloading", "verifying"] as const satisfies JobState[]; export const JOB_ERROR_CODES = [ "auth", // invalid/missing token "gated", // gated repo, access not granted "repo_not_found", "revision_not_found", "disk_full", "network", "size_mismatch", // finished but files don't match expected sizes "unknown", ] as const; export type JobErrorCode = (typeof JOB_ERROR_CODES)[number]; export const JOB_FILE_STATES = ["pending", "downloading", "done", "failed"] as const; export type JobFileState = (typeof JOB_FILE_STATES)[number]; export const LOG_STREAMS = ["stdout", "stderr", "system"] as const; export type LogStream = (typeof LOG_STREAMS)[number]; // Endpoints and benchmarks export const ENDPOINT_ENGINES = ["llama.cpp", "vllm", "sglang", "ollama", "other"] as const; export type EndpointEngine = (typeof ENDPOINT_ENGINES)[number]; export const BENCHMARK_STATES = ["queued", "running", "completed", "failed", "cancelled"] as const; export type BenchmarkState = (typeof BENCHMARK_STATES)[number]; export const BENCHMARK_PHASES = ["decode", "prefill", "concurrency"] as const; export type BenchmarkPhase = (typeof BENCHMARK_PHASES)[number]; export const QUALITY_SECTIONS = ["tools", "coding", "retrieval"] as const; export type QualitySection = (typeof QUALITY_SECTIONS)[number]; /** run: BetterBench; ab: paired A/B; eval: Kaname's quality eval (tool calling, coding, retrieval). */ export const BENCHMARK_KINDS = ["run", "ab", "eval"] as const; export type BenchmarkKind = (typeof BENCHMARK_KINDS)[number]; /** * preview: the worker runs `L80 betterbench --results … --dry-run --payload-out`; previewed: the * exact payload is ready to inspect; publish: confirmed by a user, the worker publishes it; * published / failed. */ export const PUBLICATION_STATES = ["preview", "previewed", "publish", "published", "failed"] as const; export type PublicationState = (typeof PUBLICATION_STATES)[number];