import { type LogEvent, type Renderer } from './logger';
/**
 * Output streams and optional memory-usage probe for {@link TextRenderer}.
 */
interface TextRendererOptions {
    /**
     * Receives all status chunks (scopes, bars, messages). May contain
     * partial-line writes (e.g. progress-bar `#` ticks). For TTY output,
     * hand this to a stream that flushes on partials
     * (`process.stderr.write.bind(process.stderr)` in Node) so bars
     * render in place. For non-interactive output (CI logs, file
     * redirects), wrap in a line buffer that holds chunks until a `\n`
     * arrives - the bar's incremental writes then coalesce into a single
     * complete line per bar.
     */
    write: (chunk: string) => void;
    /**
     * Receives `output` events, one logical unit per call, each already
     * terminated with `\n` by the renderer. Hand this to the pipeable
     * channel (typically `process.stdout.write.bind(process.stdout)`).
     * Defaults to the same sink as `write` when omitted.
     */
    output?: (chunk: string) => void;
    /**
     * Optional peak-memory probe in bytes. Used by the `[peak X]`
     * overlay gated by the renderer's `mem` field. In Node this is
     * typically derived from `process.resourceUsage().maxRSS` (which
     * is kernel-tracked and reflects the whole process - including
     * ArrayBuffers - rather than just the V8 heap).
     */
    getPeakMemory?: () => number;
    /**
     * Optional currently-live memory probe in bytes. When supplied
     * alongside `getPeakMemory`, the `--mem` overlay becomes
     * `[peak X | live Y]`, where `live` reflects memory that V8 still
     * tracks as alive. Unlike `peak` (kernel max RSS, monotonic), this
     * value drops when the GC reclaims unreferenced allocations, so
     * the gap between consecutive phases reveals whether each phase
     * actually releases its scratch buffers. In Node this is typically
     * `heapUsed + external` from `process.memoryUsage()` so ArrayBuffer
     * storage (typed arrays) is included.
     */
    getLiveMemory?: () => number;
}
/**
 * Default human-readable text renderer. Emits one event per line - no
 * carriage-return rewriting, no TTY detection, no buffering. Bars render
 * as `[#### ...... ] duration`, with `#` appended incrementally on each
 * `barTick` and the remainder padded with `.` on `barEnd`. `output`
 * events are treated as line-oriented: their text is written to the
 * pipeable sink with a trailing `\n` appended (callers should not include
 * one themselves).
 *
 * Verbosity is consulted directly from the shared {@link logger} on each
 * event, so this renderer alone decides what to display - the core
 * delivers every scope/bar lifecycle event so embedders consuming the
 * event stream see a faithful record. The display rules are:
 *
 * - `quiet` - suppresses every scope/bar lifecycle line (start, tick,
 *   end - including failed ends). Errors, warnings and `output` still
 *   show.
 * - `normal` (default) - shows scope/bar headers and bar progress;
 *   shows failed `scopeEnd` / `barEnd` footers (the "failed in ..."
 *   cascade from `logger.error` / `unwindAll(true)`); hides successful
 *   `scopeEnd` footers.
 * - `verbose` - shows everything, including successful `scopeEnd`
 *   footers ("done in ...").
 *
 * Sinks are injected (no `process` reference here) so the renderer works in
 * both Node CLI and browser/bundle contexts: the CLI passes
 * `process.stderr.write` for status and `process.stdout.write` for raw
 * output; library/browser consumers can pass a `console.log` line buffer.
 */
declare class TextRenderer implements Renderer {
    private readonly write;
    private readonly output;
    private readonly getPeakMemory?;
    private readonly getLiveMemory?;
    /**
     * When true, scope-end and bar-end lines gain a `[peak X]` suffix
     * (or `[peak X | live Y]` when {@link TextRendererOptions.getLiveMemory}
     * is also supplied) sourced from
     * {@link TextRendererOptions.getPeakMemory}. No effect when the probe
     * is omitted. Defaults to `true` when `getPeakMemory` is provided so
     * embedders that supply a probe see the overlay automatically. Mutable
     * so the host can toggle the overlay without re-installing the renderer.
     */
    mem: boolean;
    /** True while a bar header has been written without its closing `\n`. */
    private lineDirty;
    /**
     * Hash count already written for the active bar. Bars are strictly LIFO
     * (the active-scope stack guarantees it), so a single counter suffices.
     */
    private barFilled;
    constructor(options: TextRendererOptions);
    private rank;
    handle(event: LogEvent): void;
    /**
     * Terminate any in-progress bar line so subsequent output starts on a
     * fresh line. The bar's `#` count is preserved on its own line; the
     * eventual `barEnd` will produce its own footer line if it fires later.
     */
    private commitDirty;
    private memSuffix;
}
export { TextRenderer };
export type { TextRendererOptions };
