@ai2070/l0
Version:
L0: The Missing Reliability Substrate for AI
56 lines (55 loc) • 1.5 kB
JavaScript
const RETRY_DEFAULTS = {
/** Maximum retry attempts for model failures */
attempts: 3,
/** Absolute maximum retries across all error types */
maxRetries: 6,
/** Base delay in milliseconds */
baseDelay: 1e3,
/** Maximum delay cap in milliseconds */
maxDelay: 1e4,
/** Maximum delay for network error suggestions */
networkMaxDelay: 3e4,
/** Default backoff strategy (AWS-style fixed jitter for predictable retry timing) */
backoff: "fixed-jitter",
/** Default retry reasons (unknown errors are not retried by default) */
retryOn: [
"zero_output",
"guardrail_violation",
"drift",
"incomplete",
"network_error",
"timeout",
"rate_limit",
"server_error"
]
};
const ERROR_TYPE_DELAY_DEFAULTS = {
connectionDropped: 1e3,
fetchError: 500,
econnreset: 1e3,
econnrefused: 2e3,
sseAborted: 500,
noBytes: 500,
partialChunks: 500,
runtimeKilled: 2e3,
backgroundThrottle: 5e3,
dnsError: 3e3,
timeout: 1e3,
unknown: 1e3
};
var ErrorCategory = /* @__PURE__ */ ((ErrorCategory2) => {
ErrorCategory2["NETWORK"] = "network";
ErrorCategory2["TRANSIENT"] = "transient";
ErrorCategory2["MODEL"] = "model";
ErrorCategory2["CONTENT"] = "content";
ErrorCategory2["PROVIDER"] = "provider";
ErrorCategory2["FATAL"] = "fatal";
ErrorCategory2["INTERNAL"] = "internal";
return ErrorCategory2;
})(ErrorCategory || {});
export {
ERROR_TYPE_DELAY_DEFAULTS,
ErrorCategory,
RETRY_DEFAULTS
};
//# sourceMappingURL=retry.js.map