/** * Chatbot Conversation Store * * Tracks multi-turn conversation history per phone number for the HTTP chatbot client. * Only used in standalone mode (plugin mode uses chatter's own conversation handling). * * Module-level singleton, single-process only - see docs/ARCHITECTURE.md's * "Single-process state caveat". `sweepConversations` gives it the same TTL * sweep as `src/core/context.ts` and `src/routes/call/pending.ts`; plugin and * standalone mode call it from the shared cleanup tick (see `src/core/mount.ts`) * with `contextTtlMs`, so an idle conversation doesn't outlive its context. * `conversationId` is minted locally (`crypto.randomUUID()`) purely for * log/DB correlation - it is never sent to the remote chatbot API and does * not change across calls from the same number, so read * `talker_sessions.conversation_id` as "which in-process chatbot * conversation produced this row," not as a per-call identifier. */ import type { ChatConversation } from "./types"; export declare function getOrCreateConversation(phoneNumber: string, systemMessage?: string): ChatConversation; export declare function addUserMessage(phoneNumber: string, content: string, systemMessage?: string): void; export declare function addBotMessage(phoneNumber: string, content: string, systemMessage?: string): void; export declare function getConversation(phoneNumber: string): ChatConversation | undefined; export declare function clearConversation(phoneNumber: string): void; export declare function clearAllConversations(): void; /** * Delete conversations idle for longer than `ttlMs`. Without this a caller * who never triggers `clearConversation` - nothing in src/routes/ calls it - * would leak an entry for the process lifetime. */ export declare function sweepConversations(ttlMs: number): void;