/**
 * Routines that trim oversized tool output before it reaches the model.
 *
 * Two separate ceilings are checked at once, and trimming kicks in the moment
 * either is reached:
 *   - a maximum count of lines that may be returned (2500 by default)
 *   - a maximum count of bytes that may be returned (64KB by default)
 *
 * Trims occur at line breaks, so output is never left holding a partial line.
 * The single exception is when trimming from the tail: should the very last line
 * by itself blow past the byte ceiling, that line gets cut mid-way.
 */
export declare const DEFAULT_MAX_LINES = 2500;
export declare const DEFAULT_MAX_BYTES: number;
export declare const GREP_MAX_LINE_LENGTH = 512;
export interface TruncationResult {
    /** Final text once the budgets have been enforced. */
    content: string;
    /** Whether any budget actually forced something to be dropped. */
    truncated: boolean;
    /** Which budget caused the cut, or null if everything fit. */
    truncatedBy: "lines" | "bytes" | null;
    /** Number of lines the original input had prior to any trimming. */
    totalLines: number;
    /** Number of bytes the original input had prior to any trimming. */
    totalBytes: number;
    /** How many complete lines survived into the result. */
    outputLines: number;
    /** How many bytes the result occupies. */
    outputBytes: number;
    /** Set only in the tail case where the closing line had to be cut mid-line. */
    lastLinePartial: boolean;
    /** Set when even the leading line by itself blows past the byte budget (head case). */
    firstLineExceedsLimit: boolean;
    /** The active line budget. */
    maxLines: number;
    /** The active byte budget. */
    maxBytes: number;
}
export interface TruncationOptions {
    /** Custom line budget; defaults to 2500 when omitted. */
    maxLines?: number;
    /** Custom byte budget; defaults to 64KB when omitted. */
    maxBytes?: number;
}
export interface TruncationStrategy {
    truncate(content: string, options?: TruncationOptions): TruncationResult;
}
/**
 * Render a raw byte count as a compact label a person can read at a glance,
 * picking B, KB, or MB depending on magnitude.
 */
export declare function formatSize(bytes: number): string;
/**
 * Retain the leading slice of the content (its first lines/bytes) and discard
 * what follows. Suited to reading files, where the beginning is most relevant.
 *
 * Whole lines are preserved. Should the opening line on its own exceed the byte
 * budget, an empty result is returned with firstLineExceedsLimit set.
 */
export declare function truncateHead(content: string, options?: TruncationOptions): TruncationResult;
/**
 * Retain the trailing slice of the content (its last lines/bytes) and discard
 * what precedes it. Suited to command output, where errors and results land at
 * the end.
 *
 * When the closing line by itself overshoots the byte budget, the returned text
 * can start partway through that line.
 */
export declare function truncateTail(content: string, options?: TruncationOptions): TruncationResult;
/**
 * Shorten one line to a character budget, tacking on a marker if it was cut.
 * Used on search hits whose lines would otherwise run too long.
 */
export declare function truncateLine(line: string, maxChars?: number): {
    text: string;
    wasTruncated: boolean;
};
