@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.
Files changed (37) 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 +8 -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 +219 -3
  18. package/lib/esm/contracts/index.mjs.map +1 -1
  19. package/lib/esm/index.mjs +224 -4
  20. package/lib/esm/index.mjs.map +1 -1
  21. package/lib/esm/runtime/index.mjs +2 -1
  22. package/lib/esm/runtime/index.mjs.map +1 -1
  23. package/lib/esm/schemas/index.mjs +224 -4
  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 +6 -0
  28. package/lib/json-schema/tenant-runtime-config.schema.json +6 -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 +288 -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
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,
@@ -10425,7 +10461,8 @@ var TenantHeadbarModuleLeafSchema = z12.object({
10425
10461
  disabled: z12.boolean().optional(),
10426
10462
  icon: z12.string().optional(),
10427
10463
  showQuickSwitcher: z12.boolean().optional(),
10428
- showSidebar: z12.boolean().optional()
10464
+ showSidebar: z12.boolean().optional(),
10465
+ showContentFrame: z12.boolean().optional()
10429
10466
  }).strict();
10430
10467
  var TenantHeadbarModuleItemSchema = TenantHeadbarModuleLeafSchema.extend({
10431
10468
  children: z12.array(TenantHeadbarModuleLeafSchema).optional()
@@ -11517,6 +11554,181 @@ var WorkflowDefinitionSchema = z14.object({
11517
11554
  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." });
11518
11555
  });
11519
11556
 
11557
+ // src/contracts/workflow-runtime.ts
11558
+ import { z as z15 } from "zod";
11559
+ var WorkflowCatalogEntrySchema = z15.object({
11560
+ contract: z15.literal("WorkflowCatalogEntry"),
11561
+ workflowId: ContractIdentifierSchema,
11562
+ teamId: ContractIdentifierSchema,
11563
+ creatorRef: EntityRefSchema,
11564
+ currentDefinitionRef: EntityRefSchema,
11565
+ lifecycle: z15.enum(["ACTIVE", "DELETED"]),
11566
+ asset: z15.object({
11567
+ preset: z15.boolean(),
11568
+ marketplacePublished: z15.boolean(),
11569
+ publishConfig: JsonObjectSchema.optional(),
11570
+ sort: z15.number().int(),
11571
+ forkFromRef: EntityRefSchema.optional(),
11572
+ notAuthorized: z15.boolean()
11573
+ }).strict(),
11574
+ createdAt: IsoDateTimeSchema,
11575
+ updatedAt: IsoDateTimeSchema,
11576
+ deletedAt: IsoDateTimeSchema.optional()
11577
+ }).strict().superRefine((entry, context) => {
11578
+ if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
11579
+ context.addIssue({
11580
+ code: "custom",
11581
+ path: ["creatorRef", "kind"],
11582
+ message: "creatorRef must reference a user or service."
11583
+ });
11584
+ }
11585
+ if (entry.currentDefinitionRef.kind !== "workflow-definition") {
11586
+ context.addIssue({
11587
+ code: "custom",
11588
+ path: ["currentDefinitionRef", "kind"],
11589
+ message: "currentDefinitionRef must reference a workflow-definition."
11590
+ });
11591
+ }
11592
+ if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
11593
+ context.addIssue({
11594
+ code: "custom",
11595
+ path: ["deletedAt"],
11596
+ message: "Deleted workflow catalog entries require deletedAt."
11597
+ });
11598
+ }
11599
+ if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
11600
+ context.addIssue({
11601
+ code: "custom",
11602
+ path: ["deletedAt"],
11603
+ message: "Active workflow catalog entries cannot declare deletedAt."
11604
+ });
11605
+ }
11606
+ });
11607
+ var WorkflowPublicationSchema = z15.object({
11608
+ contract: z15.literal("WorkflowPublication"),
11609
+ publicationId: ContractIdentifierSchema,
11610
+ definitionRef: EntityRefSchema,
11611
+ runtimeDefinitionRef: EntityRefSchema,
11612
+ sourceHash: Sha256Schema,
11613
+ compiledHash: Sha256Schema,
11614
+ status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
11615
+ publisherRef: EntityRefSchema,
11616
+ publishedAt: IsoDateTimeSchema.optional(),
11617
+ failureReason: z15.string().trim().min(1).optional()
11618
+ }).strict().superRefine((publication, context) => {
11619
+ if (publication.definitionRef.kind !== "workflow-definition") {
11620
+ context.addIssue({
11621
+ code: "custom",
11622
+ path: ["definitionRef", "kind"],
11623
+ message: "definitionRef must reference a workflow-definition."
11624
+ });
11625
+ }
11626
+ if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
11627
+ context.addIssue({
11628
+ code: "custom",
11629
+ path: ["runtimeDefinitionRef", "kind"],
11630
+ message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
11631
+ });
11632
+ }
11633
+ if (publication.status === "PUBLISHED" && !publication.publishedAt) {
11634
+ context.addIssue({
11635
+ code: "custom",
11636
+ path: ["publishedAt"],
11637
+ message: "Published workflow publications require publishedAt."
11638
+ });
11639
+ }
11640
+ if (publication.status === "FAILED" && !publication.failureReason) {
11641
+ context.addIssue({
11642
+ code: "custom",
11643
+ path: ["failureReason"],
11644
+ message: "Failed workflow publications require failureReason."
11645
+ });
11646
+ }
11647
+ });
11648
+ var WorkflowCompletionCommitSchema = z15.object({
11649
+ contract: z15.literal("WorkflowCompletionCommit"),
11650
+ commitId: ContractIdentifierSchema,
11651
+ run: ApplicationRunSchema,
11652
+ outputs: z15.array(OutputRecordSchema),
11653
+ artifacts: z15.array(ArtifactManifestSchema),
11654
+ lineage: LineageRecordSchema,
11655
+ completedAt: IsoDateTimeSchema
11656
+ }).strict().superRefine((commit, context) => {
11657
+ const expectedRunId = commit.run.runId;
11658
+ const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
11659
+ commit.outputs.forEach((output, index) => {
11660
+ if (!referencesRun(output)) {
11661
+ context.addIssue({
11662
+ code: "custom",
11663
+ path: ["outputs", index, "runRef"],
11664
+ message: "Every output must reference the committed ApplicationRun."
11665
+ });
11666
+ }
11667
+ });
11668
+ commit.artifacts.forEach((artifact, index) => {
11669
+ if (!referencesRun(artifact)) {
11670
+ context.addIssue({
11671
+ code: "custom",
11672
+ path: ["artifacts", index, "runRef"],
11673
+ message: "Every artifact must reference the committed ApplicationRun."
11674
+ });
11675
+ }
11676
+ });
11677
+ if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
11678
+ context.addIssue({
11679
+ code: "custom",
11680
+ path: ["lineage", "subjectRef"],
11681
+ message: "Completion lineage must use the committed ApplicationRun as its subject."
11682
+ });
11683
+ }
11684
+ const outputIds = new Set(commit.outputs.map((output) => output.outputId));
11685
+ commit.artifacts.forEach((artifact, index) => {
11686
+ if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
11687
+ context.addIssue({
11688
+ code: "custom",
11689
+ path: ["artifacts", index, "outputRef"],
11690
+ message: "Artifact outputRef must reference an output in the same commit."
11691
+ });
11692
+ }
11693
+ });
11694
+ });
11695
+ var WorkflowCompletionReceiptSchema = z15.object({
11696
+ contract: z15.literal("WorkflowCompletionReceipt"),
11697
+ commitId: ContractIdentifierSchema,
11698
+ runRef: EntityRefSchema,
11699
+ outputRefs: z15.array(EntityRefSchema),
11700
+ artifactRefs: z15.array(EntityRefSchema),
11701
+ contentHash: Sha256Schema,
11702
+ committedAt: IsoDateTimeSchema,
11703
+ idempotentReplay: z15.boolean()
11704
+ }).strict().superRefine((receipt, context) => {
11705
+ if (receipt.runRef.kind !== "application-run") {
11706
+ context.addIssue({
11707
+ code: "custom",
11708
+ path: ["runRef", "kind"],
11709
+ message: "runRef must reference an application-run."
11710
+ });
11711
+ }
11712
+ receipt.outputRefs.forEach((ref2, index) => {
11713
+ if (ref2.kind !== "workflow-output") {
11714
+ context.addIssue({
11715
+ code: "custom",
11716
+ path: ["outputRefs", index, "kind"],
11717
+ message: "outputRefs must reference workflow-output records."
11718
+ });
11719
+ }
11720
+ });
11721
+ receipt.artifactRefs.forEach((ref2, index) => {
11722
+ if (ref2.kind !== "artifact") {
11723
+ context.addIssue({
11724
+ code: "custom",
11725
+ path: ["artifactRefs", index, "kind"],
11726
+ message: "artifactRefs must reference artifacts."
11727
+ });
11728
+ }
11729
+ });
11730
+ });
11731
+
11520
11732
  // src/schemas/index.ts
11521
11733
  var canonicalContractSchemas = {
11522
11734
  "agent-session-command": AgentSessionCommandSchema,
@@ -11575,7 +11787,11 @@ var canonicalContractSchemas = {
11575
11787
  "trend-metric-snapshot": TrendMetricSnapshotSchema,
11576
11788
  "trend-source-record": TrendSourceRecordSchema,
11577
11789
  "view-provider-descriptor": ViewProviderDescriptorSchema,
11578
- "workflow-definition": WorkflowDefinitionSchema
11790
+ "workflow-definition": WorkflowDefinitionSchema,
11791
+ "workflow-catalog-entry": WorkflowCatalogEntrySchema,
11792
+ "workflow-publication": WorkflowPublicationSchema,
11793
+ "workflow-completion-commit": WorkflowCompletionCommitSchema,
11794
+ "workflow-completion-receipt": WorkflowCompletionReceiptSchema
11579
11795
  };
11580
11796
 
11581
11797
  // src/runtime/capability-registry.ts
@@ -12951,12 +13167,16 @@ export {
12951
13167
  ValidationIssueType,
12952
13168
  ValidationReasonType,
12953
13169
  ViewProviderDescriptorSchema,
13170
+ WorkflowCatalogEntrySchema,
13171
+ WorkflowCompletionCommitSchema,
13172
+ WorkflowCompletionReceiptSchema,
12954
13173
  WorkflowDefinitionSchema,
12955
13174
  WorkflowEdgeSchema,
12956
13175
  WorkflowNodeSchema,
12957
13176
  WorkflowOutputBindingSchema,
12958
13177
  WorkflowParameterSchema,
12959
13178
  WorkflowParameterTypeSchema,
13179
+ WorkflowPublicationSchema,
12960
13180
  WorkflowTriggerSchema,
12961
13181
  WorkflowTriggerType,
12962
13182
  WorkflowValidationIssueSchema,