Public declaration syntax from harness-sdk/src/harness/loop_driver.rs Original source SHA-256: d9f996560e0b3b3dd6a35dd3906884a183245bc8d530eef91b020a833c716528 Function bodies and constant values are omitted. This is not the complete implementation. Source line 43 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum HarnessLoopPhase { /// Phase 1: run the benchmark with the current harness. Rollout, /// Phase 2: strip noise from trajectories. Clean, /// Phase 3: verify the prior iteration's manifest contracts. Attribute, /// Phase 4: AgentDebugger produces the EvidenceCorpus. Distill, /// Phase 5: Evolve Agent edits the workspace + emits manifest. Evolve, /// Phase 6: git-tag the iteration. Commit, } Source line 61 #[must_use] pub fn as_key(self) -> &'static str; Source line 74 #[must_use] pub fn label(self) -> &'static str; Source line 87 #[must_use] pub const fn ordering() -> [HarnessLoopPhase; 6]; Source line 103 #[must_use] pub fn next(self) -> Option; Source line 117 #[derive(Debug, Error)] pub enum HarnessLoopError { /// The caller invoked a phase out of order (e.g. `Distill` /// before `Rollout` finished). #[error("phase {got:?} attempted before {expected:?}")] PhaseOutOfOrder { /// Phase that should run next. expected: HarnessLoopPhase, /// Phase the caller tried to run. got: HarnessLoopPhase, }, /// Iteration is already complete; bump the counter before /// attempting another phase. #[error("iteration {iteration} is complete; advance to next iteration")] IterationComplete { /// Completed iteration number. iteration: u32, }, /// Workspace I/O error. #[error(transparent)] Workspace(#[from] HarnessWorkspaceError), /// Evidence corpus I/O error. #[error(transparent)] Evidence(#[from] EvidenceCorpusError), /// I/O error reaching the runs root. #[error("loop io: {0}")] Io(#[from] std::io::Error), /// Caller-supplied phase callback failed. #[error("phase {phase:?} failed: {reason}")] PhaseFailed { /// Phase whose callback returned an error. phase: HarnessLoopPhase, /// Free-form reason from the caller. reason: String, }, } Source line 160 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct IterationRecord { /// Iteration number (matches the directory suffix). pub iteration: u32, /// Phases completed so far in canonical order. pub completed_phases: Vec, /// Per-task outcomes from this iteration's rollout (populated /// after Phase 1). #[serde(default)] pub outcomes: TaskOutcomeMap, /// Verdicts produced by the Attribute phase against the /// *previous* iteration's manifest. Empty on iteration 1. #[serde(default)] pub verdicts: Vec, /// Manifest produced by the Evolve phase. `None` until phase 5 /// completes. #[serde(default)] pub manifest: Option, /// UNIX seconds the iteration was started. pub started_at_unix_secs: u64 } Source line 216 #[derive(Debug)] pub struct StandardHarnessLoop { } Source line 232 pub fn start( runs_root: impl Into, workspace: HarnessWorkspace, iteration: u32, ) -> Result; Source line 252 pub fn with_prior(mut self, manifest: ChangeManifest, outcomes: TaskOutcomeMap) -> Self; Source line 261 #[must_use] pub fn record(&self) -> &IterationRecord; Source line 267 #[must_use] pub fn iteration(&self) -> u32; Source line 274 #[must_use] pub fn next_phase(&self) -> Option; Source line 280 #[must_use] pub fn is_complete(&self) -> bool; Source line 286 #[must_use] pub fn iteration_dir(&self) -> PathBuf; Source line 293 pub fn open_corpus(&self) -> Result; Source line 299 #[must_use] pub fn workspace(&self) -> &HarnessWorkspace; Source line 305 pub fn run_rollout( &mut self, outcomes: TaskOutcomeMap, ) -> Result; Source line 318 pub fn run_clean( &mut self, cleanup: impl FnOnce(&Path) -> Result<(), String>, ) -> Result; Source line 335 pub fn run_attribute(&mut self) -> Result; Source line 349 pub fn run_distill( &mut self, debug: impl FnOnce(&EvidenceCorpus) -> Result<(), String>, ) -> Result; Source line 365 pub fn run_evolve( &mut self, evolve: impl FnOnce(&HarnessWorkspace, &EvidenceCorpus) -> Result, ) -> Result; Source line 384 pub fn run_commit( &mut self, commit: impl FnOnce(&IterationRecord) -> Result<(), String>, ) -> Result; Source line 400 #[must_use] pub fn loop_record_path(&self) -> PathBuf;