mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Scope extension capabilities to invocation lifetimes (#41020)
## What changed - Add callback lifetimes to extension `ToolCall`, `ToolEnvironment`, turn-input context, and skill-read request types. - Require extension tool executors to handle calls for any invocation lifetime and tie their returned futures to that lifetime. - Update built-in extensions, adapters, and tests to use the lifetime-scoped APIs without retaining host-owned environment capabilities. GitOrigin-RevId: aca9ce3a1b6870df550bc84ec9308cc65533f161
This commit is contained in:
1 parent
eed1dee69e
commit
81e180044d
85 files changed
+477
-202
No files matched your search
@@ -49,7 +49,7 @@ pub(crate) struct WebSearchTool {
|
||||
pub(crate) originator: Option<String>,
|
||||
}
|
||||
|
||||
impl ToolExecutor<ToolCall> for WebSearchTool {
|
||||
impl<'call> ToolExecutor<ToolCall<'call>> for WebSearchTool {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced(WEB_NAMESPACE, RUN_TOOL_NAME)
|
||||
}
|
||||
@@ -83,13 +83,19 @@ impl ToolExecutor<ToolCall> for WebSearchTool {
|
||||
true
|
||||
}
|
||||
|
||||
fn handle(&self, call: ToolCall) -> codex_extension_api::ToolExecutorFuture<'_> {
|
||||
fn handle<'a>(&'a self, call: ToolCall<'call>) -> codex_extension_api::ToolExecutorFuture<'a>
|
||||
where
|
||||
'call: 'a,
|
||||
{
|
||||
Box::pin(self.handle_call(call))
|
||||
}
|
||||
}
|
||||
|
||||
impl WebSearchTool {
|
||||
async fn handle_call(&self, call: ToolCall) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
|
||||
async fn handle_call(
|
||||
&self,
|
||||
call: ToolCall<'_>,
|
||||
) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
|
||||
let commands = parse_commands(&call)?;
|
||||
let command_action = command_action(&commands);
|
||||
let provider = self
|
||||
@@ -196,7 +202,7 @@ fn search_request_headers(originator: Option<&str>, turn_metadata: Option<&str>)
|
||||
headers
|
||||
}
|
||||
|
||||
fn parse_commands(call: &ToolCall) -> Result<SearchCommands, FunctionCallError> {
|
||||
fn parse_commands(call: &ToolCall<'_>) -> Result<SearchCommands, FunctionCallError> {
|
||||
let arguments = call.function_arguments()?;
|
||||
if arguments.trim().is_empty() {
|
||||
return Ok(SearchCommands::default());
|
||||
|
||||
Reference in new issue
Block a user