/** 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.
 *
 * Mastra validation-error envelopes (e.g. from output-schema validation
 * failures) are tagged as `{ type: 'error-json', value }` so providers
 * receive a valid tool-result output instead of an untagged object.
 *
 * `{ error: string }` results (e.g. substituted by a blocking `beforeToolCall`
 * hook) are tagged as `{ type: 'error-text', value }` so the model sees the reason.
 */
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 tokenx for fast token estimation 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<string>;
/**
 * Head+tail sandwich truncation. Keeps lines from both the start and end
 * of the output, with a truncation notice in the middle.
 * Uses tokenx for fast token estimation.
 *
 * The notice names the dropped lines and the lines kept on each side, so the
 * model can read exactly the missing range instead of re-running the command, e.g.
 * `[...output truncated — dropped lines 24-199; showing first ~200 tokens (lines 1-23) + last ~1800 tokens (lines 200-400) of ~3600 tokens...]`.
 * A line the cut goes through is reported as "the end of line N" / "the start of line N".
 *
 * @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<string>;
/**
 * Tell the model when the sandbox dropped the start of a stream (retention limit),
 * so it doesn't read the newest output as all of it.
 */
export declare function noteDroppedOutput(output: string, droppedBytes: number | undefined, stream: 'stdout' | 'stderr'): string;
/**
 * 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<string>;
//# sourceMappingURL=output-helpers.d.ts.map