/** * Trace file reader for the dashboard. * * Stream-parses NDJSON trace files from `.agents-reverse-engineer/traces/` * and reconstructs timeline data for visualization. * * @module */ import type { TraceEvent } from '../orchestration/trace.js'; /** Parsed trace containing all events and derived timeline data */ export interface ParsedTrace { /** Trace file path */ filePath: string; /** All events in sequence order */ events: TraceEvent[]; /** Phase timeline reconstructed from events */ phases: PhaseTimeline[]; /** Total elapsed time in ms */ totalElapsedMs: number; } /** Timeline data for a single phase */ export interface PhaseTimeline { /** Phase name (e.g., "phase-1-files") */ phase: string; /** Start elapsed time (ms from run start) */ startMs: number; /** End elapsed time (ms from run start) */ endMs: number; /** Duration in ms */ durationMs: number; /** Concurrency level */ concurrency: number; /** Total tasks in this phase */ taskCount: number; /** Tasks completed successfully */ tasksCompleted: number; /** Tasks that failed */ tasksFailed: number; /** Worker timelines */ workers: WorkerTimeline[]; } /** Timeline data for a single worker within a phase */ export interface WorkerTimeline { /** Worker ID */ workerId: number; /** Tasks executed by this worker */ tasks: TaskSpan[]; } /** Time span for a single task execution */ export interface TaskSpan { /** Task label (typically a file path) */ label: string; /** Task index in the phase */ taskIndex: number; /** Start elapsed time (ms from run start) */ startMs: number; /** End elapsed time (ms from run start) */ endMs: number; /** Duration in ms */ durationMs: number; /** Whether the task succeeded */ success: boolean; } /** * List all trace files, newest first. * * @param projectRoot - Absolute path to the project root directory * @returns Array of absolute paths to trace files */ export declare function listTraceFiles(projectRoot: string): Promise; /** * Parse a trace NDJSON file into structured timeline data. * * Uses readline for line-by-line streaming to avoid loading * large trace files entirely into memory. * * @param filePath - Absolute path to the trace NDJSON file * @returns Parsed trace with events and reconstructed timeline */ export declare function parseTraceFile(filePath: string): Promise; /** * Find a trace file by partial timestamp match. * * @param projectRoot - Absolute path to the project root directory * @param query - Partial timestamp to match in the filename * @returns Absolute path to the matching trace file, or null */ export declare function findTraceFile(projectRoot: string, query: string): Promise; /** * Extract a short display ID from a trace filename. * * Converts "trace-2026-02-14T13-46-11-934Z.ndjson" to "2026-02-14 13:46". */ export declare function shortTraceId(filePath: string): string; //# sourceMappingURL=trace-reader.d.ts.map