/** * AgentMemorySync - Cross-session persistence for the AgentMemory service. * * Provides functions to load and save agent memory to/from the virtual * filesystem, enabling memory to survive across shell sessions. * * File layout: * /.ag-bash/agent-memory//.json * * Each JSON file contains an array of MemoryEntry objects for that * agent+scope combination. */ import type { AgentMemory, MemoryScope } from "./AgentMemory.js"; export interface SyncFs { exists(path: string): Promise; readFile(path: string, encoding?: "utf-8"): Promise; writeFile(path: string, content: string): Promise; mkdir(path: string, options?: { recursive?: boolean; }): Promise; } /** * Load persisted agent memories from the VFS into the AgentMemory instance. * * Reads from `/.ag-bash/agent-memory//.json` for every * agent type found on disk within the requested scopes. Entries are merged * with whatever is already in memory: when a key collision occurs the entry * with the more recent `updatedAt` timestamp wins. * * @param memory The AgentMemory instance to hydrate. * @param fs A VFS implementation satisfying `SyncFs`. * @param scopes Which scopes to load (default: all three). * @returns The total number of entries loaded (merged) from disk. */ export declare function loadMemoryFromFs(memory: AgentMemory, fs: SyncFs, scopes?: MemoryScope[]): Promise; /** * Save all agent memories to the VFS. * * Groups memories by scope and agentType, writing one JSON file per group * to `/.ag-bash/agent-memory//.json`. Also writes a * `.manifest.json` per scope directory so that `loadMemoryFromFs` can * discover agent types without requiring a `readdir` on the VFS. * * @param memory The AgentMemory instance to persist. * @param fs A VFS implementation satisfying `SyncFs`. * @returns The total number of entries written to disk. */ export declare function saveMemoryToFs(memory: AgentMemory, fs: SyncFs): Promise; /** * Sync a specific agent type's memory for a specific scope. * * This is an incremental save: only the entries matching the given * agentType and scope are written. Useful after a single write operation * to avoid re-serializing the entire memory store. * * @param memory The AgentMemory instance to read from. * @param fs A VFS implementation satisfying `SyncFs`. * @param agentType The agent type to sync. * @param scope The scope to sync. */ export declare function syncAgentMemory(memory: AgentMemory, fs: SyncFs, agentType: string, scope: MemoryScope): Promise;