/**
 * Custom message types and transformers for the coding agent.
 *
 * Extends the base AgentMessage type with coding-agent specific message types,
 * and provides a transformer to convert them to LLM-compatible messages.
 */
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import { type ImageContent, type Message, type TextContent } from "@earendil-works/pi-ai";
export declare const COMPACTION_SUMMARY_PREFIX = "The conversation history before this point was compacted into the following summary:\n\n<summary>\n";
export declare const COMPACTION_SUMMARY_SUFFIX = "\n</summary>";
export declare const BRANCH_SUMMARY_PREFIX = "The following is a summary of a branch that this conversation came back from:\n\n<summary>\n";
export declare const BRANCH_SUMMARY_SUFFIX = "</summary>";
export declare const GOAL_CONTINUATION_MESSAGE_TYPE = "goal-continuation";
/**
 * Per-type exclusion must remain false: compaction and branch summarization
 * inspect entries independently, where excluding this type would hide the live
 * goal-continuation message.
 */
export declare function isContextExcludedCustomMessage(_customType: string): boolean;
/**
 * Whole-context filtering is deliberately a no-op. Goal continuations are
 * append-only: dropping an already-sent continuation would rewrite a
 * provider-visible turn, so request N would stop being a prefix of request N+1
 * and every cached token ahead of the edit would be invalidated (full re-read,
 * cost spike, 429 storms in team mode). Continuation history is bounded by
 * normal compaction instead of by per-request deletion.
 */
export declare function filterContextExcludedMessages(messages: AgentMessage[]): AgentMessage[];
/**
 * Message type for bash executions via the ! command.
 */
export interface BashExecutionMessage {
    role: "bashExecution";
    command: string;
    output: string;
    exitCode: number | undefined;
    cancelled: boolean;
    truncated: boolean;
    fullOutputPath?: string;
    timestamp: number;
    /** If true, this message is excluded from LLM context (!! prefix) */
    excludeFromContext?: boolean;
}
/**
 * Message type for extension-injected messages via sendMessage().
 * These are custom messages that extensions can inject into the conversation.
 */
export interface CustomMessage<T = unknown> {
    role: "custom";
    customType: string;
    content: string | (TextContent | ImageContent)[];
    display: boolean;
    details?: T;
    timestamp: number;
}
export interface BranchSummaryMessage {
    role: "branchSummary";
    summary: string;
    fromId: string | null;
    timestamp: number;
}
export interface CompactionSummaryMessage {
    role: "compactionSummary";
    summary: string;
    tokensBefore: number;
    details?: unknown;
    timestamp: number;
}
export interface ConfigurationUpdateMessage {
    role: "configurationUpdate";
    content: (TextContent | ImageContent)[];
    effort: string;
    timestamp: number;
}
declare module "@earendil-works/pi-agent-core" {
    interface CustomAgentMessages {
        bashExecution: BashExecutionMessage;
        custom: CustomMessage;
        branchSummary: BranchSummaryMessage;
        configurationUpdate: ConfigurationUpdateMessage;
    }
}
/**
 * Convert a BashExecutionMessage to user message text for LLM context.
 */
export declare function bashExecutionToText(msg: BashExecutionMessage): string;
export declare function createBranchSummaryMessage(summary: string, fromId: string, timestamp: string): BranchSummaryMessage;
export declare function createCompactionSummaryMessage(summary: string, tokensBefore: number, timestamp: string, details?: unknown): CompactionSummaryMessage;
/** Convert CustomMessageEntry to AgentMessage format */
export declare function createCustomMessage(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details: unknown | undefined, timestamp: string): CustomMessage;
/**
 * Transform AgentMessages (including custom types) to LLM-compatible Messages.
 *
 * This is used by:
 * - Agent's transormToLlm option (for prompt calls and queued messages)
 * - Compaction's generateSummary (for summarization)
 * - Custom extensions and tools
 */
export declare function convertToLlm(messages: AgentMessage[]): Message[];
/**
 * Cap on inline image base64 (characters approximately equal wire bytes) per
 * provider request. Anthropic documents a 32 MB request limit; reserving the
 * remainder for text and request overhead keeps the transport below that wall.
 */
export declare const TRANSPORT_IMAGE_BUDGET_BYTES: number;
export { IMAGE_ELISION_PLACEHOLDER } from "./image-elision-placeholder.ts";
export declare const BLOCKED_IMAGE_PLACEHOLDER = "Image reading is disabled.";
export interface ElideOldImagesOptions {
    /** Cumulative inline image base64 budget. Defaults to TRANSPORT_IMAGE_BUDGET_BYTES. */
    budgetBytes?: number;
    /** Newest image blocks always kept regardless of budget. They still consume it. Defaults to 1. */
    alwaysKeepNewest?: number;
    /** Keep at most this many images from turns completed by a later assistant response. */
    maxHistoricalImages?: number;
}
export interface TransportConvertOptions extends ElideOldImagesOptions {
    /** Replace every image when the images.blockImages setting is enabled. */
    blockImages: boolean;
}
/** Drop consecutive duplicates of a placeholder produced by adjacent image replacements. */
export declare function dedupeConsecutivePlaceholder(content: (TextContent | ImageContent)[], placeholder: string): (TextContent | ImageContent)[];
/**
 * Bound inline image payload at request-build time. The oldest images are
 * replaced by a text placeholder in the message that held them, so a dropped
 * image never moves to another turn.
 *
 * The cutoff moves in fixed steps rather than on every request (senpi#2768).
 * History only grows by appending, so each image's offset from the oldest one
 * never changes; images are dropped once they end below a threshold that only
 * rises when the total crosses the next half-budget step (likewise half the
 * historical-image limit). A request that just adds an image therefore sends
 * every earlier image exactly as before, and a provider cache or a sent-history
 * hash keyed on that history stays valid until the next step. Crossing a step drops up to
 * half the budget at once, so the request shrinks noticeably then grows back image by image.
 *
 * The newest protected blocks, the current turn (when a historical limit is
 * set) and the newest historical images under that limit are always kept. The
 * input and persisted session remain untouched. If every image fits, the
 * original array reference is returned.
 */
export declare function elideOldImages(messages: Message[], options?: ElideOldImagesOptions): Message[];
/** Convert messages for the main provider transport and apply its image policy. */
export declare function convertToLlmForTransport(messages: AgentMessage[], options: TransportConvertOptions): Message[];
//# sourceMappingURL=messages.d.ts.map