forbocai 0.3.7 → 0.3.9

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 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** (and Visual Studio Build Tools) to build the native Cortex (`node-llama-cpp`). If `npm install` fails with a CMake message, install [CMake](https://cmake.org/download/) (add to PATH) and [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) (Desktop development with C++), then run `npm install forbocai` again.
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 via the Visual Studio Installer (Modify → check "Desktop development with C++"). Then run `npm install forbocai` again.
103
103
 
104
104
  ---
105
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forbocai",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "The Infrastructure Layer for Autonomous AI Characters",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
- // Preinstall check (Windows only): CMake is required for node-llama-cpp on Windows.
2
+ // Preinstall check (Windows only): CMake and Visual Studio C++ workload required for node-llama-cpp.
3
3
  // On macOS/Linux we skip this so install works as before (prebuilt binaries or system cmake).
4
4
 
5
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
 
8
10
  if (!isWindows) {
@@ -18,31 +20,54 @@ function cmakeAvailable() {
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 = isWindows
23
- ? [
24
- '',
25
- 'ForbocAI SDK requires CMake to build the native Cortex (node-llama-cpp).',
26
- '',
27
- 'On Windows:',
28
- ' 1. Install CMake: https://cmake.org/download/',
29
- ' - Run the installer and check "Add CMake to the system PATH".',
30
- ' 2. Install Visual Studio Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/',
31
- ' - Select "Desktop development with C++".',
32
- ' 3. Close and reopen your terminal, then run: npm install forbocai',
33
- '',
34
- 'Or install via Chocolatey: choco install cmake visualstudio2022buildtools',
35
- ''
36
- ]
37
- : [
38
- '',
39
- 'ForbocAI SDK requires CMake to build the native Cortex (node-llama-cpp).',
40
- '',
41
- 'Install CMake, then run: npm install forbocai',
42
- ' macOS (Homebrew): brew install cmake',
43
- ' Linux (apt): sudo apt install cmake',
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
+ ];
53
+ console.error(msg.join('\n'));
54
+ process.exit(1);
55
+ }
56
+
57
+ if (!vcToolsetAvailable()) {
58
+ const msg = [
59
+ '',
60
+ 'ForbocAI SDK requires the Visual Studio C++ toolset to build the native Cortex (node-llama-cpp).',
61
+ '',
62
+ 'You have CMake but the "Desktop development with C++" workload is missing or not detected.',
63
+ '',
64
+ 'On Windows:',
65
+ ' 1. Open "Visual Studio Installer" (from Start menu).',
66
+ ' 2. Find "Build Tools 2022" (or your VS version) → click "Modify".',
67
+ ' 3. Check "Desktop development with C++" and install.',
68
+ ' 4. Close and reopen your terminal, then run: npm install forbocai',
69
+ ''
70
+ ];
46
71
  console.error(msg.join('\n'));
47
72
  process.exit(1);
48
73
  }