/** * LLM-generated session titles (webchat and any path using SessionStore). */ import type { AgentMessage } from '@earendil-works/pi-agent-core'; import type { SessionStore } from './store.js'; export declare function isWebchatSessionKey(sessionKey: string): boolean; /** Whether to run LLM/fallback session naming for this key (excludes cron, heartbeat). */ export declare function shouldAutoTitleSessionKey(sessionKey: string): boolean; export declare function sanitizeSessionTitle(raw: string): string; /** Strip leading reasoning blocks emitted as raw text by some model providers. */ export declare function sanitizeGeneratedSessionTitle(raw: string): string; export type SessionTitleSource = 'provisional' | 'llm' | 'user'; export declare function getSessionTitleSource(meta: { customData?: Record; } | null | undefined): SessionTitleSource | null; /** Title from a single user message (first line), for immediate sidebar labels. */ export declare function provisionalTitleFromUserText(raw: string): string | null; /** Non-LLM title: first line of first user text, else first assistant line. */ export declare function fallbackTitleFromMessages(messages: AgentMessage[]): string | null; /** * Returns a title string, or null if generation should be skipped or failed. */ export declare function generateSessionTitleFromMessages(modelRef: string, messages: AgentMessage[], signal?: AbortSignal): Promise; export type SessionTitleUpdatedHook = (sessionKey: string, name: string) => void | Promise; /** Whether post-turn LLM refine may run (provisional or still unnamed; not user-locked). */ export declare function shouldRefineSessionTitleWithLlm(meta: { name?: string; customData?: Record; } | null | undefined): boolean; /** * Set provisional title from first user text when session is still unnamed. * Skips cron/heartbeat keys and user-locked titles. */ export declare function maybeSetProvisionalSessionTitle(sessionStore: SessionStore, sessionKey: string, userText?: string, onUpdated?: SessionTitleUpdatedHook): Promise; /** * LLM refine when title is empty or still provisional (not user-locked). */ export declare function maybeRefineSessionTitleWithLlm(sessionStore: SessionStore, sessionKey: string, modelRef: string | undefined, onUpdated?: SessionTitleUpdatedHook): Promise;