wolverine-ai 5.5.1 → 6.0.0

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/.env.example CHANGED
@@ -2,27 +2,29 @@
2
2
  # Copy to .env.local and fill in your keys.
3
3
  # All other settings are in server/config/settings.json
4
4
 
5
- # ── API Keys ─────────────────────────────────────────────────────
6
- # Your OpenAI API key (required)
5
+ # ── AI API Keys (at least one required) ──────────────────────────
6
+ # Wolverine uses these to diagnose errors and generate fixes.
7
+ # Provider is auto-detected from model name in settings.json.
7
8
  OPENAI_API_KEY=
8
9
  ANTHROPIC_API_KEY=
9
10
 
10
- # ── Wolverine Platform (optional) ────────────────────────────────
11
- # API key for wolverine-hosted models (wolverine-test-1, wolverine-embedding-1)
12
- # Get your key at wolverinenode.xyz
13
- WOLVERINE_API_KEY=
14
- # ── Dashboard Admin Key (make your own) ──────────────────────────────────────────
11
+ # ── Dashboard Admin Key ──────────────────────────────────────────
15
12
  # Required for the agent command interface on the dashboard.
16
13
  # Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
17
14
  WOLVERINE_ADMIN_KEY=
18
15
 
19
- # ── CDP x402 Facilitator (mainnet payments) ──────────────────────
20
- # Required for x402 USDC payments on Base mainnet.
21
- # Sign up free at https://cdp.coinbase.com → create project → get keys
22
- # Without these, x402 only works on testnet (Base Sepolia).
16
+ # ── x402 Payments (optional) ─────────────────────────────────────
17
+ # Required for x402 USDC-paid APIs on Base mainnet.
18
+ # Sign up free at https://cdp.coinbase.com → create project → get keys.
19
+ # Then run: wolverine --init-vault
23
20
  CDP_API_KEY_ID=
24
21
  CDP_API_KEY_SECRET=
25
22
 
23
+ # ── Wolverine Platform (optional) ────────────────────────────────
24
+ # API key for wolverine-hosted models (wolverine-test-1, etc.)
25
+ # Get your key at wolverinenode.xyz
26
+ WOLVERINE_API_KEY=
27
+
26
28
  # ── Custom Secrets ───────────────────────────────────────────────
27
29
  # Add any secret here — wolverine automatically redacts its value
28
30
  # from all AI calls, logs, brain storage, and dashboard output.
package/README.md CHANGED
@@ -58,6 +58,49 @@ Each demo:
58
58
 
59
59
  ---
60
60
 
61
+ ## x402 Paid APIs
62
+
63
+ Turn any route into a USDC-paid API with one line of config. Uses the [x402 protocol](https://docs.cdp.coinbase.com/x402/welcome) for server-to-server payments on Base.
64
+
65
+ ### Setup (one-time)
66
+
67
+ ```bash
68
+ wolverine --init-vault # Create encrypted wallet
69
+ # Add CDP keys to .env.local (free at https://cdp.coinbase.com):
70
+ # CDP_API_KEY_ID=your-key-id
71
+ # CDP_API_KEY_SECRET=your-key-secret
72
+ ```
73
+
74
+ ### Usage
75
+
76
+ ```javascript
77
+ // Free route — no config needed
78
+ fastify.get("/api/data", async () => ({ data: "free" }));
79
+
80
+ // Paid route — just add x402 config
81
+ fastify.get("/api/premium", {
82
+ config: { x402: { price: "$0.01", description: "Premium data" } },
83
+ }, async (req) => ({
84
+ data: "premium",
85
+ paid: req.x402.amount,
86
+ txHash: req.x402.txHash,
87
+ }));
88
+
89
+ // Variable price — caller chooses amount
90
+ fastify.post("/api/purchase", {
91
+ config: { x402: { variable: true, min: "$1", max: "$1000", priceField: "dollars" } },
92
+ }, async (req) => ({
93
+ credits: parseFloat(req.x402.amount.replace("$", "")) * 100,
94
+ txHash: req.x402.txHash,
95
+ }));
96
+ ```
97
+
98
+ The middleware handles everything: 402 responses, wallet signing, CDP facilitator verification, and on-chain USDC settlement. Your handler only runs after payment confirms on Base.
99
+
100
+ **Requirements:** Node 22+, CDP API keys (free tier: 1,000 tx/month), `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` for healing.
101
+
102
+ ---
103
+
61
104
  ## Architecture
62
105
 
63
106
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wolverine-ai",
3
- "version": "5.5.1",
3
+ "version": "6.0.0",
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": {
@@ -75,6 +75,6 @@
75
75
  "stripe": "^18.0.0"
76
76
  },
77
77
  "engines": {
78
- "node": ">=18.0.0"
78
+ "node": ">=22.0.0"
79
79
  }
80
80
  }
@@ -194,7 +194,7 @@ const SEED_DOCS = [
194
194
  metadata: { topic: "x402-paid-apis" },
195
195
  },
196
196
  {
197
- text: "x402 examples — making a paid API is as simple as adding a route. FREE route: fastify.get('/api/data', async (req) => { return getData(); }). PAID route: fastify.get('/api/premium', { config: { x402: { price: '$0.01' } } }, async (req) => { return { data: 'premium', paid: req.x402.amount, txHash: req.x402.txHash }; }). CREDIT PURCHASE: fastify.post('/buy', { config: { x402: { variable: true, min: '$1', max: '$10000', priceField: 'dollars' } } }, async (req) => { const credits = parseFloat(req.x402.amount.replace('$','')) * 100; return { credits, txHash: req.x402.txHash }; }). Frontend integration: sign EIP-3009 TransferWithAuthorization with eth_signTypedData_v4, build v2 payload as { x402Version: 2, scheme: 'exact', network: 'eip155:8453', payload: { authorization: {...}, signature } }, base64 encode, send as X-PAYMENT header. Values MUST be decimal strings ('1000000' for $1) NOT hex. validAfter = String(now - 600), validBefore = String(now + 300). Both verify + settle happen in preHandler BEFORE handler runs. Handler only executes after USDC moves on-chain. req.x402 = { paid: true, amount: '$5.00', from: '0x...', txHash: '0x...', settled: true }.",
197
+ text: "x402 examples — making a paid API is as simple as adding a route. FREE route: fastify.get('/api/data', async (req) => { return getData(); }). PAID route: fastify.get('/api/premium', { config: { x402: { price: '$0.01' } } }, async (req) => { return { data: 'premium', paid: req.x402.amount, txHash: req.x402.txHash }; }). CREDIT PURCHASE: fastify.post('/buy', { config: { x402: { variable: true, min: '$1', max: '$10000', priceField: 'dollars' } } }, async (req) => { const credits = parseFloat(req.x402.amount.replace('$','')) * 100; return { credits, txHash: req.x402.txHash }; }). Frontend integration: sign EIP-3009 TransferWithAuthorization with eth_signTypedData_v4. v2 payload format: { x402Version: 2, payload: { authorization: { from, to, value (decimal string), validAfter (string), validBefore (string), nonce (0x hex) }, signature }, accepted: { scheme: 'exact', network: 'eip155:8453', amount: usdcAtomicUnits, asset: USDC_ADDRESS, payTo: receiverAddress, maxTimeoutSeconds: 60, extra: { name: 'USD Coin', version: '2' } } }. CRITICAL: the 'accepted' field is required for v2 — it contains the payment requirements the client accepted. Without it the facilitator returns 400 'paymentPayload is invalid'. Base64 encode the payload and send as X-PAYMENT header. Values MUST be decimal strings ('1000000' for $1) NOT hex. validAfter = String(now - 600), validBefore = String(now + 300). Both verify + settle happen in preHandler BEFORE handler runs. Handler only executes after USDC moves on-chain. req.x402 = { paid: true, amount: '$5.00', from: '0x...', txHash: '0x...', settled: true }.",
198
198
  metadata: { topic: "x402-examples" },
199
199
  },
200
200
  {
@@ -1,10 +1,13 @@
1
1
  {
2
+ "_": "Wolverine Server Configuration — edit these settings to customize your server. Docs: https://github.com/bobbyswhip/Wolverine",
3
+
2
4
  "app": {
3
- "name": "Wolverine Server",
5
+ "name": "My Server",
4
6
  "version": "1.0.0",
5
7
  "env": "development"
6
8
  },
7
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. See wolverine dashboard at localhost:PORT+1/analytics for per-role cost/speed metrics.",
8
11
  "models": {
9
12
  "reasoning": "claude-sonnet-4-6",
10
13
  "coding": "claude-sonnet-4-6",
@@ -16,19 +19,23 @@
16
19
  "research": "claude-sonnet-4-6"
17
20
  },
18
21
 
22
+ "_embedding": "Vector embedding model for brain memory. Requires OPENAI_API_KEY.",
19
23
  "embedding": "text-embedding-3-small",
20
24
 
25
+ "_server": "port: server listen port | maxRetries: consecutive crashes before giving up | maxMemoryMB: OOM threshold",
21
26
  "server": {
22
27
  "port": 3000,
23
28
  "maxRetries": 3,
24
29
  "maxMemoryMB": 512
25
30
  },
26
31
 
32
+ "_telemetry": "Heartbeat reports server health to the dashboard. Disable for fully offline servers.",
27
33
  "telemetry": {
28
34
  "enabled": true,
29
35
  "heartbeatIntervalMs": 60000
30
36
  },
31
37
 
38
+ "_rateLimiting": "AI call budget. Prevents runaway costs from heal loops.",
32
39
  "rateLimiting": {
33
40
  "maxCallsPerWindow": 32,
34
41
  "windowMs": 100000,
@@ -36,6 +43,7 @@
36
43
  "maxTokensPerHour": 1000000
37
44
  },
38
45
 
46
+ "_healthCheck": "Probes server liveness. failThreshold consecutive failures trigger a heal. startDelayMs gives the server time to boot.",
39
47
  "healthCheck": {
40
48
  "intervalMs": 15000,
41
49
  "timeoutMs": 5000,
@@ -43,12 +51,14 @@
43
51
  "startDelayMs": 10000
44
52
  },
45
53
 
54
+ "_errorMonitor": "Tracks caught 500 errors per route. defaultThreshold: how many 500s before triggering a heal. cooldownMs: minimum time between heals on the same route.",
46
55
  "errorMonitor": {
47
56
  "defaultThreshold": 1,
48
57
  "windowMs": 30000,
49
58
  "cooldownMs": 60000
50
59
  },
51
60
 
61
+ "_autoUpdate": "Auto-updates wolverine framework from git. Only updates src/ and bin/ — never touches server/ code.",
52
62
  "autoUpdate": {
53
63
  "enabled": false,
54
64
  "intervalMs": 300000
@@ -59,6 +69,7 @@
59
69
  "cors": ["http://localhost:3000"]
60
70
  },
61
71
 
72
+ "_dashboard": "Dashboard serves on PORT+1. Set WOLVERINE_ADMIN_KEY in .env.local for the agent command interface.",
62
73
  "dashboard": {},
63
74
 
64
75
  "cors": {