@vorionsys/contracts 0.1.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 (173) hide show
  1. package/dist/aci/aci-string.d.ts +539 -0
  2. package/dist/aci/aci-string.d.ts.map +1 -0
  3. package/dist/aci/aci-string.js +563 -0
  4. package/dist/aci/aci-string.js.map +1 -0
  5. package/dist/aci/attestation.d.ts +648 -0
  6. package/dist/aci/attestation.d.ts.map +1 -0
  7. package/dist/aci/attestation.js +289 -0
  8. package/dist/aci/attestation.js.map +1 -0
  9. package/dist/aci/domains.d.ts +260 -0
  10. package/dist/aci/domains.d.ts.map +1 -0
  11. package/dist/aci/domains.js +322 -0
  12. package/dist/aci/domains.js.map +1 -0
  13. package/dist/aci/effective-permission.d.ts +371 -0
  14. package/dist/aci/effective-permission.d.ts.map +1 -0
  15. package/dist/aci/effective-permission.js +351 -0
  16. package/dist/aci/effective-permission.js.map +1 -0
  17. package/dist/aci/identity.d.ts +1100 -0
  18. package/dist/aci/identity.d.ts.map +1 -0
  19. package/dist/aci/identity.js +328 -0
  20. package/dist/aci/identity.js.map +1 -0
  21. package/dist/aci/index.d.ts +67 -0
  22. package/dist/aci/index.d.ts.map +1 -0
  23. package/dist/aci/index.js +157 -0
  24. package/dist/aci/index.js.map +1 -0
  25. package/dist/aci/jwt-claims.d.ts +756 -0
  26. package/dist/aci/jwt-claims.d.ts.map +1 -0
  27. package/dist/aci/jwt-claims.js +335 -0
  28. package/dist/aci/jwt-claims.js.map +1 -0
  29. package/dist/aci/levels.d.ts +279 -0
  30. package/dist/aci/levels.d.ts.map +1 -0
  31. package/dist/aci/levels.js +467 -0
  32. package/dist/aci/levels.js.map +1 -0
  33. package/dist/aci/mapping.d.ts +291 -0
  34. package/dist/aci/mapping.d.ts.map +1 -0
  35. package/dist/aci/mapping.js +427 -0
  36. package/dist/aci/mapping.js.map +1 -0
  37. package/dist/aci/skills.d.ts +314 -0
  38. package/dist/aci/skills.d.ts.map +1 -0
  39. package/dist/aci/skills.js +404 -0
  40. package/dist/aci/skills.js.map +1 -0
  41. package/dist/aci/tiers.d.ts +403 -0
  42. package/dist/aci/tiers.d.ts.map +1 -0
  43. package/dist/aci/tiers.js +659 -0
  44. package/dist/aci/tiers.js.map +1 -0
  45. package/dist/canonical/agent.d.ts +796 -0
  46. package/dist/canonical/agent.d.ts.map +1 -0
  47. package/dist/canonical/agent.js +527 -0
  48. package/dist/canonical/agent.js.map +1 -0
  49. package/dist/canonical/governance.d.ts +905 -0
  50. package/dist/canonical/governance.d.ts.map +1 -0
  51. package/dist/canonical/governance.js +454 -0
  52. package/dist/canonical/governance.js.map +1 -0
  53. package/dist/canonical/index.d.ts +17 -0
  54. package/dist/canonical/index.d.ts.map +1 -0
  55. package/dist/canonical/index.js +21 -0
  56. package/dist/canonical/index.js.map +1 -0
  57. package/dist/canonical/intent.d.ts +727 -0
  58. package/dist/canonical/intent.d.ts.map +1 -0
  59. package/dist/canonical/intent.js +203 -0
  60. package/dist/canonical/intent.js.map +1 -0
  61. package/dist/canonical/risk-level.d.ts +344 -0
  62. package/dist/canonical/risk-level.d.ts.map +1 -0
  63. package/dist/canonical/risk-level.js +472 -0
  64. package/dist/canonical/risk-level.js.map +1 -0
  65. package/dist/canonical/trust-band.d.ts +239 -0
  66. package/dist/canonical/trust-band.d.ts.map +1 -0
  67. package/dist/canonical/trust-band.js +298 -0
  68. package/dist/canonical/trust-band.js.map +1 -0
  69. package/dist/canonical/trust-score.d.ts +301 -0
  70. package/dist/canonical/trust-score.d.ts.map +1 -0
  71. package/dist/canonical/trust-score.js +390 -0
  72. package/dist/canonical/trust-score.js.map +1 -0
  73. package/dist/canonical/trust-signal.d.ts +617 -0
  74. package/dist/canonical/trust-signal.d.ts.map +1 -0
  75. package/dist/canonical/trust-signal.js +355 -0
  76. package/dist/canonical/trust-signal.js.map +1 -0
  77. package/dist/canonical/validation.d.ts +231 -0
  78. package/dist/canonical/validation.d.ts.map +1 -0
  79. package/dist/canonical/validation.js +558 -0
  80. package/dist/canonical/validation.js.map +1 -0
  81. package/dist/common/index.d.ts +7 -0
  82. package/dist/common/index.d.ts.map +1 -0
  83. package/dist/common/index.js +7 -0
  84. package/dist/common/index.js.map +1 -0
  85. package/dist/common/primitives.d.ts +56 -0
  86. package/dist/common/primitives.d.ts.map +1 -0
  87. package/dist/common/primitives.js +70 -0
  88. package/dist/common/primitives.js.map +1 -0
  89. package/dist/index.d.ts +11 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +15 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/v2/canary-probe.d.ts +201 -0
  94. package/dist/v2/canary-probe.d.ts.map +1 -0
  95. package/dist/v2/canary-probe.js +99 -0
  96. package/dist/v2/canary-probe.js.map +1 -0
  97. package/dist/v2/component.d.ts +132 -0
  98. package/dist/v2/component.d.ts.map +1 -0
  99. package/dist/v2/component.js +5 -0
  100. package/dist/v2/component.js.map +1 -0
  101. package/dist/v2/decision.d.ts +310 -0
  102. package/dist/v2/decision.d.ts.map +1 -0
  103. package/dist/v2/decision.js +21 -0
  104. package/dist/v2/decision.js.map +1 -0
  105. package/dist/v2/enums.d.ts +185 -0
  106. package/dist/v2/enums.d.ts.map +1 -0
  107. package/dist/v2/enums.js +203 -0
  108. package/dist/v2/enums.js.map +1 -0
  109. package/dist/v2/evidence.d.ts +368 -0
  110. package/dist/v2/evidence.d.ts.map +1 -0
  111. package/dist/v2/evidence.js +152 -0
  112. package/dist/v2/evidence.js.map +1 -0
  113. package/dist/v2/execution.d.ts +190 -0
  114. package/dist/v2/execution.d.ts.map +1 -0
  115. package/dist/v2/execution.js +5 -0
  116. package/dist/v2/execution.js.map +1 -0
  117. package/dist/v2/index.d.ts +19 -0
  118. package/dist/v2/index.d.ts.map +1 -0
  119. package/dist/v2/index.js +32 -0
  120. package/dist/v2/index.js.map +1 -0
  121. package/dist/v2/intent.d.ts +89 -0
  122. package/dist/v2/intent.d.ts.map +1 -0
  123. package/dist/v2/intent.js +5 -0
  124. package/dist/v2/intent.js.map +1 -0
  125. package/dist/v2/policy-bundle.d.ts +166 -0
  126. package/dist/v2/policy-bundle.d.ts.map +1 -0
  127. package/dist/v2/policy-bundle.js +20 -0
  128. package/dist/v2/policy-bundle.js.map +1 -0
  129. package/dist/v2/pre-action-gate.d.ts +185 -0
  130. package/dist/v2/pre-action-gate.d.ts.map +1 -0
  131. package/dist/v2/pre-action-gate.js +64 -0
  132. package/dist/v2/pre-action-gate.js.map +1 -0
  133. package/dist/v2/proof-event.d.ts +201 -0
  134. package/dist/v2/proof-event.d.ts.map +1 -0
  135. package/dist/v2/proof-event.js +5 -0
  136. package/dist/v2/proof-event.js.map +1 -0
  137. package/dist/v2/retention.d.ts +329 -0
  138. package/dist/v2/retention.d.ts.map +1 -0
  139. package/dist/v2/retention.js +162 -0
  140. package/dist/v2/retention.js.map +1 -0
  141. package/dist/v2/trust-delta.d.ts +119 -0
  142. package/dist/v2/trust-delta.d.ts.map +1 -0
  143. package/dist/v2/trust-delta.js +28 -0
  144. package/dist/v2/trust-delta.js.map +1 -0
  145. package/dist/v2/trust-profile.d.ts +337 -0
  146. package/dist/v2/trust-profile.d.ts.map +1 -0
  147. package/dist/v2/trust-profile.js +96 -0
  148. package/dist/v2/trust-profile.js.map +1 -0
  149. package/dist/validators/decision.d.ts +430 -0
  150. package/dist/validators/decision.d.ts.map +1 -0
  151. package/dist/validators/decision.js +61 -0
  152. package/dist/validators/decision.js.map +1 -0
  153. package/dist/validators/enums.d.ts +24 -0
  154. package/dist/validators/enums.d.ts.map +1 -0
  155. package/dist/validators/enums.js +24 -0
  156. package/dist/validators/enums.js.map +1 -0
  157. package/dist/validators/index.d.ts +30 -0
  158. package/dist/validators/index.d.ts.map +1 -0
  159. package/dist/validators/index.js +42 -0
  160. package/dist/validators/index.js.map +1 -0
  161. package/dist/validators/intent.d.ts +229 -0
  162. package/dist/validators/intent.d.ts.map +1 -0
  163. package/dist/validators/intent.js +47 -0
  164. package/dist/validators/intent.js.map +1 -0
  165. package/dist/validators/proof-event.d.ts +981 -0
  166. package/dist/validators/proof-event.d.ts.map +1 -0
  167. package/dist/validators/proof-event.js +134 -0
  168. package/dist/validators/proof-event.js.map +1 -0
  169. package/dist/validators/trust-profile.d.ts +350 -0
  170. package/dist/validators/trust-profile.d.ts.map +1 -0
  171. package/dist/validators/trust-profile.js +65 -0
  172. package/dist/validators/trust-profile.js.map +1 -0
  173. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../src/canonical/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG1E,YAAY,EAAE,eAAe,EAAE,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY;AACtB,2CAA2C;AACzC,SAAS;AACX,wDAAwD;GACtD,YAAY;AACd,0CAA0C;GACxC,UAAU;AACZ,oDAAoD;GAClD,QAAQ;AACV,wCAAwC;GACtC,WAAW;AACb,yCAAyC;GACvC,WAAW;AACb,8CAA8C;GAC5C,WAAW;AACb,8BAA8B;GAC5B,QAAQ;AACV,6CAA6C;GAC3C,WAAW,CAAC;AAEhB;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,YAAY,EAU9C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,YAAY,EAKlD,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWpC,CAAC;AAMH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * @fileoverview Canonical Intent type definitions for the Vorion Platform.
3
+ *
4
+ * This file provides the authoritative definition for intents - requests from
5
+ * agents to perform actions. It combines and reconciles the various Intent
6
+ * definitions found across the codebase into a single canonical source.
7
+ *
8
+ * An Intent represents what an agent wants to do, including the action,
9
+ * resources involved, classification metadata, and trust context.
10
+ *
11
+ * @module @vorion/contracts/canonical/intent
12
+ */
13
+ import { z } from 'zod';
14
+ import { trustBandSchema } from './trust-band.js';
15
+ import { trustScoreSchema } from './trust-score.js';
16
+ // Re-export enums from v2 to avoid duplication
17
+ export { ActionType, DataSensitivity, Reversibility } from '../v2/enums.js';
18
+ import { ActionType, DataSensitivity, Reversibility } from '../v2/enums.js';
19
+ /**
20
+ * All possible intent status values as an array.
21
+ */
22
+ export const INTENT_STATUS_VALUES = [
23
+ 'pending',
24
+ 'evaluating',
25
+ 'approved',
26
+ 'denied',
27
+ 'escalated',
28
+ 'executing',
29
+ 'completed',
30
+ 'failed',
31
+ 'cancelled',
32
+ ];
33
+ /**
34
+ * Terminal intent statuses (intent lifecycle has ended).
35
+ */
36
+ export const TERMINAL_INTENT_STATUSES = [
37
+ 'denied',
38
+ 'completed',
39
+ 'failed',
40
+ 'cancelled',
41
+ ];
42
+ /**
43
+ * Active intent statuses (intent is still in progress).
44
+ */
45
+ export const ACTIVE_INTENT_STATUSES = [
46
+ 'pending',
47
+ 'evaluating',
48
+ 'approved',
49
+ 'escalated',
50
+ 'executing',
51
+ ];
52
+ // ============================================================================
53
+ // Type Guards
54
+ // ============================================================================
55
+ /**
56
+ * Type guard to check if a value is a valid IntentStatus.
57
+ *
58
+ * @param value - Value to check
59
+ * @returns True if value is a valid IntentStatus
60
+ */
61
+ export function isIntentStatus(value) {
62
+ return typeof value === 'string' && INTENT_STATUS_VALUES.includes(value);
63
+ }
64
+ /**
65
+ * Type guard to check if an IntentStatus is terminal.
66
+ *
67
+ * @param status - Status to check
68
+ * @returns True if status is a terminal state
69
+ */
70
+ export function isTerminalStatus(status) {
71
+ return TERMINAL_INTENT_STATUSES.includes(status);
72
+ }
73
+ /**
74
+ * Type guard to check if an IntentStatus is active.
75
+ *
76
+ * @param status - Status to check
77
+ * @returns True if status is an active state
78
+ */
79
+ export function isActiveStatus(status) {
80
+ return ACTIVE_INTENT_STATUSES.includes(status);
81
+ }
82
+ // Note: isActionType, isDataSensitivity, and isReversibility type guards
83
+ // are exported from canonical/validation.ts to avoid duplication
84
+ // ============================================================================
85
+ // Zod Schemas
86
+ // ============================================================================
87
+ /**
88
+ * Zod schema for ActionType enum.
89
+ */
90
+ export const actionTypeSchema = z.nativeEnum(ActionType, {
91
+ errorMap: () => ({ message: 'Invalid action type' }),
92
+ });
93
+ /**
94
+ * Zod schema for DataSensitivity enum.
95
+ */
96
+ export const dataSensitivitySchema = z.nativeEnum(DataSensitivity, {
97
+ errorMap: () => ({ message: 'Invalid data sensitivity level' }),
98
+ });
99
+ /**
100
+ * Zod schema for Reversibility enum.
101
+ */
102
+ export const reversibilitySchema = z.nativeEnum(Reversibility, {
103
+ errorMap: () => ({ message: 'Invalid reversibility value' }),
104
+ });
105
+ /**
106
+ * Zod schema for IntentStatus.
107
+ */
108
+ export const intentStatusSchema = z.enum([
109
+ 'pending',
110
+ 'evaluating',
111
+ 'approved',
112
+ 'denied',
113
+ 'escalated',
114
+ 'executing',
115
+ 'completed',
116
+ 'failed',
117
+ 'cancelled',
118
+ ], {
119
+ errorMap: () => ({ message: 'Invalid intent status' }),
120
+ });
121
+ /**
122
+ * Zod schema for IntentContext.
123
+ */
124
+ export const intentContextSchema = z.object({
125
+ domain: z.string().optional(),
126
+ environment: z.string().optional(),
127
+ onBehalfOf: z.string().optional(),
128
+ sessionId: z.string().optional(),
129
+ parentIntentId: z.string().uuid().optional(),
130
+ priority: z.number().int().min(0).max(10).optional(),
131
+ handlesPii: z.boolean().optional(),
132
+ handlesPhi: z.boolean().optional(),
133
+ jurisdictions: z.array(z.string()).optional(),
134
+ tags: z.array(z.string()).optional(),
135
+ metadata: z.record(z.unknown()).optional(),
136
+ }).strict();
137
+ /**
138
+ * Zod schema for TrustSnapshot.
139
+ */
140
+ export const trustSnapshotSchema = z.object({
141
+ score: trustScoreSchema,
142
+ band: trustBandSchema,
143
+ capturedAt: z.coerce.date(),
144
+ profileVersion: z.number().int().positive().optional(),
145
+ });
146
+ /**
147
+ * Zod schema for Intent validation.
148
+ */
149
+ export const intentSchema = z.object({
150
+ intentId: z.string().uuid(),
151
+ tenantId: z.string().min(1),
152
+ agentId: z.string().min(1),
153
+ correlationId: z.string().uuid(),
154
+ action: z.string().min(1).max(1000),
155
+ actionType: actionTypeSchema,
156
+ resourceScope: z.array(z.string().min(1)).min(1),
157
+ dataSensitivity: dataSensitivitySchema,
158
+ reversibility: reversibilitySchema,
159
+ context: intentContextSchema,
160
+ trustSnapshot: trustSnapshotSchema,
161
+ status: intentStatusSchema,
162
+ createdAt: z.coerce.date(),
163
+ updatedAt: z.coerce.date(),
164
+ expiresAt: z.coerce.date().optional(),
165
+ deletedAt: z.coerce.date().optional(),
166
+ cancellationReason: z.string().optional(),
167
+ denialReason: z.string().optional(),
168
+ failureReason: z.string().optional(),
169
+ source: z.string().optional(),
170
+ decisionId: z.string().uuid().optional(),
171
+ executionId: z.string().uuid().optional(),
172
+ });
173
+ /**
174
+ * Zod schema for IntentSummary.
175
+ */
176
+ export const intentSummarySchema = z.object({
177
+ intentId: z.string().uuid(),
178
+ tenantId: z.string().min(1),
179
+ agentId: z.string().min(1),
180
+ correlationId: z.string().uuid(),
181
+ action: z.string(),
182
+ actionType: actionTypeSchema,
183
+ dataSensitivity: dataSensitivitySchema,
184
+ status: intentStatusSchema,
185
+ trustBand: trustBandSchema,
186
+ createdAt: z.coerce.date(),
187
+ });
188
+ /**
189
+ * Zod schema for CreateIntentRequest validation.
190
+ */
191
+ export const createIntentRequestSchema = z.object({
192
+ agentId: z.string().min(1),
193
+ action: z.string().min(1).max(1000),
194
+ actionType: actionTypeSchema,
195
+ resourceScope: z.array(z.string().min(1)).min(1),
196
+ dataSensitivity: dataSensitivitySchema,
197
+ reversibility: reversibilitySchema,
198
+ correlationId: z.string().uuid().optional(),
199
+ context: intentContextSchema.partial().optional(),
200
+ expiresInMs: z.number().int().positive().optional(),
201
+ source: z.string().optional(),
202
+ });
203
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../src/canonical/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,kBAAkB,CAAC;AAK1E,+CAA+C;AAC/C,OAAO,EAAE,UA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CAAC,IAAI,EAAE;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,UAAU,EAAE,gBAAgB;IAC5B,eAAe,EAAE,qBAAqB;IACtC,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,eAAe;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACnC,UAAU,EAAE,gBAAgB;IAC5B,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,eAAe,EAAE,qBAAqB;IACtC,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC3C,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC"}
@@ -0,0 +1,344 @@
1
+ /**
2
+ * @fileoverview Canonical RiskLevel type definitions for the Vorion Platform.
3
+ *
4
+ * This file provides the authoritative definition for risk levels, unifying
5
+ * the various representations found across packages (enum, string union, numeric)
6
+ * into a single canonical source with conversion utilities.
7
+ *
8
+ * Risk levels classify the potential impact or severity of actions, decisions,
9
+ * and events within the platform.
10
+ *
11
+ * @module @vorion/contracts/canonical/risk-level
12
+ */
13
+ import { z } from 'zod';
14
+ /**
15
+ * Canonical risk level type.
16
+ *
17
+ * Uses lowercase string union as the authoritative format.
18
+ * This provides good developer experience while being easily
19
+ * serializable and human-readable.
20
+ *
21
+ * Levels (in ascending severity):
22
+ * - `low`: Minimal risk, standard operation
23
+ * - `medium`: Moderate risk, enhanced monitoring recommended
24
+ * - `high`: Significant risk, requires additional safeguards
25
+ * - `critical`: Severe risk, may require human intervention
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const risk: RiskLevel = 'medium';
30
+ * ```
31
+ */
32
+ export type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
33
+ /**
34
+ * Array of all risk levels in ascending severity order.
35
+ *
36
+ * Useful for iteration, validation, and UI components.
37
+ */
38
+ export declare const RISK_LEVELS: readonly RiskLevel[];
39
+ /**
40
+ * Numeric values for risk levels (0-3 scale).
41
+ *
42
+ * Enables numeric comparisons and calculations while maintaining
43
+ * the string type as the canonical representation.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * RISK_LEVEL_VALUES['critical']; // 3
48
+ * RISK_LEVEL_VALUES['low']; // 0
49
+ * ```
50
+ */
51
+ export declare const RISK_LEVEL_VALUES: Readonly<Record<RiskLevel, number>>;
52
+ /**
53
+ * Human-readable labels for risk levels.
54
+ *
55
+ * Useful for display in UIs and reports.
56
+ */
57
+ export declare const RISK_LEVEL_LABELS: Readonly<Record<RiskLevel, string>>;
58
+ /**
59
+ * Detailed descriptions for each risk level.
60
+ *
61
+ * Provides guidance on what each level means and when to use it.
62
+ */
63
+ export declare const RISK_LEVEL_DESCRIPTIONS: Readonly<Record<RiskLevel, string>>;
64
+ /**
65
+ * Color codes for risk levels (for UI display).
66
+ *
67
+ * Uses common color conventions: green for low, yellow/orange for medium,
68
+ * red for high, and dark red for critical.
69
+ */
70
+ export declare const RISK_LEVEL_COLORS: Readonly<Record<RiskLevel, string>>;
71
+ /**
72
+ * Default risk level for unclassified items.
73
+ */
74
+ export declare const DEFAULT_RISK_LEVEL: RiskLevel;
75
+ /**
76
+ * Converts a numeric value to a RiskLevel.
77
+ *
78
+ * Handles the 5-level numeric system (0-4) used by some packages
79
+ * by mapping level 4 to 'critical' (same as level 3).
80
+ *
81
+ * @param n - Numeric value (0-4)
82
+ * @returns Corresponding RiskLevel
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * riskLevelFromNumber(0); // 'low'
87
+ * riskLevelFromNumber(2); // 'high'
88
+ * riskLevelFromNumber(4); // 'critical' (Council's L4 maps to critical)
89
+ * ```
90
+ */
91
+ export declare function riskLevelFromNumber(n: number): RiskLevel;
92
+ /**
93
+ * Converts a RiskLevel to its numeric value.
94
+ *
95
+ * @param level - RiskLevel to convert
96
+ * @returns Numeric value (0-3)
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * riskLevelToNumber('low'); // 0
101
+ * riskLevelToNumber('critical'); // 3
102
+ * ```
103
+ */
104
+ export declare function riskLevelToNumber(level: RiskLevel): number;
105
+ /**
106
+ * Safely parses a value to RiskLevel.
107
+ *
108
+ * Handles various input formats:
109
+ * - String values (case-insensitive)
110
+ * - Numeric values (0-4)
111
+ * - Enum-style uppercase strings
112
+ *
113
+ * @param value - Value to parse
114
+ * @returns RiskLevel or null if unparseable
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * parseRiskLevel('LOW'); // 'low'
119
+ * parseRiskLevel('MEDIUM'); // 'medium'
120
+ * parseRiskLevel(2); // 'high'
121
+ * parseRiskLevel('invalid'); // null
122
+ * ```
123
+ */
124
+ export declare function parseRiskLevel(value: unknown): RiskLevel | null;
125
+ /**
126
+ * Parses a value to RiskLevel with a default fallback.
127
+ *
128
+ * @param value - Value to parse
129
+ * @param defaultLevel - Default level if parsing fails
130
+ * @returns RiskLevel (parsed or default)
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * parseRiskLevelOrDefault('high', 'low'); // 'high'
135
+ * parseRiskLevelOrDefault('invalid', 'low'); // 'low'
136
+ * ```
137
+ */
138
+ export declare function parseRiskLevelOrDefault(value: unknown, defaultLevel?: RiskLevel): RiskLevel;
139
+ /**
140
+ * Compares two risk levels.
141
+ *
142
+ * @param a - First risk level
143
+ * @param b - Second risk level
144
+ * @returns -1 if a < b, 0 if equal, 1 if a > b
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * compareRiskLevels('low', 'high'); // -1
149
+ * compareRiskLevels('high', 'medium'); // 1
150
+ * compareRiskLevels('medium', 'medium'); // 0
151
+ * ```
152
+ */
153
+ export declare function compareRiskLevels(a: RiskLevel, b: RiskLevel): -1 | 0 | 1;
154
+ /**
155
+ * Checks if a risk level is at least as severe as another.
156
+ *
157
+ * @param level - Level to check
158
+ * @param threshold - Minimum threshold
159
+ * @returns True if level meets or exceeds threshold
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * isRiskAtLeast('high', 'medium'); // true
164
+ * isRiskAtLeast('low', 'medium'); // false
165
+ * isRiskAtLeast('medium', 'medium'); // true
166
+ * ```
167
+ */
168
+ export declare function isRiskAtLeast(level: RiskLevel, threshold: RiskLevel): boolean;
169
+ /**
170
+ * Checks if a risk level is more severe than another.
171
+ *
172
+ * @param level - Level to check
173
+ * @param other - Level to compare against
174
+ * @returns True if level is more severe than other
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * isRiskHigherThan('high', 'medium'); // true
179
+ * isRiskHigherThan('medium', 'high'); // false
180
+ * isRiskHigherThan('high', 'high'); // false
181
+ * ```
182
+ */
183
+ export declare function isRiskHigherThan(level: RiskLevel, other: RiskLevel): boolean;
184
+ /**
185
+ * Gets the maximum (most severe) risk level from an array.
186
+ *
187
+ * @param levels - Array of risk levels
188
+ * @returns Most severe risk level, or 'low' if array is empty
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * maxRiskLevel(['low', 'medium', 'high']); // 'high'
193
+ * maxRiskLevel(['low', 'low']); // 'low'
194
+ * maxRiskLevel([]); // 'low'
195
+ * ```
196
+ */
197
+ export declare function maxRiskLevel(levels: RiskLevel[]): RiskLevel;
198
+ /**
199
+ * Gets the minimum (least severe) risk level from an array.
200
+ *
201
+ * @param levels - Array of risk levels
202
+ * @returns Least severe risk level, or 'critical' if array is empty
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * minRiskLevel(['low', 'medium', 'high']); // 'low'
207
+ * minRiskLevel(['high', 'critical']); // 'high'
208
+ * ```
209
+ */
210
+ export declare function minRiskLevel(levels: RiskLevel[]): RiskLevel;
211
+ /**
212
+ * Escalates a risk level by one step (if possible).
213
+ *
214
+ * @param level - Current risk level
215
+ * @returns Escalated risk level (or same if already critical)
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * escalateRiskLevel('low'); // 'medium'
220
+ * escalateRiskLevel('high'); // 'critical'
221
+ * escalateRiskLevel('critical'); // 'critical'
222
+ * ```
223
+ */
224
+ export declare function escalateRiskLevel(level: RiskLevel): RiskLevel;
225
+ /**
226
+ * De-escalates a risk level by one step (if possible).
227
+ *
228
+ * @param level - Current risk level
229
+ * @returns De-escalated risk level (or same if already low)
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * deescalateRiskLevel('critical'); // 'high'
234
+ * deescalateRiskLevel('medium'); // 'low'
235
+ * deescalateRiskLevel('low'); // 'low'
236
+ * ```
237
+ */
238
+ export declare function deescalateRiskLevel(level: RiskLevel): RiskLevel;
239
+ /**
240
+ * Type guard to check if a value is a valid RiskLevel.
241
+ *
242
+ * @param value - Value to check
243
+ * @returns True if value is a valid RiskLevel
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * isRiskLevel('high'); // true
248
+ * isRiskLevel('severe'); // false
249
+ * isRiskLevel(2); // false
250
+ * ```
251
+ */
252
+ export declare function isRiskLevel(value: unknown): value is RiskLevel;
253
+ /**
254
+ * Type guard to check if a risk level requires elevated attention.
255
+ *
256
+ * Returns true for 'high' and 'critical' levels.
257
+ *
258
+ * @param level - Risk level to check
259
+ * @returns True if level requires elevated attention
260
+ */
261
+ export declare function requiresElevatedAttention(level: RiskLevel): boolean;
262
+ /**
263
+ * Type guard to check if a risk level is critical.
264
+ *
265
+ * @param level - Risk level to check
266
+ * @returns True if level is critical
267
+ */
268
+ export declare function isCriticalRisk(level: RiskLevel): boolean;
269
+ /**
270
+ * Gets the human-readable label for a risk level.
271
+ *
272
+ * @param level - Risk level
273
+ * @returns Human-readable label
274
+ */
275
+ export declare function getRiskLevelLabel(level: RiskLevel): string;
276
+ /**
277
+ * Gets the description for a risk level.
278
+ *
279
+ * @param level - Risk level
280
+ * @returns Description string
281
+ */
282
+ export declare function getRiskLevelDescription(level: RiskLevel): string;
283
+ /**
284
+ * Gets the color code for a risk level.
285
+ *
286
+ * @param level - Risk level
287
+ * @returns Hex color code
288
+ */
289
+ export declare function getRiskLevelColor(level: RiskLevel): string;
290
+ /**
291
+ * Zod schema for RiskLevel validation.
292
+ *
293
+ * Validates that a value is one of the canonical risk level strings.
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * riskLevelSchema.parse('medium'); // Success
298
+ * riskLevelSchema.parse('severe'); // Throws ZodError
299
+ * ```
300
+ */
301
+ export declare const riskLevelSchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
302
+ /**
303
+ * Zod schema that accepts numeric input and transforms to RiskLevel.
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * riskLevelFromNumberSchema.parse(2); // 'high'
308
+ * ```
309
+ */
310
+ export declare const riskLevelFromNumberSchema: z.ZodEffects<z.ZodNumber, "low" | "medium" | "high" | "critical", number>;
311
+ /**
312
+ * Zod schema that accepts string input (case-insensitive) and transforms to RiskLevel.
313
+ *
314
+ * @example
315
+ * ```typescript
316
+ * riskLevelFlexibleSchema.parse('HIGH'); // 'high'
317
+ * riskLevelFlexibleSchema.parse('Medium'); // 'medium'
318
+ * ```
319
+ */
320
+ export declare const riskLevelFlexibleSchema: z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["low", "medium", "high", "critical"]>>;
321
+ /**
322
+ * Zod schema that accepts multiple input formats and normalizes to RiskLevel.
323
+ *
324
+ * Accepts: lowercase strings, uppercase strings, numbers (0-4).
325
+ */
326
+ export declare const riskLevelUnionSchema: z.ZodUnion<[z.ZodEnum<["low", "medium", "high", "critical"]>, z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<["low", "medium", "high", "critical"]>>, z.ZodEffects<z.ZodNumber, "low" | "medium" | "high" | "critical", number>]>;
327
+ /**
328
+ * Enum-style representation for compatibility with older code.
329
+ *
330
+ * @deprecated Use RiskLevel string type directly. This is for migration only.
331
+ */
332
+ export declare const RiskLevelEnum: {
333
+ readonly LOW: RiskLevel;
334
+ readonly MEDIUM: RiskLevel;
335
+ readonly HIGH: RiskLevel;
336
+ readonly CRITICAL: RiskLevel;
337
+ };
338
+ /**
339
+ * Maps legacy uppercase enum values to canonical RiskLevel.
340
+ *
341
+ * @deprecated Use RiskLevel string type directly. This is for migration only.
342
+ */
343
+ export declare const LEGACY_RISK_LEVEL_MAP: Readonly<Record<string, RiskLevel>>;
344
+ //# sourceMappingURL=risk-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"risk-level.d.ts","sourceRoot":"","sources":["../../src/canonical/risk-level.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAM/D;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAAmD,CAAC;AAEhG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAKxD,CAAC;AAcX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM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