MCPcopy
hub / github.com/codeaashu/claude-code / getProgressStats

Function getProgressStats

src/tools/AgentTool/UI.tsx:471–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469 const toolToolRenderLinesEstimate = (inProgressToolCallCount ?? 1) * ESTIMATED_LINES_PER_TOOL + TERMINAL_BUFFER_LINES;
470 const shouldUseCondensedMode = !isTranscriptMode && terminalSize && terminalSize.rows && terminalSize.rows < toolToolRenderLinesEstimate;
471 const getProgressStats = () => {
472 const toolUseCount = count(progressMessages, msg => {
473 if (!hasProgressMessage(msg.data)) {
474 return false;
475 }
476 const message = msg.data.message;
477 return message.message.content.some(content => content.type === 'tool_use');
478 });
479 const latestAssistant = progressMessages.findLast((msg): msg is ProgressMessage<AgentToolProgress> => hasProgressMessage(msg.data) && msg.data.message.type === 'assistant');
480 let tokens = null;
481 if (latestAssistant?.data.message.type === 'assistant') {
482 const usage = latestAssistant.data.message.message.usage;
483 tokens = (usage.cache_creation_input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0) + usage.input_tokens + usage.output_tokens;
484 }
485 return {
486 toolUseCount,
487 tokens
488 };
489 };
490 if (shouldUseCondensedMode) {
491 const {
492 toolUseCount,

Callers 1

Calls 2

countFunction · 0.85
hasProgressMessageFunction · 0.85

Tested by

no test coverage detected