/**
 * Shared utilities for compaction and branch summarization.
 */
import type { AgentMessage } from "@nerf/pi-agent-core";
import type { Message } from "@nerf/pi-ai";
import type { SessionEntry } from "../session-manager.js";
export interface FileOperations {
    read: Set<string>;
    written: Set<string>;
    edited: Set<string>;
}
export declare function createFileOps(): FileOperations;
/**
 * Extract file operations from tool calls in an assistant message.
 */
export declare function extractFileOpsFromMessage(message: AgentMessage, fileOps: FileOperations): void;
/**
 * Compute final file lists from file operations.
 * Returns readFiles (files only read, not modified) and modifiedFiles.
 */
export declare function computeFileLists(fileOps: FileOperations): {
    readFiles: string[];
    modifiedFiles: string[];
};
/**
 * Format file operations as XML tags for summary.
 */
export declare function formatFileOperations(readFiles: string[], modifiedFiles: string[]): string;
/**
 * Extract AgentMessage from a session entry.
 *
 * Handles all entry types: message, custom_message, branch_summary, and compaction.
 * Returns undefined for entries that don't contribute to LLM context (e.g., settings changes).
 *
 * @param skipToolResults - If true, skips toolResult messages (used by branch summarization
 *   where tool call context is sufficient). Default false.
 */
export declare function getMessageFromEntry(entry: SessionEntry, skipToolResults?: boolean): AgentMessage | undefined;
/**
 * Collect AgentMessages from a range of session entries.
 *
 * @param entries - Session entries array
 * @param startIndex - First index (inclusive)
 * @param endIndex - Last index (exclusive)
 * @param skipToolResults - If true, skips toolResult messages. Default false.
 */
export declare function collectMessages(entries: SessionEntry[], startIndex: number, endIndex: number, skipToolResults?: boolean): AgentMessage[];
/**
 * Extract text from an array of content blocks, filtering to text-type blocks.
 * Replaces the recurring `.filter(c => c.type === "text").map(c => c.text).join(sep)` pattern.
 */
export declare function extractTextContent(content: Array<{
    type: string;
    text?: string;
}>, separator?: string): string;
/**
 * Create a single-message array for summarization prompts.
 * Wraps promptText in the standard `[{ role: "user", content: [{ type: "text", text }], timestamp }]` shape.
 */
export declare function createSummarizationMessage(promptText: string): [{
    role: "user";
    content: [{
        type: "text";
        text: string;
    }];
    timestamp: number;
}];
/**
 * Serialize LLM messages to text for summarization.
 * This prevents the model from treating it as a conversation to continue.
 * Call convertToLlm() first to handle custom message types.
 *
 * Tool results are truncated to keep the summarization request within
 * reasonable token budgets. Full content is not needed for summarization.
 */
export declare function serializeConversation(messages: Message[]): string;
export declare const SUMMARIZATION_SYSTEM_PROMPT = "You are a context summarization assistant. Your task is to read a conversation between a user and an AI coding assistant, then produce a structured summary following the exact format specified.\n\nDo NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.";
//# sourceMappingURL=utils.d.ts.map