/** * Environment variable that overrides the path of the shared secondary rate * limit state file. When absent the file lives under the TDPM cache * directory so all processes on the host share the same path automatically. */ export declare const SECONDARY_RATE_LIMIT_STATE_FILE_ENV_VAR = "TDPM_GH_SECONDARY_RATE_LIMIT_STATE_FILE"; /** * State older than this is treated as non-blocking. A crashed writer cannot * wedge the fleet permanently beyond one hour. */ export declare const STALE_STATE_MAX_AGE_MS: number; export interface SecondaryRateLimitState { /** Epoch milliseconds at which the block expires (or should have expired). */ resetTimeMs: number; /** Epoch milliseconds at which the block was first detected. */ detectedAtMs: number; } export declare const secondaryRateLimitStateFilePath: () => string; /** * Reads the shared state file. Returns null on any I/O or parse error so * the caller always falls back to the non-blocking path rather than * crashing. */ export declare const readSecondaryRateLimitState: (filePath?: string) => SecondaryRateLimitState | null; /** * Writes the state file atomically (temp-file then rename) so a concurrent * reader never sees a partial file. Errors are swallowed: failure to write * means other processes simply do not benefit from this detection, which * degrades gracefully to the pre-breaker behaviour. */ export declare const writeSecondaryRateLimitState: (resetTimeMs: number, detectedAtMs: number, filePath?: string) => void; export interface SecondaryRateLimitBreakerResult { isBlocked: boolean; /** Present only when isBlocked is true. */ resetTimeMs: number | null; } /** * Checks whether a previously recorded secondary rate limit block is still * active. * * Returns { isBlocked: false } in every error or edge case: * - State file is missing, unreadable, or malformed. * - State file is stale (detectedAtMs more than one hour ago). * - Reset time has already passed. * * This ensures a crashed or hung writer cannot wedge the fleet permanently. */ export declare const checkSecondaryRateLimitBreaker: (nowMs: number, filePath?: string) => SecondaryRateLimitBreakerResult; //# sourceMappingURL=githubSecondaryRateLimitBreaker.d.ts.map