/** * Manifest WASM Expression Evaluator * * Drop-in replacement for the TypeScript expression evaluator that uses * the compiled WASM module for execution. Maintains identical semantics * to the TypeScript runtime engine (src/manifest/runtime-engine.ts). * * Internal prototype only. The published package does not expose a supported * WASM surface today, so callers should expect TypeScript fallback unless * they inject their own bytes explicitly in repo/dev scenarios. */ import type { IRExpression } from '../ir.js'; import { type ConstraintPolarityOptions } from '../constraint-polarity.js'; export type { ConstraintPolarityOptions }; export type WasmStatus = 'uninitialized' | 'loading' | 'ready' | 'failed' | 'unsupported'; export interface WasmEvaluatorOptions { /** * Path to the WASM bytes, or a function returning the bytes. * If omitted, the evaluator will try to load from default locations. */ wasmBytes?: ArrayBuffer | (() => Promise); /** * If true, do not fall back to TypeScript on WASM failure. * The error will be thrown to the caller. Default: false. */ strict?: boolean; /** * If true, log debug information to the console. Default: false. */ debug?: boolean; } /** * WASM-backed expression evaluator. * * Usage: * const evaluator = new WasmExpressionEvaluator(); * await evaluator.init(); * const result = await evaluator.evaluate(expr, context); */ export declare class WasmExpressionEvaluator { private module; private status; private initPromise; private options; private hostNow; private hostUuid; constructor(options?: WasmEvaluatorOptions); /** * Initialize the WASM module. Safe to call multiple times. */ init(): Promise; private doInit; /** * Get the current status of the WASM evaluator. */ getStatus(): WasmStatus; /** * Check whether WASM is available and ready. */ isReady(): boolean; /** * Get the WASM module version string. */ getVersion(): string; /** * Set the host now() provider. * Mirrors the now() built-in semantics from the TypeScript runtime. */ setNowProvider(fn: () => number): void; /** * Set the host uuid() provider. * Mirrors the uuid() built-in semantics from the TypeScript runtime. */ setUuidProvider(fn: () => string): void; /** * Evaluate an expression. Falls back to TypeScript on WASM failure. */ evaluate(expr: IRExpression, context: Record): Promise; /** * Evaluate a constraint expression. * Returns true if the constraint passes, false otherwise. * Polarity uses explicit `failWhen` + severity (semantics.md) — never name heuristics. * Expression evaluation may use WASM when available; polarity is always applied in TS * so both evaluators agree with RuntimeEngine. */ evaluateConstraint(expr: IRExpression, context: Record, options?: ConstraintPolarityOptions): Promise; private fallbackEvaluate; } /** * Get the default WASM evaluator, creating it if necessary. */ export declare function getDefaultWasmEvaluator(): WasmExpressionEvaluator; /** * Reset the default evaluator (mainly for testing). */ export declare function resetDefaultWasmEvaluator(): void; //# sourceMappingURL=wasm-evaluator.d.ts.map