mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 14:01:15 +00:00
feat: add tool call and result counts to /session command
This commit is contained in:
parent
b1410ef903
commit
383b67b5c0
2 changed files with 14 additions and 0 deletions
|
|
@ -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.
|
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
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -566,8 +566,18 @@ export class TuiRenderer {
|
||||||
// Count messages
|
// Count messages
|
||||||
const userMessages = state.messages.filter((m) => m.role === "user").length;
|
const userMessages = state.messages.filter((m) => m.role === "user").length;
|
||||||
const assistantMessages = state.messages.filter((m) => m.role === "assistant").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;
|
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)
|
// Calculate cumulative usage from all assistant messages (same as footer)
|
||||||
let totalInput = 0;
|
let totalInput = 0;
|
||||||
let totalOutput = 0;
|
let totalOutput = 0;
|
||||||
|
|
@ -595,6 +605,8 @@ export class TuiRenderer {
|
||||||
info += `${chalk.bold("Messages")}\n`;
|
info += `${chalk.bold("Messages")}\n`;
|
||||||
info += `${chalk.dim("User:")} ${userMessages}\n`;
|
info += `${chalk.dim("User:")} ${userMessages}\n`;
|
||||||
info += `${chalk.dim("Assistant:")} ${assistantMessages}\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.dim("Total:")} ${totalMessages}\n\n`;
|
||||||
info += `${chalk.bold("Tokens")}\n`;
|
info += `${chalk.bold("Tokens")}\n`;
|
||||||
info += `${chalk.dim("Input:")} ${totalInput.toLocaleString()}\n`;
|
info += `${chalk.dim("Input:")} ${totalInput.toLocaleString()}\n`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue