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