mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 20:20:22 +00:00
refactor: clean up ClawHub compatibility validation
This commit is contained in:
@@ -77,6 +77,8 @@ describe("clawhub helpers", () => {
|
||||
expect(satisfiesPluginApiRange("1.9.0", ">=1.2.0 <2.0.0")).toBe(true);
|
||||
expect(satisfiesPluginApiRange("2.0.0", "^1.2.0")).toBe(false);
|
||||
expect(satisfiesPluginApiRange("1.1.9", ">=1.2.0")).toBe(false);
|
||||
expect(satisfiesPluginApiRange("2026.3.22", ">=2026.3.22")).toBe(true);
|
||||
expect(satisfiesPluginApiRange("2026.3.21", ">=2026.3.22")).toBe(false);
|
||||
expect(satisfiesPluginApiRange("invalid", "^1.2.0")).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ const DEFAULT_FETCH_TIMEOUT_MS = 30_000;
|
||||
|
||||
export type ClawHubPackageFamily = "skill" | "code-plugin" | "bundle-plugin";
|
||||
export type ClawHubPackageChannel = "official" | "community" | "private";
|
||||
export type ClawHubPackageCompatibility = {
|
||||
pluginApiRange?: string;
|
||||
builtWithOpenClawVersion?: string;
|
||||
minGatewayVersion?: string;
|
||||
};
|
||||
|
||||
export type ClawHubPackageListItem = {
|
||||
name: string;
|
||||
@@ -31,11 +36,7 @@ export type ClawHubPackageDetail = {
|
||||
package:
|
||||
| (ClawHubPackageListItem & {
|
||||
tags?: Record<string, string>;
|
||||
compatibility?: {
|
||||
pluginApiRange?: string;
|
||||
builtWithOpenClawVersion?: string;
|
||||
minGatewayVersion?: string;
|
||||
} | null;
|
||||
compatibility?: ClawHubPackageCompatibility | null;
|
||||
capabilities?: {
|
||||
executesCode?: boolean;
|
||||
runtimeId?: string;
|
||||
@@ -78,11 +79,7 @@ export type ClawHubPackageVersion = {
|
||||
changelog: string;
|
||||
distTags?: string[];
|
||||
files?: unknown;
|
||||
compatibility?: ClawHubPackageDetail["package"] extends infer T
|
||||
? T extends { compatibility?: infer C }
|
||||
? C
|
||||
: never
|
||||
: never;
|
||||
compatibility?: ClawHubPackageCompatibility | null;
|
||||
capabilities?: ClawHubPackageDetail["package"] extends infer T
|
||||
? T extends { capabilities?: infer C }
|
||||
? C
|
||||
|
||||
Reference in New Issue
Block a user