Release 0.13.0: agent API for deployments and benchmarks
Release / release (push) Successful in 3m0s
Release / release (push) Successful in 3m0s
Scopes deployments:read/write and benchmarks:read/run; /api/v1 endpoints for runtimes, deployments (create with dry run, edit, start, stop, delete own ones), benchmark runs, A/B, sweeps and comparisons; ?wait= on all status endpoints. Guardrails: approval, agent deployments at once, one GPU job at a time, time limits, sweep variants, runtime and argument allowlists, host port range, memory/CPU caps, protected deployments with a VRAM check. Requested-by filters, approval bars, per-token activity log, scope editing, docs/agent/SKILL-tuning.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e007a35143
commit
716bd8f2f0
62 files changed
+6091
-219
No files matched your search
@@ -3,6 +3,7 @@ import { eq } from "drizzle-orm";
|
||||
import { db } from "@/lib/db/client";
|
||||
import { type HardwareOverrides, settings } from "@/lib/db/schema";
|
||||
import { APPROVAL_MODES, type Guardrails, parseGuardrails } from "@/lib/agent-guardrails";
|
||||
import { parseTuning, TUNING_KEY, type TuningGuardrails } from "@/lib/agent-tuning";
|
||||
import { isLabelColor } from "@/lib/colors";
|
||||
import { HARDWARE_OVERRIDES_KEY, HardwareOverrideError, parseOverrides, validateOverrides } from "@/lib/hardware";
|
||||
import { FILE_ROLE_ORDER, FILE_ROLES, type FileRole, type FileRoleStyles } from "@/lib/file-roles";
|
||||
@@ -138,3 +139,32 @@ export async function saveHardwareOverrides(input: unknown): Promise<HardwareOve
|
||||
else await write(HARDWARE_OVERRIDES_KEY, next);
|
||||
return next;
|
||||
}
|
||||
|
||||
/** Limits for deployments and benchmarks requested through the API (Settings → API tokens). */
|
||||
export async function getTuning(): Promise<TuningGuardrails> {
|
||||
return parseTuning(await read<unknown>(TUNING_KEY));
|
||||
}
|
||||
|
||||
export async function saveTuning(input: Partial<TuningGuardrails>): Promise<TuningGuardrails> {
|
||||
const next = { ...(await getTuning()), ...input };
|
||||
if (!APPROVAL_MODES.includes(next.approvalMode)) throw new SettingsError(`Approval mode must be one of: ${APPROVAL_MODES.join(", ")}.`);
|
||||
const intIn = (v: number, min: number, max: number, what: string) => {
|
||||
if (!Number.isInteger(v) || v < min || v > max) throw new SettingsError(`${what} must be ${min}–${max}.`);
|
||||
};
|
||||
intIn(next.maxAgentDeployments, 1, 16, "Agent deployments at once");
|
||||
intIn(next.maxRunMinutes, 1, 24 * 60, "Max minutes per run");
|
||||
intIn(next.maxSweepMinutes, 1, 7 * 24 * 60, "Max minutes per sweep");
|
||||
intIn(next.maxSweepVariants, 2, 16, "Max sweep variants");
|
||||
const r = next.hostPortRange;
|
||||
if (r && (!Number.isInteger(r.from) || !Number.isInteger(r.to) || r.from < 1024 || r.to > 65_535 || r.from > r.to)) {
|
||||
throw new SettingsError("Host port range must be within 1024–65535, from ≤ to.");
|
||||
}
|
||||
if (next.maxMemoryMb != null && !(next.maxMemoryMb >= 256)) throw new SettingsError("Memory cap must be at least 256 MiB, or empty.");
|
||||
if (next.maxCpus != null && !(next.maxCpus >= 0.1)) throw new SettingsError("CPU cap must be at least 0.1 cores, or empty.");
|
||||
const parsed = parseTuning(next);
|
||||
for (const engine of ["llama.cpp", "vllm"] as const) {
|
||||
if (parsed.allowedArgs[engine].length !== new Set(next.allowedArgs[engine]).size) throw new SettingsError(`The ${engine} argument allowlist contains something that isn't a flag.`);
|
||||
}
|
||||
await write(TUNING_KEY, parsed);
|
||||
return parsed;
|
||||
}
|
||||
Reference in new issue
Block a user