@eigenpal/cli 0.11.3 → 0.12.0

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/dist/cli.js CHANGED
@@ -27023,26 +27023,10 @@ function workflowInputTypeToJsonSchema(def) {
27023
27023
  if (def.source && def.type === "file") {
27024
27024
  return { type: "string", minLength: 1 };
27025
27025
  }
27026
- switch (def.type) {
27027
- case "string":
27028
- return { type: "string" };
27029
- case "enum":
27030
- return def.values && def.values.length > 0 ? { type: "string", enum: def.values } : { type: "string" };
27031
- case "number":
27032
- return { type: "number" };
27033
- case "integer":
27034
- return { type: "integer" };
27035
- case "boolean":
27036
- return { type: "boolean" };
27037
- case "file":
27038
- return { ...WORKFLOW_FILE_REF_JSON_SCHEMA };
27039
- case "array":
27040
- return { type: "array", items: itemsToJsonSchema(def.items) };
27041
- case "object":
27042
- return { type: "object" };
27043
- default:
27044
- return {};
27026
+ if (def.type === "file") {
27027
+ return { ...WORKFLOW_FILE_REF_JSON_SCHEMA };
27045
27028
  }
27029
+ return inputPropertyToJsonSchema(def);
27046
27030
  }
27047
27031
  function itemsToJsonSchema(items) {
27048
27032
  if (!items)
@@ -27052,8 +27036,49 @@ function itemsToJsonSchema(items) {
27052
27036
  if (items.type === "enum" && items.values && items.values.length > 0) {
27053
27037
  return { type: "string", enum: items.values };
27054
27038
  }
27039
+ if (items.type === "object" && items.properties && items.properties.length > 0) {
27040
+ return workflowInputPropertiesToJsonSchema(items.properties);
27041
+ }
27055
27042
  return { type: items.type };
27056
27043
  }
27044
+ function workflowInputPropertiesToJsonSchema(props) {
27045
+ const properties = {};
27046
+ const required2 = [];
27047
+ for (const prop of props) {
27048
+ properties[prop.name] = inputPropertyToJsonSchema(prop);
27049
+ if (prop.required !== false)
27050
+ required2.push(prop.name);
27051
+ }
27052
+ const schema = { type: "object", properties };
27053
+ if (required2.length > 0)
27054
+ schema.required = required2;
27055
+ return schema;
27056
+ }
27057
+ function inputPropertyToJsonSchema(prop) {
27058
+ const base = (() => {
27059
+ switch (prop.type) {
27060
+ case "string":
27061
+ return { type: "string" };
27062
+ case "enum":
27063
+ return prop.values && prop.values.length > 0 ? { type: "string", enum: prop.values } : { type: "string" };
27064
+ case "number":
27065
+ return { type: "number" };
27066
+ case "integer":
27067
+ return { type: "integer" };
27068
+ case "boolean":
27069
+ return { type: "boolean" };
27070
+ case "array":
27071
+ return { type: "array", items: itemsToJsonSchema(prop.items) };
27072
+ case "object":
27073
+ return prop.properties && prop.properties.length > 0 ? workflowInputPropertiesToJsonSchema(prop.properties) : { type: "object" };
27074
+ default:
27075
+ return {};
27076
+ }
27077
+ })();
27078
+ if (prop.description)
27079
+ base.description = prop.description;
27080
+ return base;
27081
+ }
27057
27082
  function validateInput(input, schema) {
27058
27083
  const validate = eigenpalAjv.compile(schema);
27059
27084
  const ok = validate(input);
@@ -66036,6 +66061,46 @@ var init_actions = __esm(() => {
66036
66061
  function suggestWorkflowName(raw) {
66037
66062
  return raw.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^[_-]+|[_-]+$/g, "").slice(0, 64);
66038
66063
  }
66064
+ function validateInputProperties(props, path, inputName, ctx) {
66065
+ const seen = new Set;
66066
+ props.forEach((prop, i) => {
66067
+ const propPath = [...path, i];
66068
+ if (seen.has(prop.name)) {
66069
+ ctx.addIssue({
66070
+ code: exports_external.ZodIssueCode.custom,
66071
+ path: [...propPath, "name"],
66072
+ message: `Duplicate property name "${prop.name}" on input "${inputName}"`
66073
+ });
66074
+ }
66075
+ seen.add(prop.name);
66076
+ if (prop.type === "file" || prop.items?.type === "file") {
66077
+ ctx.addIssue({
66078
+ code: exports_external.ZodIssueCode.custom,
66079
+ path: [...propPath, "type"],
66080
+ message: `File-typed properties are not supported inside object inputs (property "${prop.name}" on input "${inputName}"). Declare the file as its own top-level input.`
66081
+ });
66082
+ }
66083
+ if (prop.properties && prop.type !== "object") {
66084
+ ctx.addIssue({
66085
+ code: exports_external.ZodIssueCode.custom,
66086
+ path: [...propPath, "properties"],
66087
+ message: `"properties" is only valid on an object property; "${prop.name}" has type "${prop.type}"`
66088
+ });
66089
+ }
66090
+ if (prop.items?.properties && prop.items.type !== "object") {
66091
+ ctx.addIssue({
66092
+ code: exports_external.ZodIssueCode.custom,
66093
+ path: [...propPath, "items", "properties"],
66094
+ message: `"items.properties" is only valid with "items.type: object"; "${prop.name}" has item type "${prop.items.type}"`
66095
+ });
66096
+ }
66097
+ if (prop.properties)
66098
+ validateInputProperties(prop.properties, [...propPath, "properties"], inputName, ctx);
66099
+ if (prop.items?.properties) {
66100
+ validateInputProperties(prop.items.properties, [...propPath, "items", "properties"], inputName, ctx);
66101
+ }
66102
+ });
66103
+ }
66039
66104
  function getTriggerMethods(definition) {
66040
66105
  if (definition.triggerMethods && definition.triggerMethods.length > 0) {
66041
66106
  return definition.triggerMethods;
@@ -66050,7 +66115,7 @@ function isManualTriggerEnabled(definition) {
66050
66115
  const manual = getTriggerMethods(definition).find((m) => m.type === "manual");
66051
66116
  return manual?.enabled !== false;
66052
66117
  }
66053
- var WORKFLOW_NAME_PATTERN, WorkflowNameSchema, WorkflowInputDefSchema, ManualTriggerMethodSchema, ApiTriggerMethodSchema, EmailTriggerMethodSchema, TriggerMethodSchema, TriggerMethodsSchema, WorkflowSettingsSchema, WorkflowDefinitionSchema, StoredWorkflowDefinitionSchema, CreateWorkflowDefinitionSchema;
66118
+ var WORKFLOW_NAME_PATTERN, WorkflowNameSchema, WorkflowInputPropertySchema, WorkflowInputDefSchema, ManualTriggerMethodSchema, ApiTriggerMethodSchema, EmailTriggerMethodSchema, TriggerMethodSchema, TriggerMethodsSchema, WorkflowSettingsSchema, WorkflowDefinitionSchema, StoredWorkflowDefinitionSchema, CreateWorkflowDefinitionSchema;
66054
66119
  var init_workflow = __esm(() => {
66055
66120
  init_zod();
66056
66121
  init_common();
@@ -66058,6 +66123,19 @@ var init_workflow = __esm(() => {
66058
66123
  init_steps();
66059
66124
  WORKFLOW_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
66060
66125
  WorkflowNameSchema = exports_external.string().min(1).max(64).regex(WORKFLOW_NAME_PATTERN, 'Workflow name must start with a lowercase letter or digit and contain only lowercase letters, digits, "_" or "-".');
66126
+ WorkflowInputPropertySchema = exports_external.lazy(() => exports_external.object({
66127
+ name: exports_external.string().min(1).regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/, "Property names must start with a letter or underscore and contain only letters, numbers, and underscores"),
66128
+ type: exports_external.string(),
66129
+ description: exports_external.string().optional(),
66130
+ required: exports_external.boolean().optional(),
66131
+ values: exports_external.array(exports_external.string()).optional(),
66132
+ items: exports_external.object({
66133
+ type: exports_external.string(),
66134
+ values: exports_external.array(exports_external.string()).optional(),
66135
+ properties: exports_external.array(WorkflowInputPropertySchema).optional()
66136
+ }).optional(),
66137
+ properties: exports_external.array(WorkflowInputPropertySchema).optional()
66138
+ }));
66061
66139
  WorkflowInputDefSchema = exports_external.object({
66062
66140
  name: exports_external.string().min(1),
66063
66141
  type: exports_external.string(),
@@ -66067,12 +66145,33 @@ var init_workflow = __esm(() => {
66067
66145
  values: exports_external.array(exports_external.string()).optional(),
66068
66146
  items: exports_external.object({
66069
66147
  type: exports_external.string(),
66070
- values: exports_external.array(exports_external.string()).optional()
66148
+ values: exports_external.array(exports_external.string()).optional(),
66149
+ properties: exports_external.array(WorkflowInputPropertySchema).optional()
66071
66150
  }).optional(),
66151
+ properties: exports_external.array(WorkflowInputPropertySchema).optional(),
66072
66152
  source: exports_external.string().min(1).optional(),
66073
66153
  mimeType: exports_external.string().min(1).optional(),
66074
66154
  extension: exports_external.string().min(1).optional()
66075
66155
  }).superRefine((def, ctx) => {
66156
+ if (def.properties && def.type !== "object") {
66157
+ ctx.addIssue({
66158
+ code: exports_external.ZodIssueCode.custom,
66159
+ path: ["properties"],
66160
+ message: `"properties" is only valid on an object input; input "${def.name}" has type "${def.type}"`
66161
+ });
66162
+ }
66163
+ if (def.items?.properties && def.items.type !== "object") {
66164
+ ctx.addIssue({
66165
+ code: exports_external.ZodIssueCode.custom,
66166
+ path: ["items", "properties"],
66167
+ message: `"items.properties" is only valid with "items.type: object"; input "${def.name}" has item type "${def.items.type}"`
66168
+ });
66169
+ }
66170
+ if (def.properties)
66171
+ validateInputProperties(def.properties, ["properties"], def.name, ctx);
66172
+ if (def.items?.properties) {
66173
+ validateInputProperties(def.items.properties, ["items", "properties"], def.name, ctx);
66174
+ }
66076
66175
  if (def.source && def.type !== "file") {
66077
66176
  ctx.addIssue({
66078
66177
  code: exports_external.ZodIssueCode.custom,
@@ -66485,33 +66584,12 @@ var init_execution2 = __esm(() => {
66485
66584
 
66486
66585
  // ../types/src/workflow/invoke-workflow-contract.ts
66487
66586
  function inputToJsonSchema(input) {
66488
- switch (input.type) {
66489
- case "string":
66490
- return { type: "string" };
66491
- case "number":
66492
- return { type: "number" };
66493
- case "integer":
66494
- return { type: "integer" };
66495
- case "boolean":
66496
- return { type: "boolean" };
66497
- case "object":
66498
- return { type: "object" };
66499
- case "enum":
66500
- return input.values && input.values.length > 0 ? { type: "string", enum: input.values } : { type: "string" };
66501
- case "array": {
66502
- const itemType = input.items?.type;
66503
- if (itemType === "enum" && input.items?.values?.length) {
66504
- return { type: "array", items: { type: "string", enum: input.items.values } };
66505
- }
66506
- if (!itemType || itemType === "file")
66507
- return { type: "array" };
66508
- return { type: "array", items: { type: itemType } };
66509
- }
66510
- case "file":
66511
- return {};
66512
- default:
66513
- return {};
66587
+ if (input.type === "file")
66588
+ return {};
66589
+ if (input.type === "array" && (!input.items?.type || input.items.type === "file")) {
66590
+ return { type: "array" };
66514
66591
  }
66592
+ return inputPropertyToJsonSchema(input);
66515
66593
  }
66516
66594
  function buildWorkflowInputsJsonSchema(inputs) {
66517
66595
  const properties = {};
@@ -66637,6 +66715,9 @@ function collectInvokeWorkflowTargetNames(definition) {
66637
66715
  }
66638
66716
  return [...names];
66639
66717
  }
66718
+ var init_invoke_workflow_contract = __esm(() => {
66719
+ init_input();
66720
+ });
66640
66721
 
66641
66722
  // ../types/src/workflow/index.ts
66642
66723
  var init_workflow2 = __esm(() => {
@@ -66649,6 +66730,7 @@ var init_workflow2 = __esm(() => {
66649
66730
  init_local_meta();
66650
66731
  init_email_trigger();
66651
66732
  init_execution2();
66733
+ init_invoke_workflow_contract();
66652
66734
  });
66653
66735
 
66654
66736
  // ../types/src/file-source/descriptor.ts
@@ -69484,6 +69566,7 @@ __export(exports_src, {
69484
69566
  workspaceDependencyNameToPackagePath: () => workspaceDependencyNameToPackagePath,
69485
69567
  workflowTriggerConfigSchema: () => workflowTriggerConfigSchema,
69486
69568
  workflowInputsToJsonSchema: () => workflowInputsToJsonSchema,
69569
+ workflowInputPropertiesToJsonSchema: () => workflowInputPropertiesToJsonSchema,
69487
69570
  workflowInputAcceptsType: () => workflowInputAcceptsType,
69488
69571
  withPendingFileRefs: () => withPendingFileRefs,
69489
69572
  walkFileReferenceSentinels: () => walkFileReferenceSentinels,
@@ -69661,6 +69744,7 @@ __export(exports_src, {
69661
69744
  WorkflowPackageManifestSchema: () => WorkflowPackageManifestSchema,
69662
69745
  WorkflowNameSchema: () => WorkflowNameSchema,
69663
69746
  WorkflowMetaSchema: () => WorkflowMetaSchema,
69747
+ WorkflowInputPropertySchema: () => WorkflowInputPropertySchema,
69664
69748
  WorkflowInputDefSchema: () => WorkflowInputDefSchema,
69665
69749
  WorkflowFileOutputSchema: () => WorkflowFileOutputSchema,
69666
69750
  WorkflowExecutionStatusValue: () => WorkflowExecutionStatusValue,
@@ -191692,7 +191776,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
191692
191776
  // package.json
191693
191777
  var package_default = {
191694
191778
  name: "@eigenpal/cli",
191695
- version: "0.11.3",
191779
+ version: "0.12.0",
191696
191780
  description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
191697
191781
  keywords: [
191698
191782
  "eigenpal",
@@ -532,6 +532,7 @@ _Generated from `WorkflowDefinitionSchema` in `@eigenpal/types/src/workflow/work
532
532
  | `default` | unknown | no | | |
533
533
  | `values` | array<string> | no | | |
534
534
  | `items` | object | no | | |
535
+ | `properties` | array<unknown> | no | | |
535
536
  | `source` | string | no | | |
536
537
  | `mimeType` | string | no | | |
537
538
  | `extension` | string | no | | |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/cli",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "description": "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
5
5
  "keywords": [
6
6
  "eigenpal",