import { type ReactNode, type Ref } from 'react'; import { type ApprovalAnswerHandler } from '../core/config.js'; import type { TextIndex } from '../core/textIndex.js'; import type { ChatMessage as Message } from '../types.js'; export type QueueDelivery = 'afterReply' | 'nextStep'; interface ChatMessageListProps { messages: Message[]; allMessages: Message[]; /** The reply being written. Left unset, the list shows the chat provider's * own stream; a host that streams elsewhere passes its reply, or null. */ streamingMessage?: Message | null; queuedMessages?: Message[]; onRemoveQueued?: (id: string) => void; /** Which queued messages can still be taken back; all of them when unset. * One that cannot has been handed to the running turn. */ canRemoveQueued?: (id: string) => boolean; /** Puts every queued message that can still be taken back into the * composer, as ↑ there does. Set, the queue shows its status once under * the last message of each run that reads alike, and Edit on the last * line, in place of a line and Remove under each message. */ onEditQueued?: (() => void) | undefined; /** When a queued message reaches the model: once the running reply * finishes (the chat provider's queue), or between the agent's steps for a * host that steers the turn in progress. A host with both kinds says which * each message is. */ queueDelivery?: QueueDelivery | ((messageId: string) => QueueDelivery); editingMessageId?: string | null | undefined; showAuthor?: boolean; currentUsername?: string; onNavigateBranch?: (messageId: string) => void; onEditMessage?: ((messageId: string) => void) | undefined; onSaveEdit?: (messageId: string, content: string) => void; onCancelEdit?: () => void; onRegenerateMessage?: ((messageId: string) => void) | undefined; onRetryMessage?: ((messageId: string) => void) | undefined; onOpenReasoning?: (reasoning: string, duration: number | null) => void; onApprovalAnswer?: ApprovalAnswerHandler; inputElement?: ReactNode; /** Whether a turn is in flight, when the host tracks that itself rather * than streaming through the provider. */ isStreaming?: boolean; /** Rows without their own side padding, for a host that pads the column. */ flush?: boolean; /** Draws the transcript as a terminal does: every run of tool calls folds * from its first call, failures and running calls included, and a thought * shows whole while it streams. */ foldEveryRun?: boolean; /** Names the list, a live log, for assistive technology. Defaults to the * chat strings' `thread.label`. */ label?: string; /** Rendered after the last message, inside the scrolling column. */ footer?: ReactNode; /** Off for a host that shows the turn's activity elsewhere, so the wait * for the first frame is not announced twice. */ workingIndicator?: boolean; /** Pins the prompt of the turn in view to the top once it scrolls out of * sight, as a terminal transcript does; a click returns to it. */ pinPrompt?: boolean; /** Draws every message at once, for a host that needs all of them on the * page. Otherwise a long conversation draws its end, then the turns near the * view as the reader scrolls, letting go of those it left far behind. */ whole?: boolean; /** Keeps the text a reader sees in each message the list doesn't draw, for * a search of the whole conversation that doesn't draw it all. */ textIndex?: TextIndex | undefined; /** Reads the messages it doesn't draw into textIndex, a few at a time. */ indexing?: boolean | undefined; ref?: Ref | undefined; } export interface ChatMessageListHandle { /** Returns to the newest content and follows it again. */ jumpToLatest: () => void; /** Draws the turn a message is in and brings the message into view; * resolves once it is drawn. */ reveal: (messageId: string) => Promise; } export default function ChatMessageList({ messages, allMessages, streamingMessage: streamingMessageProp, queuedMessages, onRemoveQueued, canRemoveQueued, onEditQueued, queueDelivery, editingMessageId, showAuthor, currentUsername, onNavigateBranch, onEditMessage, onSaveEdit, onCancelEdit, onRegenerateMessage, onRetryMessage, onOpenReasoning, onApprovalAnswer, inputElement, isStreaming: isStreamingProp, flush, foldEveryRun, label, footer, workingIndicator, pinPrompt, whole, textIndex, indexing, ref, }: ChatMessageListProps): import("react").JSX.Element; export {};