import type { PlatformAdapter } from '../../platform/index.js'; /** Interactive action id used on rate-limit notices ("Resume now" button). Handlers are * registered by the composition root via adapter.onAction; the button value carries the * provider key (empty = all providers). */ export declare const RATE_LIMIT_CLEAR_ACTION_ID = "rate-limit:clear"; export interface RateLimitSource { provider: string; displayName: string; mode?: string; } export interface RateLimitWindowState { type: string; utilization: number | null; resetsAt: number; activatedAt: number; } export interface ProviderThrottleState { provider: string; displayName: string; modes: string[]; windows: RateLimitWindowState[]; } export interface RateLimitThrottleState { providers: ProviderThrottleState[]; } export interface LegacyThrottleState { resetsAt: number; activatedAt: number; modes?: string[]; types?: string[]; } export type PersistedThrottleState = RateLimitThrottleState | LegacyThrottleState; export interface ThrottlePersistence { save: (state: RateLimitThrottleState | null) => Promise; load: () => Promise; } export interface ThrottleStateView extends RateLimitThrottleState { isThrottled: boolean; resetsAt: number | null; rateLimitedModes: string[]; rateLimitedTypes: string[]; } export interface ClearedThrottleProvider { provider: string; displayName: string; /** Window types cleared (e.g. five_hour / outage). */ types: string[]; /** Latest resetsAt among the cleared windows (epoch sec) — how long was remaining. */ resetsAt: number; } export interface ClearThrottleResult { cleared: ClearedThrottleProvider[]; } interface RateLimitInfo { status?: string; resetsAt?: number; rateLimitType?: string; utilization?: number; isUsingOverage?: boolean; surpassedThreshold?: number; } declare function initRateLimitThrottle(adapter: PlatformAdapter, persistence: ThrottlePersistence, onResume?: (providers: string[]) => void, onChange?: () => void): Promise; declare function activateOutageWindow(provider: string | null, durationMs: number): Promise; declare function handleRateLimitEvent(info: RateLimitInfo, rawSource?: string | RateLimitSource): Promise; /** Manually lift an active rate-limit (or outage) throttle early, for one provider or all. * Walks the same recovery path as a natural window expiry: persists the cleared state, * re-schedules the resume timer, notifies the UI, and fires onResume so paused work is * dispatched immediately. Idempotent — no active window yields an empty result and no notices. * If the provider is actually still rate-limited, the next API call's rate-limit event * re-activates the throttle automatically. */ declare function clearThrottle(provider?: string | null): Promise; declare function isThrottled(): boolean; declare function isProviderRateLimited(provider: string | null | undefined): boolean; declare function isProviderUsageRateLimited(provider: string | null | undefined): boolean; declare function isProviderModeRateLimited(provider: string, mode: string): boolean; declare function isModeRateLimited(mode: string): boolean; declare function getThrottleState(): ThrottleStateView; declare function _testReset(): void; export { initRateLimitThrottle, activateOutageWindow, handleRateLimitEvent, clearThrottle, isThrottled, isProviderRateLimited, isProviderUsageRateLimited, isProviderModeRateLimited, isModeRateLimited, getThrottleState, _testReset, };