MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / formatUsageReport

Function formatUsageReport

packages/acp-adapter/src/session.ts:1425–1440  ·  view source on GitHub ↗
(usage: SessionUsage, status: SessionStatus)

Source from the content-addressed store, hash-verified

1423}
1424
1425function 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
1442function formatMcpReport(servers: readonly McpServerInfo[]): string {
1443 if (servers.length === 0) return 'No MCP servers are configured for this session.';

Callers 1

runBuiltInCommandMethod · 0.85

Calls 3

formatTokenUsageFunction · 0.85
formatContextUsageFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected