From 81e46bd0e12d1cae3755f556a8f8890f6d9c33ac Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Tue, 16 Dec 2025 21:10:12 -0500 Subject: [PATCH] fix(websearch): update config.yaml comments to match CLI implementation - Update WebSearch section comments in unified-config-loader.ts - Remove outdated MCP references (web-search-prime, brave, tavily, customMcp) - Add accurate CLI provider info (Gemini CLI FREE, Grok CLI paid) - Add GrokWebSearchConfig type to unified-config-types.ts - Update PUT /api/websearch route to handle both gemini and grok Old comments listed MCP-based providers that were never implemented. New comments accurately reflect the CLI-based WebSearch implementation. --- src/config/unified-config-loader.ts | 14 ++++++-------- src/config/unified-config-types.ts | 22 +++++++++++++++------- src/web-server/routes.ts | 10 +++++++++- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/config/unified-config-loader.ts b/src/config/unified-config-loader.ts index 1c765c93..96929a79 100644 --- a/src/config/unified-config-loader.ts +++ b/src/config/unified-config-loader.ts @@ -261,19 +261,17 @@ function generateYamlWithComments(config: UnifiedConfig): string { // WebSearch section if (config.websearch) { lines.push('# ----------------------------------------------------------------------------'); - lines.push('# WebSearch: Provider configuration for third-party profiles'); + lines.push('# WebSearch: CLI-based web search for third-party profiles'); lines.push('# Dashboard (`ccs config`) is the source of truth for provider selection.'); lines.push('#'); - lines.push('# enabled: Master switch - auto-disables when no providers enabled'); - lines.push('# mode: sequential (try in order) | parallel (merge all results)'); + lines.push('# Third-party providers (gemini, codex, agy, etc.) do not have access to'); + lines.push("# Anthropic's WebSearch tool. These CLI tools provide fallback web search."); lines.push('#'); lines.push('# providers:'); - lines.push('# gemini: Uses Gemini CLI with google_web_search tool'); - lines.push('# web-search-prime: HTTP MCP endpoint (z.ai subscription)'); - lines.push('# brave: Brave Search API (requires BRAVE_API_KEY)'); - lines.push('# tavily: Tavily Search API (requires TAVILY_API_KEY)'); + lines.push('# gemini: Gemini CLI (FREE) - npm i -g @google/gemini-cli'); + lines.push('# grok: Grok CLI (paid) - npm i -g @vibe-kit/grok-cli (needs GROK_API_KEY)'); lines.push('#'); - lines.push('# customMcp: User-defined MCP servers (BYOM - Bring Your Own MCP)'); + lines.push('# enabled: Master switch - auto-disables when no providers enabled'); lines.push('# ----------------------------------------------------------------------------'); lines.push( yaml diff --git a/src/config/unified-config-types.ts b/src/config/unified-config-types.ts index 72463bb3..d44f1e3a 100644 --- a/src/config/unified-config-types.ts +++ b/src/config/unified-config-types.ts @@ -111,22 +111,30 @@ export interface GeminiWebSearchConfig { timeout?: number; } +/** + * Grok CLI WebSearch configuration. + */ +export interface GrokWebSearchConfig { + /** Enable Grok CLI for WebSearch (default: false - requires GROK_API_KEY) */ + enabled?: boolean; + /** Timeout in seconds (default: 55) */ + timeout?: number; +} + /** * WebSearch providers configuration. - * Currently supports Gemini CLI only. - * Future: opencode, grok-cli, etc. + * Currently supports Gemini CLI and Grok CLI. */ export interface WebSearchProvidersConfig { - /** Gemini CLI - uses google_web_search tool */ + /** Gemini CLI - uses google_web_search tool (FREE tier: 1000 req/day) */ gemini?: GeminiWebSearchConfig; - // Future CLI tools can be added here: - // opencode?: { enabled?: boolean; model?: string; }; - // grok?: { enabled?: boolean; }; + /** Grok CLI - xAI web search (requires GROK_API_KEY) */ + grok?: GrokWebSearchConfig; } /** * WebSearch configuration. - * Uses CLI tools (Gemini CLI) to provide WebSearch for third-party profiles. + * Uses CLI tools (Gemini CLI, Grok CLI) to provide WebSearch for third-party profiles. * Third-party providers don't have server-side WebSearch access. */ export interface WebSearchConfig { diff --git a/src/web-server/routes.ts b/src/web-server/routes.ts index 03145707..921b8751 100644 --- a/src/web-server/routes.ts +++ b/src/web-server/routes.ts @@ -1466,7 +1466,7 @@ apiRoutes.put('/websearch', (req: Request, res: Response): void => { return; } - // Merge updates - simple structure (Gemini CLI only for now) + // Merge updates - supports Gemini CLI and Grok CLI existingConfig.websearch = { enabled: enabled ?? existingConfig.websearch?.enabled ?? true, providers: providers @@ -1481,6 +1481,14 @@ apiRoutes.put('/websearch', (req: Request, res: Response): void => { existingConfig.websearch?.providers?.gemini?.timeout ?? 55, }, + grok: { + enabled: + providers.grok?.enabled ?? + existingConfig.websearch?.providers?.grok?.enabled ?? + false, + timeout: + providers.grok?.timeout ?? existingConfig.websearch?.providers?.grok?.timeout ?? 55, + }, } : existingConfig.websearch?.providers, };