perf(plugin-sdk): add web fetch contract artifacts

This commit is contained in:
Vincent Koc
2026-04-07 08:34:52 +01:00
parent 2ceafbafcc
commit 49fbecbf16
9 changed files with 103 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
// Narrow shared exports for web-fetch contract surfaces.
import type { WebFetchProviderPlugin } from "../plugins/types.js";
export { enablePluginInConfig } from "../plugins/enable.js";
export type { WebFetchProviderPlugin };

View File

@@ -351,6 +351,15 @@ describe("plugin-sdk subpath exports", () => {
"resolveCitationRedirectUrl",
],
});
expectSourceContract("provider-web-fetch-contract", {
mentions: ["enablePluginInConfig", "WebFetchProviderPlugin"],
omits: [
"withTrustedWebToolsEndpoint",
"readResponseText",
"resolveCacheTtlMs",
"wrapExternalContent",
],
});
expectSourceMentions("compat", [
"createPluginRuntimeStore",
"createScopedChannelConfigAdapter",

View File

@@ -41,4 +41,14 @@ describe("web provider public artifacts", () => {
}),
);
});
it("prefers lightweight bundled web fetch contract artifacts", () => {
const provider = resolveBundledWebFetchProvidersFromPublicArtifacts({
bundledAllowlistCompat: true,
onlyPluginIds: ["firecrawl"],
})?.[0];
expect(provider?.pluginId).toBe("firecrawl");
expect(provider?.createTool({ config: {} as never })).toBeNull();
});
});

View File

@@ -18,7 +18,11 @@ const WEB_SEARCH_ARTIFACT_CANDIDATES = [
"web-search-provider.js",
"web-search.js",
] as const;
const WEB_FETCH_ARTIFACT_CANDIDATES = ["web-fetch-provider.js", "web-fetch.js"] as const;
const WEB_FETCH_ARTIFACT_CANDIDATES = [
"web-fetch-contract-api.js",
"web-fetch-provider.js",
"web-fetch.js",
] as const;
type BundledWebProviderPublicArtifactParams = {
config?: PluginLoadOptions["config"];