Skip to content

Releases: ChiR24/opencode-tps-meter

v0.3.1

02 Jun 04:59

Choose a tag to compare

Changes

  • Keeps the persistent TUI TPS meter visible when assistant responses transition into tool calls.
  • Keeps the latest TUI TPS status visible after idle/non-streaming phases.
  • Adds configurable initial display latency with initialDisplayDelayMs / TPS_METER_INITIAL_DISPLAY_DELAY_MS and a 10ms default.
  • Improves live stream token counting and fallback delta/full-part deduplication.

v0.3.0

31 May 17:49

Choose a tag to compare

Highlights

  • Add persistent OpenCode TUI TPS meter via the opencode-tps-meter/tui entrypoint.
  • Disable legacy toast popups by default; opt back in with toastFallback or TPS_METER_TOAST_FALLBACK=true.
  • Add per-session final TPS persistence, delta/full-part dedupe, lifecycle cleanup, package export, docs, and test coverage.

v0.2.1

20 Apr 11:24

Choose a tag to compare

What's Changed

message.part.delta event support

The event handler now processes message.part.delta events alongside message.part.updated. This new event type carries only { sessionID, messageID, partID, field, delta } without a full Part object. The handleMessagePartUpdated function was extracted from the plugin closure and updated with a two-path dispatch: if a Part object is present, it uses the existing accumulated-text-delta logic; if only delta + sessionID + messageID are present, it uses the delta string directly. The event switch now matches both "message.part.updated" and "message.part.delta".

MessageEvent type expanded

The MessageEvent.type union in types.ts now includes "message.part.delta". The MessageEvent.properties shape gained three optional fields: messageID, partID, and field — used by the delta-only event path.

Background agent detection reverted to cross-session only

getAllActiveAgentsGlobally no longer includes same-session agents with messageAgentCache entries. The isSameSessionAgent check was removed — only trackers where sessionId !== primarySessionId are identified as background agents. isPrimarySessionActive no longer skips trackers with cached agent names; any tracker with recent activity in the primary session counts as primary activity.

Primary session assignment simplified

The message.part.updated handler no longer checks messageAgentCache before setting primarySessionId. The first session to receive any assistant token chunk becomes the primary session, unconditionally.

Multi-agent tests aligned with cross-session design

Tests were using same-session agents, but the code only detects background agents across sessions. Tests 1, 2, and 4 now use separate session IDs per agent and send primary part.updated tokens first to establish primarySessionId. Test 3 (agents-only) updated: the original code always shows the primary TPS line when the primary session has tokens, so the test now verifies agent labels appear alongside the primary line rather than expecting no primary line.

Version bump

package.json version updated from 0.2.0 to 0.2.1.

Full Changelog: v0.2.0...v0.2.1

v0.2.0: Realistic TPS and Better Agent IDs

10 Feb 12:26

Choose a tag to compare

Improvements

Fixed

  • Inflated TPS values — Changed denominator from to . This prevents 300+ TPS spikes when tokens arrive in bursts by accounting for idle time that naturally lowers the rate.
  • Identical agent labels — All agents showed because OpenCode message IDs share the prefix. Now strips this prefix and shows 6 differentiating characters.

Changed

  • Faster timing constants for more responsive feel:
    • : 250ms → 150ms (40% faster initial display)
    • : 500ms → 250ms (more responsive smoothing)
    • : 150ms → 80ms (nearly 2x faster UI updates)
    • : 0.1s → 0.3s (stable baseline)
  • Reduced toast throttling — multiplier: 3x → 2x

Commits

  • fix: correct TPS calculation to use elapsed time from oldest entry
  • feat: improve TPS responsiveness with faster timing constants
  • fix: improve agent ID display and reduce UI throttling
  • docs: update README timing and bump version to 0.2.0

0.1.9

08 Feb 12:52

Choose a tag to compare

Full Changelog: v0.1.8...0.1.9

v0.1.8 - Agent Detection Improvements

08 Feb 09:36

Choose a tag to compare

Improvements

  • Improved agent name detection from multiple sources
  • Better handling of missing agent metadata
  • Added debug logging for troubleshooting

Bug Fixes

  • Fixed buildAgentLabel to handle missing type gracefully
  • Improved getAllActiveAgentsGlobally to get agent name from cache when metadata is missing

v0.1.7 - Bug Fixes

07 Feb 17:32

Choose a tag to compare

Bug Fixes

  • Agent name caching fixed - Previously the cache was never populated because info.agent is an AgentIdentity object (not a string). Now correctly extracts name from: agent.name > agent.type > agentType > agent.id
  • Color coding in agent-only mode - Previously showed "slow" (red) because TPS was 0. Now uses max agent TPS for color determination
  • formatAgentLine respects config - Now properly uses showInstant, showAverage, showTotalTokens settings instead of always showing all

Files Changed

  • src/index.ts - Fixed agent name extraction from AgentIdentity object
  • src/ui.ts - Fixed color coding logic and formatAgentLine config respect

v0.1.6 - Multi-agent TPS Tracking

07 Feb 17:13

Choose a tag to compare

What's New

Multi-Agent TPS Tracking

  • Per-agent display: Each background agent (explore, librarian, etc.) now shows its own TPS instead of combined values
  • Agent name caching: Uses info.agent from message.updated events for proper labels
  • Explicit primary session: Stores primarySessionId instead of iteration-based detection
  • Show/hide logic: Main TPS line hidden when only background agents are active

TPS Spike Prevention

  • 3-level burst smoothing:
    • Normal streaming: 500ms half-life
    • Medium bursts (50-200 tokens): 3000ms half-life
    • Large bursts (200+ tokens): 5000ms half-life
  • Initial TPS cap: Max 100 TPS on first reading to prevent startup spikes

UI Improvements

  • Shorter IDs: Reduced from 8 to 4 characters for more compact display
  • Timer-based fallback: Shows TPS after 250ms even if stream pauses

Testing

  • Added 33 comprehensive tests for multi-agent scenarios
  • All tests passing

Installation

npm install opencode-tps-meter@0.1.6

Or in OpenCode config:

{
  "plugins": ["opencode-tps-meter@0.1.6"]
}

v0.1.5 - EWMA Smoothing for TPS Spike Prevention

06 Feb 13:22
53b234e

Choose a tag to compare

What's New

Features

  • EWMA Smoothing: Added Exponentially Weighted Moving Average (EWMA) smoothing to prevent unrealistic TPS spikes from bursty token arrivals (e.g., tool outputs)
  • Adaptive Half-Life: Normal streaming uses 500ms half-life, bursts (>120 tokens) use 2000ms for stronger smoothing
  • New method: Returns EWMA-smoothed TPS values for more stable UI display

Bug Fixes

  • Fixed buffer pruning bug: When all entries were expired, returned -1 and nothing was removed - now properly clears the buffer
  • Renamed misleading variable: → to accurately reflect the smoothed value

Technical Details

  • Added constants: (120), (500), (2000)
  • Buffer pruning now uses in-place mutation () instead of reassignment
  • Enhanced test coverage for burst smoothing scenarios

Breaking Changes

None - the plugin now displays smoothed TPS by default, providing more accurate and stable metrics.

Testing

  • All 28 tests pass
  • Build successful (ESM + CJS + TypeScript declarations)
  • Verified smoothing behavior with large token bursts

v0.1.4 - CJS/ESM Compatibility Fix

05 Feb 09:42

Choose a tag to compare

Fixes

  • CJS Export Timing: Move module.exports to end of file to ensure TpsMeterPlugin function is defined before export
  • ESM Compatibility: Add module.exports.default and __esModule flag for proper ESM/CJS interop
  • dist/package.json: Create separate package.json in dist folder with type:commonjs to fix Node.js loading

This resolves the 'fn3 is not a function' error when loading the plugin in OpenCode.