import type { GlobToolDetails } from "@oh-my-pi/pi-tui/tools/glob"; import * as fs from "node:fs"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import * as natives from "@oh-my-pi/pi-natives"; import { glob as ovnfsGlob } from "../ovnfs/search.js"; import type { ToolSession } from "./index.js"; import { searchPathTier } from "./path-utils.js"; declare const findSchema: import("@oh-my-pi/omptype").FluentType<{ gitignore?: boolean | undefined; hidden?: boolean | undefined; limit?: number | undefined; path?: string | undefined; }, { gitignore?: boolean | undefined; hidden?: boolean | undefined; limit?: number | undefined; path?: string | undefined; }>; export type GlobToolInput = typeof findSchema.infer; /** * Pluggable operations for the find tool. * Override these to delegate file search to remote systems (e.g., SSH). */ export interface GlobOperations { /** Check if path exists */ exists: (absolutePath: string) => Promise | boolean; /** Optional stat for distinguishing files vs directories. */ stat?: (absolutePath: string) => Promise<{ isFile(): boolean; isDirectory(): boolean; }> | { isFile(): boolean; isDirectory(): boolean; }; /** Find files matching glob pattern. Returns relative paths. */ glob: (pattern: string, cwd: string, options: GlobOperationsOptions) => Promise | string[]; } /** Search policy the tool resolved for this call, plus the cancellation signal. */ export interface GlobOperationsOptions { /** Globs the tool always excludes. */ ignore: string[]; /** Effective result cap for this call, already clamped to the tool maximum. */ limit: number; /** Include dotfiles. Resolved from the caller's `hidden`, defaulting to true. */ hidden: boolean; /** Honour gitignore files. Resolved from the caller's `gitignore`, defaulting to true. */ gitignore: boolean; /** Restrict matches to this entry type, including symlinks to that type. */ fileType?: natives.FileType; /** Aborts when the caller cancels or when the tool's scan deadline expires. * Backends are expected to stop on it; the tool does not wait for one that * does not, but it still stops reporting at the deadline. */ signal?: AbortSignal; } export interface GlobToolOptions { /** Custom operations for find. Default: local filesystem + rg */ operations?: GlobOperations; /** Remap slash-only paths to the session cwd before root-search validation. */ rootPathAlias?: boolean; /** Glob backend (`natives.glob`, answered by the ovnfs daemon inside its mount). Override only in tests. */ nativeGlob?: typeof ovnfsGlob; /** Filesystem stat used before native scans. Override only in tests. */ stat?: typeof fs.promises.stat; /** Native and user-facing scan timeout. Override only in tests. */ timeoutMs?: number; } export declare class GlobTool implements AgentTool { #private; private readonly session; readonly name = "glob"; readonly approval: typeof searchPathTier; /** * `always-ask-cached` keys: the folders and files this glob searches, so a * folder grant recorded by a `read` (or by a grep) covers a search inside it * and a search rooted at one file shares that file's read grant. Roots report * the walkable base `parseFindPattern` finds — no glob is expanded — and each * costs a single stat; see {@link searchApprovalCacheTargets}. */ readonly approvalCacheTargets: (args: unknown) => readonly string[] | undefined; readonly loadMode = "essential"; readonly label = "Glob"; get description(): string; readonly parameters: import("@oh-my-pi/omptype").FluentType<{ gitignore?: boolean | undefined; hidden?: boolean | undefined; limit?: number | undefined; path?: string | undefined; }, { gitignore?: boolean | undefined; hidden?: boolean | undefined; limit?: number | undefined; path?: string | undefined; }>; readonly strict = true; constructor(session: ToolSession, options?: GlobToolOptions); execute(_toolCallId: string, params: typeof findSchema.infer, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback, _context?: AgentToolContext): Promise>; } export {};