MCPcopy Create free account
hub / github.com/apache/maka / compactTerminalSummary

Function compactTerminalSummary

packages/cli/src/pi-transcript-tools.ts:304–321  ·  view source on GitHub ↗
(
  content: Extract<ToolResultContent, { kind: 'terminal' }>,
)

Source from the content-addressed store, hash-verified

302}
303
304function compactTerminalSummary(
305 content: Extract<ToolResultContent, { kind: 'terminal' }>,
306): CompactToolSummary {
307 if (content.status !== 'completed') {
308 // The exit code is the whole signal on a failed row; the error text lives
309 // in the expanded card.
310 return {
311 text: ansi.red(content.exitCode === undefined ? content.status : `exit ${content.exitCode}`),
312 protect: true,
313 };
314 }
315 if (content.output.mode === 'pty') {
316 const rows = ptyTuiTerminalRows(content.output).length;
317 return rows > 0 ? { text: linesText(rows), protect: true } : noOutput();
318 }
319 const lines = pipeOutputLineCount(content.output);
320 return lines > 0 ? { text: linesText(lines), protect: true } : noOutput();
321}
322
323function compactDiffSummary(
324 content: Extract<ToolResultContent, { kind: 'file_diff' }>,

Callers 1

compactToolSummaryFunction · 0.85

Calls 4

ptyTuiTerminalRowsFunction · 0.90
linesTextFunction · 0.85
noOutputFunction · 0.85
pipeOutputLineCountFunction · 0.85

Tested by

no test coverage detected