wolverine-ai 6.0.2 → 6.1.1
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 +55 -5
- package/package.json +1 -1
- package/src/brain/brain.js +4 -0
- package/src/core/config.js +30 -0
- package/src/core/runner.js +2 -2
- package/src/core/wolverine.js +3 -1
- package/src/templates/server/config/settings.json +38 -4
package/README.md
CHANGED
|
@@ -1307,12 +1307,62 @@ Wolverine minimizes AI spend through 7 techniques:
|
|
|
1307
1307
|
|
|
1308
1308
|
## Configuration
|
|
1309
1309
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1310
|
+
All settings are in `server/config/settings.json`. Each section has a `_` prefixed description field.
|
|
1311
|
+
|
|
1312
|
+
### Settings Reference
|
|
1313
|
+
|
|
1314
|
+
| Section | Key | Default | Description |
|
|
1315
|
+
|---------|-----|---------|-------------|
|
|
1316
|
+
| **models** | reasoning, coding, chat, tool, classifier, audit, compacting, research | `claude-sonnet-4-6` | AI model per task. Provider auto-detected from name. |
|
|
1317
|
+
| **embedding** | — | `text-embedding-3-small` | Vector embedding model for brain memory. |
|
|
1318
|
+
| **server** | port | `3000` | Server listen port. |
|
|
1319
|
+
| | maxRetries | `3` | Consecutive crashes before giving up. |
|
|
1320
|
+
| | maxMemoryMB | `512` | OOM kill threshold. |
|
|
1321
|
+
| **heal** | healTimeoutMs | `300000` (5 min) | Max time for entire heal attempt. |
|
|
1322
|
+
| | globalMaxHeals | `5` | Max heals across all errors per window. |
|
|
1323
|
+
| | globalWindowMs | `300000` (5 min) | Window for global heal rate limit. |
|
|
1324
|
+
| | loopMaxAttempts | `3` | Same-error failures before stop + bug report. |
|
|
1325
|
+
| | loopWindowMs | `600000` (10 min) | Window for loop guard. |
|
|
1326
|
+
| **agent** | aiCallTimeoutMs | `90000` (90 sec) | Timeout per AI API call. |
|
|
1327
|
+
| | maxTurns | `8` | Agent tool-use iterations per heal. |
|
|
1328
|
+
| | tokenBudget.simple | `20000` | Token budget for simple errors. |
|
|
1329
|
+
| | tokenBudget.moderate | `50000` | Token budget for moderate errors. |
|
|
1330
|
+
| | tokenBudget.complex | `100000` | Token budget for complex errors. |
|
|
1331
|
+
| **rateLimiting** | maxCallsPerWindow | `32` | AI calls allowed per window. |
|
|
1332
|
+
| | windowMs | `100000` | Rate limit window. |
|
|
1333
|
+
| | minGapMs | `5000` | Min delay between AI calls. |
|
|
1334
|
+
| | maxTokensPerHour | `1000000` | Hard token ceiling. |
|
|
1335
|
+
| **healthCheck** | intervalMs | `15000` (15 sec) | Health probe frequency. |
|
|
1336
|
+
| | timeoutMs | `5000` | Timeout per probe. |
|
|
1337
|
+
| | failThreshold | `3` | Consecutive failures before heal. |
|
|
1338
|
+
| | startDelayMs | `10000` | Grace period after boot. |
|
|
1339
|
+
| **errorMonitor** | defaultThreshold | `1` | 500 errors before triggering heal. |
|
|
1340
|
+
| | windowMs | `30000` | Error counting window. |
|
|
1341
|
+
| | cooldownMs | `60000` | Min time between heals on same route. |
|
|
1342
|
+
| **adaptiveLimiter** | thresholdYellow | `70` | CPU/memory % to start shedding 30% of requests. |
|
|
1343
|
+
| | thresholdRed | `85` | CPU/memory % to reject all non-essential requests. |
|
|
1344
|
+
| | reserveMB | `200` | Memory reserved for heal tools. |
|
|
1345
|
+
| **backup** | stabilityMs | `1800000` (30 min) | Time before backup marked STABLE. |
|
|
1346
|
+
| | retentionDays | `7` | Auto-delete old backups. |
|
|
1347
|
+
| | maxFileSizeMB | `10` | Skip files larger than this. |
|
|
1348
|
+
| **autoUpdate** | enabled | `false` | Auto-update framework from git. |
|
|
1349
|
+
| | intervalMs | `300000` (5 min) | Update check frequency. |
|
|
1350
|
+
| **telemetry** | enabled | `true` | Send heartbeats to dashboard. |
|
|
1351
|
+
| | heartbeatIntervalMs | `60000` (1 min) | Heartbeat frequency. |
|
|
1352
|
+
|
|
1353
|
+
All values accept environment variable overrides (e.g., `WOLVERINE_HEAL_TIMEOUT_MS=600000`).
|
|
1354
|
+
|
|
1355
|
+
### Secrets
|
|
1356
|
+
|
|
1357
|
+
Secrets go in `.env.local` (never committed):
|
|
1314
1358
|
|
|
1315
|
-
|
|
1359
|
+
```bash
|
|
1360
|
+
OPENAI_API_KEY= # Required for OpenAI models
|
|
1361
|
+
ANTHROPIC_API_KEY= # Required for Claude models
|
|
1362
|
+
WOLVERINE_ADMIN_KEY= # Dashboard agent command interface
|
|
1363
|
+
CDP_API_KEY_ID= # x402 payments (free at cdp.coinbase.com)
|
|
1364
|
+
CDP_API_KEY_SECRET= # x402 payments
|
|
1365
|
+
```
|
|
1316
1366
|
|
|
1317
1367
|
---
|
|
1318
1368
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
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/brain/brain.js
CHANGED
|
@@ -201,6 +201,10 @@ const SEED_DOCS = [
|
|
|
201
201
|
text: "x402 troubleshooting — common issues and fixes. (1) 'Unauthorized' from CDP facilitator: the @coinbase/x402 package handles JWT auth internally using CDP_API_KEY_ID + CDP_API_KEY_SECRET from env vars — do NOT set a facilitator URL in settings.json. (2) '400 Bad Request': payload format mismatch — v2 uses x402Version:2, network:'eip155:8453', amount (not maxAmountRequired). Parse base64 JSON directly, don't use decodePayment(). (3) 'invalid_exact_evm_payload_signature': EIP-712 signature wrong — check domain (name:'USD Coin', version:'2', chainId:8453, verifyingContract:USDC). (4) USDC not moving: old middleware only verified without settling — must use x402ResourceServer.verifyPayment() + settlePayment() which goes through the CDP facilitator. (5) Frontend value as hex (0xf4240): must use decimal strings ('1000000'). (6) ESM errors: @coinbase/x402 needs Node 22+. (7) Packages disappearing after --update: they're in package.json dependencies + auto-installed on startup when vault exists. (8) Credits granted before settlement: verify+settle must both be in preHandler, not onSend. (9) v2 auth trick: pass @coinbase/x402's facilitator config to @x402/core HTTPFacilitatorClient — this gives v2 protocol with CDP auth that actually works.",
|
|
202
202
|
metadata: { topic: "x402-troubleshooting" },
|
|
203
203
|
},
|
|
204
|
+
{
|
|
205
|
+
text: "settings.json configuration — all wolverine behavior is configurable in server/config/settings.json. Sections: (1) models: 8 task-specific AI model slots (reasoning, coding, chat, tool, classifier, audit, compacting, research). Provider auto-detected from model name. (2) embedding: vector embedding model for brain. (3) server: port, maxRetries, maxMemoryMB. (4) heal: healTimeoutMs (default 300000/5min), globalMaxHeals (5 heals per globalWindowMs 300000/5min — prevents runaway costs), loopMaxAttempts (3 failed heals on same error in loopWindowMs 600000/10min = stop + bug report). (5) agent: aiCallTimeoutMs (90000/90s per AI call), maxTurns (8 agent iterations per heal), tokenBudget by complexity (simple: 20000, moderate: 50000, complex: 100000). (6) rateLimiting: maxCallsPerWindow (32), windowMs, minGapMs (5000), maxTokensPerHour (1000000). (7) healthCheck: intervalMs (15000), timeoutMs (5000), failThreshold (3), startDelayMs (10000). (8) errorMonitor: defaultThreshold (1 = single 500 triggers heal), windowMs (30000), cooldownMs (60000). (9) adaptiveLimiter: thresholdYellow (70% CPU/mem = start shedding 30% requests), thresholdRed (85% = reject all non-essential), reserveMB (200MB reserved for heal tools). (10) backup: stabilityMs (1800000/30min before STABLE), retentionDays (7), maxFileSizeMB (10). (11) autoUpdate: enabled, intervalMs. (12) telemetry: enabled, heartbeatIntervalMs. All values accept env var overrides (e.g. WOLVERINE_HEAL_TIMEOUT_MS). Description fields prefixed with _ explain each section inline.",
|
|
206
|
+
metadata: { topic: "configuration" },
|
|
207
|
+
},
|
|
204
208
|
{
|
|
205
209
|
text: "MCP integration: connect external tools via Model Context Protocol. Configure in .wolverine/mcp.json with per-server tool allowlists. Security: arg sanitization (secrets redacted before sending to MCP servers), result injection scanning, rate limiting per server, audit logging. Tools appear as mcp__server__tool in the agent. Supports stdio and HTTP transports.",
|
|
206
210
|
metadata: { topic: "mcp" },
|
package/src/core/config.js
CHANGED
|
@@ -98,6 +98,36 @@ function loadConfig() {
|
|
|
98
98
|
windowMs: parseInt(process.env.WOLVERINE_ERROR_WINDOW_MS, 10) || fileConfig.errorMonitor?.windowMs || 30000,
|
|
99
99
|
cooldownMs: parseInt(process.env.WOLVERINE_ERROR_COOLDOWN_MS, 10) || fileConfig.errorMonitor?.cooldownMs || 60000,
|
|
100
100
|
},
|
|
101
|
+
|
|
102
|
+
heal: {
|
|
103
|
+
healTimeoutMs: parseInt(process.env.WOLVERINE_HEAL_TIMEOUT_MS, 10) || fileConfig.heal?.healTimeoutMs || 300000,
|
|
104
|
+
globalMaxHeals: parseInt(process.env.WOLVERINE_RATE_MAX_GLOBAL_HEALS, 10) || fileConfig.heal?.globalMaxHeals || 5,
|
|
105
|
+
globalWindowMs: parseInt(process.env.WOLVERINE_RATE_GLOBAL_WINDOW_MS, 10) || fileConfig.heal?.globalWindowMs || 300000,
|
|
106
|
+
loopMaxAttempts: parseInt(process.env.WOLVERINE_LOOP_MAX_ATTEMPTS, 10) || fileConfig.heal?.loopMaxAttempts || 3,
|
|
107
|
+
loopWindowMs: parseInt(process.env.WOLVERINE_LOOP_WINDOW_MS, 10) || fileConfig.heal?.loopWindowMs || 600000,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
agent: {
|
|
111
|
+
aiCallTimeoutMs: parseInt(process.env.WOLVERINE_AI_CALL_TIMEOUT_MS, 10) || fileConfig.agent?.aiCallTimeoutMs || 90000,
|
|
112
|
+
maxTurns: parseInt(process.env.WOLVERINE_AGENT_MAX_TURNS, 10) || fileConfig.agent?.maxTurns || 8,
|
|
113
|
+
tokenBudget: {
|
|
114
|
+
simple: fileConfig.agent?.tokenBudget?.simple || 20000,
|
|
115
|
+
moderate: fileConfig.agent?.tokenBudget?.moderate || 50000,
|
|
116
|
+
complex: fileConfig.agent?.tokenBudget?.complex || 100000,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
adaptiveLimiter: {
|
|
121
|
+
thresholdYellow: fileConfig.adaptiveLimiter?.thresholdYellow || 70,
|
|
122
|
+
thresholdRed: fileConfig.adaptiveLimiter?.thresholdRed || 85,
|
|
123
|
+
reserveMB: fileConfig.adaptiveLimiter?.reserveMB || 200,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
backup: {
|
|
127
|
+
stabilityMs: fileConfig.backup?.stabilityMs || 1800000,
|
|
128
|
+
retentionDays: fileConfig.backup?.retentionDays || 7,
|
|
129
|
+
maxFileSizeMB: fileConfig.backup?.maxFileSizeMB || 10,
|
|
130
|
+
},
|
|
101
131
|
};
|
|
102
132
|
|
|
103
133
|
// Migrate old settings.json to new format + ensure defaults
|
package/src/core/runner.js
CHANGED
|
@@ -69,8 +69,8 @@ class WolverineRunner {
|
|
|
69
69
|
windowMs: cfg.rateLimiting.windowMs,
|
|
70
70
|
minGapMs: cfg.rateLimiting.minGapMs,
|
|
71
71
|
maxTokensPerHour: cfg.rateLimiting.maxTokensPerHour,
|
|
72
|
-
maxGlobalHealsPerWindow:
|
|
73
|
-
globalWindowMs:
|
|
72
|
+
maxGlobalHealsPerWindow: cfg.heal?.globalMaxHeals || 5,
|
|
73
|
+
globalWindowMs: cfg.heal?.globalWindowMs || 300000,
|
|
74
74
|
});
|
|
75
75
|
this.backupManager = new BackupManager(this.cwd);
|
|
76
76
|
this.logger = new EventLogger(this.cwd);
|
package/src/core/wolverine.js
CHANGED
|
@@ -32,7 +32,9 @@ const { getSummary: getServerContextSummary } = require("./server-context");
|
|
|
32
32
|
* The engine tries fast path first. If that fails verification, it escalates to the agent.
|
|
33
33
|
*/
|
|
34
34
|
async function heal(opts) {
|
|
35
|
-
const
|
|
35
|
+
const { loadConfig } = require("./config");
|
|
36
|
+
const _cfg = loadConfig();
|
|
37
|
+
const HEAL_TIMEOUT_MS = _cfg.heal?.healTimeoutMs || 300000;
|
|
36
38
|
try {
|
|
37
39
|
return await Promise.race([
|
|
38
40
|
_healImpl(opts),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"env": "development"
|
|
8
8
|
},
|
|
9
9
|
|
|
10
|
-
"_models": "AI models for each task. Provider auto-detected from name (claude-* = Anthropic, gpt-* = OpenAI). Using one model across all roles maximizes prompt cache hits.
|
|
10
|
+
"_models": "AI models for each task. Provider auto-detected from name (claude-* = Anthropic, gpt-* = OpenAI). Using one model across all roles maximizes prompt cache hits. Dashboard at localhost:PORT+1/analytics shows per-role cost/speed.",
|
|
11
11
|
"models": {
|
|
12
12
|
"reasoning": "claude-sonnet-4-6",
|
|
13
13
|
"coding": "claude-sonnet-4-6",
|
|
@@ -22,20 +22,40 @@
|
|
|
22
22
|
"_embedding": "Vector embedding model for brain memory. Requires OPENAI_API_KEY.",
|
|
23
23
|
"embedding": "text-embedding-3-small",
|
|
24
24
|
|
|
25
|
-
"_server": "port:
|
|
25
|
+
"_server": "port: listen port (3000) | maxRetries: crashes before giving up | maxMemoryMB: OOM kill threshold",
|
|
26
26
|
"server": {
|
|
27
27
|
"port": 3000,
|
|
28
28
|
"maxRetries": 3,
|
|
29
29
|
"maxMemoryMB": 512
|
|
30
30
|
},
|
|
31
31
|
|
|
32
|
+
"_heal": "Controls the self-healing pipeline. healTimeoutMs: max time for entire heal attempt. globalMaxHeals/globalWindowMs: rate limit across ALL errors (prevents runaway costs). loopMaxAttempts/loopWindowMs: same-error loop guard (stops after N failures on the same error).",
|
|
33
|
+
"heal": {
|
|
34
|
+
"healTimeoutMs": 300000,
|
|
35
|
+
"globalMaxHeals": 5,
|
|
36
|
+
"globalWindowMs": 300000,
|
|
37
|
+
"loopMaxAttempts": 3,
|
|
38
|
+
"loopWindowMs": 600000
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
"_agent": "Controls the AI agent. aiCallTimeoutMs: max time per AI API call. maxTurns: agent tool-use iterations per heal. tokenBudget: max tokens per heal attempt (simple/moderate/complex auto-selected).",
|
|
42
|
+
"agent": {
|
|
43
|
+
"aiCallTimeoutMs": 90000,
|
|
44
|
+
"maxTurns": 8,
|
|
45
|
+
"tokenBudget": {
|
|
46
|
+
"simple": 20000,
|
|
47
|
+
"moderate": 50000,
|
|
48
|
+
"complex": 100000
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
32
52
|
"_telemetry": "Heartbeat reports server health to the dashboard. Disable for fully offline servers.",
|
|
33
53
|
"telemetry": {
|
|
34
54
|
"enabled": true,
|
|
35
55
|
"heartbeatIntervalMs": 60000
|
|
36
56
|
},
|
|
37
57
|
|
|
38
|
-
"_rateLimiting": "AI call budget. Prevents runaway costs from heal loops.",
|
|
58
|
+
"_rateLimiting": "AI call budget per window. Prevents runaway costs from heal loops.",
|
|
39
59
|
"rateLimiting": {
|
|
40
60
|
"maxCallsPerWindow": 32,
|
|
41
61
|
"windowMs": 100000,
|
|
@@ -51,13 +71,27 @@
|
|
|
51
71
|
"startDelayMs": 10000
|
|
52
72
|
},
|
|
53
73
|
|
|
54
|
-
"_errorMonitor": "Tracks caught 500 errors per route. defaultThreshold: how many 500s
|
|
74
|
+
"_errorMonitor": "Tracks caught 500 errors per route. defaultThreshold: how many 500s trigger a heal. cooldownMs: min time between heals on same route.",
|
|
55
75
|
"errorMonitor": {
|
|
56
76
|
"defaultThreshold": 1,
|
|
57
77
|
"windowMs": 30000,
|
|
58
78
|
"cooldownMs": 60000
|
|
59
79
|
},
|
|
60
80
|
|
|
81
|
+
"_adaptiveLimiter": "CPU/memory-based request throttling. thresholdYellow: start shedding 30% of requests. thresholdRed: reject all non-essential. reserveMB: memory reserved for heal tools.",
|
|
82
|
+
"adaptiveLimiter": {
|
|
83
|
+
"thresholdYellow": 70,
|
|
84
|
+
"thresholdRed": 85,
|
|
85
|
+
"reserveMB": 200
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
"_backup": "Server snapshots. stabilityMs: time before backup is marked STABLE. retentionDays: auto-delete old backups. maxFileSizeMB: skip files larger than this.",
|
|
89
|
+
"backup": {
|
|
90
|
+
"stabilityMs": 1800000,
|
|
91
|
+
"retentionDays": 7,
|
|
92
|
+
"maxFileSizeMB": 10
|
|
93
|
+
},
|
|
94
|
+
|
|
61
95
|
"_autoUpdate": "Auto-updates wolverine framework from git. Only updates src/ and bin/ — never touches server/ code.",
|
|
62
96
|
"autoUpdate": {
|
|
63
97
|
"enabled": false,
|