@vorionsys/shared-constants 1.0.1 → 1.0.3
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/CHANGELOG.md +39 -0
- package/LICENSE +190 -0
- package/README.md +418 -44
- package/dist/api-versions.d.ts +91 -0
- package/dist/capabilities.cjs +4 -3
- package/dist/capabilities.d.cts +3 -2
- package/dist/capabilities.d.ts +56 -0
- package/dist/capabilities.js +1 -1
- package/dist/chunk-CJQJGJZ6.js +216 -0
- package/dist/chunk-JOS3AHBL.js +176 -0
- package/dist/{chunk-IKLCEYZT.js → chunk-OEEPW54O.js} +4 -6
- package/dist/domains.cjs +4 -6
- package/dist/domains.d.cts +4 -8
- package/dist/domains.d.ts +246 -0
- package/dist/domains.js +1 -1
- package/dist/error-codes.d.ts +633 -0
- package/dist/index.cjs +349 -12
- package/dist/index.d.cts +119 -4
- package/dist/index.d.ts +169 -0
- package/dist/index.js +330 -5
- package/dist/products.cjs +1 -1
- package/dist/products.d.ts +80 -0
- package/dist/products.js +1 -1
- package/dist/rate-limits.d.ts +80 -0
- package/dist/themes.d.ts +85 -0
- package/dist/tiers.d.ts +75 -0
- package/package.json +30 -8
- package/dist/chunk-F2R6HBF5.js +0 -253
- package/dist/chunk-PHL3CB53.js +0 -159
- package/src/api-versions.ts +0 -250
- package/src/capabilities.ts +0 -272
- package/src/domains.ts +0 -216
- package/src/error-codes.ts +0 -494
- package/src/index.ts +0 -206
- package/src/products.ts +0 -285
- package/src/rate-limits.ts +0 -334
- package/src/themes.ts +0 -380
- package/src/tiers.ts +0 -239
- package/tsconfig.json +0 -25
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vorionsys/shared-constants
|
|
2
2
|
|
|
3
|
-
Single source of truth for the Vorion ecosystem
|
|
3
|
+
Single source of truth for the Vorion ecosystem -- canonical trust tiers, domain configuration, capability definitions, rate limits, error codes, API versions, product catalog, and UI themes.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,6 +8,19 @@ Single source of truth for the Vorion ecosystem - trust tiers, domains, capabili
|
|
|
8
8
|
npm install @vorionsys/shared-constants
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## What This Package Provides
|
|
12
|
+
|
|
13
|
+
| Module | Description |
|
|
14
|
+
|--------|-------------|
|
|
15
|
+
| **Tiers** | The BASIS 8-tier trust model (T0-T7) with score ranges, names, colors, and helper functions |
|
|
16
|
+
| **Domains** | All Vorion, Agent Anchor, and Cognigate domains, API endpoints, emails, GitHub links, and npm package names |
|
|
17
|
+
| **Capabilities** | Tier-gated capability definitions with categories and constraint metadata |
|
|
18
|
+
| **Products** | Product catalog for both Vorion (open source) and Agent Anchor (commercial) with status and version info |
|
|
19
|
+
| **Rate Limits** | Per-tier rate-limiting configurations and monthly quota definitions |
|
|
20
|
+
| **Error Codes** | Standardized error codes (E1xxx-E7xxx) with HTTP status, categories, retry info, and message templates |
|
|
21
|
+
| **API Versions** | Version management for Cognigate, Trust, Logic, BASIS, and CAR Spec APIs |
|
|
22
|
+
| **Themes** | UI theme tokens (4 themes) with CSS custom-property generation |
|
|
23
|
+
|
|
11
24
|
## Quick Start
|
|
12
25
|
|
|
13
26
|
```typescript
|
|
@@ -17,50 +30,48 @@ import {
|
|
|
17
30
|
scoreToTier,
|
|
18
31
|
API_ENDPOINTS,
|
|
19
32
|
CAPABILITIES,
|
|
33
|
+
getCapabilitiesForTier,
|
|
20
34
|
} from '@vorionsys/shared-constants';
|
|
21
35
|
|
|
22
|
-
// Convert score to tier
|
|
36
|
+
// Convert a trust score to its tier
|
|
23
37
|
const tier = scoreToTier(750); // TrustTier.T4_STANDARD
|
|
24
38
|
|
|
25
|
-
//
|
|
39
|
+
// Look up tier metadata
|
|
26
40
|
const info = TIER_THRESHOLDS[TrustTier.T4_STANDARD];
|
|
27
|
-
console.log(info.name);
|
|
41
|
+
console.log(info.name); // "Standard"
|
|
28
42
|
console.log(info.min, info.max); // 650, 799
|
|
43
|
+
console.log(info.color); // "#22c55e"
|
|
29
44
|
|
|
30
|
-
//
|
|
45
|
+
// List capabilities available at a tier
|
|
31
46
|
const caps = getCapabilitiesForTier(TrustTier.T4_STANDARD);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Features
|
|
47
|
+
console.log(caps.map(c => c.code));
|
|
48
|
+
// ["CAP-READ-PUBLIC", "CAP-GENERATE-TEXT", ..., "CAP-ESCALATE-HUMAN"]
|
|
35
49
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **Rate Limits**: Per-tier rate limiting and quota configurations
|
|
41
|
-
- **Error Codes**: Standardized error codes with categories and retry information
|
|
42
|
-
- **API Versions**: Version management for Cognigate, Trust, Logic, BASIS, and CAR APIs
|
|
43
|
-
- **Themes**: UI theme tokens with CSS variable generation
|
|
50
|
+
// Get an API endpoint
|
|
51
|
+
const apiUrl = API_ENDPOINTS.cognigate.production;
|
|
52
|
+
// "https://cognigate.dev/v1"
|
|
53
|
+
```
|
|
44
54
|
|
|
45
55
|
## Trust Tiers
|
|
46
56
|
|
|
47
|
-
The BASIS 8-tier trust model (score range 0
|
|
57
|
+
The BASIS 8-tier trust model (score range 0--1000):
|
|
48
58
|
|
|
49
59
|
| Tier | Score | Name | Description |
|
|
50
60
|
|------|-------|------|-------------|
|
|
51
|
-
| T0 | 0
|
|
52
|
-
| T1 | 200
|
|
53
|
-
| T2 | 350
|
|
54
|
-
| T3 | 500
|
|
55
|
-
| T4 | 650
|
|
56
|
-
| T5 | 800
|
|
57
|
-
| T6 | 876
|
|
58
|
-
| T7 | 951
|
|
61
|
+
| T0 | 0--199 | Sandbox | Isolated, no external access, observation only |
|
|
62
|
+
| T1 | 200--349 | Observed | Read-only, sandboxed execution, monitored |
|
|
63
|
+
| T2 | 350--499 | Provisional | Basic operations, heavy supervision |
|
|
64
|
+
| T3 | 500--649 | Monitored | Standard operations with continuous monitoring |
|
|
65
|
+
| T4 | 650--799 | Standard | External API access, policy-governed |
|
|
66
|
+
| T5 | 800--875 | Trusted | Cross-agent communication, delegated tasks |
|
|
67
|
+
| T6 | 876--950 | Certified | Admin tasks, agent spawning, minimal oversight |
|
|
68
|
+
| T7 | 951--1000 | Autonomous | Full autonomy, self-governance, strategic only |
|
|
59
69
|
|
|
60
70
|
## Subpath Imports
|
|
61
71
|
|
|
72
|
+
Import only the module you need to minimize bundle size:
|
|
73
|
+
|
|
62
74
|
```typescript
|
|
63
|
-
// Import only what you need
|
|
64
75
|
import { TrustTier, scoreToTier } from '@vorionsys/shared-constants/tiers';
|
|
65
76
|
import { VORION_DOMAINS, API_ENDPOINTS } from '@vorionsys/shared-constants/domains';
|
|
66
77
|
import { CAPABILITIES, getCapabilitiesForTier } from '@vorionsys/shared-constants/capabilities';
|
|
@@ -68,45 +79,387 @@ import { VORION_PRODUCTS } from '@vorionsys/shared-constants/products';
|
|
|
68
79
|
import { RATE_LIMITS, getRateLimits } from '@vorionsys/shared-constants/rate-limits';
|
|
69
80
|
import { ERROR_CODES, getErrorByCode } from '@vorionsys/shared-constants/error-codes';
|
|
70
81
|
import { API_VERSIONS, getCurrentVersion } from '@vorionsys/shared-constants/api-versions';
|
|
82
|
+
import { THEMES, getActiveTheme, themeToCssVars } from '@vorionsys/shared-constants/themes';
|
|
71
83
|
```
|
|
72
84
|
|
|
73
|
-
##
|
|
85
|
+
## Usage Examples
|
|
74
86
|
|
|
75
|
-
###
|
|
87
|
+
### Trust Tier Helpers
|
|
76
88
|
|
|
77
89
|
```typescript
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
import {
|
|
91
|
+
TrustTier,
|
|
92
|
+
scoreToTier,
|
|
93
|
+
getTierName,
|
|
94
|
+
getTierColor,
|
|
95
|
+
getTierMinScore,
|
|
96
|
+
getTierMaxScore,
|
|
97
|
+
getTierCode,
|
|
98
|
+
meetsTierRequirement,
|
|
99
|
+
parseTier,
|
|
100
|
+
ALL_TIERS,
|
|
101
|
+
} from '@vorionsys/shared-constants';
|
|
102
|
+
|
|
103
|
+
scoreToTier(750); // TrustTier.T4_STANDARD
|
|
104
|
+
getTierName(TrustTier.T5_TRUSTED); // "Trusted"
|
|
105
|
+
getTierColor(TrustTier.T3_MONITORED); // "#eab308"
|
|
106
|
+
getTierMinScore(TrustTier.T4_STANDARD); // 650
|
|
107
|
+
getTierMaxScore(TrustTier.T4_STANDARD); // 799
|
|
108
|
+
getTierCode(TrustTier.T4_STANDARD); // "T4"
|
|
109
|
+
meetsTierRequirement(750, TrustTier.T3_MONITORED); // true
|
|
110
|
+
parseTier('T3'); // TrustTier.T3_MONITORED
|
|
111
|
+
parseTier('TRUSTED'); // TrustTier.T5_TRUSTED
|
|
112
|
+
ALL_TIERS; // [T0, T1, T2, T3, T4, T5, T6, T7]
|
|
85
113
|
```
|
|
86
114
|
|
|
87
|
-
###
|
|
115
|
+
### Domains and Endpoints
|
|
88
116
|
|
|
89
117
|
```typescript
|
|
118
|
+
import {
|
|
119
|
+
VORION_DOMAINS,
|
|
120
|
+
AGENTANCHOR_DOMAINS,
|
|
121
|
+
COGNIGATE_DOMAINS,
|
|
122
|
+
API_ENDPOINTS,
|
|
123
|
+
VORION_EMAILS,
|
|
124
|
+
GITHUB,
|
|
125
|
+
NPM_PACKAGES,
|
|
126
|
+
ALL_DOMAINS,
|
|
127
|
+
DOMAIN_ALIASES,
|
|
128
|
+
} from '@vorionsys/shared-constants';
|
|
129
|
+
|
|
130
|
+
VORION_DOMAINS.basis; // "https://basis.vorion.org"
|
|
131
|
+
AGENTANCHOR_DOMAINS.trust; // "https://trust.vorion.org"
|
|
132
|
+
COGNIGATE_DOMAINS.main; // "https://cognigate.dev"
|
|
133
|
+
API_ENDPOINTS.cognigate.production; // "https://cognigate.dev/v1"
|
|
134
|
+
API_ENDPOINTS.agentAnchor.sandbox; // "https://sandbox.vorion.org/v1"
|
|
135
|
+
VORION_EMAILS.security; // "security@vorion.org"
|
|
136
|
+
GITHUB.vorion.mainRepo; // "https://github.com/vorionsys/vorion"
|
|
137
|
+
NPM_PACKAGES.vorion.sharedConstants; // "@vorionsys/shared-constants"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Capabilities
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import {
|
|
144
|
+
CapabilityCategory,
|
|
145
|
+
CAPABILITIES,
|
|
146
|
+
getCapabilitiesForTier,
|
|
147
|
+
getCapability,
|
|
148
|
+
isCapabilityAvailable,
|
|
149
|
+
getCapabilityMinTier,
|
|
150
|
+
getCapabilitiesByCategory,
|
|
151
|
+
getAllCapabilityCodes,
|
|
152
|
+
} from '@vorionsys/shared-constants';
|
|
153
|
+
|
|
154
|
+
// Get all capabilities unlocked at T4 or below
|
|
155
|
+
const caps = getCapabilitiesForTier(TrustTier.T4_STANDARD);
|
|
156
|
+
|
|
157
|
+
// Look up a single capability
|
|
158
|
+
const cap = getCapability('CAP-AGENT-DELEGATE');
|
|
159
|
+
// { code: "CAP-AGENT-DELEGATE", name: "Task Delegation", unlockTier: T5_TRUSTED, ... }
|
|
160
|
+
|
|
161
|
+
// Check if available
|
|
162
|
+
isCapabilityAvailable('CAP-FILE-WRITE', TrustTier.T3_MONITORED); // true (unlocks at T2)
|
|
163
|
+
|
|
164
|
+
// Get minimum tier needed
|
|
165
|
+
getCapabilityMinTier('CAP-AGENT-SPAWN'); // TrustTier.T6_CERTIFIED
|
|
166
|
+
|
|
167
|
+
// Filter by category
|
|
168
|
+
const apiCaps = getCapabilitiesByCategory(CapabilityCategory.API_ACCESS);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Products
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import {
|
|
175
|
+
ProductCategory,
|
|
176
|
+
ProductStatus,
|
|
177
|
+
VORION_PRODUCTS,
|
|
178
|
+
AGENTANCHOR_PRODUCTS,
|
|
179
|
+
ALL_PRODUCTS,
|
|
180
|
+
getProduct,
|
|
181
|
+
getProductsByCategory,
|
|
182
|
+
getProductsByStatus,
|
|
183
|
+
getProductsByOrganization,
|
|
184
|
+
} from '@vorionsys/shared-constants';
|
|
185
|
+
|
|
186
|
+
const basis = getProduct('basis');
|
|
187
|
+
// { id: "basis", name: "BASIS", status: "ga", url: "https://basis.vorion.org", ... }
|
|
188
|
+
|
|
189
|
+
const gaProducts = getProductsByStatus(ProductStatus.GA);
|
|
190
|
+
const openSource = getProductsByCategory(ProductCategory.OPEN_SOURCE);
|
|
191
|
+
const vorionProducts = getProductsByOrganization('vorion');
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Rate Limits and Quotas
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import {
|
|
198
|
+
TrustTier,
|
|
199
|
+
RATE_LIMITS,
|
|
200
|
+
TIER_QUOTAS,
|
|
201
|
+
getRateLimits,
|
|
202
|
+
wouldExceedLimit,
|
|
203
|
+
formatRateLimit,
|
|
204
|
+
getQuota,
|
|
205
|
+
isUnlimited,
|
|
206
|
+
} from '@vorionsys/shared-constants';
|
|
207
|
+
|
|
90
208
|
const limits = getRateLimits(TrustTier.T4_STANDARD);
|
|
91
|
-
// { requestsPerMinute:
|
|
209
|
+
// { requestsPerSecond: 20, requestsPerMinute: 600, burstLimit: 50, ... }
|
|
210
|
+
|
|
211
|
+
wouldExceedLimit(TrustTier.T4_STANDARD, 'minute', 599); // false
|
|
212
|
+
wouldExceedLimit(TrustTier.T4_STANDARD, 'minute', 600); // true
|
|
92
213
|
|
|
93
|
-
|
|
94
|
-
|
|
214
|
+
formatRateLimit(TrustTier.T4_STANDARD);
|
|
215
|
+
// "20/s, 600/min, 10000/hr"
|
|
216
|
+
|
|
217
|
+
const quota = getQuota(TrustTier.T7_AUTONOMOUS);
|
|
218
|
+
isUnlimited(quota.monthlyApiCalls); // true (-1 means unlimited)
|
|
95
219
|
```
|
|
96
220
|
|
|
97
221
|
### Error Codes
|
|
98
222
|
|
|
99
223
|
```typescript
|
|
100
|
-
|
|
101
|
-
|
|
224
|
+
import {
|
|
225
|
+
ErrorCategory,
|
|
226
|
+
ERROR_CODES,
|
|
227
|
+
getErrorByCode,
|
|
228
|
+
getErrorsByCategory,
|
|
229
|
+
getRetryableErrors,
|
|
230
|
+
formatErrorMessage,
|
|
231
|
+
createErrorResponse,
|
|
232
|
+
} from '@vorionsys/shared-constants';
|
|
102
233
|
|
|
234
|
+
// Look up error by its code string
|
|
235
|
+
const err = getErrorByCode('E1001');
|
|
236
|
+
// { code: "E1001", httpStatus: 401, category: "auth", message: "API key is missing...", retryable: false }
|
|
237
|
+
|
|
238
|
+
// Use a named error constant
|
|
239
|
+
const response = createErrorResponse(
|
|
240
|
+
ERROR_CODES.TRUST_TIER_INSUFFICIENT,
|
|
241
|
+
{ currentTier: 'T2', requiredTier: 'T4' },
|
|
242
|
+
'req_abc123',
|
|
243
|
+
);
|
|
244
|
+
// { error: { code: "E5001", message: "Trust tier T2 insufficient. Required: T4.", ... }, status: 403 }
|
|
245
|
+
|
|
246
|
+
// Get all retryable errors (useful for retry logic)
|
|
103
247
|
const retryable = getRetryableErrors();
|
|
104
|
-
|
|
248
|
+
|
|
249
|
+
// Get errors by category
|
|
250
|
+
const authErrors = getErrorsByCategory(ErrorCategory.AUTH);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### API Versions
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import {
|
|
257
|
+
VersionStatus,
|
|
258
|
+
API_VERSIONS,
|
|
259
|
+
getCurrentVersion,
|
|
260
|
+
getVersionDefinition,
|
|
261
|
+
isVersionSupported,
|
|
262
|
+
isVersionDeprecated,
|
|
263
|
+
getStableVersions,
|
|
264
|
+
buildApiUrl,
|
|
265
|
+
VERSION_HEADERS,
|
|
266
|
+
COGNIGATE_CURRENT_VERSION,
|
|
267
|
+
BASIS_SPEC_VERSION,
|
|
268
|
+
} from '@vorionsys/shared-constants';
|
|
269
|
+
|
|
270
|
+
getCurrentVersion('cognigate'); // "v1"
|
|
271
|
+
getCurrentVersion('basis'); // "v1"
|
|
272
|
+
BASIS_SPEC_VERSION; // "1.0.0"
|
|
273
|
+
|
|
274
|
+
isVersionSupported('cognigate', 'v1'); // true
|
|
275
|
+
isVersionDeprecated('cognigate', 'v1'); // false
|
|
276
|
+
|
|
277
|
+
buildApiUrl('https://cognigate.dev', 'v1', 'agents/lookup');
|
|
278
|
+
// "https://cognigate.dev/v1/agents/lookup"
|
|
279
|
+
|
|
280
|
+
const stableVersions = getStableVersions('trust');
|
|
281
|
+
|
|
282
|
+
VERSION_HEADERS.REQUEST_VERSION; // "X-API-Version"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Themes
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
import {
|
|
289
|
+
ACTIVE_THEME,
|
|
290
|
+
THEMES,
|
|
291
|
+
getActiveTheme,
|
|
292
|
+
getAllThemeIds,
|
|
293
|
+
themeToCssVars,
|
|
294
|
+
} from '@vorionsys/shared-constants';
|
|
295
|
+
|
|
296
|
+
ACTIVE_THEME; // "midnight_cyan"
|
|
297
|
+
getAllThemeIds(); // ["midnight_cyan", "indigo_authority", "obsidian_amber", "arctic_glass"]
|
|
298
|
+
|
|
299
|
+
const theme = getActiveTheme();
|
|
300
|
+
console.log(theme.accent); // "#06b6d4"
|
|
301
|
+
console.log(theme.bgPrimary); // "#0a0a0f"
|
|
302
|
+
console.log(theme.fontFamily); // "'Inter', -apple-system, ..."
|
|
303
|
+
|
|
304
|
+
// Generate CSS custom properties for injection
|
|
305
|
+
const cssVars = themeToCssVars('midnight_cyan');
|
|
306
|
+
// "--bg-primary: #0a0a0f; --accent: #06b6d4; ..."
|
|
105
307
|
```
|
|
106
308
|
|
|
309
|
+
## API Reference
|
|
310
|
+
|
|
311
|
+
### Tiers (`@vorionsys/shared-constants/tiers`)
|
|
312
|
+
|
|
313
|
+
| Export | Kind | Description |
|
|
314
|
+
|--------|------|-------------|
|
|
315
|
+
| `TrustTier` | enum | Trust tier enum (T0_SANDBOX through T7_AUTONOMOUS) |
|
|
316
|
+
| `TIER_THRESHOLDS` | const | Score ranges, names, descriptions, and colors for each tier |
|
|
317
|
+
| `scoreToTier(score)` | function | Convert a 0-1000 score to its `TrustTier` |
|
|
318
|
+
| `getTierThreshold(tier)` | function | Get the full `TierThreshold` object for a tier |
|
|
319
|
+
| `getTierName(tier)` | function | Get human-readable tier name |
|
|
320
|
+
| `getTierColor(tier)` | function | Get hex color for a tier |
|
|
321
|
+
| `getTierMinScore(tier)` | function | Get minimum score required for a tier |
|
|
322
|
+
| `getTierMaxScore(tier)` | function | Get maximum score for a tier |
|
|
323
|
+
| `getTierCode(tier)` | function | Get short code string (e.g. "T4") |
|
|
324
|
+
| `meetsTierRequirement(score, minTier)` | function | Check if a score meets a minimum tier |
|
|
325
|
+
| `parseTier(input)` | function | Parse tier from string ("T3", "3", "MONITORED") |
|
|
326
|
+
| `ALL_TIERS` | const | Ordered array of all 8 tiers |
|
|
327
|
+
| `TierThreshold` | type | Interface for tier threshold configuration |
|
|
328
|
+
| `TrustTierName` | type | Union of tier display names |
|
|
329
|
+
| `TrustTierCode` | type | Union of tier short codes ("T0" through "T7") |
|
|
330
|
+
|
|
331
|
+
### Domains (`@vorionsys/shared-constants/domains`)
|
|
332
|
+
|
|
333
|
+
| Export | Kind | Description |
|
|
334
|
+
|--------|------|-------------|
|
|
335
|
+
| `VORION_DOMAINS` | const | Vorion organization URLs (main, basis, carId, atsf, learn, kaizen) |
|
|
336
|
+
| `AGENTANCHOR_DOMAINS` | const | Agent Anchor AI URLs (main, trust, logic, status, verify) |
|
|
337
|
+
| `COGNIGATE_DOMAINS` | const | Cognigate URLs (main, docs) |
|
|
338
|
+
| `API_ENDPOINTS` | const | Production/staging/sandbox API base URLs |
|
|
339
|
+
| `VORION_EMAILS` | const | Vorion contact email addresses |
|
|
340
|
+
| `AGENTANCHOR_EMAILS` | const | Vorion platform contact email addresses |
|
|
341
|
+
| `GITHUB` | const | GitHub organization and repo URLs |
|
|
342
|
+
| `NPM_PACKAGES` | const | npm package names for all published packages |
|
|
343
|
+
| `ALL_DOMAINS` | const | Combined object containing all domain groups |
|
|
344
|
+
| `DOMAIN_ALIASES` | const | Map of alternate domains to their primary |
|
|
345
|
+
| `VorionDomain` | type | Key union for `VORION_DOMAINS` |
|
|
346
|
+
| `AgentAnchorDomain` | type | Key union for `AGENTANCHOR_DOMAINS` (legacy name) |
|
|
347
|
+
| `CognigateDomain` | type | Key union for `COGNIGATE_DOMAINS` |
|
|
348
|
+
|
|
349
|
+
### Capabilities (`@vorionsys/shared-constants/capabilities`)
|
|
350
|
+
|
|
351
|
+
| Export | Kind | Description |
|
|
352
|
+
|--------|------|-------------|
|
|
353
|
+
| `CapabilityCategory` | enum | Capability categories (DATA_ACCESS, API_ACCESS, CODE_EXECUTION, etc.) |
|
|
354
|
+
| `CAPABILITIES` | const | Array of all capability definitions with tier gates |
|
|
355
|
+
| `getCapabilitiesForTier(tier)` | function | Get all capabilities available at or below a tier |
|
|
356
|
+
| `getCapability(code)` | function | Look up a capability by its code string |
|
|
357
|
+
| `isCapabilityAvailable(code, tier)` | function | Check if a capability is unlocked at a tier |
|
|
358
|
+
| `getCapabilityMinTier(code)` | function | Get the minimum tier required for a capability |
|
|
359
|
+
| `getCapabilitiesByCategory(category)` | function | Filter capabilities by category |
|
|
360
|
+
| `getAllCapabilityCodes()` | function | Get array of all capability code strings |
|
|
361
|
+
| `CapabilityDefinition` | type | Interface for a capability definition |
|
|
362
|
+
|
|
363
|
+
### Products (`@vorionsys/shared-constants/products`)
|
|
364
|
+
|
|
365
|
+
| Export | Kind | Description |
|
|
366
|
+
|--------|------|-------------|
|
|
367
|
+
| `ProductCategory` | enum | Product categories (OPEN_SOURCE, COMMERCIAL, DEVELOPER_TOOLS, EDUCATION) |
|
|
368
|
+
| `ProductStatus` | enum | Product lifecycle status (DEVELOPMENT through EOL) |
|
|
369
|
+
| `VORION_PRODUCTS` | const | Vorion open-source product definitions |
|
|
370
|
+
| `AGENTANCHOR_PRODUCTS` | const | Vorion commercial product definitions (legacy name) |
|
|
371
|
+
| `ALL_PRODUCTS` | const | Combined product catalog |
|
|
372
|
+
| `getProduct(id)` | function | Look up a product by ID |
|
|
373
|
+
| `getProductsByCategory(category)` | function | Filter products by category |
|
|
374
|
+
| `getProductsByStatus(status)` | function | Filter products by lifecycle status |
|
|
375
|
+
| `getProductsByOrganization(org)` | function | Get products for "vorion" or "agentanchor" |
|
|
376
|
+
| `ProductDefinition` | type | Interface for a product definition |
|
|
377
|
+
|
|
378
|
+
### Rate Limits (`@vorionsys/shared-constants/rate-limits`)
|
|
379
|
+
|
|
380
|
+
| Export | Kind | Description |
|
|
381
|
+
|--------|------|-------------|
|
|
382
|
+
| `RATE_LIMITS` | const | Rate-limit configurations keyed by tier |
|
|
383
|
+
| `TIER_QUOTAS` | const | Monthly quota configurations keyed by tier |
|
|
384
|
+
| `getRateLimits(tier)` | function | Get `RateLimitConfig` for a tier |
|
|
385
|
+
| `getMinTierForLimits(config)` | function | Find the lowest tier that satisfies given limits |
|
|
386
|
+
| `wouldExceedLimit(tier, window, count)` | function | Check if a count exceeds a tier's limit for a time window |
|
|
387
|
+
| `formatRateLimit(tier)` | function | Human-readable rate-limit string |
|
|
388
|
+
| `getQuota(tier)` | function | Get `QuotaConfig` for a tier |
|
|
389
|
+
| `isUnlimited(value)` | function | Check if a quota value represents unlimited (-1) |
|
|
390
|
+
| `RateLimitConfig` | type | Interface for rate-limit settings |
|
|
391
|
+
| `QuotaConfig` | type | Interface for monthly quota settings |
|
|
392
|
+
|
|
393
|
+
### Error Codes (`@vorionsys/shared-constants/error-codes`)
|
|
394
|
+
|
|
395
|
+
| Export | Kind | Description |
|
|
396
|
+
|--------|------|-------------|
|
|
397
|
+
| `ErrorCategory` | enum | Error categories (AUTH, VALIDATION, RATE_LIMIT, NOT_FOUND, TRUST, SERVER, EXTERNAL, CONFIG) |
|
|
398
|
+
| `AUTH_ERRORS` | const | Authentication error definitions (E1001-E1007) |
|
|
399
|
+
| `VALIDATION_ERRORS` | const | Validation error definitions (E2001-E2008) |
|
|
400
|
+
| `RATE_LIMIT_ERRORS` | const | Rate-limit error definitions (E3001-E3004) |
|
|
401
|
+
| `NOT_FOUND_ERRORS` | const | Not-found error definitions (E4001-E4005) |
|
|
402
|
+
| `TRUST_ERRORS` | const | Trust/governance error definitions (E5001-E5007) |
|
|
403
|
+
| `SERVER_ERRORS` | const | Server error definitions (E6001-E6004) |
|
|
404
|
+
| `EXTERNAL_ERRORS` | const | External service error definitions (E7001-E7003) |
|
|
405
|
+
| `ERROR_CODES` | const | All error definitions merged into one object |
|
|
406
|
+
| `getErrorByCode(code)` | function | Look up error by code string (e.g. "E1001") |
|
|
407
|
+
| `getErrorsByCategory(category)` | function | Get all errors in a category |
|
|
408
|
+
| `getRetryableErrors()` | function | Get all errors marked as retryable |
|
|
409
|
+
| `formatErrorMessage(error, params)` | function | Interpolate parameters into a message template |
|
|
410
|
+
| `createErrorResponse(error, params?, requestId?)` | function | Build a structured error response object |
|
|
411
|
+
| `ErrorDefinition` | type | Interface for an error definition |
|
|
412
|
+
| `ErrorCode` | type | Union of all error constant keys |
|
|
413
|
+
|
|
414
|
+
### API Versions (`@vorionsys/shared-constants/api-versions`)
|
|
415
|
+
|
|
416
|
+
| Export | Kind | Description |
|
|
417
|
+
|--------|------|-------------|
|
|
418
|
+
| `VersionStatus` | enum | Version lifecycle status (DEVELOPMENT, PREVIEW, STABLE, DEPRECATED, RETIRED) |
|
|
419
|
+
| `COGNIGATE_VERSIONS` | const | Cognigate API version definitions |
|
|
420
|
+
| `COGNIGATE_CURRENT_VERSION` | const | Current Cognigate API version string |
|
|
421
|
+
| `COGNIGATE_DEFAULT_VERSION` | const | Default Cognigate API version string |
|
|
422
|
+
| `TRUST_API_VERSIONS` | const | Trust API version definitions |
|
|
423
|
+
| `TRUST_CURRENT_VERSION` | const | Current Trust API version string |
|
|
424
|
+
| `LOGIC_API_VERSIONS` | const | Logic API version definitions |
|
|
425
|
+
| `LOGIC_CURRENT_VERSION` | const | Current Logic API version string |
|
|
426
|
+
| `BASIS_VERSIONS` | const | BASIS spec version definitions |
|
|
427
|
+
| `BASIS_CURRENT_VERSION` | const | Current BASIS spec version string |
|
|
428
|
+
| `BASIS_SPEC_VERSION` | const | Full semver of BASIS spec ("1.0.0") |
|
|
429
|
+
| `CAR_SPEC_VERSIONS` | const | CAR Spec version definitions |
|
|
430
|
+
| `CAR_SPEC_CURRENT_VERSION` | const | Current CAR Spec version string |
|
|
431
|
+
| `API_VERSIONS` | const | All API version definitions grouped by service |
|
|
432
|
+
| `getCurrentVersion(service)` | function | Get current version for a service |
|
|
433
|
+
| `getVersionDefinition(service, version)` | function | Get full version definition |
|
|
434
|
+
| `isVersionSupported(service, version)` | function | Check if a version is still supported |
|
|
435
|
+
| `isVersionDeprecated(service, version)` | function | Check if a version is deprecated |
|
|
436
|
+
| `getStableVersions(service)` | function | Get all stable versions for a service |
|
|
437
|
+
| `buildApiUrl(baseUrl, version, path)` | function | Build a versioned API URL |
|
|
438
|
+
| `VERSION_HEADERS` | const | Standard HTTP header names for version negotiation |
|
|
439
|
+
| `ApiVersionDefinition` | type | Interface for an API version definition |
|
|
440
|
+
|
|
441
|
+
### Themes (`@vorionsys/shared-constants/themes`)
|
|
442
|
+
|
|
443
|
+
| Export | Kind | Description |
|
|
444
|
+
|--------|------|-------------|
|
|
445
|
+
| `ACTIVE_THEME` | const | Currently active theme ID |
|
|
446
|
+
| `THEMES` | const | All theme token definitions keyed by `ThemeId` |
|
|
447
|
+
| `getActiveTheme()` | function | Get token object for the active theme |
|
|
448
|
+
| `getAllThemeIds()` | function | Get array of all available theme IDs |
|
|
449
|
+
| `themeToCssVars(themeId?)` | function | Generate CSS custom-property string for a theme |
|
|
450
|
+
| `ThemeId` | type | Union of theme identifiers |
|
|
451
|
+
| `ThemeTokens` | type | Interface for a complete set of theme tokens |
|
|
452
|
+
|
|
453
|
+
### Root Exports
|
|
454
|
+
|
|
455
|
+
| Export | Kind | Description |
|
|
456
|
+
|--------|------|-------------|
|
|
457
|
+
| `VERSION` | const | Package version string |
|
|
458
|
+
| `LAST_UPDATED` | const | Last updated date string |
|
|
459
|
+
|
|
107
460
|
## TypeScript
|
|
108
461
|
|
|
109
|
-
All types are fully exported:
|
|
462
|
+
All types are fully exported and can be imported as type-only:
|
|
110
463
|
|
|
111
464
|
```typescript
|
|
112
465
|
import type {
|
|
@@ -115,15 +468,36 @@ import type {
|
|
|
115
468
|
TrustTierName,
|
|
116
469
|
TrustTierCode,
|
|
117
470
|
CapabilityDefinition,
|
|
471
|
+
CapabilityCategory,
|
|
118
472
|
ProductDefinition,
|
|
473
|
+
ProductCategory,
|
|
474
|
+
ProductStatus,
|
|
119
475
|
RateLimitConfig,
|
|
476
|
+
QuotaConfig,
|
|
120
477
|
ErrorDefinition,
|
|
121
478
|
ErrorCode,
|
|
479
|
+
ErrorCategory,
|
|
122
480
|
ApiVersionDefinition,
|
|
481
|
+
VersionStatus,
|
|
482
|
+
ThemeId,
|
|
123
483
|
ThemeTokens,
|
|
484
|
+
VorionDomain,
|
|
485
|
+
AgentAnchorDomain,
|
|
486
|
+
CognigateDomain,
|
|
124
487
|
} from '@vorionsys/shared-constants';
|
|
125
488
|
```
|
|
126
489
|
|
|
490
|
+
## Requirements
|
|
491
|
+
|
|
492
|
+
- Node.js >= 18
|
|
493
|
+
- TypeScript >= 5.7 (for type-only imports)
|
|
494
|
+
|
|
495
|
+
## Repository
|
|
496
|
+
|
|
497
|
+
This package lives in the Vorion monorepo:
|
|
498
|
+
|
|
499
|
+
[https://github.com/vorionsys/vorion/tree/master/packages/shared-constants](https://github.com/vorionsys/vorion/tree/master/packages/shared-constants)
|
|
500
|
+
|
|
127
501
|
## License
|
|
128
502
|
|
|
129
|
-
|
|
503
|
+
Apache-2.0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vorionsys/shared-constants - API Versions
|
|
3
|
+
*
|
|
4
|
+
* Centralized API version management across all services
|
|
5
|
+
* Ensures consistent versioning strategy
|
|
6
|
+
*
|
|
7
|
+
* @see https://cognigate.dev/docs/versioning
|
|
8
|
+
*/
|
|
9
|
+
declare enum VersionStatus {
|
|
10
|
+
/** Currently in development, not available */
|
|
11
|
+
DEVELOPMENT = "development",
|
|
12
|
+
/** Available as preview/beta */
|
|
13
|
+
PREVIEW = "preview",
|
|
14
|
+
/** Stable and recommended */
|
|
15
|
+
STABLE = "stable",
|
|
16
|
+
/** Still supported but deprecated */
|
|
17
|
+
DEPRECATED = "deprecated",
|
|
18
|
+
/** No longer supported */
|
|
19
|
+
RETIRED = "retired"
|
|
20
|
+
}
|
|
21
|
+
interface ApiVersionDefinition {
|
|
22
|
+
/** Version identifier (e.g., "v1") */
|
|
23
|
+
version: string;
|
|
24
|
+
/** Full version number (e.g., "1.0.0") */
|
|
25
|
+
fullVersion: string;
|
|
26
|
+
/** Release date */
|
|
27
|
+
releaseDate: string;
|
|
28
|
+
/** End of support date (if deprecated/retired) */
|
|
29
|
+
endOfLife?: string;
|
|
30
|
+
/** Current status */
|
|
31
|
+
status: VersionStatus;
|
|
32
|
+
/** Changelog URL */
|
|
33
|
+
changelogUrl?: string;
|
|
34
|
+
/** Migration guide URL (if deprecated) */
|
|
35
|
+
migrationUrl?: string;
|
|
36
|
+
}
|
|
37
|
+
declare const COGNIGATE_VERSIONS: Record<string, ApiVersionDefinition>;
|
|
38
|
+
declare const COGNIGATE_CURRENT_VERSION = "v1";
|
|
39
|
+
declare const COGNIGATE_DEFAULT_VERSION = "v1";
|
|
40
|
+
declare const TRUST_API_VERSIONS: Record<string, ApiVersionDefinition>;
|
|
41
|
+
declare const TRUST_CURRENT_VERSION = "v1";
|
|
42
|
+
declare const LOGIC_API_VERSIONS: Record<string, ApiVersionDefinition>;
|
|
43
|
+
declare const LOGIC_CURRENT_VERSION = "v1";
|
|
44
|
+
declare const BASIS_VERSIONS: Record<string, ApiVersionDefinition>;
|
|
45
|
+
declare const BASIS_CURRENT_VERSION = "v1";
|
|
46
|
+
declare const BASIS_SPEC_VERSION = "1.0.0";
|
|
47
|
+
declare const CAR_SPEC_VERSIONS: Record<string, ApiVersionDefinition>;
|
|
48
|
+
declare const CAR_SPEC_CURRENT_VERSION = "v1";
|
|
49
|
+
declare const API_VERSIONS: {
|
|
50
|
+
readonly cognigate: Record<string, ApiVersionDefinition>;
|
|
51
|
+
readonly trust: Record<string, ApiVersionDefinition>;
|
|
52
|
+
readonly logic: Record<string, ApiVersionDefinition>;
|
|
53
|
+
readonly basis: Record<string, ApiVersionDefinition>;
|
|
54
|
+
readonly carSpec: Record<string, ApiVersionDefinition>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get the current stable version for a service
|
|
58
|
+
*/
|
|
59
|
+
declare function getCurrentVersion(service: 'cognigate' | 'trust' | 'logic' | 'basis' | 'carSpec'): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get version definition
|
|
62
|
+
*/
|
|
63
|
+
declare function getVersionDefinition(service: 'cognigate' | 'trust' | 'logic' | 'basis' | 'carSpec', version: string): ApiVersionDefinition | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Check if a version is still supported
|
|
66
|
+
*/
|
|
67
|
+
declare function isVersionSupported(service: 'cognigate' | 'trust' | 'logic' | 'basis' | 'carSpec', version: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a version is deprecated
|
|
70
|
+
*/
|
|
71
|
+
declare function isVersionDeprecated(service: 'cognigate' | 'trust' | 'logic' | 'basis' | 'carSpec', version: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Get all stable versions for a service
|
|
74
|
+
*/
|
|
75
|
+
declare function getStableVersions(service: 'cognigate' | 'trust' | 'logic' | 'basis' | 'carSpec'): ApiVersionDefinition[];
|
|
76
|
+
/**
|
|
77
|
+
* Build versioned API URL
|
|
78
|
+
*/
|
|
79
|
+
declare function buildApiUrl(baseUrl: string, version: string, path: string): string;
|
|
80
|
+
declare const VERSION_HEADERS: {
|
|
81
|
+
/** Header to request specific API version */
|
|
82
|
+
readonly REQUEST_VERSION: "X-API-Version";
|
|
83
|
+
/** Header indicating actual API version used */
|
|
84
|
+
readonly RESPONSE_VERSION: "X-API-Version";
|
|
85
|
+
/** Header warning about deprecation */
|
|
86
|
+
readonly DEPRECATION_WARNING: "X-Deprecation-Warning";
|
|
87
|
+
/** Header with sunset date */
|
|
88
|
+
readonly SUNSET: "Sunset";
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { API_VERSIONS, type ApiVersionDefinition, BASIS_CURRENT_VERSION, BASIS_SPEC_VERSION, BASIS_VERSIONS, CAR_SPEC_CURRENT_VERSION, CAR_SPEC_VERSIONS, COGNIGATE_CURRENT_VERSION, COGNIGATE_DEFAULT_VERSION, COGNIGATE_VERSIONS, LOGIC_API_VERSIONS, LOGIC_CURRENT_VERSION, TRUST_API_VERSIONS, TRUST_CURRENT_VERSION, VERSION_HEADERS, VersionStatus, buildApiUrl, getCurrentVersion, getStableVersions, getVersionDefinition, isVersionDeprecated, isVersionSupported };
|
package/dist/capabilities.cjs
CHANGED
|
@@ -32,12 +32,13 @@ __export(capabilities_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(capabilities_exports);
|
|
33
33
|
var CapabilityCategory = /* @__PURE__ */ ((CapabilityCategory2) => {
|
|
34
34
|
CapabilityCategory2["DATA_ACCESS"] = "data_access";
|
|
35
|
+
CapabilityCategory2["FILE_OPERATIONS"] = "file_operations";
|
|
35
36
|
CapabilityCategory2["API_ACCESS"] = "api_access";
|
|
36
37
|
CapabilityCategory2["CODE_EXECUTION"] = "code_execution";
|
|
37
38
|
CapabilityCategory2["AGENT_INTERACTION"] = "agent_interaction";
|
|
38
39
|
CapabilityCategory2["RESOURCE_MANAGEMENT"] = "resource_management";
|
|
40
|
+
CapabilityCategory2["SYSTEM_ADMINISTRATION"] = "system_administration";
|
|
39
41
|
CapabilityCategory2["GOVERNANCE"] = "governance";
|
|
40
|
-
CapabilityCategory2["ADMIN"] = "admin";
|
|
41
42
|
return CapabilityCategory2;
|
|
42
43
|
})(CapabilityCategory || {});
|
|
43
44
|
var CAPABILITIES = [
|
|
@@ -77,7 +78,7 @@ var CAPABILITIES = [
|
|
|
77
78
|
{
|
|
78
79
|
code: "CAP-FILE-WRITE",
|
|
79
80
|
name: "Write Files",
|
|
80
|
-
category: "
|
|
81
|
+
category: "file_operations" /* FILE_OPERATIONS */,
|
|
81
82
|
description: "Write to approved directories",
|
|
82
83
|
unlockTier: 2 /* T2_PROVISIONAL */,
|
|
83
84
|
constraints: ["Approved dirs only", "Size limited"]
|
|
@@ -193,7 +194,7 @@ var CAPABILITIES = [
|
|
|
193
194
|
{
|
|
194
195
|
code: "CAP-FULL-ADMIN",
|
|
195
196
|
name: "Full Administration",
|
|
196
|
-
category: "
|
|
197
|
+
category: "system_administration" /* SYSTEM_ADMINISTRATION */,
|
|
197
198
|
description: "Full administrative access",
|
|
198
199
|
unlockTier: 7 /* T7_AUTONOMOUS */
|
|
199
200
|
},
|