/** * Reading the Zen catalogue's sources over the network — the one module in * this package that does, and only when a caller invokes it. Importing it, * constructing a provider or reading the bundled snapshot fetches nothing. */ import type { ZenService } from '../models.js'; import { type BuildZenCatalogueOptions, type ZenCatalogueResult, type ZenCatalogueSources } from './catalogue.js'; /** The branch of OpenCode's repository the two documentation pages are read from. */ export declare const ZEN_DOCS_REF = "dev"; export declare const ZEN_MODELS_DEV_URL = "https://models.dev/api.json"; /** The host both services' own `/models` endpoints hang off. */ export declare const ZEN_SERVICE_BASE = "https://opencode.ai"; /** Byte ceilings per source. A source past its ceiling is refused, never truncated. */ export interface ZenCatalogueLimits { /** Each documentation page. Default 1 MiB (the live pages are ~32 KB). */ readonly pageBytes?: number; /** models.dev's whole document. Default 32 MiB (measured 4.8 MB on 2026-09-22). */ readonly modelsDevBytes?: number; /** Each `/models` answer. Default 1 MiB, the driver's own `listModels` ceiling. */ readonly servedBytes?: number; } export interface FetchZenCatalogueOptions { /** Defaults to the global `fetch`. */ readonly fetch?: typeof fetch; /** Aborts every outstanding read; the call then rejects with the signal's reason. */ readonly signal?: AbortSignal; /** Deadline for each source read, in milliseconds. Default 15,000. */ readonly timeoutMs?: number; /** Tries per source; a 404 is never retried. Default 1. */ readonly attempts?: number; readonly limits?: ZenCatalogueLimits; /** OpenCode branch for the two pages. Default `dev`. */ readonly docsRef?: string; readonly modelsDevUrl?: string; /** Host for the two `/models` answers. Default `https://opencode.ai`. */ readonly serviceBase?: string; } /** The URL of one service's documentation page. */ export declare function zenDocsUrl(service: ZenService, ref?: string): string; /** The models-list endpoint of one service. */ export declare function zenServedUrl(service: ZenService, serviceBase?: string): string; /** * One source, as text, inside its deadline and its byte ceiling. * * Redirects are refused: every source is a fixed URL that answers directly, and * a source that starts redirecting has moved. A 404 is a branch or a path that * moved and is not retried; a caller's abort is not retried either. */ export declare function readZenSource(url: string, limit: number, options?: Pick): Promise; /** The two `/models` answers, as text. */ export declare function fetchZenServedRosters(options?: FetchZenCatalogueOptions): Promise>; /** * All five sources, as text: the two documentation pages, models.dev and the * two `/models` answers. Rejects on the first source that cannot be read. */ export declare function fetchZenCatalogueSources(options?: FetchZenCatalogueOptions): Promise; /** * Read every source and derive a catalogue from them, or reject. * * Opt-in by construction: nothing in this package calls it. A rejection is a * `ZenCatalogueSourceError` for a source that could not be read or no longer * parses, or the caller's abort reason; there is no partial result. */ export declare function fetchZenCatalogue(options?: FetchZenCatalogueOptions & BuildZenCatalogueOptions): Promise; //# sourceMappingURL=fetch.d.ts.map