feat(FN-2993): merge fusion/fn-2993

Commits merged:
- fix(FN-2993): resolve lint and build verification issues
- fix(FN-2993): address provider registry review feedback
- feat(FN-2993): complete Step 7 — add provider registry
- feat(FN-2993): complete Step 6 — add LLM synthesis provider
- feat(FN-2993): complete Step 5 — add local docs provider
- feat(FN-2993): complete Step 4 — add GitHub provider
- fix(FN-2993): align provider config types with step runner contract
- fix(FN-2993): resolve page fetch test module ordering
- test(FN-2993): expand page fetch coverage for timeout and truncation
- feat(FN-2993): complete Step 3 — add page fetch provider
- fix(FN-2993): align web search provider interface and abort assertions
- feat(FN-2993): complete Step 2 — add web search provider
- feat(FN-2993): complete Step 1 — define provider types and settings fields

Files changed:
packages/core/src/index.ts                         |   2 +-
 packages/core/src/settings-schema.ts               |  11 +
 packages/core/src/types.ts                         |  25 ++
 .../app/components/CustomProvidersSection.tsx      |   1 -
 packages/engine/src/index.ts                       |  19 ++
 .../research/__tests__/provider-registry.test.ts   |  49 +++
 packages/engine/src/research/provider-registry.ts  | 110 +++++++
 .../providers/__tests__/github-provider.test.ts    | 143 +++++++++
 .../__tests__/llm-synthesis-provider.test.ts       | 107 +++++++
 .../__tests__/local-docs-provider.test.ts          |  79 +++++
 .../__tests__/page-fetch-provider.test.ts          |  92 ++++++
 .../__tests__/web-search-provider.test.ts          | 101 +++++++
 .../src/research/providers/github-provider.ts      | 327 +++++++++++++++++++++
 packages/engine/src/research/providers/index.ts    |   5 +
 .../research/providers/llm-synthesis-provider.ts   | 216 ++++++++++++++
 .../src/research/providers/local-docs-provider.ts  | 238 +++++++++++++++
 .../src/research/providers/page-fetch-provider.ts  | 123 ++++++++
 .../src/research/providers/web-search-provider.ts  | 269 +++++++++++++++++
 packages/engine/src/research/types.ts              |  50 ++++
 19 files changed, 1965 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-2993
This commit is contained in:
Fusion
2026-04-30 02:19:38 -07:00
committed by gsxdsm
parent a227d5b305
commit 9bea0a1367
19 changed files with 1965 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
import { describe, expect, it } from "vitest";
import { ResearchProviderRegistry } from "../provider-registry.js";
describe("ResearchProviderRegistry", () => {
it("instantiates providers with defaults", () => {
const registry = new ResearchProviderRegistry({}, process.cwd());
expect(registry.getProvider("web-search")).toBeDefined();
expect(registry.getProvider("page-fetch")).toBeDefined();
expect(registry.isProviderAvailable("local-docs")).toBe(true);
expect(registry.isProviderAvailable("github")).toBe(false);
});
it("detects search backend from credentials", () => {
const tavily = new ResearchProviderRegistry({ researchTavilyApiKey: "key" }, process.cwd());
expect(tavily.isProviderAvailable("web-search")).toBe(true);
const searx = new ResearchProviderRegistry({ researchSearxngUrl: "https://sx.local" }, process.cwd());
expect(searx.isProviderAvailable("web-search")).toBe(true);
});
it("returns only configured providers in available list", () => {
const registry = new ResearchProviderRegistry(
{
researchWebSearchProvider: "brave",
researchBraveApiKey: "token",
researchGitHubEnabled: true,
},
process.cwd(),
);
const available = registry.getAvailableProviders();
expect(available).toContain("web-search");
expect(available).toContain("local-docs");
});
it("refreshes providers after settings changes", () => {
const registry = new ResearchProviderRegistry({ researchWebSearchProvider: "none" }, process.cwd());
expect(registry.isProviderAvailable("web-search")).toBe(false);
registry.refreshSettings({ researchWebSearchProvider: "tavily", researchTavilyApiKey: "key" });
expect(registry.isProviderAvailable("web-search")).toBe(true);
});
it("gracefully degrades disabled providers", () => {
const registry = new ResearchProviderRegistry({ researchGitHubEnabled: false, researchLocalDocsEnabled: false }, process.cwd());
expect(registry.isProviderAvailable("github")).toBe(false);
expect(registry.isProviderAvailable("local-docs")).toBe(false);
});
});