@cadenza.io/core 1.7.11 → 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 +145 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -30
- 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
|
}
|
|
@@ -1260,9 +1324,13 @@ var Task = class extends SignalParticipant {
|
|
|
1260
1324
|
* @param validateInputContext
|
|
1261
1325
|
* @param outputSchema
|
|
1262
1326
|
* @param validateOutputContext
|
|
1327
|
+
* @param retryCount
|
|
1328
|
+
* @param retryDelay
|
|
1329
|
+
* @param retryDelayMax
|
|
1330
|
+
* @param retryDelayFactor
|
|
1263
1331
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
1264
1332
|
*/
|
|
1265
|
-
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) {
|
|
1266
1334
|
super();
|
|
1267
1335
|
this.isMeta = false;
|
|
1268
1336
|
this.isUnique = false;
|
|
@@ -1274,6 +1342,10 @@ var Task = class extends SignalParticipant {
|
|
|
1274
1342
|
this.validateInputContext = false;
|
|
1275
1343
|
this.outputContextSchema = void 0;
|
|
1276
1344
|
this.validateOutputContext = false;
|
|
1345
|
+
this.retryCount = 0;
|
|
1346
|
+
this.retryDelay = 0;
|
|
1347
|
+
this.retryDelayMax = 0;
|
|
1348
|
+
this.retryDelayFactor = 1;
|
|
1277
1349
|
this.layerIndex = 0;
|
|
1278
1350
|
this.progressWeight = 0;
|
|
1279
1351
|
this.nextTasks = /* @__PURE__ */ new Set();
|
|
@@ -1292,6 +1364,10 @@ var Task = class extends SignalParticipant {
|
|
|
1292
1364
|
this.validateInputContext = validateInputContext;
|
|
1293
1365
|
this.outputContextSchema = outputSchema;
|
|
1294
1366
|
this.validateOutputContext = validateOutputContext;
|
|
1367
|
+
this.retryCount = retryCount;
|
|
1368
|
+
this.retryDelay = retryDelay;
|
|
1369
|
+
this.retryDelayMax = retryDelayMax;
|
|
1370
|
+
this.retryDelayFactor = retryDelayFactor;
|
|
1295
1371
|
if (getTagCallback) {
|
|
1296
1372
|
this.getTag = (context) => getTagCallback(context, this);
|
|
1297
1373
|
this.throttled = true;
|
|
@@ -2123,7 +2199,7 @@ var DebounceTask = class extends Task {
|
|
|
2123
2199
|
|
|
2124
2200
|
// src/graph/definition/EphemeralTask.ts
|
|
2125
2201
|
var EphemeralTask = class extends Task {
|
|
2126
|
-
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) {
|
|
2127
2203
|
super(
|
|
2128
2204
|
name,
|
|
2129
2205
|
task,
|
|
@@ -2137,7 +2213,11 @@ var EphemeralTask = class extends Task {
|
|
|
2137
2213
|
inputSchema,
|
|
2138
2214
|
validateInputContext,
|
|
2139
2215
|
outputSchema,
|
|
2140
|
-
validateOutputContext
|
|
2216
|
+
validateOutputContext,
|
|
2217
|
+
retryCount,
|
|
2218
|
+
retryDelay,
|
|
2219
|
+
retryDelayMax,
|
|
2220
|
+
retryDelayFactor
|
|
2141
2221
|
);
|
|
2142
2222
|
this.isEphemeral = true;
|
|
2143
2223
|
this.once = once;
|
|
@@ -2475,11 +2555,6 @@ var GraphRunStrategy = class {
|
|
|
2475
2555
|
}
|
|
2476
2556
|
};
|
|
2477
2557
|
|
|
2478
|
-
// src/utils/promise.ts
|
|
2479
|
-
function sleep(ms) {
|
|
2480
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
2558
|
// src/engine/ThrottleEngine.ts
|
|
2484
2559
|
var ThrottleEngine = class _ThrottleEngine {
|
|
2485
2560
|
constructor() {
|
|
@@ -2736,7 +2811,11 @@ var Cadenza = class {
|
|
|
2736
2811
|
inputSchema: void 0,
|
|
2737
2812
|
validateInputContext: false,
|
|
2738
2813
|
outputSchema: void 0,
|
|
2739
|
-
validateOutputContext: false
|
|
2814
|
+
validateOutputContext: false,
|
|
2815
|
+
retryCount: 0,
|
|
2816
|
+
retryDelay: 0,
|
|
2817
|
+
retryDelayMax: 0,
|
|
2818
|
+
retryDelayFactor: 1
|
|
2740
2819
|
}) {
|
|
2741
2820
|
this.bootstrap();
|
|
2742
2821
|
this.validateName(name);
|
|
@@ -2753,7 +2832,11 @@ var Cadenza = class {
|
|
|
2753
2832
|
options.inputSchema,
|
|
2754
2833
|
options.validateInputContext,
|
|
2755
2834
|
options.outputSchema,
|
|
2756
|
-
options.validateOutputContext
|
|
2835
|
+
options.validateOutputContext,
|
|
2836
|
+
options.retryCount,
|
|
2837
|
+
options.retryDelay,
|
|
2838
|
+
options.retryDelayMax,
|
|
2839
|
+
options.retryDelayFactor
|
|
2757
2840
|
);
|
|
2758
2841
|
}
|
|
2759
2842
|
/**
|
|
@@ -2776,7 +2859,11 @@ var Cadenza = class {
|
|
|
2776
2859
|
inputSchema: void 0,
|
|
2777
2860
|
validateInputContext: false,
|
|
2778
2861
|
outputSchema: void 0,
|
|
2779
|
-
validateOutputContext: false
|
|
2862
|
+
validateOutputContext: false,
|
|
2863
|
+
retryCount: 0,
|
|
2864
|
+
retryDelay: 0,
|
|
2865
|
+
retryDelayMax: 0,
|
|
2866
|
+
retryDelayFactor: 1
|
|
2780
2867
|
}) {
|
|
2781
2868
|
options.isMeta = true;
|
|
2782
2869
|
return this.createTask(name, func, description, options);
|
|
@@ -2801,7 +2888,11 @@ var Cadenza = class {
|
|
|
2801
2888
|
inputSchema: void 0,
|
|
2802
2889
|
validateInputContext: false,
|
|
2803
2890
|
outputSchema: void 0,
|
|
2804
|
-
validateOutputContext: false
|
|
2891
|
+
validateOutputContext: false,
|
|
2892
|
+
retryCount: 0,
|
|
2893
|
+
retryDelay: 0,
|
|
2894
|
+
retryDelayMax: 0,
|
|
2895
|
+
retryDelayFactor: 1
|
|
2805
2896
|
}) {
|
|
2806
2897
|
options.isUnique = true;
|
|
2807
2898
|
return this.createTask(name, func, description, options);
|
|
@@ -2824,7 +2915,11 @@ var Cadenza = class {
|
|
|
2824
2915
|
inputSchema: void 0,
|
|
2825
2916
|
validateInputContext: false,
|
|
2826
2917
|
outputSchema: void 0,
|
|
2827
|
-
validateOutputContext: false
|
|
2918
|
+
validateOutputContext: false,
|
|
2919
|
+
retryCount: 0,
|
|
2920
|
+
retryDelay: 0,
|
|
2921
|
+
retryDelayMax: 0,
|
|
2922
|
+
retryDelayFactor: 1
|
|
2828
2923
|
}) {
|
|
2829
2924
|
options.isMeta = true;
|
|
2830
2925
|
return this.createUniqueTask(name, func, description, options);
|
|
@@ -2848,7 +2943,11 @@ var Cadenza = class {
|
|
|
2848
2943
|
inputSchema: void 0,
|
|
2849
2944
|
validateInputContext: false,
|
|
2850
2945
|
outputSchema: void 0,
|
|
2851
|
-
validateOutputContext: false
|
|
2946
|
+
validateOutputContext: false,
|
|
2947
|
+
retryCount: 0,
|
|
2948
|
+
retryDelay: 0,
|
|
2949
|
+
retryDelayMax: 0,
|
|
2950
|
+
retryDelayFactor: 1
|
|
2852
2951
|
}) {
|
|
2853
2952
|
options.getTagCallback = throttledIdGetter;
|
|
2854
2953
|
return this.createTask(name, func, description, options);
|
|
@@ -2871,7 +2970,11 @@ var Cadenza = class {
|
|
|
2871
2970
|
inputSchema: void 0,
|
|
2872
2971
|
validateInputContext: false,
|
|
2873
2972
|
outputSchema: void 0,
|
|
2874
|
-
validateOutputContext: false
|
|
2973
|
+
validateOutputContext: false,
|
|
2974
|
+
retryCount: 0,
|
|
2975
|
+
retryDelay: 0,
|
|
2976
|
+
retryDelayMax: 0,
|
|
2977
|
+
retryDelayFactor: 1
|
|
2875
2978
|
}) {
|
|
2876
2979
|
options.isMeta = true;
|
|
2877
2980
|
return this.createThrottledTask(
|
|
@@ -2981,7 +3084,11 @@ var Cadenza = class {
|
|
|
2981
3084
|
inputSchema: void 0,
|
|
2982
3085
|
validateInputContext: false,
|
|
2983
3086
|
outputSchema: void 0,
|
|
2984
|
-
validateOutputContext: false
|
|
3087
|
+
validateOutputContext: false,
|
|
3088
|
+
retryCount: 0,
|
|
3089
|
+
retryDelay: 0,
|
|
3090
|
+
retryDelayMax: 0,
|
|
3091
|
+
retryDelayFactor: 1
|
|
2985
3092
|
}) {
|
|
2986
3093
|
this.bootstrap();
|
|
2987
3094
|
this.validateName(name);
|
|
@@ -3000,7 +3107,11 @@ var Cadenza = class {
|
|
|
3000
3107
|
options.inputSchema,
|
|
3001
3108
|
options.validateInputContext,
|
|
3002
3109
|
options.outputSchema,
|
|
3003
|
-
options.validateOutputContext
|
|
3110
|
+
options.validateOutputContext,
|
|
3111
|
+
options.retryCount,
|
|
3112
|
+
options.retryDelay,
|
|
3113
|
+
options.retryDelayMax,
|
|
3114
|
+
options.retryDelayFactor
|
|
3004
3115
|
);
|
|
3005
3116
|
}
|
|
3006
3117
|
/**
|
|
@@ -3023,7 +3134,11 @@ var Cadenza = class {
|
|
|
3023
3134
|
inputSchema: void 0,
|
|
3024
3135
|
validateInputContext: false,
|
|
3025
3136
|
outputSchema: void 0,
|
|
3026
|
-
validateOutputContext: false
|
|
3137
|
+
validateOutputContext: false,
|
|
3138
|
+
retryCount: 0,
|
|
3139
|
+
retryDelay: 0,
|
|
3140
|
+
retryDelayMax: 0,
|
|
3141
|
+
retryDelayFactor: 1
|
|
3027
3142
|
}) {
|
|
3028
3143
|
options.isMeta = true;
|
|
3029
3144
|
return this.createEphemeralTask(
|