@cadenza.io/core 1.7.10 → 1.8.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 +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +151 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -195,6 +195,9 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
195
195
|
private subgraphComplete;
|
|
196
196
|
private graphComplete;
|
|
197
197
|
private result;
|
|
198
|
+
private retryCount;
|
|
199
|
+
private retryDelay;
|
|
200
|
+
private retries;
|
|
198
201
|
private previousNodes;
|
|
199
202
|
private nextNodes;
|
|
200
203
|
private executionTime;
|
|
@@ -222,11 +225,15 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
222
225
|
start(): number;
|
|
223
226
|
end(): number;
|
|
224
227
|
execute(): GraphNode[] | Promise<GraphNode[]>;
|
|
225
|
-
private
|
|
228
|
+
private workAsync;
|
|
229
|
+
private executeAsync;
|
|
226
230
|
private work;
|
|
227
231
|
private onProgress;
|
|
228
232
|
private postProcess;
|
|
229
233
|
private onError;
|
|
234
|
+
private retry;
|
|
235
|
+
private retryAsync;
|
|
236
|
+
private delayRetry;
|
|
230
237
|
private divide;
|
|
231
238
|
private generateNewNodes;
|
|
232
239
|
private differentiate;
|
|
@@ -248,7 +255,7 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
248
255
|
__id: string;
|
|
249
256
|
__context: AnyObject;
|
|
250
257
|
};
|
|
251
|
-
__result:
|
|
258
|
+
__result: TaskResult;
|
|
252
259
|
__executionTime: number;
|
|
253
260
|
__executionStart: number;
|
|
254
261
|
__executionEnd: number;
|
|
@@ -391,7 +398,7 @@ type SchemaDefinition = {
|
|
|
391
398
|
};
|
|
392
399
|
|
|
393
400
|
type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
|
|
394
|
-
type TaskResult = boolean |
|
|
401
|
+
type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
|
|
395
402
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
396
403
|
declare class Task extends SignalParticipant implements Graph {
|
|
397
404
|
id: string;
|
|
@@ -409,6 +416,10 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
409
416
|
protected validateInputContext: boolean;
|
|
410
417
|
protected outputContextSchema: SchemaDefinition | undefined;
|
|
411
418
|
protected validateOutputContext: boolean;
|
|
419
|
+
readonly retryCount: number;
|
|
420
|
+
readonly retryDelay: number;
|
|
421
|
+
readonly retryDelayMax: number;
|
|
422
|
+
readonly retryDelayFactor: number;
|
|
412
423
|
layerIndex: number;
|
|
413
424
|
progressWeight: number;
|
|
414
425
|
private nextTasks;
|
|
@@ -431,9 +442,13 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
431
442
|
* @param validateInputContext
|
|
432
443
|
* @param outputSchema
|
|
433
444
|
* @param validateOutputContext
|
|
445
|
+
* @param retryCount
|
|
446
|
+
* @param retryDelay
|
|
447
|
+
* @param retryDelayMax
|
|
448
|
+
* @param retryDelayFactor
|
|
434
449
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
435
450
|
*/
|
|
436
|
-
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean);
|
|
451
|
+
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
437
452
|
getTag(context?: AnyObject): string;
|
|
438
453
|
setGlobalId(id: string): void;
|
|
439
454
|
setTimeout(timeout: number): void;
|
|
@@ -718,7 +733,7 @@ declare class EphemeralTask extends Task {
|
|
|
718
733
|
private readonly once;
|
|
719
734
|
private readonly condition;
|
|
720
735
|
readonly isEphemeral: boolean;
|
|
721
|
-
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean);
|
|
736
|
+
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
722
737
|
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
723
738
|
}
|
|
724
739
|
|
|
@@ -745,6 +760,10 @@ interface TaskOptions {
|
|
|
745
760
|
validateInputContext?: boolean;
|
|
746
761
|
outputSchema?: SchemaDefinition;
|
|
747
762
|
validateOutputContext?: boolean;
|
|
763
|
+
retryCount?: number;
|
|
764
|
+
retryDelay?: number;
|
|
765
|
+
retryDelayMax?: number;
|
|
766
|
+
retryDelayFactor?: number;
|
|
748
767
|
}
|
|
749
768
|
type CadenzaMode = "dev" | "debug" | "production";
|
|
750
769
|
declare class Cadenza {
|
package/dist/index.d.ts
CHANGED
|
@@ -195,6 +195,9 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
195
195
|
private subgraphComplete;
|
|
196
196
|
private graphComplete;
|
|
197
197
|
private result;
|
|
198
|
+
private retryCount;
|
|
199
|
+
private retryDelay;
|
|
200
|
+
private retries;
|
|
198
201
|
private previousNodes;
|
|
199
202
|
private nextNodes;
|
|
200
203
|
private executionTime;
|
|
@@ -222,11 +225,15 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
222
225
|
start(): number;
|
|
223
226
|
end(): number;
|
|
224
227
|
execute(): GraphNode[] | Promise<GraphNode[]>;
|
|
225
|
-
private
|
|
228
|
+
private workAsync;
|
|
229
|
+
private executeAsync;
|
|
226
230
|
private work;
|
|
227
231
|
private onProgress;
|
|
228
232
|
private postProcess;
|
|
229
233
|
private onError;
|
|
234
|
+
private retry;
|
|
235
|
+
private retryAsync;
|
|
236
|
+
private delayRetry;
|
|
230
237
|
private divide;
|
|
231
238
|
private generateNewNodes;
|
|
232
239
|
private differentiate;
|
|
@@ -248,7 +255,7 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
248
255
|
__id: string;
|
|
249
256
|
__context: AnyObject;
|
|
250
257
|
};
|
|
251
|
-
__result:
|
|
258
|
+
__result: TaskResult;
|
|
252
259
|
__executionTime: number;
|
|
253
260
|
__executionStart: number;
|
|
254
261
|
__executionEnd: number;
|
|
@@ -391,7 +398,7 @@ type SchemaDefinition = {
|
|
|
391
398
|
};
|
|
392
399
|
|
|
393
400
|
type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
|
|
394
|
-
type TaskResult = boolean |
|
|
401
|
+
type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
|
|
395
402
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
396
403
|
declare class Task extends SignalParticipant implements Graph {
|
|
397
404
|
id: string;
|
|
@@ -409,6 +416,10 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
409
416
|
protected validateInputContext: boolean;
|
|
410
417
|
protected outputContextSchema: SchemaDefinition | undefined;
|
|
411
418
|
protected validateOutputContext: boolean;
|
|
419
|
+
readonly retryCount: number;
|
|
420
|
+
readonly retryDelay: number;
|
|
421
|
+
readonly retryDelayMax: number;
|
|
422
|
+
readonly retryDelayFactor: number;
|
|
412
423
|
layerIndex: number;
|
|
413
424
|
progressWeight: number;
|
|
414
425
|
private nextTasks;
|
|
@@ -431,9 +442,13 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
431
442
|
* @param validateInputContext
|
|
432
443
|
* @param outputSchema
|
|
433
444
|
* @param validateOutputContext
|
|
445
|
+
* @param retryCount
|
|
446
|
+
* @param retryDelay
|
|
447
|
+
* @param retryDelayMax
|
|
448
|
+
* @param retryDelayFactor
|
|
434
449
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
435
450
|
*/
|
|
436
|
-
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean);
|
|
451
|
+
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
437
452
|
getTag(context?: AnyObject): string;
|
|
438
453
|
setGlobalId(id: string): void;
|
|
439
454
|
setTimeout(timeout: number): void;
|
|
@@ -718,7 +733,7 @@ declare class EphemeralTask extends Task {
|
|
|
718
733
|
private readonly once;
|
|
719
734
|
private readonly condition;
|
|
720
735
|
readonly isEphemeral: boolean;
|
|
721
|
-
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean);
|
|
736
|
+
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
722
737
|
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
723
738
|
}
|
|
724
739
|
|
|
@@ -745,6 +760,10 @@ interface TaskOptions {
|
|
|
745
760
|
validateInputContext?: boolean;
|
|
746
761
|
outputSchema?: SchemaDefinition;
|
|
747
762
|
validateOutputContext?: boolean;
|
|
763
|
+
retryCount?: number;
|
|
764
|
+
retryDelay?: number;
|
|
765
|
+
retryDelayMax?: number;
|
|
766
|
+
retryDelayFactor?: number;
|
|
748
767
|
}
|
|
749
768
|
type CadenzaMode = "dev" | "debug" | "production";
|
|
750
769
|
declare class Cadenza {
|
package/dist/index.js
CHANGED
|
@@ -646,6 +646,11 @@ var SignalEmitter = class {
|
|
|
646
646
|
}
|
|
647
647
|
};
|
|
648
648
|
|
|
649
|
+
// src/utils/promise.ts
|
|
650
|
+
function sleep(ms) {
|
|
651
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
652
|
+
}
|
|
653
|
+
|
|
649
654
|
// src/graph/execution/GraphNode.ts
|
|
650
655
|
var GraphNode = class _GraphNode extends SignalEmitter {
|
|
651
656
|
constructor(task, context, routineExecId, prevNodes = [], debug = false) {
|
|
@@ -655,6 +660,10 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
655
660
|
this.processing = false;
|
|
656
661
|
this.subgraphComplete = false;
|
|
657
662
|
this.graphComplete = false;
|
|
663
|
+
this.result = false;
|
|
664
|
+
this.retryCount = 0;
|
|
665
|
+
this.retryDelay = 0;
|
|
666
|
+
this.retries = 0;
|
|
658
667
|
this.previousNodes = [];
|
|
659
668
|
this.nextNodes = [];
|
|
660
669
|
this.executionTime = 0;
|
|
@@ -663,10 +672,12 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
663
672
|
this.errored = false;
|
|
664
673
|
this.destroyed = false;
|
|
665
674
|
this.debug = false;
|
|
675
|
+
this.id = (0, import_uuid3.v4)();
|
|
666
676
|
this.task = task;
|
|
667
677
|
this.context = context;
|
|
678
|
+
this.retryCount = task.retryCount;
|
|
679
|
+
this.retryDelay = task.retryDelay;
|
|
668
680
|
this.previousNodes = prevNodes;
|
|
669
|
-
this.id = (0, import_uuid3.v4)();
|
|
670
681
|
this.routineExecId = routineExecId;
|
|
671
682
|
this.splitGroupId = routineExecId;
|
|
672
683
|
this.debug = debug;
|
|
@@ -781,29 +792,49 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
781
792
|
this.postProcess();
|
|
782
793
|
return this.nextNodes;
|
|
783
794
|
}
|
|
784
|
-
|
|
785
|
-
this.result = this.work();
|
|
786
|
-
} catch (e) {
|
|
787
|
-
this.onError(e);
|
|
788
|
-
}
|
|
795
|
+
this.result = this.work();
|
|
789
796
|
if (this.result instanceof Promise) {
|
|
790
|
-
return this.
|
|
797
|
+
return this.executeAsync();
|
|
791
798
|
}
|
|
792
799
|
this.postProcess();
|
|
793
800
|
}
|
|
794
801
|
return this.nextNodes;
|
|
795
802
|
}
|
|
796
|
-
async
|
|
803
|
+
async workAsync() {
|
|
797
804
|
try {
|
|
798
805
|
this.result = await this.result;
|
|
799
806
|
} catch (e) {
|
|
800
|
-
this.
|
|
807
|
+
const result = await this.retryAsync(e);
|
|
808
|
+
if (result === e) {
|
|
809
|
+
this.onError(e);
|
|
810
|
+
}
|
|
801
811
|
}
|
|
812
|
+
}
|
|
813
|
+
async executeAsync() {
|
|
814
|
+
await this.workAsync();
|
|
802
815
|
this.postProcess();
|
|
803
816
|
return this.nextNodes;
|
|
804
817
|
}
|
|
805
818
|
work() {
|
|
806
|
-
|
|
819
|
+
try {
|
|
820
|
+
const result = this.task.execute(
|
|
821
|
+
this.context,
|
|
822
|
+
this.onProgress.bind(this)
|
|
823
|
+
);
|
|
824
|
+
if (result.errored || result.failed) {
|
|
825
|
+
return this.retry(result);
|
|
826
|
+
}
|
|
827
|
+
return result;
|
|
828
|
+
} catch (e) {
|
|
829
|
+
const result = this.retry(e);
|
|
830
|
+
return result.then((result2) => {
|
|
831
|
+
if (result2 !== e) {
|
|
832
|
+
return result2;
|
|
833
|
+
}
|
|
834
|
+
this.onError(e);
|
|
835
|
+
return this.result;
|
|
836
|
+
});
|
|
837
|
+
}
|
|
807
838
|
}
|
|
808
839
|
onProgress(progress) {
|
|
809
840
|
var _a, _b, _c;
|
|
@@ -839,6 +870,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
839
870
|
this.result = {
|
|
840
871
|
...this.context.getFullContext(),
|
|
841
872
|
__error: `Node error: ${error}`,
|
|
873
|
+
__retries: this.retries,
|
|
842
874
|
error: `Node error: ${error}`,
|
|
843
875
|
returnedValue: this.result,
|
|
844
876
|
...errorData
|
|
@@ -846,6 +878,30 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
846
878
|
this.migrate(this.result);
|
|
847
879
|
this.errored = true;
|
|
848
880
|
}
|
|
881
|
+
async retry(prevResult) {
|
|
882
|
+
if (this.retryCount === 0) {
|
|
883
|
+
return prevResult;
|
|
884
|
+
}
|
|
885
|
+
await this.delayRetry();
|
|
886
|
+
return this.work();
|
|
887
|
+
}
|
|
888
|
+
async retryAsync(prevResult) {
|
|
889
|
+
if (this.retryCount === 0) {
|
|
890
|
+
return prevResult;
|
|
891
|
+
}
|
|
892
|
+
await this.delayRetry();
|
|
893
|
+
this.result = this.work();
|
|
894
|
+
return this.workAsync();
|
|
895
|
+
}
|
|
896
|
+
async delayRetry() {
|
|
897
|
+
this.retryCount--;
|
|
898
|
+
this.retries++;
|
|
899
|
+
await sleep(this.retryDelay);
|
|
900
|
+
this.retryDelay *= this.task.retryDelayFactor;
|
|
901
|
+
if (this.retryDelay > this.task.retryDelayMax) {
|
|
902
|
+
this.retryDelay = this.task.retryDelayMax;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
849
905
|
divide() {
|
|
850
906
|
var _a;
|
|
851
907
|
const newNodes = [];
|
|
@@ -869,7 +925,14 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
869
925
|
if (outputValidation !== true) {
|
|
870
926
|
this.onError(outputValidation.__validationErrors);
|
|
871
927
|
}
|
|
872
|
-
this.
|
|
928
|
+
this.divided = true;
|
|
929
|
+
this.migrate({
|
|
930
|
+
...this.result,
|
|
931
|
+
...this.context.getMetaData(),
|
|
932
|
+
__nextNodes: newNodes.map((n) => n.id),
|
|
933
|
+
__retries: this.retries
|
|
934
|
+
});
|
|
935
|
+
return newNodes;
|
|
873
936
|
}
|
|
874
937
|
}
|
|
875
938
|
if (this.errored) {
|
|
@@ -883,7 +946,8 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
883
946
|
this.divided = true;
|
|
884
947
|
this.migrate({
|
|
885
948
|
...this.context.getFullContext(),
|
|
886
|
-
__nextNodes: newNodes.map((n) => n.id)
|
|
949
|
+
__nextNodes: newNodes.map((n) => n.id),
|
|
950
|
+
__retries: this.retries
|
|
887
951
|
});
|
|
888
952
|
return newNodes;
|
|
889
953
|
}
|
|
@@ -1044,7 +1108,12 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
1044
1108
|
};
|
|
1045
1109
|
}
|
|
1046
1110
|
log() {
|
|
1047
|
-
console.log(
|
|
1111
|
+
console.log(
|
|
1112
|
+
"Node execution:",
|
|
1113
|
+
this.task.name,
|
|
1114
|
+
this.context.getFullContext(),
|
|
1115
|
+
this.routineExecId
|
|
1116
|
+
);
|
|
1048
1117
|
}
|
|
1049
1118
|
};
|
|
1050
1119
|
|
|
@@ -1255,9 +1324,13 @@ var Task = class extends SignalParticipant {
|
|
|
1255
1324
|
* @param validateInputContext
|
|
1256
1325
|
* @param outputSchema
|
|
1257
1326
|
* @param validateOutputContext
|
|
1327
|
+
* @param retryCount
|
|
1328
|
+
* @param retryDelay
|
|
1329
|
+
* @param retryDelayMax
|
|
1330
|
+
* @param retryDelayFactor
|
|
1258
1331
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
1259
1332
|
*/
|
|
1260
|
-
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) {
|
|
1333
|
+
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) {
|
|
1261
1334
|
super();
|
|
1262
1335
|
this.isMeta = false;
|
|
1263
1336
|
this.isUnique = false;
|
|
@@ -1269,6 +1342,10 @@ var Task = class extends SignalParticipant {
|
|
|
1269
1342
|
this.validateInputContext = false;
|
|
1270
1343
|
this.outputContextSchema = void 0;
|
|
1271
1344
|
this.validateOutputContext = false;
|
|
1345
|
+
this.retryCount = 0;
|
|
1346
|
+
this.retryDelay = 0;
|
|
1347
|
+
this.retryDelayMax = 0;
|
|
1348
|
+
this.retryDelayFactor = 1;
|
|
1272
1349
|
this.layerIndex = 0;
|
|
1273
1350
|
this.progressWeight = 0;
|
|
1274
1351
|
this.nextTasks = /* @__PURE__ */ new Set();
|
|
@@ -1287,6 +1364,10 @@ var Task = class extends SignalParticipant {
|
|
|
1287
1364
|
this.validateInputContext = validateInputContext;
|
|
1288
1365
|
this.outputContextSchema = outputSchema;
|
|
1289
1366
|
this.validateOutputContext = validateOutputContext;
|
|
1367
|
+
this.retryCount = retryCount;
|
|
1368
|
+
this.retryDelay = retryDelay;
|
|
1369
|
+
this.retryDelayMax = retryDelayMax;
|
|
1370
|
+
this.retryDelayFactor = retryDelayFactor;
|
|
1290
1371
|
if (getTagCallback) {
|
|
1291
1372
|
this.getTag = (context) => getTagCallback(context, this);
|
|
1292
1373
|
this.throttled = true;
|
|
@@ -2118,7 +2199,7 @@ var DebounceTask = class extends Task {
|
|
|
2118
2199
|
|
|
2119
2200
|
// src/graph/definition/EphemeralTask.ts
|
|
2120
2201
|
var EphemeralTask = class extends Task {
|
|
2121
|
-
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) {
|
|
2202
|
+
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) {
|
|
2122
2203
|
super(
|
|
2123
2204
|
name,
|
|
2124
2205
|
task,
|
|
@@ -2132,7 +2213,11 @@ var EphemeralTask = class extends Task {
|
|
|
2132
2213
|
inputSchema,
|
|
2133
2214
|
validateInputContext,
|
|
2134
2215
|
outputSchema,
|
|
2135
|
-
validateOutputContext
|
|
2216
|
+
validateOutputContext,
|
|
2217
|
+
retryCount,
|
|
2218
|
+
retryDelay,
|
|
2219
|
+
retryDelayMax,
|
|
2220
|
+
retryDelayFactor
|
|
2136
2221
|
);
|
|
2137
2222
|
this.isEphemeral = true;
|
|
2138
2223
|
this.once = once;
|
|
@@ -2470,11 +2555,6 @@ var GraphRunStrategy = class {
|
|
|
2470
2555
|
}
|
|
2471
2556
|
};
|
|
2472
2557
|
|
|
2473
|
-
// src/utils/promise.ts
|
|
2474
|
-
function sleep(ms) {
|
|
2475
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
2558
|
// src/engine/ThrottleEngine.ts
|
|
2479
2559
|
var ThrottleEngine = class _ThrottleEngine {
|
|
2480
2560
|
constructor() {
|
|
@@ -2731,7 +2811,11 @@ var Cadenza = class {
|
|
|
2731
2811
|
inputSchema: void 0,
|
|
2732
2812
|
validateInputContext: false,
|
|
2733
2813
|
outputSchema: void 0,
|
|
2734
|
-
validateOutputContext: false
|
|
2814
|
+
validateOutputContext: false,
|
|
2815
|
+
retryCount: 0,
|
|
2816
|
+
retryDelay: 0,
|
|
2817
|
+
retryDelayMax: 0,
|
|
2818
|
+
retryDelayFactor: 1
|
|
2735
2819
|
}) {
|
|
2736
2820
|
this.bootstrap();
|
|
2737
2821
|
this.validateName(name);
|
|
@@ -2748,7 +2832,11 @@ var Cadenza = class {
|
|
|
2748
2832
|
options.inputSchema,
|
|
2749
2833
|
options.validateInputContext,
|
|
2750
2834
|
options.outputSchema,
|
|
2751
|
-
options.validateOutputContext
|
|
2835
|
+
options.validateOutputContext,
|
|
2836
|
+
options.retryCount,
|
|
2837
|
+
options.retryDelay,
|
|
2838
|
+
options.retryDelayMax,
|
|
2839
|
+
options.retryDelayFactor
|
|
2752
2840
|
);
|
|
2753
2841
|
}
|
|
2754
2842
|
/**
|
|
@@ -2771,7 +2859,11 @@ var Cadenza = class {
|
|
|
2771
2859
|
inputSchema: void 0,
|
|
2772
2860
|
validateInputContext: false,
|
|
2773
2861
|
outputSchema: void 0,
|
|
2774
|
-
validateOutputContext: false
|
|
2862
|
+
validateOutputContext: false,
|
|
2863
|
+
retryCount: 0,
|
|
2864
|
+
retryDelay: 0,
|
|
2865
|
+
retryDelayMax: 0,
|
|
2866
|
+
retryDelayFactor: 1
|
|
2775
2867
|
}) {
|
|
2776
2868
|
options.isMeta = true;
|
|
2777
2869
|
return this.createTask(name, func, description, options);
|
|
@@ -2796,7 +2888,11 @@ var Cadenza = class {
|
|
|
2796
2888
|
inputSchema: void 0,
|
|
2797
2889
|
validateInputContext: false,
|
|
2798
2890
|
outputSchema: void 0,
|
|
2799
|
-
validateOutputContext: false
|
|
2891
|
+
validateOutputContext: false,
|
|
2892
|
+
retryCount: 0,
|
|
2893
|
+
retryDelay: 0,
|
|
2894
|
+
retryDelayMax: 0,
|
|
2895
|
+
retryDelayFactor: 1
|
|
2800
2896
|
}) {
|
|
2801
2897
|
options.isUnique = true;
|
|
2802
2898
|
return this.createTask(name, func, description, options);
|
|
@@ -2819,7 +2915,11 @@ var Cadenza = class {
|
|
|
2819
2915
|
inputSchema: void 0,
|
|
2820
2916
|
validateInputContext: false,
|
|
2821
2917
|
outputSchema: void 0,
|
|
2822
|
-
validateOutputContext: false
|
|
2918
|
+
validateOutputContext: false,
|
|
2919
|
+
retryCount: 0,
|
|
2920
|
+
retryDelay: 0,
|
|
2921
|
+
retryDelayMax: 0,
|
|
2922
|
+
retryDelayFactor: 1
|
|
2823
2923
|
}) {
|
|
2824
2924
|
options.isMeta = true;
|
|
2825
2925
|
return this.createUniqueTask(name, func, description, options);
|
|
@@ -2843,7 +2943,11 @@ var Cadenza = class {
|
|
|
2843
2943
|
inputSchema: void 0,
|
|
2844
2944
|
validateInputContext: false,
|
|
2845
2945
|
outputSchema: void 0,
|
|
2846
|
-
validateOutputContext: false
|
|
2946
|
+
validateOutputContext: false,
|
|
2947
|
+
retryCount: 0,
|
|
2948
|
+
retryDelay: 0,
|
|
2949
|
+
retryDelayMax: 0,
|
|
2950
|
+
retryDelayFactor: 1
|
|
2847
2951
|
}) {
|
|
2848
2952
|
options.getTagCallback = throttledIdGetter;
|
|
2849
2953
|
return this.createTask(name, func, description, options);
|
|
@@ -2866,7 +2970,11 @@ var Cadenza = class {
|
|
|
2866
2970
|
inputSchema: void 0,
|
|
2867
2971
|
validateInputContext: false,
|
|
2868
2972
|
outputSchema: void 0,
|
|
2869
|
-
validateOutputContext: false
|
|
2973
|
+
validateOutputContext: false,
|
|
2974
|
+
retryCount: 0,
|
|
2975
|
+
retryDelay: 0,
|
|
2976
|
+
retryDelayMax: 0,
|
|
2977
|
+
retryDelayFactor: 1
|
|
2870
2978
|
}) {
|
|
2871
2979
|
options.isMeta = true;
|
|
2872
2980
|
return this.createThrottledTask(
|
|
@@ -2976,7 +3084,11 @@ var Cadenza = class {
|
|
|
2976
3084
|
inputSchema: void 0,
|
|
2977
3085
|
validateInputContext: false,
|
|
2978
3086
|
outputSchema: void 0,
|
|
2979
|
-
validateOutputContext: false
|
|
3087
|
+
validateOutputContext: false,
|
|
3088
|
+
retryCount: 0,
|
|
3089
|
+
retryDelay: 0,
|
|
3090
|
+
retryDelayMax: 0,
|
|
3091
|
+
retryDelayFactor: 1
|
|
2980
3092
|
}) {
|
|
2981
3093
|
this.bootstrap();
|
|
2982
3094
|
this.validateName(name);
|
|
@@ -2995,7 +3107,11 @@ var Cadenza = class {
|
|
|
2995
3107
|
options.inputSchema,
|
|
2996
3108
|
options.validateInputContext,
|
|
2997
3109
|
options.outputSchema,
|
|
2998
|
-
options.validateOutputContext
|
|
3110
|
+
options.validateOutputContext,
|
|
3111
|
+
options.retryCount,
|
|
3112
|
+
options.retryDelay,
|
|
3113
|
+
options.retryDelayMax,
|
|
3114
|
+
options.retryDelayFactor
|
|
2999
3115
|
);
|
|
3000
3116
|
}
|
|
3001
3117
|
/**
|
|
@@ -3018,7 +3134,11 @@ var Cadenza = class {
|
|
|
3018
3134
|
inputSchema: void 0,
|
|
3019
3135
|
validateInputContext: false,
|
|
3020
3136
|
outputSchema: void 0,
|
|
3021
|
-
validateOutputContext: false
|
|
3137
|
+
validateOutputContext: false,
|
|
3138
|
+
retryCount: 0,
|
|
3139
|
+
retryDelay: 0,
|
|
3140
|
+
retryDelayMax: 0,
|
|
3141
|
+
retryDelayFactor: 1
|
|
3022
3142
|
}) {
|
|
3023
3143
|
options.isMeta = true;
|
|
3024
3144
|
return this.createEphemeralTask(
|