pub struct RuleEvaluator { /* private fields */ }Expand description
Enforces per-tool rules declared in nanny.toml under [tools.
Currently enforces:
max_calls: deny once a tool has been called max_calls times
Always runs after ToolPermissionPolicy: compose them with ChainPolicy.
Implementations§
Source§impl RuleEvaluator
impl RuleEvaluator
pub fn new(max_calls: HashMap<String, u32>) -> Self
Sourcepub fn rule_name_for(&self, tool: &str) -> Option<String>
pub fn rule_name_for(&self, tool: &str) -> Option<String>
The engine-side rule governing tool, if any.
A max_calls cap is a rule like any other, so a call it evaluated and
allowed belongs in that call’s cleared_by alongside the SDK’s rules.
Otherwise the engine’s own control is the one control that leaves no
evidence of having operated.
Trait Implementations§
Source§impl Policy for RuleEvaluator
impl Policy for RuleEvaluator
fn evaluate(&self, ctx: &PolicyContext) -> PolicyDecision
Auto Trait Implementations§
impl Freeze for RuleEvaluator
impl RefUnwindSafe for RuleEvaluator
impl Send for RuleEvaluator
impl Sync for RuleEvaluator
impl Unpin for RuleEvaluator
impl UnsafeUnpin for RuleEvaluator
impl UnwindSafe for RuleEvaluator
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