@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.
@@ -0,0 +1,80 @@
1
+ import { TrustTier } from './tiers.js';
2
+
3
+ /**
4
+ * @vorionsys/shared-constants - Rate Limits
5
+ *
6
+ * Rate limits by trust tier - used across all APIs
7
+ * Higher trust = higher limits
8
+ *
9
+ * @see https://cognigate.dev/docs/rate-limits
10
+ */
11
+
12
+ interface RateLimitConfig {
13
+ /** Requests per second */
14
+ requestsPerSecond: number;
15
+ /** Requests per minute */
16
+ requestsPerMinute: number;
17
+ /** Requests per hour */
18
+ requestsPerHour: number;
19
+ /** Requests per day */
20
+ requestsPerDay: number;
21
+ /** Burst limit (max concurrent) */
22
+ burstLimit: number;
23
+ /** Max payload size in bytes */
24
+ maxPayloadBytes: number;
25
+ /** Max response size in bytes */
26
+ maxResponseBytes: number;
27
+ /** Connection timeout in ms */
28
+ connectionTimeoutMs: number;
29
+ /** Request timeout in ms */
30
+ requestTimeoutMs: number;
31
+ }
32
+ declare const RATE_LIMITS: Record<TrustTier, RateLimitConfig>;
33
+ /**
34
+ * Get rate limits for a trust tier
35
+ */
36
+ declare function getRateLimits(tier: TrustTier): RateLimitConfig;
37
+ /**
38
+ * Get the minimum tier required for specific rate limits
39
+ */
40
+ declare function getMinTierForLimits(config: {
41
+ requestsPerSecond?: number;
42
+ requestsPerMinute?: number;
43
+ requestsPerHour?: number;
44
+ requestsPerDay?: number;
45
+ }): TrustTier;
46
+ /**
47
+ * Check if a rate limit would be exceeded
48
+ */
49
+ declare function wouldExceedLimit(tier: TrustTier, window: 'second' | 'minute' | 'hour' | 'day', currentCount: number): boolean;
50
+ /**
51
+ * Format rate limit for display
52
+ */
53
+ declare function formatRateLimit(tier: TrustTier): string;
54
+ interface QuotaConfig {
55
+ /** Monthly API calls included */
56
+ monthlyApiCalls: number;
57
+ /** Monthly compute units included */
58
+ monthlyComputeUnits: number;
59
+ /** Monthly storage (bytes) */
60
+ monthlyStorageBytes: number;
61
+ /** Monthly bandwidth (bytes) */
62
+ monthlyBandwidthBytes: number;
63
+ /** Max agents allowed */
64
+ maxAgents: number;
65
+ /** Max webhooks */
66
+ maxWebhooks: number;
67
+ /** Max team members */
68
+ maxTeamMembers: number;
69
+ }
70
+ declare const TIER_QUOTAS: Record<TrustTier, QuotaConfig>;
71
+ /**
72
+ * Get quota for a tier
73
+ */
74
+ declare function getQuota(tier: TrustTier): QuotaConfig;
75
+ /**
76
+ * Check if quota is unlimited (-1)
77
+ */
78
+ declare function isUnlimited(value: number): boolean;
79
+
80
+ export { type QuotaConfig, RATE_LIMITS, type RateLimitConfig, TIER_QUOTAS, formatRateLimit, getMinTierForLimits, getQuota, getRateLimits, isUnlimited, wouldExceedLimit };
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Unified Theme System for the Vorion Ecosystem
3
+ *
4
+ * Controls the visual identity across all three sites:
5
+ * - cognigate.dev (Developer Engine)
6
+ * - agentanchorai.com (Enterprise Platform)
7
+ * - vorion.org (Community / Standard)
8
+ *
9
+ * QUICK SWAP: Change ACTIVE_THEME to switch all sites at once.
10
+ */
11
+ declare const ACTIVE_THEME: ThemeId;
12
+ type ThemeId = 'midnight_cyan' | 'indigo_authority' | 'obsidian_amber' | 'arctic_glass';
13
+ interface ThemeTokens {
14
+ /** Theme display name */
15
+ name: string;
16
+ /** Short description for team review */
17
+ description: string;
18
+ /** Page background */
19
+ bgPrimary: string;
20
+ /** Card / surface background */
21
+ bgSurface: string;
22
+ /** Input / recessed background */
23
+ bgInput: string;
24
+ /** Nav background */
25
+ bgNav: string;
26
+ /** Code block background */
27
+ bgCode: string;
28
+ /** Primary accent (buttons, links, active states) */
29
+ accent: string;
30
+ /** Accent hover state */
31
+ accentHover: string;
32
+ /** Accent at 10% opacity (badges, subtle fills) */
33
+ accentMuted: string;
34
+ /** Accent at 3% opacity (table row hover) */
35
+ accentSubtle: string;
36
+ /** Primary body text */
37
+ textPrimary: string;
38
+ /** Headings */
39
+ textHeading: string;
40
+ /** Secondary/muted text */
41
+ textSecondary: string;
42
+ /** Tertiary/subtle text */
43
+ textTertiary: string;
44
+ /** Card/section borders */
45
+ border: string;
46
+ /** Input borders */
47
+ borderInput: string;
48
+ /** Hover border for interactive cards */
49
+ borderHover: string;
50
+ /** Nav/section divider border (Tailwind opacity format) */
51
+ borderDivider: string;
52
+ /** Hero text gradient start */
53
+ gradientFrom: string;
54
+ /** Hero text gradient end */
55
+ gradientTo: string;
56
+ scrollTrack: string;
57
+ scrollThumb: string;
58
+ scrollThumbHover: string;
59
+ selectionBg: string;
60
+ /** Kept consistent for meaning — these don't change with theme */
61
+ success: string;
62
+ error: string;
63
+ warning: string;
64
+ info: string;
65
+ layerBasis: string;
66
+ layerIntent: string;
67
+ layerEnforce: string;
68
+ layerProof: string;
69
+ fontFamily: string;
70
+ /** Tailwind-compatible font class for Next.js sites */
71
+ fontImport: string;
72
+ /** Whether to apply backdrop-blur to cards */
73
+ cardBlur: boolean;
74
+ /** Button text color (on accent background) */
75
+ buttonText: string;
76
+ }
77
+ declare const THEMES: Record<ThemeId, ThemeTokens>;
78
+ /** Get the currently active theme tokens */
79
+ declare function getActiveTheme(): ThemeTokens;
80
+ /** Get all theme IDs */
81
+ declare function getAllThemeIds(): ThemeId[];
82
+ /** Generate CSS custom properties string from a theme */
83
+ declare function themeToCssVars(themeId?: ThemeId): string;
84
+
85
+ export { ACTIVE_THEME, THEMES, type ThemeId, type ThemeTokens, getActiveTheme, getAllThemeIds, themeToCssVars };
@@ -0,0 +1,75 @@
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
+ declare enum TrustTier {
10
+ T0_SANDBOX = 0,
11
+ T1_OBSERVED = 1,
12
+ T2_PROVISIONAL = 2,
13
+ T3_MONITORED = 3,
14
+ T4_STANDARD = 4,
15
+ T5_TRUSTED = 5,
16
+ T6_CERTIFIED = 6,
17
+ T7_AUTONOMOUS = 7
18
+ }
19
+ interface TierThreshold {
20
+ readonly min: number;
21
+ readonly max: number;
22
+ readonly name: string;
23
+ readonly description: string;
24
+ readonly color: string;
25
+ readonly textColor: string;
26
+ }
27
+ /**
28
+ * Official tier thresholds for the BASIS trust model
29
+ * All products MUST use these values for consistency
30
+ */
31
+ declare const TIER_THRESHOLDS: Readonly<Record<TrustTier, TierThreshold>>;
32
+ /**
33
+ * Convert a trust score (0-1000) to a trust tier
34
+ */
35
+ declare function scoreToTier(score: number): TrustTier;
36
+ /**
37
+ * Get tier threshold configuration
38
+ */
39
+ declare function getTierThreshold(tier: TrustTier): TierThreshold;
40
+ /**
41
+ * Get human-readable tier name
42
+ */
43
+ declare function getTierName(tier: TrustTier): string;
44
+ /**
45
+ * Get tier display color
46
+ */
47
+ declare function getTierColor(tier: TrustTier): string;
48
+ /**
49
+ * Get minimum score required for a tier
50
+ */
51
+ declare function getTierMinScore(tier: TrustTier): number;
52
+ /**
53
+ * Get maximum score for a tier
54
+ */
55
+ declare function getTierMaxScore(tier: TrustTier): number;
56
+ /**
57
+ * Check if a score meets the minimum tier requirement
58
+ */
59
+ declare function meetsTierRequirement(score: number, minTier: TrustTier): boolean;
60
+ /**
61
+ * Get tier short code (T0, T1, etc.)
62
+ */
63
+ declare function getTierCode(tier: TrustTier): string;
64
+ /**
65
+ * Parse tier from string (e.g., "T3", "3", "MONITORED")
66
+ */
67
+ declare function parseTier(input: string): TrustTier | null;
68
+ /**
69
+ * Get all tiers in order
70
+ */
71
+ declare const ALL_TIERS: readonly TrustTier[];
72
+ type TrustTierName = 'Sandbox' | 'Observed' | 'Provisional' | 'Monitored' | 'Standard' | 'Trusted' | 'Certified' | 'Autonomous';
73
+ type TrustTierCode = 'T0' | 'T1' | 'T2' | 'T3' | 'T4' | 'T5' | 'T6' | 'T7';
74
+
75
+ export { ALL_TIERS, TIER_THRESHOLDS, type TierThreshold, TrustTier, type TrustTierCode, type TrustTierName, getTierCode, getTierColor, getTierMaxScore, getTierMinScore, getTierName, getTierThreshold, meetsTierRequirement, parseTier, scoreToTier };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vorionsys/shared-constants",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared constants for Vorion ecosystem - single source of truth for tiers, domains, and configuration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,11 +38,24 @@
38
38
  "./api-versions": {
39
39
  "types": "./dist/api-versions.d.ts",
40
40
  "import": "./dist/api-versions.js"
41
+ },
42
+ "./themes": {
43
+ "types": "./dist/themes.d.ts",
44
+ "import": "./dist/themes.js"
41
45
  }
42
46
  },
47
+ "files": [
48
+ "dist",
49
+ "!dist/**/*.test.*",
50
+ "README.md",
51
+ "CHANGELOG.md",
52
+ "LICENSE"
53
+ ],
43
54
  "scripts": {
44
- "build": "tsup src/*.ts --format esm,cjs --dts",
45
- "dev": "tsup src/*.ts --format esm,cjs --dts --watch",
55
+ "build": "tsup src/index.ts src/tiers.ts src/domains.ts src/capabilities.ts src/products.ts src/rate-limits.ts src/error-codes.ts src/api-versions.ts src/themes.ts --format esm,cjs --dts",
56
+ "dev": "tsup src/index.ts src/tiers.ts src/domains.ts src/capabilities.ts src/products.ts src/rate-limits.ts src/error-codes.ts src/api-versions.ts src/themes.ts --format esm,cjs --dts --watch",
57
+ "test": "vitest run",
58
+ "test:watch": "vitest",
46
59
  "typecheck": "tsc --noEmit"
47
60
  },
48
61
  "keywords": [
@@ -51,19 +64,28 @@
51
64
  "trust",
52
65
  "tiers",
53
66
  "constants",
54
- "shared"
67
+ "shared",
68
+ "ai-governance",
69
+ "agent-trust",
70
+ "cognigate",
71
+ "vorion",
72
+ "trust-tiers",
73
+ "rate-limits",
74
+ "error-codes",
75
+ "capabilities"
55
76
  ],
56
77
  "author": "Vorion <team@vorion.org>",
57
- "license": "MIT",
78
+ "license": "Apache-2.0",
58
79
  "repository": {
59
80
  "type": "git",
60
- "url": "https://github.com/voriongit/vorion.git",
81
+ "url": "git+https://github.com/vorionsys/vorion.git",
61
82
  "directory": "packages/shared-constants"
62
83
  },
63
84
  "homepage": "https://vorion.org",
64
85
  "devDependencies": {
65
- "tsup": "^8.0.0",
66
- "typescript": "^5.7.0"
86
+ "tsup": "^8.5.1",
87
+ "typescript": "^5.9.3",
88
+ "vitest": "4.0.18"
67
89
  },
68
90
  "engines": {
69
91
  "node": ">=18.0.0"
@@ -1,253 +0,0 @@
1
- import {
2
- TrustTier
3
- } from "./chunk-PHL3CB53.js";
4
-
5
- // src/rate-limits.ts
6
- var RATE_LIMITS = {
7
- [0 /* T0_SANDBOX */]: {
8
- requestsPerSecond: 1,
9
- requestsPerMinute: 10,
10
- requestsPerHour: 100,
11
- requestsPerDay: 500,
12
- burstLimit: 2,
13
- maxPayloadBytes: 1024 * 10,
14
- // 10 KB
15
- maxResponseBytes: 1024 * 100,
16
- // 100 KB
17
- connectionTimeoutMs: 5e3,
18
- requestTimeoutMs: 1e4
19
- },
20
- [1 /* T1_OBSERVED */]: {
21
- requestsPerSecond: 2,
22
- requestsPerMinute: 30,
23
- requestsPerHour: 500,
24
- requestsPerDay: 2e3,
25
- burstLimit: 5,
26
- maxPayloadBytes: 1024 * 50,
27
- // 50 KB
28
- maxResponseBytes: 1024 * 500,
29
- // 500 KB
30
- connectionTimeoutMs: 5e3,
31
- requestTimeoutMs: 15e3
32
- },
33
- [2 /* T2_PROVISIONAL */]: {
34
- requestsPerSecond: 5,
35
- requestsPerMinute: 100,
36
- requestsPerHour: 2e3,
37
- requestsPerDay: 1e4,
38
- burstLimit: 10,
39
- maxPayloadBytes: 1024 * 100,
40
- // 100 KB
41
- maxResponseBytes: 1024 * 1024,
42
- // 1 MB
43
- connectionTimeoutMs: 1e4,
44
- requestTimeoutMs: 3e4
45
- },
46
- [3 /* T3_MONITORED */]: {
47
- requestsPerSecond: 10,
48
- requestsPerMinute: 300,
49
- requestsPerHour: 5e3,
50
- requestsPerDay: 5e4,
51
- burstLimit: 20,
52
- maxPayloadBytes: 1024 * 500,
53
- // 500 KB
54
- maxResponseBytes: 1024 * 1024 * 5,
55
- // 5 MB
56
- connectionTimeoutMs: 1e4,
57
- requestTimeoutMs: 6e4
58
- },
59
- [4 /* T4_STANDARD */]: {
60
- requestsPerSecond: 20,
61
- requestsPerMinute: 600,
62
- requestsPerHour: 1e4,
63
- requestsPerDay: 1e5,
64
- burstLimit: 50,
65
- maxPayloadBytes: 1024 * 1024,
66
- // 1 MB
67
- maxResponseBytes: 1024 * 1024 * 10,
68
- // 10 MB
69
- connectionTimeoutMs: 15e3,
70
- requestTimeoutMs: 12e4
71
- },
72
- [5 /* T5_TRUSTED */]: {
73
- requestsPerSecond: 50,
74
- requestsPerMinute: 1500,
75
- requestsPerHour: 3e4,
76
- requestsPerDay: 3e5,
77
- burstLimit: 100,
78
- maxPayloadBytes: 1024 * 1024 * 5,
79
- // 5 MB
80
- maxResponseBytes: 1024 * 1024 * 50,
81
- // 50 MB
82
- connectionTimeoutMs: 3e4,
83
- requestTimeoutMs: 3e5
84
- },
85
- [6 /* T6_CERTIFIED */]: {
86
- requestsPerSecond: 100,
87
- requestsPerMinute: 3e3,
88
- requestsPerHour: 1e5,
89
- requestsPerDay: 1e6,
90
- burstLimit: 200,
91
- maxPayloadBytes: 1024 * 1024 * 10,
92
- // 10 MB
93
- maxResponseBytes: 1024 * 1024 * 100,
94
- // 100 MB
95
- connectionTimeoutMs: 6e4,
96
- requestTimeoutMs: 6e5
97
- },
98
- [7 /* T7_AUTONOMOUS */]: {
99
- requestsPerSecond: 500,
100
- requestsPerMinute: 1e4,
101
- requestsPerHour: 5e5,
102
- requestsPerDay: 5e6,
103
- burstLimit: 500,
104
- maxPayloadBytes: 1024 * 1024 * 50,
105
- // 50 MB
106
- maxResponseBytes: 1024 * 1024 * 500,
107
- // 500 MB
108
- connectionTimeoutMs: 12e4,
109
- requestTimeoutMs: 12e5
110
- }
111
- };
112
- function getRateLimits(tier) {
113
- return RATE_LIMITS[tier];
114
- }
115
- function getMinTierForLimits(config) {
116
- const tiers = Object.values(TrustTier).filter((t) => typeof t === "number");
117
- for (const tier of tiers) {
118
- const limits = RATE_LIMITS[tier];
119
- if ((config.requestsPerSecond === void 0 || limits.requestsPerSecond >= config.requestsPerSecond) && (config.requestsPerMinute === void 0 || limits.requestsPerMinute >= config.requestsPerMinute) && (config.requestsPerHour === void 0 || limits.requestsPerHour >= config.requestsPerHour) && (config.requestsPerDay === void 0 || limits.requestsPerDay >= config.requestsPerDay)) {
120
- return tier;
121
- }
122
- }
123
- return 7 /* T7_AUTONOMOUS */;
124
- }
125
- function wouldExceedLimit(tier, window, currentCount) {
126
- const limits = RATE_LIMITS[tier];
127
- switch (window) {
128
- case "second":
129
- return currentCount >= limits.requestsPerSecond;
130
- case "minute":
131
- return currentCount >= limits.requestsPerMinute;
132
- case "hour":
133
- return currentCount >= limits.requestsPerHour;
134
- case "day":
135
- return currentCount >= limits.requestsPerDay;
136
- }
137
- }
138
- function formatRateLimit(tier) {
139
- const limits = RATE_LIMITS[tier];
140
- return `${limits.requestsPerSecond}/s, ${limits.requestsPerMinute}/min, ${limits.requestsPerHour}/hr`;
141
- }
142
- var TIER_QUOTAS = {
143
- [0 /* T0_SANDBOX */]: {
144
- monthlyApiCalls: 1e3,
145
- monthlyComputeUnits: 100,
146
- monthlyStorageBytes: 1024 * 1024 * 10,
147
- // 10 MB
148
- monthlyBandwidthBytes: 1024 * 1024 * 100,
149
- // 100 MB
150
- maxAgents: 1,
151
- maxWebhooks: 1,
152
- maxTeamMembers: 1
153
- },
154
- [1 /* T1_OBSERVED */]: {
155
- monthlyApiCalls: 1e4,
156
- monthlyComputeUnits: 1e3,
157
- monthlyStorageBytes: 1024 * 1024 * 100,
158
- // 100 MB
159
- monthlyBandwidthBytes: 1024 * 1024 * 1024,
160
- // 1 GB
161
- maxAgents: 5,
162
- maxWebhooks: 5,
163
- maxTeamMembers: 3
164
- },
165
- [2 /* T2_PROVISIONAL */]: {
166
- monthlyApiCalls: 5e4,
167
- monthlyComputeUnits: 5e3,
168
- monthlyStorageBytes: 1024 * 1024 * 500,
169
- // 500 MB
170
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 5,
171
- // 5 GB
172
- maxAgents: 10,
173
- maxWebhooks: 10,
174
- maxTeamMembers: 5
175
- },
176
- [3 /* T3_MONITORED */]: {
177
- monthlyApiCalls: 25e4,
178
- monthlyComputeUnits: 25e3,
179
- monthlyStorageBytes: 1024 * 1024 * 1024 * 2,
180
- // 2 GB
181
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 25,
182
- // 25 GB
183
- maxAgents: 50,
184
- maxWebhooks: 25,
185
- maxTeamMembers: 10
186
- },
187
- [4 /* T4_STANDARD */]: {
188
- monthlyApiCalls: 1e6,
189
- monthlyComputeUnits: 1e5,
190
- monthlyStorageBytes: 1024 * 1024 * 1024 * 10,
191
- // 10 GB
192
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 100,
193
- // 100 GB
194
- maxAgents: 200,
195
- maxWebhooks: 50,
196
- maxTeamMembers: 25
197
- },
198
- [5 /* T5_TRUSTED */]: {
199
- monthlyApiCalls: 5e6,
200
- monthlyComputeUnits: 5e5,
201
- monthlyStorageBytes: 1024 * 1024 * 1024 * 50,
202
- // 50 GB
203
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 500,
204
- // 500 GB
205
- maxAgents: 1e3,
206
- maxWebhooks: 100,
207
- maxTeamMembers: 50
208
- },
209
- [6 /* T6_CERTIFIED */]: {
210
- monthlyApiCalls: 25e6,
211
- monthlyComputeUnits: 25e5,
212
- monthlyStorageBytes: 1024 * 1024 * 1024 * 250,
213
- // 250 GB
214
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 2500,
215
- // 2.5 TB
216
- maxAgents: 5e3,
217
- maxWebhooks: 250,
218
- maxTeamMembers: 100
219
- },
220
- [7 /* T7_AUTONOMOUS */]: {
221
- monthlyApiCalls: -1,
222
- // Unlimited
223
- monthlyComputeUnits: -1,
224
- // Unlimited
225
- monthlyStorageBytes: 1024 * 1024 * 1024 * 1024,
226
- // 1 TB
227
- monthlyBandwidthBytes: 1024 * 1024 * 1024 * 1e4,
228
- // 10 TB
229
- maxAgents: -1,
230
- // Unlimited
231
- maxWebhooks: -1,
232
- // Unlimited
233
- maxTeamMembers: -1
234
- // Unlimited
235
- }
236
- };
237
- function getQuota(tier) {
238
- return TIER_QUOTAS[tier];
239
- }
240
- function isUnlimited(value) {
241
- return value === -1;
242
- }
243
-
244
- export {
245
- RATE_LIMITS,
246
- getRateLimits,
247
- getMinTierForLimits,
248
- wouldExceedLimit,
249
- formatRateLimit,
250
- TIER_QUOTAS,
251
- getQuota,
252
- isUnlimited
253
- };