@ai2070/l0
Version:
L0: The Missing Reliability Substrate for AI
25 lines • 1.18 kB
TypeScript
import type { RetryConfig, RetryState, RetryReason, CategorizedError, RetryDecision, RetryContext } from "../types/retry";
import { ErrorCategory } from "../types/retry";
export declare class RetryManager {
private config;
private state;
constructor(config?: Partial<RetryConfig>);
private createInitialState;
categorizeError(error: Error, reason?: RetryReason): CategorizedError;
private classifyError;
private determineCategory;
private inferReason;
shouldRetry(error: Error, reason?: RetryReason): RetryDecision;
recordRetry(categorizedError: CategorizedError, decision: RetryDecision): Promise<void>;
execute<T>(fn: () => Promise<T>, onRetry?: (context: RetryContext) => void): Promise<T>;
getState(): RetryState;
reset(): void;
hasReachedLimit(): boolean;
getTotalRetries(): number;
getmodelRetryCount(): number;
private mapErrorTypeDelays;
}
export declare function createRetryManager(config?: Partial<RetryConfig>): RetryManager;
export declare function isRetryableError(error: Error): boolean;
export declare function getErrorCategory(error: Error): ErrorCategory;
//# sourceMappingURL=retry.d.ts.map