import { type ErrorSourceSpan } from "./error/shape.js"; import { type SourceSpan } from "./parse/parser.js"; import { type SafeJSSnapshot } from "./restore.js"; import { Budget } from "./interp/budget.js"; import { type HostCallRecord, type HostCallResumeProvider } from "./interp/host-call.js"; import { type ConsoleSink } from "./interp/globals/console-json.js"; import { type CallerInjectedBinding } from "./interp/host-bridge.js"; import { type InterpreterResult, type LoopIterationSnapshot } from "./interp/interpreter.js"; import { type ModuleRegistry } from "./modules/registry.js"; import { type OtelSink } from "./observability/otel.js"; import type { SnapshotBackend } from "./snapshot/backend.js"; export type RunOptions = { bindings?: Record; budget?: Budget; clock?: RunClock; entryPointArgs?: readonly unknown[]; filename?: string; importMeta?: Record; hostCallResumeProvider?: HostCallResumeProvider; modules?: ModuleRegistry; random?: RunRandom; randomSeed?: number; otelSink?: OtelSink; signal?: AbortSignal; snapshot?: SafeJSSnapshot; snapshotBackend?: SnapshotBackend; snapshotIntervalMs?: number; snapshotPath?: string; sink?: ConsoleSink; }; export declare class UnhandledRejectionError extends Error { readonly reason: unknown; constructor(reason: unknown, span?: ErrorSourceSpan); } export type RunSnapshot = SafeJSSnapshot & { bindings: InterpreterResult["snapshot"]["bindings"]; clock?: RunClockSnapshot; hostCalls?: HostCallRecord[]; loopIterations?: Record; pendingAwaits?: RunPendingAwaitSnapshot[]; random?: { seed: number; state: number; }; }; export type RunPendingAwaitSnapshot = { nodeId?: number; span: SourceSpan; }; export type RunClockSnapshot = { next: number; }; export type RunClock = { snapshot: () => RunClockSnapshot | undefined; }; export type RunRandom = { next: () => number; seed: number; snapshot: () => number; }; type WithRunSnapshot = TResult extends unknown ? Omit & { snapshot: RunSnapshot; } : never; export type RunResult = WithRunSnapshot; export declare function run(source: string, options?: RunOptions): Promise; export {};