export * from './schemas'; export interface SendMessageParams { userId: string; conversationId?: string; content: string; role: 'user' | 'assistant'; title?: string; metadata?: Record; } export interface SendMessageResponse { conversationId: string; messageId: string; sequence: number; created: boolean; title: string; timestamp: string; metadata?: Record; } export interface GetConversationParams { userId: string; conversationId: string; } export interface ConversationMetadata { conversationId: string; userId: string; title: string; messageCount: number; createdAt: string; updatedAt: string; lastMessage: string | null; metadata?: Record; } export interface GetHistoryParams { userId: string; conversationId: string; limit?: number; cursor?: string; } export interface Message { messageId: string; conversationId: string; content: string; role: 'user' | 'assistant'; sequence: number; timestamp: string; metadata?: Record; } export interface GetHistoryResponse { conversationId: string; messages: Message[]; hasMore: boolean; nextCursor?: string; } export interface ListConversationsParams { userId: string; pageSize?: number; cursor?: string; } export interface ConversationSummary { conversationId: string; title: string; messageCount: number; createdAt: string; updatedAt: string; metadata?: Record; } export interface ListConversationsResponse { conversations: ConversationSummary[]; totalCount: number; hasMore: boolean; nextCursor?: string; } /** * Conversation MCP Client v2.1.1 * * Unified API with auto-creation pattern: * - No sessionId required * - sendMessage() auto-creates conversation on first message * - Client stores conversationId returned from first sendMessage() * * Usage Pattern: * ```typescript * const client = new ConversationMCPClient('http://localhost:8080'); * * // First message - auto-creates conversation * const result1 = await client.sendMessage({ * userId: 'user123', * content: 'Hello!', * role: 'user', * title: 'My Chat' // optional * }); * const conversationId = result1.conversationId; * console.log('Created:', result1.created); // true * * // Subsequent messages - use conversationId * const result2 = await client.sendMessage({ * userId: 'user123', * conversationId, * content: 'How are you?', * role: 'assistant' * }); * console.log('Created:', result2.created); // false * ``` */ export declare class ConversationMCPClient { private readonly serverUrl; private requestId; constructor(serverUrl: string); /** * Send a message with auto-creation. * * If conversationId is omitted, automatically creates a new conversation. * If conversationId is provided, adds message to existing conversation. * * ⚠️ CRITICAL: Messages must be sent SEQUENTIALLY (await each call before the next). * * ✅ CORRECT: * const r1 = await client.sendMessage(msg1); * const r2 = await client.sendMessage(msg2); * * ❌ WRONG: (race condition!) * await Promise.all([ * client.sendMessage(msg1), * client.sendMessage(msg2) * ]); */ sendMessage(params: SendMessageParams): Promise; /** * Get conversation metadata (does not include messages). * * Use getHistory() to retrieve messages. */ getConversation(params: GetConversationParams): Promise; /** * Get conversation message history with pagination. * * Returns messages in chronological order (oldest first). * Use cursor from response to fetch next page. */ getHistory(params: GetHistoryParams): Promise; /** * List all conversations for a user with pagination. * * Returns conversations sorted by updatedAt DESC (most recent first). * Use cursor from response to fetch next page. */ listConversations(params: ListConversationsParams): Promise; /** * Low-level JSON-RPC call. * * @throws {Error} Network errors, non-200 status, or JSON-RPC errors */ private callTool; private processToolResult; private validateToolResponse; private validateSendMessageResponse; private validateConversationMetadataResponse; private validateGetHistoryResponse; private validateListConversationsResponse; private formatToolError; } //# sourceMappingURL=index.d.ts.map