@agentkai/node
Version:
AgentKai的Node.js环境特定实现
64 lines (63 loc) • 1.85 kB
TypeScript
import { EnvProvider, FileSystem, PathUtils, PlatformInfo, PlatformServices, PlatformType } from '@agentkai/core';
/**
* Node.js环境的文件系统实现
*/
export declare class NodeFileSystem implements FileSystem {
readFile(filePath: string): Promise<string>;
writeFile(filePath: string, data: string): Promise<void>;
exists(filePath: string): Promise<boolean>;
mkdir(filePath: string, options?: {
recursive: boolean;
}): Promise<void>;
readdir(filePath: string): Promise<string[]>;
unlink(filePath: string): Promise<void>;
stat(filePath: string): Promise<{
isDirectory(): boolean;
}>;
}
/**
* Node.js环境的环境变量提供者实现
*/
export declare class NodeEnvProvider implements EnvProvider {
get(key: string, defaultValue?: string): string | undefined;
set(key: string, value: string): void;
getAll(): Record<string, string>;
}
/**
* Node.js环境的路径工具实现
*/
export declare class NodePathUtils implements PathUtils {
home(): string;
join(...paths: string[]): string;
resolve(...paths: string[]): string;
dirname(pathStr: string): string;
basename(pathStr: string): string;
extname(pathStr: string): string;
}
/**
* Node.js环境的平台信息实现
*/
export declare class NodePlatformInfo implements PlatformInfo {
homeDir(): string;
platform(): string;
isNode(): boolean;
isBrowser(): boolean;
tmpdir(): string;
cwd(): string;
}
/**
* Node.js环境的平台服务实现
*/
export declare class NodePlatformServices implements PlatformServices {
type: PlatformType;
fs: FileSystem;
env: EnvProvider;
path: PathUtils;
platformInfo: PlatformInfo;
}
/**
* Node.js环境的平台服务工厂
*/
export declare class NodePlatformServiceFactory {
create(): PlatformServices;
}