Skip to main content

systemprompt_traits/startup_events/
types.rs

1//! Startup event type definitions.
2
3use std::time::Duration;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6pub enum Phase {
7    PreFlight,
8    Database,
9    McpServers,
10    ApiServer,
11    Agents,
12    Scheduler,
13}
14
15impl Phase {
16    /// Human-readable phase name for display
17    pub const fn name(&self) -> &'static str {
18        match self {
19            Self::PreFlight => "Pre-flight",
20            Self::Database => "Database",
21            Self::McpServers => "MCP Servers",
22            Self::ApiServer => "API Server",
23            Self::Agents => "Agents",
24            Self::Scheduler => "Scheduler",
25        }
26    }
27
28    /// Whether this phase blocks API readiness
29    pub const fn is_blocking(&self) -> bool {
30        matches!(
31            self,
32            Self::PreFlight | Self::Database | Self::McpServers | Self::ApiServer
33        )
34    }
35}
36
37#[derive(Debug, Clone, Copy, PartialEq, Eq)]
38pub enum ServiceType {
39    Mcp,
40    Agent,
41    Api,
42    Scheduler,
43}
44
45impl ServiceType {
46    pub const fn label(&self) -> &'static str {
47        match self {
48            Self::Mcp => "MCP",
49            Self::Agent => "Agent",
50            Self::Api => "API",
51            Self::Scheduler => "Sched",
52        }
53    }
54}
55
56#[derive(Debug, Clone, Copy, PartialEq, Eq)]
57pub enum ServiceState {
58    Starting,
59    Running,
60    Stopped,
61    Failed,
62}
63
64#[derive(Debug, Clone)]
65pub struct ServiceInfo {
66    pub name: String,
67    pub service_type: ServiceType,
68    pub port: Option<u16>,
69    pub state: ServiceState,
70    pub startup_time: Option<Duration>,
71}
72
73#[derive(Debug, Clone)]
74pub struct ModuleInfo {
75    pub name: String,
76    pub category: String,
77}