import { type TruncationResult } from "@caupulican/pi-agent-core/truncate"; export interface OutputAccumulatorOptions { maxLines?: number; maxBytes?: number; tempFilePrefix?: string; tempDirectory?: string; /** Stream the complete output to disk even when the bounded in-memory view is not truncated. */ persistAllOutput?: boolean; /** Maximum raw bytes persisted to the managed output file. Defaults to no additional cap. */ maxPersistedBytes?: number; /** Decode valid UTF-8 plus isolated Windows-1252 bytes from native Windows programs. */ windowsCompatibleEncoding?: boolean; } export interface OutputSnapshot { content: string; truncation: TruncationResult; fullOutputPath?: string; fullOutputError?: string; persistedOutputTruncated?: boolean; persistedOutputBytes?: number; } export interface OutputPreview { content: string; skippedLines: number; } /** * Incrementally tracks streaming output with bounded memory. * * Appends decode chunks with a streaming UTF-8 decoder, keeps a bounded tail of * logical lines, and opens a temp file when the full output needs preserving. * Snapshot and preview work is bounded by configured output limits, never by * total command history. */ export declare class OutputAccumulator { private readonly maxLines; private readonly maxBytes; private readonly tempFilePrefix; private readonly tempDirectory; private readonly persistAllOutput; private readonly maxPersistedBytes; private readonly decoder; private readonly outputHash; private rawChunks; private headLines; private headStoredBytes; private tailLines; private tailLineBytes; private tailLineStoredBytes; private tailStart; private tailStoredBytes; private currentLineText; private currentLineBytes; private currentLineStoredBytes; private lastCompletedLineBytes; private totalRawBytes; private totalDecodedBytes; private completedLines; private totalLines; private hasOpenLine; private finished; private outputSignature; private tempFilePath; private tempFileFd; private tempFileError; private persistedOutputBytes; private persistedOutputTruncated; constructor(options?: OutputAccumulatorOptions); append(data: Buffer): void; finish(): void; snapshot(options?: { persistIfTruncated?: boolean; persistAlways?: boolean; }): OutputSnapshot; preview(maxLines: number, maxBytes?: number): OutputPreview; previewSnapshot(maxLines: number, maxBytes?: number, options?: { persistIfFullTruncated?: boolean; }): OutputSnapshot; private withPersistenceState; closeTempFile(): Promise; getLastLineBytes(): number; getOutputSignature(): string; private appendBlock; private appendDecodedText; private appendToCurrentLine; private pushCompletedCurrentLine; private recordHeadLine; private trimStoredTail; private completedTailLineCount; private retainedTailLines; private buildModelSnapshot; private buildSnapshot; private shouldUseTempFile; private fullOutputPath; private tryEnsureTempFile; private writePersisted; private recordTempFileError; } //# sourceMappingURL=output-accumulator.d.ts.map