



























@@ -3,6 +3,7 @@
33import { execFileSync, execSync } from "node:child_process";
44import {
55existsSync,
6+lstatSync,
67mkdtempSync,
78mkdirSync,
89realpathSync,
@@ -116,6 +117,15 @@ const appcastPath = resolve("appcast.xml");
116117const laneBuildMin = 1_000_000_000;
117118const laneFloorAdoptionDateKey = 20260227;
118119const SAFE_UNIX_SMOKE_PATH = "/usr/bin:/bin";
120+export const MAX_CRITICAL_PLUGIN_SDK_ENTRYPOINT_BYTES = 2 * 1024 * 1024;
121+export const CRITICAL_PLUGIN_SDK_SIZE_CHECK_SPECIFIERS = [
122+"openclaw/plugin-sdk/agent-runtime-test-contracts",
123+"openclaw/plugin-sdk/plugin-test-contracts",
124+"openclaw/plugin-sdk/provider-test-contracts",
125+] as const;
126+export const CRITICAL_PLUGIN_SDK_IMPORT_SMOKE_SPECIFIERS = [
127+"openclaw/plugin-sdk/plugin-test-contracts",
128+] as const;
119129export const PACKED_CLI_SMOKE_COMMANDS = [
120130["--help"],
121131["onboard", "--help"],
@@ -843,6 +853,44 @@ async function checkPluginSdkExports() {
843853}
844854}
845855856+export function collectCriticalPluginSdkEntrypointSizeErrors(rootDir = process.cwd()): string[] {
857+const errors: string[] = [];
858+for (const specifier of CRITICAL_PLUGIN_SDK_SIZE_CHECK_SPECIFIERS) {
859+const subpath = specifier.slice("openclaw/plugin-sdk/".length);
860+const relativePath = `dist/plugin-sdk/${subpath}.js`;
861+const filePath = resolve(rootDir, relativePath);
862+if (!existsSync(filePath)) {
863+errors.push(`${relativePath} is missing.`);
864+continue;
865+}
866+const stat = lstatSync(filePath);
867+if (!stat.isFile()) {
868+errors.push(`${relativePath} is not a file.`);
869+continue;
870+}
871+if (stat.size > MAX_CRITICAL_PLUGIN_SDK_ENTRYPOINT_BYTES) {
872+errors.push(
873+`${relativePath} is ${stat.size} bytes, exceeding ${MAX_CRITICAL_PLUGIN_SDK_ENTRYPOINT_BYTES} bytes. Keep public SDK test-contract entrypoints lazy and avoid bundling compiler/runtime internals.`,
874+);
875+}
876+}
877+return errors;
878+}
879+880+function runCriticalPluginSdkEntrypointImportSmoke() {
881+const script = [
882+`const specifiers = ${JSON.stringify(CRITICAL_PLUGIN_SDK_IMPORT_SMOKE_SPECIFIERS)};`,
883+`const importModule = new Function("specifier", "return imp" + "ort(specifier)");`,
884+"for (const specifier of specifiers) {",
885+" await importModule(specifier);",
886+"}",
887+].join("\n");
888+execFileSync(process.execPath, ["--input-type=module", "--eval", script], {
889+cwd: process.cwd(),
890+stdio: "inherit",
891+});
892+}
893+846894async function main() {
847895checkAppcastSparkleVersions();
848896checkCliBootstrapExternalImports({
@@ -851,6 +899,15 @@ async function main() {
851899},
852900});
853901await checkPluginSdkExports();
902+const criticalPluginSdkEntrypointErrors = collectCriticalPluginSdkEntrypointSizeErrors();
903+if (criticalPluginSdkEntrypointErrors.length > 0) {
904+console.error("release-check: critical plugin-sdk entrypoint validation failed:");
905+for (const error of criticalPluginSdkEntrypointErrors) {
906+console.error(` - ${error}`);
907+}
908+process.exit(1);
909+}
910+runCriticalPluginSdkEntrypointImportSmoke();
854911checkBundledExtensionMetadata();
855912await writePackageDistInventory(process.cwd());
856913此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。