import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import * as z from "zod/v4"; import type { RenderResultOptions } from "../extensibility/custom-tools/types"; import type { Theme } from "../modes/theme/theme"; import { type TruncationResult } from "../session/streaming-output"; import type { ToolSession } from "."; import { type OutputMeta } from "./output-meta"; declare const searchSchema: z.ZodObject<{ pattern: z.ZodString; paths: z.ZodArray; i: z.ZodOptional; gitignore: z.ZodOptional; skip: z.ZodOptional; }, z.core.$strict>; export type SearchToolInput = z.infer; /** Maximum number of distinct files surfaced in a single response. The * agent paginates further pages via `skip`. */ export declare const DEFAULT_FILE_LIMIT = 20; /** Per-file match cap for multi-file searches — keeps a single hot file * from crowding out diverse hits. Applied in JS after grep returns. */ export declare const MULTI_FILE_PER_FILE_MATCHES = 20; /** Per-file match cap for single-file searches — there's no diversity * concern when the scope is one file. */ export declare const SINGLE_FILE_MATCHES = 200; export interface SearchToolDetails { truncation?: TruncationResult; fileLimitReached?: number; perFileLimitReached?: number; linesTruncated?: boolean; meta?: OutputMeta; scopePath?: string; matchCount?: number; fileCount?: number; files?: string[]; fileMatches?: Array<{ path: string; count: number; }>; truncated?: boolean; error?: string; /** Pre-formatted text for the user-visible TUI render. Mirrors the model-facing * `result.text` lines but uses a `│` gutter and `*` to mark match lines (vs space for * context). The TUI uses this directly so it never parses model-facing hashline anchors. */ displayContent?: string; /** Absolute base directory used during search. Used by the renderer to resolve * display-relative paths to absolute paths for OSC 8 hyperlinks. */ searchPath?: string; /** User-supplied paths whose base directory was missing on disk. The tool * skipped these and continued with the surviving entries; surfaced as a * non-fatal warning in the renderer and in the model-facing text. */ missingPaths?: string[]; } type SearchParams = z.infer; export declare class SearchTool implements AgentTool { private readonly session; readonly name = "search"; readonly label = "Search"; readonly loadMode = "discoverable"; readonly summary = "Search file contents using ripgrep (fast text search)"; readonly description: string; readonly parameters: z.ZodObject<{ pattern: z.ZodString; paths: z.ZodArray; i: z.ZodOptional; gitignore: z.ZodOptional; skip: z.ZodOptional; }, z.core.$strict>; readonly strict = true; constructor(session: ToolSession); execute(_toolCallId: string, params: SearchParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback, _toolContext?: AgentToolContext): Promise>; } interface SearchRenderArgs { pattern: string; paths?: string[]; i?: boolean; gitignore?: boolean; skip?: number; } export declare const searchToolRenderer: { inline: boolean; renderCall(args: SearchRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component; renderResult(result: { content: Array<{ type: string; text?: string; }>; details?: SearchToolDetails; isError?: boolean; }, options: RenderResultOptions, uiTheme: Theme, args?: SearchRenderArgs): Component; mergeCallAndResult: boolean; }; export {};