import { Dispatch, SetStateAction } from 'react'; import { ChatMessage } from '../../src/elements/chat-types'; import { AttachmentData } from '../../src/components/attachment-types'; import { AssistantStream } from '../../src/state'; export type { ChatMessage } from '../../src/elements/chat-types'; export interface UseKaiChatOptions { /** Seed messages, read once at mount and copied. Later changes are ignored — drive updates through the returned ops. */ initialMessages?: ChatMessage[]; /** Seed suggestions, read once at mount and copied. Later changes are ignored. */ initialSuggestions?: string[]; onSubmit?: (detail: { value: string; attachments: AttachmentData[]; }) => void | Promise; } /** Owns chat state in React and exposes ergonomic, fully-typed controlled operations. */ export interface KaiChatController { messages: ChatMessage[]; setMessages: Dispatch>; suggestions: string[]; setSuggestions: Dispatch>; loading: boolean; append: (msg: ChatMessage) => void; update: (id: string, patch: Partial | ((m: ChatMessage) => ChatMessage)) => void; remove: (id: string) => void; addSuggestion: (s: string) => void; removeSuggestion: (s: string) => void; clearSuggestions: () => void; streamAssistant: (init?: Partial) => AssistantStream; /** Spread onto `` — wires messages, loading, suggestions, and kai-submit. */ bind: { messages: ChatMessage[]; loading: boolean; suggestions: string[]; onSubmit: (event: CustomEvent<{ value: string; attachments: AttachmentData[]; }>) => void; }; } export declare function useKaiChat(options?: UseKaiChatOptions): KaiChatController;