forbocai 0.3.4 → 0.3.6
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 +10 -8
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +9 -9
- package/scripts/check-cmake.js +48 -0
- package/scripts/download_slm.ts +37 -0
- package/scripts/init_infra.ts +20 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
Autonomous AI for game NPCs.
|
|
14
14
|
|
|
15
|
-
[](https://docs.forboc.ai)
|
|
16
16
|
[](https://www.npmjs.com/package/forbocai)
|
|
17
17
|
[](https://discord.gg/6hr2jHqnsG)
|
|
18
18
|
|
|
@@ -99,6 +99,8 @@ 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.
|
|
103
|
+
|
|
102
104
|
---
|
|
103
105
|
|
|
104
106
|
## CLI Reference
|
|
@@ -122,7 +124,7 @@ npx forbocai status
|
|
|
122
124
|
npx forbocai doctor
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
See [full CLI documentation](https://
|
|
127
|
+
See [full CLI documentation](https://docs.forboc.ai/docs/pages/cli).
|
|
126
128
|
|
|
127
129
|
---
|
|
128
130
|
|
|
@@ -405,10 +407,10 @@ In the ForbocAI ecosystem, an NFT is not just a receipt—it is an **Encapsulate
|
|
|
405
407
|
|
|
406
408
|
`Dócs_Máp // Référence`
|
|
407
409
|
|
|
408
|
-
- **[Introduction](https://
|
|
409
|
-
- **[User Stories](https://
|
|
410
|
-
- **[Concepts](https://
|
|
411
|
-
- **[API Reference](https://
|
|
410
|
+
- **[Introduction](https://docs.forboc.ai)** — SDK overview and quick start
|
|
411
|
+
- **[User Stories](https://docs.forboc.ai/user-stories)** — BDD specifications for all features
|
|
412
|
+
- **[Concepts](https://docs.forboc.ai/concepts)** — Architecture and core abstractions
|
|
413
|
+
- **[API Reference](https://docs.forboc.ai/api-reference)** — Complete endpoint documentation
|
|
412
414
|
|
|
413
415
|
---
|
|
414
416
|
|
|
@@ -417,7 +419,7 @@ In the ForbocAI ecosystem, an NFT is not just a receipt—it is an **Encapsulate
|
|
|
417
419
|
`Éxternal_Líns // Cónnect`
|
|
418
420
|
|
|
419
421
|
- **Website:** [forboc.ai](https://forboc.ai)
|
|
420
|
-
- **Documentation:** [
|
|
422
|
+
- **Documentation:** [docs.forboc.ai](https://docs.forboc.ai)
|
|
421
423
|
- **Discord:** [discord.gg/6hr2jHqnsG](https://discord.gg/6hr2jHqnsG)
|
|
422
424
|
- **Telegram:** [t.me/forbocai](https://t.me/forbocai)
|
|
423
425
|
|
|
@@ -461,7 +463,7 @@ To verify the full end-to-end loop (SDK <-> NPM <-> Render API):
|
|
|
461
463
|
Use the CLI to check connection to the production API:
|
|
462
464
|
```bash
|
|
463
465
|
npx forbocai api status
|
|
464
|
-
# > Checking API Status (https://
|
|
466
|
+
# > Checking API Status (https://api.forboc.ai)...
|
|
465
467
|
# > Status: ONLINE
|
|
466
468
|
```
|
|
467
469
|
|
package/dist/cli.js
CHANGED
|
@@ -29,8 +29,8 @@ var import_https = __toESM(require("https"));
|
|
|
29
29
|
var readline = __toESM(require("readline"));
|
|
30
30
|
var fs = __toESM(require("fs"));
|
|
31
31
|
var path = __toESM(require("path"));
|
|
32
|
-
var VERSION = "0.3.
|
|
33
|
-
var DEFAULT_API_URL = "https://
|
|
32
|
+
var VERSION = "0.3.5";
|
|
33
|
+
var DEFAULT_API_URL = "https://api.forboc.ai";
|
|
34
34
|
var CONFIG_PATH = path.join(process.env.HOME || ".", ".forbocai.json");
|
|
35
35
|
var config = {};
|
|
36
36
|
try {
|
package/dist/cli.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import https from "https";
|
|
|
6
6
|
import * as readline from "readline";
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import * as path from "path";
|
|
9
|
-
var VERSION = "0.3.
|
|
10
|
-
var DEFAULT_API_URL = "https://
|
|
9
|
+
var VERSION = "0.3.5";
|
|
10
|
+
var DEFAULT_API_URL = "https://api.forboc.ai";
|
|
11
11
|
var CONFIG_PATH = path.join(process.env.HOME || ".", ".forbocai.json");
|
|
12
12
|
var config = {};
|
|
13
13
|
try {
|
package/dist/index.js
CHANGED
|
@@ -436,7 +436,7 @@ var exportSoulToIPFS = async (agentId, soul, config = {}) => {
|
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
const apiUrl = config.apiUrl || "https://
|
|
439
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
440
440
|
try {
|
|
441
441
|
const response = await fetch(`${apiUrl}/agents/${agentId}/soul/export`, {
|
|
442
442
|
method: "POST",
|
|
@@ -471,7 +471,7 @@ var importSoulFromIPFS = async (cid, config = {}) => {
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
const apiUrl = config.apiUrl || "https://
|
|
474
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
475
475
|
try {
|
|
476
476
|
const response = await fetch(`${apiUrl}/souls/${cid}`, {
|
|
477
477
|
method: "GET",
|
|
@@ -494,7 +494,7 @@ var importSoulFromIPFS = async (cid, config = {}) => {
|
|
|
494
494
|
}
|
|
495
495
|
};
|
|
496
496
|
var getSoulList = async (limit = 50, apiUrl) => {
|
|
497
|
-
const url = apiUrl || "https://
|
|
497
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
498
498
|
try {
|
|
499
499
|
const response = await fetch(`${url}/souls?limit=${limit}`, {
|
|
500
500
|
method: "GET",
|
|
@@ -516,7 +516,7 @@ var getSoulList = async (limit = 50, apiUrl) => {
|
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
518
|
var createAgentFromSoul = async (cid, cortexId, config = {}) => {
|
|
519
|
-
const apiUrl = config.apiUrl || "https://
|
|
519
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
520
520
|
const response = await fetch(`${apiUrl}/agents/import`, {
|
|
521
521
|
method: "POST",
|
|
522
522
|
headers: { "Content-Type": "application/json" },
|
|
@@ -533,7 +533,7 @@ var createAgentFromSoul = async (cid, cortexId, config = {}) => {
|
|
|
533
533
|
};
|
|
534
534
|
var createSoulInstance = (id, name, persona, state, memories = [], initialApiUrl) => {
|
|
535
535
|
const soulData = createSoul(id, name, persona, state, memories);
|
|
536
|
-
const defaultApiUrl = initialApiUrl || "https://
|
|
536
|
+
const defaultApiUrl = initialApiUrl || "https://api.forboc.ai";
|
|
537
537
|
const exportSoul = async (config) => {
|
|
538
538
|
return exportSoulToIPFS(soulData.id, soulData, {
|
|
539
539
|
...config,
|
|
@@ -936,7 +936,7 @@ var validateAction = (action, rules, context = {}) => {
|
|
|
936
936
|
|
|
937
937
|
// src/ghost.ts
|
|
938
938
|
var startGhostSession = async (config) => {
|
|
939
|
-
const apiUrl = config.apiUrl || "https://
|
|
939
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
940
940
|
try {
|
|
941
941
|
const response = await fetch(`${apiUrl}/ghost/run`, {
|
|
942
942
|
method: "POST",
|
|
@@ -963,7 +963,7 @@ var startGhostSession = async (config) => {
|
|
|
963
963
|
}
|
|
964
964
|
};
|
|
965
965
|
var getGhostStatus = async (sessionId, apiUrl) => {
|
|
966
|
-
const url = apiUrl || "https://
|
|
966
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
967
967
|
try {
|
|
968
968
|
const response = await fetch(`${url}/ghost/${sessionId}/status`, {
|
|
969
969
|
method: "GET",
|
|
@@ -993,7 +993,7 @@ var getGhostStatus = async (sessionId, apiUrl) => {
|
|
|
993
993
|
}
|
|
994
994
|
};
|
|
995
995
|
var getGhostResults = async (sessionId, apiUrl) => {
|
|
996
|
-
const url = apiUrl || "https://
|
|
996
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
997
997
|
try {
|
|
998
998
|
const response = await fetch(`${url}/ghost/${sessionId}/results`, {
|
|
999
999
|
method: "GET",
|
|
@@ -1060,7 +1060,7 @@ var waitForGhostCompletion = async (sessionId, pollIntervalMs = 5e3, timeoutMs =
|
|
|
1060
1060
|
throw new Error(`Ghost session timed out after ${timeoutMs}ms`);
|
|
1061
1061
|
};
|
|
1062
1062
|
var stopGhostSession = async (sessionId, apiUrl) => {
|
|
1063
|
-
const url = apiUrl || "https://
|
|
1063
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
1064
1064
|
try {
|
|
1065
1065
|
const response = await fetch(`${url}/ghost/${sessionId}/stop`, {
|
|
1066
1066
|
method: "POST",
|
|
@@ -1082,7 +1082,7 @@ var stopGhostSession = async (sessionId, apiUrl) => {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
};
|
|
1084
1084
|
var getGhostHistory = async (limit = 10, apiUrl) => {
|
|
1085
|
-
const url = apiUrl || "https://
|
|
1085
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
1086
1086
|
try {
|
|
1087
1087
|
const response = await fetch(`${url}/ghost/history?limit=${limit}`, {
|
|
1088
1088
|
method: "GET",
|
|
@@ -1106,7 +1106,7 @@ var getGhostHistory = async (limit = 10, apiUrl) => {
|
|
|
1106
1106
|
};
|
|
1107
1107
|
var createGhost = (config) => {
|
|
1108
1108
|
let sessionId = null;
|
|
1109
|
-
const apiUrl = config.apiUrl || "https://
|
|
1109
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
1110
1110
|
const run = async () => {
|
|
1111
1111
|
const result = await startGhostSession(config);
|
|
1112
1112
|
sessionId = result.sessionId;
|
|
@@ -1161,7 +1161,7 @@ var init = () => {
|
|
|
1161
1161
|
| . / -_) || | '_ / _ \\/ _ \\ | || ' \\| _| | |
|
|
1162
1162
|
|_|\\_\\___|\\_,_| ._\\___/_/ \\_\\ |___|_||_|\\__|_|_|
|
|
1163
1163
|
|_| \x1B[0m
|
|
1164
|
-
Neuro-Symbolic Grid SDK v0.3.
|
|
1164
|
+
Neuro-Symbolic Grid SDK v0.3.5
|
|
1165
1165
|
---------------------------------
|
|
1166
1166
|
Vessel: ACTIVE
|
|
1167
1167
|
Memory: LOCAL (LanceDB)
|
package/dist/index.mjs
CHANGED
|
@@ -364,7 +364,7 @@ var exportSoulToIPFS = async (agentId, soul, config = {}) => {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
const apiUrl = config.apiUrl || "https://
|
|
367
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
368
368
|
try {
|
|
369
369
|
const response = await fetch(`${apiUrl}/agents/${agentId}/soul/export`, {
|
|
370
370
|
method: "POST",
|
|
@@ -399,7 +399,7 @@ var importSoulFromIPFS = async (cid, config = {}) => {
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
const apiUrl = config.apiUrl || "https://
|
|
402
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
403
403
|
try {
|
|
404
404
|
const response = await fetch(`${apiUrl}/souls/${cid}`, {
|
|
405
405
|
method: "GET",
|
|
@@ -422,7 +422,7 @@ var importSoulFromIPFS = async (cid, config = {}) => {
|
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
424
|
var getSoulList = async (limit = 50, apiUrl) => {
|
|
425
|
-
const url = apiUrl || "https://
|
|
425
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
426
426
|
try {
|
|
427
427
|
const response = await fetch(`${url}/souls?limit=${limit}`, {
|
|
428
428
|
method: "GET",
|
|
@@ -444,7 +444,7 @@ var getSoulList = async (limit = 50, apiUrl) => {
|
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
446
|
var createAgentFromSoul = async (cid, cortexId, config = {}) => {
|
|
447
|
-
const apiUrl = config.apiUrl || "https://
|
|
447
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
448
448
|
const response = await fetch(`${apiUrl}/agents/import`, {
|
|
449
449
|
method: "POST",
|
|
450
450
|
headers: { "Content-Type": "application/json" },
|
|
@@ -461,7 +461,7 @@ var createAgentFromSoul = async (cid, cortexId, config = {}) => {
|
|
|
461
461
|
};
|
|
462
462
|
var createSoulInstance = (id, name, persona, state, memories = [], initialApiUrl) => {
|
|
463
463
|
const soulData = createSoul(id, name, persona, state, memories);
|
|
464
|
-
const defaultApiUrl = initialApiUrl || "https://
|
|
464
|
+
const defaultApiUrl = initialApiUrl || "https://api.forboc.ai";
|
|
465
465
|
const exportSoul = async (config) => {
|
|
466
466
|
return exportSoulToIPFS(soulData.id, soulData, {
|
|
467
467
|
...config,
|
|
@@ -864,7 +864,7 @@ var validateAction = (action, rules, context = {}) => {
|
|
|
864
864
|
|
|
865
865
|
// src/ghost.ts
|
|
866
866
|
var startGhostSession = async (config) => {
|
|
867
|
-
const apiUrl = config.apiUrl || "https://
|
|
867
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
868
868
|
try {
|
|
869
869
|
const response = await fetch(`${apiUrl}/ghost/run`, {
|
|
870
870
|
method: "POST",
|
|
@@ -891,7 +891,7 @@ var startGhostSession = async (config) => {
|
|
|
891
891
|
}
|
|
892
892
|
};
|
|
893
893
|
var getGhostStatus = async (sessionId, apiUrl) => {
|
|
894
|
-
const url = apiUrl || "https://
|
|
894
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
895
895
|
try {
|
|
896
896
|
const response = await fetch(`${url}/ghost/${sessionId}/status`, {
|
|
897
897
|
method: "GET",
|
|
@@ -921,7 +921,7 @@ var getGhostStatus = async (sessionId, apiUrl) => {
|
|
|
921
921
|
}
|
|
922
922
|
};
|
|
923
923
|
var getGhostResults = async (sessionId, apiUrl) => {
|
|
924
|
-
const url = apiUrl || "https://
|
|
924
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
925
925
|
try {
|
|
926
926
|
const response = await fetch(`${url}/ghost/${sessionId}/results`, {
|
|
927
927
|
method: "GET",
|
|
@@ -988,7 +988,7 @@ var waitForGhostCompletion = async (sessionId, pollIntervalMs = 5e3, timeoutMs =
|
|
|
988
988
|
throw new Error(`Ghost session timed out after ${timeoutMs}ms`);
|
|
989
989
|
};
|
|
990
990
|
var stopGhostSession = async (sessionId, apiUrl) => {
|
|
991
|
-
const url = apiUrl || "https://
|
|
991
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
992
992
|
try {
|
|
993
993
|
const response = await fetch(`${url}/ghost/${sessionId}/stop`, {
|
|
994
994
|
method: "POST",
|
|
@@ -1010,7 +1010,7 @@ var stopGhostSession = async (sessionId, apiUrl) => {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
};
|
|
1012
1012
|
var getGhostHistory = async (limit = 10, apiUrl) => {
|
|
1013
|
-
const url = apiUrl || "https://
|
|
1013
|
+
const url = apiUrl || "https://api.forboc.ai";
|
|
1014
1014
|
try {
|
|
1015
1015
|
const response = await fetch(`${url}/ghost/history?limit=${limit}`, {
|
|
1016
1016
|
method: "GET",
|
|
@@ -1034,7 +1034,7 @@ var getGhostHistory = async (limit = 10, apiUrl) => {
|
|
|
1034
1034
|
};
|
|
1035
1035
|
var createGhost = (config) => {
|
|
1036
1036
|
let sessionId = null;
|
|
1037
|
-
const apiUrl = config.apiUrl || "https://
|
|
1037
|
+
const apiUrl = config.apiUrl || "https://api.forboc.ai";
|
|
1038
1038
|
const run = async () => {
|
|
1039
1039
|
const result = await startGhostSession(config);
|
|
1040
1040
|
sessionId = result.sessionId;
|
|
@@ -1089,7 +1089,7 @@ var init = () => {
|
|
|
1089
1089
|
| . / -_) || | '_ / _ \\/ _ \\ | || ' \\| _| | |
|
|
1090
1090
|
|_|\\_\\___|\\_,_| ._\\___/_/ \\_\\ |___|_||_|\\__|_|_|
|
|
1091
1091
|
|_| \x1B[0m
|
|
1092
|
-
Neuro-Symbolic Grid SDK v0.3.
|
|
1092
|
+
Neuro-Symbolic Grid SDK v0.3.5
|
|
1093
1093
|
---------------------------------
|
|
1094
1094
|
Vessel: ACTIVE
|
|
1095
1095
|
Memory: LOCAL (LanceDB)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forbocai",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "The Infrastructure Layer for Autonomous AI Characters",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
"dev": "tsup src/index.ts --watch",
|
|
14
14
|
"test": "vitest",
|
|
15
15
|
"test:watch": "vitest --watch",
|
|
16
|
+
"preinstall": "node scripts/check-cmake.js",
|
|
16
17
|
"postinstall": "node postinstall.js"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@helia/json": "^5.0.6",
|
|
21
|
+
"@lancedb/lancedb": "^0.23.0",
|
|
22
|
+
"@mlc-ai/web-llm": "^0.2.80",
|
|
20
23
|
"@xenova/transformers": "^2.17.2",
|
|
21
24
|
"apache-arrow": "^18.1.0",
|
|
22
25
|
"axios": "^1.6.2",
|
|
@@ -24,13 +27,9 @@
|
|
|
24
27
|
"datastore-core": "^11.0.2",
|
|
25
28
|
"helia": "^6.0.18",
|
|
26
29
|
"idb": "^8.0.3",
|
|
27
|
-
"zod": "^3.22.4"
|
|
28
|
-
},
|
|
29
|
-
"optionalDependencies": {
|
|
30
|
-
"@lancedb/lancedb": "^0.23.0",
|
|
31
|
-
"@mlc-ai/web-llm": "^0.2.80",
|
|
32
30
|
"node-llama-cpp": "^3.15.1",
|
|
33
|
-
"onnxruntime-node": "^1.23.2"
|
|
31
|
+
"onnxruntime-node": "^1.23.2",
|
|
32
|
+
"zod": "^3.22.4"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"@types/node": "^20.0.0",
|
|
@@ -42,6 +41,7 @@
|
|
|
42
41
|
"dist",
|
|
43
42
|
"README.md",
|
|
44
43
|
"package.json",
|
|
45
|
-
"postinstall.js"
|
|
44
|
+
"postinstall.js",
|
|
45
|
+
"scripts"
|
|
46
46
|
]
|
|
47
|
-
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Preinstall check: CMake is required for node-llama-cpp (native Cortex).
|
|
3
|
+
// If missing, fail with clear instructions so the user knows what to install.
|
|
4
|
+
|
|
5
|
+
const { execSync, spawnSync } = require('child_process');
|
|
6
|
+
const isWindows = process.platform === 'win32';
|
|
7
|
+
|
|
8
|
+
function cmakeAvailable() {
|
|
9
|
+
try {
|
|
10
|
+
if (isWindows) {
|
|
11
|
+
const r = spawnSync('cmake', ['--version'], { stdio: 'pipe', shell: true });
|
|
12
|
+
return r.status === 0;
|
|
13
|
+
}
|
|
14
|
+
execSync('which cmake', { stdio: 'pipe' });
|
|
15
|
+
return true;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
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
|
+
];
|
|
46
|
+
console.error(msg.join('\n'));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as https from "https";
|
|
4
|
+
|
|
5
|
+
async function download(url: string, dest: string) {
|
|
6
|
+
console.log(`Downloading from ${url}...`);
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const file = fs.createWriteStream(dest);
|
|
9
|
+
https.get(url, (response) => {
|
|
10
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
11
|
+
console.log(`Redirecting to ${response.headers.location}...`);
|
|
12
|
+
download(response.headers.location!, dest).then(resolve).catch(reject);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (response.statusCode !== 200) {
|
|
16
|
+
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
response.pipe(file);
|
|
20
|
+
file.on('finish', () => {
|
|
21
|
+
file.close();
|
|
22
|
+
console.log("File saved.");
|
|
23
|
+
resolve(true);
|
|
24
|
+
});
|
|
25
|
+
}).on('error', (err) => {
|
|
26
|
+
fs.unlink(dest, () => { });
|
|
27
|
+
reject(err);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const url = "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf?download=true";
|
|
33
|
+
const dest = path.join(process.cwd(), "local_infrastructure", "models", "smollm2-135m.gguf");
|
|
34
|
+
|
|
35
|
+
download(url, dest)
|
|
36
|
+
.then(() => console.log("SLM Download Complete."))
|
|
37
|
+
.catch(console.error);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as lancedb from '@lancedb/lancedb';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const dbPath = path.join(process.cwd(), 'local_infrastructure', 'vectors', 'forbocai.lance');
|
|
6
|
+
console.log(`Initializing DB at ${dbPath}...`);
|
|
7
|
+
|
|
8
|
+
// Connect to LanceDB
|
|
9
|
+
const db = await lancedb.connect(dbPath);
|
|
10
|
+
|
|
11
|
+
// Create a dummy table with a vector column
|
|
12
|
+
const data = [
|
|
13
|
+
{ id: "init", text: "Database Initialized", vector: new Array(384).fill(0).map(() => Math.random()) }
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
await db.createTable("memories", data, { mode: 'overwrite' });
|
|
17
|
+
console.log("DB File Created successfully.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main().catch(console.error);
|