mirror of
https://github.com/openai/codex.git
synced 2026-05-04 05:11:37 +03:00
feat(app-server): add ThreadItem::DynamicToolCall (#12732)
Previously, clients would call `thread/start` with dynamic_tools set, and when a model invokes a dynamic tool, it would just make the server->client `item/tool/call` request and wait for the client's response to complete the tool call. This works, but it doesn't have an `item/started` or `item/completed` event. Now we are doing this: - [new] emit `item/started` with `DynamicToolCall` populated with the call arguments - send an `item/tool/call` server request - [new] once the client responds, emit `item/completed` with `DynamicToolCall` populated with the response. Also, with `persistExtendedHistory: true`, dynamic tool calls are now reconstructable in `thread/read` and `thread/resume` as `ThreadItem::DynamicToolCall`.
This commit is contained in:
@@ -724,6 +724,13 @@ When a dynamic tool is invoked during a turn, the server sends an `item/tool/cal
|
||||
}
|
||||
```
|
||||
|
||||
The server also emits item lifecycle notifications around the request:
|
||||
|
||||
1. `item/started` with `item.type = "dynamicToolCall"`, `status = "inProgress"`, plus `tool` and `arguments`.
|
||||
2. `item/tool/call` request.
|
||||
3. Client response.
|
||||
4. `item/completed` with `item.type = "dynamicToolCall"`, final `status`, and the returned `contentItems`/`success`.
|
||||
|
||||
The client must respond with content items. Use `inputText` for text and `inputImage` for image URLs/data URLs:
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user