/** * Parallel AI direct HTTP transport. * * Performs direct HTTP requests against Parallel AI API endpoints. */ import type { ProviderQuotaFetchResponse } from "../types.js"; export interface ParallelTransportDeps { readonly fetch?: (input: string, init: Record) => Promise; readonly setTimeout?: typeof setTimeout; readonly clearTimeout?: typeof clearTimeout; readonly env?: NodeJS.ProcessEnv; } export interface ParallelSearchParams { readonly objective?: string; /** * Advanced search settings forwarded to Parallel's API * (8P.3 — control acceptance). Contains source_policy, location, * and excerpt_settings mapped from provider-neutral SearchControls. */ readonly advanced_settings?: { readonly source_policy?: { readonly include_domains?: readonly string[]; readonly after_date?: string; }; readonly location?: string; readonly excerpt_settings?: { readonly max_chars_per_result?: number; }; }; } export interface ParallelSearchResultItem { readonly title?: string; readonly url?: string; readonly excerpts?: readonly string[]; readonly publish_date?: string | null; } export interface ParallelSearchResponse { readonly search_id?: string; readonly results?: readonly ParallelSearchResultItem[]; readonly usage?: readonly unknown[]; readonly session_id?: string; } export declare function resolveTimeoutMs(env: NodeJS.ProcessEnv): number; export declare function fetchParallelSearch(apiKey: string, query: string, params?: ParallelSearchParams, deps?: ParallelTransportDeps, externalSignal?: AbortSignal): Promise; export interface ParallelExtractResultItem { readonly url?: string; readonly title?: string; readonly publish_date?: string | null; readonly excerpts?: readonly string[]; readonly full_content?: string; } export interface ParallelExtractErrorEntry { readonly url?: string; readonly error_type?: string; readonly http_status_code?: number; } export interface ParallelExtractResponse { readonly results?: readonly ParallelExtractResultItem[]; readonly errors?: readonly ParallelExtractErrorEntry[]; } export declare function fetchParallelExtract(apiKey: string, targetUrl: string, deps?: ParallelTransportDeps, options?: { /** * Caller's per-request timeout budget in seconds (CC-6, #70). * Forwarded as the documented Extract `advanced_settings. * fetch_policy.timeout_seconds` knob and used to raise the * client-side abort budget. */ readonly timeoutSeconds?: number; }): Promise; /** * Provider-native Task API request fields (Parallel field names). The * Adapter maps the provider-neutral `ResearchRequest` into these before * calling {@link createParallelTaskRun}. */ export interface ParallelTaskParams { /** Processor tier: pro, ultra, pro-fast, ultra-fast. */ readonly processor: string; /** Restrict research to specific domains. */ readonly source_policy?: { readonly include_domains?: readonly string[]; readonly exclude_domains?: readonly string[]; readonly after_date?: string; }; /** Geo-targeted search results (ISO 3166-1 alpha-2). */ readonly advanced_settings?: { readonly location?: string; }; /** Output schema — text mode produces a markdown report. */ readonly task_spec?: { readonly output_schema: { readonly type: "text"; readonly description?: string; }; }; } /** Structured result of POST /v1/tasks/runs (HTTP 202). */ export interface ParallelTaskRunCreateResult { readonly runId: string; readonly status: string; } /** A single citation from the research basis. */ export interface ParallelTaskCitation { readonly title?: string; readonly url: string; readonly excerpts?: readonly string[]; } /** * Structured result of GET /v1/tasks/runs/{run_id}/result. `status: * "running"` covers both the explicit 408 (server long-poll timed out) * and a 200 whose `run.status` is not yet terminal. `status: * "not_found"` covers HTTP 404 (run failed or run_id expired). */ export interface ParallelTaskRunResult { readonly status: "completed" | "running" | "failed" | "not_found"; readonly content?: string; readonly citations?: readonly ParallelTaskCitation[]; readonly processor?: string; readonly errorMessage?: string; } /** * Perform ONE POST against the Parallel /v1/tasks/runs endpoint to start * a Deep Research task run. No retry — a transient POST failure is * terminal (the user re-runs); retrying risks a double-charge if the * POST succeeded server-side but the response was lost. Returns the * structured create result `{ runId, status }`. */ export declare function createParallelTaskRun(apiKey: string, input: string, params: ParallelTaskParams, deps?: ParallelTransportDeps, externalSignal?: AbortSignal): Promise; /** * Perform ONE GET against the Parallel /v1/tasks/runs/{run_id}/result * endpoint. This is a server-side long-poll: the server blocks up to * `RESULT_POLL_SERVER_TIMEOUT_S` seconds, then returns 408 if the run is * still active. On 200, the response includes `run.status` and (if * completed) `output.content` + `output.basis`. On 404, the run failed * or the run_id expired. * * The client-side AbortController timeout is set to * `max(PARALLEL_TIMEOUT, (server_timeout + 30)s)` so the server's 408 * arrives before our timeout fires. The external signal (from the * command handler's `--timeout`) can abort at any time. */ export declare function retrieveParallelTaskRunResult(apiKey: string, runId: string, deps?: ParallelTransportDeps, externalSignal?: AbortSignal): Promise; //# sourceMappingURL=client.d.ts.map