Skip to main content

aster/execution/
mod.rs

1//! Unified execution management for Aster agents
2//!
3//! This module provides centralized agent lifecycle management with session isolation,
4//! enabling multiple concurrent sessions with independent agents, extensions, and providers.
5
6pub mod manager;
7
8use serde::{Deserialize, Serialize};
9use std::fmt;
10
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
12pub enum SessionExecutionMode {
13    Interactive,
14    Background,
15    SubTask { parent_session: String },
16}
17
18impl SessionExecutionMode {
19    /// Create an interactive chat mode
20    pub fn chat() -> Self {
21        Self::Interactive
22    }
23
24    /// Create a background/scheduled mode
25    pub fn scheduled() -> Self {
26        Self::Background
27    }
28
29    /// Create a sub-task mode with parent reference
30    pub fn task(parent: String) -> Self {
31        Self::SubTask {
32            parent_session: parent,
33        }
34    }
35}
36
37impl fmt::Display for SessionExecutionMode {
38    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39        match self {
40            Self::Interactive => write!(f, "interactive"),
41            Self::Background => write!(f, "background"),
42            Self::SubTask { parent_session } => write!(f, "subtask(parent: {})", parent_session),
43        }
44    }
45}