/**
 * Pure helpers shared by the terminal renderer: key parsing and status-text
 * formatting. Kept apart from the renderer so the presentation class stays
 * focused on painting.
 */
import type { AssistantResponseStatsMode } from "./types.js";
export type TerminalKey = {
    type: "character";
    value: string;
} | {
    type: "backspace";
} | {
    type: "delete";
} | {
    type: "enter";
} | {
    type: "up";
} | {
    type: "down";
} | {
    type: "left";
} | {
    type: "right";
} | {
    type: "home";
} | {
    type: "end";
} | {
    type: "tab";
} | {
    type: "escape";
} | {
    type: "ctrl-a";
} | {
    type: "ctrl-e";
} | {
    type: "ctrl-d";
} | {
    type: "ctrl-k";
} | {
    type: "ctrl-u";
} | {
    type: "ctrl-w";
} | {
    type: "ctrl-l";
} | {
    type: "ctrl-r";
} | {
    type: "ctrl-c";
} | {
    type: "ignore";
};
/** One decoded key plus how many bytes it consumed from the input buffer. */
export interface KeyToken {
    key?: TerminalKey;
    consumed: number;
    /** The buffer ends mid-sequence; wait for more bytes before decoding. */
    incomplete?: boolean;
}
/**
 * Decodes the next key from a raw input buffer, returning how many characters
 * it consumed so a caller can reassemble escape sequences that arrive split
 * across reads (common with PTYs and under load). Returns `incomplete` when the
 * buffer holds only a prefix of a longer sequence (a lone `ESC`, or a CSI/SS3
 * without its final byte) so the caller can wait for the rest.
 */
export declare function nextKey(buffer: string): KeyToken;
export declare function parseKey(chunk: Buffer): TerminalKey;
export interface AssistantResponseStats {
    totalTokens: number | undefined;
    outputTokens: number | undefined;
    tokensPerSecond: number | undefined;
}
export declare function takeUntil<T>(source: AsyncIterable<T>, stop: Promise<void>): AsyncIterable<T>;
export declare function formatTokenCount(tokens: number | undefined, contextSize?: number): string | undefined;
export declare function formatAssistantResponseStats(stats: AssistantResponseStats, mode: AssistantResponseStatsMode): string | undefined;
