/** * Failure classification for the inline wire path. The codes must land in * the harness vocabulary dsh-llm-retry understands (AUTH, RATE_LIMIT, * INVALID_REQUEST, SERVER, TIMEOUT, TRANSPORT, QUOTA, * CONTEXT_WINDOW_EXCEEDED, UNKNOWN) so the standard retry policy applies. * Also owns the finish-chunk constructors the two wires share. * @module dsh-github-copilot/failure */ import type { LlmFailure, StreamChunk } from '@deepseek-ai/dsh-llm'; /** * Classify a non-OK HTTP response into the harness failure vocabulary. * @param status - the HTTP status code. * @param retryAfterMs - optional provider-requested delay in milliseconds. * @param requestId - optional provider request id for diagnostics. * @param apiLabel - the API family named in the diagnostic, e.g. `Messages API`. * @returns the failure object for a finish chunk. */ export declare function classifyHttpStatus(status: number, retryAfterMs?: number, requestId?: string, apiLabel?: string): LlmFailure; /** * Parse an HTTP `Retry-After` header value into milliseconds. Only a * non-negative seconds integer is accepted; an HTTP-date or any other value * yields `undefined` rather than a `NaN` delay. * @param retryAfter - the raw header value, or `null` when absent. * @returns the delay in milliseconds, or `undefined`. */ export declare function parseRetryAfterMs(retryAfter: string | null): number | undefined; /** * Classify a transport-level error (fetch throw, timeout, malformed body) * into the harness failure vocabulary. * @param error - the thrown value. * @returns the failure object for a finish chunk. */ export declare function classifyWireError(error: unknown): LlmFailure; /** The finish chunk for any failure; the generator never throws it. */ export declare function errorFinish(failure: LlmFailure): StreamChunk; /** The finish chunk for a caller-aborted request. */ export declare function abortedFinish(): StreamChunk; //# sourceMappingURL=failure.d.ts.map