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

Function getTaskOutputDelta

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

Source from the content-addressed store, hash-verified

304 * Reads only from the byte offset, up to maxBytes — never loads the full file.
305 */
306export async function getTaskOutputDelta(
307 taskId: string,
308 fromOffset: number,
309 maxBytes: number = DEFAULT_MAX_READ_BYTES,
310): Promise<{ content: string; newOffset: number }> {
311 try {
312 const result = await readFileRange(
313 getTaskOutputPath(taskId),
314 fromOffset,
315 maxBytes,
316 )
317 if (!result) {
318 return { content: '', newOffset: fromOffset }
319 }
320 return {
321 content: result.content,
322 newOffset: fromOffset + result.bytesRead,
323 }
324 } catch (e) {
325 const code = getErrnoCode(e)
326 if (code === 'ENOENT') {
327 return { content: '', newOffset: fromOffset }
328 }
329 logError(e)
330 return { content: '', newOffset: fromOffset }
331 }
332}
333
334/**
335 * Get output for a task, reading the tail of the file.

Callers 1

generateTaskAttachmentsFunction · 0.85

Calls 4

readFileRangeFunction · 0.85
getTaskOutputPathFunction · 0.85
getErrnoCodeFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected