@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
@@ -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,
@@ -10316,7 +10352,8 @@ var TenantHeadbarModuleLeafSchema = z12.object({
10316
10352
  disabled: z12.boolean().optional(),
10317
10353
  icon: z12.string().optional(),
10318
10354
  showQuickSwitcher: z12.boolean().optional(),
10319
- showSidebar: z12.boolean().optional()
10355
+ showSidebar: z12.boolean().optional(),
10356
+ showContentFrame: z12.boolean().optional()
10320
10357
  }).strict();
10321
10358
  var TenantHeadbarModuleItemSchema = TenantHeadbarModuleLeafSchema.extend({
10322
10359
  children: z12.array(TenantHeadbarModuleLeafSchema).optional()
@@ -11408,6 +11445,181 @@ var WorkflowDefinitionSchema = z14.object({
11408
11445
  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
11446
  });
11410
11447
 
11448
+ // src/contracts/workflow-runtime.ts
11449
+ import { z as z15 } from "zod";
11450
+ var WorkflowCatalogEntrySchema = z15.object({
11451
+ contract: z15.literal("WorkflowCatalogEntry"),
11452
+ workflowId: ContractIdentifierSchema,
11453
+ teamId: ContractIdentifierSchema,
11454
+ creatorRef: EntityRefSchema,
11455
+ currentDefinitionRef: EntityRefSchema,
11456
+ lifecycle: z15.enum(["ACTIVE", "DELETED"]),
11457
+ asset: z15.object({
11458
+ preset: z15.boolean(),
11459
+ marketplacePublished: z15.boolean(),
11460
+ publishConfig: JsonObjectSchema.optional(),
11461
+ sort: z15.number().int(),
11462
+ forkFromRef: EntityRefSchema.optional(),
11463
+ notAuthorized: z15.boolean()
11464
+ }).strict(),
11465
+ createdAt: IsoDateTimeSchema,
11466
+ updatedAt: IsoDateTimeSchema,
11467
+ deletedAt: IsoDateTimeSchema.optional()
11468
+ }).strict().superRefine((entry, context) => {
11469
+ if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
11470
+ context.addIssue({
11471
+ code: "custom",
11472
+ path: ["creatorRef", "kind"],
11473
+ message: "creatorRef must reference a user or service."
11474
+ });
11475
+ }
11476
+ if (entry.currentDefinitionRef.kind !== "workflow-definition") {
11477
+ context.addIssue({
11478
+ code: "custom",
11479
+ path: ["currentDefinitionRef", "kind"],
11480
+ message: "currentDefinitionRef must reference a workflow-definition."
11481
+ });
11482
+ }
11483
+ if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
11484
+ context.addIssue({
11485
+ code: "custom",
11486
+ path: ["deletedAt"],
11487
+ message: "Deleted workflow catalog entries require deletedAt."
11488
+ });
11489
+ }
11490
+ if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
11491
+ context.addIssue({
11492
+ code: "custom",
11493
+ path: ["deletedAt"],
11494
+ message: "Active workflow catalog entries cannot declare deletedAt."
11495
+ });
11496
+ }
11497
+ });
11498
+ var WorkflowPublicationSchema = z15.object({
11499
+ contract: z15.literal("WorkflowPublication"),
11500
+ publicationId: ContractIdentifierSchema,
11501
+ definitionRef: EntityRefSchema,
11502
+ runtimeDefinitionRef: EntityRefSchema,
11503
+ sourceHash: Sha256Schema,
11504
+ compiledHash: Sha256Schema,
11505
+ status: z15.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
11506
+ publisherRef: EntityRefSchema,
11507
+ publishedAt: IsoDateTimeSchema.optional(),
11508
+ failureReason: z15.string().trim().min(1).optional()
11509
+ }).strict().superRefine((publication, context) => {
11510
+ if (publication.definitionRef.kind !== "workflow-definition") {
11511
+ context.addIssue({
11512
+ code: "custom",
11513
+ path: ["definitionRef", "kind"],
11514
+ message: "definitionRef must reference a workflow-definition."
11515
+ });
11516
+ }
11517
+ if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
11518
+ context.addIssue({
11519
+ code: "custom",
11520
+ path: ["runtimeDefinitionRef", "kind"],
11521
+ message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
11522
+ });
11523
+ }
11524
+ if (publication.status === "PUBLISHED" && !publication.publishedAt) {
11525
+ context.addIssue({
11526
+ code: "custom",
11527
+ path: ["publishedAt"],
11528
+ message: "Published workflow publications require publishedAt."
11529
+ });
11530
+ }
11531
+ if (publication.status === "FAILED" && !publication.failureReason) {
11532
+ context.addIssue({
11533
+ code: "custom",
11534
+ path: ["failureReason"],
11535
+ message: "Failed workflow publications require failureReason."
11536
+ });
11537
+ }
11538
+ });
11539
+ var WorkflowCompletionCommitSchema = z15.object({
11540
+ contract: z15.literal("WorkflowCompletionCommit"),
11541
+ commitId: ContractIdentifierSchema,
11542
+ run: ApplicationRunSchema,
11543
+ outputs: z15.array(OutputRecordSchema),
11544
+ artifacts: z15.array(ArtifactManifestSchema),
11545
+ lineage: LineageRecordSchema,
11546
+ completedAt: IsoDateTimeSchema
11547
+ }).strict().superRefine((commit, context) => {
11548
+ const expectedRunId = commit.run.runId;
11549
+ const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
11550
+ commit.outputs.forEach((output, index) => {
11551
+ if (!referencesRun(output)) {
11552
+ context.addIssue({
11553
+ code: "custom",
11554
+ path: ["outputs", index, "runRef"],
11555
+ message: "Every output must reference the committed ApplicationRun."
11556
+ });
11557
+ }
11558
+ });
11559
+ commit.artifacts.forEach((artifact, index) => {
11560
+ if (!referencesRun(artifact)) {
11561
+ context.addIssue({
11562
+ code: "custom",
11563
+ path: ["artifacts", index, "runRef"],
11564
+ message: "Every artifact must reference the committed ApplicationRun."
11565
+ });
11566
+ }
11567
+ });
11568
+ if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
11569
+ context.addIssue({
11570
+ code: "custom",
11571
+ path: ["lineage", "subjectRef"],
11572
+ message: "Completion lineage must use the committed ApplicationRun as its subject."
11573
+ });
11574
+ }
11575
+ const outputIds = new Set(commit.outputs.map((output) => output.outputId));
11576
+ commit.artifacts.forEach((artifact, index) => {
11577
+ if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
11578
+ context.addIssue({
11579
+ code: "custom",
11580
+ path: ["artifacts", index, "outputRef"],
11581
+ message: "Artifact outputRef must reference an output in the same commit."
11582
+ });
11583
+ }
11584
+ });
11585
+ });
11586
+ var WorkflowCompletionReceiptSchema = z15.object({
11587
+ contract: z15.literal("WorkflowCompletionReceipt"),
11588
+ commitId: ContractIdentifierSchema,
11589
+ runRef: EntityRefSchema,
11590
+ outputRefs: z15.array(EntityRefSchema),
11591
+ artifactRefs: z15.array(EntityRefSchema),
11592
+ contentHash: Sha256Schema,
11593
+ committedAt: IsoDateTimeSchema,
11594
+ idempotentReplay: z15.boolean()
11595
+ }).strict().superRefine((receipt, context) => {
11596
+ if (receipt.runRef.kind !== "application-run") {
11597
+ context.addIssue({
11598
+ code: "custom",
11599
+ path: ["runRef", "kind"],
11600
+ message: "runRef must reference an application-run."
11601
+ });
11602
+ }
11603
+ receipt.outputRefs.forEach((ref, index) => {
11604
+ if (ref.kind !== "workflow-output") {
11605
+ context.addIssue({
11606
+ code: "custom",
11607
+ path: ["outputRefs", index, "kind"],
11608
+ message: "outputRefs must reference workflow-output records."
11609
+ });
11610
+ }
11611
+ });
11612
+ receipt.artifactRefs.forEach((ref, index) => {
11613
+ if (ref.kind !== "artifact") {
11614
+ context.addIssue({
11615
+ code: "custom",
11616
+ path: ["artifactRefs", index, "kind"],
11617
+ message: "artifactRefs must reference artifacts."
11618
+ });
11619
+ }
11620
+ });
11621
+ });
11622
+
11411
11623
  // src/schemas/index.ts
11412
11624
  var canonicalContractSchemas = {
11413
11625
  "agent-session-command": AgentSessionCommandSchema,
@@ -11466,7 +11678,11 @@ var canonicalContractSchemas = {
11466
11678
  "trend-metric-snapshot": TrendMetricSnapshotSchema,
11467
11679
  "trend-source-record": TrendSourceRecordSchema,
11468
11680
  "view-provider-descriptor": ViewProviderDescriptorSchema,
11469
- "workflow-definition": WorkflowDefinitionSchema
11681
+ "workflow-definition": WorkflowDefinitionSchema,
11682
+ "workflow-catalog-entry": WorkflowCatalogEntrySchema,
11683
+ "workflow-publication": WorkflowPublicationSchema,
11684
+ "workflow-completion-commit": WorkflowCompletionCommitSchema,
11685
+ "workflow-completion-receipt": WorkflowCompletionReceiptSchema
11470
11686
  };
11471
11687
  export {
11472
11688
  AgentConfigurationCapabilitySchema,
@@ -11581,12 +11797,16 @@ export {
11581
11797
  TrendSourceRecordSchema,
11582
11798
  TrendSourceSchema,
11583
11799
  ViewProviderDescriptorSchema,
11800
+ WorkflowCatalogEntrySchema,
11801
+ WorkflowCompletionCommitSchema,
11802
+ WorkflowCompletionReceiptSchema,
11584
11803
  WorkflowDefinitionSchema,
11585
11804
  WorkflowEdgeSchema,
11586
11805
  WorkflowNodeSchema,
11587
11806
  WorkflowOutputBindingSchema,
11588
11807
  WorkflowParameterSchema,
11589
11808
  WorkflowParameterTypeSchema,
11809
+ WorkflowPublicationSchema,
11590
11810
  WorkflowTriggerSchema,
11591
11811
  WorkflowValidationIssueSchema,
11592
11812
  canonicalContractSchemas