mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Dynamic tool calls - allow dynamic registration
Add experimental app-server support for connection-owned dynamic tool providers over both `stdio` and websocket.
Clients can now:
- register a tool with `toolProvider/register`
- unregister it with `toolProvider/unregister`
Registered tools are stored in an app-server registry, mapped back to the owning connection, and routed through the existing dynamic tool call flow. Tools with `injectIntoContext: true` are exposed to the model; tools with `injectIntoContext: false` remain callable only from `js_repl` via `codex.tool(...)`.
This also extends dynamic tool call events with `thread_id` so provider-owned tools can be invoked from newly created or resumed threads.
```mermaid
sequenceDiagram
participant Client as Provider Client
participant AppServer as App Server
participant ThreadClient as Thread Client
participant Core as Core Thread
Client->>AppServer: toolProvider/register(tool)
AppServer->>AppServer: store tool -> owning connection
ThreadClient->>AppServer: thread/start
AppServer->>Core: load thread + sync registered tools
ThreadClient->>AppServer: turn/start
AppServer->>Core: submit user input
Core-->>AppServer: DynamicToolCallRequest(thread_id, tool, args, provider_owned=true)
AppServer->>Client: item/tool/call
Client-->>AppServer: DynamicToolCallResponse
AppServer->>Core: submit dynamic tool response
Core-->>AppServer: continue turn
This commit is contained in:
@@ -1975,6 +1975,13 @@
|
||||
"callId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerOwned": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tool": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1992,6 +1999,7 @@
|
||||
"required": [
|
||||
"arguments",
|
||||
"callId",
|
||||
"threadId",
|
||||
"tool",
|
||||
"turnId",
|
||||
"type"
|
||||
@@ -8112,6 +8120,13 @@
|
||||
"callId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerOwned": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"threadId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tool": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -8129,6 +8144,7 @@
|
||||
"required": [
|
||||
"arguments",
|
||||
"callId",
|
||||
"threadId",
|
||||
"tool",
|
||||
"turnId",
|
||||
"type"
|
||||
|
||||
Reference in New Issue
Block a user