pub struct ShadowProbeExecutor<T: ToolExecutor> { /* private fields */ }Expand description
Wraps an inner ToolExecutor and applies an LLM safety probe before high-risk calls.
ShadowProbeExecutor<T> is Clone when T: Clone (not required for operation).
All methods delegate to inner after a probe verdict of Allow or Skip.
§Concurrency
The probe field is Arc<dyn ProbeGate>, so multiple ShadowProbeExecutor instances
sharing the same underlying ShadowSentinel (e.g., during parallel tool dispatch) are safe.
Implementations§
Source§impl<T: ToolExecutor> ShadowProbeExecutor<T>
impl<T: ToolExecutor> ShadowProbeExecutor<T>
Sourcepub fn new(
inner: T,
probe: Arc<dyn ProbeGate>,
turn_number: Arc<AtomicU64>,
risk_level: Arc<RwLock<String>>,
) -> Self
pub fn new( inner: T, probe: Arc<dyn ProbeGate>, turn_number: Arc<AtomicU64>, risk_level: Arc<RwLock<String>>, ) -> Self
Create a new ShadowProbeExecutor wrapping inner.
§Arguments
inner— the next executor in the chain (typicallyPolicyGateExecutor).probe— the safety probe gate backed byShadowSentinel.turn_number— shared atomic counter updated by the agent loop.risk_level— shared risk level string updated by the agent loop.
Trait Implementations§
Source§impl<T: ToolExecutor + Debug> Debug for ShadowProbeExecutor<T>
impl<T: ToolExecutor + Debug> Debug for ShadowProbeExecutor<T>
Source§impl<T: ToolExecutor> ToolExecutor for ShadowProbeExecutor<T>
impl<T: ToolExecutor> ToolExecutor for ShadowProbeExecutor<T>
Source§async fn execute(&self, response: &str) -> Result<Option<ToolOutput>, ToolError>
async fn execute(&self, response: &str) -> Result<Option<ToolOutput>, ToolError>
Legacy fenced-block path: probe not applied (no structured tool id).
Source§async fn execute_confirmed(
&self,
response: &str,
) -> Result<Option<ToolOutput>, ToolError>
async fn execute_confirmed( &self, response: &str, ) -> Result<Option<ToolOutput>, ToolError>
Legacy confirmed path: probe not applied.
Source§async fn execute_tool_call(
&self,
call: &ToolCall,
) -> Result<Option<ToolOutput>, ToolError>
async fn execute_tool_call( &self, call: &ToolCall, ) -> Result<Option<ToolOutput>, ToolError>
Structured tool call path: probe is applied before delegation.
Returns ToolError::SafetyDenied if the probe returns Deny.
Delegates to inner on Allow or Skip.
Source§async fn execute_tool_call_confirmed(
&self,
call: &ToolCall,
) -> Result<Option<ToolOutput>, ToolError>
async fn execute_tool_call_confirmed( &self, call: &ToolCall, ) -> Result<Option<ToolOutput>, ToolError>
Confirmed structured path: probe is still applied.
User confirmation does not bypass the safety probe — they are orthogonal gates.
Source§fn tool_definitions(&self) -> Vec<ToolDef>
fn tool_definitions(&self) -> Vec<ToolDef>
Source§fn set_skill_env(&self, env: Option<HashMap<String, String>>)
fn set_skill_env(&self, env: Option<HashMap<String, String>>)
Source§fn set_effective_trust(&self, level: SkillTrustLevel)
fn set_effective_trust(&self, level: SkillTrustLevel)
Source§fn is_tool_retryable(&self, tool_id: &str) -> bool
fn is_tool_retryable(&self, tool_id: &str) -> bool
Auto Trait Implementations§
impl<T> Freeze for ShadowProbeExecutor<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ShadowProbeExecutor<T>
impl<T> Send for ShadowProbeExecutor<T>
impl<T> Sync for ShadowProbeExecutor<T>
impl<T> Unpin for ShadowProbeExecutor<T>where
T: Unpin,
impl<T> UnsafeUnpin for ShadowProbeExecutor<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for ShadowProbeExecutor<T>
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> ErasedToolExecutor for Twhere
T: ToolExecutor,
impl<T> ErasedToolExecutor for Twhere
T: ToolExecutor,
fn execute_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>
fn execute_confirmed_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>
fn tool_definitions_erased(&self) -> Vec<ToolDef>
fn execute_tool_call_erased<'a>( &'a self, call: &'a ToolCall, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>
fn execute_tool_call_confirmed_erased<'a>( &'a self, call: &'a ToolCall, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>
Source§fn set_skill_env(&self, env: Option<HashMap<String, String>>)
fn set_skill_env(&self, env: Option<HashMap<String, String>>)
Source§fn set_effective_trust(&self, level: SkillTrustLevel)
fn set_effective_trust(&self, level: SkillTrustLevel)
Source§fn is_tool_retryable_erased(&self, tool_id: &str) -> bool
fn is_tool_retryable_erased(&self, tool_id: &str) -> bool
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