@dynamicalsystems/idl 0.6.1

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 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/primitives.ts","../src/kernel/dispatch-consume.v1.ts","../src/run/operation.v1.ts","../src/infra/signed-law.v1.ts","../src/infra/resource-descriptor.v1.ts","../src/infra/adoption-fact.v1.ts","../src/registry/revocations.v1.ts","../src/kernel/bootstrap.v1.ts","../src/kernel/ordinary-authority.v1.ts","../src/run/contract-versions.ts","../src/index.ts"],"mappings":"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"}
package/dist/index.mjs ADDED
@@ -0,0 +1,646 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { ORN_PATTERN, SHA256_PATTERN } from "@dynamicalsystems/orn-schemas";
3
+ //#region src/primitives.ts
4
+ /** Closed object: an extra field is a different protocol. */
5
+ const closed = (properties) => Type.Object(properties, { additionalProperties: false });
6
+ /** Lowercase sha256 hex. Every digest on the wire. */
7
+ const Hex64 = Type.String({ pattern: "^[0-9a-f]{64}$" });
8
+ /** Exact UTC second, Z suffix, no fractional part. */
9
+ const UtcSecond = Type.String({ pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" });
10
+ const NonEmptyString = Type.String({ minLength: 1 });
11
+ const SafeInt = Type.Integer({
12
+ minimum: 0,
13
+ maximum: Number.MAX_SAFE_INTEGER
14
+ });
15
+ /** An ORN, validated by the grammar dsg-orn owns. Built from the exported
16
+ * pattern, not the exported schema object: the upstream schemas carry
17
+ * JSON Schema $id metadata, and embedding the same $id in several route
18
+ * schemas makes validators refuse the duplicate. The pattern is the wire
19
+ * truth; the metadata is not. */
20
+ const Orn = Type.String({ pattern: ORN_PATTERN });
21
+ /** The pair of an ORN and the sha256 pinning a version (dsg-orn Reference). */
22
+ const Reference = closed({
23
+ orn: Orn,
24
+ sha256: Type.String({ pattern: SHA256_PATTERN })
25
+ });
26
+ //#endregion
27
+ //#region src/kernel/dispatch-consume.v1.ts
28
+ const DISPATCH_CONSUME_PROFILE = "dsg.kernel.dispatch-consume/1";
29
+ /** The bounded clock skew a lease check must tolerate, in seconds. */
30
+ const DISPATCH_MAX_SKEW_SECONDS = 300;
31
+ const DispatchConsumeRequestSchema = closed({
32
+ profile: Type.Literal(DISPATCH_CONSUME_PROFILE),
33
+ /** The kernel operation identity from the accepted OperationRequest. */
34
+ operationId: NonEmptyString,
35
+ /** The workspace generation the plane admitted the operation at. */
36
+ generation: Type.Integer({ minimum: 0 }),
37
+ /** The Case the operation belongs to - the stream the consume event
38
+ * lands on and the stream the reservation was recorded on. */
39
+ caseOrn: Orn,
40
+ /** SHA256(JCS(complete OperationRequest)) - the M010 envelope digest. */
41
+ envelopeSha256: Hex64,
42
+ /** The exact retained signed-law bytes the Case pins. */
43
+ lawSha256: Hex64,
44
+ /** The K04 reservation the authorization is bound to: sha256 is the
45
+ * reservation event's record id. */
46
+ reservation: Reference,
47
+ requestedAt: UtcSecond,
48
+ /** False: first consumption or idempotent replay of it. True: an explicit
49
+ * renewal - a new recorded authorization decision for the same operation
50
+ * and reservation after lease expiry with the work known unsubmitted. A
51
+ * replay never renews; only this flag does, and it re-runs every
52
+ * revocation check at the current record state. */
53
+ renewal: Type.Boolean()
54
+ });
55
+ const DispatchLeaseSchema = closed({
56
+ profile: Type.Literal(DISPATCH_CONSUME_PROFILE),
57
+ /** The consume event's record id: the committed ordering point. */
58
+ leaseId: Hex64,
59
+ operationId: NonEmptyString,
60
+ generation: Type.Integer({ minimum: 0 }),
61
+ caseOrn: Orn,
62
+ envelopeSha256: Hex64,
63
+ lawSha256: Hex64,
64
+ reservation: Reference,
65
+ consumedAt: UtcSecond,
66
+ /** Fixed maximum duration from consumedAt; the plane checks validity
67
+ * before each new non-cleanup call, Batch submission included. */
68
+ expiresAt: UtcSecond,
69
+ /** The bounded clock skew a lease check must tolerate, in seconds. */
70
+ maxSkewSeconds: Type.Integer({
71
+ minimum: 0,
72
+ maximum: 300
73
+ }),
74
+ renewal: Type.Literal("new-authorization-required"),
75
+ /** False when this response replays an earlier committed consumption:
76
+ * the lease bytes, expiry included, are the original's. */
77
+ fresh: Type.Boolean()
78
+ });
79
+ const DispatchRefusalCodeSchema = Type.Union([
80
+ Type.Literal("unknown_operation"),
81
+ Type.Literal("no_reservation"),
82
+ Type.Literal("binding_mismatch"),
83
+ Type.Literal("revoked"),
84
+ Type.Literal("authority_refused"),
85
+ Type.Literal("renewal_requires_existing_consumption"),
86
+ Type.Literal("unavailable")
87
+ ]);
88
+ const DispatchRefusalSchema = closed({
89
+ profile: Type.Literal(DISPATCH_CONSUME_PROFILE),
90
+ code: DispatchRefusalCodeSchema,
91
+ issues: Type.Array(NonEmptyString, { minItems: 1 })
92
+ });
93
+ const dispatchConsumeV1 = {
94
+ literal: DISPATCH_CONSUME_PROFILE,
95
+ shapes: {
96
+ request: DispatchConsumeRequestSchema,
97
+ lease: DispatchLeaseSchema,
98
+ refusal: DispatchRefusalSchema
99
+ }
100
+ };
101
+ //#endregion
102
+ //#region src/run/operation.v1.ts
103
+ const OPERATION_PROFILE = "dsg.run.operation/1";
104
+ const ExecutionResourcesSchema = closed({
105
+ maxGpuSeconds: SafeInt,
106
+ maxRunSeconds: SafeInt,
107
+ maxParallelism: SafeInt
108
+ });
109
+ const ExecutionLawSchema = closed({
110
+ bundle: Reference,
111
+ registryRelease: Reference
112
+ });
113
+ const ExecutionDocumentSchema = closed({
114
+ schemaVersion: Type.Literal(1),
115
+ classContract: Reference,
116
+ law: ExecutionLawSchema,
117
+ workload: Reference,
118
+ inputs: Type.Array(Reference),
119
+ resources: ExecutionResourcesSchema,
120
+ costBound: Reference,
121
+ placement: Reference,
122
+ results: Reference,
123
+ secrets: Type.Array(Reference)
124
+ });
125
+ const OperationBeforeSchema = closed({
126
+ operationId: Type.Union([NonEmptyString, Type.Null()]),
127
+ planDigest: Type.Union([Hex64, Type.Null()])
128
+ });
129
+ const OperationRequestSchema = closed({
130
+ profile: Type.Literal(OPERATION_PROFILE),
131
+ operationId: NonEmptyString,
132
+ case: Reference,
133
+ workspace: NonEmptyString,
134
+ expectedGeneration: SafeInt,
135
+ before: OperationBeforeSchema,
136
+ planDigest: Hex64,
137
+ document: ExecutionDocumentSchema,
138
+ authority: Reference,
139
+ reservation: Reference
140
+ });
141
+ const AcceptedSchema = closed({
142
+ profile: Type.Literal(OPERATION_PROFILE),
143
+ operationId: NonEmptyString,
144
+ actionId: NonEmptyString,
145
+ generation: SafeInt,
146
+ planDigest: Hex64,
147
+ acceptedAt: NonEmptyString
148
+ });
149
+ const OperationExecutionSchema = Type.Union([
150
+ Type.Literal("queued"),
151
+ Type.Literal("running"),
152
+ Type.Literal("succeeded"),
153
+ Type.Literal("failed"),
154
+ Type.Literal("canceled"),
155
+ Type.Literal("unknown")
156
+ ]);
157
+ const OperationCleanupSchema = Type.Union([
158
+ Type.Literal("pending"),
159
+ Type.Literal("present"),
160
+ Type.Literal("absent"),
161
+ Type.Literal("unknown")
162
+ ]);
163
+ const OperationEvidenceSchema = Type.Union([Type.Literal("pending"), Type.Literal("ready")]);
164
+ const OperationCostSchema = Type.Union([
165
+ Type.Literal("reserved"),
166
+ Type.Literal("provisional"),
167
+ Type.Literal("reconciled")
168
+ ]);
169
+ const ReadbackSchema = closed({
170
+ operationId: NonEmptyString,
171
+ generation: SafeInt,
172
+ planDigest: Hex64,
173
+ execution: OperationExecutionSchema,
174
+ cleanup: OperationCleanupSchema,
175
+ evidence: OperationEvidenceSchema,
176
+ evidenceRef: Type.Union([Reference, Type.Null()]),
177
+ cost: OperationCostSchema
178
+ });
179
+ const OperationStatusSchema = ReadbackSchema;
180
+ const operationV1 = {
181
+ literal: OPERATION_PROFILE,
182
+ shapes: {
183
+ request: OperationRequestSchema,
184
+ accepted: AcceptedSchema,
185
+ readback: ReadbackSchema
186
+ }
187
+ };
188
+ //#endregion
189
+ //#region src/infra/resource-descriptor.v1.ts
190
+ const RESOURCE_DESCRIPTOR_PROFILE = "dsg.infra.resource-descriptor/1";
191
+ /** The document kind: the profile literal without its version suffix; the
192
+ * version rides in schemaVersion. Frozen /1 wire choice. */
193
+ const RESOURCE_DESCRIPTOR_KIND = "dsg.infra.resource-descriptor";
194
+ const prefixedDigest = Type.String({ pattern: "^sha256:[0-9a-f]{64}$" });
195
+ const ResourceDescriptorSchema = closed({
196
+ schemaVersion: Type.Literal(1),
197
+ kind: Type.Literal(RESOURCE_DESCRIPTOR_KIND),
198
+ workloadClass: NonEmptyString,
199
+ lifecycle: Type.Union([Type.Literal("ephemeral"), Type.Literal("durable")]),
200
+ machineType: Type.String({ pattern: "^[a-z][a-z0-9]*-[a-z0-9]+-[0-9]+$" }),
201
+ accelerator: Type.Union([Type.String({ minLength: 1 }), Type.Null()]),
202
+ acceleratorCount: Type.Integer({ minimum: 0 }),
203
+ vcpuCount: Type.Integer({ minimum: 1 }),
204
+ memoryGiB: Type.Integer({ minimum: 1 }),
205
+ maxRunSeconds: Type.Integer({ minimum: 1 }),
206
+ maxParallelism: Type.Integer({ minimum: 1 }),
207
+ region: NonEmptyString,
208
+ imageDigest: prefixedDigest,
209
+ moduleDigest: prefixedDigest,
210
+ externalIp: Type.Literal(false),
211
+ network: Type.Literal("private"),
212
+ reservation: closed({
213
+ gpuSeconds: Type.Integer({ minimum: 0 }),
214
+ usdMicroUnits: Type.Integer({ minimum: 0 })
215
+ })
216
+ });
217
+ const resourceDescriptorV1 = {
218
+ literal: RESOURCE_DESCRIPTOR_PROFILE,
219
+ literalNote: "carried as kind (unversioned) plus schemaVersion on the document; the /1 literal is the version marker signed-law pins",
220
+ rootShape: "descriptor",
221
+ shapes: { descriptor: ResourceDescriptorSchema }
222
+ };
223
+ //#endregion
224
+ //#region src/infra/signed-law.v1.ts
225
+ const SIGNED_LAW_PROFILE = "dsg.infra.signed-law/1";
226
+ /** The signature-input domain member is exactly the profile literal. */
227
+ const SIGNED_LAW_DOMAIN = SIGNED_LAW_PROFILE;
228
+ /** The scope vocabulary version today's laws cite in
229
+ * standingOrder.scopeReference. The FIELD stays an open nonempty string on
230
+ * purpose (a law may cite a future scope); this constant is the value in
231
+ * force, exported so no consumer hand-types it. */
232
+ const SCOPE_REFERENCE = "dsg.infra.scope/1";
233
+ /** The price-profile version today's laws cite in priceProfile.reference.
234
+ * Same rule: the field stays open; this is the value in force. */
235
+ const PRICE_PROFILE_REFERENCE = "dsg.infra.price-profile/1";
236
+ const nullableString = Type.Union([Type.String({ minLength: 1 }), Type.Null()]);
237
+ const authority = Type.Object({
238
+ issuerType: Type.Literal("human"),
239
+ issuerReference: nullableString,
240
+ designationReference: nullableString,
241
+ signatureReference: nullableString,
242
+ humanSignatureRequired: Type.Literal(true),
243
+ releaseAutomationMayIssue: Type.Literal(false)
244
+ }, { additionalProperties: false });
245
+ const utcSecond = Type.String({ pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" });
246
+ const standingOrder = Type.Object({
247
+ reference: nullableString,
248
+ designationReference: nullableString,
249
+ scopeReference: Type.String({ minLength: 1 }),
250
+ issuedAt: Type.Union([utcSecond, Type.Null()]),
251
+ expiresAt: Type.Union([utcSecond, Type.Null()])
252
+ }, { additionalProperties: false });
253
+ const scope = Type.Object({
254
+ actions: Type.Array(Type.String({ minLength: 1 }), {
255
+ minItems: 1,
256
+ uniqueItems: true
257
+ }),
258
+ workloadClasses: Type.Array(Type.String({ minLength: 1 }), {
259
+ minItems: 1,
260
+ uniqueItems: true
261
+ }),
262
+ providers: Type.Array(Type.Literal("provider-neutral"), {
263
+ minItems: 1,
264
+ uniqueItems: true
265
+ }),
266
+ regions: Type.Array(Type.String({ minLength: 1 }), { uniqueItems: true }),
267
+ resourceDescriptorVersion: Type.Literal(RESOURCE_DESCRIPTOR_PROFILE)
268
+ }, { additionalProperties: false });
269
+ const validity = Type.Object({
270
+ clock: Type.Literal("UTC"),
271
+ notBefore: Type.Union([utcSecond, Type.Null()]),
272
+ notAfter: Type.Union([utcSecond, Type.Null()])
273
+ }, { additionalProperties: false });
274
+ const revocation = Type.Object({
275
+ snapshotReference: nullableString,
276
+ failClosed: Type.Literal(true),
277
+ checks: Type.Array(Type.String({ minLength: 1 }), {
278
+ minItems: 1,
279
+ uniqueItems: true
280
+ })
281
+ }, { additionalProperties: false });
282
+ const ceiling = Type.Object({
283
+ unit: Type.String({ minLength: 1 }),
284
+ period: Type.String({ minLength: 1 }),
285
+ scope: Type.Union([Type.Literal("person"), Type.Literal("organization")]),
286
+ value: Type.Union([Type.Integer({ minimum: 0 }), Type.Null()])
287
+ }, { additionalProperties: false });
288
+ const capabilityProfile = Type.Object({
289
+ lifecycle: Type.Union([Type.Literal("ephemeral"), Type.Literal("durable")]),
290
+ machinePrefixes: Type.Array(Type.String({ minLength: 1 }), {
291
+ minItems: 1,
292
+ uniqueItems: true
293
+ }),
294
+ accelerators: Type.Array(Type.String({ minLength: 1 }), { uniqueItems: true }),
295
+ maxRunSeconds: Type.Union([Type.Integer({ minimum: 0 }), Type.Null()]),
296
+ maxParallelism: Type.Union([Type.Integer({ minimum: 1 }), Type.Null()]),
297
+ maxGpuInstances: Type.Union([Type.Integer({ minimum: 0 }), Type.Null()]),
298
+ maxVcpus: Type.Union([Type.Integer({ minimum: 1 }), Type.Null()]),
299
+ network: Type.Literal("private"),
300
+ externalIpAllowed: Type.Literal(false)
301
+ }, { additionalProperties: false });
302
+ const capabilities = Type.Object({
303
+ providerNeutral: Type.Literal(true),
304
+ descriptorVersion: Type.Literal(RESOURCE_DESCRIPTOR_PROFILE),
305
+ profiles: Type.Record(Type.String(), capabilityProfile, { minProperties: 1 })
306
+ }, { additionalProperties: false });
307
+ const priceProfile = Type.Object({
308
+ reference: Type.String({ minLength: 1 }),
309
+ status: Type.Union([Type.Literal("unassigned"), Type.Literal("retained")]),
310
+ currency: Type.Literal("USD"),
311
+ unit: Type.Literal("micro_usd"),
312
+ basis: Type.Literal("retained-conservative-on-demand"),
313
+ rates: Type.Object({
314
+ vcpuSecond: Type.Optional(Type.Integer({ minimum: 0 })),
315
+ memoryGiBSecond: Type.Optional(Type.Integer({ minimum: 0 })),
316
+ gpuSecond: Type.Optional(Type.Integer({ minimum: 0 })),
317
+ startup: Type.Optional(Type.Integer({ minimum: 0 }))
318
+ }, { additionalProperties: false }),
319
+ safetyFactorBps: Type.Union([Type.Integer({ minimum: 1e4 }), Type.Null()]),
320
+ validFrom: Type.Union([utcSecond, Type.Null()]),
321
+ validUntil: Type.Union([utcSecond, Type.Null()])
322
+ }, { additionalProperties: false });
323
+ const bootstrap = Type.Object({
324
+ mode: Type.Literal("finite-human-root"),
325
+ rootReferences: Type.Array(Type.String({ minLength: 1 }), { uniqueItems: true }),
326
+ allowedActions: Type.Array(Type.Union([
327
+ Type.Literal("enroll_human_root"),
328
+ Type.Literal("initialize_kernel_record"),
329
+ Type.Literal("restore_kernel_record"),
330
+ Type.Literal("cutover_single_writer")
331
+ ]), {
332
+ minItems: 1,
333
+ uniqueItems: true
334
+ }),
335
+ maxUses: Type.Integer({
336
+ minimum: 1,
337
+ maximum: 1
338
+ }),
339
+ expiresAt: Type.Union([utcSecond, Type.Null()]),
340
+ projectCreationAllowed: Type.Literal(false),
341
+ requiresHumanSignature: Type.Literal(true),
342
+ automationCanSatisfy: Type.Literal(false)
343
+ }, { additionalProperties: false });
344
+ const digest$1 = Type.String({ pattern: "^sha256:[0-9a-f]{64}$" });
345
+ const policyBundle = Type.Object({
346
+ digest: digest$1,
347
+ manifest: Type.Record(Type.String({ pattern: "^policy/[A-Za-z0-9._-]+\\.rego$" }), Type.String({ pattern: "^[0-9a-f]{64}$" }), {
348
+ additionalProperties: false,
349
+ minProperties: 1
350
+ })
351
+ }, { additionalProperties: false });
352
+ const lawInputProfile = Type.Object({
353
+ requiresRunCeiling: Type.Boolean(),
354
+ requiresExpirationLabel: Type.Boolean(),
355
+ maxRunSeconds: Type.Integer({ minimum: 1 }),
356
+ allowExternalIp: Type.Literal(false),
357
+ machinePrefixes: Type.Array(Type.String({ minLength: 1 }), {
358
+ minItems: 1,
359
+ uniqueItems: true
360
+ }),
361
+ accelerators: Type.Array(Type.String({ minLength: 1 }), { uniqueItems: true }),
362
+ maxGpuInstances: Type.Integer({ minimum: 0 }),
363
+ maxTotalVcpus: Type.Integer({ minimum: 1 }),
364
+ maxParallelism: Type.Integer({ minimum: 1 }),
365
+ network: Type.Literal("private")
366
+ }, { additionalProperties: false });
367
+ const lawInputs = Type.Object({
368
+ cloudflare: Type.Object({
369
+ approvedZoneId: Type.String({ minLength: 1 }),
370
+ approvedAccountId: Type.String({ minLength: 1 })
371
+ }, { additionalProperties: false }),
372
+ planLimits: Type.Object({
373
+ maxGpuInstances: Type.Integer({ minimum: 0 }),
374
+ maxTotalVcpus: Type.Integer({ minimum: 1 }),
375
+ approvedLocations: Type.Array(Type.String({ minLength: 1 }), {
376
+ minItems: 1,
377
+ uniqueItems: true
378
+ })
379
+ }, { additionalProperties: false }),
380
+ profiles: Type.Object({
381
+ compute: lawInputProfile,
382
+ plane: lawInputProfile
383
+ }, { additionalProperties: false })
384
+ }, { additionalProperties: false });
385
+ const evaluationInputs = Type.Object({
386
+ policyBundle,
387
+ lawInputs
388
+ }, { additionalProperties: false });
389
+ const lawDocument = Type.Object({
390
+ schemaVersion: Type.Literal(1),
391
+ kind: Type.Literal("dsg.infra.law"),
392
+ lawId: Type.String({ minLength: 1 }),
393
+ status: Type.Union([Type.Literal("unissued"), Type.Literal("issued")]),
394
+ authority,
395
+ standingOrder,
396
+ scope,
397
+ validity,
398
+ revocation,
399
+ ceilings: Type.Object({
400
+ gpuSecondsPerPersonUtcWeek: ceiling,
401
+ usdMicroUnitsPerPersonUtcMonth: ceiling,
402
+ usdMicroUnitsPerOrganizationUtcMonth: ceiling
403
+ }, { additionalProperties: false }),
404
+ capabilities,
405
+ priceProfile,
406
+ bootstrap,
407
+ evaluationInputs
408
+ }, { additionalProperties: false });
409
+ const signature = Type.Object({
410
+ algorithm: Type.Literal("Ed25519"),
411
+ keyClass: Type.Union([
412
+ Type.Literal("synthetic-test-only"),
413
+ Type.Literal("human-authority"),
414
+ Type.Literal("release-automation")
415
+ ]),
416
+ publicKeyHex: Type.String({ pattern: "^[0-9a-f]{64}$" }),
417
+ signatureHex: Type.String({ pattern: "^[0-9a-f]{128}$" })
418
+ }, { additionalProperties: false });
419
+ const SignedLawBundleSchema = Type.Object({
420
+ schemaVersion: Type.Literal(1),
421
+ kind: Type.Union([Type.Literal("dsg.infra.signed-law"), Type.Literal("dsg.infra.signed-law-fixture")]),
422
+ testOnly: Type.Boolean(),
423
+ deployedAuthority: Type.Boolean(),
424
+ payload: lawDocument,
425
+ canonicalPayload: Type.String({ minLength: 1 }),
426
+ payloadSha256: Type.String({ pattern: "^[0-9a-f]{64}$" }),
427
+ canonicalSignatureInput: Type.String({ minLength: 1 }),
428
+ signature
429
+ }, { additionalProperties: false });
430
+ const signedLawV1 = {
431
+ literal: SIGNED_LAW_PROFILE,
432
+ literalNote: "carried as the domain member of the canonical signature input, not as a bundle field",
433
+ shapes: { bundle: SignedLawBundleSchema }
434
+ };
435
+ //#endregion
436
+ //#region src/infra/adoption-fact.v1.ts
437
+ const ADOPTION_FACT_PROFILE = "dsg.infra.adoption-fact/1";
438
+ const AdoptionFactSchema = closed({
439
+ profile: Type.Literal(ADOPTION_FACT_PROFILE),
440
+ /** The root the record names as active baseline owner. */
441
+ root: NonEmptyString,
442
+ lineage: NonEmptyString,
443
+ /** The accepted root-authorizing operation. */
444
+ operation: NonEmptyString,
445
+ /** Count of accepted root operations; ownership needs at least one. */
446
+ generation: Type.Integer({
447
+ minimum: 1,
448
+ maximum: Number.MAX_SAFE_INTEGER
449
+ }),
450
+ /** Canonical digest of the verified record snapshot. */
451
+ snapshotSha256: Hex64,
452
+ /** initialize establishes the first owner; cutover transfers it. restore
453
+ * and enrollment move custody and human roots, never root ownership. */
454
+ action: Type.Union([Type.Literal("initialize_kernel_record"), Type.Literal("cutover_single_writer")]),
455
+ signer: Orn,
456
+ humanRoot: NonEmptyString,
457
+ testOnly: Type.Boolean()
458
+ });
459
+ const adoptionFactV1 = {
460
+ literal: ADOPTION_FACT_PROFILE,
461
+ rootShape: "fact",
462
+ shapes: { fact: AdoptionFactSchema }
463
+ };
464
+ //#endregion
465
+ //#region src/registry/revocations.v1.ts
466
+ const REVOCATIONS_PROFILE = "dsg.registry.revocations/1";
467
+ const closed$1 = { additionalProperties: false };
468
+ const text = Type.String({ minLength: 1 });
469
+ const digest = Type.String({ pattern: "^[0-9a-f]{64}$" });
470
+ const time = Type.Integer({
471
+ minimum: 0,
472
+ maximum: Number.MAX_SAFE_INTEGER
473
+ });
474
+ const RevocationSchema = Type.Object({
475
+ domain: Type.Literal(REVOCATIONS_PROFILE),
476
+ version: Type.Integer({
477
+ minimum: 1,
478
+ maximum: Number.MAX_SAFE_INTEGER
479
+ }),
480
+ issuedAt: time,
481
+ expiresAt: time,
482
+ previousSha256: Type.Union([digest, Type.Null()]),
483
+ testOnly: Type.Literal(true),
484
+ signerKey: digest,
485
+ revoked: Type.Array(Type.Object({
486
+ kind: Type.Union([
487
+ Type.Literal("principal"),
488
+ Type.Literal("standing-order"),
489
+ Type.Literal("law"),
490
+ Type.Literal("class"),
491
+ Type.Literal("key")
492
+ ]),
493
+ id: text,
494
+ effectiveAt: time,
495
+ reason: text
496
+ }, closed$1)),
497
+ trustHistory: Type.Array(Type.Object({
498
+ principal: text,
499
+ publicKey: digest,
500
+ role: Type.Union([
501
+ Type.Literal("human"),
502
+ Type.Literal("release"),
503
+ Type.Literal("collector")
504
+ ]),
505
+ action: Type.Union([
506
+ Type.Literal("enroll"),
507
+ Type.Literal("rotate"),
508
+ Type.Literal("compromise")
509
+ ]),
510
+ effectiveAt: time,
511
+ authoritySha256: digest,
512
+ replacesKey: Type.Union([digest, Type.Null()])
513
+ }, closed$1))
514
+ }, closed$1);
515
+ const RevocationPointerSchema = Type.Object({
516
+ version: Type.Integer({
517
+ minimum: 1,
518
+ maximum: Number.MAX_SAFE_INTEGER
519
+ }),
520
+ sha256: digest,
521
+ url: Type.String({ pattern: "^/revocations/v/[1-9][0-9]*/snapshot\\.json$" })
522
+ }, closed$1);
523
+ const revocationsV1 = {
524
+ literal: REVOCATIONS_PROFILE,
525
+ shapes: {
526
+ snapshot: RevocationSchema,
527
+ pointer: RevocationPointerSchema
528
+ }
529
+ };
530
+ //#endregion
531
+ //#region src/kernel/bootstrap.v1.ts
532
+ const BOOTSTRAP_PROFILE = "dsg.kernel.bootstrap/1";
533
+ const BootstrapActionSchema = Type.Union([
534
+ Type.Literal("initialize_kernel_record"),
535
+ Type.Literal("restore_kernel_record"),
536
+ Type.Literal("cutover_single_writer"),
537
+ Type.Literal("enroll_human_root")
538
+ ]);
539
+ const BootstrapIntentSchema = closed({
540
+ version: Type.Literal(BOOTSTRAP_PROFILE),
541
+ operation: NonEmptyString,
542
+ action: BootstrapActionSchema,
543
+ lineage: NonEmptyString,
544
+ humanRoot: NonEmptyString,
545
+ signer: Orn,
546
+ scope: NonEmptyString,
547
+ resources: Type.Array(closed({
548
+ identity: NonEmptyString,
549
+ specSha256: Hex64
550
+ }), {
551
+ minItems: 1,
552
+ uniqueItems: true
553
+ }),
554
+ planSha256: Hex64,
555
+ preconditionsSha256: Hex64,
556
+ createdAt: NonEmptyString,
557
+ expiresAt: NonEmptyString,
558
+ maxUses: Type.Literal(1),
559
+ cost: closed({
560
+ currency: Type.Literal("USD"),
561
+ maxMicroUsd: Type.Integer({
562
+ minimum: 0,
563
+ maximum: Number.MAX_SAFE_INTEGER
564
+ }),
565
+ assumptionsSha256: Hex64
566
+ }),
567
+ testOnly: Type.Boolean()
568
+ });
569
+ const SignedBootstrapIntentSchema = closed({
570
+ body: BootstrapIntentSchema,
571
+ signature: Type.String({ pattern: "^[0-9a-f]{128}$" })
572
+ });
573
+ const bootstrapV1 = {
574
+ literal: BOOTSTRAP_PROFILE,
575
+ shapes: {
576
+ intent: BootstrapIntentSchema,
577
+ signed: SignedBootstrapIntentSchema
578
+ }
579
+ };
580
+ //#endregion
581
+ //#region src/kernel/ordinary-authority.v1.ts
582
+ const ORDINARY_AUTHORITY_PROFILE = "dsg.kernel.ordinary-authority/1";
583
+ const names = Type.Array(NonEmptyString, {
584
+ minItems: 1,
585
+ uniqueItems: true
586
+ });
587
+ const ceilingValue = Type.Integer({
588
+ minimum: 0,
589
+ maximum: Number.MAX_SAFE_INTEGER
590
+ });
591
+ const OrdinaryAuthoritySchema = closed({
592
+ version: Type.Literal(ORDINARY_AUTHORITY_PROFILE),
593
+ reference: NonEmptyString,
594
+ actor: Orn,
595
+ publicKeyHex: Hex64,
596
+ keyClass: Type.Union([Type.Literal("synthetic-test-only"), Type.Literal("human-authority")]),
597
+ designation: closed({
598
+ role: Type.Literal("law-issuer"),
599
+ designationReference: NonEmptyString
600
+ }),
601
+ scope: closed({
602
+ scopeReference: NonEmptyString,
603
+ actions: names,
604
+ workloadClasses: names,
605
+ regions: names
606
+ }),
607
+ validity: closed({
608
+ notBefore: UtcSecond,
609
+ notAfter: UtcSecond
610
+ }),
611
+ ceilings: closed({
612
+ gpuSecondsPerPersonUtcWeek: ceilingValue,
613
+ usdMicroUnitsPerPersonUtcMonth: ceilingValue,
614
+ usdMicroUnitsPerOrganizationUtcMonth: ceilingValue
615
+ }),
616
+ revoked: Type.Boolean()
617
+ });
618
+ const ordinaryAuthorityV1 = {
619
+ literal: ORDINARY_AUTHORITY_PROFILE,
620
+ rootShape: "authority",
621
+ shapes: { authority: OrdinaryAuthoritySchema }
622
+ };
623
+ //#endregion
624
+ //#region src/run/contract-versions.ts
625
+ const EXECUTOR_PROTOCOL_VERSION = "dsg.run.executor/1";
626
+ const PROVIDER_PROTOCOL_VERSION = "dsg.run.provider/1";
627
+ //#endregion
628
+ //#region src/index.ts
629
+ /** Every profile this version of the package defines, keyed by literal.
630
+ * Profile modules are added here as they are extracted; the rules test
631
+ * and the schema emitter walk this registry, so a module that is not
632
+ * registered does not exist. */
633
+ const PROFILES = {
634
+ [dispatchConsumeV1.literal]: dispatchConsumeV1,
635
+ [operationV1.literal]: operationV1,
636
+ [signedLawV1.literal]: signedLawV1,
637
+ [resourceDescriptorV1.literal]: resourceDescriptorV1,
638
+ [adoptionFactV1.literal]: adoptionFactV1,
639
+ [revocationsV1.literal]: revocationsV1,
640
+ [bootstrapV1.literal]: bootstrapV1,
641
+ [ordinaryAuthorityV1.literal]: ordinaryAuthorityV1
642
+ };
643
+ //#endregion
644
+ export { ADOPTION_FACT_PROFILE, AcceptedSchema, AdoptionFactSchema, BOOTSTRAP_PROFILE, BootstrapActionSchema, BootstrapIntentSchema, DISPATCH_CONSUME_PROFILE, DISPATCH_MAX_SKEW_SECONDS, DispatchConsumeRequestSchema, DispatchLeaseSchema, DispatchRefusalCodeSchema, DispatchRefusalSchema, EXECUTOR_PROTOCOL_VERSION, ExecutionDocumentSchema, ExecutionLawSchema, ExecutionResourcesSchema, Hex64, NonEmptyString, OPERATION_PROFILE, ORDINARY_AUTHORITY_PROFILE, OperationBeforeSchema, OperationCleanupSchema, OperationCostSchema, OperationEvidenceSchema, OperationExecutionSchema, OperationRequestSchema, OperationStatusSchema, OrdinaryAuthoritySchema, Orn, PRICE_PROFILE_REFERENCE, PROFILES, PROVIDER_PROTOCOL_VERSION, RESOURCE_DESCRIPTOR_KIND, RESOURCE_DESCRIPTOR_PROFILE, REVOCATIONS_PROFILE, ReadbackSchema, Reference, ResourceDescriptorSchema, RevocationPointerSchema, RevocationSchema, SCOPE_REFERENCE, SIGNED_LAW_DOMAIN, SIGNED_LAW_PROFILE, SafeInt, SignedBootstrapIntentSchema, SignedLawBundleSchema, UtcSecond, closed };
645
+
646
+ //# sourceMappingURL=index.mjs.map