Skip to content

replace hardcoded tokenCount with live tool invocation count#531

Merged
JeremyDev87 merged 1 commit intomasterfrom
feat/tui-490-replace-token-count-with-tool-invocation-count
Feb 18, 2026
Merged

replace hardcoded tokenCount with live tool invocation count#531
JeremyDev87 merged 1 commit intomasterfrom
feat/tui-490-replace-token-count-with-tool-invocation-count

Conversation

@JeremyDev87
Copy link
Owner

Summary

Closes #490

The StageHealthBar footer was hardcoded to always display tokens: 0, which is meaningless because the MCP server acts only as a tool provider and cannot access LLM API token usage metadata.

This PR replaces the token count display with the actual number of tool invocations, accumulated via the existing TOOL_INVOKED event stream.

Changes

New behavior

  • Footer now displays tools: <count> instead of tokens: 0
  • Count increments by 1 on every TOOL_INVOKED event
  • Values ≥ 1,000 are abbreviated as 1k, 2k, etc. (existing logic retained)

Renamed symbols

Before After Location
DashboardState.tokenUsage toolInvokeCount dashboard-types.ts
StageHealthBarProps.tokenCount toolCount StageHealthBar.tsx
formatStageHealthBar param tokenCount toolCount stage-health.pure.ts
Internal variable tokenStr countStr StageHealthBar.tsx, stage-health.pure.ts
Label tokens: tools: StageHealthBar.tsx

Implementation

  • Added toolInvokeCount: number field to DashboardState interface
  • Initialized to 0 in createInitialDashboardState()
  • Incremented by 1 in the TOOL_INVOKED reducer case
  • Passed as toolCount prop from DashboardApp to StageHealthBar

Test Plan

  • New reducer test: toolInvokeCount increments from 0 → 1 → 2 on consecutive TOOL_INVOKED dispatches
  • All existing StageHealthBar, stage-health.pure, use-dashboard-state, and dashboard-types tests updated and passing
  • No residual references to tokenCount, tokenUsage, or tokenStr in the TUI source tree
  • 164 test files, 3,783 tests pass
  • TypeScript build succeeds

@vercel
Copy link

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Feb 18, 2026 2:18am

@JeremyDev87 JeremyDev87 force-pushed the feat/tui-490-replace-token-count-with-tool-invocation-count branch from 98635e8 to 6fba39e Compare February 18, 2026 02:17
@JeremyDev87 JeremyDev87 self-assigned this Feb 18, 2026
@JeremyDev87 JeremyDev87 added feat tui TUI Agent Monitor labels Feb 18, 2026
@JeremyDev87 JeremyDev87 changed the title feat(tui): replace hardcoded tokenCount with live tool invocation count replace hardcoded tokenCount with live tool invocation count Feb 18, 2026
@JeremyDev87 JeremyDev87 merged commit efa7d26 into master Feb 18, 2026
25 checks passed
@JeremyDev87 JeremyDev87 deleted the feat/tui-490-replace-token-count-with-tool-invocation-count branch February 18, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat tui TUI Agent Monitor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tui): replace hardcoded tokenCount with live tool invocation count in StageHealthBar

1 participant