mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:52:25 +00:00
fix: normalize bundled plugin version reporting
This commit is contained in:
@@ -81,6 +81,63 @@ describe("buildPluginStatusReport", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizes bundled plugin versions to the core base release", () => {
|
||||
loadOpenClawPluginsMock.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "whatsapp",
|
||||
name: "WhatsApp",
|
||||
description: "Bundled channel plugin",
|
||||
version: "2026.3.22",
|
||||
source: "/tmp/whatsapp/index.ts",
|
||||
origin: "bundled",
|
||||
enabled: true,
|
||||
status: "loaded",
|
||||
toolNames: [],
|
||||
hookNames: [],
|
||||
channelIds: ["whatsapp"],
|
||||
providerIds: [],
|
||||
speechProviderIds: [],
|
||||
mediaUnderstandingProviderIds: [],
|
||||
imageGenerationProviderIds: [],
|
||||
webSearchProviderIds: [],
|
||||
gatewayMethods: [],
|
||||
cliCommands: [],
|
||||
services: [],
|
||||
commands: [],
|
||||
httpRoutes: 0,
|
||||
hookCount: 0,
|
||||
configSchema: false,
|
||||
},
|
||||
],
|
||||
diagnostics: [],
|
||||
channels: [],
|
||||
providers: [],
|
||||
speechProviders: [],
|
||||
mediaUnderstandingProviders: [],
|
||||
imageGenerationProviders: [],
|
||||
webSearchProviders: [],
|
||||
tools: [],
|
||||
hooks: [],
|
||||
typedHooks: [],
|
||||
channelSetups: [],
|
||||
httpRoutes: [],
|
||||
gatewayHandlers: {},
|
||||
cliRegistrars: [],
|
||||
services: [],
|
||||
commands: [],
|
||||
});
|
||||
|
||||
const report = buildPluginStatusReport({
|
||||
config: {},
|
||||
env: {
|
||||
OPENCLAW_VERSION: "2026.3.23-1",
|
||||
} as NodeJS.ProcessEnv,
|
||||
});
|
||||
|
||||
expect(report.plugins[0]?.version).toBe("2026.3.23");
|
||||
});
|
||||
|
||||
it("builds an inspect report with capability shape and policy", () => {
|
||||
loadConfigMock.mockReturnValue({
|
||||
plugins: {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import { resolveDefaultAgentWorkspaceDir } from "../agents/workspace.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { normalizeOpenClawVersionBase } from "../config/version.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { resolveRuntimeServiceVersion } from "../version.js";
|
||||
import { inspectBundleLspRuntimeSupport } from "./bundle-lsp.js";
|
||||
import { inspectBundleMcpRuntimeSupport } from "./bundle-mcp.js";
|
||||
import { normalizePluginsConfig } from "./config-state.js";
|
||||
@@ -114,6 +116,20 @@ function buildCompatibilityNoticesForInspect(
|
||||
|
||||
const log = createSubsystemLogger("plugins");
|
||||
|
||||
function resolveReportedPluginVersion(
|
||||
plugin: PluginRegistry["plugins"][number],
|
||||
env: NodeJS.ProcessEnv | undefined,
|
||||
): string | undefined {
|
||||
if (plugin.origin !== "bundled") {
|
||||
return plugin.version;
|
||||
}
|
||||
return (
|
||||
normalizeOpenClawVersionBase(resolveRuntimeServiceVersion(env)) ??
|
||||
normalizeOpenClawVersionBase(plugin.version) ??
|
||||
plugin.version
|
||||
);
|
||||
}
|
||||
|
||||
export function buildPluginStatusReport(params?: {
|
||||
config?: ReturnType<typeof loadConfig>;
|
||||
workspaceDir?: string;
|
||||
@@ -136,6 +152,10 @@ export function buildPluginStatusReport(params?: {
|
||||
return {
|
||||
workspaceDir,
|
||||
...registry,
|
||||
plugins: registry.plugins.map((plugin) => ({
|
||||
...plugin,
|
||||
version: resolveReportedPluginVersion(plugin, params?.env),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user