@inf-monkeys-tech/monkeys 1.0.18 → 1.0.19
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/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 +217 -2
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +222 -3
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +222 -3
- 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/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 +284 -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
|
@@ -7550,7 +7550,7 @@ var ApplicationRunSchema = z7.object({
|
|
|
7550
7550
|
contract: z7.literal("ApplicationRun"),
|
|
7551
7551
|
runId: ContractIdentifierSchema,
|
|
7552
7552
|
definitionRef: EntityRefSchema,
|
|
7553
|
-
runtimeLedgerRef: EntityRefSchema,
|
|
7553
|
+
runtimeLedgerRef: EntityRefSchema.optional(),
|
|
7554
7554
|
requestId: ContractIdentifierSchema,
|
|
7555
7555
|
actorRef: EntityRefSchema,
|
|
7556
7556
|
status: z7.enum(["PENDING", "RUNNING", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]),
|
|
@@ -7560,7 +7560,43 @@ var ApplicationRunSchema = z7.object({
|
|
|
7560
7560
|
completedAt: IsoDateTimeSchema.optional(),
|
|
7561
7561
|
expiresAt: IsoDateTimeSchema.optional(),
|
|
7562
7562
|
metadata: JsonObjectSchema.default({})
|
|
7563
|
-
}).strict()
|
|
7563
|
+
}).strict().superRefine((run, context) => {
|
|
7564
|
+
if (run.definitionRef.kind !== "workflow-definition") {
|
|
7565
|
+
context.addIssue({
|
|
7566
|
+
code: "custom",
|
|
7567
|
+
path: ["definitionRef", "kind"],
|
|
7568
|
+
message: "definitionRef must reference a workflow-definition."
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7571
|
+
if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== "workflow-run") {
|
|
7572
|
+
context.addIssue({
|
|
7573
|
+
code: "custom",
|
|
7574
|
+
path: ["runtimeLedgerRef", "kind"],
|
|
7575
|
+
message: "runtimeLedgerRef must reference a workflow-run."
|
|
7576
|
+
});
|
|
7577
|
+
}
|
|
7578
|
+
if ((run.status === "RUNNING" || run.status === "COMPLETED" || run.status === "CANCELLED") && !run.runtimeLedgerRef) {
|
|
7579
|
+
context.addIssue({
|
|
7580
|
+
code: "custom",
|
|
7581
|
+
path: ["runtimeLedgerRef"],
|
|
7582
|
+
message: `${run.status} ApplicationRun requires runtimeLedgerRef.`
|
|
7583
|
+
});
|
|
7584
|
+
}
|
|
7585
|
+
if (run.status === "RUNNING" && !run.startedAt) {
|
|
7586
|
+
context.addIssue({
|
|
7587
|
+
code: "custom",
|
|
7588
|
+
path: ["startedAt"],
|
|
7589
|
+
message: "RUNNING ApplicationRun requires startedAt."
|
|
7590
|
+
});
|
|
7591
|
+
}
|
|
7592
|
+
if (["COMPLETED", "FAILED", "CANCELLED", "EXPIRED"].includes(run.status) && !run.completedAt) {
|
|
7593
|
+
context.addIssue({
|
|
7594
|
+
code: "custom",
|
|
7595
|
+
path: ["completedAt"],
|
|
7596
|
+
message: `Terminal ApplicationRun status ${run.status} requires completedAt.`
|
|
7597
|
+
});
|
|
7598
|
+
}
|
|
7599
|
+
});
|
|
7564
7600
|
var ExpiringAccessGrantSchema = z7.object({
|
|
7565
7601
|
contract: z7.literal("ExpiringAccessGrant"),
|
|
7566
7602
|
grantId: ContractIdentifierSchema,
|
|
@@ -11408,6 +11444,181 @@ var WorkflowDefinitionSchema = z14.object({
|
|
|
11408
11444
|
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." });
|
|
11409
11445
|
});
|
|
11410
11446
|
|
|
11447
|
+
// src/contracts/workflow-runtime.ts
|
|
11448
|
+
import { z as z15 } from "zod";
|
|
11449
|
+
var WorkflowCatalogEntrySchema = z15.object({
|
|
11450
|
+
contract: z15.literal("WorkflowCatalogEntry"),
|
|
11451
|
+
workflowId: ContractIdentifierSchema,
|
|
11452
|
+
teamId: ContractIdentifierSchema,
|
|
11453
|
+
creatorRef: EntityRefSchema,
|
|
11454
|
+
currentDefinitionRef: EntityRefSchema,
|
|
11455
|
+
lifecycle: z15.enum(["ACTIVE", "DELETED"]),
|
|
11456
|
+
asset: z15.object({
|
|
11457
|
+
preset: z15.boolean(),
|
|
11458
|
+
marketplacePublished: z15.boolean(),
|
|
11459
|
+
publishConfig: JsonObjectSchema.optional(),
|
|
11460
|
+
sort: z15.number().int(),
|
|
11461
|
+
forkFromRef: EntityRefSchema.optional(),
|
|
11462
|
+
notAuthorized: z15.boolean()
|
|
11463
|
+
}).strict(),
|
|
11464
|
+
createdAt: IsoDateTimeSchema,
|
|
11465
|
+
updatedAt: IsoDateTimeSchema,
|
|
11466
|
+
deletedAt: IsoDateTimeSchema.optional()
|
|
11467
|
+
}).strict().superRefine((entry, context) => {
|
|
11468
|
+
if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
|
|
11469
|
+
context.addIssue({
|
|
11470
|
+
code: "custom",
|
|
11471
|
+
path: ["creatorRef", "kind"],
|
|
11472
|
+
message: "creatorRef must reference a user or service."
|
|
11473
|
+
});
|
|
11474
|
+
}
|
|
11475
|
+
if (entry.currentDefinitionRef.kind !== "workflow-definition") {
|
|
11476
|
+
context.addIssue({
|
|
11477
|
+
code: "custom",
|
|
11478
|
+
path: ["currentDefinitionRef", "kind"],
|
|
11479
|
+
message: "currentDefinitionRef must reference a workflow-definition."
|
|
11480
|
+
});
|
|
11481
|
+
}
|
|
11482
|
+
if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
|
|
11483
|
+
context.addIssue({
|
|
11484
|
+
code: "custom",
|
|
11485
|
+
path: ["deletedAt"],
|
|
11486
|
+
message: "Deleted workflow catalog entries require deletedAt."
|
|
11487
|
+
});
|
|
11488
|
+
}
|
|
11489
|
+
if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
|
|
11490
|
+
context.addIssue({
|
|
11491
|
+
code: "custom",
|
|
11492
|
+
path: ["deletedAt"],
|
|
11493
|
+
message: "Active workflow catalog entries cannot declare deletedAt."
|
|
11494
|
+
});
|
|
11495
|
+
}
|
|
11496
|
+
});
|
|
11497
|
+
var WorkflowPublicationSchema = z15.object({
|
|
11498
|
+
contract: z15.literal("WorkflowPublication"),
|
|
11499
|
+
publicationId: ContractIdentifierSchema,
|
|
11500
|
+
definitionRef: EntityRefSchema,
|
|
11501
|
+
runtimeDefinitionRef: EntityRefSchema,
|
|
11502
|
+
sourceHash: Sha256Schema,
|
|
11503
|
+
compiledHash: Sha256Schema,
|
|
11504
|
+
status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
|
|
11505
|
+
publisherRef: EntityRefSchema,
|
|
11506
|
+
publishedAt: IsoDateTimeSchema.optional(),
|
|
11507
|
+
failureReason: z15.string().trim().min(1).optional()
|
|
11508
|
+
}).strict().superRefine((publication, context) => {
|
|
11509
|
+
if (publication.definitionRef.kind !== "workflow-definition") {
|
|
11510
|
+
context.addIssue({
|
|
11511
|
+
code: "custom",
|
|
11512
|
+
path: ["definitionRef", "kind"],
|
|
11513
|
+
message: "definitionRef must reference a workflow-definition."
|
|
11514
|
+
});
|
|
11515
|
+
}
|
|
11516
|
+
if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
|
|
11517
|
+
context.addIssue({
|
|
11518
|
+
code: "custom",
|
|
11519
|
+
path: ["runtimeDefinitionRef", "kind"],
|
|
11520
|
+
message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
|
|
11521
|
+
});
|
|
11522
|
+
}
|
|
11523
|
+
if (publication.status === "PUBLISHED" && !publication.publishedAt) {
|
|
11524
|
+
context.addIssue({
|
|
11525
|
+
code: "custom",
|
|
11526
|
+
path: ["publishedAt"],
|
|
11527
|
+
message: "Published workflow publications require publishedAt."
|
|
11528
|
+
});
|
|
11529
|
+
}
|
|
11530
|
+
if (publication.status === "FAILED" && !publication.failureReason) {
|
|
11531
|
+
context.addIssue({
|
|
11532
|
+
code: "custom",
|
|
11533
|
+
path: ["failureReason"],
|
|
11534
|
+
message: "Failed workflow publications require failureReason."
|
|
11535
|
+
});
|
|
11536
|
+
}
|
|
11537
|
+
});
|
|
11538
|
+
var WorkflowCompletionCommitSchema = z15.object({
|
|
11539
|
+
contract: z15.literal("WorkflowCompletionCommit"),
|
|
11540
|
+
commitId: ContractIdentifierSchema,
|
|
11541
|
+
run: ApplicationRunSchema,
|
|
11542
|
+
outputs: z15.array(OutputRecordSchema),
|
|
11543
|
+
artifacts: z15.array(ArtifactManifestSchema),
|
|
11544
|
+
lineage: LineageRecordSchema,
|
|
11545
|
+
completedAt: IsoDateTimeSchema
|
|
11546
|
+
}).strict().superRefine((commit, context) => {
|
|
11547
|
+
const expectedRunId = commit.run.runId;
|
|
11548
|
+
const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
|
|
11549
|
+
commit.outputs.forEach((output, index) => {
|
|
11550
|
+
if (!referencesRun(output)) {
|
|
11551
|
+
context.addIssue({
|
|
11552
|
+
code: "custom",
|
|
11553
|
+
path: ["outputs", index, "runRef"],
|
|
11554
|
+
message: "Every output must reference the committed ApplicationRun."
|
|
11555
|
+
});
|
|
11556
|
+
}
|
|
11557
|
+
});
|
|
11558
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11559
|
+
if (!referencesRun(artifact)) {
|
|
11560
|
+
context.addIssue({
|
|
11561
|
+
code: "custom",
|
|
11562
|
+
path: ["artifacts", index, "runRef"],
|
|
11563
|
+
message: "Every artifact must reference the committed ApplicationRun."
|
|
11564
|
+
});
|
|
11565
|
+
}
|
|
11566
|
+
});
|
|
11567
|
+
if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
|
|
11568
|
+
context.addIssue({
|
|
11569
|
+
code: "custom",
|
|
11570
|
+
path: ["lineage", "subjectRef"],
|
|
11571
|
+
message: "Completion lineage must use the committed ApplicationRun as its subject."
|
|
11572
|
+
});
|
|
11573
|
+
}
|
|
11574
|
+
const outputIds = new Set(commit.outputs.map((output) => output.outputId));
|
|
11575
|
+
commit.artifacts.forEach((artifact, index) => {
|
|
11576
|
+
if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
|
|
11577
|
+
context.addIssue({
|
|
11578
|
+
code: "custom",
|
|
11579
|
+
path: ["artifacts", index, "outputRef"],
|
|
11580
|
+
message: "Artifact outputRef must reference an output in the same commit."
|
|
11581
|
+
});
|
|
11582
|
+
}
|
|
11583
|
+
});
|
|
11584
|
+
});
|
|
11585
|
+
var WorkflowCompletionReceiptSchema = z15.object({
|
|
11586
|
+
contract: z15.literal("WorkflowCompletionReceipt"),
|
|
11587
|
+
commitId: ContractIdentifierSchema,
|
|
11588
|
+
runRef: EntityRefSchema,
|
|
11589
|
+
outputRefs: z15.array(EntityRefSchema),
|
|
11590
|
+
artifactRefs: z15.array(EntityRefSchema),
|
|
11591
|
+
contentHash: Sha256Schema,
|
|
11592
|
+
committedAt: IsoDateTimeSchema,
|
|
11593
|
+
idempotentReplay: z15.boolean()
|
|
11594
|
+
}).strict().superRefine((receipt, context) => {
|
|
11595
|
+
if (receipt.runRef.kind !== "application-run") {
|
|
11596
|
+
context.addIssue({
|
|
11597
|
+
code: "custom",
|
|
11598
|
+
path: ["runRef", "kind"],
|
|
11599
|
+
message: "runRef must reference an application-run."
|
|
11600
|
+
});
|
|
11601
|
+
}
|
|
11602
|
+
receipt.outputRefs.forEach((ref, index) => {
|
|
11603
|
+
if (ref.kind !== "workflow-output") {
|
|
11604
|
+
context.addIssue({
|
|
11605
|
+
code: "custom",
|
|
11606
|
+
path: ["outputRefs", index, "kind"],
|
|
11607
|
+
message: "outputRefs must reference workflow-output records."
|
|
11608
|
+
});
|
|
11609
|
+
}
|
|
11610
|
+
});
|
|
11611
|
+
receipt.artifactRefs.forEach((ref, index) => {
|
|
11612
|
+
if (ref.kind !== "artifact") {
|
|
11613
|
+
context.addIssue({
|
|
11614
|
+
code: "custom",
|
|
11615
|
+
path: ["artifactRefs", index, "kind"],
|
|
11616
|
+
message: "artifactRefs must reference artifacts."
|
|
11617
|
+
});
|
|
11618
|
+
}
|
|
11619
|
+
});
|
|
11620
|
+
});
|
|
11621
|
+
|
|
11411
11622
|
// src/schemas/index.ts
|
|
11412
11623
|
var canonicalContractSchemas = {
|
|
11413
11624
|
"agent-session-command": AgentSessionCommandSchema,
|
|
@@ -11466,7 +11677,11 @@ var canonicalContractSchemas = {
|
|
|
11466
11677
|
"trend-metric-snapshot": TrendMetricSnapshotSchema,
|
|
11467
11678
|
"trend-source-record": TrendSourceRecordSchema,
|
|
11468
11679
|
"view-provider-descriptor": ViewProviderDescriptorSchema,
|
|
11469
|
-
"workflow-definition": WorkflowDefinitionSchema
|
|
11680
|
+
"workflow-definition": WorkflowDefinitionSchema,
|
|
11681
|
+
"workflow-catalog-entry": WorkflowCatalogEntrySchema,
|
|
11682
|
+
"workflow-publication": WorkflowPublicationSchema,
|
|
11683
|
+
"workflow-completion-commit": WorkflowCompletionCommitSchema,
|
|
11684
|
+
"workflow-completion-receipt": WorkflowCompletionReceiptSchema
|
|
11470
11685
|
};
|
|
11471
11686
|
export {
|
|
11472
11687
|
AgentConfigurationCapabilitySchema,
|
|
@@ -11581,12 +11796,16 @@ export {
|
|
|
11581
11796
|
TrendSourceRecordSchema,
|
|
11582
11797
|
TrendSourceSchema,
|
|
11583
11798
|
ViewProviderDescriptorSchema,
|
|
11799
|
+
WorkflowCatalogEntrySchema,
|
|
11800
|
+
WorkflowCompletionCommitSchema,
|
|
11801
|
+
WorkflowCompletionReceiptSchema,
|
|
11584
11802
|
WorkflowDefinitionSchema,
|
|
11585
11803
|
WorkflowEdgeSchema,
|
|
11586
11804
|
WorkflowNodeSchema,
|
|
11587
11805
|
WorkflowOutputBindingSchema,
|
|
11588
11806
|
WorkflowParameterSchema,
|
|
11589
11807
|
WorkflowParameterTypeSchema,
|
|
11808
|
+
WorkflowPublicationSchema,
|
|
11590
11809
|
WorkflowTriggerSchema,
|
|
11591
11810
|
WorkflowValidationIssueSchema,
|
|
11592
11811
|
canonicalContractSchemas
|