Skip to main content

ProbeGate

Trait ProbeGate 

Source
pub trait ProbeGate: Send + Sync {
    // Required method
    fn probe<'a>(
        &'a self,
        qualified_tool_id: &'a str,
        args: &'a Value,
        turn_number: u64,
        risk_level: &'a str,
    ) -> Pin<Box<dyn Future<Output = ProbeOutcome> + Send + 'a>>;

    // Provided method
    fn record<'a>(
        &'a self,
        qualified_tool_id: &'a str,
        turn_number: u64,
        risk_level: &'a str,
        context_summary: &'a str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> { ... }
}
Expand description

Probe interface required by ShadowProbeExecutor.

Decoupled from zeph-core to avoid a reverse crate dependency. The agent builder wires in a concrete Arc<zeph_core::agent::shadow_sentinel::ShadowSentinel> at construction time.

Uses Pin<Box<dyn Future>> returns for dyn-compatibility (same pattern as ErasedToolExecutor).

Required Methods§

Source

fn probe<'a>( &'a self, qualified_tool_id: &'a str, args: &'a Value, turn_number: u64, risk_level: &'a str, ) -> Pin<Box<dyn Future<Output = ProbeOutcome> + Send + 'a>>

Evaluate whether the tool call at qualified_tool_id with args is safe.

Provided Methods§

Source

fn record<'a>( &'a self, qualified_tool_id: &'a str, turn_number: u64, risk_level: &'a str, context_summary: &'a str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>

Record a completed tool call in the persistent safety event stream.

Called by ShadowProbeExecutor after a probe outcome of Allow or Deny (never Skip — recording every low-risk/disabled-feature call would flood the store with noise and defeat the purpose of cross-session pattern detection). Best-effort: no error is surfaced to the tool-dispatch path.

Default implementation is a no-op, so gates that don’t back a persistent store (e.g. test doubles) don’t need to implement it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§