mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 03:45:46 -06:00
fix provider static model fallback (#92293)
This commit is contained in:
@@ -691,6 +691,25 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => {
|
||||
expect(mocks.resolvePluginProviders).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("can omit manifest model catalogs from static discovery entries", () => {
|
||||
mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["openai"]);
|
||||
mocks.loadPluginMetadataSnapshot.mockReturnValue({
|
||||
index: { plugins: [] },
|
||||
manifestRegistry: {
|
||||
plugins: [createManifestPluginWithModelCatalog("openai")],
|
||||
diagnostics: [],
|
||||
},
|
||||
});
|
||||
|
||||
const providers = resolvePluginDiscoveryProvidersRuntime({
|
||||
discoveryEntriesOnly: true,
|
||||
includeManifestModelCatalogProviders: false,
|
||||
});
|
||||
|
||||
expect(providers).toStrictEqual([]);
|
||||
expect(mocks.resolvePluginProviders).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("defaults missing manifest model costs for static discovery entries", async () => {
|
||||
mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["anthropic"]);
|
||||
mocks.loadPluginMetadataSnapshot.mockReturnValue({
|
||||
|
||||
@@ -274,6 +274,7 @@ function resolveProviderDiscoveryEntryPlugins(params: {
|
||||
includeUntrustedWorkspacePlugins?: boolean;
|
||||
requireCompleteDiscoveryEntryCoverage?: boolean;
|
||||
discoveryEntriesOnly?: boolean;
|
||||
includeManifestModelCatalogProviders?: boolean;
|
||||
pluginMetadataSnapshot?: PluginMetadataRegistryView;
|
||||
}): ProviderDiscoveryEntryResult {
|
||||
const metadataSnapshot =
|
||||
@@ -295,7 +296,10 @@ function resolveProviderDiscoveryEntryPlugins(params: {
|
||||
const runtimeManifestCatalogPluginIds = resolveRuntimeManifestCatalogPluginIds(pluginRecords);
|
||||
const entryRecords = pluginRecords.filter((plugin) => plugin.providerDiscoverySource);
|
||||
const entryPluginIds = new Set(entryRecords.map((plugin) => plugin.id));
|
||||
const manifestProviders = resolveManifestModelCatalogProviders(pluginRecords);
|
||||
const manifestProviders =
|
||||
params.includeManifestModelCatalogProviders === false
|
||||
? []
|
||||
: resolveManifestModelCatalogProviders(pluginRecords);
|
||||
const manifestEntryPluginIds = new Set<string>();
|
||||
for (const pluginId of manifestProviders.map((provider) => provider.pluginId)) {
|
||||
if (pluginId) {
|
||||
@@ -427,6 +431,7 @@ export function resolvePluginDiscoveryProvidersRuntime(params: {
|
||||
includeUntrustedWorkspacePlugins?: boolean;
|
||||
requireCompleteDiscoveryEntryCoverage?: boolean;
|
||||
discoveryEntriesOnly?: boolean;
|
||||
includeManifestModelCatalogProviders?: boolean;
|
||||
pluginMetadataSnapshot?: PluginMetadataRegistryView;
|
||||
}): ProviderPlugin[] {
|
||||
const env = params.env ?? process.env;
|
||||
|
||||
@@ -46,6 +46,7 @@ export type ResolveRuntimePluginDiscoveryProvidersParams = {
|
||||
includeUntrustedWorkspacePlugins?: boolean;
|
||||
requireCompleteDiscoveryEntryCoverage?: boolean;
|
||||
discoveryEntriesOnly?: boolean;
|
||||
includeManifestModelCatalogProviders?: boolean;
|
||||
pluginMetadataSnapshot?: PluginMetadataRegistryView;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user