puck / frontend /src /lib /molt.ts
vu1n's picture
Puck β€” desktop fairy familiar (HF Build Small)
3c124f3
Raw
History Blame Contribute Delete
980 Bytes
// Molt readiness β€” how Puck's learning actually accumulates. The daemon counts
// the rated traces collected so far against the threshold for the next adapter
// "molt". Night Bloom shows this so sleep reflects real progress, not theatre.
// Null when the daemon is down (Space/demo mode) β€” the screen just omits the gauge.
export interface MoltStatus {
/** rated traces accumulated server-side (server/data/traces.jsonl) */
traces: number;
/** traces needed before a molt (LoRA retrain from base) is eligible */
threshold: number;
/** hand-built SFT examples the molt starts from */
sftBase: number;
ready: boolean;
}
export async function fetchMoltStatus(): Promise<MoltStatus | null> {
try {
const res = await fetch("/api/molt/status", { signal: AbortSignal.timeout(4000) });
if (!res.ok) return null;
return (await res.json()) as MoltStatus;
} catch {
return null; // daemon offline β€” sleep still works, just without the gauge
}
}