Skip to main content

Crate firstpass_core

Crate firstpass_core 

Source
Expand description

§firstpass-core

The Firstpass domain contract — pure, with no I/O (no filesystem, network, clock, or env access). Everything here is deterministic so the audit hash chain and feature extraction are reproducible and testable in isolation; all I/O lives in firstpass-proxy.

This crate is the versioned thing every other component (gates, bandit, CLI, auditors) depends on. The serde field names on Trace, Config, Verdict, and friends are the wire/audit contract — see each module for the “don’t rename silently” rule.

§Modules

Re-exports§

pub use config::Budget;
pub use config::Config;
pub use config::Escalation;
pub use config::GateDef;
pub use config::JudgeDef;
pub use config::Mode;
pub use config::ModelRef;
pub use config::OnExhausted;
pub use config::Route;
pub use config::SessionPromotion;
pub use conformal::ConformalResult;
pub use conformal::calibrate;
pub use conformal::served_failure_rate;
pub use cost::ModelPrice;
pub use cost::PriceTable;
pub use error::Error;
pub use error::Result;
pub use features::FEATURE_VERSION;
pub use features::Features;
pub use features::TaskKind;
pub use hashchain::Chained;
pub use hashchain::GENESIS_HASH;
pub use hashchain::canonical_json;
pub use hashchain::record_hash;
pub use hashchain::verify_chain;
pub use trace::Attempt;
pub use trace::DeferredVerdict;
pub use trace::FinalOutcome;
pub use trace::PolicyRef;
pub use trace::RequestInfo;
pub use trace::ServedFrom;
pub use trace::Trace;
pub use verdict::GateResult;
pub use verdict::Score;
pub use verdict::Verdict;

Modules§

config
Routing configuration (SPEC §8.4) — declarative, agent-first.
conformal
Split-conformal risk control on the gate threshold (SPEC §10.1).
cost
Cost model: per-model token pricing and the counterfactual baseline (SPEC §9.1).
error
Error types for the domain contract.
features
The request feature vector (SPEC §9.2) — deterministic, versioned, privacy-preserving.
hashchain
Tamper-evident audit hash chain (SPEC §9).
trace
The audit trace (SPEC §9.1) — the tamper-evident record of one routing decision.
verdict
Verdicts and scores — the atomic unit of ground truth (SPEC §7.1, §9).