genai-electron 0.5.0 → 0.7.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/LICENSE +21 -21
- package/README.md +87 -85
- package/dist/config/defaults.d.ts +29 -17
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +31 -19
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/reasoning-models.d.ts.map +1 -1
- package/dist/config/reasoning-models.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/managers/BinaryManager.d.ts.map +1 -1
- package/dist/managers/BinaryManager.js +12 -3
- package/dist/managers/BinaryManager.js.map +1 -1
- package/dist/managers/DiffusionServerManager.d.ts +5 -0
- package/dist/managers/DiffusionServerManager.d.ts.map +1 -1
- package/dist/managers/DiffusionServerManager.js +106 -31
- package/dist/managers/DiffusionServerManager.js.map +1 -1
- package/dist/managers/GenerationRegistry.d.ts.map +1 -1
- package/dist/managers/GenerationRegistry.js +1 -1
- package/dist/managers/GenerationRegistry.js.map +1 -1
- package/dist/managers/LlamaServerManager.d.ts +17 -0
- package/dist/managers/LlamaServerManager.d.ts.map +1 -1
- package/dist/managers/LlamaServerManager.js +296 -30
- package/dist/managers/LlamaServerManager.js.map +1 -1
- package/dist/managers/ModelManager.d.ts +3 -0
- package/dist/managers/ModelManager.d.ts.map +1 -1
- package/dist/managers/ModelManager.js +208 -0
- package/dist/managers/ModelManager.js.map +1 -1
- package/dist/managers/ResourceOrchestrator.d.ts.map +1 -1
- package/dist/managers/ResourceOrchestrator.js +62 -54
- package/dist/managers/ResourceOrchestrator.js.map +1 -1
- package/dist/managers/ServerManager.d.ts +1 -1
- package/dist/managers/ServerManager.d.ts.map +1 -1
- package/dist/managers/ServerManager.js +6 -2
- package/dist/managers/ServerManager.js.map +1 -1
- package/dist/managers/StorageManager.d.ts.map +1 -1
- package/dist/managers/StorageManager.js +51 -0
- package/dist/managers/StorageManager.js.map +1 -1
- package/dist/process/health-check.d.ts +4 -3
- package/dist/process/health-check.d.ts.map +1 -1
- package/dist/process/health-check.js +12 -6
- package/dist/process/health-check.js.map +1 -1
- package/dist/process/log-manager.d.ts +11 -1
- package/dist/process/log-manager.d.ts.map +1 -1
- package/dist/process/log-manager.js +49 -2
- package/dist/process/log-manager.js.map +1 -1
- package/dist/process/port-utils.d.ts +3 -0
- package/dist/process/port-utils.d.ts.map +1 -0
- package/dist/process/port-utils.js +28 -0
- package/dist/process/port-utils.js.map +1 -0
- package/dist/system/SystemInfo.d.ts +2 -3
- package/dist/system/SystemInfo.d.ts.map +1 -1
- package/dist/system/SystemInfo.js +91 -17
- package/dist/system/SystemInfo.js.map +1 -1
- package/dist/types/images.d.ts +2 -2
- package/dist/types/images.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +9 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/servers.d.ts +21 -2
- package/dist/types/servers.d.ts.map +1 -1
- package/dist/utils/debug-log.d.ts +3 -0
- package/dist/utils/debug-log.d.ts.map +1 -0
- package/dist/utils/debug-log.js +10 -0
- package/dist/utils/debug-log.js.map +1 -0
- package/dist/utils/kv-cache-math.d.ts +6 -0
- package/dist/utils/kv-cache-math.d.ts.map +1 -0
- package/dist/utils/kv-cache-math.js +35 -0
- package/dist/utils/kv-cache-math.js.map +1 -0
- package/dist/utils/model-metadata-helpers.d.ts +2 -0
- package/dist/utils/model-metadata-helpers.d.ts.map +1 -1
- package/dist/utils/model-metadata-helpers.js +28 -0
- package/dist/utils/model-metadata-helpers.js.map +1 -1
- package/package.json +73 -73
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Luigi Acerbi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luigi Acerbi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,85 +1,87 @@
|
|
|
1
|
-
# genai-electron
|
|
2
|
-
|
|
3
|
-
> **Version**: 0.
|
|
4
|
-
|
|
5
|
-
Electron-specific library for managing local AI model servers (llama.cpp, stable-diffusion.cpp). Handles platform-specific operations to run AI models locally. Complements [genai-lite](https://github.com/lacerbi/genai-lite) for API abstraction.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- ✅ **System detection** - Auto-detect RAM, CPU, GPU, VRAM capabilities
|
|
10
|
-
- ✅ **Model management** - Download GGUF models with progress tracking and metadata extraction
|
|
11
|
-
- ✅ **LLM server** - Manage llama-server lifecycle with auto-configuration
|
|
12
|
-
- ✅ **Image generation** - Local image generation via stable-diffusion.cpp
|
|
13
|
-
- ✅ **Multi-component diffusion models** - Flux 2, SDXL split components with aggregate checksum validation
|
|
14
|
-
- ✅ **Resource orchestration** - Automatic LLM offload/reload when memory constrained
|
|
15
|
-
- ✅ **
|
|
16
|
-
- ✅ **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- [
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- **
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
# genai-electron
|
|
2
|
+
|
|
3
|
+
> **Version**: 0.7.1 | **Status**: Production Ready - LLM & Image Generation, hardened server lifecycle
|
|
4
|
+
|
|
5
|
+
Electron-specific library for managing local AI model servers (llama.cpp, stable-diffusion.cpp). Handles platform-specific operations to run AI models locally. Complements [genai-lite](https://github.com/lacerbi/genai-lite) for API abstraction.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- ✅ **System detection** - Auto-detect RAM, CPU, GPU, VRAM capabilities
|
|
10
|
+
- ✅ **Model management** - Download GGUF models with progress tracking and metadata extraction
|
|
11
|
+
- ✅ **LLM server** - Manage llama-server lifecycle with auto-configuration
|
|
12
|
+
- ✅ **Image generation** - Local image generation via stable-diffusion.cpp
|
|
13
|
+
- ✅ **Multi-component diffusion models** - Flux 2, SDXL split components with aggregate checksum validation
|
|
14
|
+
- ✅ **Resource orchestration** - Automatic LLM offload/reload when memory constrained
|
|
15
|
+
- ✅ **Reliable server lifecycle** - Crash auto-restart, hang watchdog, automatic port selection, occupancy safety, log rotation
|
|
16
|
+
- ✅ **Advanced launch control** - KV-cache quantization, flash-attention control, MoE CPU offload, multi-shard GGUF downloads, image-generation cancellation
|
|
17
|
+
- ✅ **Binary management** - Automatic binary download with GPU variant testing (CUDA→Vulkan→CPU)
|
|
18
|
+
- ✅ **TypeScript-first** - Full type safety, minimal runtime dependencies
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install genai-electron
|
|
24
|
+
npm install electron@>=25.0.0 # Peer dependency
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { app } from 'electron';
|
|
31
|
+
import { systemInfo, modelManager, llamaServer } from 'genai-electron';
|
|
32
|
+
|
|
33
|
+
app.whenReady().then(async () => {
|
|
34
|
+
// Detect capabilities
|
|
35
|
+
const caps = await systemInfo.detect();
|
|
36
|
+
console.log('RAM:', (caps.memory.total / 1024 ** 3).toFixed(1), 'GB');
|
|
37
|
+
|
|
38
|
+
// Download model (if needed)
|
|
39
|
+
await modelManager.downloadModel({
|
|
40
|
+
source: 'url',
|
|
41
|
+
url: 'https://huggingface.co/TheBloke/Llama-2-7B-GGUF/resolve/main/llama-2-7b.Q4_K_M.gguf',
|
|
42
|
+
name: 'Llama 2 7B',
|
|
43
|
+
type: 'llm'
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Start server with auto-config (port is optional — defaults to 8080;
|
|
47
|
+
// pass port: 'auto' to have the OS pick a free port)
|
|
48
|
+
const info = await llamaServer.start({
|
|
49
|
+
modelId: 'llama-2-7b'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
console.log(`Server ready on port ${info.port}`);
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use with [genai-lite](https://github.com/lacerbi/genai-lite) for AI interactions (chat, image generation).
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
📚 **[Complete Documentation](genai-electron-docs/index.md)** - Full API reference, guides, and examples
|
|
61
|
+
|
|
62
|
+
**Quick Links**:
|
|
63
|
+
- [Installation & Setup](genai-electron-docs/installation-and-setup.md)
|
|
64
|
+
- [System Detection](genai-electron-docs/system-detection.md)
|
|
65
|
+
- [Model Management](genai-electron-docs/model-management.md)
|
|
66
|
+
- [LLM Server](genai-electron-docs/llm-server.md)
|
|
67
|
+
- [Image Generation](genai-electron-docs/image-generation.md)
|
|
68
|
+
- [TypeScript Reference](genai-electron-docs/typescript-reference.md)
|
|
69
|
+
- [Troubleshooting](genai-electron-docs/troubleshooting.md)
|
|
70
|
+
|
|
71
|
+
## Example App
|
|
72
|
+
|
|
73
|
+
See **[electron-control-panel](examples/electron-control-panel/)** for a full-featured reference implementation.
|
|
74
|
+
|
|
75
|
+
## Platform Support
|
|
76
|
+
|
|
77
|
+
- **macOS**: 11+ (Intel, Apple Silicon with Metal)
|
|
78
|
+
- **Windows**: 10+ (64-bit; CUDA, Vulkan, CPU)
|
|
79
|
+
- **Linux**: Ubuntu 20.04+, Debian 11+, Fedora 35+ (Vulkan, CPU — no CUDA prebuilt upstream; build from source for CUDA)
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
84
|
+
|
|
85
|
+
## Related Projects
|
|
86
|
+
|
|
87
|
+
- **[genai-lite](https://github.com/lacerbi/genai-lite)** - Lightweight API abstraction for AI providers (cloud and local)
|
|
@@ -5,10 +5,22 @@ export declare const DEFAULT_PORTS: {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const DEFAULT_TIMEOUTS: {
|
|
7
7
|
readonly download: 300000;
|
|
8
|
-
readonly serverStart:
|
|
8
|
+
readonly serverStart: 120000;
|
|
9
9
|
readonly serverStop: 10000;
|
|
10
10
|
readonly healthCheck: 5000;
|
|
11
11
|
};
|
|
12
|
+
export declare const DEFAULT_LOG_ROTATION: {
|
|
13
|
+
readonly maxFileSize: number;
|
|
14
|
+
readonly maxArchives: 2;
|
|
15
|
+
};
|
|
16
|
+
export declare const KV_SIZING: {
|
|
17
|
+
readonly floorContextTokens: 4096;
|
|
18
|
+
readonly computeBufferBytes: number;
|
|
19
|
+
readonly gpuWeightsOverhead: 1.1;
|
|
20
|
+
readonly cpuWeightsOverhead: 1.2;
|
|
21
|
+
readonly osRamMarginBytes: number;
|
|
22
|
+
readonly minPartialReserveBytes: number;
|
|
23
|
+
};
|
|
12
24
|
export type BinaryVariant = 'cuda' | 'vulkan' | 'metal' | 'cpu';
|
|
13
25
|
export interface BinaryDependency {
|
|
14
26
|
url: string;
|
|
@@ -23,44 +35,44 @@ export interface BinaryVariantConfig {
|
|
|
23
35
|
}
|
|
24
36
|
export declare const BINARY_VERSIONS: {
|
|
25
37
|
readonly llamaServer: {
|
|
26
|
-
readonly version: "
|
|
38
|
+
readonly version: "b9860";
|
|
27
39
|
readonly variants: {
|
|
28
40
|
readonly 'darwin-arm64': readonly [{
|
|
29
41
|
readonly type: BinaryVariant;
|
|
30
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
31
|
-
readonly checksum: "
|
|
42
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-macos-arm64.tar.gz";
|
|
43
|
+
readonly checksum: "35a2e8c3528adc71db5044e7ad7de8d8b96a4221e737958915e31538a005f1d9";
|
|
32
44
|
}];
|
|
33
45
|
readonly 'darwin-x64': readonly [{
|
|
34
46
|
readonly type: BinaryVariant;
|
|
35
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
36
|
-
readonly checksum: "
|
|
47
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-macos-x64.tar.gz";
|
|
48
|
+
readonly checksum: "d442123d5441c82b23b412a58d91e149f60723adfc20a7cc9df04a3908cb5113";
|
|
37
49
|
}];
|
|
38
50
|
readonly 'win32-x64': readonly [{
|
|
39
51
|
readonly type: BinaryVariant;
|
|
40
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
41
|
-
readonly checksum: "
|
|
52
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-cuda-12.4-x64.zip";
|
|
53
|
+
readonly checksum: "70c433fcb55bcb0e0ff0d4a4fc5f02c11a14303445e0525b526071bccdc6c848";
|
|
42
54
|
readonly dependencies: readonly [{
|
|
43
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
55
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/cudart-llama-bin-win-cuda-12.4-x64.zip";
|
|
44
56
|
readonly checksum: "8c79a9b226de4b3cacfd1f83d24f962d0773be79f1e7b75c6af4ded7e32ae1d6";
|
|
45
57
|
readonly description: "CUDA 12.4 runtime libraries required for NVIDIA GPU acceleration";
|
|
46
58
|
}];
|
|
47
59
|
}, {
|
|
48
60
|
readonly type: BinaryVariant;
|
|
49
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
50
|
-
readonly checksum: "
|
|
61
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-vulkan-x64.zip";
|
|
62
|
+
readonly checksum: "c3f0703c8fca8fa4cbc01a347d7180fca092e889fe693268bf1192fd07350c13";
|
|
51
63
|
}, {
|
|
52
64
|
readonly type: BinaryVariant;
|
|
53
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
54
|
-
readonly checksum: "
|
|
65
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-cpu-x64.zip";
|
|
66
|
+
readonly checksum: "d33871623713345cd90b54e516ebada79039cab636e51b22c8c9feae72567837";
|
|
55
67
|
}];
|
|
56
68
|
readonly 'linux-x64': readonly [{
|
|
57
69
|
readonly type: BinaryVariant;
|
|
58
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
59
|
-
readonly checksum: "
|
|
70
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-ubuntu-vulkan-x64.tar.gz";
|
|
71
|
+
readonly checksum: "4aaa4ca2ed9f608cf26cb6ba0cdad9c5b8e8f2d1e95c4f04bb3fa9a1a8c86806";
|
|
60
72
|
}, {
|
|
61
73
|
readonly type: BinaryVariant;
|
|
62
|
-
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/
|
|
63
|
-
readonly checksum: "
|
|
74
|
+
readonly url: "https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-ubuntu-x64.tar.gz";
|
|
75
|
+
readonly checksum: "b68e8072eb88d1cc8b8e9d6ea8237aae87b34c6d8bbffda958c870e4dc949714";
|
|
64
76
|
}];
|
|
65
77
|
};
|
|
66
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAKhE,eAAO,MAAM,aAAa;;;CAKhB,CAAC;AAKX,eAAO,MAAM,gBAAgB;;;;;CASnB,CAAC;AAKX,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAMhE,MAAM,WAAW,gBAAgB;IAE/B,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,MAAM,WAAW,mBAAmB;IAElC,IAAI,EAAE,aAAa,CAAC;IAEpB,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,CAAC,EAAE,SAAS,gBAAgB,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M,yBAAyB;;;;CAO5B,CAAC"}
|
package/dist/config/defaults.js
CHANGED
|
@@ -4,36 +4,48 @@ export const DEFAULT_PORTS = {
|
|
|
4
4
|
};
|
|
5
5
|
export const DEFAULT_TIMEOUTS = {
|
|
6
6
|
download: 300000,
|
|
7
|
-
serverStart:
|
|
7
|
+
serverStart: 120000,
|
|
8
8
|
serverStop: 10000,
|
|
9
9
|
healthCheck: 5000,
|
|
10
10
|
};
|
|
11
|
+
export const DEFAULT_LOG_ROTATION = {
|
|
12
|
+
maxFileSize: 5 * 1024 * 1024,
|
|
13
|
+
maxArchives: 2,
|
|
14
|
+
};
|
|
15
|
+
export const KV_SIZING = {
|
|
16
|
+
floorContextTokens: 4096,
|
|
17
|
+
computeBufferBytes: 1 * 1024 ** 3,
|
|
18
|
+
gpuWeightsOverhead: 1.1,
|
|
19
|
+
cpuWeightsOverhead: 1.2,
|
|
20
|
+
osRamMarginBytes: 2 * 1024 ** 3,
|
|
21
|
+
minPartialReserveBytes: 1.5 * 1024 ** 3,
|
|
22
|
+
};
|
|
11
23
|
export const BINARY_VERSIONS = {
|
|
12
24
|
llamaServer: {
|
|
13
|
-
version: '
|
|
25
|
+
version: 'b9860',
|
|
14
26
|
variants: {
|
|
15
27
|
'darwin-arm64': [
|
|
16
28
|
{
|
|
17
29
|
type: 'metal',
|
|
18
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
19
|
-
checksum: '
|
|
30
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-macos-arm64.tar.gz',
|
|
31
|
+
checksum: '35a2e8c3528adc71db5044e7ad7de8d8b96a4221e737958915e31538a005f1d9',
|
|
20
32
|
},
|
|
21
33
|
],
|
|
22
34
|
'darwin-x64': [
|
|
23
35
|
{
|
|
24
36
|
type: 'cpu',
|
|
25
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
26
|
-
checksum: '
|
|
37
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-macos-x64.tar.gz',
|
|
38
|
+
checksum: 'd442123d5441c82b23b412a58d91e149f60723adfc20a7cc9df04a3908cb5113',
|
|
27
39
|
},
|
|
28
40
|
],
|
|
29
41
|
'win32-x64': [
|
|
30
42
|
{
|
|
31
43
|
type: 'cuda',
|
|
32
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
33
|
-
checksum: '
|
|
44
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-cuda-12.4-x64.zip',
|
|
45
|
+
checksum: '70c433fcb55bcb0e0ff0d4a4fc5f02c11a14303445e0525b526071bccdc6c848',
|
|
34
46
|
dependencies: [
|
|
35
47
|
{
|
|
36
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
48
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/cudart-llama-bin-win-cuda-12.4-x64.zip',
|
|
37
49
|
checksum: '8c79a9b226de4b3cacfd1f83d24f962d0773be79f1e7b75c6af4ded7e32ae1d6',
|
|
38
50
|
description: 'CUDA 12.4 runtime libraries required for NVIDIA GPU acceleration',
|
|
39
51
|
},
|
|
@@ -41,25 +53,25 @@ export const BINARY_VERSIONS = {
|
|
|
41
53
|
},
|
|
42
54
|
{
|
|
43
55
|
type: 'vulkan',
|
|
44
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
45
|
-
checksum: '
|
|
56
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-vulkan-x64.zip',
|
|
57
|
+
checksum: 'c3f0703c8fca8fa4cbc01a347d7180fca092e889fe693268bf1192fd07350c13',
|
|
46
58
|
},
|
|
47
59
|
{
|
|
48
60
|
type: 'cpu',
|
|
49
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
50
|
-
checksum: '
|
|
61
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-win-cpu-x64.zip',
|
|
62
|
+
checksum: 'd33871623713345cd90b54e516ebada79039cab636e51b22c8c9feae72567837',
|
|
51
63
|
},
|
|
52
64
|
],
|
|
53
65
|
'linux-x64': [
|
|
54
66
|
{
|
|
55
|
-
type: '
|
|
56
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
57
|
-
checksum: '
|
|
67
|
+
type: 'vulkan',
|
|
68
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-ubuntu-vulkan-x64.tar.gz',
|
|
69
|
+
checksum: '4aaa4ca2ed9f608cf26cb6ba0cdad9c5b8e8f2d1e95c4f04bb3fa9a1a8c86806',
|
|
58
70
|
},
|
|
59
71
|
{
|
|
60
|
-
type: '
|
|
61
|
-
url: 'https://github.com/ggml-org/llama.cpp/releases/download/
|
|
62
|
-
checksum: '
|
|
72
|
+
type: 'cpu',
|
|
73
|
+
url: 'https://github.com/ggml-org/llama.cpp/releases/download/b9860/llama-b9860-bin-ubuntu-x64.tar.gz',
|
|
74
|
+
checksum: 'b68e8072eb88d1cc8b8e9d6ea8237aae87b34c6d8bbffda958c870e4dc949714',
|
|
63
75
|
},
|
|
64
76
|
],
|
|
65
77
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,aAAa,GAAG;IAE3B,KAAK,EAAE,IAAI;IAEX,SAAS,EAAE,IAAI;CACP,CAAC;AAKX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAE9B,QAAQ,EAAE,MAAM;IAEhB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,aAAa,GAAG;IAE3B,KAAK,EAAE,IAAI;IAEX,SAAS,EAAE,IAAI;CACP,CAAC;AAKX,MAAM,CAAC,MA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EAAE,SAAS;IAChB,GAAG,EAAE,OAAO;IACZ,UAAU,EAAE,cAAc;IAC1B,GAAG,EAAE,OAAO;CACb,CAAC;AAMF,MAAM,CAAC,MAAM,yBAAyB,GAAsC;IAC1E,iBAAiB;IACjB,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,YAAY;IACZ,KAAK;CACG,CAAC;AAUX,MAAM,CAAC,MAAM,yBAAyB,GAAG;IAEvC,sBAAsB,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC;IAErC,qBAAqB,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC;IAEpC,uBAAuB,EAAE,GAAG;CACpB,CAAC;AAKX,MAAM,CAAC,MAAM,yBAAyB,GAAG;IAEvC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;IAEnC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE9B,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning-models.d.ts","sourceRoot":"","sources":["../../src/config/reasoning-models.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reasoning-models.d.ts","sourceRoot":"","sources":["../../src/config/reasoning-models.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAIrD,CAAC;AAmBF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning-models.js","sourceRoot":"","sources":["../../src/config/reasoning-models.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reasoning-models.js","sourceRoot":"","sources":["../../src/config/reasoning-models.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,OAAO;IACP,aAAa;IACb,SAAS;CACV,CAAC;AAmBF,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC7C,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export { StorageManager } from './managers/StorageManager.js';
|
|
|
18
18
|
export { ProcessManager } from './process/ProcessManager.js';
|
|
19
19
|
export { LogManager } from './process/log-manager.js';
|
|
20
20
|
export { Downloader } from './download/Downloader.js';
|
|
21
|
-
export { checkHealth, waitForHealthy, isServerResponding } from './process/health-check.js';
|
|
21
|
+
export { checkHealth, waitForHealthy, isServerResponding, normalizeHealthHost, } from './process/health-check.js';
|
|
22
|
+
export { findFreePort, isPortBindable } from './process/port-utils.js';
|
|
23
|
+
export { estimateKVBytesPerToken, floorContextToGranularity, KV_CACHE_BYTES_PER_ELEMENT, CONTEXT_GRANULARITY_LADDER, } from './utils/kv-cache-math.js';
|
|
22
24
|
export { getCPUInfo, getRecommendedThreads } from './system/cpu-detect.js';
|
|
23
25
|
export { getMemoryInfo, estimateVRAM } from './system/memory-detect.js';
|
|
24
26
|
export { detectGPU } from './system/gpu-detect.js';
|
|
@@ -34,9 +36,9 @@ export { formatErrorForUI } from './utils/error-helpers.js';
|
|
|
34
36
|
export type { UIErrorFormat } from './utils/error-helpers.js';
|
|
35
37
|
export { PATHS, getBinaryPath, getModelFilePath, getModelDirectory } from './config/paths.js';
|
|
36
38
|
export { BINARY_VERSIONS, DEFAULT_PORTS, DEFAULT_TIMEOUTS, DIFFUSION_VRAM_THRESHOLDS, DIFFUSION_COMPONENT_FLAGS, DIFFUSION_COMPONENT_ORDER, } from './config/defaults.js';
|
|
37
|
-
export type { GPUInfo, CPUInfo, MemoryInfo, SystemCapabilities, SystemRecommendations, ModelType, ModelInfo, ModelSource, DownloadConfig, DownloadProgress, DownloadProgressCallback, GGUFMetadata, MetadataFetchStrategy, DiffusionComponentRole, DiffusionComponentInfo, DiffusionModelComponents, DiffusionComponentDownload, ServerStatus, HealthStatus, ServerConfig, ServerInfo, LlamaServerConfig, ServerEvent, ServerEventData, BinaryLogEvent, ImageSampler, ImageGenerationStage, ImageGenerationProgress, ImageGenerationConfig, ImageGenerationResult, DiffusionServerConfig, DiffusionServerInfo, GenerationStatus, GenerationState, Optional, RequiredKeys, OptionalKeys, JSONValue, } from './types/index.js';
|
|
39
|
+
export type { GPUInfo, CPUInfo, MemoryInfo, SystemCapabilities, SystemRecommendations, ModelType, ModelInfo, ModelSource, DownloadConfig, DownloadProgress, DownloadProgressCallback, GGUFMetadata, MetadataFetchStrategy, DiffusionComponentRole, DiffusionComponentInfo, DiffusionModelComponents, DiffusionComponentDownload, ShardInfo, ServerStatus, HealthStatus, KVCacheType, FlashAttentionSetting, ServerConfig, ServerInfo, LlamaServerConfig, ServerEvent, ServerEventData, BinaryLogEvent, OptimalConfigHints, ImageSampler, ImageGenerationStage, ImageGenerationProgress, ImageGenerationConfig, ImageGenerationResult, DiffusionServerConfig, DiffusionServerInfo, GenerationStatus, GenerationState, Optional, RequiredKeys, OptionalKeys, JSONValue, } from './types/index.js';
|
|
38
40
|
export type { SpawnOptions, SpawnResult } from './process/ProcessManager.js';
|
|
39
41
|
export type { HealthCheckResponse } from './process/health-check.js';
|
|
40
|
-
export type { LogLevel, LogEntry } from './process/log-manager.js';
|
|
42
|
+
export type { LogLevel, LogEntry, LogRotationOptions } from './process/log-manager.js';
|
|
41
43
|
export { GenaiElectronError, ModelNotFoundError, DownloadError, InsufficientResourcesError, ServerError, PortInUseError, FileSystemError, ChecksumError, BinaryError, } from './errors/index.js';
|
|
42
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","s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AwB,EACxB,0BAA0B,EAC1B,SAAS,EAET,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAElB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EAEf,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE7E,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAMvF,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,9 @@ export { StorageManager } from './managers/StorageManager.js';
|
|
|
17
17
|
export { ProcessManager } from './process/ProcessManager.js';
|
|
18
18
|
export { LogManager } from './process/log-manager.js';
|
|
19
19
|
export { Downloader } from './download/Downloader.js';
|
|
20
|
-
export { checkHealth, waitForHealthy, isServerResponding } from './process/health-check.js';
|
|
20
|
+
export { checkHealth, waitForHealthy, isServerResponding, normalizeHealthHost, } from './process/health-check.js';
|
|
21
|
+
export { findFreePort, isPortBindable } from './process/port-utils.js';
|
|
22
|
+
export { estimateKVBytesPerToken, floorContextToGranularity, KV_CACHE_BYTES_PER_ELEMENT, CONTEXT_GRANULARITY_LADDER, } from './utils/kv-cache-math.js';
|
|
21
23
|
export { getCPUInfo, getRecommendedThreads } from './system/cpu-detect.js';
|
|
22
24
|
export { getMemoryInfo, estimateVRAM } from './system/memory-detect.js';
|
|
23
25
|
export { detectGPU } from './system/gpu-detect.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmDA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAkB9E,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;AA0BnD,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;AAmCvD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAuCpD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,sBAAsB,CACvD,SAAS,EACT,SAAS,EACT,WAAW,CACZ,CAAC;AAMF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OA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BAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAkE9B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryManager.d.ts","sourceRoot":"","sources":["../../src/managers/BinaryManager.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,mBAAmB,EAAyB,MAAM,uBAAuB,CAAC;AA0CxF,MAAM,WAAW,mBAAmB;IAElC,IAAI,EAAE,OAAO,GAAG,WAAW,CAAC;IAE5B,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAEzC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;IAMnE,aAAa,CAAC,EAAE,MAAM,CAAC;IAMvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;YASzB,mBAAmB;YA8BnB,mBAAmB;YAuBnB,gCAAgC;IAyCxC,YAAY,CAAC,eAAe,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;YAwJ9C,oBAAoB;YA+DpB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"BinaryManager.d.ts","sourceRoot":"","sources":["../../src/managers/BinaryManager.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,mBAAmB,EAAyB,MAAM,uBAAuB,CAAC;AA0CxF,MAAM,WAAW,mBAAmB;IAElC,IAAI,EAAE,OAAO,GAAG,WAAW,CAAC;IAE5B,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAEzC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;IAMnE,aAAa,CAAC,EAAE,MAAM,CAAC;IAMvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;YASzB,mBAAmB;YA8BnB,mBAAmB;YAuBnB,gCAAgC;IAyCxC,YAAY,CAAC,eAAe,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;YAwJ9C,oBAAoB;YA+DpB,sBAAsB;IA8GpC,OAAO,CAAC,gBAAgB;YAoEV,sBAAsB;IAqBpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAWxC;IASF,OAAO,CAAC,iBAAiB;YAsBX,wBAAwB;YAqBxB,kBAAkB;YAmIlB,gBAAgB;YAuEhB,UAAU;IA4BxB,OAAO,CAAC,GAAG;CAKZ"}
|
|
@@ -228,7 +228,16 @@ export class BinaryManager {
|
|
|
228
228
|
const extractedBinaryPath = await extractBinary(archivePath, extractDir, binaryNamesToSearch);
|
|
229
229
|
const works = await this.testBinary(extractedBinaryPath);
|
|
230
230
|
if (works) {
|
|
231
|
-
|
|
231
|
+
const extractedBinaryDir = path.dirname(extractedBinaryPath);
|
|
232
|
+
await copyDirectory(extractedBinaryDir, PATHS.binaries[type]);
|
|
233
|
+
if (path.resolve(extractedBinaryDir) !== path.resolve(extractDir)) {
|
|
234
|
+
const rootEntries = await fs.readdir(extractDir, { withFileTypes: true });
|
|
235
|
+
for (const entry of rootEntries) {
|
|
236
|
+
if (entry.isFile()) {
|
|
237
|
+
await fs.copyFile(path.join(extractDir, entry.name), path.join(PATHS.binaries[type], entry.name));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
232
241
|
if (process.platform !== 'win32') {
|
|
233
242
|
await fs.chmod(finalBinaryPath, 0o755);
|
|
234
243
|
}
|
|
@@ -364,7 +373,7 @@ export class BinaryManager {
|
|
|
364
373
|
try {
|
|
365
374
|
const controller = new AbortController();
|
|
366
375
|
const fetchTimer = setTimeout(() => controller.abort(), 2000);
|
|
367
|
-
const response = await fetch(`http://
|
|
376
|
+
const response = await fetch(`http://127.0.0.1:${testPort}/health`, {
|
|
368
377
|
signal: controller.signal,
|
|
369
378
|
});
|
|
370
379
|
clearTimeout(fetchTimer);
|
|
@@ -389,7 +398,7 @@ export class BinaryManager {
|
|
|
389
398
|
}
|
|
390
399
|
const controller = new AbortController();
|
|
391
400
|
const fetchTimer = setTimeout(() => controller.abort(), 5000);
|
|
392
|
-
const completionResponse = await fetch(`http://
|
|
401
|
+
const completionResponse = await fetch(`http://127.0.0.1:${testPort}/completion`, {
|
|
393
402
|
method: 'POST',
|
|
394
403
|
headers: { 'Content-Type': 'application/json' },
|
|
395
404
|
body: JSON.stringify({ prompt: '2+2=', n_predict: 4 }),
|