forbocai 0.3.6 → 0.3.8
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/README.md +1 -1
- package/package.json +1 -1
- package/scripts/check-cmake.js +62 -33
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ AI state (memories, personality, mood) is complex and sensitive. Classes encoura
|
|
|
99
99
|
npm install forbocai
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
**Windows:** The SDK requires **CMake**
|
|
102
|
+
**Windows:** The SDK requires **CMake** and the **Visual Studio C++ workload** ("Desktop development with C++") to build the native Cortex (`node-llama-cpp`). The install runs a preinstall check; if it fails, you'll see a message for either missing CMake or missing C++ toolset. Install [CMake](https://cmake.org/download/) (add to PATH) and [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with "Desktop development with C++" selected (or add that workload via Visual Studio Installer → Modify). Then run `npm install forbocai` again.
|
|
103
103
|
|
|
104
104
|
---
|
|
105
105
|
|
package/package.json
CHANGED
package/scripts/check-cmake.js
CHANGED
|
@@ -1,48 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Preinstall check: CMake
|
|
3
|
-
//
|
|
2
|
+
// Preinstall check (Windows only): CMake and Visual Studio C++ workload required for node-llama-cpp.
|
|
3
|
+
// On macOS/Linux we skip this so install works as before (prebuilt binaries or system cmake).
|
|
4
4
|
|
|
5
|
-
const {
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const fs = require('fs');
|
|
6
8
|
const isWindows = process.platform === 'win32';
|
|
7
9
|
|
|
10
|
+
if (!isWindows) {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
function cmakeAvailable() {
|
|
9
15
|
try {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return r.status === 0;
|
|
13
|
-
}
|
|
14
|
-
execSync('which cmake', { stdio: 'pipe' });
|
|
15
|
-
return true;
|
|
16
|
+
const r = spawnSync('cmake', ['--version'], { stdio: 'pipe', shell: true });
|
|
17
|
+
return r.status === 0;
|
|
16
18
|
} catch {
|
|
17
19
|
return false;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
// Check for Visual Studio with "Desktop development with C++" (VC++ toolset) via vswhere.
|
|
24
|
+
function vcToolsetAvailable() {
|
|
25
|
+
const programFiles = process.env['ProgramFiles(x86)'] || path.join(process.env.SystemDrive || 'C:', 'Program Files (x86)');
|
|
26
|
+
const vswherePath = path.join(programFiles, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe');
|
|
27
|
+
if (!fs.existsSync(vswherePath)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const r = spawnSync(vswherePath, [
|
|
31
|
+
'-products', '*',
|
|
32
|
+
'-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
|
|
33
|
+
'-latest',
|
|
34
|
+
'-property', 'installationPath'
|
|
35
|
+
], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
36
|
+
const out = (r.stdout && r.stdout.trim()) || '';
|
|
37
|
+
return r.status === 0 && out.length > 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
21
40
|
if (!cmakeAvailable()) {
|
|
22
|
-
const msg =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const msg = [
|
|
42
|
+
'',
|
|
43
|
+
'ForbocAI SDK requires CMake to build the native Cortex (node-llama-cpp).',
|
|
44
|
+
'',
|
|
45
|
+
'On Windows:',
|
|
46
|
+
' 1. Install CMake: https://cmake.org/download/',
|
|
47
|
+
' - Run the installer and check "Add CMake to the system PATH".',
|
|
48
|
+
' 2. Install Visual Studio Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/',
|
|
49
|
+
' - Select "Desktop development with C++".',
|
|
50
|
+
' 3. Close and reopen your terminal, then run: npm install forbocai',
|
|
51
|
+
'',
|
|
52
|
+
'Or install via Chocolatey: choco install cmake visualstudio2022buildtools',
|
|
53
|
+
''
|
|
54
|
+
];
|
|
55
|
+
console.error(msg.join('\n'));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!vcToolsetAvailable()) {
|
|
60
|
+
const msg = [
|
|
61
|
+
'',
|
|
62
|
+
'ForbocAI SDK requires the Visual Studio C++ toolset to build the native Cortex (node-llama-cpp).',
|
|
63
|
+
'',
|
|
64
|
+
'You have CMake but the "Desktop development with C++" workload is missing or not detected.',
|
|
65
|
+
'',
|
|
66
|
+
'On Windows:',
|
|
67
|
+
' 1. Open "Visual Studio Installer" (from Start menu).',
|
|
68
|
+
' 2. Find "Build Tools 2022" (or your VS version) → click "Modify".',
|
|
69
|
+
' 3. Check "Desktop development with C++" and install.',
|
|
70
|
+
' 4. Close and reopen your terminal, then run: npm install forbocai',
|
|
71
|
+
'',
|
|
72
|
+
'Or install the workload via Chocolatey: choco install visualstudio2022-workload-vctools -y',
|
|
73
|
+
''
|
|
74
|
+
];
|
|
46
75
|
console.error(msg.join('\n'));
|
|
47
76
|
process.exit(1);
|
|
48
77
|
}
|