/** * MemoryStack React Native SDK Types * Full TypeScript support for React Native applications */ export interface MemoryStackConfig { /** Your MemoryStack API key */ apiKey: string; /** Base URL for the API (default: https://www.memorystack.app) */ baseUrl?: string; /** Agent name (e.g., "Support Agent") */ agentName?: string; /** Agent type (e.g., "support", "sales") */ agentType?: string; /** Session ID for conversation tracking */ sessionId?: string; /** Project name (default: "default") */ projectName?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; /** Retry configuration for network errors */ retryConfig?: RetryConfig; /** Enable request/response logging (default: false) */ enableLogging?: boolean; /** Custom logger function */ logger?: Logger; /** Enable offline queue (requires @react-native-async-storage/async-storage) */ enableOffline?: boolean; /** Storage key prefix for offline data (default: '@memorystack') */ storageKeyPrefix?: string; } export interface RetryConfig { /** Maximum number of retries (default: 3) */ maxRetries?: number; /** Initial retry delay in ms (default: 1000) */ retryDelay?: number; /** Maximum retry delay in ms (default: 10000) */ maxRetryDelay?: number; /** HTTP status codes to retry (default: [408, 429, 500, 502, 503, 504]) */ retryableStatusCodes?: number[]; } export interface Logger { debug?: (message: string, data?: unknown) => void; info?: (message: string, data?: unknown) => void; warn?: (message: string, data?: unknown) => void; error?: (message: string, data?: unknown) => void; } export type MessageRole = 'user' | 'assistant' | 'system'; export interface TextPart { type: 'text'; text: string; } export interface ImagePart { type: 'image'; /** Base64 encoded image data */ data: string; mimeType: string; } export interface DocumentPart { type: 'document'; /** Base64 encoded document data */ data: string; mimeType?: string; } export interface AudioPart { type: 'audio'; /** Base64 encoded audio data */ data: string; mimeType?: string; } export type MessagePart = TextPart | ImagePart | DocumentPart | AudioPart; export type MessageContent = string | MessagePart | MessagePart[]; export interface Message { role: MessageRole; content: MessageContent; } export interface Memory { id: string; owner_clerk_id: string; end_user_id: string | null; content: string; memory_type: string; confidence: number; metadata: Record; source_type: string; created_at: string; updated_at: string; embedding?: number[]; /** Similarity score (only present in search results) */ similarity?: number; } export interface CreateMemoryRequest { messages: Message[]; user_id?: string; metadata?: Record; } export interface CreateMemoryResponse { success: boolean; memories_created: number; memory_ids: string[]; owner_id: string; user_id: string | null; message?: string; agent_id?: string; project_id?: string; } export interface UpdateMemoryResponse { success: boolean; memory: Memory; updated_fields?: string[]; previous_values?: Record; timestamp?: string; } export interface DeleteMemoryResponse { success: boolean; deleted_count: number; hard_delete: boolean; } export interface BatchDeleteResponse { success: boolean; deleted_count: number; failed_count: number; total_requested: number; } export interface ListMemoriesRequest { user_id?: string | 'self' | 'all'; limit?: number; cursor?: string; order?: 'asc' | 'desc'; memory_type?: string; min_confidence?: number; include_embedding?: boolean; } export interface ListMemoriesResponse { success: boolean; count: number; next_cursor: string | null; results: Memory[]; } /** * Search modes: * - hybrid (default): RRF-based fusion of vector + text search - best for general queries * - vector: Pure semantic similarity search - best for conceptual queries * - text: Pure keyword/text search - best for exact term matching * - graph: Full graph-enhanced search with entity extraction * - temporal: RRF + temporal enhancements (recency boost, contradiction awareness) */ export type SearchMode = 'hybrid' | 'vector' | 'text' | 'graph' | 'temporal'; export interface SearchOptions { userId?: string; limit?: number; mode?: SearchMode; } export interface TemporalAnalysis { is_time_sensitive: boolean; is_evolution_query: boolean; detected_entities: string[]; contradictions_found: number; recency_applied: boolean; } export interface SearchMemoriesResponse { success: boolean; count: number; mode: SearchMode; graph_search_used?: boolean; temporal_search_used?: boolean; entity_boosted_results?: number; relationship_boosted_results?: number; temporal_analysis?: TemporalAnalysis; results: Memory[]; } export interface ReflectionOptions { timeWindowDays?: number; analysisDepth?: 'shallow' | 'deep'; dryRun?: boolean; minPatternStrength?: number; } export interface ReflectionResponse { success: boolean; insights_generated?: number; patterns_detected?: number; batch_job_id?: string; mode?: 'sync' | 'async'; estimated_completion?: string; message?: string; } export interface ConsolidationOptions { similarityThreshold?: number; checkRedundancy?: boolean; dryRun?: boolean; } export interface ConsolidationResponse { success: boolean; memories_merged?: number; duplicates_found?: number; batch_job_id?: string; mode?: 'sync' | 'async'; estimated_completion?: string; message?: string; } export interface UsageStats { success: boolean; owner_id: string; plan_tier: string | null; totals: { total_memories: number; total_api_calls: number; }; usage: { current_month_api_calls: number; monthly_api_limit: number; }; storage: { total_storage_bytes: number; storage_limit_bytes: number; }; } export interface GraphNode { id: string; label: string; type: 'owner' | 'enduser' | 'memory'; group: number; content?: string; } export interface GraphLink { source: string; target: string; label: string; } export interface GraphData { nodes: GraphNode[]; links: GraphLink[]; error?: string; } export interface ListAgentMemoriesOptions { limit?: number; cursor?: string; includeTeam?: boolean; includeProject?: boolean; } export interface ListAgentMemoriesResponse { success: boolean; count: number; data: Memory[]; next_cursor?: string; } export interface ExportOptions { format?: 'json' | 'csv'; userId?: string; } export interface ImportMemory { content: string; memory_type?: string; confidence?: number; metadata?: Record; } export interface ImportResponse { success: boolean; imported: number; failed: number; } export type OfflineOperationType = 'add' | 'update' | 'delete' | 'deleteBatch'; export interface OfflineQueueItem { id: string; type: OfflineOperationType; payload: unknown; createdAt: number; retryCount: number; lastError?: string; } export interface OfflineQueueStatus { pendingCount: number; items: OfflineQueueItem[]; isProcessing: boolean; } export interface NetworkState { isConnected: boolean; isInternetReachable: boolean | null; type: string | null; } export interface UseMemoriesOptions { userId?: string; limit?: number; autoRefresh?: boolean; refreshInterval?: number; } export interface UseMemoriesResult { memories: Memory[]; isLoading: boolean; error: Error | null; refetch: () => Promise; hasMore: boolean; loadMore: () => Promise; } export interface UseSearchOptions { debounceMs?: number; limit?: number; userId?: string; } export interface UseSearchResult { results: Memory[]; isSearching: boolean; error: Error | null; search: (query: string) => void; clearResults: () => void; } export interface UseMemoryResult { memory: Memory | null; isLoading: boolean; error: Error | null; update: (updates: Partial) => Promise; remove: (hard?: boolean) => Promise; refetch: () => Promise; } export interface MemoryStackContextValue { client: import('./client').MemoryStackClient | null; isOnline: boolean; pendingOperations: number; syncPending: () => Promise; } //# sourceMappingURL=types.d.ts.map