@cadenza.io/core 1.7.11 → 1.9.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.
- package/dist/index.d.mts +38 -13
- package/dist/index.d.ts +38 -13
- package/dist/index.js +219 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +219 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -608,6 +608,11 @@ var SignalEmitter = class {
|
|
|
608
608
|
}
|
|
609
609
|
};
|
|
610
610
|
|
|
611
|
+
// src/utils/promise.ts
|
|
612
|
+
function sleep(ms) {
|
|
613
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
614
|
+
}
|
|
615
|
+
|
|
611
616
|
// src/graph/execution/GraphNode.ts
|
|
612
617
|
var GraphNode = class _GraphNode extends SignalEmitter {
|
|
613
618
|
constructor(task, context, routineExecId, prevNodes = [], debug = false) {
|
|
@@ -617,6 +622,10 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
617
622
|
this.processing = false;
|
|
618
623
|
this.subgraphComplete = false;
|
|
619
624
|
this.graphComplete = false;
|
|
625
|
+
this.result = false;
|
|
626
|
+
this.retryCount = 0;
|
|
627
|
+
this.retryDelay = 0;
|
|
628
|
+
this.retries = 0;
|
|
620
629
|
this.previousNodes = [];
|
|
621
630
|
this.nextNodes = [];
|
|
622
631
|
this.executionTime = 0;
|
|
@@ -625,10 +634,12 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
625
634
|
this.errored = false;
|
|
626
635
|
this.destroyed = false;
|
|
627
636
|
this.debug = false;
|
|
637
|
+
this.id = uuid3();
|
|
628
638
|
this.task = task;
|
|
629
639
|
this.context = context;
|
|
640
|
+
this.retryCount = task.retryCount;
|
|
641
|
+
this.retryDelay = task.retryDelay;
|
|
630
642
|
this.previousNodes = prevNodes;
|
|
631
|
-
this.id = uuid3();
|
|
632
643
|
this.routineExecId = routineExecId;
|
|
633
644
|
this.splitGroupId = routineExecId;
|
|
634
645
|
this.debug = debug;
|
|
@@ -696,6 +707,20 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
696
707
|
...this.lightExport(),
|
|
697
708
|
__scheduled: Date.now()
|
|
698
709
|
});
|
|
710
|
+
const context = this.context.getFullContext();
|
|
711
|
+
if (context.__signalName !== void 0 && !context.__signalName.includes("meta.")) {
|
|
712
|
+
this.emit("meta.node.consumed_signal", {
|
|
713
|
+
__signal_log: {
|
|
714
|
+
signal_name: context.__signalName,
|
|
715
|
+
log_type: "consume",
|
|
716
|
+
consumed_by_task_id: this.task.id,
|
|
717
|
+
task_execution_id: this.id,
|
|
718
|
+
relation_type: "listener",
|
|
719
|
+
metadata: {},
|
|
720
|
+
is_meta: false
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}
|
|
699
724
|
}
|
|
700
725
|
}
|
|
701
726
|
start() {
|
|
@@ -743,29 +768,70 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
743
768
|
this.postProcess();
|
|
744
769
|
return this.nextNodes;
|
|
745
770
|
}
|
|
746
|
-
|
|
747
|
-
this.result = this.work();
|
|
748
|
-
} catch (e) {
|
|
749
|
-
this.onError(e);
|
|
750
|
-
}
|
|
771
|
+
this.result = this.work();
|
|
751
772
|
if (this.result instanceof Promise) {
|
|
752
|
-
return this.
|
|
773
|
+
return this.executeAsync();
|
|
753
774
|
}
|
|
754
775
|
this.postProcess();
|
|
755
776
|
}
|
|
756
777
|
return this.nextNodes;
|
|
757
778
|
}
|
|
758
|
-
async
|
|
779
|
+
async workAsync() {
|
|
759
780
|
try {
|
|
760
781
|
this.result = await this.result;
|
|
761
782
|
} catch (e) {
|
|
762
|
-
this.
|
|
783
|
+
const result = await this.retryAsync(e);
|
|
784
|
+
if (result === e) {
|
|
785
|
+
this.onError(e);
|
|
786
|
+
}
|
|
763
787
|
}
|
|
788
|
+
}
|
|
789
|
+
async executeAsync() {
|
|
790
|
+
await this.workAsync();
|
|
764
791
|
this.postProcess();
|
|
765
792
|
return this.nextNodes;
|
|
766
793
|
}
|
|
767
794
|
work() {
|
|
768
|
-
|
|
795
|
+
try {
|
|
796
|
+
const result = this.task.execute(
|
|
797
|
+
this.context,
|
|
798
|
+
this.emitWithMetadata.bind(this),
|
|
799
|
+
this.onProgress.bind(this)
|
|
800
|
+
);
|
|
801
|
+
if (result.errored || result.failed) {
|
|
802
|
+
return this.retry(result);
|
|
803
|
+
}
|
|
804
|
+
return result;
|
|
805
|
+
} catch (e) {
|
|
806
|
+
const result = this.retry(e);
|
|
807
|
+
return result.then((result2) => {
|
|
808
|
+
if (result2 !== e) {
|
|
809
|
+
return result2;
|
|
810
|
+
}
|
|
811
|
+
this.onError(e);
|
|
812
|
+
return this.result;
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
emitWithMetadata(signal, context) {
|
|
817
|
+
this.emit(signal, {
|
|
818
|
+
...context,
|
|
819
|
+
__emittedSignal: signal,
|
|
820
|
+
__emittedByNode: this.id
|
|
821
|
+
});
|
|
822
|
+
if (!signal.includes(".meta")) {
|
|
823
|
+
this.emit("meta.node.emitted_signal", {
|
|
824
|
+
__signal_log: {
|
|
825
|
+
signal_name: signal,
|
|
826
|
+
log_type: "emit",
|
|
827
|
+
emitted_by_task_id: this.task.id,
|
|
828
|
+
task_execution_id: this.id,
|
|
829
|
+
relation_type: "emitter",
|
|
830
|
+
metadata: {},
|
|
831
|
+
is_meta: false
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
}
|
|
769
835
|
}
|
|
770
836
|
onProgress(progress) {
|
|
771
837
|
var _a, _b, _c;
|
|
@@ -791,9 +857,13 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
791
857
|
this.completeSubgraph();
|
|
792
858
|
}
|
|
793
859
|
if (this.errored || this.failed) {
|
|
794
|
-
this.task.
|
|
860
|
+
this.task.mapOnFailSignals(
|
|
861
|
+
(signal) => this.emitWithMetadata(signal, this.context)
|
|
862
|
+
);
|
|
795
863
|
} else {
|
|
796
|
-
this.task.
|
|
864
|
+
this.task.mapSignals(
|
|
865
|
+
(signal) => this.emitWithMetadata(signal, this.context)
|
|
866
|
+
);
|
|
797
867
|
}
|
|
798
868
|
this.end();
|
|
799
869
|
}
|
|
@@ -801,6 +871,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
801
871
|
this.result = {
|
|
802
872
|
...this.context.getFullContext(),
|
|
803
873
|
__error: `Node error: ${error}`,
|
|
874
|
+
__retries: this.retries,
|
|
804
875
|
error: `Node error: ${error}`,
|
|
805
876
|
returnedValue: this.result,
|
|
806
877
|
...errorData
|
|
@@ -808,6 +879,30 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
808
879
|
this.migrate(this.result);
|
|
809
880
|
this.errored = true;
|
|
810
881
|
}
|
|
882
|
+
async retry(prevResult) {
|
|
883
|
+
if (this.retryCount === 0) {
|
|
884
|
+
return prevResult;
|
|
885
|
+
}
|
|
886
|
+
await this.delayRetry();
|
|
887
|
+
return this.work();
|
|
888
|
+
}
|
|
889
|
+
async retryAsync(prevResult) {
|
|
890
|
+
if (this.retryCount === 0) {
|
|
891
|
+
return prevResult;
|
|
892
|
+
}
|
|
893
|
+
await this.delayRetry();
|
|
894
|
+
this.result = this.work();
|
|
895
|
+
return this.workAsync();
|
|
896
|
+
}
|
|
897
|
+
async delayRetry() {
|
|
898
|
+
this.retryCount--;
|
|
899
|
+
this.retries++;
|
|
900
|
+
await sleep(this.retryDelay);
|
|
901
|
+
this.retryDelay *= this.task.retryDelayFactor;
|
|
902
|
+
if (this.retryDelay > this.task.retryDelayMax) {
|
|
903
|
+
this.retryDelay = this.task.retryDelayMax;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
811
906
|
divide() {
|
|
812
907
|
var _a;
|
|
813
908
|
const newNodes = [];
|
|
@@ -831,7 +926,14 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
831
926
|
if (outputValidation !== true) {
|
|
832
927
|
this.onError(outputValidation.__validationErrors);
|
|
833
928
|
}
|
|
834
|
-
this.
|
|
929
|
+
this.divided = true;
|
|
930
|
+
this.migrate({
|
|
931
|
+
...this.result,
|
|
932
|
+
...this.context.getMetaData(),
|
|
933
|
+
__nextNodes: newNodes.map((n) => n.id),
|
|
934
|
+
__retries: this.retries
|
|
935
|
+
});
|
|
936
|
+
return newNodes;
|
|
835
937
|
}
|
|
836
938
|
}
|
|
837
939
|
if (this.errored) {
|
|
@@ -845,7 +947,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
845
947
|
this.divided = true;
|
|
846
948
|
this.migrate({
|
|
847
949
|
...this.context.getFullContext(),
|
|
848
|
-
__nextNodes: newNodes.map((n) => n.id)
|
|
950
|
+
__nextNodes: newNodes.map((n) => n.id),
|
|
951
|
+
__retries: this.retries
|
|
849
952
|
});
|
|
850
953
|
return newNodes;
|
|
851
954
|
}
|
|
@@ -1022,8 +1125,8 @@ import { v4 as uuid4 } from "uuid";
|
|
|
1022
1125
|
var SignalParticipant = class extends SignalEmitter {
|
|
1023
1126
|
constructor() {
|
|
1024
1127
|
super(...arguments);
|
|
1025
|
-
this.
|
|
1026
|
-
|
|
1128
|
+
this.emitsSignals = /* @__PURE__ */ new Set();
|
|
1129
|
+
this.signalsToEmitAfter = /* @__PURE__ */ new Set();
|
|
1027
1130
|
this.signalsToEmitOnFail = /* @__PURE__ */ new Set();
|
|
1028
1131
|
this.observedSignals = /* @__PURE__ */ new Set();
|
|
1029
1132
|
}
|
|
@@ -1046,12 +1149,18 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1046
1149
|
* @param signals The signal names.
|
|
1047
1150
|
* @returns This for chaining.
|
|
1048
1151
|
*/
|
|
1049
|
-
|
|
1050
|
-
signals.forEach((signal) =>
|
|
1152
|
+
emitsAfter(...signals) {
|
|
1153
|
+
signals.forEach((signal) => {
|
|
1154
|
+
this.signalsToEmitAfter.add(signal);
|
|
1155
|
+
this.emitsSignals.add(signal);
|
|
1156
|
+
});
|
|
1051
1157
|
return this;
|
|
1052
1158
|
}
|
|
1053
1159
|
emitsOnFail(...signals) {
|
|
1054
|
-
signals.forEach((signal) =>
|
|
1160
|
+
signals.forEach((signal) => {
|
|
1161
|
+
this.signalsToEmitOnFail.add(signal);
|
|
1162
|
+
this.emitsSignals.add(signal);
|
|
1163
|
+
});
|
|
1055
1164
|
return this;
|
|
1056
1165
|
}
|
|
1057
1166
|
/**
|
|
@@ -1086,7 +1195,7 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1086
1195
|
* @returns This for chaining.
|
|
1087
1196
|
*/
|
|
1088
1197
|
detachSignals(...signals) {
|
|
1089
|
-
signals.forEach((signal) => this.
|
|
1198
|
+
signals.forEach((signal) => this.signalsToEmitAfter.delete(signal));
|
|
1090
1199
|
return this;
|
|
1091
1200
|
}
|
|
1092
1201
|
/**
|
|
@@ -1094,16 +1203,22 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1094
1203
|
* @returns This for chaining.
|
|
1095
1204
|
*/
|
|
1096
1205
|
detachAllSignals() {
|
|
1097
|
-
this.
|
|
1206
|
+
this.signalsToEmitAfter.clear();
|
|
1098
1207
|
return this;
|
|
1099
1208
|
}
|
|
1209
|
+
mapSignals(callback) {
|
|
1210
|
+
return Array.from(this.signalsToEmitAfter).map(callback);
|
|
1211
|
+
}
|
|
1212
|
+
mapOnFailSignals(callback) {
|
|
1213
|
+
return Array.from(this.signalsToEmitOnFail).map(callback);
|
|
1214
|
+
}
|
|
1100
1215
|
/**
|
|
1101
1216
|
* Emits attached signals.
|
|
1102
1217
|
* @param context The context for emission.
|
|
1103
1218
|
* @edge If isMeta (from Task), suppresses further "meta.*" to prevent loops.
|
|
1104
1219
|
*/
|
|
1105
1220
|
emitSignals(context) {
|
|
1106
|
-
this.
|
|
1221
|
+
this.signalsToEmitAfter.forEach((signal) => {
|
|
1107
1222
|
this.emit(signal, context.getFullContext());
|
|
1108
1223
|
});
|
|
1109
1224
|
}
|
|
@@ -1222,9 +1337,13 @@ var Task = class extends SignalParticipant {
|
|
|
1222
1337
|
* @param validateInputContext
|
|
1223
1338
|
* @param outputSchema
|
|
1224
1339
|
* @param validateOutputContext
|
|
1340
|
+
* @param retryCount
|
|
1341
|
+
* @param retryDelay
|
|
1342
|
+
* @param retryDelayMax
|
|
1343
|
+
* @param retryDelayFactor
|
|
1225
1344
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
1226
1345
|
*/
|
|
1227
|
-
constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false) {
|
|
1346
|
+
constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
|
|
1228
1347
|
super();
|
|
1229
1348
|
this.isMeta = false;
|
|
1230
1349
|
this.isUnique = false;
|
|
@@ -1236,6 +1355,10 @@ var Task = class extends SignalParticipant {
|
|
|
1236
1355
|
this.validateInputContext = false;
|
|
1237
1356
|
this.outputContextSchema = void 0;
|
|
1238
1357
|
this.validateOutputContext = false;
|
|
1358
|
+
this.retryCount = 0;
|
|
1359
|
+
this.retryDelay = 0;
|
|
1360
|
+
this.retryDelayMax = 0;
|
|
1361
|
+
this.retryDelayFactor = 1;
|
|
1239
1362
|
this.layerIndex = 0;
|
|
1240
1363
|
this.progressWeight = 0;
|
|
1241
1364
|
this.nextTasks = /* @__PURE__ */ new Set();
|
|
@@ -1254,6 +1377,10 @@ var Task = class extends SignalParticipant {
|
|
|
1254
1377
|
this.validateInputContext = validateInputContext;
|
|
1255
1378
|
this.outputContextSchema = outputSchema;
|
|
1256
1379
|
this.validateOutputContext = validateOutputContext;
|
|
1380
|
+
this.retryCount = retryCount;
|
|
1381
|
+
this.retryDelay = retryDelay;
|
|
1382
|
+
this.retryDelayMax = retryDelayMax;
|
|
1383
|
+
this.retryDelayFactor = retryDelayFactor;
|
|
1257
1384
|
if (getTagCallback) {
|
|
1258
1385
|
this.getTag = (context) => getTagCallback(context, this);
|
|
1259
1386
|
this.throttled = true;
|
|
@@ -1446,14 +1573,16 @@ var Task = class extends SignalParticipant {
|
|
|
1446
1573
|
/**
|
|
1447
1574
|
* Executes the task function after optional input validation.
|
|
1448
1575
|
* @param context - The GraphContext to validate and execute.
|
|
1576
|
+
* @param emit
|
|
1449
1577
|
* @param progressCallback - Callback for progress updates.
|
|
1450
1578
|
* @returns TaskResult from the taskFunction or error object on validation failure.
|
|
1451
1579
|
* @edge If validateInputContext is true, validates context; on failure, emits 'meta.task.validationFailed' with detailed errors.
|
|
1452
1580
|
* @edge If validateOutputContext is true, validates output; on failure, emits 'meta.task.outputValidationFailed' with detailed errors.
|
|
1453
1581
|
*/
|
|
1454
|
-
execute(context, progressCallback) {
|
|
1582
|
+
execute(context, emit, progressCallback) {
|
|
1455
1583
|
return this.taskFunction(
|
|
1456
1584
|
this.isMeta ? context.getClonedFullContext() : context.getClonedContext(),
|
|
1585
|
+
emit,
|
|
1457
1586
|
progressCallback
|
|
1458
1587
|
);
|
|
1459
1588
|
}
|
|
@@ -1593,7 +1722,7 @@ var Task = class extends SignalParticipant {
|
|
|
1593
1722
|
__isMeta: this.isMeta,
|
|
1594
1723
|
__isSignal: this.isSignal,
|
|
1595
1724
|
__eventTriggers: this.observedSignals,
|
|
1596
|
-
__attachedEvents: this.
|
|
1725
|
+
__attachedEvents: this.signalsToEmitAfter,
|
|
1597
1726
|
__isDeputy: this.isDeputy,
|
|
1598
1727
|
__throttled: this.throttled,
|
|
1599
1728
|
__isEphemeral: this.isEphemeral,
|
|
@@ -1994,6 +2123,7 @@ var DebounceTask = class extends Task {
|
|
|
1994
2123
|
this.lastContext = null;
|
|
1995
2124
|
this.lastTimeout = null;
|
|
1996
2125
|
this.lastProgressCallback = null;
|
|
2126
|
+
this.lastEmitFunction = null;
|
|
1997
2127
|
this.debounceTime = debounceTime;
|
|
1998
2128
|
this.leading = leading;
|
|
1999
2129
|
this.trailing = trailing;
|
|
@@ -2007,6 +2137,7 @@ var DebounceTask = class extends Task {
|
|
|
2007
2137
|
try {
|
|
2008
2138
|
result = this.taskFunction(
|
|
2009
2139
|
this.lastContext.getClonedContext(),
|
|
2140
|
+
this.lastEmitFunction,
|
|
2010
2141
|
this.lastProgressCallback
|
|
2011
2142
|
);
|
|
2012
2143
|
} catch (error) {
|
|
@@ -2023,7 +2154,7 @@ var DebounceTask = class extends Task {
|
|
|
2023
2154
|
}
|
|
2024
2155
|
}
|
|
2025
2156
|
}
|
|
2026
|
-
debouncedTrigger(resolve, reject, context, timeout, progressCallback) {
|
|
2157
|
+
debouncedTrigger(resolve, reject, context, timeout, emit, progressCallback) {
|
|
2027
2158
|
const callNow = this.leading && this.timer === null;
|
|
2028
2159
|
const isNewBurst = this.timer === null;
|
|
2029
2160
|
if (this.timer !== null) {
|
|
@@ -2035,6 +2166,7 @@ var DebounceTask = class extends Task {
|
|
|
2035
2166
|
this.lastContext = context;
|
|
2036
2167
|
this.lastTimeout = timeout;
|
|
2037
2168
|
this.lastProgressCallback = progressCallback;
|
|
2169
|
+
this.lastEmitFunction = emit;
|
|
2038
2170
|
if (!callNow) {
|
|
2039
2171
|
this.hasLaterCall = true;
|
|
2040
2172
|
}
|
|
@@ -2067,7 +2199,7 @@ var DebounceTask = class extends Task {
|
|
|
2067
2199
|
}, this.maxWait);
|
|
2068
2200
|
}
|
|
2069
2201
|
}
|
|
2070
|
-
execute(context, progressCallback) {
|
|
2202
|
+
execute(context, emit, progressCallback) {
|
|
2071
2203
|
return new Promise((resolve, reject) => {
|
|
2072
2204
|
const timeout = setTimeout(() => {
|
|
2073
2205
|
resolve(false);
|
|
@@ -2077,6 +2209,7 @@ var DebounceTask = class extends Task {
|
|
|
2077
2209
|
reject,
|
|
2078
2210
|
context,
|
|
2079
2211
|
timeout,
|
|
2212
|
+
emit,
|
|
2080
2213
|
progressCallback
|
|
2081
2214
|
);
|
|
2082
2215
|
});
|
|
@@ -2085,7 +2218,7 @@ var DebounceTask = class extends Task {
|
|
|
2085
2218
|
|
|
2086
2219
|
// src/graph/definition/EphemeralTask.ts
|
|
2087
2220
|
var EphemeralTask = class extends Task {
|
|
2088
|
-
constructor(name, task, description = "", once = true, condition = () => true, concurrency = 0, timeout = 0, register = false, isUnique = false, isMeta = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false) {
|
|
2221
|
+
constructor(name, task, description = "", once = true, condition = () => true, concurrency = 0, timeout = 0, register = false, isUnique = false, isMeta = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
|
|
2089
2222
|
super(
|
|
2090
2223
|
name,
|
|
2091
2224
|
task,
|
|
@@ -2099,15 +2232,18 @@ var EphemeralTask = class extends Task {
|
|
|
2099
2232
|
inputSchema,
|
|
2100
2233
|
validateInputContext,
|
|
2101
2234
|
outputSchema,
|
|
2102
|
-
validateOutputContext
|
|
2235
|
+
validateOutputContext,
|
|
2236
|
+
retryCount,
|
|
2237
|
+
retryDelay,
|
|
2238
|
+
retryDelayMax,
|
|
2239
|
+
retryDelayFactor
|
|
2103
2240
|
);
|
|
2104
2241
|
this.isEphemeral = true;
|
|
2105
2242
|
this.once = once;
|
|
2106
2243
|
this.condition = condition;
|
|
2107
2244
|
}
|
|
2108
|
-
execute(context, progressCallback) {
|
|
2109
|
-
const result = super.execute(context, progressCallback);
|
|
2110
|
-
this.emit("meta.ephemeral.executed", result);
|
|
2245
|
+
execute(context, emit, progressCallback) {
|
|
2246
|
+
const result = super.execute(context, emit, progressCallback);
|
|
2111
2247
|
if (this.once || !this.condition(result)) {
|
|
2112
2248
|
this.destroy();
|
|
2113
2249
|
return result;
|
|
@@ -2437,11 +2573,6 @@ var GraphRunStrategy = class {
|
|
|
2437
2573
|
}
|
|
2438
2574
|
};
|
|
2439
2575
|
|
|
2440
|
-
// src/utils/promise.ts
|
|
2441
|
-
function sleep(ms) {
|
|
2442
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
2576
|
// src/engine/ThrottleEngine.ts
|
|
2446
2577
|
var ThrottleEngine = class _ThrottleEngine {
|
|
2447
2578
|
constructor() {
|
|
@@ -2698,7 +2829,11 @@ var Cadenza = class {
|
|
|
2698
2829
|
inputSchema: void 0,
|
|
2699
2830
|
validateInputContext: false,
|
|
2700
2831
|
outputSchema: void 0,
|
|
2701
|
-
validateOutputContext: false
|
|
2832
|
+
validateOutputContext: false,
|
|
2833
|
+
retryCount: 0,
|
|
2834
|
+
retryDelay: 0,
|
|
2835
|
+
retryDelayMax: 0,
|
|
2836
|
+
retryDelayFactor: 1
|
|
2702
2837
|
}) {
|
|
2703
2838
|
this.bootstrap();
|
|
2704
2839
|
this.validateName(name);
|
|
@@ -2715,7 +2850,11 @@ var Cadenza = class {
|
|
|
2715
2850
|
options.inputSchema,
|
|
2716
2851
|
options.validateInputContext,
|
|
2717
2852
|
options.outputSchema,
|
|
2718
|
-
options.validateOutputContext
|
|
2853
|
+
options.validateOutputContext,
|
|
2854
|
+
options.retryCount,
|
|
2855
|
+
options.retryDelay,
|
|
2856
|
+
options.retryDelayMax,
|
|
2857
|
+
options.retryDelayFactor
|
|
2719
2858
|
);
|
|
2720
2859
|
}
|
|
2721
2860
|
/**
|
|
@@ -2738,7 +2877,11 @@ var Cadenza = class {
|
|
|
2738
2877
|
inputSchema: void 0,
|
|
2739
2878
|
validateInputContext: false,
|
|
2740
2879
|
outputSchema: void 0,
|
|
2741
|
-
validateOutputContext: false
|
|
2880
|
+
validateOutputContext: false,
|
|
2881
|
+
retryCount: 0,
|
|
2882
|
+
retryDelay: 0,
|
|
2883
|
+
retryDelayMax: 0,
|
|
2884
|
+
retryDelayFactor: 1
|
|
2742
2885
|
}) {
|
|
2743
2886
|
options.isMeta = true;
|
|
2744
2887
|
return this.createTask(name, func, description, options);
|
|
@@ -2763,7 +2906,11 @@ var Cadenza = class {
|
|
|
2763
2906
|
inputSchema: void 0,
|
|
2764
2907
|
validateInputContext: false,
|
|
2765
2908
|
outputSchema: void 0,
|
|
2766
|
-
validateOutputContext: false
|
|
2909
|
+
validateOutputContext: false,
|
|
2910
|
+
retryCount: 0,
|
|
2911
|
+
retryDelay: 0,
|
|
2912
|
+
retryDelayMax: 0,
|
|
2913
|
+
retryDelayFactor: 1
|
|
2767
2914
|
}) {
|
|
2768
2915
|
options.isUnique = true;
|
|
2769
2916
|
return this.createTask(name, func, description, options);
|
|
@@ -2786,7 +2933,11 @@ var Cadenza = class {
|
|
|
2786
2933
|
inputSchema: void 0,
|
|
2787
2934
|
validateInputContext: false,
|
|
2788
2935
|
outputSchema: void 0,
|
|
2789
|
-
validateOutputContext: false
|
|
2936
|
+
validateOutputContext: false,
|
|
2937
|
+
retryCount: 0,
|
|
2938
|
+
retryDelay: 0,
|
|
2939
|
+
retryDelayMax: 0,
|
|
2940
|
+
retryDelayFactor: 1
|
|
2790
2941
|
}) {
|
|
2791
2942
|
options.isMeta = true;
|
|
2792
2943
|
return this.createUniqueTask(name, func, description, options);
|
|
@@ -2810,7 +2961,11 @@ var Cadenza = class {
|
|
|
2810
2961
|
inputSchema: void 0,
|
|
2811
2962
|
validateInputContext: false,
|
|
2812
2963
|
outputSchema: void 0,
|
|
2813
|
-
validateOutputContext: false
|
|
2964
|
+
validateOutputContext: false,
|
|
2965
|
+
retryCount: 0,
|
|
2966
|
+
retryDelay: 0,
|
|
2967
|
+
retryDelayMax: 0,
|
|
2968
|
+
retryDelayFactor: 1
|
|
2814
2969
|
}) {
|
|
2815
2970
|
options.getTagCallback = throttledIdGetter;
|
|
2816
2971
|
return this.createTask(name, func, description, options);
|
|
@@ -2833,7 +2988,11 @@ var Cadenza = class {
|
|
|
2833
2988
|
inputSchema: void 0,
|
|
2834
2989
|
validateInputContext: false,
|
|
2835
2990
|
outputSchema: void 0,
|
|
2836
|
-
validateOutputContext: false
|
|
2991
|
+
validateOutputContext: false,
|
|
2992
|
+
retryCount: 0,
|
|
2993
|
+
retryDelay: 0,
|
|
2994
|
+
retryDelayMax: 0,
|
|
2995
|
+
retryDelayFactor: 1
|
|
2837
2996
|
}) {
|
|
2838
2997
|
options.isMeta = true;
|
|
2839
2998
|
return this.createThrottledTask(
|
|
@@ -2943,7 +3102,11 @@ var Cadenza = class {
|
|
|
2943
3102
|
inputSchema: void 0,
|
|
2944
3103
|
validateInputContext: false,
|
|
2945
3104
|
outputSchema: void 0,
|
|
2946
|
-
validateOutputContext: false
|
|
3105
|
+
validateOutputContext: false,
|
|
3106
|
+
retryCount: 0,
|
|
3107
|
+
retryDelay: 0,
|
|
3108
|
+
retryDelayMax: 0,
|
|
3109
|
+
retryDelayFactor: 1
|
|
2947
3110
|
}) {
|
|
2948
3111
|
this.bootstrap();
|
|
2949
3112
|
this.validateName(name);
|
|
@@ -2962,7 +3125,11 @@ var Cadenza = class {
|
|
|
2962
3125
|
options.inputSchema,
|
|
2963
3126
|
options.validateInputContext,
|
|
2964
3127
|
options.outputSchema,
|
|
2965
|
-
options.validateOutputContext
|
|
3128
|
+
options.validateOutputContext,
|
|
3129
|
+
options.retryCount,
|
|
3130
|
+
options.retryDelay,
|
|
3131
|
+
options.retryDelayMax,
|
|
3132
|
+
options.retryDelayFactor
|
|
2966
3133
|
);
|
|
2967
3134
|
}
|
|
2968
3135
|
/**
|
|
@@ -2985,7 +3152,11 @@ var Cadenza = class {
|
|
|
2985
3152
|
inputSchema: void 0,
|
|
2986
3153
|
validateInputContext: false,
|
|
2987
3154
|
outputSchema: void 0,
|
|
2988
|
-
validateOutputContext: false
|
|
3155
|
+
validateOutputContext: false,
|
|
3156
|
+
retryCount: 0,
|
|
3157
|
+
retryDelay: 0,
|
|
3158
|
+
retryDelayMax: 0,
|
|
3159
|
+
retryDelayFactor: 1
|
|
2989
3160
|
}) {
|
|
2990
3161
|
options.isMeta = true;
|
|
2991
3162
|
return this.createEphemeralTask(
|
|
@@ -3041,7 +3212,7 @@ Cadenza.mode = "production";
|
|
|
3041
3212
|
var SignalTask = class extends Task {
|
|
3042
3213
|
constructor(signal, description = "") {
|
|
3043
3214
|
super(signal, () => true, description);
|
|
3044
|
-
this.
|
|
3215
|
+
this.signalsToEmitAfter.add(signal);
|
|
3045
3216
|
}
|
|
3046
3217
|
};
|
|
3047
3218
|
|