import type { ArrowFunctionExpression, AwaitExpression, FunctionDeclaration, FunctionExpression, ParseResult, SourceSpan } from "../parse.js";
import { type GeneratorCompletion } from "./generator.js";
import { type OtelSpan } from "../observability/otel.js";
import type { Budget } from "./budget.js";
import type { EvaluationResult } from "./exceptions.js";
import type { InterpreterError, InterpreterSnapshot, LoopIterationSnapshot } from "./interpreter.js";
import type { Scope } from "./scope.js";
import { type SandboxValue } from "./values.js";
export type InterpreterYieldPoint = {
    kind: "await" | "generator-yield" | "loop-iteration";
    nodeId?: number;
    otelSpan?: OtelSpan;
    snapshot: () => InterpreterSnapshot;
    span: SourceSpan;
};
type ResumeBreakpoint = Omit<InterpreterYieldPoint, "snapshot">;
export type AsyncInterpreterError = InterpreterError;
export type AsyncEvaluationResult = EvaluationResult<AsyncInterpreterError>;
export type AsyncEvaluationContext = {
    activeLoopIterations: Map<number, LoopIterationSnapshot>;
    budget: Budget;
    callStack: string[];
    onYield?: (yieldPoint: InterpreterYieldPoint) => void;
    rootNode?: ParseResult;
    restoredLoopIterations: Map<number, LoopIterationSnapshot>;
    scope: Scope;
    snapshot?: () => InterpreterSnapshot;
    stats: {
        currentDataSize: number;
        nodeVisits: number;
        peakDataSize: number;
    };
    microtasks: Array<() => void>;
    generatorYield?: (value?: SandboxValue, yieldNodeId?: number) => Promise<GeneratorCompletion>;
    generatorResume?: {
        sent: GeneratorCompletion[];
        yieldNodeId: number;
    };
};
export type EvaluateAsyncNode = (node: ParseResult, context: AsyncEvaluationContext) => Promise<AsyncEvaluationResult>;
export declare function emitResumeBreakpoint(context: AsyncEvaluationContext, breakpoint: ResumeBreakpoint): void;
export declare function evaluateArrowFunctionExpression(node: ArrowFunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
export declare function evaluateFunctionExpression(node: FunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
export declare function createInterpretedClosure(node: ArrowFunctionExpression | FunctionDeclaration | FunctionExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): import("./values.js").SandboxClosure;
export declare function evaluateAwaitExpression(node: AwaitExpression, context: AsyncEvaluationContext, evaluateNode: EvaluateAsyncNode): Promise<AsyncEvaluationResult>;
export declare function normalizeClosureResult(result: SandboxValue | Promise<SandboxValue> | PromiseLike<SandboxValue>, budget?: Budget): SandboxValue;
export declare function resolveClosureResult(result: SandboxValue | Promise<SandboxValue> | PromiseLike<SandboxValue>): Promise<SandboxValue>;
export {};
