import type { RunDirectoryPaths } from "./runDir.js"; import type { Trace } from "./traces.js"; /** * Merging statelogs into a run directory, by trace id. * * `planStatelogMerge` is pure and judges the whole incoming set at once: a * trace whose id is absent is added; one whose id is present with an equal * digest is skipped; one whose id is present with a different digest is * refused, because two event streams claiming one id would make every workdir * and annotation keyed on that id ambiguous. Any refusal fails the whole plan * — nothing is written — so a directory never ends up half-merged. */ export type StatelogMergePlan = { add: Trace[]; skipped: string[]; refused: { traceId: string; reason: "conflicting-digest"; }[]; }; export declare function planStatelogMerge(existing: readonly Trace[], incoming: readonly Trace[]): StatelogMergePlan; /** One sentence a person can act on: which ids were refused, or that nothing * was added and why, or what was added. */ export declare function describeStatelogMerge(plan: StatelogMergePlan, dir: string): string; /** @internal Writes a plan that has no refusals. Caller holds the lock. */ export declare function applyStatelogMerge(paths: RunDirectoryPaths, plan: StatelogMergePlan): void;