import type { IRProgram } from "../compile/ir";
import type { RuntimeResult } from "./results.js";
import { CommandHandler, parseCommand } from "./commands.js";
export interface RunnerOptions {
    startAt: string;
    variables?: Record<string, unknown>;
    functions?: Record<string, (...args: unknown[]) => unknown>;
    handleCommand?: (command: string, parsed?: ReturnType<typeof parseCommand>) => void;
    commandHandler?: CommandHandler;
    onStoryEnd?: (payload: {
        variables: Readonly<Record<string, unknown>>;
        storyEnd: true;
    }) => void;
}
export declare class YarnRunner {
    private readonly program;
    private readonly variables;
    private readonly functions;
    private readonly handleCommand?;
    private readonly commandHandler;
    private readonly evaluator;
    private readonly onceSeen;
    private readonly onStoryEnd?;
    private storyEnded;
    private readonly nodeGroupOnceSeen;
    private readonly visitCounts;
    private pendingOptions;
    private nodeTitle;
    private ip;
    private currentNodeIndex;
    private callStack;
    currentResult: RuntimeResult | null;
    history: RuntimeResult[];
    constructor(program: IRProgram, opts: RunnerOptions);
    /**
     * Get the current node title (may resolve to a node group).
     */
    getCurrentNodeTitle(): string;
    /**
     * Resolve a node title to an actual node (handling node groups).
     */
    private resolveNode;
    /**
     * Evaluate when conditions for a node in a group.
     */
    private evaluateWhenConditions;
    /**
     * Mark a node group node as seen (for "once" condition).
     */
    private markNodeGroupOnceSeen;
    advance(optionIndex?: number): void;
    private interpolate;
    private normalizeMarkupResult;
    private resumeBlock;
    private step;
    private executeBlock;
    private filterOptions;
    private lookaheadIsEnd;
    private emit;
    /**
     * Get the current variable store (read-only view).
     */
    getVariables(): Readonly<Record<string, unknown>>;
    /**
     * Get variable value.
     */
    getVariable(name: string): unknown;
    /**
     * Set variable value.
     */
    setVariable(name: string, value: unknown): void;
}
