Public declaration syntax from forge-rs/harness-runtime/src/record.rs Original source SHA-256: 663f381e07a61ef9208053cb9d35b43ac2b9b7224e9d2de5ab0b606872090191 Function bodies and constant values are omitted. This is not the complete implementation. Source line 17 pub const RUN_RECORD_SCHEMA_VERSION: &str; Source line 21 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] pub struct UsageTotals { /// Total input tokens across all inference calls. pub input_tokens: u64, /// Total output tokens across all inference calls. pub output_tokens: u64, /// `input_tokens + output_tokens`. pub total_tokens: u64, /// Total USD charged. pub cost_usd: f64, /// Number of inference calls made. pub inference_calls: u64, /// Number of tool invocations executed. pub tool_invocations: u64 } Source line 40 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum RunOutcomeKind { /// All declared gates executed and passed. Verified, /// Execution finished but a gate failed, or a gate could not run. Failed, /// The run stopped early (budget, step limit, plane failure). Halted, /// Admission refused the run. Denied, } Source line 54 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "reason", rename_all = "snake_case")] pub enum HaltReason { /// The inference budget was exhausted (§5.8 `halt_and_settle`). BudgetExhausted, /// The budget was exhausted and the manifest's policy is /// `request_approval` (§5.8): an extension approval was requested and /// the run halted pending it — extension mints a new budget epoch, it /// never edits the exhausted one. BudgetExhaustedApprovalRequested, /// `[loop].max_steps` was reached without a final answer. StepLimitExceeded, /// A plane call failed in-run (§4.4: any failure lands in a terminal /// state with settlement — never silent continuation). PlaneFailure { /// The plane that failed. plane: PlaneKind, /// What happened. detail: String, }, } Source line 77 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "state", rename_all = "snake_case")] pub enum RunOutcome { /// All declared gates executed and passed. Verified { /// The final answer, when the loop produced one. answer: Option, }, /// Execution finished but verification failed (§4.6: `failed` is /// terminal with evidence; still settles). Failed { /// Why the run failed. reason: String, }, /// The run halted before completion. Halted { /// Why it halted. cause: HaltReason, }, /// Admission denied the run (§4.4: denied still settles and archives). Denied { /// Why admission denied the run. reason: String, }, } Source line 103 pub fn kind(&self) -> RunOutcomeKind; Source line 116 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PlaneDecision { /// The plane that made the decision. pub plane: PlaneKind, /// The operation decided (e.g. `tool.invoke`, `inference.complete`). pub operation: String, /// Whether the operation was allowed to proceed. pub allowed: bool, /// Why / what happened (tool id, denial reason, budget state). pub detail: String } Source line 130 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct AdmissionEvidence { /// The durable admission evidence reference. pub evidence_ref: String, /// The identity plane's lineage verification evidence, when produced. pub lineage_evidence_ref: Option, /// The economics plane's reservation id. pub reservation_id: String, /// The reservation's evidence reference, when produced. pub reservation_evidence_ref: Option, /// Granted USD budget. pub granted_usd: f64, /// Granted token budget. pub granted_tokens: u64 } Source line 147 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SettlementEvidence { /// The provider's settlement id. pub settlement_id: String, /// Settled USD. pub settled_usd: f64, /// Settled tokens. pub settled_tokens: u64, /// The settlement evidence reference, when produced. pub evidence_ref: Option } Source line 160 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct RunRecord { /// Schema version ([`RUN_RECORD_SCHEMA_VERSION`]). pub schema_version: String, /// The run id minted at admission. pub run_id: String, /// BLAKE3 manifest hash (hex) identifying the harness contract. pub manifest_hash: String, /// Parent run id for spawned children (§4.5). pub parent_run_id: Option, /// Derivation depth of this run (0 for a root harness). pub depth: u32, /// The harness id (`[harness].id`). pub harness_id: String, /// The agent DID (`[identity].did`). pub agent_did: String, /// The loop strategy that executed (`[loop].strategy`). pub loop_strategy: String, /// Admission evidence. pub admission: AdmissionEvidence, /// Ordered plane decisions. pub decisions: Vec, /// Declared gate results, in manifest order. pub gate_results: Vec, /// Terminal usage totals. pub usage: UsageTotals, /// Terminal outcome. pub outcome: RunOutcome, /// Settlement evidence; present on every terminal state (§4.4: all /// still settle). Absent only when settlement itself failed — which is /// itself recorded in `telemetry_failures`. pub settlement: Option, /// Telemetry/consolidation failures observed during the run. Recording /// them here keeps observability honest without silently dropping /// events or rewriting the terminal outcome. pub telemetry_failures: Vec, /// The run's W3C trace id (32 hex chars) propagated to providers. pub trace_id: String, /// When the run started (admission time). pub started_at: DateTime, /// When the run reached its terminal state. pub ended_at: DateTime }