pub struct GateDef {
pub id: String,
pub cmd: Vec<String>,
pub timeout_ms: u64,
pub judge: Option<JudgeDef>,
pub consistency: Option<ConsistencyDef>,
pub schema: Option<Value>,
pub decision: Option<DecisionDef>,
pub on_abstain: AbstainPolicy,
}Expand description
A user-defined gate (SPEC §8.1). Exactly one kind per definition:
- subprocess (
cmd): any executable that reads the candidate as JSON on stdin (never argv — injection-resistant) and emits{"verdict":"pass|fail|abstain", ...}on stdout. - judge (
judge): a native LLM-judge gate that grades the candidate against a rubric. - consistency (
consistency): a self-consistency uncertainty gate that scores the candidate by agreement with k fresh samples of the same model (Wang et al. 2022). - schema (
schema): validates the candidate (parsed as JSON) against a JSON-Schema subset (top-leveltype/required/ per-propertytype). - decision (
decision): a cheap external decision-model verifier (TypeSafe’s Jev) that answers a single yes/no “does this response satisfy the request?” question. Unmeasured: its precision/recall against real failures has not been benchmarked.
Fields§
§id: StringThe id a route references this gate by (must be unique and not shadow a built-in gate id).
cmd: Vec<String>Subprocess command: program first, then its args — e.g. ["pytest", "-q"]. Set this or
judge / consistency / schema / decision, not both.
timeout_ms: u64Hard timeout in milliseconds for a subprocess gate; it abstains (timeout) if the process
runs longer.
judge: Option<JudgeDef>LLM-judge configuration. Set this or cmd / consistency / schema / decision,
not both.
consistency: Option<ConsistencyDef>Self-consistency configuration. Set this or cmd / judge / schema / decision,
not both.
schema: Option<Value>JSON-Schema (subset) the candidate must satisfy. Set this or cmd / judge /
consistency / decision, not both.
decision: Option<DecisionDef>TypeSafe Jev decision-model configuration. Set this or cmd / judge / consistency
/ schema, not both.
on_abstain: AbstainPolicyWhat an abstain from this gate means for serving (§7.2). fail_open (default): an
abstaining gate never blocks serving — availability over strictness, today’s behavior.
fail_closed: an abstain blocks serving exactly like a Fail — strictness over
availability, for gates whose silence must never be mistaken for approval.