Skip to main content

vtcode_core/tools/registry/
commands_facade.rs

1//! Command configuration accessors for ToolRegistry.
2
3use crate::config::CommandsConfig;
4
5use super::ToolRegistry;
6
7impl ToolRegistry {
8    pub fn apply_commands_config(&self, commands_config: &CommandsConfig) {
9        self.inventory.update_commands_config(commands_config);
10        self.pty_sessions.manager().apply_commands_config(commands_config);
11        match self.shell_policy.write() {
12            Ok(mut shell_policy) => shell_policy.set_commands_config(commands_config),
13            Err(poisoned) => poisoned.into_inner().set_commands_config(commands_config),
14        }
15    }
16
17    pub fn commands_config(&self) -> CommandsConfig {
18        match self.shell_policy.read() {
19            Ok(shell_policy) => shell_policy.commands_config().cloned().unwrap_or_default(),
20            Err(poisoned) => poisoned.into_inner().commands_config().cloned().unwrap_or_default(),
21        }
22    }
23}