mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(plugins): move plugin contributions into the registry bundle (#117372)
* refactor(plugins): move plugin contributions into the registry bundle * fix(plugins): guard embedding owner union and drop unused test-util imports * fix(plugins): break registry facade import cycles * fix(plugins): remove obsolete registry snapshot seams * test(gateway): preserve plugin runtime mock exports * test(auto-reply): install builder registry in diagnostics fixture * test(plugins): activate registry-backed capability fixtures
This commit is contained in:
committed by
GitHub
parent
339b8270bb
commit
e4d1b7e0d3
@@ -9,9 +9,12 @@ import {
|
||||
import {
|
||||
clearEmbeddingProviders,
|
||||
clearMemoryEmbeddingProviders,
|
||||
createEmptyPluginRegistry,
|
||||
getActivePluginRegistry,
|
||||
getRegisteredEmbeddingProvider,
|
||||
setActivePluginRegistry,
|
||||
} from "openclaw/plugin-sdk/plugin-test-runtime";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const memoryHostEmbeddingMocks = vi.hoisted(() => ({
|
||||
createLocalEmbeddingProvider: vi.fn(),
|
||||
@@ -32,6 +35,11 @@ type MemoryCreateTestOptions = AdapterCreateOptions & {
|
||||
fallback?: "none";
|
||||
outputDimensionality?: number;
|
||||
};
|
||||
let previousPluginRegistry: ReturnType<typeof getActivePluginRegistry>;
|
||||
|
||||
beforeEach(() => {
|
||||
previousPluginRegistry = getActivePluginRegistry();
|
||||
});
|
||||
|
||||
async function createLlamaCppMemoryEmbeddingProvider(options: MemoryCreateTestOptions) {
|
||||
const { fallback: _fallback, outputDimensionality, ...adapterOptions } = options;
|
||||
@@ -44,6 +52,7 @@ async function createLlamaCppMemoryEmbeddingProvider(options: MemoryCreateTestOp
|
||||
afterEach(() => {
|
||||
clearEmbeddingProviders();
|
||||
clearMemoryEmbeddingProviders();
|
||||
setActivePluginRegistry(previousPluginRegistry ?? createEmptyPluginRegistry());
|
||||
memoryHostEmbeddingMocks.createLocalEmbeddingProvider.mockReset();
|
||||
});
|
||||
|
||||
@@ -88,6 +97,7 @@ describe("llama.cpp provider plugin", () => {
|
||||
},
|
||||
register: llamaCppPlugin.register,
|
||||
});
|
||||
setActivePluginRegistry(registry.registry);
|
||||
|
||||
const provider = getRegisteredEmbeddingProvider("local");
|
||||
expect(provider?.ownerPluginId).toBe("llama-cpp");
|
||||
|
||||
Reference in New Issue
Block a user