mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:40:44 +00:00
fix(plugins): scope capability provider snapshots
This commit is contained in:
@@ -101,6 +101,7 @@ function expectBundledCompatLoadPath(params: {
|
||||
});
|
||||
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
|
||||
config: params.enablementCompat,
|
||||
onlyPluginIds: ["openai"],
|
||||
activate: false,
|
||||
});
|
||||
}
|
||||
@@ -400,6 +401,7 @@ describe("resolvePluginCapabilityProviders", () => {
|
||||
allow: ["openai", "microsoft"],
|
||||
}),
|
||||
}),
|
||||
onlyPluginIds: ["microsoft"],
|
||||
activate: false,
|
||||
});
|
||||
});
|
||||
@@ -573,6 +575,7 @@ describe("resolvePluginCapabilityProviders", () => {
|
||||
expectNoResolvedCapabilityProviders(providers);
|
||||
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
|
||||
config: expect.anything(),
|
||||
onlyPluginIds: [],
|
||||
activate: false,
|
||||
});
|
||||
});
|
||||
@@ -600,7 +603,16 @@ describe("resolvePluginCapabilityProviders", () => {
|
||||
nativeDocumentInputs: ["pdf"],
|
||||
},
|
||||
} as never);
|
||||
setBundledCapabilityFixture("mediaUnderstandingProviders");
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "google",
|
||||
origin: "bundled",
|
||||
contracts: { mediaUnderstandingProviders: ["google"] },
|
||||
},
|
||||
] as never,
|
||||
diagnostics: [],
|
||||
});
|
||||
mocks.withBundledPluginEnablementCompat.mockReturnValue(compatConfig);
|
||||
mocks.withBundledPluginVitestCompat.mockReturnValue(compatConfig);
|
||||
mocks.resolveRuntimePluginRegistry.mockImplementation((params?: unknown) =>
|
||||
@@ -616,6 +628,7 @@ describe("resolvePluginCapabilityProviders", () => {
|
||||
});
|
||||
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
|
||||
config: compatConfig,
|
||||
onlyPluginIds: ["google"],
|
||||
activate: false,
|
||||
});
|
||||
});
|
||||
@@ -681,6 +694,7 @@ describe("resolvePluginCapabilityProviders", () => {
|
||||
});
|
||||
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
|
||||
config: enablementCompat,
|
||||
onlyPluginIds: ["google"],
|
||||
activate: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -226,7 +226,9 @@ export function resolvePluginCapabilityProvider<K extends CapabilityProviderRegi
|
||||
pluginIds,
|
||||
});
|
||||
const loadOptions =
|
||||
compatConfig === undefined ? undefined : { config: compatConfig, activate: false };
|
||||
compatConfig === undefined
|
||||
? { onlyPluginIds: pluginIds, activate: false }
|
||||
: { config: compatConfig, onlyPluginIds: pluginIds, activate: false };
|
||||
const registry = resolveRuntimePluginRegistry(loadOptions);
|
||||
return findProviderById(registry?.[params.key] ?? [], params.providerId);
|
||||
}
|
||||
@@ -258,9 +260,19 @@ export function resolvePluginCapabilityProviders<K extends CapabilityProviderReg
|
||||
return activeProviders.map((entry) => entry.provider) as CapabilityProviderForKey<K>[];
|
||||
}
|
||||
}
|
||||
const compatConfig = resolveCapabilityProviderConfig({ key: params.key, cfg: params.cfg });
|
||||
const pluginIds = resolveBundledCapabilityCompatPluginIds({
|
||||
key: params.key,
|
||||
cfg: params.cfg,
|
||||
});
|
||||
const compatConfig = resolveCapabilityProviderConfig({
|
||||
key: params.key,
|
||||
cfg: params.cfg,
|
||||
pluginIds,
|
||||
});
|
||||
const loadOptions =
|
||||
compatConfig === undefined ? undefined : { config: compatConfig, activate: false };
|
||||
compatConfig === undefined
|
||||
? { onlyPluginIds: pluginIds, activate: false }
|
||||
: { config: compatConfig, onlyPluginIds: pluginIds, activate: false };
|
||||
const registry = resolveRuntimePluginRegistry(loadOptions);
|
||||
const loadedProviders = registry?.[params.key] ?? [];
|
||||
if (params.key !== "memoryEmbeddingProviders") {
|
||||
|
||||
Reference in New Issue
Block a user