wolverine-ai 5.2.9 → 5.2.11
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/bin/wolverine.js +51 -0
- package/package.json +1 -1
- package/src/middleware/x402-fastify.js +4 -4
package/bin/wolverine.js
CHANGED
|
@@ -38,6 +38,7 @@ ${chalk.bold("Options:")}
|
|
|
38
38
|
--workers <n> Force specific worker count
|
|
39
39
|
--info Show system info and exit
|
|
40
40
|
--init Scan server/ and build context map (routes, DB, config, deps)
|
|
41
|
+
--restart Full restart (kills parent + children, re-launches fresh)
|
|
41
42
|
--x402-info Show x402 payment configuration
|
|
42
43
|
|
|
43
44
|
${chalk.bold("Configuration:")}
|
|
@@ -121,6 +122,56 @@ if (args.includes("--init")) {
|
|
|
121
122
|
process.exit(0);
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
// --restart: full framework restart (kills parent + all children, re-launches)
|
|
126
|
+
if (args.includes("--restart")) {
|
|
127
|
+
const fs = require("fs");
|
|
128
|
+
const { execSync, spawn } = require("child_process");
|
|
129
|
+
const pidPath = path.resolve(process.cwd(), ".wolverine", "wolverine.pid");
|
|
130
|
+
|
|
131
|
+
// Find and kill the running wolverine process
|
|
132
|
+
let killed = false;
|
|
133
|
+
if (fs.existsSync(pidPath)) {
|
|
134
|
+
const pid = parseInt(fs.readFileSync(pidPath, "utf-8").trim(), 10);
|
|
135
|
+
if (pid) {
|
|
136
|
+
try {
|
|
137
|
+
process.kill(pid, "SIGTERM");
|
|
138
|
+
console.log(chalk.yellow(` 🔄 Killed wolverine process ${pid}`));
|
|
139
|
+
killed = true;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
if (e.code !== "ESRCH") console.log(chalk.gray(` ⚠️ Could not kill PID ${pid}: ${e.message}`));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Also kill any lingering child processes
|
|
147
|
+
try {
|
|
148
|
+
if (process.platform === "win32") {
|
|
149
|
+
execSync('taskkill /F /IM node.exe /FI "WINDOWTITLE eq wolverine*" 2>nul', { stdio: "ignore" });
|
|
150
|
+
} else {
|
|
151
|
+
execSync("pkill -f 'wolverine.js --single' 2>/dev/null; pkill -f 'error-hook.js' 2>/dev/null", { stdio: "ignore" });
|
|
152
|
+
}
|
|
153
|
+
} catch {}
|
|
154
|
+
|
|
155
|
+
// Wait for processes to die
|
|
156
|
+
const wait = killed ? 3000 : 1000;
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
// Find the script path from the old PID file's sibling args, or use default
|
|
159
|
+
const scriptPath = args[args.indexOf("--restart") + 1] || "server/index.js";
|
|
160
|
+
|
|
161
|
+
console.log(chalk.blue(` 🚀 Restarting: wolverine --single ${scriptPath}`));
|
|
162
|
+
const child = spawn(process.execPath, [__filename, "--single", scriptPath], {
|
|
163
|
+
cwd: process.cwd(),
|
|
164
|
+
detached: true,
|
|
165
|
+
stdio: "ignore",
|
|
166
|
+
env: process.env,
|
|
167
|
+
});
|
|
168
|
+
child.unref();
|
|
169
|
+
console.log(chalk.green(` ✅ Wolverine restarted (PID ${child.pid})`));
|
|
170
|
+
process.exit(0);
|
|
171
|
+
}, wait);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
124
175
|
// --update: safe framework update
|
|
125
176
|
if (args.includes("--update")) {
|
|
126
177
|
const { safeUpdate } = require("../src/skills/update");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.11",
|
|
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": {
|
|
@@ -187,15 +187,15 @@ async function x402Plugin(fastify, opts) {
|
|
|
187
187
|
// Use x402 SDK if available
|
|
188
188
|
if (_x402Server) {
|
|
189
189
|
try {
|
|
190
|
-
// Verify
|
|
191
|
-
const verifyResult = await _x402Server.
|
|
190
|
+
// Verify via facilitator
|
|
191
|
+
const verifyResult = await _x402Server.verifyPayment(paymentPayload, paymentRequirements);
|
|
192
192
|
if (!verifyResult.isValid) {
|
|
193
193
|
reply.code(402).send({ error: "Payment verification failed", reason: verifyResult.invalidReason, price, payTo: _payTo });
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
// Settle
|
|
198
|
-
const settleResult = await _x402Server.
|
|
197
|
+
// Settle via facilitator (executes on-chain transfer)
|
|
198
|
+
const settleResult = await _x402Server.settlePayment(paymentPayload, paymentRequirements);
|
|
199
199
|
if (!settleResult.success) {
|
|
200
200
|
reply.code(402).send({ error: "Payment settlement failed", reason: settleResult.errorReason, price, payTo: _payTo });
|
|
201
201
|
return;
|