/** * useChat Hook - Layer 1 (Headless) * * Complete chat state management with zero UI. * Consumes AG-UI SSE by default. * * Supports two inference modes: * - cloud: server-side provider inference * - server-local: explicit local model on the server */ import { handleAgUiStreamingResponse } from "./streaming/index.js"; import type { ChatFilePart, ChatMessage, ChatMessagePart, UseChatOptions, UseChatResult } from "./types.js"; type UseChatStreamHandler = typeof handleAgUiStreamingResponse; /** A snapshot of messages from a branch point onward */ interface Branch { messages: ChatMessage[]; } /** Tracks branches keyed by the message ID where the edit occurred */ interface BranchState { branches: Branch[]; currentIndex: number; baseMessages: ChatMessage[]; } export declare function isLatestRequest(activeRequestId: number, requestId: number): boolean; export declare function resolveBranchKey(messageId: string, branchMap: Map, branchKeyByMessageId: Map): string | undefined; export declare function findBranchUserMessageIndex(messages: ChatMessage[], branchKey: string, branchKeyByMessageId: Map): number; /** * Build the parts for an outgoing user message. File attachments lead (before * the text) so the model sees the referenced files first — matching how AI-SDK * orders multimodal parts. Exported for unit testing. */ export declare function buildUserMessageParts(text: string, files?: ChatFilePart[]): ChatMessagePart[]; /** Extract the text and file payload from a user message for regenerate. */ export declare function userMessagePayload(message: ChatMessage): { text: string; files?: ChatFilePart[]; } | null; export declare function resolveUseChatStreamHandler(transport: UseChatOptions["transport"]): UseChatStreamHandler; interface ResettableUseChatResult extends UseChatResult { reset: (messages?: ChatMessage[]) => void; } /** * The core chat session hook: manages messages, streaming status, input, submit, * regenerate, and branch navigation for a conversation. Powers `` (L1) and * is the L3 headless entry point for building a fully custom chat UI. * * @example * ```tsx * import { useChat } from "veryfront/chat"; * * export default function AssistantChat() { * const chat = useChat(); * return ( *
* * *
* ); * } * ``` */ export declare function useChat(options?: UseChatOptions): UseChatResult; /** @internal Chat session with the reset capability used by conversation hosts. */ export declare function useChatWithSessionReset(options?: UseChatOptions): ResettableUseChatResult; export {}; //# sourceMappingURL=use-chat.d.ts.map