export interface ConversationMessage { id: string; userId?: string; text: string; isAssistant: boolean; timestamp: number; metadata?: Record; } export type Platform = 'cli' | 'web' | 'api' | 'mcp' | `channel/${string}`; export interface ConversationThread { threadId: string; platform: Platform; messages: ConversationMessage[]; metadata?: { title?: string; firstMessage?: string; lastMessage?: string; messageCount?: number; updatedAt?: number; }; } export interface TemplateMessage { text: string; isAssistant: boolean; timestamp?: number; metadata?: Record; files?: Array<{ name: string; size?: number; localPath?: string; }>; } export interface FetchHistoryOptions { limit?: number; maxContextLength?: number; currentTraceId?: string; } export interface IConversationHistoryProvider { ensureThread(threadId: string, platform: Platform, workspaceId?: string): Promise<{ created: boolean; }>; fetchHistory(threadId: string, options?: FetchHistoryOptions): Promise; saveUserMessage(threadId: string, text: string, userId?: string, metadata?: Record): Promise<{ id: string; firstMessage: boolean; }>; saveAssistantMessage(threadId: string, text: string, agentId: string, metadata?: Record): Promise<{ id: string; }>; close?(): void; }