UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

18 lines (17 loc) 1.2 kB
import { configureFsSafeNative } from "@openclaw/fs-safe/config"; import { assertNoSymlinkParents, readRegularFile, statRegularFile } from "@openclaw/fs-safe/advanced"; import { isPathInside, isPathInsideWithRealpath } from "@openclaw/fs-safe/path"; import { root as root$1 } from "@openclaw/fs-safe/root"; import { walkDirectory } from "@openclaw/fs-safe/walk"; //#region packages/memory-host-sdk/src/host/fs-utils.ts if (!Object.keys(process.env).some((key) => /^(?:OPENCLAW_)?FS_SAFE_(?:NATIVE|PYTHON)_MODE$/u.test(process.platform === "win32" ? key.toUpperCase() : key))) configureFsSafeNative({ mode: "off" }); /** * True for missing-file errors emitted by Node or fs-safe. * The narrowed union stays stable; extra-path authorization handles `not-file` separately. */ function isFileMissingError(err) { if (!err || typeof err !== "object" || !("code" in err)) return false; return err.code === "ENOENT" || err.code === "ENOTDIR" || err.code === "not-file" || err.code === "not-found"; } //#endregion export { readRegularFile as a, walkDirectory as c, isPathInsideWithRealpath as i, isFileMissingError as n, root$1 as o, isPathInside as r, statRegularFile as s, assertNoSymlinkParents as t };