import { AIClientOptions, getAI } from '@happyvertical/ai'; import { ChatService } from '@happyvertical/smrt-chat'; import { ResolvedPrompt, resolvePrompt } from '@happyvertical/smrt-prompts'; import { DatabaseInterface } from '@happyvertical/sql'; export type ContentChatAIConfig = AIClientOptions & { apiKey?: string; allowedModels?: string[]; model?: string; defaultModel?: string; provider?: string; type?: string; }; export interface ContentChatCollectionLike { db: DatabaseInterface; get(filter: string | Record): Promise; } export interface ContentChatSessionInput { db: DatabaseInterface; contents?: ContentChatCollectionLike; tenantId?: string | null; profileId?: string | null; contentId: string; resolvePromptFn?: typeof resolvePrompt; } export interface CreateContentChatThreadInput extends ContentChatSessionInput { title: string; sessionId: string; model?: string | null; initializeChatCollections?: () => Promise; } export interface ListContentChatThreadMessagesInput { db: DatabaseInterface; contents?: ContentChatCollectionLike; tenantId?: string | null; profileId?: string | null; contentId: string; threadId: string; } export interface SendContentChatThreadMessageInput { contents: ContentChatCollectionLike; tenantId?: string | null; profileId?: string | null; contentId: string; threadId: string; content: string; sessionId: string; model?: string | null; currentEditorState?: unknown; referenceIds?: unknown; formFields?: Record | null; aiConfig?: ContentChatAIConfig | null; env?: Record; resolvePromptFn?: typeof resolvePrompt; getAIClient?: typeof getAI; resolveAI?: (input: ResolveContentChatAIInput) => Promise | ResolvedContentChatAI | null; } export interface ResolveContentChatAIInput { aiConfig: ContentChatAIConfig; env: Record; sessionContext: Record; requestedModel?: string | null; interactionPrompt: ResolvedPrompt; } export interface ResolvedContentChatAI { clientOptions: ContentChatAIConfig; model: string; provider?: string | null; profile?: string | null; temperature?: number | null; maxTokens?: number | null; } export declare function contentChatSessionMatchesContent(session: unknown, contentId: string): boolean; /** * Stable agent-session key scoping a content-editor session to its content * (S5 #1392). * * `createAgentSession` reuses ANY active session for the same * agent/profile/tenant unless a `sessionKey` is supplied. The content-editor * agent (`content_editor`) opens a distinct conversation per content, so a * keyless create would reuse — and the handler would then REWRITE — a session * created for a different content, returning the other content's room/threads. * Keying the session on the content id makes a new content always create a * distinct session/room. */ export declare function contentChatSessionKey(contentId: string): string; export declare function contentChatSessionIsAuthorized(session: unknown, input: { profileId: string; contentId: string; }): boolean; export declare function contentChatMessageToJSON(message: unknown): Record; export declare function serializeContentChatMessageForUI(message: unknown): Record; export declare function getOrCreateContentEditorChatSession(input: ContentChatSessionInput): Promise<{ chatService: ChatService; session: import('@happyvertical/smrt-chat').AgentSession; threads: unknown[]; }>; export declare function createContentEditorChatThread(input: CreateContentChatThreadInput): Promise<{ chatService: ChatService; session: import('@happyvertical/smrt-chat').AgentSession | null; thread: import('@happyvertical/smrt-chat').ChatThread; }>; export declare function listContentEditorChatThreadMessages(input: ListContentChatThreadMessagesInput): Promise<{ chatService: ChatService; thread: import('@happyvertical/smrt-chat').ChatThread; messages: import('@happyvertical/smrt-chat').ChatMessage[]; }>; export declare function resolveDefaultContentChatAI(input: ResolveContentChatAIInput): ResolvedContentChatAI; export declare function sendContentEditorChatThreadMessage(input: SendContentChatThreadMessageInput): Promise<{ chatService: ChatService; session: import('@happyvertical/smrt-chat').AgentSession | null; thread: import('@happyvertical/smrt-chat').ChatThread; userMessage: import('@happyvertical/smrt-chat').ChatMessage; agentMessage: import('packages/chat/dist').ChatMessage; }>; //# sourceMappingURL=content-chat-handlers.d.ts.map