use super::auth::ApiAuthManager;
use super::task::TaskManager;
use crate::{security::RateLimiter, AgentRuntime};
use std::sync::{Arc, RwLock};
use std::time::Instant;
#[derive(Clone)]
pub struct ApiState {
pub runtime: Arc<RwLock<AgentRuntime>>,
pub start_time: Instant,
}
impl ApiState {
pub fn new(runtime: Arc<RwLock<AgentRuntime>>) -> Self {
Self {
runtime,
start_time: Instant::now(),
}
}
}
#[derive(Clone)]
pub struct ServerState {
pub api_state: ApiState,
pub auth_manager: Arc<ApiAuthManager>,
pub rate_limiter: Arc<RwLock<RateLimiter>>,
pub task_manager: TaskManager,
pub config: Arc<super::server::AgentApiConfig>,
}