pub enum ToolGrantCheck {
NoGrant,
Active,
Expired,
}Expand description
Result of checking whether a GrantKind::Tool grant permits a tool dispatch.
Returned by PermissionGrants::check_tool_grant. See that method’s doc for the full
default-permit / time-box-only semantics (confirmed, issue #6567) — in short: this is a
narrowing restriction on top of an already-permitted tool, never an allow-list, and
NoGrant always means “unrestricted by this mechanism,” not “denied.”
§Examples
use std::time::Duration;
use zeph_subagent::grants::{GrantKind, PermissionGrants, ToolGrantCheck};
let mut grants = PermissionGrants::default();
grants.add(GrantKind::Tool("web".to_owned()), Duration::from_mins(5));
assert_eq!(grants.check_tool_grant("web"), ToolGrantCheck::Active);
assert_eq!(grants.check_tool_grant("shell"), ToolGrantCheck::NoGrant);Variants§
NoGrant
No GrantKind::Tool grant record exists for this tool name — dispatch is
unrestricted by this mechanism (today’s universal production state, since no
caller creates GrantKind::Tool grants yet).
Active
A GrantKind::Tool grant exists for this tool name and has not expired.
Expired
A GrantKind::Tool grant existed for this tool name but its TTL has elapsed; the
stale entry is evicted as a side effect of this check.
Trait Implementations§
Source§impl Clone for ToolGrantCheck
impl Clone for ToolGrantCheck
Source§fn clone(&self) -> ToolGrantCheck
fn clone(&self) -> ToolGrantCheck
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ToolGrantCheck
Source§impl Debug for ToolGrantCheck
impl Debug for ToolGrantCheck
impl Eq for ToolGrantCheck
Source§impl PartialEq for ToolGrantCheck
impl PartialEq for ToolGrantCheck
impl StructuralPartialEq for ToolGrantCheck
Auto Trait Implementations§
impl Freeze for ToolGrantCheck
impl RefUnwindSafe for ToolGrantCheck
impl Send for ToolGrantCheck
impl Sync for ToolGrantCheck
impl Unpin for ToolGrantCheck
impl UnsafeUnpin for ToolGrantCheck
impl UnwindSafe for ToolGrantCheck
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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 moreSource§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