import type { ServiceRegistry } from '../../config/service-registry.js';
import { type FetchOutput, type FetchUrlResult } from '../../tools/fetch/index.js';
import type { FetchAuthInput, FetchInput } from '../../tools/fetch/schema.js';
import type { WebSearchEvidence, WebSearchProviderDescriptor, WebSearchResult } from '../types.js';
type EnvMap = Record<string, string | undefined>;
type FetchExecutor = (input: FetchInput) => Promise<FetchOutput>;
export interface SearchProviderContext {
    readonly fetcher?: FetchExecutor | undefined;
    readonly env: EnvMap;
    readonly serviceRegistry: Pick<ServiceRegistry, 'get'>;
}
export interface SearchProviderConfig {
    readonly id: string;
    readonly label: string;
    readonly note: string;
    readonly envKeyCandidates?: readonly string[] | undefined;
    readonly serviceName?: string | undefined;
    readonly baseUrlEnvCandidates?: readonly string[] | undefined;
    readonly defaultBaseUrl?: string | undefined;
    readonly requiresAuth?: boolean | undefined;
}
export interface JsonRequestConfig {
    readonly url: string;
    readonly method?: 'GET' | 'POST' | undefined;
    readonly params?: Record<string, string> | undefined;
    readonly body?: Record<string, unknown> | undefined;
    readonly headers?: Record<string, string> | undefined;
    readonly service?: string | undefined;
    readonly auth?: FetchAuthInput | undefined;
    readonly fetcher?: FetchExecutor | undefined;
    readonly maxContentLength?: number | undefined;
}
export interface JsonRequestResult<T = unknown> {
    readonly payload: T;
    readonly response: FetchUrlResult;
}
export declare function resolveDomain(url: string): string | undefined;
export declare function trimSnippet(value: unknown, limit?: number): string | undefined;
export declare function makeEvidence(url: string, content: unknown, metadata?: Record<string, unknown>, extract?: 'raw' | 'text' | 'json' | 'markdown' | 'readable' | 'code_blocks' | 'links' | 'metadata' | 'structured' | 'tables' | 'pdf' | 'summary'): WebSearchEvidence[] | undefined;
export declare function withInlineApiKey(env: EnvMap, envKeys: readonly string[] | undefined, headerName: string): FetchAuthInput | undefined;
export declare function withInlineBearer(env: EnvMap, envKeys: readonly string[] | undefined): FetchAuthInput | undefined;
export declare function hasConfiguredCredential(serviceRegistry: Pick<ServiceRegistry, 'get'>, env: EnvMap, envKeys: readonly string[] | undefined, serviceName?: string): boolean;
export declare function resolveBaseUrl(serviceRegistry: Pick<ServiceRegistry, 'get'>, env: EnvMap, envKeys: readonly string[] | undefined, serviceName: string | undefined, defaultBaseUrl?: string): string | null;
export declare function buildDescriptor(config: SearchProviderConfig, context: SearchProviderContext): WebSearchProviderDescriptor;
export declare function executeJsonRequest<T = unknown>(config: JsonRequestConfig): Promise<JsonRequestResult<T>>;
export declare function resultFromRecord(providerId: string, rank: number, record: Record<string, unknown>, options?: {
    readonly urlKeys?: readonly string[] | undefined;
    readonly titleKeys?: readonly string[] | undefined;
    readonly snippetKeys?: readonly string[] | undefined;
    readonly displayUrlKeys?: readonly string[] | undefined;
    readonly evidenceKeys?: readonly string[] | undefined;
    readonly metadata?: Record<string, unknown> | undefined;
}): WebSearchResult | null;
export declare function firstString(record: Record<string, unknown>, keys: readonly string[]): string | undefined;
export {};
//# sourceMappingURL=shared.d.ts.map