vesper-wizard 2.0.9 → 2.1.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/build/index.js CHANGED
@@ -530,7 +530,45 @@ function syncPythonScripts(appRoot, dataRoot) {
530
530
  }
531
531
  // Sync scripts immediately
532
532
  syncPythonScripts(appRoot, dataRoot);
533
- const metadataStore = new MetadataStore(dbPath);
533
+ // Auto-rebuild better-sqlite3 if native binary doesn't match current Node version
534
+ function tryRebuildSqlite() {
535
+ try {
536
+ const { execSync } = require("child_process");
537
+ const pkgRoot = path.resolve(__dirname, "..");
538
+ console.error("[Vesper] Rebuilding better-sqlite3 for Node " + process.version + "...");
539
+ execSync("npm rebuild better-sqlite3", {
540
+ stdio: "pipe",
541
+ timeout: 60000,
542
+ cwd: pkgRoot,
543
+ });
544
+ console.error("[Vesper] Rebuild succeeded. Retrying...");
545
+ // Clear require cache so the rebuilt module is loaded
546
+ for (const key of Object.keys(require.cache)) {
547
+ if (key.includes("better-sqlite3") || key.includes("better_sqlite3")) {
548
+ delete require.cache[key];
549
+ }
550
+ }
551
+ return true;
552
+ }
553
+ catch (e) {
554
+ console.error("[Vesper] Auto-rebuild failed: " + (e?.message || e));
555
+ return false;
556
+ }
557
+ }
558
+ let metadataStore;
559
+ try {
560
+ metadataStore = new MetadataStore(dbPath);
561
+ }
562
+ catch (e) {
563
+ if (e?.code === "ERR_DLOPEN_FAILED" && tryRebuildSqlite()) {
564
+ metadataStore = new MetadataStore(dbPath);
565
+ }
566
+ else {
567
+ console.error("[Vesper] FATAL: Cannot load better-sqlite3.");
568
+ console.error("[Vesper] Run: npm rebuild better-sqlite3");
569
+ throw e;
570
+ }
571
+ }
534
572
  const vectorStore = new VectorStore(vectorPath);
535
573
  const embedder = Embedder.getInstance();
536
574
  const searchEngine = new SearchEngine(metadataStore, vectorStore, embedder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vesper-wizard",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "description": "AI-powered dataset discovery, quality analysis, and preparation MCP server with multimodal support (text, image, audio, video)",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -62,7 +62,21 @@ dirs.forEach(dir => {
62
62
 
63
63
  console.log(`āœ… Data directories created at ${vesperDataDir}`);
64
64
 
65
- // 4. Auto-configure Claude Desktop (Best Effort)
65
+ // 4. Rebuild better-sqlite3 for current Node.js version
66
+ console.log('\nšŸ”§ Rebuilding native modules for current Node.js...');
67
+ try {
68
+ execSync('npm rebuild better-sqlite3', {
69
+ stdio: 'pipe',
70
+ timeout: 60000,
71
+ cwd: path.resolve(__dirname, '..')
72
+ });
73
+ console.log('āœ… Native modules rebuilt successfully');
74
+ } catch (e) {
75
+ console.warn('āš ļø Could not rebuild better-sqlite3: ' + (e.message || e));
76
+ console.warn(' If you see ERR_DLOPEN_FAILED, run: npm rebuild better-sqlite3');
77
+ }
78
+
79
+ // 5. Auto-configure Claude Desktop (Best Effort)
66
80
  console.log('\nāš™ļø Attempting to auto-configure Claude Desktop...');
67
81
 
68
82
  function getClaudeConfigPath() {