/** * MEL Text Ingest API * * Compiles MEL text to DomainSchema or RuntimeConditionalPatchOp[]. * * @see SPEC v0.4.0 §19 */ import type { Diagnostic } from "../diagnostics/types.js"; import type { DomainSchema } from "../generator/ir.js"; import type { RuntimeConditionalPatchOp } from "../lowering/lower-runtime-patch.js"; import type { DomainModule } from "../annotations.js"; /** * Trace entry for compilation steps. */ export interface CompileTrace { phase: "lex" | "parse" | "analyze" | "generate" | "lower"; durationMs: number; details?: Record; } /** * Domain compilation options. */ export interface CompileMelDomainOptions { mode: "domain"; fnTableVersion?: string; } export interface CompileMelModuleOptions { mode: "module"; fnTableVersion?: string; } /** * Domain compilation result. * * @see SPEC v0.4.0 §19.1 */ export interface CompileMelDomainResult { /** * Compiled schema, or null if errors occurred. */ schema: DomainSchema | null; /** * Compilation trace. */ trace: CompileTrace[]; /** * Warning diagnostics. */ warnings: Diagnostic[]; /** * Error diagnostics. */ errors: Diagnostic[]; } export interface CompileMelModuleResult { /** * Tooling-only compiled module, or null if errors occurred. */ module: DomainModule | null; /** * Compilation trace. */ trace: CompileTrace[]; /** * Warning diagnostics. */ warnings: Diagnostic[]; /** * Error diagnostics. */ errors: Diagnostic[]; } export type { Annotation, AnnotationIndex, DomainModule, JsonLiteral, LocalTargetKey, } from "../annotations.js"; export type { SourceMapEmissionContext, SourceMapEntry, SourceMapIndex, SourceMapPath, SourcePoint, SourceSpan, } from "../source-map.js"; /** * Patch compilation options. */ export interface CompileMelPatchOptions { mode: "patch"; /** * Action name for context. */ actionName: string; /** * Allowed dollar namespace prefixes. * Default: ["input", "runtime", "context"]. */ allowSysPaths?: { prefixes: ("input" | "runtime" | "context")[]; }; /** * Function table version. */ fnTableVersion?: string; } /** * Patch compilation result. * * @see SPEC v0.4.0 §19.2 */ export interface CompileMelPatchResult { /** * Compiled patch operations. * These still contain Core IR expressions that need evaluation. */ ops: RuntimeConditionalPatchOp[]; /** * Compilation trace. */ trace: CompileTrace[]; /** * Warning diagnostics. */ warnings: Diagnostic[]; /** * Error diagnostics. */ errors: Diagnostic[]; } /** * Compile MEL text to DomainSchema. * * Takes a complete MEL domain definition and produces a DomainSchema * suitable for use with core.compute(). * * @param melText - MEL domain source text * @param options - Compilation options * @returns Compilation result with schema or errors * * @see SPEC v0.4.0 §19.1 */ export declare function compileMelDomain(melText: string, options?: CompileMelDomainOptions): CompileMelDomainResult; export declare function compileMelModule(melText: string, options?: CompileMelModuleOptions): CompileMelModuleResult; /** * Compile MEL patch text to RuntimeConditionalPatchOp[]. * * Takes MEL patch statements (set, unset, merge) and produces * RuntimeConditionalPatchOp[] with Core IR expressions. * * The returned ops still contain expressions that need to be evaluated * by evaluateRuntimePatches() to get concrete values. * * Constraints: * - ADR-027: `$system.*` and `$meta.*` are retired in current v5 MEL. * * @param melText - MEL patch source text * @param options - Compilation options * @returns Compilation result with ops or errors * * @see SPEC v0.4.0 §19.2 */ export declare function compileMelPatch(melText: string, options: CompileMelPatchOptions): CompileMelPatchResult;