Problem
When AI is processing, the ActivityIndicator.tsx currently shows token count during streaming:
Processing... (Esc to cancel, ↓ 123 tokens)
However, there are two issues:
- No visibility into how many tool call chunks have been received during streaming
- Token count only includes
text-delta and reasoning-delta chunks, missing tokens from tool-call chunks
Solution
Extend the ActivityIndicator to display tool call chunk counts and include tool-call tokens in the total count:
Processing... (Esc to cancel, ↓ 123 tokens, 🔧 3 tools)
Implementation approach:
-
Track tool call chunks in store.ts: Add a processingToolCalls counter similar to processingTokens
-
Update chunk handler in store.ts: Currently only counts text/reasoning tokens:
if (chunk.type === 'text-delta' || chunk.type === 'reasoning-delta') {
const tokenCount = countTokens(chunk.delta);
set({ processingTokens: get().processingTokens + tokenCount });
}
Should be extended to also count tool-call tokens:
if (chunk.type === 'text-delta' || chunk.type === 'reasoning-delta') {
const tokenCount = countTokens(chunk.delta);
set({ processingTokens: get().processingTokens + tokenCount });
} else if (chunk.type === 'tool-call') {
const tokenCount = countTokens(JSON.stringify(chunk));
set({
processingTokens: get().processingTokens + tokenCount,
processingToolCalls: get().processingToolCalls + 1
});
}
- Display in ActivityIndicator: Update the
statusText in ActivityIndicator.tsx to include the tool call count
Reference files:
src/ui/ActivityIndicator.tsx - UI component to update
src/ui/store.ts - Already tracks processingTokens, needs processingToolCalls
src/loop.ts - Shows how tool-call chunks are emitted via onChunk
src/nodeBridge.ts - Bridge layer for chunk events
Alternatives
Could also display this in the /status command output, but real-time feedback during processing is more valuable.
Importance
Would make my life easier - provides better visibility into agent progress during complex multi-tool operations.
Problem
When AI is processing, the
ActivityIndicator.tsxcurrently shows token count during streaming:However, there are two issues:
text-deltaandreasoning-deltachunks, missing tokens from tool-call chunksSolution
Extend the
ActivityIndicatorto display tool call chunk counts and include tool-call tokens in the total count:Implementation approach:
Track tool call chunks in store.ts: Add a
processingToolCallscounter similar toprocessingTokensUpdate chunk handler in store.ts: Currently only counts text/reasoning tokens:
Should be extended to also count tool-call tokens:
statusTextinActivityIndicator.tsxto include the tool call countReference files:
src/ui/ActivityIndicator.tsx- UI component to updatesrc/ui/store.ts- Already tracksprocessingTokens, needsprocessingToolCallssrc/loop.ts- Shows how tool-call chunks are emitted viaonChunksrc/nodeBridge.ts- Bridge layer for chunk eventsAlternatives
Could also display this in the
/statuscommand output, but real-time feedback during processing is more valuable.Importance
Would make my life easier - provides better visibility into agent progress during complex multi-tool operations.