feat: add tool call and result counts to /session command

This commit is contained in:
Mario Zechner 2025-11-13 00:02:24 +01:00
parent b1410ef903
commit 383b67b5c0
2 changed files with 14 additions and 0 deletions

View file

@ -2,6 +2,8 @@
A radically simple and opinionated coding agent with multi-model support (including mid-session switching), a simple yet powerful CLI for headless coding tasks, and many creature comforts you might be used to from other coding agents.
Works on Linux, macOS, and Windows (barely tested, needs Git Bash running in the "modern" Windows Terminal).
## Installation
```bash

View file

@ -566,8 +566,18 @@ export class TuiRenderer {
// Count messages
const userMessages = state.messages.filter((m) => m.role === "user").length;
const assistantMessages = state.messages.filter((m) => m.role === "assistant").length;
const toolResults = state.messages.filter((m) => m.role === "toolResult").length;
const totalMessages = state.messages.length;
// Count tool calls from assistant messages
let toolCalls = 0;
for (const message of state.messages) {
if (message.role === "assistant") {
const assistantMsg = message as AssistantMessage;
toolCalls += assistantMsg.content.filter((c) => c.type === "toolCall").length;
}
}
// Calculate cumulative usage from all assistant messages (same as footer)
let totalInput = 0;
let totalOutput = 0;
@ -595,6 +605,8 @@ export class TuiRenderer {
info += `${chalk.bold("Messages")}\n`;
info += `${chalk.dim("User:")} ${userMessages}\n`;
info += `${chalk.dim("Assistant:")} ${assistantMessages}\n`;
info += `${chalk.dim("Tool Calls:")} ${toolCalls}\n`;
info += `${chalk.dim("Tool Results:")} ${toolResults}\n`;
info += `${chalk.dim("Total:")} ${totalMessages}\n\n`;
info += `${chalk.bold("Tokens")}\n`;
info += `${chalk.dim("Input:")} ${totalInput.toLocaleString()}\n`;