Repository navigation
v0.4.0-beta.1 — OpenCode v2 support (beta)
Pre-releasePrerelease. This targets opencode2, which is itself beta and whose plugin API is documented as subject to change before 2.0 is stable. Published under the beta dist-tag — latest stays on 0.3.1.
npm install opencode-tps-meter@betaOpenCode v2 support
One package now serves both generations. v1 reads server/tui, v2 reads setup, and v1 behaviour is unchanged.
v2 deleted the entire message.* event family the meter was built on, so this is a port rather than a version bump:
| v1 | v2 |
|---|---|
message.part.delta (field text) |
session.text.delta |
message.part.updated (reasoning) |
session.reasoning.delta |
message.updated (completed) |
session.step.ended |
message.updated (info.tokens) |
session.usage.updated |
session.idle |
unchanged |
New on v2
Measurements v1 could not make, because its events carried no timestamps and StepStartPart carried neither model nor agent:
- Calibrated live rate — each step compares streamed tokens against the provider's count and learns a per-model correction
- Generation vs end-to-end TPS — tool execution subtracted, so a turn that waited on a shell command still reports the model's real rate
- Time to first token, measured on the host clock
- Hidden overhead — the auto-title and compaction tokens no step reports
- Per-subagent breakdown in the sidebar, using the real session tree
- Durable ledger and
/tpsdashboard, persisted and shared across windows
Performance
Delta counting re-read the whole accumulated response on every chunk — O(n²) per response.
| word heuristic | before | after |
|---|---|---|
| 186k chars (v2 path) | 10,223 ms | 12.2 ms |
| 62k chars (v1 path) | 1,571 ms, +11.7 MB | 10.4 ms |
Live updates were also being dropped by a clock mismatch in the publish throttle: 8 updates at p50 184 ms over 120 deltas became 120 updates at p50 15.3 ms.
Both fixes benefit v1 as well.
Known limitations
- Registering only in
opencode.jsonloads the server half but not the TUI meter. Point~/.config/opencode/cli.jsonat the built file for now:{ "plugins": ["file:///abs/path/to/opencode-tps-meter/dist/tui.mjs"] } - The footer meter is confirmed working on
opencode2beta. The dashboard, sidebar panel and calibration are covered by tests but have not been exercised in a live TUI.
Feedback welcome — especially from anyone already running opencode2.