use argonauts_core::names::RoleName;
use argonauts_core::settings::protocol::PlanningBy;
use argonauts_core::workflow::StandardPhase;
use crate::engine::host::Host;
use crate::error::EngineResult;
use crate::orchestrated;
use crate::review;
use crate::workflow::{StepCall, StepDone};
pub mod context;
pub mod critique;
pub mod decisions;
pub mod drafting;
pub mod drafts;
pub mod experiments;
pub mod fast_path;
pub mod judge;
pub mod judging;
pub mod map;
pub mod scan;
mod together;
pub use context::part;
pub async fn draft_step(host: &Host, call: &StepCall) -> EngineResult<StepDone> {
let orchestrator = match call.step.role {
Some(role) => role == RoleName::Orchestrator,
None => host.settings().drafting.by == PlanningBy::Orchestrator,
};
if orchestrator {
orchestrated::run(host, call).await
} else {
drafting::run(host, call).await
}
}
pub async fn map_step(host: &Host, call: &StepCall) -> EngineResult<StepDone> {
map::run(host, call).await
}
pub async fn critique_step(host: &Host, call: &StepCall) -> EngineResult<StepDone> {
critique::run(host, call).await
}
pub async fn synthesize_step(host: &Host, call: &StepCall) -> EngineResult<StepDone> {
fast_path::merge(host, call).await
}
pub async fn judge_step(host: &Host, call: &StepCall) -> EngineResult<StepDone> {
if call.standard == StandardPhase::Plan {
judge::run(host, call).await
} else {
review::settle::step(host, call).await
}
}