Skip to main content

vtcode_core/tools/registry/
subagent_facade.rs

1use std::sync::Arc;
2
3use super::ToolRegistry;
4use crate::subagents::SubagentController;
5
6impl ToolRegistry {
7    pub fn set_subagent_controller(&self, controller: Arc<SubagentController>) {
8        if let Ok(mut slot) = self.subagent_controller.write() {
9            *slot = Some(controller);
10        }
11    }
12
13    pub fn subagent_controller(&self) -> Option<Arc<SubagentController>> {
14        self.subagent_controller.read().unwrap_or_else(|e| e.into_inner()).clone()
15    }
16
17    pub fn has_subagent_controller(&self) -> bool {
18        self.subagent_controller().is_some()
19    }
20}