/** * Stream Outcome: the single place that interprets how a provider stream ended. * * Both the runtime layer (which starts streams) and the hosted layer (which * finishes them) need to answer the same questions: what error message does a * thrown value carry, was it the late body-read failure, did the final step * complete, and does the error map to a known terminal provider error. Before * this module those answers were byte-identical private copies on both sides * of the runtime/hosted boundary with nothing keeping them in sync. */ /** Extract a human-readable message from any value a provider stream can throw. */ export declare function getStreamErrorMessage(error: unknown): string; /** * True for the "error reading a body from connection" failure some providers * raise after all output has already streamed. Treated as a completed stream * when output and a completion signal are present. */ export declare function isLateProviderBodyReadError(error: unknown): boolean; /** True when a thrown stream error represents a lifecycle or watchdog timeout. */ export declare function isStreamTimeoutError(error: unknown): boolean; /** True when the provider finish reason marks a completed step. */ export declare function hasCompletedStepSignal(finishReason: string | null): boolean; /** * Map a thrown provider error to a terminal `{code, message}` pair, or null * for the generic "LLM provider service error" (which callers treat as * unknown/retryable rather than terminal). */ export declare function resolveKnownProviderTerminalError(error: unknown): { code: string; message: string; } | null; import type { StreamCancellationSource, StreamCommittedToolCall, StreamLifecycleError, StreamOutcome, StreamProviderError, StreamSnapshot } from "./lifecycle/types.js"; /** Input accepted by the shared terminal classifier. */ export interface ResolveStreamOutcomeInput { snapshot: StreamSnapshot; elapsedMs: number; cancellation?: StreamCancellationSource; lifecycleError?: StreamLifecycleError; thrownError?: unknown; providerError?: StreamProviderError; } /** * The sole terminal classifier for provider stream attempts. The lifecycle * runner and hosted compatibility finalization both resolve their Stream * Outcome here so terminal meaning cannot drift between layers. */ export declare function resolveStreamOutcome(input: ResolveStreamOutcomeInput): StreamOutcome; /** Committed local tool calls projected from a terminal snapshot. */ export declare function collectCommittedLocalToolCalls(snapshot: Readonly): StreamCommittedToolCall[]; //# sourceMappingURL=stream-outcome.d.ts.map