import { type PortableLogicPrimitiveId, type PortableLogicSupport, type PortableLogicTarget } from './codegen/portable-logic-primitives.js'; import { type CoreShapeFacts } from './core-runtime/shape-validator.js'; import type { NodeContract } from './ir/semantics/index.js'; import { type ClassSemanticFacts, type RagSemanticFacts } from './semantic-validator.js'; import type { IRNode } from './types.js'; export type KernSemanticSubstrateSource = 'codegen-from-ts' | 'native-kern'; export type KernSemanticSubstrateTarget = PortableLogicTarget; export interface KernSemanticSupport { readonly ts: PortableLogicSupport; readonly python: PortableLogicSupport; readonly go: PortableLogicSupport; } export interface KernSemanticCoreOperation { readonly id: string; readonly kind: string; readonly args: readonly string[]; readonly returns: readonly string[]; readonly lowerings: Readonly>; readonly fixtureCount: number; readonly reviewSummary: string; readonly reviewTags: readonly string[]; } export interface KernSemanticCoreType { readonly id: string; readonly name: string; readonly kind: string; readonly strict: true; readonly operations: readonly KernSemanticCoreOperation[]; } export interface KernSemanticPrimitive { readonly id: PortableLogicPrimitiveId; readonly kernName: string; readonly domain: string; readonly description: string; readonly intent: string; readonly purity: string; readonly hostPatterns: readonly string[]; readonly portabilityNotes: readonly string[]; readonly support: KernSemanticSupport; } export interface KernSemanticStdlibOperation { readonly id: string; readonly module: string; readonly method: string; readonly arity: number; readonly support: KernSemanticSupport; } export interface KernSemanticIrContract { readonly nodeType: string; readonly forbiddenRewrites: readonly string[]; readonly fixtureCount: number; } export interface KernSemanticValidationSummary { readonly total: number; readonly byRule: Readonly>; } export type KernSemanticRagAnswerReviewStatus = 'ready' | 'incomplete' | 'invalid'; export interface KernSemanticRagAnswerReviewFact { readonly pipelineName: string; readonly retrieverName: string; readonly prompt?: string; readonly answer?: string; readonly citationsRequired: boolean; readonly groundingCount: number; readonly evalCount: number; readonly evalCaseCount: number; readonly answerContractCount: number; readonly mcpRetrievalCount: number; readonly compatibleMcpRetrievalCount: number; readonly provenanceRequired: boolean; readonly provenanceComplete: boolean; readonly validationStatus: KernSemanticRagAnswerReviewStatus; readonly issues: readonly string[]; } export interface KernSemanticSubstrate { readonly schemaVersion: 1; readonly generatedBy: 'kern-semantic-substrate'; readonly source: KernSemanticSubstrateSource; readonly coreTypes: readonly KernSemanticCoreType[]; readonly coreGraphEdges: readonly { readonly from: string; readonly relation: string; readonly to: string; readonly operation?: string; readonly index?: number; }[]; readonly portablePrimitives: readonly KernSemanticPrimitive[]; readonly stdlibOperations: readonly KernSemanticStdlibOperation[]; readonly irContracts: readonly KernSemanticIrContract[]; readonly classFacts?: ClassSemanticFacts; readonly classValidationSummary?: KernSemanticValidationSummary; readonly ragFacts?: RagSemanticFacts; readonly ragValidationSummary?: KernSemanticValidationSummary; readonly ragAnswerReviewFacts?: readonly KernSemanticRagAnswerReviewFact[]; readonly coreShapeFacts?: CoreShapeFacts; } export interface BuildKernSemanticSubstrateOptions { readonly source?: KernSemanticSubstrateSource; readonly irContracts?: ReadonlyMap; readonly documentClasses?: IRNode | readonly IRNode[]; readonly includeClassValidationSummary?: boolean; readonly documentRag?: IRNode | readonly IRNode[]; readonly includeRagValidationSummary?: boolean; readonly documentShapes?: IRNode | readonly IRNode[]; } export declare function buildKernSemanticSubstrate(options?: BuildKernSemanticSubstrateOptions): KernSemanticSubstrate; export declare function lookupSemanticPrimitive(substrate: KernSemanticSubstrate, id: PortableLogicPrimitiveId): KernSemanticPrimitive; export declare function semanticPrimitiveSupportSummary(primitive: KernSemanticPrimitive, targets: readonly KernSemanticSubstrateTarget[]): string;