UNPKG

mcp-think-tank

Version:

Structured thinking and knowledge management tool for Model Context Protocol

94 lines 3.28 kB
import { MemoryStore, Observation, MemoryQuery } from './MemoryStore.js'; import { KnowledgeGraph, Entity, Relation } from '../knowledgeGraph.js'; /** * JSONL implementation of the MemoryStore interface */ export declare class JsonlMemoryStore implements MemoryStore { private filePath; private graph; private isLoading; private loadPromise; private enhancedEntities; private entityRelations; private autoLinkEnabled; /** * Create a new JsonlMemoryStore instance * @param filePath - Path to the storage file */ constructor(filePath: string); /** * Get the knowledge graph instance * @returns The knowledge graph instance */ getGraph(): KnowledgeGraph; /** * Add a new observation to the store * @param entityName - Entity to associate the observation with * @param text - The observation text * @param metadata - Optional metadata for the observation * @returns The stored observation with generated metadata */ add(entityName: string, text: string, metadata?: { version?: string; tags?: string[]; agent?: string; }): Promise<Observation>; /** * Create automatic relationships between entities based on heuristics * @param entityName - Name of the entity to link * @param observationText - Text of the observation that might contain relationship clues */ private createAutoLinks; /** * Query observations based on filter criteria * @param query - Query parameters * @returns Array of matching observations with their entity names */ query(query: MemoryQuery): Promise<{ entityName: string; observation: Observation; }[]>; /** * Prune observations from the store * @param options - Pruning options * @returns Count of pruned observations */ prune(options: { before?: string; tag?: string; deprecate?: boolean; }): Promise<number>; /** * Find similar entity names based on the provided name * @param name - The name to find similar entities for * @returns Array of similar entity names */ findSimilar(name: string): Promise<string[]>; /** * Get the loading promise * @returns Promise that resolves when loading is complete */ getLoadingPromise(): Promise<void>; /** * Load the graph from the file (JSONL only) using streaming for better performance * @returns Promise resolving when loading is complete */ load(): Promise<void>; /** * Save the graph to the file in JSONL format */ save(): Promise<void>; /** * Backward compatibility method: Add a new entity to the graph * @param entity - The entity to add * @returns Promise resolving to true if the entity was added, false if it already exists */ addEntity(entity: Entity): Promise<boolean>; /** * Backward compatibility method: Add a new relation between entities * @param relation - The relation to add * @returns Promise resolving to true if the relation was added, false if invalid or already exists */ addRelation(relation: Relation): Promise<boolean>; } //# sourceMappingURL=JsonlMemoryStore.d.ts.map