@vorionsys/shared-constants 1.0.1 → 1.0.2
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.d.ts +55 -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 +6 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +54 -0
- package/dist/index.js +3 -3
- package/dist/products.d.ts +80 -0
- 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 +29 -7
- 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/src/products.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vorionsys/shared-constants - Product Definitions
|
|
3
|
-
*
|
|
4
|
-
* Single source of truth for all Vorion ecosystem products
|
|
5
|
-
* Used for consistent product references across all sites
|
|
6
|
-
*
|
|
7
|
-
* @see https://vorion.org
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// =============================================================================
|
|
11
|
-
// PRODUCT CATEGORIES
|
|
12
|
-
// =============================================================================
|
|
13
|
-
|
|
14
|
-
export enum ProductCategory {
|
|
15
|
-
/** Open source standards and specifications */
|
|
16
|
-
OPEN_SOURCE = 'open_source',
|
|
17
|
-
|
|
18
|
-
/** Commercial SaaS products */
|
|
19
|
-
COMMERCIAL = 'commercial',
|
|
20
|
-
|
|
21
|
-
/** Developer tools and SDKs */
|
|
22
|
-
DEVELOPER_TOOLS = 'developer_tools',
|
|
23
|
-
|
|
24
|
-
/** Educational platforms */
|
|
25
|
-
EDUCATION = 'education',
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// =============================================================================
|
|
29
|
-
// PRODUCT STATUS
|
|
30
|
-
// =============================================================================
|
|
31
|
-
|
|
32
|
-
export enum ProductStatus {
|
|
33
|
-
/** In active development, not yet released */
|
|
34
|
-
DEVELOPMENT = 'development',
|
|
35
|
-
|
|
36
|
-
/** Released as alpha/preview */
|
|
37
|
-
ALPHA = 'alpha',
|
|
38
|
-
|
|
39
|
-
/** Released as beta */
|
|
40
|
-
BETA = 'beta',
|
|
41
|
-
|
|
42
|
-
/** Generally available */
|
|
43
|
-
GA = 'ga',
|
|
44
|
-
|
|
45
|
-
/** Deprecated, still supported */
|
|
46
|
-
DEPRECATED = 'deprecated',
|
|
47
|
-
|
|
48
|
-
/** End of life, no longer supported */
|
|
49
|
-
EOL = 'eol',
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// =============================================================================
|
|
53
|
-
// PRODUCT DEFINITIONS
|
|
54
|
-
// =============================================================================
|
|
55
|
-
|
|
56
|
-
export interface ProductDefinition {
|
|
57
|
-
/** Unique product identifier */
|
|
58
|
-
id: string;
|
|
59
|
-
|
|
60
|
-
/** Human-readable name */
|
|
61
|
-
name: string;
|
|
62
|
-
|
|
63
|
-
/** Short description */
|
|
64
|
-
description: string;
|
|
65
|
-
|
|
66
|
-
/** Product category */
|
|
67
|
-
category: ProductCategory;
|
|
68
|
-
|
|
69
|
-
/** Current status */
|
|
70
|
-
status: ProductStatus;
|
|
71
|
-
|
|
72
|
-
/** Primary website URL */
|
|
73
|
-
url: string;
|
|
74
|
-
|
|
75
|
-
/** Documentation URL */
|
|
76
|
-
docsUrl?: string;
|
|
77
|
-
|
|
78
|
-
/** GitHub repository URL */
|
|
79
|
-
repoUrl?: string;
|
|
80
|
-
|
|
81
|
-
/** NPM package name */
|
|
82
|
-
npmPackage?: string;
|
|
83
|
-
|
|
84
|
-
/** Parent organization */
|
|
85
|
-
organization: 'vorion' | 'agentanchor';
|
|
86
|
-
|
|
87
|
-
/** Version (semver) */
|
|
88
|
-
version?: string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// =============================================================================
|
|
92
|
-
// VORION OPEN SOURCE PRODUCTS
|
|
93
|
-
// =============================================================================
|
|
94
|
-
|
|
95
|
-
export const VORION_PRODUCTS: Record<string, ProductDefinition> = {
|
|
96
|
-
basis: {
|
|
97
|
-
id: 'basis',
|
|
98
|
-
name: 'BASIS',
|
|
99
|
-
description: 'Blockchain Agent Safety & Identity Standard - Open framework for AI agent governance',
|
|
100
|
-
category: ProductCategory.OPEN_SOURCE,
|
|
101
|
-
status: ProductStatus.GA,
|
|
102
|
-
url: 'https://basis.vorion.org',
|
|
103
|
-
docsUrl: 'https://basis.vorion.org/docs',
|
|
104
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/packages/basis',
|
|
105
|
-
npmPackage: '@vorionsys/basis',
|
|
106
|
-
organization: 'vorion',
|
|
107
|
-
version: '1.0.0',
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
carId: {
|
|
111
|
-
id: 'car-id',
|
|
112
|
-
name: 'CAR ID',
|
|
113
|
-
description: 'Categorical Agent Registry - Universal agent identification system',
|
|
114
|
-
category: ProductCategory.OPEN_SOURCE,
|
|
115
|
-
status: ProductStatus.GA,
|
|
116
|
-
url: 'https://carid.vorion.org',
|
|
117
|
-
docsUrl: 'https://carid.vorion.org/docs',
|
|
118
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/packages/car-spec',
|
|
119
|
-
npmPackage: '@vorionsys/car-spec',
|
|
120
|
-
organization: 'vorion',
|
|
121
|
-
version: '1.0.0',
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
atsf: {
|
|
125
|
-
id: 'atsf',
|
|
126
|
-
name: 'ATSF',
|
|
127
|
-
description: 'Agent Trust & Safety Framework - Comprehensive safety evaluation system',
|
|
128
|
-
category: ProductCategory.OPEN_SOURCE,
|
|
129
|
-
status: ProductStatus.BETA,
|
|
130
|
-
url: 'https://atsf.vorion.org',
|
|
131
|
-
docsUrl: 'https://atsf.vorion.org/docs',
|
|
132
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/packages/atsf-core',
|
|
133
|
-
npmPackage: '@vorionsys/atsf-core',
|
|
134
|
-
organization: 'vorion',
|
|
135
|
-
version: '0.9.0',
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
kaizen: {
|
|
139
|
-
id: 'kaizen',
|
|
140
|
-
name: 'Kaizen',
|
|
141
|
-
description: 'Interactive AI Learning Experience - Educational platform for agentic AI',
|
|
142
|
-
category: ProductCategory.EDUCATION,
|
|
143
|
-
status: ProductStatus.BETA,
|
|
144
|
-
url: 'https://learn.vorion.org',
|
|
145
|
-
docsUrl: 'https://learn.vorion.org/docs',
|
|
146
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/kaizen',
|
|
147
|
-
organization: 'vorion',
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
kaizenStudio: {
|
|
151
|
-
id: 'kaizen-studio',
|
|
152
|
-
name: 'Kaizen Studio',
|
|
153
|
-
description: 'Interactive AI learning studio - hands-on agentic AI experiments',
|
|
154
|
-
category: ProductCategory.EDUCATION,
|
|
155
|
-
status: ProductStatus.BETA,
|
|
156
|
-
url: 'https://kaizen.vorion.org',
|
|
157
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/kaizen',
|
|
158
|
-
organization: 'vorion',
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
proofPlane: {
|
|
162
|
-
id: 'proof-plane',
|
|
163
|
-
name: 'Proof Plane',
|
|
164
|
-
description: 'Cryptographic proof layer for agent attestations and verifiable execution',
|
|
165
|
-
category: ProductCategory.OPEN_SOURCE,
|
|
166
|
-
status: ProductStatus.BETA,
|
|
167
|
-
url: 'https://vorion.org/proof-plane',
|
|
168
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/packages/proof-plane',
|
|
169
|
-
npmPackage: '@vorionsys/proof-plane',
|
|
170
|
-
organization: 'vorion',
|
|
171
|
-
version: '0.5.0',
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
contracts: {
|
|
175
|
-
id: 'contracts',
|
|
176
|
-
name: 'Vorion Contracts',
|
|
177
|
-
description: 'Smart contracts for on-chain agent governance and attestations',
|
|
178
|
-
category: ProductCategory.OPEN_SOURCE,
|
|
179
|
-
status: ProductStatus.BETA,
|
|
180
|
-
url: 'https://vorion.org/contracts',
|
|
181
|
-
repoUrl: 'https://github.com/voriongit/vorion/tree/master/packages/contracts',
|
|
182
|
-
npmPackage: '@vorionsys/contracts',
|
|
183
|
-
organization: 'vorion',
|
|
184
|
-
},
|
|
185
|
-
} as const;
|
|
186
|
-
|
|
187
|
-
// =============================================================================
|
|
188
|
-
// AGENT ANCHOR COMMERCIAL PRODUCTS
|
|
189
|
-
// =============================================================================
|
|
190
|
-
|
|
191
|
-
export const AGENTANCHOR_PRODUCTS: Record<string, ProductDefinition> = {
|
|
192
|
-
cognigate: {
|
|
193
|
-
id: 'cognigate',
|
|
194
|
-
name: 'Cognigate',
|
|
195
|
-
description: 'AI Governance API - Reference implementation of BASIS runtime',
|
|
196
|
-
category: ProductCategory.COMMERCIAL,
|
|
197
|
-
status: ProductStatus.GA,
|
|
198
|
-
url: 'https://cognigate.dev',
|
|
199
|
-
docsUrl: 'https://cognigate.dev/docs',
|
|
200
|
-
npmPackage: '@vorionsys/cognigate',
|
|
201
|
-
organization: 'agentanchor',
|
|
202
|
-
version: '1.0.0',
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
trust: {
|
|
206
|
-
id: 'trust',
|
|
207
|
-
name: 'Agent Anchor Trust',
|
|
208
|
-
description: 'Trust verification and certification platform for AI agents',
|
|
209
|
-
category: ProductCategory.COMMERCIAL,
|
|
210
|
-
status: ProductStatus.GA,
|
|
211
|
-
url: 'https://trust.agentanchorai.com',
|
|
212
|
-
docsUrl: 'https://trust.agentanchorai.com/docs',
|
|
213
|
-
organization: 'agentanchor',
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
logic: {
|
|
217
|
-
id: 'logic',
|
|
218
|
-
name: 'Agent Anchor Logic',
|
|
219
|
-
description: 'Policy engine and governance logic for enterprise AI',
|
|
220
|
-
category: ProductCategory.COMMERCIAL,
|
|
221
|
-
status: ProductStatus.BETA,
|
|
222
|
-
url: 'https://logic.agentanchorai.com',
|
|
223
|
-
docsUrl: 'https://logic.agentanchorai.com/docs',
|
|
224
|
-
organization: 'agentanchor',
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
platform: {
|
|
228
|
-
id: 'platform',
|
|
229
|
-
name: 'Agent Anchor Platform',
|
|
230
|
-
description: 'Enterprise AI governance dashboard and management console',
|
|
231
|
-
category: ProductCategory.COMMERCIAL,
|
|
232
|
-
status: ProductStatus.GA,
|
|
233
|
-
url: 'https://agentanchorai.com',
|
|
234
|
-
docsUrl: 'https://agentanchorai.com/docs',
|
|
235
|
-
organization: 'agentanchor',
|
|
236
|
-
},
|
|
237
|
-
} as const;
|
|
238
|
-
|
|
239
|
-
// =============================================================================
|
|
240
|
-
// ALL PRODUCTS
|
|
241
|
-
// =============================================================================
|
|
242
|
-
|
|
243
|
-
export const ALL_PRODUCTS = {
|
|
244
|
-
vorion: VORION_PRODUCTS,
|
|
245
|
-
agentAnchor: AGENTANCHOR_PRODUCTS,
|
|
246
|
-
} as const;
|
|
247
|
-
|
|
248
|
-
// =============================================================================
|
|
249
|
-
// HELPER FUNCTIONS
|
|
250
|
-
// =============================================================================
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Get a product by its ID
|
|
254
|
-
*/
|
|
255
|
-
export function getProduct(productId: string): ProductDefinition | undefined {
|
|
256
|
-
return (
|
|
257
|
-
VORION_PRODUCTS[productId] ||
|
|
258
|
-
AGENTANCHOR_PRODUCTS[productId]
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Get all products by category
|
|
264
|
-
*/
|
|
265
|
-
export function getProductsByCategory(category: ProductCategory): ProductDefinition[] {
|
|
266
|
-
const allProducts = [...Object.values(VORION_PRODUCTS), ...Object.values(AGENTANCHOR_PRODUCTS)];
|
|
267
|
-
return allProducts.filter(p => p.category === category);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Get all products by status
|
|
272
|
-
*/
|
|
273
|
-
export function getProductsByStatus(status: ProductStatus): ProductDefinition[] {
|
|
274
|
-
const allProducts = [...Object.values(VORION_PRODUCTS), ...Object.values(AGENTANCHOR_PRODUCTS)];
|
|
275
|
-
return allProducts.filter(p => p.status === status);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Get all products by organization
|
|
280
|
-
*/
|
|
281
|
-
export function getProductsByOrganization(org: 'vorion' | 'agentanchor'): ProductDefinition[] {
|
|
282
|
-
return org === 'vorion'
|
|
283
|
-
? Object.values(VORION_PRODUCTS)
|
|
284
|
-
: Object.values(AGENTANCHOR_PRODUCTS);
|
|
285
|
-
}
|
package/src/rate-limits.ts
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vorionsys/shared-constants - Rate Limits
|
|
3
|
-
*
|
|
4
|
-
* Rate limits by trust tier - used across all APIs
|
|
5
|
-
* Higher trust = higher limits
|
|
6
|
-
*
|
|
7
|
-
* @see https://cognigate.dev/docs/rate-limits
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { TrustTier } from './tiers.js';
|
|
11
|
-
|
|
12
|
-
// =============================================================================
|
|
13
|
-
// RATE LIMIT DEFINITIONS
|
|
14
|
-
// =============================================================================
|
|
15
|
-
|
|
16
|
-
export interface RateLimitConfig {
|
|
17
|
-
/** Requests per second */
|
|
18
|
-
requestsPerSecond: number;
|
|
19
|
-
|
|
20
|
-
/** Requests per minute */
|
|
21
|
-
requestsPerMinute: number;
|
|
22
|
-
|
|
23
|
-
/** Requests per hour */
|
|
24
|
-
requestsPerHour: number;
|
|
25
|
-
|
|
26
|
-
/** Requests per day */
|
|
27
|
-
requestsPerDay: number;
|
|
28
|
-
|
|
29
|
-
/** Burst limit (max concurrent) */
|
|
30
|
-
burstLimit: number;
|
|
31
|
-
|
|
32
|
-
/** Max payload size in bytes */
|
|
33
|
-
maxPayloadBytes: number;
|
|
34
|
-
|
|
35
|
-
/** Max response size in bytes */
|
|
36
|
-
maxResponseBytes: number;
|
|
37
|
-
|
|
38
|
-
/** Connection timeout in ms */
|
|
39
|
-
connectionTimeoutMs: number;
|
|
40
|
-
|
|
41
|
-
/** Request timeout in ms */
|
|
42
|
-
requestTimeoutMs: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// =============================================================================
|
|
46
|
-
// RATE LIMITS BY TIER
|
|
47
|
-
// =============================================================================
|
|
48
|
-
|
|
49
|
-
export const RATE_LIMITS: Record<TrustTier, RateLimitConfig> = {
|
|
50
|
-
[TrustTier.T0_SANDBOX]: {
|
|
51
|
-
requestsPerSecond: 1,
|
|
52
|
-
requestsPerMinute: 10,
|
|
53
|
-
requestsPerHour: 100,
|
|
54
|
-
requestsPerDay: 500,
|
|
55
|
-
burstLimit: 2,
|
|
56
|
-
maxPayloadBytes: 1024 * 10, // 10 KB
|
|
57
|
-
maxResponseBytes: 1024 * 100, // 100 KB
|
|
58
|
-
connectionTimeoutMs: 5000,
|
|
59
|
-
requestTimeoutMs: 10000,
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
[TrustTier.T1_OBSERVED]: {
|
|
63
|
-
requestsPerSecond: 2,
|
|
64
|
-
requestsPerMinute: 30,
|
|
65
|
-
requestsPerHour: 500,
|
|
66
|
-
requestsPerDay: 2000,
|
|
67
|
-
burstLimit: 5,
|
|
68
|
-
maxPayloadBytes: 1024 * 50, // 50 KB
|
|
69
|
-
maxResponseBytes: 1024 * 500, // 500 KB
|
|
70
|
-
connectionTimeoutMs: 5000,
|
|
71
|
-
requestTimeoutMs: 15000,
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
[TrustTier.T2_PROVISIONAL]: {
|
|
75
|
-
requestsPerSecond: 5,
|
|
76
|
-
requestsPerMinute: 100,
|
|
77
|
-
requestsPerHour: 2000,
|
|
78
|
-
requestsPerDay: 10000,
|
|
79
|
-
burstLimit: 10,
|
|
80
|
-
maxPayloadBytes: 1024 * 100, // 100 KB
|
|
81
|
-
maxResponseBytes: 1024 * 1024, // 1 MB
|
|
82
|
-
connectionTimeoutMs: 10000,
|
|
83
|
-
requestTimeoutMs: 30000,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
[TrustTier.T3_MONITORED]: {
|
|
87
|
-
requestsPerSecond: 10,
|
|
88
|
-
requestsPerMinute: 300,
|
|
89
|
-
requestsPerHour: 5000,
|
|
90
|
-
requestsPerDay: 50000,
|
|
91
|
-
burstLimit: 20,
|
|
92
|
-
maxPayloadBytes: 1024 * 500, // 500 KB
|
|
93
|
-
maxResponseBytes: 1024 * 1024 * 5, // 5 MB
|
|
94
|
-
connectionTimeoutMs: 10000,
|
|
95
|
-
requestTimeoutMs: 60000,
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
[TrustTier.T4_STANDARD]: {
|
|
99
|
-
requestsPerSecond: 20,
|
|
100
|
-
requestsPerMinute: 600,
|
|
101
|
-
requestsPerHour: 10000,
|
|
102
|
-
requestsPerDay: 100000,
|
|
103
|
-
burstLimit: 50,
|
|
104
|
-
maxPayloadBytes: 1024 * 1024, // 1 MB
|
|
105
|
-
maxResponseBytes: 1024 * 1024 * 10, // 10 MB
|
|
106
|
-
connectionTimeoutMs: 15000,
|
|
107
|
-
requestTimeoutMs: 120000,
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
[TrustTier.T5_TRUSTED]: {
|
|
111
|
-
requestsPerSecond: 50,
|
|
112
|
-
requestsPerMinute: 1500,
|
|
113
|
-
requestsPerHour: 30000,
|
|
114
|
-
requestsPerDay: 300000,
|
|
115
|
-
burstLimit: 100,
|
|
116
|
-
maxPayloadBytes: 1024 * 1024 * 5, // 5 MB
|
|
117
|
-
maxResponseBytes: 1024 * 1024 * 50, // 50 MB
|
|
118
|
-
connectionTimeoutMs: 30000,
|
|
119
|
-
requestTimeoutMs: 300000,
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
[TrustTier.T6_CERTIFIED]: {
|
|
123
|
-
requestsPerSecond: 100,
|
|
124
|
-
requestsPerMinute: 3000,
|
|
125
|
-
requestsPerHour: 100000,
|
|
126
|
-
requestsPerDay: 1000000,
|
|
127
|
-
burstLimit: 200,
|
|
128
|
-
maxPayloadBytes: 1024 * 1024 * 10, // 10 MB
|
|
129
|
-
maxResponseBytes: 1024 * 1024 * 100, // 100 MB
|
|
130
|
-
connectionTimeoutMs: 60000,
|
|
131
|
-
requestTimeoutMs: 600000,
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
[TrustTier.T7_AUTONOMOUS]: {
|
|
135
|
-
requestsPerSecond: 500,
|
|
136
|
-
requestsPerMinute: 10000,
|
|
137
|
-
requestsPerHour: 500000,
|
|
138
|
-
requestsPerDay: 5000000,
|
|
139
|
-
burstLimit: 500,
|
|
140
|
-
maxPayloadBytes: 1024 * 1024 * 50, // 50 MB
|
|
141
|
-
maxResponseBytes: 1024 * 1024 * 500, // 500 MB
|
|
142
|
-
connectionTimeoutMs: 120000,
|
|
143
|
-
requestTimeoutMs: 1200000,
|
|
144
|
-
},
|
|
145
|
-
} as const;
|
|
146
|
-
|
|
147
|
-
// =============================================================================
|
|
148
|
-
// HELPER FUNCTIONS
|
|
149
|
-
// =============================================================================
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Get rate limits for a trust tier
|
|
153
|
-
*/
|
|
154
|
-
export function getRateLimits(tier: TrustTier): RateLimitConfig {
|
|
155
|
-
return RATE_LIMITS[tier];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Get the minimum tier required for specific rate limits
|
|
160
|
-
*/
|
|
161
|
-
export function getMinTierForLimits(config: {
|
|
162
|
-
requestsPerSecond?: number;
|
|
163
|
-
requestsPerMinute?: number;
|
|
164
|
-
requestsPerHour?: number;
|
|
165
|
-
requestsPerDay?: number;
|
|
166
|
-
}): TrustTier {
|
|
167
|
-
const tiers = Object.values(TrustTier).filter(t => typeof t === 'number') as TrustTier[];
|
|
168
|
-
|
|
169
|
-
for (const tier of tiers) {
|
|
170
|
-
const limits = RATE_LIMITS[tier];
|
|
171
|
-
if (
|
|
172
|
-
(config.requestsPerSecond === undefined || limits.requestsPerSecond >= config.requestsPerSecond) &&
|
|
173
|
-
(config.requestsPerMinute === undefined || limits.requestsPerMinute >= config.requestsPerMinute) &&
|
|
174
|
-
(config.requestsPerHour === undefined || limits.requestsPerHour >= config.requestsPerHour) &&
|
|
175
|
-
(config.requestsPerDay === undefined || limits.requestsPerDay >= config.requestsPerDay)
|
|
176
|
-
) {
|
|
177
|
-
return tier;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return TrustTier.T7_AUTONOMOUS;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Check if a rate limit would be exceeded
|
|
186
|
-
*/
|
|
187
|
-
export function wouldExceedLimit(
|
|
188
|
-
tier: TrustTier,
|
|
189
|
-
window: 'second' | 'minute' | 'hour' | 'day',
|
|
190
|
-
currentCount: number,
|
|
191
|
-
): boolean {
|
|
192
|
-
const limits = RATE_LIMITS[tier];
|
|
193
|
-
switch (window) {
|
|
194
|
-
case 'second':
|
|
195
|
-
return currentCount >= limits.requestsPerSecond;
|
|
196
|
-
case 'minute':
|
|
197
|
-
return currentCount >= limits.requestsPerMinute;
|
|
198
|
-
case 'hour':
|
|
199
|
-
return currentCount >= limits.requestsPerHour;
|
|
200
|
-
case 'day':
|
|
201
|
-
return currentCount >= limits.requestsPerDay;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Format rate limit for display
|
|
207
|
-
*/
|
|
208
|
-
export function formatRateLimit(tier: TrustTier): string {
|
|
209
|
-
const limits = RATE_LIMITS[tier];
|
|
210
|
-
return `${limits.requestsPerSecond}/s, ${limits.requestsPerMinute}/min, ${limits.requestsPerHour}/hr`;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// =============================================================================
|
|
214
|
-
// QUOTA DEFINITIONS (for billing/usage)
|
|
215
|
-
// =============================================================================
|
|
216
|
-
|
|
217
|
-
export interface QuotaConfig {
|
|
218
|
-
/** Monthly API calls included */
|
|
219
|
-
monthlyApiCalls: number;
|
|
220
|
-
|
|
221
|
-
/** Monthly compute units included */
|
|
222
|
-
monthlyComputeUnits: number;
|
|
223
|
-
|
|
224
|
-
/** Monthly storage (bytes) */
|
|
225
|
-
monthlyStorageBytes: number;
|
|
226
|
-
|
|
227
|
-
/** Monthly bandwidth (bytes) */
|
|
228
|
-
monthlyBandwidthBytes: number;
|
|
229
|
-
|
|
230
|
-
/** Max agents allowed */
|
|
231
|
-
maxAgents: number;
|
|
232
|
-
|
|
233
|
-
/** Max webhooks */
|
|
234
|
-
maxWebhooks: number;
|
|
235
|
-
|
|
236
|
-
/** Max team members */
|
|
237
|
-
maxTeamMembers: number;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export const TIER_QUOTAS: Record<TrustTier, QuotaConfig> = {
|
|
241
|
-
[TrustTier.T0_SANDBOX]: {
|
|
242
|
-
monthlyApiCalls: 1000,
|
|
243
|
-
monthlyComputeUnits: 100,
|
|
244
|
-
monthlyStorageBytes: 1024 * 1024 * 10, // 10 MB
|
|
245
|
-
monthlyBandwidthBytes: 1024 * 1024 * 100, // 100 MB
|
|
246
|
-
maxAgents: 1,
|
|
247
|
-
maxWebhooks: 1,
|
|
248
|
-
maxTeamMembers: 1,
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
[TrustTier.T1_OBSERVED]: {
|
|
252
|
-
monthlyApiCalls: 10000,
|
|
253
|
-
monthlyComputeUnits: 1000,
|
|
254
|
-
monthlyStorageBytes: 1024 * 1024 * 100, // 100 MB
|
|
255
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024, // 1 GB
|
|
256
|
-
maxAgents: 5,
|
|
257
|
-
maxWebhooks: 5,
|
|
258
|
-
maxTeamMembers: 3,
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
[TrustTier.T2_PROVISIONAL]: {
|
|
262
|
-
monthlyApiCalls: 50000,
|
|
263
|
-
monthlyComputeUnits: 5000,
|
|
264
|
-
monthlyStorageBytes: 1024 * 1024 * 500, // 500 MB
|
|
265
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 5, // 5 GB
|
|
266
|
-
maxAgents: 10,
|
|
267
|
-
maxWebhooks: 10,
|
|
268
|
-
maxTeamMembers: 5,
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
[TrustTier.T3_MONITORED]: {
|
|
272
|
-
monthlyApiCalls: 250000,
|
|
273
|
-
monthlyComputeUnits: 25000,
|
|
274
|
-
monthlyStorageBytes: 1024 * 1024 * 1024 * 2, // 2 GB
|
|
275
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 25, // 25 GB
|
|
276
|
-
maxAgents: 50,
|
|
277
|
-
maxWebhooks: 25,
|
|
278
|
-
maxTeamMembers: 10,
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
[TrustTier.T4_STANDARD]: {
|
|
282
|
-
monthlyApiCalls: 1000000,
|
|
283
|
-
monthlyComputeUnits: 100000,
|
|
284
|
-
monthlyStorageBytes: 1024 * 1024 * 1024 * 10, // 10 GB
|
|
285
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 100, // 100 GB
|
|
286
|
-
maxAgents: 200,
|
|
287
|
-
maxWebhooks: 50,
|
|
288
|
-
maxTeamMembers: 25,
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
[TrustTier.T5_TRUSTED]: {
|
|
292
|
-
monthlyApiCalls: 5000000,
|
|
293
|
-
monthlyComputeUnits: 500000,
|
|
294
|
-
monthlyStorageBytes: 1024 * 1024 * 1024 * 50, // 50 GB
|
|
295
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 500, // 500 GB
|
|
296
|
-
maxAgents: 1000,
|
|
297
|
-
maxWebhooks: 100,
|
|
298
|
-
maxTeamMembers: 50,
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
[TrustTier.T6_CERTIFIED]: {
|
|
302
|
-
monthlyApiCalls: 25000000,
|
|
303
|
-
monthlyComputeUnits: 2500000,
|
|
304
|
-
monthlyStorageBytes: 1024 * 1024 * 1024 * 250, // 250 GB
|
|
305
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 2500, // 2.5 TB
|
|
306
|
-
maxAgents: 5000,
|
|
307
|
-
maxWebhooks: 250,
|
|
308
|
-
maxTeamMembers: 100,
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
[TrustTier.T7_AUTONOMOUS]: {
|
|
312
|
-
monthlyApiCalls: -1, // Unlimited
|
|
313
|
-
monthlyComputeUnits: -1, // Unlimited
|
|
314
|
-
monthlyStorageBytes: 1024 * 1024 * 1024 * 1024, // 1 TB
|
|
315
|
-
monthlyBandwidthBytes: 1024 * 1024 * 1024 * 10000, // 10 TB
|
|
316
|
-
maxAgents: -1, // Unlimited
|
|
317
|
-
maxWebhooks: -1, // Unlimited
|
|
318
|
-
maxTeamMembers: -1, // Unlimited
|
|
319
|
-
},
|
|
320
|
-
} as const;
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Get quota for a tier
|
|
324
|
-
*/
|
|
325
|
-
export function getQuota(tier: TrustTier): QuotaConfig {
|
|
326
|
-
return TIER_QUOTAS[tier];
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Check if quota is unlimited (-1)
|
|
331
|
-
*/
|
|
332
|
-
export function isUnlimited(value: number): boolean {
|
|
333
|
-
return value === -1;
|
|
334
|
-
}
|