import type { UploadResult } from '../types.js'; /** * A file or directory entry in the user's workspace. * * `path` is a container-style absolute path (e.g. `/home/aiuser/uploads/foo.txt`) * — the same form the gateway accepts as `?path=`. `modifiedAt` is whatever the * gateway returned in the `modified` field; consumers should treat it as opaque. */ export interface WorkspaceFile { name: string; path: string; /** File size in bytes. For directories, this is whatever the gateway reports (typically 0 or the inode size). */ size: number; modifiedAt: string; type: 'file' | 'directory'; permissions?: string; } export interface FilePreview { content: string; mimeType: string; /** True when content was truncated at the gateway's 1MB cap. */ truncated: boolean; /** Total bytes of the underlying file. Always present when `truncated` is true (gateway pairs the two). */ originalSize?: number; } export interface ShareLink { url: string; /** ISO-8601 string, mirrors gateway response. */ expiresAt: string; fileName: string; fileSize: number; } /** Per-file upload progress, mirrors `@optima-chat/agentic-auth`'s `UploadProgress`. */ export interface UploadProgress { loaded: number; total: number; percentage: number; } /** * Optional progress-capable uploader, structurally compatible with * `createAuthenticatedUploader` from `@optima-chat/agentic-auth`. Keeping this * as a structural type means the SDK does not depend on the auth package. */ export type AuthenticatedUploader = (url: string, formData: FormData, onProgress?: (progress: UploadProgress) => void) => Promise; export interface UploadOptions { /** Target directory (defaults to `/home/aiuser`). */ path?: string; /** Per-file progress callback. Implementations that don't track progress may ignore this option. */ onProgress?: (file: File, progress: UploadProgress) => void; } export interface ListOptions { /** Container path to list; defaults to workspace root. */ path?: string; /** When true, populate `size`/`modifiedAt`/`permissions` on each entry. */ includeStats?: boolean; } export interface DeleteOptions { /** Required to delete a non-empty directory; otherwise gateway returns 409. */ recursive?: boolean; } /** * Consumer-supplied abstraction for workspace file operations. The default * implementation (`createDefaultWorkspaceProvider`) targets the gateway's * `/api/user/files/*` family. Consumers can swap in their own (e.g. signed-S3) * provider as long as the contract holds. */ export interface WorkspaceProvider { uploadFiles: (files: File[], options?: UploadOptions) => Promise; listFiles: (options?: ListOptions) => Promise; previewFile: (path: string) => Promise; downloadFile: (path: string) => Promise; deleteFile: (path: string, options?: DeleteOptions) => Promise; renameFile: (oldPath: string, newPath: string) => Promise; makeDirectory: (path: string) => Promise; statFile: (path: string) => Promise; shareFile: (path: string) => Promise; } //# sourceMappingURL=types.d.ts.map