UNPKG

@agentkai/browser

Version:

AgentKai的浏览器环境特定实现

73 lines 2.2 kB
import { EnvProvider, FileSystem, PathUtils, PlatformInfo, PlatformServices, PlatformType } from '@agentkai/core'; /** * 浏览器环境的文件系统实现,使用IndexedDB */ export declare class IndexedDBFileSystem implements FileSystem { private db; private indexedDB; private dbName; private storeName; constructor(dbName: string, storeName: string); private getDB; private getStore; readFile(path: string): Promise<string>; writeFile(path: string, data: string): Promise<void>; exists(path: string): Promise<boolean>; mkdir(path: string, _options?: { recursive: boolean; }): Promise<void>; readdir(path: string): Promise<string[]>; unlink(path: string): Promise<void>; stat(path: string): Promise<{ isDirectory(): boolean; }>; } /** * 浏览器环境的环境变量提供者实现,使用localStorage */ export declare class BrowserEnvProvider implements EnvProvider { private readonly STORAGE_KEY_PREFIX; get(key: string, defaultValue?: string): string | undefined; set(key: string, value: string): void; getAll(): Record<string, string>; } /** * 浏览器环境的路径工具实现 */ export declare class BrowserPathUtils implements PathUtils { home(): string; join(...paths: string[]): string; resolve(...paths: string[]): string; dirname(pathString: string): string; basename(pathString: string): string; extname(pathString: string): string; } /** * 浏览器环境的平台信息实现 */ export declare class BrowserPlatformInfo implements PlatformInfo { homeDir(): string; platform(): string; isNode(): boolean; isBrowser(): boolean; tmpdir(): string; cwd(): string; } /** * 浏览器环境的平台服务实现 */ export declare class BrowserPlatformServices implements PlatformServices { type: PlatformType; fs: FileSystem; env: EnvProvider; path: PathUtils; platformInfo: PlatformInfo; } /** * 浏览器环境的平台服务工厂 */ export declare class BrowserPlatformServiceFactory { create(): PlatformServices; } export declare const platform: PlatformServices; //# sourceMappingURL=index.d.ts.map