import type { ReactNode } from "react"; import type { GeistdocsAISuggestionInput } from "../../config.js"; export declare const DEFAULT_CHAT_ENDPOINT = "/api/chat"; export declare const DEFAULT_CHAT_TITLE = "Ask AI"; export declare const DEFAULT_CHAT_HISTORY_RETENTION_DAYS = 30; export declare const MAX_CHAT_SUGGESTIONS = 4; /** * Package routes with fixed paths that the site OpenAPI document describes. * Neither the chat route nor the document itself may live at one of them. */ export declare const RESERVED_SITE_PATHS: readonly string[]; /** * Resolve `ai.endpoint` to the app-local chat route path. Invalid values * throw: a chat client pointed at the wrong origin, a malformed path, or a * path another package route already serves cannot work, and the OpenAPI * document would describe a route that does not exist. */ export declare const resolveChatEndpoint: (endpoint: string | undefined) => string; /** Resolve `ai.title`, falling back to "Ask AI" when unset or blank. */ export declare const resolveChatTitle: (title: string | undefined) => string; export interface ChatSuggestion { icon?: ReactNode; /** Stable React key, unique within the returned list. */ key: string; text: string; } /** * Normalize `ai.suggestions` into at most four renderable suggestions. * Blank entries are dropped and repeated texts keep their first occurrence, * so the text doubles as a unique, stable key. */ export declare const normalizeChatSuggestions: (suggestions: readonly GeistdocsAISuggestionInput[] | undefined) => ChatSuggestion[]; /** * Resolve `ai.history.retentionDays` to milliseconds. * * - `undefined`, negative, `NaN`, and `-Infinity` use the 30-day default. * - `0` keeps no history: stored conversations are cleared on load and new * messages are not saved. * - `Infinity` never expires stored conversations. * - Fractional days are allowed (`0.5` is 12 hours). */ export declare const resolveChatHistoryRetentionMs: (retentionDays: number | undefined) => number; export declare const isValidChatHistoryRetentionDays: (retentionDays: number | undefined) => boolean; interface TimestampedRow { timestamp?: unknown; } /** * The most recent activity in a stored conversation, or `undefined` when no * row carries a usable timestamp. */ export declare const getChatLastActivityAt: (rows: readonly TimestampedRow[]) => number | undefined; /** * Whether a stored conversation should be cleared. A conversation survives * while its most recent message is younger than the retention window; at * exactly the boundary it expires. An empty store never expires, and a store * whose rows carry no usable timestamp is treated as expired. */ export declare const isChatHistoryExpired: ({ now, retentionMs, rows, }: { now: number; retentionMs: number; rows: readonly TimestampedRow[]; }) => boolean; /** * Turn the stored rows of a conversation, in `sequence` order, into the * messages to restore. An expired conversation restores nothing and reports * `expired` so the caller clears the store. */ export declare const restoreStoredChat: ({ now, retentionMs, rows, }: { now: number; retentionMs: number; rows: readonly T[]; }) => { expired: boolean; messages: Omit[]; }; /** * Build the rows to store for a conversation. Messages already stored keep * their original timestamp, so saving (which happens on every load as well as * after each message) never refreshes the age of old messages; messages seen * for the first time are stamped with `now`. */ export declare const stampChatMessages: (messages: readonly T[], storedRows: readonly ({ id: string; } & TimestampedRow)[], now: number) => (T & { sequence: number; timestamp: number; })[]; export {}; //# sourceMappingURL=options.d.ts.map