forbocai 0.0.8 → 0.0.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 +30 -2
- package/dist/cli.d.mts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +9 -24
- package/dist/cli.mjs +9 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,9 +156,37 @@ In the ForbocAI ecosystem, an NFT is not just a receipt—it is an **Encapsulate
|
|
|
156
156
|
|
|
157
157
|
1. **Bump Version**: Update `version` in `package.json`.
|
|
158
158
|
2. **Build**: `npm run build` (Generates `dist/`).
|
|
159
|
-
3. **
|
|
159
|
+
3. **Auth**: Ensure `sdk/.npmrc` contains the valid token from `../api/NPM_TOKEN.md`.
|
|
160
|
+
```bash
|
|
161
|
+
# Command to configure local .npmrc
|
|
162
|
+
echo "//registry.npmjs.org/:_authToken=YOUR_TOKEN_HERE" > .npmrc
|
|
163
|
+
```
|
|
164
|
+
4. **Publish**: `npm publish --access public`.
|
|
160
165
|
|
|
161
|
-
> **Note**:
|
|
166
|
+
> **Note**: The `.npmrc` file is gitignored (`.gitignore`) to prevent leaking secrets. Always verify the token in `api/NPM_TOKEN.md` matches the active Granular Access Token.
|
|
167
|
+
|
|
168
|
+
## 🧪 Testing Flow
|
|
169
|
+
|
|
170
|
+
`Tést_Séquence // Válidátion`
|
|
171
|
+
|
|
172
|
+
To verify the full end-to-end loop (SDK <-> NPM <-> Render API):
|
|
173
|
+
|
|
174
|
+
1. **Local Updates**: Make changes to `sdk/` or `api/` code.
|
|
175
|
+
2. **Deploy**:
|
|
176
|
+
* **SDK**: Push to NPM (see [Developers](#developers) section above).
|
|
177
|
+
* **API**: Commit and push changes to GitHub (triggers Render auto-deploy).
|
|
178
|
+
3. **Consume**:
|
|
179
|
+
```bash
|
|
180
|
+
# In your client app (e.g. Forboc/client)
|
|
181
|
+
npm install forbocai@latest
|
|
182
|
+
```
|
|
183
|
+
4. **Verify**:
|
|
184
|
+
Use the CLI to check connection to the production API:
|
|
185
|
+
```bash
|
|
186
|
+
npx forbocai api status
|
|
187
|
+
# > Checking API Status (https://forbocai-api.onrender.com)...
|
|
188
|
+
# > Status: ONLINE
|
|
189
|
+
```
|
|
162
190
|
|
|
163
191
|
|
|
164
192
|
## License
|
package/dist/cli.d.mts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -24,40 +23,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
23
|
));
|
|
25
24
|
|
|
26
25
|
// src/cli.ts
|
|
26
|
+
var import_http = __toESM(require("http"));
|
|
27
27
|
var import_https = __toESM(require("https"));
|
|
28
|
-
var
|
|
28
|
+
var DEFAULT_API_URL = "https://forbocai-api.onrender.com";
|
|
29
|
+
var API_URL = process.env.FORBOC_API_URL || DEFAULT_API_URL;
|
|
29
30
|
var args = process.argv.slice(2);
|
|
30
31
|
var command = args[0];
|
|
31
32
|
var subcommand = args[1];
|
|
32
|
-
var subcommand2 = args[2];
|
|
33
33
|
if (command === "api" && subcommand === "status") {
|
|
34
34
|
checkApiStatus();
|
|
35
|
-
} else if (command === "agent" && subcommand === "create") {
|
|
36
|
-
const persona = subcommand2 || "Default Persona";
|
|
37
|
-
console.log(`> Creating Agent with persona: "${persona}"...`);
|
|
38
|
-
console.log(`> [Mock] Agent created. ID: ag_${Math.floor(Math.random() * 1e3)}`);
|
|
39
|
-
} else if (command === "soul") {
|
|
40
|
-
if (subcommand === "export") {
|
|
41
|
-
const agentId = subcommand2;
|
|
42
|
-
console.log(`> Exporting Soul for Agent: ${agentId}...`);
|
|
43
|
-
console.log(`> [Mock] Soul exported to IPFS. CID: Qmhash_${Math.random().toString(36).substring(7)}`);
|
|
44
|
-
} else if (subcommand === "import") {
|
|
45
|
-
const cid = subcommand2;
|
|
46
|
-
console.log(`> Importing Soul from CID: ${cid}...`);
|
|
47
|
-
console.log(`> [Mock] Agent rehydrated from Soul.`);
|
|
48
|
-
}
|
|
49
35
|
} else {
|
|
50
36
|
printUsage();
|
|
51
37
|
}
|
|
52
38
|
function checkApiStatus() {
|
|
53
|
-
console.log(`>
|
|
54
|
-
import_https.default
|
|
39
|
+
console.log(`> Connecting to Neuro-Symbolic Grid...`);
|
|
40
|
+
const client = API_URL.startsWith("https") ? import_https.default : import_http.default;
|
|
41
|
+
client.get(`${API_URL}/status`, (res) => {
|
|
55
42
|
let data = "";
|
|
56
43
|
res.on("data", (chunk) => data += chunk);
|
|
57
44
|
res.on("end", () => {
|
|
58
45
|
try {
|
|
59
46
|
if (res.statusCode !== 200) {
|
|
60
|
-
console.error(`> Error: Server returned ${res.statusCode}
|
|
47
|
+
console.error(`> Error: Server returned ${res.statusCode}`);
|
|
61
48
|
process.exit(1);
|
|
62
49
|
}
|
|
63
50
|
const json = JSON.parse(data);
|
|
@@ -71,12 +58,10 @@ function checkApiStatus() {
|
|
|
71
58
|
});
|
|
72
59
|
}).on("error", (e) => {
|
|
73
60
|
console.error(`> Error: ${e.message}`);
|
|
61
|
+
console.log(`> Hint: Is the local Haskell API running? (cd api/hs && cabal run)`);
|
|
74
62
|
});
|
|
75
63
|
}
|
|
76
64
|
function printUsage() {
|
|
77
65
|
console.log("Usage:");
|
|
78
|
-
console.log(" forbocai api status");
|
|
79
|
-
console.log(" forbocai agent create <persona>");
|
|
80
|
-
console.log(" forbocai soul export <agentId>");
|
|
81
|
-
console.log(" forbocai soul import <cid>");
|
|
66
|
+
console.log(" forbocai api status (Env: FORBOC_API_URL=http://localhost:8080)");
|
|
82
67
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
1
|
// src/cli.ts
|
|
2
|
+
import http from "http";
|
|
4
3
|
import https from "https";
|
|
5
|
-
var
|
|
4
|
+
var DEFAULT_API_URL = "https://forbocai-api.onrender.com";
|
|
5
|
+
var API_URL = process.env.FORBOC_API_URL || DEFAULT_API_URL;
|
|
6
6
|
var args = process.argv.slice(2);
|
|
7
7
|
var command = args[0];
|
|
8
8
|
var subcommand = args[1];
|
|
9
|
-
var subcommand2 = args[2];
|
|
10
9
|
if (command === "api" && subcommand === "status") {
|
|
11
10
|
checkApiStatus();
|
|
12
|
-
} else if (command === "agent" && subcommand === "create") {
|
|
13
|
-
const persona = subcommand2 || "Default Persona";
|
|
14
|
-
console.log(`> Creating Agent with persona: "${persona}"...`);
|
|
15
|
-
console.log(`> [Mock] Agent created. ID: ag_${Math.floor(Math.random() * 1e3)}`);
|
|
16
|
-
} else if (command === "soul") {
|
|
17
|
-
if (subcommand === "export") {
|
|
18
|
-
const agentId = subcommand2;
|
|
19
|
-
console.log(`> Exporting Soul for Agent: ${agentId}...`);
|
|
20
|
-
console.log(`> [Mock] Soul exported to IPFS. CID: Qmhash_${Math.random().toString(36).substring(7)}`);
|
|
21
|
-
} else if (subcommand === "import") {
|
|
22
|
-
const cid = subcommand2;
|
|
23
|
-
console.log(`> Importing Soul from CID: ${cid}...`);
|
|
24
|
-
console.log(`> [Mock] Agent rehydrated from Soul.`);
|
|
25
|
-
}
|
|
26
11
|
} else {
|
|
27
12
|
printUsage();
|
|
28
13
|
}
|
|
29
14
|
function checkApiStatus() {
|
|
30
|
-
console.log(`>
|
|
31
|
-
|
|
15
|
+
console.log(`> Connecting to Neuro-Symbolic Grid...`);
|
|
16
|
+
const client = API_URL.startsWith("https") ? https : http;
|
|
17
|
+
client.get(`${API_URL}/status`, (res) => {
|
|
32
18
|
let data = "";
|
|
33
19
|
res.on("data", (chunk) => data += chunk);
|
|
34
20
|
res.on("end", () => {
|
|
35
21
|
try {
|
|
36
22
|
if (res.statusCode !== 200) {
|
|
37
|
-
console.error(`> Error: Server returned ${res.statusCode}
|
|
23
|
+
console.error(`> Error: Server returned ${res.statusCode}`);
|
|
38
24
|
process.exit(1);
|
|
39
25
|
}
|
|
40
26
|
const json = JSON.parse(data);
|
|
@@ -48,12 +34,10 @@ function checkApiStatus() {
|
|
|
48
34
|
});
|
|
49
35
|
}).on("error", (e) => {
|
|
50
36
|
console.error(`> Error: ${e.message}`);
|
|
37
|
+
console.log(`> Hint: Is the local Haskell API running? (cd api/hs && cabal run)`);
|
|
51
38
|
});
|
|
52
39
|
}
|
|
53
40
|
function printUsage() {
|
|
54
41
|
console.log("Usage:");
|
|
55
|
-
console.log(" forbocai api status");
|
|
56
|
-
console.log(" forbocai agent create <persona>");
|
|
57
|
-
console.log(" forbocai soul export <agentId>");
|
|
58
|
-
console.log(" forbocai soul import <cid>");
|
|
42
|
+
console.log(" forbocai api status (Env: FORBOC_API_URL=http://localhost:8080)");
|
|
59
43
|
}
|