build: restore qa lab updater sidecar

This commit is contained in:
Peter Steinberger
2026-04-17 00:42:52 +01:00
parent 0c5bdbde89
commit 26db52ed69
12 changed files with 83 additions and 21 deletions

View File

@@ -46,6 +46,7 @@ const LEGACY_CONTEXT_ENGINE_UNRESOLVED_RUNTIME_MARKER =
"Failed to load legacy context engine runtime.";
const LEGACY_UPDATE_COMPAT_RUNTIME_SIDECAR_PATHS = [
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
] as const;
const PUBLISHED_BUNDLED_RUNTIME_SIDECAR_PATHS = [
...BUNDLED_RUNTIME_SIDECAR_PATHS.filter((relativePath) =>

View File

@@ -59,7 +59,10 @@ export type NpmDistTagMirrorAuth = {
};
const EXPECTED_REPOSITORY_URL = "https://github.com/openclaw/openclaw";
const MAX_CALVER_DISTANCE_DAYS = 2;
const LEGACY_UPDATE_COMPAT_PACKED_PATHS = ["dist/extensions/qa-channel/runtime-api.js"] as const;
const LEGACY_UPDATE_COMPAT_PACKED_PATHS = [
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
] as const;
const REQUIRED_PACKED_PATHS = [
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
"dist/control-ui/index.html",

View File

@@ -41,6 +41,12 @@ const LEGACY_UPDATE_COMPAT_SIDECARS = [
content:
"// Compatibility stub for older OpenClaw updaters. The QA channel implementation is not packaged.\nexport {};\n",
},
{
path: "dist/extensions/qa-lab/runtime-api.js",
removedPrefix: "dist/extensions/qa-lab/",
content:
"// Compatibility stub for older OpenClaw updaters. The QA lab implementation is not packaged.\nexport {};\n",
},
];
const BAILEYS_MEDIA_FILE = join(
"node_modules",
@@ -313,10 +319,9 @@ export function restoreLegacyUpdaterCompatSidecars(params = {}) {
const restored = [];
for (const sidecar of LEGACY_UPDATE_COMPAT_SIDECARS) {
// Older npm updater builds verify this exact sidecar after npm has already
// replaced the package. npm may remove stale QA Lab files before this
// postinstall hook runs, so this must be generated independently of prune
// results. The tarball and dist inventory still omit QA Lab.
// Older npm updater builds verify these exact sidecars after npm has
// already replaced the package, so generate them independently of prune
// results.
const sidecarPath = join(packageRoot, sidecar.path);
makeDirectory(dirname(sidecarPath), { recursive: true });
writeFile(sidecarPath, sidecar.content, "utf8");

View File

@@ -57,7 +57,13 @@ const requiredPathGroups = [
"dist/build-info.json",
"dist/channel-catalog.json",
"dist/control-ui/index.html",
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
];
const legacyUpdateCompatPackPaths = new Set([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
]);
const forbiddenPrefixes = [
"dist-runtime/",
"dist/OpenClaw.app/",
@@ -274,7 +280,9 @@ export function collectForbiddenPackPaths(paths: Iterable<string>): string[] {
return [...paths]
.filter(
(path) =>
forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) || /node_modules\//.test(path),
!legacyUpdateCompatPackPaths.has(path) &&
(forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) ||
/node_modules\//.test(path)),
)
.toSorted((left, right) => left.localeCompare(right));
}