/** * Parallel step log display * * Provides prefixed, color-coded interleaved output for parallel sub-steps. * Each sub-step's stream output gets a `[name]` prefix with right-padding * aligned to the longest sub-step name. */ import type { StreamCallback } from '../types.js'; import type { WorkflowMaxSteps } from '../../models/types.js'; /** Progress information for parallel logger */ export interface ParallelProgressInfo { /** Current iteration (1-indexed) */ iteration: number; /** Maximum steps allowed */ maxSteps: WorkflowMaxSteps; } export interface ParallelLoggerOptions { /** Sub-step names (used to calculate prefix width) */ subStepNames: string[]; /** Parent onStream callback to delegate non-prefixed events */ parentOnStream?: StreamCallback; /** Override process.stdout.write for testing */ writeFn?: (text: string) => void; /** Progress information for display */ progressInfo?: ParallelProgressInfo; /** Task label for rich parallel prefix display */ taskLabel?: string; /** Task color index for rich parallel prefix display */ taskColorIndex?: number; /** Parent step name for rich parallel prefix display */ parentStepName?: string; /** Parent step iteration count for rich parallel prefix display */ stepIteration?: number; /** Flush interval for partial text buffers in milliseconds */ flushIntervalMs?: number; /** Minimum buffered chars before timed flush is allowed */ minTimedFlushChars?: number; /** Maximum wait time for timed flush even without boundary */ maxTimedBufferMs?: number; } /** * Logger for parallel step execution. * * Creates per-sub-step StreamCallback wrappers that: * - Buffer partial lines until newline * - Prepend colored `[name]` prefix to each complete line * - Delegate init/result/error events to the parent callback */ export declare class ParallelLogger { private static readonly DEFAULT_FLUSH_INTERVAL_MS; private maxNameDisplayWidth; private readonly subStepNames; private readonly lineBuffer; private readonly parentOnStream?; private readonly writeFn; private readonly progressInfo?; private totalSubSteps; private readonly taskLabel?; private readonly taskColorIndex?; private readonly parentStepName?; private readonly stepIteration?; private readonly flushIntervalMs; constructor(options: ParallelLoggerOptions); addSubStep(name: string): number; /** * Build the colored prefix string for a sub-step. * Format: `\x1b[COLORm[name](iteration/max) step index/total\x1b[0m` + padding spaces */ buildPrefix(name: string, index: number): string; /** * Create a StreamCallback wrapper for a specific sub-step. * * - `text`: buffered line-by-line with prefix * - `tool_use`, `tool_result`, `tool_output`, `thinking`: prefixed per-line, no buffering * - `init`, `result`, `error`, diagnostics: delegated to parent callback (no prefix) */ createStreamHandler(subStepName: string, index: number): StreamCallback; /** * Handle text event with line buffering. * Buffer until newline, then output prefixed complete lines. * Empty lines get no prefix per spec. */ private handleTextEvent; private flushPartialLine; /** * Handle block events (tool_use, tool_result, tool_output, thinking). * Output with prefix, splitting multi-line content. */ private handleBlockEvent; /** * Build the prefix string for summary lines (no sub-step name). * Returns empty string in non-rich mode (no task-level prefix needed). */ private buildSummaryPrefix; /** * Flush remaining line buffers for all sub-steps. * Call after all sub-steps complete to output any trailing partial lines. */ flush(): void; /** * Print completion summary after all sub-steps finish. * * Format: * ``` * ── parallel-review results ── * arch-review: approved * security-review: rejected * ────────────────────────────── * ``` */ printSummary(parentStepName: string, results: Array<{ name: string; condition: string | undefined; }>): void; } //# sourceMappingURL=parallel-logger.d.ts.map