import type { FileStats, FilesystemChangeKind, SearchResult } from "@edenapp/types"; import { ExecutionContext } from "../execution/ExecutionContext"; import { CommandRegistry, EdenEmitter, IPCBridge } from "../ipc"; import { ViewManager } from "../view-manager/ViewManager"; interface FilesystemEvents { changed: { watchId: string; kind: FilesystemChangeKind; }; } /** * FilesystemManager * * Manages filesystem operations and path resolution. */ export declare class FilesystemManager extends EdenEmitter { private executionContext; private viewManager; private baseDir; private handler; private readonly transfer; private readonly watcher; constructor(baseDir: string, commandRegistry: CommandRegistry, executionContext: ExecutionContext, ipcBridge: IPCBridge, viewManager: ViewManager); /** * Get the base directory (user directory) */ getBaseDir(): string; /** * Resolve a masked path (as seen by apps) to an absolute filesystem path. * * @param targetPath - The masked path (e.g., "/file.json" or "/Documents/notes.txt") * @returns The resolved absolute path (e.g., "/home/user/.eden/file.json") * @throws Error if the path attempts to escape the base directory */ resolvePath(targetPath: string): Promise; /** * Convert an absolute filesystem path back to a masked path (as seen by apps). * * @param absolutePath - The absolute filesystem path * @returns The masked path relative to the base directory * @throws Error if the path is outside the base directory */ toMaskedPath(absolutePath: string): Promise; /** * Check if a path is within the allowed base directory */ isPathAllowed(targetPath: string): Promise; private getEffectiveRoot; /** * Read the contents of a file. */ readFile(targetPath: string, encoding?: BufferEncoding): Promise; /** * Read the contents of a file without text encoding. */ readBinaryFile(targetPath: string): Promise; /** * Write content to a file, creating directories if needed. */ writeFile(targetPath: string, content: string, encoding?: BufferEncoding): Promise; /** * Write bytes to a file, creating directories if needed. */ writeBinaryFile(targetPath: string, content: Uint8Array): Promise; /** * Check if a file or directory exists. */ exists(targetPath: string): Promise; /** * Create a directory and any necessary parent directories. */ mkdir(targetPath: string): Promise; /** * List contents of a directory. */ readdir(targetPath: string): Promise; /** * Get file or directory statistics. */ stat(targetPath: string): Promise; /** * Search for files and directories using glob patterns. */ search(basePath: string, pattern: string, limit?: number): Promise; /** * Delete a file or directory. * For directories, removes recursively. */ delete(targetPath: string): Promise; /** * Copy a file or directory to another location. */ copy(fromPath: string, toPath: string, overwrite?: boolean): Promise; /** * Move or rename a file or directory. * Falls back to copy+delete when rename crosses filesystem boundaries. */ move(fromPath: string, toPath: string, overwrite?: boolean): Promise; watchDirectory(targetPath: string, callerWebContentsId: number | undefined): Promise<{ watchId: string; }>; unwatch(watchId: string, callerWebContentsId: number | undefined): void; private invalidateHostDirectory; dispose(): void; } export {}; //# sourceMappingURL=FilesystemManager.d.ts.map