mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Simplify tool executor lifetimes (#64159)
## Why Extension tools borrow host capabilities for each call. Expressing that borrow in the executor's type argument requires higher-ranked lifetime bounds wherever extension executors are stored or returned. ## What changed Define the per-call input as `ToolInput::Call<'a>` so `ToolExecutor` can use the same lifetime for the input, the executor borrow, and the returned future while remaining usable as a trait object. Default to borrowed `ToolCall<'a>` inputs so extension contributors can return `Arc<dyn ToolExecutor>`. Core handlers continue to take owned `ToolInvocation` inputs. GitOrigin-RevId: efbf56c1e758c59a18b192d210c2ab1b368793e2
This commit is contained in:
@@ -39,7 +39,7 @@ use super::with_mcp_tool_call_ids_meta;
|
||||
pub async fn conversation_history_tools(
|
||||
parent: &Arc<CodexThread>,
|
||||
max_output_tokens: usize,
|
||||
) -> anyhow::Result<Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>>> {
|
||||
) -> anyhow::Result<Vec<Arc<dyn ToolExecutor>>> {
|
||||
let binding = history_binding(&parent.session).await?;
|
||||
let mut tools = Vec::new();
|
||||
for name in ["search_messages", "read_messages"] {
|
||||
@@ -63,8 +63,7 @@ pub async fn conversation_history_tools(
|
||||
parent: Arc::downgrade(&parent.session),
|
||||
function,
|
||||
max_output_tokens,
|
||||
})
|
||||
as Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>);
|
||||
}) as Arc<dyn ToolExecutor>);
|
||||
}
|
||||
Ok(tools)
|
||||
}
|
||||
@@ -93,7 +92,7 @@ struct HistoryTool {
|
||||
max_output_tokens: usize,
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for HistoryTool {
|
||||
impl ToolExecutor for HistoryTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced("user_message", &self.function.name)
|
||||
}
|
||||
@@ -114,10 +113,7 @@ impl<'call> ToolExecutor<ToolCall<'call>> for HistoryTool {
|
||||
ToolExposure::DirectModelOnly
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ToolCall<'a>) -> ToolExecutorFuture<'a> {
|
||||
Box::pin(async move {
|
||||
let result: anyhow::Result<Box<dyn ToolOutput>> = async {
|
||||
let parent = self.parent.upgrade().context("Parent thread has stopped")?;
|
||||
|
||||
@@ -106,10 +106,7 @@ impl ToolExecutor<ToolInvocation> for TestHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async {
|
||||
Ok(Box::new(FunctionToolOutput::from_text(
|
||||
"audit-probe-ok".to_string(),
|
||||
|
||||
@@ -179,10 +179,7 @@ impl ToolExecutor<ToolInvocation> for CodeModeExecuteHandler {
|
||||
self.spec.clone()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,10 +59,7 @@ impl ToolExecutor<ToolInvocation> for CodeModeWaitHandler {
|
||||
self.spec.clone()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,10 @@ pub struct ToolInvocation {
|
||||
pub(crate) environments: ToolEnvironments,
|
||||
}
|
||||
|
||||
impl codex_tools::ToolInput for ToolInvocation {
|
||||
type Call<'a> = Self;
|
||||
}
|
||||
|
||||
/// Identity of the model call that started a tool invocation, retained across code-mode waits.
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct ToolCallOrigin {
|
||||
|
||||
@@ -293,10 +293,7 @@ impl ToolExecutor<ToolInvocation> for ApplyPatchHandler {
|
||||
create_apply_patch_freeform_tool(self.multi_environment)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,10 +87,7 @@ impl ToolExecutor<ToolInvocation> for CurrentTimeHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
if !matches!(invocation.payload, ToolPayload::Function { .. }) {
|
||||
return Err(FunctionCallError::RespondToModel(format!(
|
||||
|
||||
@@ -120,10 +120,7 @@ impl ToolExecutor<ToolInvocation> for DynamicToolHandler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,14 +27,10 @@ use crate::tools::registry::CoreToolRuntime;
|
||||
use crate::tools::registry::ToolExecutor;
|
||||
use crate::turn_metadata::ExecutionMetadata;
|
||||
|
||||
pub(crate) struct ExtensionToolAdapter(
|
||||
Arc<dyn for<'call> codex_tools::ToolExecutor<ExtensionToolCall<'call>>>,
|
||||
);
|
||||
pub(crate) struct ExtensionToolAdapter(Arc<dyn ToolExecutor>);
|
||||
|
||||
impl ExtensionToolAdapter {
|
||||
pub(crate) fn new(
|
||||
executor: Arc<dyn for<'call> codex_tools::ToolExecutor<ExtensionToolCall<'call>>>,
|
||||
) -> Self {
|
||||
pub(crate) fn new(executor: Arc<dyn ToolExecutor>) -> Self {
|
||||
Self(executor)
|
||||
}
|
||||
}
|
||||
@@ -60,10 +56,7 @@ impl ToolExecutor<ToolInvocation> for ExtensionToolAdapter {
|
||||
self.0.search_info()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let step = &invocation.step_context;
|
||||
let selected: Vec<_> = match &invocation.environments {
|
||||
@@ -296,9 +289,7 @@ mod tests {
|
||||
|
||||
struct StubExtensionExecutor;
|
||||
|
||||
impl<'call> codex_extension_api::ToolExecutor<codex_tools::ToolCall<'call>>
|
||||
for StubExtensionExecutor
|
||||
{
|
||||
impl codex_extension_api::ToolExecutor for StubExtensionExecutor {
|
||||
fn tool_name(&self) -> codex_tools::ToolName {
|
||||
codex_tools::ToolName::plain("extension_echo")
|
||||
}
|
||||
@@ -324,11 +315,8 @@ mod tests {
|
||||
|
||||
fn handle<'a>(
|
||||
&'a self,
|
||||
_call: codex_tools::ToolCall<'call>,
|
||||
) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
_call: codex_tools::ToolCall<'a>,
|
||||
) -> codex_tools::ToolExecutorFuture<'a> {
|
||||
Box::pin(async {
|
||||
Ok(
|
||||
Box::new(codex_tools::JsonToolOutput::new(json!({ "ok": true })))
|
||||
@@ -343,9 +331,7 @@ mod tests {
|
||||
captured_sandbox_cwds: Arc<Mutex<Vec<PathUri>>>,
|
||||
}
|
||||
|
||||
impl<'call> codex_extension_api::ToolExecutor<codex_tools::ToolCall<'call>>
|
||||
for CapturingExtensionExecutor
|
||||
{
|
||||
impl codex_extension_api::ToolExecutor for CapturingExtensionExecutor {
|
||||
fn tool_name(&self) -> codex_tools::ToolName {
|
||||
codex_tools::ToolName::plain("extension_echo")
|
||||
}
|
||||
@@ -363,11 +349,8 @@ mod tests {
|
||||
|
||||
fn handle<'a>(
|
||||
&'a self,
|
||||
call: codex_tools::ToolCall<'call>,
|
||||
) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
call: codex_tools::ToolCall<'a>,
|
||||
) -> codex_tools::ToolExecutorFuture<'a> {
|
||||
Box::pin(self.handle_call(call))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,7 @@ impl ToolExecutor<ToolInvocation> for GetContextRemainingHandler {
|
||||
self.spec.clone()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
if !matches!(invocation.payload, ToolPayload::Function { .. }) {
|
||||
return Err(FunctionCallError::RespondToModel(
|
||||
|
||||
@@ -67,10 +67,7 @@ impl ToolExecutor<ToolInvocation> for ListAvailablePluginsToInstallHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,10 +235,7 @@ impl ToolExecutor<ToolInvocation> for McpHandler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,7 @@ impl ToolExecutor<ToolInvocation> for ListMcpResourceTemplatesHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,7 @@ impl ToolExecutor<ToolInvocation> for ListMcpResourcesHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,7 @@ impl ToolExecutor<ToolInvocation> for ReadMcpResourceHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move { handle_close_agent(invocation).await.map(boxed_tool_output) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move { handle_resume_agent(invocation).await.map(boxed_tool_output) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move { handle_spawn_agent(invocation).await.map(boxed_tool_output) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_followup_task_tool()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let mut analytics = ToolCallAnalytics::new(&invocation, CollabAgentTool::FollowupTask);
|
||||
let result = self.handle_call(invocation, &mut analytics).await;
|
||||
|
||||
@@ -17,10 +17,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_interrupt_agent_tool_v2()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let mut analytics =
|
||||
ToolCallAnalytics::new(&invocation, CollabAgentTool::InterruptAgent);
|
||||
|
||||
@@ -18,10 +18,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_list_agents_tool()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let analytics = ToolCallAnalytics::new(&invocation, CollabAgentTool::ListAgents);
|
||||
let result = self.handle_call(invocation).await;
|
||||
|
||||
@@ -17,10 +17,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_send_message_tool()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let mut analytics = ToolCallAnalytics::new(&invocation, CollabAgentTool::SendMessage);
|
||||
let result = self.handle_call(invocation, &mut analytics).await;
|
||||
|
||||
@@ -41,10 +41,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_spawn_agent_tool_v2(self.options.clone(), self.description_override.as_deref())
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let analytics = invocation.session.services.analytics_events_client.clone();
|
||||
let sender_thread_id = invocation.session.thread_id;
|
||||
|
||||
@@ -29,10 +29,7 @@ impl ToolExecutor<ToolInvocation> for Handler {
|
||||
create_wait_agent_tool_v2(self.options)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,7 @@ impl ToolExecutor<ToolInvocation> for NewContextWindowHandler {
|
||||
self.spec.clone()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
if !matches!(invocation.payload, ToolPayload::Function { .. }) {
|
||||
return Err(FunctionCallError::RespondToModel(
|
||||
|
||||
@@ -55,10 +55,7 @@ impl ToolExecutor<ToolInvocation> for PlanHandler {
|
||||
create_update_plan_tool()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,10 +94,7 @@ impl ToolExecutor<ToolInvocation> for RequestPermissionsHandler {
|
||||
create_request_permissions_tool(request_permissions_tool_description())
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,10 +81,7 @@ impl ToolExecutor<ToolInvocation> for RequestPluginInstallHandler {
|
||||
false
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,7 @@ impl ToolExecutor<ToolInvocation> for RequestUserInputHandler {
|
||||
create_request_user_input_tool(request_user_input_tool_description(&self.available_modes))
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +86,7 @@ impl ToolExecutor<ToolInvocation> for RequestUserInputAsyncHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let ToolInvocation {
|
||||
session,
|
||||
|
||||
@@ -56,10 +56,7 @@ impl ToolExecutor<ToolInvocation> for SendMessageToUserAsyncHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let ToolInvocation {
|
||||
session,
|
||||
|
||||
@@ -75,10 +75,7 @@ impl ToolExecutor<ToolInvocation> for SleepHandler {
|
||||
ToolExposure::DirectModelOnly
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let ToolInvocation {
|
||||
session,
|
||||
|
||||
@@ -73,10 +73,7 @@ impl ToolExecutor<ToolInvocation> for TestSyncHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,10 +212,7 @@ impl ToolExecutor<ToolInvocation> for ToolSearchHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,7 @@ impl ToolExecutor<ToolInvocation> for ExecCommandHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,7 @@ impl ToolExecutor<ToolInvocation> for WriteStdinHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,10 +88,7 @@ impl ToolExecutor<ToolInvocation> for ViewImageHandler {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(invocation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +105,7 @@ impl ToolExecutor<ToolInvocation> for WaitForEnvironmentHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async move {
|
||||
let ToolInvocation {
|
||||
payload,
|
||||
|
||||
@@ -125,10 +125,7 @@ impl ToolExecutor<ToolInvocation> for MultiAgentV2ToolOverrides {
|
||||
self.handler.search_info()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
self.handler.handle(invocation)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1010,10 +1010,7 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
self.calls.fetch_add(1, Ordering::Relaxed);
|
||||
Box::pin(async {
|
||||
Ok(
|
||||
|
||||
@@ -22,10 +22,7 @@ impl ToolExecutor<ToolInvocation> for TestHandler {
|
||||
test_spec(&self.tool_name)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async {
|
||||
Ok(
|
||||
Box::new(crate::tools::context::FunctionToolOutput::from_text(
|
||||
@@ -53,10 +50,7 @@ impl ToolExecutor<ToolInvocation> for ReadinessTestHandler {
|
||||
self.handler.spec()
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
self.handler.handle(invocation)
|
||||
}
|
||||
}
|
||||
@@ -89,10 +83,7 @@ impl ToolExecutor<ToolInvocation> for LifecycleTestHandler {
|
||||
test_spec(&self.tool_name)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
assert_eq!(
|
||||
invocation.tool_name,
|
||||
self.tool_name.clone().with_default_namespace()
|
||||
|
||||
@@ -116,14 +116,14 @@ impl codex_extension_api::ToolContributor for ExtensionEchoContributor {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
vec![Arc::new(ExtensionEchoExecutor)]
|
||||
}
|
||||
}
|
||||
|
||||
struct ExtensionEchoExecutor;
|
||||
|
||||
impl<'call> ToolExecutor<ExtensionToolCall<'call>> for ExtensionEchoExecutor {
|
||||
impl ToolExecutor for ExtensionEchoExecutor {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced("extension/", "echo")
|
||||
}
|
||||
@@ -151,10 +151,7 @@ impl<'call> ToolExecutor<ExtensionToolCall<'call>> for ExtensionEchoExecutor {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ExtensionToolCall<'call>) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ExtensionToolCall<'a>) -> codex_tools::ToolExecutorFuture<'a> {
|
||||
Box::pin(self.handle_call(call))
|
||||
}
|
||||
}
|
||||
@@ -184,9 +181,7 @@ fn extension_tool_test_registry() -> Arc<ExtensionRegistry<Config>> {
|
||||
fn test_tool_router(
|
||||
step_context: &StepContext,
|
||||
mcp_tools: Vec<RegisteredTool>,
|
||||
extension_tool_executors: impl IntoIterator<
|
||||
Item = Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>,
|
||||
>,
|
||||
extension_tool_executors: impl IntoIterator<Item = Arc<dyn ToolExecutor>>,
|
||||
dynamic_tools: &[DynamicToolSpec],
|
||||
) -> ToolRouter {
|
||||
let mut registry = build_core_tool_registry(
|
||||
|
||||
@@ -84,7 +84,6 @@ use codex_protocol::protocol::MultiAgentVersion;
|
||||
use codex_tools::IndirectNamespacePrefixes;
|
||||
use codex_tools::ResponsesApiNamespaceTool;
|
||||
use codex_tools::TOOL_SEARCH_TOOL_NAME;
|
||||
use codex_tools::ToolCall as ExtensionToolCall;
|
||||
use codex_tools::ToolEnvironmentMode;
|
||||
use codex_tools::ToolExecutor;
|
||||
use codex_tools::ToolExposures;
|
||||
@@ -326,9 +325,7 @@ pub(crate) fn append_source_tools(
|
||||
model_info: &ModelInfo,
|
||||
registry: &mut ToolRegistry,
|
||||
mcp_tools: Vec<RegisteredTool>,
|
||||
extension_tool_executors: impl IntoIterator<
|
||||
Item = Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>,
|
||||
>,
|
||||
extension_tool_executors: impl IntoIterator<Item = Arc<dyn ToolExecutor>>,
|
||||
dynamic_tools: &[DynamicToolSpec],
|
||||
) -> Vec<ToolSpec> {
|
||||
for tool in mcp_tools {
|
||||
@@ -352,7 +349,7 @@ pub(crate) fn append_source_tools(
|
||||
pub(crate) fn extension_tool_executors<'a>(
|
||||
session: &'a Session,
|
||||
step_store: &'a ExtensionData,
|
||||
) -> impl Iterator<Item = Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>> + 'a {
|
||||
) -> impl Iterator<Item = Arc<dyn ToolExecutor>> + 'a {
|
||||
session
|
||||
.services
|
||||
.extensions
|
||||
@@ -1629,7 +1626,7 @@ fn append_tool_search_executor(
|
||||
fn append_extension_tool_executors(
|
||||
turn_context: &TurnContext,
|
||||
model_info: &ModelInfo,
|
||||
executors: impl IntoIterator<Item = Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>>,
|
||||
executors: impl IntoIterator<Item = Arc<dyn ToolExecutor>>,
|
||||
registry: &mut ToolRegistry,
|
||||
) -> Option<ToolName> {
|
||||
let standalone_web_search_enabled = standalone_web_search_enabled(turn_context, model_info);
|
||||
|
||||
@@ -205,7 +205,7 @@ async fn strict_finalization_cannot_resurrect_hidden_or_policy_denied_tools() {
|
||||
),
|
||||
mcp_runtime("denied", "mcp__denied", "lookup", ToolExposure::Direct),
|
||||
],
|
||||
std::iter::empty::<Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>>(),
|
||||
std::iter::empty::<Arc<dyn ToolExecutor>>(),
|
||||
&[
|
||||
dynamic_tool(
|
||||
/*namespace*/ None,
|
||||
|
||||
@@ -69,7 +69,7 @@ const MULTI_AGENT_V2_NAMESPACE: &str = "collaboration";
|
||||
struct ToolPlanInputs {
|
||||
tool_runtimes: Vec<RegisteredTool>,
|
||||
tool_suggest_candidates: Option<ToolSuggestCandidates>,
|
||||
extension_tool_executors: Vec<Arc<dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>>>,
|
||||
extension_tool_executors: Vec<Arc<dyn ToolExecutor>>,
|
||||
wait_for_environment_tool_config: Option<Arc<WaitForEnvironmentToolConfig>>,
|
||||
dynamic_tools: Vec<DynamicToolSpec>,
|
||||
}
|
||||
@@ -317,7 +317,7 @@ struct TestNamespaceExtensionTool {
|
||||
tool_name: &'static str,
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ExtensionToolCall<'call>> for TestNamespaceExtensionTool {
|
||||
impl ToolExecutor for TestNamespaceExtensionTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced(self.namespace, self.tool_name)
|
||||
}
|
||||
@@ -337,10 +337,7 @@ impl<'call> ToolExecutor<ExtensionToolCall<'call>> for TestNamespaceExtensionToo
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _call: ExtensionToolCall<'call>) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, _call: ExtensionToolCall<'a>) -> codex_tools::ToolExecutorFuture<'a> {
|
||||
Box::pin(async {
|
||||
Ok(Box::new(codex_tools::JsonToolOutput::new(json!({}))) as Box<dyn ToolOutput>)
|
||||
})
|
||||
@@ -349,7 +346,7 @@ impl<'call> ToolExecutor<ExtensionToolCall<'call>> for TestNamespaceExtensionToo
|
||||
|
||||
struct DeferredExtensionTool;
|
||||
|
||||
impl<'call> ToolExecutor<ExtensionToolCall<'call>> for DeferredExtensionTool {
|
||||
impl ToolExecutor for DeferredExtensionTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::plain("extension_echo")
|
||||
}
|
||||
@@ -376,10 +373,7 @@ impl<'call> ToolExecutor<ExtensionToolCall<'call>> for DeferredExtensionTool {
|
||||
ToolExposure::Deferred
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _call: ExtensionToolCall<'call>) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, _call: ExtensionToolCall<'a>) -> codex_tools::ToolExecutorFuture<'a> {
|
||||
Box::pin(async { panic!("spec planning should not execute extension tools") })
|
||||
}
|
||||
}
|
||||
@@ -536,10 +530,7 @@ async fn allowed_tools_filter_sources_before_code_mode_and_discovery() {
|
||||
mcp_runtime("kept", "kept", "lookup", ToolExposure::Deferred),
|
||||
mcp_runtime("excluded", "excluded", "lookup", ToolExposure::Deferred),
|
||||
],
|
||||
[Arc::new(DeferredExtensionTool)
|
||||
as Arc<
|
||||
dyn for<'call> ToolExecutor<ExtensionToolCall<'call>>,
|
||||
>],
|
||||
[Arc::new(DeferredExtensionTool) as Arc<dyn ToolExecutor>],
|
||||
&[dynamic_tool(
|
||||
/*namespace*/ None,
|
||||
"dynamic_echo",
|
||||
|
||||
@@ -48,10 +48,7 @@ impl ToolExecutor<ToolInvocation> for TestHandler {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'a>
|
||||
where
|
||||
ToolInvocation: 'a,
|
||||
{
|
||||
fn handle(&self, _invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(async {
|
||||
Ok(
|
||||
Box::new(FunctionToolOutput::from_text("ok".to_string(), Some(true)))
|
||||
|
||||
@@ -8,7 +8,6 @@ use codex_protocol::dynamic_tools::DynamicToolFunctionSpec;
|
||||
use codex_protocol::dynamic_tools::DynamicToolSpec;
|
||||
use codex_protocol::request_user_input::RequestUserInputAnswer;
|
||||
use codex_protocol::request_user_input::RequestUserInputResponse;
|
||||
use codex_tools::ToolCall;
|
||||
use codex_tools::ToolExecutor;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::HashMap;
|
||||
@@ -42,7 +41,7 @@ impl ToolContributor for StepPreparationObserver {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
if let Some(ready) = self.tools_ready.lock().expect("tool gate").take() {
|
||||
ready
|
||||
.send(())
|
||||
|
||||
@@ -8185,7 +8185,7 @@ impl ToolContributor for NamespacedCustomTool {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
@@ -8194,7 +8194,7 @@ impl ToolContributor for NamespacedCustomTool {
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
_step_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
vec![Arc::new(Self {
|
||||
generation: self.generations.fetch_add(1, Ordering::Relaxed) + 1,
|
||||
generations: Arc::clone(&self.generations),
|
||||
@@ -8202,7 +8202,7 @@ impl ToolContributor for NamespacedCustomTool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for NamespacedCustomTool {
|
||||
impl ToolExecutor for NamespacedCustomTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced("editor", "apply_patch")
|
||||
}
|
||||
@@ -8224,10 +8224,7 @@ impl<'call> ToolExecutor<ToolCall<'call>> for NamespacedCustomTool {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ToolCall<'a>) -> ToolExecutorFuture<'a> {
|
||||
Box::pin(async move {
|
||||
let ToolPayload::Custom { input } = call.payload else {
|
||||
return Err(FunctionCallError::Fatal(
|
||||
|
||||
@@ -63,12 +63,12 @@ impl ToolContributor for GatedTool {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
vec![Arc::new(self.clone())]
|
||||
}
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for GatedTool {
|
||||
impl ToolExecutor for GatedTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::plain(if matches!(self.admission, Admission::Unsupported) {
|
||||
"followup_task"
|
||||
@@ -92,10 +92,7 @@ impl<'call> ToolExecutor<ToolCall<'call>> for GatedTool {
|
||||
matches!(self.admission, Admission::Parallel)
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ToolCall<'a>) -> ToolExecutorFuture<'a> {
|
||||
Box::pin(async move {
|
||||
self.entered
|
||||
.send((call.call_id.to_string(), Instant::now()))
|
||||
|
||||
@@ -953,12 +953,12 @@ impl ToolContributor for DeferredCustomTool {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
vec![Arc::new(Self)]
|
||||
}
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for DeferredCustomTool {
|
||||
impl ToolExecutor for DeferredCustomTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::plain("custom_echo")
|
||||
}
|
||||
@@ -980,10 +980,7 @@ impl<'call> ToolExecutor<ToolCall<'call>> for DeferredCustomTool {
|
||||
ToolExposure::Deferred
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ToolCall<'a>) -> ToolExecutorFuture<'a> {
|
||||
Box::pin(async move {
|
||||
let ToolPayload::Custom { input } = call.payload else {
|
||||
return Err(FunctionCallError::Fatal(
|
||||
|
||||
@@ -187,7 +187,6 @@ async fn step_preparation_finishes_before_tools_and_world_state() -> Result<()>
|
||||
use codex_extension_api::ExtensionFuture;
|
||||
use codex_extension_api::SelectedPluginSnapshot;
|
||||
use codex_extension_api::StepPreparationInput;
|
||||
use codex_extension_api::ToolCall;
|
||||
use codex_extension_api::ToolContributor;
|
||||
use codex_extension_api::ToolExecutor;
|
||||
use codex_extension_api::WorldStateContributionInput;
|
||||
@@ -221,7 +220,7 @@ async fn step_preparation_finishes_before_tools_and_world_state() -> Result<()>
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
step_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
assert!(step_store.get::<SelectedPluginSnapshot>().is_some());
|
||||
assert_eq!(
|
||||
*step_store
|
||||
|
||||
@@ -2998,12 +2998,12 @@ impl ToolContributor for SettingsEcho {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
vec![Arc::new(self.clone())]
|
||||
}
|
||||
}
|
||||
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for SettingsEcho {
|
||||
impl ToolExecutor for SettingsEcho {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::plain("extension_settings")
|
||||
}
|
||||
@@ -3019,10 +3019,7 @@ impl<'call> ToolExecutor<ToolCall<'call>> for SettingsEcho {
|
||||
})
|
||||
}
|
||||
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
fn handle<'a>(&'a self, call: ToolCall<'a>) -> ToolExecutorFuture<'a> {
|
||||
Box::pin(async move {
|
||||
*self.history.lock().expect("history lock") = Some(call.conversation_history);
|
||||
let metadata: Value = serde_json::from_str(
|
||||
|
||||
Reference in New Issue
Block a user