/** * 文件系统传输层接口 * 本地模式走 Wails IPC,远程模式走 HTTP REST API * Composable 和组件不感知底层差异 */ export type FileItem = { name: string path: string size: number size_str?: string is_dir: boolean mod_time?: string mode?: string } export type FileOperationResult = { path: string name: string size: number size_str?: string is_dir: boolean mod_time?: string mode?: string old_path?: string deleted?: boolean } export type DetectTypeResult = { extension: string category: string mime_type: string confidence: number } export interface FsTransport { // 文件列表与信息 listDir(path: string): Promise getFileInfo(path: string): Promise> // 文件读写 readFile(path: string): Promise writeFile(path: string, content: string): Promise saveBase64File(path: string, content: string): Promise // 文件操作 createFile(dirPath: string, filename: string): Promise createDir(parentPath: string, dirname: string): Promise deletePath(path: string): Promise renamePath(oldPath: string, newPath: string): Promise // ZIP 操作(Wave 3) listZipContents(zipPath: string): Promise extractFileFromZip(zipPath: string, filePath: string): Promise extractFileFromZipToTemp(zipPath: string, filePath: string): Promise getZipFileInfo(zipPath: string, filePath: string): Promise // 系统操作 openPath(path: string): Promise getFileServerURL(): Promise getPreviewToken(): string resolveShortcut(lnkPath: string): Promise detectFileTypeByContent(path: string): Promise getCommonPaths(): Promise> // 回收站(Wave 3) getRecycleBinEntries(): Promise restoreFromRecycleBin(path: string): Promise deletePermanently(path: string): Promise emptyRecycleBin(): Promise // 预览辅助 /** 下载远程文件到本地临时目录,本地/HTTP 直接返回原路径 */ downloadForPreview(path: string): Promise /** 下载 HTML 及其引用的资源到临时目录(OSS 实现) */ downloadSiteForPreview?(path: string): Promise /** 获取预签名 URL(仅 OSS 实现,其他返回空串) */ getSignedUrl?(path: string): Promise }