@codai/memorai-core
Version:
Simplified advanced memory engine - no tiers, just powerful semantic search with persistence
91 lines • 2.86 kB
TypeScript
import type { ContextRequest, ContextResponse, MemoryConfig, MemoryResult, MemoryType } from '../types/index.js';
export interface RememberOptions {
type?: MemoryType;
importance?: number;
emotional_weight?: number;
tags?: string[];
context?: Record<string, unknown>;
ttl?: Date;
}
export interface RecallOptions {
type?: MemoryType;
limit?: number;
threshold?: number;
include_context?: boolean;
time_decay?: boolean;
}
export declare class MemoryEngine {
private config;
private embedding;
private vectorStore;
private isInitialized;
constructor(config?: Partial<MemoryConfig>);
initialize(): Promise<void>;
/**
* Natural language interface for agents: remember new information
*/
remember(content: string, tenantId: string, agentId?: string, options?: RememberOptions): Promise<string>;
/**
* Natural language interface for agents: recall relevant memories
*/
recall(query: string, tenantId: string, agentId?: string, options?: RecallOptions): Promise<MemoryResult[]>; /**
* Natural language interface for agents: forget specific memories
*/
forget(query: string, tenantId: string, agentId?: string, confirmThreshold?: number): Promise<number>;
/**
* Natural language interface for agents: get contextual information
*/
context(request: ContextRequest): Promise<ContextResponse>;
/**
* Health check for the memory system
*/
healthCheck(): Promise<{
status: 'healthy' | 'unhealthy';
components: Record<string, boolean>;
memory_count?: number;
}>;
/**
* Get system health status
*/ getHealth(): Promise<{
status: 'healthy' | 'degraded' | 'unhealthy';
initialized: boolean;
checks?: Record<string, boolean>;
components?: Record<string, {
status: string;
error?: string;
} | string>;
timestamp?: Date;
}>; /**
* Close connections and clean up resources
*/
close(): Promise<void>;
private ensureInitialized;
private classifyMemoryType;
private calculateImportance;
private applyTimeDecay;
private generateContextSummary;
private generateContextText;
private calculateContextConfidence;
/**
* Test tier functionality
*/
testTier(tier: string): Promise<{
success: boolean;
message: string;
}>;
/**
* Get comprehensive statistics
*/
getStatistics(): Promise<{
totalMemories: number;
memoryTypes: Record<string, number>;
avgConfidence: number;
recentActivity: number;
vectorStoreHealth: string;
}>;
/**
* Delete a specific memory by ID
*/
deleteMemory(memoryId: string): Promise<boolean>;
}
//# sourceMappingURL=MemoryEngine.d.ts.map