MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getTaskOutputDelta

Function getTaskOutputDelta

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

Source from the content-addressed store, hash-verified

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