swarm_engine_core/agent/
escalation.rs1#[derive(Debug, Clone, PartialEq, Eq)]
8pub enum EscalationReason {
9 ConsecutiveFailures(u32),
11 ResourceExhausted,
13 Timeout,
15 AgentRequested(String),
17 Unknown(String),
19}
20
21#[derive(Debug, Clone)]
23pub struct Escalation {
24 pub reason: EscalationReason,
26 pub raised_at_tick: u64,
28 pub context: Option<String>,
30}
31
32impl Escalation {
33 pub fn consecutive_failures(count: u32, tick: u64) -> Self {
35 Self {
36 reason: EscalationReason::ConsecutiveFailures(count),
37 raised_at_tick: tick,
38 context: None,
39 }
40 }
41
42 pub fn agent_requested(reason: impl Into<String>, tick: u64) -> Self {
44 Self {
45 reason: EscalationReason::AgentRequested(reason.into()),
46 raised_at_tick: tick,
47 context: None,
48 }
49 }
50
51 pub fn with_context(mut self, ctx: impl Into<String>) -> Self {
53 self.context = Some(ctx.into());
54 self
55 }
56}