feat(web): display reported chat throughput tokens context and cost

This commit is contained in:
2026-10-21 00:27:12 +01:00
parent 910028a75c
commit 0b8595f16e
12 changed files with 314 additions and 12 deletions
+17
View File
@@ -347,6 +347,23 @@ A new subscriber receives any retained active compaction. Clear stale activity
before reconnecting, then preserve fresh replayed activity while history loads.
This reports native observations only; it does not request or trigger compaction.
Usage frames (`chat_event.kind="usage"`) may carry full native snapshots with
`usage.scope="session"`, `total_tokens`, `context_tokens`, `context_window`,
`cost_usd`, and `output_tokens_per_second`. Optional fields are unknown when
absent, not zero; reported zero values are retained explicitly. A new snapshot
replaces the previous one—never add repeated/replayed totals together.
`rate_basis="generation"` uses a native generation interval;
`rate_basis="turn"` denotes an end-to-end average that may include tools/waits.
Throughput must not be inferred from output text length.
Total tokens count processed usage across model calls; they are not the current
context size. Context usage/window and USD costs are shown only when available
from the harness. In particular, a subscription without reported USD cost is not
free, and the browser does not estimate a bill from a price table. Usage frames
are session metadata: no assistant/tool message is created and no queued prompt
is admitted or completed by a usage update. Subscriptions replay retained usage;
native readback refreshes it where supported.
The brokered OpenCode chat exposes the operator's own sessions, separate from the
sessions pipeline runs create. The protocol types are: