import { type ThreadLink } from './atif.js'; export type TrajectoryMergeReason = 'started_without_terminal' | 'EACCES' | 'ENOSPC' | 'malformed_fragment' | 'identity_hash_drift' | 'unresolvable_subagent_link' | 'unbound_child_fragment' | 'missing_child_fragment' | 'ambiguous_subagent_link' | 'output_path_exists' | 'output_path_not_writable' | 'containment_failure' | 'aggregate_metrics_underivable'; export declare class TrajectoryMergeError extends Error { readonly reason: TrajectoryMergeReason; constructor(reason: TrajectoryMergeReason, message: string, options?: { cause?: unknown; }); } export interface TrajectoryMergeFileSystem { readdir(directory: string): string[]; readFile(filePath: string): Buffer; exists(filePath: string): boolean; realpath(filePath: string): string; access(filePath: string, mode: number): void; open(filePath: string, flags: number, mode: number): number; write(fd: number, data: Buffer, offset: number, length?: number): number; fsync(fd: number): void; close(fd: number): void; link(source: string, destination: string): void; unlink(filePath: string): void; } export declare const NODE_TRAJECTORY_MERGE_FS: TrajectoryMergeFileSystem; export interface MergeTrajectoryOptions { trajectoryRoot: string; outputPath: string; subagentLinks?: ThreadLink[]; } export interface FragmentOutcome { thread_id: string | null; state: unknown; terminal_reason: unknown; } export interface MergeTrajectoryResult { outputPath: string; sha256: string; trajectoryId: string; fragments: FragmentOutcome[]; } export declare function mergeTrajectory(options: MergeTrajectoryOptions, fileSystem?: TrajectoryMergeFileSystem): MergeTrajectoryResult;