- The enum arrays move from schema.ts to src/lib/db/enums.ts (no imports), which schema.ts re-exports. The endpoint form and benchmark start imported ENDPOINT_ENGINES/QUALITY_SECTIONS from the schema, which put drizzle-orm, every table definition and ulid (18 KB gzipped) on the endpoint pages. An ESLint rule now refuses value imports from the schema in client code. - The ⌘K palette dialog is its own chunk, loaded on first open and preloaded when you hover or focus Search or press ⌘/Ctrl. - The dot painting's brightness grid was copied into 10 page chunks (~10 KB gzipped each); it is now one async chunk, parsed once per tab. The canvas skips redraws when size, pixel ratio and theme are unchanged (the ResizeObserver's first callback drew everything a second time) and draws at most once per frame while resizing. First-load JS per route drops by 10-29 KB gzipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
94 lines
3.6 KiB
TypeScript
94 lines
3.6 KiB
TypeScript
// 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];
|