vesper-wizard 2.0.9 → 2.1.1

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.1",
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() {
@@ -221,14 +221,10 @@ async function chooseAuthMode(existingKey, existingAuthMode) {
221
221
  }
222
222
 
223
223
  const choices = [];
224
- if (hasExistingKey) {
225
- choices.push({ value: 'keep', label: 'Keep current key as-is' });
226
- }
227
- choices.push({ value: 'manual', label: 'Provide Vesper API key manually' });
228
224
  choices.push({ value: 'browser', label: 'Sign in through the browser' });
229
- choices.push({ value: 'local', label: 'Use local-only key' });
225
+ choices.push({ value: 'manual', label: 'Provide Vesper API key manually' });
230
226
 
231
- return await askChoice(`${cyan('→')} How do you want to authenticate Vesper?`, choices, hasExistingKey ? 'keep' : 'browser');
227
+ return await askChoice(`${cyan('→')} How do you want to authenticate Vesper?`, choices, 'browser');
232
228
  }
233
229
 
234
230
  async function deviceAuthFlow() {
@@ -463,9 +459,7 @@ async function main() {
463
459
 
464
460
  const authChoice = await chooseAuthMode(localKey, authMode);
465
461
 
466
- if (authChoice === 'keep' && localKey) {
467
- console.log(` ${green('āœ“')} Keeping current key`);
468
- } else if (authChoice === 'manual') {
462
+ if (authChoice === 'manual') {
469
463
  localKey = await promptForManualApiKey();
470
464
  authMode = 'cloud';
471
465
  console.log(` ${green('āœ“')} Cloud API key saved from manual input`);
@@ -475,28 +469,10 @@ async function main() {
475
469
  localKey = cloudKey;
476
470
  authMode = 'cloud';
477
471
  } else {
478
- const fallbackChoice = await askChoice(`${yellow('!')} Browser sign-in did not complete. Choose a fallback:`, [
479
- { value: 'manual', label: 'Provide Vesper API key manually' },
480
- { value: 'local', label: 'Use local-only key' },
481
- ], 'manual');
482
-
483
- if (fallbackChoice === 'manual') {
484
- localKey = await promptForManualApiKey();
485
- authMode = 'cloud';
486
- } else {
487
- if (!localKey || isCloudApiKey(localKey)) {
488
- localKey = generateLocalKey();
489
- }
490
- authMode = 'local_unified';
491
- console.log(`\n ${yellow('⚠')} Using local-only key. Run the wizard again anytime to link an account.`);
492
- }
493
- }
494
- } else {
495
- if (!localKey || isCloudApiKey(localKey)) {
496
- localKey = generateLocalKey();
472
+ console.log(`\n ${yellow('!')} Browser sign-in did not complete. Falling back to manual key entry.`);
473
+ localKey = await promptForManualApiKey();
474
+ authMode = 'cloud';
497
475
  }
498
- authMode = 'local_unified';
499
- console.log(` ${green('āœ“')} Local-only key ready`);
500
476
  }
501
477
 
502
478
  const configData = { ...existing, api_key: localKey, auth_mode: authMode };
package/scripts/wizard.js CHANGED
@@ -221,14 +221,10 @@ async function chooseAuthMode(existingKey, existingAuthMode) {
221
221
  }
222
222
 
223
223
  const choices = [];
224
- if (hasExistingKey) {
225
- choices.push({ value: 'keep', label: 'Keep current key as-is' });
226
- }
227
- choices.push({ value: 'manual', label: 'Provide Vesper API key manually' });
228
224
  choices.push({ value: 'browser', label: 'Sign in through the browser' });
229
- choices.push({ value: 'local', label: 'Use local-only key' });
225
+ choices.push({ value: 'manual', label: 'Provide Vesper API key manually' });
230
226
 
231
- return await askChoice(`${cyan('→')} How do you want to authenticate Vesper?`, choices, hasExistingKey ? 'keep' : 'browser');
227
+ return await askChoice(`${cyan('→')} How do you want to authenticate Vesper?`, choices, 'browser');
232
228
  }
233
229
 
234
230
  async function deviceAuthFlow() {
@@ -463,9 +459,7 @@ async function main() {
463
459
 
464
460
  const authChoice = await chooseAuthMode(localKey, authMode);
465
461
 
466
- if (authChoice === 'keep' && localKey) {
467
- console.log(` ${green('āœ“')} Keeping current key`);
468
- } else if (authChoice === 'manual') {
462
+ if (authChoice === 'manual') {
469
463
  localKey = await promptForManualApiKey();
470
464
  authMode = 'cloud';
471
465
  console.log(` ${green('āœ“')} Cloud API key saved from manual input`);
@@ -475,28 +469,10 @@ async function main() {
475
469
  localKey = cloudKey;
476
470
  authMode = 'cloud';
477
471
  } else {
478
- const fallbackChoice = await askChoice(`${yellow('!')} Browser sign-in did not complete. Choose a fallback:`, [
479
- { value: 'manual', label: 'Provide Vesper API key manually' },
480
- { value: 'local', label: 'Use local-only key' },
481
- ], 'manual');
482
-
483
- if (fallbackChoice === 'manual') {
484
- localKey = await promptForManualApiKey();
485
- authMode = 'cloud';
486
- } else {
487
- if (!localKey || isCloudApiKey(localKey)) {
488
- localKey = generateLocalKey();
489
- }
490
- authMode = 'local_unified';
491
- console.log(`\n ${yellow('⚠')} Using local-only key. Run the wizard again anytime to link an account.`);
492
- }
493
- }
494
- } else {
495
- if (!localKey || isCloudApiKey(localKey)) {
496
- localKey = generateLocalKey();
472
+ console.log(`\n ${yellow('!')} Browser sign-in did not complete. Falling back to manual key entry.`);
473
+ localKey = await promptForManualApiKey();
474
+ authMode = 'cloud';
497
475
  }
498
- authMode = 'local_unified';
499
- console.log(` ${green('āœ“')} Local-only key ready`);
500
476
  }
501
477
 
502
478
  const configData = { ...existing, api_key: localKey, auth_mode: authMode };