mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Native Anthropic web search is only reliable for Claude-family model names, while many configured providers either do not implement the server tool schema or reject it through proxy layers. This routes WebSearch through a single resolver, adds Tavily and Brave fallbacks, and exposes provider key setup in the desktop settings page. Constraint: Third-party Anthropic-compatible endpoints may reject web_search_20250305 even when the model name is Claude-like Constraint: Non-Claude models still need a usable WebSearch path when users configure an external search provider Rejected: Gate native WebSearch by base URL | third-party Claude proxies can support it and official-looking URLs are not the real capability boundary Rejected: Always expose Anthropic native WebSearch | unsupported providers loop on schema or tool errors Confidence: high Scope-risk: moderate Directive: Keep WebSearch capability resolution centralized in WebSearchTool/backend.ts before adding more search providers Tested: bun test src/tools/WebSearchTool/backend.test.ts Tested: cd desktop && bun run test -- generalSettings.test.tsx Tested: cd desktop && bun run lint Tested: cd desktop && bun run build Tested: agent-browser Settings E2E for Tavily/Brave links and settings persistence Tested: live Tavily and Brave fallback searches returned results using transient keys Not-tested: automatic LLM decision to invoke WebSearch end-to-end against a paid model session