@dynamicalsystems/idl 0.11.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,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
+ };
@@ -0,0 +1,89 @@
1
+ // dsg.run.workload-artifact/1
2
+ // This document's Reference pins JCS metadata, not executable OCI bytes.
3
+ import { type Static, Type } from "@sinclair/typebox";
4
+ import {
5
+ closed,
6
+ Hex64,
7
+ NonEmptyString,
8
+ Reference,
9
+ UtcSecond,
10
+ type ProfileEntry,
11
+ } from "../primitives.js";
12
+
13
+ export const WORKLOAD_ARTIFACT_PROFILE = "dsg.run.workload-artifact/1" as const;
14
+ const OciRepository = Type.String({
15
+ pattern:
16
+ "^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?::[1-9][0-9]{0,4})?/[a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)*$",
17
+ });
18
+ export const WorkloadSourceSchema = closed({
19
+ repository: NonEmptyString,
20
+ revision: Type.String({ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" }),
21
+ sourceDigest: Hex64,
22
+ });
23
+ export type WorkloadSource = Static<typeof WorkloadSourceSchema>;
24
+ export const OciPlatformSchema = closed({
25
+ os: NonEmptyString,
26
+ architecture: NonEmptyString,
27
+ variant: Type.Optional(NonEmptyString),
28
+ });
29
+ export type OciPlatform = Static<typeof OciPlatformSchema>;
30
+ export const WorkloadArtifactSchema = closed({
31
+ profile: Type.Literal(WORKLOAD_ARTIFACT_PROFILE),
32
+ schemaVersion: Type.Literal(1),
33
+ kind: Type.Literal("workload-artifact"),
34
+ id: NonEmptyString,
35
+ format: Type.Literal("oci-image"),
36
+ source: WorkloadSourceSchema,
37
+ index: Type.Union([
38
+ Type.Null(),
39
+ closed({
40
+ sha256: Hex64,
41
+ mediaType: Type.Union([
42
+ Type.Literal("application/vnd.oci.image.index.v1+json"),
43
+ Type.Literal("application/vnd.docker.distribution.manifest.list.v2+json"),
44
+ ]),
45
+ }),
46
+ ]),
47
+ executable: closed({
48
+ repository: OciRepository,
49
+ platform: OciPlatformSchema,
50
+ manifest: closed({
51
+ sha256: Hex64,
52
+ mediaType: Type.Union([
53
+ Type.Literal("application/vnd.oci.image.manifest.v1+json"),
54
+ Type.Literal("application/vnd.docker.distribution.manifest.v2+json"),
55
+ ]),
56
+ }),
57
+ config: closed({
58
+ sha256: Hex64,
59
+ mediaType: Type.Union([
60
+ Type.Literal("application/vnd.oci.image.config.v1+json"),
61
+ Type.Literal("application/vnd.docker.container.image.v1+json"),
62
+ ]),
63
+ }),
64
+ }),
65
+ entrypoint: Type.Array(NonEmptyString, { minItems: 1 }),
66
+ });
67
+ export type WorkloadArtifact = Static<typeof WorkloadArtifactSchema>;
68
+ // Build and transport observations bind the metadata after it has an identity;
69
+ // including this observation inside the metadata would create a digest cycle.
70
+ export const WorkloadArtifactProvenanceSchema = closed({
71
+ profile: Type.Literal(WORKLOAD_ARTIFACT_PROFILE),
72
+ schemaVersion: Type.Literal(1),
73
+ kind: Type.Literal("workload-artifact-provenance"),
74
+ artifact: Reference,
75
+ source: WorkloadSourceSchema,
76
+ build: Reference,
77
+ transportArchiveSha256: Hex64,
78
+ observedAt: UtcSecond,
79
+ evidence: Type.Array(Reference, { minItems: 1, uniqueItems: true }),
80
+ });
81
+ export type WorkloadArtifactProvenance = Static<typeof WorkloadArtifactProvenanceSchema>;
82
+ export const workloadArtifactV1: ProfileEntry = {
83
+ literal: WORKLOAD_ARTIFACT_PROFILE,
84
+ rootDocument: "workloadArtifact",
85
+ documents: {
86
+ workloadArtifact: WorkloadArtifactSchema,
87
+ provenance: WorkloadArtifactProvenanceSchema,
88
+ },
89
+ };