From 48089ef71fed006d3d2990edaeeaf67a445205e8 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Wed, 31 Dec 2025 16:17:07 -0800 Subject: [PATCH] feat: improve token counter display (#439) Co-authored-by: Letta --- src/cli/helpers/accumulator.ts | 2 ++ src/constants.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/helpers/accumulator.ts b/src/cli/helpers/accumulator.ts index 47fd58e..a199eee 100644 --- a/src/cli/helpers/accumulator.ts +++ b/src/cli/helpers/accumulator.ts @@ -395,6 +395,8 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) { argsText: (line.argsText || "") + argsText, }; b.byId.set(id, updatedLine); + // Count tool call arguments as LLM output tokens + b.tokenCount += argsText.length; } break; } diff --git a/src/constants.ts b/src/constants.ts index 542fb29..48c8f90 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -20,7 +20,7 @@ export const INTERRUPTED_BY_USER = "Interrupted by user"; /** * Status bar thresholds - only show indicators when values exceed these */ -// Show token count after 1000 estimated tokens -export const TOKEN_DISPLAY_THRESHOLD = 1000; +// Show token count after 100 estimated tokens (shows exact count until 1k, then compact) +export const TOKEN_DISPLAY_THRESHOLD = 100; // Show elapsed time after 2 minutes (in ms) export const ELAPSED_DISPLAY_THRESHOLD_MS = 2 * 60 * 1000;