@dynamicalsystems/idl 0.12.0 → 0.13.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.
@@ -0,0 +1,403 @@
1
+ // dsg.organization.release/1
2
+ // Semantic bodies and installation observations are separate documents.
3
+ import { type Static, Type } from "@sinclair/typebox";
4
+ import {
5
+ closed,
6
+ Hex64,
7
+ NonEmptyString,
8
+ Orn,
9
+ Reference,
10
+ SafeInt,
11
+ UtcSecond,
12
+ type ProfileEntry,
13
+ } from "../primitives.js";
14
+ import { ExtensionComponentKindSchema } from "../extension/release.v1.js";
15
+
16
+ export const ORGANIZATION_RELEASE_PROFILE = "dsg.organization.release/1" as const;
17
+ export const ORGANIZATION_RELEASE_CANONICALIZATION = "RFC8785-JCS-UTF8" as const;
18
+ const Identifier = Type.String({ pattern: "^[a-z][a-z0-9-]*(?:[.-][a-z0-9]+)*$" });
19
+ const Revision = Type.String({ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" });
20
+ const Identifiers = () => Type.Array(Identifier, { uniqueItems: true });
21
+ const References = () => Type.Array(Reference, { uniqueItems: true });
22
+ const Evidence = () => Type.Array(Reference, { minItems: 1, uniqueItems: true });
23
+ const Header = {
24
+ profile: Type.Literal(ORGANIZATION_RELEASE_PROFILE),
25
+ schemaVersion: Type.Literal(1),
26
+ };
27
+
28
+ export const CompilerContractSchema = closed({
29
+ profile: Type.String({ pattern: "^dsg\\.[a-z0-9.-]+/[1-9][0-9]*$" }),
30
+ version: Type.String({ pattern: "^(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)$" }),
31
+ implementation: Reference,
32
+ });
33
+ export type CompilerContract = Static<typeof CompilerContractSchema>;
34
+ export const DependencyKindSchema = Type.Union([
35
+ Type.Literal("extension-release"),
36
+ Type.Literal("component"),
37
+ Type.Literal("idl-package"),
38
+ Type.Literal("module-release"),
39
+ Type.Literal("law-release"),
40
+ Type.Literal("definition"),
41
+ Type.Literal("workload-artifact"),
42
+ Type.Literal("event-catalog"),
43
+ Type.Literal("example"),
44
+ Type.Literal("project"),
45
+ Type.Literal("target"),
46
+ ]);
47
+ export type DependencyKind = Static<typeof DependencyKindSchema>;
48
+ export const DependencyLockEntrySchema = closed({
49
+ id: Identifier,
50
+ kind: DependencyKindSchema,
51
+ reference: Reference,
52
+ mediaType: NonEmptyString,
53
+ selectedMemberIds: Identifiers(),
54
+ dependsOn: Identifiers(),
55
+ });
56
+ export type DependencyLockEntry = Static<typeof DependencyLockEntrySchema>;
57
+ // Entries and their dependency IDs are sorted. The closure is exactly the graph
58
+ // reachable from roots; graph validation is a consumer obligation, not uniqueItems.
59
+ export const DependencyLockSchema = closed({
60
+ ...Header,
61
+ kind: Type.Literal("dependency-lock"),
62
+ canonicalization: Type.Literal(ORGANIZATION_RELEASE_CANONICALIZATION),
63
+ roots: Identifiers(),
64
+ entries: Type.Array(DependencyLockEntrySchema, { uniqueItems: true }),
65
+ compiler: CompilerContractSchema,
66
+ });
67
+ export type DependencyLock = Static<typeof DependencyLockSchema>;
68
+
69
+ export const OrganizationReleaseMemberKindSchema = Type.Union([
70
+ Type.Literal("publication"),
71
+ Type.Literal("import"),
72
+ Type.Literal("capability-admission"),
73
+ Type.Literal("workflow-publication"),
74
+ Type.Literal("contract-check"),
75
+ Type.Literal("target-readiness"),
76
+ Type.Literal("setup-condition"),
77
+ Type.Literal("paid-execution-readiness"),
78
+ ]);
79
+ export type OrganizationReleaseMemberKind = Static<typeof OrganizationReleaseMemberKindSchema>;
80
+ export const OrganizationReleaseMemberSchema = closed({
81
+ id: Identifier,
82
+ kind: OrganizationReleaseMemberKindSchema,
83
+ required: Type.Boolean(),
84
+ acceptableDispositions: Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true }),
85
+ subject: Reference,
86
+ });
87
+ export type OrganizationReleaseMember = Static<typeof OrganizationReleaseMemberSchema>;
88
+ export const ComponentBindingSchema = closed({
89
+ id: Identifier,
90
+ kind: ExtensionComponentKindSchema,
91
+ reference: Reference,
92
+ });
93
+ export type ComponentBinding = Static<typeof ComponentBindingSchema>;
94
+ export const BuildSelectionSchema = closed({
95
+ id: Identifier,
96
+ selection: Reference,
97
+ extensionRelease: Reference,
98
+ members: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
99
+ });
100
+ export type BuildSelection = Static<typeof BuildSelectionSchema>;
101
+ export const BuildComponentSchema = closed({
102
+ extensionRelease: Reference,
103
+ memberId: Identifier,
104
+ kind: ExtensionComponentKindSchema,
105
+ reference: Reference,
106
+ mediaType: NonEmptyString,
107
+ });
108
+ export type BuildComponent = Static<typeof BuildComponentSchema>;
109
+ export const OrganizationBuildSchema = closed({
110
+ ...Header,
111
+ kind: Type.Literal("organization-build"),
112
+ organization: NonEmptyString,
113
+ canonicalization: Type.Literal(ORGANIZATION_RELEASE_CANONICALIZATION),
114
+ source: closed({ root: Reference, revision: Revision }),
115
+ facts: closed({ name: NonEmptyString, purpose: NonEmptyString, space: NonEmptyString }),
116
+ workspaceProfile: Reference,
117
+ projects: Type.Array(closed({ id: Identifier, membership: Reference, revision: Revision }), {
118
+ uniqueItems: true,
119
+ }),
120
+ sourceDocuments: Type.Array(
121
+ closed({ path: NonEmptyString, sha256: Hex64, mediaType: NonEmptyString }),
122
+ { minItems: 1, uniqueItems: true },
123
+ ),
124
+ selections: Type.Array(BuildSelectionSchema, { uniqueItems: true }),
125
+ components: Type.Array(BuildComponentSchema, { uniqueItems: true }),
126
+ typedReleases: Type.Array(DependencyLockEntrySchema, { uniqueItems: true }),
127
+ dependencyLock: Reference,
128
+ compiler: CompilerContractSchema,
129
+ instructions: References(),
130
+ handling: References(),
131
+ releaseDeclarations: References(),
132
+ releaseMembers: Type.Array(OrganizationReleaseMemberSchema, { uniqueItems: true }),
133
+ });
134
+ export type OrganizationBuild = Static<typeof OrganizationBuildSchema>;
135
+ // No self-reference or status: activation and supersession are record state.
136
+ export const OrganizationReleaseSchema = closed({
137
+ ...Header,
138
+ kind: Type.Literal("organization-release"),
139
+ id: Identifier,
140
+ organization: NonEmptyString,
141
+ build: Reference,
142
+ dependencyLock: Reference,
143
+ selections: Identifiers(),
144
+ members: Type.Array(OrganizationReleaseMemberSchema, { minItems: 1, uniqueItems: true }),
145
+ });
146
+ export type OrganizationRelease = Static<typeof OrganizationReleaseSchema>;
147
+
148
+ const ImportCommon = {
149
+ ...Header,
150
+ kind: Type.Literal("import-disposition"),
151
+ installation: Orn,
152
+ build: Reference,
153
+ release: Reference,
154
+ subject: Reference,
155
+ observedAt: UtcSecond,
156
+ };
157
+ export const ImportDispositionSchema = Type.Union([
158
+ closed({ ...ImportCommon, status: Type.Literal("pending") }),
159
+ closed({
160
+ ...ImportCommon,
161
+ status: Type.Literal("verified"),
162
+ disposition: Type.Union([Type.Literal("published"), Type.Literal("digest-match")]),
163
+ evidence: Evidence(),
164
+ }),
165
+ closed({
166
+ ...ImportCommon,
167
+ status: Type.Literal("staged"),
168
+ disposition: Type.Literal("captured"),
169
+ evidence: Evidence(),
170
+ }),
171
+ closed({
172
+ ...ImportCommon,
173
+ status: Type.Literal("refused"),
174
+ disposition: Type.Union([
175
+ Type.Literal("digest-mismatch"),
176
+ Type.Literal("missing"),
177
+ Type.Literal("unsupported"),
178
+ ]),
179
+ reason: NonEmptyString,
180
+ evidence: Evidence(),
181
+ }),
182
+ ]);
183
+ export type ImportDisposition = Static<typeof ImportDispositionSchema>;
184
+ export const ReleaseStatusSchema = Type.Union([
185
+ Type.Literal("active"),
186
+ Type.Literal("retired"),
187
+ Type.Literal("revoked"),
188
+ ]);
189
+ export type ReleaseStatus = Static<typeof ReleaseStatusSchema>;
190
+ export const ReleaseStatusObservationSchema = closed({
191
+ ...Header,
192
+ kind: Type.Literal("release-status-observation"),
193
+ subject: Reference,
194
+ registry: Reference,
195
+ trustView: Reference,
196
+ status: ReleaseStatusSchema,
197
+ effectiveAt: UtcSecond,
198
+ observedAt: UtcSecond,
199
+ evidence: Evidence(),
200
+ });
201
+ export type ReleaseStatusObservation = Static<typeof ReleaseStatusObservationSchema>;
202
+ // A status evaluation pins both the observation and the consumer's current trust
203
+ // input. Retirement permits existing active execution; revocation never does.
204
+ export const ReleaseEligibilitySchema = closed({
205
+ ...Header,
206
+ kind: Type.Literal("release-eligibility"),
207
+ release: Reference,
208
+ operation: Type.Union([
209
+ Type.Literal("resolve"),
210
+ Type.Literal("select"),
211
+ Type.Literal("import"),
212
+ Type.Literal("admit"),
213
+ Type.Literal("activate"),
214
+ Type.Literal("execute"),
215
+ ]),
216
+ observation: ReleaseStatusObservationSchema,
217
+ trustView: Reference,
218
+ activeSet: Type.Union([Reference, Type.Null()]),
219
+ });
220
+ export type ReleaseEligibility = Static<typeof ReleaseEligibilitySchema>;
221
+ export const ApprovedUseSchema = closed({ use: NonEmptyString, binding: Reference });
222
+ export type ApprovedUse = Static<typeof ApprovedUseSchema>;
223
+ const AdmissionCommon = {
224
+ ...Header,
225
+ kind: Type.Literal("admission-record"),
226
+ id: Identifier,
227
+ installation: Orn,
228
+ organization: NonEmptyString,
229
+ build: Reference,
230
+ release: Reference,
231
+ selectionId: Identifier,
232
+ extensionRelease: Reference,
233
+ evaluatingCase: Reference,
234
+ decision: Reference,
235
+ authority: Reference,
236
+ fence: Reference,
237
+ revision: SafeInt,
238
+ decidedAt: UtcSecond,
239
+ };
240
+ export const AdmissionRecordSchema = Type.Union([
241
+ closed({
242
+ ...AdmissionCommon,
243
+ status: Type.Literal("admitted"),
244
+ components: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
245
+ approvedUses: Type.Array(ApprovedUseSchema, { minItems: 1, uniqueItems: true }),
246
+ bindings: Evidence(),
247
+ evidence: Evidence(),
248
+ }),
249
+ closed({
250
+ ...AdmissionCommon,
251
+ status: Type.Literal("refused"),
252
+ components: Type.Array(ComponentBindingSchema, { uniqueItems: true }),
253
+ reason: NonEmptyString,
254
+ evidence: Evidence(),
255
+ }),
256
+ ]);
257
+ export type AdmissionRecord = Static<typeof AdmissionRecordSchema>;
258
+ const AdmissionObservationCommon = {
259
+ ...Header,
260
+ kind: Type.Literal("admission-status-observation"),
261
+ admission: Reference,
262
+ decision: Reference,
263
+ evidence: Evidence(),
264
+ observedAt: UtcSecond,
265
+ };
266
+ export const AdmissionStatusObservationSchema = Type.Union([
267
+ closed({
268
+ ...AdmissionObservationCommon,
269
+ status: Type.Literal("suspended"),
270
+ reason: NonEmptyString,
271
+ }),
272
+ closed({
273
+ ...AdmissionObservationCommon,
274
+ status: Type.Literal("superseded"),
275
+ replacement: Reference,
276
+ }),
277
+ closed({
278
+ ...AdmissionObservationCommon,
279
+ status: Type.Literal("revoked"),
280
+ governedRevocation: Reference,
281
+ trustView: Reference,
282
+ reason: NonEmptyString,
283
+ }),
284
+ ]);
285
+ export type AdmissionStatusObservation = Static<typeof AdmissionStatusObservationSchema>;
286
+ const MemberObservationCommon = {
287
+ ...Header,
288
+ kind: Type.Literal("member-observation"),
289
+ installation: Orn,
290
+ build: Reference,
291
+ release: Reference,
292
+ memberId: Identifier,
293
+ memberKind: OrganizationReleaseMemberKindSchema,
294
+ subject: Reference,
295
+ evidence: Evidence(),
296
+ observedAt: UtcSecond,
297
+ };
298
+ export const MemberObservationSchema = Type.Union([
299
+ closed({
300
+ ...MemberObservationCommon,
301
+ disposition: Type.Union([Type.Literal("ready"), Type.Literal("verified")]),
302
+ }),
303
+ closed({
304
+ ...MemberObservationCommon,
305
+ disposition: Type.Union([
306
+ Type.Literal("refused"),
307
+ Type.Literal("suspended"),
308
+ Type.Literal("revoked"),
309
+ ]),
310
+ reason: NonEmptyString,
311
+ }),
312
+ ]);
313
+ export type MemberObservation = Static<typeof MemberObservationSchema>;
314
+ export const ActiveMemberSchema = closed({
315
+ selectionId: Identifier,
316
+ memberId: Identifier,
317
+ extensionRelease: Reference,
318
+ components: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
319
+ admission: Reference,
320
+ });
321
+ export type ActiveMember = Static<typeof ActiveMemberSchema>;
322
+ export const ActiveSetSchema = closed({
323
+ ...Header,
324
+ kind: Type.Literal("active-set"),
325
+ installation: Orn,
326
+ organization: NonEmptyString,
327
+ release: Reference,
328
+ build: Reference,
329
+ predecessor: Type.Union([Reference, Type.Null()]),
330
+ members: Type.Array(ActiveMemberSchema, { uniqueItems: true }),
331
+ memberObservations: Evidence(),
332
+ policies: References(),
333
+ configuration: References(),
334
+ activatingCase: Reference,
335
+ authority: Reference,
336
+ activatingDecision: Reference,
337
+ fence: Reference,
338
+ revision: SafeInt,
339
+ activatedAt: UtcSecond,
340
+ });
341
+ export type ActiveSet = Static<typeof ActiveSetSchema>;
342
+ const CatalogEntryCommon = {
343
+ id: Identifier,
344
+ activeSet: Reference,
345
+ selectionId: Identifier,
346
+ memberId: Identifier,
347
+ extensionRelease: Reference,
348
+ workflow: Reference,
349
+ example: Type.Union([Reference, Type.Null()]),
350
+ jobClass: Type.Union([Reference, Type.Null()]),
351
+ workloadArtifact: Type.Union([Reference, Type.Null()]),
352
+ contracts: References(),
353
+ availabilityEvidence: Evidence(),
354
+ };
355
+ export const CatalogEntrySchema = Type.Union([
356
+ closed({ ...CatalogEntryCommon, availability: Type.Literal("available") }),
357
+ closed({
358
+ ...CatalogEntryCommon,
359
+ availability: Type.Literal("unavailable"),
360
+ unavailableReason: NonEmptyString,
361
+ }),
362
+ ]);
363
+ export type CatalogEntry = Static<typeof CatalogEntrySchema>;
364
+ export const CatalogSchema = closed({
365
+ ...Header,
366
+ kind: Type.Literal("catalog"),
367
+ activeSet: Reference,
368
+ entries: Type.Array(CatalogEntrySchema, { uniqueItems: true }),
369
+ });
370
+ export type Catalog = Static<typeof CatalogSchema>;
371
+ export const BoundAttestationSchema = closed({
372
+ ...Header,
373
+ kind: Type.Literal("bound-attestation"),
374
+ subject: Reference,
375
+ issuer: Orn,
376
+ evidence: Reference,
377
+ verification: Type.Union([
378
+ Type.Literal("publisher-signature"),
379
+ Type.Literal("registry-recognition"),
380
+ Type.Literal("source-provenance"),
381
+ Type.Literal("component-digest"),
382
+ ]),
383
+ observedAt: UtcSecond,
384
+ signature: NonEmptyString,
385
+ });
386
+ export type BoundAttestation = Static<typeof BoundAttestationSchema>;
387
+ export const organizationReleaseV1: ProfileEntry = {
388
+ literal: ORGANIZATION_RELEASE_PROFILE,
389
+ documents: {
390
+ dependencyLock: DependencyLockSchema,
391
+ organizationBuild: OrganizationBuildSchema,
392
+ importDisposition: ImportDispositionSchema,
393
+ releaseStatusObservation: ReleaseStatusObservationSchema,
394
+ releaseEligibility: ReleaseEligibilitySchema,
395
+ organizationRelease: OrganizationReleaseSchema,
396
+ admissionRecord: AdmissionRecordSchema,
397
+ admissionStatusObservation: AdmissionStatusObservationSchema,
398
+ memberObservation: MemberObservationSchema,
399
+ activeSet: ActiveSetSchema,
400
+ catalog: CatalogSchema,
401
+ boundAttestation: BoundAttestationSchema,
402
+ },
403
+ };
@@ -0,0 +1,165 @@
1
+ // dsg.organization.source/3
2
+ // Organization authoring is selection and review input only. This profile has
3
+ // no principals, grants, admissions, deployment wiring, or runtime authority.
4
+ import { type Static, Type } from "@sinclair/typebox";
5
+ import { ExtensionReleaseReferenceSchema } from "../extension/release.v1.js";
6
+ import { closed, Hex64, NonEmptyString, type ProfileEntry } from "../primitives.js";
7
+ import {
8
+ DependencyLockSchema,
9
+ type DependencyLock,
10
+ OrganizationReleaseMemberKindSchema,
11
+ } from "./release.v1.js";
12
+ import {
13
+ OrganizationDocumentPathSchema,
14
+ OrganizationSpaceSchema,
15
+ OrganizationSourceLocationSchema,
16
+ ProjectSourceSchema,
17
+ } from "./source.v2.js";
18
+
19
+ export const ORGANIZATION_SOURCE_V3_PROFILE = "dsg.organization.source/3" as const;
20
+
21
+ const IdentifierSchema = Type.String({ pattern: "^[a-z][a-z0-9-]*(?:[.-][a-z0-9]+)*$" });
22
+ const UniqueIdentifiers = () => Type.Array(IdentifierSchema, { minItems: 1, uniqueItems: true });
23
+ const IdentifierSet = () => Type.Array(IdentifierSchema, { uniqueItems: true });
24
+ const UniquePaths = () => Type.Array(OrganizationDocumentPathSchema, { uniqueItems: true });
25
+ const UniqueStrings = () => Type.Array(NonEmptyString, { uniqueItems: true });
26
+
27
+ export const OrganizationSourceProjectSchema = closed({
28
+ schemaVersion: Type.Literal(3),
29
+ kind: Type.Literal("project-membership"),
30
+ id: IdentifierSchema,
31
+ source: ProjectSourceSchema,
32
+ contract: OrganizationDocumentPathSchema,
33
+ handling: OrganizationDocumentPathSchema,
34
+ });
35
+ export type OrganizationSourceProject = Static<typeof OrganizationSourceProjectSchema>;
36
+
37
+ export const OrganizationSelectionDispositionSchema = closed({
38
+ kind: Type.Union([
39
+ Type.Literal("publication"),
40
+ Type.Literal("import"),
41
+ Type.Literal("admission"),
42
+ Type.Literal("target"),
43
+ Type.Literal("check"),
44
+ Type.Literal("setup"),
45
+ Type.Literal("paid-execution"),
46
+ ]),
47
+ required: Type.Boolean(),
48
+ acceptable: UniqueStrings(),
49
+ });
50
+ export type OrganizationSelectionDisposition = Static<
51
+ typeof OrganizationSelectionDispositionSchema
52
+ >;
53
+
54
+ export const AuthoredOverlaySchema = closed({
55
+ id: IdentifierSchema,
56
+ document: OrganizationDocumentPathSchema,
57
+ sha256: Hex64,
58
+ mediaType: NonEmptyString,
59
+ });
60
+ export type AuthoredOverlay = Static<typeof AuthoredOverlaySchema>;
61
+
62
+ export const CapabilitySelectionV3Schema = closed({
63
+ schemaVersion: Type.Literal(3),
64
+ kind: Type.Literal("capability-selection"),
65
+ id: IdentifierSchema,
66
+ release: ExtensionReleaseReferenceSchema,
67
+ memberIds: UniqueIdentifiers(),
68
+ origin: Type.Union([
69
+ Type.Literal("workspace"),
70
+ Type.Literal("official"),
71
+ Type.Literal("curated"),
72
+ ]),
73
+ dependencyLock: OrganizationDocumentPathSchema,
74
+ requiredDispositions: Type.Array(OrganizationSelectionDispositionSchema, {
75
+ minItems: 1,
76
+ uniqueItems: true,
77
+ }),
78
+ authoredOverlays: Type.Array(AuthoredOverlaySchema, { uniqueItems: true }),
79
+ });
80
+ export type CapabilitySelectionV3 = Static<typeof CapabilitySelectionV3Schema>;
81
+
82
+ export const WorkspaceProfileV3Schema = closed({
83
+ schemaVersion: Type.Literal(3),
84
+ kind: Type.Literal("workspace-profile"),
85
+ profile: Type.Literal(ORGANIZATION_SOURCE_V3_PROFILE),
86
+ id: IdentifierSchema,
87
+ version: Type.String({ pattern: "^(?:0|[1-9][0-9]*)\\.[0-9]+\\.[0-9]+$" }),
88
+ requirements: closed({
89
+ facts: UniqueStrings(),
90
+ minimumProjects: Type.Integer({ minimum: 0 }),
91
+ requiredSelections: Type.Array(IdentifierSchema, { uniqueItems: true }),
92
+ instructions: Type.Boolean(),
93
+ }),
94
+ allowedOrigins: Type.Array(
95
+ Type.Union([Type.Literal("workspace"), Type.Literal("official"), Type.Literal("curated")]),
96
+ { minItems: 1, uniqueItems: true },
97
+ ),
98
+ sourceChecks: UniquePaths(),
99
+ });
100
+ export type WorkspaceProfileV3 = Static<typeof WorkspaceProfileV3Schema>;
101
+
102
+ /** A semantic dependency lock is a source document referenced by the root;
103
+ * its lock bytes contain no Build self-reference or runtime observations. */
104
+ export const OrganizationDependencyLockSchema = DependencyLockSchema;
105
+ export type OrganizationDependencyLock = DependencyLock;
106
+
107
+ export const OrganizationSourceReleaseMemberSchema = closed({
108
+ id: IdentifierSchema,
109
+ kind: OrganizationReleaseMemberKindSchema,
110
+ required: Type.Boolean(),
111
+ acceptableDispositions: Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true }),
112
+ subject: OrganizationDocumentPathSchema,
113
+ });
114
+ export type OrganizationSourceReleaseMember = Static<typeof OrganizationSourceReleaseMemberSchema>;
115
+
116
+ /** Source-only Organization Release declaration. Runtime status, admission,
117
+ * activation, predecessor, and supersession belong to release records. */
118
+ export const OrganizationReleaseDeclarationSchema = closed({
119
+ schemaVersion: Type.Literal(3),
120
+ kind: Type.Literal("organization-release-declaration"),
121
+ id: IdentifierSchema,
122
+ dependencyLock: OrganizationDocumentPathSchema,
123
+ selections: IdentifierSet(),
124
+ members: Type.Array(OrganizationSourceReleaseMemberSchema, {
125
+ minItems: 1,
126
+ uniqueItems: true,
127
+ }),
128
+ acceptance: closed({
129
+ requiredMembers: UniqueIdentifiers(),
130
+ acceptableDispositions: Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true }),
131
+ }),
132
+ });
133
+ export type OrganizationReleaseDeclaration = Static<typeof OrganizationReleaseDeclarationSchema>;
134
+
135
+ export const OrganizationRootV3Schema = closed({
136
+ schemaVersion: Type.Literal(3),
137
+ kind: Type.Literal("organization"),
138
+ org: NonEmptyString,
139
+ space: OrganizationSpaceSchema,
140
+ purpose: NonEmptyString,
141
+ profile: OrganizationDocumentPathSchema,
142
+ projects: UniquePaths(),
143
+ capabilities: UniquePaths(),
144
+ dependencyLocks: UniquePaths(),
145
+ releases: UniquePaths(),
146
+ instructions: UniquePaths(),
147
+ documents: UniquePaths(),
148
+ archive: Type.Optional(OrganizationDocumentPathSchema),
149
+ source: Type.Optional(OrganizationSourceLocationSchema),
150
+ });
151
+ export type OrganizationRootV3 = Static<typeof OrganizationRootV3Schema>;
152
+
153
+ export const organizationSourceV3: ProfileEntry = {
154
+ literal: ORGANIZATION_SOURCE_V3_PROFILE,
155
+ rootDocument: "organization",
156
+ documents: {
157
+ organization: OrganizationRootV3Schema,
158
+ profile: WorkspaceProfileV3Schema,
159
+ project: OrganizationSourceProjectSchema,
160
+ capabilitySelection: CapabilitySelectionV3Schema,
161
+ dependencyLock: OrganizationDependencyLockSchema,
162
+ releaseMember: OrganizationSourceReleaseMemberSchema,
163
+ releaseDeclaration: OrganizationReleaseDeclarationSchema,
164
+ },
165
+ };
@@ -0,0 +1,70 @@
1
+ // dsg.run.execution-binding/1
2
+ // Exact authority chain re-derived independently by the kernel and execution
3
+ // plane before any effect. No mutable discovery or latest lookup is permitted.
4
+ import { type Static, Type } from "@sinclair/typebox";
5
+ import { closed, Hex64, Orn, Reference, type ProfileEntry } from "../primitives.js";
6
+ import {
7
+ AdmissionRecordSchema,
8
+ ActiveSetSchema,
9
+ BuildSelectionSchema,
10
+ CatalogEntrySchema,
11
+ ReleaseEligibilitySchema,
12
+ } from "../organization/release.v1.js";
13
+ import { OperationRequestSchema } from "./operation.v1.js";
14
+ import { JobClassSchema } from "./job-class.v1.js";
15
+ import {
16
+ WorkloadArtifactSchema,
17
+ WorkloadArtifactProvenanceSchema,
18
+ } from "./workload-artifact.v1.js";
19
+
20
+ export const EXECUTION_BINDING_PROFILE = "dsg.run.execution-binding/1" as const;
21
+
22
+ export const ExecutionBindingSchema = closed({
23
+ profile: Type.Literal(EXECUTION_BINDING_PROFILE),
24
+ schemaVersion: Type.Literal(1),
25
+ kind: Type.Literal("execution-binding"),
26
+ installation: Orn,
27
+ operation: Reference,
28
+ activeSet: Reference,
29
+ admission: Reference,
30
+ organizationRelease: Reference,
31
+ organizationBuild: Reference,
32
+ selection: Reference,
33
+ extensionRelease: Reference,
34
+ workflow: Reference,
35
+ jobClass: Reference,
36
+ workloadArtifact: Reference,
37
+ executableManifestSha256: Hex64,
38
+ target: Reference,
39
+ eventCatalog: Reference,
40
+ law: Reference,
41
+ reservation: Reference,
42
+ trustView: Reference,
43
+ });
44
+ export type ExecutionBinding = Static<typeof ExecutionBindingSchema>;
45
+
46
+ export const ExecutionRequestEnvelopeSchema = closed({
47
+ profile: Type.Literal(EXECUTION_BINDING_PROFILE),
48
+ schemaVersion: Type.Literal(1),
49
+ kind: Type.Literal("execution-request-envelope"),
50
+ operation: OperationRequestSchema,
51
+ binding: ExecutionBindingSchema,
52
+ jobClass: JobClassSchema,
53
+ workloadArtifact: WorkloadArtifactSchema,
54
+ workloadArtifactProvenance: WorkloadArtifactProvenanceSchema,
55
+ admission: AdmissionRecordSchema,
56
+ activeSet: ActiveSetSchema,
57
+ selection: BuildSelectionSchema,
58
+ catalogEntry: CatalogEntrySchema,
59
+ releaseEligibility: ReleaseEligibilitySchema,
60
+ });
61
+ export type ExecutionRequestEnvelope = Static<typeof ExecutionRequestEnvelopeSchema>;
62
+
63
+ export const executionBindingV1: ProfileEntry = {
64
+ literal: EXECUTION_BINDING_PROFILE,
65
+ rootDocument: "executionBinding",
66
+ documents: {
67
+ executionBinding: ExecutionBindingSchema,
68
+ executionRequestEnvelope: ExecutionRequestEnvelopeSchema,
69
+ },
70
+ };
@@ -0,0 +1,57 @@
1
+ // dsg.run.job-class/1
2
+ // Immutable execution semantics shared by the organization compiler, kernel,
3
+ // and execution plane. Catalog detail APIs resolve these exact bytes.
4
+ import { type Static, Type } from "@sinclair/typebox";
5
+ import { closed, NonEmptyString, Reference, SafeInt, type ProfileEntry } from "../primitives.js";
6
+
7
+ export const JOB_CLASS_PROFILE = "dsg.run.job-class/1" as const;
8
+
9
+ const RequiredReferences = () => Type.Array(Reference, { minItems: 1, uniqueItems: true });
10
+ const RequiredStrings = () => Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true });
11
+
12
+ export const JobClassBoundsSchema = closed({
13
+ maxRunSeconds: SafeInt,
14
+ maxGpuSeconds: SafeInt,
15
+ maxParallelism: SafeInt,
16
+ maxUsdMicroUnits: SafeInt,
17
+ });
18
+ export type JobClassBounds = Static<typeof JobClassBoundsSchema>;
19
+
20
+ export const JobClassSchema = closed({
21
+ profile: Type.Literal(JOB_CLASS_PROFILE),
22
+ schemaVersion: Type.Literal(1),
23
+ kind: Type.Literal("job-class"),
24
+ id: NonEmptyString,
25
+ executor: NonEmptyString,
26
+ mode: NonEmptyString,
27
+ modeEnvironmentVariable: NonEmptyString,
28
+ workloadArtifact: Reference,
29
+ platforms: RequiredStrings(),
30
+ isolation: Type.Union([Type.Literal("ephemeral"), Type.Literal("dedicated")]),
31
+ inputContracts: RequiredReferences(),
32
+ outputContracts: RequiredReferences(),
33
+ eventCatalog: Reference,
34
+ decisionRequirements: RequiredReferences(),
35
+ bounds: JobClassBoundsSchema,
36
+ handling: Type.Union([
37
+ Type.Literal("public"),
38
+ Type.Literal("restricted"),
39
+ Type.Literal("confidential"),
40
+ ]),
41
+ retention: Type.Union([
42
+ Type.Literal("ephemeral"),
43
+ Type.Literal("bounded"),
44
+ Type.Literal("durable"),
45
+ ]),
46
+ completion: Reference,
47
+ teardown: Reference,
48
+ evidence: Reference,
49
+ replay: Reference,
50
+ });
51
+ export type JobClass = Static<typeof JobClassSchema>;
52
+
53
+ export const jobClassV1: ProfileEntry = {
54
+ literal: JOB_CLASS_PROFILE,
55
+ rootDocument: "jobClass",
56
+ documents: { jobClass: JobClassSchema },
57
+ };