import type { Pipeline } from "./types"; export type SandboxLogLevel = "info" | "warn" | "ok"; export type SandboxLogLine = { atMs: number; text: string; level: SandboxLogLevel }; // Hard ceiling on a test run โ€” a real GPU-backed run would be expected to // finish (or be killed) inside this budget; the simulated script below runs // well under it. export const TEST_RUN_BUDGET_MS = 180_000; export function buildSimulatedRunScript(pipeline: Pipeline, targetLabel: string): SandboxLogLine[] { const lines: SandboxLogLine[] = []; let t = 0; const push = (text: string, level: SandboxLogLevel = "info", gap = 1300) => { t += gap; lines.push({ atMs: t, text, level }); }; push(`Provisioning NVIDIA GPU (simulated) for ${targetLabel}...`); push( "No live NIM/GPU endpoint is wired up yet for execution โ€” this run is a scripted simulation, not real inference.", "warn", 1000, ); push("Allocated: 1x simulated L40S (48GB) โ€” sized against this pipeline's VRAM budget."); pipeline.nodes.forEach((n) => { const impl = n.implementations[0]; push(`[${n.category}] loading ${n.label}${n.confidence === "inferred" ? " (inferred config)" : ""}...`); if (impl) push(` runtime: ${impl.runtime ?? "n/a"} ยท precision: ${impl.precision ?? "n/a"}`, "info", 650); push(` ${n.label} ready.`, "ok", 850); }); push("Running scripted smoke pass across all stage handoffs...", "info", 1500); push("Simulated turn: ASR -> LLM -> TTS -> Avatar handoffs all resolved.", "ok", 1700); push( `Simulated run complete in ~${(t / 1000).toFixed(0)}s (budget: ${TEST_RUN_BUDGET_MS / 1000}s). Wire a real NIM/GPU endpoint to replace this with live inference.`, "ok", 1100, ); return lines; }