Public declaration syntax from forge-rs/harness-apd/src/spec.rs Original source SHA-256: 33fc4f5706fbb2792611e3359c6620a4dc2f33a96c19de41547259389156e9fc Function bodies and constant values are omitted. This is not the complete implementation. Source line 12 pub const SPEC_SCHEMA: &str; Source line 16 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ApdTaskSpec { /// Schema tag; must be [`SPEC_SCHEMA`]. pub schema: String, /// Corpus task id (e.g. `json5-cve-2022-46175`). pub task_id: String, /// The task prompt from the corpus. pub prompt: String, /// The task's declared context files, in declared order. pub context_files: Vec, /// Absolute path of the pristine workspace checkout (tools plane root). pub workspace_dir: String, /// Operator-supplied model identifier (never defaulted — live-catalog /// discipline, L1F-16). pub model: String, /// OpenAI-compatible base URL of the model route (e.g. a Foundry /// route or provider gateway). pub base_url: String, /// Environment variable holding the route's API key. The key value is /// read from the process environment at run time; it is never written /// to the spec, the result, or the run record. #[serde(default)] pub api_key_env: Option, /// Sampling temperature. `null` omits the parameter entirely — some /// current flagship models accept only their default temperature and /// reject an explicit value. #[serde(default)] pub temperature: Option, /// Output-token cap per model call. #[serde(default)] pub max_output_tokens: Option, /// ReAct loop step cap (`[loop].max_steps`). #[serde(default = "default_max_steps")] pub max_steps: u64, /// Context frame cap (`[context].frame_budget_tokens`). #[serde(default = "default_frame_budget_tokens")] pub frame_budget_tokens: u64, /// USD budget cap (`[inference].budget_usd`). pub budget_usd: f64, /// Token budget cap (`[inference].budget_tokens`). pub budget_tokens: u64, /// The model's current price entry (the runner's fail-loud price /// table resolved it before any spend). pub price: SpecPrice, /// Enable the MARC `reasoning_task` decomposition section when the /// MAP spine is configured. Ignored when it is not. #[serde(default = "default_marc_decomposition")] pub marc_decomposition: bool } Source line 79 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SpecContextFile { /// Repo-relative path. pub path: String, /// Current content at the pinned ref. pub content: String } Source line 88 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] pub struct SpecPrice { /// USD per 1M input tokens. pub input_per_mtok: f64, /// USD per 1M output tokens. pub output_per_mtok: f64 } Source line 97 pub fn from_json(source: &str) -> Result; Source line 126 #[derive(Debug, thiserror::Error)] pub enum SpecError { /// The document is not valid JSON for the spec shape. #[error("malformed spec: {0}")] Malformed(serde_json::Error), /// The schema tag is not supported by this driver. #[error("unsupported spec schema {0:?} (expected {SPEC_SCHEMA:?})")] UnsupportedSchema(String), /// A required field is missing or invalid. #[error("missing or invalid field: {0}")] MissingField(&'static str), } Source line 140 #[derive(Debug, Clone, PartialEq, Serialize)] pub struct ApdRunResult { /// Schema tag. pub schema: String, /// Corpus task id. pub task_id: String, /// The harness run id minted at admission. pub run_id: String, /// The model route used. pub model: String, /// Terminal outcome kind (`verified` | `failed` | `halted`). pub outcome: String, /// The unified diff extracted from the run's final answer, when the /// loop produced one. `null` is honest: no patch exists. pub patch: Option, /// Real metered usage from the run record's usage totals. pub usage: ApdUsage, /// MAP spine dispatches made by the run's planes (empty when the /// spine is unconfigured — local planes served the run). pub map_spine: ApdMapSpine, /// Terminal error detail (halt reason / verification failure), when /// the run did not verify. pub error: Option } Source line 166 #[derive(Debug, Clone, Copy, PartialEq, Serialize)] pub struct ApdUsage { /// Total input tokens across all model calls. pub prompt_tokens: u64, /// Total output tokens across all model calls. pub completion_tokens: u64, /// Total USD charged against the budget ledger. pub cost_usd: f64 } Source line 177 #[derive(Debug, Clone, PartialEq, Serialize)] pub struct ApdMapSpine { /// Whether `MAP_BASE_URL` configured a spine for this run. pub configured: bool, /// Every dispatch the run's planes made, in order. pub dispatches: Vec }