@minded-ai/mindedjs 3.1.43 → 3.1.45

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.
Files changed (50) hide show
  1. package/dist/cli/cliUtils.d.ts +4 -2
  2. package/dist/cli/cliUtils.d.ts.map +1 -1
  3. package/dist/cli/cliUtils.js +12 -5
  4. package/dist/cli/cliUtils.js.map +1 -1
  5. package/dist/nodes/addAppToolNode.d.ts.map +1 -1
  6. package/dist/nodes/addAppToolNode.js +61 -28
  7. package/dist/nodes/addAppToolNode.js.map +1 -1
  8. package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
  9. package/dist/nodes/addBrowserTaskNode.js +37 -7
  10. package/dist/nodes/addBrowserTaskNode.js.map +1 -1
  11. package/dist/nodes/addToolNode.d.ts.map +1 -1
  12. package/dist/nodes/addToolNode.js +24 -55
  13. package/dist/nodes/addToolNode.js.map +1 -1
  14. package/dist/nodes/addToolRunNode.d.ts.map +1 -1
  15. package/dist/nodes/addToolRunNode.js +93 -82
  16. package/dist/nodes/addToolRunNode.js.map +1 -1
  17. package/dist/nodes/compilePrompt.d.ts +10 -0
  18. package/dist/nodes/compilePrompt.d.ts.map +1 -1
  19. package/dist/nodes/compilePrompt.js +67 -21
  20. package/dist/nodes/compilePrompt.js.map +1 -1
  21. package/dist/nodes/utils/getSchemaForToolInference.d.ts +13 -0
  22. package/dist/nodes/utils/getSchemaForToolInference.d.ts.map +1 -0
  23. package/dist/nodes/utils/getSchemaForToolInference.js +34 -0
  24. package/dist/nodes/utils/getSchemaForToolInference.js.map +1 -0
  25. package/dist/nodes/utils/inferToolCallWithRetry.d.ts +18 -0
  26. package/dist/nodes/utils/inferToolCallWithRetry.d.ts.map +1 -0
  27. package/dist/nodes/utils/inferToolCallWithRetry.js +58 -0
  28. package/dist/nodes/utils/inferToolCallWithRetry.js.map +1 -0
  29. package/dist/types/Flows.types.d.ts +2 -0
  30. package/dist/types/Flows.types.d.ts.map +1 -1
  31. package/dist/types/Flows.types.js +1 -0
  32. package/dist/types/Flows.types.js.map +1 -1
  33. package/dist/utils/flowSchema.d.ts.map +1 -1
  34. package/dist/utils/flowSchema.js +20 -4
  35. package/dist/utils/flowSchema.js.map +1 -1
  36. package/dist/utils/schemaUtils.d.ts.map +1 -1
  37. package/dist/utils/schemaUtils.js +2 -0
  38. package/dist/utils/schemaUtils.js.map +1 -1
  39. package/package.json +2 -2
  40. package/src/cli/cliUtils.ts +12 -5
  41. package/src/nodes/addAppToolNode.ts +68 -31
  42. package/src/nodes/addBrowserTaskNode.ts +45 -9
  43. package/src/nodes/addToolNode.ts +30 -61
  44. package/src/nodes/addToolRunNode.ts +114 -97
  45. package/src/nodes/compilePrompt.ts +69 -23
  46. package/src/nodes/utils/getSchemaForToolInference.ts +48 -0
  47. package/src/nodes/utils/inferToolCallWithRetry.ts +89 -0
  48. package/src/types/Flows.types.ts +2 -0
  49. package/src/utils/flowSchema.ts +21 -4
  50. package/src/utils/schemaUtils.ts +2 -0
@@ -373,9 +373,13 @@ export function safeParseFlow(flow: unknown): z.ZodSafeParseResult<FlowTypes.Flo
373
373
  return `Invalid ${subjectLabel}: "${toDotPath(issuePath)}" must be ${issue.expected}, received ${parsedType(issue.input)}`;
374
374
  }
375
375
  } else if (issue.code === 'invalid_value') {
376
- const { subjectLabel } = getErrorSubject(issuePath, flow);
376
+ const { subjectLabel, fieldHint } = getErrorSubject(issuePath, flow);
377
377
  const allowedValues = `[${issue.values.join(', ')}]`;
378
- return `Invalid ${subjectLabel}: "${toDotPath(issuePath)}" must be one of ${allowedValues}, received ${parsedType(issue.input)}`;
378
+ const receivedValue = typeof issue.input === 'string' ? `"${issue.input}"` : parsedType(issue.input);
379
+ if (fieldHint) {
380
+ return `Invalid ${subjectLabel}: ${fieldHint} must be one of ${allowedValues}, received ${receivedValue}`;
381
+ }
382
+ return `Invalid ${subjectLabel}: "${toDotPath(issuePath)}" must be one of ${allowedValues}, received ${receivedValue}`;
379
383
  } else if (issue.code === 'unrecognized_keys') {
380
384
  const { subjectLabel } = getErrorSubject(issuePath, flow);
381
385
  return `Invalid ${subjectLabel}: "${toDotPath(issuePath)}" unrecognized key "${issue.keys.join(', ')}"`;
@@ -430,16 +434,28 @@ export function safeParseFlow(flow: unknown): z.ZodSafeParseResult<FlowTypes.Flo
430
434
  function getErrorSubject(issuePath: PropertyKey[], flow: any) {
431
435
  let subject = 'flow';
432
436
  let subjectLabel: string | undefined;
437
+ let fieldHint: string | undefined;
433
438
  if (issuePath.length === 1) {
434
439
  subject = 'flow';
435
440
  } else if (issuePath.length >= 3 && issuePath[0] === 'nodes') {
436
441
  subject = 'node';
437
442
  const node = _.get(flow, issuePath.slice(0, 2));
438
443
  if (node && 'type' in node) {
444
+ const nodeName = node.name ? ` "${node.name}"` : '';
439
445
  if ('triggerType' in node) {
440
- subjectLabel = `${node.triggerType} ${node.type} node`;
446
+ subjectLabel = `${node.triggerType} ${node.type} node${nodeName}`;
441
447
  } else {
442
- subjectLabel = `${node.type} node`;
448
+ subjectLabel = `${node.type} node${nodeName}`;
449
+ }
450
+ }
451
+
452
+ // Provide human-readable hints for paths deep into metadata.schema[n]
453
+ if (issuePath.length >= 5 && issuePath[2] === 'metadata' && issuePath[3] === 'schema') {
454
+ const fieldIndex = issuePath[4] as number;
455
+ const schemaField = _.get(flow, ['nodes', issuePath[1], 'metadata', 'schema', fieldIndex]);
456
+ if (schemaField && 'name' in schemaField) {
457
+ const prop = issuePath.length > 5 ? `, property "${String(issuePath[issuePath.length - 1])}"` : '';
458
+ fieldHint = `schema field "${schemaField.name}"${prop}`;
443
459
  }
444
460
  }
445
461
  } else if (issuePath.length > 2 && issuePath[0] === 'edges') {
@@ -457,5 +473,6 @@ function getErrorSubject(issuePath: PropertyKey[], flow: any) {
457
473
  return {
458
474
  subject,
459
475
  subjectLabel,
476
+ fieldHint,
460
477
  };
461
478
  }
@@ -25,6 +25,8 @@ export const mapItemTypeToZod = (
25
25
  return z.string();
26
26
  case 'number':
27
27
  return z.number();
28
+ case 'integer':
29
+ return z.number().int();
28
30
  case 'boolean':
29
31
  return z.boolean();
30
32
  case 'any':