@loadstrike/loadstrike-sdk 1.0.20801 → 1.0.21101

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.
@@ -42,14 +42,26 @@ export const LoadStrikeOperationType = {
42
42
  Error: "Error"
43
43
  };
44
44
  export class LoadStrikePluginDataTable {
45
+ /**
46
+ * Exposes the public constructor operation.
47
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
48
+ */
45
49
  constructor(tableName, headers = [], rows = []) {
46
50
  this.tableName = requireNonEmpty(tableName, "Table name must be provided.");
47
51
  this.headers = [...headers];
48
52
  this.rows = rows.map((row) => ({ ...row }));
49
53
  }
54
+ /**
55
+ * Creates a new instance of this public SDK type.
56
+ * Use this when you are starting a run definition from scratch.
57
+ */
50
58
  static create(tableName) {
51
59
  return new LoadStrikePluginDataTable(tableName);
52
60
  }
61
+ /**
62
+ * Creates a new instance of this public SDK type.
63
+ * Use this when you are starting a run definition from scratch.
64
+ */
53
65
  static Create(tableName) {
54
66
  return LoadStrikePluginDataTable.create(tableName);
55
67
  }
@@ -64,14 +76,26 @@ export class LoadStrikePluginDataTable {
64
76
  }
65
77
  }
66
78
  export class LoadStrikePluginData {
79
+ /**
80
+ * Exposes the public constructor operation.
81
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
82
+ */
67
83
  constructor(pluginName, tables = [], hints = []) {
68
84
  this.pluginName = requireNonEmpty(pluginName, "Plugin name must be provided.");
69
85
  this.tables = tables.map((table) => new LoadStrikePluginDataTable(table.tableName, table.headers, table.rows));
70
86
  this.hints = [...hints];
71
87
  }
88
+ /**
89
+ * Creates a new instance of this public SDK type.
90
+ * Use this when you are starting a run definition from scratch.
91
+ */
72
92
  static create(pluginName) {
73
93
  return new LoadStrikePluginData(pluginName);
74
94
  }
95
+ /**
96
+ * Creates a new instance of this public SDK type.
97
+ * Use this when you are starting a run definition from scratch.
98
+ */
75
99
  static Create(pluginName) {
76
100
  return LoadStrikePluginData.create(pluginName);
77
101
  }
@@ -96,6 +120,10 @@ class MeasurementAccumulator {
96
120
  get Count() {
97
121
  return this.count;
98
122
  }
123
+ /**
124
+ * Exposes the public record operation.
125
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
126
+ */
99
127
  record(reply, observedLatencyMs) {
100
128
  const latencyMs = resolveRecordedLatency(reply.customLatencyMs, observedLatencyMs);
101
129
  const sizeBytes = Math.max(toNumber(reply.sizeBytes), 0);
@@ -118,6 +146,10 @@ class MeasurementAccumulator {
118
146
  count: 1
119
147
  });
120
148
  }
149
+ /**
150
+ * Builds the configured payload or helper object.
151
+ * Use this when all builder inputs are ready to be materialized.
152
+ */
121
153
  build(allRequestCount, durationMs) {
122
154
  const count = this.count;
123
155
  const totalDurationMs = Math.max(durationMs, 0);
@@ -176,6 +208,10 @@ class StepStatsAccumulator {
176
208
  this.ok = new MeasurementAccumulator();
177
209
  this.fail = new MeasurementAccumulator();
178
210
  }
211
+ /**
212
+ * Exposes the public record operation.
213
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
214
+ */
179
215
  record(reply, observedLatencyMs) {
180
216
  if (reply.isSuccess) {
181
217
  this.ok.record(reply, observedLatencyMs);
@@ -183,6 +219,10 @@ class StepStatsAccumulator {
183
219
  }
184
220
  this.fail.record(reply, observedLatencyMs);
185
221
  }
222
+ /**
223
+ * Builds the configured payload or helper object.
224
+ * Use this when all builder inputs are ready to be materialized.
225
+ */
186
226
  build(allScenarioRequestCount, durationMs) {
187
227
  const ok = this.ok.build(allScenarioRequestCount, durationMs);
188
228
  const fail = this.fail.build(allScenarioRequestCount, durationMs);
@@ -222,18 +262,34 @@ class ScenarioStatsAccumulator {
222
262
  this.loadSimulationStats = { simulationName: "", value: 0 };
223
263
  this.currentOperation = "None";
224
264
  }
265
+ /**
266
+ * Exposes the public setLoadSimulation operation.
267
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
268
+ */
225
269
  setLoadSimulation(simulationName, value) {
226
270
  this.loadSimulationStats = {
227
271
  simulationName,
228
272
  value
229
273
  };
230
274
  }
275
+ /**
276
+ * Exposes the public setCurrentOperation operation.
277
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
278
+ */
231
279
  setCurrentOperation(operation) {
232
280
  this.currentOperation = operation;
233
281
  }
282
+ /**
283
+ * Returns current operation.
284
+ * Use this when current operation is required for branching, logging, or assertions.
285
+ */
234
286
  getCurrentOperation() {
235
287
  return this.currentOperation;
236
288
  }
289
+ /**
290
+ * Exposes the public recordScenario operation.
291
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
292
+ */
237
293
  recordScenario(reply, observedLatencyMs) {
238
294
  if (reply.isSuccess) {
239
295
  this.ok.record(reply, observedLatencyMs);
@@ -241,6 +297,10 @@ class ScenarioStatsAccumulator {
241
297
  }
242
298
  this.fail.record(reply, observedLatencyMs);
243
299
  }
300
+ /**
301
+ * Exposes the public recordStep operation.
302
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
303
+ */
244
304
  recordStep(stepName, reply, observedLatencyMs) {
245
305
  const existing = this.steps.get(stepName);
246
306
  const step = existing ?? new StepStatsAccumulator(this.scenarioName, stepName, this.nextStepSortIndex += 1);
@@ -249,6 +309,10 @@ class ScenarioStatsAccumulator {
249
309
  }
250
310
  step.record(reply, observedLatencyMs);
251
311
  }
312
+ /**
313
+ * Builds the configured payload or helper object.
314
+ * Use this when all builder inputs are ready to be materialized.
315
+ */
252
316
  build(durationMs) {
253
317
  const totalRequests = this.ok.Count + this.fail.Count;
254
318
  const ok = this.ok.build(totalRequests, durationMs);
@@ -293,6 +357,10 @@ class ScenarioStatsAccumulator {
293
357
  }
294
358
  }
295
359
  export class LoadStrikeResponse {
360
+ /**
361
+ * Creates a successful reply.
362
+ * Use this when a step or scenario completed successfully and should report a success response.
363
+ */
296
364
  static ok(...args) {
297
365
  const normalized = normalizeSuccessResponseCall(args);
298
366
  const reply = {
@@ -305,6 +373,10 @@ export class LoadStrikeResponse {
305
373
  };
306
374
  return attachReplyProjection(reply);
307
375
  }
376
+ /**
377
+ * Creates a successful reply.
378
+ * Use this when a step or scenario completed successfully and should report a success response.
379
+ */
308
380
  static Ok(...args) {
309
381
  return LoadStrikeResponse.ok(...args);
310
382
  }
@@ -314,6 +386,10 @@ export class LoadStrikeResponse {
314
386
  static OkWithPayload(payload, statusCode = "200", sizeBytesOrMessage = 0, messageOrSizeBytes = "", customLatencyMs) {
315
387
  return LoadStrikeResponse.okWithPayload(payload, statusCode, sizeBytesOrMessage, messageOrSizeBytes, customLatencyMs);
316
388
  }
389
+ /**
390
+ * Creates a failed reply.
391
+ * Use this when a step or scenario should record an explicit failure response.
392
+ */
317
393
  static fail(...args) {
318
394
  const normalized = normalizeFailureResponseCall(args);
319
395
  const reply = {
@@ -326,6 +402,10 @@ export class LoadStrikeResponse {
326
402
  };
327
403
  return attachReplyProjection(reply);
328
404
  }
405
+ /**
406
+ * Creates a failed reply.
407
+ * Use this when a step or scenario should record an explicit failure response.
408
+ */
329
409
  static Fail(...args) {
330
410
  return LoadStrikeResponse.fail(...args);
331
411
  }
@@ -374,6 +454,10 @@ export class LoadStrikeStep {
374
454
  }
375
455
  }
376
456
  export class LoadStrikeSimulation {
457
+ /**
458
+ * Builds a constant injection load shape.
459
+ * Use this when requests should be injected at a fixed rate over a duration.
460
+ */
377
461
  static inject(rate, intervalSeconds, duringSeconds) {
378
462
  return attachLoadSimulationProjection({
379
463
  Kind: "Inject",
@@ -382,9 +466,17 @@ export class LoadStrikeSimulation {
382
466
  DuringSeconds: duringSeconds
383
467
  });
384
468
  }
469
+ /**
470
+ * Builds a constant injection load shape.
471
+ * Use this when requests should be injected at a fixed rate over a duration.
472
+ */
385
473
  static Inject(rate, intervalSeconds, duringSeconds) {
386
474
  return LoadStrikeSimulation.inject(rate, intervalSeconds, duringSeconds);
387
475
  }
476
+ /**
477
+ * Builds an iteration-limited constant-concurrency load shape.
478
+ * Use this when a fixed number of iterations should be shared across constant workers.
479
+ */
388
480
  static iterationsForConstant(copies, iterations) {
389
481
  return attachLoadSimulationProjection({
390
482
  Kind: "IterationsForConstant",
@@ -392,9 +484,17 @@ export class LoadStrikeSimulation {
392
484
  Iterations: iterations
393
485
  });
394
486
  }
487
+ /**
488
+ * Builds an iteration-limited constant-concurrency load shape.
489
+ * Use this when a fixed number of iterations should be shared across constant workers.
490
+ */
395
491
  static IterationsForConstant(copies, iterations) {
396
492
  return LoadStrikeSimulation.iterationsForConstant(copies, iterations);
397
493
  }
494
+ /**
495
+ * Builds an iteration-limited injection load shape.
496
+ * Use this when a fixed number of injected iterations should be executed.
497
+ */
398
498
  static iterationsForInject(rate, intervalSeconds, iterations) {
399
499
  return attachLoadSimulationProjection({
400
500
  Kind: "IterationsForInject",
@@ -403,9 +503,17 @@ export class LoadStrikeSimulation {
403
503
  Iterations: iterations
404
504
  });
405
505
  }
506
+ /**
507
+ * Builds an iteration-limited injection load shape.
508
+ * Use this when a fixed number of injected iterations should be executed.
509
+ */
406
510
  static IterationsForInject(rate, intervalSeconds, iterations) {
407
511
  return LoadStrikeSimulation.iterationsForInject(rate, intervalSeconds, iterations);
408
512
  }
513
+ /**
514
+ * Builds a constant-concurrency load shape.
515
+ * Use this when a fixed number of virtual users should stay active.
516
+ */
409
517
  static keepConstant(copies, duringSeconds) {
410
518
  return attachLoadSimulationProjection({
411
519
  Kind: "KeepConstant",
@@ -413,9 +521,17 @@ export class LoadStrikeSimulation {
413
521
  DuringSeconds: duringSeconds
414
522
  });
415
523
  }
524
+ /**
525
+ * Builds a constant-concurrency load shape.
526
+ * Use this when a fixed number of virtual users should stay active.
527
+ */
416
528
  static KeepConstant(copies, duringSeconds) {
417
529
  return LoadStrikeSimulation.keepConstant(copies, duringSeconds);
418
530
  }
531
+ /**
532
+ * Builds a randomized injection load shape.
533
+ * Use this when traffic should fluctuate between a minimum and maximum rate.
534
+ */
419
535
  static injectRandom(minRate, maxRate, intervalSeconds, duringSeconds) {
420
536
  return attachLoadSimulationProjection({
421
537
  Kind: "InjectRandom",
@@ -425,9 +541,17 @@ export class LoadStrikeSimulation {
425
541
  DuringSeconds: duringSeconds
426
542
  });
427
543
  }
544
+ /**
545
+ * Builds a randomized injection load shape.
546
+ * Use this when traffic should fluctuate between a minimum and maximum rate.
547
+ */
428
548
  static InjectRandom(minRate, maxRate, intervalSeconds, duringSeconds) {
429
549
  return LoadStrikeSimulation.injectRandom(minRate, maxRate, intervalSeconds, duringSeconds);
430
550
  }
551
+ /**
552
+ * Builds a ramping injection load shape.
553
+ * Use this when request rate should increase over time.
554
+ */
431
555
  static rampingInject(rate, intervalSeconds, duringSeconds) {
432
556
  return attachLoadSimulationProjection({
433
557
  Kind: "RampingInject",
@@ -436,9 +560,17 @@ export class LoadStrikeSimulation {
436
560
  DuringSeconds: duringSeconds
437
561
  });
438
562
  }
563
+ /**
564
+ * Builds a ramping injection load shape.
565
+ * Use this when request rate should increase over time.
566
+ */
439
567
  static RampingInject(rate, intervalSeconds, duringSeconds) {
440
568
  return LoadStrikeSimulation.rampingInject(rate, intervalSeconds, duringSeconds);
441
569
  }
570
+ /**
571
+ * Builds a ramping-concurrency load shape.
572
+ * Use this when the number of active virtual users should climb over time.
573
+ */
442
574
  static rampingConstant(copies, duringSeconds) {
443
575
  return attachLoadSimulationProjection({
444
576
  Kind: "RampingConstant",
@@ -446,20 +578,36 @@ export class LoadStrikeSimulation {
446
578
  DuringSeconds: duringSeconds
447
579
  });
448
580
  }
581
+ /**
582
+ * Builds a ramping-concurrency load shape.
583
+ * Use this when the number of active virtual users should climb over time.
584
+ */
449
585
  static RampingConstant(copies, duringSeconds) {
450
586
  return LoadStrikeSimulation.rampingConstant(copies, duringSeconds);
451
587
  }
588
+ /**
589
+ * Builds a pause segment in a load profile.
590
+ * Use this when a simulation should intentionally idle for a period.
591
+ */
452
592
  static pause(duringSeconds) {
453
593
  return attachLoadSimulationProjection({
454
594
  Kind: "Pause",
455
595
  DuringSeconds: duringSeconds
456
596
  });
457
597
  }
598
+ /**
599
+ * Builds a pause segment in a load profile.
600
+ * Use this when a simulation should intentionally idle for a period.
601
+ */
458
602
  static Pause(duringSeconds) {
459
603
  return LoadStrikeSimulation.pause(duringSeconds);
460
604
  }
461
605
  }
462
606
  export class LoadStrikeCounter {
607
+ /**
608
+ * Exposes the public constructor operation.
609
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
610
+ */
463
611
  constructor(name, initialValueOrUnit = 0, unitOfMeasure = "") {
464
612
  this.type = "counter";
465
613
  this.name = requireNonEmpty(name, "Metric name is required.");
@@ -470,20 +618,40 @@ export class LoadStrikeCounter {
470
618
  ? 0
471
619
  : (Number.isFinite(initialValueOrUnit) ? Number(initialValueOrUnit) : 0);
472
620
  }
621
+ /**
622
+ * Adds a value to the current metric.
623
+ * Use this when a counter or gauge should be incremented by an explicit delta.
624
+ */
473
625
  add(value) {
474
626
  const next = Number.isFinite(value) ? Number(value) : 0;
475
627
  this.current += next;
476
628
  return this.current;
477
629
  }
630
+ /**
631
+ * Increments the current metric by one.
632
+ * Use this when events should simply be counted.
633
+ */
478
634
  increment(by = 1) {
479
635
  return this.add(by);
480
636
  }
637
+ /**
638
+ * Returns the current metric value.
639
+ * Use this when custom metric state needs to be inspected inside user code.
640
+ */
481
641
  value() {
482
642
  return this.current;
483
643
  }
644
+ /**
645
+ * Adds a value to the current metric.
646
+ * Use this when a counter or gauge should be incremented by an explicit delta.
647
+ */
484
648
  Add(value) {
485
649
  return this.add(value);
486
650
  }
651
+ /**
652
+ * Increments the current metric by one.
653
+ * Use this when events should simply be counted.
654
+ */
487
655
  Increment(by = 1) {
488
656
  return this.increment(by);
489
657
  }
@@ -498,6 +666,10 @@ export class LoadStrikeCounter {
498
666
  }
499
667
  }
500
668
  export class LoadStrikeGauge {
669
+ /**
670
+ * Exposes the public constructor operation.
671
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
672
+ */
501
673
  constructor(name, initialValueOrUnit = 0, unitOfMeasure = "") {
502
674
  this.type = "gauge";
503
675
  this.name = requireNonEmpty(name, "Metric name is required.");
@@ -508,33 +680,69 @@ export class LoadStrikeGauge {
508
680
  ? 0
509
681
  : (Number.isFinite(initialValueOrUnit) ? Number(initialValueOrUnit) : 0);
510
682
  }
683
+ /**
684
+ * Sets the current gauge value.
685
+ * Use this when the latest observed value should replace the previous one.
686
+ */
511
687
  set(value) {
512
688
  this.current = Number.isFinite(value) ? Number(value) : 0;
513
689
  return this.current;
514
690
  }
691
+ /**
692
+ * Adds a value to the current metric.
693
+ * Use this when a counter or gauge should be incremented by an explicit delta.
694
+ */
515
695
  add(value) {
516
696
  const next = Number.isFinite(value) ? Number(value) : 0;
517
697
  this.current += next;
518
698
  return this.current;
519
699
  }
700
+ /**
701
+ * Increments the current metric by one.
702
+ * Use this when events should simply be counted.
703
+ */
520
704
  increment(by = 1) {
521
705
  return this.add(by);
522
706
  }
707
+ /**
708
+ * Decrements the current metric by one.
709
+ * Use this when a gauge should move down by a single unit.
710
+ */
523
711
  decrement(by = 1) {
524
712
  return this.add(-by);
525
713
  }
714
+ /**
715
+ * Returns the current metric value.
716
+ * Use this when custom metric state needs to be inspected inside user code.
717
+ */
526
718
  value() {
527
719
  return this.current;
528
720
  }
721
+ /**
722
+ * Sets the current gauge value.
723
+ * Use this when the latest observed value should replace the previous one.
724
+ */
529
725
  Set(value) {
530
726
  return this.set(value);
531
727
  }
728
+ /**
729
+ * Adds a value to the current metric.
730
+ * Use this when a counter or gauge should be incremented by an explicit delta.
731
+ */
532
732
  Add(value) {
533
733
  return this.add(value);
534
734
  }
735
+ /**
736
+ * Increments the current metric by one.
737
+ * Use this when events should simply be counted.
738
+ */
535
739
  Increment(by = 1) {
536
740
  return this.increment(by);
537
741
  }
742
+ /**
743
+ * Decrements the current metric by one.
744
+ * Use this when a gauge should move down by a single unit.
745
+ */
538
746
  Decrement(by = 1) {
539
747
  return this.decrement(by);
540
748
  }
@@ -549,21 +757,45 @@ export class LoadStrikeGauge {
549
757
  }
550
758
  }
551
759
  export class LoadStrikeMetric {
760
+ /**
761
+ * Creates a counter metric.
762
+ * Use this when a scenario should accumulate a monotonically increasing custom metric.
763
+ */
552
764
  static counter(name, initialValueOrUnit = 0, unitOfMeasure = "") {
553
765
  return new LoadStrikeCounter(name, initialValueOrUnit, unitOfMeasure);
554
766
  }
767
+ /**
768
+ * Creates a gauge metric.
769
+ * Use this when a scenario should track the latest value of a custom metric.
770
+ */
555
771
  static gauge(name, initialValueOrUnit = 0, unitOfMeasure = "") {
556
772
  return new LoadStrikeGauge(name, initialValueOrUnit, unitOfMeasure);
557
773
  }
774
+ /**
775
+ * Creates a counter metric.
776
+ * Use this when a scenario should accumulate a monotonically increasing custom metric.
777
+ */
558
778
  static Counter(name, initialValueOrUnit = 0, unitOfMeasure = "") {
559
779
  return LoadStrikeMetric.counter(name, initialValueOrUnit, unitOfMeasure);
560
780
  }
781
+ /**
782
+ * Creates a gauge metric.
783
+ * Use this when a scenario should track the latest value of a custom metric.
784
+ */
561
785
  static Gauge(name, initialValueOrUnit = 0, unitOfMeasure = "") {
562
786
  return LoadStrikeMetric.gauge(name, initialValueOrUnit, unitOfMeasure);
563
787
  }
788
+ /**
789
+ * Creates a counter metric.
790
+ * Use this when a scenario should accumulate a monotonically increasing custom metric.
791
+ */
564
792
  static CreateCounter(name, unitOfMeasure = "") {
565
793
  return new LoadStrikeCounter(name, 0, unitOfMeasure);
566
794
  }
795
+ /**
796
+ * Creates a gauge metric.
797
+ * Use this when a scenario should track the latest value of a custom metric.
798
+ */
567
799
  static CreateGauge(name, unitOfMeasure = "") {
568
800
  return new LoadStrikeGauge(name, 0, unitOfMeasure);
569
801
  }
@@ -684,15 +916,31 @@ export class LoadStrikeContext {
684
916
  this.registeredScenarios = [...registeredScenarios];
685
917
  this.runArgs = [...runArgs];
686
918
  }
919
+ /**
920
+ * Creates a new instance of this public SDK type.
921
+ * Use this when you are starting a run definition from scratch.
922
+ */
687
923
  static create() {
688
924
  return new LoadStrikeContext();
689
925
  }
926
+ /**
927
+ * Exposes the public toObject operation.
928
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
929
+ */
690
930
  toObject() {
691
931
  return { ...this.values };
692
932
  }
933
+ /**
934
+ * Builds the current configuration into a runnable context.
935
+ * Use this when you want to inspect or reuse the final run settings before execution.
936
+ */
693
937
  buildContext() {
694
938
  return this;
695
939
  }
940
+ /**
941
+ * Builds the current configuration into a runnable context.
942
+ * Use this when you want to inspect or reuse the final run settings before execution.
943
+ */
696
944
  BuildContext() {
697
945
  return this.buildContext();
698
946
  }
@@ -714,6 +962,10 @@ export class LoadStrikeContext {
714
962
  const args = normalizeRunArgsInput(argsOrSingleArray);
715
963
  return this.run(args);
716
964
  }
965
+ /**
966
+ * Exposes the public toRunnerOptions operation.
967
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
968
+ */
717
969
  toRunnerOptions() {
718
970
  const normalizedValues = normalizeRunContextCollectionShapes(this.values);
719
971
  return {
@@ -786,27 +1038,59 @@ export class LoadStrikeContext {
786
1038
  Configure(input) {
787
1039
  return this.configure(input);
788
1040
  }
1041
+ /**
1042
+ * Copies settings from an existing context snapshot.
1043
+ * Use this when a runner should inherit configuration that was already assembled elsewhere.
1044
+ */
789
1045
  configureContext(context) {
790
1046
  return this.configure(context);
791
1047
  }
1048
+ /**
1049
+ * Copies settings from an existing context snapshot.
1050
+ * Use this when a runner should inherit configuration that was already assembled elsewhere.
1051
+ */
792
1052
  ConfigureContext(context) {
793
1053
  return this.configureContext(context);
794
1054
  }
1055
+ /**
1056
+ * Toggles realtime console metric output.
1057
+ * Use this when a local run or CI log should stream live throughput and latency updates.
1058
+ */
795
1059
  displayConsoleMetrics(enable) {
796
1060
  return this.DisplayConsoleMetrics(enable);
797
1061
  }
1062
+ /**
1063
+ * Toggles realtime console metric output.
1064
+ * Use this when a local run or CI log should stream live throughput and latency updates.
1065
+ */
798
1066
  DisplayConsoleMetrics(enable) {
799
1067
  return this.mergeValues({ ConsoleMetricsEnabled: Boolean(enable) });
800
1068
  }
1069
+ /**
1070
+ * Toggles local development cluster mode.
1071
+ * Use this when you want to simulate coordinator and agent behavior on a single machine.
1072
+ */
801
1073
  enableLocalDevCluster(enable) {
802
1074
  return this.EnableLocalDevCluster(enable);
803
1075
  }
1076
+ /**
1077
+ * Toggles local development cluster mode.
1078
+ * Use this when you want to simulate coordinator and agent behavior on a single machine.
1079
+ */
804
1080
  EnableLocalDevCluster(enable) {
805
1081
  return this.mergeValues({ LocalDevClusterEnabled: Boolean(enable) });
806
1082
  }
1083
+ /**
1084
+ * Loads run settings from a JSON config file.
1085
+ * Use this when configuration should come from a checked-in or generated config document.
1086
+ */
807
1087
  loadConfig(path) {
808
1088
  return this.LoadConfig(path);
809
1089
  }
1090
+ /**
1091
+ * Loads run settings from a JSON config file.
1092
+ * Use this when configuration should come from a checked-in or generated config document.
1093
+ */
810
1094
  LoadConfig(path) {
811
1095
  const configPath = requireNonEmpty(path, "Config path must be provided.");
812
1096
  const loaded = loadJsonObject(configPath);
@@ -816,9 +1100,17 @@ export class LoadStrikeContext {
816
1100
  ...extractContextOverridesFromConfig(loaded)
817
1101
  });
818
1102
  }
1103
+ /**
1104
+ * Loads infrastructure settings for sinks, plugins, or transport dependencies.
1105
+ * Use this when runtime integrations depend on external connection details.
1106
+ */
819
1107
  loadInfraConfig(path) {
820
1108
  return this.LoadInfraConfig(path);
821
1109
  }
1110
+ /**
1111
+ * Loads infrastructure settings for sinks, plugins, or transport dependencies.
1112
+ * Use this when runtime integrations depend on external connection details.
1113
+ */
822
1114
  LoadInfraConfig(path) {
823
1115
  const infraConfigPath = requireNonEmpty(path, "Infra config path must be provided.");
824
1116
  return this.mergeValues({
@@ -826,87 +1118,191 @@ export class LoadStrikeContext {
826
1118
  InfraConfig: loadJsonObject(infraConfigPath)
827
1119
  });
828
1120
  }
1121
+ /**
1122
+ * Sets the agent group for this node or run.
1123
+ * Use this when only a subset of agents should pick up a particular workload.
1124
+ */
829
1125
  withAgentGroup(agentGroup) {
830
1126
  return this.WithAgentGroup(agentGroup);
831
1127
  }
1128
+ /**
1129
+ * Sets the agent group for this node or run.
1130
+ * Use this when only a subset of agents should pick up a particular workload.
1131
+ */
832
1132
  WithAgentGroup(agentGroup) {
833
1133
  return this.mergeValues({ AgentGroup: requireNonEmpty(agentGroup, "Agent group must be provided.") });
834
1134
  }
1135
+ /**
1136
+ * Sets the requested agent count.
1137
+ * Use this when a coordinator should fan work out across a specific number of agents.
1138
+ */
835
1139
  withAgentsCount(agentsCount) {
836
1140
  return this.WithAgentsCount(agentsCount);
837
1141
  }
1142
+ /**
1143
+ * Sets the requested agent count.
1144
+ * Use this when a coordinator should fan work out across a specific number of agents.
1145
+ */
838
1146
  WithAgentsCount(agentsCount) {
839
1147
  if (!Number.isFinite(agentsCount) || agentsCount <= 0) {
840
1148
  throw new RangeError("Agents count should be greater than zero.");
841
1149
  }
842
1150
  return this.mergeValues({ AgentsCount: Math.trunc(agentsCount) });
843
1151
  }
1152
+ /**
1153
+ * Targets a shared set of scenarios.
1154
+ * Use this when only selected scenarios should execute for the current node or run.
1155
+ */
844
1156
  withTargetScenarios(...scenarioNames) {
845
1157
  return this.WithTargetScenarios(...scenarioNames);
846
1158
  }
1159
+ /**
1160
+ * Targets a shared set of scenarios.
1161
+ * Use this when only selected scenarios should execute for the current node or run.
1162
+ */
847
1163
  WithTargetScenarios(...scenarioNames) {
848
1164
  return this.mergeValues({ TargetScenarios: validateScenarioNames(scenarioNames) });
849
1165
  }
1166
+ /**
1167
+ * Targets scenarios for agent nodes only.
1168
+ * Use this when agents should execute only a subset of the registered scenarios.
1169
+ */
850
1170
  withAgentTargetScenarios(...scenarioNames) {
851
1171
  return this.WithAgentTargetScenarios(...scenarioNames);
852
1172
  }
1173
+ /**
1174
+ * Targets scenarios for agent nodes only.
1175
+ * Use this when agents should execute only a subset of the registered scenarios.
1176
+ */
853
1177
  WithAgentTargetScenarios(...scenarioNames) {
854
1178
  return this.mergeValues({ AgentTargetScenarios: validateScenarioNames(scenarioNames) });
855
1179
  }
1180
+ /**
1181
+ * Targets scenarios for the coordinator only.
1182
+ * Use this when orchestration or control-node work should run on the coordinator itself.
1183
+ */
856
1184
  withCoordinatorTargetScenarios(...scenarioNames) {
857
1185
  return this.WithCoordinatorTargetScenarios(...scenarioNames);
858
1186
  }
1187
+ /**
1188
+ * Targets scenarios for the coordinator only.
1189
+ * Use this when orchestration or control-node work should run on the coordinator itself.
1190
+ */
859
1191
  WithCoordinatorTargetScenarios(...scenarioNames) {
860
1192
  return this.mergeValues({ CoordinatorTargetScenarios: validateScenarioNames(scenarioNames) });
861
1193
  }
1194
+ /**
1195
+ * Sets the runner key used for licensing validation.
1196
+ * Use this when the run must authenticate against the licensing API before it starts.
1197
+ */
862
1198
  withRunnerKey(runnerKey) {
863
1199
  return this.WithRunnerKey(runnerKey);
864
1200
  }
1201
+ /**
1202
+ * Sets the runner key used for licensing validation.
1203
+ * Use this when the run must authenticate against the licensing API before it starts.
1204
+ */
865
1205
  WithRunnerKey(runnerKey) {
866
1206
  return this.mergeValues({ RunnerKey: requireNonEmpty(runnerKey, "Runner key must be provided.") });
867
1207
  }
1208
+ /**
1209
+ * Sets how long the SDK waits for licensing validation to complete.
1210
+ * Use this when control-plane latency or private networking requires a longer validation window.
1211
+ */
868
1212
  withLicenseValidationTimeout(timeoutSeconds) {
869
1213
  return this.WithLicenseValidationTimeout(timeoutSeconds);
870
1214
  }
1215
+ /**
1216
+ * Sets how long the SDK waits for licensing validation to complete.
1217
+ * Use this when control-plane latency or private networking requires a longer validation window.
1218
+ */
871
1219
  WithLicenseValidationTimeout(timeoutSeconds) {
872
1220
  if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
873
1221
  throw new RangeError("License validation timeout should be greater than zero.");
874
1222
  }
875
1223
  return this.mergeValues({ LicenseValidationTimeoutSeconds: timeoutSeconds });
876
1224
  }
1225
+ /**
1226
+ * Sets the runtime node type.
1227
+ * Use this when a process should behave as a single node, coordinator, or agent.
1228
+ */
877
1229
  withNodeType(nodeType) {
878
1230
  return this.WithNodeType(nodeType);
879
1231
  }
1232
+ /**
1233
+ * Sets the runtime node type.
1234
+ * Use this when a process should behave as a single node, coordinator, or agent.
1235
+ */
880
1236
  WithNodeType(nodeType) {
881
1237
  return this.mergeValues({ NodeType: parseNodeTypeToken(nodeType) });
882
1238
  }
1239
+ /**
1240
+ * Sets the NATS server URL used for distributed cluster coordination.
1241
+ * Use this when coordinator and agent nodes communicate over NATS.
1242
+ */
883
1243
  withNatsServerUrl(natsUrl) {
884
1244
  return this.WithNatsServerUrl(natsUrl);
885
1245
  }
1246
+ /**
1247
+ * Sets the NATS server URL used for distributed cluster coordination.
1248
+ * Use this when coordinator and agent nodes communicate over NATS.
1249
+ */
886
1250
  WithNatsServerUrl(natsUrl) {
887
1251
  return this.mergeValues({ NatsServerUrl: requireNonEmpty(natsUrl, "NATS server URL must be provided.") });
888
1252
  }
1253
+ /**
1254
+ * Disables local report generation.
1255
+ * Use this when reports are unnecessary or should be handled exclusively by sinks.
1256
+ */
889
1257
  withoutReports() {
890
1258
  return this.WithoutReports();
891
1259
  }
1260
+ /**
1261
+ * Disables local report generation.
1262
+ * Use this when reports are unnecessary or should be handled exclusively by sinks.
1263
+ */
892
1264
  WithoutReports() {
893
1265
  return this.mergeValues({ ReportsEnabled: false });
894
1266
  }
1267
+ /**
1268
+ * Sets the base file name for generated reports.
1269
+ * Use this when exported reports should use a predictable naming convention.
1270
+ */
895
1271
  withReportFileName(reportFileName) {
896
1272
  return this.WithReportFileName(reportFileName);
897
1273
  }
1274
+ /**
1275
+ * Sets the base file name for generated reports.
1276
+ * Use this when exported reports should use a predictable naming convention.
1277
+ */
898
1278
  WithReportFileName(reportFileName) {
899
1279
  return this.mergeValues({ ReportFileName: requireNonEmpty(reportFileName, "Report file name must be provided.") });
900
1280
  }
1281
+ /**
1282
+ * Sets the output folder for generated reports.
1283
+ * Use this when report files should land in a specific directory.
1284
+ */
901
1285
  withReportFolder(reportFolderPath) {
902
1286
  return this.WithReportFolder(reportFolderPath);
903
1287
  }
1288
+ /**
1289
+ * Sets the output folder for generated reports.
1290
+ * Use this when report files should land in a specific directory.
1291
+ */
904
1292
  WithReportFolder(reportFolderPath) {
905
1293
  return this.mergeValues({ ReportFolderPath: requireNonEmpty(reportFolderPath, "Report folder path must be provided.") });
906
1294
  }
1295
+ /**
1296
+ * Restricts generated reports to specific formats.
1297
+ * Use this when you want only selected report artifacts such as HTML, CSV, or Markdown.
1298
+ */
907
1299
  withReportFormats(...reportFormats) {
908
1300
  return this.WithReportFormats(...reportFormats);
909
1301
  }
1302
+ /**
1303
+ * Restricts generated reports to specific formats.
1304
+ * Use this when you want only selected report artifacts such as HTML, CSV, or Markdown.
1305
+ */
910
1306
  WithReportFormats(...reportFormats) {
911
1307
  if (!reportFormats.length) {
912
1308
  throw new Error("At least one report format should be provided.");
@@ -917,18 +1313,34 @@ export class LoadStrikeContext {
917
1313
  }
918
1314
  return this.mergeValues({ ReportFormats: normalized });
919
1315
  }
1316
+ /**
1317
+ * Sets the realtime reporting cadence.
1318
+ * Use this when sinks or dashboards should receive updates at a controlled interval.
1319
+ */
920
1320
  withReportingInterval(intervalSeconds) {
921
1321
  return this.WithReportingInterval(intervalSeconds);
922
1322
  }
1323
+ /**
1324
+ * Sets the realtime reporting cadence.
1325
+ * Use this when sinks or dashboards should receive updates at a controlled interval.
1326
+ */
923
1327
  WithReportingInterval(intervalSeconds) {
924
1328
  if (!Number.isFinite(intervalSeconds) || intervalSeconds <= 0) {
925
1329
  throw new RangeError("Reporting interval should be greater than zero.");
926
1330
  }
927
1331
  return this.mergeValues({ ReportingIntervalSeconds: intervalSeconds });
928
1332
  }
1333
+ /**
1334
+ * Registers one or more reporting sinks.
1335
+ * Use this when run results must be pushed to external observability or storage systems.
1336
+ */
929
1337
  withReportingSinks(...sinks) {
930
1338
  return this.WithReportingSinks(...sinks);
931
1339
  }
1340
+ /**
1341
+ * Registers one or more reporting sinks.
1342
+ * Use this when run results must be pushed to external observability or storage systems.
1343
+ */
932
1344
  WithReportingSinks(...sinks) {
933
1345
  if (!sinks.length) {
934
1346
  throw new Error("At least one reporting sink should be provided.");
@@ -939,9 +1351,17 @@ export class LoadStrikeContext {
939
1351
  validateNamedReportingSinks(sinks);
940
1352
  return this.mergeValues({ ReportingSinks: sinks });
941
1353
  }
1354
+ /**
1355
+ * Registers runtime policies for the run.
1356
+ * Use this when scenario selection or step execution should obey policy callbacks.
1357
+ */
942
1358
  withRuntimePolicies(...policies) {
943
1359
  return this.WithRuntimePolicies(...policies);
944
1360
  }
1361
+ /**
1362
+ * Registers runtime policies for the run.
1363
+ * Use this when scenario selection or step execution should obey policy callbacks.
1364
+ */
945
1365
  WithRuntimePolicies(...policies) {
946
1366
  if (!policies.length) {
947
1367
  throw new Error("At least one runtime policy should be provided.");
@@ -951,17 +1371,33 @@ export class LoadStrikeContext {
951
1371
  }
952
1372
  return this.mergeValues({ RuntimePolicies: policies });
953
1373
  }
1374
+ /**
1375
+ * Sets how runtime policy failures are handled.
1376
+ * Use this when policy errors should either fail fast or be tolerated.
1377
+ */
954
1378
  withRuntimePolicyErrorMode(mode) {
955
1379
  return this.WithRuntimePolicyErrorMode(mode);
956
1380
  }
1381
+ /**
1382
+ * Sets how runtime policy failures are handled.
1383
+ * Use this when policy errors should either fail fast or be tolerated.
1384
+ */
957
1385
  WithRuntimePolicyErrorMode(mode) {
958
1386
  return this.mergeValues({
959
1387
  RuntimePolicyErrorMode: normalizedRuntimePolicyErrorMode(mode)
960
1388
  });
961
1389
  }
1390
+ /**
1391
+ * Registers worker plugins for the run.
1392
+ * Use this when custom plugin data should be collected alongside run results.
1393
+ */
962
1394
  withWorkerPlugins(...plugins) {
963
1395
  return this.WithWorkerPlugins(...plugins);
964
1396
  }
1397
+ /**
1398
+ * Registers worker plugins for the run.
1399
+ * Use this when custom plugin data should be collected alongside run results.
1400
+ */
965
1401
  WithWorkerPlugins(...plugins) {
966
1402
  if (!plugins.length) {
967
1403
  throw new Error("At least one worker plugin should be provided.");
@@ -972,71 +1408,143 @@ export class LoadStrikeContext {
972
1408
  validateNamedWorkerPlugins(plugins);
973
1409
  return this.mergeValues({ WorkerPlugins: plugins });
974
1410
  }
1411
+ /**
1412
+ * Sets the minimum runtime log level.
1413
+ * Use this when the run should emit less or more operational detail.
1414
+ */
975
1415
  withMinimumLogLevel(minimumLogLevel) {
976
1416
  return this.WithMinimumLogLevel(minimumLogLevel);
977
1417
  }
1418
+ /**
1419
+ * Sets the minimum runtime log level.
1420
+ * Use this when the run should emit less or more operational detail.
1421
+ */
978
1422
  WithMinimumLogLevel(minimumLogLevel) {
979
1423
  return this.mergeValues({
980
1424
  MinimumLogLevel: parseMinimumLogLevelToken(requireNonEmpty(minimumLogLevel, "Minimum log level must be provided."))
981
1425
  });
982
1426
  }
1427
+ /**
1428
+ * Supplies a custom logger configuration factory.
1429
+ * Use this when the default runtime logging output is not enough for your environment.
1430
+ */
983
1431
  withLoggerConfig(loggerConfig) {
984
1432
  return this.WithLoggerConfig(loggerConfig);
985
1433
  }
1434
+ /**
1435
+ * Supplies a custom logger configuration factory.
1436
+ * Use this when the default runtime logging output is not enough for your environment.
1437
+ */
986
1438
  WithLoggerConfig(loggerConfig) {
987
1439
  if (typeof loggerConfig !== "function") {
988
1440
  throw new TypeError("Logger config must be provided.");
989
1441
  }
990
1442
  return this.mergeValues({ LoggerConfig: loggerConfig });
991
1443
  }
1444
+ /**
1445
+ * Sets the timeout for scenario completion.
1446
+ * Use this when long-running scenarios need an explicit completion window.
1447
+ */
992
1448
  withScenarioCompletionTimeout(timeoutSeconds) {
993
1449
  return this.WithScenarioCompletionTimeout(timeoutSeconds);
994
1450
  }
1451
+ /**
1452
+ * Sets the timeout for scenario completion.
1453
+ * Use this when long-running scenarios need an explicit completion window.
1454
+ */
995
1455
  WithScenarioCompletionTimeout(timeoutSeconds) {
996
1456
  if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
997
1457
  throw new RangeError("Scenario completion timeout should be greater than zero.");
998
1458
  }
999
1459
  return this.mergeValues({ ScenarioCompletionTimeoutSeconds: timeoutSeconds });
1000
1460
  }
1461
+ /**
1462
+ * Sets the timeout for cluster command round-trips.
1463
+ * Use this when distributed control messages need a tighter or looser deadline.
1464
+ */
1001
1465
  withClusterCommandTimeout(timeoutSeconds) {
1002
1466
  return this.WithClusterCommandTimeout(timeoutSeconds);
1003
1467
  }
1468
+ /**
1469
+ * Sets the timeout for cluster command round-trips.
1470
+ * Use this when distributed control messages need a tighter or looser deadline.
1471
+ */
1004
1472
  WithClusterCommandTimeout(timeoutSeconds) {
1005
1473
  if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
1006
1474
  throw new RangeError("Cluster command timeout should be greater than zero.");
1007
1475
  }
1008
1476
  return this.mergeValues({ ClusterCommandTimeoutSeconds: timeoutSeconds });
1009
1477
  }
1478
+ /**
1479
+ * Sets the retry limit for restartable failed iterations.
1480
+ * Use this when transient failures should be retried a fixed number of times.
1481
+ */
1010
1482
  withRestartIterationMaxAttempts(attempts) {
1011
1483
  return this.WithRestartIterationMaxAttempts(attempts);
1012
1484
  }
1485
+ /**
1486
+ * Sets the retry limit for restartable failed iterations.
1487
+ * Use this when transient failures should be retried a fixed number of times.
1488
+ */
1013
1489
  WithRestartIterationMaxAttempts(attempts) {
1014
1490
  if (!Number.isFinite(attempts) || attempts < 0) {
1015
1491
  throw new RangeError("Restart iteration max attempts should be zero or greater.");
1016
1492
  }
1017
1493
  return this.mergeValues({ RestartIterationMaxAttempts: Math.trunc(attempts) });
1018
1494
  }
1495
+ /**
1496
+ * Sets the session identifier for this run.
1497
+ * Use this when downstream logs, reports, or external systems need a stable session id.
1498
+ */
1019
1499
  withSessionId(sessionId) {
1020
1500
  return this.WithSessionId(sessionId);
1021
1501
  }
1502
+ /**
1503
+ * Sets the session identifier for this run.
1504
+ * Use this when downstream logs, reports, or external systems need a stable session id.
1505
+ */
1022
1506
  WithSessionId(sessionId) {
1023
1507
  return this.mergeValues({ SessionId: requireNonEmpty(sessionId, "Session id must be provided.") });
1024
1508
  }
1509
+ /**
1510
+ * Sets the test suite label for the run.
1511
+ * Use this when related tests should be grouped under a suite name.
1512
+ */
1025
1513
  withTestSuite(testSuite) {
1026
1514
  return this.WithTestSuite(testSuite);
1027
1515
  }
1516
+ /**
1517
+ * Sets the test suite label for the run.
1518
+ * Use this when related tests should be grouped under a suite name.
1519
+ */
1028
1520
  WithTestSuite(testSuite) {
1029
1521
  return this.mergeValues({ TestSuite: requireNonEmpty(testSuite, "Test suite must be provided.") });
1030
1522
  }
1523
+ /**
1524
+ * Sets the test name label for the run.
1525
+ * Use this when reports and logs should expose a human-readable test identifier.
1526
+ */
1031
1527
  withTestName(testName) {
1032
1528
  return this.WithTestName(testName);
1033
1529
  }
1530
+ /**
1531
+ * Sets the test name label for the run.
1532
+ * Use this when reports and logs should expose a human-readable test identifier.
1533
+ */
1034
1534
  WithTestName(testName) {
1035
1535
  return this.mergeValues({ TestName: requireNonEmpty(testName, "Test name must be provided.") });
1036
1536
  }
1537
+ /**
1538
+ * Sets the cluster identifier for this run.
1539
+ * Use this when multiple cluster nodes must join the same distributed execution.
1540
+ */
1037
1541
  withClusterId(clusterId) {
1038
1542
  return this.WithClusterId(clusterId);
1039
1543
  }
1544
+ /**
1545
+ * Sets the cluster identifier for this run.
1546
+ * Use this when multiple cluster nodes must join the same distributed execution.
1547
+ */
1040
1548
  WithClusterId(clusterId) {
1041
1549
  return this.mergeValues({ ClusterId: requireNonEmpty(clusterId, "Cluster id must be provided.") });
1042
1550
  }
@@ -1049,6 +1557,10 @@ export class LoadStrikeContext {
1049
1557
  this.runArgs = [...runArgs];
1050
1558
  return this;
1051
1559
  }
1560
+ /**
1561
+ * Configures registered scenarios for this SDK object.
1562
+ * Use this when registered scenarios should be set explicitly before the run starts.
1563
+ */
1052
1564
  withRegisteredScenarios(...scenarios) {
1053
1565
  return this.assignState(this.values, scenarios, this.runArgs);
1054
1566
  }
@@ -1084,57 +1596,105 @@ export class LoadStrikeScenario {
1084
1596
  static CreateAsync(name, runHandler) {
1085
1597
  return LoadStrikeScenario.createAsync(name, runHandler);
1086
1598
  }
1599
+ /**
1600
+ * Creates a placeholder scenario that returns the default success reply.
1601
+ * Use this when you want a scenario shell before adding setup, cleanup, or more detailed behavior.
1602
+ */
1087
1603
  static empty(name) {
1088
1604
  return LoadStrikeScenario.create(name, () => LoadStrikeResponse.ok());
1089
1605
  }
1606
+ /**
1607
+ * Creates a placeholder scenario that returns the default success reply.
1608
+ * Use this when you want a scenario shell before adding setup, cleanup, or more detailed behavior.
1609
+ */
1090
1610
  static Empty(name) {
1091
1611
  return LoadStrikeScenario.empty(name);
1092
1612
  }
1093
1613
  get Name() {
1094
1614
  return this.name;
1095
1615
  }
1616
+ /**
1617
+ * Configures init for this SDK object.
1618
+ * Use this when init should be set explicitly before the run starts.
1619
+ */
1096
1620
  withInit(handler) {
1097
1621
  if (typeof handler !== "function") {
1098
1622
  throw new TypeError("Init handler must be provided.");
1099
1623
  }
1100
1624
  return new LoadStrikeScenario(this.name, this.runHandler, handler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1101
1625
  }
1626
+ /**
1627
+ * Configures init async for this SDK object.
1628
+ * Use this when init async should be set explicitly before the run starts.
1629
+ */
1102
1630
  withInitAsync(handler) {
1103
1631
  return this.withInit(handler);
1104
1632
  }
1633
+ /**
1634
+ * Configures clean for this SDK object.
1635
+ * Use this when clean should be set explicitly before the run starts.
1636
+ */
1105
1637
  withClean(handler) {
1106
1638
  if (typeof handler !== "function") {
1107
1639
  throw new TypeError("Clean handler must be provided.");
1108
1640
  }
1109
1641
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, handler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1110
1642
  }
1643
+ /**
1644
+ * Configures clean async for this SDK object.
1645
+ * Use this when clean async should be set explicitly before the run starts.
1646
+ */
1111
1647
  withCleanAsync(handler) {
1112
1648
  return this.withClean(handler);
1113
1649
  }
1650
+ /**
1651
+ * Configures max fail count for this SDK object.
1652
+ * Use this when max fail count should be set explicitly before the run starts.
1653
+ */
1114
1654
  withMaxFailCount(maxFailCount) {
1115
1655
  if (!Number.isFinite(maxFailCount)) {
1116
1656
  throw new RangeError("maxFailCount should be a finite number.");
1117
1657
  }
1118
1658
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, Math.trunc(maxFailCount), this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1119
1659
  }
1660
+ /**
1661
+ * Configures out warm up for this SDK object.
1662
+ * Use this when out warm up should be set explicitly before the run starts.
1663
+ */
1120
1664
  withoutWarmUp() {
1121
1665
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, true, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1122
1666
  }
1667
+ /**
1668
+ * Configures warm up duration for this SDK object.
1669
+ * Use this when warm up duration should be set explicitly before the run starts.
1670
+ */
1123
1671
  withWarmUpDuration(durationSeconds) {
1124
1672
  if (!Number.isFinite(durationSeconds)) {
1125
1673
  throw new RangeError("Warmup duration should be a finite number.");
1126
1674
  }
1127
1675
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, durationSeconds, this.weight, this.restartIterationOnFail);
1128
1676
  }
1677
+ /**
1678
+ * Configures weight for this SDK object.
1679
+ * Use this when weight should be set explicitly before the run starts.
1680
+ */
1129
1681
  withWeight(weight) {
1130
1682
  if (!Number.isFinite(weight)) {
1131
1683
  throw new RangeError("Weight should be a finite number.");
1132
1684
  }
1133
1685
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, Math.trunc(weight), this.restartIterationOnFail);
1134
1686
  }
1687
+ /**
1688
+ * Configures restart iteration on fail for this SDK object.
1689
+ * Use this when restart iteration on fail should be set explicitly before the run starts.
1690
+ */
1135
1691
  withRestartIterationOnFail(shouldRestart) {
1136
1692
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, Boolean(shouldRestart));
1137
1693
  }
1694
+ /**
1695
+ * Configures cross platform tracking for this SDK object.
1696
+ * Use this when cross platform tracking should be set explicitly before the run starts.
1697
+ */
1138
1698
  withCrossPlatformTracking(configuration) {
1139
1699
  if (!configuration || typeof configuration !== "object" || Array.isArray(configuration)) {
1140
1700
  throw new TypeError("Tracking configuration must be provided.");
@@ -1152,39 +1712,79 @@ export class LoadStrikeScenario {
1152
1712
  validateRuntimeTrackingConfiguration(copied, sourceEndpoint, destinationEndpoint);
1153
1713
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, this.thresholds, copied, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1154
1714
  }
1715
+ /**
1716
+ * Configures load simulations for this SDK object.
1717
+ * Use this when load simulations should be set explicitly before the run starts.
1718
+ */
1155
1719
  withLoadSimulations(...simulations) {
1156
1720
  if (!simulations.length) {
1157
1721
  throw new Error("At least one load simulation should be provided.");
1158
1722
  }
1159
1723
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, simulations.map((simulation) => attachLoadSimulationProjection({ ...simulation })), this.thresholds, this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1160
1724
  }
1725
+ /**
1726
+ * Configures thresholds for this SDK object.
1727
+ * Use this when thresholds should be set explicitly before the run starts.
1728
+ */
1161
1729
  withThresholds(...thresholds) {
1162
1730
  if (!thresholds.length) {
1163
1731
  throw new Error("At least one threshold should be provided.");
1164
1732
  }
1165
1733
  return new LoadStrikeScenario(this.name, this.runHandler, this.initHandler, this.cleanHandler, this.loadSimulations, thresholds.map((threshold) => ({ ...threshold })), this.trackingConfiguration, this.maxFailCount, this.withoutWarmUpValue, this.warmUpDurationSeconds, this.weight, this.restartIterationOnFail);
1166
1734
  }
1735
+ /**
1736
+ * Returns simulations.
1737
+ * Use this when simulations is required for branching, logging, or assertions.
1738
+ */
1167
1739
  getSimulations() {
1168
1740
  return this.loadSimulations.map((simulation) => attachLoadSimulationProjection({ ...simulation }));
1169
1741
  }
1742
+ /**
1743
+ * Returns thresholds.
1744
+ * Use this when thresholds is required for branching, logging, or assertions.
1745
+ */
1170
1746
  getThresholds() {
1171
1747
  return this.thresholds;
1172
1748
  }
1749
+ /**
1750
+ * Returns tracking configuration.
1751
+ * Use this when tracking configuration is required for branching, logging, or assertions.
1752
+ */
1173
1753
  getTrackingConfiguration() {
1174
1754
  return this.trackingConfiguration ? { ...this.trackingConfiguration } : undefined;
1175
1755
  }
1756
+ /**
1757
+ * Returns max fail count.
1758
+ * Use this when max fail count is required for branching, logging, or assertions.
1759
+ */
1176
1760
  getMaxFailCount() {
1177
1761
  return this.maxFailCount;
1178
1762
  }
1763
+ /**
1764
+ * Exposes the public isWithoutWarmUp operation.
1765
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
1766
+ */
1179
1767
  isWithoutWarmUp() {
1180
1768
  return this.withoutWarmUpValue;
1181
1769
  }
1770
+ /**
1771
+ * Returns warm up duration seconds.
1772
+ * Use this when warm up duration seconds is required for branching, logging, or assertions.
1773
+ */
1182
1774
  getWarmUpDurationSeconds() {
1183
1775
  return this.warmUpDurationSeconds;
1184
1776
  }
1777
+ /**
1778
+ * Returns weight.
1779
+ * Use this when weight is required for branching, logging, or assertions.
1780
+ */
1185
1781
  getWeight() {
1186
1782
  return this.weight;
1187
1783
  }
1784
+ /**
1785
+ * Exposes the public shouldRestartIterationOnFail operation.
1786
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
1787
+ */
1188
1788
  shouldRestartIterationOnFail() {
1189
1789
  return this.restartIterationOnFail;
1190
1790
  }
@@ -1210,39 +1810,87 @@ export class LoadStrikeScenario {
1210
1810
  return LoadStrikeResponse.fail("exception", resolveRuntimeErrorMessage(error, "scenario failed"), 0);
1211
1811
  }
1212
1812
  }
1813
+ /**
1814
+ * Configures cross platform tracking for this SDK object.
1815
+ * Use this when cross platform tracking should be set explicitly before the run starts.
1816
+ */
1213
1817
  WithCrossPlatformTracking(configuration) {
1214
1818
  return this.withCrossPlatformTracking(configuration);
1215
1819
  }
1820
+ /**
1821
+ * Configures init for this SDK object.
1822
+ * Use this when init should be set explicitly before the run starts.
1823
+ */
1216
1824
  WithInit(handler) {
1217
1825
  return this.withInit(handler);
1218
1826
  }
1827
+ /**
1828
+ * Configures init async for this SDK object.
1829
+ * Use this when init async should be set explicitly before the run starts.
1830
+ */
1219
1831
  WithInitAsync(handler) {
1220
1832
  return this.withInitAsync(handler);
1221
1833
  }
1834
+ /**
1835
+ * Configures clean for this SDK object.
1836
+ * Use this when clean should be set explicitly before the run starts.
1837
+ */
1222
1838
  WithClean(handler) {
1223
1839
  return this.withClean(handler);
1224
1840
  }
1841
+ /**
1842
+ * Configures clean async for this SDK object.
1843
+ * Use this when clean async should be set explicitly before the run starts.
1844
+ */
1225
1845
  WithCleanAsync(handler) {
1226
1846
  return this.withCleanAsync(handler);
1227
1847
  }
1848
+ /**
1849
+ * Configures load simulations for this SDK object.
1850
+ * Use this when load simulations should be set explicitly before the run starts.
1851
+ */
1228
1852
  WithLoadSimulations(...simulations) {
1229
1853
  return this.withLoadSimulations(...simulations);
1230
1854
  }
1855
+ /**
1856
+ * Configures max fail count for this SDK object.
1857
+ * Use this when max fail count should be set explicitly before the run starts.
1858
+ */
1231
1859
  WithMaxFailCount(maxFailCount) {
1232
1860
  return this.withMaxFailCount(maxFailCount);
1233
1861
  }
1862
+ /**
1863
+ * Configures out warm up for this SDK object.
1864
+ * Use this when out warm up should be set explicitly before the run starts.
1865
+ */
1234
1866
  WithoutWarmUp() {
1235
1867
  return this.withoutWarmUp();
1236
1868
  }
1869
+ /**
1870
+ * Configures restart iteration on fail for this SDK object.
1871
+ * Use this when restart iteration on fail should be set explicitly before the run starts.
1872
+ */
1237
1873
  WithRestartIterationOnFail(shouldRestart) {
1238
1874
  return this.withRestartIterationOnFail(shouldRestart);
1239
1875
  }
1876
+ /**
1877
+ * Configures thresholds for this SDK object.
1878
+ * Use this when thresholds should be set explicitly before the run starts.
1879
+ */
1240
1880
  WithThresholds(...thresholds) {
1241
1881
  return this.withThresholds(...thresholds);
1242
1882
  }
1883
+ /**
1884
+ * Configures warm up duration for this SDK object.
1885
+ * Use this when warm up duration should be set explicitly before the run starts.
1886
+ */
1243
1887
  WithWarmUpDuration(durationSeconds) {
1244
1888
  return this.withWarmUpDuration(durationSeconds);
1245
1889
  }
1890
+ /**
1891
+ * Configures weight for this SDK object.
1892
+ * Use this when weight should be set explicitly before the run starts.
1893
+ */
1246
1894
  WithWeight(weight) {
1247
1895
  return this.withWeight(weight);
1248
1896
  }
@@ -1253,115 +1901,251 @@ export class LoadStrikeRunner {
1253
1901
  this.options = normalizeRunnerOptionCollectionShapes(options);
1254
1902
  this.contextConfigurators = [...contextConfigurators];
1255
1903
  }
1904
+ /**
1905
+ * Creates a new instance of this public SDK type.
1906
+ * Use this when you are starting a run definition from scratch.
1907
+ */
1256
1908
  static create() {
1257
1909
  return new LoadStrikeRunner([], {});
1258
1910
  }
1911
+ /**
1912
+ * Creates a new instance of this public SDK type.
1913
+ * Use this when you are starting a run definition from scratch.
1914
+ */
1259
1915
  static Create() {
1260
1916
  return LoadStrikeRunner.create();
1261
1917
  }
1918
+ /**
1919
+ * Registers one or more scenarios on a fresh runnable context.
1920
+ * Use this when you want a context immediately without composing a runner first.
1921
+ */
1262
1922
  static registerScenarios(...scenarios) {
1263
1923
  validateRegisteredScenarios(scenarios);
1264
1924
  return new LoadStrikeContext({}, scenarios);
1265
1925
  }
1926
+ /**
1927
+ * Registers one or more scenarios on a fresh runnable context.
1928
+ * Use this when you want a context immediately without composing a runner first.
1929
+ */
1266
1930
  static RegisterScenarios(...scenarios) {
1267
1931
  return LoadStrikeRunner.registerScenarios(...scenarios);
1268
1932
  }
1933
+ /**
1934
+ * Toggles realtime console metric output.
1935
+ * Use this when a local run or CI log should stream live throughput and latency updates.
1936
+ */
1269
1937
  static DisplayConsoleMetrics(context, enable) {
1270
1938
  return context.DisplayConsoleMetrics(enable);
1271
1939
  }
1940
+ /**
1941
+ * Toggles local development cluster mode.
1942
+ * Use this when you want to simulate coordinator and agent behavior on a single machine.
1943
+ */
1272
1944
  static EnableLocalDevCluster(context, enable) {
1273
1945
  return context.EnableLocalDevCluster(enable);
1274
1946
  }
1947
+ /**
1948
+ * Loads run settings from a JSON config file.
1949
+ * Use this when configuration should come from a checked-in or generated config document.
1950
+ */
1275
1951
  static LoadConfig(context, path) {
1276
1952
  return context.LoadConfig(path);
1277
1953
  }
1954
+ /**
1955
+ * Loads infrastructure settings for sinks, plugins, or transport dependencies.
1956
+ * Use this when runtime integrations depend on external connection details.
1957
+ */
1278
1958
  static LoadInfraConfig(context, path) {
1279
1959
  return context.LoadInfraConfig(path);
1280
1960
  }
1961
+ /**
1962
+ * Executes the configured workload through the SDK runtime.
1963
+ * Use this when configuration is complete and you are ready to start the run.
1964
+ */
1281
1965
  static Run(context, ...args) {
1282
1966
  return context.Run(args);
1283
1967
  }
1968
+ /**
1969
+ * Sets the agent group for this node or run.
1970
+ * Use this when only a subset of agents should pick up a particular workload.
1971
+ */
1284
1972
  static WithAgentGroup(context, agentGroup) {
1285
1973
  return context.WithAgentGroup(agentGroup);
1286
1974
  }
1975
+ /**
1976
+ * Sets the requested agent count.
1977
+ * Use this when a coordinator should fan work out across a specific number of agents.
1978
+ */
1287
1979
  static WithAgentsCount(context, agentsCount) {
1288
1980
  return context.WithAgentsCount(agentsCount);
1289
1981
  }
1982
+ /**
1983
+ * Targets scenarios for agent nodes only.
1984
+ * Use this when agents should execute only a subset of the registered scenarios.
1985
+ */
1290
1986
  static WithAgentTargetScenarios(context, ...scenarioNames) {
1291
1987
  return context.WithAgentTargetScenarios(...scenarioNames);
1292
1988
  }
1989
+ /**
1990
+ * Sets the cluster identifier for this run.
1991
+ * Use this when multiple cluster nodes must join the same distributed execution.
1992
+ */
1293
1993
  static WithClusterId(context, clusterId) {
1294
1994
  return context.WithClusterId(clusterId);
1295
1995
  }
1996
+ /**
1997
+ * Targets scenarios for the coordinator only.
1998
+ * Use this when orchestration or control-node work should run on the coordinator itself.
1999
+ */
1296
2000
  static WithCoordinatorTargetScenarios(context, ...scenarioNames) {
1297
2001
  return context.WithCoordinatorTargetScenarios(...scenarioNames);
1298
2002
  }
2003
+ /**
2004
+ * Sets the runner key used for licensing validation.
2005
+ * Use this when the run must authenticate against the licensing API before it starts.
2006
+ */
1299
2007
  static WithRunnerKey(context, runnerKey) {
1300
2008
  return context.WithRunnerKey(runnerKey);
1301
2009
  }
2010
+ /**
2011
+ * Sets how long the SDK waits for licensing validation to complete.
2012
+ * Use this when control-plane latency or private networking requires a longer validation window.
2013
+ */
1302
2014
  static WithLicenseValidationTimeout(context, timeoutSeconds) {
1303
2015
  return context.WithLicenseValidationTimeout(timeoutSeconds);
1304
2016
  }
2017
+ /**
2018
+ * Supplies a custom logger configuration factory.
2019
+ * Use this when the default runtime logging output is not enough for your environment.
2020
+ */
1305
2021
  static WithLoggerConfig(context, loggerConfig) {
1306
2022
  return context.WithLoggerConfig(loggerConfig);
1307
2023
  }
2024
+ /**
2025
+ * Sets the minimum runtime log level.
2026
+ * Use this when the run should emit less or more operational detail.
2027
+ */
1308
2028
  static WithMinimumLogLevel(context, minimumLogLevel) {
1309
2029
  return context.WithMinimumLogLevel(minimumLogLevel);
1310
2030
  }
2031
+ /**
2032
+ * Sets the NATS server URL used for distributed cluster coordination.
2033
+ * Use this when coordinator and agent nodes communicate over NATS.
2034
+ */
1311
2035
  static WithNatsServerUrl(context, natsUrl) {
1312
2036
  return context.WithNatsServerUrl(natsUrl);
1313
2037
  }
1314
2038
  static WithNodeType(context, nodeType) {
1315
2039
  return context.WithNodeType(nodeType);
1316
2040
  }
2041
+ /**
2042
+ * Disables local report generation.
2043
+ * Use this when reports are unnecessary or should be handled exclusively by sinks.
2044
+ */
1317
2045
  static WithoutReports(context) {
1318
2046
  return context.WithoutReports();
1319
2047
  }
2048
+ /**
2049
+ * Sets the base file name for generated reports.
2050
+ * Use this when exported reports should use a predictable naming convention.
2051
+ */
1320
2052
  static WithReportFileName(context, reportFileName) {
1321
2053
  return context.WithReportFileName(reportFileName);
1322
2054
  }
2055
+ /**
2056
+ * Sets the output folder for generated reports.
2057
+ * Use this when report files should land in a specific directory.
2058
+ */
1323
2059
  static WithReportFolder(context, reportFolderPath) {
1324
2060
  return context.WithReportFolder(reportFolderPath);
1325
2061
  }
1326
2062
  static WithReportFormats(context, ...reportFormats) {
1327
2063
  return context.WithReportFormats(...reportFormats);
1328
2064
  }
2065
+ /**
2066
+ * Sets the realtime reporting cadence.
2067
+ * Use this when sinks or dashboards should receive updates at a controlled interval.
2068
+ */
1329
2069
  static WithReportingInterval(context, intervalSeconds) {
1330
2070
  return context.WithReportingInterval(intervalSeconds);
1331
2071
  }
2072
+ /**
2073
+ * Registers one or more reporting sinks.
2074
+ * Use this when run results must be pushed to external observability or storage systems.
2075
+ */
1332
2076
  static WithReportingSinks(context, ...sinks) {
1333
2077
  return context.WithReportingSinks(...sinks);
1334
2078
  }
2079
+ /**
2080
+ * Registers runtime policies for the run.
2081
+ * Use this when scenario selection or step execution should obey policy callbacks.
2082
+ */
1335
2083
  static WithRuntimePolicies(context, ...policies) {
1336
2084
  return context.WithRuntimePolicies(...policies);
1337
2085
  }
1338
2086
  static WithRuntimePolicyErrorMode(context, mode) {
1339
2087
  return context.WithRuntimePolicyErrorMode(mode);
1340
2088
  }
2089
+ /**
2090
+ * Sets the timeout for scenario completion.
2091
+ * Use this when long-running scenarios need an explicit completion window.
2092
+ */
1341
2093
  static WithScenarioCompletionTimeout(context, timeoutSeconds) {
1342
2094
  return context.WithScenarioCompletionTimeout(timeoutSeconds);
1343
2095
  }
2096
+ /**
2097
+ * Sets the timeout for cluster command round-trips.
2098
+ * Use this when distributed control messages need a tighter or looser deadline.
2099
+ */
1344
2100
  static WithClusterCommandTimeout(context, timeoutSeconds) {
1345
2101
  return context.WithClusterCommandTimeout(timeoutSeconds);
1346
2102
  }
2103
+ /**
2104
+ * Sets the retry limit for restartable failed iterations.
2105
+ * Use this when transient failures should be retried a fixed number of times.
2106
+ */
1347
2107
  static WithRestartIterationMaxAttempts(context, attempts) {
1348
2108
  return context.WithRestartIterationMaxAttempts(attempts);
1349
2109
  }
2110
+ /**
2111
+ * Sets the session identifier for this run.
2112
+ * Use this when downstream logs, reports, or external systems need a stable session id.
2113
+ */
1350
2114
  static WithSessionId(context, sessionId) {
1351
2115
  return context.WithSessionId(sessionId);
1352
2116
  }
2117
+ /**
2118
+ * Targets a shared set of scenarios.
2119
+ * Use this when only selected scenarios should execute for the current node or run.
2120
+ */
1353
2121
  static WithTargetScenarios(context, ...scenarioNames) {
1354
2122
  return context.WithTargetScenarios(...scenarioNames);
1355
2123
  }
2124
+ /**
2125
+ * Sets the test name label for the run.
2126
+ * Use this when reports and logs should expose a human-readable test identifier.
2127
+ */
1356
2128
  static WithTestName(context, testName) {
1357
2129
  return context.WithTestName(testName);
1358
2130
  }
2131
+ /**
2132
+ * Sets the test suite label for the run.
2133
+ * Use this when related tests should be grouped under a suite name.
2134
+ */
1359
2135
  static WithTestSuite(context, testSuite) {
1360
2136
  return context.WithTestSuite(testSuite);
1361
2137
  }
2138
+ /**
2139
+ * Registers worker plugins for the run.
2140
+ * Use this when custom plugin data should be collected alongside run results.
2141
+ */
1362
2142
  static WithWorkerPlugins(context, ...plugins) {
1363
2143
  return context.WithWorkerPlugins(...plugins);
1364
2144
  }
2145
+ /**
2146
+ * Adds a scenario to the current runner.
2147
+ * Use this when the run should include one more scenario definition.
2148
+ */
1365
2149
  addScenario(scenario) {
1366
2150
  if (!(scenario instanceof LoadStrikeScenario)) {
1367
2151
  throw new TypeError("Scenario must be provided.");
@@ -1369,9 +2153,17 @@ export class LoadStrikeRunner {
1369
2153
  this.scenarios = [...this.scenarios, scenario];
1370
2154
  return this;
1371
2155
  }
2156
+ /**
2157
+ * Adds a scenario to the current runner.
2158
+ * Use this when the run should include one more scenario definition.
2159
+ */
1372
2160
  AddScenario(scenario) {
1373
2161
  return this.addScenario(scenario);
1374
2162
  }
2163
+ /**
2164
+ * Adds multiple scenarios to the current runner.
2165
+ * Use this when the run should execute a batch of scenario definitions together.
2166
+ */
1375
2167
  addScenarios(...scenarios) {
1376
2168
  if (!scenarios.length) {
1377
2169
  throw new Error("At least one scenario must be provided.");
@@ -1382,9 +2174,17 @@ export class LoadStrikeRunner {
1382
2174
  this.scenarios = [...this.scenarios, ...scenarios];
1383
2175
  return this;
1384
2176
  }
2177
+ /**
2178
+ * Adds multiple scenarios to the current runner.
2179
+ * Use this when the run should execute a batch of scenario definitions together.
2180
+ */
1385
2181
  AddScenarios(...scenarios) {
1386
2182
  return this.addScenarios(...scenarios);
1387
2183
  }
2184
+ /**
2185
+ * Applies a grouped configuration change to the current builder or context.
2186
+ * Use this when several related settings should be supplied in one step.
2187
+ */
1388
2188
  configure(options) {
1389
2189
  if (!options || typeof options !== "object" || Array.isArray(options)) {
1390
2190
  throw new TypeError("Configure options must be a non-null object.");
@@ -1411,6 +2211,10 @@ export class LoadStrikeRunner {
1411
2211
  }
1412
2212
  return this.configure(input);
1413
2213
  }
2214
+ /**
2215
+ * Copies settings from an existing context snapshot.
2216
+ * Use this when a runner should inherit configuration that was already assembled elsewhere.
2217
+ */
1414
2218
  configureContext(context) {
1415
2219
  if (!context || typeof context !== "object" || Array.isArray(context)) {
1416
2220
  throw new TypeError("Configure context must be a LoadStrikeContext or run context object.");
@@ -1420,66 +2224,138 @@ export class LoadStrikeRunner {
1420
2224
  : new LoadStrikeContext(context);
1421
2225
  return this.configure(runtimeContext.toRunnerOptions());
1422
2226
  }
2227
+ /**
2228
+ * Copies settings from an existing context snapshot.
2229
+ * Use this when a runner should inherit configuration that was already assembled elsewhere.
2230
+ */
1423
2231
  ConfigureContext(context) {
1424
2232
  return this.configureContext(context);
1425
2233
  }
2234
+ /**
2235
+ * Sets the test suite label for the run.
2236
+ * Use this when related tests should be grouped under a suite name.
2237
+ */
1426
2238
  withTestSuite(testSuite) {
1427
2239
  return this.configure({ testSuite: requireNonEmpty(testSuite, "Test suite must be provided.") });
1428
2240
  }
2241
+ /**
2242
+ * Sets the test suite label for the run.
2243
+ * Use this when related tests should be grouped under a suite name.
2244
+ */
1429
2245
  WithTestSuite(testSuite) {
1430
2246
  return this.withTestSuite(testSuite);
1431
2247
  }
2248
+ /**
2249
+ * Sets the test name label for the run.
2250
+ * Use this when reports and logs should expose a human-readable test identifier.
2251
+ */
1432
2252
  withTestName(testName) {
1433
2253
  return this.configure({ testName: requireNonEmpty(testName, "Test name must be provided.") });
1434
2254
  }
2255
+ /**
2256
+ * Sets the test name label for the run.
2257
+ * Use this when reports and logs should expose a human-readable test identifier.
2258
+ */
1435
2259
  WithTestName(testName) {
1436
2260
  return this.withTestName(testName);
1437
2261
  }
2262
+ /**
2263
+ * Sets the session identifier for this run.
2264
+ * Use this when downstream logs, reports, or external systems need a stable session id.
2265
+ */
1438
2266
  withSessionId(sessionId) {
1439
2267
  return this.configure({ sessionId: requireNonEmpty(sessionId, "Session id must be provided.") });
1440
2268
  }
2269
+ /**
2270
+ * Sets the session identifier for this run.
2271
+ * Use this when downstream logs, reports, or external systems need a stable session id.
2272
+ */
1441
2273
  WithSessionId(sessionId) {
1442
2274
  return this.withSessionId(sessionId);
1443
2275
  }
2276
+ /**
2277
+ * Sets the output folder for generated reports.
2278
+ * Use this when report files should land in a specific directory.
2279
+ */
1444
2280
  withReportFolder(reportFolderPath) {
1445
2281
  return this.configure({ reportFolderPath: requireNonEmpty(reportFolderPath, "Report folder path must be provided.") });
1446
2282
  }
2283
+ /**
2284
+ * Sets the output folder for generated reports.
2285
+ * Use this when report files should land in a specific directory.
2286
+ */
1447
2287
  WithReportFolder(reportFolderPath) {
1448
2288
  return this.withReportFolder(reportFolderPath);
1449
2289
  }
2290
+ /**
2291
+ * Sets the realtime reporting cadence.
2292
+ * Use this when sinks or dashboards should receive updates at a controlled interval.
2293
+ */
1450
2294
  withReportingInterval(intervalSeconds) {
1451
2295
  if (!Number.isFinite(intervalSeconds) || intervalSeconds <= 0) {
1452
2296
  throw new RangeError("Reporting interval should be greater than zero.");
1453
2297
  }
1454
2298
  return this.configure({ reportingIntervalSeconds: intervalSeconds });
1455
2299
  }
2300
+ /**
2301
+ * Sets the realtime reporting cadence.
2302
+ * Use this when sinks or dashboards should receive updates at a controlled interval.
2303
+ */
1456
2304
  WithReportingInterval(intervalSeconds) {
1457
2305
  return this.withReportingInterval(intervalSeconds);
1458
2306
  }
2307
+ /**
2308
+ * Sets the timeout for cluster command round-trips.
2309
+ * Use this when distributed control messages need a tighter or looser deadline.
2310
+ */
1459
2311
  withClusterCommandTimeout(timeoutSeconds) {
1460
2312
  if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
1461
2313
  throw new RangeError("Cluster command timeout should be greater than zero.");
1462
2314
  }
1463
2315
  return this.configure({ clusterCommandTimeoutSeconds: timeoutSeconds });
1464
2316
  }
2317
+ /**
2318
+ * Sets the timeout for cluster command round-trips.
2319
+ * Use this when distributed control messages need a tighter or looser deadline.
2320
+ */
1465
2321
  WithClusterCommandTimeout(timeoutSeconds) {
1466
2322
  return this.withClusterCommandTimeout(timeoutSeconds);
1467
2323
  }
2324
+ /**
2325
+ * Sets the retry limit for restartable failed iterations.
2326
+ * Use this when transient failures should be retried a fixed number of times.
2327
+ */
1468
2328
  withRestartIterationMaxAttempts(attempts) {
1469
2329
  if (!Number.isFinite(attempts) || attempts < 0) {
1470
2330
  throw new RangeError("Restart iteration max attempts should be zero or greater.");
1471
2331
  }
1472
2332
  return this.configure({ restartIterationMaxAttempts: Math.trunc(attempts) });
1473
2333
  }
2334
+ /**
2335
+ * Sets the retry limit for restartable failed iterations.
2336
+ * Use this when transient failures should be retried a fixed number of times.
2337
+ */
1474
2338
  WithRestartIterationMaxAttempts(attempts) {
1475
2339
  return this.withRestartIterationMaxAttempts(attempts);
1476
2340
  }
2341
+ /**
2342
+ * Disables local report generation.
2343
+ * Use this when reports are unnecessary or should be handled exclusively by sinks.
2344
+ */
1477
2345
  withoutReports() {
1478
2346
  return this.configure({ reportsEnabled: false });
1479
2347
  }
2348
+ /**
2349
+ * Disables local report generation.
2350
+ * Use this when reports are unnecessary or should be handled exclusively by sinks.
2351
+ */
1480
2352
  WithoutReports() {
1481
2353
  return this.withoutReports();
1482
2354
  }
2355
+ /**
2356
+ * Builds the current configuration into a runnable context.
2357
+ * Use this when you want to inspect or reuse the final run settings before execution.
2358
+ */
1483
2359
  buildContext() {
1484
2360
  if (!this.scenarios.length) {
1485
2361
  throw new Error("At least one scenario must be added before building the runner context.");
@@ -1494,6 +2370,10 @@ export class LoadStrikeRunner {
1494
2370
  }
1495
2371
  return context;
1496
2372
  }
2373
+ /**
2374
+ * Builds the current configuration into a runnable context.
2375
+ * Use this when you want to inspect or reuse the final run settings before execution.
2376
+ */
1497
2377
  BuildContext() {
1498
2378
  return this.buildContext();
1499
2379
  }
@@ -1550,14 +2430,17 @@ export class LoadStrikeRunner {
1550
2430
  const selectedScenarios = clusterMode === "local-coordinator" || clusterMode === "nats-coordinator"
1551
2431
  ? await this.filterScenariosWithPolicies(this.scenarios, policies, policyErrors, runtimePolicyErrorMode)
1552
2432
  : await this.selectScenarios(policies, policyErrors, runtimePolicyErrorMode);
1553
- licensePayload = buildLicenseValidationPayload(this.options, this.scenarios);
2433
+ if (clusterMode === "nats-agent") {
2434
+ return this.runAgentWithNats(createdUtc, testInfo, nodeInfo);
2435
+ }
2436
+ licensePayload = buildLicenseValidationPayload({
2437
+ ...this.options,
2438
+ sessionId: testInfo.sessionId
2439
+ }, this.scenarios);
1554
2440
  licenseClient = new LoadStrikeLocalClient({
1555
2441
  licenseValidationTimeoutMs: Math.max((this.options.licenseValidationTimeoutSeconds ?? 10) * 1000, 1)
1556
2442
  });
1557
2443
  licenseSession = await licenseClient.acquireLicenseLease(licensePayload);
1558
- if (clusterMode === "nats-agent") {
1559
- return this.runAgentWithNats(createdUtc, testInfo, nodeInfo);
1560
- }
1561
2444
  const loggerSetup = createLoggerSetup(this.options.loggerConfig, this.options.minimumLogLevel, this.options, testInfo, nodeInfo);
1562
2445
  const runLogger = loggerSetup.logger;
1563
2446
  const scenarioStartInfos = selectedScenarios.map((scenario, index) => {
@@ -1647,12 +2530,12 @@ export class LoadStrikeRunner {
1647
2530
  let result;
1648
2531
  let metricStats;
1649
2532
  if (clusterMode === "local-coordinator") {
1650
- const aggregated = await this.runCoordinatorWithLocalAgents(selectedScenarios, testInfo, nodeInfo);
2533
+ const aggregated = await this.runCoordinatorWithLocalAgents(selectedScenarios, testInfo, nodeInfo, licenseClient, licenseSession);
1651
2534
  metricStats = aggregated.metrics;
1652
2535
  result = toDetailedRunResultFromNodeStats(aggregated, started.toISOString(), sinkErrors, policyErrors);
1653
2536
  }
1654
2537
  else if (clusterMode === "nats-coordinator") {
1655
- const aggregated = await this.runCoordinatorWithNats(selectedScenarios, testInfo, nodeInfo);
2538
+ const aggregated = await this.runCoordinatorWithNats(selectedScenarios, testInfo, nodeInfo, licenseClient, licenseSession);
1656
2539
  metricStats = aggregated.metrics;
1657
2540
  result = toDetailedRunResultFromNodeStats(aggregated, started.toISOString(), sinkErrors, policyErrors);
1658
2541
  }
@@ -1799,8 +2682,8 @@ export class LoadStrikeRunner {
1799
2682
  natsServerUrl: undefined,
1800
2683
  reportFolderPath: resolve(this.options.reportFolderPath ?? "./reports", sanitizeReportFileName(machineName)),
1801
2684
  targetScenarios,
1802
- agentTargetScenarios: targetScenarios,
1803
- coordinatorTargetScenarios: [],
2685
+ agentTargetScenarios: undefined,
2686
+ coordinatorTargetScenarios: undefined,
1804
2687
  reportsEnabled: false,
1805
2688
  displayConsoleMetrics: false,
1806
2689
  reportingSinks: includeWorkerExtensions ? this.options.reportingSinks : [],
@@ -1818,16 +2701,40 @@ export class LoadStrikeRunner {
1818
2701
  logFiles: [...(childResult.logFiles ?? [])]
1819
2702
  };
1820
2703
  }
1821
- async runCoordinatorWithLocalAgents(scenarios, testInfo, nodeInfo) {
2704
+ async runCoordinatorWithLocalAgents(scenarios, testInfo, nodeInfo, licenseClient, licenseSession) {
2705
+ if (!licenseClient) {
2706
+ throw new Error("Coordinator agent execution authorization requires an initialized licensing client.");
2707
+ }
2708
+ const controllerRunToken = stringValueOrDefault(licenseSession?.runToken, "").trim();
2709
+ if (!controllerRunToken) {
2710
+ throw new Error("Coordinator agent execution authorization requires an active controller run token.");
2711
+ }
1822
2712
  const assignments = planRuntimeClusterAssignments(scenarios, Math.max(this.options.agentsCount ?? 1, 1), this.options.targetScenarios ?? [], this.options.agentTargetScenarios ?? []);
1823
- const nodeResults = await Promise.all(assignments.map((targetScenarios, index) => this.runClusterChildNode(targetScenarios, "Agent", `local-agent-${index + 1}`, false)));
2713
+ const nodeResults = await Promise.all(assignments.map(async (targetScenarios, index) => {
2714
+ const commandId = randomBytes(16).toString("hex");
2715
+ const agentExecutionToken = await licenseClient.createAgentExecutionToken(controllerRunToken, testInfo.sessionId, commandId, index, assignments.length, targetScenarios);
2716
+ return this.runClusterChildNode(targetScenarios, "Agent", `local-agent-${index + 1}`, false, {
2717
+ sessionId: testInfo.sessionId,
2718
+ testSuite: testInfo.testSuite,
2719
+ testName: testInfo.testName,
2720
+ agentCommandId: commandId,
2721
+ agentExecutionToken
2722
+ });
2723
+ }));
1824
2724
  const coordinatorTargets = [...(this.options.coordinatorTargetScenarios ?? [])];
1825
2725
  if (coordinatorTargets.length) {
1826
2726
  nodeResults.push(await this.runClusterChildNode(coordinatorTargets, "Coordinator", nodeInfo.machineName, false));
1827
2727
  }
1828
2728
  return aggregateNodeStats(testInfo, { ...nodeInfo, nodeType: "Coordinator" }, nodeResults);
1829
2729
  }
1830
- async runCoordinatorWithNats(scenarios, testInfo, nodeInfo) {
2730
+ async runCoordinatorWithNats(scenarios, testInfo, nodeInfo, licenseClient, licenseSession) {
2731
+ if (!licenseClient) {
2732
+ throw new Error("Coordinator agent execution authorization requires an initialized licensing client.");
2733
+ }
2734
+ const controllerRunToken = stringValueOrDefault(licenseSession?.runToken, "").trim();
2735
+ if (!controllerRunToken) {
2736
+ throw new Error("Coordinator agent execution authorization requires an active controller run token.");
2737
+ }
1831
2738
  const assignments = planRuntimeClusterAssignments(scenarios, Math.max(this.options.agentsCount ?? 1, 1), this.options.targetScenarios ?? [], this.options.agentTargetScenarios ?? []);
1832
2739
  const coordinator = new DistributedClusterCoordinator({
1833
2740
  clusterId: this.options.clusterId ?? "local",
@@ -1841,7 +2748,7 @@ export class LoadStrikeRunner {
1841
2748
  ? { ServerUrl: this.options.natsServerUrl }
1842
2749
  : undefined
1843
2750
  });
1844
- const dispatch = await coordinator.dispatch(assignments);
2751
+ const dispatch = await coordinator.dispatch(assignments, (command) => licenseClient.createAgentExecutionToken(controllerRunToken, testInfo.sessionId, command.commandId, command.agentIndex, command.agentCount, command.targetScenarios));
1845
2752
  const nodes = dispatch.nodeResults.map((value) => clusterNodeResultToNodeStats(value, testInfo, { ...nodeInfo, nodeType: "Agent" }));
1846
2753
  const coordinatorTargets = [...(this.options.coordinatorTargetScenarios ?? [])];
1847
2754
  if (coordinatorTargets.length) {
@@ -1871,7 +2778,9 @@ export class LoadStrikeRunner {
1871
2778
  handledStats = await this.runClusterChildNode(dispatch.scenarioNames, "Agent", nodeInfo.machineName, true, {
1872
2779
  sessionId: testInfo.sessionId,
1873
2780
  testSuite: testInfo.testSuite,
1874
- testName: testInfo.testName
2781
+ testName: testInfo.testName,
2782
+ agentCommandId: dispatch.commandId,
2783
+ agentExecutionToken: dispatch.agentRunToken
1875
2784
  });
1876
2785
  return {
1877
2786
  nodeId: handledStats.nodeInfo.machineName,
@@ -6513,10 +7422,16 @@ function toRunContext(options) {
6513
7422
  RestartIterationMaxAttempts: normalized.restartIterationMaxAttempts,
6514
7423
  WorkerPlugins: normalized.workerPlugins,
6515
7424
  CustomSettings: normalized.customSettings,
6516
- GlobalCustomSettings: normalized.globalCustomSettings
7425
+ GlobalCustomSettings: normalized.globalCustomSettings,
7426
+ AgentExecutionToken: normalized.agentExecutionToken,
7427
+ AgentCommandId: normalized.agentCommandId
6517
7428
  };
6518
7429
  }
6519
7430
  class RuntimePolicyCallbackError extends Error {
7431
+ /**
7432
+ * Exposes the public constructor operation.
7433
+ * Use this when the surrounding wrapper type makes this operation the clearest way to express your intent.
7434
+ */
6520
7435
  constructor(message) {
6521
7436
  super(message);
6522
7437
  this.name = "RuntimePolicyCallbackError";