Release 0.15.0: endpoints instead of deployments
Release / release (push) Successful in 12m32s

Kaname keeps two jobs: the model downloader and benchmarks. Benchmarks
now run against endpoints (any OpenAI-compatible server added by URL,
with an optional server-side API key and hand-written hardware notes)
instead of deployments Kaname started itself.

Removed: runtimes, deployments, sweeps, resource telemetry, hardware
detection, the /api/v1 API with tokens and guardrails, and all Docker
access. The quality eval's coding tests run in a network-less sandbox
container that shares only an exchange folder with the worker.

The previous state is kept in branch backup / tag backup-0.14.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-26 21:43:42 +01:00
1 parent 1d2f908b75
commit 276108932d
199 files changed
+5462 -15961

No files matched your search

+5 -36
View File
@@ -6,8 +6,7 @@ import { jobFiles, jobs, localFolders, modelFiles, modelRevisions, models } from
import { hubMissingMessage } from "@/lib/hub/availability";
import { checkFileAccess, getAuthorAvatar, getRepoInfo, listFiles } from "@/lib/hub/client";
import { metadataColumns } from "@/lib/hub/refresh";
import { deploymentsUsing } from "@/lib/deployments";
import { hasOpenJob, queueDownload, type RequestedBy } from "@/lib/jobs";
import { hasOpenJob, queueDownload } from "@/lib/jobs";
import { getLocalFolder, requestFolderScan } from "@/lib/local-folders";
import { purgeModelRows } from "@/lib/model-purge";
import { contentId } from "@/lib/update-diff";
@@ -36,8 +35,6 @@ export async function addModel(input: {
rule: SelectionRule;
/** Import: use this existing folder in MODELS_DIR (must be one the worker's scan found). */
localPath?: string;
/** Added through the API by this token. */
requestedBy?: RequestedBy;
}): Promise<{ id: string }> {
const info = await getRepoInfo(input.repoId, input.sha);
const repoId = info.repoId;
@@ -84,8 +81,6 @@ export async function addModel(input: {
localPath,
includePatterns: input.rule.include,
excludePatterns: input.rule.exclude,
requestedByTokenId: input.requestedBy?.tokenId ?? null,
requestedBy: input.requestedBy?.name ?? null,
...metadataColumns(info.metadata, await getAuthorAvatar(repoId.split("/")[0])),
}),
d.insert(modelRevisions).values({ modelId, sha: info.sha }),
@@ -107,10 +102,6 @@ export async function deleteModel(id: string, options: { deleteFiles: boolean })
if (await hasOpenJob(id)) {
throw new ModelError("busy", "A job for this model is still queued or running. Cancel it first.", 409);
}
const using = await deploymentsUsing({ modelId: id });
if (using.length > 0) {
throw new ModelError("busy", `Deployments use this model (${using.map((u) => u.name).join(", ")}). Delete them first.`, 409);
}
const [{ n }] = await d.select({ n: sql<number>`count(*)` }).from(jobs).where(eq(jobs.modelId, id));
const neverDownloaded = model.status === "pending" && n === 0;
if (!options.deleteFiles || neverDownloaded) {
@@ -206,11 +197,7 @@ function chunk<T>(items: T[], size: number): T[][] {
* rule as exact includes; exclude patterns that would block one of them are dropped, then the
* rule is re-applied to the whole file list so `selected` always matches the stored rule.
*/
export async function addFilesToModel(
modelId: string,
paths: string[],
options: { pendingApproval?: boolean; requestedBy?: RequestedBy } = {},
): Promise<{ jobId: string; added: number }> {
export async function addFilesToModel(modelId: string, paths: string[]): Promise<{ jobId: string; added: number }> {
const d = db();
const model = await d.query.models.findFirst({ where: eq(models.id, modelId) });
if (!model) throw new ModelError("not_found", "Model not found.", 404);
@@ -219,9 +206,9 @@ export async function addFilesToModel(
const open = await d.query.jobs.findFirst({
columns: { id: true },
where: and(eq(jobs.modelId, modelId), inArray(jobs.state, ["pending_approval", "queued", "downloading", "verifying"])),
where: and(eq(jobs.modelId, modelId), inArray(jobs.state, ["queued", "downloading", "verifying"])),
});
if (open) throw new ModelError("busy", "A download for this model is still pending, queued or running. Add files when it has finished.", 409);
if (open) throw new ModelError("busy", "A download for this model is still queued or running. Add files when it has finished.", 409);
const files = await d.select().from(modelFiles).where(eq(modelFiles.modelId, modelId));
const known = new Map(files.map((f) => [f.path, f]));
@@ -241,24 +228,6 @@ export async function addFilesToModel(
d.update(modelFiles).set({ selected: !f.selected, state: "pending" }).where(eq(modelFiles.id, f.id)),
),
]);
const { jobId } = await queueDownload(modelId, "add", {
...options,
// API requests can be rejected; the rule before goes with the job so it can be restored.
previousRule: options.requestedBy ? { include: model.includePatterns, exclude: model.excludePatterns } : undefined,
});
const { jobId } = await queueDownload(modelId, "add");
return { jobId, added: changed.filter((f) => !f.selected).length };
}
/** Put a model's selection rule back (a rejected API "add files" request) and re-apply it. */
export async function restoreSelection(modelId: string, rule: SelectionRule): Promise<void> {
const d = db();
const files = await d
.select({ id: modelFiles.id, path: modelFiles.path, selected: modelFiles.selected })
.from(modelFiles)
.where(eq(modelFiles.modelId, modelId));
const changed = files.filter((f) => f.selected !== isSelected(f.path, rule));
await d.batch([
d.update(models).set({ includePatterns: rule.include, excludePatterns: rule.exclude, updateDiff: null }).where(eq(models.id, modelId)),
...changed.map((f) => d.update(modelFiles).set({ selected: !f.selected }).where(eq(modelFiles.id, f.id))),
]);
}