use std::time::Duration;
use swink_agent::Usage;
use super::types::PipelineId;
#[derive(Clone, Debug)]
pub struct StepResult {
pub agent_name: String,
pub response: String,
pub duration: Duration,
pub usage: Usage,
}
#[derive(Clone, Debug)]
pub struct PipelineOutput {
pub pipeline_id: PipelineId,
pub final_response: String,
pub steps: Vec<StepResult>,
pub total_duration: Duration,
pub total_usage: Usage,
}
#[derive(Debug, thiserror::Error)]
pub enum PipelineError {
#[error("agent not found: {name}")]
AgentNotFound { name: String },
#[error("pipeline not found: {id}")]
PipelineNotFound { id: PipelineId },
#[error("step {step_index} ({agent_name}) failed: {source}")]
StepFailed {
step_index: usize,
agent_name: String,
source: Box<dyn std::error::Error + Send + Sync>,
},
#[error("max iterations reached: {iterations}")]
MaxIterationsReached { iterations: usize },
#[error("pipeline cancelled")]
Cancelled,
#[error("invalid exit condition: {message}")]
InvalidExitCondition { message: String },
}