

























@@ -477,6 +477,62 @@ describe("resolvePluginCapabilityProviders", () => {
477477expect(mocks.loadBundledCapabilityRuntimeRegistry).not.toHaveBeenCalled();
478478});
479479480+it("merges enabled generation providers missing from the active registry", () => {
481+const active = createEmptyPluginRegistry();
482+active.imageGenerationProviders.push({
483+pluginId: "xai",
484+pluginName: "xai",
485+source: "test",
486+provider: {
487+id: "xai",
488+defaultModel: "grok-2-image",
489+models: ["grok-2-image"],
490+isConfigured: () => true,
491+generateImage: async () => ({ images: [] }),
492+},
493+} as never);
494+const loaded = createEmptyPluginRegistry();
495+loaded.imageGenerationProviders.push({
496+pluginId: "fal",
497+pluginName: "fal",
498+source: "test",
499+provider: {
500+id: "fal",
501+defaultModel: "fal-ai/flux/dev",
502+models: ["fal-ai/flux/dev"],
503+isConfigured: () => true,
504+generateImage: async () => ({ images: [] }),
505+},
506+} as never);
507+mocks.loadPluginManifestRegistry.mockReturnValue({
508+plugins: [
509+{
510+id: "fal",
511+origin: "bundled",
512+contracts: { imageGenerationProviders: ["fal"] },
513+},
514+{
515+id: "xai",
516+origin: "bundled",
517+contracts: { imageGenerationProviders: ["xai"] },
518+},
519+] as never,
520+diagnostics: [],
521+});
522+mocks.resolveRuntimePluginRegistry.mockImplementation((params?: unknown) =>
523+params === undefined ? active : loaded,
524+);
525+526+const providers = resolvePluginCapabilityProviders({
527+key: "imageGenerationProviders",
528+cfg: { plugins: { allow: ["fal", "xai"] } } as OpenClawConfig,
529+});
530+531+expectResolvedCapabilityProviderIds(providers, ["xai", "fal"]);
532+expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith();
533+expectActiveRegistryLookup(["fal", "xai"]);
534+});
535+480536it("cold-loads enabled external manifest-contract providers missing from startup registry", () => {
481537const loaded = createEmptyPluginRegistry();
482538loaded.speechProviders.push({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。