Skip to content

[Feature Request]: Add tool call chunk count to ActivityIndicator processing status #611

Description

@sorrycc

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:

  1. No visibility into how many tool call chunks have been received during streaming
  2. 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:

  1. Track tool call chunks in store.ts: Add a processingToolCalls counter similar to processingTokens

  2. 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 
  });
}
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions