Skip to main content

ErasedToolExecutor

Trait ErasedToolExecutor 

Source
pub trait ErasedToolExecutor: Send + Sync {
Show 13 methods // Required methods 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>>; fn checkpoint_undo_erased(&self, n: usize) -> CheckpointActionResult; fn checkpoint_redo_erased(&self) -> CheckpointActionResult; fn checkpoint_list_erased(&self) -> CheckpointListResult; fn is_tool_retryable_erased(&self, tool_id: &str) -> bool; fn is_tool_speculatable_erased(&self, _tool_id: &str) -> bool; fn requires_confirmation_erased(&self, _call: &ToolCall) -> bool; // Provided methods fn set_skill_env(&self, _env: Option<HashMap<String, String>>) { ... } fn set_effective_trust(&self, _level: SkillTrustLevel) { ... }
}
Expand description

Object-safe erased version of ToolExecutor using boxed futures.

Because ToolExecutor uses impl Future return types, it is not object-safe and cannot be used as dyn ToolExecutor. This trait provides the same interface with Pin<Box<dyn Future>> returns, enabling dynamic dispatch.

Implemented automatically for all T: ToolExecutor + 'static via the blanket impl below. Use DynExecutor or Box<dyn ErasedToolExecutor> when runtime polymorphism is needed.

Required Methods§

Source

fn execute_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn execute_confirmed_erased<'a>( &'a self, response: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<ToolOutput>, ToolError>> + Send + 'a>>

Source

fn tool_definitions_erased(&self) -> Vec<ToolDef>

Source

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>>

Required (no default). TrustGateExecutor-style wrappers that override 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 checkpoint_undo_erased(&self, n: usize) -> CheckpointActionResult

Undo the last n checkpointed write commands.

Required (no default). Wrappers must forward to their inner executor — see erased_tool_executor_forward!. Leaf executors with no checkpoint support should return CheckpointActionResult::unsupported.

Source

fn checkpoint_redo_erased(&self) -> CheckpointActionResult

Redo the last undone checkpoint.

Required (no default). See checkpoint_undo_erased.

Source

fn checkpoint_list_erased(&self) -> CheckpointListResult

List the current undo stack entries and redo depth.

Required (no default). See checkpoint_undo_erased.

Source

fn is_tool_retryable_erased(&self, tool_id: &str) -> bool

Whether the executor can safely retry this tool call on a transient error.

Source

fn is_tool_speculatable_erased(&self, _tool_id: &str) -> bool

Whether a tool call can be safely dispatched speculatively.

Required (no default). Return false unless the executor is read-only and idempotent for the given tool.

Source

fn requires_confirmation_erased(&self, _call: &ToolCall) -> bool

Return true when call would require user confirmation before execution.

This is a pure metadata/policy query — implementations must not execute the tool. Used by the speculative engine to gate dispatch without causing double side-effects.

Required (no default). Return true (confirmation required) unless the executor explicitly wants to allow speculative dispatch. The blanket impl for T: ToolExecutor delegates to ToolExecutor::requires_confirmation.

Provided Methods§

Source

fn set_skill_env(&self, _env: Option<HashMap<String, String>>)

Inject environment variables for the currently active skill. No-op by default.

Source

fn set_effective_trust(&self, _level: SkillTrustLevel)

Set the effective trust level for the currently active skill. No-op by default.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§