2026-02-19 15:25:22 +00:00
|
|
|
mod agents;
|
2026-02-16 16:24:21 +00:00
|
|
|
mod http;
|
|
|
|
|
mod io;
|
2026-02-13 12:31:36 +00:00
|
|
|
mod llm;
|
|
|
|
|
mod state;
|
|
|
|
|
mod store;
|
2026-02-19 12:54:04 +00:00
|
|
|
mod workflow;
|
2026-02-13 12:31:36 +00:00
|
|
|
|
2026-02-19 15:25:22 +00:00
|
|
|
use crate::agents::AgentPool;
|
2026-02-16 16:24:21 +00:00
|
|
|
use crate::http::build_routes;
|
|
|
|
|
use crate::http::context::AppContext;
|
2026-02-13 12:31:36 +00:00
|
|
|
use crate::state::SessionState;
|
|
|
|
|
use crate::store::JsonFileStore;
|
2026-02-19 12:54:04 +00:00
|
|
|
use crate::workflow::WorkflowState;
|
2026-02-16 16:24:21 +00:00
|
|
|
use poem::Server;
|
|
|
|
|
use poem::listener::TcpListener;
|
2026-02-13 12:31:36 +00:00
|
|
|
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)?,
|
|
|
|
|
);
|
2026-02-19 12:54:04 +00:00
|
|
|
let workflow = Arc::new(std::sync::Mutex::new(WorkflowState::default()));
|
2026-02-19 15:25:22 +00:00
|
|
|
let agents = Arc::new(AgentPool::new());
|
2026-02-13 12:31:36 +00:00
|
|
|
|
|
|
|
|
let ctx = AppContext {
|
|
|
|
|
state: app_state,
|
|
|
|
|
store,
|
2026-02-19 12:54:04 +00:00
|
|
|
workflow,
|
2026-02-19 15:25:22 +00:00
|
|
|
agents,
|
2026-02-13 12:31:36 +00:00
|
|
|
};
|
|
|
|
|
|
2026-02-16 16:24:21 +00:00
|
|
|
let app = build_routes(ctx);
|
2026-02-13 12:31:36 +00:00
|
|
|
|
2026-02-16 17:10:23 +00:00
|
|
|
println!(
|
|
|
|
|
"\x1b[95;1m ____ _ _ ___ _ \n / ___|| |_ ___ _ __| | _|_ _| |_ \n \\___ \\| __/ _ \\| '__| |/ /| || __|\n ___) | || (_) | | | < | || |_ \n |____/ \\__\\___/|_| |_|\\_\\___|\\__|\n\x1b[0m"
|
|
|
|
|
);
|
2026-02-19 15:25:22 +00:00
|
|
|
println!("\x1b[96;1mFrontend:\x1b[0m \x1b[94mhttp://127.0.0.1:3002\x1b[0m");
|
|
|
|
|
println!("\x1b[92;1mOpenAPI Docs:\x1b[0m \x1b[94mhttp://127.0.0.1:3002/docs\x1b[0m");
|
2026-02-16 17:10:23 +00:00
|
|
|
|
2026-02-19 15:25:22 +00:00
|
|
|
Server::new(TcpListener::bind("127.0.0.1:3002"))
|
2026-02-13 12:31:36 +00:00
|
|
|
.run(app)
|
|
|
|
|
.await
|
|
|
|
|
}
|