/** * Gateway-side web search execution (server-tool parity). * * `web_search` is a *server-executed* tool: callers (Codex, Claude Code, API * clients) declare it but never run it — on the real provider APIs the * backend searches mid-turn. Nothing behind this gateway can do that, so the * gateway becomes the server: the dialect adapters project the tool to the * upstream model, and when it calls the tool the server-tool loop executes the * search here by delegating to a real provider's native web search in a * one-shot, buffered side call. * * Each dialect prefers its own provider (result and citation shapes match * what the caller's provider would have produced), falling back to the other * provider when only one key is available. With no key at all the feature is * off and the adapters keep their honest-drop behavior. */ import type { ToolResult } from "@velum-labs/routekit-contracts/protocol-ir"; import { Effect } from "effect"; import { HttpClient } from "effect/unstable/http"; export type WebSearchExecutor = { readonly provider: "openai" | "anthropic"; readonly model: string; search(query: string, signal?: AbortSignal): Effect.Effect; }; export type WebSearchDialect = "responses" | "anthropic"; /** Hard ceiling on gateway-executed searches within one caller turn. */ export declare const MAX_WEB_SEARCHES_PER_TURN = 8; /** * The executor for a dialect: the matching provider when its key is present, * the other provider as fallback (working search beats provider purity), or * `undefined` when the feature is off (`ROUTEKIT_WEB_SEARCH=0` or no keys), * in which case the adapters keep dropping the tool with a warning. */ export declare function resolveWebSearchExecutor(dialect: WebSearchDialect, env?: Record): WebSearchExecutor | undefined;