pub struct TrustGateExecutor<T: ToolExecutor> { /* private fields */ }Expand description
Wraps an inner ToolExecutor and applies trust-level permission overlays.
Implementations§
Source§impl<T: ToolExecutor> TrustGateExecutor<T>
impl<T: ToolExecutor> TrustGateExecutor<T>
pub fn new(inner: T, policy: PermissionPolicy) -> Self
Sourcepub fn mcp_tool_ids_handle(&self) -> Arc<RwLock<HashSet<String>>> ⓘ
pub fn mcp_tool_ids_handle(&self) -> Arc<RwLock<HashSet<String>>> ⓘ
Returns the shared MCP tool ID set so the caller can populate it after
MCP servers have connected (and after TrustGateExecutor has been wrapped
in a DynExecutor).
Sourcepub fn with_trust_floor(self, floor: TurnTrustFloor) -> Self
pub fn with_trust_floor(self, floor: TurnTrustFloor) -> Self
Replaces this gate’s trust floor with an externally-owned, shared one (#6701).
Use when another component (e.g. SkillTrustGate) must observe and fold the exact
same cell this gate reads in check_trust — pass the same
TurnTrustFloor to both instead of relying on trust_floor,
which can only be called after this gate already exists.
Sourcepub fn trust_floor(&self) -> TurnTrustFloor
pub fn trust_floor(&self) -> TurnTrustFloor
Returns a clone of the shared per-turn trust floor (#6701).
Cloning is cheap (an Arc clone) and shares the same underlying cell — callers that
need to downgrade trust from outside the ToolExecutor trait chain (e.g. a subagent
spawn applying an inherited trust cap, or SkillTrustGate::resolve_body degrading on
a Quarantined body read) can call TurnTrustFloor::fold on the returned handle
directly instead of routing a set_effective_trust call back down through every
wrapping executor layer.
pub fn set_effective_trust(&self, level: SkillTrustLevel)
pub fn effective_trust(&self) -> SkillTrustLevel
Trait Implementations§
Source§impl<T: ToolExecutor + Debug> Debug for TrustGateExecutor<T>
impl<T: ToolExecutor + Debug> Debug for TrustGateExecutor<T>
Source§impl<T: ToolExecutor> ToolExecutor for TrustGateExecutor<T>
impl<T: ToolExecutor> ToolExecutor for TrustGateExecutor<T>
Source§fn requires_confirmation(&self, call: &ToolCall) -> bool
fn requires_confirmation(&self, call: &ToolCall) -> bool
Returns true when the current policy would require confirmation for call.
Mirrors the decision in execute_tool_call without
executing the tool. The speculative engine calls this to skip dispatch for tools
that require user approval.
Source§async fn execute(&self, response: &str) -> Result<Option<ToolOutput>, ToolError>
async fn execute(&self, response: &str) -> Result<Option<ToolOutput>, ToolError>
response for fenced tool blocks and execute them. Read moreSource§async fn execute_confirmed(
&self,
response: &str,
) -> Result<Option<ToolOutput>, ToolError>
async fn execute_confirmed( &self, response: &str, ) -> Result<Option<ToolOutput>, ToolError>
Source§fn tool_definitions(&self) -> Vec<ToolDef>
fn tool_definitions(&self) -> Vec<ToolDef>
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>
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>
Source§fn set_skill_env(&self, env: Option<HashMap<String, String>>)
fn set_skill_env(&self, env: Option<HashMap<String, String>>)
Source§fn is_tool_retryable(&self, tool_id: &str) -> bool
fn is_tool_retryable(&self, tool_id: &str) -> bool
Source§fn is_tool_speculatable(&self, tool_id: &str) -> bool
fn is_tool_speculatable(&self, tool_id: &str) -> bool
Source§fn checkpoint_undo(&self, n: usize) -> CheckpointActionResult
fn checkpoint_undo(&self, n: usize) -> CheckpointActionResult
n checkpointed write commands. Read moreSource§fn checkpoint_redo(&self) -> CheckpointActionResult
fn checkpoint_redo(&self) -> CheckpointActionResult
Source§fn checkpoint_list(&self) -> CheckpointListResult
fn checkpoint_list(&self) -> CheckpointListResult
Source§fn set_effective_trust(&self, level: SkillTrustLevel)
fn set_effective_trust(&self, level: SkillTrustLevel)
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TrustGateExecutor<T>
impl<T> !UnwindSafe for TrustGateExecutor<T>
impl<T> Freeze for TrustGateExecutor<T>where
T: Freeze,
impl<T> Send for TrustGateExecutor<T>
impl<T> Sync for TrustGateExecutor<T>
impl<T> Unpin for TrustGateExecutor<T>where
T: Unpin,
impl<T> UnsafeUnpin for TrustGateExecutor<T>where
T: UnsafeUnpin,
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>>
Source§fn execute_tool_call_confirmed_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>>
ToolExecutor::execute_tool_call_confirmed reach it through the blanket impl below.
Other implementors should fall back to
execute_tool_call_erased (normal
enforcement path) unless they need to replicate confirmed-path-specific behavior
(e.g. a fallback that only applies on the unconfirmed path must be mirrored
explicitly, not assumed). See
erased_tool_executor_no_inner_defaults!
for leaf executors with no wrapped inner.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 checkpoint_undo_erased(&self, n: usize) -> CheckpointActionResult
fn checkpoint_undo_erased(&self, n: usize) -> CheckpointActionResult
n checkpointed write commands. Read moreSource§fn checkpoint_redo_erased(&self) -> CheckpointActionResult
fn checkpoint_redo_erased(&self) -> CheckpointActionResult
Source§fn checkpoint_list_erased(&self) -> CheckpointListResult
fn checkpoint_list_erased(&self) -> CheckpointListResult
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