agent-swarm-kit 1.0.32 → 1.0.34

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.cjs CHANGED
@@ -456,11 +456,16 @@ var ClientAgent = /** @class */ (function () {
456
456
  if ((validation = _a.sent())) {
457
457
  throw new Error("agent-swarm-kit ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " model ressurect failed: ").concat(validation));
458
458
  }
459
+ this.params.onOutput &&
460
+ this.params.onOutput(this.params.clientId, this.params.agentName, result_1);
459
461
  return [4 /*yield*/, this._outputSubject.next(result_1)];
460
462
  case 4:
461
463
  _a.sent();
462
464
  return [2 /*return*/];
463
- case 5: return [4 /*yield*/, this._outputSubject.next(result)];
465
+ case 5:
466
+ this.params.onOutput &&
467
+ this.params.onOutput(this.params.clientId, this.params.agentName, result);
468
+ return [4 /*yield*/, this._outputSubject.next(result)];
464
469
  case 6:
465
470
  _a.sent();
466
471
  return [2 /*return*/];
@@ -479,6 +484,8 @@ var ClientAgent = /** @class */ (function () {
479
484
  switch (_a.label) {
480
485
  case 0:
481
486
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel"));
487
+ this.params.onResurrect &&
488
+ this.params.onResurrect(this.params.clientId, this.params.agentName, mode, reason);
482
489
  return [4 /*yield*/, this.params.history.push({
483
490
  role: "resque",
484
491
  mode: "tool",
@@ -540,25 +547,30 @@ var ClientAgent = /** @class */ (function () {
540
547
  * @returns {Promise<IModelMessage>}
541
548
  */
542
549
  this.getCompletion = function (mode) { return __awaiter(_this, void 0, void 0, function () {
543
- var messages;
544
- var _a;
545
- return __generator(this, function (_b) {
546
- switch (_b.label) {
550
+ var messages, args, output;
551
+ var _a, _b, _c;
552
+ return __generator(this, function (_d) {
553
+ switch (_d.label) {
547
554
  case 0:
548
555
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " getCompletion"));
549
556
  return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
550
557
  case 1:
551
- messages = _b.sent();
552
- return [4 /*yield*/, this.params.completion.getCompletion({
553
- clientId: this.params.clientId,
554
- agentName: this.params.agentName,
555
- messages: messages,
556
- mode: mode,
557
- tools: (_a = this.params.tools) === null || _a === void 0 ? void 0 : _a.map(function (t) {
558
- return lodashEs.omit(t, "toolName", "call", "validate");
559
- }),
560
- })];
561
- case 2: return [2 /*return*/, _b.sent()];
558
+ messages = _d.sent();
559
+ args = {
560
+ clientId: this.params.clientId,
561
+ agentName: this.params.agentName,
562
+ messages: messages,
563
+ mode: mode,
564
+ tools: (_a = this.params.tools) === null || _a === void 0 ? void 0 : _a.map(function (t) {
565
+ return lodashEs.omit(t, "toolName", "call", "validate", "callbacks");
566
+ }),
567
+ };
568
+ return [4 /*yield*/, this.params.completion.getCompletion(args)];
569
+ case 2:
570
+ output = _d.sent();
571
+ ((_b = this.params.completion.callbacks) === null || _b === void 0 ? void 0 : _b.onComplete) &&
572
+ ((_c = this.params.completion.callbacks) === null || _c === void 0 ? void 0 : _c.onComplete(args, output));
573
+ return [2 /*return*/, output];
562
574
  }
563
575
  });
564
576
  }); };
@@ -572,6 +584,8 @@ var ClientAgent = /** @class */ (function () {
572
584
  switch (_a.label) {
573
585
  case 0:
574
586
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitUserMessage"), { message: message });
587
+ this.params.onUserMessage &&
588
+ this.params.onUserMessage(this.params.clientId, this.params.agentName, message);
575
589
  return [4 /*yield*/, this.params.history.push({
576
590
  role: "user",
577
591
  agentName: this.params.agentName,
@@ -593,6 +607,8 @@ var ClientAgent = /** @class */ (function () {
593
607
  switch (_a.label) {
594
608
  case 0:
595
609
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitFlush"));
610
+ this.params.onFlush &&
611
+ this.params.onFlush(this.params.clientId, this.params.agentName);
596
612
  return [4 /*yield*/, this.params.history.push({
597
613
  role: "flush",
598
614
  agentName: this.params.agentName,
@@ -615,6 +631,8 @@ var ClientAgent = /** @class */ (function () {
615
631
  switch (_a.label) {
616
632
  case 0:
617
633
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitSystemMessage"), { message: message });
634
+ this.params.onSystemMessage &&
635
+ this.params.onSystemMessage(this.params.clientId, this.params.agentName, message);
618
636
  return [4 /*yield*/, this.params.history.push({
619
637
  role: "system",
620
638
  agentName: this.params.agentName,
@@ -637,6 +655,8 @@ var ClientAgent = /** @class */ (function () {
637
655
  switch (_a.label) {
638
656
  case 0:
639
657
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitToolOutput"), { content: content });
658
+ this.params.onToolOutput &&
659
+ this.params.onToolOutput(this.params.clientId, this.params.agentName, content);
640
660
  return [4 /*yield*/, this.params.history.push({
641
661
  role: "tool",
642
662
  agentName: this.params.agentName,
@@ -660,11 +680,13 @@ var ClientAgent = /** @class */ (function () {
660
680
  this.execute = functoolsKit.queued(function (incoming, mode) { return __awaiter(_this, void 0, void 0, function () {
661
681
  var message, _loop_1, this_1, _a, _b, tool, state_1, e_1_1, result, validation, result1;
662
682
  var e_1, _c;
663
- var _d;
664
- return __generator(this, function (_e) {
665
- switch (_e.label) {
683
+ var _d, _e, _f, _g, _h;
684
+ return __generator(this, function (_j) {
685
+ switch (_j.label) {
666
686
  case 0:
667
687
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute begin"), { incoming: incoming, mode: mode });
688
+ this.params.onExecute &&
689
+ this.params.onExecute(this.params.clientId, this.params.agentName, incoming, mode);
668
690
  return [4 /*yield*/, this.params.history.push({
669
691
  role: "user",
670
692
  mode: mode,
@@ -672,44 +694,49 @@ var ClientAgent = /** @class */ (function () {
672
694
  content: incoming.trim(),
673
695
  })];
674
696
  case 1:
675
- _e.sent();
697
+ _j.sent();
676
698
  return [4 /*yield*/, this.getCompletion(mode)];
677
699
  case 2:
678
- message = _e.sent();
700
+ message = _j.sent();
679
701
  if (!message.tool_calls) return [3 /*break*/, 11];
680
702
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " tool call begin"));
681
703
  _loop_1 = function (tool) {
682
704
  var targetFn, result_2, result_3;
683
- return __generator(this, function (_f) {
684
- switch (_f.label) {
705
+ return __generator(this, function (_k) {
706
+ switch (_k.label) {
685
707
  case 0:
686
708
  targetFn = (_d = this_1.params.tools) === null || _d === void 0 ? void 0 : _d.find(function (t) { return t.function.name === tool.function.name; });
687
709
  return [4 /*yield*/, this_1.params.history.push(__assign(__assign({}, message), { agentName: this_1.params.agentName }))];
688
710
  case 1:
689
- _f.sent();
711
+ _k.sent();
690
712
  if (!!targetFn) return [3 /*break*/, 4];
691
713
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"), this_1.params.tools);
692
714
  return [4 /*yield*/, this_1._resurrectModel(mode, "No target function for ".concat(tool.function.name))];
693
715
  case 2:
694
- result_2 = _f.sent();
716
+ result_2 = _k.sent();
695
717
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_2));
696
718
  return [4 /*yield*/, this_1._emitOuput(mode, result_2)];
697
719
  case 3:
698
- _f.sent();
720
+ _k.sent();
699
721
  return [2 /*return*/, { value: void 0 }];
700
- case 4: return [4 /*yield*/, functoolsKit.not(targetFn.validate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments))];
722
+ case 4:
723
+ ((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onValidate) &&
724
+ ((_f = targetFn.callbacks) === null || _f === void 0 ? void 0 : _f.onValidate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
725
+ return [4 /*yield*/, functoolsKit.not(targetFn.validate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments))];
701
726
  case 5:
702
- if (!_f.sent()) return [3 /*break*/, 8];
727
+ if (!_k.sent()) return [3 /*break*/, 8];
703
728
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool validation not passed"));
704
729
  return [4 /*yield*/, this_1._resurrectModel(mode, "Function validation failed: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
705
730
  case 6:
706
- result_3 = _f.sent();
731
+ result_3 = _k.sent();
707
732
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_3));
708
733
  return [4 /*yield*/, this_1._emitOuput(mode, result_3)];
709
734
  case 7:
710
- _f.sent();
735
+ _k.sent();
711
736
  return [2 /*return*/, { value: void 0 }];
712
737
  case 8:
738
+ ((_g = targetFn.callbacks) === null || _g === void 0 ? void 0 : _g.onCall) &&
739
+ ((_h = targetFn.callbacks) === null || _h === void 0 ? void 0 : _h.onCall(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
713
740
  /**
714
741
  * @description Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
715
742
  */
@@ -720,33 +747,33 @@ var ClientAgent = /** @class */ (function () {
720
747
  this_1._outputSubject.toPromise(),
721
748
  ])];
722
749
  case 9:
723
- _f.sent();
750
+ _k.sent();
724
751
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool call end"));
725
752
  return [2 /*return*/];
726
753
  }
727
754
  });
728
755
  };
729
756
  this_1 = this;
730
- _e.label = 3;
757
+ _j.label = 3;
731
758
  case 3:
732
- _e.trys.push([3, 8, 9, 10]);
759
+ _j.trys.push([3, 8, 9, 10]);
733
760
  _a = __values(message.tool_calls), _b = _a.next();
734
- _e.label = 4;
761
+ _j.label = 4;
735
762
  case 4:
736
763
  if (!!_b.done) return [3 /*break*/, 7];
737
764
  tool = _b.value;
738
765
  return [5 /*yield**/, _loop_1(tool)];
739
766
  case 5:
740
- state_1 = _e.sent();
767
+ state_1 = _j.sent();
741
768
  if (typeof state_1 === "object")
742
769
  return [2 /*return*/, state_1.value];
743
- _e.label = 6;
770
+ _j.label = 6;
744
771
  case 6:
745
772
  _b = _a.next();
746
773
  return [3 /*break*/, 4];
747
774
  case 7: return [3 /*break*/, 10];
748
775
  case 8:
749
- e_1_1 = _e.sent();
776
+ e_1_1 = _j.sent();
750
777
  e_1 = { error: e_1_1 };
751
778
  return [3 /*break*/, 10];
752
779
  case 9:
@@ -763,31 +790,44 @@ var ClientAgent = /** @class */ (function () {
763
790
  result = message.content;
764
791
  return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
765
792
  case 12:
766
- _e.sent();
793
+ _j.sent();
767
794
  validation = null;
768
795
  return [4 /*yield*/, this.params.validate(result)];
769
796
  case 13:
770
- if (!(validation = _e.sent())) return [3 /*break*/, 16];
797
+ if (!(validation = _j.sent())) return [3 /*break*/, 16];
771
798
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
772
799
  return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
773
800
  case 14:
774
- result1 = _e.sent();
801
+ result1 = _j.sent();
775
802
  return [4 /*yield*/, this._emitOuput(mode, result1)];
776
803
  case 15:
777
- _e.sent();
804
+ _j.sent();
778
805
  return [2 /*return*/];
779
806
  case 16:
780
807
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
781
808
  return [4 /*yield*/, this._emitOuput(mode, result)];
782
809
  case 17:
783
- _e.sent();
810
+ _j.sent();
784
811
  return [2 /*return*/];
785
812
  }
786
813
  });
787
814
  }); });
815
+ /**
816
+ * Should call on agent dispose
817
+ * @returns {Promise<void>}
818
+ */
819
+ this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
820
+ return __generator(this, function (_a) {
821
+ this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " dispose"));
822
+ this.params.onDispose &&
823
+ this.params.onDispose(this.params.clientId, this.params.agentName);
824
+ return [2 /*return*/];
825
+ });
826
+ }); };
788
827
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
789
828
  params: params,
790
829
  });
830
+ this.params.onInit && this.params.onInit(params.clientId, params.agentName);
791
831
  }
792
832
  return ClientAgent;
793
833
  }());
@@ -816,20 +856,10 @@ var AgentConnectionService = /** @class */ (function () {
816
856
  var _b = __read(_a, 2), clientId = _b[0], agentName = _b[1];
817
857
  return "".concat(clientId, "-").concat(agentName);
818
858
  }, function (clientId, agentName) {
819
- var _a = _this.agentSchemaService.get(agentName), prompt = _a.prompt, system = _a.system, tools = _a.tools, completionName = _a.completion, _b = _a.validate, validate = _b === void 0 ? validateDefault : _b;
859
+ var _a = _this.agentSchemaService.get(agentName), prompt = _a.prompt, system = _a.system, tools = _a.tools, callbacks = _a.callbacks, completionName = _a.completion, _b = _a.validate, validate = _b === void 0 ? validateDefault : _b;
820
860
  var completion = _this.completionSchemaService.get(completionName);
821
861
  _this.sessionValidationService.addAgentUsage(clientId, agentName);
822
- return new ClientAgent({
823
- clientId: clientId,
824
- agentName: agentName,
825
- validate: validate,
826
- logger: _this.loggerService,
827
- history: _this.historyConnectionService.getHistory(clientId, agentName),
828
- prompt: prompt,
829
- system: system,
830
- tools: tools === null || tools === void 0 ? void 0 : tools.map(_this.toolSchemaService.get),
831
- completion: completion,
832
- });
862
+ return new ClientAgent(__assign({ clientId: clientId, agentName: agentName, validate: validate, logger: _this.loggerService, history: _this.historyConnectionService.getHistory(clientId, agentName), prompt: prompt, system: system, tools: tools === null || tools === void 0 ? void 0 : tools.map(_this.toolSchemaService.get), completion: completion }, callbacks));
833
863
  });
834
864
  /**
835
865
  * Executes an input command.
@@ -942,12 +972,18 @@ var AgentConnectionService = /** @class */ (function () {
942
972
  */
943
973
  this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
944
974
  return __generator(this, function (_a) {
945
- this.loggerService.log("agentConnectionService dispose", {
946
- context: this.contextService.context,
947
- });
948
- this.getAgent.clear("".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.agentName));
949
- this.sessionValidationService.removeAgentUsage(this.contextService.context.clientId, this.contextService.context.agentName);
950
- return [2 /*return*/];
975
+ switch (_a.label) {
976
+ case 0:
977
+ this.loggerService.log("agentConnectionService dispose", {
978
+ context: this.contextService.context,
979
+ });
980
+ return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).dispose()];
981
+ case 1:
982
+ _a.sent();
983
+ this.getAgent.clear("".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.agentName));
984
+ this.sessionValidationService.removeAgentUsage(this.contextService.context.clientId, this.contextService.context.agentName);
985
+ return [2 /*return*/];
986
+ }
951
987
  });
952
988
  }); };
953
989
  }
@@ -1459,7 +1495,7 @@ var SwarmConnectionService = /** @class */ (function () {
1459
1495
  return "".concat(clientId, "-").concat(swarmName);
1460
1496
  }, function (clientId, swarmName) {
1461
1497
  var e_1, _a;
1462
- var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent;
1498
+ var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent, callbacks = _b.callbacks;
1463
1499
  var agentMap = {};
1464
1500
  try {
1465
1501
  for (var agentList_1 = __values(agentList), agentList_1_1 = agentList_1.next(); !agentList_1_1.done; agentList_1_1 = agentList_1.next()) {
@@ -1484,7 +1520,11 @@ var SwarmConnectionService = /** @class */ (function () {
1484
1520
  return __awaiter(this, void 0, void 0, function () {
1485
1521
  return __generator(this, function (_a) {
1486
1522
  switch (_a.label) {
1487
- case 0: return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED(clientId, agentName, swarmName)];
1523
+ case 0:
1524
+ if (callbacks && callbacks.onAgentChanged) {
1525
+ callbacks.onAgentChanged(clientId, agentName, swarmName);
1526
+ }
1527
+ return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED(clientId, agentName, swarmName)];
1488
1528
  case 1:
1489
1529
  _a.sent();
1490
1530
  return [2 /*return*/];
@@ -1679,6 +1719,8 @@ var ClientSession = /** @class */ (function () {
1679
1719
  this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " emit"), {
1680
1720
  message: message,
1681
1721
  });
1722
+ this.params.onEmit &&
1723
+ this.params.onEmit(this.params.clientId, this.params.swarmName, message);
1682
1724
  return [4 /*yield*/, this._emitSubject.next(message)];
1683
1725
  case 1:
1684
1726
  _a.sent();
@@ -1701,6 +1743,8 @@ var ClientSession = /** @class */ (function () {
1701
1743
  message: message,
1702
1744
  mode: mode,
1703
1745
  });
1746
+ this.params.onExecute &&
1747
+ this.params.onExecute(this.params.clientId, this.params.swarmName, message, mode);
1704
1748
  return [4 /*yield*/, this.params.swarm.getAgent()];
1705
1749
  case 1:
1706
1750
  agent = _a.sent();
@@ -1801,6 +1845,8 @@ var ClientSession = /** @class */ (function () {
1801
1845
  */
1802
1846
  this.connect = function (connector) {
1803
1847
  _this.params.logger.debug("ClientSession clientId=".concat(_this.params.clientId, " connect"));
1848
+ _this.params.onConnect &&
1849
+ _this.params.onConnect(_this.params.clientId, _this.params.swarmName);
1804
1850
  _this._emitSubject.subscribe(function (data) { return __awaiter(_this, void 0, void 0, function () {
1805
1851
  var _a;
1806
1852
  var _b;
@@ -1842,9 +1888,22 @@ var ClientSession = /** @class */ (function () {
1842
1888
  });
1843
1889
  }); };
1844
1890
  };
1891
+ /**
1892
+ * Should call on session dispose
1893
+ * @returns {Promise<void>}
1894
+ */
1895
+ this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
1896
+ return __generator(this, function (_a) {
1897
+ this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " dispose"));
1898
+ this.params.onDispose &&
1899
+ this.params.onDispose(this.params.clientId, this.params.swarmName);
1900
+ return [2 /*return*/];
1901
+ });
1902
+ }); };
1845
1903
  this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"), {
1846
1904
  params: params,
1847
1905
  });
1906
+ this.params.onInit && this.params.onInit(params.clientId, params.swarmName);
1848
1907
  }
1849
1908
  return ClientSession;
1850
1909
  }());
@@ -1859,6 +1918,7 @@ var SessionConnectionService = /** @class */ (function () {
1859
1918
  this.loggerService = inject(TYPES.loggerService);
1860
1919
  this.contextService = inject(TYPES.contextService);
1861
1920
  this.swarmConnectionService = inject(TYPES.swarmConnectionService);
1921
+ this.swarmSchemaService = inject(TYPES.swarmSchemaService);
1862
1922
  /**
1863
1923
  * Retrieves a memoized session based on clientId and swarmName.
1864
1924
  * @param {string} clientId - The client ID.
@@ -1869,11 +1929,8 @@ var SessionConnectionService = /** @class */ (function () {
1869
1929
  var _b = __read(_a, 2), clientId = _b[0], swarmName = _b[1];
1870
1930
  return "".concat(clientId, "-").concat(swarmName);
1871
1931
  }, function (clientId, swarmName) {
1872
- return new ClientSession({
1873
- clientId: clientId,
1874
- logger: _this.loggerService,
1875
- swarm: _this.swarmConnectionService.getSwarm(clientId, swarmName),
1876
- });
1932
+ var callbacks = _this.swarmSchemaService.get(swarmName).callbacks;
1933
+ return new ClientSession(__assign({ clientId: clientId, logger: _this.loggerService, swarm: _this.swarmConnectionService.getSwarm(clientId, swarmName), swarmName: swarmName }, callbacks));
1877
1934
  });
1878
1935
  /**
1879
1936
  * Emits a message to the session.
@@ -1999,11 +2056,17 @@ var SessionConnectionService = /** @class */ (function () {
1999
2056
  */
2000
2057
  this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
2001
2058
  return __generator(this, function (_a) {
2002
- this.loggerService.log("sessionConnectionService dispose", {
2003
- context: this.contextService.context,
2004
- });
2005
- this.getSession.clear("".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.swarmName));
2006
- return [2 /*return*/];
2059
+ switch (_a.label) {
2060
+ case 0:
2061
+ this.loggerService.log("sessionConnectionService dispose", {
2062
+ context: this.contextService.context,
2063
+ });
2064
+ return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).dispose()];
2065
+ case 1:
2066
+ _a.sent();
2067
+ this.getSession.clear("".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.swarmName));
2068
+ return [2 /*return*/];
2069
+ }
2007
2070
  });
2008
2071
  }); };
2009
2072
  }