wolverine-ai 3.7.1 ā 3.7.3
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 +1 -1
- package/src/core/runner.js +18 -1
- package/src/security/injection-detector.js +22 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.3",
|
|
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/runner.js
CHANGED
|
@@ -558,6 +558,7 @@ class WolverineRunner {
|
|
|
558
558
|
this._healInProgress = false;
|
|
559
559
|
this._healStatus = null;
|
|
560
560
|
this._spawn();
|
|
561
|
+
this._processPendingErrorHeal();
|
|
561
562
|
} else {
|
|
562
563
|
console.log(chalk.red(`\nšŗ Wolverine could not heal: ${result.explanation}`));
|
|
563
564
|
|
|
@@ -609,7 +610,13 @@ class WolverineRunner {
|
|
|
609
610
|
* Unlike crash healing, the server is still running ā we heal and restart.
|
|
610
611
|
*/
|
|
611
612
|
async _healFromError(routePath, errorDetails) {
|
|
612
|
-
if (this.
|
|
613
|
+
if (this._shuttingDown) return;
|
|
614
|
+
if (this._healInProgress) {
|
|
615
|
+
// Queue the error ā process after current heal finishes
|
|
616
|
+
this._pendingErrorHeal = { routePath, errorDetails };
|
|
617
|
+
console.log(chalk.yellow(` š Heal in progress ā queued IPC error on ${routePath} for after current heal`));
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
613
620
|
this._healInProgress = true;
|
|
614
621
|
|
|
615
622
|
console.log(chalk.yellow(`\nšŗ Wolverine healing caught error on ${routePath}...`));
|
|
@@ -693,6 +700,16 @@ class WolverineRunner {
|
|
|
693
700
|
}
|
|
694
701
|
}
|
|
695
702
|
|
|
703
|
+
_processPendingErrorHeal() {
|
|
704
|
+
if (this._pendingErrorHeal) {
|
|
705
|
+
const { routePath, errorDetails } = this._pendingErrorHeal;
|
|
706
|
+
this._pendingErrorHeal = null;
|
|
707
|
+
console.log(chalk.yellow(` š Processing queued IPC error on ${routePath}`));
|
|
708
|
+
// Small delay to let the new child process start
|
|
709
|
+
setTimeout(() => this._healFromError(routePath, errorDetails), 2000);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
696
713
|
_startStabilityTimer() {
|
|
697
714
|
this._clearStabilityTimer();
|
|
698
715
|
// Capture backup ID in closure ā prevents race where a new heal overwrites _lastBackupId
|
|
@@ -98,13 +98,31 @@ Respond with ONLY valid JSON:
|
|
|
98
98
|
category: "audit",
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
const content = result.content;
|
|
102
|
-
|
|
101
|
+
const content = (result.content || "").trim();
|
|
102
|
+
// Strip markdown code blocks, thinking tags, and any prefix text
|
|
103
|
+
let cleaned = content
|
|
104
|
+
.replace(/^```(?:json)?\s*/gm, "")
|
|
105
|
+
.replace(/```\s*$/gm, "")
|
|
106
|
+
.replace(/<\|channel>.*?<channel\|>/gs, "") // Gemma thinking tags
|
|
107
|
+
.replace(/<\|think\|>[\s\S]*?<\|\/think\|>/g, "") // thinking blocks
|
|
108
|
+
.trim();
|
|
109
|
+
|
|
110
|
+
// Extract JSON object from response (might have text before/after)
|
|
111
|
+
const jsonMatch = cleaned.match(/\{[\s\S]*"safe"\s*:\s*(true|false)[\s\S]*\}/);
|
|
112
|
+
if (jsonMatch) cleaned = jsonMatch[0];
|
|
103
113
|
|
|
104
114
|
try {
|
|
105
|
-
|
|
115
|
+
const parsed = JSON.parse(cleaned);
|
|
116
|
+
return parsed;
|
|
106
117
|
} catch {
|
|
107
|
-
|
|
118
|
+
// If the response contains "safe" as text, infer the result
|
|
119
|
+
if (/\bsafe\b.*\btrue\b/i.test(content) || /\bnone\b.*\brisk/i.test(content)) {
|
|
120
|
+
return { safe: true, risk_level: "none", explanation: "Inferred safe from unparseable response" };
|
|
121
|
+
}
|
|
122
|
+
// Default to SAFE for parse failures ā blocking heals on bad JSON is worse than allowing a safe error through
|
|
123
|
+
// The regex layer already caught obvious injection patterns
|
|
124
|
+
console.log(chalk.yellow(` ā ļø AI audit: could not parse response, defaulting to safe`));
|
|
125
|
+
return { safe: true, risk_level: "none", explanation: "Could not parse safety scan ā defaulting safe (regex layer passed)" };
|
|
108
126
|
}
|
|
109
127
|
}
|
|
110
128
|
|