fix(coding-agent): expose tool metadata at stream start (#7953)

* fix(coding-agent): expose tool metadata at stream start

* fix(coding-agent): centralize message update serialization
This commit is contained in:
Christian Klotz 2026-08-19 12:24:30 +02:00 • committed by GitHub
parent d711bd5f0a
commit 830a0a59e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 97 additions and 28 deletions

View file

@ -945,7 +945,7 @@ The `assistantMessageEvent` field contains one of these delta types:
| `thinking_start` | Thinking block started |
| `thinking_delta` | Thinking content chunk |
| `thinking_end` | Thinking block ended |
| `toolcall_start` | Tool call started |
| `toolcall_start` | Tool call started (includes `id` and `toolName`) |
| `toolcall_delta` | Tool call arguments chunk |
| `toolcall_end` | Tool call ended (includes full `toolCall` object) |
@ -960,11 +960,17 @@ Example streaming a text response:
The top-level `usage` field contains the latest cumulative provider-reported usage. It may remain
zero until completion when a provider does not report usage during streaming.
Example starting a tool call:
```json
{"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"toolcall_start","contentIndex":1,"id":"call_abc123","toolName":"write"}}
```
`message_update` intentionally omits the former cumulative `message` field and
`assistantMessageEvent.partial`. Clients that need a live partial message must assemble it
from `message_start` and subsequent events using `contentIndex`. Treat `message_end.message`
as authoritative. For tool calls, buffer `toolcall_delta.delta`; `toolcall_end.toolCall`
contains the completed call.
as authoritative. For tool calls, `toolcall_start` provides the call `id` and `toolName`;
buffer `toolcall_delta.delta` for arguments. `toolcall_end.toolCall` contains the completed
call.
### bash_execution_update