import { type AuthPredicate, type FilterAst, type HttpMethod, type JsonSchema, type LifecycleHook, type LinkResult, type LinkedManifestSet, type ProcedureManifest, type SchemaManifest, type TriggerManifest, type ViewManifest } from "@aotter/mantle-spec"; /** * Bump when the runtime's interpretation of a sealed plan changes, so a plan * generated by an older `mantle generate` fails closed instead of running * with stale semantics. v2: public Views over publishing Schemas carry the * published-only predicate and native column names are reserved (#1007, * #1008); a v1 artifact has neither. */ export declare const RUNTIME_PLAN_VERSION: 2; export interface RuntimeSchemaPlan { readonly name: string; readonly manifest: SchemaManifest; readonly translationParent?: string; } export interface AuthorizationPlan { readonly all: readonly AuthPredicate[]; } export interface RuntimeProcedurePlan { readonly name: string; readonly manifest: ProcedureManifest; readonly authorization?: AuthorizationPlan; readonly guard?: string; readonly builtinSchema?: string; readonly collectionActionSchema?: string; } export type LogicalViewPlan = { readonly kind: "declarative"; readonly from: string; readonly fields?: readonly string[]; readonly filter?: FilterAst; readonly orderBy: readonly { readonly field: string; readonly direction: "asc" | "desc"; }[]; readonly limit?: number; readonly params?: JsonSchema; } | { readonly kind: "native"; readonly dialect: "sqlite"; readonly statement: string; readonly limit?: number; readonly params?: JsonSchema; }; export interface RuntimeViewPlan { readonly name: string; readonly manifest: ViewManifest; readonly query: LogicalViewPlan; readonly authorization?: AuthorizationPlan; readonly guard?: string; } export interface RuntimeTriggerPlan { readonly name: string; readonly manifest: TriggerManifest; readonly target: string; readonly lifecycleSchema?: string; } export interface LifecycleHookPlan { readonly schema: string; readonly hook: LifecycleHook; readonly triggerNames: readonly string[]; } export interface HttpRoutePlan { readonly trigger: string; readonly method: HttpMethod; readonly path: string; readonly procedure: string; } interface McpToolPlanBase { readonly name: string; readonly ownerName: string; readonly surface: "staff" | "public"; } export type McpToolPlan = McpToolPlanBase & ({ readonly ownerKind: "Schema" | "View"; } | { readonly ownerKind: "Procedure"; readonly trigger: string; }); declare const runtimePlanBrand: unique symbol; export interface RuntimePlanData { readonly version: typeof RUNTIME_PLAN_VERSION; readonly semanticFingerprint: string; readonly schemas: Readonly>; readonly views: Readonly>; readonly procedures: Readonly>; readonly triggers: Readonly>; readonly lifecycleHooks: readonly LifecycleHookPlan[]; readonly httpRoutes: readonly HttpRoutePlan[]; readonly mcpTools: readonly McpToolPlan[]; } export interface RuntimePlan extends RuntimePlanData { readonly [runtimePlanBrand]: true; } export type CompileResult = LinkResult; /** Pure projection from sealed semantics to the adapter-neutral runtime contract. */ export declare function compileRuntimePlan(linked: LinkedManifestSet): CompileResult; /** Restore the brand and immutability of a generated, JSON-safe plan. */ export declare function sealRuntimePlan(data: RuntimePlanData): RuntimePlan; /** The predicate a public View over a `publishing` Schema always carries. */ export declare const PUBLISHED_ONLY_FILTER: FilterAst; /** * Compile a View manifest into the storage-neutral query plan every adapter * executes. `from` is the View's source Schema when it is declarative. * * Public Views over a `publishing` Schema are fail-closed: the plan carries * `status = published` whether or not the author wrote it (#1007). The * handbook promises drafts are unreadable until published; that promise * cannot depend on an author remembering a filter. Staff Views and * `operational` Schemas (rows are created published) are untouched. */ export declare function compileLogicalView(view: ViewManifest, from?: SchemaManifest): LogicalViewPlan; /** @internal exported for the stale-plan regression test. */ export declare function semanticFingerprint(value: unknown): string; export {}; //# sourceMappingURL=RuntimePlanCompiler.d.ts.map