Remove async-trait from ToolExecutor

This commit is contained in:
jif-oai
2026-06-10 14:38:10 +01:00
parent d2f6d23c6c
commit 81509e8d03
56 changed files with 2097 additions and 2117 deletions
-1
View File
@@ -8,7 +8,6 @@ version.workspace = true
workspace = true
[dependencies]
async-trait = { workspace = true }
codex-app-server-protocol = { workspace = true }
codex-code-mode = { workspace = true }
codex-features = { workspace = true }
+1
View File
@@ -92,6 +92,7 @@ pub use tool_discovery::TOOL_SEARCH_TOOL_NAME;
pub use tool_discovery::ToolSearchSourceInfo;
pub use tool_discovery::collect_request_plugin_install_entries;
pub use tool_discovery::filter_request_plugin_install_discoverable_tools_for_client;
pub use tool_executor::ToolExecutionFuture;
pub use tool_executor::ToolExecutor;
pub use tool_executor::ToolExposure;
pub use tool_output::JsonToolOutput;
+8 -5
View File
@@ -1,9 +1,16 @@
use std::future::Future;
use std::pin::Pin;
use crate::FunctionCallError;
use crate::ToolName;
use crate::ToolOutput;
use crate::ToolSearchInfo;
use crate::ToolSpec;
/// Boxed, sendable future returned by a tool executor.
pub type ToolExecutionFuture<'a> =
Pin<Box<dyn Future<Output = Result<Box<dyn ToolOutput>, FunctionCallError>> + Send + 'a>>;
/// Controls where a tool is exposed to the model.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ToolExposure {
@@ -40,7 +47,6 @@ impl ToolExposure {
/// Implementations keep the model-visible spec tied to the executable runtime.
/// Host crates can layer routing, hooks, telemetry, or other orchestration on
/// top without reopening the spec/runtime split.
#[async_trait::async_trait]
pub trait ToolExecutor<Invocation>: Send + Sync {
/// The concrete tool name handled by this runtime instance.
fn tool_name(&self) -> ToolName;
@@ -60,8 +66,5 @@ pub trait ToolExecutor<Invocation>: Send + Sync {
false
}
async fn handle(
&self,
invocation: Invocation,
) -> Result<Box<dyn ToolOutput>, FunctionCallError>;
fn handle<'a>(&'a self, invocation: Invocation) -> ToolExecutionFuture<'a>;
}