惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Martin Fowler
Martin Fowler
博客园_首页
量子位
T
Tailwind CSS Blog
博客园 - Franky
G
Google Developers Blog
D
DataBreaches.Net
Vercel News
Vercel News
B
Blog
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
爱范儿
爱范儿
博客园 - 【当耐特】
The Cloudflare Blog
H
Help Net Security
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
C
Check Point Blog
有赞技术团队
有赞技术团队
Microsoft Security Blog
Microsoft Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(tavily): keep web search contract executable · opencl...
extrasmall0 · 2026-06-14 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,7 +1,11 @@

11

// Tavily provider module implements model/runtime integration.

22

import { readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";

33

import type { WebSearchProviderPlugin } from "openclaw/plugin-sdk/provider-web-search-contract";

4-

import { buildTavilyWebSearchProviderBase } from "../web-search-shared.js";

4+

import {

5+

buildTavilyWebSearchProviderBase,

6+

TAVILY_GENERIC_SEARCH_DESCRIPTION,

7+

TAVILY_GENERIC_SEARCH_SCHEMA,

8+

} from "../web-search-shared.js";

59
610

type TavilyClientModule = typeof import("./tavily-client.js");

711

@@ -12,27 +16,12 @@ function loadTavilyClientModule(): Promise<TavilyClientModule> {

1216

return tavilyClientModulePromise;

1317

}

1418
15-

const GenericTavilySearchSchema = {

16-

type: "object",

17-

properties: {

18-

query: { type: "string", description: "Search query string." },

19-

count: {

20-

type: "integer",

21-

description: "Number of results to return (1-20).",

22-

minimum: 1,

23-

maximum: 20,

24-

},

25-

},

26-

additionalProperties: false,

27-

} satisfies Record<string, unknown>;

28-
2919

export function createTavilyWebSearchProvider(): WebSearchProviderPlugin {

3020

return {

3121

...buildTavilyWebSearchProviderBase(),

3222

createTool: (ctx) => ({

33-

description:

34-

"Search the web using Tavily. Returns structured results with snippets. Use tavily_search for Tavily-specific options like search depth, topic filtering, or AI answers.",

35-

parameters: GenericTavilySearchSchema,

23+

description: TAVILY_GENERIC_SEARCH_DESCRIPTION,

24+

parameters: TAVILY_GENERIC_SEARCH_SCHEMA,

3625

execute: async (args) => {

3726

const { runTavilySearch } = await loadTavilyClientModule();

3827

return await runTavilySearch({

Original file line numberDiff line numberDiff line change

@@ -47,13 +47,16 @@ function fakeApi(): OpenClawPluginApi {

4747
4848

describe("tavily tools", () => {

4949

let createTavilyWebSearchProvider: typeof import("./tavily-search-provider.js").createTavilyWebSearchProvider;

50+

let createTavilyContractWebSearchProvider: typeof import("../web-search-contract-api.js").createTavilyWebSearchProvider;

5051

let createTavilySearchTool: typeof import("./tavily-search-tool.js").createTavilySearchTool;

5152

let createTavilyExtractTool: typeof import("./tavily-extract-tool.js").createTavilyExtractTool;

5253

let tavilyClientTesting: typeof import("./tavily-client.js").testing;

5354

let tavilyPlugin: typeof import("../index.js").default;

5455
5556

beforeAll(async () => {

5657

({ createTavilyWebSearchProvider } = await import("./tavily-search-provider.js"));

58+

({ createTavilyWebSearchProvider: createTavilyContractWebSearchProvider } =

59+

await import("../web-search-contract-api.js"));

5760

({ createTavilySearchTool } = await import("./tavily-search-tool.js"));

5861

({ createTavilyExtractTool } = await import("./tavily-extract-tool.js"));

5962

({ testing: tavilyClientTesting } =

@@ -110,6 +113,32 @@ describe("tavily tools", () => {

110113

});

111114

});

112115
116+

it("keeps the contract web search provider executable", async () => {

117+

const provider = createTavilyContractWebSearchProvider();

118+

const tool = provider.createTool({

119+

config: { test: "contract" },

120+

} as never);

121+

if (!tool) {

122+

throw new Error("Expected contract provider tool definition");

123+

}

124+
125+

const result = await tool.execute({

126+

query: "runtime registration",

127+

count: 3,

128+

});

129+
130+

expect(runTavilySearch).toHaveBeenCalledWith({

131+

cfg: { test: "contract" },

132+

query: "runtime registration",

133+

maxResults: 3,

134+

});

135+

expect(result).toEqual({

136+

cfg: { test: "contract" },

137+

query: "runtime registration",

138+

maxResults: 3,

139+

});

140+

});

141+
113142

it("normalizes generic Tavily search count before dispatch", async () => {

114143

const provider = createTavilyWebSearchProvider();

115144

const tool = provider.createTool({

Original file line numberDiff line numberDiff line change

@@ -1,10 +1,35 @@

11

// Tavily API module exposes the plugin public contract.

2-

import type { WebSearchProviderPlugin } from "openclaw/plugin-sdk/provider-web-search-contract";

3-

import { buildTavilyWebSearchProviderBase } from "./web-search-shared.js";

2+

import type { WebSearchProviderPlugin } from "openclaw/plugin-sdk/provider-web-search-config-contract";

3+

import {

4+

buildTavilyWebSearchProviderBase,

5+

TAVILY_GENERIC_SEARCH_DESCRIPTION,

6+

TAVILY_GENERIC_SEARCH_SCHEMA,

7+

} from "./web-search-shared.js";

8+
9+

type TavilySearchProviderModule = typeof import("./src/tavily-search-provider.js");

10+
11+

let tavilySearchProviderModulePromise: Promise<TavilySearchProviderModule> | undefined;

12+
13+

function loadTavilySearchProviderModule(): Promise<TavilySearchProviderModule> {

14+

tavilySearchProviderModulePromise ??= import("./src/tavily-search-provider.js");

15+

return tavilySearchProviderModulePromise;

16+

}

417
518

export function createTavilyWebSearchProvider(): WebSearchProviderPlugin {

619

return {

720

...buildTavilyWebSearchProviderBase(),

8-

createTool: () => null,

21+

createTool: (ctx) => ({

22+

description: TAVILY_GENERIC_SEARCH_DESCRIPTION,

23+

parameters: TAVILY_GENERIC_SEARCH_SCHEMA,

24+

execute: async (args) => {

25+

const { createTavilyWebSearchProvider: createRuntimeProvider } =

26+

await loadTavilySearchProviderModule();

27+

const tool = createRuntimeProvider().createTool(ctx);

28+

if (!tool) {

29+

throw new Error("Tavily web_search provider did not create a runtime tool.");

30+

}

31+

return await tool.execute(args);

32+

},

33+

}),

934

};

1035

}

Original file line numberDiff line numberDiff line change

@@ -6,6 +6,23 @@ import {

66
77

export const TAVILY_CREDENTIAL_PATH = "plugins.entries.tavily.config.webSearch.apiKey";

88
9+

export const TAVILY_GENERIC_SEARCH_DESCRIPTION =

10+

"Search the web using Tavily. Returns structured results with snippets. Use tavily_search for Tavily-specific options like search depth, topic filtering, or AI answers.";

11+
12+

export const TAVILY_GENERIC_SEARCH_SCHEMA = {

13+

type: "object",

14+

properties: {

15+

query: { type: "string", description: "Search query string." },

16+

count: {

17+

type: "integer",

18+

description: "Number of results to return (1-20).",

19+

minimum: 1,

20+

maximum: 20,

21+

},

22+

},

23+

additionalProperties: false,

24+

} satisfies Record<string, unknown>;

25+
926

export function buildTavilyWebSearchProviderBase(): Omit<WebSearchProviderPlugin, "createTool"> {

1027

return {

1128

id: "tavily",