@hexabot-ai/agentic 3.2.2 → 3.2.4-beta.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.
Files changed (51) hide show
  1. package/dist/cjs/bindings/base-binding.js +98 -25
  2. package/dist/cjs/dsl.types.js +141 -34
  3. package/dist/cjs/index.js +3 -1
  4. package/dist/cjs/runner-runtime-control.js +12 -0
  5. package/dist/cjs/step-executors/parallel-executor.js +5 -0
  6. package/dist/cjs/validation-issue.js +10 -0
  7. package/dist/cjs/workflow-compiler.js +3 -2
  8. package/dist/cjs/workflow-values.js +9 -8
  9. package/dist/cjs/workflow.js +3 -2
  10. package/dist/esm/bindings/base-binding.js +98 -25
  11. package/dist/esm/dsl.types.js +141 -34
  12. package/dist/esm/index.js +1 -0
  13. package/dist/esm/runner-runtime-control.js +12 -0
  14. package/dist/esm/step-executors/parallel-executor.js +5 -0
  15. package/dist/esm/validation-issue.js +6 -0
  16. package/dist/esm/workflow-compiler.js +3 -2
  17. package/dist/esm/workflow-values.js +9 -8
  18. package/dist/esm/workflow.js +3 -2
  19. package/dist/types/bindings/base-binding.d.ts +2 -1
  20. package/dist/types/bindings/base-binding.d.ts.map +1 -1
  21. package/dist/types/context.d.ts +12 -0
  22. package/dist/types/context.d.ts.map +1 -1
  23. package/dist/types/dsl.types.d.ts +4 -1
  24. package/dist/types/dsl.types.d.ts.map +1 -1
  25. package/dist/types/index.d.ts +1 -0
  26. package/dist/types/index.d.ts.map +1 -1
  27. package/dist/types/runner-runtime-control.d.ts +1 -0
  28. package/dist/types/runner-runtime-control.d.ts.map +1 -1
  29. package/dist/types/validation-issue.d.ts +16 -0
  30. package/dist/types/validation-issue.d.ts.map +1 -0
  31. package/dist/types/workflow-compiler.d.ts.map +1 -1
  32. package/dist/types/workflow-types.d.ts +17 -2
  33. package/dist/types/workflow-types.d.ts.map +1 -1
  34. package/dist/types/workflow-values.d.ts +2 -8
  35. package/dist/types/workflow-values.d.ts.map +1 -1
  36. package/dist/types/workflow.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/__tests__/validation.test.ts +235 -17
  39. package/src/__tests__/workflow-runner.test.ts +185 -0
  40. package/src/__tests__/workflow-values.test.ts +26 -0
  41. package/src/bindings/base-binding.ts +116 -62
  42. package/src/context.ts +12 -0
  43. package/src/dsl.types.ts +225 -40
  44. package/src/index.ts +6 -0
  45. package/src/runner-runtime-control.ts +15 -0
  46. package/src/step-executors/parallel-executor.ts +6 -0
  47. package/src/validation-issue.ts +38 -0
  48. package/src/workflow-compiler.ts +3 -2
  49. package/src/workflow-types.ts +34 -4
  50. package/src/workflow-values.ts +19 -20
  51. package/src/workflow.ts +3 -2
package/src/dsl.types.ts CHANGED
@@ -11,6 +11,8 @@ import { z } from 'zod';
11
11
  import type { BindingKindSchemas } from './bindings/base-binding';
12
12
  import { validateAndResolveBindings } from './bindings/base-binding';
13
13
  import { SNAKE_CASE_REGEX } from './utils/naming';
14
+ import { type WorkflowValidationIssue } from './validation-issue';
15
+ import { mergeSettings } from './workflow-values';
14
16
 
15
17
  export const ExpressionStringSchema = z
16
18
  .string()
@@ -357,6 +359,8 @@ export type WorkflowDefinition = z.infer<typeof WorkflowDefinitionSchema>;
357
359
 
358
360
  export type WorkflowValidationActionMetadata = {
359
361
  supportedBindings?: readonly string[];
362
+ inputSchema?: z.ZodTypeAny;
363
+ settingSchema?: z.ZodTypeAny;
360
364
  };
361
365
 
362
366
  export type ValidateWorkflowOptions = {
@@ -366,37 +370,66 @@ export type ValidateWorkflowOptions = {
366
370
 
367
371
  export type WorkflowValidationResult =
368
372
  | { success: true; data: WorkflowDefinition }
369
- | { success: false; errors: string[] };
373
+ | { success: false; issues: WorkflowValidationIssue[] };
370
374
 
371
- const collectTaskReferences = (steps: FlowStep[]): string[] => {
372
- const refs: string[] = [];
375
+ type TaskReference = {
376
+ taskId: string;
377
+ path: Array<string | number>;
378
+ };
379
+
380
+ const collectTaskReferences = (
381
+ steps: FlowStep[],
382
+ basePath: Array<string | number> = ['flow'],
383
+ ): TaskReference[] => {
384
+ const refs: TaskReference[] = [];
385
+
386
+ steps.forEach((step, index) => {
387
+ const stepPath = [...basePath, index];
373
388
 
374
- for (const step of steps) {
375
389
  if ('do' in step) {
376
- refs.push(step.do);
377
- continue;
390
+ refs.push({ taskId: step.do, path: [...stepPath, 'do'] });
391
+
392
+ return;
378
393
  }
379
394
 
380
395
  if ('parallel' in step) {
381
- refs.push(...collectTaskReferences(step.parallel.steps));
382
- continue;
396
+ refs.push(
397
+ ...collectTaskReferences(step.parallel.steps, [
398
+ ...stepPath,
399
+ 'parallel',
400
+ 'steps',
401
+ ]),
402
+ );
403
+
404
+ return;
383
405
  }
384
406
 
385
407
  if ('conditional' in step) {
386
- for (const branch of step.conditional.when) {
387
- if ('condition' in branch) {
388
- refs.push(...collectTaskReferences(branch.steps));
389
- } else if ('else' in branch) {
390
- refs.push(...collectTaskReferences(branch.steps));
391
- }
392
- }
393
- continue;
408
+ step.conditional.when.forEach((branch, branchIndex) => {
409
+ refs.push(
410
+ ...collectTaskReferences(branch.steps, [
411
+ ...stepPath,
412
+ 'conditional',
413
+ 'when',
414
+ branchIndex,
415
+ 'steps',
416
+ ]),
417
+ );
418
+ });
419
+
420
+ return;
394
421
  }
395
422
 
396
423
  if ('loop' in step) {
397
- refs.push(...collectTaskReferences(step.loop.steps));
424
+ refs.push(
425
+ ...collectTaskReferences(step.loop.steps, [
426
+ ...stepPath,
427
+ 'loop',
428
+ 'steps',
429
+ ]),
430
+ );
398
431
  }
399
- }
432
+ });
400
433
 
401
434
  return refs;
402
435
  };
@@ -414,12 +447,157 @@ export const extractTaskDefinitions = (defs: DefDefinitions): TaskDefinitions =>
414
447
  return tasks;
415
448
  }, {});
416
449
 
417
- const formatZodErrors = (issues: z.ZodIssue[]): string[] =>
418
- issues.map((issue) => {
450
+ const EXECUTION_SETTING_KEYS = new Set(Object.keys(BaseSettingsSchema.shape));
451
+ const isExpressionString = (value: unknown): boolean =>
452
+ typeof value === 'string' && value.startsWith('=');
453
+ const toIssuePath = (path: readonly PropertyKey[]): Array<string | number> =>
454
+ path.filter(
455
+ (segment): segment is string | number =>
456
+ typeof segment === 'string' || typeof segment === 'number',
457
+ );
458
+ const getValueAtPath = (
459
+ value: unknown,
460
+ path: Array<string | number>,
461
+ ): unknown => {
462
+ let current = value;
463
+
464
+ for (const segment of path) {
465
+ if (current === null || typeof current !== 'object') {
466
+ return undefined;
467
+ }
468
+
469
+ current = (current as Record<string | number, unknown>)[segment];
470
+ }
471
+
472
+ return current;
473
+ };
474
+ const extractActionSettings = (settings: unknown): Record<string, unknown> => {
475
+ if (!settings || typeof settings !== 'object' || Array.isArray(settings)) {
476
+ return {};
477
+ }
478
+
479
+ return Object.fromEntries(
480
+ Object.entries(settings).filter(
481
+ ([key]) => !EXECUTION_SETTING_KEYS.has(key),
482
+ ),
483
+ );
484
+ };
485
+ const toActionSchemaIssues = ({
486
+ actionName,
487
+ code,
488
+ payload,
489
+ schema,
490
+ section,
491
+ taskId,
492
+ }: {
493
+ actionName: string;
494
+ code: 'action_inputs' | 'action_settings';
495
+ payload: unknown;
496
+ schema: z.ZodTypeAny;
497
+ section: 'inputs' | 'settings';
498
+ taskId: string;
499
+ }): WorkflowValidationIssue[] => {
500
+ const result = schema.safeParse(payload);
501
+
502
+ if (result.success) {
503
+ return [];
504
+ }
505
+
506
+ return result.error.issues.flatMap<WorkflowValidationIssue>((issue) => {
507
+ const issuePath = toIssuePath(issue.path);
508
+
509
+ // Expressions are resolved immediately before action execution, so their
510
+ // eventual runtime type cannot be checked while validating the definition.
511
+ if (isExpressionString(getValueAtPath(payload, issuePath))) {
512
+ return [];
513
+ }
514
+
515
+ const path = ['defs', taskId, section, ...issuePath];
516
+
517
+ return [
518
+ {
519
+ actionName,
520
+ code,
521
+ message: `${path.join('.')}: ${issue.message}`,
522
+ path,
523
+ taskId,
524
+ },
525
+ ];
526
+ });
527
+ };
528
+ const validateTaskActionSchemas = (
529
+ definition: WorkflowDefinition,
530
+ actions?: Record<string, WorkflowValidationActionMetadata>,
531
+ ): WorkflowValidationIssue[] => {
532
+ if (!actions) {
533
+ return [];
534
+ }
535
+
536
+ const issues: WorkflowValidationIssue[] = [];
537
+ const taskDefinitions = extractTaskDefinitions(definition.defs);
538
+
539
+ for (const [taskId, task] of Object.entries(taskDefinitions)) {
540
+ const action = actions[task.action];
541
+
542
+ // Missing actions are reported by binding validation and have no schemas
543
+ // available for payload validation.
544
+ if (!action) {
545
+ continue;
546
+ }
547
+
548
+ if (action.inputSchema) {
549
+ issues.push(
550
+ ...toActionSchemaIssues({
551
+ actionName: task.action,
552
+ code: 'action_inputs',
553
+ payload: task.inputs ?? {},
554
+ schema: action.inputSchema,
555
+ section: 'inputs',
556
+ taskId,
557
+ }),
558
+ );
559
+ }
560
+
561
+ if (action.settingSchema) {
562
+ const effectiveSettings = mergeSettings(
563
+ definition.defaults?.settings,
564
+ task.settings,
565
+ );
566
+
567
+ issues.push(
568
+ ...toActionSchemaIssues({
569
+ actionName: task.action,
570
+ code: 'action_settings',
571
+ payload: extractActionSettings(effectiveSettings),
572
+ schema: action.settingSchema,
573
+ section: 'settings',
574
+ taskId,
575
+ }),
576
+ );
577
+ }
578
+ }
579
+
580
+ return issues;
581
+ };
582
+ const toSchemaIssues = (zodIssues: z.ZodIssue[]): WorkflowValidationIssue[] =>
583
+ zodIssues.map((issue) => {
419
584
  const path = issue.path.join('.') || '<root>';
420
585
 
421
- return `${path}: ${issue.message}`;
586
+ return {
587
+ code: 'schema',
588
+ message: `${path}: ${issue.message}`,
589
+ path: issue.path.filter(
590
+ (segment): segment is string | number =>
591
+ typeof segment === 'string' || typeof segment === 'number',
592
+ ),
593
+ };
422
594
  });
595
+ const invalidWorkflow = (
596
+ issues: WorkflowValidationIssue[],
597
+ ): WorkflowValidationResult => ({
598
+ success: false,
599
+ issues,
600
+ });
423
601
 
424
602
  export function validateWorkflow(
425
603
  input: string | unknown,
@@ -434,30 +612,38 @@ export function validateWorkflow(
434
612
  const message =
435
613
  error instanceof Error ? error.message : 'Unknown YAML parse error';
436
614
 
437
- return {
438
- success: false,
439
- errors: ['Unable to parse workflow YAML', message],
440
- };
615
+ return invalidWorkflow([
616
+ { code: 'yaml_parse', message: 'Unable to parse workflow YAML' },
617
+ { code: 'yaml_parse', message },
618
+ ]);
441
619
  }
442
620
  }
443
621
 
444
622
  const parsed = WorkflowDefinitionSchema.safeParse(candidate);
445
623
 
446
624
  if (!parsed.success) {
447
- return { success: false, errors: formatZodErrors(parsed.error.issues) };
625
+ return invalidWorkflow(toSchemaIssues(parsed.error.issues));
448
626
  }
449
627
 
450
- const errors: string[] = [];
628
+ const issues: WorkflowValidationIssue[] = [];
451
629
  const taskDefinitions = extractTaskDefinitions(parsed.data.defs);
452
- const referencedTasks = new Set(collectTaskReferences(parsed.data.flow));
453
- const missingTasks = Array.from(referencedTasks).filter(
454
- (task) => !Object.prototype.hasOwnProperty.call(taskDefinitions, task),
455
- );
630
+ const reportedMissingTasks = new Set<string>();
631
+
632
+ for (const { taskId, path } of collectTaskReferences(parsed.data.flow)) {
633
+ if (
634
+ Object.prototype.hasOwnProperty.call(taskDefinitions, taskId) ||
635
+ reportedMissingTasks.has(taskId)
636
+ ) {
637
+ continue;
638
+ }
456
639
 
457
- if (missingTasks.length > 0) {
458
- errors.push(
459
- `Unknown task(s) referenced in flow: ${missingTasks.join(', ')}`,
460
- );
640
+ reportedMissingTasks.add(taskId);
641
+ issues.push({
642
+ code: 'unknown_task',
643
+ message: `Unknown task(s) referenced in flow: ${taskId}`,
644
+ path,
645
+ taskId,
646
+ });
461
647
  }
462
648
 
463
649
  const bindingValidation = validateAndResolveBindings(parsed.data, {
@@ -465,12 +651,11 @@ export function validateWorkflow(
465
651
  actions: options?.actions,
466
652
  });
467
653
 
468
- if (bindingValidation.errors.length > 0) {
469
- errors.push(...bindingValidation.errors);
470
- }
654
+ issues.push(...bindingValidation.issues);
655
+ issues.push(...validateTaskActionSchemas(parsed.data, options?.actions));
471
656
 
472
- if (errors.length > 0) {
473
- return { success: false, errors };
657
+ if (issues.length > 0) {
658
+ return invalidWorkflow(issues);
474
659
  }
475
660
 
476
661
  return { success: true, data: parsed.data };
package/src/index.ts CHANGED
@@ -40,6 +40,12 @@ export {
40
40
 
41
41
  export * from './dsl.types';
42
42
 
43
+ export {
44
+ issueMessages,
45
+ type WorkflowValidationIssue,
46
+ type WorkflowValidationIssueCode,
47
+ } from './validation-issue';
48
+
43
49
  export type {
44
50
  BindingKindDescriptor,
45
51
  BindingKindSchemas,
@@ -157,6 +157,21 @@ export class RunnerRuntimeControl implements WorkflowRuntimeControl {
157
157
  return request.resume.promise as Promise<T>;
158
158
  }
159
159
 
160
+ hasRecordedResult(key?: string): boolean {
161
+ const currentStep = this.runner.getCurrentStep();
162
+ if (!currentStep) {
163
+ return false;
164
+ }
165
+
166
+ const execution = this.ensureStepExecution(currentStep.id);
167
+ const suspendKey = buildSuspendKey(execution.suspendCursor + 1, key);
168
+ if (execution.awaitResults.has(suspendKey)) {
169
+ return true;
170
+ }
171
+
172
+ return (this.primedResumeData.get(currentStep.id)?.length ?? 0) > 0;
173
+ }
174
+
160
175
  resume(data?: unknown): void {
161
176
  void this.runner.resume({ resumeData: data });
162
177
  }
@@ -353,6 +353,12 @@ class ParallelWorkflowRuntimeControl implements WorkflowRuntimeControl {
353
353
  return Promise.reject(new ParallelSuspensionError());
354
354
  }
355
355
 
356
+ hasRecordedResult(): boolean {
357
+ // Suspension is not supported inside parallel blocks, so no resume
358
+ // result can ever be recorded for them.
359
+ return false;
360
+ }
361
+
356
362
  resume(data?: unknown): void {
357
363
  this.getParent().resume(data);
358
364
  }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Hexabot — Fair Core License (FCL-1.0-ALv2)
3
+ * Copyright (c) 2026 Hexastack.
4
+ * Full terms: see LICENSE.md.
5
+ */
6
+
7
+ export type WorkflowValidationIssueCode =
8
+ | 'yaml_parse'
9
+ | 'schema'
10
+ | 'unknown_task'
11
+ | 'missing_action'
12
+ | 'action_inputs'
13
+ | 'action_settings'
14
+ | 'binding_registry_required'
15
+ | 'unknown_binding_kind'
16
+ | 'action_required'
17
+ | 'action_forbidden'
18
+ | 'binding_settings'
19
+ | 'binding_ref'
20
+ | 'binding_unsupported'
21
+ | 'binding_cycle';
22
+
23
+ export type WorkflowValidationIssue = {
24
+ code: WorkflowValidationIssueCode;
25
+ /** Human-readable message; kept identical to the legacy error strings. */
26
+ message: string;
27
+ /** Path within the YAML document, e.g. ["defs", "my_task", "action"]. */
28
+ path?: Array<string | number>;
29
+ /** Referenced action name, set for action-specific issues where known. */
30
+ actionName?: string;
31
+ /** Referenced task id, set for task-specific issues where known. */
32
+ taskId?: string;
33
+ /** Binding kind involved, set for binding-related issues where known. */
34
+ bindingKind?: string;
35
+ };
36
+
37
+ export const issueMessages = (issues: WorkflowValidationIssue[]): string[] =>
38
+ issues.map((issue) => issue.message);
@@ -20,6 +20,7 @@ import type {
20
20
  WorkflowDefinition,
21
21
  } from './dsl.types';
22
22
  import { extractTaskDefinitions as extractTaskDefinitionsFromDefs } from './dsl.types';
23
+ import { issueMessages } from './validation-issue';
23
24
  import { StepType } from './workflow-event-emitter';
24
25
  import type {
25
26
  CompiledMapping,
@@ -158,9 +159,9 @@ const compileTasks = (
158
159
  actions: options.actions,
159
160
  });
160
161
 
161
- if (bindingValidation.errors.length > 0) {
162
+ if (bindingValidation.issues.length > 0) {
162
163
  throw new Error(
163
- `Workflow bindings validation failed: ${bindingValidation.errors.join('; ')}`,
164
+ `Workflow bindings validation failed: ${issueMessages(bindingValidation.issues).join('; ')}`,
164
165
  );
165
166
  }
166
167
 
@@ -4,7 +4,7 @@
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
6
 
7
- import type { Expression } from 'jsonata';
7
+ import type { Expression, Focus } from 'jsonata';
8
8
  import type { ZodType } from 'zod';
9
9
 
10
10
  import type { Action } from './action/action.types';
@@ -15,10 +15,40 @@ import { StepType, type StepInfo } from './workflow-event-emitter';
15
15
 
16
16
  export type { CompiledTaskBindings } from './bindings/base-binding';
17
17
 
18
- /** Value representation used by the runtime after compilation. */
18
+ /** Custom function callable from JSONata expressions. */
19
+ export type JsonataFunctionImplementation = (
20
+ this: Focus,
21
+ ...args: any[]
22
+ ) => unknown;
23
+
24
+ /** Function implementation, optionally paired with a JSONata type signature. */
25
+ export type JsonataFunctionConfig =
26
+ | JsonataFunctionImplementation
27
+ | {
28
+ implementation: JsonataFunctionImplementation;
29
+ signature?: string;
30
+ };
31
+
32
+ /** Map of function names to implementations, registered on compiled expressions. */
33
+ export type JsonataFunctionRegistry = Record<string, JsonataFunctionConfig>;
34
+
35
+ /**
36
+ * Value representation used by the runtime after compilation.
37
+ * The function registry is kept so nested `=` expressions discovered at
38
+ * evaluation time can be compiled with the same custom functions.
39
+ */
19
40
  export type CompiledValue =
20
- | { kind: 'literal'; value: unknown }
21
- | { kind: 'expression'; source: string; expression: Expression };
41
+ | {
42
+ kind: 'literal';
43
+ value: unknown;
44
+ jsonataFunctions?: JsonataFunctionRegistry;
45
+ }
46
+ | {
47
+ kind: 'expression';
48
+ source: string;
49
+ expression: Expression;
50
+ jsonataFunctions?: JsonataFunctionRegistry;
51
+ };
22
52
 
23
53
  /** Map of variable names to compiled values. */
24
54
  export type CompiledMapping = Record<string, CompiledValue>;
@@ -4,7 +4,7 @@
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
6
 
7
- import type { Expression, Focus } from 'jsonata';
7
+ import type { Expression } from 'jsonata';
8
8
  import jsonata from 'jsonata';
9
9
 
10
10
  import type { JsonValue, Settings } from './dsl.types';
@@ -12,21 +12,14 @@ import type {
12
12
  CompiledMapping,
13
13
  CompiledValue,
14
14
  EvaluationScope,
15
+ JsonataFunctionRegistry,
15
16
  } from './workflow-types';
16
17
 
17
- export type JsonataFunctionImplementation = (
18
- this: Focus,
19
- ...args: any[]
20
- ) => unknown;
21
-
22
- export type JsonataFunctionConfig =
23
- | JsonataFunctionImplementation
24
- | {
25
- implementation: JsonataFunctionImplementation;
26
- signature?: string;
27
- };
28
-
29
- export type JsonataFunctionRegistry = Record<string, JsonataFunctionConfig>;
18
+ export type {
19
+ JsonataFunctionConfig,
20
+ JsonataFunctionImplementation,
21
+ JsonataFunctionRegistry,
22
+ } from './workflow-types';
30
23
 
31
24
  export type CompileValueOptions = {
32
25
  jsonataFunctions?: JsonataFunctionRegistry;
@@ -38,10 +31,11 @@ const isPlainObject = (value: unknown): value is Record<string, unknown> =>
38
31
  const resolveNestedExpressions = async (
39
32
  value: unknown,
40
33
  scope: EvaluationScope,
34
+ jsonataFunctions?: JsonataFunctionRegistry,
41
35
  seen: WeakSet<object> = new WeakSet(),
42
36
  ): Promise<unknown> => {
43
37
  if (typeof value === 'string' && value.startsWith('=')) {
44
- return evaluateValue(compileValue(value), scope);
38
+ return evaluateValue(compileValue(value, { jsonataFunctions }), scope);
45
39
  }
46
40
 
47
41
  if (Array.isArray(value)) {
@@ -51,7 +45,9 @@ const resolveNestedExpressions = async (
51
45
  seen.add(value);
52
46
 
53
47
  return Promise.all(
54
- value.map((entry) => resolveNestedExpressions(entry, scope, seen)),
48
+ value.map((entry) =>
49
+ resolveNestedExpressions(entry, scope, jsonataFunctions, seen),
50
+ ),
55
51
  );
56
52
  }
57
53
 
@@ -64,7 +60,7 @@ const resolveNestedExpressions = async (
64
60
  const entries = await Promise.all(
65
61
  Object.entries(value).map(async ([key, entry]) => [
66
62
  key,
67
- await resolveNestedExpressions(entry, scope, seen),
63
+ await resolveNestedExpressions(entry, scope, jsonataFunctions, seen),
68
64
  ]),
69
65
  );
70
66
 
@@ -108,14 +104,16 @@ export const compileValue = (
108
104
  value: unknown,
109
105
  options?: CompileValueOptions,
110
106
  ): CompiledValue => {
107
+ const jsonataFunctions = options?.jsonataFunctions;
108
+
111
109
  if (typeof value === 'string' && value.startsWith('=')) {
112
110
  const expression = jsonata(value.slice(1));
113
- registerJsonataFunctions(expression, options?.jsonataFunctions);
111
+ registerJsonataFunctions(expression, jsonataFunctions);
114
112
 
115
- return { kind: 'expression', source: value, expression };
113
+ return { kind: 'expression', source: value, expression, jsonataFunctions };
116
114
  }
117
115
 
118
- return { kind: 'literal', value };
116
+ return { kind: 'literal', value, jsonataFunctions };
119
117
  };
120
118
 
121
119
  /**
@@ -162,6 +160,7 @@ export const evaluateMapping = async (
162
160
  await resolveNestedExpressions(
163
161
  await evaluateValue(compiled, scope),
164
162
  scope,
163
+ compiled.jsonataFunctions,
165
164
  ),
166
165
  ]),
167
166
  );
package/src/workflow.ts CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  type FlowStep,
20
20
  } from './dsl.types';
21
21
  import { safeRenameTaskInDefinition as renameTaskInDefinition } from './utils/workflow-definition';
22
+ import { issueMessages } from './validation-issue';
22
23
  import {
23
24
  compileWorkflow,
24
25
  type WorkflowCompileOptions,
@@ -123,7 +124,7 @@ export class Workflow {
123
124
  });
124
125
  if (!validation.success) {
125
126
  throw new Error(
126
- `Workflow validation failed: ${validation.errors.join('; ')}`,
127
+ `Workflow validation failed: ${issueMessages(validation.issues).join('; ')}`,
127
128
  );
128
129
  }
129
130
 
@@ -143,7 +144,7 @@ export class Workflow {
143
144
  });
144
145
  if (!validation.success) {
145
146
  throw new Error(
146
- `Workflow validation failed: ${validation.errors.join('; ')}`,
147
+ `Workflow validation failed: ${issueMessages(validation.issues).join('; ')}`,
147
148
  );
148
149
  }
149
150