mirror of
https://github.com/openai/codex.git
synced 2026-11-30 00:10:49 +00:00
## Summary Add dynamic tool injection to thread startup in API v2, wire dynamic tool calls through the app server to clients, and plumb responses back into the model tool pipeline. ### Flow (high level) - Thread start injects `dynamic_tools` into the model tool list for that thread (validation is done here). - When the model emits a tool call for one of those names, core raises a `DynamicToolCallRequest` event. - The app server forwards it to the client as `item/tool/call`, waits for the client’s response, then submits a `DynamicToolResponse` back to core. - Core turns that into a `function_call_output` in the next model request so the model can continue. ### What changed - Added dynamic tool specs to v2 thread start params and protocol types; introduced `item/tool/call` (request/response) for dynamic tool execution. - Core now registers dynamic tool specs at request time and routes those calls via a new dynamic tool handler. - App server validates tool names/schemas, forwards dynamic tool call requests to clients, and publishes tool outputs back into the session. - Integration tests
44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
pub mod apply_patch;
|
|
pub(crate) mod collab;
|
|
mod dynamic;
|
|
mod grep_files;
|
|
mod list_dir;
|
|
mod mcp;
|
|
mod mcp_resource;
|
|
mod plan;
|
|
mod read_file;
|
|
mod request_user_input;
|
|
mod shell;
|
|
mod test_sync;
|
|
mod unified_exec;
|
|
mod view_image;
|
|
|
|
pub use plan::PLAN_TOOL;
|
|
use serde::Deserialize;
|
|
|
|
use crate::function_tool::FunctionCallError;
|
|
pub use apply_patch::ApplyPatchHandler;
|
|
pub use collab::CollabHandler;
|
|
pub use dynamic::DynamicToolHandler;
|
|
pub use grep_files::GrepFilesHandler;
|
|
pub use list_dir::ListDirHandler;
|
|
pub use mcp::McpHandler;
|
|
pub use mcp_resource::McpResourceHandler;
|
|
pub use plan::PlanHandler;
|
|
pub use read_file::ReadFileHandler;
|
|
pub use request_user_input::RequestUserInputHandler;
|
|
pub use shell::ShellCommandHandler;
|
|
pub use shell::ShellHandler;
|
|
pub use test_sync::TestSyncHandler;
|
|
pub use unified_exec::UnifiedExecHandler;
|
|
pub use view_image::ViewImageHandler;
|
|
|
|
fn parse_arguments<T>(arguments: &str) -> Result<T, FunctionCallError>
|
|
where
|
|
T: for<'de> Deserialize<'de>,
|
|
{
|
|
serde_json::from_str(arguments).map_err(|err| {
|
|
FunctionCallError::RespondToModel(format!("failed to parse function arguments: {err}"))
|
|
})
|
|
}
|