Commit 383946f
fix(agents): parse prompt_tokens/completion_tokens in CLI usage output for llama.cpp (#77992)
llama.cpp and other OpenAI-compatible local providers return usage as
{ prompt_tokens, completion_tokens } instead of { input_tokens, output_tokens }.
The toCliUsage() function in cli-output.ts only accepted input_tokens /
output_tokens (and their camelCase aliases), so llama.cpp usage was silently
dropped and context display showed "?/131k" for all llama.cpp users.
Add prompt_tokens and completion_tokens as fallback keys for totalInput and
output respectively in toCliUsage(). Both parseCliJson and parseCliJsonl go
through this function, so the fix covers all CLI output parsing paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ea391c6 commit 383946f
2 files changed
Lines changed: 46 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
386 | 423 | | |
387 | 424 | | |
388 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| |||
0 commit comments