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

Function getTaskOutput

source code/utils/task/diskOutput.ts:338–359  ·  view source on GitHub ↗
(
  taskId: string,
  maxBytes: number = DEFAULT_MAX_READ_BYTES,
)

Source from the content-addressed store, hash-verified

336 * Caps at maxBytes to avoid loading multi-GB files into memory.
337 */
338export async function getTaskOutput(
339 taskId: string,
340 maxBytes: number = DEFAULT_MAX_READ_BYTES,
341): Promise<string> {
342 try {
343 const { content, bytesTotal, bytesRead } = await tailFile(
344 getTaskOutputPath(taskId),
345 maxBytes,
346 )
347 if (bytesTotal > bytesRead) {
348 return `[${Math.round((bytesTotal - bytesRead) / 1024)}KB of earlier output omitted]\n${content}`
349 }
350 return content
351 } catch (e) {
352 const code = getErrnoCode(e)
353 if (code === 'ENOENT') {
354 return ''
355 }
356 logError(e)
357 return ''
358 }
359}
360
361/**
362 * Get the current size (offset) of a task's output file.

Callers 1

getTaskOutputDataFunction · 0.50

Calls 4

tailFileFunction · 0.85
getTaskOutputPathFunction · 0.85
getErrnoCodeFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected