import type { Message, Usage } from "../types/index.js";
import { MessageSource } from "../types/index.js";
import { ChatCompletionMessageFunctionToolCall } from "openai/resources.js";
export interface UserMessageParams {
    content: string;
    customCommandContent?: string;
    images?: Array<{
        path: string;
        mimeType: string;
    }>;
    source?: MessageSource;
    isMeta?: boolean;
}
export interface AddUserMessageParams extends UserMessageParams {
    messages: Message[];
    id?: string;
}
export interface UpdateToolBlockParams {
    messages: Message[];
    id: string;
    messageId?: string;
    parameters?: string;
    result?: string;
    success?: boolean;
    error?: string;
    /**
     * Tool execution stage:
     * - 'start': Tool call initiated during AI streaming
     * - 'streaming': Tool parameters being received incrementally
     * - 'running': Tool execution in progress
     * - 'end': Tool execution completed with final result
     */
    stage?: "start" | "streaming" | "running" | "end";
    name?: string;
    shortResult?: string;
    startLineNumber?: number;
    images?: Array<{
        data: string;
        mediaType?: string;
    }>;
    compactParams?: string;
    parametersChunk?: string;
    isManuallyBackgrounded?: boolean;
}
export type AgentToolBlockUpdateParams = Omit<UpdateToolBlockParams, "messages">;
export interface AddErrorBlockParams {
    messages: Message[];
    error: string;
}
export interface AddBangParams {
    messages: Message[];
    command: string;
}
export interface UpdateBangParams {
    messages: Message[];
    command: string;
    output: string;
}
export interface CompleteBangParams {
    messages: Message[];
    command: string;
    exitCode: number;
    output?: string;
}
/**
 * Convert image file path to base64 format
 * @param imagePath Image file path
 * @returns base64 format image data URL
 */
export declare const convertImageToBase64: (imagePath: string) => string;
export declare const generateMessageId: () => string;
export declare const addUserMessageToMessages: ({ messages, content, customCommandContent, images, source, id, isMeta, }: AddUserMessageParams) => Message[];
/**
 * Update a user message's content by its ID.
 */
export declare const updateUserMessageInMessages: (messages: Message[], id: string, params: Partial<UserMessageParams>) => Message[];
export declare const addAssistantMessageToMessages: (messages: Message[], content?: string, toolCalls?: ChatCompletionMessageFunctionToolCall[], usage?: Usage, additionalFields?: Record<string, unknown>) => Message[];
/**
 * Add a tool block to a specific message by ID.
 */
export declare const addToolBlockToMessageInMessages: (messages: Message[], messageId: string, params: Omit<AgentToolBlockUpdateParams, "id">) => {
    messages: Message[];
    toolBlockId: string;
};
export declare const updateToolBlockInMessage: ({ messages, id, messageId, parameters, result, success, error, stage, name, shortResult, startLineNumber, images, compactParams, parametersChunk, isManuallyBackgrounded, }: UpdateToolBlockParams) => Message[];
export declare const addErrorBlockToMessage: ({ messages, error, }: AddErrorBlockParams) => Message[];
export declare const addBangMessage: ({ messages, command, }: AddBangParams) => Message[];
export declare const updateBangInMessage: ({ messages, command, output, }: UpdateBangParams) => Message[];
export declare const completeBangInMessage: ({ messages, command, exitCode, output, }: CompleteBangParams) => Message[];
/**
 * Helper to count tool blocks in messages
 */
export declare function countToolBlocks(messages: Message[]): number;
/**
 * Remove the last user message from the conversation
 * Used for hook error handling when the user prompt needs to be erased
 */
export declare const removeLastUserMessage: (messages: Message[]) => Message[];
/**
 * Efficiently clone a message for UI freezing.
 * Clones the message object and its blocks array, but reuses string references.
 */
export declare function cloneMessage(message: Message): Message;
/**
 * Helper to format tool and token summary
 */
export declare function formatToolTokenSummary(toolCount: number, tokens: number): string;
/**
 * Extracts displayable text from a Message object, handling various block types.
 * Returns the first available content block.
 */
export declare function getMessageContent(message: Message): string;
export interface AddNotificationMessageParams {
    messages: Message[];
    taskId: string;
    taskType: "shell" | "agent";
    status: "completed" | "failed" | "killed";
    summary: string;
    outputFile?: string;
}
export declare const addNotificationMessageToMessages: ({ messages, taskId, taskType, status, summary, outputFile, }: AddNotificationMessageParams) => Message[];
//# sourceMappingURL=messageOperations.d.ts.map