import type { AgentToolResult } from "@earendil-works/pi-agent-core";
import type { TextContent } from "@earendil-works/pi-ai/compat";
/**
 * Resolve the effective persistence threshold (in characters) for a tool.
 *
 * Mirrors the upstream `getPersistenceThreshold` convention: a tool may declare a
 * lower per-tool cap, but the global {@link DEFAULT_MAX_RESULT_SIZE_CHARS} acts as
 * a system-wide ceiling. `Infinity` is a hard opt-out for self-bounded tools whose
 * output is already a file the model reads back, where persisting would be circular.
 */
export declare function getPersistenceThreshold(declaredMaxResultSizeChars?: number): number;
export interface RedirectOversizedToolResultInput<TDetails = unknown> {
    toolName: string;
    toolCallId: string;
    result: Pick<AgentToolResult<TDetails>, "content" | "details">;
    isError: boolean;
    sessionId: string;
    sessionDir?: string;
    /** Optional per-tool character cap; clamped by {@link DEFAULT_MAX_RESULT_SIZE_CHARS}. */
    maxResultSizeChars?: number;
}
export interface OversizedToolResultReplacement {
    content: TextContent[];
    details: unknown;
    isError: boolean;
}
/**
 * Human-readable byte size, e.g. `1536` → "1.5KB". Intentionally mirrors
 * upstream Claude Code `formatFileSize` wording instead of using tools/truncate.ts.
 */
export declare function formatFileSize(sizeInBytes: number): string;
/**
 * Generate a preview of content, truncating at a newline boundary when possible.
 * Ported from the reference `generatePreview`.
 */
export declare function generatePreview(content: string, maxBytes: number): {
    preview: string;
    hasMore: boolean;
};
/**
 * When a tool result's text content exceeds the persistence threshold (default
 * 50,000 chars — {@link DEFAULT_MAX_RESULT_SIZE_CHARS}), persist the full output
 * to a session-scoped file and replace the model-visible content with a
 * `<persisted-output>` preview that references the saved file.
 *
 * Returns `undefined` (leave the result untouched) when the result is within the
 * threshold, contains image blocks, or cannot be persisted to disk.
 *
 * Convention ported from the upstream `maybePersistLargeToolResult`
 * (mehmoodosman/claude-code, `src/utils/toolResultStorage.ts`).
 */
export declare function redirectOversizedToolResult<TDetails = unknown>(input: RedirectOversizedToolResultInput<TDetails>): Promise<OversizedToolResultReplacement | undefined>;
//# sourceMappingURL=oversized-tool-result.d.ts.map