Skip to main content

resolve_gates

Function resolve_gates 

Source
pub fn resolve_gates(
    names: &[String],
    defs: &[GateDef],
    registry: &ProviderRegistry,
    auth: &Auth,
    prices: &PriceTable,
) -> Vec<Box<dyn Gate>>
Expand description

Resolve a route’s gate ids into runnable gates. Built-in ids (non-empty, json-valid) map to inline gates; any other id is looked up among the config’s [[gate]] definitions and built as a SubprocessGate (cmd, SPEC §8.1), a JudgeGate (judge, §8.3), a ConsistencyGate (consistency), or a SchemaGate (schema). Model-backed gates (judge/consistency) need a provider (from registry), the caller’s credentials (auth, BYOK), and prices so their sample-call cost lands on the receipt. An id that is neither built-in nor defined — or a model gate whose provider isn’t registered — is skipped with a warning rather than failing the request. A def with on_abstain = "fail_closed" is wrapped so its abstains block serving.