UNPKG

@claytondcruze/chat-sdk

Version:

TypeScript SDK for AgentStable Chat System with CRUD operations and AI streaming

176 lines 5.76 kB
import { SDKConfig, Chat, Message, CreateChatRequest, UpdateChatRequest, CreateMessageRequest, ChatListResponse, MessageListResponse, StreamingChatRequest, StreamingResponse, ClassificationMetadata, FileSystem, Folder, File, CreateFileSystemRequest, UpdateFileSystemRequest, CreateFolderRequest, UpdateFolderRequest, CreateFileRequest, UpdateFileRequest, AIFilesystemPipelineRequest, AIFilesystemPipelineResponse } from "./types"; export declare class ChatSDK { private config; constructor(config: SDKConfig); private getHeaders; private fetchAPI; /** * Create a new chat */ createChat(data: CreateChatRequest): Promise<Chat>; /** * Get a specific chat by ID */ getChat(chatId: string): Promise<Chat>; /** * List chats with pagination */ listChats(limit?: number, cursor?: string): Promise<ChatListResponse>; /** * Update a chat */ updateChat(chatId: string, updates: UpdateChatRequest): Promise<Chat>; /** * Delete a chat */ deleteChat(chatId: string): Promise<void>; /** * Create a new message */ createMessage(data: CreateMessageRequest): Promise<Message>; /** * Get messages for a chat with pagination */ getMessages(chatId: string, limit?: number, cursor?: string): Promise<MessageListResponse>; /** * Delete a message */ deleteMessage(messageId: string): Promise<void>; /** * Send a message and get streaming AI response */ streamChat(data: StreamingChatRequest): Promise<StreamingResponse>; /** * Helper method to consume a streaming response as a string */ streamToString(streamResponse: StreamingResponse): Promise<string>; /** * Helper method to get full chat conversation (all messages) */ getChatHistory(chatId: string): Promise<Message[]>; /** * Helper method for simple chat completion (create message + get AI response) */ sendMessage(chatId: string, message: string, options?: { model?: string; includeHistory?: boolean; maxHistoryMessages?: number; }): Promise<string>; /** * Get classification data from a message */ getMessageClassification(message: Message): ClassificationMetadata | null; /** * Check if a message was classified as complex */ isComplexMessage(message: Message): boolean; /** * Get topics identified in a message */ getMessageTopics(message: Message): string[]; /** * Get classification statistics for a chat */ getChatClassificationStats(chatId: string): Promise<{ totalMessages: number; simpleMessages: number; complexMessages: number; averageConfidence: number; topTopics: Array<{ topic: string; count: number; }>; }>; /** * Filter messages by complexity */ filterMessagesByComplexity(messages: Message[], complexity: "SIMPLE" | "COMPLEX"): Message[]; /** * Search messages by topics */ searchMessagesByTopics(messages: Message[], topics: string[]): Message[]; /** * Create a new filesystem */ createFileSystem(data: CreateFileSystemRequest): Promise<FileSystem>; /** * Get a specific filesystem by ID */ getFileSystem(filesystemId: string): Promise<FileSystem>; /** * List all filesystems for the user */ listFileSystems(): Promise<FileSystem[]>; /** * Update a filesystem */ updateFileSystem(filesystemId: string, updates: UpdateFileSystemRequest): Promise<FileSystem>; /** * Delete a filesystem */ deleteFileSystem(filesystemId: string): Promise<void>; /** * Create a new folder */ createFolder(data: CreateFolderRequest): Promise<Folder>; /** * Get a specific folder by ID */ getFolder(filesystemId: string, folderId: string): Promise<Folder>; /** * List folders in a filesystem */ listFolders(filesystemId: string): Promise<Folder[]>; /** * Update a folder */ updateFolder(filesystemId: string, folderId: string, updates: UpdateFolderRequest): Promise<Folder>; /** * Delete a folder */ deleteFolder(filesystemId: string, folderId: string): Promise<void>; /** * Create a new file */ createFile(data: CreateFileRequest): Promise<File>; /** * Get a specific file by ID */ getFile(filesystemId: string, folderId: string, fileId: string): Promise<File>; /** * List files in a folder */ listFiles(filesystemId: string, folderId: string): Promise<File[]>; /** * Update a file */ updateFile(filesystemId: string, folderId: string, fileId: string, updates: UpdateFileRequest): Promise<File>; /** * Delete a file */ deleteFile(filesystemId: string, folderId: string, fileId: string): Promise<void>; /** * Use AI to analyze user intent and create intelligent filesystem structures */ aiFilesystemPipeline(data: AIFilesystemPipelineRequest): Promise<AIFilesystemPipelineResponse>; /** * Get user's filesystem context for AI analysis */ getFilesystemContext(): Promise<any>; /** * Helper method to create a complete filesystem structure from AI pipeline results */ createFilesystemFromPipeline(pipelineResult: AIFilesystemPipelineResponse): Promise<{ filesystem: FileSystem; folders: Folder[]; files: File[]; }>; /** * Search for files and folders by tags */ searchByTags(filesystemId: string, tags: string[]): Promise<{ folders: Folder[]; files: File[]; }>; } //# sourceMappingURL=client.d.ts.map