@xec-sh/core
Version:
Universal shell execution engine
22 lines (21 loc) • 1.03 kB
TypeScript
import { ExecutionResult } from '../core/result.js';
import type { EnhancedEventEmitter } from './event-emitter.js';
export interface RetryOptions {
maxRetries?: number;
initialDelay?: number;
maxDelay?: number;
backoffMultiplier?: number;
jitter?: boolean;
isRetryable?: (result: ExecutionResult) => boolean;
onRetry?: (attempt: number, result: ExecutionResult, nextDelay: number) => void;
}
export declare class RetryError extends Error {
readonly attempts: number;
readonly lastResult: ExecutionResult;
readonly results: ExecutionResult[];
constructor(message: string, attempts: number, lastResult: ExecutionResult, results: ExecutionResult[]);
}
export declare function withExecutionRetry(fn: () => Promise<ExecutionResult>, options?: RetryOptions, eventEmitter?: EnhancedEventEmitter): Promise<ExecutionResult>;
export declare function createRetryableAdapter<T extends {
execute: (cmd: any) => Promise<ExecutionResult>;
}>(adapter: T, defaultRetryOptions?: RetryOptions): T;