import type { AparteMessage, AparteSegment } from '../types.js'; import type { AparteChatImperativeApi } from '@aparte/core'; /** * Idiomatic React ergonomics for ``. Owns the `messages` state and * the component ref so the consumer doesn't have to wire `onMessagesChange` * back into `messages` by hand. Spread `ref` + `messages` + `onMessagesChange` * onto `` and drive it with the returned imperative helpers. * * @example * const chat = useAparteChat(); * return ( * * ); * // The user's message is appended automatically on send — don't re-add it. */ export interface UseAparteChat { messages: AparteMessage[]; setMessages: React.Dispatch>; ref: React.RefObject; appendMessage: (message: AparteMessage, options?: { historical?: boolean; }) => void; updateMessage: (messageId: string, updates: Partial) => void; updateLastMessage: (content: string, options?: { append?: boolean; }) => void; addSegment: (segment: AparteSegment) => void; updateSegment: (segmentId: string, updates: Partial) => void; removeSegment: (segmentId: string) => void; appendToSegment: (segmentId: string, content: string) => void; /** * The host's list — the authority, and mid-stream a frame ahead of the * `messages` state, which is synced once per paint rather than per token. */ getMessages: () => AparteMessage[]; clearMessages: (options?: { revokeAttachments?: boolean; }) => void; addBranch: (messageId: string) => number; addSiblingOf: (existingId: string, message: AparteMessage) => string | null; truncateFrom: (messageId: string) => void; truncateResponsesAfter: (userMessageId: string) => void; injectTokenStream: (messageId: string, tokens: AsyncIterable) => Promise; stopTokenStream: () => void; setConversationId: (id: string | null) => Promise; isStreaming: () => boolean; scrollToBottom: () => void; focusInput: () => void; /** The `` element — same accessor on all four wrappers. */ getViewport: () => HTMLElement | null; } export declare function useAparteChat(initial?: AparteMessage[]): UseAparteChat; //# sourceMappingURL=useAparteChat.d.ts.map