import type { AuthStorage } from "@gajae-code/ai/core"; import type { Settings } from "../../config/settings"; import type { SearchProvider, SearchProviderSettings } from "./providers/base"; import type { ActiveSearchModelContext, SearchProviderId } from "./types"; export type { SearchParams, SearchProviderSettings } from "./providers/base"; export { SearchProvider } from "./providers/base"; export declare function searchProviderSettings(settings?: Settings): SearchProviderSettings | undefined; export declare function getSearchProviderLabel(id: SearchProviderId): string; export declare function getSearchProvider(id: SearchProviderId): Promise; export declare const SEARCH_PROVIDER_ORDER: SearchProviderId[]; /** Drop every cached resolved chain (settings changed, tests). */ export declare function clearResolvedChainCache(): void; export declare function setPreferredSearchProvider(provider: SearchProviderId | "auto"): void; export declare function setSearchFallbackProviders(ids: readonly string[]): void; /** * Fire-and-forget warm-up: resolve the provider chain once so the provider * modules are imported and the chain cache is primed before the first * user-visible search. Errors are intentionally swallowed — prewarming must * never surface a failure the real search path would handle itself. */ export declare function prewarmSearchProviders(options: ResolveProviderChainOptions): void; export interface SearchProviderPreferenceSource { get(path: "providers.webSearch" | "web_search.provider"): SearchProviderId | "auto"; has(path: "providers.webSearch" | "web_search.provider"): boolean; } export declare function getConfiguredSearchProviderPreference(settings: SearchProviderPreferenceSource): SearchProviderId | "auto"; export interface ResolveProviderChainOptions { authStorage: AuthStorage; sessionId?: string; signal?: AbortSignal; preferredProvider?: SearchProviderId | "auto"; activeModelContext?: ActiveSearchModelContext; fallbackProviders?: readonly SearchProviderId[]; settings?: Settings; } export declare function looksHostedModelId(modelId: string | undefined): boolean; export declare function isLocalBaseUrl(baseUrl: string | undefined): boolean; export declare function inferNativeProviderFromModel(ctx: ActiveSearchModelContext | undefined): SearchProviderId | undefined; export declare function canUseGenericCredentials(authStorage: AuthStorage, ctx: ActiveSearchModelContext | undefined, sessionId?: string, signal?: AbortSignal): Promise; /** * Native web-search provider to attempt by reusing the ACTIVE model's own * credentials + baseUrl, dispatched by the model's wire protocol. * * This is the "native search over a proxy" path: when a model is served through * a proxy/custom endpoint, its canonical search credentials (e.g. a dedicated * `anthropic` key, or ChatGPT OAuth for `codex`) are usually absent, but the * credential that authenticates the model itself — stored under the active * provider id and aimed at `ctx.baseUrl` — can drive native web search just as * well. Each provider's `search()` falls back to those active credentials when * its canonical ones are missing. * * Returned ids are matched purely from the wire `api` (+ model-id family where a * native tool only makes sense for that family); the providers themselves fail * closed (and the chain falls through to DuckDuckGo) if the endpoint does not * actually support web search. */ export declare function activeContextNativeId(ctx: ActiveSearchModelContext | undefined): SearchProviderId | undefined; export declare function resolveProviderChain(options: ResolveProviderChainOptions): Promise;