/**
 * gist-compression — ReadAgent-style (Lee et al., ICLR 2024, arXiv:2402.09727)
 * tool-result compaction for multi-turn agent logs.
 *
 * Instead of truncating old tool messages, we generate a 1-2 sentence gist
 * via an LLM callback, preserving task-relevant identifiers and numbers at
 * ~84% compression (per the ReadAgent QuALITY benchmark).
 *
 * Scope:
 *   - gistToolResult:       compress a single tool result into a GistedMessage.
 *   - compactToolLogGist:   replace old tool messages in a log with their gists.
 *
 * Non-goals:
 *   - Token counting / tokenizer (caller provides rough char-based estimate).
 *   - LLM provider selection (caller injects GistLLMFn).
 *   - Persistence (stateless, pure).
 */
/** Caller-supplied LLM completion function (avoids provider coupling). */
export type GistLLMFn = (prompt: string) => Promise<string>;
export interface GistCompressionConfig {
    /**
     * Max tokens for the gist (rough estimate via chars/4). Default 80.
     * Passed to the prompt as guidance; the LLM is not hard-capped here.
     */
    maxGistTokens?: number;
    /**
     * Character length threshold above which gisting kicks in.
     * Below this the raw content is returned as-is. Default 400.
     */
    raw_threshold?: number;
}
export interface GistedMessage {
    /** Original role — always "tool" for gisted results. */
    role: "tool";
    /** Tool name, if known. */
    toolName?: string;
    /** Compressed content with "[GIST] " prefix for downstream visibility. */
    content: string;
    /** Original character length, for debug / telemetry. */
    originalLength: number;
}
/**
 * Generate a gist for a single tool result.
 *
 * - If rawContent.length < raw_threshold: returns { content: rawContent, ... } unchanged.
 * - Else: calls llmFn(prompt), trims, prefixes with "[GIST] ".
 * - On llmFn throw: falls back to truncation `rawContent.slice(0, raw_threshold) + "..."`.
 */
export declare function gistToolResult(rawContent: string, toolName: string | undefined, llmFn: GistLLMFn, config?: GistCompressionConfig): Promise<GistedMessage>;
/**
 * Compact a conversation log by replacing tool messages older than
 * `keepRecentN` with their gists. System and user messages are untouched.
 *
 * @param log         Full conversation log (mixed roles).
 * @param llmFn       LLM completion function for gist generation.
 * @param keepRecentN Keep the most recent N tool messages verbatim. Default 3.
 * @param config      Optional gist compression config.
 */
export declare function compactToolLogGist(log: Array<{
    role: string;
    content: string;
    toolName?: string;
}>, llmFn: GistLLMFn, keepRecentN?: number, config?: GistCompressionConfig): Promise<Array<{
    role: string;
    content: string;
    toolName?: string;
}>>;
//# sourceMappingURL=gist-compression.d.ts.map