Commit 7219299
authored
feat: add stop_reason field to ResultMessage (#619)
Adds `stop_reason: str | None` to `ResultMessage`, matching the
TypeScript SDK.
The field carries the API's stop reason (`"end_turn"`, `"max_tokens"`,
etc.) through to the result message. Backward-compatible: defaults to
`None` and the parser uses `data.get("stop_reason")`, so older CLI
output without the field produces `None` rather than failing.
<!-- CHANGELOG:START -->
- Add `stop_reason: str | None` field to `ResultMessage`
<!-- CHANGELOG:END -->
## Test plan
- Unit: parser tests for explicit value, explicit `null` → `None`, and
absent field → `None`
- E2E: verified against CLI v2.1.64-dev — SDK parsing correct (CLI-side
population tracked separately)1 parent d9fe709 commit 7219299
3 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| 680 | + | |
680 | 681 | | |
681 | 682 | | |
682 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
316 | 355 | | |
317 | 356 | | |
318 | 357 | | |
| |||
0 commit comments