refactor(plugins): share package compatibility validation (#198663)

* refactor(plugins): share package compatibility validation

* chore(plugins): shrink assertion safety baseline
This commit is contained in:
Vincent Koc 2026-11-14 13:58:20 +08:00 • committed by GitHub
parent 9e7e97393d
commit 3256fe14aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 230 additions and 142 deletions

View file

@ -2068,7 +2068,6 @@ src/plugins/host-hook-runtime.ts 1
src/plugins/host-hook-scheduled-turns.ts 4
src/plugins/host-hook-state.ts 6
src/plugins/install-managed-npm-state.ts 2
src/plugins/install-npm-metadata.ts 1
src/plugins/install-persistence.ts 1
src/plugins/install-record-commit.ts 2
src/plugins/install-transaction.ts 3

View file

@ -1,25 +1,11 @@
import { describe, expect, it } from "vitest";
import {
validateOpenClawPackageInstallCompatibility,
type PluginInstallRuntime,
} from "./install-shared.js";
import { PLUGIN_INSTALL_ERROR_CODE } from "./install-types.js";
import type { OpenClawPackageManifest } from "./manifest.js";
import { checkMinHostVersion } from "./min-host-version.js";
function createCompatibilityRuntime(
hostVersion: string,
): Pick<PluginInstallRuntime, "checkMinHostVersion" | "resolveCompatibilityHostVersion"> {
return {
checkMinHostVersion,
resolveCompatibilityHostVersion: () => hostVersion,
};
}
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
describe("plugin package install compatibility", () => {
it("accepts independent package compatibility floors without requiring package-host equality", () => {
const result = validateOpenClawPackageInstallCompatibility({
runtime: createCompatibilityRuntime("2026.5.21"),
currentHostVersion: "2026.5.21",
pluginId: "example-plugin",
packageMetadata: {
install: { minHostVersion: ">=2026.5.1-beta.1" },
@ -32,7 +18,7 @@ describe("plugin package install compatibility", () => {
it("rejects a package whose minimum host floor exceeds the current host", () => {
const result = validateOpenClawPackageInstallCompatibility({
runtime: createCompatibilityRuntime("2026.5.21"),
currentHostVersion: "2026.5.21",
pluginId: "example-plugin",
packageMetadata: { install: { minHostVersion: ">=2026.5.22" } },
});
@ -46,7 +32,7 @@ describe("plugin package install compatibility", () => {
it("rejects a package whose plugin API range excludes the current runtime", () => {
const result = validateOpenClawPackageInstallCompatibility({
runtime: createCompatibilityRuntime("2026.5.21"),
currentHostVersion: "2026.5.21",
pluginId: "example-plugin",
packageMetadata: { compat: { pluginApi: ">=2026.5.22" } },
});
@ -58,9 +44,28 @@ describe("plugin package install compatibility", () => {
expect(result?.error).toContain("requires plugin API >=2026.5.22");
});
it("reports an unknown host before checking the plugin API", () => {
const result = validateOpenClawPackageInstallCompatibility({
currentHostVersion: "unknown",
pluginId: "example-plugin",
packageMetadata: {
install: { minHostVersion: ">=2026.5.1" },
compat: { pluginApi: ">=2026.5.22" },
},
});
expect(result).toMatchObject({
ok: false,
code: PLUGIN_INSTALL_ERROR_CODE.UNKNOWN_HOST_VERSION,
});
});
it.each([
{
packageMetadata: { install: { minHostVersion: "2026.5.22" } },
packageMetadata: {
install: { minHostVersion: "2026.5.22" },
compat: { pluginApi: 20260522 },
},
code: PLUGIN_INSTALL_ERROR_CODE.INVALID_MIN_HOST_VERSION,
},
{
@ -69,9 +74,9 @@ describe("plugin package install compatibility", () => {
},
])("rejects malformed compatibility metadata with $code", ({ packageMetadata, code }) => {
const result = validateOpenClawPackageInstallCompatibility({
runtime: createCompatibilityRuntime("2026.5.21"),
currentHostVersion: "2026.5.21",
pluginId: "example-plugin",
packageMetadata: packageMetadata as OpenClawPackageManifest,
packageMetadata,
});
expect(result).toMatchObject({ ok: false, code });

View file

@ -17,7 +17,6 @@ import {
runInstallSourceScan,
sourceFamilyForInstallPolicyKind,
sourceFamilyForInstallPolicySource,
validateOpenClawPackageInstallCompatibility,
type PluginInstallRuntime,
} from "./install-shared.js";
import {
@ -29,6 +28,7 @@ import {
type PluginInstallLogger,
type PluginInstallPolicyRequest,
} from "./install-types.js";
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
import { validatePackageExtensionEntriesForInstall } from "./package-entry-resolution.js";
import { linkOpenClawPeerDependencies, resolveOpenClawHostDependency } from "./plugin-peer-link.js";
@ -115,7 +115,7 @@ export async function validatePackagePluginInstallSource(params: {
const packageMetadata = params.runtime.getPackageManifestMetadata(manifest);
const compatibilityError = validateOpenClawPackageInstallCompatibility({
runtime: params.runtime,
currentHostVersion: params.runtime.resolveCompatibilityHostVersion(),
pluginId,
packageMetadata,
});

View file

@ -6,16 +6,13 @@ import {
type ParsedRegistryNpmSpec,
} from "../infra/npm-registry-spec.js";
import { comparePackageUpdateVersions } from "../infra/package-update-utils.js";
import {
validateOpenClawPackageInstallCompatibility,
type PluginInstallRuntime,
} from "./install-shared.js";
import type { PluginInstallRuntime } from "./install-shared.js";
import {
PLUGIN_INSTALL_ERROR_CODE,
type PluginInstallFailureResult,
type PluginInstallLogger,
} from "./install-types.js";
import type { OpenClawPackageManifest } from "./manifest.js";
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
export function isNpmPackageNotFoundMessage(error: string): boolean {
const normalized = error.trim();
@ -136,9 +133,9 @@ export function validateNpmResolutionCompatibility(params: {
resolution: NpmSpecResolution;
}): PluginInstallFailureResult | null {
return validateOpenClawPackageInstallCompatibility({
runtime: params.runtime,
currentHostVersion: params.runtime.resolveCompatibilityHostVersion(),
pluginId: params.expectedPluginId ?? params.resolution.name ?? params.parsedSpec.name,
packageMetadata: params.resolution.packageOpenClaw as OpenClawPackageManifest | undefined,
packageMetadata: params.resolution.packageOpenClaw,
});
}

View file

@ -18,7 +18,6 @@ import {
resolvePreparedDirectoryInstallTarget,
runInstallSourceScan,
sourceFamilyForInstallPolicyKind,
validateOpenClawPackageInstallCompatibility,
type PreparedInstallTarget,
} from "./install-shared.js";
import { copyPluginInstallTransactionRequest } from "./install-transaction.js";
@ -30,6 +29,7 @@ import {
type PackageManifest,
type PluginInstallPolicyRequest,
} from "./install-types.js";
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
const PLUGIN_ARCHIVE_ROOT_MARKERS = [
"package.json",
@ -112,7 +112,7 @@ async function installBundleFromSourceDir(
? runtime.getPackageManifestMetadata(packageManifestResult.manifest)
: undefined;
const compatibilityError = validateOpenClawPackageInstallCompatibility({
runtime,
currentHostVersion: runtime.resolveCompatibilityHostVersion(),
pluginId,
packageMetadata,
});

View file

@ -22,8 +22,7 @@ import {
type PluginInstallLogger,
type PluginInstallPolicyRequest,
} from "./install-types.js";
import { resolvePackageExtensionEntries, type OpenClawPackageManifest } from "./manifest.js";
import { satisfiesPluginApiRange, resolvePackagePluginApiRange } from "./package-compat.js";
import { resolvePackageExtensionEntries } from "./manifest.js";
import {
emitPluginAuditSecurityEvent,
emitPluginInstallSecurityEvent,
@ -38,10 +37,6 @@ export async function loadPluginInstallRuntime() {
}
export type PluginInstallRuntime = Awaited<ReturnType<typeof loadPluginInstallRuntime>>;
type PluginCompatibilityRuntime = Pick<
PluginInstallRuntime,
"checkMinHostVersion" | "resolveCompatibilityHostVersion"
>;
export const defaultLogger: PluginInstallLogger = {};
@ -51,57 +46,6 @@ export function formatUnresolvedOpenClawPeerLinkError(packageName: string): stri
const MISSING_EXTENSIONS_ERROR =
'package.json missing openclaw.extensions; update the plugin package to include openclaw.extensions (for example ["./dist/index.js"]). See https://docs.openclaw.ai/help/troubleshooting#plugin-install-fails-with-missing-openclaw-extensions';
export function validateOpenClawPackageInstallCompatibility(params: {
runtime: PluginCompatibilityRuntime;
pluginId: string;
packageMetadata?: OpenClawPackageManifest;
}): PluginInstallFailureResult | null {
const currentHostVersion = params.runtime.resolveCompatibilityHostVersion();
const minHostVersionCheck = params.runtime.checkMinHostVersion({
currentVersion: currentHostVersion,
minHostVersion: params.packageMetadata?.install?.minHostVersion,
});
if (!minHostVersionCheck.ok) {
if (minHostVersionCheck.kind === "invalid") {
return {
ok: false,
error: `invalid package.json openclaw.install.minHostVersion: ${minHostVersionCheck.error}`,
code: PLUGIN_INSTALL_ERROR_CODE.INVALID_MIN_HOST_VERSION,
};
}
if (minHostVersionCheck.kind === "unknown_host_version") {
return {
ok: false,
error: `plugin "${params.pluginId}" requires OpenClaw >=${minHostVersionCheck.requirement.minimumLabel}, but this host version could not be determined. Re-run from a released build or set OPENCLAW_VERSION and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.UNKNOWN_HOST_VERSION,
};
}
return {
ok: false,
error: `plugin "${params.pluginId}" requires OpenClaw >=${minHostVersionCheck.requirement.minimumLabel}, but this host is ${minHostVersionCheck.currentVersion}. Upgrade OpenClaw and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.INCOMPATIBLE_HOST_VERSION,
};
}
const pluginApiRangeCheck = resolvePackagePluginApiRange(params.packageMetadata);
if (!pluginApiRangeCheck.ok) {
return {
ok: false,
error: `invalid package.json openclaw.compat.pluginApi: ${pluginApiRangeCheck.error}`,
code: PLUGIN_INSTALL_ERROR_CODE.INVALID_PLUGIN_API,
};
}
const pluginApiRange = pluginApiRangeCheck.range;
if (pluginApiRange && !satisfiesPluginApiRange(currentHostVersion, pluginApiRange)) {
return {
ok: false,
error: `plugin "${params.pluginId}" requires plugin API ${pluginApiRange}, but this OpenClaw runtime exposes ${currentHostVersion}. Upgrade OpenClaw or install a compatible plugin version and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.INCOMPATIBLE_PLUGIN_API,
};
}
return null;
}
export async function readOptionalPackageManifest(params: {
runtime: PluginInstallRuntime;
packageDir: string;

View file

@ -26,5 +26,4 @@ export {
loadPluginManifest,
resolvePackageExtensionEntries,
} from "./manifest.js";
export { checkMinHostVersion } from "./min-host-version.js";
export { isPathInside } from "./path-safety.js";

View file

@ -1,6 +1,8 @@
import { isRecord } from "@openclaw/normalization-core/record-coerce";
import { normalizeStringEntries } from "@openclaw/normalization-core/string-normalization";
import { prerelease as parseSemverPrerelease, satisfies as satisfiesSemver } from "semver";
import { PLUGIN_INSTALL_ERROR_CODE, type PluginInstallFailureResult } from "./install-types.js";
import { checkMinHostVersion } from "./min-host-version.js";
function normalizePartialComparableVersion(version: string): {
version: string;
@ -101,3 +103,59 @@ export function satisfiesPluginApiRange(
}
return satisfiesSemverRange(pluginApiVersion, pluginApiRange);
}
export function validateOpenClawPackageInstallCompatibility(params: {
currentHostVersion: string;
pluginId: string;
packageMetadata?: unknown;
allowLegacyBareSemver?: boolean;
}): PluginInstallFailureResult | null {
const { currentHostVersion } = params;
const installMetadata = isRecord(params.packageMetadata)
? params.packageMetadata.install
: undefined;
const minHostVersionCheck = checkMinHostVersion({
currentVersion: currentHostVersion,
minHostVersion: isRecord(installMetadata) ? installMetadata.minHostVersion : undefined,
allowLegacyBareSemver: params.allowLegacyBareSemver,
});
if (!minHostVersionCheck.ok) {
if (minHostVersionCheck.kind === "invalid") {
return {
ok: false,
error: `invalid package.json openclaw.install.minHostVersion: ${minHostVersionCheck.error}`,
code: PLUGIN_INSTALL_ERROR_CODE.INVALID_MIN_HOST_VERSION,
};
}
if (minHostVersionCheck.kind === "unknown_host_version") {
return {
ok: false,
error: `plugin "${params.pluginId}" requires OpenClaw >=${minHostVersionCheck.requirement.minimumLabel}, but this host version could not be determined. Re-run from a released build or set OPENCLAW_VERSION and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.UNKNOWN_HOST_VERSION,
};
}
return {
ok: false,
error: `plugin "${params.pluginId}" requires OpenClaw >=${minHostVersionCheck.requirement.minimumLabel}, but this host is ${minHostVersionCheck.currentVersion}. Upgrade OpenClaw and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.INCOMPATIBLE_HOST_VERSION,
};
}
const pluginApiRangeCheck = resolvePackagePluginApiRange(params.packageMetadata);
if (!pluginApiRangeCheck.ok) {
return {
ok: false,
error: `invalid package.json openclaw.compat.pluginApi: ${pluginApiRangeCheck.error}`,
code: PLUGIN_INSTALL_ERROR_CODE.INVALID_PLUGIN_API,
};
}
const pluginApiRange = pluginApiRangeCheck.range;
if (pluginApiRange && !satisfiesPluginApiRange(currentHostVersion, pluginApiRange)) {
return {
ok: false,
error: `plugin "${params.pluginId}" requires plugin API ${pluginApiRange}, but this OpenClaw runtime exposes ${currentHostVersion}. Upgrade OpenClaw or install a compatible plugin version and retry.`,
code: PLUGIN_INSTALL_ERROR_CODE.INCOMPATIBLE_PLUGIN_API,
};
}
return null;
}

View file

@ -0,0 +1,83 @@
import fs from "node:fs";
import path from "node:path";
import { afterEach, expect, it, vi } from "vitest";
import { useAutoCleanupTempDirTracker } from "../../test/helpers/temp-dir.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { updateNpmInstalledPlugins } from "./update-installed.js";
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
vi.mock("../process/exec.js", async (importOriginal) => ({
...(await importOriginal<typeof import("../process/exec.js")>()),
runCommandWithTimeout: vi.fn(async () => ({
code: 1,
stdout: "",
stderr: "E404 No matching version",
})),
}));
it.each([
{ processVersion: "2026.9.2", coreVersion: "2026.9.4", retained: true },
{ processVersion: "2026.9.4", coreVersion: "2026.9.2", retained: false },
])(
"checks legacy retention against target $coreVersion rather than process $processVersion",
async ({ processVersion, coreVersion, retained }) => {
vi.stubEnv("OPENCLAW_COMPATIBILITY_HOST_VERSION", processVersion);
const installPath = tempDirs.make("plugin-compat-retention-");
const entry = "export default function register() {}\n";
fs.writeFileSync(path.join(installPath, "index.js"), entry);
fs.writeFileSync(
path.join(installPath, "package.json"),
JSON.stringify({
name: "@acme/demo",
version: "1.0.0",
openclaw: {
extensions: ["./index.js"],
install: { minHostVersion: "2026.9.3" },
compat: { pluginApi: ">=2026.9.3" },
},
}),
);
const config: OpenClawConfig = {
plugins: {
installs: {
demo: {
source: "npm",
spec: "@acme/demo@2.0.0",
installPath,
version: "1.0.0",
},
},
allow: ["demo"],
entries: { demo: { enabled: true, config: { preserved: true } } },
},
};
const warn = vi.fn();
const result = await updateNpmInstalledPlugins({
config,
pluginIds: ["demo"],
retainOnUnavailable: true,
syncOfficialPluginInstalls: true,
updateChannel: "stable",
coreVersion,
logger: { warn },
});
expect(result.outcomes).toEqual([
expect.objectContaining({
pluginId: "demo",
status: retained ? "unchanged" : "error",
code: retained ? "plugin-target-unavailable" : "npm_package_not_found",
}),
]);
if (retained) {
expect(result.outcomes[0]?.message).toContain(coreVersion);
expect(result.outcomes[0]?.message).toContain("openclaw plugins update demo");
expect(warn).toHaveBeenCalledWith(result.outcomes[0]?.message);
}
expect(result.config).toBe(config);
expect(result.changed).toBe(false);
expect(fs.readFileSync(path.join(installPath, "index.js"), "utf8")).toBe(entry);
},
);

View file

@ -9,6 +9,7 @@ import {
readInstalledPackageVersion,
} from "../infra/package-update-utils.js";
import { resolveUserPath } from "../utils.js";
import { resolveCompatibilityHostVersion } from "../version.js";
import {
resolveBundledPluginSources,
resolveSourceCheckoutBundledPluginIds,
@ -59,20 +60,16 @@ import {
type NpmPluginUpdateSuccess,
} from "./update-attempt.js";
import { preparePluginUpdateCapabilityConsent } from "./update-capability-consent.js";
import {
hasRunnableInstalledNpmPayload,
migratePluginConfigId,
resolveRecordedExtensionsDir,
} from "./update-config.js";
import { migratePluginConfigId, resolveRecordedExtensionsDir } from "./update-config.js";
import {
reconcileDuplicateNpmPluginAliases,
stageDuplicateNpmPluginAlias,
} from "./update-duplicate-aliases.js";
import { prepareNpmPluginUpdateMetadata } from "./update-npm-metadata.js";
import { canRetainInstalledNpmPayload } from "./update-retention.js";
import {
createStablePluginUpdateVersionPolicy,
expectedIntegrityForNpmUpdate,
isNpmMetadataCompatibleWithCurrentHost,
isPluginInstallRecordUpdateSource,
resolveClawHubNpmUpdateFallback,
resolveClawHubUpdateSpecs,
@ -382,17 +379,12 @@ async function runInstalledPluginUpdate(
!params.dryRun &&
currentVersion
) {
const compatible = isNpmMetadataCompatibleWithCurrentHost(
{ packageOpenClaw: installedManifest?.openclaw },
{ hostVersion: params.coreVersion, allowLegacyBareSemver: true },
);
try {
installedPayloadRunnable =
compatible &&
(await hasRunnableInstalledNpmPayload({ installPath, manifest: installedManifest }));
} catch {
// Damaged or unreadable payloads do not qualify for retention.
}
installedPayloadRunnable = await canRetainInstalledNpmPayload({
currentHostVersion: params.coreVersion ?? resolveCompatibilityHostVersion(),
pluginId,
installPath,
manifest: installedManifest,
});
}
if (retainOnUnavailable && installedPayloadRunnable) {
const retainedMessage =

View file

@ -1,9 +1,10 @@
import type { PluginInstallRecord } from "../config/types.plugins.js";
import { parseRegistryNpmSpec, type NpmSpecResolution } from "../infra/npm-registry-spec.js";
import { resolveCompatibilityHostVersion } from "../version.js";
import { resolveTrustedOfficialPrereleaseResolution } from "./install-npm-metadata.js";
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
import {
expectedIntegrityForNpmUpdate,
isNpmMetadataCompatibleWithCurrentHost,
shouldBypassTrustedOfficialUnchangedNpmCheck,
} from "./update-source.js";
@ -38,9 +39,14 @@ export async function prepareNpmPluginUpdateMetadata(params: {
record: params.record,
trustedSourceLinkedOfficialInstall: params.trustedSourceLinkedOfficialInstall,
});
const currentHostVersion = resolveCompatibilityHostVersion();
if (
!params.catalogExpectedIntegrity &&
(!isNpmMetadataCompatibleWithCurrentHost(expectedIntegrityMetadata) ||
(validateOpenClawPackageInstallCompatibility({
currentHostVersion,
pluginId: expectedIntegrityMetadata.name ?? params.spec,
packageMetadata: expectedIntegrityMetadata.packageOpenClaw,
}) !== null ||
(bypassUnchanged && !trustedPrereleaseResolution))
) {
expectedIntegrity = undefined;
@ -52,6 +58,12 @@ export async function prepareNpmPluginUpdateMetadata(params: {
...(trustedPrereleaseResolution ? { trustedPrereleaseResolution } : {}),
},
expectedIntegrity,
unchangedEligible: !bypassUnchanged && isNpmMetadataCompatibleWithCurrentHost(params.metadata),
unchangedEligible:
!bypassUnchanged &&
validateOpenClawPackageInstallCompatibility({
currentHostVersion,
pluginId: params.metadata.name ?? params.spec,
packageMetadata: params.metadata.packageOpenClaw,
}) === null,
};
}

View file

@ -0,0 +1,28 @@
import type { PackageManifest } from "./manifest.js";
import { validateOpenClawPackageInstallCompatibility } from "./package-compat.js";
import { hasRunnableInstalledNpmPayload } from "./update-config.js";
export async function canRetainInstalledNpmPayload(params: {
currentHostVersion: string;
pluginId: string;
installPath: string;
manifest: PackageManifest | undefined;
}): Promise<boolean> {
// Existing installations may declare historical bare host floors.
if (
validateOpenClawPackageInstallCompatibility({
currentHostVersion: params.currentHostVersion,
pluginId: params.pluginId,
packageMetadata: params.manifest?.openclaw,
allowLegacyBareSemver: true,
}) !== null
) {
return false;
}
try {
return await hasRunnableInstalledNpmPayload(params);
} catch {
// Damaged or unreadable payloads do not qualify for retention.
return false;
}
}

View file

@ -1,4 +1,3 @@
import { isRecord } from "@openclaw/normalization-core/record-coerce";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { PluginInstallRecord } from "../config/types.plugins.js";
import type { ClawHubTrustErrorCode } from "../infra/clawhub-install-trust.js";
@ -35,13 +34,11 @@ import {
import type { InstallSafetyOverrides } from "./install-security-scan.types.js";
import type { PluginInstallArtifactConsentHandler } from "./install-types.js";
import type { OperatorManagedPluginUpdate } from "./installed-plugin-package-ownership.js";
import { checkMinHostVersion } from "./min-host-version.js";
import * as officialInstallRecords from "./official-external-install-records.js";
import {
getOfficialExternalPluginCatalogEntry,
resolveOfficialExternalPluginInstall,
} from "./official-external-plugin-catalog.js";
import { satisfiesPluginApiRange, resolvePackagePluginApiRange } from "./package-compat.js";
/** Logger surface used by plugin update flows. */
export type PluginUpdateLogger = {
@ -393,31 +390,6 @@ export async function resolveNewerExactPinnedClawHubDefaultLine(params: {
return { packageName: parsed.name, registryLine, version };
}
export function isNpmMetadataCompatibleWithCurrentHost(
metadata: NpmSpecResolution,
options: { hostVersion?: string; allowLegacyBareSemver?: boolean } = {},
): boolean {
const hostVersion = options.hostVersion ?? resolveCompatibilityHostVersion();
const installMetadata = metadata.packageOpenClaw?.install;
const minHostVersionCheck = checkMinHostVersion({
currentVersion: hostVersion,
minHostVersion: isRecord(installMetadata) ? installMetadata.minHostVersion : undefined,
allowLegacyBareSemver: options.allowLegacyBareSemver,
});
if (!minHostVersionCheck.ok) {
return false;
}
const pluginApiRangeCheck = resolvePackagePluginApiRange(metadata.packageOpenClaw);
if (!pluginApiRangeCheck.ok) {
return false;
}
const pluginApiRange = pluginApiRangeCheck.range;
if (!pluginApiRange) {
return true;
}
return satisfiesPluginApiRange(hostVersion, pluginApiRange);
}
export function formatChannelFallbackOutcomeSuffix(params: {
fallbackLabel: string | undefined;
fallbackSpec: string | undefined;

View file

@ -4,10 +4,9 @@ import { afterEach, expect, it } from "vitest";
import { syncPluginVersions } from "../../scripts/sync-plugin-versions.js";
import { useAutoCleanupTempDirTracker } from "../../test/helpers/temp-dir.js";
import { shouldSkipIncompatiblePackagePluginApi } from "../plugins/discovery-availability.js";
import { validateOpenClawPackageInstallCompatibility } from "../plugins/install-shared.js";
import { PLUGIN_INSTALL_ERROR_CODE } from "../plugins/install-types.js";
import type { PluginDiagnostic } from "../plugins/manifest-types.js";
import { checkMinHostVersion } from "../plugins/min-host-version.js";
import { validateOpenClawPackageInstallCompatibility } from "../plugins/package-compat.js";
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
@ -39,7 +38,7 @@ it("release-aligns the actual Nextcloud manifest before plugin-first publication
for (const hostVersion of [oldHostVersion, releaseVersion]) {
const compatible = hostVersion === releaseVersion;
const result = validateOpenClawPackageInstallCompatibility({
runtime: { checkMinHostVersion, resolveCompatibilityHostVersion: () => hostVersion },
currentHostVersion: hostVersion,
pluginId: "nextcloud-talk",
packageMetadata: aligned.openclaw,
});