UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

20 lines (19 loc) 998 B
import { y as resolveIsNixMode } from "./paths-D2sRr1a_.js"; import { a as pluginCacheRealpathSync } from "./plugin-cache-files-DLPF_Tw2.js"; import path from "node:path"; //#region src/plugins/hardlink-policy.ts /** Enforces plugin root hardlink policy with bundled and immutable Nix-store exceptions. */ const NIX_STORE_ROOT = "/nix/store"; /** Returns true when a plugin root resolves inside the immutable Nix store. */ function isNixStorePluginRoot(rootDir) { const rootRealPath = pluginCacheRealpathSync(rootDir) ?? path.resolve(rootDir); return rootRealPath === NIX_STORE_ROOT || rootRealPath.startsWith(`${NIX_STORE_ROOT}/`); } /** Decides whether plugin file hardlinks should fail boundary validation for one root. */ function shouldRejectHardlinkedPluginFiles(params) { if (params.origin === "bundled") return false; if (resolveIsNixMode(params.env) && isNixStorePluginRoot(params.rootDir)) return false; return true; } //#endregion export { shouldRejectHardlinkedPluginFiles as t };