mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(plugins): repair status and CLI fixtures (#122925)
This commit is contained in:
@@ -34,7 +34,12 @@ vi.mock("../config/plugin-auto-enable.js", () => ({
|
||||
applyPluginAutoEnable: (...args: unknown[]) => mocks.applyPluginAutoEnable(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../config/io.plugin-metadata.js", () => ({
|
||||
resolveConfigWidePluginManifestRegistry: () => ({ plugins: [], diagnostics: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("./plugin-metadata-snapshot.js", () => ({
|
||||
rebasePluginMetadataSnapshotManifestRegistry: <T>(snapshot: T) => snapshot,
|
||||
resolvePluginMetadataSnapshot: (...args: unknown[]) =>
|
||||
mocks.resolvePluginMetadataSnapshot(...args),
|
||||
}));
|
||||
|
||||
@@ -7,6 +7,23 @@ import type { PluginHookName } from "./types.js";
|
||||
|
||||
export { createPluginRecord };
|
||||
|
||||
export function createInstalledPluginIndexSnapshot(
|
||||
plugins: Array<Record<string, unknown>>,
|
||||
): Record<string, unknown> {
|
||||
return {
|
||||
version: 1,
|
||||
warning: "test",
|
||||
hostContractVersion: "test",
|
||||
compatRegistryVersion: "test",
|
||||
migrationVersion: 1,
|
||||
policyHash: "test",
|
||||
generatedAtMs: 0,
|
||||
installRecords: {},
|
||||
plugins,
|
||||
diagnostics: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const HOOK_ONLY_MESSAGE =
|
||||
"is hook-only. This remains a supported compatibility path, but it has not migrated to explicit capability registration yet.";
|
||||
export const DEPRECATED_MEMORY_EMBEDDING_PROVIDER_API_MESSAGE =
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { PluginMemoryEmbeddingProviderRegistration } from "./registry.test-
|
||||
import {
|
||||
createCompatibilityNotice,
|
||||
createCustomHook,
|
||||
createInstalledPluginIndexSnapshot,
|
||||
createPluginLoadResult,
|
||||
createPluginRecord,
|
||||
DEPRECATED_MEMORY_EMBEDDING_PROVIDER_API_MESSAGE,
|
||||
@@ -58,6 +59,10 @@ vi.mock("../config/config.js", () => ({
|
||||
loadConfig: () => loadConfigMock(),
|
||||
}));
|
||||
|
||||
vi.mock("../config/io.plugin-metadata.js", () => ({
|
||||
resolveConfigWidePluginManifestRegistry: () => ({ plugins: [], diagnostics: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("../config/plugin-auto-enable.js", () => ({
|
||||
applyPluginAutoEnable: (...args: unknown[]) => applyPluginAutoEnableMock(...args),
|
||||
}));
|
||||
@@ -91,6 +96,7 @@ vi.mock("./manifest-registry-installed.js", () => ({
|
||||
vi.mock("./plugin-metadata-snapshot.js", () => ({
|
||||
isPluginMetadataSnapshotCompatible: isPluginMetadataSnapshotCompatibleMock,
|
||||
loadPluginMetadataSnapshot: (params?: unknown) => loadPluginMetadataSnapshotMock(params),
|
||||
rebasePluginMetadataSnapshotManifestRegistry: <T>(snapshot: T) => snapshot,
|
||||
resolvePluginMetadataSnapshot: (params?: { pluginMetadataSnapshot?: unknown }) =>
|
||||
params?.pluginMetadataSnapshot ?? loadPluginMetadataSnapshotMock(params),
|
||||
}));
|
||||
@@ -118,6 +124,7 @@ vi.mock("./runtime.js", () => ({
|
||||
vi.mock("../agents/agent-scope.js", () => ({
|
||||
resolveAgentWorkspaceDir: () => undefined,
|
||||
resolveDefaultAgentId: () => "default",
|
||||
tryResolveConfiguredAgentWorkspaceDir: () => undefined,
|
||||
}));
|
||||
|
||||
vi.mock("../agents/workspace.js", () => ({
|
||||
@@ -143,23 +150,6 @@ function setSinglePluginLoadResult(
|
||||
});
|
||||
}
|
||||
|
||||
function createInstalledPluginIndexSnapshot(
|
||||
plugins: Array<Record<string, unknown>>,
|
||||
): Record<string, unknown> {
|
||||
return {
|
||||
version: 1,
|
||||
warning: "test",
|
||||
hostContractVersion: "test",
|
||||
compatRegistryVersion: "test",
|
||||
migrationVersion: 1,
|
||||
policyHash: "test",
|
||||
generatedAtMs: 0,
|
||||
installRecords: {},
|
||||
plugins,
|
||||
diagnostics: [],
|
||||
};
|
||||
}
|
||||
|
||||
function expectInspectReport(
|
||||
pluginId: string,
|
||||
options: Omit<Parameters<typeof buildPluginInspectReport>[0], "id"> = {},
|
||||
|
||||
Reference in New Issue
Block a user