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 +39 -1
- package/package.json +1 -1
- package/scripts/postinstall.cjs +15 -1
- package/scripts/wizard.cjs +6 -30
- package/scripts/wizard.js +6 -30
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
|
-
|
|
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
package/scripts/postinstall.cjs
CHANGED
|
@@ -62,7 +62,21 @@ dirs.forEach(dir => {
|
|
|
62
62
|
|
|
63
63
|
console.log(`ā
Data directories created at ${vesperDataDir}`);
|
|
64
64
|
|
|
65
|
-
// 4.
|
|
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() {
|
package/scripts/wizard.cjs
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: '
|
|
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,
|
|
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 === '
|
|
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
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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: '
|
|
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,
|
|
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 === '
|
|
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
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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 };
|