MCPcopy Create free account
hub / github.com/github/gh-aw / generateSummaryLines

Function generateSummaryLines

actions/setup/js/log_parser_format.cjs:558–610  ·  view source on GitHub ↗
(logEntries)

Source from the content-addressed store, hash-verified

556 }
557
558 function generateSummaryLines(logEntries) {
559 const renderEntries = normalizeEntriesForRendering(logEntries);
560 const lines = [];
561 const toolUsePairs = collectToolUsePairs(renderEntries);
562
563 const state = {
564 conversationLineCount: 0,
565 maxConversationLines: 5000,
566 conversationTruncated: false,
567 traceEventCount: 0,
568 };
569
570 for (const entry of renderEntries) {
571 if (state.conversationLineCount >= state.maxConversationLines) {
572 state.conversationTruncated = true;
573 break;
574 }
575
576 if (entry.type === "assistant" && entry.message?.content) {
577 for (const content of entry.message.content) {
578 if (state.conversationLineCount >= state.maxConversationLines) {
579 state.conversationTruncated = true;
580 break;
581 }
582
583 if (content.type === "text" && content.text) {
584 let text = content.text.trim();
585 text = unfenceMarkdown(text);
586 if (text && text.length > 0) {
587 appendAgentText(lines, text, state);
588 }
589 } else if (content.type === "thinking" && content.thinking) {
590 let text = content.thinking.trim();
591 text = unfenceMarkdown(text);
592 if (text && text.length > 0) {
593 appendReasoningText(lines, text, state);
594 }
595 } else if (content.type === "tool_use") {
596 appendToolExecutionLine(lines, content, toolUsePairs, state);
597 }
598 }
599 }
600 }
601
602 if (state.conversationTruncated) {
603 lines.push("... (conversation truncated)");
604 lines.push("");
605 }
606
607 appendStatistics(lines, renderEntries, toolUsePairs);
608
609 return lines;
610 }
611
612 /**
613 * Generates plain-text Copilot CLI style summary for logs.

Callers 2

generatePlainTextSummaryFunction · 0.85

Calls 7

collectToolUsePairsFunction · 0.85
unfenceMarkdownFunction · 0.85
appendAgentTextFunction · 0.85
appendReasoningTextFunction · 0.85
appendToolExecutionLineFunction · 0.85
appendStatisticsFunction · 0.85

Tested by

no test coverage detected