/** * Deterministic integrity checking for OpenLore's on-disk governance corpus. * (change: add-knowledge-corpus-integrity) * * The evaluator is deliberately split from discovery. `evaluateCorpusGraph` is a * pure typed-graph pass (and is useful to callers that already have the corpus in * memory); `detectCorpusIntegrity` only reads the stores and OpenSpec tree before * invoking it. Neither path writes, calls a model, or uses the network. */ import type { PendingDecision, StructuralAnchor } from '../../types/index.js'; import type { GovernanceFinding } from '../services/mcp-handlers/enforcement-policy.js'; export declare const CORPUS_ARTIFACT_TYPES: readonly ["requirement", "decision", "spec-domain", "change-delta", "memory", "symbol", "file", "proposal"]; export type CorpusArtifactType = (typeof CORPUS_ARTIFACT_TYPES)[number]; export declare const CORPUS_EDGE_KINDS: readonly ["spec-cites-decision", "spec-cites-requirement", "proposal-cites-decision", "proposal-cites-requirement", "decision-supersedes", "change-delta-targets-domain", "memory-cites-decision", "memory-anchors-symbol", "spec-anchors-symbol"]; export type CorpusEdgeKind = (typeof CORPUS_EDGE_KINDS)[number]; /** Edge kinds emitted by each independent on-disk discovery path. */ export declare const CORPUS_DISCOVERY_EDGE_KINDS: { readonly requirementLines: readonly ["spec-cites-decision", "spec-cites-requirement", "spec-anchors-symbol"]; readonly proposalLines: readonly ["proposal-cites-decision", "proposal-cites-requirement"]; readonly decisionRecords: readonly ["decision-supersedes"]; readonly changeDeltas: readonly ["change-delta-targets-domain"]; readonly memoryRecords: readonly ["memory-cites-decision", "memory-anchors-symbol"]; }; export interface CorpusEdgeSpec { sourceArtifactType: CorpusArtifactType; targetRange: readonly CorpusArtifactType[]; directional: boolean; mayCycle: boolean; liveSourceMayReferenceRetiredTarget: boolean; } /** The closed, source-declared contract for every supported corpus edge. */ export declare const CORPUS_EDGE_REGISTRY: Record; export declare const CORPUS_FINDING_CODES: readonly ["corpus-reference-unresolved", "corpus-reference-ambiguous", "corpus-self-reference", "corpus-duplicate-identifier", "corpus-edge-unsupported", "corpus-target-type-mismatch", "corpus-target-retired", "corpus-supersession-cycle", "corpus-anchor-target-missing", "corpus-reference-undeclared"]; export type CorpusFindingCode = (typeof CORPUS_FINDING_CODES)[number]; export declare const CORPUS_RESOURCE_LIMITS: { readonly fileBytes: number; readonly totalBytes: number; readonly directoryEntries: 20000; readonly artifacts: 100000; readonly edges: 250000; readonly findings: 100000; readonly mentionPairs: 25000000; }; export interface CorpusArtifact { /** Unique internal key; unlike `identifier`, this never participates in resolution. */ key: string; type: CorpusArtifactType; /** The exact externally referenced identifier (decision id, requirement name, domain, and so on). */ identifier: string; path: string; /** Requirement identities are scoped to their spec domain. Other identities are global. */ identityScope?: string; text?: string; live?: boolean; retiredBy?: string; } export interface CorpusEdge { /** Kept open at the input boundary so an undeclared kind produces a finding, not a cast failure. */ kind: string; sourceKey: string; /** The reference exactly as written in the source artifact. */ reference: string; /** For structured anchors, discovery can prove absence without inventing a target artifact. */ anchorMissing?: boolean; /** Discovery-only hint retained from an explicit Symbol/File anchor line. */ anchorTargetType?: 'symbol' | 'file'; } export interface CorpusGraph { artifacts: readonly CorpusArtifact[]; edges: readonly CorpusEdge[]; } /** Return every member of every decision-supersession cycle, in stable order. */ export declare function supersessionCycleMembers(graph: CorpusGraph): string[]; /** Pure, deterministic validation over a fully discovered graph. */ export declare function evaluateCorpusGraph(graph: CorpusGraph): GovernanceFinding[]; export interface DurableDecision { decision: PendingDecision; path: string; text: string; statusError?: string; } /** * Read the durable decision corpus once for lifecycle-aware consumers. Synced * decisions may be projected into several specs and an ADR; those projections * are coalesced by stable decision id, preferring the spec entry that carries * the human-visible Decisions record. Resource limits and path confinement are * the same as the governance-corpus integrity pass. */ export declare function loadDurableDecisionCorpus(rootPath: string, openspecPath?: string): Promise; /** All durable projections, retained for consumers that must detect conflicts. */ export declare function loadDurableDecisionProjections(rootPath: string, openspecPath?: string): Promise; export interface DetectCorpusIntegrityOptions { openspecPath?: string; /** `false` proves absence, `true` proves presence, `undefined` means the graph cannot decide. */ anchorExists?: (anchor: StructuralAnchor) => boolean | undefined | Promise; } /** Read the existing stores/OpenSpec tree and evaluate them without modifying any bytes. */ export declare function detectCorpusIntegrity(rootPath: string, options?: DetectCorpusIntegrityOptions): Promise; //# sourceMappingURL=corpus-integrity.d.ts.map