import type { HostFiles, Located } from "../../host/host.js"; import type { TraceSink } from "./sinks.js"; import type { TraceLine } from "./types.js"; export declare class FileSink implements TraceSink { private files; private located; private handle; private constructor(); static open(files: HostFiles, filePath: string): Promise; /** What an earlier writer in this run already put in the file. */ existing(): Promise; writeLine(line: TraceLine): Promise; close(): Promise; } /** What a sink already holds from an earlier writer in the same run. */ export type ExistingTrace = { hasHeader: boolean; chunkHashes: Set; }; /** * Scan an existing trace file to learn what a prior writer in the same run * already emitted, so that a freshly-constructed `TraceWriter` can avoid * writing a duplicate header or re-emitting chunks that are already on disk. * * Best-effort: malformed lines (e.g. a partial JSON line from a crashed prior * writer) are skipped, not propagated. Returns `{ hasHeader: false, * chunkHashes: new Set() }` for empty or non-existent files. Only `header` and * `chunk` line types affect the result; other types (`source`, `static-state`, * `manifest`, `footer`) are ignored — they don't need cross-writer dedup * because either they're never emitted at runtime (`source`) or they're * already gated to once per run elsewhere (`static-state` via * `globals.markInitialized`; `manifest`/`footer` are per-checkpoint / * per-close events that shouldn't be deduped). * * Reads the file in pieces and keeps one line at a time, so peak memory * stays at roughly one line, not the full file content. Each parsed chunk * line becomes GC-eligible after we extract its `hash` — the chunk's `data` * payload (potentially large) is never retained. */ export declare function scanExistingTraceFile(files: HostFiles, located: Located): Promise;