MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / formatTaskOutput

Function formatTaskOutput

source code/utils/task/outputFormatting.ts:24–40  ·  view source on GitHub ↗
(
  output: string,
  taskId: string,
)

Source from the content-addressed store, hash-verified

22 * the last N characters that fit within the limit.
23 */
24export function formatTaskOutput(
25 output: string,
26 taskId: string,
27): { content: string; wasTruncated: boolean } {
28 const maxLen = getMaxTaskOutputLength()
29
30 if (output.length <= maxLen) {
31 return { content: output, wasTruncated: false }
32 }
33
34 const filePath = getTaskOutputPath(taskId)
35 const header = `[Truncated. Full output: ${filePath}]\n\n`
36 const availableSpace = maxLen - header.length
37 const truncated = output.slice(-availableSpace)
38
39 return { content: header + truncated, wasTruncated: true }
40}

Callers 1

Calls 2

getMaxTaskOutputLengthFunction · 0.85
getTaskOutputPathFunction · 0.85

Tested by

no test coverage detected