Commit 235e380
committed
fix(agency): UsageTotals carries + accumulates cache-token fields
Final unswept accumulator surface. UsageTotals (the agency() API's
internal helper type) matched the same pattern as the pre-fix
generateObject / streamText / strategies / UsageLedger / ITokenUsage
types — promptTokens + completionTokens + totalTokens + costUSD but no
cacheReadTokens / cacheCreationTokens. normalizeUsage dropped cache
fields from the source usage; addUsageTotals never summed them even
when callers routed cache-token-reporting usage objects through.
With this fix, every AgentOS accumulator I could find in src/ forwards
Anthropic prompt-cache counters end-to-end. Consumers using the public
agency() API now see cache-aware totals with the same undefined-vs-zero
convention as the rest of the surface.
No behavior change for non-cache paths. Typecheck clean.1 parent b986b94 commit 235e380
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
980 | 984 | | |
981 | 985 | | |
982 | 986 | | |
| |||
990 | 994 | | |
991 | 995 | | |
992 | 996 | | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
993 | 1001 | | |
994 | 1002 | | |
995 | 1003 | | |
| |||
1000 | 1008 | | |
1001 | 1009 | | |
1002 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1003 | 1017 | | |
1004 | 1018 | | |
1005 | 1019 | | |
| |||
0 commit comments