/** * useScrollPreservation — manage the message list's scroll behaviour: * * 1. Auto-scroll to bottom when: * - The user was already near the bottom AND a new message arrived * - The user just sent a message (trailing `user` row appears) * - An AI/agent bubble is streaming (content length grows) * - The conversation first mounts * 2. Preserve scroll position when the user has scrolled up (reading history) * and new agent/AI messages arrive — instead, surface the * "↓ N new messages" pill. * 3. Detect when the user manually scrolls back to the bottom and reset the * "scrolled up" flag + clear the pill counter. */ import type { RefObject } from "preact"; import type { ChatMessage } from "../../../../utils/globals"; import type { ChatStore } from "../../store/chat-store"; interface UseScrollPreservationArgs { store: ChatStore; scrollRef: RefObject; messages: ChatMessage[]; /** * Whether the trailing typing bubble is currently rendered. When it * flips from `false` → `true` the bubble grows the list by ~one * message-height; if the user was at the bottom we snap them to keep * the dots in view, matching the behaviour for newly-arrived * messages. */ typingActive?: boolean; } export declare function useScrollPreservation({ store, scrollRef, messages, typingActive, }: UseScrollPreservationArgs): { jumpToBottom: () => void; }; export {};