import type { SuperagentToolCall } from '../types'; /** * Pure logic backing the search/web tool widgets (SearchWeb, GrepSearch, * GetConnectorsInfo). Ports of the parsers in the web builder's tools-ui * Components (SearchWeb.tsx, GrepSearch.tsx) so the native widgets read the * same queries, result links and match counts. No RN imports — unit-testable * in the node environment. */ export type SearchResultLink = { url: string; title?: string; }; /** * The search query, mirroring the web extractQuery: batched `queries[0] * .query_or_url` wins, then `query` / `query_or_url`, then a regex over the * raw (possibly still-streaming, unparseable) arguments string. */ export declare function extractSearchQuery(toolCall: SuperagentToolCall): string; /** * Result links out of the search tool output, same two passes as the web: * `` blocks yield url + following title line; otherwise fall back * to scraping unique URLs from the raw text. */ export declare function parseSearchResults(results: SuperagentToolCall['results']): SearchResultLink[]; /** "https://www.foo.com/bar?x=1" → "foo.com/bar", capped at 60 chars (web parity). */ export declare function prettifyUrl(url: string): string; export type GrepCounts = { matchCount: number; fileCount: number; }; /** * Parse match/file counts from the grep tool's result text. The backend emits * a different header per output_mode (see the web GrepSearch.tsx port): * - content mode: "Found N matches in M files:" * - files_with_matches mode: "Found N files:" * - count mode: "Match counts in N files:\nfile.js:10\n..." * - no results: "No matches found" */ export declare function parseGrepCounts(results: SuperagentToolCall['results']): GrepCounts; /** * A grep call is done when its status is terminal OR it already carries * results — during streaming the status can lag behind the payload (web parity). */ export declare function isGrepCallDone(toolCall: SuperagentToolCall): boolean; /** * The grep pattern, tolerating a still-streaming arguments string via the * same regex fallback as extractSearchQuery (the web uses parsePartialJson). */ export declare function getGrepPattern(toolCall: SuperagentToolCall): string; export declare function truncateDisplayText(text: string, maxLength?: number): string; export declare function pluralize(count: number, noun: string): string; //# sourceMappingURL=searchWidgetUtils.d.ts.map