diff --git a/src/main.rs b/src/main.rs index 758ba5e..c476882 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ mod memory; mod persistence; mod sdk; mod sync; +mod time_context; mod tools; use std::sync::Arc; @@ -174,11 +175,26 @@ async fn main() -> anyhow::Result<()> { None }; + // Initialize Kratos client if configured + let kratos_client: Option> = + if let Some(kratos_config) = &config.services.kratos { + info!(url = kratos_config.admin_url.as_str(), "Kratos integration enabled"); + Some(Arc::new(sdk::kratos::KratosClient::new( + kratos_config.admin_url.clone(), + ))) + } else { + info!("Kratos integration disabled (missing config)"); + None + }; + let tool_registry = Arc::new(ToolRegistry::new( os_client.clone(), matrix_client.clone(), config.clone(), gitea_client, + kratos_client, + Some(mistral.clone()), + Some(store.clone()), )); let indexer = Arc::new(Indexer::new(os_client.clone(), config.clone())); let evaluator = Arc::new(Evaluator::new(config.clone(), system_prompt_text.clone())); @@ -213,13 +229,24 @@ async fn main() -> anyhow::Result<()> { opensearch: os_client, last_response: Arc::new(tokio::sync::Mutex::new(std::collections::HashMap::new())), responding_in: Arc::new(tokio::sync::Mutex::new(std::collections::HashSet::new())), + silenced_until: Arc::new(tokio::sync::Mutex::new(std::collections::HashMap::new())), }); // Initialize orchestrator agent if conversations API is enabled let mut agent_recreated = false; if config.agents.use_conversations_api { info!("Conversations API enabled — ensuring orchestrator agent exists"); - let agent_tools = tools::ToolRegistry::agent_tool_definitions(config.services.gitea.is_some()); + let agent_tools = tools::ToolRegistry::agent_tool_definitions( + config.services.gitea.is_some(), + config.services.kratos.is_some(), + ); + let mut active_agents: Vec<(&str, &str)> = vec![]; + if config.services.gitea.is_some() { + active_agents.push(("sol-devtools", "Git repos, issues, PRs, code (Gitea)")); + } + if config.services.kratos.is_some() { + active_agents.push(("sol-identity", "User accounts, sessions, recovery (Kratos)")); + } match state .agent_registry .ensure_orchestrator( @@ -227,7 +254,7 @@ async fn main() -> anyhow::Result<()> { &config.agents.orchestrator_model, agent_tools, &state.mistral, - &[], // no domain agents yet — delegation section added when they are + &active_agents, ) .await { diff --git a/src/sdk/mod.rs b/src/sdk/mod.rs index e2d57d3..6dc5080 100644 --- a/src/sdk/mod.rs +++ b/src/sdk/mod.rs @@ -1,3 +1,4 @@ pub mod gitea; +pub mod kratos; pub mod tokens; pub mod vault;