@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.
@@ -15847,9 +15847,105 @@ var compileWorkflowPersistenceProjection = (input) => {
15847
15847
  });
15848
15848
  };
15849
15849
 
15850
- // src/contracts/access.ts
15850
+ // src/contracts/workflow-column.ts
15851
15851
  import { z as z13 } from "zod";
15852
- var PermissionDefinitionSchema = z13.object({
15852
+ var WorkflowColumnFieldRefSchema = z13.object({
15853
+ ontologyId: ContractIdentifierSchema,
15854
+ fieldKey: ContractIdentifierSchema
15855
+ }).strict();
15856
+ var WorkflowColumnInputSchema = z13.discriminatedUnion("kind", [
15857
+ z13.object({ kind: z13.literal("default") }).strict(),
15858
+ z13.object({ kind: z13.literal("constant"), value: JsonValueSchema }).strict(),
15859
+ z13.object({ kind: z13.literal("field"), field: WorkflowColumnFieldRefSchema }).strict(),
15860
+ z13.object({
15861
+ kind: z13.literal("context"),
15862
+ field: z13.enum(["assetId", "teamId", "ontologyId", "columnId"])
15863
+ }).strict()
15864
+ ]);
15865
+ var WorkflowColumnDependencySchema = z13.discriminatedUnion("kind", [
15866
+ z13.object({ kind: z13.literal("field"), field: WorkflowColumnFieldRefSchema }).strict(),
15867
+ z13.object({
15868
+ kind: z13.literal("relation"),
15869
+ relation: WorkflowColumnFieldRefSchema,
15870
+ direction: z13.enum(["incoming", "outgoing"]),
15871
+ fields: z13.array(WorkflowColumnFieldRefSchema).max(100)
15872
+ }).strict()
15873
+ ]);
15874
+ var WorkflowColumnOutputPathSchema = z13.array(z13.string().min(1).max(256)).max(20);
15875
+ var WorkflowColumnOutputSchema = z13.object({
15876
+ type: z13.enum(["number", "text", "json"]),
15877
+ path: WorkflowColumnOutputPathSchema,
15878
+ nullable: z13.boolean().default(false)
15879
+ }).strict();
15880
+ var WorkflowColumnBindingSchema = z13.object({
15881
+ contract: z13.literal("WorkflowColumnBinding"),
15882
+ version: z13.literal(1),
15883
+ enabled: z13.boolean(),
15884
+ paused: z13.boolean().default(false),
15885
+ workflow: z13.object({
15886
+ id: ContractIdentifierSchema,
15887
+ version: z13.number().int().positive(),
15888
+ inputSchemaHash: Sha256Schema
15889
+ }).strict(),
15890
+ inputs: z13.record(z13.string().min(1).max(128), WorkflowColumnInputSchema),
15891
+ dependencies: z13.array(WorkflowColumnDependencySchema).max(100).default([]),
15892
+ output: WorkflowColumnOutputSchema,
15893
+ policy: z13.object({
15894
+ debounceMs: z13.number().int().min(0).max(3e4).default(5e3),
15895
+ maxDelayMs: z13.number().int().min(0).max(3e4).default(3e4),
15896
+ concurrency: z13.number().int().min(1).max(32).default(2)
15897
+ }).strict().default({ debounceMs: 5e3, maxDelayMs: 3e4, concurrency: 2 }),
15898
+ // The workflow supplies an ISO datetime with offset for one future expiry.
15899
+ // Scheduling infrastructure needs no knowledge of months or business periods.
15900
+ expiry: z13.object({ path: WorkflowColumnOutputPathSchema }).strict().optional()
15901
+ }).strict();
15902
+
15903
+ // src/runtime/workflow-column.ts
15904
+ function parseWorkflowColumnBinding(value) {
15905
+ const binding = WorkflowColumnBindingSchema.parse(value);
15906
+ if (Object.keys(binding.inputs).length > 100)
15907
+ throw new Error("Workflow column supports at most 100 input bindings.");
15908
+ if (binding.policy.maxDelayMs < binding.policy.debounceMs)
15909
+ throw new Error("Workflow column maxDelayMs must be at least debounceMs.");
15910
+ for (const name of Object.keys(binding.inputs)) {
15911
+ if (name !== name.trim() || name.startsWith("__") || name === "constructor" || name === "prototype") {
15912
+ throw new Error(`Invalid Workflow input name: ${name}`);
15913
+ }
15914
+ }
15915
+ return binding;
15916
+ }
15917
+ function selectOwnValue(payload, path) {
15918
+ let value = payload;
15919
+ for (const key of path) {
15920
+ if (value === null || typeof value !== "object" || !Object.prototype.hasOwnProperty.call(value, key)) {
15921
+ throw new Error(`Workflow output is missing the configured path: ${JSON.stringify(path)}`);
15922
+ }
15923
+ value = value[key];
15924
+ }
15925
+ if (value === void 0) throw new Error("Workflow output is absent.");
15926
+ return value;
15927
+ }
15928
+ function resolveWorkflowColumnResult(binding, payload, nowMs = Date.now()) {
15929
+ const selected = selectOwnValue(payload, binding.output.path);
15930
+ if (selected === null && !binding.output.nullable)
15931
+ throw new Error("Workflow output is null but this column does not allow null results.");
15932
+ if (selected !== null) {
15933
+ if (binding.output.type === "number" && (typeof selected !== "number" || !Number.isFinite(selected)))
15934
+ throw new Error("Workflow output must be a finite number.");
15935
+ if (binding.output.type === "text" && typeof selected !== "string")
15936
+ throw new Error("Workflow output must be text.");
15937
+ }
15938
+ const value = JsonValueSchema.parse(selected);
15939
+ if (!binding.expiry) return { value };
15940
+ const expiresAt = IsoDateTimeSchema.parse(selectOwnValue(payload, binding.expiry.path));
15941
+ if (!Number.isFinite(nowMs) || Date.parse(expiresAt) <= nowMs)
15942
+ throw new Error("Workflow expiry must be a future datetime.");
15943
+ return { value, expiresAt };
15944
+ }
15945
+
15946
+ // src/contracts/access.ts
15947
+ import { z as z14 } from "zod";
15948
+ var PermissionDefinitionSchema = z14.object({
15853
15949
  code: ContractIdentifierSchema,
15854
15950
  name: LocalizedTextSchema,
15855
15951
  description: LocalizedTextSchema.optional(),
@@ -15857,29 +15953,29 @@ var PermissionDefinitionSchema = z13.object({
15857
15953
  action: ContractIdentifierSchema,
15858
15954
  domain: ContractIdentifierSchema.optional()
15859
15955
  }).strict();
15860
- var PermissionBundleSchema = z13.object({
15956
+ var PermissionBundleSchema = z14.object({
15861
15957
  bundleId: ContractIdentifierSchema,
15862
15958
  name: LocalizedTextSchema,
15863
- permissionCodes: z13.array(ContractIdentifierSchema).default([])
15959
+ permissionCodes: z14.array(ContractIdentifierSchema).default([])
15864
15960
  }).strict();
15865
- var SystemGroupDefinitionSchema = z13.object({
15961
+ var SystemGroupDefinitionSchema = z14.object({
15866
15962
  groupCode: ContractIdentifierSchema,
15867
15963
  name: LocalizedTextSchema,
15868
15964
  description: LocalizedTextSchema.optional(),
15869
- permissionPolicy: z13.enum(["bundles", "studio_current", "all_current"]).default("bundles"),
15870
- permissionBundleIds: z13.array(ContractIdentifierSchema).default([])
15965
+ permissionPolicy: z14.enum(["bundles", "studio_current", "all_current"]).default("bundles"),
15966
+ permissionBundleIds: z14.array(ContractIdentifierSchema).default([])
15871
15967
  }).strict().refine((value) => value.permissionPolicy !== "bundles" || value.permissionBundleIds.length > 0, {
15872
15968
  message: "A bundles permission policy requires at least one permission bundle.",
15873
15969
  path: ["permissionBundleIds"]
15874
15970
  });
15875
- var ProductAccessDeclarationSchema = z13.object({
15876
- contract: z13.literal("ProductAccessDeclaration"),
15971
+ var ProductAccessDeclarationSchema = z14.object({
15972
+ contract: z14.literal("ProductAccessDeclaration"),
15877
15973
  declarationId: ContractIdentifierSchema,
15878
15974
  version: ContractVersionSchema,
15879
15975
  ownerRepo: ContractIdentifierSchema,
15880
- permissions: z13.array(PermissionDefinitionSchema).default([]),
15881
- permissionBundles: z13.array(PermissionBundleSchema).default([]),
15882
- systemGroups: z13.array(SystemGroupDefinitionSchema).min(1)
15976
+ permissions: z14.array(PermissionDefinitionSchema).default([]),
15977
+ permissionBundles: z14.array(PermissionBundleSchema).default([]),
15978
+ systemGroups: z14.array(SystemGroupDefinitionSchema).min(1)
15883
15979
  }).strict();
15884
15980
 
15885
15981
  // src/runtime/access-compiler.ts
@@ -15988,6 +16084,7 @@ export {
15988
16084
  materializeRouteSpacePath,
15989
16085
  mergeThemeTokenDocuments,
15990
16086
  parseApplicationHandoff,
16087
+ parseWorkflowColumnBinding,
15991
16088
  projectAgentSessionEvents,
15992
16089
  projectNavigationCompatibility,
15993
16090
  publishOpenApiToolCapabilityManifests,
@@ -15996,6 +16093,7 @@ export {
15996
16093
  resolveMenuActivationId,
15997
16094
  resolveThemeTokens,
15998
16095
  resolveWorkbenchEntry,
16096
+ resolveWorkflowColumnResult,
15999
16097
  revisionRefKey,
16000
16098
  sameRevisionRef,
16001
16099
  sameStableRef,