From dfb5c0cf7a5f50d8fc30f7ee2546f071f4fe0cfb Mon Sep 17 00:00:00 2001 From: Adam Perry Date: Wed, 10 Jun 2026 04:38:37 +0000 Subject: [PATCH] Outline ToolExecutor handler bodies --- .../src/tools/code_mode/execute_handler.rs | 9 +++++++++ .../core/src/tools/code_mode/wait_handler.rs | 9 +++++++++ .../agent_jobs/report_agent_job_result.rs | 9 +++++++++ .../handlers/agent_jobs/spawn_agents_on_csv.rs | 9 +++++++++ .../core/src/tools/handlers/apply_patch.rs | 9 +++++++++ codex-rs/core/src/tools/handlers/dynamic.rs | 9 +++++++++ .../core/src/tools/handlers/extension_tools.rs | 18 ++++++++++++++++++ .../list_available_plugins_to_install.rs | 9 +++++++++ codex-rs/core/src/tools/handlers/mcp.rs | 9 +++++++++ .../list_mcp_resource_templates.rs | 9 +++++++++ .../mcp_resource/list_mcp_resources.rs | 9 +++++++++ .../handlers/mcp_resource/read_mcp_resource.rs | 9 +++++++++ .../tools/handlers/multi_agents/send_input.rs | 9 +++++++++ .../src/tools/handlers/multi_agents/wait.rs | 9 +++++++++ .../handlers/multi_agents_v2/followup_task.rs | 9 +++++++++ .../handlers/multi_agents_v2/list_agents.rs | 9 +++++++++ .../handlers/multi_agents_v2/send_message.rs | 9 +++++++++ .../src/tools/handlers/multi_agents_v2/wait.rs | 9 +++++++++ codex-rs/core/src/tools/handlers/plan.rs | 9 +++++++++ .../src/tools/handlers/request_permissions.rs | 9 +++++++++ .../tools/handlers/request_plugin_install.rs | 9 +++++++++ .../src/tools/handlers/request_user_input.rs | 9 +++++++++ .../src/tools/handlers/shell/shell_command.rs | 9 +++++++++ codex-rs/core/src/tools/handlers/test_sync.rs | 9 +++++++++ .../core/src/tools/handlers/tool_search.rs | 9 +++++++++ .../handlers/unified_exec/exec_command.rs | 9 +++++++++ .../tools/handlers/unified_exec/write_stdin.rs | 9 +++++++++ codex-rs/core/src/tools/handlers/view_image.rs | 9 +++++++++ codex-rs/core/src/tools/parallel.rs | 9 +++++++++ codex-rs/core/src/tools/registry_tests.rs | 8 ++++++++ codex-rs/core/src/tools/router_tests.rs | 9 +++++++++ codex-rs/ext/image-generation/src/tool.rs | 6 ++++++ codex-rs/ext/memories/src/tools/ad_hoc_note.rs | 13 +++++++++++++ codex-rs/ext/memories/src/tools/list.rs | 13 +++++++++++++ codex-rs/ext/memories/src/tools/read.rs | 13 +++++++++++++ codex-rs/ext/memories/src/tools/search.rs | 13 +++++++++++++ codex-rs/ext/web-search/src/tool.rs | 6 ++++++ 37 files changed, 351 insertions(+) diff --git a/codex-rs/core/src/tools/code_mode/execute_handler.rs b/codex-rs/core/src/tools/code_mode/execute_handler.rs index 1d69c8f4cc4a..0bdb8b20a6eb 100644 --- a/codex-rs/core/src/tools/code_mode/execute_handler.rs +++ b/codex-rs/core/src/tools/code_mode/execute_handler.rs @@ -104,6 +104,15 @@ impl ToolExecutor for CodeModeExecuteHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl CodeModeExecuteHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/code_mode/wait_handler.rs b/codex-rs/core/src/tools/code_mode/wait_handler.rs index 74cc314a7bd5..c1928955f4a4 100644 --- a/codex-rs/core/src/tools/code_mode/wait_handler.rs +++ b/codex-rs/core/src/tools/code_mode/wait_handler.rs @@ -57,6 +57,15 @@ impl ToolExecutor for CodeModeWaitHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl CodeModeWaitHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs b/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs index c7adb27610af..5f2a6153295b 100644 --- a/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs +++ b/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs @@ -26,6 +26,15 @@ impl ToolExecutor for ReportAgentJobResultHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ReportAgentJobResultHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, payload, .. diff --git a/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs b/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs index 26438ca7ba49..16e1b1f72c87 100644 --- a/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs +++ b/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs @@ -27,6 +27,15 @@ impl ToolExecutor for SpawnAgentsOnCsvHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl SpawnAgentsOnCsvHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs index 66fb1d308092..6a322ed6aea4 100644 --- a/codex-rs/core/src/tools/handlers/apply_patch.rs +++ b/codex-rs/core/src/tools/handlers/apply_patch.rs @@ -318,6 +318,15 @@ impl ToolExecutor for ApplyPatchHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ApplyPatchHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/dynamic.rs b/codex-rs/core/src/tools/handlers/dynamic.rs index a74f44fd6d2d..e0151cf18967 100644 --- a/codex-rs/core/src/tools/handlers/dynamic.rs +++ b/codex-rs/core/src/tools/handlers/dynamic.rs @@ -89,6 +89,15 @@ impl ToolExecutor for DynamicToolHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl DynamicToolHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/extension_tools.rs b/codex-rs/core/src/tools/handlers/extension_tools.rs index 5e177156c64b..a94c764a9f78 100644 --- a/codex-rs/core/src/tools/handlers/extension_tools.rs +++ b/codex-rs/core/src/tools/handlers/extension_tools.rs @@ -221,6 +221,15 @@ mod tests { async fn handle( &self, call: codex_tools::ToolCall, + ) -> Result, codex_tools::FunctionCallError> { + self.handle_call(call).await + } + } + + impl CapturingExtensionExecutor { + async fn handle_call( + &self, + call: codex_tools::ToolCall, ) -> Result, codex_tools::FunctionCallError> { let item = ExtensionTurnItem::WebSearch(WebSearchItem { id: call.call_id.clone(), @@ -452,6 +461,15 @@ mod tests { async fn handle( &self, call: codex_tools::ToolCall, + ) -> Result, codex_tools::FunctionCallError> { + self.handle_call(call).await + } + } + + impl ImageGenerationExtensionExecutor { + async fn handle_call( + &self, + call: codex_tools::ToolCall, ) -> Result, codex_tools::FunctionCallError> { call.turn_item_emitter .emit_started(ExtensionTurnItem::ImageGeneration( diff --git a/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs b/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs index d18a1ca36e10..2b782e4552f2 100644 --- a/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs +++ b/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs @@ -71,6 +71,15 @@ impl ToolExecutor for ListAvailablePluginsToInstallHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ListAvailablePluginsToInstallHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { payload, .. } = invocation; match payload { diff --git a/codex-rs/core/src/tools/handlers/mcp.rs b/codex-rs/core/src/tools/handlers/mcp.rs index 77ff3c14a3c1..d60cdfdd0cff 100644 --- a/codex-rs/core/src/tools/handlers/mcp.rs +++ b/codex-rs/core/src/tools/handlers/mcp.rs @@ -116,6 +116,15 @@ impl ToolExecutor for McpHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl McpHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs index e96aad7552ea..8974d678fdde 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs @@ -43,6 +43,15 @@ impl ToolExecutor for ListMcpResourceTemplatesHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ListMcpResourceTemplatesHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs index 1b052184eece..f3a7b43c28bf 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs @@ -43,6 +43,15 @@ impl ToolExecutor for ListMcpResourcesHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ListMcpResourcesHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs b/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs index f059d12c841c..9861e5d22d68 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs @@ -43,6 +43,15 @@ impl ToolExecutor for ReadMcpResourceHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ReadMcpResourceHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs index 6e28d0a1d97e..b811faf91a6f 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs @@ -26,6 +26,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs index 525ee7f2ed3b..1f6b7db8f10e 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs @@ -47,6 +47,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs index 2fe09f5f217d..66a39cc79d06 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs @@ -20,6 +20,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let arguments = function_arguments(invocation.payload.clone())?; let args: FollowupTaskArgs = parse_arguments(&arguments)?; diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs index 46b29bdf10c9..18421278fe00 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs @@ -18,6 +18,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs index a8e3605840ed..2fd636a85c5f 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs @@ -20,6 +20,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let arguments = function_arguments(invocation.payload.clone())?; let args: SendMessageArgs = parse_arguments(&arguments)?; diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs index 5e37725b7792..9d671b1989a6 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs @@ -32,6 +32,15 @@ impl ToolExecutor for Handler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl Handler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/plan.rs b/codex-rs/core/src/tools/handlers/plan.rs index bd1060b3d794..ff18a3281318 100644 --- a/codex-rs/core/src/tools/handlers/plan.rs +++ b/codex-rs/core/src/tools/handlers/plan.rs @@ -58,6 +58,15 @@ impl ToolExecutor for PlanHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl PlanHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/request_permissions.rs b/codex-rs/core/src/tools/handlers/request_permissions.rs index a20ff2b6654b..7c24f15697a1 100644 --- a/codex-rs/core/src/tools/handlers/request_permissions.rs +++ b/codex-rs/core/src/tools/handlers/request_permissions.rs @@ -38,6 +38,15 @@ impl ToolExecutor for RequestPermissionsHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl RequestPermissionsHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/request_plugin_install.rs b/codex-rs/core/src/tools/handlers/request_plugin_install.rs index ce5bb3fb1f12..64625aaac0d6 100644 --- a/codex-rs/core/src/tools/handlers/request_plugin_install.rs +++ b/codex-rs/core/src/tools/handlers/request_plugin_install.rs @@ -65,6 +65,15 @@ impl ToolExecutor for RequestPluginInstallHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl RequestPluginInstallHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { payload, diff --git a/codex-rs/core/src/tools/handlers/request_user_input.rs b/codex-rs/core/src/tools/handlers/request_user_input.rs index 0aa4b4f6f848..3f3adf0ba39f 100644 --- a/codex-rs/core/src/tools/handlers/request_user_input.rs +++ b/codex-rs/core/src/tools/handlers/request_user_input.rs @@ -33,6 +33,15 @@ impl ToolExecutor for RequestUserInputHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl RequestUserInputHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/shell/shell_command.rs b/codex-rs/core/src/tools/handlers/shell/shell_command.rs index 7c492b3646db..e9fcf82046db 100644 --- a/codex-rs/core/src/tools/handlers/shell/shell_command.rs +++ b/codex-rs/core/src/tools/handlers/shell/shell_command.rs @@ -144,6 +144,15 @@ impl ToolExecutor for ShellCommandHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ShellCommandHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/test_sync.rs b/codex-rs/core/src/tools/handlers/test_sync.rs index 0e5fe894ad19..802859c916c3 100644 --- a/codex-rs/core/src/tools/handlers/test_sync.rs +++ b/codex-rs/core/src/tools/handlers/test_sync.rs @@ -74,6 +74,15 @@ impl ToolExecutor for TestSyncHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl TestSyncHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { payload, .. } = invocation; diff --git a/codex-rs/core/src/tools/handlers/tool_search.rs b/codex-rs/core/src/tools/handlers/tool_search.rs index 2de1e20dd406..a4781e75e212 100644 --- a/codex-rs/core/src/tools/handlers/tool_search.rs +++ b/codex-rs/core/src/tools/handlers/tool_search.rs @@ -70,6 +70,15 @@ impl ToolExecutor for ToolSearchHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ToolSearchHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { payload, .. } = invocation; diff --git a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs index ba69f0d03910..9fe3b343b571 100644 --- a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs +++ b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs @@ -95,6 +95,15 @@ impl ToolExecutor for ExecCommandHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ExecCommandHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs index a639ea006516..9b319d54336c 100644 --- a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs +++ b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs @@ -44,6 +44,15 @@ impl ToolExecutor for WriteStdinHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl WriteStdinHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let ToolInvocation { session, diff --git a/codex-rs/core/src/tools/handlers/view_image.rs b/codex-rs/core/src/tools/handlers/view_image.rs index 5a67db1a660e..eb761359a7a8 100644 --- a/codex-rs/core/src/tools/handlers/view_image.rs +++ b/codex-rs/core/src/tools/handlers/view_image.rs @@ -81,6 +81,15 @@ impl ToolExecutor for ViewImageHandler { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } +} + +impl ViewImageHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { if !invocation .turn diff --git a/codex-rs/core/src/tools/parallel.rs b/codex-rs/core/src/tools/parallel.rs index 7db1ec964367..a6f630a342c0 100644 --- a/codex-rs/core/src/tools/parallel.rs +++ b/codex-rs/core/src/tools/parallel.rs @@ -314,6 +314,15 @@ mod tests { async fn handle( &self, invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call(invocation).await + } + } + + impl CancellationCleanupHandler { + async fn handle_call( + &self, + invocation: ToolInvocation, ) -> Result, FunctionCallError> { let started = self .started diff --git a/codex-rs/core/src/tools/registry_tests.rs b/codex-rs/core/src/tools/registry_tests.rs index f2566251c582..cc7f39e2a39a 100644 --- a/codex-rs/core/src/tools/registry_tests.rs +++ b/codex-rs/core/src/tools/registry_tests.rs @@ -51,6 +51,14 @@ impl ToolExecutor for LifecycleTestHandler { async fn handle( &self, _invocation: ToolInvocation, + ) -> Result, FunctionCallError> { + self.handle_call().await + } +} + +impl LifecycleTestHandler { + async fn handle_call( + &self, ) -> Result, FunctionCallError> { match self.result.clone() { LifecycleTestResult::Ok { success } => Ok(Box::new( diff --git a/codex-rs/core/src/tools/router_tests.rs b/codex-rs/core/src/tools/router_tests.rs index 7c3e0157bc60..a9a52ca463c7 100644 --- a/codex-rs/core/src/tools/router_tests.rs +++ b/codex-rs/core/src/tools/router_tests.rs @@ -76,6 +76,15 @@ impl ToolExecutor for ExtensionEchoExecutor { async fn handle( &self, call: ExtensionToolCall, + ) -> Result, codex_tools::FunctionCallError> { + self.handle_call(call).await + } +} + +impl ExtensionEchoExecutor { + async fn handle_call( + &self, + call: ExtensionToolCall, ) -> Result, codex_tools::FunctionCallError> { let arguments: serde_json::Value = serde_json::from_str(call.function_arguments()?).expect("test arguments should parse"); diff --git a/codex-rs/ext/image-generation/src/tool.rs b/codex-rs/ext/image-generation/src/tool.rs index 69b99bdbc42e..70880b4661fe 100644 --- a/codex-rs/ext/image-generation/src/tool.rs +++ b/codex-rs/ext/image-generation/src/tool.rs @@ -97,6 +97,12 @@ impl ToolExecutor for ImageGenerationTool { /// Executes the selected image operation and returns the completed image result. async fn handle(&self, call: ToolCall) -> Result, FunctionCallError> { + self.handle_call(call).await + } +} + +impl ImageGenerationTool { + async fn handle_call(&self, call: ToolCall) -> Result, FunctionCallError> { let args = parse_args(&call)?; let request = request_for_args(&args, call.conversation_history.items())?; call.turn_item_emitter diff --git a/codex-rs/ext/memories/src/tools/ad_hoc_note.rs b/codex-rs/ext/memories/src/tools/ad_hoc_note.rs index a6712a40229b..3495d57d3288 100644 --- a/codex-rs/ext/memories/src/tools/ad_hoc_note.rs +++ b/codex-rs/ext/memories/src/tools/ad_hoc_note.rs @@ -61,6 +61,19 @@ where &self, call: ToolCall, ) -> Result, codex_extension_api::FunctionCallError> + { + self.handle_call(call).await + } +} + +impl AddAdHocNoteTool +where + B: MemoriesBackend, +{ + async fn handle_call( + &self, + call: ToolCall, + ) -> Result, codex_extension_api::FunctionCallError> { let backend = self.backend.clone(); let args: AddAdHocNoteArgs = parse_args(&call)?; diff --git a/codex-rs/ext/memories/src/tools/list.rs b/codex-rs/ext/memories/src/tools/list.rs index 301c7cab71b0..d3b23b1ca2e4 100644 --- a/codex-rs/ext/memories/src/tools/list.rs +++ b/codex-rs/ext/memories/src/tools/list.rs @@ -59,6 +59,19 @@ where &self, call: ToolCall, ) -> Result, codex_extension_api::FunctionCallError> + { + self.handle_call(call).await + } +} + +impl ListTool +where + B: MemoriesBackend, +{ + async fn handle_call( + &self, + call: ToolCall, + ) -> Result, codex_extension_api::FunctionCallError> { let backend = self.backend.clone(); let args: ListArgs = parse_args(&call)?; diff --git a/codex-rs/ext/memories/src/tools/read.rs b/codex-rs/ext/memories/src/tools/read.rs index 33ede3c6003b..e408a17cad70 100644 --- a/codex-rs/ext/memories/src/tools/read.rs +++ b/codex-rs/ext/memories/src/tools/read.rs @@ -58,6 +58,19 @@ where &self, call: ToolCall, ) -> Result, codex_extension_api::FunctionCallError> + { + self.handle_call(call).await + } +} + +impl ReadTool +where + B: MemoriesBackend, +{ + async fn handle_call( + &self, + call: ToolCall, + ) -> Result, codex_extension_api::FunctionCallError> { let backend = self.backend.clone(); let args: ReadArgs = parse_args(&call)?; diff --git a/codex-rs/ext/memories/src/tools/search.rs b/codex-rs/ext/memories/src/tools/search.rs index 1d0507270308..cc8ba201a658 100644 --- a/codex-rs/ext/memories/src/tools/search.rs +++ b/codex-rs/ext/memories/src/tools/search.rs @@ -67,6 +67,19 @@ where &self, call: ToolCall, ) -> Result, codex_extension_api::FunctionCallError> + { + self.handle_call(call).await + } +} + +impl SearchTool +where + B: MemoriesBackend, +{ + async fn handle_call( + &self, + call: ToolCall, + ) -> Result, codex_extension_api::FunctionCallError> { let backend = self.backend.clone(); let args: SearchArgs = parse_args(&call)?; diff --git a/codex-rs/ext/web-search/src/tool.rs b/codex-rs/ext/web-search/src/tool.rs index 35f126dd6baa..1de65edf8653 100644 --- a/codex-rs/ext/web-search/src/tool.rs +++ b/codex-rs/ext/web-search/src/tool.rs @@ -75,6 +75,12 @@ impl ToolExecutor for WebSearchTool { } async fn handle(&self, call: ToolCall) -> Result, FunctionCallError> { + self.handle_call(call).await + } +} + +impl WebSearchTool { + async fn handle_call(&self, call: ToolCall) -> Result, FunctionCallError> { let commands = parse_commands(&call)?; let command_action = command_action(&commands); let provider = self