| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- export type ModelRef = {
- /** Provider/model string (e.g. "openai/gpt-4o-mini"). */
- id: string;
- /** Optional model variant annotation. */
- variant?: string;
- };
- export type SmartfetchOptions = {
- binaryDir?: string;
- /**
- * Dedicated model(s) for secondary-model summarization.
- * Each entry is tried in order; the first to return usable text is used.
- */
- webfetchModels?: ModelRef[];
- };
- export type SecondaryModel = {
- providerID: string;
- modelID: string;
- /** Optional model variant passed at the body level. */
- variant?: string;
- };
- export type RedirectStep = {
- from: string;
- to: string;
- status: number;
- };
- export type CachedFetch = {
- requestedUrl: string;
- finalUrl: string;
- statusCode: number;
- contentType: string;
- charset?: string;
- etag?: string;
- lastModified?: string;
- contentLength?: number;
- filename?: string;
- canonicalUrl?: string;
- headings?: string[];
- title?: string;
- rawContent: string;
- markdown: string;
- text: string;
- html: string;
- extractedMain: boolean;
- usedLlmsTxt: boolean;
- sourceKind: 'llms_txt' | 'html' | 'text';
- upgradedToHttps: boolean;
- redirectChain: RedirectStep[];
- truncated: boolean;
- wordCount: number;
- qualitySignals?: string[];
- llmsProbeError?: string;
- llmsProbeTruncated?: boolean;
- cacheRevalidated?: boolean;
- upstreamStatusCode?: number;
- cacheHit?: boolean;
- decodedCharset?: string;
- decodeFallback?: boolean;
- decodeWarning?: string;
- secondaryModelInputTruncated?: boolean;
- secondaryModelInputChars?: number;
- secondaryModelSourceChars?: number;
- };
- export type BinaryFetch = {
- requestedUrl: string;
- finalUrl: string;
- statusCode: number;
- contentType: string;
- charset?: string;
- etag?: string;
- lastModified?: string;
- contentLength?: number;
- filename?: string;
- canonicalUrl?: string;
- redirectChain: RedirectStep[];
- upgradedToHttps: boolean;
- truncated: boolean;
- binary: true;
- binaryKind: 'image' | 'audio' | 'video' | 'pdf' | 'binary';
- downloadLimitBytes?: number;
- metadataOnly?: boolean;
- data?: Uint8Array;
- llmsProbeError?: string;
- llmsProbeTruncated?: boolean;
- cacheRevalidated?: boolean;
- upstreamStatusCode?: number;
- cacheHit?: boolean;
- };
- export type FetchResult = CachedFetch | BinaryFetch;
- export type DecodedBody = {
- text: string;
- decodedCharset: string;
- decodeFallback: boolean;
- decodeWarning?: string;
- };
- export type ExtractedContent = {
- title?: string;
- rawContent: string;
- markdown: string;
- text: string;
- html: string;
- extractedMain: boolean;
- canonicalUrl?: string;
- headings?: string[];
- };
- export type FetchWithRedirectsResult =
- | {
- blockedRedirect: true;
- redirectUrl: string;
- statusCode: number;
- redirectChain: RedirectStep[];
- }
- | {
- response: Response;
- finalUrl: string;
- redirectChain: RedirectStep[];
- };
- export type LlmsProbeResult =
- | {
- url: string;
- statusCode: number;
- redirectChain: RedirectStep[];
- text: string;
- headers: {
- contentType?: string;
- charset?: string;
- etag?: string;
- lastModified?: string;
- contentLength?: number;
- filename?: string;
- };
- truncated: boolean;
- decodedCharset: string;
- decodeFallback: boolean;
- decodeWarning?: string;
- upgradedToHttps: boolean;
- }
- | {
- error?: string;
- };
|