mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 02:22:25 +00:00
perf(plugin-sdk): add web fetch contract artifacts
This commit is contained in:
6
src/plugin-sdk/provider-web-fetch-contract.ts
Normal file
6
src/plugin-sdk/provider-web-fetch-contract.ts
Normal 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 };
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user