@@ -38,6 +38,25 @@ const { loadBundledPluginPublicArtifactModuleSyncMock } = vi.hoisted(() => {
|
38 | 38 | }), |
39 | 39 | }; |
40 | 40 | } |
| 41 | +if (dirName === "mockplugin" && artifactBasename === "web-search-contract-api.js") { |
| 42 | +return { |
| 43 | +createFuzzpluginWebSearchProvider: () => { |
| 44 | +throw new Error("fuzzplugin web provider factory failed"); |
| 45 | +}, |
| 46 | +createMockpluginWebSearchProvider: () => ({ |
| 47 | + ...providerBase, |
| 48 | +id: "mockplugin", |
| 49 | +createTool: () => null, |
| 50 | +}), |
| 51 | +}; |
| 52 | +} |
| 53 | +if (dirName === "fuzzplugin" && artifactBasename === "web-search-contract-api.js") { |
| 54 | +return { |
| 55 | +createFuzzpluginWebSearchProvider: () => { |
| 56 | +throw new Error("fuzzplugin web provider factory failed"); |
| 57 | +}, |
| 58 | +}; |
| 59 | +} |
41 | 60 | if (dirName === "firecrawl" && artifactBasename === "web-fetch-contract-api.js") { |
42 | 61 | return { |
43 | 62 | createFirecrawlWebFetchProvider: () => ({ |
@@ -108,6 +127,37 @@ describe("web provider public artifacts explicit fast path", () => {
|
108 | 127 | expect(loadPluginManifestRegistryMock).not.toHaveBeenCalled(); |
109 | 128 | }); |
110 | 129 | |
| 130 | +it("skips throwing bundled web provider factories while preserving healthy siblings", () => { |
| 131 | +const provider = expectSingleProvider( |
| 132 | +resolveBundledWebSearchProvidersFromPublicArtifacts({ |
| 133 | +onlyPluginIds: ["mockplugin"], |
| 134 | +}), |
| 135 | +); |
| 136 | + |
| 137 | +expect(provider.pluginId).toBe("mockplugin"); |
| 138 | +expect(provider.id).toBe("mockplugin"); |
| 139 | +expect(provider.createTool({ config: {} as never })).toBeNull(); |
| 140 | +expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
| 141 | +dirName: "mockplugin", |
| 142 | +artifactBasename: "web-search-contract-api.js", |
| 143 | +}); |
| 144 | +expect(loadPluginManifestRegistryMock).not.toHaveBeenCalled(); |
| 145 | +}); |
| 146 | + |
| 147 | +it("throws when every matching bundled web provider factory fails", () => { |
| 148 | +expect(() => |
| 149 | +resolveBundledWebSearchProvidersFromPublicArtifacts({ |
| 150 | +onlyPluginIds: ["fuzzplugin"], |
| 151 | +}), |
| 152 | +).toThrow("Unable to initialize web providers for plugin fuzzplugin"); |
| 153 | + |
| 154 | +expect(loadBundledPluginPublicArtifactModuleSyncMock).toHaveBeenCalledWith({ |
| 155 | +dirName: "fuzzplugin", |
| 156 | +artifactBasename: "web-search-contract-api.js", |
| 157 | +}); |
| 158 | +expect(loadPluginManifestRegistryMock).not.toHaveBeenCalled(); |
| 159 | +}); |
| 160 | + |
111 | 161 | it("resolves bundled runtime web search providers by explicit plugin id", () => { |
112 | 162 | const provider = expectSingleProvider( |
113 | 163 | resolveExplicitRuntimeWebSearchProviders({ |
|