agent-swarm-kit 1.0.80 → 1.0.82

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/build/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { scoped } from 'di-scoped';
2
2
  import { createActivator } from 'di-kit';
3
- import { trycatch, singleshot, memoize, sleep, ToolRegistry, Subject, queued, getErrorMessage, errorData, not, randomString, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, execpool, SortedArray, schedule, ttl, Source, isObject } from 'functools-kit';
3
+ import { trycatch, singleshot, memoize, ToolRegistry, Subject, queued, getErrorMessage, errorData, not, randomString, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, execpool, SortedArray, schedule, ttl, Source, isObject } from 'functools-kit';
4
4
  import xml2js from 'xml2js';
5
5
  import { omit } from 'lodash-es';
6
6
 
@@ -165,8 +165,8 @@ var MethodContextService = scoped(/** @class */ (function () {
165
165
  return class_1;
166
166
  }()));
167
167
 
168
- var _a;
169
- var init = (_a = createActivator("agent-swarm"), _a.init), inject = _a.inject, provide = _a.provide;
168
+ var _a$2;
169
+ var init = (_a$2 = createActivator("agent-swarm"), _a$2.init), inject = _a$2.inject, provide = _a$2.provide;
170
170
 
171
171
  var baseServices$1 = {
172
172
  busService: Symbol('busService'),
@@ -226,103 +226,6 @@ var ExecutionContextService = scoped(/** @class */ (function () {
226
226
  return class_1;
227
227
  }()));
228
228
 
229
- /**
230
- * LoggerService class that implements the ILogger interface.
231
- * Provides methods to log and debug messages.
232
- */
233
- var LoggerService = /** @class */ (function () {
234
- function LoggerService() {
235
- var _this = this;
236
- this.methodContextService = inject(TYPES.methodContextService);
237
- this.executionContextService = inject(TYPES.executionContextService);
238
- this._logger = {
239
- /**
240
- * Logs messages.
241
- * @param {...any} args - The messages to log.
242
- */
243
- log: function () {
244
- },
245
- /**
246
- * Logs debug messages.
247
- * @param {...any} args - The debug messages to log.
248
- */
249
- debug: function () {
250
- },
251
- /**
252
- * Logs info messages.
253
- * @param {...any} args - The info messages to log.
254
- */
255
- info: function () {
256
- },
257
- };
258
- /**
259
- * Logs messages using the current logger.
260
- * @param {...any} args - The messages to log.
261
- */
262
- this.log = function () {
263
- var _a;
264
- var args = [];
265
- for (var _i = 0; _i < arguments.length; _i++) {
266
- args[_i] = arguments[_i];
267
- }
268
- var methodContext = MethodContextService.hasContext()
269
- ? _this.methodContextService.context
270
- : null;
271
- var executionContext = ExecutionContextService.hasContext()
272
- ? _this.executionContextService.context
273
- : null;
274
- (_a = _this._logger).log.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{
275
- methodContext: methodContext,
276
- executionContext: executionContext,
277
- }], false));
278
- };
279
- /**
280
- * Logs debug messages using the current logger.
281
- * @param {...any} args - The debug messages to log.
282
- */
283
- this.debug = function () {
284
- var _a;
285
- var args = [];
286
- for (var _i = 0; _i < arguments.length; _i++) {
287
- args[_i] = arguments[_i];
288
- }
289
- var methodContext = MethodContextService.hasContext()
290
- ? _this.methodContextService.context
291
- : null;
292
- var executionContext = ExecutionContextService.hasContext()
293
- ? _this.executionContextService.context
294
- : null;
295
- (_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
296
- };
297
- /**
298
- * Logs info messages using the current logger.
299
- * @param {...any} args - The info messages to log.
300
- */
301
- this.info = function () {
302
- var _a;
303
- var args = [];
304
- for (var _i = 0; _i < arguments.length; _i++) {
305
- args[_i] = arguments[_i];
306
- }
307
- var methodContext = MethodContextService.hasContext()
308
- ? _this.methodContextService.context
309
- : null;
310
- var executionContext = ExecutionContextService.hasContext()
311
- ? _this.executionContextService.context
312
- : null;
313
- (_a = _this._logger).info.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
314
- };
315
- /**
316
- * Sets a new logger.
317
- * @param {ILogger} logger - The new logger to set.
318
- */
319
- this.setLogger = function (logger) {
320
- _this._logger = logger;
321
- };
322
- }
323
- return LoggerService;
324
- }());
325
-
326
229
  /**
327
230
  * Validates that the given output string is not empty.
328
231
  *
@@ -427,6 +330,8 @@ var removeXmlTags = function (input) {
427
330
  .trim();
428
331
  };
429
332
 
333
+ var _a$1;
334
+ var HISTORY_INSTANCE_WAIT_FOR_INIT = Symbol("wait-for-init");
430
335
  var INSTANCE_METHOD_NAME_WAIT_FOR_INIT = "HistoryInstance.waitForInit";
431
336
  var INSTANCE_METHOD_NAME_CTOR = "HistoryInstance.CTOR";
432
337
  var INSTANCE_METHOD_NAME_ITERATE_CONDITION = "HistoryInstance.iterate condition";
@@ -453,71 +358,31 @@ var HistoryInstance = /** @class */ (function () {
453
358
  this.callbacks = callbacks;
454
359
  this._array = [];
455
360
  /**
456
- * Wait for the history to initialize.
361
+ * Makes the singleshot for initialization
457
362
  * @param agentName - The agent name.
458
363
  */
459
- this.waitForInit = singleshot(function (agentName) { return __awaiter(_this, void 0, void 0, function () {
460
- var _a;
461
- return __generator(this, function (_b) {
462
- switch (_b.label) {
364
+ this[_a$1] = singleshot(function (agentName) { return __awaiter(_this, void 0, void 0, function () {
365
+ var _b;
366
+ return __generator(this, function (_c) {
367
+ switch (_c.label) {
463
368
  case 0:
464
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
465
- swarm.loggerService.log(INSTANCE_METHOD_NAME_WAIT_FOR_INIT, {
369
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
370
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_WAIT_FOR_INIT, {
466
371
  clientId: this.clientId,
467
372
  agentName: agentName,
468
373
  });
469
374
  if (!this.callbacks.getData) return [3 /*break*/, 2];
470
- _a = this;
375
+ _b = this;
471
376
  return [4 /*yield*/, this.callbacks.getData(this.clientId, agentName)];
472
377
  case 1:
473
- _a._array = _b.sent();
474
- _b.label = 2;
378
+ _b._array = _c.sent();
379
+ _c.label = 2;
475
380
  case 2: return [2 /*return*/];
476
381
  }
477
382
  });
478
383
  }); });
479
- /**
480
- * Push a new message to the history for a given agent.
481
- * @param value - The model message to push.
482
- * @param agentName - The agent name.
483
- * @returns A promise that resolves when the message is pushed.
484
- */
485
- this.push = function (value, agentName) { return __awaiter(_this, void 0, void 0, function () {
486
- return __generator(this, function (_a) {
487
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
488
- swarm.loggerService.log(INSTANCE_METHOD_NAME_PUSH, {
489
- clientId: this.clientId,
490
- agentName: agentName,
491
- });
492
- this.callbacks.onPush &&
493
- this.callbacks.onPush(value, this.clientId, agentName);
494
- this._array.push(value);
495
- this.callbacks.onChange &&
496
- this.callbacks.onChange(this._array, this.clientId, agentName);
497
- return [2 /*return*/, Promise.resolve()];
498
- });
499
- }); };
500
- /**
501
- * Dispose of the history for a given agent.
502
- * @param agentName - The agent name or null.
503
- * @returns A promise that resolves when the history is disposed.
504
- */
505
- this.dispose = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
506
- return __generator(this, function (_a) {
507
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
508
- swarm.loggerService.log(INSTANCE_METHOD_NAME_DISPOSE, {
509
- clientId: this.clientId,
510
- agentName: agentName,
511
- });
512
- if (agentName === null) {
513
- this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
514
- this._array = [];
515
- }
516
- return [2 /*return*/, Promise.resolve()];
517
- });
518
- }); };
519
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
520
- swarm.loggerService.log(INSTANCE_METHOD_NAME_CTOR, {
384
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
385
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_CTOR, {
521
386
  clientId: this.clientId,
522
387
  });
523
388
  if (callbacks.onInit) {
@@ -529,47 +394,47 @@ var HistoryInstance = /** @class */ (function () {
529
394
  if (callbacks.filterCondition) {
530
395
  this.iterate = function (agentName) {
531
396
  return __asyncGenerator(this, arguments, function () {
532
- var _a, _b, item, e_1_1, _c, _d, item, e_2_1;
533
- var e_1, _e, e_2, _f;
534
- return __generator(this, function (_g) {
535
- switch (_g.label) {
397
+ var _b, _c, item, e_1_1, _d, _e, item, e_2_1;
398
+ var e_1, _f, e_2, _g;
399
+ return __generator(this, function (_h) {
400
+ switch (_h.label) {
536
401
  case 0:
537
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
538
- swarm.loggerService.log(INSTANCE_METHOD_NAME_ITERATE_CONDITION, {
402
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
403
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_ITERATE_CONDITION, {
539
404
  clientId: this.clientId,
540
405
  agentName: agentName,
541
406
  });
542
407
  if (!this.callbacks.onRead) return [3 /*break*/, 12];
543
408
  this.callbacks.onReadBegin &&
544
409
  this.callbacks.onReadBegin(this.clientId, agentName);
545
- _g.label = 1;
410
+ _h.label = 1;
546
411
  case 1:
547
- _g.trys.push([1, 8, 9, 10]);
548
- _a = __values(this._array), _b = _a.next();
549
- _g.label = 2;
412
+ _h.trys.push([1, 8, 9, 10]);
413
+ _b = __values(this._array), _c = _b.next();
414
+ _h.label = 2;
550
415
  case 2:
551
- if (!!_b.done) return [3 /*break*/, 7];
552
- item = _b.value;
416
+ if (!!_c.done) return [3 /*break*/, 7];
417
+ item = _c.value;
553
418
  return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
554
419
  case 3:
555
- if (!_g.sent()) return [3 /*break*/, 6];
420
+ if (!_h.sent()) return [3 /*break*/, 6];
556
421
  this.callbacks.onRead(item, this.clientId, agentName);
557
422
  return [4 /*yield*/, __await(item)];
558
- case 4: return [4 /*yield*/, _g.sent()];
423
+ case 4: return [4 /*yield*/, _h.sent()];
559
424
  case 5:
560
- _g.sent();
561
- _g.label = 6;
425
+ _h.sent();
426
+ _h.label = 6;
562
427
  case 6:
563
- _b = _a.next();
428
+ _c = _b.next();
564
429
  return [3 /*break*/, 2];
565
430
  case 7: return [3 /*break*/, 10];
566
431
  case 8:
567
- e_1_1 = _g.sent();
432
+ e_1_1 = _h.sent();
568
433
  e_1 = { error: e_1_1 };
569
434
  return [3 /*break*/, 10];
570
435
  case 9:
571
436
  try {
572
- if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
437
+ if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
573
438
  }
574
439
  finally { if (e_1) throw e_1.error; }
575
440
  return [7 /*endfinally*/];
@@ -577,37 +442,37 @@ var HistoryInstance = /** @class */ (function () {
577
442
  this.callbacks.onReadEnd &&
578
443
  this.callbacks.onReadEnd(this.clientId, agentName);
579
444
  return [4 /*yield*/, __await(void 0)];
580
- case 11: return [2 /*return*/, _g.sent()];
445
+ case 11: return [2 /*return*/, _h.sent()];
581
446
  case 12:
582
447
  this.callbacks.onReadBegin &&
583
448
  this.callbacks.onReadBegin(this.clientId, agentName);
584
- _g.label = 13;
449
+ _h.label = 13;
585
450
  case 13:
586
- _g.trys.push([13, 20, 21, 22]);
587
- _c = __values(this._array), _d = _c.next();
588
- _g.label = 14;
451
+ _h.trys.push([13, 20, 21, 22]);
452
+ _d = __values(this._array), _e = _d.next();
453
+ _h.label = 14;
589
454
  case 14:
590
- if (!!_d.done) return [3 /*break*/, 19];
591
- item = _d.value;
455
+ if (!!_e.done) return [3 /*break*/, 19];
456
+ item = _e.value;
592
457
  return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
593
458
  case 15:
594
- if (!_g.sent()) return [3 /*break*/, 18];
459
+ if (!_h.sent()) return [3 /*break*/, 18];
595
460
  return [4 /*yield*/, __await(item)];
596
- case 16: return [4 /*yield*/, _g.sent()];
461
+ case 16: return [4 /*yield*/, _h.sent()];
597
462
  case 17:
598
- _g.sent();
599
- _g.label = 18;
463
+ _h.sent();
464
+ _h.label = 18;
600
465
  case 18:
601
- _d = _c.next();
466
+ _e = _d.next();
602
467
  return [3 /*break*/, 14];
603
468
  case 19: return [3 /*break*/, 22];
604
469
  case 20:
605
- e_2_1 = _g.sent();
470
+ e_2_1 = _h.sent();
606
471
  e_2 = { error: e_2_1 };
607
472
  return [3 /*break*/, 22];
608
473
  case 21:
609
474
  try {
610
- if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
475
+ if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
611
476
  }
612
477
  finally { if (e_2) throw e_2.error; }
613
478
  return [7 /*endfinally*/];
@@ -621,6 +486,20 @@ var HistoryInstance = /** @class */ (function () {
621
486
  };
622
487
  }
623
488
  }
489
+ /**
490
+ * Wait for the history to initialize.
491
+ * @param agentName - The agent name.
492
+ */
493
+ HistoryInstance.prototype.waitForInit = function (agentName) {
494
+ return __awaiter(this, void 0, void 0, function () {
495
+ return __generator(this, function (_b) {
496
+ switch (_b.label) {
497
+ case 0: return [4 /*yield*/, this[HISTORY_INSTANCE_WAIT_FOR_INIT](agentName)];
498
+ case 1: return [2 /*return*/, _b.sent()];
499
+ }
500
+ });
501
+ });
502
+ };
624
503
  /**
625
504
  * Iterate over the history messages for a given agent.
626
505
  * @param agentName - The agent name.
@@ -628,44 +507,44 @@ var HistoryInstance = /** @class */ (function () {
628
507
  */
629
508
  HistoryInstance.prototype.iterate = function (agentName) {
630
509
  return __asyncGenerator(this, arguments, function iterate_1() {
631
- var _a, _b, item, e_3_1, _c, _d, item, e_4_1;
632
- var e_3, _e, e_4, _f;
633
- return __generator(this, function (_g) {
634
- switch (_g.label) {
510
+ var _b, _c, item, e_3_1, _d, _e, item, e_4_1;
511
+ var e_3, _f, e_4, _g;
512
+ return __generator(this, function (_h) {
513
+ switch (_h.label) {
635
514
  case 0:
636
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
637
- swarm.loggerService.log(INSTANCE_METHOD_NAME_ITERATE, {
515
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
516
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_ITERATE, {
638
517
  clientId: this.clientId,
639
518
  agentName: agentName,
640
519
  });
641
520
  if (!this.callbacks.onRead) return [3 /*break*/, 11];
642
521
  this.callbacks.onReadBegin &&
643
522
  this.callbacks.onReadBegin(this.clientId, agentName);
644
- _g.label = 1;
523
+ _h.label = 1;
645
524
  case 1:
646
- _g.trys.push([1, 7, 8, 9]);
647
- _a = __values(this._array), _b = _a.next();
648
- _g.label = 2;
525
+ _h.trys.push([1, 7, 8, 9]);
526
+ _b = __values(this._array), _c = _b.next();
527
+ _h.label = 2;
649
528
  case 2:
650
- if (!!_b.done) return [3 /*break*/, 6];
651
- item = _b.value;
529
+ if (!!_c.done) return [3 /*break*/, 6];
530
+ item = _c.value;
652
531
  this.callbacks.onRead(item, this.clientId, agentName);
653
532
  return [4 /*yield*/, __await(item)];
654
- case 3: return [4 /*yield*/, _g.sent()];
533
+ case 3: return [4 /*yield*/, _h.sent()];
655
534
  case 4:
656
- _g.sent();
657
- _g.label = 5;
535
+ _h.sent();
536
+ _h.label = 5;
658
537
  case 5:
659
- _b = _a.next();
538
+ _c = _b.next();
660
539
  return [3 /*break*/, 2];
661
540
  case 6: return [3 /*break*/, 9];
662
541
  case 7:
663
- e_3_1 = _g.sent();
542
+ e_3_1 = _h.sent();
664
543
  e_3 = { error: e_3_1 };
665
544
  return [3 /*break*/, 9];
666
545
  case 8:
667
546
  try {
668
- if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
547
+ if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
669
548
  }
670
549
  finally { if (e_3) throw e_3.error; }
671
550
  return [7 /*endfinally*/];
@@ -673,34 +552,34 @@ var HistoryInstance = /** @class */ (function () {
673
552
  this.callbacks.onReadEnd &&
674
553
  this.callbacks.onReadEnd(this.clientId, agentName);
675
554
  return [4 /*yield*/, __await(void 0)];
676
- case 10: return [2 /*return*/, _g.sent()];
555
+ case 10: return [2 /*return*/, _h.sent()];
677
556
  case 11:
678
557
  this.callbacks.onReadBegin &&
679
558
  this.callbacks.onReadBegin(this.clientId, agentName);
680
- _g.label = 12;
559
+ _h.label = 12;
681
560
  case 12:
682
- _g.trys.push([12, 18, 19, 20]);
683
- _c = __values(this._array), _d = _c.next();
684
- _g.label = 13;
561
+ _h.trys.push([12, 18, 19, 20]);
562
+ _d = __values(this._array), _e = _d.next();
563
+ _h.label = 13;
685
564
  case 13:
686
- if (!!_d.done) return [3 /*break*/, 17];
687
- item = _d.value;
565
+ if (!!_e.done) return [3 /*break*/, 17];
566
+ item = _e.value;
688
567
  return [4 /*yield*/, __await(item)];
689
- case 14: return [4 /*yield*/, _g.sent()];
568
+ case 14: return [4 /*yield*/, _h.sent()];
690
569
  case 15:
691
- _g.sent();
692
- _g.label = 16;
570
+ _h.sent();
571
+ _h.label = 16;
693
572
  case 16:
694
- _d = _c.next();
573
+ _e = _d.next();
695
574
  return [3 /*break*/, 13];
696
575
  case 17: return [3 /*break*/, 20];
697
576
  case 18:
698
- e_4_1 = _g.sent();
577
+ e_4_1 = _h.sent();
699
578
  e_4 = { error: e_4_1 };
700
579
  return [3 /*break*/, 20];
701
580
  case 19:
702
581
  try {
703
- if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
582
+ if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
704
583
  }
705
584
  finally { if (e_4) throw e_4.error; }
706
585
  return [7 /*endfinally*/];
@@ -712,8 +591,45 @@ var HistoryInstance = /** @class */ (function () {
712
591
  });
713
592
  });
714
593
  };
594
+ /**
595
+ * Push a new message to the history for a given agent.
596
+ * @param value - The model message to push.
597
+ * @param agentName - The agent name.
598
+ * @returns A promise that resolves when the message is pushed.
599
+ */
600
+ HistoryInstance.prototype.push = function (value, agentName) {
601
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
602
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_PUSH, {
603
+ clientId: this.clientId,
604
+ agentName: agentName,
605
+ });
606
+ this.callbacks.onPush &&
607
+ this.callbacks.onPush(value, this.clientId, agentName);
608
+ this._array.push(value);
609
+ this.callbacks.onChange &&
610
+ this.callbacks.onChange(this._array, this.clientId, agentName);
611
+ return Promise.resolve();
612
+ };
613
+ /**
614
+ * Dispose of the history for a given agent.
615
+ * @param agentName - The agent name or null.
616
+ * @returns A promise that resolves when the history is disposed.
617
+ */
618
+ HistoryInstance.prototype.dispose = function (agentName) {
619
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
620
+ swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_DISPOSE, {
621
+ clientId: this.clientId,
622
+ agentName: agentName,
623
+ });
624
+ if (agentName === null) {
625
+ this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
626
+ this._array = [];
627
+ }
628
+ return Promise.resolve();
629
+ };
715
630
  return HistoryInstance;
716
631
  }());
632
+ _a$1 = HISTORY_INSTANCE_WAIT_FOR_INIT;
717
633
  /**
718
634
  * Class representing History Utilities
719
635
  */
@@ -722,8 +638,8 @@ var HistoryUtils = /** @class */ (function () {
722
638
  var _this = this;
723
639
  this.HistoryFactory = HistoryInstance;
724
640
  this.HistoryCallbacks = {};
725
- this.getHistory = memoize(function (_a) {
726
- var _b = __read(_a, 1), clientId = _b[0];
641
+ this.getHistory = memoize(function (_b) {
642
+ var _c = __read(_b, 1), clientId = _c[0];
727
643
  return clientId;
728
644
  }, function (clientId) {
729
645
  return new _this.HistoryFactory(clientId, _this.HistoryCallbacks);
@@ -734,7 +650,7 @@ var HistoryUtils = /** @class */ (function () {
734
650
  */
735
651
  this.useHistoryAdapter = function (Ctor) {
736
652
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
737
- swarm.loggerService.log(METHOD_NAME_USE_HISTORY_ADAPTER);
653
+ swarm$1.loggerService.log(METHOD_NAME_USE_HISTORY_ADAPTER);
738
654
  _this.HistoryFactory = Ctor;
739
655
  };
740
656
  /**
@@ -743,7 +659,7 @@ var HistoryUtils = /** @class */ (function () {
743
659
  */
744
660
  this.useHistoryCallbacks = function (Callbacks) {
745
661
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
746
- swarm.loggerService.log(METHOD_NAME_USE_HISTORY_CALLBACKS);
662
+ swarm$1.loggerService.log(METHOD_NAME_USE_HISTORY_CALLBACKS);
747
663
  Object.assign(_this.HistoryCallbacks, Callbacks);
748
664
  };
749
665
  /**
@@ -755,11 +671,11 @@ var HistoryUtils = /** @class */ (function () {
755
671
  */
756
672
  this.push = function (value, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
757
673
  var isInitial, history;
758
- return __generator(this, function (_a) {
759
- switch (_a.label) {
674
+ return __generator(this, function (_b) {
675
+ switch (_b.label) {
760
676
  case 0:
761
677
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
762
- swarm.loggerService.log(METHOD_NAME_PUSH, {
678
+ swarm$1.loggerService.log(METHOD_NAME_PUSH, {
763
679
  clientId: clientId,
764
680
  agentName: agentName,
765
681
  value: value,
@@ -767,12 +683,12 @@ var HistoryUtils = /** @class */ (function () {
767
683
  isInitial = this.getHistory.has(clientId);
768
684
  return [4 /*yield*/, this.getHistory(clientId)];
769
685
  case 1:
770
- history = _a.sent();
686
+ history = _b.sent();
771
687
  return [4 /*yield*/, history.waitForInit(agentName, isInitial)];
772
688
  case 2:
773
- _a.sent();
689
+ _b.sent();
774
690
  return [4 /*yield*/, history.push(value, agentName)];
775
- case 3: return [2 /*return*/, _a.sent()];
691
+ case 3: return [2 /*return*/, _b.sent()];
776
692
  }
777
693
  });
778
694
  }); };
@@ -783,25 +699,27 @@ var HistoryUtils = /** @class */ (function () {
783
699
  * @returns A promise that resolves when the history is disposed.
784
700
  */
785
701
  this.dispose = function (clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
786
- var isInitial, history;
787
- return __generator(this, function (_a) {
788
- switch (_a.label) {
702
+ var history;
703
+ return __generator(this, function (_b) {
704
+ switch (_b.label) {
789
705
  case 0:
790
706
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
791
- swarm.loggerService.log(METHOD_NAME_DISPOSE, {
707
+ swarm$1.loggerService.log(METHOD_NAME_DISPOSE, {
792
708
  clientId: clientId,
793
709
  agentName: agentName,
794
710
  });
795
- isInitial = this.getHistory.has(clientId);
711
+ if (!this.getHistory.has(clientId)) {
712
+ return [2 /*return*/];
713
+ }
796
714
  return [4 /*yield*/, this.getHistory(clientId)];
797
715
  case 1:
798
- history = _a.sent();
799
- return [4 /*yield*/, history.waitForInit(agentName, isInitial)];
716
+ history = _b.sent();
717
+ return [4 /*yield*/, history.waitForInit(agentName, false)];
800
718
  case 2:
801
- _a.sent();
719
+ _b.sent();
802
720
  return [4 /*yield*/, history.dispose(agentName)];
803
721
  case 3:
804
- _a.sent();
722
+ _b.sent();
805
723
  if (agentName === null) {
806
724
  this.getHistory.clear(clientId);
807
725
  }
@@ -818,54 +736,54 @@ var HistoryUtils = /** @class */ (function () {
818
736
  */
819
737
  HistoryUtils.prototype.iterate = function (clientId, agentName) {
820
738
  return __asyncGenerator(this, arguments, function iterate_2() {
821
- var isInitial, history, _a, _b, _c, item, e_5_1;
822
- var _d, e_5, _e, _f;
823
- return __generator(this, function (_g) {
824
- switch (_g.label) {
739
+ var isInitial, history, _b, _c, _d, item, e_5_1;
740
+ var _e, e_5, _f, _g;
741
+ return __generator(this, function (_h) {
742
+ switch (_h.label) {
825
743
  case 0:
826
744
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
827
- swarm.loggerService.log(METHOD_NAME_ITERATE, {
745
+ swarm$1.loggerService.log(METHOD_NAME_ITERATE, {
828
746
  clientId: clientId,
829
747
  agentName: agentName,
830
748
  });
831
749
  isInitial = this.getHistory.has(clientId);
832
750
  return [4 /*yield*/, __await(this.getHistory(clientId))];
833
751
  case 1:
834
- history = _g.sent();
752
+ history = _h.sent();
835
753
  return [4 /*yield*/, __await(history.waitForInit(agentName, isInitial))];
836
754
  case 2:
837
- _g.sent();
838
- _g.label = 3;
755
+ _h.sent();
756
+ _h.label = 3;
839
757
  case 3:
840
- _g.trys.push([3, 10, 11, 16]);
841
- _a = true, _b = __asyncValues(history.iterate(agentName));
842
- _g.label = 4;
843
- case 4: return [4 /*yield*/, __await(_b.next())];
758
+ _h.trys.push([3, 10, 11, 16]);
759
+ _b = true, _c = __asyncValues(history.iterate(agentName));
760
+ _h.label = 4;
761
+ case 4: return [4 /*yield*/, __await(_c.next())];
844
762
  case 5:
845
- if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 9];
846
- _f = _c.value;
847
- _a = false;
848
- item = _f;
763
+ if (!(_d = _h.sent(), _e = _d.done, !_e)) return [3 /*break*/, 9];
764
+ _g = _d.value;
765
+ _b = false;
766
+ item = _g;
849
767
  return [4 /*yield*/, __await(item)];
850
- case 6: return [4 /*yield*/, _g.sent()];
768
+ case 6: return [4 /*yield*/, _h.sent()];
851
769
  case 7:
852
- _g.sent();
853
- _g.label = 8;
770
+ _h.sent();
771
+ _h.label = 8;
854
772
  case 8:
855
- _a = true;
773
+ _b = true;
856
774
  return [3 /*break*/, 4];
857
775
  case 9: return [3 /*break*/, 16];
858
776
  case 10:
859
- e_5_1 = _g.sent();
777
+ e_5_1 = _h.sent();
860
778
  e_5 = { error: e_5_1 };
861
779
  return [3 /*break*/, 16];
862
780
  case 11:
863
- _g.trys.push([11, , 14, 15]);
864
- if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 13];
865
- return [4 /*yield*/, __await(_e.call(_b))];
781
+ _h.trys.push([11, , 14, 15]);
782
+ if (!(!_b && !_e && (_f = _c.return))) return [3 /*break*/, 13];
783
+ return [4 /*yield*/, __await(_f.call(_c))];
866
784
  case 12:
867
- _g.sent();
868
- _g.label = 13;
785
+ _h.sent();
786
+ _h.label = 13;
869
787
  case 13: return [3 /*break*/, 15];
870
788
  case 14:
871
789
  if (e_5) throw e_5.error;
@@ -906,6 +824,291 @@ var nameToTitle = function (name) {
906
824
  return __spreadArray(["".concat(word.charAt(0).toUpperCase()).concat(word.slice(1))], __read(rest), false).join(' ');
907
825
  };
908
826
 
827
+ var _a;
828
+ var LOGGER_INSTANCE_WAIT_FOR_INIT = Symbol('wait-for-init');
829
+ /**
830
+ * @class LoggerInstance
831
+ * @implements ILoggerInstance
832
+ * @description Logger instance class.
833
+ */
834
+ var LoggerInstance = /** @class */ (function () {
835
+ function LoggerInstance(clientId, callbacks) {
836
+ var _this = this;
837
+ this.clientId = clientId;
838
+ this.callbacks = callbacks;
839
+ this[_a] = singleshot(function () { return __awaiter(_this, void 0, void 0, function () {
840
+ return __generator(this, function (_b) {
841
+ if (this.callbacks.onInit) {
842
+ this.callbacks.onInit(this.clientId);
843
+ }
844
+ return [2 /*return*/];
845
+ });
846
+ }); });
847
+ }
848
+ /**
849
+ * @method waitForInit
850
+ * @description Waits for initialization.
851
+ * @returns {Promise<void>}
852
+ */
853
+ LoggerInstance.prototype.waitForInit = function () {
854
+ return __awaiter(this, void 0, void 0, function () {
855
+ return __generator(this, function (_b) {
856
+ switch (_b.label) {
857
+ case 0: return [4 /*yield*/, this[LOGGER_INSTANCE_WAIT_FOR_INIT]()];
858
+ case 1: return [2 /*return*/, _b.sent()];
859
+ }
860
+ });
861
+ });
862
+ };
863
+ /**
864
+ * @method log
865
+ * @description Logs a message.
866
+ * @param {string} topic - The topic of the log.
867
+ * @param {...any[]} args - The log arguments.
868
+ */
869
+ LoggerInstance.prototype.log = function (topic) {
870
+ var _b;
871
+ var args = [];
872
+ for (var _i = 1; _i < arguments.length; _i++) {
873
+ args[_i - 1] = arguments[_i];
874
+ }
875
+ if (this.callbacks.onLog) {
876
+ (_b = this.callbacks).onLog.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
877
+ }
878
+ };
879
+ /**
880
+ * @method debug
881
+ * @description Logs a debug message.
882
+ * @param {string} topic - The topic of the debug log.
883
+ * @param {...any[]} args - The debug log arguments.
884
+ */
885
+ LoggerInstance.prototype.debug = function (topic) {
886
+ var _b;
887
+ var args = [];
888
+ for (var _i = 1; _i < arguments.length; _i++) {
889
+ args[_i - 1] = arguments[_i];
890
+ }
891
+ if (this.callbacks.onDebug) {
892
+ (_b = this.callbacks).onDebug.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
893
+ }
894
+ };
895
+ /**
896
+ * @method info
897
+ * @description Logs an info message.
898
+ * @param {string} topic - The topic of the info log.
899
+ * @param {...any[]} args - The info log arguments.
900
+ */
901
+ LoggerInstance.prototype.info = function (topic) {
902
+ var _b;
903
+ var args = [];
904
+ for (var _i = 1; _i < arguments.length; _i++) {
905
+ args[_i - 1] = arguments[_i];
906
+ }
907
+ if (this.callbacks.onInfo) {
908
+ (_b = this.callbacks).onInfo.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
909
+ }
910
+ };
911
+ /**
912
+ * @method dispose
913
+ * @description Disposes the logger instance.
914
+ */
915
+ LoggerInstance.prototype.dispose = function () {
916
+ if (this.callbacks.onDispose) {
917
+ this.callbacks.onDispose(this.clientId);
918
+ }
919
+ };
920
+ return LoggerInstance;
921
+ }());
922
+ _a = LOGGER_INSTANCE_WAIT_FOR_INIT;
923
+ /**
924
+ * @class LoggerUtils
925
+ * @implements ILoggerAdapter, ILoggerControl
926
+ * @description Utility class for logger.
927
+ */
928
+ var LoggerUtils = /** @class */ (function () {
929
+ function LoggerUtils() {
930
+ var _this = this;
931
+ this.LoggerFactory = LoggerInstance;
932
+ this.LoggerCallbacks = {};
933
+ this.getLogger = memoize(function (_b) {
934
+ var _c = __read(_b, 1), clientId = _c[0];
935
+ return clientId;
936
+ }, function (clientId) { return new _this.LoggerFactory(clientId, _this.LoggerCallbacks); });
937
+ /**
938
+ * @method useCommonAdapter
939
+ * @description Sets the common logger adapter.
940
+ * @param {ILogger} logger - The logger instance.
941
+ */
942
+ this.useCommonAdapter = function (logger) {
943
+ swarm$1.loggerService.setLogger(logger);
944
+ };
945
+ /**
946
+ * @method useClientCallbacks
947
+ * @description Sets the client-specific callbacks.
948
+ * @param {Partial<ILoggerInstanceCallbacks>} Callbacks - The callbacks.
949
+ */
950
+ this.useClientCallbacks = function (Callbacks) {
951
+ Object.assign(_this.LoggerCallbacks, Callbacks);
952
+ };
953
+ /**
954
+ * @method useClientAdapter
955
+ * @description Sets the client-specific logger adapter.
956
+ * @param {TLoggerInstanceCtor} Ctor - The logger instance constructor.
957
+ */
958
+ this.useClientAdapter = function (Ctor) {
959
+ _this.LoggerFactory = Ctor;
960
+ };
961
+ /**
962
+ * @method log
963
+ * @description Logs a message.
964
+ * @param {string} clientId - The client ID.
965
+ * @param {string} topic - The topic of the log.
966
+ * @param {...any[]} args - The log arguments.
967
+ * @returns {Promise<void>}
968
+ */
969
+ this.log = function (clientId, topic) {
970
+ var args = [];
971
+ for (var _i = 2; _i < arguments.length; _i++) {
972
+ args[_i - 2] = arguments[_i];
973
+ }
974
+ return __awaiter(_this, void 0, void 0, function () {
975
+ var isInitial, logger;
976
+ return __generator(this, function (_b) {
977
+ switch (_b.label) {
978
+ case 0:
979
+ if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG) {
980
+ return [2 /*return*/];
981
+ }
982
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
983
+ return [2 /*return*/];
984
+ }
985
+ isInitial = this.getLogger.has(clientId);
986
+ logger = this.getLogger(clientId);
987
+ return [4 /*yield*/, logger.waitForInit(isInitial)];
988
+ case 1:
989
+ _b.sent();
990
+ return [4 /*yield*/, logger.log.apply(logger, __spreadArray([topic], __read(args), false))];
991
+ case 2:
992
+ _b.sent();
993
+ return [2 /*return*/];
994
+ }
995
+ });
996
+ });
997
+ };
998
+ /**
999
+ * @method debug
1000
+ * @description Logs a debug message.
1001
+ * @param {string} clientId - The client ID.
1002
+ * @param {string} topic - The topic of the debug log.
1003
+ * @param {...any[]} args - The debug log arguments.
1004
+ * @returns {Promise<void>}
1005
+ */
1006
+ this.debug = function (clientId, topic) {
1007
+ var args = [];
1008
+ for (var _i = 2; _i < arguments.length; _i++) {
1009
+ args[_i - 2] = arguments[_i];
1010
+ }
1011
+ return __awaiter(_this, void 0, void 0, function () {
1012
+ var isInitial, logger;
1013
+ return __generator(this, function (_b) {
1014
+ switch (_b.label) {
1015
+ case 0:
1016
+ if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG) {
1017
+ return [2 /*return*/];
1018
+ }
1019
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
1020
+ return [2 /*return*/];
1021
+ }
1022
+ isInitial = this.getLogger.has(clientId);
1023
+ logger = this.getLogger(clientId);
1024
+ return [4 /*yield*/, logger.waitForInit(isInitial)];
1025
+ case 1:
1026
+ _b.sent();
1027
+ return [4 /*yield*/, logger.debug.apply(logger, __spreadArray([topic], __read(args), false))];
1028
+ case 2:
1029
+ _b.sent();
1030
+ return [2 /*return*/];
1031
+ }
1032
+ });
1033
+ });
1034
+ };
1035
+ /**
1036
+ * @method info
1037
+ * @description Logs an info message.
1038
+ * @param {string} clientId - The client ID.
1039
+ * @param {string} topic - The topic of the info log.
1040
+ * @param {...any[]} args - The info log arguments.
1041
+ * @returns {Promise<void>}
1042
+ */
1043
+ this.info = function (clientId, topic) {
1044
+ var args = [];
1045
+ for (var _i = 2; _i < arguments.length; _i++) {
1046
+ args[_i - 2] = arguments[_i];
1047
+ }
1048
+ return __awaiter(_this, void 0, void 0, function () {
1049
+ var isInitial, logger;
1050
+ return __generator(this, function (_b) {
1051
+ switch (_b.label) {
1052
+ case 0:
1053
+ if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO) {
1054
+ return [2 /*return*/];
1055
+ }
1056
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
1057
+ return [2 /*return*/];
1058
+ }
1059
+ isInitial = this.getLogger.has(clientId);
1060
+ logger = this.getLogger(clientId);
1061
+ return [4 /*yield*/, logger.waitForInit(isInitial)];
1062
+ case 1:
1063
+ _b.sent();
1064
+ return [4 /*yield*/, logger.info.apply(logger, __spreadArray([topic], __read(args), false))];
1065
+ case 2:
1066
+ _b.sent();
1067
+ return [2 /*return*/];
1068
+ }
1069
+ });
1070
+ });
1071
+ };
1072
+ /**
1073
+ * @method dispose
1074
+ * @description Disposes the logger instance.
1075
+ * @param {string} clientId - The client ID.
1076
+ * @returns {Promise<void>}
1077
+ */
1078
+ this.dispose = function (clientId) { return __awaiter(_this, void 0, void 0, function () {
1079
+ var logger;
1080
+ return __generator(this, function (_b) {
1081
+ switch (_b.label) {
1082
+ case 0:
1083
+ if (!this.getLogger.has(clientId)) {
1084
+ return [2 /*return*/];
1085
+ }
1086
+ logger = this.getLogger(clientId);
1087
+ return [4 /*yield*/, logger.waitForInit(false)];
1088
+ case 1:
1089
+ _b.sent();
1090
+ return [4 /*yield*/, logger.dispose()];
1091
+ case 2:
1092
+ _b.sent();
1093
+ this.getLogger.clear(clientId);
1094
+ return [2 /*return*/];
1095
+ }
1096
+ });
1097
+ }); };
1098
+ }
1099
+ return LoggerUtils;
1100
+ }());
1101
+ /**
1102
+ * @constant LoggerAdapter
1103
+ * @description Singleton instance of LoggerUtils.
1104
+ */
1105
+ var LoggerAdapter = new LoggerUtils();
1106
+ /**
1107
+ * @constant Logger
1108
+ * @description Logger control interface.
1109
+ */
1110
+ var Logger = LoggerAdapter;
1111
+
909
1112
  /**
910
1113
  * @description `ask for agent function` in `llama3.1:8b` to troubleshoot (need CC_OLLAMA_EMIT_TOOL_PROTOCOL to be turned off)
911
1114
  */
@@ -926,19 +1129,11 @@ var CC_EMPTY_OUTPUT_PLACEHOLDERS = [
926
1129
  "Could you please repeat that? I didn’t catch it.",
927
1130
  ];
928
1131
  var CC_SWARM_AGENT_CHANGED = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
929
- switch (_a.label) {
930
- case 0: return [4 /*yield*/, sleep(100)];
931
- case 1: return [2 /*return*/, _a.sent()];
932
- }
1132
+ return [2 /*return*/, Promise.resolve()];
933
1133
  }); }); };
934
1134
  var CC_SWARM_DEFAULT_AGENT = function (_a, _b, defaultAgent_1) { return __awaiter(void 0, [_a, _b, defaultAgent_1], void 0, function (_c, _d, defaultAgent) {
935
1135
  return __generator(this, function (_e) {
936
- switch (_e.label) {
937
- case 0: return [4 /*yield*/, sleep(100)];
938
- case 1:
939
- _e.sent();
940
- return [2 /*return*/, defaultAgent];
941
- }
1136
+ return [2 /*return*/, defaultAgent];
942
1137
  });
943
1138
  }); };
944
1139
  var CC_AGENT_DEFAULT_VALIDATION = validateDefault;
@@ -959,12 +1154,13 @@ var CC_AGENT_HISTORY_FILTER = function (agentName) {
959
1154
  var CC_AGENT_OUTPUT_TRANSFORM = removeXmlTags;
960
1155
  var CC_KEEP_MESSAGES = 5;
961
1156
  var CC_GET_AGENT_HISTORY_ADAPTER = function () { return HistoryAdapter; };
1157
+ var CC_GET_CLIENT_LOGGER_ADAPTER = function () { return LoggerAdapter; };
962
1158
  var CC_AGENT_OUTPUT_MAP = function (message) { return message; };
963
1159
  var CC_AGENT_SYSTEM_PROMPT = undefined;
964
1160
  var CC_STORAGE_SEARCH_SIMILARITY = 0.65;
965
1161
  var CC_STORAGE_SEARCH_POOL = 5;
966
1162
  var CC_LOGGER_ENABLE_INFO = false;
967
- var CC_LOGGER_ENABLE_DEBUG = true;
1163
+ var CC_LOGGER_ENABLE_DEBUG = false;
968
1164
  var CC_LOGGER_ENABLE_LOG = true;
969
1165
  var CC_NAME_TO_TITLE = nameToTitle;
970
1166
  var GLOBAL_CONFIG = {
@@ -972,6 +1168,7 @@ var GLOBAL_CONFIG = {
972
1168
  CC_EMPTY_OUTPUT_PLACEHOLDERS: CC_EMPTY_OUTPUT_PLACEHOLDERS,
973
1169
  CC_KEEP_MESSAGES: CC_KEEP_MESSAGES,
974
1170
  CC_GET_AGENT_HISTORY_ADAPTER: CC_GET_AGENT_HISTORY_ADAPTER,
1171
+ CC_GET_CLIENT_LOGGER_ADAPTER: CC_GET_CLIENT_LOGGER_ADAPTER,
975
1172
  CC_SWARM_AGENT_CHANGED: CC_SWARM_AGENT_CHANGED,
976
1173
  CC_SWARM_DEFAULT_AGENT: CC_SWARM_DEFAULT_AGENT,
977
1174
  CC_AGENT_DEFAULT_VALIDATION: CC_AGENT_DEFAULT_VALIDATION,
@@ -992,6 +1189,123 @@ var setConfig = function (config) {
992
1189
  Object.assign(GLOBAL_CONFIG, config);
993
1190
  };
994
1191
 
1192
+ var NOOP_LOGGER = {
1193
+ /**
1194
+ * Logs normal level messages.
1195
+ */
1196
+ log: function () {
1197
+ },
1198
+ /**
1199
+ * Logs debug level messages.
1200
+ */
1201
+ debug: function () {
1202
+ },
1203
+ /**
1204
+ * Logs info level messages.
1205
+ */
1206
+ info: function () {
1207
+ },
1208
+ };
1209
+ /**
1210
+ * LoggerService class that implements the ILogger interface.
1211
+ * Provides methods to log and debug messages.
1212
+ */
1213
+ var LoggerService = /** @class */ (function () {
1214
+ function LoggerService() {
1215
+ var _this = this;
1216
+ this.methodContextService = inject(TYPES.methodContextService);
1217
+ this.executionContextService = inject(TYPES.executionContextService);
1218
+ this._commonLogger = NOOP_LOGGER;
1219
+ /**
1220
+ * Creates the client logs adapter using factory
1221
+ */
1222
+ this.getLoggerAdapter = singleshot(GLOBAL_CONFIG.CC_GET_CLIENT_LOGGER_ADAPTER);
1223
+ /**
1224
+ * Logs messages using the current logger.
1225
+ * @param {...any} args - The messages to log.
1226
+ */
1227
+ this.log = function (topic) {
1228
+ var _a, _b;
1229
+ var _c;
1230
+ var args = [];
1231
+ for (var _i = 1; _i < arguments.length; _i++) {
1232
+ args[_i - 1] = arguments[_i];
1233
+ }
1234
+ var methodContext = MethodContextService.hasContext()
1235
+ ? _this.methodContextService.context
1236
+ : null;
1237
+ var executionContext = ExecutionContextService.hasContext()
1238
+ ? _this.executionContextService.context
1239
+ : null;
1240
+ var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
1241
+ var context = {
1242
+ methodContext: methodContext,
1243
+ executionContext: executionContext,
1244
+ };
1245
+ clientId && (_a = _this.getLoggerAdapter()).log.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
1246
+ (_b = _this._commonLogger).log.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
1247
+ };
1248
+ /**
1249
+ * Logs debug messages using the current logger.
1250
+ * @param {...any} args - The debug messages to log.
1251
+ */
1252
+ this.debug = function (topic) {
1253
+ var _a, _b;
1254
+ var _c;
1255
+ var args = [];
1256
+ for (var _i = 1; _i < arguments.length; _i++) {
1257
+ args[_i - 1] = arguments[_i];
1258
+ }
1259
+ var methodContext = MethodContextService.hasContext()
1260
+ ? _this.methodContextService.context
1261
+ : null;
1262
+ var executionContext = ExecutionContextService.hasContext()
1263
+ ? _this.executionContextService.context
1264
+ : null;
1265
+ var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
1266
+ var context = {
1267
+ methodContext: methodContext,
1268
+ executionContext: executionContext,
1269
+ };
1270
+ clientId && (_a = _this.getLoggerAdapter()).debug.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
1271
+ (_b = _this._commonLogger).debug.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
1272
+ };
1273
+ /**
1274
+ * Logs info messages using the current logger.
1275
+ * @param {...any} args - The info messages to log.
1276
+ */
1277
+ this.info = function (topic) {
1278
+ var _a, _b;
1279
+ var _c;
1280
+ var args = [];
1281
+ for (var _i = 1; _i < arguments.length; _i++) {
1282
+ args[_i - 1] = arguments[_i];
1283
+ }
1284
+ var methodContext = MethodContextService.hasContext()
1285
+ ? _this.methodContextService.context
1286
+ : null;
1287
+ var executionContext = ExecutionContextService.hasContext()
1288
+ ? _this.executionContextService.context
1289
+ : null;
1290
+ var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
1291
+ var context = {
1292
+ methodContext: methodContext,
1293
+ executionContext: executionContext,
1294
+ };
1295
+ clientId && (_a = _this.getLoggerAdapter()).info.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
1296
+ (_b = _this._commonLogger).info.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
1297
+ };
1298
+ /**
1299
+ * Sets a new logger.
1300
+ * @param {ILogger} logger - The new logger to set.
1301
+ */
1302
+ this.setLogger = function (logger) {
1303
+ _this._commonLogger = logger;
1304
+ };
1305
+ }
1306
+ return LoggerService;
1307
+ }());
1308
+
995
1309
  /**
996
1310
  * Service for managing agent schemas.
997
1311
  */
@@ -2375,7 +2689,7 @@ var ClientSwarm = /** @class */ (function () {
2375
2689
  this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgentName"));
2376
2690
  if (!(this._activeAgent === AGENT_NEED_FETCH)) return [3 /*break*/, 2];
2377
2691
  _a = this;
2378
- return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_DEFAULT_AGENT(this.params.clientId, this.params.swarmName, this.params.defaultAgent)];
2692
+ return [4 /*yield*/, this.params.getActiveAgent(this.params.clientId, this.params.swarmName, this.params.defaultAgent)];
2379
2693
  case 1:
2380
2694
  _a._activeAgent = _b.sent();
2381
2695
  _b.label = 2;
@@ -2473,15 +2787,19 @@ var ClientSwarm = /** @class */ (function () {
2473
2787
  * @param {AgentName} agentName - The name of the agent to set as active.
2474
2788
  */
2475
2789
  this.setAgentName = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
2476
- return __generator(this, function (_a) {
2477
- switch (_a.label) {
2790
+ var _a;
2791
+ return __generator(this, function (_b) {
2792
+ switch (_b.label) {
2478
2793
  case 0:
2479
2794
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2480
2795
  this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " setAgentName agentName=").concat(agentName));
2481
2796
  this._activeAgent = agentName;
2482
- return [4 /*yield*/, this.params.onAgentChanged(this.params.clientId, agentName, this.params.swarmName)];
2797
+ return [4 /*yield*/, this.params.setActiveAgent(this.params.clientId, agentName, this.params.swarmName)];
2483
2798
  case 1:
2484
- _a.sent();
2799
+ _b.sent();
2800
+ if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onAgentChanged) {
2801
+ this.params.callbacks.onAgentChanged(this.params.clientId, agentName, this.params.swarmName);
2802
+ }
2485
2803
  return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
2486
2804
  type: "set-agent-name",
2487
2805
  source: "swarm-bus",
@@ -2495,7 +2813,7 @@ var ClientSwarm = /** @class */ (function () {
2495
2813
  clientId: this.params.clientId,
2496
2814
  })];
2497
2815
  case 2:
2498
- _a.sent();
2816
+ _b.sent();
2499
2817
  return [2 /*return*/];
2500
2818
  }
2501
2819
  });
@@ -2538,7 +2856,7 @@ var SwarmConnectionService = /** @class */ (function () {
2538
2856
  return "".concat(clientId, "-").concat(swarmName);
2539
2857
  }, function (clientId, swarmName) {
2540
2858
  var e_1, _a;
2541
- var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent, callbacks = _b.callbacks;
2859
+ var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent, callbacks = _b.callbacks, _c = _b.getActiveAgent, getActiveAgent = _c === void 0 ? GLOBAL_CONFIG.CC_SWARM_DEFAULT_AGENT : _c, _d = _b.setActiveAgent, setActiveAgent = _d === void 0 ? GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED : _d;
2542
2860
  var agentMap = {};
2543
2861
  try {
2544
2862
  for (var agentList_1 = __values(agentList), agentList_1_1 = agentList_1.next(); !agentList_1_1.done; agentList_1_1 = agentList_1.next()) {
@@ -2560,22 +2878,8 @@ var SwarmConnectionService = /** @class */ (function () {
2560
2878
  swarmName: swarmName,
2561
2879
  logger: _this.loggerService,
2562
2880
  bus: _this.busService,
2563
- onAgentChanged: function (clientId, agentName, swarmName) {
2564
- return __awaiter(this, void 0, void 0, function () {
2565
- return __generator(this, function (_a) {
2566
- switch (_a.label) {
2567
- case 0:
2568
- if (callbacks && callbacks.onAgentChanged) {
2569
- callbacks.onAgentChanged(clientId, agentName, swarmName);
2570
- }
2571
- return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED(clientId, agentName, swarmName)];
2572
- case 1:
2573
- _a.sent();
2574
- return [2 /*return*/];
2575
- }
2576
- });
2577
- });
2578
- },
2881
+ getActiveAgent: getActiveAgent,
2882
+ setActiveAgent: setActiveAgent,
2579
2883
  callbacks: callbacks,
2580
2884
  });
2581
2885
  });
@@ -6716,6 +7020,7 @@ var validationServices = {
6716
7020
  };
6717
7021
  var swarm = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices), contextServices), connectionServices), schemaServices), publicServices), validationServices);
6718
7022
  init();
7023
+ var swarm$1 = swarm;
6719
7024
 
6720
7025
  var METHOD_NAME$C = "function.addAgent";
6721
7026
  /**
@@ -6726,11 +7031,11 @@ var METHOD_NAME$C = "function.addAgent";
6726
7031
  */
6727
7032
  var addAgent = function (agentSchema) {
6728
7033
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6729
- swarm.loggerService.log(METHOD_NAME$C, {
7034
+ swarm$1.loggerService.log(METHOD_NAME$C, {
6730
7035
  agentSchema: agentSchema,
6731
7036
  });
6732
- swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
6733
- swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
7037
+ swarm$1.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
7038
+ swarm$1.agentSchemaService.register(agentSchema.agentName, agentSchema);
6734
7039
  return agentSchema.agentName;
6735
7040
  };
6736
7041
 
@@ -6744,11 +7049,11 @@ var METHOD_NAME$B = "function.addCompletion";
6744
7049
  */
6745
7050
  var addCompletion = function (completionSchema) {
6746
7051
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6747
- swarm.loggerService.log(METHOD_NAME$B, {
7052
+ swarm$1.loggerService.log(METHOD_NAME$B, {
6748
7053
  completionSchema: completionSchema,
6749
7054
  });
6750
- swarm.completionValidationService.addCompletion(completionSchema.completionName);
6751
- swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
7055
+ swarm$1.completionValidationService.addCompletion(completionSchema.completionName);
7056
+ swarm$1.completionSchemaService.register(completionSchema.completionName, completionSchema);
6752
7057
  return completionSchema.completionName;
6753
7058
  };
6754
7059
 
@@ -6761,11 +7066,11 @@ var METHOD_NAME$A = "function.addSwarm";
6761
7066
  */
6762
7067
  var addSwarm = function (swarmSchema) {
6763
7068
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6764
- swarm.loggerService.log(METHOD_NAME$A, {
7069
+ swarm$1.loggerService.log(METHOD_NAME$A, {
6765
7070
  swarmSchema: swarmSchema,
6766
7071
  });
6767
- swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
6768
- swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
7072
+ swarm$1.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
7073
+ swarm$1.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
6769
7074
  return swarmSchema.swarmName;
6770
7075
  };
6771
7076
 
@@ -6779,11 +7084,11 @@ var METHOD_NAME$z = "function.addTool";
6779
7084
  */
6780
7085
  var addTool = function (toolSchema) {
6781
7086
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6782
- swarm.loggerService.log(METHOD_NAME$z, {
7087
+ swarm$1.loggerService.log(METHOD_NAME$z, {
6783
7088
  toolSchema: toolSchema,
6784
7089
  });
6785
- swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
6786
- swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
7090
+ swarm$1.toolValidationService.addTool(toolSchema.toolName, toolSchema);
7091
+ swarm$1.toolSchemaService.register(toolSchema.toolName, toolSchema);
6787
7092
  return toolSchema.toolName;
6788
7093
  };
6789
7094
 
@@ -6796,12 +7101,12 @@ var METHOD_NAME$y = "function.addState";
6796
7101
  */
6797
7102
  var addState = function (stateSchema) {
6798
7103
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6799
- swarm.loggerService.log(METHOD_NAME$y, {
7104
+ swarm$1.loggerService.log(METHOD_NAME$y, {
6800
7105
  stateSchema: stateSchema,
6801
7106
  });
6802
- swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
7107
+ swarm$1.stateSchemaService.register(stateSchema.stateName, stateSchema);
6803
7108
  if (stateSchema.shared) {
6804
- swarm.stateConnectionService
7109
+ swarm$1.stateConnectionService
6805
7110
  .getSharedStateRef("shared", stateSchema.stateName)
6806
7111
  .waitForInit();
6807
7112
  }
@@ -6817,11 +7122,11 @@ var METHOD_NAME$x = "function.addEmbedding";
6817
7122
  */
6818
7123
  var addEmbedding = function (embeddingSchema) {
6819
7124
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6820
- swarm.loggerService.log(METHOD_NAME$x, {
7125
+ swarm$1.loggerService.log(METHOD_NAME$x, {
6821
7126
  embeddingSchema: embeddingSchema,
6822
7127
  });
6823
- swarm.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
6824
- swarm.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
7128
+ swarm$1.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
7129
+ swarm$1.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
6825
7130
  return embeddingSchema.embeddingName;
6826
7131
  };
6827
7132
 
@@ -6834,13 +7139,13 @@ var METHOD_NAME$w = "function.addStorage";
6834
7139
  */
6835
7140
  var addStorage = function (storageSchema) {
6836
7141
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6837
- swarm.loggerService.log(METHOD_NAME$w, {
7142
+ swarm$1.loggerService.log(METHOD_NAME$w, {
6838
7143
  storageSchema: storageSchema,
6839
7144
  });
6840
- swarm.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
6841
- swarm.storageSchemaService.register(storageSchema.storageName, storageSchema);
7145
+ swarm$1.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
7146
+ swarm$1.storageSchemaService.register(storageSchema.storageName, storageSchema);
6842
7147
  if (storageSchema.shared) {
6843
- swarm.storageConnectionService
7148
+ swarm$1.storageConnectionService
6844
7149
  .getSharedStorage("shared", storageSchema.storageName)
6845
7150
  .waitForInit();
6846
7151
  }
@@ -6862,28 +7167,28 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6862
7167
  switch (_a.label) {
6863
7168
  case 0:
6864
7169
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6865
- swarm.loggerService.log(METHOD_NAME$v, {
7170
+ swarm$1.loggerService.log(METHOD_NAME$v, {
6866
7171
  content: content,
6867
7172
  clientId: clientId,
6868
7173
  agentName: agentName,
6869
7174
  });
6870
- swarm.agentValidationService.validate(agentName, METHOD_NAME$v);
6871
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$v);
6872
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
6873
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$v);
6874
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName)];
7175
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
7176
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
7177
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7178
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
7179
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName)];
6875
7180
  case 1:
6876
7181
  currentAgentName = _a.sent();
6877
7182
  if (currentAgentName !== agentName) {
6878
7183
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6879
- swarm.loggerService.log('function "commitUserMessage" skipped due to the agent change', {
7184
+ swarm$1.loggerService.log('function "commitUserMessage" skipped due to the agent change', {
6880
7185
  currentAgentName: currentAgentName,
6881
7186
  agentName: agentName,
6882
7187
  clientId: clientId,
6883
7188
  });
6884
7189
  return [2 /*return*/];
6885
7190
  }
6886
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$v, clientId, swarmName)];
7191
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$v, clientId, swarmName)];
6887
7192
  case 2:
6888
7193
  _a.sent();
6889
7194
  return [2 /*return*/];
@@ -6905,13 +7210,13 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
6905
7210
  switch (_a.label) {
6906
7211
  case 0:
6907
7212
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6908
- swarm.loggerService.log(METHOD_NAME$u, {
7213
+ swarm$1.loggerService.log(METHOD_NAME$u, {
6909
7214
  clientId: clientId,
6910
7215
  });
6911
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$u);
6912
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
6913
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$u);
6914
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
7216
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
7217
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7218
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
7219
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
6915
7220
  case 1: return [2 /*return*/, _a.sent()];
6916
7221
  }
6917
7222
  });
@@ -6929,25 +7234,25 @@ var METHOD_NAME$t = "function.makeConnection";
6929
7234
  */
6930
7235
  var makeConnection = function (connector, clientId, swarmName) {
6931
7236
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6932
- swarm.loggerService.log(METHOD_NAME$t, {
7237
+ swarm$1.loggerService.log(METHOD_NAME$t, {
6933
7238
  clientId: clientId,
6934
7239
  swarmName: swarmName,
6935
7240
  });
6936
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$t);
6937
- swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
6938
- var send = swarm.sessionPublicService.connect(connector, METHOD_NAME$t, clientId, swarmName);
7241
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
7242
+ swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
7243
+ var send = swarm$1.sessionPublicService.connect(connector, METHOD_NAME$t, clientId, swarmName);
6939
7244
  return queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
6940
7245
  var _a;
6941
7246
  var _b;
6942
7247
  return __generator(this, function (_c) {
6943
7248
  switch (_c.label) {
6944
7249
  case 0:
6945
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$t);
7250
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
6946
7251
  _a = send;
6947
7252
  _b = {
6948
7253
  data: outgoing
6949
7254
  };
6950
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName)];
7255
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName)];
6951
7256
  case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
6952
7257
  _b.clientId = clientId,
6953
7258
  _b)])];
@@ -6978,7 +7283,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
6978
7283
  return __generator(this, function (_a) {
6979
7284
  switch (_a.label) {
6980
7285
  case 0:
6981
- if (!swarm.sessionValidationService.hasSession(clientId)) {
7286
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
6982
7287
  return [2 /*return*/];
6983
7288
  }
6984
7289
  return [4 /*yield*/, send(content)];
@@ -6998,7 +7303,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
6998
7303
  return __generator(this, function (_f) {
6999
7304
  switch (_f.label) {
7000
7305
  case 0:
7001
- if (!swarm.sessionValidationService.hasSession(clientId)) {
7306
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
7002
7307
  return [2 /*return*/];
7003
7308
  }
7004
7309
  _c = commitUserMessage;
@@ -7056,15 +7361,15 @@ var createChangeAgent = ttl(function (clientId) {
7056
7361
  return __generator(this, function (_d) {
7057
7362
  switch (_d.label) {
7058
7363
  case 0:
7059
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$s);
7060
- swarm.agentValidationService.validate(agentName, METHOD_NAME$s);
7061
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7062
- return [4 /*yield*/, Promise.all(swarm.swarmValidationService
7364
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
7365
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
7366
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7367
+ return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
7063
7368
  .getAgentList(swarmName)
7064
7369
  .map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
7065
7370
  return __generator(this, function (_a) {
7066
7371
  switch (_a.label) {
7067
- case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
7372
+ case 0: return [4 /*yield*/, swarm$1.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
7068
7373
  case 1:
7069
7374
  _a.sent();
7070
7375
  return [2 /*return*/];
@@ -7073,22 +7378,22 @@ var createChangeAgent = ttl(function (clientId) {
7073
7378
  }); }))];
7074
7379
  case 1:
7075
7380
  _d.sent();
7076
- return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
7381
+ return [4 /*yield*/, swarm$1.agentPublicService.dispose(methodName, clientId, agentName)];
7077
7382
  case 2:
7078
7383
  _d.sent();
7079
- return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
7384
+ return [4 /*yield*/, swarm$1.historyPublicService.dispose(methodName, clientId, agentName)];
7080
7385
  case 3:
7081
7386
  _d.sent();
7082
- _b = (_a = swarm.swarmPublicService).setAgentRef;
7387
+ _b = (_a = swarm$1.swarmPublicService).setAgentRef;
7083
7388
  _c = [methodName,
7084
7389
  clientId,
7085
7390
  swarmName,
7086
7391
  agentName];
7087
- return [4 /*yield*/, swarm.agentPublicService.createAgentRef(methodName, clientId, agentName)];
7392
+ return [4 /*yield*/, swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName)];
7088
7393
  case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
7089
7394
  case 5:
7090
7395
  _d.sent();
7091
- return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
7396
+ return [4 /*yield*/, swarm$1.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
7092
7397
  case 6:
7093
7398
  _d.sent();
7094
7399
  return [2 /*return*/];
@@ -7127,7 +7432,7 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
7127
7432
  switch (_a.label) {
7128
7433
  case 0:
7129
7434
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7130
- swarm.loggerService.log(METHOD_NAME$s, {
7435
+ swarm$1.loggerService.log(METHOD_NAME$s, {
7131
7436
  agentName: agentName,
7132
7437
  clientId: clientId,
7133
7438
  });
@@ -7160,28 +7465,26 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7160
7465
  switch (_a.label) {
7161
7466
  case 0:
7162
7467
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7163
- swarm.loggerService.log(METHOD_NAME$r, {
7468
+ swarm$1.loggerService.log(METHOD_NAME$r, {
7164
7469
  clientId: clientId,
7165
7470
  swarmName: swarmName,
7166
7471
  });
7167
- swarm.swarmValidationService.validate(swarmName, methodName);
7168
- swarm.sessionValidationService.removeSession(clientId);
7169
- swarm.busService.dispose(clientId);
7170
- return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
7472
+ swarm$1.swarmValidationService.validate(swarmName, methodName);
7473
+ return [4 /*yield*/, swarm$1.sessionPublicService.dispose(methodName, clientId, swarmName)];
7171
7474
  case 1:
7172
7475
  _a.sent();
7173
- return [4 /*yield*/, swarm.swarmPublicService.dispose(methodName, clientId, swarmName)];
7476
+ return [4 /*yield*/, swarm$1.swarmPublicService.dispose(methodName, clientId, swarmName)];
7174
7477
  case 2:
7175
7478
  _a.sent();
7176
- return [4 /*yield*/, Promise.all(swarm.swarmValidationService
7479
+ return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
7177
7480
  .getAgentList(swarmName)
7178
7481
  .map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
7179
7482
  return __generator(this, function (_a) {
7180
7483
  switch (_a.label) {
7181
- case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
7484
+ case 0: return [4 /*yield*/, swarm$1.agentPublicService.dispose(methodName, clientId, agentName)];
7182
7485
  case 1:
7183
7486
  _a.sent();
7184
- return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
7487
+ return [4 /*yield*/, swarm$1.historyPublicService.dispose(methodName, clientId, agentName)];
7185
7488
  case 2:
7186
7489
  _a.sent();
7187
7490
  return [2 /*return*/];
@@ -7190,16 +7493,16 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7190
7493
  }); }))];
7191
7494
  case 3:
7192
7495
  _a.sent();
7193
- return [4 /*yield*/, Promise.all(swarm.swarmValidationService
7496
+ return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
7194
7497
  .getAgentList(swarmName)
7195
7498
  .flatMap(function (agentName) {
7196
- return swarm.agentValidationService.getStorageList(agentName);
7499
+ return swarm$1.agentValidationService.getStorageList(agentName);
7197
7500
  })
7198
7501
  .filter(function (storageName) { return !!storageName; })
7199
7502
  .map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
7200
7503
  return __generator(this, function (_a) {
7201
7504
  switch (_a.label) {
7202
- case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(methodName, clientId, storageName)];
7505
+ case 0: return [4 /*yield*/, swarm$1.storagePublicService.dispose(methodName, clientId, storageName)];
7203
7506
  case 1:
7204
7507
  _a.sent();
7205
7508
  return [2 /*return*/];
@@ -7208,16 +7511,16 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7208
7511
  }); }))];
7209
7512
  case 4:
7210
7513
  _a.sent();
7211
- return [4 /*yield*/, Promise.all(swarm.swarmValidationService
7514
+ return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
7212
7515
  .getAgentList(swarmName)
7213
7516
  .flatMap(function (agentName) {
7214
- return swarm.agentValidationService.getStateList(agentName);
7517
+ return swarm$1.agentValidationService.getStateList(agentName);
7215
7518
  })
7216
7519
  .filter(function (stateName) { return !!stateName; })
7217
7520
  .map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
7218
7521
  return __generator(this, function (_a) {
7219
7522
  switch (_a.label) {
7220
- case 0: return [4 /*yield*/, swarm.statePublicService.dispose(methodName, clientId, stateName)];
7523
+ case 0: return [4 /*yield*/, swarm$1.statePublicService.dispose(methodName, clientId, stateName)];
7221
7524
  case 1:
7222
7525
  _a.sent();
7223
7526
  return [2 /*return*/];
@@ -7229,6 +7532,11 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7229
7532
  return [4 /*yield*/, HistoryAdapter.dispose(clientId, null)];
7230
7533
  case 6:
7231
7534
  _a.sent();
7535
+ return [4 /*yield*/, LoggerAdapter.dispose(clientId)];
7536
+ case 7:
7537
+ _a.sent();
7538
+ swarm$1.sessionValidationService.removeSession(clientId);
7539
+ swarm$1.busService.dispose(clientId);
7232
7540
  return [2 /*return*/];
7233
7541
  }
7234
7542
  });
@@ -7250,9 +7558,9 @@ var createComplete = ttl(function (clientId, swarmName) {
7250
7558
  return __generator(this, function (_a) {
7251
7559
  switch (_a.label) {
7252
7560
  case 0:
7253
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
7254
- swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
7255
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME, clientId, swarmName)];
7561
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
7562
+ swarm$1.sessionValidationService.addSession(clientId, swarmName, "complete");
7563
+ return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME, clientId, swarmName)];
7256
7564
  case 1:
7257
7565
  result = _a.sent();
7258
7566
  return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME)];
@@ -7295,7 +7603,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
7295
7603
  case 0:
7296
7604
  executionId = randomString();
7297
7605
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7298
- swarm.loggerService.log(METHOD_NAME$q, {
7606
+ swarm$1.loggerService.log(METHOD_NAME$q, {
7299
7607
  content: content,
7300
7608
  clientId: clientId,
7301
7609
  executionId: executionId,
@@ -7334,13 +7642,13 @@ var METHOD_NAME$p = "function.session";
7334
7642
  var session = function (clientId, swarmName) {
7335
7643
  var executionId = randomString();
7336
7644
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7337
- swarm.loggerService.log(METHOD_NAME$p, {
7645
+ swarm$1.loggerService.log(METHOD_NAME$p, {
7338
7646
  clientId: clientId,
7339
7647
  swarmName: swarmName,
7340
7648
  executionId: executionId,
7341
7649
  });
7342
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$p);
7343
- swarm.sessionValidationService.addSession(clientId, swarmName, "session");
7650
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
7651
+ swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
7344
7652
  return {
7345
7653
  /**
7346
7654
  * Completes the session with the given content.
@@ -7350,11 +7658,11 @@ var session = function (clientId, swarmName) {
7350
7658
  */
7351
7659
  complete: queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
7352
7660
  return __generator(this, function (_a) {
7353
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$p);
7661
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
7354
7662
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7355
7663
  return __generator(this, function (_a) {
7356
7664
  switch (_a.label) {
7357
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME$p, clientId, swarmName)];
7665
+ case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$p, clientId, swarmName)];
7358
7666
  case 1: return [2 /*return*/, _a.sent()];
7359
7667
  }
7360
7668
  });
@@ -7490,16 +7798,16 @@ var getRawHistory = function (clientId_1) {
7490
7798
  switch (_a.label) {
7491
7799
  case 0:
7492
7800
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7493
- swarm.loggerService.log(METHOD_NAME$o, {
7801
+ swarm$1.loggerService.log(METHOD_NAME$o, {
7494
7802
  clientId: clientId,
7495
7803
  });
7496
- swarm.sessionValidationService.validate(clientId, methodName);
7497
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7498
- swarm.swarmValidationService.validate(swarmName, methodName);
7499
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7804
+ swarm$1.sessionValidationService.validate(clientId, methodName);
7805
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7806
+ swarm$1.swarmValidationService.validate(swarmName, methodName);
7807
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7500
7808
  case 1:
7501
7809
  agentName = _a.sent();
7502
- return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
7810
+ return [4 /*yield*/, swarm$1.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
7503
7811
  case 2:
7504
7812
  history = _a.sent();
7505
7813
  return [2 /*return*/, __spreadArray([], __read(history), false)];
@@ -7522,13 +7830,13 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
7522
7830
  switch (_a.label) {
7523
7831
  case 0:
7524
7832
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7525
- swarm.loggerService.log(METHOD_NAME$n, {
7833
+ swarm$1.loggerService.log(METHOD_NAME$n, {
7526
7834
  clientId: clientId,
7527
7835
  agentName: agentName,
7528
7836
  });
7529
- swarm.agentValidationService.validate(agentName, METHOD_NAME$n);
7530
- prompt = swarm.agentSchemaService.get(agentName).prompt;
7531
- return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$n, clientId, agentName)];
7837
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$n);
7838
+ prompt = swarm$1.agentSchemaService.get(agentName).prompt;
7839
+ return [4 /*yield*/, swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$n, clientId, agentName)];
7532
7840
  case 1:
7533
7841
  history = _a.sent();
7534
7842
  return [2 /*return*/, __spreadArray([], __read(history), false)];
@@ -7546,12 +7854,12 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
7546
7854
  var swarmName;
7547
7855
  return __generator(this, function (_a) {
7548
7856
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7549
- swarm.loggerService.log(METHOD_NAME$m, {
7857
+ swarm$1.loggerService.log(METHOD_NAME$m, {
7550
7858
  clientId: clientId,
7551
7859
  });
7552
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7553
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$m);
7554
- return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
7860
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7861
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
7862
+ return [2 /*return*/, swarm$1.sessionValidationService.getSessionMode(clientId)];
7555
7863
  });
7556
7864
  }); };
7557
7865
 
@@ -7570,22 +7878,22 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7570
7878
  switch (_a.label) {
7571
7879
  case 0:
7572
7880
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7573
- swarm.loggerService.log(METHOD_NAME$l, {
7881
+ swarm$1.loggerService.log(METHOD_NAME$l, {
7574
7882
  toolId: toolId,
7575
7883
  content: content,
7576
7884
  clientId: clientId,
7577
7885
  agentName: agentName,
7578
7886
  });
7579
- swarm.agentValidationService.validate(agentName, METHOD_NAME$l);
7580
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$l);
7581
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7582
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$l);
7583
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
7887
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
7888
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
7889
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7890
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
7891
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
7584
7892
  case 1:
7585
7893
  currentAgentName = _a.sent();
7586
7894
  if (currentAgentName !== agentName) {
7587
7895
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7588
- swarm.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
7896
+ swarm$1.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
7589
7897
  toolId: toolId,
7590
7898
  currentAgentName: currentAgentName,
7591
7899
  agentName: agentName,
@@ -7593,7 +7901,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7593
7901
  });
7594
7902
  return [2 /*return*/];
7595
7903
  }
7596
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$l, clientId, swarmName)];
7904
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$l, clientId, swarmName)];
7597
7905
  case 2:
7598
7906
  _a.sent();
7599
7907
  return [2 /*return*/];
@@ -7616,28 +7924,28 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7616
7924
  switch (_a.label) {
7617
7925
  case 0:
7618
7926
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7619
- swarm.loggerService.log(METHOD_NAME$k, {
7927
+ swarm$1.loggerService.log(METHOD_NAME$k, {
7620
7928
  content: content,
7621
7929
  clientId: clientId,
7622
7930
  agentName: agentName,
7623
7931
  });
7624
- swarm.agentValidationService.validate(agentName, METHOD_NAME$k);
7625
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$k);
7626
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7627
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$k);
7628
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
7932
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
7933
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
7934
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7935
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
7936
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
7629
7937
  case 1:
7630
7938
  currentAgentName = _a.sent();
7631
7939
  if (currentAgentName !== agentName) {
7632
7940
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7633
- swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
7941
+ swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
7634
7942
  currentAgentName: currentAgentName,
7635
7943
  agentName: agentName,
7636
7944
  clientId: clientId,
7637
7945
  });
7638
7946
  return [2 /*return*/];
7639
7947
  }
7640
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$k, clientId, swarmName)];
7948
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$k, clientId, swarmName)];
7641
7949
  case 2:
7642
7950
  _a.sent();
7643
7951
  return [2 /*return*/];
@@ -7659,27 +7967,27 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7659
7967
  switch (_a.label) {
7660
7968
  case 0:
7661
7969
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7662
- swarm.loggerService.log(METHOD_NAME$j, {
7970
+ swarm$1.loggerService.log(METHOD_NAME$j, {
7663
7971
  clientId: clientId,
7664
7972
  agentName: agentName,
7665
7973
  });
7666
- swarm.agentValidationService.validate(agentName, METHOD_NAME$j);
7667
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$j);
7668
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7669
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$j);
7670
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName)];
7974
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$j);
7975
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
7976
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
7977
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
7978
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName)];
7671
7979
  case 1:
7672
7980
  currentAgentName = _a.sent();
7673
7981
  if (currentAgentName !== agentName) {
7674
7982
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7675
- swarm.loggerService.log('function "commitFlush" skipped due to the agent change', {
7983
+ swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
7676
7984
  currentAgentName: currentAgentName,
7677
7985
  agentName: agentName,
7678
7986
  clientId: clientId,
7679
7987
  });
7680
7988
  return [2 /*return*/];
7681
7989
  }
7682
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$j, clientId, swarmName)];
7990
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$j, clientId, swarmName)];
7683
7991
  case 2:
7684
7992
  _a.sent();
7685
7993
  return [2 /*return*/];
@@ -7704,22 +8012,22 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7704
8012
  case 0:
7705
8013
  executionId = randomString();
7706
8014
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7707
- swarm.loggerService.log(METHOD_NAME$i, {
8015
+ swarm$1.loggerService.log(METHOD_NAME$i, {
7708
8016
  content: content,
7709
8017
  clientId: clientId,
7710
8018
  agentName: agentName,
7711
8019
  executionId: executionId,
7712
8020
  });
7713
- swarm.agentValidationService.validate(agentName, METHOD_NAME$i);
7714
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$i);
7715
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7716
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$i);
7717
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
8021
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$i);
8022
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
8023
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8024
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
8025
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
7718
8026
  case 1:
7719
8027
  currentAgentName = _a.sent();
7720
8028
  if (currentAgentName !== agentName) {
7721
8029
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7722
- swarm.loggerService.log('function "execute" skipped due to the agent change', {
8030
+ swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
7723
8031
  currentAgentName: currentAgentName,
7724
8032
  agentName: agentName,
7725
8033
  clientId: clientId,
@@ -7729,7 +8037,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7729
8037
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7730
8038
  return __generator(this, function (_a) {
7731
8039
  switch (_a.label) {
7732
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$i, clientId, swarmName)];
8040
+ case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$i, clientId, swarmName)];
7733
8041
  case 1: return [2 /*return*/, _a.sent()];
7734
8042
  }
7735
8043
  });
@@ -7758,31 +8066,31 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7758
8066
  switch (_a.label) {
7759
8067
  case 0:
7760
8068
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7761
- swarm.loggerService.log(METHOD_NAME$h, {
8069
+ swarm$1.loggerService.log(METHOD_NAME$h, {
7762
8070
  content: content,
7763
8071
  clientId: clientId,
7764
8072
  agentName: agentName,
7765
8073
  });
7766
- if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
8074
+ if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7767
8075
  throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
7768
8076
  }
7769
- swarm.agentValidationService.validate(agentName, METHOD_NAME$h);
7770
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$h);
7771
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7772
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$h);
7773
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
8077
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$h);
8078
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
8079
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8080
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
8081
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
7774
8082
  case 1:
7775
8083
  currentAgentName = _a.sent();
7776
8084
  if (currentAgentName !== agentName) {
7777
8085
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7778
- swarm.loggerService.log('function "emit" skipped due to the agent change', {
8086
+ swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
7779
8087
  currentAgentName: currentAgentName,
7780
8088
  agentName: agentName,
7781
8089
  clientId: clientId,
7782
8090
  });
7783
8091
  return [2 /*return*/];
7784
8092
  }
7785
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$h, clientId, swarmName)];
8093
+ return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$h, clientId, swarmName)];
7786
8094
  case 2: return [2 /*return*/, _a.sent()];
7787
8095
  }
7788
8096
  });
@@ -7802,15 +8110,15 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
7802
8110
  switch (_a.label) {
7803
8111
  case 0:
7804
8112
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7805
- swarm.loggerService.log(METHOD_NAME$g, {
8113
+ swarm$1.loggerService.log(METHOD_NAME$g, {
7806
8114
  toolId: toolId,
7807
8115
  content: content,
7808
8116
  clientId: clientId,
7809
8117
  });
7810
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$g);
7811
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7812
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$g);
7813
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$g, clientId, swarmName)];
8118
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
8119
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8120
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
8121
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$g, clientId, swarmName)];
7814
8122
  case 1:
7815
8123
  _a.sent();
7816
8124
  return [2 /*return*/];
@@ -7832,14 +8140,14 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
7832
8140
  switch (_a.label) {
7833
8141
  case 0:
7834
8142
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7835
- swarm.loggerService.log(METHOD_NAME$f, {
8143
+ swarm$1.loggerService.log(METHOD_NAME$f, {
7836
8144
  content: content,
7837
8145
  clientId: clientId,
7838
8146
  });
7839
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$f);
7840
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7841
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$f);
7842
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$f, clientId, swarmName)];
8147
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
8148
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8149
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$f);
8150
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$f, clientId, swarmName)];
7843
8151
  case 1:
7844
8152
  _a.sent();
7845
8153
  return [2 /*return*/];
@@ -7860,14 +8168,14 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
7860
8168
  switch (_a.label) {
7861
8169
  case 0:
7862
8170
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7863
- swarm.loggerService.log(METHOD_NAME$e, {
8171
+ swarm$1.loggerService.log(METHOD_NAME$e, {
7864
8172
  clientId: clientId,
7865
8173
  METHOD_NAME: METHOD_NAME$e,
7866
8174
  });
7867
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$e);
7868
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7869
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$e);
7870
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$e, clientId, swarmName)];
8175
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
8176
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8177
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$e);
8178
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$e, clientId, swarmName)];
7871
8179
  case 1:
7872
8180
  _a.sent();
7873
8181
  return [2 /*return*/];
@@ -7889,14 +8197,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
7889
8197
  switch (_a.label) {
7890
8198
  case 0:
7891
8199
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7892
- swarm.loggerService.log(METHOD_NAME$d, {
8200
+ swarm$1.loggerService.log(METHOD_NAME$d, {
7893
8201
  content: content,
7894
8202
  clientId: clientId,
7895
8203
  });
7896
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$d);
7897
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7898
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$d);
7899
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$d, clientId, swarmName)];
8204
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$d);
8205
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8206
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$d);
8207
+ return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$d, clientId, swarmName)];
7900
8208
  case 1:
7901
8209
  _a.sent();
7902
8210
  return [2 /*return*/];
@@ -7921,17 +8229,17 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
7921
8229
  switch (_a.label) {
7922
8230
  case 0:
7923
8231
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7924
- swarm.loggerService.log(METHOD_NAME$c, {
8232
+ swarm$1.loggerService.log(METHOD_NAME$c, {
7925
8233
  content: content,
7926
8234
  clientId: clientId,
7927
8235
  });
7928
- if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
8236
+ if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7929
8237
  throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
7930
8238
  }
7931
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$c);
7932
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7933
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$c);
7934
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$c, clientId, swarmName)];
8239
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$c);
8240
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8241
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$c);
8242
+ return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$c, clientId, swarmName)];
7935
8243
  case 1: return [2 /*return*/, _a.sent()];
7936
8244
  }
7937
8245
  });
@@ -7953,18 +8261,18 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
7953
8261
  return __generator(this, function (_a) {
7954
8262
  executionId = randomString();
7955
8263
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7956
- swarm.loggerService.log(METHOD_NAME$b, {
8264
+ swarm$1.loggerService.log(METHOD_NAME$b, {
7957
8265
  content: content,
7958
8266
  clientId: clientId,
7959
8267
  executionId: executionId,
7960
8268
  });
7961
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$b);
7962
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7963
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$b);
8269
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$b);
8270
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8271
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$b);
7964
8272
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7965
8273
  return __generator(this, function (_a) {
7966
8274
  switch (_a.label) {
7967
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$b, clientId, swarmName)];
8275
+ case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$b, clientId, swarmName)];
7968
8276
  case 1: return [2 /*return*/, _a.sent()];
7969
8277
  }
7970
8278
  });
@@ -7988,7 +8296,7 @@ var validateClientId$d = function (clientId) {
7988
8296
  if (clientId === "*") {
7989
8297
  return;
7990
8298
  }
7991
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8299
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
7992
8300
  throw new Error("agent-swarm listenEvent session not found for clientId=".concat(clientId));
7993
8301
  }
7994
8302
  };
@@ -8001,14 +8309,14 @@ var validateClientId$d = function (clientId) {
8001
8309
  */
8002
8310
  var listenEvent = function (clientId, topicName, fn) {
8003
8311
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8004
- swarm.loggerService.log(METHOD_NAME$a, {
8312
+ swarm$1.loggerService.log(METHOD_NAME$a, {
8005
8313
  clientId: clientId,
8006
8314
  });
8007
8315
  if (DISALLOWED_EVENT_SOURCE_LIST$2.has(topicName)) {
8008
8316
  throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
8009
8317
  }
8010
8318
  validateClientId$d(clientId);
8011
- return swarm.busService.subscribe(clientId, topicName, function (_a) {
8319
+ return swarm$1.busService.subscribe(clientId, topicName, function (_a) {
8012
8320
  var payload = _a.payload;
8013
8321
  return fn(payload);
8014
8322
  });
@@ -8027,7 +8335,7 @@ var validateClientId$c = function (clientId) {
8027
8335
  if (clientId === "*") {
8028
8336
  return;
8029
8337
  }
8030
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8338
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8031
8339
  throw new Error("agent-swarm listenEventOnce session not found for clientId=".concat(clientId));
8032
8340
  }
8033
8341
  };
@@ -8040,14 +8348,14 @@ var validateClientId$c = function (clientId) {
8040
8348
  */
8041
8349
  var listenEventOnce = function (clientId, topicName, filterFn, fn) {
8042
8350
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8043
- swarm.loggerService.log(METHOD_NAME$9, {
8351
+ swarm$1.loggerService.log(METHOD_NAME$9, {
8044
8352
  clientId: clientId,
8045
8353
  });
8046
8354
  if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
8047
8355
  throw new Error("agent-swarm listenEventOnce topic is reserved topicName=".concat(topicName));
8048
8356
  }
8049
8357
  validateClientId$c(clientId);
8050
- return swarm.busService.once(clientId, topicName, function (_a) {
8358
+ return swarm$1.busService.once(clientId, topicName, function (_a) {
8051
8359
  var payload = _a.payload;
8052
8360
  return filterFn(payload);
8053
8361
  }, function (_a) {
@@ -8069,7 +8377,7 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
8069
8377
  switch (_a.label) {
8070
8378
  case 0:
8071
8379
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8072
- swarm.loggerService.log(METHOD_NAME$8, {
8380
+ swarm$1.loggerService.log(METHOD_NAME$8, {
8073
8381
  clientId: clientId,
8074
8382
  });
8075
8383
  return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$8)];
@@ -8097,7 +8405,7 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
8097
8405
  switch (_a.label) {
8098
8406
  case 0:
8099
8407
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8100
- swarm.loggerService.log(METHOD_NAME$7, {
8408
+ swarm$1.loggerService.log(METHOD_NAME$7, {
8101
8409
  clientId: clientId,
8102
8410
  });
8103
8411
  return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$7)];
@@ -8124,7 +8432,7 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
8124
8432
  switch (_a.label) {
8125
8433
  case 0:
8126
8434
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8127
- swarm.loggerService.log(METHOD_NAME$6, {
8435
+ swarm$1.loggerService.log(METHOD_NAME$6, {
8128
8436
  clientId: clientId,
8129
8437
  });
8130
8438
  return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$6)];
@@ -8151,7 +8459,7 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
8151
8459
  switch (_a.label) {
8152
8460
  case 0:
8153
8461
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8154
- swarm.loggerService.log(METHOD_NAME$5, {
8462
+ swarm$1.loggerService.log(METHOD_NAME$5, {
8155
8463
  clientId: clientId,
8156
8464
  });
8157
8465
  return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$5)];
@@ -8179,7 +8487,7 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
8179
8487
  switch (_a.label) {
8180
8488
  case 0:
8181
8489
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8182
- swarm.loggerService.log(METHOD_NAME$4, {
8490
+ swarm$1.loggerService.log(METHOD_NAME$4, {
8183
8491
  clientId: clientId,
8184
8492
  });
8185
8493
  return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$4)];
@@ -8207,7 +8515,7 @@ var DEFAULT_TIMEOUT = 15 * 60;
8207
8515
  var makeAutoDispose = function (clientId, swarmName, _a) {
8208
8516
  var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
8209
8517
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8210
- swarm.loggerService.log(METHOD_NAME$3, {
8518
+ swarm$1.loggerService.log(METHOD_NAME$3, {
8211
8519
  clientId: clientId,
8212
8520
  swarmName: swarmName,
8213
8521
  });
@@ -8226,7 +8534,7 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
8226
8534
  switch (_a.label) {
8227
8535
  case 0:
8228
8536
  unSource();
8229
- if (!swarm.sessionValidationService.hasSession(clientId)) return [3 /*break*/, 2];
8537
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) return [3 /*break*/, 2];
8230
8538
  return [4 /*yield*/, disposeConnection(clientId, swarmName)];
8231
8539
  case 1:
8232
8540
  _a.sent();
@@ -8273,13 +8581,13 @@ var DISALLOWED_EVENT_SOURCE_LIST = new Set([
8273
8581
  */
8274
8582
  var event = function (clientId, topicName, payload) {
8275
8583
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8276
- swarm.loggerService.log(METHOD_NAME$2, {
8584
+ swarm$1.loggerService.log(METHOD_NAME$2, {
8277
8585
  clientId: clientId,
8278
8586
  });
8279
8587
  if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
8280
8588
  throw new Error("agent-swarm event topic is reserved topicName=".concat(topicName));
8281
8589
  }
8282
- return swarm.busService.emit(clientId, {
8590
+ return swarm$1.busService.emit(clientId, {
8283
8591
  source: topicName,
8284
8592
  payload: payload,
8285
8593
  clientId: clientId,
@@ -8300,27 +8608,27 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
8300
8608
  switch (_a.label) {
8301
8609
  case 0:
8302
8610
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8303
- swarm.loggerService.log(METHOD_NAME$1, {
8611
+ swarm$1.loggerService.log(METHOD_NAME$1, {
8304
8612
  clientId: clientId,
8305
8613
  agentName: agentName,
8306
8614
  });
8307
- swarm.agentValidationService.validate(agentName, METHOD_NAME$1);
8308
- swarm.sessionValidationService.validate(clientId, METHOD_NAME$1);
8309
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
8310
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$1);
8311
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$1, clientId, swarmName)];
8615
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1);
8616
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1);
8617
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8618
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1);
8619
+ return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1, clientId, swarmName)];
8312
8620
  case 1:
8313
8621
  currentAgentName = _a.sent();
8314
8622
  if (currentAgentName !== agentName) {
8315
8623
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8316
- swarm.loggerService.log('function "cancelOutput" skipped due to the agent change', {
8624
+ swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
8317
8625
  currentAgentName: currentAgentName,
8318
8626
  agentName: agentName,
8319
8627
  clientId: clientId,
8320
8628
  });
8321
8629
  return [2 /*return*/];
8322
8630
  }
8323
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME$1, clientId, swarmName)];
8631
+ return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$1, clientId, swarmName)];
8324
8632
  case 2:
8325
8633
  _a.sent();
8326
8634
  return [2 /*return*/];
@@ -8342,13 +8650,13 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
8342
8650
  switch (_a.label) {
8343
8651
  case 0:
8344
8652
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8345
- swarm.loggerService.log(METHOD_NAME, {
8653
+ swarm$1.loggerService.log(METHOD_NAME, {
8346
8654
  clientId: clientId,
8347
8655
  });
8348
- swarm.sessionValidationService.validate(clientId, METHOD_NAME);
8349
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
8350
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
8351
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME, clientId, swarmName)];
8656
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME);
8657
+ swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
8658
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
8659
+ return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME, clientId, swarmName)];
8352
8660
  case 1:
8353
8661
  _a.sent();
8354
8662
  return [2 /*return*/];
@@ -8360,7 +8668,7 @@ var validateClientId$b = function (clientId) {
8360
8668
  if (clientId === "*") {
8361
8669
  return;
8362
8670
  }
8363
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8671
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8364
8672
  throw new Error("agent-swarm listenAgentEvent session not found for clientId=".concat(clientId));
8365
8673
  }
8366
8674
  };
@@ -8371,18 +8679,18 @@ var validateClientId$b = function (clientId) {
8371
8679
  * @param {function} fn - The callback function to handle the event.
8372
8680
  */
8373
8681
  var listenAgentEvent = function (clientId, fn) {
8374
- swarm.loggerService.log("middleware listenAgentEvent", {
8682
+ swarm$1.loggerService.log("middleware listenAgentEvent", {
8375
8683
  clientId: clientId,
8376
8684
  });
8377
8685
  validateClientId$b(clientId);
8378
- return swarm.busService.subscribe(clientId, "agent-bus", fn);
8686
+ return swarm$1.busService.subscribe(clientId, "agent-bus", fn);
8379
8687
  };
8380
8688
 
8381
8689
  var validateClientId$a = function (clientId) {
8382
8690
  if (clientId === "*") {
8383
8691
  return;
8384
8692
  }
8385
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8693
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8386
8694
  throw new Error("agent-swarm listenHistoryEvent session not found for clientId=".concat(clientId));
8387
8695
  }
8388
8696
  };
@@ -8393,18 +8701,18 @@ var validateClientId$a = function (clientId) {
8393
8701
  * @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
8394
8702
  */
8395
8703
  var listenHistoryEvent = function (clientId, fn) {
8396
- swarm.loggerService.log("middleware listenHistoryEvent", {
8704
+ swarm$1.loggerService.log("middleware listenHistoryEvent", {
8397
8705
  clientId: clientId,
8398
8706
  });
8399
8707
  validateClientId$a(clientId);
8400
- return swarm.busService.subscribe(clientId, "history-bus", fn);
8708
+ return swarm$1.busService.subscribe(clientId, "history-bus", fn);
8401
8709
  };
8402
8710
 
8403
8711
  var validateClientId$9 = function (clientId) {
8404
8712
  if (clientId === "*") {
8405
8713
  return;
8406
8714
  }
8407
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8715
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8408
8716
  throw new Error("agent-swarm listenSessionEvent session not found for clientId=".concat(clientId));
8409
8717
  }
8410
8718
  };
@@ -8415,18 +8723,18 @@ var validateClientId$9 = function (clientId) {
8415
8723
  * @param {function} fn - The callback function to handle the session events.
8416
8724
  */
8417
8725
  var listenSessionEvent = function (clientId, fn) {
8418
- swarm.loggerService.log("middleware listenSessionEvent", {
8726
+ swarm$1.loggerService.log("middleware listenSessionEvent", {
8419
8727
  clientId: clientId,
8420
8728
  });
8421
8729
  validateClientId$9(clientId);
8422
- return swarm.busService.subscribe(clientId, "session-bus", fn);
8730
+ return swarm$1.busService.subscribe(clientId, "session-bus", fn);
8423
8731
  };
8424
8732
 
8425
8733
  var validateClientId$8 = function (clientId) {
8426
8734
  if (clientId === "*") {
8427
8735
  return;
8428
8736
  }
8429
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8737
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8430
8738
  throw new Error("agent-swarm listenStateEvent session not found for clientId=".concat(clientId));
8431
8739
  }
8432
8740
  };
@@ -8437,18 +8745,18 @@ var validateClientId$8 = function (clientId) {
8437
8745
  * @param {function} fn - The callback function to handle the event.
8438
8746
  */
8439
8747
  var listenStateEvent = function (clientId, fn) {
8440
- swarm.loggerService.log("middleware listenStateEvent", {
8748
+ swarm$1.loggerService.log("middleware listenStateEvent", {
8441
8749
  clientId: clientId,
8442
8750
  });
8443
8751
  validateClientId$8(clientId);
8444
- return swarm.busService.subscribe(clientId, "state-bus", fn);
8752
+ return swarm$1.busService.subscribe(clientId, "state-bus", fn);
8445
8753
  };
8446
8754
 
8447
8755
  var validateClientId$7 = function (clientId) {
8448
8756
  if (clientId === "*") {
8449
8757
  return;
8450
8758
  }
8451
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8759
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8452
8760
  throw new Error("agent-swarm listenStorageEvent session not found for clientId=".concat(clientId));
8453
8761
  }
8454
8762
  };
@@ -8459,18 +8767,18 @@ var validateClientId$7 = function (clientId) {
8459
8767
  * @param {function} fn - The callback function to handle the storage event.
8460
8768
  */
8461
8769
  var listenStorageEvent = function (clientId, fn) {
8462
- swarm.loggerService.log("middleware listenStorageEvent", {
8770
+ swarm$1.loggerService.log("middleware listenStorageEvent", {
8463
8771
  clientId: clientId,
8464
8772
  });
8465
8773
  validateClientId$7(clientId);
8466
- return swarm.busService.subscribe(clientId, "storage-bus", fn);
8774
+ return swarm$1.busService.subscribe(clientId, "storage-bus", fn);
8467
8775
  };
8468
8776
 
8469
8777
  var validateClientId$6 = function (clientId) {
8470
8778
  if (clientId === "*") {
8471
8779
  return;
8472
8780
  }
8473
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8781
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8474
8782
  throw new Error("agent-swarm listenSwarmEvent session not found for clientId=".concat(clientId));
8475
8783
  }
8476
8784
  };
@@ -8481,18 +8789,18 @@ var validateClientId$6 = function (clientId) {
8481
8789
  * @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
8482
8790
  */
8483
8791
  var listenSwarmEvent = function (clientId, fn) {
8484
- swarm.loggerService.log("middleware listenSwarmEvent", {
8792
+ swarm$1.loggerService.log("middleware listenSwarmEvent", {
8485
8793
  clientId: clientId,
8486
8794
  });
8487
8795
  validateClientId$6(clientId);
8488
- return swarm.busService.subscribe(clientId, "swarm-bus", fn);
8796
+ return swarm$1.busService.subscribe(clientId, "swarm-bus", fn);
8489
8797
  };
8490
8798
 
8491
8799
  var validateClientId$5 = function (clientId) {
8492
8800
  if (clientId === "*") {
8493
8801
  return;
8494
8802
  }
8495
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8803
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8496
8804
  throw new Error("agent-swarm listenAgentEventOnce session not found for clientId=".concat(clientId));
8497
8805
  }
8498
8806
  };
@@ -8503,18 +8811,18 @@ var validateClientId$5 = function (clientId) {
8503
8811
  * @param {function} fn - The callback function to handle the event.
8504
8812
  */
8505
8813
  var listenAgentEventOnce = function (clientId, filterFn, fn) {
8506
- swarm.loggerService.log("middleware listenAgentEventOnce", {
8814
+ swarm$1.loggerService.log("middleware listenAgentEventOnce", {
8507
8815
  clientId: clientId,
8508
8816
  });
8509
8817
  validateClientId$5(clientId);
8510
- return swarm.busService.once(clientId, "agent-bus", filterFn, fn);
8818
+ return swarm$1.busService.once(clientId, "agent-bus", filterFn, fn);
8511
8819
  };
8512
8820
 
8513
8821
  var validateClientId$4 = function (clientId) {
8514
8822
  if (clientId === "*") {
8515
8823
  return;
8516
8824
  }
8517
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8825
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8518
8826
  throw new Error("agent-swarm listenHistoryEventOnce session not found for clientId=".concat(clientId));
8519
8827
  }
8520
8828
  };
@@ -8525,18 +8833,18 @@ var validateClientId$4 = function (clientId) {
8525
8833
  * @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
8526
8834
  */
8527
8835
  var listenHistoryEventOnce = function (clientId, filterFn, fn) {
8528
- swarm.loggerService.log("middleware listenHistoryEventOnce", {
8836
+ swarm$1.loggerService.log("middleware listenHistoryEventOnce", {
8529
8837
  clientId: clientId,
8530
8838
  });
8531
8839
  validateClientId$4(clientId);
8532
- return swarm.busService.once(clientId, "history-bus", filterFn, fn);
8840
+ return swarm$1.busService.once(clientId, "history-bus", filterFn, fn);
8533
8841
  };
8534
8842
 
8535
8843
  var validateClientId$3 = function (clientId) {
8536
8844
  if (clientId === "*") {
8537
8845
  return;
8538
8846
  }
8539
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8847
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8540
8848
  throw new Error("agent-swarm listenSessionEventOnce session not found for clientId=".concat(clientId));
8541
8849
  }
8542
8850
  };
@@ -8547,18 +8855,18 @@ var validateClientId$3 = function (clientId) {
8547
8855
  * @param {function} fn - The callback function to handle the session events.
8548
8856
  */
8549
8857
  var listenSessionEventOnce = function (clientId, filterFn, fn) {
8550
- swarm.loggerService.log("middleware listenSessionEventOnce", {
8858
+ swarm$1.loggerService.log("middleware listenSessionEventOnce", {
8551
8859
  clientId: clientId,
8552
8860
  });
8553
8861
  validateClientId$3(clientId);
8554
- return swarm.busService.once(clientId, "session-bus", filterFn, fn);
8862
+ return swarm$1.busService.once(clientId, "session-bus", filterFn, fn);
8555
8863
  };
8556
8864
 
8557
8865
  var validateClientId$2 = function (clientId) {
8558
8866
  if (clientId === "*") {
8559
8867
  return;
8560
8868
  }
8561
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8869
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8562
8870
  throw new Error("agent-swarm listenStateEventOnce session not found for clientId=".concat(clientId));
8563
8871
  }
8564
8872
  };
@@ -8569,18 +8877,18 @@ var validateClientId$2 = function (clientId) {
8569
8877
  * @param {function} fn - The callback function to handle the event.
8570
8878
  */
8571
8879
  var listenStateEventOnce = function (clientId, filterFn, fn) {
8572
- swarm.loggerService.log("middleware listenStateEventOnce", {
8880
+ swarm$1.loggerService.log("middleware listenStateEventOnce", {
8573
8881
  clientId: clientId,
8574
8882
  });
8575
8883
  validateClientId$2(clientId);
8576
- return swarm.busService.once(clientId, "state-bus", filterFn, fn);
8884
+ return swarm$1.busService.once(clientId, "state-bus", filterFn, fn);
8577
8885
  };
8578
8886
 
8579
8887
  var validateClientId$1 = function (clientId) {
8580
8888
  if (clientId === "*") {
8581
8889
  return;
8582
8890
  }
8583
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8891
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8584
8892
  throw new Error("agent-swarm listenStorageEventOnce session not found for clientId=".concat(clientId));
8585
8893
  }
8586
8894
  };
@@ -8591,18 +8899,18 @@ var validateClientId$1 = function (clientId) {
8591
8899
  * @param {function} fn - The callback function to handle the storage event.
8592
8900
  */
8593
8901
  var listenStorageEventOnce = function (clientId, filterFn, fn) {
8594
- swarm.loggerService.log("middleware listenStorageEventOnce", {
8902
+ swarm$1.loggerService.log("middleware listenStorageEventOnce", {
8595
8903
  clientId: clientId,
8596
8904
  });
8597
8905
  validateClientId$1(clientId);
8598
- return swarm.busService.once(clientId, "storage-bus", filterFn, fn);
8906
+ return swarm$1.busService.once(clientId, "storage-bus", filterFn, fn);
8599
8907
  };
8600
8908
 
8601
8909
  var validateClientId = function (clientId) {
8602
8910
  if (clientId === "*") {
8603
8911
  return;
8604
8912
  }
8605
- if (!swarm.sessionValidationService.hasSession(clientId)) {
8913
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
8606
8914
  throw new Error("agent-swarm listenSwarmEventOnce session not found for clientId=".concat(clientId));
8607
8915
  }
8608
8916
  };
@@ -8613,11 +8921,11 @@ var validateClientId = function (clientId) {
8613
8921
  * @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
8614
8922
  */
8615
8923
  var listenSwarmEventOnce = function (clientId, filterFn, fn) {
8616
- swarm.loggerService.log("middleware listenSwarmEventOnce", {
8924
+ swarm$1.loggerService.log("middleware listenSwarmEventOnce", {
8617
8925
  clientId: clientId,
8618
8926
  });
8619
8927
  validateClientId(clientId);
8620
- return swarm.busService.once(clientId, "swarm-bus", filterFn, fn);
8928
+ return swarm$1.busService.once(clientId, "swarm-bus", filterFn, fn);
8621
8929
  };
8622
8930
 
8623
8931
  var METHOD_NAME_TAKE = "StorageUtils.take";
@@ -8644,18 +8952,18 @@ var StorageUtils = /** @class */ (function () {
8644
8952
  switch (_a.label) {
8645
8953
  case 0:
8646
8954
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8647
- swarm.loggerService.log(METHOD_NAME_TAKE, {
8955
+ swarm$1.loggerService.log(METHOD_NAME_TAKE, {
8648
8956
  search: payload.search,
8649
8957
  total: payload.total,
8650
8958
  clientId: payload.clientId,
8651
8959
  storageName: payload.storageName,
8652
8960
  score: payload.score,
8653
8961
  });
8654
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
8655
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8962
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
8963
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8656
8964
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
8657
8965
  }
8658
- return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.clientId, payload.storageName, payload.score)];
8966
+ return [4 /*yield*/, swarm$1.storagePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.clientId, payload.storageName, payload.score)];
8659
8967
  case 1: return [2 /*return*/, (_a.sent())];
8660
8968
  }
8661
8969
  });
@@ -8674,16 +8982,16 @@ var StorageUtils = /** @class */ (function () {
8674
8982
  switch (_a.label) {
8675
8983
  case 0:
8676
8984
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8677
- swarm.loggerService.log(METHOD_NAME_UPSERT, {
8985
+ swarm$1.loggerService.log(METHOD_NAME_UPSERT, {
8678
8986
  item: payload.item,
8679
8987
  clientId: payload.clientId,
8680
8988
  storageName: payload.storageName,
8681
8989
  });
8682
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_UPSERT);
8683
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8990
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_UPSERT);
8991
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8684
8992
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
8685
8993
  }
8686
- return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.clientId, payload.storageName)];
8994
+ return [4 /*yield*/, swarm$1.storagePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.clientId, payload.storageName)];
8687
8995
  case 1: return [2 /*return*/, _a.sent()];
8688
8996
  }
8689
8997
  });
@@ -8701,16 +9009,16 @@ var StorageUtils = /** @class */ (function () {
8701
9009
  switch (_a.label) {
8702
9010
  case 0:
8703
9011
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8704
- swarm.loggerService.log(METHOD_NAME_REMOVE, {
9012
+ swarm$1.loggerService.log(METHOD_NAME_REMOVE, {
8705
9013
  itemId: payload.itemId,
8706
9014
  clientId: payload.clientId,
8707
9015
  storageName: payload.storageName,
8708
9016
  });
8709
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_REMOVE);
8710
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
9017
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_REMOVE);
9018
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8711
9019
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
8712
9020
  }
8713
- return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.clientId, payload.storageName)];
9021
+ return [4 /*yield*/, swarm$1.storagePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.clientId, payload.storageName)];
8714
9022
  case 1: return [2 /*return*/, _a.sent()];
8715
9023
  }
8716
9024
  });
@@ -8729,16 +9037,16 @@ var StorageUtils = /** @class */ (function () {
8729
9037
  switch (_a.label) {
8730
9038
  case 0:
8731
9039
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8732
- swarm.loggerService.log(METHOD_NAME_GET$1, {
9040
+ swarm$1.loggerService.log(METHOD_NAME_GET$1, {
8733
9041
  itemId: payload.itemId,
8734
9042
  clientId: payload.clientId,
8735
9043
  storageName: payload.storageName,
8736
9044
  });
8737
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_GET$1);
8738
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
9045
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_GET$1);
9046
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8739
9047
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
8740
9048
  }
8741
- return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, METHOD_NAME_GET$1, payload.clientId, payload.storageName)];
9049
+ return [4 /*yield*/, swarm$1.storagePublicService.get(payload.itemId, METHOD_NAME_GET$1, payload.clientId, payload.storageName)];
8742
9050
  case 1: return [2 /*return*/, (_a.sent())];
8743
9051
  }
8744
9052
  });
@@ -8757,15 +9065,15 @@ var StorageUtils = /** @class */ (function () {
8757
9065
  switch (_a.label) {
8758
9066
  case 0:
8759
9067
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8760
- swarm.loggerService.log(METHOD_NAME_LIST, {
9068
+ swarm$1.loggerService.log(METHOD_NAME_LIST, {
8761
9069
  clientId: payload.clientId,
8762
9070
  storageName: payload.storageName,
8763
9071
  });
8764
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_LIST);
8765
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
9072
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_LIST);
9073
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8766
9074
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
8767
9075
  }
8768
- return [4 /*yield*/, swarm.storagePublicService.list(METHOD_NAME_LIST, payload.clientId, payload.storageName, payload.filter)];
9076
+ return [4 /*yield*/, swarm$1.storagePublicService.list(METHOD_NAME_LIST, payload.clientId, payload.storageName, payload.filter)];
8769
9077
  case 1: return [2 /*return*/, (_a.sent())];
8770
9078
  }
8771
9079
  });
@@ -8782,15 +9090,15 @@ var StorageUtils = /** @class */ (function () {
8782
9090
  switch (_a.label) {
8783
9091
  case 0:
8784
9092
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8785
- swarm.loggerService.log(METHOD_NAME_CLEAR, {
9093
+ swarm$1.loggerService.log(METHOD_NAME_CLEAR, {
8786
9094
  clientId: payload.clientId,
8787
9095
  storageName: payload.storageName,
8788
9096
  });
8789
- swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_CLEAR);
8790
- if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
9097
+ swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_CLEAR);
9098
+ if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8791
9099
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
8792
9100
  }
8793
- return [4 /*yield*/, swarm.storagePublicService.clear(METHOD_NAME_CLEAR, payload.clientId, payload.storageName)];
9101
+ return [4 /*yield*/, swarm$1.storagePublicService.clear(METHOD_NAME_CLEAR, payload.clientId, payload.storageName)];
8794
9102
  case 1: return [2 /*return*/, _a.sent()];
8795
9103
  }
8796
9104
  });
@@ -8824,14 +9132,14 @@ var StateUtils = /** @class */ (function () {
8824
9132
  switch (_a.label) {
8825
9133
  case 0:
8826
9134
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8827
- swarm.loggerService.log(METHOD_NAME_GET, {
9135
+ swarm$1.loggerService.log(METHOD_NAME_GET, {
8828
9136
  clientId: payload.clientId,
8829
9137
  stateName: payload.stateName,
8830
9138
  });
8831
- if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
9139
+ if (!swarm$1.agentValidationService.hasState(payload.agentName, payload.stateName)) {
8832
9140
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
8833
9141
  }
8834
- return [4 /*yield*/, swarm.statePublicService.getState(METHOD_NAME_GET, payload.clientId, payload.stateName)];
9142
+ return [4 /*yield*/, swarm$1.statePublicService.getState(METHOD_NAME_GET, payload.clientId, payload.stateName)];
8835
9143
  case 1: return [2 /*return*/, _a.sent()];
8836
9144
  }
8837
9145
  });
@@ -8853,17 +9161,17 @@ var StateUtils = /** @class */ (function () {
8853
9161
  switch (_a.label) {
8854
9162
  case 0:
8855
9163
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8856
- swarm.loggerService.log(METHOD_NAME_SET, {
9164
+ swarm$1.loggerService.log(METHOD_NAME_SET, {
8857
9165
  clientId: payload.clientId,
8858
9166
  stateName: payload.stateName,
8859
9167
  });
8860
- if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
9168
+ if (!swarm$1.agentValidationService.hasState(payload.agentName, payload.stateName)) {
8861
9169
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
8862
9170
  }
8863
9171
  if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
8864
- return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, METHOD_NAME_SET, payload.clientId, payload.stateName)];
9172
+ return [4 /*yield*/, swarm$1.statePublicService.setState(dispatchFn, METHOD_NAME_SET, payload.clientId, payload.stateName)];
8865
9173
  case 1: return [2 /*return*/, _a.sent()];
8866
- case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
9174
+ case 2: return [4 /*yield*/, swarm$1.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
8867
9175
  return [2 /*return*/, dispatchFn];
8868
9176
  }); }); }, METHOD_NAME_SET, payload.clientId, payload.stateName)];
8869
9177
  case 3: return [2 /*return*/, _a.sent()];
@@ -8879,27 +9187,6 @@ var StateUtils = /** @class */ (function () {
8879
9187
  */
8880
9188
  var State = new StateUtils();
8881
9189
 
8882
- var METHOD_NAME_USE_LOGGER = "HistoryInstance.useLogger";
8883
- var LoggerUtils = /** @class */ (function () {
8884
- function LoggerUtils() {
8885
- /**
8886
- * Sets the provided logger to the logger service.
8887
- * @param {ILogger} logger - The logger instance to be used.
8888
- */
8889
- this.useLogger = function (logger) {
8890
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8891
- swarm.loggerService.log(METHOD_NAME_USE_LOGGER);
8892
- swarm.loggerService.setLogger(logger);
8893
- };
8894
- }
8895
- return LoggerUtils;
8896
- }());
8897
- /**
8898
- * Instance of LoggerUtils to be used for logging.
8899
- * @type {LoggerUtils}
8900
- */
8901
- var Logger = new LoggerUtils();
8902
-
8903
9190
  /**
8904
9191
  * Function that recursively flattens a nested object to array of entries.
8905
9192
  */
@@ -8949,7 +9236,7 @@ var SchemaUtils = /** @class */ (function () {
8949
9236
  */
8950
9237
  this.serialize = function (data) {
8951
9238
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8952
- swarm.loggerService.log(METHOD_NAME_SERIALIZE, {
9239
+ swarm$1.loggerService.log(METHOD_NAME_SERIALIZE, {
8953
9240
  data: data,
8954
9241
  });
8955
9242
  if (Array.isArray(data)) {
@@ -8987,4 +9274,4 @@ var SchemaUtils = /** @class */ (function () {
8987
9274
  */
8988
9275
  var Schema = new SchemaUtils();
8989
9276
 
8990
- export { ExecutionContextService, History, HistoryAdapter, HistoryInstance, Logger, MethodContextService, Schema, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, session, setConfig, swarm };
9277
+ export { ExecutionContextService, History, HistoryAdapter, HistoryInstance, Logger, LoggerAdapter, LoggerInstance, MethodContextService, Schema, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, session, setConfig, swarm };