trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
34 lines • 1.51 kB
TypeScript
/**
* Ontology Validation — Schema enforcement for graph mutations.
*
* Provides both standalone validation (check existing entities against schemas)
* and a kernel middleware that rejects mutations violating ontology constraints.
*
* @module trellis/core/ontology
*/
import type { EAVStore } from '../store/eav-store.js';
import type { KernelMiddleware } from '../kernel/middleware.js';
import type { OntologyRegistry } from './registry.js';
import type { ValidationResult } from './types.js';
/**
* Validate a single entity against the ontology registry.
*/
export declare function validateEntity(entityId: string, store: EAVStore, registry: OntologyRegistry): ValidationResult;
/**
* Validate all entities in the store against the ontology registry.
*/
export declare function validateStore(store: EAVStore, registry: OntologyRegistry): ValidationResult;
/**
* Creates a kernel middleware that validates mutations against the ontology.
*
* - On `addFacts`: validates that new facts conform to attribute definitions
* - On `addLinks`: validates that links conform to relation definitions
* - Blocks operations that would create invalid data (throws on error)
*
* @param registry The ontology registry to validate against
* @param strict If true, unknown entity types cause errors (default: false = warnings only)
*/
export declare function createValidationMiddleware(registry: OntologyRegistry, options?: {
strict?: boolean;
}): KernelMiddleware;
//# sourceMappingURL=validator.d.ts.map