@cadenza.io/core 3.28.0 → 3.28.1
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 +72 -26
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +72 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2531,6 +2531,38 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
2531
2531
|
getTag() {
|
|
2532
2532
|
return this.task.getTag(this.context);
|
|
2533
2533
|
}
|
|
2534
|
+
classifyBusinessRoutineLifecycle() {
|
|
2535
|
+
const fullContext = this.context?.getFullContext?.() ?? {};
|
|
2536
|
+
const metadata = fullContext.__metadata && typeof fullContext.__metadata === "object" ? fullContext.__metadata : {};
|
|
2537
|
+
if (this.task.isMeta || this.task.isSubMeta || this.task.isHidden) {
|
|
2538
|
+
return false;
|
|
2539
|
+
}
|
|
2540
|
+
if (fullContext.__isInquiry === true || fullContext.__isDeputy === true || metadata.__isInquiry === true || metadata.__isDeputy === true || metadata.__isSubMeta === true) {
|
|
2541
|
+
return false;
|
|
2542
|
+
}
|
|
2543
|
+
return true;
|
|
2544
|
+
}
|
|
2545
|
+
getBusinessRoutineLifecycleDecision() {
|
|
2546
|
+
const fullContext = this.context?.getFullContext?.() ?? {};
|
|
2547
|
+
const metadata = this.context?.getMetadata?.() ?? {};
|
|
2548
|
+
if (typeof metadata.__emitBusinessRoutineLifecycle === "boolean") {
|
|
2549
|
+
return metadata.__emitBusinessRoutineLifecycle;
|
|
2550
|
+
}
|
|
2551
|
+
if (typeof fullContext.__emitBusinessRoutineLifecycle === "boolean") {
|
|
2552
|
+
return fullContext.__emitBusinessRoutineLifecycle;
|
|
2553
|
+
}
|
|
2554
|
+
return this.classifyBusinessRoutineLifecycle();
|
|
2555
|
+
}
|
|
2556
|
+
rememberBusinessRoutineLifecycleDecision(value) {
|
|
2557
|
+
const fullContext = this.context?.getFullContext?.();
|
|
2558
|
+
const metadata = this.context?.getMetadata?.();
|
|
2559
|
+
if (fullContext && typeof fullContext === "object") {
|
|
2560
|
+
fullContext.__emitBusinessRoutineLifecycle = value;
|
|
2561
|
+
}
|
|
2562
|
+
if (metadata && typeof metadata === "object") {
|
|
2563
|
+
metadata.__emitBusinessRoutineLifecycle = value;
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2534
2566
|
/**
|
|
2535
2567
|
* Schedules the current node/task on the specified graph layer if applicable.
|
|
2536
2568
|
*
|
|
@@ -2656,17 +2688,23 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
2656
2688
|
this.executionStart = Date.now();
|
|
2657
2689
|
}
|
|
2658
2690
|
if (this.previousNodes.length === 0) {
|
|
2659
|
-
this.
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
data: {
|
|
2663
|
-
isRunning: true,
|
|
2664
|
-
started: formatTimestamp(this.executionStart)
|
|
2665
|
-
},
|
|
2666
|
-
filter: { uuid: this.routineExecId }
|
|
2667
|
-
},
|
|
2668
|
-
{ squash: true, squashId: this.routineExecId }
|
|
2691
|
+
const shouldEmitBusinessRoutineLifecycle = this.getBusinessRoutineLifecycleDecision();
|
|
2692
|
+
this.rememberBusinessRoutineLifecycleDecision(
|
|
2693
|
+
shouldEmitBusinessRoutineLifecycle
|
|
2669
2694
|
);
|
|
2695
|
+
if (shouldEmitBusinessRoutineLifecycle) {
|
|
2696
|
+
this.emitMetricsWithMetadata(
|
|
2697
|
+
"meta.node.started_routine_execution",
|
|
2698
|
+
{
|
|
2699
|
+
data: {
|
|
2700
|
+
isRunning: true,
|
|
2701
|
+
started: formatTimestamp(this.executionStart)
|
|
2702
|
+
},
|
|
2703
|
+
filter: { uuid: this.routineExecId }
|
|
2704
|
+
},
|
|
2705
|
+
{ squash: true, squashId: this.routineExecId }
|
|
2706
|
+
);
|
|
2707
|
+
}
|
|
2670
2708
|
}
|
|
2671
2709
|
if (this.debug && !this.task.isSubMeta && !this.context.getMetadata().__isSubMeta || this.verbose) {
|
|
2672
2710
|
this.log();
|
|
@@ -2735,21 +2773,23 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
2735
2773
|
`meta.node.graph_completed:${this.routineExecId}`,
|
|
2736
2774
|
context2
|
|
2737
2775
|
);
|
|
2738
|
-
this.
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2776
|
+
if (this.getBusinessRoutineLifecycleDecision()) {
|
|
2777
|
+
this.emitMetricsWithMetadata(
|
|
2778
|
+
"meta.node.ended_routine_execution",
|
|
2779
|
+
{
|
|
2780
|
+
data: {
|
|
2781
|
+
isRunning: false,
|
|
2782
|
+
isComplete: true,
|
|
2783
|
+
resultContext: this.context.getContext(),
|
|
2784
|
+
metaResultContext: this.context.getMetadata(),
|
|
2785
|
+
progress: 1,
|
|
2786
|
+
ended: formatTimestamp(end)
|
|
2787
|
+
},
|
|
2788
|
+
filter: { uuid: this.routineExecId }
|
|
2748
2789
|
},
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
);
|
|
2790
|
+
{ squash: true, squashId: this.routineExecId }
|
|
2791
|
+
);
|
|
2792
|
+
}
|
|
2753
2793
|
}
|
|
2754
2794
|
return end;
|
|
2755
2795
|
}
|
|
@@ -3636,7 +3676,7 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
3636
3676
|
allTasks
|
|
3637
3677
|
);
|
|
3638
3678
|
const ctx = new GraphContext(context || {});
|
|
3639
|
-
if (!isSubMeta) {
|
|
3679
|
+
if (!isSubMeta && (!isMeta || this.debug)) {
|
|
3640
3680
|
if (isNewTrace) {
|
|
3641
3681
|
this.emitMetrics("meta.runner.new_trace", {
|
|
3642
3682
|
data: {
|
|
@@ -4055,7 +4095,13 @@ var Actor = class {
|
|
|
4055
4095
|
inquire: (inquiryName, inquiryContext = {}, options = {}) => inquire(inquiryName, inquiryContext, options),
|
|
4056
4096
|
tools: resolvedTools
|
|
4057
4097
|
};
|
|
4058
|
-
const handlerResult = await handler(
|
|
4098
|
+
const handlerResult = await handler(
|
|
4099
|
+
actorContext,
|
|
4100
|
+
actorContext.emit,
|
|
4101
|
+
actorContext.inquire,
|
|
4102
|
+
resolvedTools,
|
|
4103
|
+
resolvedProgressCallback
|
|
4104
|
+
);
|
|
4059
4105
|
if (invocationOptions.writeContract === "reducer" && typeof handlerResult === "function") {
|
|
4060
4106
|
reduceDurableState(handlerResult);
|
|
4061
4107
|
}
|