UNPKG

memq-ai-memory

Version:

Memory SDK with Vercel AI SDK integration

111 lines 3.51 kB
import { SDKConfig, Memory, MemoryResponse, WorkflowMemory, Fact, PromptStructure, SmartMemoryResponse, UserFactsResponse, UserPromptStructuresResponse, MemoryCreateRequest, MemorySearchRequest, APIKeyInfo, CreateAPIKeyRequest, CreateAPIKeyResponse, SuccessResponse } from '../types'; export declare class MemoryClient { private config; private client; private sessionId; private derivedUserId; private actualUserId?; constructor(config: SDKConfig); /** * Validate the API key by making a test request */ validateApiKey(): Promise<boolean>; /** * Create a new memory (automatically uses derived user_id) */ createMemory(memory: MemoryCreateRequest): Promise<SuccessResponse>; /** * Get all memories (automatically uses derived user_id) */ getAllMemories(userId?: string, limit?: number): Promise<MemoryResponse[]>; /** * Search memories (automatically uses derived user_id) */ searchMemories(request: MemorySearchRequest): Promise<SmartMemoryResponse>; /** * Get workflow memories for a user */ getWorkflowMemories(userId: string, limit?: number): Promise<WorkflowMemory[]>; /** * Get user facts (automatically uses derived user_id if not provided) */ getUserFacts(userId?: string, category?: string, limit?: number): Promise<UserFactsResponse>; /** * Get user prompt structures (automatically uses derived user_id if not provided) */ getUserPromptStructures(userId?: string, isComplete?: boolean, limit?: number): Promise<UserPromptStructuresResponse>; /** * Delete a memory */ deleteMemory(memoryId: string): Promise<SuccessResponse>; /** * Get collection statistics */ getStats(): Promise<{ success: boolean; data: any; timestamp: string; }>; /** * Health check */ healthCheck(): Promise<{ status: string; timestamp: string; version: string; }>; /** * Get recent activity for a user (automatically uses derived user_id if not provided) */ getRecentActivity(userId?: string, limit?: number): Promise<{ memories: Memory[]; facts: Fact[]; prompt_structures: PromptStructure[]; }>; /** * Create a new API key */ createApiKey(request: CreateAPIKeyRequest): Promise<CreateAPIKeyResponse>; /** * Get user's API keys */ getApiKeys(): Promise<APIKeyInfo[]>; /** * Revoke an API key */ revokeApiKey(keyId: string): Promise<SuccessResponse>; /** * Update API key details */ updateApiKey(keyId: string, updates: Partial<CreateAPIKeyRequest>): Promise<APIKeyInfo>; /** * Get the current session ID */ getSessionId(): string; /** * Set a new session ID */ setSessionId(sessionId: string): void; /** * Get derived user_id */ getDerivedUserId(): string; /** * Get actual user_id resolved from API key, if available */ getActualUserId(): string | undefined; /** * Initialize actual user_id by validating API key against backend * Uses /api-keys/test/protected which returns user_id when x-api-key is valid */ initializeUserFromApiKey(): Promise<void>; /** * Handle API errors */ private handleError; /** * Retry a request with exponential backoff */ private retryRequest; } //# sourceMappingURL=MemoryClient.d.ts.map