@inf-monkeys-tech/monkeys 1.0.69 → 1.0.70

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/esm/index.mjs CHANGED
@@ -14863,22 +14863,75 @@ var WorkflowDefinitionSchema = z19.object({
14863
14863
  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." });
14864
14864
  });
14865
14865
 
14866
- // src/contracts/workflow-runtime.ts
14866
+ // src/contracts/workflow-column.ts
14867
14867
  import { z as z20 } from "zod";
14868
- var WorkflowCatalogEntrySchema = z20.object({
14869
- contract: z20.literal("WorkflowCatalogEntry"),
14868
+ var WorkflowColumnFieldRefSchema = z20.object({
14869
+ ontologyId: ContractIdentifierSchema,
14870
+ fieldKey: ContractIdentifierSchema
14871
+ }).strict();
14872
+ var WorkflowColumnInputSchema = z20.discriminatedUnion("kind", [
14873
+ z20.object({ kind: z20.literal("default") }).strict(),
14874
+ z20.object({ kind: z20.literal("constant"), value: JsonValueSchema }).strict(),
14875
+ z20.object({ kind: z20.literal("field"), field: WorkflowColumnFieldRefSchema }).strict(),
14876
+ z20.object({
14877
+ kind: z20.literal("context"),
14878
+ field: z20.enum(["assetId", "teamId", "ontologyId", "columnId"])
14879
+ }).strict()
14880
+ ]);
14881
+ var WorkflowColumnDependencySchema = z20.discriminatedUnion("kind", [
14882
+ z20.object({ kind: z20.literal("field"), field: WorkflowColumnFieldRefSchema }).strict(),
14883
+ z20.object({
14884
+ kind: z20.literal("relation"),
14885
+ relation: WorkflowColumnFieldRefSchema,
14886
+ direction: z20.enum(["incoming", "outgoing"]),
14887
+ fields: z20.array(WorkflowColumnFieldRefSchema).max(100)
14888
+ }).strict()
14889
+ ]);
14890
+ var WorkflowColumnOutputPathSchema = z20.array(z20.string().min(1).max(256)).max(20);
14891
+ var WorkflowColumnOutputSchema = z20.object({
14892
+ type: z20.enum(["number", "text", "json"]),
14893
+ path: WorkflowColumnOutputPathSchema,
14894
+ nullable: z20.boolean().default(false)
14895
+ }).strict();
14896
+ var WorkflowColumnBindingSchema = z20.object({
14897
+ contract: z20.literal("WorkflowColumnBinding"),
14898
+ version: z20.literal(1),
14899
+ enabled: z20.boolean(),
14900
+ paused: z20.boolean().default(false),
14901
+ workflow: z20.object({
14902
+ id: ContractIdentifierSchema,
14903
+ version: z20.number().int().positive(),
14904
+ inputSchemaHash: Sha256Schema
14905
+ }).strict(),
14906
+ inputs: z20.record(z20.string().min(1).max(128), WorkflowColumnInputSchema),
14907
+ dependencies: z20.array(WorkflowColumnDependencySchema).max(100).default([]),
14908
+ output: WorkflowColumnOutputSchema,
14909
+ policy: z20.object({
14910
+ debounceMs: z20.number().int().min(0).max(3e4).default(5e3),
14911
+ maxDelayMs: z20.number().int().min(0).max(3e4).default(3e4),
14912
+ concurrency: z20.number().int().min(1).max(32).default(2)
14913
+ }).strict().default({ debounceMs: 5e3, maxDelayMs: 3e4, concurrency: 2 }),
14914
+ // The workflow supplies an ISO datetime with offset for one future expiry.
14915
+ // Scheduling infrastructure needs no knowledge of months or business periods.
14916
+ expiry: z20.object({ path: WorkflowColumnOutputPathSchema }).strict().optional()
14917
+ }).strict();
14918
+
14919
+ // src/contracts/workflow-runtime.ts
14920
+ import { z as z21 } from "zod";
14921
+ var WorkflowCatalogEntrySchema = z21.object({
14922
+ contract: z21.literal("WorkflowCatalogEntry"),
14870
14923
  workflowId: ContractIdentifierSchema,
14871
14924
  teamId: ContractIdentifierSchema,
14872
14925
  creatorRef: EntityRefSchema,
14873
14926
  currentDefinitionRef: EntityRefSchema,
14874
- lifecycle: z20.enum(["ACTIVE", "DELETED"]),
14875
- asset: z20.object({
14876
- preset: z20.boolean(),
14877
- marketplacePublished: z20.boolean(),
14927
+ lifecycle: z21.enum(["ACTIVE", "DELETED"]),
14928
+ asset: z21.object({
14929
+ preset: z21.boolean(),
14930
+ marketplacePublished: z21.boolean(),
14878
14931
  publishConfig: JsonObjectSchema.optional(),
14879
- sort: z20.number().int(),
14932
+ sort: z21.number().int(),
14880
14933
  forkFromRef: EntityRefSchema.optional(),
14881
- notAuthorized: z20.boolean()
14934
+ notAuthorized: z21.boolean()
14882
14935
  }).strict(),
14883
14936
  createdAt: IsoDateTimeSchema,
14884
14937
  updatedAt: IsoDateTimeSchema,
@@ -14913,17 +14966,17 @@ var WorkflowCatalogEntrySchema = z20.object({
14913
14966
  });
14914
14967
  }
14915
14968
  });
14916
- var WorkflowPublicationSchema = z20.object({
14917
- contract: z20.literal("WorkflowPublication"),
14969
+ var WorkflowPublicationSchema = z21.object({
14970
+ contract: z21.literal("WorkflowPublication"),
14918
14971
  publicationId: ContractIdentifierSchema,
14919
14972
  definitionRef: EntityRefSchema,
14920
14973
  runtimeDefinitionRef: EntityRefSchema,
14921
14974
  sourceHash: Sha256Schema,
14922
14975
  compiledHash: Sha256Schema,
14923
- status: z20.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
14976
+ status: z21.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
14924
14977
  publisherRef: EntityRefSchema,
14925
14978
  publishedAt: IsoDateTimeSchema.optional(),
14926
- failureReason: z20.string().trim().min(1).optional()
14979
+ failureReason: z21.string().trim().min(1).optional()
14927
14980
  }).strict().superRefine((publication, context) => {
14928
14981
  if (publication.definitionRef.kind !== "workflow-definition") {
14929
14982
  context.addIssue({
@@ -14954,12 +15007,12 @@ var WorkflowPublicationSchema = z20.object({
14954
15007
  });
14955
15008
  }
14956
15009
  });
14957
- var WorkflowCompletionCommitSchema = z20.object({
14958
- contract: z20.literal("WorkflowCompletionCommit"),
15010
+ var WorkflowCompletionCommitSchema = z21.object({
15011
+ contract: z21.literal("WorkflowCompletionCommit"),
14959
15012
  commitId: ContractIdentifierSchema,
14960
15013
  run: ApplicationRunSchema,
14961
- outputs: z20.array(OutputRecordSchema),
14962
- artifacts: z20.array(ArtifactManifestSchema),
15014
+ outputs: z21.array(OutputRecordSchema),
15015
+ artifacts: z21.array(ArtifactManifestSchema),
14963
15016
  lineage: LineageRecordSchema,
14964
15017
  completedAt: IsoDateTimeSchema
14965
15018
  }).strict().superRefine((commit, context) => {
@@ -15001,15 +15054,15 @@ var WorkflowCompletionCommitSchema = z20.object({
15001
15054
  }
15002
15055
  });
15003
15056
  });
15004
- var WorkflowCompletionReceiptSchema = z20.object({
15005
- contract: z20.literal("WorkflowCompletionReceipt"),
15057
+ var WorkflowCompletionReceiptSchema = z21.object({
15058
+ contract: z21.literal("WorkflowCompletionReceipt"),
15006
15059
  commitId: ContractIdentifierSchema,
15007
15060
  runRef: EntityRefSchema,
15008
- outputRefs: z20.array(EntityRefSchema),
15009
- artifactRefs: z20.array(EntityRefSchema),
15061
+ outputRefs: z21.array(EntityRefSchema),
15062
+ artifactRefs: z21.array(EntityRefSchema),
15010
15063
  contentHash: Sha256Schema,
15011
15064
  committedAt: IsoDateTimeSchema,
15012
- idempotentReplay: z20.boolean()
15065
+ idempotentReplay: z21.boolean()
15013
15066
  }).strict().superRefine((receipt, context) => {
15014
15067
  if (receipt.runRef.kind !== "application-run") {
15015
15068
  context.addIssue({
@@ -15040,6 +15093,7 @@ var WorkflowCompletionReceiptSchema = z20.object({
15040
15093
 
15041
15094
  // src/schemas/index.ts
15042
15095
  var canonicalContractSchemas = {
15096
+ "workflow-column-binding": WorkflowColumnBindingSchema,
15043
15097
  "agent-session-command": AgentSessionCommandSchema,
15044
15098
  "agent-session-targeted-command": AgentSessionTargetedCommandSchema,
15045
15099
  "agent-session-command-result": AgentSessionCommandResultSchema,
@@ -17805,6 +17859,49 @@ var compileWorkflowPersistenceProjection = (input) => {
17805
17859
  });
17806
17860
  };
17807
17861
 
17862
+ // src/runtime/workflow-column.ts
17863
+ function parseWorkflowColumnBinding(value) {
17864
+ const binding = WorkflowColumnBindingSchema.parse(value);
17865
+ if (Object.keys(binding.inputs).length > 100)
17866
+ throw new Error("Workflow column supports at most 100 input bindings.");
17867
+ if (binding.policy.maxDelayMs < binding.policy.debounceMs)
17868
+ throw new Error("Workflow column maxDelayMs must be at least debounceMs.");
17869
+ for (const name of Object.keys(binding.inputs)) {
17870
+ if (name !== name.trim() || name.startsWith("__") || name === "constructor" || name === "prototype") {
17871
+ throw new Error(`Invalid Workflow input name: ${name}`);
17872
+ }
17873
+ }
17874
+ return binding;
17875
+ }
17876
+ function selectOwnValue(payload, path) {
17877
+ let value = payload;
17878
+ for (const key of path) {
17879
+ if (value === null || typeof value !== "object" || !Object.prototype.hasOwnProperty.call(value, key)) {
17880
+ throw new Error(`Workflow output is missing the configured path: ${JSON.stringify(path)}`);
17881
+ }
17882
+ value = value[key];
17883
+ }
17884
+ if (value === void 0) throw new Error("Workflow output is absent.");
17885
+ return value;
17886
+ }
17887
+ function resolveWorkflowColumnResult(binding, payload, nowMs = Date.now()) {
17888
+ const selected = selectOwnValue(payload, binding.output.path);
17889
+ if (selected === null && !binding.output.nullable)
17890
+ throw new Error("Workflow output is null but this column does not allow null results.");
17891
+ if (selected !== null) {
17892
+ if (binding.output.type === "number" && (typeof selected !== "number" || !Number.isFinite(selected)))
17893
+ throw new Error("Workflow output must be a finite number.");
17894
+ if (binding.output.type === "text" && typeof selected !== "string")
17895
+ throw new Error("Workflow output must be text.");
17896
+ }
17897
+ const value = JsonValueSchema.parse(selected);
17898
+ if (!binding.expiry) return { value };
17899
+ const expiresAt = IsoDateTimeSchema.parse(selectOwnValue(payload, binding.expiry.path));
17900
+ if (!Number.isFinite(nowMs) || Date.parse(expiresAt) <= nowMs)
17901
+ throw new Error("Workflow expiry must be a future datetime.");
17902
+ return { value, expiresAt };
17903
+ }
17904
+
17808
17905
  // src/runtime/access-compiler.ts
17809
17906
  var uniqueBy = (values, key, label) => {
17810
17907
  const result = /* @__PURE__ */ new Map();
@@ -18271,6 +18368,12 @@ export {
18271
18368
  WorkbenchRuntimeBundleSchema,
18272
18369
  WorkbenchSchema,
18273
18370
  WorkflowCatalogEntrySchema,
18371
+ WorkflowColumnBindingSchema,
18372
+ WorkflowColumnDependencySchema,
18373
+ WorkflowColumnFieldRefSchema,
18374
+ WorkflowColumnInputSchema,
18375
+ WorkflowColumnOutputPathSchema,
18376
+ WorkflowColumnOutputSchema,
18274
18377
  WorkflowCompletionCommitSchema,
18275
18378
  WorkflowCompletionReceiptSchema,
18276
18379
  WorkflowDefinitionSchema,
@@ -18339,6 +18442,7 @@ export {
18339
18442
  normalizeAgentMode,
18340
18443
  normalizeStudioAgentMode,
18341
18444
  parseApplicationHandoff,
18445
+ parseWorkflowColumnBinding,
18342
18446
  projectAgentSessionEvents,
18343
18447
  projectNavigationCompatibility,
18344
18448
  publishOpenApiToolCapabilityManifests,
@@ -18349,6 +18453,7 @@ export {
18349
18453
  resolveMenuActivationId,
18350
18454
  resolveThemeTokens,
18351
18455
  resolveWorkbenchEntry,
18456
+ resolveWorkflowColumnResult,
18352
18457
  revisionRefKey,
18353
18458
  sameRevisionRef,
18354
18459
  sameStableRef,