/** * MemoryStack React Native SDK - Core Client * * A lightweight, offline-first client for React Native applications * with full API parity to the Node.js SDK. */ import { MemoryStackConfig, Message, CreateMemoryResponse, UpdateMemoryResponse, DeleteMemoryResponse, BatchDeleteResponse, ListMemoriesRequest, ListMemoriesResponse, Memory, SearchMemoriesResponse, ReflectionOptions, ReflectionResponse, ConsolidationOptions, ConsolidationResponse, UsageStats, GraphData, ListAgentMemoriesOptions, ListAgentMemoriesResponse, ExportOptions, ImportMemory, ImportResponse, OfflineQueueStatus } from './types'; interface OfflineStorage { getItem: (key: string) => Promise; setItem: (key: string, value: string) => Promise; removeItem: (key: string) => Promise; } interface NetworkStateProvider { isConnected: () => Promise; addEventListener?: (callback: (isConnected: boolean) => void) => () => void; } export declare class MemoryStackClient { private readonly apiKey; private readonly baseUrl; private readonly timeout; private readonly retryConfig; private readonly enableLogging; private readonly logger; private readonly enableOffline; private readonly storageKeyPrefix; private agentId?; private projectId?; private sessionId?; private agentName?; private agentType?; private storage; private networkProvider; private isOnline; private offlineQueue; private isProcessingQueue; constructor(config: MemoryStackConfig); /** * Set custom storage provider (e.g., AsyncStorage) * Call this before using offline features */ setStorage(storage: OfflineStorage): void; /** * Set custom network state provider (e.g., NetInfo) */ setNetworkProvider(provider: NetworkStateProvider): void; private request; private loadOfflineQueue; private saveOfflineQueue; private addToOfflineQueue; /** * Get pending offline operations */ getPendingOperations(): Promise; /** * Process all pending offline operations */ processPendingOperations(): Promise<{ processed: number; failed: number; remaining: number; }>; private executeQueueItem; /** * Clear all pending offline operations */ clearPendingOperations(): Promise; /** * Add a memory - the simplest way to store information * * @example * // Simple text * await client.add("User prefers dark mode"); * * // With user ID (for B2B apps) * await client.add("User prefers dark mode", { userId: "user_123" }); * * // Conversation format * await client.add([ * { role: "user", content: "I love TypeScript" }, * { role: "assistant", content: "Great choice!" } * ]); */ add(content: string | Message[], options?: { userId?: string; metadata?: Record; agentId?: string; teamId?: string; sessionId?: string; conversationId?: string; }): Promise; /** * @deprecated Use add() instead - simpler API */ createMemory(request: { messages: Message[]; user_id?: string; metadata?: Record; }): Promise; /** * Get a single memory by ID */ getMemory(memoryId: string): Promise; /** * Update an existing memory */ updateMemory(memoryId: string, updates: { content?: string; memory_type?: string; confidence?: number; metadata?: Record; }): Promise; /** * Delete a single memory */ deleteMemory(memoryId: string, hard?: boolean): Promise; /** * Delete multiple memories at once */ deleteMemories(memoryIds: string[], hard?: boolean): Promise; /** * List memories with optional filtering and pagination */ listMemories(request?: ListMemoriesRequest): Promise; /** * List memories with optional filtering * @deprecated Use listMemories() for more options */ list(options?: { userId?: string; limit?: number; }): Promise; /** * Search memories - find relevant information * * @example * // Simple search * const results = await client.search("user preferences"); * * // With user ID * const results = await client.search("user preferences", { userId: "user_123" }); * * // With limit * const results = await client.search("user preferences", { limit: 5 }); */ search(query: string, options?: { userId?: string; limit?: number; }): Promise; /** * @deprecated Use search() instead - simpler API */ searchMemories(options: { query: string; userId?: string; limit?: number; mode?: string; }): Promise; /** * List memories for the current agent */ listAgentMemories(options?: ListAgentMemoriesOptions): Promise; /** * Run reflection analysis on memories to generate insights */ reflectOnMemories(options?: ReflectionOptions): Promise; /** * Consolidate duplicate or similar memories */ consolidateMemories(options?: ConsolidationOptions): Promise; /** * Get usage statistics */ getStats(): Promise; /** * Get knowledge graph data */ getGraph(): Promise; /** * Export memories */ exportMemories(options?: ExportOptions): Promise; /** * Import memories */ importMemories(memories: ImportMemory[]): Promise; /** * Get current auto-maintenance configuration */ getAutoMaintenanceConfig(): Promise; /** * Update auto-maintenance configuration */ updateAutoMaintenanceConfig(config: { consolidation_enabled?: boolean; consolidation_frequency?: 'daily' | 'weekly' | 'monthly'; reflection_enabled?: boolean; reflection_frequency?: 'daily' | 'weekly' | 'monthly'; }): Promise; /** * Get current network status */ getNetworkStatus(): Promise; /** * Get the current agent ID (if initialized) */ getAgentId(): string | undefined; /** * Get the current project ID (if initialized) */ getProjectId(): string | undefined; } export { MemoryStackError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, ServerError, OfflineError, isMemoryStackError, isRetryableError, } from './errors'; //# sourceMappingURL=client.d.ts.map