| 1474 | } |
| 1475 | |
| 1476 | function formatTokenUsage(usage: NonNullable<SessionUsage['total']>): string { |
| 1477 | return [ |
| 1478 | `input ${usage.inputOther.toLocaleString('en-US')}`, |
| 1479 | `output ${usage.output.toLocaleString('en-US')}`, |
| 1480 | `cache read ${usage.inputCacheRead.toLocaleString('en-US')}`, |
| 1481 | `cache creation ${usage.inputCacheCreation.toLocaleString('en-US')}`, |
| 1482 | ].join(', '); |
| 1483 | } |
| 1484 | |
| 1485 | // agent-core emits `contextUsage` as a 0..1 fraction (`contextTokens / |
| 1486 | // maxContextTokens` — see agent-core/src/agent/index.ts:419-422). It can |