fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: markfietje <4325889+markfietje@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
markfietje
2026-03-02 22:10:31 +00:00
committed by GitHub
parent 11dcf96628
commit 49687d313c
9 changed files with 122 additions and 11 deletions

View File

@@ -225,12 +225,13 @@ function shouldIgnoreScannedDirectory(dirName: string): boolean {
return false;
}
function readPackageManifest(dir: string): PackageManifest | null {
function readPackageManifest(dir: string, rejectHardlinks = true): PackageManifest | null {
const manifestPath = path.join(dir, "package.json");
const opened = openBoundaryFileSync({
absolutePath: manifestPath,
rootPath: dir,
boundaryLabel: "plugin package directory",
rejectHardlinks,
});
if (!opened.ok) {
return null;
@@ -318,12 +319,14 @@ function resolvePackageEntrySource(params: {
entryPath: string;
sourceLabel: string;
diagnostics: PluginDiagnostic[];
rejectHardlinks?: boolean;
}): string | null {
const source = path.resolve(params.packageDir, params.entryPath);
const opened = openBoundaryFileSync({
absolutePath: source,
rootPath: params.packageDir,
boundaryLabel: "plugin package directory",
rejectHardlinks: params.rejectHardlinks ?? true,
});
if (!opened.ok) {
params.diagnostics.push({
@@ -387,7 +390,8 @@ function discoverInDirectory(params: {
continue;
}
const manifest = readPackageManifest(fullPath);
const rejectHardlinks = params.origin !== "bundled";
const manifest = readPackageManifest(fullPath, rejectHardlinks);
const extensionResolution = resolvePackageExtensionEntries(manifest ?? undefined);
const extensions = extensionResolution.status === "ok" ? extensionResolution.entries : [];
@@ -398,6 +402,7 @@ function discoverInDirectory(params: {
entryPath: extPath,
sourceLabel: fullPath,
diagnostics: params.diagnostics,
rejectHardlinks,
});
if (!resolved) {
continue;
@@ -488,7 +493,8 @@ function discoverFromPath(params: {
}
if (stat.isDirectory()) {
const manifest = readPackageManifest(resolved);
const rejectHardlinks = params.origin !== "bundled";
const manifest = readPackageManifest(resolved, rejectHardlinks);
const extensionResolution = resolvePackageExtensionEntries(manifest ?? undefined);
const extensions = extensionResolution.status === "ok" ? extensionResolution.entries : [];
@@ -499,6 +505,7 @@ function discoverFromPath(params: {
entryPath: extPath,
sourceLabel: resolved,
diagnostics: params.diagnostics,
rejectHardlinks,
});
if (!source) {
continue;