@cadenza.io/core 1.11.14 → 1.11.16

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.js CHANGED
@@ -1179,7 +1179,11 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1179
1179
  return newNodes;
1180
1180
  }
1181
1181
  differentiate(task) {
1182
+ var _a, _b;
1182
1183
  this.task = task;
1184
+ this.retryCount = task.retryCount;
1185
+ this.retryDelay = task.retryDelay;
1186
+ this.silent = task.isMeta && !this.debug || task.isSubMeta || ((_b = (_a = this.context) == null ? void 0 : _a.getMetadata()) == null ? void 0 : _b.__isSubMeta);
1183
1187
  return this;
1184
1188
  }
1185
1189
  migrate(ctx) {
@@ -3103,6 +3107,12 @@ var Cadenza = class {
3103
3107
  this.runner.setDebug(true);
3104
3108
  this.runner.setVerbose(true);
3105
3109
  }
3110
+ if (mode === "production") {
3111
+ this.broker.setDebug(false);
3112
+ this.broker.setVerbose(false);
3113
+ this.runner.setDebug(false);
3114
+ this.runner.setVerbose(false);
3115
+ }
3106
3116
  }
3107
3117
  /**
3108
3118
  * Validates a name for uniqueness and non-emptiness.
@@ -3123,26 +3133,28 @@ var Cadenza = class {
3123
3133
  * @returns The created Task instance.
3124
3134
  * @throws Error if name is invalid or duplicate in registry.
3125
3135
  */
3126
- static createTask(name, func, description, options = {
3127
- concurrency: 0,
3128
- timeout: 0,
3129
- register: true,
3130
- isUnique: false,
3131
- isMeta: false,
3132
- isSubMeta: false,
3133
- isHidden: false,
3134
- getTagCallback: void 0,
3135
- inputSchema: void 0,
3136
- validateInputContext: false,
3137
- outputSchema: void 0,
3138
- validateOutputContext: false,
3139
- retryCount: 0,
3140
- retryDelay: 0,
3141
- retryDelayMax: 0,
3142
- retryDelayFactor: 1
3143
- }) {
3136
+ static createTask(name, func, description, options = {}) {
3144
3137
  this.bootstrap();
3145
3138
  this.validateName(name);
3139
+ options = {
3140
+ concurrency: 0,
3141
+ timeout: 0,
3142
+ register: true,
3143
+ isUnique: false,
3144
+ isMeta: false,
3145
+ isSubMeta: false,
3146
+ isHidden: false,
3147
+ getTagCallback: void 0,
3148
+ inputSchema: void 0,
3149
+ validateInputContext: false,
3150
+ outputSchema: void 0,
3151
+ validateOutputContext: false,
3152
+ retryCount: 0,
3153
+ retryDelay: 0,
3154
+ retryDelayMax: 0,
3155
+ retryDelayFactor: 1,
3156
+ ...options
3157
+ };
3146
3158
  return new Task(
3147
3159
  name,
3148
3160
  func,
@@ -3175,24 +3187,7 @@ var Cadenza = class {
3175
3187
  * @returns The created MetaTask instance.
3176
3188
  * @throws Error if name invalid or duplicate.
3177
3189
  */
3178
- static createMetaTask(name, func, description, options = {
3179
- concurrency: 0,
3180
- timeout: 0,
3181
- register: true,
3182
- isUnique: false,
3183
- isMeta: true,
3184
- isSubMeta: false,
3185
- isHidden: false,
3186
- getTagCallback: void 0,
3187
- inputSchema: void 0,
3188
- validateInputContext: false,
3189
- outputSchema: void 0,
3190
- validateOutputContext: false,
3191
- retryCount: 0,
3192
- retryDelay: 0,
3193
- retryDelayMax: 0,
3194
- retryDelayFactor: 1
3195
- }) {
3190
+ static createMetaTask(name, func, description, options = {}) {
3196
3191
  options.isMeta = true;
3197
3192
  return this.createTask(name, func, description, options);
3198
3193
  }
@@ -3206,24 +3201,7 @@ var Cadenza = class {
3206
3201
  * @returns The created UniqueTask.
3207
3202
  * @throws Error if invalid.
3208
3203
  */
3209
- static createUniqueTask(name, func, description, options = {
3210
- concurrency: 0,
3211
- timeout: 0,
3212
- register: true,
3213
- isUnique: true,
3214
- isMeta: false,
3215
- isSubMeta: false,
3216
- isHidden: false,
3217
- getTagCallback: void 0,
3218
- inputSchema: void 0,
3219
- validateInputContext: false,
3220
- outputSchema: void 0,
3221
- validateOutputContext: false,
3222
- retryCount: 0,
3223
- retryDelay: 0,
3224
- retryDelayMax: 0,
3225
- retryDelayFactor: 1
3226
- }) {
3204
+ static createUniqueTask(name, func, description, options = {}) {
3227
3205
  options.isUnique = true;
3228
3206
  return this.createTask(name, func, description, options);
3229
3207
  }
@@ -3235,25 +3213,9 @@ var Cadenza = class {
3235
3213
  * @param options Optional task options.
3236
3214
  * @returns The created UniqueMetaTask.
3237
3215
  */
3238
- static createUniqueMetaTask(name, func, description, options = {
3239
- concurrency: 0,
3240
- timeout: 0,
3241
- register: true,
3242
- isUnique: true,
3243
- isMeta: true,
3244
- isSubMeta: false,
3245
- isHidden: false,
3246
- getTagCallback: void 0,
3247
- inputSchema: void 0,
3248
- validateInputContext: false,
3249
- outputSchema: void 0,
3250
- validateOutputContext: false,
3251
- retryCount: 0,
3252
- retryDelay: 0,
3253
- retryDelayMax: 0,
3254
- retryDelayFactor: 1
3255
- }) {
3216
+ static createUniqueMetaTask(name, func, description, options = {}) {
3256
3217
  options.isMeta = true;
3218
+ options.isUnique = true;
3257
3219
  return this.createUniqueTask(name, func, description, options);
3258
3220
  }
3259
3221
  /**
@@ -3266,23 +3228,8 @@ var Cadenza = class {
3266
3228
  * @returns The created ThrottledTask.
3267
3229
  * @edge If no getter, throttles per task ID; use for resource protection.
3268
3230
  */
3269
- static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {
3270
- concurrency: 1,
3271
- timeout: 0,
3272
- register: true,
3273
- isUnique: false,
3274
- isMeta: false,
3275
- isSubMeta: false,
3276
- isHidden: false,
3277
- inputSchema: void 0,
3278
- validateInputContext: false,
3279
- outputSchema: void 0,
3280
- validateOutputContext: false,
3281
- retryCount: 0,
3282
- retryDelay: 0,
3283
- retryDelayMax: 0,
3284
- retryDelayFactor: 1
3285
- }) {
3231
+ static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
3232
+ options.concurrency = 1;
3286
3233
  options.getTagCallback = throttledIdGetter;
3287
3234
  return this.createTask(name, func, description, options);
3288
3235
  }
@@ -3295,23 +3242,7 @@ var Cadenza = class {
3295
3242
  * @param options Optional task options.
3296
3243
  * @returns The created ThrottledMetaTask.
3297
3244
  */
3298
- static createThrottledMetaTask(name, func, throttledIdGetter, description, options = {
3299
- concurrency: 0,
3300
- timeout: 0,
3301
- register: true,
3302
- isUnique: false,
3303
- isMeta: true,
3304
- isSubMeta: false,
3305
- isHidden: false,
3306
- inputSchema: void 0,
3307
- validateInputContext: false,
3308
- outputSchema: void 0,
3309
- validateOutputContext: false,
3310
- retryCount: 0,
3311
- retryDelay: 0,
3312
- retryDelayMax: 0,
3313
- retryDelayFactor: 1
3314
- }) {
3245
+ static createThrottledMetaTask(name, func, throttledIdGetter, description, options = {}) {
3315
3246
  options.isMeta = true;
3316
3247
  return this.createThrottledTask(
3317
3248
  name,
@@ -3331,24 +3262,26 @@ var Cadenza = class {
3331
3262
  * @returns The created DebounceTask.
3332
3263
  * @edge Multiple triggers within time collapse to one exec.
3333
3264
  */
3334
- static createDebounceTask(name, func, description, debounceTime = 1e3, options = {
3335
- concurrency: 0,
3336
- timeout: 0,
3337
- register: true,
3338
- leading: false,
3339
- trailing: true,
3340
- maxWait: 0,
3341
- isUnique: false,
3342
- isMeta: false,
3343
- isSubMeta: false,
3344
- isHidden: false,
3345
- inputSchema: void 0,
3346
- validateInputContext: false,
3347
- outputSchema: void 0,
3348
- validateOutputContext: false
3349
- }) {
3265
+ static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
3350
3266
  this.bootstrap();
3351
3267
  this.validateName(name);
3268
+ options = {
3269
+ concurrency: 0,
3270
+ timeout: 0,
3271
+ register: true,
3272
+ leading: false,
3273
+ trailing: true,
3274
+ maxWait: 0,
3275
+ isUnique: false,
3276
+ isMeta: false,
3277
+ isSubMeta: false,
3278
+ isHidden: false,
3279
+ inputSchema: void 0,
3280
+ validateInputContext: false,
3281
+ outputSchema: void 0,
3282
+ validateOutputContext: false,
3283
+ ...options
3284
+ };
3352
3285
  return new DebounceTask(
3353
3286
  name,
3354
3287
  func,
@@ -3379,22 +3312,7 @@ var Cadenza = class {
3379
3312
  * @param options Optional task options plus optional debounce config (e.g., leading/trailing).
3380
3313
  * @returns The created DebouncedMetaTask.
3381
3314
  */
3382
- static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {
3383
- concurrency: 0,
3384
- timeout: 0,
3385
- register: true,
3386
- leading: false,
3387
- trailing: true,
3388
- maxWait: 0,
3389
- isUnique: false,
3390
- isMeta: false,
3391
- isSubMeta: false,
3392
- isHidden: false,
3393
- inputSchema: void 0,
3394
- validateInputContext: false,
3395
- outputSchema: void 0,
3396
- validateOutputContext: false
3397
- }) {
3315
+ static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
3398
3316
  options.isMeta = true;
3399
3317
  return this.createDebounceTask(
3400
3318
  name,
@@ -3414,28 +3332,30 @@ var Cadenza = class {
3414
3332
  * @returns The created EphemeralTask.
3415
3333
  * @edge Destruction triggered post-exec via Node/Builder; emits meta-signal for cleanup.
3416
3334
  */
3417
- static createEphemeralTask(name, func, description, options = {
3418
- concurrency: 0,
3419
- timeout: 0,
3420
- register: true,
3421
- isUnique: false,
3422
- isMeta: false,
3423
- isSubMeta: false,
3424
- isHidden: false,
3425
- once: true,
3426
- destroyCondition: () => true,
3427
- getTagCallback: void 0,
3428
- inputSchema: void 0,
3429
- validateInputContext: false,
3430
- outputSchema: void 0,
3431
- validateOutputContext: false,
3432
- retryCount: 0,
3433
- retryDelay: 0,
3434
- retryDelayMax: 0,
3435
- retryDelayFactor: 1
3436
- }) {
3335
+ static createEphemeralTask(name, func, description, options = {}) {
3437
3336
  this.bootstrap();
3438
3337
  this.validateName(name);
3338
+ options = {
3339
+ concurrency: 0,
3340
+ timeout: 0,
3341
+ register: true,
3342
+ isUnique: false,
3343
+ isMeta: false,
3344
+ isSubMeta: false,
3345
+ isHidden: false,
3346
+ once: true,
3347
+ destroyCondition: () => true,
3348
+ getTagCallback: void 0,
3349
+ inputSchema: void 0,
3350
+ validateInputContext: false,
3351
+ outputSchema: void 0,
3352
+ validateOutputContext: false,
3353
+ retryCount: 0,
3354
+ retryDelay: 0,
3355
+ retryDelayMax: 0,
3356
+ retryDelayFactor: 1,
3357
+ ...options
3358
+ };
3439
3359
  return new EphemeralTask(
3440
3360
  name,
3441
3361
  func,
@@ -3468,26 +3388,7 @@ var Cadenza = class {
3468
3388
  * @param options Optional task options plus optional "once" (true) and "destroyCondition" (ctx => boolean).
3469
3389
  * @returns The created EphemeralMetaTask.
3470
3390
  */
3471
- static createEphemeralMetaTask(name, func, description, options = {
3472
- concurrency: 0,
3473
- timeout: 0,
3474
- register: true,
3475
- isUnique: false,
3476
- isMeta: true,
3477
- isSubMeta: false,
3478
- isHidden: false,
3479
- once: true,
3480
- destroyCondition: () => true,
3481
- getTagCallback: void 0,
3482
- inputSchema: void 0,
3483
- validateInputContext: false,
3484
- outputSchema: void 0,
3485
- validateOutputContext: false,
3486
- retryCount: 0,
3487
- retryDelay: 0,
3488
- retryDelayMax: 0,
3489
- retryDelayFactor: 1
3490
- }) {
3391
+ static createEphemeralMetaTask(name, func, description, options = {}) {
3491
3392
  options.isMeta = true;
3492
3393
  return this.createEphemeralTask(name, func, description, options);
3493
3394
  }