@jsonfirst/sdk 1.1.0 → 1.2.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 +36 -0
- package/index.js +50 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,42 @@ const client = new JsonFirst({
|
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## Governance Modes
|
|
47
|
+
|
|
48
|
+
All 22 modes are available via `JsonFirst.MODES` or `client.modes()`.
|
|
49
|
+
|
|
50
|
+
| Mode | Plan | Category |
|
|
51
|
+
|------|------|----------|
|
|
52
|
+
| `ANTI_CREDIT_WASTE_V2` | free+ | efficiency |
|
|
53
|
+
| `EXPRESS_ROUTE` | explorer+ | speed |
|
|
54
|
+
| `STRICT_PROTOCOL` | explorer+ | compliance |
|
|
55
|
+
| `PERFORMANCE_MAX` | explorer+ | performance |
|
|
56
|
+
| `GUARDIAN_MODE` | explorer+ | safety |
|
|
57
|
+
| `FINANCE_ALGO` | explorer+ | finance |
|
|
58
|
+
| `ETHICAL_LOCK` | explorer+ | ethics |
|
|
59
|
+
| `SCOPE_LIMITER` | pro+ | governance |
|
|
60
|
+
| `SAFE_DEPLOY` | pro+ | deployment |
|
|
61
|
+
| `STANDARD_DEPLOY` | pro+ | deployment |
|
|
62
|
+
| `FAST_BUILD` | pro+ | build |
|
|
63
|
+
| `PRODUCTION_LOCK` | pro+ | deployment |
|
|
64
|
+
| `MEDICAL_EXPERT` | business+ | domain_lock |
|
|
65
|
+
| `LEGAL_EXPERT` | business+ | domain_lock |
|
|
66
|
+
| `FINANCE_EXPERT` | business+ | domain_lock |
|
|
67
|
+
| `CYBERSECURITY_EXPERT` | business+ | domain_lock |
|
|
68
|
+
| `SOFTWARE_ENGINEERING_EXPERT` | business+ | domain_lock |
|
|
69
|
+
| `AI_RESEARCH_EXPERT` | business+ | domain_lock |
|
|
70
|
+
| `NEWS_ANALYSIS_EXPERT` | business+ | domain_lock |
|
|
71
|
+
| `SCIENTIFIC_RESEARCH_EXPERT` | business+ | domain_lock |
|
|
72
|
+
| `BUSINESS_STRATEGY_EXPERT` | business+ | domain_lock |
|
|
73
|
+
| `DATA_SCIENCE_EXPERT` | business+ | domain_lock |
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
// Access modes programmatically
|
|
77
|
+
const JsonFirst = require('@jsonfirst/sdk');
|
|
78
|
+
console.log(JsonFirst.MODE_IDS); // array of 22 mode IDs
|
|
79
|
+
console.log(JsonFirst.MODES['MEDICAL_EXPERT']); // { plan, category, description }
|
|
80
|
+
```
|
|
81
|
+
|
|
46
82
|
## Links
|
|
47
83
|
|
|
48
84
|
- [Documentation](https://jsonfirst.com/developers)
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @jsonfirst/sdk v1.
|
|
2
|
+
* @jsonfirst/sdk v1.2.0
|
|
3
3
|
* Official JavaScript/Node.js SDK for the JSONFIRST Protocol
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
@@ -21,6 +21,36 @@
|
|
|
21
21
|
|
|
22
22
|
const DEFAULT_BASE_URL = 'https://jsonfirst.com';
|
|
23
23
|
|
|
24
|
+
// All 22 governance modes
|
|
25
|
+
const MODES = {
|
|
26
|
+
// Base modes (all plans)
|
|
27
|
+
ANTI_CREDIT_WASTE_V2: { plan: 'free+', category: 'efficiency', description: 'Anti-token-waste enforcement. Minimal, direct, single-pass.' },
|
|
28
|
+
EXPRESS_ROUTE: { plan: 'explorer+', category: 'speed', description: 'Ultra-low latency routing. Fastest path to response.' },
|
|
29
|
+
STRICT_PROTOCOL: { plan: 'explorer+', category: 'compliance', description: 'Enforces strict JSONFIRST spec compliance on all outputs.' },
|
|
30
|
+
PERFORMANCE_MAX: { plan: 'explorer+', category: 'performance', description: 'Maximum throughput. Optimized for high-volume workloads.' },
|
|
31
|
+
GUARDIAN_MODE: { plan: 'explorer+', category: 'safety', description: 'Safety lock. Blocks risky actions until explicit confirmation.' },
|
|
32
|
+
FINANCE_ALGO: { plan: 'explorer+', category: 'finance', description: 'Financial computation mode. Precision over speed.' },
|
|
33
|
+
ETHICAL_LOCK: { plan: 'explorer+', category: 'ethics', description: 'Ethics enforcement. Refuses harmful or biased outputs.' },
|
|
34
|
+
SCOPE_LIMITER: { plan: 'pro+', category: 'governance', description: 'Restricts agent scope to explicitly defined boundaries.' },
|
|
35
|
+
SAFE_DEPLOY: { plan: 'pro+', category: 'deployment', description: 'Deployment gating. Requires validation before any deploy.' },
|
|
36
|
+
STANDARD_DEPLOY: { plan: 'pro+', category: 'deployment', description: 'Standard deployment flow with audit trail.' },
|
|
37
|
+
FAST_BUILD: { plan: 'pro+', category: 'build', description: 'Accelerated build mode. Speed-first, reduced validation.' },
|
|
38
|
+
PRODUCTION_LOCK: { plan: 'pro+', category: 'deployment', description: 'Production environment lock. No destructive actions.' },
|
|
39
|
+
// Domain Lock modes (business/enterprise)
|
|
40
|
+
MEDICAL_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to medicine. Refuses off-domain queries.' },
|
|
41
|
+
LEGAL_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to law and legal compliance.' },
|
|
42
|
+
FINANCE_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to financial analysis and accounting.' },
|
|
43
|
+
CYBERSECURITY_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to cybersecurity and threat analysis.' },
|
|
44
|
+
SOFTWARE_ENGINEERING_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to software engineering and architecture.' },
|
|
45
|
+
AI_RESEARCH_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to AI/ML research and model analysis.' },
|
|
46
|
+
NEWS_ANALYSIS_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to news analysis and geopolitics.' },
|
|
47
|
+
SCIENTIFIC_RESEARCH_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to scientific research and methodology.' },
|
|
48
|
+
BUSINESS_STRATEGY_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to business strategy and market analysis.' },
|
|
49
|
+
DATA_SCIENCE_EXPERT: { plan: 'business+', category: 'domain_lock', description: 'Domain-locked to data science and analytics.' },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const MODE_IDS = Object.keys(MODES);
|
|
53
|
+
|
|
24
54
|
class JsonFirstError extends Error {
|
|
25
55
|
constructor(message, status, body) {
|
|
26
56
|
super(message);
|
|
@@ -171,7 +201,26 @@
|
|
|
171
201
|
async usage() {
|
|
172
202
|
return this._request('GET', '/auth/me');
|
|
173
203
|
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* List all 22 governance modes with their metadata.
|
|
207
|
+
* @returns {Object} modes map
|
|
208
|
+
*/
|
|
209
|
+
modes() {
|
|
210
|
+
return MODES;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* List all mode IDs.
|
|
215
|
+
* @returns {string[]}
|
|
216
|
+
*/
|
|
217
|
+
modeIds() {
|
|
218
|
+
return MODE_IDS.slice();
|
|
219
|
+
}
|
|
174
220
|
}
|
|
175
221
|
|
|
222
|
+
JsonFirst.MODES = MODES;
|
|
223
|
+
JsonFirst.MODE_IDS = MODE_IDS;
|
|
224
|
+
|
|
176
225
|
return JsonFirst;
|
|
177
226
|
}));
|