wolverine-ai 6.1.2 → 6.2.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/README.md +171 -0
- package/bin/wolverine-claw.js +182 -0
- package/bin/wolverine.js +27 -0
- package/package.json +8 -2
- package/src/brain/brain.js +20 -0
- package/src/claw/claw-runner.js +422 -0
- package/src/claw/setup.js +871 -0
- package/wolverine-claw/config/settings.json +115 -0
- package/wolverine-claw/index.js +297 -0
- package/wolverine-claw/plugins/wolverine-integration.js +283 -0
- package/wolverine-claw/workspace/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -1615,6 +1615,177 @@ AI summary generated with CHAT_MODEL, secrets redacted, optional webhook deliver
|
|
|
1615
1615
|
|
|
1616
1616
|
---
|
|
1617
1617
|
|
|
1618
|
+
## Wolverine Claw
|
|
1619
|
+
|
|
1620
|
+
Agentic AI agent mode powered by [OpenClaw](https://github.com/openclaw/openclaw) with Wolverine self-healing. Run an always-on AI assistant that automatically recovers from crashes, heals its own errors, and learns from past fixes.
|
|
1621
|
+
|
|
1622
|
+
### What It Does
|
|
1623
|
+
|
|
1624
|
+
Wolverine Claw wraps the OpenClaw gateway (WebSocket control plane + Pi agent runtime) in Wolverine's process manager. When the agent crashes or encounters errors, Wolverine's AI heal pipeline kicks in — diagnoses the error, generates a fix, verifies it, and restarts. The agent gets access to Wolverine's brain (semantic memory), backup system (workspace snapshots), and self-healing tools.
|
|
1625
|
+
|
|
1626
|
+
### Setup (Existing OpenClaw Users)
|
|
1627
|
+
|
|
1628
|
+
If you already have OpenClaw installed, the setup wizard detects your config and merges it:
|
|
1629
|
+
|
|
1630
|
+
```bash
|
|
1631
|
+
npm install wolverine-ai
|
|
1632
|
+
wolverine-claw --setup
|
|
1633
|
+
```
|
|
1634
|
+
|
|
1635
|
+
The wizard will:
|
|
1636
|
+
1. Detect your OpenClaw installation and `~/.openclaw/config.yml`
|
|
1637
|
+
2. Merge your gateway port, model, channels, and security settings with wolverine defaults
|
|
1638
|
+
3. Scaffold `wolverine-claw/` with merged config
|
|
1639
|
+
4. Validate Node version, API keys, and dependencies
|
|
1640
|
+
5. Show next steps
|
|
1641
|
+
|
|
1642
|
+
Preview without changes: `wolverine-claw --setup --dry`
|
|
1643
|
+
|
|
1644
|
+
### Setup (Fresh Install)
|
|
1645
|
+
|
|
1646
|
+
```bash
|
|
1647
|
+
git clone https://github.com/bobbyswhip/Wolverine.git
|
|
1648
|
+
cd Wolverine
|
|
1649
|
+
npm install
|
|
1650
|
+
cp .env.example .env.local
|
|
1651
|
+
# Edit .env.local — add ANTHROPIC_API_KEY or OPENAI_API_KEY
|
|
1652
|
+
wolverine-claw --setup
|
|
1653
|
+
npm run claw
|
|
1654
|
+
```
|
|
1655
|
+
|
|
1656
|
+
### Commands
|
|
1657
|
+
|
|
1658
|
+
```bash
|
|
1659
|
+
# Start
|
|
1660
|
+
npm run claw # Start with self-healing
|
|
1661
|
+
npm run claw:direct # Start without healing (debugging)
|
|
1662
|
+
wolverine --claw # Same as npm run claw, via main CLI
|
|
1663
|
+
|
|
1664
|
+
# Setup & Config
|
|
1665
|
+
wolverine-claw --setup # Guided onboarding wizard
|
|
1666
|
+
wolverine-claw --info # Show configuration and status
|
|
1667
|
+
wolverine --setup-claw # Same setup, from main CLI
|
|
1668
|
+
|
|
1669
|
+
# Backups
|
|
1670
|
+
wolverine --backup "reason" # Snapshot workspace
|
|
1671
|
+
wolverine --list-backups # Show all snapshots
|
|
1672
|
+
wolverine --rollback-latest # Restore most recent
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
### Architecture
|
|
1676
|
+
|
|
1677
|
+
```
|
|
1678
|
+
wolverine-claw/
|
|
1679
|
+
├── config/
|
|
1680
|
+
│ └── settings.json # Gateway, agent, channels, healing, security
|
|
1681
|
+
├── index.js # Entry point — bootstraps OpenClaw gateway
|
|
1682
|
+
├── plugins/
|
|
1683
|
+
│ └── wolverine-integration.js # 7 wolverine tools for the agent
|
|
1684
|
+
├── skills/ # Custom user skills
|
|
1685
|
+
└── workspace/ # Sandboxed agent working directory
|
|
1686
|
+
|
|
1687
|
+
src/claw/
|
|
1688
|
+
├── claw-runner.js # Process manager with healing pipeline
|
|
1689
|
+
└── setup.js # Setup wizard (detect, merge, scaffold, validate)
|
|
1690
|
+
|
|
1691
|
+
bin/wolverine-claw.js # CLI entry point
|
|
1692
|
+
```
|
|
1693
|
+
|
|
1694
|
+
### How It Works
|
|
1695
|
+
|
|
1696
|
+
1. `ClawRunner` spawns `wolverine-claw/index.js` as a child process with IPC
|
|
1697
|
+
2. `index.js` loads OpenClaw via `require("openclaw")` (SDK mode) or falls back to `npx openclaw gateway` (CLI mode)
|
|
1698
|
+
3. The wolverine integration plugin injects 7 tools into the OpenClaw agent
|
|
1699
|
+
4. On crash/error, `ClawRunner` catches via IPC or exit event
|
|
1700
|
+
5. Wolverine's AI heal pipeline runs: diagnose → backup → fix → verify → restart
|
|
1701
|
+
6. Gateway health monitored via TCP probe on WebSocket port every 30s
|
|
1702
|
+
|
|
1703
|
+
### Wolverine Tools for the Agent
|
|
1704
|
+
|
|
1705
|
+
The integration plugin gives the OpenClaw agent access to wolverine capabilities:
|
|
1706
|
+
|
|
1707
|
+
| Tool | What It Does |
|
|
1708
|
+
|------|-------------|
|
|
1709
|
+
| `wolverine_backup` | Create a workspace snapshot |
|
|
1710
|
+
| `wolverine_rollback` | Restore to a previous backup |
|
|
1711
|
+
| `wolverine_brain_search` | Search semantic memory for past fixes and patterns |
|
|
1712
|
+
| `wolverine_brain_learn` | Store new learnings in the brain |
|
|
1713
|
+
| `wolverine_health` | Get system health status (memory, uptime, backups) |
|
|
1714
|
+
| `wolverine_list_backups` | List all available snapshots |
|
|
1715
|
+
| `wolverine_self_heal` | Trigger the heal pipeline on a specific error |
|
|
1716
|
+
|
|
1717
|
+
### Configuration
|
|
1718
|
+
|
|
1719
|
+
Edit `wolverine-claw/config/settings.json`:
|
|
1720
|
+
|
|
1721
|
+
```json
|
|
1722
|
+
{
|
|
1723
|
+
"gateway": { "port": 18789, "host": "127.0.0.1" },
|
|
1724
|
+
"agent": { "model": "claude-sonnet-4-6", "maxTurns": 25 },
|
|
1725
|
+
"channels": {
|
|
1726
|
+
"terminal": { "enabled": true },
|
|
1727
|
+
"discord": { "enabled": false, "token": "" },
|
|
1728
|
+
"slack": { "enabled": false, "botToken": "", "appToken": "" },
|
|
1729
|
+
"telegram": { "enabled": false, "botToken": "" }
|
|
1730
|
+
},
|
|
1731
|
+
"healing": {
|
|
1732
|
+
"enabled": true,
|
|
1733
|
+
"maxHealsPerWindow": 5,
|
|
1734
|
+
"windowMs": 300000,
|
|
1735
|
+
"loopMaxAttempts": 3
|
|
1736
|
+
},
|
|
1737
|
+
"skills": {
|
|
1738
|
+
"codingAgent": { "enabled": true, "sandbox": true },
|
|
1739
|
+
"browserControl": { "enabled": false },
|
|
1740
|
+
"cron": { "enabled": true, "maxJobs": 10 }
|
|
1741
|
+
},
|
|
1742
|
+
"workspace": { "path": "wolverine-claw/workspace" },
|
|
1743
|
+
"security": {
|
|
1744
|
+
"dmPairing": true,
|
|
1745
|
+
"sandbox": true,
|
|
1746
|
+
"blockedCommands": ["rm -rf /", "format", "shutdown"]
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
```
|
|
1750
|
+
|
|
1751
|
+
Channel tokens go in `.env.local` (never in settings.json):
|
|
1752
|
+
|
|
1753
|
+
```bash
|
|
1754
|
+
# wolverine-claw channel tokens
|
|
1755
|
+
DISCORD_BOT_TOKEN=your-token
|
|
1756
|
+
SLACK_BOT_TOKEN=xoxb-your-token
|
|
1757
|
+
SLACK_APP_TOKEN=xapp-your-token
|
|
1758
|
+
TELEGRAM_BOT_TOKEN=123456:ABC-your-token
|
|
1759
|
+
```
|
|
1760
|
+
|
|
1761
|
+
### Self-Healing Pipeline
|
|
1762
|
+
|
|
1763
|
+
Same pipeline as server healing, adapted for the claw environment:
|
|
1764
|
+
|
|
1765
|
+
```
|
|
1766
|
+
Claw crashes or IPC error received
|
|
1767
|
+
→ Empty stderr? → Just restart ($0.00)
|
|
1768
|
+
→ Rate limit: 5 heals per 5min
|
|
1769
|
+
→ Loop guard: 3 failed heals on same error → stop + bug report
|
|
1770
|
+
→ AI heal: diagnose → backup → fix → verify → restart
|
|
1771
|
+
→ Success: retry count reset, learning stored in brain
|
|
1772
|
+
→ Fail: rollback to pre-heal backup, next retry
|
|
1773
|
+
→ Max retries: rollback to startup snapshot, stop
|
|
1774
|
+
```
|
|
1775
|
+
|
|
1776
|
+
### Editable Scope
|
|
1777
|
+
|
|
1778
|
+
The claw agent can only modify files in `wolverine-claw/`. Protected paths:
|
|
1779
|
+
|
|
1780
|
+
- `src/` — wolverine framework code
|
|
1781
|
+
- `bin/` — CLI entry points
|
|
1782
|
+
- `server/` — user server code
|
|
1783
|
+
- `node_modules/` — dependencies
|
|
1784
|
+
- `.env`, `.env.local` — secrets
|
|
1785
|
+
- `.wolverine/vault/` — encrypted keys
|
|
1786
|
+
|
|
1787
|
+
---
|
|
1788
|
+
|
|
1618
1789
|
## License
|
|
1619
1790
|
|
|
1620
1791
|
MIT
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const dotenv = require("dotenv");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
|
|
7
|
+
// Global error handlers — prevent parent process death
|
|
8
|
+
process.on("uncaughtException", (err) => {
|
|
9
|
+
console.error(chalk.red(`\n ⚠️ Uncaught exception (wolverine-claw survived): ${err.message}`));
|
|
10
|
+
console.error(chalk.gray(` ${err.stack?.split("\n")[1]?.trim() || ""}`));
|
|
11
|
+
});
|
|
12
|
+
process.on("unhandledRejection", (reason) => {
|
|
13
|
+
const msg = reason instanceof Error ? reason.message : String(reason);
|
|
14
|
+
console.error(chalk.red(`\n ⚠️ Unhandled rejection (wolverine-claw survived): ${msg}`));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Load secrets
|
|
18
|
+
dotenv.config({ path: path.resolve(process.cwd(), ".env.local") });
|
|
19
|
+
dotenv.config({ path: path.resolve(process.cwd(), ".env") });
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const fs = require("fs");
|
|
23
|
+
|
|
24
|
+
// --help
|
|
25
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
26
|
+
console.log(`
|
|
27
|
+
${chalk.blue("🐾 Wolverine Claw")} — Agentic AI agent with self-healing
|
|
28
|
+
|
|
29
|
+
${chalk.bold("Usage:")}
|
|
30
|
+
wolverine-claw [options]
|
|
31
|
+
|
|
32
|
+
${chalk.bold("Options:")}
|
|
33
|
+
--help, -h Show this help
|
|
34
|
+
--setup Full guided setup (detects OpenClaw, merges config, validates)
|
|
35
|
+
--setup --dry Preview setup without making changes
|
|
36
|
+
--info Show claw configuration and status
|
|
37
|
+
--init Initialize wolverine-claw/ directory (first run)
|
|
38
|
+
--direct Run claw directly without wolverine healing wrapper
|
|
39
|
+
|
|
40
|
+
${chalk.bold("Configuration:")}
|
|
41
|
+
wolverine-claw/config/settings.json Gateway, channels, agent, healing
|
|
42
|
+
.env.local Secrets (API keys)
|
|
43
|
+
|
|
44
|
+
${chalk.bold("Examples:")}
|
|
45
|
+
wolverine-claw --setup Full guided onboarding
|
|
46
|
+
wolverine-claw Start with self-healing
|
|
47
|
+
wolverine-claw --direct Start without healing (debugging)
|
|
48
|
+
wolverine-claw --info Show configuration
|
|
49
|
+
`);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// --setup: full guided setup
|
|
54
|
+
if (args.includes("--setup")) {
|
|
55
|
+
const { setup } = require("../src/claw/setup");
|
|
56
|
+
const dryRun = args.includes("--dry") || args.includes("--dry-run");
|
|
57
|
+
const force = args.includes("--force");
|
|
58
|
+
|
|
59
|
+
(async () => {
|
|
60
|
+
const result = await setup(process.cwd(), { dryRun, force });
|
|
61
|
+
process.exit(result.success ? 0 : 1);
|
|
62
|
+
})();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// --init: scaffold wolverine-claw directory if missing
|
|
67
|
+
if (args.includes("--init")) {
|
|
68
|
+
const clawDir = path.resolve(process.cwd(), "wolverine-claw");
|
|
69
|
+
|
|
70
|
+
if (fs.existsSync(path.join(clawDir, "index.js"))) {
|
|
71
|
+
console.log(chalk.green("\n ✅ wolverine-claw/ already exists.\n"));
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log(chalk.blue("\n 🐾 Initializing wolverine-claw/ ...\n"));
|
|
76
|
+
|
|
77
|
+
// Copy from templates if available, otherwise the files should already exist
|
|
78
|
+
const dirs = ["config", "plugins", "workspace"];
|
|
79
|
+
for (const d of dirs) {
|
|
80
|
+
const dirPath = path.join(clawDir, d);
|
|
81
|
+
if (!fs.existsSync(dirPath)) {
|
|
82
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
83
|
+
console.log(chalk.gray(` Created: wolverine-claw/${d}/`));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(chalk.green("\n ✅ wolverine-claw/ initialized."));
|
|
88
|
+
console.log(chalk.gray(" Edit wolverine-claw/config/settings.json to configure.\n"));
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// --info: show claw config and status
|
|
93
|
+
if (args.includes("--info")) {
|
|
94
|
+
const configPath = path.resolve(process.cwd(), "wolverine-claw", "config", "settings.json");
|
|
95
|
+
|
|
96
|
+
if (!fs.existsSync(configPath)) {
|
|
97
|
+
console.log(chalk.yellow("\n ⚠️ wolverine-claw/ not found. Run: wolverine-claw --init\n"));
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
103
|
+
const gw = config.gateway || {};
|
|
104
|
+
const agent = config.agent || {};
|
|
105
|
+
const channels = config.channels || {};
|
|
106
|
+
const healing = config.healing || {};
|
|
107
|
+
|
|
108
|
+
console.log(chalk.blue.bold("\n 🐾 Wolverine Claw — Configuration\n"));
|
|
109
|
+
console.log(chalk.gray(` Gateway: ws://${gw.host || "127.0.0.1"}:${gw.port || 18789}`));
|
|
110
|
+
console.log(chalk.gray(` Agent model: ${agent.model || "claude-sonnet-4-6"}`));
|
|
111
|
+
console.log(chalk.gray(` Max turns: ${agent.maxTurns || 25}`));
|
|
112
|
+
console.log(chalk.gray(` Healing: ${healing.enabled !== false ? "enabled" : "disabled"}`));
|
|
113
|
+
console.log(chalk.gray(` Max heals: ${healing.maxHealsPerWindow || 5} per ${Math.round((healing.windowMs || 300000) / 60000)}min`));
|
|
114
|
+
|
|
115
|
+
const enabledChannels = Object.entries(channels)
|
|
116
|
+
.filter(([k, v]) => !k.startsWith("_") && v.enabled)
|
|
117
|
+
.map(([k]) => k);
|
|
118
|
+
console.log(chalk.gray(` Channels: ${enabledChannels.length > 0 ? enabledChannels.join(", ") : "terminal only"}`));
|
|
119
|
+
|
|
120
|
+
// Check for API keys
|
|
121
|
+
const hasOpenAI = !!process.env.OPENAI_API_KEY;
|
|
122
|
+
const hasAnthropic = !!process.env.ANTHROPIC_API_KEY;
|
|
123
|
+
console.log(chalk.gray(` OpenAI key: ${hasOpenAI ? "set" : "missing"}`));
|
|
124
|
+
console.log(chalk.gray(` Anthropic: ${hasAnthropic ? "set" : "missing"}`));
|
|
125
|
+
|
|
126
|
+
// Check openclaw installation
|
|
127
|
+
let openclawVersion = "not installed";
|
|
128
|
+
try {
|
|
129
|
+
const pkg = require("openclaw/package.json");
|
|
130
|
+
openclawVersion = pkg.version;
|
|
131
|
+
} catch {
|
|
132
|
+
try {
|
|
133
|
+
const { execSync } = require("child_process");
|
|
134
|
+
const ver = execSync("npx openclaw --version 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
135
|
+
openclawVersion = ver || "available via npx";
|
|
136
|
+
} catch {
|
|
137
|
+
openclawVersion = "not installed (will use npx)";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
console.log(chalk.gray(` OpenClaw: ${openclawVersion}`));
|
|
141
|
+
console.log("");
|
|
142
|
+
} catch (err) {
|
|
143
|
+
console.error(chalk.red(` Config error: ${err.message}\n`));
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// --direct: run without wolverine healing wrapper
|
|
150
|
+
if (args.includes("--direct")) {
|
|
151
|
+
console.log(chalk.blue("\n 🐾 Starting Wolverine Claw (direct mode — no healing)\n"));
|
|
152
|
+
require("../wolverine-claw/index");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Default: start with wolverine self-healing
|
|
157
|
+
const { ClawRunner } = require("../src/claw/claw-runner");
|
|
158
|
+
|
|
159
|
+
console.log(chalk.blue.bold("\n 🐾 Wolverine Claw — Starting with Self-Healing\n"));
|
|
160
|
+
|
|
161
|
+
const runner = new ClawRunner({ cwd: process.cwd() });
|
|
162
|
+
|
|
163
|
+
// Grace period: ignore SIGTERM for 3s after startup
|
|
164
|
+
let startupGrace = true;
|
|
165
|
+
setTimeout(() => { startupGrace = false; }, 3000);
|
|
166
|
+
|
|
167
|
+
process.on("SIGINT", () => {
|
|
168
|
+
console.log(chalk.blue("\n\n 👋 Shutting down Wolverine Claw..."));
|
|
169
|
+
runner.stop();
|
|
170
|
+
process.exit(0);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
process.on("SIGTERM", () => {
|
|
174
|
+
if (startupGrace) {
|
|
175
|
+
console.log(chalk.yellow(" ⚡ Ignoring SIGTERM during startup grace period (3s)"));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
runner.stop();
|
|
179
|
+
process.exit(0);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
runner.start();
|
package/bin/wolverine.js
CHANGED
|
@@ -39,6 +39,8 @@ ${chalk.bold("Options:")}
|
|
|
39
39
|
--info Show system info and exit
|
|
40
40
|
--init Scan server/ and build context map (routes, DB, config, deps)
|
|
41
41
|
--restart Full restart (kills parent + children, re-launches fresh)
|
|
42
|
+
--claw Launch wolverine-claw (agentic agent mode)
|
|
43
|
+
--setup-claw Guided setup for wolverine-claw (detects OpenClaw, merges config)
|
|
42
44
|
--x402-info Show x402 payment configuration
|
|
43
45
|
|
|
44
46
|
${chalk.bold("Configuration:")}
|
|
@@ -243,6 +245,31 @@ if (args.includes("--backups")) {
|
|
|
243
245
|
process.exit(0);
|
|
244
246
|
}
|
|
245
247
|
|
|
248
|
+
// --setup-claw: run claw setup wizard
|
|
249
|
+
if (args.includes("--setup-claw")) {
|
|
250
|
+
const { setup } = require("../src/claw/setup");
|
|
251
|
+
const dryRun = args.includes("--dry-run");
|
|
252
|
+
(async () => {
|
|
253
|
+
const result = await setup(process.cwd(), { dryRun });
|
|
254
|
+
process.exit(result.success ? 0 : 1);
|
|
255
|
+
})();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// --claw: launch wolverine-claw instead of server
|
|
260
|
+
if (args.includes("--claw")) {
|
|
261
|
+
const clawArgs = args.filter(a => a !== "--claw");
|
|
262
|
+
const { ClawRunner } = require("../src/claw/claw-runner");
|
|
263
|
+
console.log(chalk.blue.bold("\n 🐾 Wolverine Claw — Agentic Agent with Self-Healing\n"));
|
|
264
|
+
const clawRunner = new ClawRunner({ cwd: process.cwd() });
|
|
265
|
+
|
|
266
|
+
process.on("SIGINT", () => { clawRunner.stop(); process.exit(0); });
|
|
267
|
+
process.on("SIGTERM", () => { clawRunner.stop(); process.exit(0); });
|
|
268
|
+
|
|
269
|
+
clawRunner.start();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
246
273
|
const scriptPath = args.find(a => !a.startsWith("--")) || "server/index.js";
|
|
247
274
|
|
|
248
275
|
// Initialize server/ from template if it doesn't exist (first run)
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.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": {
|
|
7
|
-
"wolverine": "./bin/wolverine.js"
|
|
7
|
+
"wolverine": "./bin/wolverine.js",
|
|
8
|
+
"wolverine-claw": "./bin/wolverine-claw.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"start": "node bin/wolverine.js server/index.js",
|
|
11
12
|
"dev": "node bin/wolverine.js server/index.js",
|
|
12
13
|
"wolverine": "node bin/wolverine.js",
|
|
13
14
|
"server": "node server/index.js",
|
|
15
|
+
"claw": "node bin/wolverine-claw.js",
|
|
16
|
+
"claw:direct": "node bin/wolverine-claw.js --direct",
|
|
17
|
+
"claw:info": "node bin/wolverine-claw.js --info",
|
|
14
18
|
"demo": "node examples/run-demo.js",
|
|
15
19
|
"demo:list": "node examples/run-demo.js --list",
|
|
16
20
|
"test:pentest": "node tests/pentest-secrets.js"
|
|
@@ -47,6 +51,7 @@
|
|
|
47
51
|
"files": [
|
|
48
52
|
"bin/",
|
|
49
53
|
"src/",
|
|
54
|
+
"wolverine-claw/",
|
|
50
55
|
"examples/",
|
|
51
56
|
".env.example"
|
|
52
57
|
],
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
"viem": "^2.0.0"
|
|
65
70
|
},
|
|
66
71
|
"optionalDependencies": {
|
|
72
|
+
"openclaw": "^1.0.0",
|
|
67
73
|
"@coinbase/cdp-sdk": "^1.46.1",
|
|
68
74
|
"@privy-io/server-auth": "1.14.0",
|
|
69
75
|
"@x402/core": "^2.9.0",
|
package/src/brain/brain.js
CHANGED
|
@@ -277,6 +277,26 @@ const SEED_DOCS = [
|
|
|
277
277
|
text: "Auto-update: wolverine checks npm registry hourly for new versions. When found, runs npm install wolverine-ai@latest, backs up settings.json/.env.local before update and restores after. Config: autoUpdate.enabled (default true) in settings.json. Disable with WOLVERINE_AUTO_UPDATE=false env var. On successful update, signals runner to restart. Protected files never overwritten: settings.json, .env.local, .env, db.js. Update check runs 30s after startup then every hour (configurable via autoUpdate.intervalMs).",
|
|
278
278
|
metadata: { topic: "auto-update" },
|
|
279
279
|
},
|
|
280
|
+
{
|
|
281
|
+
text: "Wolverine Claw: agentic AI agent mode powered by OpenClaw with Wolverine self-healing. Wraps the OpenClaw gateway (WebSocket control plane + Pi agent runtime) in Wolverine's process manager for automatic crash recovery, AI-powered healing, and workspace backup. Architecture: wolverine-claw/index.js bootstraps OpenClaw (tries require('openclaw') SDK first, falls back to npx openclaw CLI). ClawRunner (src/claw/claw-runner.js) spawns the claw process with IPC, monitors for crashes and gateway errors, triggers heal pipeline on failures. Gateway health monitored via TCP probe on WebSocket port (default 18789). Config: wolverine-claw/config/settings.json with gateway, agent, channels, healing, skills, workspace, security sections. CLI: wolverine-claw --setup (guided onboarding), npm run claw (start with healing), wolverine --claw (same via main CLI), wolverine-claw --direct (no healing). Workspace: wolverine-claw/workspace/ is the sandboxed agent working directory.",
|
|
282
|
+
metadata: { topic: "wolverine-claw" },
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
text: "Wolverine Claw setup: guided onboarding for OpenClaw users (wolverine-claw --setup). 8-step flow: (1) Detect environment — Node version, OpenClaw installation (checks local node_modules, global install, package.json dep, ~/.openclaw/config.yml), API keys, wolverine core. (2) Abort if Node < 22. (3) Merge config — reads user's OpenClaw YAML config (gateway port, model, channels, security) and overlays onto wolverine-claw defaults. OpenClaw values win, wolverine fills gaps. (4) Scaffold — creates wolverine-claw/ with config/settings.json, plugins/wolverine-integration.js, workspace/, skills/. Never overwrites existing files. (5) Environment — ensures .env.local has claw-specific key templates (DISCORD_BOT_TOKEN, SLACK_BOT_TOKEN, etc). (6) Install — npm install openclaw --save-optional (falls back to npx). (7) Validate — 7 checks: Node, OpenClaw, API keys, config, entry point, plugin, wolverine core. (8) Next steps. Also available as wolverine --setup-claw from main CLI. Dry run: wolverine-claw --setup --dry.",
|
|
286
|
+
metadata: { topic: "wolverine-claw-setup" },
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
text: "Wolverine Claw integration plugin (wolverine-claw/plugins/wolverine-integration.js): registers 7 wolverine tools into the OpenClaw agent toolkit. Tools: wolverine_backup (create workspace snapshot), wolverine_rollback (restore to previous backup), wolverine_brain_search (semantic search of wolverine's memory for past fixes/patterns), wolverine_brain_learn (store new learnings in brain), wolverine_health (system health status), wolverine_list_backups (list all snapshots), wolverine_self_heal (trigger heal pipeline on a specific error). Plugin hooks into gateway events (error, agent:error, skill:error) to report errors to wolverine parent via IPC for automatic healing. Sends heartbeat every 30s. Registered via gateway.registerTools(), gateway.addTools(), or gateway.skills.register() depending on OpenClaw API version.",
|
|
290
|
+
metadata: { topic: "wolverine-claw-plugin" },
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
text: "Wolverine Claw configuration (wolverine-claw/config/settings.json): gateway (port 18789, host 127.0.0.1), agent (model claude-sonnet-4-6, maxTurns 25, timeoutMs 120000), models (reasoning/coding/chat/embedding per-task), channels (terminal enabled by default, discord/slack/telegram/whatsapp configurable with tokens in .env.local), healing (enabled, healTimeoutMs 300000, maxHealsPerWindow 5, loopMaxAttempts 3), skills (codingAgent with sandbox+allowedPaths, browserControl, cron, canvas), workspace (path wolverine-claw/workspace, maxFileSizeMB 50), security (dmPairing true, sandbox true, blockedCommands, maxConcurrentSessions 5), logging, remoteAccess (disabled, tailscale method), backup (stabilityMs 1800000, retentionDays 7). Editable scope: only wolverine-claw/ files can be modified by the claw agent. src/, bin/, server/ are protected.",
|
|
294
|
+
metadata: { topic: "wolverine-claw-config" },
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
text: "Wolverine Claw channels: OpenClaw supports 20+ messaging platforms. Configure in wolverine-claw/config/settings.json channels section. Terminal: always enabled (local CLI). Discord: set enabled:true, add DISCORD_BOT_TOKEN to .env.local. Slack: set enabled:true, add SLACK_BOT_TOKEN + SLACK_APP_TOKEN to .env.local. Telegram: set enabled:true, add TELEGRAM_BOT_TOKEN to .env.local. WhatsApp: set enabled:true, requires WhatsApp Business API setup. Each channel's tokens go in .env.local (never in settings.json). The claw setup wizard (--setup) detects existing OpenClaw channel config from ~/.openclaw/config.yml and merges it automatically.",
|
|
298
|
+
metadata: { topic: "wolverine-claw-channels" },
|
|
299
|
+
},
|
|
280
300
|
{
|
|
281
301
|
text: "Loop guard: detects infinite heal loops and stops burning tokens. Tracks heal attempts by error signature — if 3+ heals fail on same error in 10 minutes, STOPS healing and generates a bug report. Bug report sent to platform backend for human review (security scanned for injection/secrets first). 30-minute cooldown after bug report filed. Process dedup via PID file (.wolverine/wolverine.pid) ensures only one wolverine instance runs — kills old process on startup. Config: WOLVERINE_LOOP_MAX_ATTEMPTS (default 3), WOLVERINE_LOOP_WINDOW_MS (default 600000).",
|
|
282
302
|
metadata: { topic: "loop-guard" },
|