/** * File system abstraction — replaces `fs.promises`. * All paths are absolute strings. The implementation is responsible for * resolving them to the appropriate location on the platform. */ export interface StorageProvider { readFile(filePath: string, encoding?: string): Promise; writeFile(filePath: string, content: string): Promise; readdir(dirPath: string): Promise; mkdir(dirPath: string, opts?: { recursive?: boolean; }): Promise; rename(oldPath: string, newPath: string): Promise; /** Throws if path does not exist (like fs.access). */ access(filePath: string): Promise; unlink(filePath: string): Promise; stat(filePath: string): Promise; /** Optional: resolve symlinks to real path. Falls back to identity if not implemented. */ realpath?(filePath: string): Promise; } export interface FileStat { isDirectory: boolean; isFile: boolean; mtime: Date; size: number; } /** * Path manipulation — replaces Node.js `path` module. * All operations are synchronous string manipulation (no I/O). */ export interface PathProvider { join(...parts: string[]): string; basename(p: string, ext?: string): string; dirname(p: string): string; resolve(...parts: string[]): string; extname(p: string): string; readonly sep: string; } /** * Secrets storage — replaces reading `~/.phaibel/secrets.json`. * On Node.js: reads/writes the JSON file. * On iOS: uses Keychain. */ export interface SecretsProvider { getApiKey(provider: string): Promise; setApiKey(provider: string, key: string): Promise; /** Load all secrets (for display/config UI). */ loadAll(): Promise>; } /** * Top-level platform provider — assembled from the above interfaces * plus platform-specific utilities. */ export interface PlatformProvider { readonly storage: StorageProvider; readonly paths: PathProvider; readonly secrets: SecretsProvider; /** Home directory (e.g. /Users/gary on macOS, app Documents on iOS). */ homedir(): string; /** System config directory (~/.phaibel/ on Node, app support on iOS). */ systemDir(): string; /** Generate a random alphanumeric ID of the given length. */ generateId(length: number): string; } //# sourceMappingURL=types.d.ts.map