@inf-monkeys-tech/monkeys 1.0.69 → 1.0.71

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