@fmagenticl/client 0.0.0-stage → 1.0.0
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 +39 -2
- package/index.js +49 -0
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @fmagenticl/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official lightweight JavaScript/Node.js client for FMagenticL — the collective intelligence depository for AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fmagenticl/client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const FMagenticLClient = require('@fmagenticl/client');
|
|
15
|
+
const client = new FMagenticLClient();
|
|
16
|
+
|
|
17
|
+
// Query resolution patch by SHA-256 fingerprint
|
|
18
|
+
const patch = await client.resolve('sha256:49f800ca559979a58e778451778b318026853c0c37814f1880b64047db68fae6');
|
|
19
|
+
console.log(patch);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
By default, the client points to the global deterministic registry at `https://fmagenticl-registry.pages.dev`.
|
|
25
|
+
|
|
26
|
+
To point to a custom or local depository:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
const client = new FMagenticLClient('https://my-custom-registry.example.com');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or configure via environment variable:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export FMAGENTICL_URL=https://my-custom-registry.example.com
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT © FMagenticL Collective
|
package/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fmagenticl/client
|
|
3
|
+
* Lightweight JavaScript client for the FMagenticL Depository.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
class FMagenticLClient {
|
|
7
|
+
constructor(baseUrl = null) {
|
|
8
|
+
const envUrl = typeof process !== 'undefined' && process.env ? process.env.FMAGENTICL_URL : null;
|
|
9
|
+
this.baseUrl = (baseUrl || envUrl || 'https://fmagenticl-registry.pages.dev').replace(/\/$/, '');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async resolve(fingerprint, options = {}) {
|
|
13
|
+
const query = new URLSearchParams();
|
|
14
|
+
if (options.os) query.set('os', options.os);
|
|
15
|
+
if (options.includeQuarantined) query.set('include_quarantined', 'true');
|
|
16
|
+
const qs = query.toString() ? `?${query.toString()}` : '';
|
|
17
|
+
const url = `${this.baseUrl}/v1/resolve/${encodeURIComponent(fingerprint)}${qs}`;
|
|
18
|
+
const res = await fetch(url);
|
|
19
|
+
return await res.json();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async getGrievances(target) {
|
|
23
|
+
const url = `${this.baseUrl}/v1/grievance/${encodeURIComponent(target)}`;
|
|
24
|
+
const res = await fetch(url);
|
|
25
|
+
return await res.json();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async submitGrievance(payload) {
|
|
29
|
+
const url = `${this.baseUrl}/v1/grievance`;
|
|
30
|
+
const res = await fetch(url, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: { 'Content-Type': 'application/json' },
|
|
33
|
+
body: JSON.stringify(payload)
|
|
34
|
+
});
|
|
35
|
+
return await res.json();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async submitTelemetry(payload) {
|
|
39
|
+
const url = `${this.baseUrl}/v1/telemetry`;
|
|
40
|
+
const res = await fetch(url, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: { 'Content-Type': 'application/json' },
|
|
43
|
+
body: JSON.stringify(payload)
|
|
44
|
+
});
|
|
45
|
+
return await res.json();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = FMagenticLClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fmagenticl/client",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"name": "@fmagenticl/client",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lightweight Node.js client for FMagenticL deterministic failure resolution and collective intelligence depository",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"fmagenticl",
|
|
8
|
+
"ai-agents",
|
|
9
|
+
"telemetry",
|
|
10
|
+
"resolution",
|
|
11
|
+
"grievances"
|
|
12
|
+
],
|
|
13
|
+
"author": "FMagenticL Collective",
|
|
14
|
+
"license": "MIT"
|
|
6
15
|
}
|