@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.
- package/dist/aci/aci-string.d.ts +539 -0
- package/dist/aci/aci-string.d.ts.map +1 -0
- package/dist/aci/aci-string.js +563 -0
- package/dist/aci/aci-string.js.map +1 -0
- package/dist/aci/attestation.d.ts +648 -0
- package/dist/aci/attestation.d.ts.map +1 -0
- package/dist/aci/attestation.js +289 -0
- package/dist/aci/attestation.js.map +1 -0
- package/dist/aci/domains.d.ts +260 -0
- package/dist/aci/domains.d.ts.map +1 -0
- package/dist/aci/domains.js +322 -0
- package/dist/aci/domains.js.map +1 -0
- package/dist/aci/effective-permission.d.ts +371 -0
- package/dist/aci/effective-permission.d.ts.map +1 -0
- package/dist/aci/effective-permission.js +351 -0
- package/dist/aci/effective-permission.js.map +1 -0
- package/dist/aci/identity.d.ts +1100 -0
- package/dist/aci/identity.d.ts.map +1 -0
- package/dist/aci/identity.js +328 -0
- package/dist/aci/identity.js.map +1 -0
- package/dist/aci/index.d.ts +67 -0
- package/dist/aci/index.d.ts.map +1 -0
- package/dist/aci/index.js +157 -0
- package/dist/aci/index.js.map +1 -0
- package/dist/aci/jwt-claims.d.ts +756 -0
- package/dist/aci/jwt-claims.d.ts.map +1 -0
- package/dist/aci/jwt-claims.js +335 -0
- package/dist/aci/jwt-claims.js.map +1 -0
- package/dist/aci/levels.d.ts +279 -0
- package/dist/aci/levels.d.ts.map +1 -0
- package/dist/aci/levels.js +467 -0
- package/dist/aci/levels.js.map +1 -0
- package/dist/aci/mapping.d.ts +291 -0
- package/dist/aci/mapping.d.ts.map +1 -0
- package/dist/aci/mapping.js +427 -0
- package/dist/aci/mapping.js.map +1 -0
- package/dist/aci/skills.d.ts +314 -0
- package/dist/aci/skills.d.ts.map +1 -0
- package/dist/aci/skills.js +404 -0
- package/dist/aci/skills.js.map +1 -0
- package/dist/aci/tiers.d.ts +403 -0
- package/dist/aci/tiers.d.ts.map +1 -0
- package/dist/aci/tiers.js +659 -0
- package/dist/aci/tiers.js.map +1 -0
- package/dist/canonical/agent.d.ts +796 -0
- package/dist/canonical/agent.d.ts.map +1 -0
- package/dist/canonical/agent.js +527 -0
- package/dist/canonical/agent.js.map +1 -0
- package/dist/canonical/governance.d.ts +905 -0
- package/dist/canonical/governance.d.ts.map +1 -0
- package/dist/canonical/governance.js +454 -0
- package/dist/canonical/governance.js.map +1 -0
- package/dist/canonical/index.d.ts +17 -0
- package/dist/canonical/index.d.ts.map +1 -0
- package/dist/canonical/index.js +21 -0
- package/dist/canonical/index.js.map +1 -0
- package/dist/canonical/intent.d.ts +727 -0
- package/dist/canonical/intent.d.ts.map +1 -0
- package/dist/canonical/intent.js +203 -0
- package/dist/canonical/intent.js.map +1 -0
- package/dist/canonical/risk-level.d.ts +344 -0
- package/dist/canonical/risk-level.d.ts.map +1 -0
- package/dist/canonical/risk-level.js +472 -0
- package/dist/canonical/risk-level.js.map +1 -0
- package/dist/canonical/trust-band.d.ts +239 -0
- package/dist/canonical/trust-band.d.ts.map +1 -0
- package/dist/canonical/trust-band.js +298 -0
- package/dist/canonical/trust-band.js.map +1 -0
- package/dist/canonical/trust-score.d.ts +301 -0
- package/dist/canonical/trust-score.d.ts.map +1 -0
- package/dist/canonical/trust-score.js +390 -0
- package/dist/canonical/trust-score.js.map +1 -0
- package/dist/canonical/trust-signal.d.ts +617 -0
- package/dist/canonical/trust-signal.d.ts.map +1 -0
- package/dist/canonical/trust-signal.js +355 -0
- package/dist/canonical/trust-signal.js.map +1 -0
- package/dist/canonical/validation.d.ts +231 -0
- package/dist/canonical/validation.d.ts.map +1 -0
- package/dist/canonical/validation.js +558 -0
- package/dist/canonical/validation.js.map +1 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +7 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/primitives.d.ts +56 -0
- package/dist/common/primitives.d.ts.map +1 -0
- package/dist/common/primitives.js +70 -0
- package/dist/common/primitives.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/v2/canary-probe.d.ts +201 -0
- package/dist/v2/canary-probe.d.ts.map +1 -0
- package/dist/v2/canary-probe.js +99 -0
- package/dist/v2/canary-probe.js.map +1 -0
- package/dist/v2/component.d.ts +132 -0
- package/dist/v2/component.d.ts.map +1 -0
- package/dist/v2/component.js +5 -0
- package/dist/v2/component.js.map +1 -0
- package/dist/v2/decision.d.ts +310 -0
- package/dist/v2/decision.d.ts.map +1 -0
- package/dist/v2/decision.js +21 -0
- package/dist/v2/decision.js.map +1 -0
- package/dist/v2/enums.d.ts +185 -0
- package/dist/v2/enums.d.ts.map +1 -0
- package/dist/v2/enums.js +203 -0
- package/dist/v2/enums.js.map +1 -0
- package/dist/v2/evidence.d.ts +368 -0
- package/dist/v2/evidence.d.ts.map +1 -0
- package/dist/v2/evidence.js +152 -0
- package/dist/v2/evidence.js.map +1 -0
- package/dist/v2/execution.d.ts +190 -0
- package/dist/v2/execution.d.ts.map +1 -0
- package/dist/v2/execution.js +5 -0
- package/dist/v2/execution.js.map +1 -0
- package/dist/v2/index.d.ts +19 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.js +32 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/intent.d.ts +89 -0
- package/dist/v2/intent.d.ts.map +1 -0
- package/dist/v2/intent.js +5 -0
- package/dist/v2/intent.js.map +1 -0
- package/dist/v2/policy-bundle.d.ts +166 -0
- package/dist/v2/policy-bundle.d.ts.map +1 -0
- package/dist/v2/policy-bundle.js +20 -0
- package/dist/v2/policy-bundle.js.map +1 -0
- package/dist/v2/pre-action-gate.d.ts +185 -0
- package/dist/v2/pre-action-gate.d.ts.map +1 -0
- package/dist/v2/pre-action-gate.js +64 -0
- package/dist/v2/pre-action-gate.js.map +1 -0
- package/dist/v2/proof-event.d.ts +201 -0
- package/dist/v2/proof-event.d.ts.map +1 -0
- package/dist/v2/proof-event.js +5 -0
- package/dist/v2/proof-event.js.map +1 -0
- package/dist/v2/retention.d.ts +329 -0
- package/dist/v2/retention.d.ts.map +1 -0
- package/dist/v2/retention.js +162 -0
- package/dist/v2/retention.js.map +1 -0
- package/dist/v2/trust-delta.d.ts +119 -0
- package/dist/v2/trust-delta.d.ts.map +1 -0
- package/dist/v2/trust-delta.js +28 -0
- package/dist/v2/trust-delta.js.map +1 -0
- package/dist/v2/trust-profile.d.ts +337 -0
- package/dist/v2/trust-profile.d.ts.map +1 -0
- package/dist/v2/trust-profile.js +96 -0
- package/dist/v2/trust-profile.js.map +1 -0
- package/dist/validators/decision.d.ts +430 -0
- package/dist/validators/decision.d.ts.map +1 -0
- package/dist/validators/decision.js +61 -0
- package/dist/validators/decision.js.map +1 -0
- package/dist/validators/enums.d.ts +24 -0
- package/dist/validators/enums.d.ts.map +1 -0
- package/dist/validators/enums.js +24 -0
- package/dist/validators/enums.js.map +1 -0
- package/dist/validators/index.d.ts +30 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +42 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/intent.d.ts +229 -0
- package/dist/validators/intent.d.ts.map +1 -0
- package/dist/validators/intent.js +47 -0
- package/dist/validators/intent.js.map +1 -0
- package/dist/validators/proof-event.d.ts +981 -0
- package/dist/validators/proof-event.d.ts.map +1 -0
- package/dist/validators/proof-event.js +134 -0
- package/dist/validators/proof-event.js.map +1 -0
- package/dist/validators/trust-profile.d.ts +350 -0
- package/dist/validators/trust-profile.d.ts.map +1 -0
- package/dist/validators/trust-profile.js +65 -0
- package/dist/validators/trust-profile.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-claims.d.ts","sourceRoot":"","sources":["../../src/aci/jwt-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,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,CAAC;CAC9B,GACA,OAAO,CAkCT;AAMD;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;EAG3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAczC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1C,CAAC"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ACI JWT Claims for OpenID Connect
|
|
3
|
+
*
|
|
4
|
+
* Defines JWT claim structures for ACI-aware authentication and authorization.
|
|
5
|
+
* These claims extend standard OIDC claims with ACI-specific information,
|
|
6
|
+
* enabling capability-based access control in JWT tokens.
|
|
7
|
+
*
|
|
8
|
+
* @module @vorion/contracts/aci/jwt-claims
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { domainCodeArraySchema } from './domains.js';
|
|
12
|
+
import { capabilityLevelSchema } from './levels.js';
|
|
13
|
+
import { CertificationTier, certificationTierSchema, runtimeTierSchema } from './tiers.js';
|
|
14
|
+
/**
|
|
15
|
+
* Zod schema for StandardJWTClaims.
|
|
16
|
+
*/
|
|
17
|
+
export const standardJWTClaimsSchema = z.object({
|
|
18
|
+
iss: z.string().optional(),
|
|
19
|
+
sub: z.string().optional(),
|
|
20
|
+
aud: z.union([z.string(), z.array(z.string())]).optional(),
|
|
21
|
+
exp: z.number().int().positive().optional(),
|
|
22
|
+
nbf: z.number().int().positive().optional(),
|
|
23
|
+
iat: z.number().int().positive().optional(),
|
|
24
|
+
jti: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Zod schema for ACIAttestationClaim.
|
|
28
|
+
*/
|
|
29
|
+
export const aciAttestationClaimSchema = z.object({
|
|
30
|
+
iss: z.string().min(1),
|
|
31
|
+
tier: certificationTierSchema,
|
|
32
|
+
scope: z.string().min(1),
|
|
33
|
+
iat: z.number().int().positive(),
|
|
34
|
+
exp: z.number().int().positive(),
|
|
35
|
+
evidence: z.string().url().optional(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Zod schema for ACIConstraintsClaim.
|
|
39
|
+
*/
|
|
40
|
+
export const aciConstraintsClaimSchema = z.object({
|
|
41
|
+
max_operations: z.number().int().positive().optional(),
|
|
42
|
+
allowed_resources: z.array(z.string()).optional(),
|
|
43
|
+
blocked_resources: z.array(z.string()).optional(),
|
|
44
|
+
valid_until: z.number().int().positive().optional(),
|
|
45
|
+
requires_approval: z.boolean().optional(),
|
|
46
|
+
custom: z.record(z.unknown()).optional(),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Zod schema for ACIJWTClaims validation.
|
|
50
|
+
*/
|
|
51
|
+
export const aciJWTClaimsSchema = standardJWTClaimsSchema.extend({
|
|
52
|
+
aci: z.string().min(1),
|
|
53
|
+
aci_domains: z.number().int().min(0),
|
|
54
|
+
aci_domains_list: domainCodeArraySchema,
|
|
55
|
+
aci_level: capabilityLevelSchema,
|
|
56
|
+
// aci_trust is optional - comes from attestations, not the ACI itself
|
|
57
|
+
aci_trust: certificationTierSchema.optional(),
|
|
58
|
+
aci_registry: z.string().min(1),
|
|
59
|
+
aci_org: z.string().min(1),
|
|
60
|
+
aci_class: z.string().min(1),
|
|
61
|
+
aci_version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
62
|
+
aci_did: z.string().optional(),
|
|
63
|
+
aci_runtime_tier: runtimeTierSchema.optional(),
|
|
64
|
+
aci_attestations: z.array(aciAttestationClaimSchema).optional(),
|
|
65
|
+
aci_permission_ceiling: z.number().int().min(0).max(7).optional(),
|
|
66
|
+
aci_constraints: aciConstraintsClaimSchema.optional(),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Generates JWT claims from a parsed ACI.
|
|
70
|
+
*
|
|
71
|
+
* @param options - Generation options
|
|
72
|
+
* @returns ACI JWT claims
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const claims = generateJWTClaims({
|
|
77
|
+
* parsed: parseACI('a3i.acme-corp.invoice-bot:ABF-L3@1.0.0'),
|
|
78
|
+
* did: 'did:web:agent.acme.com',
|
|
79
|
+
* issuer: 'did:web:auth.acme.com',
|
|
80
|
+
* validitySeconds: 3600,
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function generateJWTClaims(options) {
|
|
85
|
+
const { parsed, did, issuer, audience, validitySeconds = 3600, runtimeTier, attestations, permissionCeiling, constraints, } = options;
|
|
86
|
+
const now = Math.floor(Date.now() / 1000);
|
|
87
|
+
return {
|
|
88
|
+
// Standard claims
|
|
89
|
+
iss: issuer,
|
|
90
|
+
sub: did ?? parsed.aci,
|
|
91
|
+
aud: audience,
|
|
92
|
+
iat: now,
|
|
93
|
+
nbf: now,
|
|
94
|
+
exp: now + validitySeconds,
|
|
95
|
+
jti: crypto.randomUUID(),
|
|
96
|
+
// ACI claims (identity only - trust comes from attestations)
|
|
97
|
+
aci: parsed.aci,
|
|
98
|
+
aci_domains: parsed.domainsBitmask,
|
|
99
|
+
aci_domains_list: [...parsed.domains],
|
|
100
|
+
aci_level: parsed.level,
|
|
101
|
+
// NOTE: aci_trust is derived from attestations, not the ACI
|
|
102
|
+
// Compute highest valid attestation tier if attestations provided
|
|
103
|
+
aci_trust: attestations && attestations.length > 0
|
|
104
|
+
? Math.max(...attestations.map((a) => a.tier))
|
|
105
|
+
: undefined,
|
|
106
|
+
aci_registry: parsed.registry,
|
|
107
|
+
aci_org: parsed.organization,
|
|
108
|
+
aci_class: parsed.agentClass,
|
|
109
|
+
aci_version: parsed.version,
|
|
110
|
+
aci_did: did,
|
|
111
|
+
aci_runtime_tier: runtimeTier,
|
|
112
|
+
aci_attestations: attestations,
|
|
113
|
+
aci_permission_ceiling: permissionCeiling,
|
|
114
|
+
aci_constraints: constraints,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Generates minimal JWT claims from a parsed ACI.
|
|
119
|
+
*
|
|
120
|
+
* NOTE: aci_trust is NOT included because trust comes from attestations,
|
|
121
|
+
* not the ACI itself. Use generateJWTClaims with attestations for full claims.
|
|
122
|
+
*
|
|
123
|
+
* @param parsed - Parsed ACI
|
|
124
|
+
* @param did - Optional agent DID
|
|
125
|
+
* @returns Minimal ACI JWT claims (without trust tier)
|
|
126
|
+
*/
|
|
127
|
+
export function generateMinimalJWTClaims(parsed, did) {
|
|
128
|
+
const now = Math.floor(Date.now() / 1000);
|
|
129
|
+
return {
|
|
130
|
+
iat: now,
|
|
131
|
+
aci: parsed.aci,
|
|
132
|
+
aci_domains: parsed.domainsBitmask,
|
|
133
|
+
aci_domains_list: [...parsed.domains],
|
|
134
|
+
aci_level: parsed.level,
|
|
135
|
+
// aci_trust intentionally omitted - comes from attestations at runtime
|
|
136
|
+
aci_registry: parsed.registry,
|
|
137
|
+
aci_org: parsed.organization,
|
|
138
|
+
aci_class: parsed.agentClass,
|
|
139
|
+
aci_version: parsed.version,
|
|
140
|
+
aci_did: did,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Validates ACI JWT claims.
|
|
145
|
+
*
|
|
146
|
+
* @param claims - Claims to validate
|
|
147
|
+
* @param options - Validation options
|
|
148
|
+
* @returns Validation result
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const result = validateJWTClaims(claims, {
|
|
153
|
+
* checkExpiry: true,
|
|
154
|
+
* validateDomainsMismatch: true,
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export function validateJWTClaims(claims, options = {}) {
|
|
159
|
+
const errors = [];
|
|
160
|
+
const { checkExpiry = true, validateDomainsMismatch = true } = options;
|
|
161
|
+
// Parse with Zod
|
|
162
|
+
const parseResult = aciJWTClaimsSchema.safeParse(claims);
|
|
163
|
+
if (!parseResult.success) {
|
|
164
|
+
return {
|
|
165
|
+
valid: false,
|
|
166
|
+
errors: parseResult.error.issues.map((issue) => ({
|
|
167
|
+
code: 'INVALID_FORMAT',
|
|
168
|
+
message: issue.message,
|
|
169
|
+
path: issue.path.join('.'),
|
|
170
|
+
})),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const parsed = parseResult.data;
|
|
174
|
+
const now = Math.floor(Date.now() / 1000);
|
|
175
|
+
// Check expiry
|
|
176
|
+
if (checkExpiry) {
|
|
177
|
+
if (parsed.exp && parsed.exp < now) {
|
|
178
|
+
errors.push({
|
|
179
|
+
code: 'EXPIRED',
|
|
180
|
+
message: `Token expired at ${new Date(parsed.exp * 1000).toISOString()}`,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (parsed.nbf && parsed.nbf > now) {
|
|
184
|
+
errors.push({
|
|
185
|
+
code: 'NOT_YET_VALID',
|
|
186
|
+
message: `Token not valid until ${new Date(parsed.nbf * 1000).toISOString()}`,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Validate domains bitmask matches domains list
|
|
191
|
+
if (validateDomainsMismatch) {
|
|
192
|
+
const expectedBitmask = parsed.aci_domains_list.reduce((mask, code) => {
|
|
193
|
+
const bits = {
|
|
194
|
+
A: 0x001, B: 0x002, C: 0x004, D: 0x008, E: 0x010,
|
|
195
|
+
F: 0x020, G: 0x040, H: 0x080, I: 0x100, S: 0x200,
|
|
196
|
+
};
|
|
197
|
+
return mask | bits[code];
|
|
198
|
+
}, 0);
|
|
199
|
+
if (expectedBitmask !== parsed.aci_domains) {
|
|
200
|
+
errors.push({
|
|
201
|
+
code: 'DOMAINS_MISMATCH',
|
|
202
|
+
message: `Domain bitmask ${parsed.aci_domains} does not match domains list (expected ${expectedBitmask})`,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
valid: errors.length === 0,
|
|
208
|
+
errors,
|
|
209
|
+
claims: errors.length === 0 ? parsed : undefined,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// ============================================================================
|
|
213
|
+
// JWT Claims Extraction
|
|
214
|
+
// ============================================================================
|
|
215
|
+
/**
|
|
216
|
+
* Extracts capability information from JWT claims.
|
|
217
|
+
*
|
|
218
|
+
* NOTE: certificationTier is optional because it comes from attestations,
|
|
219
|
+
* not the ACI. If no attestations are present, it will be undefined.
|
|
220
|
+
*
|
|
221
|
+
* @param claims - ACI JWT claims
|
|
222
|
+
* @returns Capability information
|
|
223
|
+
*/
|
|
224
|
+
export function extractCapabilityFromClaims(claims) {
|
|
225
|
+
return {
|
|
226
|
+
domains: claims.aci_domains_list,
|
|
227
|
+
domainsBitmask: claims.aci_domains,
|
|
228
|
+
level: claims.aci_level,
|
|
229
|
+
certificationTier: claims.aci_trust, // Optional - from attestations
|
|
230
|
+
runtimeTier: claims.aci_runtime_tier,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Extracts identity information from JWT claims.
|
|
235
|
+
*
|
|
236
|
+
* @param claims - ACI JWT claims
|
|
237
|
+
* @returns Identity information
|
|
238
|
+
*/
|
|
239
|
+
export function extractIdentityFromClaims(claims) {
|
|
240
|
+
return {
|
|
241
|
+
aci: claims.aci,
|
|
242
|
+
did: claims.aci_did,
|
|
243
|
+
registry: claims.aci_registry,
|
|
244
|
+
organization: claims.aci_org,
|
|
245
|
+
agentClass: claims.aci_class,
|
|
246
|
+
version: claims.aci_version,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Checks if claims have specific domain capability.
|
|
251
|
+
*
|
|
252
|
+
* @param claims - ACI JWT claims
|
|
253
|
+
* @param domain - Domain to check
|
|
254
|
+
* @returns True if the domain is present
|
|
255
|
+
*/
|
|
256
|
+
export function claimsHaveDomain(claims, domain) {
|
|
257
|
+
const bits = {
|
|
258
|
+
A: 0x001, B: 0x002, C: 0x004, D: 0x008, E: 0x010,
|
|
259
|
+
F: 0x020, G: 0x040, H: 0x080, I: 0x100, S: 0x200,
|
|
260
|
+
};
|
|
261
|
+
return (claims.aci_domains & bits[domain]) !== 0;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Checks if claims meet minimum capability requirements.
|
|
265
|
+
*
|
|
266
|
+
* @param claims - ACI JWT claims
|
|
267
|
+
* @param requirements - Minimum requirements
|
|
268
|
+
* @returns True if requirements are met
|
|
269
|
+
*/
|
|
270
|
+
export function claimsMeetRequirements(claims, requirements) {
|
|
271
|
+
// Check domains
|
|
272
|
+
if (requirements.domains) {
|
|
273
|
+
for (const domain of requirements.domains) {
|
|
274
|
+
if (!claimsHaveDomain(claims, domain)) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Check level
|
|
280
|
+
if (requirements.minLevel !== undefined && claims.aci_level < requirements.minLevel) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
// Check certification tier (comes from attestations, may be undefined)
|
|
284
|
+
if (requirements.minCertificationTier !== undefined) {
|
|
285
|
+
// If no attestation-based trust, treat as T0 (sandbox)
|
|
286
|
+
const effectiveTrust = claims.aci_trust ?? CertificationTier.T0_SANDBOX;
|
|
287
|
+
if (effectiveTrust < requirements.minCertificationTier) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Check runtime tier
|
|
292
|
+
if (requirements.minRuntimeTier !== undefined &&
|
|
293
|
+
claims.aci_runtime_tier !== undefined &&
|
|
294
|
+
claims.aci_runtime_tier < requirements.minRuntimeTier) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// Zod Schemas for Validation
|
|
301
|
+
// ============================================================================
|
|
302
|
+
/**
|
|
303
|
+
* Zod schema for JWT claims validation options.
|
|
304
|
+
*/
|
|
305
|
+
export const jwtClaimsValidationOptionsSchema = z.object({
|
|
306
|
+
checkExpiry: z.boolean().optional(),
|
|
307
|
+
validateDomainsMismatch: z.boolean().optional(),
|
|
308
|
+
});
|
|
309
|
+
/**
|
|
310
|
+
* Zod schema for JWTClaimsValidationError.
|
|
311
|
+
*/
|
|
312
|
+
export const jwtClaimsValidationErrorSchema = z.object({
|
|
313
|
+
code: z.enum([
|
|
314
|
+
'MISSING_ACI',
|
|
315
|
+
'INVALID_ACI',
|
|
316
|
+
'EXPIRED',
|
|
317
|
+
'NOT_YET_VALID',
|
|
318
|
+
'INVALID_DOMAINS',
|
|
319
|
+
'INVALID_LEVEL',
|
|
320
|
+
'INVALID_TIER',
|
|
321
|
+
'DOMAINS_MISMATCH',
|
|
322
|
+
'INVALID_FORMAT',
|
|
323
|
+
]),
|
|
324
|
+
message: z.string(),
|
|
325
|
+
path: z.string().optional(),
|
|
326
|
+
});
|
|
327
|
+
/**
|
|
328
|
+
* Zod schema for JWTClaimsValidationResult.
|
|
329
|
+
*/
|
|
330
|
+
export const jwtClaimsValidationResultSchema = z.object({
|
|
331
|
+
valid: z.boolean(),
|
|
332
|
+
errors: z.array(jwtClaimsValidationErrorSchema),
|
|
333
|
+
claims: aciJWTClaimsSchema.optional(),
|
|
334
|
+
});
|
|
335
|
+
//# sourceMappingURL=jwt-claims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-claims.js","sourceRoot":"","sources":["../../src/aci/jwt-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAE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;QACd,kBAAkB;QAClB,gBAAgB;KACjB,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC;IAC/C,MAAM,EAAE,kBAAkB,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ACI Capability Levels (L0-L7)
|
|
3
|
+
*
|
|
4
|
+
* Defines the autonomy/capability levels used in ACI strings. Levels represent
|
|
5
|
+
* what actions an agent is permitted to perform, ranging from read-only
|
|
6
|
+
* observation (L0) to full autonomy (L7).
|
|
7
|
+
*
|
|
8
|
+
* The 8-tier system (L0-L7) maps to trust bands:
|
|
9
|
+
* - L0: Observe - Read-only access (Sandbox tier)
|
|
10
|
+
* - L1: Advise - Suggest and recommend (Observed tier)
|
|
11
|
+
* - L2: Draft - Prepare changes for review (Provisional tier)
|
|
12
|
+
* - L3: Execute - Execute with approval (Monitored tier)
|
|
13
|
+
* - L4: Autonomous - Self-directed within bounds (Standard tier)
|
|
14
|
+
* - L5: Trusted - Expanded autonomy (Trusted tier)
|
|
15
|
+
* - L6: Certified - Independent operation (Certified tier)
|
|
16
|
+
* - L7: Sovereign - Full autonomy (Autonomous tier)
|
|
17
|
+
*
|
|
18
|
+
* @module @vorion/contracts/aci/levels
|
|
19
|
+
*/
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
/**
|
|
22
|
+
* Capability levels defining agent autonomy.
|
|
23
|
+
*
|
|
24
|
+
* Levels form a hierarchy where higher levels include the capabilities
|
|
25
|
+
* of all lower levels:
|
|
26
|
+
*
|
|
27
|
+
* - L0: Read-only access, monitoring, observation
|
|
28
|
+
* - L1: Can suggest and recommend, but not modify
|
|
29
|
+
* - L2: Can prepare drafts and stage changes for review
|
|
30
|
+
* - L3: Can execute operations with human approval
|
|
31
|
+
* - L4: Self-directed operation within defined bounds
|
|
32
|
+
* - L5: Expanded autonomy with minimal oversight
|
|
33
|
+
* - L6: Independent operation with comprehensive audit trail
|
|
34
|
+
* - L7: Full autonomy for mission-critical operations
|
|
35
|
+
*/
|
|
36
|
+
export declare enum CapabilityLevel {
|
|
37
|
+
/** Read-only, monitoring - Can observe but not interact */
|
|
38
|
+
L0_OBSERVE = 0,
|
|
39
|
+
/** Advisory - Can suggest and recommend actions */
|
|
40
|
+
L1_ADVISE = 1,
|
|
41
|
+
/** Drafting - Can prepare changes for human review */
|
|
42
|
+
L2_DRAFT = 2,
|
|
43
|
+
/** Execute - Can execute with human approval */
|
|
44
|
+
L3_EXECUTE = 3,
|
|
45
|
+
/** Autonomous - Self-directed within bounds */
|
|
46
|
+
L4_AUTONOMOUS = 4,
|
|
47
|
+
/** Trusted - Expanded autonomy with minimal oversight */
|
|
48
|
+
L5_TRUSTED = 5,
|
|
49
|
+
/** Certified - Independent operation with audit trail */
|
|
50
|
+
L6_CERTIFIED = 6,
|
|
51
|
+
/** Autonomous - Full autonomy for mission-critical operations */
|
|
52
|
+
L7_AUTONOMOUS = 7
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Array of all capability levels in ascending order.
|
|
56
|
+
*/
|
|
57
|
+
export declare const CAPABILITY_LEVELS: readonly [CapabilityLevel.L0_OBSERVE, CapabilityLevel.L1_ADVISE, CapabilityLevel.L2_DRAFT, CapabilityLevel.L3_EXECUTE, CapabilityLevel.L4_AUTONOMOUS, CapabilityLevel.L5_TRUSTED, CapabilityLevel.L6_CERTIFIED, CapabilityLevel.L7_AUTONOMOUS];
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema for CapabilityLevel enum validation.
|
|
60
|
+
*/
|
|
61
|
+
export declare const capabilityLevelSchema: z.ZodNativeEnum<typeof CapabilityLevel>;
|
|
62
|
+
/**
|
|
63
|
+
* Human-readable names for capability levels.
|
|
64
|
+
*/
|
|
65
|
+
export declare const CAPABILITY_LEVEL_NAMES: Readonly<Record<CapabilityLevel, string>>;
|
|
66
|
+
/**
|
|
67
|
+
* Short codes for capability levels (without the L prefix).
|
|
68
|
+
*/
|
|
69
|
+
export declare const CAPABILITY_LEVEL_CODES: Readonly<Record<CapabilityLevel, string>>;
|
|
70
|
+
/**
|
|
71
|
+
* Detailed descriptions for each capability level.
|
|
72
|
+
*/
|
|
73
|
+
export declare const CAPABILITY_LEVEL_DESCRIPTIONS: Readonly<Record<CapabilityLevel, string>>;
|
|
74
|
+
/**
|
|
75
|
+
* Capabilities granted at each level (cumulative).
|
|
76
|
+
*/
|
|
77
|
+
export declare const CAPABILITY_LEVEL_ABILITIES: Readonly<Record<CapabilityLevel, readonly string[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Configuration for a capability level.
|
|
80
|
+
*/
|
|
81
|
+
export interface CapabilityLevelConfig {
|
|
82
|
+
/** The capability level */
|
|
83
|
+
readonly level: CapabilityLevel;
|
|
84
|
+
/** Short code (L0-L7) */
|
|
85
|
+
readonly code: string;
|
|
86
|
+
/** Human-readable name */
|
|
87
|
+
readonly name: string;
|
|
88
|
+
/** Detailed description */
|
|
89
|
+
readonly description: string;
|
|
90
|
+
/** Abilities granted at this level */
|
|
91
|
+
readonly abilities: readonly string[];
|
|
92
|
+
/** Whether human approval is required for actions */
|
|
93
|
+
readonly requiresApproval: boolean;
|
|
94
|
+
/** Whether this level can operate autonomously */
|
|
95
|
+
readonly canOperateAutonomously: boolean;
|
|
96
|
+
/** Minimum certification tier typically required */
|
|
97
|
+
readonly minCertificationTier: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Complete configuration for all capability levels.
|
|
101
|
+
*/
|
|
102
|
+
export declare const CAPABILITY_LEVEL_CONFIGS: Readonly<Record<CapabilityLevel, CapabilityLevelConfig>>;
|
|
103
|
+
/**
|
|
104
|
+
* Checks if one level is higher than another.
|
|
105
|
+
*
|
|
106
|
+
* @param level - The level to check
|
|
107
|
+
* @param other - The level to compare against
|
|
108
|
+
* @returns True if level is higher than other
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* isLevelHigher(CapabilityLevel.L3_EXECUTE, CapabilityLevel.L2_DRAFT); // true
|
|
113
|
+
* isLevelHigher(CapabilityLevel.L1_ADVISE, CapabilityLevel.L3_EXECUTE); // false
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function isLevelHigher(level: CapabilityLevel, other: CapabilityLevel): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Checks if one level is at least as high as another.
|
|
119
|
+
*
|
|
120
|
+
* @param level - The level to check
|
|
121
|
+
* @param minLevel - The minimum level required
|
|
122
|
+
* @returns True if level meets or exceeds minLevel
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* meetsLevel(CapabilityLevel.L3_EXECUTE, CapabilityLevel.L2_DRAFT); // true
|
|
127
|
+
* meetsLevel(CapabilityLevel.L2_DRAFT, CapabilityLevel.L2_DRAFT); // true
|
|
128
|
+
* meetsLevel(CapabilityLevel.L1_ADVISE, CapabilityLevel.L3_EXECUTE); // false
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function meetsLevel(level: CapabilityLevel, minLevel: CapabilityLevel): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Compares two capability levels.
|
|
134
|
+
*
|
|
135
|
+
* @param a - First level
|
|
136
|
+
* @param b - Second level
|
|
137
|
+
* @returns -1 if a < b, 0 if equal, 1 if a > b
|
|
138
|
+
*/
|
|
139
|
+
export declare function compareLevels(a: CapabilityLevel, b: CapabilityLevel): -1 | 0 | 1;
|
|
140
|
+
/**
|
|
141
|
+
* Gets the minimum of two capability levels.
|
|
142
|
+
*
|
|
143
|
+
* @param a - First level
|
|
144
|
+
* @param b - Second level
|
|
145
|
+
* @returns The lower level
|
|
146
|
+
*/
|
|
147
|
+
export declare function minLevel(a: CapabilityLevel, b: CapabilityLevel): CapabilityLevel;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the maximum of two capability levels.
|
|
150
|
+
*
|
|
151
|
+
* @param a - First level
|
|
152
|
+
* @param b - Second level
|
|
153
|
+
* @returns The higher level
|
|
154
|
+
*/
|
|
155
|
+
export declare function maxLevel(a: CapabilityLevel, b: CapabilityLevel): CapabilityLevel;
|
|
156
|
+
/**
|
|
157
|
+
* Clamps a level to a range.
|
|
158
|
+
*
|
|
159
|
+
* @param level - The level to clamp
|
|
160
|
+
* @param min - Minimum allowed level
|
|
161
|
+
* @param max - Maximum allowed level
|
|
162
|
+
* @returns The clamped level
|
|
163
|
+
*/
|
|
164
|
+
export declare function clampLevel(level: CapabilityLevel, min?: CapabilityLevel, max?: CapabilityLevel): CapabilityLevel;
|
|
165
|
+
/**
|
|
166
|
+
* Gets the configuration for a capability level.
|
|
167
|
+
*
|
|
168
|
+
* @param level - The capability level
|
|
169
|
+
* @returns Level configuration
|
|
170
|
+
*/
|
|
171
|
+
export declare function getLevelConfig(level: CapabilityLevel): CapabilityLevelConfig;
|
|
172
|
+
/**
|
|
173
|
+
* Gets the human-readable name for a capability level.
|
|
174
|
+
*
|
|
175
|
+
* @param level - The capability level
|
|
176
|
+
* @returns Level name
|
|
177
|
+
*/
|
|
178
|
+
export declare function getLevelName(level: CapabilityLevel): string;
|
|
179
|
+
/**
|
|
180
|
+
* Gets the short code (L0-L7) for a capability level.
|
|
181
|
+
*
|
|
182
|
+
* @param level - The capability level
|
|
183
|
+
* @returns Level code
|
|
184
|
+
*/
|
|
185
|
+
export declare function getLevelCode(level: CapabilityLevel): string;
|
|
186
|
+
/**
|
|
187
|
+
* Gets the description for a capability level.
|
|
188
|
+
*
|
|
189
|
+
* @param level - The capability level
|
|
190
|
+
* @returns Level description
|
|
191
|
+
*/
|
|
192
|
+
export declare function getLevelDescription(level: CapabilityLevel): string;
|
|
193
|
+
/**
|
|
194
|
+
* Checks if a level has a specific ability.
|
|
195
|
+
*
|
|
196
|
+
* @param level - The capability level
|
|
197
|
+
* @param ability - The ability to check
|
|
198
|
+
* @returns True if the level grants this ability
|
|
199
|
+
*/
|
|
200
|
+
export declare function hasAbility(level: CapabilityLevel, ability: string): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Checks if a level requires approval for actions.
|
|
203
|
+
*
|
|
204
|
+
* @param level - The capability level
|
|
205
|
+
* @returns True if approval is required
|
|
206
|
+
*/
|
|
207
|
+
export declare function requiresApproval(level: CapabilityLevel): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Checks if a level can operate autonomously.
|
|
210
|
+
*
|
|
211
|
+
* @param level - The capability level
|
|
212
|
+
* @returns True if autonomous operation is allowed
|
|
213
|
+
*/
|
|
214
|
+
export declare function canOperateAutonomously(level: CapabilityLevel): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Parses a level string (e.g., "L3" or "3") to a CapabilityLevel.
|
|
217
|
+
*
|
|
218
|
+
* @param levelStr - Level string to parse
|
|
219
|
+
* @returns Parsed CapabilityLevel
|
|
220
|
+
* @throws Error if the string is not a valid level
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* parseLevel('L3'); // CapabilityLevel.L3_EXECUTE
|
|
225
|
+
* parseLevel('3'); // CapabilityLevel.L3_EXECUTE
|
|
226
|
+
* parseLevel('L0'); // CapabilityLevel.L0_OBSERVE
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export declare function parseLevel(levelStr: string): CapabilityLevel;
|
|
230
|
+
/**
|
|
231
|
+
* Safely parses a level string, returning null on failure.
|
|
232
|
+
*
|
|
233
|
+
* @param levelStr - Level string to parse
|
|
234
|
+
* @returns Parsed CapabilityLevel or null
|
|
235
|
+
*/
|
|
236
|
+
export declare function tryParseLevel(levelStr: string): CapabilityLevel | null;
|
|
237
|
+
/**
|
|
238
|
+
* Type guard to check if a value is a valid CapabilityLevel.
|
|
239
|
+
*
|
|
240
|
+
* @param value - Value to check
|
|
241
|
+
* @returns True if value is a valid CapabilityLevel
|
|
242
|
+
*/
|
|
243
|
+
export declare function isCapabilityLevel(value: unknown): value is CapabilityLevel;
|
|
244
|
+
/**
|
|
245
|
+
* Zod schema for level configuration.
|
|
246
|
+
*/
|
|
247
|
+
export declare const capabilityLevelConfigSchema: z.ZodObject<{
|
|
248
|
+
level: z.ZodNativeEnum<typeof CapabilityLevel>;
|
|
249
|
+
code: z.ZodString;
|
|
250
|
+
name: z.ZodString;
|
|
251
|
+
description: z.ZodString;
|
|
252
|
+
abilities: z.ZodReadonly<z.ZodArray<z.ZodString, "many">>;
|
|
253
|
+
requiresApproval: z.ZodBoolean;
|
|
254
|
+
canOperateAutonomously: z.ZodBoolean;
|
|
255
|
+
minCertificationTier: z.ZodNumber;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
name: string;
|
|
258
|
+
code: string;
|
|
259
|
+
description: string;
|
|
260
|
+
level: CapabilityLevel;
|
|
261
|
+
abilities: readonly string[];
|
|
262
|
+
requiresApproval: boolean;
|
|
263
|
+
canOperateAutonomously: boolean;
|
|
264
|
+
minCertificationTier: number;
|
|
265
|
+
}, {
|
|
266
|
+
name: string;
|
|
267
|
+
code: string;
|
|
268
|
+
description: string;
|
|
269
|
+
level: CapabilityLevel;
|
|
270
|
+
abilities: readonly string[];
|
|
271
|
+
requiresApproval: boolean;
|
|
272
|
+
canOperateAutonomously: boolean;
|
|
273
|
+
minCertificationTier: number;
|
|
274
|
+
}>;
|
|
275
|
+
/**
|
|
276
|
+
* Zod schema for parsing level strings.
|
|
277
|
+
*/
|
|
278
|
+
export declare const levelStringSchema: z.ZodEffects<z.ZodString, CapabilityLevel, string>;
|
|
279
|
+
//# sourceMappingURL=levels.d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