import { type HTMLAttributes } from 'react'; import type { OptionsType } from '@diplodoc/transform/lib/typings'; import type { BaseMessageActionConfig, DefaultMessageAction, MessageExtraInfoComponent, TAssistantMessage, TChatMessage, TMessageContent, TMessageMetadata, TUserMessage } from "../../../types/messages.js"; import { type MessageRendererRegistry } from "../../../utils/messageTypeRegistry.js"; import type { MarkdownRendererMdxOptions } from "../../atoms/MarkdownRenderer/index.js"; /** * Shared configuration for a single rendered message. These props are expected to be * referentially stable across renders (memoized by the parent list), so that the memoized * `MessageItem` only re-renders when the `message` itself changes. */ export type MessageItemConfig = { messageRendererRegistry?: MessageRendererRegistry; transformOptions?: OptionsType; shouldParseIncompleteMarkdown?: boolean; openMarkdownLinksInNewTab?: boolean; mdxOptions?: MarkdownRendererMdxOptions; getMarkdownExtraProps?: (message: TChatMessage) => HTMLAttributes | undefined; getMdxContext?: (message: TChatMessage) => Record | undefined; showActionsOnHover?: boolean; showTimestamp?: boolean; showAvatar?: boolean; userActions?: DefaultMessageAction>[]; assistantActions?: DefaultMessageAction>[]; userExtraInfo?: MessageExtraInfoComponent>; assistantExtraInfo?: MessageExtraInfoComponent>; /** Stable popup handler from `usePopup`; bound to the concrete message internally. */ onActionPopup: (message: TChatMessage, action: BaseMessageActionConfig, anchor: HTMLElement) => void; }; export type MessageItemProps = MessageItemConfig & { message: TChatMessage; /** * Whether action buttons should be hidden for this message. Precomputed by the parent * (the last message while a response is still streaming/submitted) so that completed * messages keep a stable value and stay memoized. */ suppressActions: boolean; }; declare function MessageItemComponent({ message, suppressActions, messageRendererRegistry, transformOptions, shouldParseIncompleteMarkdown, openMarkdownLinksInNewTab, mdxOptions, getMarkdownExtraProps, getMdxContext, showActionsOnHover, showTimestamp, showAvatar, userActions, assistantActions, userExtraInfo: UserExtraInfo, assistantExtraInfo: AssistantExtraInfo, onActionPopup, }: MessageItemProps): import("react/jsx-runtime").JSX.Element | null; /** * Memoized single message renderer shared by the plain and virtualized message lists. * Re-renders only when `message`, `suppressActions`, or one of the (stable) config props changes, * so that during streaming only the message that actually changed is re-rendered. */ export declare const MessageItem: typeof MessageItemComponent; export {};