/** * pi-ai HTTP transport owner (PRI-683). * * Node's global fetch (built-in undici dispatcher) applies implicit default * `headersTimeout`/`bodyTimeout` of 300s per request. LLM repair-wave requests * with large payloads can exceed 300s on server prefill before response * headers arrive, so the request is aborted at exactly 300.0s even when the * runtime profile's timeoutMs is 600s/900s — the configured deadline never * gets a chance to fire (lab evidence: every repair attempt died at * 300.02-300.04s with "Request was aborted", PRI-683). * * The fix reuses pi-ai's official `options.fetch` injection point * (ProviderRequestOptions.fetch) to route PD's LLM requests through a * dedicated undici Agent with both idle/header caps disabled. The only * remaining timeout authorities are then the ones the pipeline already * configures and has verified (adapter AbortSignal.timeout + SDK request * `timeout` + runner deadline, PR #1512). Scoped per-request: the host * process's global dispatcher and globalThis.fetch are left untouched, so * non-PD fetches in the OpenClaw host keep their previous behavior. * * This file is a registered I/O seam (io-seam-registry.json, `pi-ai-http-transport`) * because it imports undici — a transport-layer library import, not business I/O. */ import * as undici from 'undici'; import type { FetchFunction } from '@earendil-works/pi-ai'; /** * Create a fetch bound to a dedicated undici Agent with the 300s * headers/body idle caps disabled. Exported for the mechanism regression * test, which recreates the exact PRI-683 failure at 1s scale by passing a * small timeout here. Production callers use `getPiAiFetch()` (caps disabled). */ export declare function createBoundPiAiFetch(agentOptions?: Pick): FetchFunction; /** * Process-wide singleton fetch for all PD pi-ai LLM requests. The Agent is * reused so its connection pool is shared across every adapter instance * (a per-request Agent would leak sockets). */ export declare function getPiAiFetch(): FetchFunction; /** Whether the given model API accepts the dedicated undici transport. */ export declare function supportsCustomFetchTransport(api: string | undefined): boolean; /** * Fetch for a specific pi-ai model API: the dedicated cap-bypass transport * where the provider supports fetch injection, Node's global fetch where the * provider rejects it. Keeps the OpenAI/undici timeout fix intact without * breaking Google/Gemini/Vertex providers (PR #1524 review P1). */ export declare function getPiAiFetchForApi(api: string | undefined): FetchFunction; /** Test-only: reset the singleton (vitest module state isolation). */ export declare function resetPiAiFetchForTest(): void; //# sourceMappingURL=pi-ai-http-transport.d.ts.map