/**
 * FilesystemDB is a thin I/O layer for filesystem-based storage.
 * It manages reading/writing JSON files in a directory, similar to how
 * InMemoryDB holds Maps for in-memory storage.
 *
 * Each editor domain gets its own JSON file (e.g., `agents.json`, `prompt-blocks.json`).
 * Skills use a real file tree under `skills/` instead of JSON.
 */
export declare class FilesystemDB {
    readonly dir: string;
    /** In-memory cache of parsed domain data, keyed by filename */
    private cache;
    private initialized;
    constructor(dir: string);
    /**
     * Initialize the storage directory. Called once; subsequent calls are no-ops.
     */
    init(): Promise<void>;
    /**
     * Ensure the storage directory and skills subdirectory exist.
     */
    ensureDir(): void;
    /**
     * Read a domain JSON file and return its entity map.
     * Uses in-memory cache; reads from disk on first access.
     */
    readDomain<T = Record<string, unknown>>(filename: string): Record<string, T>;
    /**
     * Write a domain's full entity map to its JSON file.
     * Uses atomic write (write to .tmp, then rename) to prevent corruption.
     */
    writeDomain<T = Record<string, unknown>>(filename: string, data: Record<string, T>): void;
    /**
     * Clear all data from a domain JSON file.
     */
    clearDomain(filename: string): void;
    /**
     * Invalidate the in-memory cache for a domain, forcing a re-read from disk on next access.
     */
    invalidateCache(filename?: string): void;
    /**
     * Get a single entity by ID from a domain JSON file.
     */
    get<T>(filename: string, id: string): T | null;
    /**
     * Get all entities from a domain JSON file as an array.
     */
    getAll<T>(filename: string): T[];
    /**
     * Set (create or update) an entity in a domain JSON file.
     */
    set<T>(filename: string, id: string, entity: T): void;
    /**
     * Remove an entity by ID from a domain JSON file. No-op if not found.
     */
    remove(filename: string, id: string): void;
    /**
     * Get the path to a skill's directory.
     */
    skillDir(skillName: string): string;
    /**
     * Resolve a file path within a skill directory, throwing if it escapes.
     */
    private safeSkillPath;
    /**
     * List all files in a skill's directory, returning relative paths.
     */
    listSkillFiles(skillName: string): string[];
    /**
     * Read a file from a skill's directory.
     */
    readSkillFile(skillName: string, relativePath: string): Buffer | null;
    /**
     * Write a file to a skill's directory.
     */
    writeSkillFile(skillName: string, relativePath: string, content: Buffer | string): void;
    /**
     * Delete a skill's entire directory.
     */
    deleteSkillDir(skillName: string): void;
}
//# sourceMappingURL=filesystem-db.d.ts.map