//#region src/core/types.d.ts interface SearchResult { url: string; title: string; snippet: string; score?: number; publishedDate?: string; author?: string; image?: string; favicon?: string; text?: string; highlights?: string[]; summary?: string; metadata?: Record; } interface SearchResponse { results: SearchResult[]; metadata?: Record; } /** Normalized state of one provider's search sequence. */ type SearchPagination = { readonly status: "next"; readonly continuation: string; } | { readonly status: "unknown"; readonly continuation: string; } | { readonly status: "end"; } | { readonly status: "unsupported"; }; /** Controls shared by every network-backed operation. */ interface ExecutionOptions { /** Cancels in-flight provider requests. */ readonly signal?: Readonly; /** Absolute Unix timestamp in milliseconds at which the operation is cancelled. */ readonly deadline?: number; /** Maximum requests started concurrently by fan-out and batch helpers. */ readonly concurrency?: number; } interface SearchOptions extends ExecutionOptions { /** Positive integer result limit. */ maxResults?: number; highlights?: boolean; summary?: boolean; fullText?: boolean; includeDomains?: string[]; excludeDomains?: string[]; sources?: string[]; categories?: string[]; startPublishedDate?: string; endPublishedDate?: string; category?: string; } type SearchRequestOptions = Readonly> & { readonly includeDomains?: readonly string[]; readonly excludeDomains?: readonly string[]; readonly sources?: readonly string[]; readonly categories?: readonly string[]; }; /** Detailed search options with an opaque token for one provider and query. */ type SearchPageOptions = SearchRequestOptions & { readonly continuation?: string; /** Keeps favicon URLs on results. Defaults to true; the agent surfaces pass false unless the model asks. */ readonly favicon?: boolean; }; declare const searchFilterNames: readonly ["includeDomains", "excludeDomains", "sources", "categories", "category", "startPublishedDate", "endPublishedDate"]; type SearchFilterName = (typeof searchFilterNames)[number]; /** Search filters a provider forwards, including any accepted singular category values. */ interface SearchFilterCapabilities { readonly filters: readonly SearchFilterName[]; readonly categories?: readonly string[]; } /** One public page and image returned by reverse image search. */ interface ImageSearchResult { pageUrl: string; imageUrl: string; title: string; provider: string; source?: string; thumbnailUrl?: string; imageWidth?: number; imageHeight?: number; thumbnailWidth?: number; thumbnailHeight?: number; position?: number; exactMatch?: boolean; } /** Options shared by reverse image search providers. */ interface ImageSearchOptions extends ExecutionOptions { maxResults?: number; } /** Immutable reverse image search options accepted by providers. */ type ImageSearchRequestOptions = Readonly; interface ReadResult { url: string; title?: string; description?: string; content: string; text?: string; html?: string; publishedDate?: string; image?: string; links?: string[]; images?: string[]; metadata?: Record; truncated?: boolean; continuation?: string; } interface ReadOptions extends ExecutionOptions { format?: "markdown" | "text" | "html"; maxTokens?: number; targetSelector?: string; removeSelector?: string; timeout?: number; noCache?: boolean; } /** OAuth access for the ChatGPT Codex backend, not an OpenAI API key. */ interface CodexCredentials { readonly accessToken: string; /** Defaults to the chatgpt_account_id claim in the access token. */ readonly accountId?: string; } /** Refresh is requested at most once, after the backend rejects authentication. */ interface CodexCredentialRequest { readonly refresh: boolean; readonly signal: Readonly; } /** The caller owns token storage, expiry checks, refresh, and concurrent refresh coordination. */ type CodexCredentialProvider = (request: CodexCredentialRequest) => CodexCredentials | Promise; /** Native login selection; none disables automatic local and host credentials. */ type CodexAuthSource = "auto" | "codex" | "pi" | "omp" | "opencode" | "none"; /** Explicit Codex configuration takes precedence over environment credentials and model. */ interface CodexConfig { readonly credentials?: CodexCredentials | CodexCredentialProvider; readonly model?: string; /** Defaults to auto, or OPENAI_CODEX_AUTH_SOURCE when set. */ readonly authSource?: CodexAuthSource; } interface ProviderConfig { apiKey?: string; baseURL?: string; readBaseURL?: string; codex?: CodexConfig; } interface ClientOptions { readonly maxRetries?: number; baseDelay?: number; timeout?: number; userAgent?: string; } //#endregion //#region src/core/client.d.ts /** HTTP client with exponential backoff retry and error mapping to web error types. */ declare class Client { readonly maxRetries: number; readonly baseDelay: number; readonly timeout: number; readonly userAgent: string; private readonly fetch; constructor(options?: Readonly); /** * Send a GET request and parse the JSON response. * @param {string} url - Request URL. * @param {Readonly>} headers - Additional headers. * @param {Readonly} signal - Cancellation signal. * @returns {Promise} Parsed response body. */ getJSON(url: string, headers?: Readonly>, signal?: Readonly): Promise; /** * Send a POST request with a JSON body and parse the JSON response. * @param {string} url - Request URL. * @param {Readonly>} body - JSON request body. * @param {Readonly>} headers - Additional headers. * @param {Readonly} signal - Cancellation signal. * @returns {Promise} Parsed response body. */ postJSON(url: string, body: Readonly>, headers?: Readonly>, signal?: Readonly): Promise; /** * Stream a metered POST without retries, redirects, or upstream error bodies. * @param url - Request URL. * @param body - JSON request body. * @param headers - Authentication and protocol headers. * @param signal - Caller cancellation. * @yields {unknown} Parsed JSON data events. * @returns {AsyncGenerator} Bounded JSON SSE events. */ postSSE(url: string, body: Readonly>, headers?: Readonly>, signal?: Readonly): AsyncGenerator; private openSSE; private fetchWithCancellation; /** * ofetch skips its own timeout once a signal is supplied, so each attempt gets one here. * @param request - Function that performs one attempt with the effective signal. * @param signal - Caller cancellation signal. * @returns {Promise} Parsed response body. */ private requestWithTimeout; private retryDelay; private mapError; } /** * Lazily-initialized singleton {@link Client} used by all providers. * @returns {Client} Shared client instance. */ declare function defaultClient(): Client; //#endregion //#region src/core/provider.d.ts type ProviderCapability = "search" | "searchImage" | "read"; type SearchResultField = Exclude; type SearchContentOptionName = "highlights" | "summary" | "fullText"; type ReadOptionName = Exclude; type ReadFormat = NonNullable; /** Known result count behavior exposed by one provider adapter. */ type ProviderResultLimit = { readonly default: number; readonly maximum?: number; } | { readonly default?: never; readonly maximum: number; }; /** Static search metadata that cannot be inferred from method presence. */ interface SearchCapabilityDetails { readonly contentOptions: readonly SearchContentOptionName[]; readonly resultLimit?: ProviderResultLimit; readonly resultFields: readonly SearchResultField[]; } /** Static reverse image search metadata that cannot be inferred from method presence. */ interface ImageSearchCapabilityDetails { readonly resultLimit: ProviderResultLimit; } /** Static URL reader metadata that cannot be inferred from method presence. */ interface ReadCapabilityDetails { readonly options: readonly ReadOptionName[]; readonly formats: readonly ReadFormat[]; } /** Optional details declared by a provider class for each implemented operation. */ interface ProviderCapabilityDetails { readonly search?: SearchCapabilityDetails; readonly searchImage?: ImageSearchCapabilityDetails; readonly read?: ReadCapabilityDetails; } /** Machine-readable search capability reported by provider discovery. */ interface ProviderSearchCapabilities { readonly supported: boolean; readonly filters?: readonly SearchFilterName[]; readonly categories?: readonly string[]; readonly contentOptions?: readonly SearchContentOptionName[]; readonly pagination?: boolean; readonly resultLimit?: ProviderResultLimit; readonly resultFields?: readonly SearchResultField[]; } /** Machine-readable reverse image search capability reported by provider discovery. */ interface ProviderImageSearchCapabilities { readonly supported: boolean; readonly resultLimit?: ProviderResultLimit; } /** Machine-readable URL reader capability reported by provider discovery. */ interface ProviderReadCapabilities { readonly supported: boolean; readonly options?: readonly ReadOptionName[]; readonly formats?: readonly ReadFormat[]; } /** Complete operation matrix for one registered provider. */ interface ProviderCapabilities { readonly search: ProviderSearchCapabilities; readonly searchImage: ProviderImageSearchCapabilities; readonly read: ProviderReadCapabilities; } interface ProviderConstructor { readonly providerName: string; readonly defaultBaseURL: string; readonly apiKeyEnvVar?: string | null; /** Optional local configuration check for providers requiring more than one credential. */ readonly isConfigured?: () => boolean; readonly capabilities?: readonly ProviderCapability[]; readonly capabilityDetails?: ProviderCapabilityDetails; readonly searchFilterCapabilities?: SearchFilterCapabilities; readonly prototype: Readonly; new (config: Readonly): Provider; } declare abstract class Provider { #private; protected readonly client: Client; protected readonly baseURL: string; get name(): string; protected constructor(config: Readonly, provider: Pick); } interface SearchProvider { search(query: string, options?: SearchRequestOptions): Promise; } interface DetailedSearchProvider { searchDetailed(query: string, options?: SearchRequestOptions): Promise; } /** One provider page with an opaque provider-native token for the next page. */ interface ProviderSearchPage extends SearchResponse { continuation?: string; continuationStatus?: "next" | "unknown"; } /** Optional paging contract implemented without exposing provider state to callers. */ interface PaginatedSearchProvider { searchPage(query: string, options?: SearchRequestOptions, continuation?: string): Promise; } /** Provider capability for finding public pages from an image URL. */ interface ImageSearchProvider { searchByImage(url: string, options?: ImageSearchRequestOptions): Promise; } interface ReadProvider { read(url: string, options?: Readonly): Promise; } interface AvailabilityProvider { isAvailable(signal?: Readonly): Promise; } declare function isSearchProvider(provider: object): provider is Provider & SearchProvider; declare function isDetailedSearchProvider(provider: object): provider is Provider & DetailedSearchProvider; declare function isPaginatedSearchProvider(provider: object): provider is Provider & SearchProvider & PaginatedSearchProvider; /** * Return whether a provider implements reverse image search. * @param provider - Provider instance to inspect. * @returns {boolean} Whether the capability is present. */ declare function isImageSearchProvider(provider: object): provider is Provider & ImageSearchProvider; declare function isReadProvider(provider: object): provider is Provider & ReadProvider; declare function isAvailabilityProvider(provider: object): provider is Provider & AvailabilityProvider; //#endregion export { Client as A, ImageSearchRequestOptions as B, SearchResultField as C, isPaginatedSearchProvider as D, isImageSearchProvider as E, CodexCredentialProvider as F, SearchFilterCapabilities as G, ProviderConfig as H, CodexCredentialRequest as I, SearchPageOptions as J, SearchFilterName as K, CodexCredentials as L, ClientOptions as M, CodexAuthSource as N, isReadProvider as O, CodexConfig as P, SearchResult as Q, ExecutionOptions as R, SearchProvider as S, isDetailedSearchProvider as T, ReadOptions as U, ImageSearchResult as V, ReadResult as W, SearchRequestOptions as X, SearchPagination as Y, SearchResponse as Z, ReadFormat as _, PaginatedSearchProvider as a, SearchCapabilityDetails as b, ProviderCapability as c, ProviderImageSearchCapabilities as d, ProviderReadCapabilities as f, ReadCapabilityDetails as g, ProviderSearchPage as h, ImageSearchProvider as i, defaultClient as j, isSearchProvider as k, ProviderCapabilityDetails as l, ProviderSearchCapabilities as m, DetailedSearchProvider as n, Provider as o, ProviderResultLimit as p, SearchOptions as q, ImageSearchCapabilityDetails as r, ProviderCapabilities as s, AvailabilityProvider as t, ProviderConstructor as u, ReadOptionName as v, isAvailabilityProvider as w, SearchContentOptionName as x, ReadProvider as y, ImageSearchOptions as z }; //# sourceMappingURL=provider-BeqDw0W2.d.mts.map