import type { Message, ToolResult } from "./contracts.js"; export declare const DEFAULT_TOOL_RESULT_FOLD_MIN_AGE_TURNS = 2; export declare const DEFAULT_TOOL_RESULT_FOLD_MIN_BYTES = 4096; export declare const DEFAULT_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES = 512; export declare const HARD_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES = 4096; export declare const TOOL_RESULT_FOLD_TURN_METADATA_KEY: "prismToolResultTurn"; export interface ToolResultFoldInput { readonly sessionId: string; readonly runId: string; readonly turn: number; readonly toolCallId: string; readonly toolName: string; readonly text: string; } export interface ToolResultFoldOptions { readonly minAgeTurns?: number; readonly minBytes?: number; readonly maxSummaryBytes?: number; readonly summarize: (input: ToolResultFoldInput) => Promise | string; } export interface ResolvedToolResultFoldOptions { readonly minAgeTurns: number; readonly minBytes: number; readonly maxSummaryBytes: number; readonly summarize: (input: ToolResultFoldInput) => Promise | string; } export interface FoldToolResultsContext { readonly sessionId: string; readonly runId: string; readonly turn: number; readonly signal?: AbortSignal; } /** Run overrides agent; disabled when neither supplies `summarize`. */ export declare function resolveToolResultFold(run?: ToolResultFoldOptions, agent?: ToolResultFoldOptions): ResolvedToolResultFoldOptions | undefined; /** Projection-only fold for history tool messages; does not mutate the input array. */ export declare function foldToolResultHistory(history: readonly Message[], options: ResolvedToolResultFoldOptions, context: FoldToolResultsContext): Promise; /** Projection-only fold for in-flight tool results before message conversion. */ export declare function foldToolResults(results: readonly ToolResult[], options: ResolvedToolResultFoldOptions, context: FoldToolResultsContext): Promise; export declare function formatFoldedToolResult(summary: string): string; export declare function foldedToolResultHeader(toolName: string, toolCallId: string, summary: string): string; /** Text the fold summarizes for one tool result: the payload JSON, then any text blocks. * Shared with the attention compiler so both hash/summarize the same bytes. */ export declare function toolResultFoldText(result: unknown, error: unknown, extra?: readonly { readonly type: string; }[]): string; /** UTF-8 cap that never splits a multi-byte character. Shared with the attention * compiler's host-summarize path so both cap host text identically. */ export declare function capToolResultSummary(summary: string, maxBytes: number): string; /** Provider turn per history index: assistant messages advance the turn, tool rows use * their `prismToolResultTurn` stamp when present and the last assistant turn otherwise. * Shared with the attention compiler so age gates match the fold exactly. */ export declare function inferToolResultTurns(history: readonly Message[]): readonly number[];