@inf-monkeys-tech/monkeys 1.0.17 → 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.
Files changed (38) hide show
  1. package/lib/contracts/continuity.d.ts +2 -2
  2. package/lib/contracts/continuity.d.ts.map +1 -1
  3. package/lib/contracts/continuity.js +39 -2
  4. package/lib/contracts/continuity.js.map +1 -1
  5. package/lib/contracts/index.d.ts +1 -0
  6. package/lib/contracts/index.d.ts.map +1 -1
  7. package/lib/contracts/index.js +1 -0
  8. package/lib/contracts/index.js.map +1 -1
  9. package/lib/contracts/tenant.d.ts +3 -0
  10. package/lib/contracts/tenant.d.ts.map +1 -1
  11. package/lib/contracts/tenant.js +1 -0
  12. package/lib/contracts/tenant.js.map +1 -1
  13. package/lib/contracts/workflow-runtime.d.ts +287 -0
  14. package/lib/contracts/workflow-runtime.d.ts.map +1 -0
  15. package/lib/contracts/workflow-runtime.js +198 -0
  16. package/lib/contracts/workflow-runtime.js.map +1 -0
  17. package/lib/esm/contracts/index.mjs +218 -2
  18. package/lib/esm/contracts/index.mjs.map +1 -1
  19. package/lib/esm/index.mjs +223 -3
  20. package/lib/esm/index.mjs.map +1 -1
  21. package/lib/esm/runtime/index.mjs +1 -0
  22. package/lib/esm/runtime/index.mjs.map +1 -1
  23. package/lib/esm/schemas/index.mjs +223 -3
  24. package/lib/esm/schemas/index.mjs.map +1 -1
  25. package/lib/json-schema/application-run.schema.json +0 -1
  26. package/lib/json-schema/index.json +5 -1
  27. package/lib/json-schema/tenant-product-config.schema.json +9 -0
  28. package/lib/json-schema/tenant-runtime-config.schema.json +9 -0
  29. package/lib/json-schema/workflow-catalog-entry.schema.json +238 -0
  30. package/lib/json-schema/workflow-completion-commit.schema.json +1163 -0
  31. package/lib/json-schema/workflow-completion-receipt.schema.json +160 -0
  32. package/lib/json-schema/workflow-publication.schema.json +168 -0
  33. package/lib/schemas/index.d.ts +286 -2
  34. package/lib/schemas/index.d.ts.map +1 -1
  35. package/lib/schemas/index.js +11 -1
  36. package/lib/schemas/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/test/fixtures/tenant-product-config.public.json +1 -0
package/lib/esm/index.mjs CHANGED
@@ -7626,7 +7626,7 @@ var ApplicationRunSchema = z7.object({
7626
7626
  contract: z7.literal("ApplicationRun"),
7627
7627
  runId: ContractIdentifierSchema,
7628
7628
  definitionRef: EntityRefSchema,
7629
- runtimeLedgerRef: EntityRefSchema,
7629
+ runtimeLedgerRef: EntityRefSchema.optional(),
7630
7630
  requestId: ContractIdentifierSchema,
7631
7631
  actorRef: EntityRefSchema,
7632
7632
  status: z7.enum(["PENDING", "RUNNING", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]),
@@ -7636,7 +7636,43 @@ var ApplicationRunSchema = z7.object({
7636
7636
  completedAt: IsoDateTimeSchema.optional(),
7637
7637
  expiresAt: IsoDateTimeSchema.optional(),
7638
7638
  metadata: JsonObjectSchema.default({})
7639
- }).strict();
7639
+ }).strict().superRefine((run, context) => {
7640
+ if (run.definitionRef.kind !== "workflow-definition") {
7641
+ context.addIssue({
7642
+ code: "custom",
7643
+ path: ["definitionRef", "kind"],
7644
+ message: "definitionRef must reference a workflow-definition."
7645
+ });
7646
+ }
7647
+ if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== "workflow-run") {
7648
+ context.addIssue({
7649
+ code: "custom",
7650
+ path: ["runtimeLedgerRef", "kind"],
7651
+ message: "runtimeLedgerRef must reference a workflow-run."
7652
+ });
7653
+ }
7654
+ if ((run.status === "RUNNING" || run.status === "COMPLETED" || run.status === "CANCELLED") && !run.runtimeLedgerRef) {
7655
+ context.addIssue({
7656
+ code: "custom",
7657
+ path: ["runtimeLedgerRef"],
7658
+ message: `${run.status} ApplicationRun requires runtimeLedgerRef.`
7659
+ });
7660
+ }
7661
+ if (run.status === "RUNNING" && !run.startedAt) {
7662
+ context.addIssue({
7663
+ code: "custom",
7664
+ path: ["startedAt"],
7665
+ message: "RUNNING ApplicationRun requires startedAt."
7666
+ });
7667
+ }
7668
+ if (["COMPLETED", "FAILED", "CANCELLED", "EXPIRED"].includes(run.status) && !run.completedAt) {
7669
+ context.addIssue({
7670
+ code: "custom",
7671
+ path: ["completedAt"],
7672
+ message: `Terminal ApplicationRun status ${run.status} requires completedAt.`
7673
+ });
7674
+ }
7675
+ });
7640
7676
  var ExpiringAccessGrantSchema = z7.object({
7641
7677
  contract: z7.literal("ExpiringAccessGrant"),
7642
7678
  grantId: ContractIdentifierSchema,
@@ -10752,6 +10788,7 @@ var TenantApplicationConfigSchema = z12.object({
10752
10788
  dataManagement: z12.object({
10753
10789
  favoriteOntologyId: z12.string().optional(),
10754
10790
  pairedOntologyId: z12.string().optional(),
10791
+ galleryOntologyIds: z12.array(ContractIdentifierSchema).max(20).optional(),
10755
10792
  galleryOntologyId: z12.string().optional(),
10756
10793
  dataBrowserDefaultOntologyId: z12.string().optional(),
10757
10794
  workflowResultOntologyId: z12.string().optional(),
@@ -11516,6 +11553,181 @@ var WorkflowDefinitionSchema = z14.object({
11516
11553
  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." });
11517
11554
  });
11518
11555
 
11556
+ // src/contracts/workflow-runtime.ts
11557
+ import { z as z15 } from "zod";
11558
+ var WorkflowCatalogEntrySchema = z15.object({
11559
+ contract: z15.literal("WorkflowCatalogEntry"),
11560
+ workflowId: ContractIdentifierSchema,
11561
+ teamId: ContractIdentifierSchema,
11562
+ creatorRef: EntityRefSchema,
11563
+ currentDefinitionRef: EntityRefSchema,
11564
+ lifecycle: z15.enum(["ACTIVE", "DELETED"]),
11565
+ asset: z15.object({
11566
+ preset: z15.boolean(),
11567
+ marketplacePublished: z15.boolean(),
11568
+ publishConfig: JsonObjectSchema.optional(),
11569
+ sort: z15.number().int(),
11570
+ forkFromRef: EntityRefSchema.optional(),
11571
+ notAuthorized: z15.boolean()
11572
+ }).strict(),
11573
+ createdAt: IsoDateTimeSchema,
11574
+ updatedAt: IsoDateTimeSchema,
11575
+ deletedAt: IsoDateTimeSchema.optional()
11576
+ }).strict().superRefine((entry, context) => {
11577
+ if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
11578
+ context.addIssue({
11579
+ code: "custom",
11580
+ path: ["creatorRef", "kind"],
11581
+ message: "creatorRef must reference a user or service."
11582
+ });
11583
+ }
11584
+ if (entry.currentDefinitionRef.kind !== "workflow-definition") {
11585
+ context.addIssue({
11586
+ code: "custom",
11587
+ path: ["currentDefinitionRef", "kind"],
11588
+ message: "currentDefinitionRef must reference a workflow-definition."
11589
+ });
11590
+ }
11591
+ if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
11592
+ context.addIssue({
11593
+ code: "custom",
11594
+ path: ["deletedAt"],
11595
+ message: "Deleted workflow catalog entries require deletedAt."
11596
+ });
11597
+ }
11598
+ if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
11599
+ context.addIssue({
11600
+ code: "custom",
11601
+ path: ["deletedAt"],
11602
+ message: "Active workflow catalog entries cannot declare deletedAt."
11603
+ });
11604
+ }
11605
+ });
11606
+ var WorkflowPublicationSchema = z15.object({
11607
+ contract: z15.literal("WorkflowPublication"),
11608
+ publicationId: ContractIdentifierSchema,
11609
+ definitionRef: EntityRefSchema,
11610
+ runtimeDefinitionRef: EntityRefSchema,
11611
+ sourceHash: Sha256Schema,
11612
+ compiledHash: Sha256Schema,
11613
+ status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
11614
+ publisherRef: EntityRefSchema,
11615
+ publishedAt: IsoDateTimeSchema.optional(),
11616
+ failureReason: z15.string().trim().min(1).optional()
11617
+ }).strict().superRefine((publication, context) => {
11618
+ if (publication.definitionRef.kind !== "workflow-definition") {
11619
+ context.addIssue({
11620
+ code: "custom",
11621
+ path: ["definitionRef", "kind"],
11622
+ message: "definitionRef must reference a workflow-definition."
11623
+ });
11624
+ }
11625
+ if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
11626
+ context.addIssue({
11627
+ code: "custom",
11628
+ path: ["runtimeDefinitionRef", "kind"],
11629
+ message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
11630
+ });
11631
+ }
11632
+ if (publication.status === "PUBLISHED" && !publication.publishedAt) {
11633
+ context.addIssue({
11634
+ code: "custom",
11635
+ path: ["publishedAt"],
11636
+ message: "Published workflow publications require publishedAt."
11637
+ });
11638
+ }
11639
+ if (publication.status === "FAILED" && !publication.failureReason) {
11640
+ context.addIssue({
11641
+ code: "custom",
11642
+ path: ["failureReason"],
11643
+ message: "Failed workflow publications require failureReason."
11644
+ });
11645
+ }
11646
+ });
11647
+ var WorkflowCompletionCommitSchema = z15.object({
11648
+ contract: z15.literal("WorkflowCompletionCommit"),
11649
+ commitId: ContractIdentifierSchema,
11650
+ run: ApplicationRunSchema,
11651
+ outputs: z15.array(OutputRecordSchema),
11652
+ artifacts: z15.array(ArtifactManifestSchema),
11653
+ lineage: LineageRecordSchema,
11654
+ completedAt: IsoDateTimeSchema
11655
+ }).strict().superRefine((commit, context) => {
11656
+ const expectedRunId = commit.run.runId;
11657
+ const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
11658
+ commit.outputs.forEach((output, index) => {
11659
+ if (!referencesRun(output)) {
11660
+ context.addIssue({
11661
+ code: "custom",
11662
+ path: ["outputs", index, "runRef"],
11663
+ message: "Every output must reference the committed ApplicationRun."
11664
+ });
11665
+ }
11666
+ });
11667
+ commit.artifacts.forEach((artifact, index) => {
11668
+ if (!referencesRun(artifact)) {
11669
+ context.addIssue({
11670
+ code: "custom",
11671
+ path: ["artifacts", index, "runRef"],
11672
+ message: "Every artifact must reference the committed ApplicationRun."
11673
+ });
11674
+ }
11675
+ });
11676
+ if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
11677
+ context.addIssue({
11678
+ code: "custom",
11679
+ path: ["lineage", "subjectRef"],
11680
+ message: "Completion lineage must use the committed ApplicationRun as its subject."
11681
+ });
11682
+ }
11683
+ const outputIds = new Set(commit.outputs.map((output) => output.outputId));
11684
+ commit.artifacts.forEach((artifact, index) => {
11685
+ if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
11686
+ context.addIssue({
11687
+ code: "custom",
11688
+ path: ["artifacts", index, "outputRef"],
11689
+ message: "Artifact outputRef must reference an output in the same commit."
11690
+ });
11691
+ }
11692
+ });
11693
+ });
11694
+ var WorkflowCompletionReceiptSchema = z15.object({
11695
+ contract: z15.literal("WorkflowCompletionReceipt"),
11696
+ commitId: ContractIdentifierSchema,
11697
+ runRef: EntityRefSchema,
11698
+ outputRefs: z15.array(EntityRefSchema),
11699
+ artifactRefs: z15.array(EntityRefSchema),
11700
+ contentHash: Sha256Schema,
11701
+ committedAt: IsoDateTimeSchema,
11702
+ idempotentReplay: z15.boolean()
11703
+ }).strict().superRefine((receipt, context) => {
11704
+ if (receipt.runRef.kind !== "application-run") {
11705
+ context.addIssue({
11706
+ code: "custom",
11707
+ path: ["runRef", "kind"],
11708
+ message: "runRef must reference an application-run."
11709
+ });
11710
+ }
11711
+ receipt.outputRefs.forEach((ref2, index) => {
11712
+ if (ref2.kind !== "workflow-output") {
11713
+ context.addIssue({
11714
+ code: "custom",
11715
+ path: ["outputRefs", index, "kind"],
11716
+ message: "outputRefs must reference workflow-output records."
11717
+ });
11718
+ }
11719
+ });
11720
+ receipt.artifactRefs.forEach((ref2, index) => {
11721
+ if (ref2.kind !== "artifact") {
11722
+ context.addIssue({
11723
+ code: "custom",
11724
+ path: ["artifactRefs", index, "kind"],
11725
+ message: "artifactRefs must reference artifacts."
11726
+ });
11727
+ }
11728
+ });
11729
+ });
11730
+
11519
11731
  // src/schemas/index.ts
11520
11732
  var canonicalContractSchemas = {
11521
11733
  "agent-session-command": AgentSessionCommandSchema,
@@ -11574,7 +11786,11 @@ var canonicalContractSchemas = {
11574
11786
  "trend-metric-snapshot": TrendMetricSnapshotSchema,
11575
11787
  "trend-source-record": TrendSourceRecordSchema,
11576
11788
  "view-provider-descriptor": ViewProviderDescriptorSchema,
11577
- "workflow-definition": WorkflowDefinitionSchema
11789
+ "workflow-definition": WorkflowDefinitionSchema,
11790
+ "workflow-catalog-entry": WorkflowCatalogEntrySchema,
11791
+ "workflow-publication": WorkflowPublicationSchema,
11792
+ "workflow-completion-commit": WorkflowCompletionCommitSchema,
11793
+ "workflow-completion-receipt": WorkflowCompletionReceiptSchema
11578
11794
  };
11579
11795
 
11580
11796
  // src/runtime/capability-registry.ts
@@ -12950,12 +13166,16 @@ export {
12950
13166
  ValidationIssueType,
12951
13167
  ValidationReasonType,
12952
13168
  ViewProviderDescriptorSchema,
13169
+ WorkflowCatalogEntrySchema,
13170
+ WorkflowCompletionCommitSchema,
13171
+ WorkflowCompletionReceiptSchema,
12953
13172
  WorkflowDefinitionSchema,
12954
13173
  WorkflowEdgeSchema,
12955
13174
  WorkflowNodeSchema,
12956
13175
  WorkflowOutputBindingSchema,
12957
13176
  WorkflowParameterSchema,
12958
13177
  WorkflowParameterTypeSchema,
13178
+ WorkflowPublicationSchema,
12959
13179
  WorkflowTriggerSchema,
12960
13180
  WorkflowTriggerType,
12961
13181
  WorkflowValidationIssueSchema,