@inf-monkeys-tech/monkeys 1.0.18 → 1.0.20
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/lib/contracts/continuity.d.ts +2 -2
- package/lib/contracts/continuity.d.ts.map +1 -1
- package/lib/contracts/continuity.js +39 -2
- package/lib/contracts/continuity.js.map +1 -1
- package/lib/contracts/index.d.ts +1 -0
- package/lib/contracts/index.d.ts.map +1 -1
- package/lib/contracts/index.js +1 -0
- package/lib/contracts/index.js.map +1 -1
- package/lib/contracts/tenant.d.ts +8 -0
- package/lib/contracts/tenant.d.ts.map +1 -1
- package/lib/contracts/tenant.js +1 -0
- package/lib/contracts/tenant.js.map +1 -1
- package/lib/contracts/workflow-runtime.d.ts +287 -0
- package/lib/contracts/workflow-runtime.d.ts.map +1 -0
- package/lib/contracts/workflow-runtime.js +198 -0
- package/lib/contracts/workflow-runtime.js.map +1 -0
- package/lib/esm/contracts/index.mjs +219 -3
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +224 -4
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +2 -1
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +224 -4
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/application-run.schema.json +0 -1
- package/lib/json-schema/index.json +5 -1
- package/lib/json-schema/tenant-product-config.schema.json +6 -0
- package/lib/json-schema/tenant-runtime-config.schema.json +6 -0
- package/lib/json-schema/workflow-catalog-entry.schema.json +238 -0
- package/lib/json-schema/workflow-completion-commit.schema.json +1163 -0
- package/lib/json-schema/workflow-completion-receipt.schema.json +160 -0
- package/lib/json-schema/workflow-publication.schema.json +168 -0
- package/lib/schemas/index.d.ts +288 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +11 -1
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowCompletionReceiptSchema = exports.WorkflowCompletionCommitSchema = exports.WorkflowPublicationSchema = exports.WorkflowCatalogEntrySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const artifact_1 = require("./artifact");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const continuity_1 = require("./continuity");
|
|
8
|
+
const data_1 = require("./data");
|
|
9
|
+
exports.WorkflowCatalogEntrySchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
contract: zod_1.z.literal('WorkflowCatalogEntry'),
|
|
12
|
+
workflowId: common_1.ContractIdentifierSchema,
|
|
13
|
+
teamId: common_1.ContractIdentifierSchema,
|
|
14
|
+
creatorRef: common_1.EntityRefSchema,
|
|
15
|
+
currentDefinitionRef: common_1.EntityRefSchema,
|
|
16
|
+
lifecycle: zod_1.z.enum(['ACTIVE', 'DELETED']),
|
|
17
|
+
asset: zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
preset: zod_1.z.boolean(),
|
|
20
|
+
marketplacePublished: zod_1.z.boolean(),
|
|
21
|
+
publishConfig: common_1.JsonObjectSchema.optional(),
|
|
22
|
+
sort: zod_1.z.number().int(),
|
|
23
|
+
forkFromRef: common_1.EntityRefSchema.optional(),
|
|
24
|
+
notAuthorized: zod_1.z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.strict(),
|
|
27
|
+
createdAt: common_1.IsoDateTimeSchema,
|
|
28
|
+
updatedAt: common_1.IsoDateTimeSchema,
|
|
29
|
+
deletedAt: common_1.IsoDateTimeSchema.optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
.superRefine((entry, context) => {
|
|
33
|
+
if (entry.creatorRef.kind !== 'user' &&
|
|
34
|
+
entry.creatorRef.kind !== 'service') {
|
|
35
|
+
context.addIssue({
|
|
36
|
+
code: 'custom',
|
|
37
|
+
path: ['creatorRef', 'kind'],
|
|
38
|
+
message: 'creatorRef must reference a user or service.',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (entry.currentDefinitionRef.kind !== 'workflow-definition') {
|
|
42
|
+
context.addIssue({
|
|
43
|
+
code: 'custom',
|
|
44
|
+
path: ['currentDefinitionRef', 'kind'],
|
|
45
|
+
message: 'currentDefinitionRef must reference a workflow-definition.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (entry.lifecycle === 'DELETED' && !entry.deletedAt) {
|
|
49
|
+
context.addIssue({
|
|
50
|
+
code: 'custom',
|
|
51
|
+
path: ['deletedAt'],
|
|
52
|
+
message: 'Deleted workflow catalog entries require deletedAt.',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (entry.lifecycle === 'ACTIVE' && entry.deletedAt) {
|
|
56
|
+
context.addIssue({
|
|
57
|
+
code: 'custom',
|
|
58
|
+
path: ['deletedAt'],
|
|
59
|
+
message: 'Active workflow catalog entries cannot declare deletedAt.',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
exports.WorkflowPublicationSchema = zod_1.z
|
|
64
|
+
.object({
|
|
65
|
+
contract: zod_1.z.literal('WorkflowPublication'),
|
|
66
|
+
publicationId: common_1.ContractIdentifierSchema,
|
|
67
|
+
definitionRef: common_1.EntityRefSchema,
|
|
68
|
+
runtimeDefinitionRef: common_1.EntityRefSchema,
|
|
69
|
+
sourceHash: common_1.Sha256Schema,
|
|
70
|
+
compiledHash: common_1.Sha256Schema,
|
|
71
|
+
status: zod_1.z.enum(['PENDING', 'PUBLISHED', 'FAILED', 'RETIRED']),
|
|
72
|
+
publisherRef: common_1.EntityRefSchema,
|
|
73
|
+
publishedAt: common_1.IsoDateTimeSchema.optional(),
|
|
74
|
+
failureReason: zod_1.z.string().trim().min(1).optional(),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
.superRefine((publication, context) => {
|
|
78
|
+
if (publication.definitionRef.kind !== 'workflow-definition') {
|
|
79
|
+
context.addIssue({
|
|
80
|
+
code: 'custom',
|
|
81
|
+
path: ['definitionRef', 'kind'],
|
|
82
|
+
message: 'definitionRef must reference a workflow-definition.',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (publication.runtimeDefinitionRef.kind !== 'conductor-workflow-definition') {
|
|
86
|
+
context.addIssue({
|
|
87
|
+
code: 'custom',
|
|
88
|
+
path: ['runtimeDefinitionRef', 'kind'],
|
|
89
|
+
message: 'runtimeDefinitionRef must reference a conductor-workflow-definition.',
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (publication.status === 'PUBLISHED' && !publication.publishedAt) {
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: 'custom',
|
|
95
|
+
path: ['publishedAt'],
|
|
96
|
+
message: 'Published workflow publications require publishedAt.',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (publication.status === 'FAILED' && !publication.failureReason) {
|
|
100
|
+
context.addIssue({
|
|
101
|
+
code: 'custom',
|
|
102
|
+
path: ['failureReason'],
|
|
103
|
+
message: 'Failed workflow publications require failureReason.',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
exports.WorkflowCompletionCommitSchema = zod_1.z
|
|
108
|
+
.object({
|
|
109
|
+
contract: zod_1.z.literal('WorkflowCompletionCommit'),
|
|
110
|
+
commitId: common_1.ContractIdentifierSchema,
|
|
111
|
+
run: continuity_1.ApplicationRunSchema,
|
|
112
|
+
outputs: zod_1.z.array(artifact_1.OutputRecordSchema),
|
|
113
|
+
artifacts: zod_1.z.array(artifact_1.ArtifactManifestSchema),
|
|
114
|
+
lineage: data_1.LineageRecordSchema,
|
|
115
|
+
completedAt: common_1.IsoDateTimeSchema,
|
|
116
|
+
})
|
|
117
|
+
.strict()
|
|
118
|
+
.superRefine((commit, context) => {
|
|
119
|
+
const expectedRunId = commit.run.runId;
|
|
120
|
+
const referencesRun = (value) => value.runRef.kind === 'application-run' && value.runRef.id === expectedRunId;
|
|
121
|
+
commit.outputs.forEach((output, index) => {
|
|
122
|
+
if (!referencesRun(output)) {
|
|
123
|
+
context.addIssue({
|
|
124
|
+
code: 'custom',
|
|
125
|
+
path: ['outputs', index, 'runRef'],
|
|
126
|
+
message: 'Every output must reference the committed ApplicationRun.',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
131
|
+
if (!referencesRun(artifact)) {
|
|
132
|
+
context.addIssue({
|
|
133
|
+
code: 'custom',
|
|
134
|
+
path: ['artifacts', index, 'runRef'],
|
|
135
|
+
message: 'Every artifact must reference the committed ApplicationRun.',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
if (commit.lineage.subjectRef.kind !== 'application-run' ||
|
|
140
|
+
commit.lineage.subjectRef.id !== expectedRunId) {
|
|
141
|
+
context.addIssue({
|
|
142
|
+
code: 'custom',
|
|
143
|
+
path: ['lineage', 'subjectRef'],
|
|
144
|
+
message: 'Completion lineage must use the committed ApplicationRun as its subject.',
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const outputIds = new Set(commit.outputs.map(output => output.outputId));
|
|
148
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
149
|
+
if (artifact.outputRef.kind !== 'workflow-output' ||
|
|
150
|
+
!outputIds.has(artifact.outputRef.id)) {
|
|
151
|
+
context.addIssue({
|
|
152
|
+
code: 'custom',
|
|
153
|
+
path: ['artifacts', index, 'outputRef'],
|
|
154
|
+
message: 'Artifact outputRef must reference an output in the same commit.',
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
exports.WorkflowCompletionReceiptSchema = zod_1.z
|
|
160
|
+
.object({
|
|
161
|
+
contract: zod_1.z.literal('WorkflowCompletionReceipt'),
|
|
162
|
+
commitId: common_1.ContractIdentifierSchema,
|
|
163
|
+
runRef: common_1.EntityRefSchema,
|
|
164
|
+
outputRefs: zod_1.z.array(common_1.EntityRefSchema),
|
|
165
|
+
artifactRefs: zod_1.z.array(common_1.EntityRefSchema),
|
|
166
|
+
contentHash: common_1.Sha256Schema,
|
|
167
|
+
committedAt: common_1.IsoDateTimeSchema,
|
|
168
|
+
idempotentReplay: zod_1.z.boolean(),
|
|
169
|
+
})
|
|
170
|
+
.strict()
|
|
171
|
+
.superRefine((receipt, context) => {
|
|
172
|
+
if (receipt.runRef.kind !== 'application-run') {
|
|
173
|
+
context.addIssue({
|
|
174
|
+
code: 'custom',
|
|
175
|
+
path: ['runRef', 'kind'],
|
|
176
|
+
message: 'runRef must reference an application-run.',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
receipt.outputRefs.forEach((ref, index) => {
|
|
180
|
+
if (ref.kind !== 'workflow-output') {
|
|
181
|
+
context.addIssue({
|
|
182
|
+
code: 'custom',
|
|
183
|
+
path: ['outputRefs', index, 'kind'],
|
|
184
|
+
message: 'outputRefs must reference workflow-output records.',
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
receipt.artifactRefs.forEach((ref, index) => {
|
|
189
|
+
if (ref.kind !== 'artifact') {
|
|
190
|
+
context.addIssue({
|
|
191
|
+
code: 'custom',
|
|
192
|
+
path: ['artifactRefs', index, 'kind'],
|
|
193
|
+
message: 'artifactRefs must reference artifacts.',
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=workflow-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-runtime.js","sourceRoot":"","sources":["../../src/contracts/workflow-runtime.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yCAAwE;AACxE,qCAMkB;AAClB,6CAAoD;AACpD,iCAA6C;AAEhC,QAAA,0BAA0B,GAAG,OAAC;KACxC,MAAM,CAAC;IACN,QAA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D,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACnC,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC;gBACnC,OAAO,EAAE,oDAAoD;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1C,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC;gBACrC,OAAO,EAAE,wCAAwC;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -7589,7 +7589,7 @@ var ApplicationRunSchema = z7.object({
|
|
|
7589
7589
|
contract: z7.literal("ApplicationRun"),
|
|
7590
7590
|
runId: ContractIdentifierSchema,
|
|
7591
7591
|
definitionRef: EntityRefSchema,
|
|
7592
|
-
runtimeLedgerRef: EntityRefSchema,
|
|
7592
|
+
runtimeLedgerRef: EntityRefSchema.optional(),
|
|
7593
7593
|
requestId: ContractIdentifierSchema,
|
|
7594
7594
|
actorRef: EntityRefSchema,
|
|
7595
7595
|
status: z7.enum(["PENDING", "RUNNING", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]),
|
|
@@ -7599,7 +7599,43 @@ var ApplicationRunSchema = z7.object({
|
|
|
7599
7599
|
completedAt: IsoDateTimeSchema.optional(),
|
|
7600
7600
|
expiresAt: IsoDateTimeSchema.optional(),
|
|
7601
7601
|
metadata: JsonObjectSchema.default({})
|
|
7602
|
-
}).strict()
|
|
7602
|
+
}).strict().superRefine((run, context) => {
|
|
7603
|
+
if (run.definitionRef.kind !== "workflow-definition") {
|
|
7604
|
+
context.addIssue({
|
|
7605
|
+
code: "custom",
|
|
7606
|
+
path: ["definitionRef", "kind"],
|
|
7607
|
+
message: "definitionRef must reference a workflow-definition."
|
|
7608
|
+
});
|
|
7609
|
+
}
|
|
7610
|
+
if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== "workflow-run") {
|
|
7611
|
+
context.addIssue({
|
|
7612
|
+
code: "custom",
|
|
7613
|
+
path: ["runtimeLedgerRef", "kind"],
|
|
7614
|
+
message: "runtimeLedgerRef must reference a workflow-run."
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7617
|
+
if ((run.status === "RUNNING" || run.status === "COMPLETED" || run.status === "CANCELLED") && !run.runtimeLedgerRef) {
|
|
7618
|
+
context.addIssue({
|
|
7619
|
+
code: "custom",
|
|
7620
|
+
path: ["runtimeLedgerRef"],
|
|
7621
|
+
message: `${run.status} ApplicationRun requires runtimeLedgerRef.`
|
|
7622
|
+
});
|
|
7623
|
+
}
|
|
7624
|
+
if (run.status === "RUNNING" && !run.startedAt) {
|
|
7625
|
+
context.addIssue({
|
|
7626
|
+
code: "custom",
|
|
7627
|
+
path: ["startedAt"],
|
|
7628
|
+
message: "RUNNING ApplicationRun requires startedAt."
|
|
7629
|
+
});
|
|
7630
|
+
}
|
|
7631
|
+
if (["COMPLETED", "FAILED", "CANCELLED", "EXPIRED"].includes(run.status) && !run.completedAt) {
|
|
7632
|
+
context.addIssue({
|
|
7633
|
+
code: "custom",
|
|
7634
|
+
path: ["completedAt"],
|
|
7635
|
+
message: `Terminal ApplicationRun status ${run.status} requires completedAt.`
|
|
7636
|
+
});
|
|
7637
|
+
}
|
|
7638
|
+
});
|
|
7603
7639
|
var ExpiringAccessGrantSchema = z7.object({
|
|
7604
7640
|
contract: z7.literal("ExpiringAccessGrant"),
|
|
7605
7641
|
grantId: ContractIdentifierSchema,
|
|
@@ -10355,7 +10391,8 @@ var TenantHeadbarModuleLeafSchema = z12.object({
|
|
|
10355
10391
|
disabled: z12.boolean().optional(),
|
|
10356
10392
|
icon: z12.string().optional(),
|
|
10357
10393
|
showQuickSwitcher: z12.boolean().optional(),
|
|
10358
|
-
showSidebar: z12.boolean().optional()
|
|
10394
|
+
showSidebar: z12.boolean().optional(),
|
|
10395
|
+
showContentFrame: z12.boolean().optional()
|
|
10359
10396
|
}).strict();
|
|
10360
10397
|
var TenantHeadbarModuleItemSchema = TenantHeadbarModuleLeafSchema.extend({
|
|
10361
10398
|
children: z12.array(TenantHeadbarModuleLeafSchema).optional()
|
|
@@ -11446,6 +11483,181 @@ var WorkflowDefinitionSchema = z14.object({
|
|
|
11446
11483
|
});
|
|
11447
11484
|
if (definition.revision.kind === "release" && definition.metadata.version !== definition.revision.recordVersion) context.addIssue({ code: "custom", path: ["revision", "recordVersion"], message: "Release recordVersion must equal metadata.version." });
|
|
11448
11485
|
});
|
|
11486
|
+
|
|
11487
|
+
// src/contracts/workflow-runtime.ts
|
|
11488
|
+
import { z as z15 } from "zod";
|
|
11489
|
+
var WorkflowCatalogEntrySchema = z15.object({
|
|
11490
|
+
contract: z15.literal("WorkflowCatalogEntry"),
|
|
11491
|
+
workflowId: ContractIdentifierSchema,
|
|
11492
|
+
teamId: ContractIdentifierSchema,
|
|
11493
|
+
creatorRef: EntityRefSchema,
|
|
11494
|
+
currentDefinitionRef: EntityRefSchema,
|
|
11495
|
+
lifecycle: z15.enum(["ACTIVE", "DELETED"]),
|
|
11496
|
+
asset: z15.object({
|
|
11497
|
+
preset: z15.boolean(),
|
|
11498
|
+
marketplacePublished: z15.boolean(),
|
|
11499
|
+
publishConfig: JsonObjectSchema.optional(),
|
|
11500
|
+
sort: z15.number().int(),
|
|
11501
|
+
forkFromRef: EntityRefSchema.optional(),
|
|
11502
|
+
notAuthorized: z15.boolean()
|
|
11503
|
+
}).strict(),
|
|
11504
|
+
createdAt: IsoDateTimeSchema,
|
|
11505
|
+
updatedAt: IsoDateTimeSchema,
|
|
11506
|
+
deletedAt: IsoDateTimeSchema.optional()
|
|
11507
|
+
}).strict().superRefine((entry, context) => {
|
|
11508
|
+
if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
|
|
11509
|
+
context.addIssue({
|
|
11510
|
+
code: "custom",
|
|
11511
|
+
path: ["creatorRef", "kind"],
|
|
11512
|
+
message: "creatorRef must reference a user or service."
|
|
11513
|
+
});
|
|
11514
|
+
}
|
|
11515
|
+
if (entry.currentDefinitionRef.kind !== "workflow-definition") {
|
|
11516
|
+
context.addIssue({
|
|
11517
|
+
code: "custom",
|
|
11518
|
+
path: ["currentDefinitionRef", "kind"],
|
|
11519
|
+
message: "currentDefinitionRef must reference a workflow-definition."
|
|
11520
|
+
});
|
|
11521
|
+
}
|
|
11522
|
+
if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
|
|
11523
|
+
context.addIssue({
|
|
11524
|
+
code: "custom",
|
|
11525
|
+
path: ["deletedAt"],
|
|
11526
|
+
message: "Deleted workflow catalog entries require deletedAt."
|
|
11527
|
+
});
|
|
11528
|
+
}
|
|
11529
|
+
if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
|
|
11530
|
+
context.addIssue({
|
|
11531
|
+
code: "custom",
|
|
11532
|
+
path: ["deletedAt"],
|
|
11533
|
+
message: "Active workflow catalog entries cannot declare deletedAt."
|
|
11534
|
+
});
|
|
11535
|
+
}
|
|
11536
|
+
});
|
|
11537
|
+
var WorkflowPublicationSchema = z15.object({
|
|
11538
|
+
contract: z15.literal("WorkflowPublication"),
|
|
11539
|
+
publicationId: ContractIdentifierSchema,
|
|
11540
|
+
definitionRef: EntityRefSchema,
|
|
11541
|
+
runtimeDefinitionRef: EntityRefSchema,
|
|
11542
|
+
sourceHash: Sha256Schema,
|
|
11543
|
+
compiledHash: Sha256Schema,
|
|
11544
|
+
status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
|
|
11545
|
+
publisherRef: EntityRefSchema,
|
|
11546
|
+
publishedAt: IsoDateTimeSchema.optional(),
|
|
11547
|
+
failureReason: z15.string().trim().min(1).optional()
|
|
11548
|
+
}).strict().superRefine((publication, context) => {
|
|
11549
|
+
if (publication.definitionRef.kind !== "workflow-definition") {
|
|
11550
|
+
context.addIssue({
|
|
11551
|
+
code: "custom",
|
|
11552
|
+
path: ["definitionRef", "kind"],
|
|
11553
|
+
message: "definitionRef must reference a workflow-definition."
|
|
11554
|
+
});
|
|
11555
|
+
}
|
|
11556
|
+
if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
|
|
11557
|
+
context.addIssue({
|
|
11558
|
+
code: "custom",
|
|
11559
|
+
path: ["runtimeDefinitionRef", "kind"],
|
|
11560
|
+
message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
|
|
11561
|
+
});
|
|
11562
|
+
}
|
|
11563
|
+
if (publication.status === "PUBLISHED" && !publication.publishedAt) {
|
|
11564
|
+
context.addIssue({
|
|
11565
|
+
code: "custom",
|
|
11566
|
+
path: ["publishedAt"],
|
|
11567
|
+
message: "Published workflow publications require publishedAt."
|
|
11568
|
+
});
|
|
11569
|
+
}
|
|
11570
|
+
if (publication.status === "FAILED" && !publication.failureReason) {
|
|
11571
|
+
context.addIssue({
|
|
11572
|
+
code: "custom",
|
|
11573
|
+
path: ["failureReason"],
|
|
11574
|
+
message: "Failed workflow publications require failureReason."
|
|
11575
|
+
});
|
|
11576
|
+
}
|
|
11577
|
+
});
|
|
11578
|
+
var WorkflowCompletionCommitSchema = z15.object({
|
|
11579
|
+
contract: z15.literal("WorkflowCompletionCommit"),
|
|
11580
|
+
commitId: ContractIdentifierSchema,
|
|
11581
|
+
run: ApplicationRunSchema,
|
|
11582
|
+
outputs: z15.array(OutputRecordSchema),
|
|
11583
|
+
artifacts: z15.array(ArtifactManifestSchema),
|
|
11584
|
+
lineage: LineageRecordSchema,
|
|
11585
|
+
completedAt: IsoDateTimeSchema
|
|
11586
|
+
}).strict().superRefine((commit, context) => {
|
|
11587
|
+
const expectedRunId = commit.run.runId;
|
|
11588
|
+
const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
|
|
11589
|
+
commit.outputs.forEach((output, index) => {
|
|
11590
|
+
if (!referencesRun(output)) {
|
|
11591
|
+
context.addIssue({
|
|
11592
|
+
code: "custom",
|
|
11593
|
+
path: ["outputs", index, "runRef"],
|
|
11594
|
+
message: "Every output must reference the committed ApplicationRun."
|
|
11595
|
+
});
|
|
11596
|
+
}
|
|
11597
|
+
});
|
|
11598
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11599
|
+
if (!referencesRun(artifact)) {
|
|
11600
|
+
context.addIssue({
|
|
11601
|
+
code: "custom",
|
|
11602
|
+
path: ["artifacts", index, "runRef"],
|
|
11603
|
+
message: "Every artifact must reference the committed ApplicationRun."
|
|
11604
|
+
});
|
|
11605
|
+
}
|
|
11606
|
+
});
|
|
11607
|
+
if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
|
|
11608
|
+
context.addIssue({
|
|
11609
|
+
code: "custom",
|
|
11610
|
+
path: ["lineage", "subjectRef"],
|
|
11611
|
+
message: "Completion lineage must use the committed ApplicationRun as its subject."
|
|
11612
|
+
});
|
|
11613
|
+
}
|
|
11614
|
+
const outputIds = new Set(commit.outputs.map((output) => output.outputId));
|
|
11615
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11616
|
+
if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
|
|
11617
|
+
context.addIssue({
|
|
11618
|
+
code: "custom",
|
|
11619
|
+
path: ["artifacts", index, "outputRef"],
|
|
11620
|
+
message: "Artifact outputRef must reference an output in the same commit."
|
|
11621
|
+
});
|
|
11622
|
+
}
|
|
11623
|
+
});
|
|
11624
|
+
});
|
|
11625
|
+
var WorkflowCompletionReceiptSchema = z15.object({
|
|
11626
|
+
contract: z15.literal("WorkflowCompletionReceipt"),
|
|
11627
|
+
commitId: ContractIdentifierSchema,
|
|
11628
|
+
runRef: EntityRefSchema,
|
|
11629
|
+
outputRefs: z15.array(EntityRefSchema),
|
|
11630
|
+
artifactRefs: z15.array(EntityRefSchema),
|
|
11631
|
+
contentHash: Sha256Schema,
|
|
11632
|
+
committedAt: IsoDateTimeSchema,
|
|
11633
|
+
idempotentReplay: z15.boolean()
|
|
11634
|
+
}).strict().superRefine((receipt, context) => {
|
|
11635
|
+
if (receipt.runRef.kind !== "application-run") {
|
|
11636
|
+
context.addIssue({
|
|
11637
|
+
code: "custom",
|
|
11638
|
+
path: ["runRef", "kind"],
|
|
11639
|
+
message: "runRef must reference an application-run."
|
|
11640
|
+
});
|
|
11641
|
+
}
|
|
11642
|
+
receipt.outputRefs.forEach((ref, index) => {
|
|
11643
|
+
if (ref.kind !== "workflow-output") {
|
|
11644
|
+
context.addIssue({
|
|
11645
|
+
code: "custom",
|
|
11646
|
+
path: ["outputRefs", index, "kind"],
|
|
11647
|
+
message: "outputRefs must reference workflow-output records."
|
|
11648
|
+
});
|
|
11649
|
+
}
|
|
11650
|
+
});
|
|
11651
|
+
receipt.artifactRefs.forEach((ref, index) => {
|
|
11652
|
+
if (ref.kind !== "artifact") {
|
|
11653
|
+
context.addIssue({
|
|
11654
|
+
code: "custom",
|
|
11655
|
+
path: ["artifactRefs", index, "kind"],
|
|
11656
|
+
message: "artifactRefs must reference artifacts."
|
|
11657
|
+
});
|
|
11658
|
+
}
|
|
11659
|
+
});
|
|
11660
|
+
});
|
|
11449
11661
|
export {
|
|
11450
11662
|
AGENT_MODE_CAPABILITIES,
|
|
11451
11663
|
AGENT_SESSION_CAPABILITY_EVIDENCE,
|
|
@@ -11584,12 +11796,16 @@ export {
|
|
|
11584
11796
|
TrendSourceRecordSchema,
|
|
11585
11797
|
TrendSourceSchema,
|
|
11586
11798
|
ViewProviderDescriptorSchema,
|
|
11799
|
+
WorkflowCatalogEntrySchema,
|
|
11800
|
+
WorkflowCompletionCommitSchema,
|
|
11801
|
+
WorkflowCompletionReceiptSchema,
|
|
11587
11802
|
WorkflowDefinitionSchema,
|
|
11588
11803
|
WorkflowEdgeSchema,
|
|
11589
11804
|
WorkflowNodeSchema,
|
|
11590
11805
|
WorkflowOutputBindingSchema,
|
|
11591
11806
|
WorkflowParameterSchema,
|
|
11592
11807
|
WorkflowParameterTypeSchema,
|
|
11808
|
+
WorkflowPublicationSchema,
|
|
11593
11809
|
WorkflowTriggerSchema,
|
|
11594
11810
|
WorkflowValidationIssueSchema,
|
|
11595
11811
|
agentModeHasCapability,
|