File size: 1,749 Bytes
e1e33d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
}