mirror of
https://github.com/hanzoai/engine.git
synced 2026-11-20 14:17:52 +00:00
hanzo-bench is the library behind `hanzo-engine bench` (its `measure` loop) and `hanzo-engine board score|publish|manifest`; its binary is gone, as is the CLI's earlier bench that read the response's self-reported timing. The dossier calls the CLI. Documented in docs/CLI.md and the CLI reference. Co-authored-by: Hanzo Dev <[email protected]>
31 lines
1.0 KiB
Rust
31 lines
1.0 KiB
Rust
//! `hanzo-engine board`: score a run, file it as evidence, pin its manifest.
|
|
|
|
|
|
use anyhow::Result;
|
|
use hanzo_bench::board;
|
|
|
|
use crate::args::BoardCommand;
|
|
|
|
pub fn run_board(cmd: BoardCommand) -> Result<()> {
|
|
match cmd {
|
|
BoardCommand::Score { run } => print!("{}", board::markdown(&board::score(&run)?)),
|
|
BoardCommand::Publish { runs, to } => {
|
|
let runs: Vec<_> = runs.iter().map(|r| board::read(r)).collect::<Result<_>>()?;
|
|
let evidence = board::evidence(&runs)?;
|
|
match to {
|
|
Some(url) => board::post(&url, &evidence)?,
|
|
None => println!(
|
|
"{}",
|
|
serde_json::to_string_pretty(&serde_json::json!({"experiments": evidence, "attempts": []}))?
|
|
),
|
|
}
|
|
}
|
|
BoardCommand::Manifest { out, pins } => {
|
|
std::fs::write(&out, serde_json::to_string_pretty(&board::pin(pins)?)?)?;
|
|
println!("manifest -> {}", out.display());
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|