pub struct AnomalyDetector { /* private fields */ }Expand description
Behavioral anomaly detector.
Implementations§
Source§impl AnomalyDetector
impl AnomalyDetector
Sourcepub fn new(config: AnomalyConfig) -> Self
pub fn new(config: AnomalyConfig) -> Self
Create a new anomaly detector with the given config. Pre-compiles intent keywords into RegexSets for O(1) matching.
Sourcepub fn classify_intent(&self, declared_intent: &str) -> IntentTier
pub fn classify_intent(&self, declared_intent: &str) -> IntentTier
Classify the declared intent into a privilege tier. Highest matching tier wins: Admin > Write > Read > Unknown.
Sourcepub fn detect(
&self,
declared_intent: &str,
operation_type: OperationType,
tool_name: &str,
) -> AnomalyResponse
pub fn detect( &self, declared_intent: &str, operation_type: OperationType, tool_name: &str, ) -> AnomalyResponse
Detect anomalies for a tool call given the session’s declared intent.
Tiered detection:
- Admin intent: delete ops flagged, all others normal
- Write intent: admin ops flagged, everything else normal
- Read intent: write/delete/admin ops flagged
- Unknown intent: no anomaly detection
Sourcepub fn detect_with_args(
&self,
declared_intent: &str,
operation_type: OperationType,
tool_name: &str,
arguments: Option<&Value>,
) -> AnomalyResponse
pub fn detect_with_args( &self, declared_intent: &str, operation_type: OperationType, tool_name: &str, arguments: Option<&Value>, ) -> AnomalyResponse
Detect anomalies with argument-level scanning.
Auto Trait Implementations§
impl Freeze for AnomalyDetector
impl RefUnwindSafe for AnomalyDetector
impl Send for AnomalyDetector
impl Sync for AnomalyDetector
impl Unpin for AnomalyDetector
impl UnsafeUnpin for AnomalyDetector
impl UnwindSafe for AnomalyDetector
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