wolverine-ai 3.7.4 → 3.7.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"description": "Self-healing Node.js server framework powered by AI. Catches crashes, diagnoses errors, generates fixes, verifies, and restarts — automatically.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/core/ai-client.js
CHANGED
|
@@ -169,7 +169,20 @@ async function _withRetry(fn, maxRetries = 3) {
|
|
|
169
169
|
try {
|
|
170
170
|
return await fn();
|
|
171
171
|
} catch (err) {
|
|
172
|
-
const
|
|
172
|
+
const msg = (err.message || "").toLowerCase();
|
|
173
|
+
const code = (err.code || "").toLowerCase();
|
|
174
|
+
|
|
175
|
+
// Permanent billing/quota errors — never retry, surface immediately
|
|
176
|
+
const isBillingError = err.status === 402
|
|
177
|
+
|| /insufficient.*(quota|credits|funds)/i.test(msg)
|
|
178
|
+
|| /billing_hard_limit|insufficient_quota|quota_exceeded/i.test(msg)
|
|
179
|
+
|| /billing_hard_limit|insufficient_quota|quota_exceeded/i.test(code);
|
|
180
|
+
if (isBillingError) {
|
|
181
|
+
console.log(chalk.red(` 💳 Billing error (not retrying): ${err.message}`));
|
|
182
|
+
throw err;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const isRateLimit = err.status === 429 || code === "rate_limit_exceeded";
|
|
173
186
|
const isServerError = err.status >= 500;
|
|
174
187
|
if ((isRateLimit || isServerError) && attempt < maxRetries) {
|
|
175
188
|
const delay = Math.min(1000 * Math.pow(2, attempt) + Math.random() * 1000, 30000);
|
|
@@ -29,11 +29,17 @@ const HUMAN_REQUIRED_PATTERNS = [
|
|
|
29
29
|
{ pattern: /(api|auth|token|key|credential).*(expired|revoked|rotated|invalid)/i, category: "auth", hint: "Credential has expired or been revoked" },
|
|
30
30
|
{ pattern: /authentication\s+failed/i, category: "auth", hint: "Authentication failed — check credentials" },
|
|
31
31
|
|
|
32
|
-
// Billing/Quota
|
|
32
|
+
// Billing/Quota — covers OpenAI, Anthropic, Wolverine, and generic patterns
|
|
33
33
|
{ pattern: /429\s*(too many|rate limit)/i, category: "billing", hint: "Rate limit hit — may need to upgrade plan or wait" },
|
|
34
34
|
{ pattern: /(quota|limit|credits?)\s*(exceeded|exhausted|depleted)/i, category: "billing", hint: "Usage quota or credits exhausted" },
|
|
35
35
|
{ pattern: /billing.*(?:issue|error|failed|inactive)/i, category: "billing", hint: "Billing issue on the account" },
|
|
36
36
|
{ pattern: /insufficient.*(funds|credits|quota)/i, category: "billing", hint: "Insufficient credits or funds" },
|
|
37
|
+
{ pattern: /billing_hard_limit_reached/i, category: "billing", hint: "OpenAI billing hard limit reached — add payment method or raise limit" },
|
|
38
|
+
{ pattern: /insufficient_quota/i, category: "billing", hint: "API quota exhausted — check billing dashboard" },
|
|
39
|
+
{ pattern: /rate_limit_exceeded/i, category: "billing", hint: "API rate limit exceeded — wait or upgrade plan" },
|
|
40
|
+
{ pattern: /402\s*(payment|required)/i, category: "billing", hint: "Payment required — check billing status" },
|
|
41
|
+
{ pattern: /exceeded.*(?:budget|spending|token)/i, category: "billing", hint: "Spending or token budget exceeded" },
|
|
42
|
+
{ pattern: /overloaded_error/i, category: "billing", hint: "Anthropic API overloaded — retry later" },
|
|
37
43
|
|
|
38
44
|
// External service failures
|
|
39
45
|
{ pattern: /ECONNREFUSED/i, category: "service", hint: "External service connection refused — is it running?" },
|