

















@@ -38,6 +38,31 @@ else
3838 exit 1
3939fi
4040export OPENCLAW_ENTRY
41+PACKAGE_VERSION="$(node -p 'require("./package.json").version')"
42+OPENCLAW_PACKAGE_ACCEPTANCE_LEGACY_COMPAT="$(
43+ node - "$PACKAGE_VERSION" <<'NODE'
44+const version = process.argv[2] || "";
45+const match = /^(\d{4})\.(\d{1,2})\.(\d{1,2})(?:[-+].*)?$/.exec(version);
46+if (!match) {
47+ console.log("0");
48+ process.exit(0);
49+}
50+const value = [Number(match[1]), Number(match[2]), Number(match[3])];
51+const max = [2026, 4, 25];
52+for (let i = 0; i < value.length; i += 1) {
53+ if (value[i] < max[i]) {
54+ console.log("1");
55+ process.exit(0);
56+ }
57+ if (value[i] > max[i]) {
58+ console.log("0");
59+ process.exit(0);
60+ }
61+}
62+console.log("1");
63+NODE
64+)"
65+export OPENCLAW_PACKAGE_ACCEPTANCE_LEGACY_COMPAT
41664267home_dir=$(mktemp -d "/tmp/openclaw-plugins-e2e.XXXXXX")
4368export HOME="$home_dir"
@@ -562,12 +587,21 @@ const indexPath = path.join(process.env.HOME, ".openclaw", "plugins", "installs.
562587const index = JSON.parse(fs.readFileSync(indexPath, "utf8"));
563588const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");
564589const config = fs.existsSync(configPath) ? JSON.parse(fs.readFileSync(configPath, "utf8")) : {};
565-const installRecords = index.installRecords ?? index.records ?? config.plugins?.installs ?? {};
590+const allowLegacyCompat = process.env.OPENCLAW_PACKAGE_ACCEPTANCE_LEGACY_COMPAT === "1";
591+if (!allowLegacyCompat && !index.installRecords) {
592+ throw new Error("expected modern installRecords in installed plugin index");
593+}
594+const installRecords = allowLegacyCompat
595+ ? index.installRecords ?? index.records ?? config.plugins?.installs ?? {}
596+ : index.installRecords ?? {};
566597for (const id of ["marketplace-shortcut", "marketplace-direct"]) {
567598 const record = installRecords[id];
568599 if (!record) {
569- console.log(`legacy package did not persist marketplace install record for ${id}`);
570- continue;
600+ if (allowLegacyCompat) {
601+ console.log(`legacy package did not persist marketplace install record for ${id}`);
602+ continue;
603+ }
604+ throw new Error(`missing marketplace install record for ${id}`);
571605 }
572606 if (record.source !== "marketplace") {
573607 throw new Error(`unexpected source for ${id}: ${record.source}`);
@@ -853,7 +887,13 @@ const indexPath = path.join(process.env.HOME, ".openclaw", "plugins", "installs.
853887const index = JSON.parse(fs.readFileSync(indexPath, "utf8"));
854888const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");
855889const config = fs.existsSync(configPath) ? JSON.parse(fs.readFileSync(configPath, "utf8")) : {};
856-const installRecords = index.installRecords ?? index.records ?? config.plugins?.installs ?? {};
890+const allowLegacyCompat = process.env.OPENCLAW_PACKAGE_ACCEPTANCE_LEGACY_COMPAT === "1";
891+if (!allowLegacyCompat && !index.installRecords) {
892+ throw new Error("expected modern installRecords in installed plugin index");
893+}
894+const installRecords = allowLegacyCompat
895+ ? index.installRecords ?? index.records ?? config.plugins?.installs ?? {}
896+ : index.installRecords ?? {};
857897const record = installRecords[pluginId];
858898if (!record) throw new Error(`missing ClawHub install record for ${pluginId}`);
859899if (record.source !== "clawhub") {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。