import type InteractiveStreamHook from "./interactive-stream-hook.d.ts"; /** Supported stream types for interactive output */ type StreamType = "stderr" | "stdout"; /** * Interactive Manager. * * Manages interactive terminal output by coordinating stdout and stderr streams. * Enables features like progress bars, spinners, and dynamic updates by temporarily * capturing and controlling terminal output. Supports suspending and resuming * interactive mode for external output. * @example * ```typescript * const manager = new InteractiveManager(stdoutHook, stderrHook); * * // Start interactive mode * manager.hook(); * * // Update output dynamically * manager.update("stdout", ["Processing...", "50% complete"]); * * // Temporarily suspend for external output * manager.suspend("stdout"); * console.log("External message"); * manager.resume("stdout"); * * // End interactive mode and show final output * manager.unhook(); * ``` */ declare class InteractiveManager { #private; /** * Creates a new InteractiveManager with the given stream hooks. * @param stdout Hook for stdout stream * @param stderr Hook for stderr stream */ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook); /** * Last printed rows count. * * Tracks the number of rows that were last written to the terminal. * Used internally for managing cursor positioning and output updates. */ get lastLength(): number; /** * Rows count outside editable area. * * Tracks the number of rows that extend beyond the current terminal height. * Used for managing scrolling and ensuring all output remains visible. */ get outside(): number; /** * Hook activity status. * * Indicates whether the interactive hooks are currently active. * When true, streams are being intercepted for interactive output. */ get isHooked(): boolean; /** * Suspend status for active hooks. * * Indicates whether interactive mode is temporarily suspended. * When suspended, external output can be written without interference. */ get isSuspended(): boolean; /** * Removes lines from the terminal output. * * Erases the specified number of lines from the bottom of the output, * moving the cursor up and clearing the lines. Useful for removing * previous interactive output before displaying new content. * @param stream The stream to erase lines from ("stdout" or "stderr") * @param count Number of lines to remove (defaults to lastLength) * @throws {TypeError} If the specified stream is not available */ erase(stream: StreamType, count?: number): void; /** * Hook stdout and stderr streams. * @returns Success status */ hook(): boolean; /** * Resume suspend hooks. * @param stream Stream to resume * @param eraseRowCount erase output rows count */ resume(stream: StreamType, eraseRowCount?: number): void; /** * Suspend active hooks for external output. * @param stream Stream to suspend * @param erase erase output */ suspend(stream: StreamType, erase?: boolean): void; /** * Unhooks both stdout and stderr streams and print their story of logs. * @param separateHistory If `true`, will add an empty line to the history output for individual recorded lines and console logs * @returns Success status */ unhook(separateHistory?: boolean): boolean; /** * Update output. * @param stream Stream to write to * @param rows Text lines to write to standard output * @param from Index of the line starting from which the contents of the terminal are being overwritten */ update(stream: StreamType, rows: string[], from?: number): void; } export default InteractiveManager;