pub struct PermissionChecker { /* private fields */ }Expand description
Permission checker that evaluates tool permissions against settings rules
Implementations§
Source§impl PermissionChecker
impl PermissionChecker
Sourcepub fn check_permission(
&self,
tool_name: &str,
tool_input: &Value,
) -> PermissionCheckResult
pub fn check_permission( &self, tool_name: &str, tool_input: &Value, ) -> PermissionCheckResult
Check permission for a tool invocation
Priority: deny > allow > ask
Returns the permission decision and matching rule (if any).
Sourcepub fn add_allow_rule(&mut self, rule: &str)
pub fn add_allow_rule(&mut self, rule: &str)
Add a runtime allow rule (e.g., from user’s “Always Allow” choice)
Sourcepub fn add_allow_rule_for_tool_call(
&mut self,
tool_name: &str,
tool_input: &Value,
)
pub fn add_allow_rule_for_tool_call( &mut self, tool_name: &str, tool_input: &Value, )
Add a runtime allow rule for “Always Allow” permission decision
For Bash tool: extracts the command name (first word) and generates
a rule like Bash(find:*) that allows all invocations of that command
regardless of arguments or paths.
For file operations (Read/Edit/Write): generates a directory-based rule that allows operations in the same directory tree.
This provides reasonable granularity:
find /path1→ ruleBash(find:*)→ allows allfindcommandsls /path→ not matched → needs separate permission
Sourcepub fn add_deny_rule(&mut self, rule: &str)
pub fn add_deny_rule(&mut self, rule: &str)
Add a runtime deny rule
Sourcepub fn default_mode(&self) -> Option<&str>
pub fn default_mode(&self) -> Option<&str>
Get the default permission mode from settings
Sourcepub fn additional_directories(&self) -> Option<&Vec<String>>
pub fn additional_directories(&self) -> Option<&Vec<String>>
Get additional directories from settings
Trait Implementations§
Source§impl Debug for PermissionChecker
impl Debug for PermissionChecker
Auto Trait Implementations§
impl Freeze for PermissionChecker
impl RefUnwindSafe for PermissionChecker
impl Send for PermissionChecker
impl Sync for PermissionChecker
impl Unpin for PermissionChecker
impl UnwindSafe for PermissionChecker
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request