import { type ChatThreadOwnership, type ChatThreadListRow, type ChatThreadScope } from "./use-chat-threads.js"; export interface UseChatThreadListOptions { /** Which list this is. Narrowed on the server before paging. */ ownership: ChatThreadOwnership; /** Rows per page, an integer from 1 to 200. Defaults to 50. Anything else throws `ChatThreadListConfigError`. */ pageSize?: number; scope?: ChatThreadScope | null; includeExternal?: boolean; /** Include archived threads. Defaults to false. */ includeArchived?: boolean; includeHidden?: boolean; /** Search text. Empty lists the whole set. */ query?: string; /** When false nothing is fetched and the list is empty. Defaults to true. */ enabled?: boolean; /** Listen for thread update events and refresh loaded rows. Defaults to true. Does not affect initial or manual refreshes. */ refreshOnThreadUpdates?: boolean; apiUrl?: string; } export type ChatThreadListRefreshOutcome = "success" | "error" | "superseded" | "disabled"; export interface UseChatThreadListResult { threads: ChatThreadListRow[]; /** True until the first page of the current list settles. */ loading: boolean; loadingMore: boolean; /** The last request failed; `threads` keeps whatever was already loaded. */ error: Error | null; /** The server has rows past the ones loaded. */ hasMore: boolean; loadMore: () => Promise; refresh: () => Promise; /** Reports whether this invocation applied the complete refreshed window. */ refreshWithResult: () => Promise; hideThread: (id: string, hidden: boolean) => Promise; } /** `pageSize` is not an integer between 1 and the server's page cap. */ export declare class ChatThreadListConfigError extends Error { constructor(pageSize: unknown); } /** * One paginated chat history list (`mine`, `shared`, or `all`). Each list pages * independently, so a long Shared list never waits on My chats. It refetches * by default when a thread mutation in this tab calls `notifyChatThreadsUpdated`, * keeping every row already loaded, however many server pages that spans, * rather than collapsing to the first page. */ export declare function useChatThreadList(options: UseChatThreadListOptions): UseChatThreadListResult;