import { AgentMessageType, GraphStorageInterface, ThreadStateType } from '../../../Types/AgentGraph/AgentGraphTypes'; /** * File-based implementation of GraphStorageInterface * Stores all data in JSON files on disk * Note: Data persists across process restarts */ export default class FileStorageService implements GraphStorageInterface { private basePath; /** * Create a new FileStorageService instance * @param basePath - Base directory for storing files */ constructor(basePath: string); /** * Get file path for agent memory */ private getAgentFilePath; /** * Get file path for shared memory */ private getSharedFilePath; /** * Get file path for global memory * @param key - Memory key */ private getGlobalFilePath; /** * Get file path for thread history */ private getHistoryFilePath; /** * Get file path for thread state */ private getStateFilePath; /** * Read JSON from file */ private readJson; /** * Write JSON to file */ private writeJson; /** * Get agent private memory by key * @param threadId - Thread identifier * @param agentId - Agent identifier * @param key - Memory key * @returns Promise resolving to stored value or null */ getAgentMemory(threadId: string, agentId: string, key: string): Promise; /** * Set agent private memory by key (replaces existing value) * @param threadId - Thread identifier * @param agentId - Agent identifier * @param key - Memory key * @param data - Data to store */ setAgentMemory(threadId: string, agentId: string, key: string, data: any): Promise; /** * Get shared thread memory by key * @param threadId - Thread identifier * @param key - Memory key * @returns Promise resolving to stored value or null */ getSharedMemory(threadId: string, key: string): Promise; /** * Set shared thread memory by key (replaces existing value) * @param threadId - Thread identifier * @param key - Memory key * @param data - Data to store */ setSharedMemory(threadId: string, key: string, data: any): Promise; /** * Get global memory by key (accessible by all threads) * @param key - Memory key * @returns Promise resolving to stored value or null */ getGlobalMemory(key: string): Promise; /** * Set global memory by key (replaces existing value) * @param key - Memory key * @param data - Data to store */ setGlobalMemory(key: string, data: any): Promise; /** * Get message history for a thread * @param threadId - Thread identifier * @returns Promise resolving to array of messages */ getHistory(threadId: string): Promise; /** * Add a message to thread history * @param threadId - Thread identifier * @param message - Message to add */ addMessage(threadId: string, message: AgentMessageType): Promise; /** * Get thread state * @param threadId - Thread identifier * @returns Promise resolving to thread state or null if not found */ getThreadState(threadId: string): Promise; /** * Set thread state * @param threadId - Thread identifier * @param state - State to set */ setThreadState(threadId: string, state: ThreadStateType): Promise; }