@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.
Files changed (46) hide show
  1. package/dist/api-versions.cjs +183 -0
  2. package/dist/api-versions.d.cts +91 -0
  3. package/dist/api-versions.js +46 -0
  4. package/dist/capabilities.cjs +246 -0
  5. package/dist/capabilities.d.cts +55 -0
  6. package/dist/capabilities.js +21 -0
  7. package/dist/chunk-F2R6HBF5.js +253 -0
  8. package/dist/chunk-IKLCEYZT.js +142 -0
  9. package/dist/chunk-JZJPDGG7.js +215 -0
  10. package/dist/chunk-P3VPMVF3.js +223 -0
  11. package/dist/chunk-PHL3CB53.js +159 -0
  12. package/dist/chunk-RZQZEF6Q.js +176 -0
  13. package/dist/chunk-TYCMBQGU.js +353 -0
  14. package/dist/chunk-UDCZKJSQ.js +139 -0
  15. package/dist/domains.cjs +175 -0
  16. package/dist/domains.d.cts +250 -0
  17. package/dist/domains.js +24 -0
  18. package/dist/error-codes.cjs +390 -0
  19. package/dist/error-codes.d.cts +633 -0
  20. package/dist/error-codes.js +32 -0
  21. package/dist/index.cjs +1762 -0
  22. package/dist/index.d.cts +54 -0
  23. package/dist/index.js +198 -0
  24. package/dist/products.cjs +208 -0
  25. package/dist/products.d.cts +80 -0
  26. package/dist/products.js +22 -0
  27. package/dist/rate-limits.cjs +295 -0
  28. package/dist/rate-limits.d.cts +80 -0
  29. package/dist/rate-limits.js +21 -0
  30. package/dist/themes.cjs +251 -0
  31. package/dist/themes.d.cts +85 -0
  32. package/dist/themes.js +14 -0
  33. package/dist/tiers.cjs +194 -0
  34. package/dist/tiers.d.cts +75 -0
  35. package/dist/tiers.js +28 -0
  36. package/package.json +71 -0
  37. package/src/api-versions.ts +250 -0
  38. package/src/capabilities.ts +272 -0
  39. package/src/domains.ts +216 -0
  40. package/src/error-codes.ts +494 -0
  41. package/src/index.ts +206 -0
  42. package/src/products.ts +285 -0
  43. package/src/rate-limits.ts +334 -0
  44. package/src/themes.ts +380 -0
  45. package/src/tiers.ts +239 -0
  46. package/tsconfig.json +25 -0
@@ -0,0 +1,250 @@
1
+ /**
2
+ * @vorionsys/shared-constants - Domain Configuration
3
+ *
4
+ * Single source of truth for all Vorion ecosystem domains and URLs
5
+ * Used across all products and sites for consistent linking
6
+ *
7
+ * @see https://vorion.org
8
+ */
9
+ declare const VORION_DOMAINS: {
10
+ /** Main Vorion organization site */
11
+ readonly main: "https://vorion.org";
12
+ /** BASIS specification and documentation */
13
+ readonly basis: "https://basis.vorion.org";
14
+ /** CAR ID specification */
15
+ readonly carId: "https://carid.vorion.org";
16
+ /** ATSF (Agent Trust & Safety Framework) */
17
+ readonly atsf: "https://atsf.vorion.org";
18
+ /** Learning and educational resources (primary) */
19
+ readonly learn: "https://learn.vorion.org";
20
+ /** Kaizen - Interactive AI Learning Experience (mirrors learn) */
21
+ readonly kaizen: "https://kaizen.vorion.org";
22
+ /** Technical documentation */
23
+ readonly docs: "https://docs.vorion.org";
24
+ /** Community forum */
25
+ readonly community: "https://community.vorion.org";
26
+ };
27
+ /**
28
+ * Domain aliases - maps alternate domains to primary
29
+ * Used for domain detection and routing
30
+ */
31
+ declare const DOMAIN_ALIASES: {
32
+ readonly 'kaizen.vorion.org': "learn.vorion.org";
33
+ };
34
+ declare const AGENTANCHOR_DOMAINS: {
35
+ /** Main Agent Anchor AI site */
36
+ readonly main: "https://agentanchorai.com";
37
+ /** Agent Anchor Trust - Trust verification and certification */
38
+ readonly trust: "https://trust.agentanchorai.com";
39
+ /** Agent Anchor Logic - Policy engine and governance logic */
40
+ readonly logic: "https://logic.agentanchorai.com";
41
+ /** Status page */
42
+ readonly status: "https://status.agentanchorai.com";
43
+ };
44
+ declare const COGNIGATE_DOMAINS: {
45
+ /** Cognigate main site and documentation */
46
+ readonly main: "https://cognigate.dev";
47
+ /** Cognigate API documentation */
48
+ readonly docs: "https://cognigate.dev/docs";
49
+ };
50
+ declare const API_ENDPOINTS: {
51
+ /** Cognigate Production API */
52
+ readonly cognigate: {
53
+ readonly production: "https://cognigate.dev/v1";
54
+ readonly staging: "https://staging.cognigate.dev/v1";
55
+ };
56
+ /** Agent Anchor AI Production API */
57
+ readonly agentAnchor: {
58
+ readonly production: "https://api.agentanchorai.com/v1";
59
+ readonly staging: "https://staging-api.agentanchorai.com/v1";
60
+ readonly sandbox: "https://sandbox.agentanchorai.com/v1";
61
+ };
62
+ /** Trust API */
63
+ readonly trust: {
64
+ readonly production: "https://trust.agentanchorai.com/v1";
65
+ readonly staging: "https://staging.trust.agentanchorai.com/v1";
66
+ };
67
+ /** Logic/Policy API */
68
+ readonly logic: {
69
+ readonly production: "https://logic.agentanchorai.com/v1";
70
+ readonly staging: "https://staging.logic.agentanchorai.com/v1";
71
+ };
72
+ };
73
+ declare const VORION_EMAILS: {
74
+ /** General inquiries */
75
+ readonly info: "info@vorion.org";
76
+ /** Security reports */
77
+ readonly security: "security@vorion.org";
78
+ /** Legal inquiries */
79
+ readonly legal: "legal@vorion.org";
80
+ /** Community and contributions */
81
+ readonly community: "community@vorion.org";
82
+ /** Contributing */
83
+ readonly contribute: "contribute@vorion.org";
84
+ };
85
+ declare const AGENTANCHOR_EMAILS: {
86
+ /** General support */
87
+ readonly support: "support@agentanchorai.com";
88
+ /** Sales inquiries */
89
+ readonly sales: "sales@agentanchorai.com";
90
+ /** Partner program */
91
+ readonly partners: "partners@agentanchorai.com";
92
+ /** API support */
93
+ readonly apiSupport: "api-support@agentanchorai.com";
94
+ /** Enterprise inquiries */
95
+ readonly enterprise: "enterprise@agentanchorai.com";
96
+ /** Compliance */
97
+ readonly compliance: "compliance@agentanchorai.com";
98
+ /** Team */
99
+ readonly team: "team@agentanchorai.com";
100
+ };
101
+ declare const GITHUB: {
102
+ /** Vorion organization */
103
+ readonly vorion: {
104
+ readonly org: "https://github.com/voriongit";
105
+ readonly mainRepo: "https://github.com/voriongit/vorion";
106
+ };
107
+ /** Agent Anchor AI (if separate) */
108
+ readonly agentAnchor: {
109
+ readonly org: "https://github.com/agentanchorai";
110
+ };
111
+ };
112
+ declare const NPM_PACKAGES: {
113
+ /** Open source packages (@vorionsys) */
114
+ readonly vorion: {
115
+ readonly basis: "@vorionsys/basis";
116
+ readonly contracts: "@vorionsys/contracts";
117
+ readonly carSpec: "@vorionsys/car-spec";
118
+ readonly atsfCore: "@vorionsys/atsf-core";
119
+ readonly cognigate: "@vorionsys/cognigate";
120
+ readonly sharedConstants: "@vorionsys/shared-constants";
121
+ };
122
+ /** Commercial packages (@agentanchor) */
123
+ readonly agentAnchor: {
124
+ readonly sdk: "@agentanchor/sdk";
125
+ readonly trust: "@agentanchor/trust";
126
+ readonly logic: "@agentanchor/logic";
127
+ };
128
+ };
129
+ declare const ALL_DOMAINS: {
130
+ readonly vorion: {
131
+ /** Main Vorion organization site */
132
+ readonly main: "https://vorion.org";
133
+ /** BASIS specification and documentation */
134
+ readonly basis: "https://basis.vorion.org";
135
+ /** CAR ID specification */
136
+ readonly carId: "https://carid.vorion.org";
137
+ /** ATSF (Agent Trust & Safety Framework) */
138
+ readonly atsf: "https://atsf.vorion.org";
139
+ /** Learning and educational resources (primary) */
140
+ readonly learn: "https://learn.vorion.org";
141
+ /** Kaizen - Interactive AI Learning Experience (mirrors learn) */
142
+ readonly kaizen: "https://kaizen.vorion.org";
143
+ /** Technical documentation */
144
+ readonly docs: "https://docs.vorion.org";
145
+ /** Community forum */
146
+ readonly community: "https://community.vorion.org";
147
+ };
148
+ readonly agentAnchor: {
149
+ /** Main Agent Anchor AI site */
150
+ readonly main: "https://agentanchorai.com";
151
+ /** Agent Anchor Trust - Trust verification and certification */
152
+ readonly trust: "https://trust.agentanchorai.com";
153
+ /** Agent Anchor Logic - Policy engine and governance logic */
154
+ readonly logic: "https://logic.agentanchorai.com";
155
+ /** Status page */
156
+ readonly status: "https://status.agentanchorai.com";
157
+ };
158
+ readonly cognigate: {
159
+ /** Cognigate main site and documentation */
160
+ readonly main: "https://cognigate.dev";
161
+ /** Cognigate API documentation */
162
+ readonly docs: "https://cognigate.dev/docs";
163
+ };
164
+ readonly api: {
165
+ /** Cognigate Production API */
166
+ readonly cognigate: {
167
+ readonly production: "https://cognigate.dev/v1";
168
+ readonly staging: "https://staging.cognigate.dev/v1";
169
+ };
170
+ /** Agent Anchor AI Production API */
171
+ readonly agentAnchor: {
172
+ readonly production: "https://api.agentanchorai.com/v1";
173
+ readonly staging: "https://staging-api.agentanchorai.com/v1";
174
+ readonly sandbox: "https://sandbox.agentanchorai.com/v1";
175
+ };
176
+ /** Trust API */
177
+ readonly trust: {
178
+ readonly production: "https://trust.agentanchorai.com/v1";
179
+ readonly staging: "https://staging.trust.agentanchorai.com/v1";
180
+ };
181
+ /** Logic/Policy API */
182
+ readonly logic: {
183
+ readonly production: "https://logic.agentanchorai.com/v1";
184
+ readonly staging: "https://staging.logic.agentanchorai.com/v1";
185
+ };
186
+ };
187
+ readonly emails: {
188
+ readonly vorion: {
189
+ /** General inquiries */
190
+ readonly info: "info@vorion.org";
191
+ /** Security reports */
192
+ readonly security: "security@vorion.org";
193
+ /** Legal inquiries */
194
+ readonly legal: "legal@vorion.org";
195
+ /** Community and contributions */
196
+ readonly community: "community@vorion.org";
197
+ /** Contributing */
198
+ readonly contribute: "contribute@vorion.org";
199
+ };
200
+ readonly agentAnchor: {
201
+ /** General support */
202
+ readonly support: "support@agentanchorai.com";
203
+ /** Sales inquiries */
204
+ readonly sales: "sales@agentanchorai.com";
205
+ /** Partner program */
206
+ readonly partners: "partners@agentanchorai.com";
207
+ /** API support */
208
+ readonly apiSupport: "api-support@agentanchorai.com";
209
+ /** Enterprise inquiries */
210
+ readonly enterprise: "enterprise@agentanchorai.com";
211
+ /** Compliance */
212
+ readonly compliance: "compliance@agentanchorai.com";
213
+ /** Team */
214
+ readonly team: "team@agentanchorai.com";
215
+ };
216
+ };
217
+ readonly github: {
218
+ /** Vorion organization */
219
+ readonly vorion: {
220
+ readonly org: "https://github.com/voriongit";
221
+ readonly mainRepo: "https://github.com/voriongit/vorion";
222
+ };
223
+ /** Agent Anchor AI (if separate) */
224
+ readonly agentAnchor: {
225
+ readonly org: "https://github.com/agentanchorai";
226
+ };
227
+ };
228
+ readonly npm: {
229
+ /** Open source packages (@vorionsys) */
230
+ readonly vorion: {
231
+ readonly basis: "@vorionsys/basis";
232
+ readonly contracts: "@vorionsys/contracts";
233
+ readonly carSpec: "@vorionsys/car-spec";
234
+ readonly atsfCore: "@vorionsys/atsf-core";
235
+ readonly cognigate: "@vorionsys/cognigate";
236
+ readonly sharedConstants: "@vorionsys/shared-constants";
237
+ };
238
+ /** Commercial packages (@agentanchor) */
239
+ readonly agentAnchor: {
240
+ readonly sdk: "@agentanchor/sdk";
241
+ readonly trust: "@agentanchor/trust";
242
+ readonly logic: "@agentanchor/logic";
243
+ };
244
+ };
245
+ };
246
+ type VorionDomain = keyof typeof VORION_DOMAINS;
247
+ type AgentAnchorDomain = keyof typeof AGENTANCHOR_DOMAINS;
248
+ type CognigateDomain = keyof typeof COGNIGATE_DOMAINS;
249
+
250
+ export { AGENTANCHOR_DOMAINS, AGENTANCHOR_EMAILS, ALL_DOMAINS, API_ENDPOINTS, type AgentAnchorDomain, COGNIGATE_DOMAINS, type CognigateDomain, DOMAIN_ALIASES, GITHUB, NPM_PACKAGES, VORION_DOMAINS, VORION_EMAILS, type VorionDomain };
@@ -0,0 +1,24 @@
1
+ import {
2
+ AGENTANCHOR_DOMAINS,
3
+ AGENTANCHOR_EMAILS,
4
+ ALL_DOMAINS,
5
+ API_ENDPOINTS,
6
+ COGNIGATE_DOMAINS,
7
+ DOMAIN_ALIASES,
8
+ GITHUB,
9
+ NPM_PACKAGES,
10
+ VORION_DOMAINS,
11
+ VORION_EMAILS
12
+ } from "./chunk-IKLCEYZT.js";
13
+ export {
14
+ AGENTANCHOR_DOMAINS,
15
+ AGENTANCHOR_EMAILS,
16
+ ALL_DOMAINS,
17
+ API_ENDPOINTS,
18
+ COGNIGATE_DOMAINS,
19
+ DOMAIN_ALIASES,
20
+ GITHUB,
21
+ NPM_PACKAGES,
22
+ VORION_DOMAINS,
23
+ VORION_EMAILS
24
+ };
@@ -0,0 +1,390 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/error-codes.ts
21
+ var error_codes_exports = {};
22
+ __export(error_codes_exports, {
23
+ AUTH_ERRORS: () => AUTH_ERRORS,
24
+ ERROR_CODES: () => ERROR_CODES,
25
+ EXTERNAL_ERRORS: () => EXTERNAL_ERRORS,
26
+ ErrorCategory: () => ErrorCategory,
27
+ NOT_FOUND_ERRORS: () => NOT_FOUND_ERRORS,
28
+ RATE_LIMIT_ERRORS: () => RATE_LIMIT_ERRORS,
29
+ SERVER_ERRORS: () => SERVER_ERRORS,
30
+ TRUST_ERRORS: () => TRUST_ERRORS,
31
+ VALIDATION_ERRORS: () => VALIDATION_ERRORS,
32
+ createErrorResponse: () => createErrorResponse,
33
+ formatErrorMessage: () => formatErrorMessage,
34
+ getErrorByCode: () => getErrorByCode,
35
+ getErrorsByCategory: () => getErrorsByCategory,
36
+ getRetryableErrors: () => getRetryableErrors
37
+ });
38
+ module.exports = __toCommonJS(error_codes_exports);
39
+ var ErrorCategory = /* @__PURE__ */ ((ErrorCategory2) => {
40
+ ErrorCategory2["AUTH"] = "auth";
41
+ ErrorCategory2["VALIDATION"] = "validation";
42
+ ErrorCategory2["RATE_LIMIT"] = "rate_limit";
43
+ ErrorCategory2["NOT_FOUND"] = "not_found";
44
+ ErrorCategory2["TRUST"] = "trust";
45
+ ErrorCategory2["SERVER"] = "server";
46
+ ErrorCategory2["EXTERNAL"] = "external";
47
+ ErrorCategory2["CONFIG"] = "config";
48
+ return ErrorCategory2;
49
+ })(ErrorCategory || {});
50
+ var AUTH_ERRORS = {
51
+ MISSING_API_KEY: {
52
+ code: "E1001",
53
+ httpStatus: 401,
54
+ category: "auth" /* AUTH */,
55
+ message: "API key is missing. Include it in the Authorization header.",
56
+ retryable: false,
57
+ docsUrl: "https://cognigate.dev/docs/authentication"
58
+ },
59
+ INVALID_API_KEY: {
60
+ code: "E1002",
61
+ httpStatus: 401,
62
+ category: "auth" /* AUTH */,
63
+ message: "API key is invalid or has been revoked.",
64
+ retryable: false,
65
+ docsUrl: "https://cognigate.dev/docs/authentication"
66
+ },
67
+ EXPIRED_API_KEY: {
68
+ code: "E1003",
69
+ httpStatus: 401,
70
+ category: "auth" /* AUTH */,
71
+ message: "API key has expired. Generate a new key.",
72
+ retryable: false,
73
+ docsUrl: "https://cognigate.dev/docs/authentication"
74
+ },
75
+ INSUFFICIENT_PERMISSIONS: {
76
+ code: "E1004",
77
+ httpStatus: 403,
78
+ category: "auth" /* AUTH */,
79
+ message: "Insufficient permissions for this operation.",
80
+ retryable: false
81
+ },
82
+ AGENT_NOT_AUTHORIZED: {
83
+ code: "E1005",
84
+ httpStatus: 403,
85
+ category: "auth" /* AUTH */,
86
+ message: "Agent is not authorized for this action.",
87
+ retryable: false
88
+ },
89
+ TOKEN_EXPIRED: {
90
+ code: "E1006",
91
+ httpStatus: 401,
92
+ category: "auth" /* AUTH */,
93
+ message: "Authentication token has expired.",
94
+ retryable: false
95
+ },
96
+ MFA_REQUIRED: {
97
+ code: "E1007",
98
+ httpStatus: 403,
99
+ category: "auth" /* AUTH */,
100
+ message: "Multi-factor authentication is required for this operation.",
101
+ retryable: false
102
+ }
103
+ };
104
+ var VALIDATION_ERRORS = {
105
+ INVALID_REQUEST: {
106
+ code: "E2001",
107
+ httpStatus: 400,
108
+ category: "validation" /* VALIDATION */,
109
+ message: "Request body is invalid or malformed.",
110
+ retryable: false
111
+ },
112
+ MISSING_REQUIRED_FIELD: {
113
+ code: "E2002",
114
+ httpStatus: 400,
115
+ category: "validation" /* VALIDATION */,
116
+ message: "Required field is missing: {field}",
117
+ retryable: false
118
+ },
119
+ INVALID_FIELD_TYPE: {
120
+ code: "E2003",
121
+ httpStatus: 400,
122
+ category: "validation" /* VALIDATION */,
123
+ message: "Field {field} has invalid type. Expected {expected}.",
124
+ retryable: false
125
+ },
126
+ INVALID_FIELD_VALUE: {
127
+ code: "E2004",
128
+ httpStatus: 400,
129
+ category: "validation" /* VALIDATION */,
130
+ message: "Field {field} has invalid value.",
131
+ retryable: false
132
+ },
133
+ PAYLOAD_TOO_LARGE: {
134
+ code: "E2005",
135
+ httpStatus: 413,
136
+ category: "validation" /* VALIDATION */,
137
+ message: "Request payload exceeds maximum size of {maxSize}.",
138
+ retryable: false
139
+ },
140
+ INVALID_JSON: {
141
+ code: "E2006",
142
+ httpStatus: 400,
143
+ category: "validation" /* VALIDATION */,
144
+ message: "Request body is not valid JSON.",
145
+ retryable: false
146
+ },
147
+ INVALID_CAR_ID: {
148
+ code: "E2007",
149
+ httpStatus: 400,
150
+ category: "validation" /* VALIDATION */,
151
+ message: "Invalid CAR ID format. Expected: car:domain/category/name:version",
152
+ retryable: false,
153
+ docsUrl: "https://carid.vorion.org/format"
154
+ },
155
+ INVALID_TRUST_SCORE: {
156
+ code: "E2008",
157
+ httpStatus: 400,
158
+ category: "validation" /* VALIDATION */,
159
+ message: "Trust score must be between 0 and 1000.",
160
+ retryable: false
161
+ }
162
+ };
163
+ var RATE_LIMIT_ERRORS = {
164
+ RATE_LIMIT_EXCEEDED: {
165
+ code: "E3001",
166
+ httpStatus: 429,
167
+ category: "rate_limit" /* RATE_LIMIT */,
168
+ message: "Rate limit exceeded. Retry after {retryAfter} seconds.",
169
+ retryable: true
170
+ },
171
+ QUOTA_EXCEEDED: {
172
+ code: "E3002",
173
+ httpStatus: 429,
174
+ category: "rate_limit" /* RATE_LIMIT */,
175
+ message: "Monthly quota exceeded. Upgrade your tier or wait for reset.",
176
+ retryable: false
177
+ },
178
+ CONCURRENT_LIMIT: {
179
+ code: "E3003",
180
+ httpStatus: 429,
181
+ category: "rate_limit" /* RATE_LIMIT */,
182
+ message: "Too many concurrent requests. Max burst: {burstLimit}.",
183
+ retryable: true
184
+ },
185
+ DAILY_LIMIT_EXCEEDED: {
186
+ code: "E3004",
187
+ httpStatus: 429,
188
+ category: "rate_limit" /* RATE_LIMIT */,
189
+ message: "Daily request limit exceeded. Resets at midnight UTC.",
190
+ retryable: true
191
+ }
192
+ };
193
+ var NOT_FOUND_ERRORS = {
194
+ RESOURCE_NOT_FOUND: {
195
+ code: "E4001",
196
+ httpStatus: 404,
197
+ category: "not_found" /* NOT_FOUND */,
198
+ message: "Resource not found: {resourceType}/{resourceId}",
199
+ retryable: false
200
+ },
201
+ AGENT_NOT_FOUND: {
202
+ code: "E4002",
203
+ httpStatus: 404,
204
+ category: "not_found" /* NOT_FOUND */,
205
+ message: "Agent not found: {agentId}",
206
+ retryable: false
207
+ },
208
+ PROOF_NOT_FOUND: {
209
+ code: "E4003",
210
+ httpStatus: 404,
211
+ category: "not_found" /* NOT_FOUND */,
212
+ message: "Proof not found: {proofId}",
213
+ retryable: false
214
+ },
215
+ ENDPOINT_NOT_FOUND: {
216
+ code: "E4004",
217
+ httpStatus: 404,
218
+ category: "not_found" /* NOT_FOUND */,
219
+ message: "API endpoint not found.",
220
+ retryable: false
221
+ },
222
+ ATTESTATION_NOT_FOUND: {
223
+ code: "E4005",
224
+ httpStatus: 404,
225
+ category: "not_found" /* NOT_FOUND */,
226
+ message: "Attestation not found: {attestationId}",
227
+ retryable: false
228
+ }
229
+ };
230
+ var TRUST_ERRORS = {
231
+ TRUST_TIER_INSUFFICIENT: {
232
+ code: "E5001",
233
+ httpStatus: 403,
234
+ category: "trust" /* TRUST */,
235
+ message: "Trust tier {currentTier} insufficient. Required: {requiredTier}.",
236
+ retryable: false,
237
+ docsUrl: "https://basis.vorion.org/tiers"
238
+ },
239
+ CAPABILITY_NOT_AVAILABLE: {
240
+ code: "E5002",
241
+ httpStatus: 403,
242
+ category: "trust" /* TRUST */,
243
+ message: "Capability {capability} not available at tier {tier}.",
244
+ retryable: false,
245
+ docsUrl: "https://cognigate.dev/docs/capabilities"
246
+ },
247
+ GOVERNANCE_DENIED: {
248
+ code: "E5003",
249
+ httpStatus: 403,
250
+ category: "trust" /* TRUST */,
251
+ message: "Action denied by governance policy: {reason}.",
252
+ retryable: false
253
+ },
254
+ AGENT_SUSPENDED: {
255
+ code: "E5004",
256
+ httpStatus: 403,
257
+ category: "trust" /* TRUST */,
258
+ message: "Agent is suspended. Contact support for reinstatement.",
259
+ retryable: false
260
+ },
261
+ PROOF_VERIFICATION_FAILED: {
262
+ code: "E5005",
263
+ httpStatus: 400,
264
+ category: "trust" /* TRUST */,
265
+ message: "Proof verification failed: {reason}.",
266
+ retryable: false
267
+ },
268
+ ATTESTATION_INVALID: {
269
+ code: "E5006",
270
+ httpStatus: 400,
271
+ category: "trust" /* TRUST */,
272
+ message: "Attestation is invalid or has expired.",
273
+ retryable: false
274
+ },
275
+ ESCALATION_REQUIRED: {
276
+ code: "E5007",
277
+ httpStatus: 403,
278
+ category: "trust" /* TRUST */,
279
+ message: "Action requires human approval. Escalation ID: {escalationId}.",
280
+ retryable: false
281
+ }
282
+ };
283
+ var SERVER_ERRORS = {
284
+ INTERNAL_ERROR: {
285
+ code: "E6001",
286
+ httpStatus: 500,
287
+ category: "server" /* SERVER */,
288
+ message: "An internal error occurred. Please try again later.",
289
+ retryable: true
290
+ },
291
+ SERVICE_UNAVAILABLE: {
292
+ code: "E6002",
293
+ httpStatus: 503,
294
+ category: "server" /* SERVER */,
295
+ message: "Service is temporarily unavailable. Please try again later.",
296
+ retryable: true
297
+ },
298
+ DATABASE_ERROR: {
299
+ code: "E6003",
300
+ httpStatus: 500,
301
+ category: "server" /* SERVER */,
302
+ message: "Database operation failed. Please try again later.",
303
+ retryable: true
304
+ },
305
+ MAINTENANCE_MODE: {
306
+ code: "E6004",
307
+ httpStatus: 503,
308
+ category: "server" /* SERVER */,
309
+ message: "Service is under maintenance. Expected completion: {eta}.",
310
+ retryable: true
311
+ }
312
+ };
313
+ var EXTERNAL_ERRORS = {
314
+ BLOCKCHAIN_ERROR: {
315
+ code: "E7001",
316
+ httpStatus: 502,
317
+ category: "external" /* EXTERNAL */,
318
+ message: "Blockchain network error. Please try again later.",
319
+ retryable: true
320
+ },
321
+ UPSTREAM_TIMEOUT: {
322
+ code: "E7002",
323
+ httpStatus: 504,
324
+ category: "external" /* EXTERNAL */,
325
+ message: "Upstream service timed out.",
326
+ retryable: true
327
+ },
328
+ EXTERNAL_SERVICE_ERROR: {
329
+ code: "E7003",
330
+ httpStatus: 502,
331
+ category: "external" /* EXTERNAL */,
332
+ message: "External service error: {service}.",
333
+ retryable: true
334
+ }
335
+ };
336
+ var ERROR_CODES = {
337
+ ...AUTH_ERRORS,
338
+ ...VALIDATION_ERRORS,
339
+ ...RATE_LIMIT_ERRORS,
340
+ ...NOT_FOUND_ERRORS,
341
+ ...TRUST_ERRORS,
342
+ ...SERVER_ERRORS,
343
+ ...EXTERNAL_ERRORS
344
+ };
345
+ function getErrorByCode(code) {
346
+ return Object.values(ERROR_CODES).find((e) => e.code === code);
347
+ }
348
+ function getErrorsByCategory(category) {
349
+ return Object.values(ERROR_CODES).filter((e) => e.category === category);
350
+ }
351
+ function getRetryableErrors() {
352
+ return Object.values(ERROR_CODES).filter((e) => e.retryable);
353
+ }
354
+ function formatErrorMessage(error, params) {
355
+ let message = error.message;
356
+ for (const [key, value] of Object.entries(params)) {
357
+ message = message.replace(`{${key}}`, String(value));
358
+ }
359
+ return message;
360
+ }
361
+ function createErrorResponse(error, params, requestId) {
362
+ return {
363
+ error: {
364
+ code: error.code,
365
+ message: params ? formatErrorMessage(error, params) : error.message,
366
+ category: error.category,
367
+ retryable: error.retryable,
368
+ ...error.docsUrl && { docsUrl: error.docsUrl },
369
+ ...requestId && { requestId }
370
+ },
371
+ status: error.httpStatus
372
+ };
373
+ }
374
+ // Annotate the CommonJS export names for ESM import in node:
375
+ 0 && (module.exports = {
376
+ AUTH_ERRORS,
377
+ ERROR_CODES,
378
+ EXTERNAL_ERRORS,
379
+ ErrorCategory,
380
+ NOT_FOUND_ERRORS,
381
+ RATE_LIMIT_ERRORS,
382
+ SERVER_ERRORS,
383
+ TRUST_ERRORS,
384
+ VALIDATION_ERRORS,
385
+ createErrorResponse,
386
+ formatErrorMessage,
387
+ getErrorByCode,
388
+ getErrorsByCategory,
389
+ getRetryableErrors
390
+ });