@vorionsys/shared-constants 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/dist/api-versions.cjs +183 -0
- package/dist/api-versions.d.cts +91 -0
- package/dist/api-versions.js +46 -0
- package/dist/capabilities.cjs +246 -0
- package/dist/capabilities.d.cts +55 -0
- package/dist/capabilities.js +21 -0
- package/dist/chunk-F2R6HBF5.js +253 -0
- package/dist/chunk-IKLCEYZT.js +142 -0
- package/dist/chunk-JZJPDGG7.js +215 -0
- package/dist/chunk-P3VPMVF3.js +223 -0
- package/dist/chunk-PHL3CB53.js +159 -0
- package/dist/chunk-RZQZEF6Q.js +176 -0
- package/dist/chunk-TYCMBQGU.js +353 -0
- package/dist/chunk-UDCZKJSQ.js +139 -0
- package/dist/domains.cjs +175 -0
- package/dist/domains.d.cts +250 -0
- package/dist/domains.js +24 -0
- package/dist/error-codes.cjs +390 -0
- package/dist/error-codes.d.cts +633 -0
- package/dist/error-codes.js +32 -0
- package/dist/index.cjs +1762 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.js +198 -0
- package/dist/products.cjs +208 -0
- package/dist/products.d.cts +80 -0
- package/dist/products.js +22 -0
- package/dist/rate-limits.cjs +295 -0
- package/dist/rate-limits.d.cts +80 -0
- package/dist/rate-limits.js +21 -0
- package/dist/themes.cjs +251 -0
- package/dist/themes.d.cts +85 -0
- package/dist/themes.js +14 -0
- package/dist/tiers.cjs +194 -0
- package/dist/tiers.d.cts +75 -0
- package/dist/tiers.js +28 -0
- package/package.json +71 -0
- package/src/api-versions.ts +250 -0
- package/src/capabilities.ts +272 -0
- package/src/domains.ts +216 -0
- package/src/error-codes.ts +494 -0
- package/src/index.ts +206 -0
- package/src/products.ts +285 -0
- package/src/rate-limits.ts +334 -0
- package/src/themes.ts +380 -0
- package/src/tiers.ts +239 -0
- package/tsconfig.json +25 -0
package/src/tiers.ts
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vorionsys/shared-constants - Trust Tiers
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the 8-tier trust model (T0-T7)
|
|
5
|
+
* Used across all Vorion ecosystem products and sites
|
|
6
|
+
*
|
|
7
|
+
* @see https://basis.vorion.org/tiers
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// TRUST TIER ENUM
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
export enum TrustTier {
|
|
15
|
+
T0_SANDBOX = 0,
|
|
16
|
+
T1_OBSERVED = 1,
|
|
17
|
+
T2_PROVISIONAL = 2,
|
|
18
|
+
T3_MONITORED = 3,
|
|
19
|
+
T4_STANDARD = 4,
|
|
20
|
+
T5_TRUSTED = 5,
|
|
21
|
+
T6_CERTIFIED = 6,
|
|
22
|
+
T7_AUTONOMOUS = 7,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// TIER THRESHOLDS - SINGLE SOURCE OF TRUTH
|
|
27
|
+
// =============================================================================
|
|
28
|
+
|
|
29
|
+
export interface TierThreshold {
|
|
30
|
+
readonly min: number;
|
|
31
|
+
readonly max: number;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly description: string;
|
|
34
|
+
readonly color: string;
|
|
35
|
+
readonly textColor: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Official tier thresholds for the BASIS trust model
|
|
40
|
+
* All products MUST use these values for consistency
|
|
41
|
+
*/
|
|
42
|
+
export const TIER_THRESHOLDS: Readonly<Record<TrustTier, TierThreshold>> = {
|
|
43
|
+
[TrustTier.T0_SANDBOX]: {
|
|
44
|
+
min: 0,
|
|
45
|
+
max: 199,
|
|
46
|
+
name: 'Sandbox',
|
|
47
|
+
description: 'Isolated, no external access, observation only',
|
|
48
|
+
color: '#78716c',
|
|
49
|
+
textColor: '#ffffff',
|
|
50
|
+
},
|
|
51
|
+
[TrustTier.T1_OBSERVED]: {
|
|
52
|
+
min: 200,
|
|
53
|
+
max: 349,
|
|
54
|
+
name: 'Observed',
|
|
55
|
+
description: 'Read-only, sandboxed execution, monitored',
|
|
56
|
+
color: '#ef4444',
|
|
57
|
+
textColor: '#ffffff',
|
|
58
|
+
},
|
|
59
|
+
[TrustTier.T2_PROVISIONAL]: {
|
|
60
|
+
min: 350,
|
|
61
|
+
max: 500,
|
|
62
|
+
name: 'Provisional',
|
|
63
|
+
description: 'Basic operations, heavy supervision',
|
|
64
|
+
color: '#f97316',
|
|
65
|
+
textColor: '#ffffff',
|
|
66
|
+
},
|
|
67
|
+
[TrustTier.T3_MONITORED]: {
|
|
68
|
+
min: 501,
|
|
69
|
+
max: 649,
|
|
70
|
+
name: 'Monitored',
|
|
71
|
+
description: 'Standard operations with continuous monitoring',
|
|
72
|
+
color: '#eab308',
|
|
73
|
+
textColor: '#000000',
|
|
74
|
+
},
|
|
75
|
+
[TrustTier.T4_STANDARD]: {
|
|
76
|
+
min: 650,
|
|
77
|
+
max: 799,
|
|
78
|
+
name: 'Standard',
|
|
79
|
+
description: 'External API access, policy-governed',
|
|
80
|
+
color: '#22c55e',
|
|
81
|
+
textColor: '#ffffff',
|
|
82
|
+
},
|
|
83
|
+
[TrustTier.T5_TRUSTED]: {
|
|
84
|
+
min: 800,
|
|
85
|
+
max: 875,
|
|
86
|
+
name: 'Trusted',
|
|
87
|
+
description: 'Cross-agent communication, delegated tasks',
|
|
88
|
+
color: '#3b82f6',
|
|
89
|
+
textColor: '#ffffff',
|
|
90
|
+
},
|
|
91
|
+
[TrustTier.T6_CERTIFIED]: {
|
|
92
|
+
min: 876,
|
|
93
|
+
max: 950,
|
|
94
|
+
name: 'Certified',
|
|
95
|
+
description: 'Admin tasks, agent spawning, minimal oversight',
|
|
96
|
+
color: '#8b5cf6',
|
|
97
|
+
textColor: '#ffffff',
|
|
98
|
+
},
|
|
99
|
+
[TrustTier.T7_AUTONOMOUS]: {
|
|
100
|
+
min: 951,
|
|
101
|
+
max: 1000,
|
|
102
|
+
name: 'Autonomous',
|
|
103
|
+
description: 'Full autonomy, self-governance, strategic only',
|
|
104
|
+
color: '#06b6d4',
|
|
105
|
+
textColor: '#ffffff',
|
|
106
|
+
},
|
|
107
|
+
} as const;
|
|
108
|
+
|
|
109
|
+
// =============================================================================
|
|
110
|
+
// HELPER FUNCTIONS
|
|
111
|
+
// =============================================================================
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Convert a trust score (0-1000) to a trust tier
|
|
115
|
+
*/
|
|
116
|
+
export function scoreToTier(score: number): TrustTier {
|
|
117
|
+
if (score < 0 || score > 1000) {
|
|
118
|
+
throw new Error(`Trust score must be between 0 and 1000, got ${score}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (score >= 951) return TrustTier.T7_AUTONOMOUS;
|
|
122
|
+
if (score >= 876) return TrustTier.T6_CERTIFIED;
|
|
123
|
+
if (score >= 800) return TrustTier.T5_TRUSTED;
|
|
124
|
+
if (score >= 650) return TrustTier.T4_STANDARD;
|
|
125
|
+
if (score >= 501) return TrustTier.T3_MONITORED;
|
|
126
|
+
if (score >= 350) return TrustTier.T2_PROVISIONAL;
|
|
127
|
+
if (score >= 200) return TrustTier.T1_OBSERVED;
|
|
128
|
+
return TrustTier.T0_SANDBOX;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get tier threshold configuration
|
|
133
|
+
*/
|
|
134
|
+
export function getTierThreshold(tier: TrustTier): TierThreshold {
|
|
135
|
+
return TIER_THRESHOLDS[tier];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get human-readable tier name
|
|
140
|
+
*/
|
|
141
|
+
export function getTierName(tier: TrustTier): string {
|
|
142
|
+
return TIER_THRESHOLDS[tier].name;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Get tier display color
|
|
147
|
+
*/
|
|
148
|
+
export function getTierColor(tier: TrustTier): string {
|
|
149
|
+
return TIER_THRESHOLDS[tier].color;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get minimum score required for a tier
|
|
154
|
+
*/
|
|
155
|
+
export function getTierMinScore(tier: TrustTier): number {
|
|
156
|
+
return TIER_THRESHOLDS[tier].min;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get maximum score for a tier
|
|
161
|
+
*/
|
|
162
|
+
export function getTierMaxScore(tier: TrustTier): number {
|
|
163
|
+
return TIER_THRESHOLDS[tier].max;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Check if a score meets the minimum tier requirement
|
|
168
|
+
*/
|
|
169
|
+
export function meetsTierRequirement(score: number, minTier: TrustTier): boolean {
|
|
170
|
+
const actualTier = scoreToTier(score);
|
|
171
|
+
return actualTier >= minTier;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get tier short code (T0, T1, etc.)
|
|
176
|
+
*/
|
|
177
|
+
export function getTierCode(tier: TrustTier): string {
|
|
178
|
+
return `T${tier}`;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Parse tier from string (e.g., "T3", "3", "MONITORED")
|
|
183
|
+
*/
|
|
184
|
+
export function parseTier(input: string): TrustTier | null {
|
|
185
|
+
const normalized = input.toUpperCase().trim();
|
|
186
|
+
|
|
187
|
+
// Try T# format
|
|
188
|
+
const tMatch = normalized.match(/^T?(\d)$/);
|
|
189
|
+
if (tMatch) {
|
|
190
|
+
const num = parseInt(tMatch[1], 10);
|
|
191
|
+
if (num >= 0 && num <= 7) {
|
|
192
|
+
return num as TrustTier;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Try name format
|
|
197
|
+
const nameMap: Record<string, TrustTier> = {
|
|
198
|
+
SANDBOX: TrustTier.T0_SANDBOX,
|
|
199
|
+
OBSERVED: TrustTier.T1_OBSERVED,
|
|
200
|
+
PROVISIONAL: TrustTier.T2_PROVISIONAL,
|
|
201
|
+
MONITORED: TrustTier.T3_MONITORED,
|
|
202
|
+
STANDARD: TrustTier.T4_STANDARD,
|
|
203
|
+
TRUSTED: TrustTier.T5_TRUSTED,
|
|
204
|
+
CERTIFIED: TrustTier.T6_CERTIFIED,
|
|
205
|
+
AUTONOMOUS: TrustTier.T7_AUTONOMOUS,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return nameMap[normalized] ?? null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get all tiers in order
|
|
213
|
+
*/
|
|
214
|
+
export const ALL_TIERS: readonly TrustTier[] = [
|
|
215
|
+
TrustTier.T0_SANDBOX,
|
|
216
|
+
TrustTier.T1_OBSERVED,
|
|
217
|
+
TrustTier.T2_PROVISIONAL,
|
|
218
|
+
TrustTier.T3_MONITORED,
|
|
219
|
+
TrustTier.T4_STANDARD,
|
|
220
|
+
TrustTier.T5_TRUSTED,
|
|
221
|
+
TrustTier.T6_CERTIFIED,
|
|
222
|
+
TrustTier.T7_AUTONOMOUS,
|
|
223
|
+
] as const;
|
|
224
|
+
|
|
225
|
+
// =============================================================================
|
|
226
|
+
// TYPE EXPORTS
|
|
227
|
+
// =============================================================================
|
|
228
|
+
|
|
229
|
+
export type TrustTierName =
|
|
230
|
+
| 'Sandbox'
|
|
231
|
+
| 'Observed'
|
|
232
|
+
| 'Provisional'
|
|
233
|
+
| 'Monitored'
|
|
234
|
+
| 'Standard'
|
|
235
|
+
| 'Trusted'
|
|
236
|
+
| 'Certified'
|
|
237
|
+
| 'Autonomous';
|
|
238
|
+
|
|
239
|
+
export type TrustTierCode = 'T0' | 'T1' | 'T2' | 'T3' | 'T4' | 'T5' | 'T6' | 'T7';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"outDir": "./dist",
|
|
15
|
+
"rootDir": "./src",
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*.ts"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|