@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.
- package/dist/cli/cliUtils.d.ts +4 -2
- package/dist/cli/cliUtils.d.ts.map +1 -1
- package/dist/cli/cliUtils.js +12 -5
- package/dist/cli/cliUtils.js.map +1 -1
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.js +61 -28
- package/dist/nodes/addAppToolNode.js.map +1 -1
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskNode.js +37 -7
- package/dist/nodes/addBrowserTaskNode.js.map +1 -1
- package/dist/nodes/addToolNode.d.ts.map +1 -1
- package/dist/nodes/addToolNode.js +24 -55
- package/dist/nodes/addToolNode.js.map +1 -1
- package/dist/nodes/addToolRunNode.d.ts.map +1 -1
- package/dist/nodes/addToolRunNode.js +93 -82
- package/dist/nodes/addToolRunNode.js.map +1 -1
- package/dist/nodes/compilePrompt.d.ts +10 -0
- package/dist/nodes/compilePrompt.d.ts.map +1 -1
- package/dist/nodes/compilePrompt.js +67 -21
- package/dist/nodes/compilePrompt.js.map +1 -1
- package/dist/nodes/utils/getSchemaForToolInference.d.ts +13 -0
- package/dist/nodes/utils/getSchemaForToolInference.d.ts.map +1 -0
- package/dist/nodes/utils/getSchemaForToolInference.js +34 -0
- package/dist/nodes/utils/getSchemaForToolInference.js.map +1 -0
- package/dist/nodes/utils/inferToolCallWithRetry.d.ts +18 -0
- package/dist/nodes/utils/inferToolCallWithRetry.d.ts.map +1 -0
- package/dist/nodes/utils/inferToolCallWithRetry.js +58 -0
- package/dist/nodes/utils/inferToolCallWithRetry.js.map +1 -0
- package/dist/types/Flows.types.d.ts +2 -0
- package/dist/types/Flows.types.d.ts.map +1 -1
- package/dist/types/Flows.types.js +1 -0
- package/dist/types/Flows.types.js.map +1 -1
- package/dist/utils/flowSchema.d.ts.map +1 -1
- package/dist/utils/flowSchema.js +20 -4
- package/dist/utils/flowSchema.js.map +1 -1
- package/dist/utils/schemaUtils.d.ts.map +1 -1
- package/dist/utils/schemaUtils.js +2 -0
- package/dist/utils/schemaUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/cliUtils.ts +12 -5
- package/src/nodes/addAppToolNode.ts +68 -31
- package/src/nodes/addBrowserTaskNode.ts +45 -9
- package/src/nodes/addToolNode.ts +30 -61
- package/src/nodes/addToolRunNode.ts +114 -97
- package/src/nodes/compilePrompt.ts +69 -23
- package/src/nodes/utils/getSchemaForToolInference.ts +48 -0
- package/src/nodes/utils/inferToolCallWithRetry.ts +89 -0
- package/src/types/Flows.types.ts +2 -0
- package/src/utils/flowSchema.ts +21 -4
- package/src/utils/schemaUtils.ts +2 -0
package/src/utils/flowSchema.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|