diff --git a/crates/gateway/src/main.rs b/crates/gateway/src/main.rs index bedebbc..a35a043 100644 --- a/crates/gateway/src/main.rs +++ b/crates/gateway/src/main.rs @@ -191,7 +191,7 @@ async fn main() { .nest("/journal", journald::service::router(journal)) .nest("/access", access_service::router(access)) .nest("/tools", tools::service::router({ - let tool_reg = tools::registry::ToolRegistry::new_with_defaults(); + let tool_reg = tools::registry::ToolRegistry::new(); tool_reg.register_defaults().await; tools::ToolState { registry: tool_reg, diff --git a/crates/gateway/src/tools/registry.rs b/crates/gateway/src/tools/registry.rs index 728d66a..f2be6f0 100644 --- a/crates/gateway/src/tools/registry.rs +++ b/crates/gateway/src/tools/registry.rs @@ -67,25 +67,14 @@ pub struct ToolRegistry { } impl ToolRegistry { - #[allow(dead_code)] + /// Build an empty registry. Callers in an async context should follow + /// this with `.register_defaults().await` if they want the built-in + /// staffing tools pre-installed — main.rs does exactly that. pub fn new() -> Self { - let registry = Self { + Self { tools: Arc::new(RwLock::new(HashMap::new())), audit_log: Arc::new(RwLock::new(Vec::new())), - }; - // Register built-in staffing tools - tokio::task::block_in_place(|| { - tokio::runtime::Handle::current().block_on(registry.register_defaults()) - }); - registry - } - - pub fn new_with_defaults() -> Self { - let registry = Self { - tools: Arc::new(RwLock::new(HashMap::new())), - audit_log: Arc::new(RwLock::new(Vec::new())), - }; - registry + } } /// Register default staffing tools.