feat(pi-web-search): 统一 web_search/web_fetch 并由主模型路由搜索厂商

7 个按厂商命名的搜索工具收敛为 2 个统一工具,schema 与提示词不再暴露
provider 概念:web_search 由当前主模型按内置规则在 Tavily/Exa/Keenable
间路由(会话内 LRU 缓存,失败按可用性降级),web_fetch 固定走 Exa 并
静默降级。三家均改为纯 fetch 直连——Exa 直接对 mcp.exa.ai 发 JSON-RPC
并缓存会话,彻底移除 pi-mcp-adapter、@tavily/pi-extension 与
@keenable/pi-search 依赖。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
云服务部-叶林立
2026-10-19 20:13:37 -07:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 6fe6cb29ae
commit ee1e6999d7
32 changed files with 1690 additions and 1188 deletions
+9 -16
View File
@@ -73,21 +73,15 @@ test("LSP routing covers navigation and post-edit diagnostics", () => {
assert.match(section, /post-edit diagnostics/);
});
test("online search routing selects providers by task", () => {
const tavily = buildToolRoutingSection(["tavily_web_search", "tavily_web_fetch"]);
assert.match(tavily, /broad discovery when keywords are uncertain/);
assert.match(tavily, /news\/recent\/trending topics/);
assert.doesNotMatch(tavily, /official or API documentation/);
test("online search routing uses the unified web tools without naming providers", () => {
const section = buildToolRoutingSection(["web_search", "web_fetch"]);
assert.match(section, /Use web_search for current, real-world, or citable web information/);
assert.match(section, /provider selection is handled internally/);
assert.match(section, /read selected pages with web_fetch/);
assert.doesNotMatch(section, /tavily|exa|keenable/iu);
const exa = buildToolRoutingSection(["exa_web_search", "exa_web_fetch", "exa_web_search_advanced"]);
assert.match(exa, /official or API documentation/);
assert.match(exa, /explicitly bound the result count and returned text length/);
assert.doesNotMatch(exa, /Chinese-language pages/);
const keenable = buildToolRoutingSection(["keenable_search", "keenable_fetch"]);
assert.match(keenable, /Chinese-language pages, policies and government notices/);
assert.match(keenable, /site-restricted search/);
assert.match(keenable, /publication-date filtering/);
const searchOnly = buildToolRoutingSection(["web_search"]);
assert.match(searchOnly, /Use web_search/);
});
test("routing includes only guidance for active optional tools", () => {
@@ -98,8 +92,7 @@ test("routing includes only guidance for active optional tools", () => {
assert.doesNotMatch(section, /Use Context Mode/);
assert.doesNotMatch(section, /ctx_execute_file is confined/);
assert.doesNotMatch(section, /fresh LINE#HASH anchors/);
assert.doesNotMatch(section, /Choose one online search provider/);
assert.doesNotMatch(section, /broad discovery when keywords are uncertain/);
assert.doesNotMatch(section, /Use web_search for current/);
assert.match(section, /Use read only when exact source is needed/);
});