/** * @medicine-wheel/relational-query — Protocol Guards * * Avoidance protocols expressed as code logic: conditional edge filters * evaluated BEFORE a traversal crosses a relation. A guard does not veto at * inference time — when a boundary is reached it returns an escalation * directive (delegate to a qualified custodian), the "in-the-loop" pattern. * * Built-in guards reproduce the former `respectCeremonyBoundaries` and * `ocapOnly` booleans; the avoidance-protocol guard reads the optional * `RelationContext` carried by a first-class Relation. */ import type { Relation, RelationalEdge } from '@medicine-wheel/ontology-core'; /** Runtime context an agent/being presents when traversing the kinship graph. */ export interface TraversalContext { /** Identity of the being attempting traversal (matched against authorized_kin). */ identity?: string; /** Current ceremony state / scope (matched against relation.context.active_context). */ ceremonyState?: string; /** Free-form additional context for custom guards. */ [key: string]: unknown; } /** The decision a guard returns for a single edge crossing. */ export interface GuardDecision { allowed: boolean; /** When blocked, who to escalate to — delegation, not a veto. */ escalateTo?: string; /** Human-readable reason. */ reason?: string; } /** * A protocol guard: a conditional edge filter evaluated before traversal. * Receives the edge, its first-class Relation (if one is mapped), and the * runtime context; returns whether the edge may be crossed. */ export interface ProtocolGuard { name: string; evaluate(edge: RelationalEdge, relation: Relation | undefined, context: TraversalContext): GuardDecision; } /** A boundary a guard refused to cross, surfaced for delegation. */ export interface GuardEscalation { fromId: string; toId: string; /** Name of the guard that blocked the crossing. */ guard: string; reason?: string; escalateTo?: string; } /** Stop at edges that have not been honored through ceremony. */ export declare const ceremonyBoundaryGuard: ProtocolGuard; /** Only follow OCAP®-compliant relations; edges with no mapped relation are open. */ export declare const ocapComplianceGuard: ProtocolGuard; /** * The avoidance protocol. A relation that carries a `context` is traversable * only when (a) its `active_context` matches the runtime ceremony state and * (b) the traversing identity is among `authorized_kin`. On failure it does * not block silently — it escalates to `authorized_by` (or a qualified * custodian). Relations with no declared context are open. */ export declare const avoidanceProtocolGuard: ProtocolGuard; /** * Evaluate a stack of guards against one edge crossing. The first guard that * blocks wins; if every guard allows, the crossing is permitted. */ export declare function evaluateGuards(guards: ProtocolGuard[], edge: RelationalEdge, relation: Relation | undefined, context: TraversalContext): { decision: GuardDecision; guard?: string; }; //# sourceMappingURL=guards.d.ts.map