import { type TruncationResult } from "@caupulican/pi-agent-core/truncate"; import type { AgentTool } from "@caupulican/pi-agent-core/types"; import { type Static, Type } from "typebox"; import type { ArtifactStore } from "../context/context-artifacts.ts"; import { type BroadQueryTracker } from "../context/tool-output-packer.ts"; import type { ToolDefinition } from "../extensions/types.ts"; import { type FffSearchBackend } from "./fff-search-backend.ts"; import { type ManagedSearchToolOptions } from "./managed-search-tool.ts"; import type { SearchRouter } from "./search-router.ts"; declare const grepSchema: Type.TObject<{ pattern: Type.TString; path: Type.TOptional; glob: Type.TOptional; ignoreCase: Type.TOptional; literal: Type.TOptional; context: Type.TOptional; limit: Type.TOptional; }>; export type GrepToolInput = Static; export interface GrepToolDetails { truncation?: TruncationResult; matchLimitReached?: number; linesTruncated?: boolean; /** Set only when output was packed to an artifact; see tool-output-packer.ts. */ artifactId?: string; /** Set when this exact query has repeatedly produced broad/truncated results. */ invalidationCandidate?: boolean; } /** * Pluggable operations for the grep tool. * Override these to delegate search to remote systems (for example SSH). */ export interface GrepOperations { /** Check if path is a directory. Throws if path does not exist. */ isDirectory: (absolutePath: string) => Promise | boolean; /** Read file contents for context lines */ readFile: (absolutePath: string) => Promise | string; } export interface GrepToolOptions extends ManagedSearchToolOptions { /** Custom operations for grep. Default: local filesystem plus routed FFF/rg search */ operations?: GrepOperations; /** FFF backend for resident indexed search. Set false to force ripgrep fallback. */ fff?: FffSearchBackend | false; /** Pure router that selects FFF or rg from request filters and environment facts. */ searchRouter?: SearchRouter; /** * Opt-in artifact store for first-capture-then-bound output packing (Phase 3). When * omitted (the default), behavior is byte-for-byte unchanged from before this option * existed: output is truncated the same way, just never artifact-backed. */ artifactStore?: ArtifactStore; /** Opt-in tracker for repeated-broad-query "do not repeat" signals. Also default-off. */ broadQueryTracker?: BroadQueryTracker; } export declare function tryFffGrep(options: { backend: FffSearchBackend; router: SearchRouter; cwd: string; searchPath: string; pattern: string; glob?: string; ignoreCase?: boolean; literal?: boolean; contextValue: number; effectiveLimit: number; isDirectory: boolean; toolCallId: string; artifactStore?: ArtifactStore; broadQueryTracker?: BroadQueryTracker; rawPath?: string; }): Promise<{ text: string; details: GrepToolDetails; } | undefined>; export declare function createGrepToolDefinition(cwd: string, options?: GrepToolOptions): ToolDefinition; export declare function createGrepTool(cwd: string, options?: GrepToolOptions): AgentTool; export {}; //# sourceMappingURL=grep.d.ts.map