use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use argonauts_core::RunId;
use argonauts_core::events::run::RunOutcome;
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub struct LearnedWorkflowRef {
pub name: String,
pub version: u32,
}
impl std::fmt::Display for LearnedWorkflowRef {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{} v{}", self.name, self.version)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Assignment {
Exploit,
Explore,
Fallback,
Retry,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RunRecord {
pub run: RunId,
#[serde(with = "time::serde::rfc3339")]
pub at: OffsetDateTime,
pub task_type: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub learned_workflow: Option<LearnedWorkflowRef>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub workflow: Option<(String, String)>,
pub outcome: RunOutcome,
pub stuck_tasks: u32,
pub final_checks_passed: bool,
pub cost_usd: f64,
pub minutes: f64,
#[serde(default)]
pub canary: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ReplayResult {
pub task: String,
pub learned_workflow: LearnedWorkflowRef,
pub try_number: u32,
pub passed: bool,
pub cost_usd: f64,
pub minutes: f64,
pub holdout: bool,
}