(usage: SessionUsage, status: SessionStatus)
| 1423 | } |
| 1424 | |
| 1425 | function formatUsageReport(usage: SessionUsage, status: SessionStatus): string { |
| 1426 | const lines = ['Session usage:']; |
| 1427 | if (usage.total !== undefined) { |
| 1428 | lines.push(`- Total: ${formatTokenUsage(usage.total)}`); |
| 1429 | } |
| 1430 | if (usage.currentTurn !== undefined) { |
| 1431 | lines.push(`- Current turn: ${formatTokenUsage(usage.currentTurn)}`); |
| 1432 | } |
| 1433 | for (const [model, modelUsage] of Object.entries(usage.byModel ?? {})) { |
| 1434 | lines.push(`- ${model}: ${formatTokenUsage(modelUsage)}`); |
| 1435 | } |
| 1436 | lines.push( |
| 1437 | `- Context: ${status.contextTokens.toLocaleString('en-US')} / ${status.maxContextTokens.toLocaleString('en-US')}${formatContextUsage(status.contextUsage)}`, |
| 1438 | ); |
| 1439 | return lines.join('\n'); |
| 1440 | } |
| 1441 | |
| 1442 | function formatMcpReport(servers: readonly McpServerInfo[]): string { |
| 1443 | if (servers.length === 0) return 'No MCP servers are configured for this session.'; |
no test coverage detected