mod agents; mod http; mod io; mod llm; mod state; mod store; mod workflow; use crate::agents::AgentPool; use crate::http::build_routes; use crate::http::context::AppContext; use crate::state::SessionState; use crate::store::JsonFileStore; use crate::workflow::WorkflowState; use poem::Server; use poem::listener::TcpListener; use std::path::PathBuf; use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), std::io::Error> { let app_state = Arc::new(SessionState::default()); let store = Arc::new( JsonFileStore::from_path(PathBuf::from("store.json")).map_err(std::io::Error::other)?, ); let workflow = Arc::new(std::sync::Mutex::new(WorkflowState::default())); let agents = Arc::new(AgentPool::new()); let ctx = AppContext { state: app_state, store, workflow, agents, }; let app = build_routes(ctx); println!( "\x1b[95;1m ____ _ _ ___ _ \n / ___|| |_ ___ _ __| | _|_ _| |_ \n \\___ \\| __/ _ \\| '__| |/ /| || __|\n ___) | || (_) | | | < | || |_ \n |____/ \\__\\___/|_| |_|\\_\\___|\\__|\n\x1b[0m" ); println!("\x1b[96;1mFrontend:\x1b[0m \x1b[94mhttp://127.0.0.1:3001\x1b[0m"); println!("\x1b[92;1mOpenAPI Docs:\x1b[0m \x1b[94mhttp://127.0.0.1:3001/docs\x1b[0m"); Server::new(TcpListener::bind("127.0.0.1:3001")) .run(app) .await }