/** * Runtime Context Factory * * Creates and configures the runtime context for script execution. * Public API for host applications. */ import type { RuntimeContext, RuntimeOptions } from './types/runtime.js'; import type { RillValue } from './types/structures.js'; /** * Tag a rejection reason so a tracked fire-and-forget body's halt is * surfaced at `dispose()` instead of swallowed. Returns the same * reason. Non-object reasons (and frozen objects) pass through * unmarked, which simply means they are not surfaced — never an error. * * Used by the `pass` dispatch path in `literals.ts`, which * hands the marked, rejected body promise to {@link RuntimeContext.trackInflight}. */ export declare function markDeferredHalt(reason: unknown): unknown; export declare const UNVALIDATED_METHOD_PARAMS: Set; /** * Create a runtime context for script execution. * This is the main entry point for configuring the Rill runtime. */ export declare function createRuntimeContext(options?: RuntimeOptions): RuntimeContext; /** * Create a child context for block scoping. * Child inherits parent's functions, methods, callbacks, etc. * but has its own variables map. Variable lookups walk the parent chain. * * Child contexts inherit the parent's lifecycle state (disposed flag, * chained signal, and dispose promise) by reference so a single * `dispose()` call cascades across the entire scope tree. */ export declare function createChildContext(parent: RuntimeContext, overrides?: { sourceId?: string; sourceText?: string; /** * Share the parent's own variables/variableTypes maps instead of * allocating fresh ones. Used for the per-statement child contexts in * `evaluateBlockBody`, where every capture must be visible to later * siblings and same-block re-captures must read as an own-scope * reassignment rather than an outer-scope write. */ variables?: Map; variableTypes?: Map; }): RuntimeContext; /** * Get a variable value, walking the parent chain. * Returns undefined if not found in any scope. * * Thin wrapper delegating to the ScopeContext method. */ export declare function getVariable(ctx: RuntimeContext, name: string): RillValue | undefined; /** * Check if a variable exists in any scope. * * Thin wrapper delegating to the ScopeContext method. */ export declare function hasVariable(ctx: RuntimeContext, name: string): boolean; /** * Extract call stack from RuntimeError. * Returns empty array if no call stack attached. * * Constraints: * - O(1) access (stored on error instance) * - Returns defensive copy (immutable) */ export declare function getCallStack(error: import('../../types.js').RillError): readonly import('../../types.js').CallFrame[]; /** * Push frame onto call stack before function/closure execution. * * Constraints: * - Stack depth limited by maxCallStackDepth option * - Older frames dropped when limit exceeded */ export declare function pushCallFrame(ctx: RuntimeContext, frame: import('../../types.js').CallFrame): void; /** * Pop frame from call stack after function/closure returns. */ export declare function popCallFrame(ctx: RuntimeContext): void;