import type { HostFiles } from "../../host/host.js"; import type { Checkpoint } from "../state/checkpointStore.js"; import { type TraceSink } from "./sinks.js"; import type { TraceConfig } from "./types.js"; /** * Decide which file (if any) a trace writer should target for a given run. * * - `traceFile` set: use it verbatim. This is a fixed, process-wide path — * useful for tests and single-run inspection, but NOT safe with concurrent * runs of the same agent (they'd interleave into one file). Documented. * - `traceFile` unset, `traceDir` set: derive `${traceDir}/${runId}.agencytrace`. * Each run gets its own file, naturally supporting concurrent runs without * any shared state. * - Neither set: returns null (no file output; callback-only or disabled). */ export declare function resolveTraceFilePath(traceConfig: TraceConfig, runId: string): string | null; export declare class TraceWriter { private store; private sinks; private checkpointCount; private chunkCount; private program; private runId; private headerWritten; constructor(runId: string, program: string, sinks: TraceSink[], options?: { seenHashes?: Set; headerWritten?: boolean; }); writeHeader(): Promise; writeStaticState(values: Record): Promise; writeCheckpoint(checkpoint: Checkpoint): Promise; /** Flush and close all sinks without emitting a footer. * Used when execution is pausing for an interrupt. */ pause(): Promise; /** Emit a footer and close all sinks. * Used when the agent run is truly finished. */ close(): Promise; private writeLine; /** `files` is the file part of the run's host, which the trace file is * written through. A host without `fileWrite` refuses the open here, * while the context is built. */ static create({ runId, traceConfig, files, }: { runId: string; traceConfig: TraceConfig; files: HostFiles; }): Promise; }