






















@@ -7,11 +7,21 @@ import path from "node:path";
77import { pathToFileURL } from "node:url";
88import * as tar from "tar";
9910-function normalizeStringList(value) {
10+function readPackageStringList(packageLabel, fieldName, value) {
1111if (!Array.isArray(value)) {
12-return [];
12+return { entries: [], errors: [] };
13+}
14+const entries = [];
15+const errors = [];
16+for (const [index, entry] of value.entries()) {
17+const normalized = typeof entry === "string" ? entry.trim() : "";
18+if (!normalized) {
19+errors.push(`${packageLabel} package.json ${fieldName}[${index}] must be a non-empty string`);
20+continue;
21+}
22+entries.push(normalized);
1323}
14-return value.map((entry) => (typeof entry === "string" ? entry.trim() : "")).filter(Boolean);
24+return { entries, errors };
1525}
16261727function normalizePackagePath(value) {
@@ -61,9 +71,23 @@ export function collectPluginNpmPublishedRuntimeErrors(params) {
6171const packageJson = params.packageJson ?? {};
6272const packageFiles = new Set([...params.files].map(normalizePackagePath));
6373const packageLabel = formatPackageLabel(packageJson, params.spec);
64-const extensions = normalizeStringList(packageJson.openclaw?.extensions);
65-const runtimeExtensions = normalizeStringList(packageJson.openclaw?.runtimeExtensions);
6674const errors = [];
75+const extensionsResult = readPackageStringList(
76+packageLabel,
77+"openclaw.extensions",
78+packageJson.openclaw?.extensions,
79+);
80+const runtimeExtensionsResult = readPackageStringList(
81+packageLabel,
82+"openclaw.runtimeExtensions",
83+packageJson.openclaw?.runtimeExtensions,
84+);
85+errors.push(...extensionsResult.errors, ...runtimeExtensionsResult.errors);
86+if (errors.length > 0) {
87+return errors;
88+}
89+const extensions = extensionsResult.entries;
90+const runtimeExtensions = runtimeExtensionsResult.entries;
67916892if (extensions.length === 0) {
6993return errors;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。