import type { LanguageModelV4StreamPart, LanguageModelV4StreamResult } from "@ai-sdk/provider"; import type { HealthTransition } from "./health-store.js"; import { type FallbackPumpConfig } from "./stream-config.js"; import { StreamLifecycleValidator } from "./stream-lifecycle-validator.js"; import type { StreamJsonBudget } from "./stream-part-json.js"; import { type CapturedReader } from "./stream-reader.js"; import type { FallbackStreamArgs, ResolvedEntry } from "./stream-types.js"; import type { FailureClassification, OnRouterAttempt, RouterOrderingToken } from "./types.js"; export declare abstract class FallbackPumpContext { protected committed: boolean; protected candidateCommitted: boolean; protected finished: boolean; protected readonly metadataNodeCounts: WeakMap; protected readonly opaquePartTypes: WeakMap; protected readonly streamJsonBudget: { remainingFileBytes: number; remaining: number; remainingCharacters: number; remainingMetadataCharacters: number; }; protected candidateBudgetCheckpoint: StreamJsonBudget; protected prelude: LanguageModelV4StreamPart[]; protected preludeMetadataNodes: number; protected preludeTextChars: number; protected cancelled: boolean; protected cancelReason: unknown; protected readonly errors: unknown[]; protected activeReader: CapturedReader | null; protected resumeDemand?: () => void; protected readonly candidates: ResolvedEntry[]; protected readonly config: FallbackPumpConfig; protected readonly acquireCandidate: FallbackStreamArgs["acquireCandidate"]; protected readonly candidateAvailable: FallbackStreamArgs["candidateAvailable"]; protected readonly candidateInFlight: FallbackStreamArgs["candidateInFlight"]; protected readonly concurrencyLimit: FallbackStreamArgs["concurrencyLimit"]; protected readonly prepareCandidate: FallbackStreamArgs["prepareCandidate"]; protected readonly releaseCandidate: FallbackStreamArgs["releaseCandidate"]; protected readonly releaseProbeCandidate: FallbackStreamArgs["releaseProbeCandidate"]; protected readonly waitForCandidate: FallbackStreamArgs["waitForCandidate"]; protected readonly classifyFailure: FallbackStreamArgs["classifyFailure"]; protected readonly isBudgetFailure: FallbackStreamArgs["isBudgetFailure"]; protected readonly nextOrderingToken: FallbackStreamArgs["nextOrderingToken"]; protected readonly onAdvance: FallbackStreamArgs["onAdvance"]; protected readonly onAttempt: FallbackStreamArgs["onAttempt"]; protected readonly onCandidateFailure: FallbackStreamArgs["onCandidateFailure"]; protected readonly onCandidateSuccess: FallbackStreamArgs["onCandidateSuccess"]; protected readonly onError: FallbackStreamArgs["onError"]; protected readonly onRequestOutcome: FallbackStreamArgs["onRequestOutcome"]; protected readonly shouldRetry: FallbackStreamArgs["shouldRetry"]; protected readonly setActive: (result: LanguageModelV4StreamResult) => void; protected readonly controller: ReadableStreamDefaultController; protected attemptsStarted: number; protected attemptStartedAt: number; protected attemptOrderingToken: RouterOrderingToken; protected validator: StreamLifecycleValidator; protected activeInFlight?: number; protected activeIndex?: number; protected pendingFallbackIndex?: number; protected waitingIndex?: number; protected cancelledPendingIndex?: number; protected budgetFailureObserved: boolean; protected budgetSuppressed: boolean; protected deferSkippedAttemptEvents: boolean; protected readonly deferredSkippedAttemptEvents: Parameters[0][]; protected requestOutcomeObserved: boolean; protected readonly operationAbort: AbortController; protected removeCallerAbort?: () => void; protected callerAbortObserved: boolean; protected callerAbortReason: unknown; protected abstract captureCallerAbortReason(signal: AbortSignal | undefined): unknown; protected abstract cleanupAbortForwarding(): void; protected abstract emitAttempt(idx: number, outcome: "success" | "failure" | "cancelled", error?: unknown, failure?: FailureClassification, willRetry?: boolean, healthTransition?: HealthTransition, inFlight?: number): void; protected abstract finishRequest(success: boolean): void; protected abstract pump(result: LanguageModelV4StreamResult, idx: number): Promise; protected abstract releaseActiveCandidate(): void; constructor(args: FallbackStreamArgs, setActive: (result: LanguageModelV4StreamResult) => void, controller: ReadableStreamDefaultController, firstResult: LanguageModelV4StreamResult); }