import { ChatMessage } from '../types/chat.types';
/**
 * Merge an incoming assistant output (either an incremental text fragment or a full
 * Message object) into an immutable array of existing chat messages.
 *
 * Streaming scenario:
 * - When `incoming` is a string (partial chunk) and the last message belongs to the assistant,
 *   the chunk is appended to that last assistant message's `content`.
 * - When `incoming` is a string and the last message is not from the assistant (or no messages exist),
 *   a new assistant message is created with a freshly generated `id`.
 *
 * Full message scenario:
 * - When `incoming` is a complete `Message` and the last message is from the assistant,
 *   the last assistant message is replaced entirely (e.g., final consolidated content).
 * - Otherwise, the full `incoming` message is appended.
 *
 * Immutability:
 * - The original `prev` array is never mutated; a new array reference is always returned.
 *
 * @param prev Existing ordered list of chat messages.
 * @param incoming Either:
 *   - A string representing an incremental content fragment from the assistant (stream chunk), or
 *   - A full `Message` representing a (possibly already aggregated) assistant message.
 *
 * @returns A new messages array with the incoming content appropriately merged.

 * Complexity: O(n) due to shallow copying via slicing; suitable for typical chat histories.
 */
export declare function mergeIncomingIntoMessages(prev: ChatMessage[], incoming: ChatMessage | string): ChatMessage[];
//# sourceMappingURL=merge-incoming-message.d.ts.map