import { type PathLike } from "node:fs"; import * as nodeFsPromises from "node:fs/promises"; type FsOperationName = "access" | "appendFile" | "chmod" | "copyFile" | "cp" | "link" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "rename" | "rm" | "rmdir" | "stat" | "symlink" | "truncate" | "utimes" | "writeFile"; type FsPassthroughName = Exclude; declare const REFUSED_OPTION_REASONS: { readonly signal: "the sandbox has no AbortController, and cancelling a run is the host's to request rather than the script's"; readonly throwIfNoEntry: "only node's synchronous stat reads it and fs/promises rejects a missing path whatever it says, so catch the ENOENT rejection instead"; readonly filter: "a closure is dropped from the digest that identifies a host call across a snapshot, so a resumed run could reconcile against a copy that took a different set of files, and under a root it would read the rewritten host paths rather than the ones the script wrote — walk the tree with readdir and copy the entries you want instead"; }; type FsOptionSurface = { readonly argument: number; readonly honoured: readonly string[]; readonly refused: readonly (keyof typeof REFUSED_OPTION_REASONS)[]; }; export declare const FS_OPTION_SURFACE: Record<"appendFile" | "cp" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "rm" | "rmdir" | "stat" | "writeFile", FsOptionSurface>; declare const STAT_NUMBER_FIELDS: readonly ["dev", "mode", "nlink", "uid", "gid", "rdev", "blksize", "ino", "size", "blocks", "atimeMs", "mtimeMs", "ctimeMs", "birthtimeMs"]; declare const FILE_TYPE_PREDICATES: readonly ["isFile", "isDirectory", "isSymbolicLink", "isBlockDevice", "isCharacterDevice", "isFIFO", "isSocket"]; export type FsImplementation = Pick; type FileTypePredicates = { readonly [Name in (typeof FILE_TYPE_PREDICATES)[number]]: () => boolean; }; export type SandboxStats = { readonly [Name in (typeof STAT_NUMBER_FIELDS)[number]]: number; } & FileTypePredicates; export type SandboxDirent = { readonly name: string; readonly parentPath: string; } & FileTypePredicates; type StringEncoding = NodeJS.BufferEncoding; type EncodingOptions = StringEncoding | { encoding: StringEncoding; }; type ReadFileOptions = StringEncoding | { encoding: StringEncoding; flag?: string; }; type ReaddirOptions = { encoding?: StringEncoding; recursive?: boolean; }; type StatOptions = { bigint?: false; }; export type FsModuleOptions = { root?: string; fs?: FsImplementation; }; export type FsModule = Pick & { readFile(path: PathLike, options: ReadFileOptions): Promise; readlink(path: PathLike, options?: EncodingOptions): Promise; realpath(path: PathLike, options?: EncodingOptions): Promise; mkdtemp(prefix: string, options?: EncodingOptions): Promise; readdir: { (path: PathLike, options: ReaddirOptions & { withFileTypes: true; }): Promise; (path: PathLike, options?: StringEncoding | (ReaddirOptions & { withFileTypes?: false; })): Promise; }; stat(path: PathLike, options?: StatOptions): Promise; lstat(path: PathLike, options?: StatOptions): Promise; constants: { F_OK: number; R_OK: number; W_OK: number; X_OK: number; COPYFILE_EXCL: number; }; }; export declare function makeFsModule(options?: FsModuleOptions): FsModule; export {};