import type { MonotonicClock, StreamLifecyclePolicy, StreamProviderDeadlineKind, StreamSnapshot } from "./types.js"; export interface TrackedProviderRead { readonly promise: Promise>; readonly settled: boolean; readonly settledAtMs: number | null; readonly result: IteratorResult | null; readonly error: unknown; } export type StreamReadRace = { kind: "part"; result: IteratorResult; } | { kind: "read_error"; error: unknown; } | { kind: "status"; toolCallIds: readonly string[]; } | { kind: "provider_deadline"; deadline: StreamProviderDeadlineKind; } | { kind: "attempt_timeout"; } | { kind: "cancelled"; }; export interface StreamDeadlineController { readonly attemptDeadlineMs: number; resumeProviderWait(snapshot: Readonly): void; pauseProviderWait(): void; noteSemanticProgress(snapshot: Readonly): void; raceProviderRead(read: TrackedProviderRead, signal: AbortSignal): Promise>; dispose(): void; } export declare function trackProviderRead(promise: Promise>, clock: MonotonicClock): TrackedProviderRead; export declare function createStreamDeadlineController(input: { clock: MonotonicClock; policy: StreamLifecyclePolicy; attemptDeadlineMs: number; disposeSignal: AbortSignal; }): StreamDeadlineController; /** * One absolute timer primitive shared by the lifecycle runner and the * compatibility watchdog. The callback fires when the schedule elapses; * dispose() releases it without firing. */ export interface AbsoluteDeadlineTimer { schedule(callback: () => void, delayMs: number): unknown; cancel(handle: unknown): void; } export declare function createClockDeadlineTimer(clock: MonotonicClock): AbsoluteDeadlineTimer; export declare function createAbsoluteDeadline(input: { timer: AbsoluteDeadlineTimer; delayMs: number; onDeadline: () => void; }): { dispose(): void; }; //# sourceMappingURL=deadlines.d.ts.map