/** * Reading a task's output file: its tail, or what was appended past a cursor. * * A tail read is bounded twice — by bytes read from the end of the file and by * lines returned — because the same code serves `pretty_task_bg_logs` and the panel, and a * runaway command must never be able to flood either. A follow read is bounded * by the file itself: it returns exactly the bytes the previous follow left. * * @author mystery4f <40482524+mystery4f@users.noreply.github.com> */ /** Tail of one output file. */ export interface OutputTail { text: string; /** Number of lines in `text`. */ lines: number; /** True when older output was left out, by bytes or by lines. */ truncated: boolean; } export interface OutputTailOptions { /** Maximum lines to return. */ lines: number; /** Maximum bytes to read from the end of the file. Defaults to 128 KiB. */ maxBytes?: number; /** Platform whose console encoding the reader falls back to; defaults to this host. */ platform?: NodeJS.Platform; } /** Read the last `lines` lines of an output file. A missing file has no output yet. */ export declare function readOutputTail(path: string, options: OutputTailOptions): Promise; /** Bytes appended to one output file since an offset. */ export interface OutputDelta { text: string; /** Offset the read started at, clamped to the file's current size. */ from: number; /** Offset just past the bytes read; the next follow read starts here. */ to: number; /** Size of the file when it was read. */ size: number; } export interface OutputDeltaOptions { /** Platform whose console encoding the reader falls back to; defaults to this host. */ platform?: NodeJS.Platform; } /** * Read what an output file holds past `offset`. A missing file has nothing past * it, and an offset beyond the end is clamped, so a file that was replaced or * truncated answers an empty delta instead of failing the follow. The bytes are * decoded the same way a tail read decodes them, so a follower and a tail * reader never disagree about a character. */ export declare function readOutputFrom(path: string, offset: number, options?: OutputDeltaOptions): Promise;