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