/** * Unified Web Search Tool * * Single tool supporting Anthropic, Perplexity, Exa, Brave, Jina, Kimi, Gemini, OpenAI code backend, xAI, Tavily, Kagi, Z.AI, SearXNG, and Synthetic * providers with provider-specific parameters exposed conditionally. */ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@gajae-code/agent-core"; import type { AuthStorage } from "@gajae-code/ai/core"; import * as z from "zod/v4"; import type { Settings } from "../../config/settings"; import type { CustomTool } from "../../extensibility/custom-tools/types"; import type { ToolSession } from "../../tools"; import { type SearchRenderDetails } from "./render"; import { type ActiveSearchModelContext, type SearchProviderId, type SearchResponse } from "./types"; /** Web search tool parameters schema */ export declare const webSearchSchema: z.ZodObject<{ query: z.ZodString; recency: z.ZodOptional>; limit: z.ZodOptional; max_tokens: z.ZodOptional; temperature: z.ZodOptional; num_search_results: z.ZodOptional; xai_search_mode: z.ZodOptional>; allowed_domains: z.ZodOptional>; excluded_domains: z.ZodOptional>; allowed_x_handles: z.ZodOptional>; excluded_x_handles: z.ZodOptional>; from_date: z.ZodOptional; to_date: z.ZodOptional; enable_image_understanding: z.ZodOptional; enable_image_search: z.ZodOptional; enable_video_understanding: z.ZodOptional; no_inline_citations: z.ZodOptional; }, z.core.$strip>; export type SearchToolParams = z.infer; export interface SearchQueryParams extends SearchToolParams { provider?: SearchProviderId | "auto"; } /** Format response for LLM consumption */ export declare function formatSearchResponseForLlm(response: SearchResponse): string; /** Override the hedge delay (tests). Non-finite/non-positive resets to default. */ export declare function setDdgHedgeDelayMs(ms: number | undefined): void; /** * Execute a web search query for CLI/testing workflows. * * `authStorage` may be omitted; in that case we discover one via the standard * factory (`discoverAuthStorage`), which honours `GJC_AUTH_BROKER_URL` and * otherwise opens the local SQLite credential store. */ export declare function runSearchQuery(params: SearchQueryParams, options?: { authStorage?: AuthStorage; sessionId?: string; signal?: AbortSignal; activeModelContext?: ActiveSearchModelContext; }): Promise<{ content: Array<{ type: "text"; text: string; }>; details: SearchRenderDetails; }>; /** * Web search tool implementation. * * Supports Anthropic, Perplexity, Exa, Brave, Jina, Kimi, Gemini, OpenAI code backend, xAI, Z.AI, SearXNG, and Synthetic providers with automatic fallback. */ export declare class WebSearchTool implements AgentTool { #private; readonly name = "web_search"; readonly label = "Web Search"; readonly description: string; readonly parameters: z.ZodObject<{ query: z.ZodString; recency: z.ZodOptional>; limit: z.ZodOptional; max_tokens: z.ZodOptional; temperature: z.ZodOptional; num_search_results: z.ZodOptional; xai_search_mode: z.ZodOptional>; allowed_domains: z.ZodOptional>; excluded_domains: z.ZodOptional>; allowed_x_handles: z.ZodOptional>; excluded_x_handles: z.ZodOptional>; from_date: z.ZodOptional; to_date: z.ZodOptional; enable_image_understanding: z.ZodOptional; enable_image_search: z.ZodOptional; enable_video_understanding: z.ZodOptional; no_inline_citations: z.ZodOptional; }, z.core.$strip>; readonly strict = true; readonly loadMode = "discoverable"; readonly summary = "Search the web for up-to-date information"; constructor(session: ToolSession); execute(_toolCallId: string, params: SearchToolParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback, _context?: AgentToolContext): Promise>; } /** Backward-compatible standalone tool; session construction uses getSearchTools(settings). */ export declare const webSearchCustomTool: CustomTool>; limit: z.ZodOptional; max_tokens: z.ZodOptional; temperature: z.ZodOptional; num_search_results: z.ZodOptional; xai_search_mode: z.ZodOptional>; allowed_domains: z.ZodOptional>; excluded_domains: z.ZodOptional>; allowed_x_handles: z.ZodOptional>; excluded_x_handles: z.ZodOptional>; from_date: z.ZodOptional; to_date: z.ZodOptional; enable_image_understanding: z.ZodOptional; enable_image_search: z.ZodOptional; enable_video_understanding: z.ZodOptional; no_inline_citations: z.ZodOptional; }, z.core.$strip>, SearchRenderDetails>; export declare function getSearchTools(settings?: Settings): CustomTool[]; export { getConfiguredSearchProviderPreference, getSearchProvider, setPreferredSearchProvider, setSearchFallbackProviders, } from "./provider"; export { applyConfiguredSearchTimeout, setSearchHardTimeoutMs } from "./providers/utils"; export type { SearchProviderId as SearchProvider, SearchResponse } from "./types"; export { isConfigurableSearchProviderId, isSearchProviderPreference } from "./types";