/**
 * 工作区文件服务
 * 负责在工作区范围内安全地浏览、读取与保存文件。
 */
export interface WorkspaceFileItem {
    name: string;
    path: string;
    isDirectory: boolean;
    size?: number;
}
export interface ListWorkspaceDirectoryResult {
    currentPath: string;
    workspacePath: string;
    items: WorkspaceFileItem[];
}
export interface ReadWorkspaceFileResult {
    workspacePath: string;
    filePath: string;
    content: string;
}
export interface WorkspaceDocumentPreviewResult {
    workspacePath: string;
    filePath: string;
    kind: 'html' | 'unsupported';
    content: string;
    message?: string;
    size: number;
    mtimeMs: number;
}
export interface WorkspaceDownloadTarget {
    workspacePath: string;
    targetPath: string;
    resolvedTargetPath: string;
    fileName: string;
    contentType: string;
    isDirectory: boolean;
}
export interface WorkspaceUploadFile {
    originalname: string;
    relativePath?: string;
    path: string;
    size: number;
}
export interface WorkspaceArchiveExtractResult {
    ok: true;
    workspacePath: string;
    archivePath: string;
    targetPath: string;
    extractedEntries: number;
}
interface WorkspacePathParams {
    workspacePath: string;
    targetPath?: string;
}
interface WorkspaceFileParams {
    workspacePath: string;
    filePath: string;
}
interface WriteWorkspaceFileParams extends WorkspaceFileParams {
    content: string;
}
interface CreateWorkspaceEntryParams extends WorkspacePathParams {
    entryName: string;
    isDirectory: boolean;
}
interface RenameWorkspaceEntryParams extends WorkspacePathParams {
    targetPath: string;
    newName: string;
}
interface MoveWorkspaceEntryParams extends WorkspacePathParams {
    targetPath: string;
    destinationPath: string;
}
interface DeleteWorkspaceEntryParams extends WorkspacePathParams {
    targetPath: string;
}
interface UploadWorkspaceFilesParams extends WorkspacePathParams {
    files: WorkspaceUploadFile[];
    extractArchives?: boolean;
}
interface DownloadWorkspaceEntryParams extends WorkspacePathParams {
    targetPath: string;
}
interface ExtractWorkspaceArchiveParams extends WorkspacePathParams {
    archivePath: string;
    outputPath?: string;
}
interface ChmodWorkspaceEntryParams extends WorkspacePathParams {
    targetPath: string;
    mode: string;
    recursive?: boolean;
}
export interface WorkspaceImageProperties {
    format: 'png' | 'jpeg' | 'gif' | 'webp';
    width: number;
    height: number;
}
export interface WorkspaceEntryPropertiesResult {
    workspacePath: string;
    targetPath: string;
    name: string;
    isDirectory: boolean;
    isFile: boolean;
    isSymbolicLink: boolean;
    size: number;
    mode: number;
    modeOctal: string;
    permissions: string;
    uid?: number;
    gid?: number;
    atimeMs: number;
    mtimeMs: number;
    ctimeMs: number;
    birthtimeMs: number;
    image?: WorkspaceImageProperties;
}
export interface ChmodWorkspaceEntryResult {
    ok: true;
    workspacePath: string;
    targetPath: string;
    mode: number;
    modeOctal: string;
    recursive: boolean;
    changedCount: number;
}
/**
 * 列出工作区目录内容。
 */
export declare function listWorkspaceDirectory(params: WorkspacePathParams): Promise<ListWorkspaceDirectoryResult>;
/**
 * 读取工作区中的文本文件。
 */
export declare function readWorkspaceFile(params: WorkspaceFileParams): Promise<ReadWorkspaceFileResult>;
/**
 * 读取工作区条目的属性信息。
 * 主流程：解析安全路径 -> 读取 stat/lstat -> 文件额外尝试解析图片尺寸。
 */
export declare function getWorkspaceEntryProperties(params: DeleteWorkspaceEntryParams): Promise<WorkspaceEntryPropertiesResult>;
/**
 * 修改工作区条目权限。
 * 主流程：校验八进制权限 -> 解析安全路径 -> 非递归只改目标，递归目录先收集所有非符号链接子项后逐一 chmod。
 */
export declare function chmodWorkspaceEntry(params: ChmodWorkspaceEntryParams): Promise<ChmodWorkspaceEntryResult>;
/**
 * 返回工作区内 Word 文档的预览元数据；docx 由前端下载原文件后渲染，旧版 doc 明确提示不支持。
 */
export declare function previewWorkspaceDocument(params: WorkspaceFileParams): Promise<WorkspaceDocumentPreviewResult>;
/**
 * 将文本内容保存到工作区文件中。
 */
export declare function writeWorkspaceFile(params: WriteWorkspaceFileParams): Promise<{
    ok: true;
    workspacePath: string;
    filePath: string;
}>;
/**
 * 在指定工作区目录下创建文件或目录。
 */
export declare function createWorkspaceEntry(params: CreateWorkspaceEntryParams): Promise<{
    ok: true;
    workspacePath: string;
    targetPath: string;
    isDirectory: boolean;
}>;
/**
 * 在工作区内重命名文件或目录，保持目标仍位于原父目录中。
 */
export declare function renameWorkspaceEntry(params: RenameWorkspaceEntryParams): Promise<{
    ok: true;
    workspacePath: string;
    sourcePath: string;
    targetPath: string;
}>;
/**
 * 将工作区内文件或目录移动到另一个工作区目录，保持原文件名不变。
 */
export declare function moveWorkspaceEntry(params: MoveWorkspaceEntryParams): Promise<{
    ok: true;
    workspacePath: string;
    sourcePath: string;
    targetPath: string;
    destinationPath: string;
}>;
/**
 * 删除工作区内的文件或目录，并阻止误删工作区根目录。
 */
export declare function deleteWorkspaceEntry(params: DeleteWorkspaceEntryParams): Promise<{
    ok: true;
    workspacePath: string;
    targetPath: string;
}>;
/**
 * 上传文件到工作区指定目录，并可在上传后自动解压常见归档。
 */
export declare function uploadWorkspaceFiles(params: UploadWorkspaceFilesParams): Promise<{
    ok: true;
    workspacePath: string;
    targetPath: string;
    files: Array<{
        fileName: string;
        targetPath: string;
        size: number;
        extracted?: WorkspaceArchiveExtractResult;
    }>;
}>;
/**
 * 解析工作区下载目标；目录由路由层打包为 zip，文件直接流式下载。
 */
export declare function resolveWorkspaceDownloadTarget(params: DownloadWorkspaceEntryParams): Promise<WorkspaceDownloadTarget>;
/**
 * 将目录内容以 zip 格式写入输出流，避免在磁盘生成临时包。
 */
export declare function streamWorkspaceDirectoryZip(directoryPath: string, output: NodeJS.WritableStream): Promise<void>;
/**
 * 解压工作区中的归档文件到指定目录，支持 zip、tar、tar.gz/tgz 与单文件 gz。
 */
export declare function extractWorkspaceArchive(params: ExtractWorkspaceArchiveParams): Promise<WorkspaceArchiveExtractResult>;
export {};
//# sourceMappingURL=workspace-files.d.ts.map