@usearazzo/runner 1.0.1-alpha.34 → 1.0.1-alpha.36

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 (53) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +6 -1
  3. package/dist/arazzo-runner.browser.js +2212 -1116
  4. package/dist/arazzo-runner.browser.min.js +1 -1
  5. package/package.json +78 -25
  6. package/src/errors/ExecutionError.cjs +2 -0
  7. package/src/errors/ExecutionError.mjs +2 -0
  8. package/src/executor/OpenAPIOperationExecutor.cjs +58 -47
  9. package/src/executor/OpenAPIOperationExecutor.mjs +58 -47
  10. package/src/executor/WorkflowExecutor.cjs +302 -160
  11. package/src/executor/WorkflowExecutor.mjs +302 -160
  12. package/src/index.cjs +14 -0
  13. package/src/index.mjs +2 -0
  14. package/src/observability/EventChannel.cjs +30 -20
  15. package/src/observability/EventChannel.mjs +30 -23
  16. package/src/observability/Redactor.cjs +7 -5
  17. package/src/observability/Redactor.mjs +7 -5
  18. package/src/observability/combineObservers.cjs +18 -0
  19. package/src/observability/combineObservers.mjs +12 -0
  20. package/src/observability/instrument.cjs +159 -0
  21. package/src/observability/instrument.mjs +144 -0
  22. package/src/observability/logging/LoggingObserver.cjs +177 -0
  23. package/src/observability/logging/LoggingObserver.mjs +172 -0
  24. package/src/observability/logging/index.cjs +13 -0
  25. package/src/observability/logging/index.mjs +1 -0
  26. package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.cjs +321 -0
  27. package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.mjs +313 -0
  28. package/src/observability/opentelemetry/index.cjs +13 -0
  29. package/src/observability/opentelemetry/index.mjs +1 -0
  30. package/src/observability/stream/EventStream.cjs +112 -0
  31. package/src/observability/stream/EventStream.mjs +107 -0
  32. package/src/observability/stream/index.cjs +13 -0
  33. package/src/observability/stream/index.mjs +1 -0
  34. package/src/registry/DocumentRegistry.cjs +14 -9
  35. package/src/registry/DocumentRegistry.mjs +14 -9
  36. package/src/vendor/swagger-client.cjs +1 -1
  37. package/src/vendor/swagger-client.mjs +1 -1
  38. package/src/version.cjs +9 -0
  39. package/src/version.mjs +3 -0
  40. package/types/observability/logging/LoggingObserver.d.cts +82 -0
  41. package/types/observability/logging/LoggingObserver.d.ts +82 -0
  42. package/types/observability/logging/index.d.cts +2 -0
  43. package/types/observability/logging/index.d.ts +2 -0
  44. package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.cts +84 -0
  45. package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.ts +84 -0
  46. package/types/observability/opentelemetry/index.d.cts +2 -0
  47. package/types/observability/opentelemetry/index.d.ts +2 -0
  48. package/types/observability/stream/EventStream.d.cts +68 -0
  49. package/types/observability/stream/EventStream.d.ts +68 -0
  50. package/types/observability/stream/index.d.cts +2 -0
  51. package/types/observability/stream/index.d.ts +2 -0
  52. package/types/runner.d.cts +3891 -0
  53. package/types/runner.d.ts +137 -40
@@ -13,6 +13,7 @@ import { STEP_TARGET_FIELDS } from "./StepExecutor.mjs";
13
13
  import ArazzoWorkflowLocatorNormalizer from "./ArazzoWorkflowLocatorNormalizer.mjs";
14
14
  import StepRetryRunner from "./StepRetryRunner.mjs";
15
15
  import WorkflowCallStack from "./WorkflowCallStack.mjs";
16
+ import { traced } from "../observability/instrument.mjs";
16
17
  import StepTransitionInterpreter, { actionTargets } from "./StepTransitionInterpreter.mjs";
17
18
  import ExecutionError from "../errors/ExecutionError.mjs";
18
19
  import ResolverError from "../errors/ResolverError.mjs";
@@ -84,6 +85,12 @@ export function settledResult(result) {
84
85
  * @internal
85
86
  */
86
87
 
88
+ /**
89
+ * How a step ran: its last attempt's outcome, the terminal action its retries
90
+ * resolved to, how many attempts it took, and where the run goes next.
91
+ * @internal
92
+ */
93
+
87
94
  /**
88
95
  * One completed `dependsOn` run, remembered with the inputs it was actually
89
96
  * given — see {@link RunScope.dependencyRuns}.
@@ -180,6 +187,7 @@ class WorkflowExecutor {
180
187
  #retryRunner;
181
188
  #interpreter = new StepTransitionInterpreter();
182
189
  #workflowLocatorNormalizer;
190
+ // emits only while `hasObservers`, so an unobserved block builds no events
183
191
  #events;
184
192
  constructor(options) {
185
193
  this.#document = options.document;
@@ -189,7 +197,7 @@ class WorkflowExecutor {
189
197
  this.#maxSteps = options.maxSteps ?? WorkflowExecutor.#DEFAULT_MAX_STEPS;
190
198
  this.#maxWorkflowDepth = options.maxWorkflowDepth ?? WorkflowExecutor.#DEFAULT_MAX_WORKFLOW_DEPTH;
191
199
  this.#now = options.now ?? WorkflowExecutor.#DEFAULT_NOW;
192
- this.#events = EventChannel.open({
200
+ this.#events = new EventChannel({
193
201
  observer: options.observer,
194
202
  now: this.#now
195
203
  });
@@ -352,29 +360,81 @@ class WorkflowExecutor {
352
360
  workflowId,
353
361
  path: nested.path
354
362
  };
355
- // extracted before `workflow-start`: a workflow its document does not
363
+ // extracted before `workflow:start`: a workflow its document does not
356
364
  // define never starts, and the event can say where the one it runs is.
357
365
  const extracted = this.#extractWorkflow(locator);
358
- // emitted before normalization, so its events nest inside this workflow's.
359
- this.#events?.emit({
360
- type: 'workflow-start',
361
- ...frame,
362
- via,
363
- location: locator.document.locationOf(extracted)
364
- }, startedAt);
365
- const workflow = await this.#resolveWorkflow(locator, extracted, scope, frame);
366
- const state = new WorkflowExecutionState({
367
- inputs
368
- });
366
+ const location = locator.document.locationOf(extracted);
369
367
  const invocation = {
370
368
  workflowId,
371
369
  document: locator.document,
372
- state,
370
+ state: new WorkflowExecutionState({
371
+ inputs
372
+ }),
373
373
  callStack: nested,
374
374
  via,
375
375
  frame
376
376
  };
377
377
 
378
+ // traced from its `workflow:start` to its `workflow:settled`, so a span an
379
+ // instrumentation opens around it is active for all of its events.
380
+ return traced(() => ({
381
+ kind: 'workflow',
382
+ ...frame,
383
+ via,
384
+ location
385
+ }), async () => {
386
+ // a started workflow always settles, a throwing one included (an
387
+ // observer throwing on its start too), so an observer holding it open
388
+ // (a span, a stream consumer) can close it.
389
+ let result;
390
+ try {
391
+ // emitted before normalization, so its events nest inside this workflow's.
392
+ if (this.#events.hasObservers) {
393
+ this.#events.emit({
394
+ type: 'workflow:start',
395
+ ...frame,
396
+ via,
397
+ location
398
+ }, startedAt);
399
+ }
400
+ result = await this.#runInvocation(locator, extracted, invocation, scope, startedAt);
401
+ } catch (error) {
402
+ this.#settleThrown({
403
+ type: 'workflow:settled',
404
+ ...frame,
405
+ status: 'failed',
406
+ settledStatus: 'failed',
407
+ outputs: {},
408
+ error
409
+ });
410
+ throw error;
411
+ }
412
+ if (this.#events.hasObservers) {
413
+ this.#events.emit({
414
+ type: 'workflow:settled',
415
+ ...frame,
416
+ status: result.status,
417
+ settledStatus: result.settledStatus,
418
+ outputs: result.outputs
419
+ }, startedAt + result.durationMs);
420
+ }
421
+ return result;
422
+ });
423
+ }
424
+
425
+ /**
426
+ * The part of {@link WorkflowExecutor.#run} after `workflow:start`:
427
+ * normalizes the workflow, checks its definition, runs its dependencies
428
+ * and its steps, and builds its result.
429
+ */
430
+ async #runInvocation(locator, extracted, invocation, scope, startedAt) {
431
+ const {
432
+ workflowId,
433
+ callStack: nested,
434
+ frame
435
+ } = invocation;
436
+ const workflow = await this.#resolveWorkflow(locator, extracted, scope, frame);
437
+
378
438
  // validated before any prerequisite runs: a malformed `steps` is an
379
439
  // authoring error, and discovering it only after the dependencies have
380
440
  // fired would mean live side effects on the way to a throw.
@@ -427,96 +487,16 @@ class WorkflowExecutor {
427
487
  stepLoop: while (index < steps.length) {
428
488
  const step = steps[index];
429
489
  const stepId = toValue(step.stepId);
430
- const stepStartedAt = this.#now();
431
- // the sub-workflow runs this step produces — one per attempt, so a retried
432
- // sub-workflow step keeps every attempt's trace rather than only the last.
433
- const subWorkflows = [];
434
- // the retry reference runs this step's attempts produced, one per firing —
435
- // separate from `subWorkflows` because a reference belongs to the retry
436
- // that invoked it, not to the step's own target.
437
- const retryReferences = [];
438
- const stepFrame = {
439
- ...frame,
440
- stepId
441
- };
442
- this.#events?.emit({
443
- type: 'step-start',
444
- ...stepFrame,
445
- location: invocation.document.locationOf(step)
446
- }, stepStartedAt);
447
- const attempt = this.#chargedAttempt(this.#observedAttempt(this.#stepAttempt(step, stepId, invocation, scope, subWorkflows), stepFrame), invocation, scope, stepId);
448
-
449
- // the retry runner settles any `retry` actions, so `action` is the terminal
450
- // action a retry chain resolved to and `attempts` is how many times the step
451
- // ran.
452
490
  const {
453
491
  outcome,
454
492
  action,
455
- attempts
456
- } = await this.#retryRunner.run(attempt, {
493
+ transition
494
+ } = await traced(() => ({
495
+ kind: 'step',
496
+ ...frame,
457
497
  stepId,
458
- workflowId,
459
- signal: scope.signal,
460
- runReference: this.#retryReference(steps, stepFrame, invocation, scope, retryReferences),
461
- onRetry: (retry, delayMs, attempt) => {
462
- const decided = {
463
- ...stepFrame,
464
- attempt
465
- };
466
- this.#events?.emit({
467
- type: 'action-selected',
468
- ...decided,
469
- action: retry,
470
- transition: {
471
- kind: 'retry'
472
- },
473
- location: invocation.document.locationOf(retry)
474
- });
475
- if (delayMs > 0) {
476
- this.#events?.emit({
477
- type: 'retry-wait',
478
- ...decided,
479
- delayMs
480
- });
481
- }
482
- }
483
- });
484
- const transition = this.#interpreter.interpret(action, outcome.successful, {
485
- workflowId,
486
- stepId
487
- });
488
- this.#events?.emit({
489
- type: 'action-selected',
490
- ...stepFrame,
491
- attempt: attempts,
492
- action,
493
- transition,
494
- location: action === undefined ? undefined : invocation.document.locationOf(action)
495
- });
496
- state.setStepOutputs(outcome.stepId, outcome.outputs);
497
- const stepSettledAt = this.#now();
498
- trace.push({
499
- stepId: outcome.stepId,
500
- location: invocation.document.locationOf(step),
501
- successful: outcome.successful,
502
- action,
503
- attempts,
504
- durationMs: stepSettledAt - stepStartedAt,
505
- successCriteria: outcome.successCriteria,
506
- actionCriteria: outcome.actionCriteria,
507
- ...(subWorkflows.length > 0 ? {
508
- subWorkflows
509
- } : {}),
510
- ...(retryReferences.length > 0 ? {
511
- retryReferences
512
- } : {})
513
- });
514
- this.#events?.emit({
515
- type: 'step-settled',
516
- ...stepFrame,
517
- successful: outcome.successful,
518
- attempts
519
- }, stepSettledAt);
498
+ location: invocation.document.locationOf(step)
499
+ }), () => this.#runStep(step, stepId, steps, invocation, scope, trace));
520
500
  switch (transition.kind) {
521
501
  case 'next':
522
502
  index += 1;
@@ -589,6 +569,159 @@ class WorkflowExecutor {
589
569
  return this.#result(invocation, workflow, trace, runOutcome, dependencies, startedAt);
590
570
  }
591
571
 
572
+ /**
573
+ * Emits the settled event of a workflow or step that threw. An observer
574
+ * throwing on it is ignored: the error that failed the operation is the one
575
+ * to report.
576
+ */
577
+ #settleThrown(event) {
578
+ if (!this.#events.hasObservers) return;
579
+ try {
580
+ this.#events.emit(event);
581
+ } catch {
582
+ // the operation's own error is rethrown by the caller
583
+ }
584
+ }
585
+
586
+ /**
587
+ * Runs one step of a workflow invocation, from its `step:start` to its
588
+ * `step:settled`, recording it in `trace` and its outputs in the state. A
589
+ * step that throws still settles, so an observer holding it open can close
590
+ * it.
591
+ */
592
+ async #runStep(step, stepId, steps, invocation, scope, trace) {
593
+ const {
594
+ workflowId,
595
+ frame,
596
+ state
597
+ } = invocation;
598
+ const stepStartedAt = this.#now();
599
+ // the sub-workflow runs this step produces — one per attempt, so a retried
600
+ // sub-workflow step keeps every attempt's trace rather than only the last.
601
+ const subWorkflows = [];
602
+ // the retry reference runs this step's attempts produced, one per firing —
603
+ // separate from `subWorkflows` because a reference belongs to the retry
604
+ // that invoked it, not to the step's own target.
605
+ const retryReferences = [];
606
+ const stepFrame = {
607
+ ...frame,
608
+ stepId
609
+ };
610
+ // the attempt reached, once past its boundary checks and before its
611
+ // step:attempt: an attempt announced is an attempt counted
612
+ let attempted = 0;
613
+ const countAttempt = runAttempt => attempt => {
614
+ attempted = attempt;
615
+ return runAttempt(attempt);
616
+ };
617
+ let settled;
618
+ try {
619
+ if (this.#events.hasObservers) {
620
+ this.#events.emit({
621
+ type: 'step:start',
622
+ ...stepFrame,
623
+ location: invocation.document.locationOf(step)
624
+ }, stepStartedAt);
625
+ }
626
+ const attempt = this.#chargedAttempt(countAttempt(this.#observedAttempt(this.#stepAttempt(step, stepId, invocation, scope, subWorkflows), stepFrame)), invocation, scope, stepId);
627
+
628
+ // the retry runner settles any `retry` actions, so `action` is the terminal
629
+ // action a retry chain resolved to and `attempts` is how many times the step
630
+ // ran.
631
+ const {
632
+ outcome,
633
+ action,
634
+ attempts
635
+ } = await this.#retryRunner.run(attempt, {
636
+ stepId,
637
+ workflowId,
638
+ signal: scope.signal,
639
+ runReference: this.#retryReference(steps, stepFrame, invocation, scope, retryReferences),
640
+ onRetry: (retry, delayMs, attempt) => {
641
+ const decided = {
642
+ ...stepFrame,
643
+ attempt
644
+ };
645
+ if (this.#events.hasObservers) {
646
+ this.#events.emit({
647
+ type: 'action:selected',
648
+ ...decided,
649
+ action: retry,
650
+ transition: {
651
+ kind: 'retry'
652
+ },
653
+ location: invocation.document.locationOf(retry)
654
+ });
655
+ }
656
+ if (delayMs > 0 && this.#events.hasObservers) {
657
+ this.#events.emit({
658
+ type: 'retry:wait',
659
+ ...decided,
660
+ delayMs
661
+ });
662
+ }
663
+ }
664
+ });
665
+ const transition = this.#interpreter.interpret(action, outcome.successful, {
666
+ workflowId,
667
+ stepId
668
+ });
669
+ if (this.#events.hasObservers) {
670
+ this.#events.emit({
671
+ type: 'action:selected',
672
+ ...stepFrame,
673
+ attempt: attempts,
674
+ action,
675
+ transition,
676
+ location: action === undefined ? undefined : invocation.document.locationOf(action)
677
+ });
678
+ }
679
+ state.setStepOutputs(outcome.stepId, outcome.outputs);
680
+ const stepSettledAt = this.#now();
681
+ trace.push({
682
+ stepId: outcome.stepId,
683
+ location: invocation.document.locationOf(step),
684
+ successful: outcome.successful,
685
+ action,
686
+ attempts,
687
+ durationMs: stepSettledAt - stepStartedAt,
688
+ successCriteria: outcome.successCriteria,
689
+ actionCriteria: outcome.actionCriteria,
690
+ ...(subWorkflows.length > 0 ? {
691
+ subWorkflows
692
+ } : {}),
693
+ ...(retryReferences.length > 0 ? {
694
+ retryReferences
695
+ } : {})
696
+ });
697
+ settled = {
698
+ outcome,
699
+ action,
700
+ transition,
701
+ attempts,
702
+ settledAt: stepSettledAt
703
+ };
704
+ } catch (error) {
705
+ this.#settleThrown({
706
+ type: 'step:settled',
707
+ ...stepFrame,
708
+ successful: false,
709
+ attempts: attempted,
710
+ error
711
+ });
712
+ throw error;
713
+ }
714
+ if (this.#events.hasObservers) {
715
+ this.#events.emit({
716
+ type: 'step:settled',
717
+ ...stepFrame,
718
+ successful: settled.outcome.successful,
719
+ attempts: settled.attempts
720
+ }, settled.settledAt);
721
+ }
722
+ return settled;
723
+ }
724
+
592
725
  /**
593
726
  * Assembles the run's result from how it ended, resolving the workflow's
594
727
  * `outputs` against the final state (unless it transferred) and stamping
@@ -631,13 +764,6 @@ class WorkflowExecutor {
631
764
  status: outcome.status,
632
765
  settledStatus: outcome.status
633
766
  };
634
- this.#events?.emit({
635
- type: 'workflow-settled',
636
- ...invocation.frame,
637
- status: result.status,
638
- settledStatus: result.settledStatus,
639
- outputs: result.outputs
640
- }, settledAt);
641
767
  return result;
642
768
  }
643
769
 
@@ -707,26 +833,26 @@ class WorkflowExecutor {
707
833
  }
708
834
 
709
835
  /**
710
- * Wraps a step-attempt thunk with the events of an attempt: `step-attempt`
711
- * as it begins, then a `criterion-evaluated` for each criterion it
836
+ * Wraps a step-attempt thunk with the events of an attempt: `step:attempt`
837
+ * as it begins, then a `criterion:evaluated` for each criterion it
712
838
  * evaluated, success criteria first.
713
839
  */
714
840
  #observedAttempt(runAttempt, stepFrame) {
715
- const events = this.#events;
716
- if (events === undefined) return runAttempt;
841
+ // observers read per attempt, so hooks added mid-step apply from its next one
717
842
  return async attempt => {
718
843
  const attemptFrame = {
719
844
  ...stepFrame,
720
845
  attempt
721
846
  };
722
- events.emit({
723
- type: 'step-attempt',
847
+ if (this.#events.hasObservers) this.#events.emit({
848
+ type: 'step:attempt',
724
849
  ...attemptFrame
725
850
  });
726
851
  const outcome = await runAttempt();
852
+ if (!this.#events.hasObservers) return outcome;
727
853
  for (const criterion of outcome.successCriteria) {
728
- events.emit({
729
- type: 'criterion-evaluated',
854
+ this.#events.emit({
855
+ type: 'criterion:evaluated',
730
856
  ...attemptFrame,
731
857
  kind: 'success',
732
858
  criterion,
@@ -734,8 +860,8 @@ class WorkflowExecutor {
734
860
  });
735
861
  }
736
862
  for (const criterion of outcome.actionCriteria) {
737
- events.emit({
738
- type: 'criterion-evaluated',
863
+ this.#events.emit({
864
+ type: 'criterion:evaluated',
739
865
  ...attemptFrame,
740
866
  kind: 'action',
741
867
  criterion,
@@ -827,11 +953,13 @@ class WorkflowExecutor {
827
953
  kind: 'workflow',
828
954
  id: reference
829
955
  };
830
- this.#events?.emit({
831
- type: 'retry-reference-start',
832
- ...referenceFrame,
833
- location: invocation.document.locationOf(action)
834
- });
956
+ if (this.#events.hasObservers) {
957
+ this.#events.emit({
958
+ type: 'retry:reference:start',
959
+ ...referenceFrame,
960
+ location: invocation.document.locationOf(action)
961
+ });
962
+ }
835
963
  const result = await this.#runReferencedWorkflow(reference, stepId, invocation, scope, 'retry', inputs);
836
964
  // the result's workflowId is the bare id the reference resolved to —
837
965
  // the key run state is recorded under, whichever document owns it.
@@ -847,11 +975,13 @@ class WorkflowExecutor {
847
975
  successful,
848
976
  subWorkflow: result
849
977
  });
850
- this.#events?.emit({
851
- type: 'retry-reference-settled',
852
- ...referenceFrame,
853
- successful
854
- });
978
+ if (this.#events.hasObservers) {
979
+ this.#events.emit({
980
+ type: 'retry:reference:settled',
981
+ ...referenceFrame,
982
+ successful
983
+ });
984
+ }
855
985
  return;
856
986
  }
857
987
  const refStepId = toValue(action.stepId);
@@ -867,11 +997,13 @@ class WorkflowExecutor {
867
997
  kind: 'step',
868
998
  id: refStepId
869
999
  };
870
- this.#events?.emit({
871
- type: 'retry-reference-start',
872
- ...referenceFrame,
873
- location: invocation.document.locationOf(action)
874
- });
1000
+ if (this.#events.hasObservers) {
1001
+ this.#events.emit({
1002
+ type: 'retry:reference:start',
1003
+ ...referenceFrame,
1004
+ location: invocation.document.locationOf(action)
1005
+ });
1006
+ }
875
1007
  // the referenced step's attempt is observed like any other, under its
876
1008
  // own stepId and with a count of its own.
877
1009
  const refOutcome = await this.#chargedAttempt(this.#observedAttempt(this.#stepAttempt(refStep, refStepId, invocation, scope, refSubWorkflows), {
@@ -887,11 +1019,13 @@ class WorkflowExecutor {
887
1019
  subWorkflow: refSubWorkflows[0]
888
1020
  } : {})
889
1021
  });
890
- this.#events?.emit({
891
- type: 'retry-reference-settled',
892
- ...referenceFrame,
893
- successful: refOutcome.successful
894
- });
1022
+ if (this.#events.hasObservers) {
1023
+ this.#events.emit({
1024
+ type: 'retry:reference:settled',
1025
+ ...referenceFrame,
1026
+ successful: refOutcome.successful
1027
+ });
1028
+ }
895
1029
  };
896
1030
  }
897
1031
 
@@ -944,12 +1078,14 @@ class WorkflowExecutor {
944
1078
  workflowId: dependency.locator.workflowId,
945
1079
  documentURI: dependency.locator.document.uri
946
1080
  };
947
- this.#events?.emit({
948
- type: 'dependency-start',
949
- ...frame,
950
- dependency: target,
951
- location: invocation.document.locationOf(dependency.entry)
952
- });
1081
+ if (this.#events.hasObservers) {
1082
+ this.#events.emit({
1083
+ type: 'dependency:start',
1084
+ ...frame,
1085
+ dependency: target,
1086
+ location: invocation.document.locationOf(dependency.entry)
1087
+ });
1088
+ }
953
1089
  // a dependency already completed in this run is satisfied, not repeated: a
954
1090
  // precondition holds once met, and a diamond (two dependents sharing one
955
1091
  // dependency) must not duplicate its live side effects. Every dependent
@@ -972,13 +1108,15 @@ class WorkflowExecutor {
972
1108
  inputs,
973
1109
  outputs: result.outputs
974
1110
  });
975
- this.#events?.emit({
976
- type: 'dependency-settled',
977
- ...frame,
978
- dependency: target,
979
- memoized: memoized !== undefined,
980
- settledStatus: result.settledStatus
981
- });
1111
+ if (this.#events.hasObservers) {
1112
+ this.#events.emit({
1113
+ type: 'dependency:settled',
1114
+ ...frame,
1115
+ dependency: target,
1116
+ memoized: memoized !== undefined,
1117
+ settledStatus: result.settledStatus
1118
+ });
1119
+ }
982
1120
  if (this.#settledFailed(result)) return results;
983
1121
 
984
1122
  // only a dependency whose chain settled non-`failed` is remembered as
@@ -1342,17 +1480,21 @@ class WorkflowExecutor {
1342
1480
  const cached = scope.workflows.get(qualifiedId);
1343
1481
  if (cached !== undefined) return cached;
1344
1482
  const location = locator.document.locationOf(extracted);
1345
- this.#events?.emit({
1346
- type: 'workflow-normalize-start',
1347
- ...frame,
1348
- location
1349
- });
1483
+ if (this.#events.hasObservers) {
1484
+ this.#events.emit({
1485
+ type: 'workflow:normalize:start',
1486
+ ...frame,
1487
+ location
1488
+ });
1489
+ }
1350
1490
  const workflow = await this.#normalizer.normalize(extracted, locator.document);
1351
- this.#events?.emit({
1352
- type: 'workflow-normalize-settled',
1353
- ...frame,
1354
- location
1355
- });
1491
+ if (this.#events.hasObservers) {
1492
+ this.#events.emit({
1493
+ type: 'workflow:normalize:settled',
1494
+ ...frame,
1495
+ location
1496
+ });
1497
+ }
1356
1498
  scope.workflows.set(qualifiedId, workflow);
1357
1499
  return workflow;
1358
1500
  }
package/src/index.cjs CHANGED
@@ -371,12 +371,24 @@ Object.defineProperty(exports, "XPathCriterionEvaluator", {
371
371
  return _XPathCriterionEvaluator.default;
372
372
  }
373
373
  });
374
+ Object.defineProperty(exports, "combineObservers", {
375
+ enumerable: true,
376
+ get: function () {
377
+ return _combineObservers.default;
378
+ }
379
+ });
374
380
  Object.defineProperty(exports, "httpClientFetch", {
375
381
  enumerable: true,
376
382
  get: function () {
377
383
  return _HTTPClientFetch.default;
378
384
  }
379
385
  });
386
+ Object.defineProperty(exports, "instrument", {
387
+ enumerable: true,
388
+ get: function () {
389
+ return _instrument.default;
390
+ }
391
+ });
380
392
  Object.defineProperty(exports, "settledResult", {
381
393
  enumerable: true,
382
394
  get: function () {
@@ -431,6 +443,8 @@ var _OpenAPIOperationExecutor = _interopRequireDefault(require("./executor/OpenA
431
443
  var _SourceDescriptionsLocatorNormalizer = _interopRequireDefault(require("./executor/SourceDescriptionsLocatorNormalizer.cjs"));
432
444
  var _OpenAPIOperationLocatorNormalizer = _interopRequireDefault(require("./executor/OpenAPIOperationLocatorNormalizer.cjs"));
433
445
  var _ArazzoWorkflowLocatorNormalizer = _interopRequireDefault(require("./executor/ArazzoWorkflowLocatorNormalizer.cjs"));
446
+ var _combineObservers = _interopRequireDefault(require("./observability/combineObservers.cjs"));
447
+ var _instrument = _interopRequireDefault(require("./observability/instrument.cjs"));
434
448
  var _Redactor = _interopRequireDefault(require("./observability/Redactor.cjs"));
435
449
  var _ArazzoRunnerError = _interopRequireDefault(require("./errors/ArazzoRunnerError.cjs"));
436
450
  var _AssemblerError = _interopRequireDefault(require("./errors/AssemblerError.cjs"));
package/src/index.mjs CHANGED
@@ -62,6 +62,8 @@ export { default as SourceDescriptionsLocatorNormalizer } from "./executor/Sourc
62
62
  export { default as OpenAPIOperationLocatorNormalizer } from "./executor/OpenAPIOperationLocatorNormalizer.mjs";
63
63
  export { default as ArazzoWorkflowLocatorNormalizer } from "./executor/ArazzoWorkflowLocatorNormalizer.mjs";
64
64
  /* Observability */
65
+ export { default as combineObservers } from "./observability/combineObservers.mjs";
66
+ export { default as instrument } from "./observability/instrument.mjs";
65
67
  export { default as Redactor } from "./observability/Redactor.mjs";
66
68
  /* Errors */
67
69
  export { default as ArazzoRunnerError } from "./errors/ArazzoRunnerError.mjs";