Display tool call metrics: Add ⚒ counter to token usage display
- Show tool call count alongside token metrics in TUI and console renderers - TUI: Display at bottom with format "↑X ↓Y ⚒Z" - Console: Show metrics after assistant messages complete - Counter increments on each tool_call event
This commit is contained in:
@@ -61,6 +61,7 @@ export class TuiRenderer implements AgentEventReceiver {
|
||||
private lastOutputTokens = 0;
|
||||
private lastCacheReadTokens = 0;
|
||||
private lastCacheWriteTokens = 0;
|
||||
private toolCallCount = 0;
|
||||
private tokenStatusComponent: TextComponent | null = null;
|
||||
|
||||
constructor() {
|
||||
@@ -200,6 +201,8 @@ export class TuiRenderer implements AgentEventReceiver {
|
||||
}
|
||||
|
||||
case "tool_call":
|
||||
this.toolCallCount++;
|
||||
this.updateTokenDisplay();
|
||||
this.chatContainer.addChild(new TextComponent(chalk.yellow(`[tool] ${event.name}(${event.args})`)));
|
||||
break;
|
||||
|
||||
@@ -300,6 +303,11 @@ export class TuiRenderer implements AgentEventReceiver {
|
||||
tokenText += chalk.dim(` (${cacheText.join(" ")})`);
|
||||
}
|
||||
|
||||
// Add tool call count
|
||||
if (this.toolCallCount > 0) {
|
||||
tokenText += chalk.dim(` ⚒${this.toolCallCount}`);
|
||||
}
|
||||
|
||||
this.tokenStatusComponent = new TextComponent(tokenText);
|
||||
this.tokenContainer.addChild(this.tokenStatusComponent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user