import type { WorkerConfig } from "./config"; /** * fetch() with a hard timeout. Node's global fetch has no default timeout, so a * server that accepts the TCP connection but never responds (proxy hang, cold * start, TLS stall) makes an awaited fetch hang FOREVER. At boot that wedged the * whole worker before it could log or heartbeat. AbortSignal.timeout bounds every * call so a slow/black-holed API degrades to a fallback instead of a hang. */ export declare function fetchWithTimeout(url: string, init?: RequestInit, timeoutMs?: number): Promise; /** * Operational config served by the API (the source of truth). Mirrors the * API's WorkerOperationalConfig. Bootstrap keys (API_BASE_URL, WORKER_ID, * Redis) are NOT here — a worker needs those locally just to reach the API. */ export interface ApiWorkerConfig { dockerImage?: string; crawlerRedisUrl?: string; containerCount?: number; logLevel?: string; idleTimeoutSecs?: number; minPagesPerWorker?: number; bullmqLockDurationMs?: number; bullmqStalledIntervalMs?: number; runExecutionQueue?: string; redisUrl?: string; } export interface ApiConfigResult { config: ApiWorkerConfig; version: number; } /** * Fetch this worker's effective config (global overlaid with any per-worker * override) from the API. Returns null on failure so the caller can fall back * to local env. */ export declare function fetchApiConfig(apiBaseUrl: string, workerId: string): Promise; /** * Load the last-known-good API config from disk. Used at boot only when the API * is unreachable, so a rebooted node doesn't fall all the way back to local * env. Returns null if no cache exists or it's unreadable. */ export declare function loadCachedApiConfig(): Promise; /** * Overlay API config onto a locally-bootstrapped WorkerConfig. API values win * for operational keys (the source of truth); a key absent from the API leaves * the local value intact. Returns a NEW config object plus the keys that * actually changed (for hot-reload decisions) and the API config version. * * Bootstrap keys (apiBaseUrl, workerId, redis*) are never touched. */ export declare function mergeApiConfig(local: WorkerConfig, api: ApiWorkerConfig): { merged: WorkerConfig; changed: (keyof WorkerConfig)[]; }; //# sourceMappingURL=api-config.d.ts.map