feat(codex): retain native session usage snapshots for chat
Verify typed ThreadTokenUsage/TokenUsageBreakdown/Thread/Turn against openai/codex@6fb1c3903d. Use native totalTokens and latest-call context tokens without re-adding cached/reasoning subsets. Replay bounded per-connection snapshots and clear on room/source release. Cost stays unavailable: no subscription USD usage is reported by this notification. Throughput stays unavailable even with native Turn.durationMs because neither last-call nor cumulative-session output is a compatible turn-specific numerator. Thread readback exposes no token usage; no extra reads, resume, or live provider calls added. Checks: go test -race ./internal/codex; go vet ./internal/codex; go test ./internal/server ./internal/protocol; git diff --check.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"method": "thread/tokenUsage/updated",
|
||||
"params": {
|
||||
"threadId": "thread",
|
||||
"turnId": "turn_new",
|
||||
"tokenUsage": {
|
||||
"total": {
|
||||
"totalTokens": 12000,
|
||||
"inputTokens": 10000,
|
||||
"cachedInputTokens": 7000,
|
||||
"cacheWriteInputTokens": 1000,
|
||||
"outputTokens": 2000,
|
||||
"reasoningOutputTokens": 1500
|
||||
},
|
||||
"last": {
|
||||
"totalTokens": 3500,
|
||||
"inputTokens": 3000,
|
||||
"cachedInputTokens": 2000,
|
||||
"cacheWriteInputTokens": 100,
|
||||
"outputTokens": 500,
|
||||
"reasoningOutputTokens": 400
|
||||
},
|
||||
"modelContextWindow": 258400
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user