/** * Search Tools Service * * Handles file and content search operations for the LLM tool system. * Extracted from ToolExecutionService to follow Single Responsibility Principle. * * Operations: * - Glob file search * - Grep content search * - Codebase semantic search * * Uses SafeExecutor.execute (spawn with an argument array, no shell) — the * `pattern`/`path` arguments here come straight from an LLM tool call with no * sanitization, and search patterns routinely contain quotes/backticks/`$()` * when searching for code that itself contains those characters (e.g. * searching for `exec("`). Interpolating them into a shell string let an * embedded `"` break out and run arbitrary commands via completely ordinary * grep/glob_file_search usage — no adversarial intent required. */ import type { getLogger } from '../../output/logger.js'; type Logger = ReturnType; /** * Service for search operations */ export declare class SearchToolsService { private readonly workingDir; constructor(workingDir?: string, _logger?: Logger); /** * Search for files using glob pattern * Uses fd for fast, .gitignore-aware file discovery with find as fallback */ executeGlobSearch(args: Record): Promise; /** Try fd first (fast, .gitignore-aware); fall back to find if fd is unavailable or errors. */ private runGlobSearch; /** * Search file contents using grep */ executeGrep(args: Record): Promise; /** Try ripgrep first (fast, respects excludes); fall back to grep if rg is unavailable, errors, or finds nothing. */ private runGrepSearch; /** * Semantic codebase search * Uses AST symbol index when available, falls back to grep */ executeCodebaseSearch(args: Record): Promise; } /** * Get the singleton SearchToolsService instance */ export declare function getSearchToolsService(workingDir?: string): SearchToolsService; /** * Reset the singleton instance (for testing) */ export declare function resetSearchToolsService(): void; export {}; //# sourceMappingURL=search-tools.service.d.ts.map