pub mod api; pub mod agent; pub mod db; pub mod kb; pub mod llm; pub mod exec; pub mod state; pub mod template; pub mod timer; pub mod tools; pub mod worker; pub mod sink; pub mod worker_runner; pub mod ws; pub mod ws_worker; use std::sync::Arc; use serde::Deserialize; pub struct AppState { pub db: db::Database, pub config: Config, pub agent_mgr: Arc, pub kb: Option>, pub obj_root: String, pub auth: Option, } #[derive(Debug, Clone, Deserialize)] pub struct Config { /// LLM config is optional on the server — workers bring their own. #[serde(default)] pub llm: Option, #[serde(default)] pub server: Option, #[serde(default)] pub database: Option, #[serde(default)] pub template_repo: Option, /// Path to EC private key PEM file for JWT signing #[serde(default)] pub jwt_private_key: Option, } #[derive(Debug, Clone, Deserialize)] pub struct TemplateRepoConfig { pub gitea_url: String, pub owner: String, pub repo: String, #[serde(default = "default_repo_path")] pub local_path: String, } fn default_repo_path() -> String { if std::path::Path::new("/app/oseng-templates").is_dir() { "/app/oseng-templates".to_string() } else { "oseng-templates".to_string() } } #[derive(Debug, Clone, serde::Serialize, Deserialize)] pub struct LlmConfig { pub base_url: String, pub api_key: String, pub model: String, } #[derive(Debug, Clone, Deserialize)] pub struct ServerConfig { pub host: String, pub port: u16, } #[derive(Debug, Clone, Deserialize)] pub struct DatabaseConfig { pub path: String, }