UNPKG

memtask

Version:

Memory and task management MCP Server with Goal-Task-Memory architecture

97 lines (96 loc) 2.48 kB
import { Memory, AddMemoryArgs, SearchMemoryArgs, ListMemoriesArgs, DeleteMemoryArgs } from './types'; import { CacheService } from './cache'; /** * Memory Manager Class * * Combines the functionality of MemoryService and MemoryStorage into a single class, * simplifies the architecture, reduces layers and dependencies. */ export declare class MemoryManager { private storagePath; private cache; private console; /** * Constructor * @param storagePath Storage path * @param cacheService Unified cache service instance * @param console Console for logging (optional) */ constructor(storagePath: string, cacheService: CacheService<string, Memory>, console?: Console); /** * Initialize */ initialize(): Promise<void>; /** * Add memory * @param args Add memory parameters */ addMemory(args: AddMemoryArgs): Promise<Memory>; /** * Search memory * @param args Search parameters */ searchMemory(args: SearchMemoryArgs): Promise<Array<{ memory: Memory; similarity: number; }>>; /** * List memories * @param args List parameters */ listMemories(args?: ListMemoriesArgs): Promise<Memory[]>; /** * Get memory * @param id Memory ID */ getMemory(id: string): Promise<Memory | null>; /** * Update memory * @param id Memory ID * @param updates Update content */ updateMemory(id: string, updates: Partial<{ content: string; summary: string; tags: string[]; }>): Promise<Memory | null>; /** * Delete memory * @param args Delete parameters */ deleteMemory(args: DeleteMemoryArgs): Promise<boolean>; /** * Batch get memories * @param ids Array of IDs */ batchGetMemories(ids: string[]): Promise<Memory[]>; /** * Get cache statistics */ getCacheStats(): import("./types").CacheStats; /** * Save memory * @param id Memory ID * @param memory Memory object */ private save; /** * Load memory * @param id Memory ID */ private load; /** * Delete memory * @param id Memory ID */ private delete; /** * List all memories */ private list; /** * Calculate simple similarity * Simplified version of similarity calculation, not using complex TF-IDF algorithm */ private calculateSimpleSimilarity; }