/** * The enrolment-capability gate: `requires` predicates. * * A vocab role's `requires` list is the REGISTRY GATE — it decides WHO may fill * the role based on the declared enrolment capability (cognition / weight / * family / host). It is deliberately NOT part of the routing token: capability * never rides the token (S0 invariant 3); it gates enrolment here. * * Each `requires` entry is a single predicate over one capability field: * * predicate = field op value * field = cognition | weight | family | host * op = "=" | "==" | "!=" | ">=" | "<=" | ">" | "<" * * Ordering/numeric operators (`>=`, `<=`, `>`, `<`) apply to `weight` only (the * one numeric capability field); the string fields support only `=`/`==`/`!=`. * A role with no `requires` (or an empty list) is open to any capability. * * Match semantics are FAIL-CLOSED for a gate: an absent field fails every * positive predicate (`=`,`==`,`>=`,`<=`,`>`,`<`); only `!=` is satisfied by an * absent field (the worker's field is provably not the forbidden value). A * capability satisfies a role iff it satisfies EVERY predicate. */ import type { Capability } from "../protocol/index.ts"; /** The capability fields a `requires` predicate may gate on. */ export declare const REQUIRES_FIELDS: readonly ["cognition", "weight", "family", "host"]; export type RequiresField = (typeof REQUIRES_FIELDS)[number]; export type RequiresOp = "=" | "==" | "!=" | ">=" | "<=" | ">" | "<"; export interface RequiresPredicate { readonly field: RequiresField; readonly op: RequiresOp; /** The compared value: a number for `weight`, a string otherwise. */ readonly value: string | number; /** The original source text, for diagnostics. */ readonly source: string; } /** Raised when a `requires` entry is not a well-formed predicate. */ export declare class RequiresParseError extends Error { readonly source: string; constructor(source: string, detail: string); } /** Parse one `requires` entry into a predicate, or throw {@link RequiresParseError}. */ export declare function parseRequires(source: string): RequiresPredicate; /** Parse every entry of a role's `requires` list. */ export declare function parseRequiresList(requires: readonly string[] | undefined): RequiresPredicate[]; /** True when `capability` satisfies a single predicate (fail-closed on absent fields). */ export declare function satisfiesPredicate(predicate: RequiresPredicate, capability: Capability): boolean; /** True when `capability` satisfies EVERY predicate (an empty list is open). */ export declare function satisfiesRequires(predicates: readonly RequiresPredicate[], capability: Capability): boolean;