/** * Structured-clone message protocol between the main thread (SandboxRunner) * and the sandbox Web Worker. Keep this file dependency-free — it is shared * by both bundles and by the Node test harness. */ import type { Bar, CompileMeta } from "../engine/types"; export type ToWorker = | { type: "compile"; reqId: number; source: string } | { type: "run"; reqId: number; bars: Bar[]; inputs: Record } | { type: "runIncremental"; reqId: number; bars: Bar[]; inputs: Record }; export type FromWorker = | { type: "compiled"; reqId: number; meta: CompileMeta; capabilities: { incremental: boolean } } | { type: "compileError"; reqId: number; line?: number; message: string } | { type: "result"; reqId: number; plots: Record; alerts: Record; warnings: string[] } | { type: "runError"; reqId: number; message: string };