claude-flow 2.7.43 ā 2.7.45
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/claude-flow +1 -1
- package/dist/src/cli/simple-cli.js +79 -173
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/config.js +257 -115
- package/dist/src/cli/simple-commands/config.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js +2 -2
- package/dist/src/core/version.js.map +1 -1
- package/dist/src/memory/in-memory-store.js +1 -0
- package/dist/src/memory/in-memory-store.js.map +1 -1
- package/dist/src/memory/sqlite-wrapper.js +45 -8
- package/dist/src/memory/sqlite-wrapper.js.map +1 -1
- package/dist/src/memory/swarm-memory.js +13 -0
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/utils/metrics-reader.js +39 -37
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/package.json +1 -1
- package/src/memory/in-memory-store.js +2 -0
- package/src/memory/sqlite-wrapper.js +57 -8
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SQLite Wrapper with Windows Fallback Support
|
|
3
3
|
* Provides graceful fallback when better-sqlite3 fails to load
|
|
4
|
+
* Includes auto-rebuild for NODE_MODULE_VERSION mismatches
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import { createRequire } from 'module';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
7
9
|
import path from 'path';
|
|
8
10
|
import { fileURLToPath } from 'url';
|
|
9
11
|
|
|
@@ -13,6 +15,37 @@ const __dirname = path.dirname(__filename);
|
|
|
13
15
|
let Database = null;
|
|
14
16
|
let sqliteAvailable = false;
|
|
15
17
|
let loadError = null;
|
|
18
|
+
let rebuildAttempted = false;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Attempt to rebuild better-sqlite3 for the current Node.js version
|
|
22
|
+
*/
|
|
23
|
+
function tryRebuildBetterSqlite3() {
|
|
24
|
+
if (rebuildAttempted) return false;
|
|
25
|
+
rebuildAttempted = true;
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// Find the better-sqlite3 module path
|
|
29
|
+
const require = createRequire(import.meta.url);
|
|
30
|
+
const betterSqlite3Path = path.dirname(require.resolve('better-sqlite3/package.json'));
|
|
31
|
+
|
|
32
|
+
console.warn(`\nš§ Attempting to rebuild better-sqlite3 for Node.js ${process.version}...`);
|
|
33
|
+
|
|
34
|
+
// Run npm rebuild in the better-sqlite3 directory
|
|
35
|
+
execSync('npm rebuild', {
|
|
36
|
+
cwd: betterSqlite3Path,
|
|
37
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
38
|
+
timeout: 120000 // 2 minute timeout
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
console.warn(`ā
Rebuild successful! Retrying SQLite load...\n`);
|
|
42
|
+
return true;
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.warn(`ā ļø Auto-rebuild failed: ${err.message}`);
|
|
45
|
+
console.warn(` You may need build tools installed (python, make, g++)\n`);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
16
49
|
|
|
17
50
|
/**
|
|
18
51
|
* Try to load better-sqlite3 with comprehensive error handling
|
|
@@ -42,6 +75,24 @@ async function tryLoadSQLite() {
|
|
|
42
75
|
importErr.message?.includes('was compiled against a different Node.js version');
|
|
43
76
|
|
|
44
77
|
if (isVersionMismatch) {
|
|
78
|
+
// Try auto-rebuild first
|
|
79
|
+
if (!rebuildAttempted && tryRebuildBetterSqlite3()) {
|
|
80
|
+
// Rebuild succeeded, try loading again
|
|
81
|
+
try {
|
|
82
|
+
const require = createRequire(import.meta.url);
|
|
83
|
+
// Clear the require cache to pick up rebuilt module
|
|
84
|
+
const modulePath = require.resolve('better-sqlite3');
|
|
85
|
+
delete require.cache[modulePath];
|
|
86
|
+
Database = require('better-sqlite3');
|
|
87
|
+
sqliteAvailable = true;
|
|
88
|
+
loadError = null;
|
|
89
|
+
return true;
|
|
90
|
+
} catch (retryErr) {
|
|
91
|
+
// Rebuild succeeded but load still failed
|
|
92
|
+
loadError = retryErr;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
45
96
|
// Extract version info for helpful message
|
|
46
97
|
const errorMsg = requireErr.message || importErr.message || '';
|
|
47
98
|
const compiledMatch = errorMsg.match(/NODE_MODULE_VERSION (\d+)/);
|
|
@@ -65,18 +116,16 @@ async function tryLoadSQLite() {
|
|
|
65
116
|
ā ā
|
|
66
117
|
ā The better-sqlite3 module was compiled for a different Node.js version. ā${versionInfo}
|
|
67
118
|
ā ā
|
|
119
|
+
ā Auto-rebuild was attempted but SQLite is still unavailable. ā
|
|
68
120
|
ā Claude Flow will continue with JSON fallback storage (still works fine). ā
|
|
69
121
|
ā ā
|
|
70
|
-
ā To fix this and use SQLite:
|
|
71
|
-
ā ā
|
|
72
|
-
ā Option 1 - Rebuild the module: ā
|
|
73
|
-
ā > npm rebuild better-sqlite3 ā
|
|
122
|
+
ā To manually fix this and use SQLite: ā
|
|
74
123
|
ā ā
|
|
75
|
-
ā Option
|
|
76
|
-
ā >
|
|
124
|
+
ā Option 1 - Global install (recommended): ā
|
|
125
|
+
ā > npm install -g claude-flow@alpha ā
|
|
77
126
|
ā ā
|
|
78
|
-
ā Option
|
|
79
|
-
ā > rm -rf
|
|
127
|
+
ā Option 2 - Clear npx cache: ā
|
|
128
|
+
ā > rm -rf ~/.npm/_npx/ && npx claude-flow@alpha ... ā
|
|
80
129
|
ā ā
|
|
81
130
|
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
82
131
|
`);
|