Skip to main content

oxios_kernel/
types.rs

1//! Core types for the Oxios kernel.
2//!
3//! Defines agent identity, status, and metadata.
4
5use chrono::{DateTime, Utc};
6use serde::{Deserialize, Serialize};
7
8/// Unique identifier for an agent instance.
9pub type AgentId = uuid::Uuid;
10
11/// Current status of an agent instance.
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
13pub enum AgentStatus {
14    /// Agent is being initialized.
15    Starting,
16    /// Agent is actively executing tasks.
17    Running,
18    /// Agent is alive but not currently working.
19    Idle,
20    /// Agent has been stopped.
21    Stopped,
22    /// Agent has encountered an error.
23    Failed,
24}
25
26impl std::fmt::Display for AgentStatus {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28        match self {
29            AgentStatus::Starting => write!(f, "starting"),
30            AgentStatus::Running => write!(f, "running"),
31            AgentStatus::Idle => write!(f, "idle"),
32            AgentStatus::Stopped => write!(f, "stopped"),
33            AgentStatus::Failed => write!(f, "failed"),
34        }
35    }
36}
37
38/// Metadata about an agent instance.
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct AgentInfo {
41    /// Unique identifier for this agent.
42    pub id: AgentId,
43    /// Human-readable name of the agent.
44    pub name: String,
45    /// Current status of the agent.
46    pub status: AgentStatus,
47    /// Timestamp when the agent was created.
48    pub created_at: DateTime<Utc>,
49    /// The seed this agent was forked from, if any.
50    pub seed_id: Option<uuid::Uuid>,
51}