import { type ComponentType, type MouseEventHandler, type ReactNode } from 'react'; import type { Components } from 'streamdown'; import { type ChatStrings } from '../strings.js'; import type { ApprovalAnswerValue, ApprovalPart, ChatLinkTarget, ChatMessage, CspKind, MessagePart, MessagePartKind, ToolCallPart, ToolPresentation } from '../types.js'; /** Takes the reader's answer to an approval. Where it returns a promise, the approval shows the * answer as on its way, with its controls off, until the promise settles; anything else it * returns is ignored. */ export type ApprovalAnswerHandler = (id: string, answer: ApprovalAnswerValue) => unknown; export interface PartRendererProps { part: MessagePart; message: ChatMessage; isStreaming?: boolean; onApprovalAnswer?: ApprovalAnswerHandler; } export interface ToolRendererProps { part: ToolCallPart; approval?: ApprovalPart; message: ChatMessage; isStreaming?: boolean; /** Absent when the reader may not answer, such as a call someone else asked for. */ onApprovalAnswer?: ApprovalAnswerHandler; } export interface ToolFooterProps { part: ToolCallPart; message: ChatMessage; } export interface ChatLinkProps { target: ChatLinkTarget; className?: string; title?: string; onClick?: MouseEventHandler; children: ReactNode; } export interface ChatUIConfig { LinkComponent?: ComponentType; extraLinks?: { connectTools?: string; manageProviders?: string; addProvider?: string; providerSettings?: (owner: string, name: string) => string; }; slots?: { composerUsage?: ReactNode; providerIcon?: (cspKind: CspKind, className?: string) => ReactNode; partRenderers?: Partial>>; toolRenderers?: Record>; toolFooters?: Record>; toolPresentation?: (part: ToolCallPart, message?: ChatMessage) => ToolPresentation | undefined; }; strings?: { [S in keyof ChatStrings]?: Partial; }; markdownComponents?: Components; suggestedPrompts?: string[]; } export interface ResolvedChatConfig { LinkComponent: ComponentType; extraLinks: NonNullable; slots: NonNullable; strings: ChatStrings; markdownComponents?: Components; suggestedPrompts?: string[]; } export declare function resolveChatConfig(config?: ChatUIConfig): ResolvedChatConfig; export declare const ChatConfigProvider: import("react").Provider; export declare function useChatConfig(): ResolvedChatConfig;