Public declaration syntax from forge-rs/crates/forge-health/src/lifecycle.rs Original source SHA-256: d4b432b04985d51868ce13773e9ae9c608da8dd1868c89824de0d3e2f3925039 Function bodies and constant values are omitted. This is not the complete implementation. Source line 77 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum LifecycleState { /// Agent is loading configuration, identity, and capabilities. /// /// This is the initial state for all agents. During initialization, the /// agent loads its OAS identity, Arsenal ACT, provider configuration, and /// tool definitions. Valid transitions are to Ready (on success), Error /// (on failure), or Terminated (abort). Initializing, /// Agent has completed initialization and is ready to accept work. /// /// The agent's identity, configuration, and tools have been loaded /// successfully. Valid transitions are to Running (start processing) /// or Terminated (shutdown before starting). Ready, /// Agent is actively processing requests. /// /// This is the primary operational state. The agent can process tool loops, /// generate text, and handle messages. Valid transitions are to Ready /// (return to idle), Paused (pause), Error (fatal failure), or Terminated /// (graceful shutdown). Running, /// Agent is temporarily paused and not processing requests. /// /// A paused agent retains its state and can resume. Valid transitions /// are to Running (resume) or Terminated (shutdown while paused). Paused, /// Agent encountered a fatal error. /// /// An agent in the Error state can attempt recovery by transitioning to /// Ready (after re-initialization), or give up by transitioning to /// Terminated. Error, /// Agent has completed shutdown. This is a **terminal state** with no /// outgoing transitions. /// /// Once an agent reaches Terminated, it cannot be reused. A new agent /// instance must be created. Terminated, } Source line 146 pub fn valid_transitions(&self) -> &'static [LifecycleState]; Source line 179 pub fn is_terminal(&self) -> bool; Source line 198 pub fn is_operational(&self) -> bool; Source line 233 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LifecycleTransition { /// The state before the transition. pub from: LifecycleState, /// The state after the transition. pub to: LifecycleState, /// The UTC timestamp when the transition occurred. pub timestamp: Timestamp } Source line 289 #[derive(Debug, Clone)] pub struct LifecycleManager { } Source line 315 pub fn new() -> Self; Source line 336 pub fn state(&self) -> LifecycleState; Source line 380 pub fn transition( &mut self, target: LifecycleState, ) -> Result; Source line 456 pub fn can_transition_to(&self, target: LifecycleState) -> bool; Source line 480 pub fn valid_transitions(&self) -> Vec; Source line 505 pub fn history(&self) -> &[LifecycleTransition];