@x12i/ai-dispatcher 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3259,8 +3259,7 @@ async function readFailure2(response) {
|
|
|
3259
3259
|
function classifyStatus2(status) {
|
|
3260
3260
|
if (status === 401 || status === 403) return "PROVIDER_AUTH_FAILED";
|
|
3261
3261
|
if (status === 404) return "PROVIDER_MODEL_NOT_FOUND";
|
|
3262
|
-
if (status === 429) return "
|
|
3263
|
-
if (status === 408 || status >= 500) return "PROVIDER_RETRYABLE";
|
|
3262
|
+
if (status === 429 || status === 408 || status >= 500) return "PROVIDER_RETRYABLE";
|
|
3264
3263
|
return "PROVIDER_REQUEST_FAILED";
|
|
3265
3264
|
}
|
|
3266
3265
|
function isConfigError2(code) {
|
|
@@ -3268,6 +3267,8 @@ function isConfigError2(code) {
|
|
|
3268
3267
|
}
|
|
3269
3268
|
function asTerminalError2(error) {
|
|
3270
3269
|
if (error instanceof AiDispatcherError && error.code === "PROVIDER_RETRYABLE") {
|
|
3270
|
+
const status = isRecord7(error.details) ? error.details.status : void 0;
|
|
3271
|
+
if (status === 429) return new AiDispatcherError("PROVIDER_RATE_LIMITED", error.message, error.details);
|
|
3271
3272
|
return new AiDispatcherError("PROVIDER_GATEWAY_UNREACHABLE", error.message, error.details);
|
|
3272
3273
|
}
|
|
3273
3274
|
if (error instanceof AiDispatcherError) return error;
|