Files
openclaw/extensions/tavily/web-search-contract-api.ts
Peter Steinberger c83dcc2bc0 fix(security): harden network tool output at canonical owner boundaries (#118984)
* fix(security): bound external tool content at its canonical owner boundary

* fix(plugin-sdk): document supported security boundary and restore facade parity
2026-08-03 15:34:33 -07:00

33 lines
1.2 KiB
TypeScript

import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
// Tavily API module exposes the plugin public contract.
import type { WebSearchProviderPlugin } from "openclaw/plugin-sdk/provider-web-search-config-contract";
import {
buildTavilyWebSearchProviderBase,
TAVILY_GENERIC_SEARCH_DESCRIPTION,
TAVILY_GENERIC_SEARCH_SCHEMA,
} from "./web-search-shared.js";
const loadTavilySearchProviderModule = createLazyRuntimeModule(
() => import("./src/tavily-search-provider.js"),
);
export function createTavilyWebSearchProvider(): WebSearchProviderPlugin {
return {
...buildTavilyWebSearchProviderBase(),
createTool: (ctx) => ({
description: TAVILY_GENERIC_SEARCH_DESCRIPTION,
parameters: TAVILY_GENERIC_SEARCH_SCHEMA,
execute: async (args, executionContext) => {
executionContext?.signal?.throwIfAborted();
const { createTavilyWebSearchProvider: createRuntimeProvider } =
await loadTavilySearchProviderModule();
const tool = createRuntimeProvider().createTool(ctx);
if (!tool) {
throw new Error("Tavily web_search provider did not create a runtime tool.");
}
return await tool.execute(args, executionContext);
},
}),
};
}