/** * LocalFileSystem:基于 Node.js 的本地 Workspace 文件能力。 * * 职责说明(中文) * - 为 File/Search Tool 提供单一 rooted 文件边界。 * - 复用统一路径策略、原子写入、符号链接校验与有界搜索实现。 * - 不执行任意 Shell 命令,也不感知 Agent、Session 或 Store。 */ import type { FileSystem, WorkspaceDirectoryEntry } from "../types/workspace/FileSystem.js"; import type { FileToolActionRequest, FileToolActionResult } from "../types/workspace/FileTool.js"; import type { SearchToolActionRequest, SearchToolActionResult } from "../types/workspace/SearchTool.js"; /** Node.js 本地文件系统实现。 */ export declare class LocalFileSystem implements FileSystem { /** 已解析且不可变的项目根目录。 */ readonly root_path: string; constructor(root_path: string); /** 将相对路径安全解析到当前 Workspace 根目录。 */ resolve_path(...segments: string[]): string; /** 判断 Workspace 路径是否存在。 */ path_exists(file_path: string): Promise; /** 读取 Workspace 文件的完整字节内容。 */ read_file(file_path: string): Promise; /** 读取普通文件的字节大小。 */ file_size(file_path: string): Promise; /** 创建目录及缺失的父目录。 */ ensure_directory(directory_path: string): Promise; /** 递归删除文件或目录;不存在时保持幂等。 */ remove_path(target_path: string): Promise; /** 使用同一 Workspace 文件系统内的 rename 原子移动路径。 */ move_path(source_path: string, target_path: string): Promise; /** 返回目录直接子项的最小稳定结构。 */ read_directory(directory_path: string): Promise; /** 使用同目录临时文件与 fsync 原子覆盖 Workspace 文件。 */ write_file_atomically(file_path: string, content: string | Buffer): Promise; /** 串行调用方可使用的文件追加能力。 */ append_file(file_path: string, content: string | Buffer): Promise; /** 使用跨进程锁文件串行执行 Workspace 文件事务。 */ with_file_lock(lock_path: string, action: () => Promise): Promise; /** 执行一次结构化文件操作。 */ run_file_action(request: FileToolActionRequest): Promise; /** 执行一次结构化搜索操作。 */ run_search_action(request: SearchToolActionRequest): Promise; } //# sourceMappingURL=LocalFileSystem.d.ts.map