pub struct ToolPolicyManager { /* private fields */ }
Expand description
Tool policy manager
Implementations§
Source§impl ToolPolicyManager
impl ToolPolicyManager
Sourcepub fn new_with_workspace(workspace_root: &PathBuf) -> Result<Self>
pub fn new_with_workspace(workspace_root: &PathBuf) -> Result<Self>
Create a new tool policy manager with workspace-specific config
Sourcepub fn apply_tools_config(&mut self, tools_config: &ToolsConfig) -> Result<()>
pub fn apply_tools_config(&mut self, tools_config: &ToolsConfig) -> Result<()>
Apply policies defined in vtcode.toml to the runtime policy manager
Sourcepub fn update_available_tools(&mut self, tools: Vec<String>) -> Result<()>
pub fn update_available_tools(&mut self, tools: Vec<String>) -> Result<()>
Update the tool list and save configuration
Sourcepub fn get_policy(&self, tool_name: &str) -> ToolPolicy
pub fn get_policy(&self, tool_name: &str) -> ToolPolicy
Get policy for a specific tool
Sourcepub fn get_constraints(&self, tool_name: &str) -> Option<&ToolConstraints>
pub fn get_constraints(&self, tool_name: &str) -> Option<&ToolConstraints>
Get optional constraints for a specific tool
Sourcepub fn should_execute_tool(&mut self, tool_name: &str) -> Result<bool>
pub fn should_execute_tool(&mut self, tool_name: &str) -> Result<bool>
Check if tool should be executed based on policy
pub fn is_auto_allow_tool(tool_name: &str) -> bool
Sourcepub fn set_policy(&mut self, tool_name: &str, policy: ToolPolicy) -> Result<()>
pub fn set_policy(&mut self, tool_name: &str, policy: ToolPolicy) -> Result<()>
Set policy for a specific tool
Sourcepub fn reset_all_to_prompt(&mut self) -> Result<()>
pub fn reset_all_to_prompt(&mut self) -> Result<()>
Reset all tools to prompt
Sourcepub fn allow_all_tools(&mut self) -> Result<()>
pub fn allow_all_tools(&mut self) -> Result<()>
Allow all tools
Sourcepub fn deny_all_tools(&mut self) -> Result<()>
pub fn deny_all_tools(&mut self) -> Result<()>
Deny all tools
Sourcepub fn get_policy_summary(&self) -> IndexMap<String, ToolPolicy>
pub fn get_policy_summary(&self) -> IndexMap<String, ToolPolicy>
Get summary of current policies
Sourcepub fn print_status(&self)
pub fn print_status(&self)
Print current policy status
Sourcepub fn config_path(&self) -> &Path
pub fn config_path(&self) -> &Path
Expose path of the underlying policy configuration file
Trait Implementations§
Source§impl Clone for ToolPolicyManager
impl Clone for ToolPolicyManager
Source§fn clone(&self) -> ToolPolicyManager
fn clone(&self) -> ToolPolicyManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ToolPolicyManager
impl RefUnwindSafe for ToolPolicyManager
impl Send for ToolPolicyManager
impl Sync for ToolPolicyManager
impl Unpin for ToolPolicyManager
impl UnwindSafe for ToolPolicyManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more