#[derive(Debug, Clone, PartialEq, Eq)]
pub enum EscalationReason {
ConsecutiveFailures(u32),
ResourceExhausted,
Timeout,
AgentRequested(String),
Unknown(String),
}
#[derive(Debug, Clone)]
pub struct Escalation {
pub reason: EscalationReason,
pub raised_at_tick: u64,
pub context: Option<String>,
}
impl Escalation {
pub fn consecutive_failures(count: u32, tick: u64) -> Self {
Self {
reason: EscalationReason::ConsecutiveFailures(count),
raised_at_tick: tick,
context: None,
}
}
pub fn agent_requested(reason: impl Into<String>, tick: u64) -> Self {
Self {
reason: EscalationReason::AgentRequested(reason.into()),
raised_at_tick: tick,
context: None,
}
}
pub fn with_context(mut self, ctx: impl Into<String>) -> Self {
self.context = Some(ctx.into());
self
}
}