UNPKG

trellis

Version:

Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications

25 lines 1.16 kB
/** * Logic Middleware * * Evaluates computed fields (formula, rollup, ai_generated) after queries. * Projects ontology relation fields from graph links. * Runs post-query to enrich EQL binding rows with computed values. */ import type { EAVStore } from '../store/eav-store.js'; import type { KernelMiddleware } from './middleware.js'; import type { SchemaDefinition } from '../ontology/types.js'; export interface LogicMiddlewareConfig { ontologies: Map<string, SchemaDefinition>; /** Graph store for rollups and relation projection. */ getStore?: () => EAVStore; /** Resolve entity type from id when bindings omit an explicit type. */ getEntityType?: (entityId: string) => string | undefined; /** Optional AI function for ai_generated fields */ generateAiField?: (prompt: string, context: Record<string, unknown>) => Promise<string>; } /** * Creates a logic middleware that enriches query results with computed fields. * This middleware hooks into queries, not mutations. */ export declare function createLogicMiddleware(config: LogicMiddlewareConfig): KernelMiddleware; //# sourceMappingURL=logic-middleware.d.ts.map