wire up identity agent, research tool, silence state

main.rs: create KratosClient, pass mistral+store to ToolRegistry,
build active_agents list for dynamic delegation.

conversations.rs: context_hint for new conversations, reset_all.
sdk/mod.rs: added kratos module.
This commit is contained in:
2026-03-23 01:43:51 +00:00
parent de33ddfe33
commit 447bead0b7
2 changed files with 30 additions and 2 deletions

View File

@@ -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<Arc<sdk::kratos::KratosClient>> =
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
{

View File

@@ -1,3 +1,4 @@
pub mod gitea;
pub mod kratos;
pub mod tokens;
pub mod vault;