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:
1 parent
1d2f908b75
commit
276108932d
199 files changed
+5462
-15961
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { GaugeIcon, LibraryIcon, RocketIcon, SettingsIcon } from "lucide-react";
|
||||
import { GaugeIcon, LibraryIcon, ServerIcon, SettingsIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -10,9 +10,9 @@ const LINKS = [
|
||||
href: "/",
|
||||
label: "Library",
|
||||
icon: LibraryIcon,
|
||||
active: (p: string) => !["/settings", "/deployments", "/benchmarks"].some((x) => p.startsWith(x)),
|
||||
active: (p: string) => !["/settings", "/endpoints", "/benchmarks"].some((x) => p.startsWith(x)),
|
||||
},
|
||||
{ href: "/deployments", label: "Deployments", icon: RocketIcon, active: (p: string) => p.startsWith("/deployments") },
|
||||
{ href: "/endpoints", label: "Endpoints", icon: ServerIcon, active: (p: string) => p.startsWith("/endpoints") },
|
||||
{ href: "/benchmarks", label: "Benchmarks", icon: GaugeIcon, active: (p: string) => p.startsWith("/benchmarks") },
|
||||
{ href: "/settings", label: "Settings", icon: SettingsIcon, active: (p: string) => p.startsWith("/settings") },
|
||||
];
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { BotIcon, CheckIcon, XIcon } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { approveJob, rejectJob } from "@/components/job-actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { toast } from "sonner";
|
||||
import { formatBytes } from "@/lib/format";
|
||||
|
||||
/** A download requested through the API that waits for approval: who asked, how much, approve/reject. */
|
||||
export function ApprovalBar({ job, onRemoved }: { job: { id: string; requestedBy: string | null; totalBytes: number; purpose: string | null }; onRemoved?: () => void }) {
|
||||
const router = useRouter();
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function run(fn: () => Promise<unknown>) {
|
||||
setBusy(true);
|
||||
try {
|
||||
await fn();
|
||||
router.refresh();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5 text-sm">
|
||||
<p className="flex items-center gap-1.5">
|
||||
<BotIcon className="size-4 shrink-0 text-amber-700 dark:text-amber-300" />
|
||||
<span>
|
||||
<strong>{job.requestedBy ?? "An API token"}</strong> asks to download {formatBytes(job.totalBytes)}
|
||||
{job.purpose === "add" ? " of additional files" : ""}. It starts once you approve it.
|
||||
</span>
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<Button size="sm" disabled={busy} onClick={() => run(() => approveJob(job.id))}>
|
||||
<CheckIcon />
|
||||
Approve
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={busy}
|
||||
onClick={() =>
|
||||
run(async () => {
|
||||
const r = await rejectJob(job.id);
|
||||
if (r?.removedModel) onRemoved?.();
|
||||
})
|
||||
}
|
||||
>
|
||||
<XIcon />
|
||||
Reject
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Something else an API token asked for (a deployment start, a run, a sweep): approve or reject. */
|
||||
export function AgentApprovalBar({ requestedBy, what, base }: { requestedBy: string | null; what: string; base: string }) {
|
||||
const router = useRouter();
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function decide(kind: "approve" | "reject") {
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await fetch(`${base}/${kind}`, { method: "POST" });
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
toast.error(body.error?.message ?? `Request failed (${res.status})`);
|
||||
return;
|
||||
}
|
||||
toast.success(kind === "approve" ? "Approved" : "Rejected");
|
||||
router.refresh();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5 text-sm">
|
||||
<p className="flex items-center gap-1.5">
|
||||
<BotIcon className="size-4 shrink-0 text-amber-700 dark:text-amber-300" />
|
||||
<span>
|
||||
<strong>{requestedBy ?? "An API token"}</strong> asks to {what}. It goes ahead once you approve it.
|
||||
</span>
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<Button size="sm" disabled={busy} onClick={() => decide("approve")}>
|
||||
<CheckIcon />
|
||||
Approve
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" disabled={busy} onClick={() => decide("reject")}>
|
||||
<XIcon />
|
||||
Reject
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { PlusIcon, XIcon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import type { ArgRow } from "@/lib/extra-args";
|
||||
|
||||
const GENERIC = { flag: "--flag", value: "value (optional)" };
|
||||
|
||||
/** Extra command-line arguments as flag/value rows (controlled). `placeholder` is the first row's example. */
|
||||
export function ArgsEditor({
|
||||
rows,
|
||||
onChange,
|
||||
placeholder = GENERIC,
|
||||
addLabel = "Add argument",
|
||||
}: {
|
||||
rows: ArgRow[];
|
||||
onChange: (rows: ArgRow[]) => void;
|
||||
placeholder?: { flag: string; value: string };
|
||||
addLabel?: string;
|
||||
}) {
|
||||
const set = (i: number, patch: Partial<ArgRow>) => onChange(rows.map((r, j) => (j === i ? { ...r, ...patch } : r)));
|
||||
const single = (s: string) => s.replace(/[\r\n]/g, "");
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
{rows.map((r, i) => (
|
||||
<div key={i} className="flex items-center gap-1.5">
|
||||
<Input
|
||||
value={r.flag}
|
||||
onChange={(e) => set(i, { flag: single(e.target.value) })}
|
||||
placeholder={(i === 0 ? placeholder : GENERIC).flag}
|
||||
spellCheck={false}
|
||||
aria-label={`Argument ${i + 1} flag`}
|
||||
className="font-mono text-xs md:text-xs"
|
||||
/>
|
||||
<Input
|
||||
value={r.value}
|
||||
onChange={(e) => set(i, { value: single(e.target.value) })}
|
||||
placeholder={(i === 0 ? placeholder : GENERIC).value}
|
||||
spellCheck={false}
|
||||
aria-label={`Argument ${i + 1} value`}
|
||||
className="font-mono text-xs md:text-xs"
|
||||
/>
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label={`Remove argument ${i + 1}`} onClick={() => onChange(rows.filter((_, j) => j !== i))}>
|
||||
<XIcon />
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
<Button type="button" variant="outline" size="sm" className="self-start" onClick={() => onChange([...rows, { flag: "", value: "" }])}>
|
||||
<PlusIcon />
|
||||
{addLabel}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
import type { ResourceStats } from "@/lib/db/schema";
|
||||
import { formatBytes } from "@/lib/format";
|
||||
|
||||
const cores = (v: number | null) => (v == null ? "—" : v.toFixed(v >= 10 ? 0 : 1));
|
||||
const mib = (v: number | null | undefined) => (v == null ? "—" : formatBytes(v * 2 ** 20));
|
||||
const round = (v: number | null | undefined, unit: string) => (v == null ? "—" : `${Math.round(v)}${unit}`);
|
||||
|
||||
function Cell({ label, value, note }: { label: string; value: string; note?: string }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-0.5 rounded-lg bg-muted/50 px-3 py-2">
|
||||
<span className="text-[11px] tracking-wide text-muted-foreground uppercase">{label}</span>
|
||||
<span className="text-lg font-semibold">{value}</span>
|
||||
{note && <span className="text-[11px] text-muted-foreground">{note}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Resource use sampled during a run: per deployment (A/B: both sides) and per GPU. */
|
||||
export function BenchmarkResources({ stats, names }: { stats: ResourceStats; names?: { a: string; b?: string } }) {
|
||||
if (stats.samples === 0 && stats.gpus.length === 0) return <p className="text-sm text-muted-foreground">No resource samples were recorded.</p>;
|
||||
const multi = stats.containers.length > 1;
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
{stats.containers.map((c) => (
|
||||
<div key={c.side} className="flex flex-col gap-1.5">
|
||||
{multi && <span className="text-xs font-medium">{c.side === "a" ? `A · ${names?.a ?? ""}` : `B · ${names?.b ?? ""}`}</span>}
|
||||
<div className="grid gap-2 sm:grid-cols-3">
|
||||
<Cell label="CPU, average" value={`${cores(c.cpuAvg)} cores`} note={`peak ${cores(c.cpuPeak)} cores`} />
|
||||
<Cell
|
||||
label="RAM, peak"
|
||||
value={c.memPeakBytes != null ? formatBytes(c.memPeakBytes) : "—"}
|
||||
note={`average ${c.memAvgBytes != null ? formatBytes(c.memAvgBytes) : "—"}${c.memLimitBytes ? ` · limit ${formatBytes(c.memLimitBytes)}` : ""}`}
|
||||
/>
|
||||
{c.memPeakBytes != null && c.memLimitBytes ? (
|
||||
<Cell label="Of the limit" value={`${Math.round((c.memPeakBytes / c.memLimitBytes) * 100)}%`} note="peak RAM ÷ memory limit" />
|
||||
) : (
|
||||
<Cell label="Of the limit" value="—" note="no memory limit set" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{stats.gpus.map((g) => (
|
||||
<div key={g.index} className="flex flex-col gap-1.5">
|
||||
<span className="text-xs font-medium">
|
||||
GPU {g.index} · {g.name}
|
||||
</span>
|
||||
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<Cell label="VRAM, peak" value={mib(g.vramPeakMb)} note={`of ${mib(g.vramTotalMb)} · average ${mib(g.vramAvgMb)}`} />
|
||||
<Cell label="Utilization" value={round(g.utilAvg, "%")} note={g.utilPeak != null ? `average · peak ${round(g.utilPeak, "%")}` : "not reported"} />
|
||||
<Cell label="Power" value={round(g.powerAvgW, " W")} note={g.powerPeakW != null ? `average · peak ${round(g.powerPeakW, " W")}` : "not reported"} />
|
||||
<Cell label="Temperature" value={round(g.tempAvgC, " °C")} note={g.tempPeakC != null ? `average · peak ${round(g.tempPeakC, " °C")}` : "not reported"} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
Sampled every ~2 s over {stats.seconds} s ({stats.samples} samples). RAM is the container's usage without page cache, like <code>docker stats</code>; GPU
|
||||
figures are for the whole GPU, so other work on it counts too.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { LoaderCircleIcon } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const STYLE: Record<string, { label: string; className: string }> = {
|
||||
stopped: { label: "stopped", className: "border-foreground/15 text-muted-foreground" },
|
||||
starting: { label: "starting", className: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300" },
|
||||
running: { label: "running", className: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" },
|
||||
stopping: { label: "stopping", className: "border-foreground/15 text-muted-foreground" },
|
||||
failed: { label: "failed", className: "border-destructive/30 bg-destructive/10 text-destructive" },
|
||||
};
|
||||
|
||||
/** Deployment state; shows "starting" as soon as a start was requested. */
|
||||
export function DeploymentStateBadge({ state, desiredState, className }: { state: string; desiredState: string; className?: string }) {
|
||||
const effective = desiredState === "running" && (state === "stopped" || state === "failed") ? "starting" : desiredState === "stopped" && (state === "running" || state === "starting") ? "stopping" : state;
|
||||
const s = STYLE[effective] ?? STYLE.stopped;
|
||||
return (
|
||||
<span className={cn("inline-flex h-5 shrink-0 items-center gap-1 rounded-4xl border px-2 text-xs font-medium whitespace-nowrap", s.className, className)}>
|
||||
{(effective === "starting" || effective === "stopping") && <LoaderCircleIcon className="size-3 animate-spin" />}
|
||||
{effective === "running" && <span className="size-1.5 rounded-full bg-emerald-500" />}
|
||||
{s.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { BotIcon } from "lucide-react";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** "requested by hermes": added or downloaded through the API with that token. */
|
||||
export function RequestedByBadge({ name, className }: { name: string | null | undefined; className?: string }) {
|
||||
if (!name) return null;
|
||||
return (
|
||||
<Badge variant="outline" className={cn("gap-1 font-normal", className)} title={`Requested through the API with the token "${name}"`}>
|
||||
<BotIcon className="size-3" />
|
||||
{name}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { BotIcon, BoxesIcon, CpuIcon, KeyRoundIcon, LogOutIcon, MonitorIcon, MoonIcon, SunIcon, TagIcon, TagsIcon } from "lucide-react";
|
||||
import { DownloadIcon, LogOutIcon, MonitorIcon, MoonIcon, SunIcon, TagIcon, TagsIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useTheme } from "next-themes";
|
||||
import { useTransition } from "react";
|
||||
@@ -67,21 +67,9 @@ export function UserMenu({ user, signOutAction }: { user: MenuUser; signOutActio
|
||||
<TagsIcon />
|
||||
Tags
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem render={<Link href="/settings/runtimes" />}>
|
||||
<BoxesIcon />
|
||||
Runtimes
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem render={<Link href="/settings/hardware" />}>
|
||||
<CpuIcon />
|
||||
Hardware
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem render={<Link href="/settings/api-keys" />}>
|
||||
<KeyRoundIcon />
|
||||
Runtime API keys
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem render={<Link href="/settings/api-tokens" />}>
|
||||
<BotIcon />
|
||||
API tokens
|
||||
<DropdownMenuItem render={<Link href="/settings/downloads" />}>
|
||||
<DownloadIcon />
|
||||
Downloads
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
Reference in new issue
Block a user