mirror of
https://github.com/openai/codex.git
synced 2026-11-08 08:37:30 +00:00
## Why `codex_tools::ToolExecutor` keeps a tool spec attached to its runtime handler, but extension tools still carried a parallel `ExtensionToolFuture` / `ExtensionToolExecutor` shape. That made extension-owned tools look different from host tools even though routing, registration, and execution need the same abstraction. This PR makes the shared executor contract directly async and lets extension tools implement it too, so host tools and extension tools can move through the same registration path. ## What changed - Changed `ToolExecutor::handle` to an `async fn` using `async-trait`, and updated built-in tool handlers to implement the async trait directly. - Replaced the bespoke `ExtensionToolFuture` contract with a marker `ExtensionToolExecutor` over `ToolExecutor<ToolCall, Output = JsonToolOutput>`, re-exporting `ToolExecutor` from `codex-extension-api`. - Updated the memories extension tools to implement the shared executor trait. - Split tool-router construction into collected executors plus hosted model specs, keeping hosted tools like web search and image generation separate from executable handlers. - Updated spec/router tests and extension-tool stubs for the new executor shape. ## Verification - Not run locally.
16 lines
666 B
Rust
16 lines
666 B
Rust
use codex_tools::JsonToolOutput;
|
|
use codex_tools::ToolCall;
|
|
use codex_tools::ToolExecutor;
|
|
|
|
/// Model-facing output returned by extension-owned tools.
|
|
pub type ExtensionToolOutput = JsonToolOutput;
|
|
|
|
/// Thin alias for extension-owned executable tools.
|
|
///
|
|
/// Extensions implement the shared `ToolExecutor<ToolCall>` contract directly;
|
|
/// the marker keeps contributor signatures readable while preserving one
|
|
/// executable-tool abstraction across host and extension tools.
|
|
pub trait ExtensionToolExecutor: ToolExecutor<ToolCall, Output = ExtensionToolOutput> {}
|
|
|
|
impl<T> ExtensionToolExecutor for T where T: ToolExecutor<ToolCall, Output = ExtensionToolOutput> {}
|