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:
31
src/main.rs
31
src/main.rs
@@ -10,6 +10,7 @@ mod memory;
|
|||||||
mod persistence;
|
mod persistence;
|
||||||
mod sdk;
|
mod sdk;
|
||||||
mod sync;
|
mod sync;
|
||||||
|
mod time_context;
|
||||||
mod tools;
|
mod tools;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -174,11 +175,26 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
None
|
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(
|
let tool_registry = Arc::new(ToolRegistry::new(
|
||||||
os_client.clone(),
|
os_client.clone(),
|
||||||
matrix_client.clone(),
|
matrix_client.clone(),
|
||||||
config.clone(),
|
config.clone(),
|
||||||
gitea_client,
|
gitea_client,
|
||||||
|
kratos_client,
|
||||||
|
Some(mistral.clone()),
|
||||||
|
Some(store.clone()),
|
||||||
));
|
));
|
||||||
let indexer = Arc::new(Indexer::new(os_client.clone(), config.clone()));
|
let indexer = Arc::new(Indexer::new(os_client.clone(), config.clone()));
|
||||||
let evaluator = Arc::new(Evaluator::new(config.clone(), system_prompt_text.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,
|
opensearch: os_client,
|
||||||
last_response: Arc::new(tokio::sync::Mutex::new(std::collections::HashMap::new())),
|
last_response: Arc::new(tokio::sync::Mutex::new(std::collections::HashMap::new())),
|
||||||
responding_in: Arc::new(tokio::sync::Mutex::new(std::collections::HashSet::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
|
// Initialize orchestrator agent if conversations API is enabled
|
||||||
let mut agent_recreated = false;
|
let mut agent_recreated = false;
|
||||||
if config.agents.use_conversations_api {
|
if config.agents.use_conversations_api {
|
||||||
info!("Conversations API enabled — ensuring orchestrator agent exists");
|
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
|
match state
|
||||||
.agent_registry
|
.agent_registry
|
||||||
.ensure_orchestrator(
|
.ensure_orchestrator(
|
||||||
@@ -227,7 +254,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
&config.agents.orchestrator_model,
|
&config.agents.orchestrator_model,
|
||||||
agent_tools,
|
agent_tools,
|
||||||
&state.mistral,
|
&state.mistral,
|
||||||
&[], // no domain agents yet — delegation section added when they are
|
&active_agents,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
pub mod gitea;
|
pub mod gitea;
|
||||||
|
pub mod kratos;
|
||||||
pub mod tokens;
|
pub mod tokens;
|
||||||
pub mod vault;
|
pub mod vault;
|
||||||
|
|||||||
Reference in New Issue
Block a user