/** Default number of lines to return (tail). */ export declare const DEFAULT_TAIL_LINES = 200; /** Default estimated token limit for tool output. Safety net on top of line-based tail. */ export declare const DEFAULT_MAX_OUTPUT_TOKENS = 2000; export declare function stripAnsi(text: string): string; /** * `toModelOutput` handler for sandbox tools. * Strips ANSI escape codes so the model sees clean text, while the raw * output (with colors) is preserved in the stream/TUI. * * Returns `{ type: 'text', value: '...' }` to match the AI SDK's * expected tool-result output format. */ export declare function sandboxToModelOutput(output: unknown): unknown; /** * Return the last N lines of output, similar to `tail -n`. * - `n > 0`: last N lines * - `n === 0`: no limit (return all) * - `undefined/null`: use DEFAULT_TAIL_LINES */ export declare function applyTail(output: string, tail: number | null | undefined): string; /** * Token-based output limit. Truncates output to fit within a token budget. * Uses tiktoken for accurate token counting and truncates at the token level * (not line boundaries) to maximise use of the budget. * * @param output - The text to truncate * @param limit - Maximum tokens (default: DEFAULT_MAX_OUTPUT_TOKENS) * @param from - Which end to truncate from: * - `'start'` (default): Remove tokens from the start, keep the end * - `'end'`: Remove tokens from the end, keep the start */ export declare function applyTokenLimit(output: string, limit?: number, from?: 'start' | 'end'): Promise; /** * Head+tail sandwich truncation. Keeps lines from both the start and end * of the output, with a truncation notice in the middle. * Uses tiktoken for accurate token counting. * * @param output - The text to truncate * @param limit - Maximum tokens (default: DEFAULT_MAX_OUTPUT_TOKENS) * @param headRatio - Fraction of the token budget to allocate to the head (default: 0.1 = 10%) */ export declare function applyTokenLimitSandwich(output: string, limit?: number, headRatio?: number): Promise; /** * Apply both tail (line-based) and token limit (safety net) to output. */ export declare function truncateOutput(output: string, tail?: number | null, tokenLimit?: number, tokenFrom?: 'start' | 'end' | 'sandwich'): Promise; //# sourceMappingURL=output-helpers.d.ts.map