agent-swarm-kit 1.0.79 → 1.0.80

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.
Files changed (3) hide show
  1. package/build/index.cjs +247 -230
  2. package/build/index.mjs +247 -230
  3. package/package.json +1 -1
package/build/index.cjs CHANGED
@@ -429,6 +429,17 @@ var removeXmlTags = function (input) {
429
429
  .trim();
430
430
  };
431
431
 
432
+ var INSTANCE_METHOD_NAME_WAIT_FOR_INIT = "HistoryInstance.waitForInit";
433
+ var INSTANCE_METHOD_NAME_CTOR = "HistoryInstance.CTOR";
434
+ var INSTANCE_METHOD_NAME_ITERATE_CONDITION = "HistoryInstance.iterate condition";
435
+ var INSTANCE_METHOD_NAME_ITERATE = "HistoryInstance.iterate";
436
+ var INSTANCE_METHOD_NAME_PUSH = "HistoryInstance.push";
437
+ var INSTANCE_METHOD_NAME_DISPOSE = "HistoryInstance.dispose";
438
+ var METHOD_NAME_USE_HISTORY_ADAPTER = "HistoryUtils.useHistoryAdapter";
439
+ var METHOD_NAME_USE_HISTORY_CALLBACKS = "HistoryUtils.useHistoryCallbacks";
440
+ var METHOD_NAME_ITERATE = "HistoryUtils.iterate";
441
+ var METHOD_NAME_PUSH = "HistoryUtils.push";
442
+ var METHOD_NAME_DISPOSE = "HistoryUtils.dispose";
432
443
  /**
433
444
  * Class representing a History Instance
434
445
  */
@@ -453,7 +464,7 @@ var HistoryInstance = /** @class */ (function () {
453
464
  switch (_b.label) {
454
465
  case 0:
455
466
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
456
- swarm.loggerService.log("HistoryInstance waitForInit", {
467
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_WAIT_FOR_INIT, {
457
468
  clientId: this.clientId,
458
469
  agentName: agentName,
459
470
  });
@@ -476,7 +487,7 @@ var HistoryInstance = /** @class */ (function () {
476
487
  this.push = function (value, agentName) { return __awaiter(_this, void 0, void 0, function () {
477
488
  return __generator(this, function (_a) {
478
489
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
479
- swarm.loggerService.log("HistoryInstance push", {
490
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_PUSH, {
480
491
  clientId: this.clientId,
481
492
  agentName: agentName,
482
493
  });
@@ -496,7 +507,7 @@ var HistoryInstance = /** @class */ (function () {
496
507
  this.dispose = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
497
508
  return __generator(this, function (_a) {
498
509
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
499
- swarm.loggerService.log("HistoryInstance dispose", {
510
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_DISPOSE, {
500
511
  clientId: this.clientId,
501
512
  agentName: agentName,
502
513
  });
@@ -508,7 +519,7 @@ var HistoryInstance = /** @class */ (function () {
508
519
  });
509
520
  }); };
510
521
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
511
- swarm.loggerService.log("HistoryInstance CTOR", {
522
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_CTOR, {
512
523
  clientId: this.clientId,
513
524
  });
514
525
  if (callbacks.onInit) {
@@ -526,7 +537,7 @@ var HistoryInstance = /** @class */ (function () {
526
537
  switch (_g.label) {
527
538
  case 0:
528
539
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
529
- swarm.loggerService.log("HistoryInstance iterate condition", {
540
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_ITERATE_CONDITION, {
530
541
  clientId: this.clientId,
531
542
  agentName: agentName,
532
543
  });
@@ -625,7 +636,7 @@ var HistoryInstance = /** @class */ (function () {
625
636
  switch (_g.label) {
626
637
  case 0:
627
638
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
628
- swarm.loggerService.log("HistoryInstance iterate", {
639
+ swarm.loggerService.log(INSTANCE_METHOD_NAME_ITERATE, {
629
640
  clientId: this.clientId,
630
641
  agentName: agentName,
631
642
  });
@@ -725,7 +736,7 @@ var HistoryUtils = /** @class */ (function () {
725
736
  */
726
737
  this.useHistoryAdapter = function (Ctor) {
727
738
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
728
- swarm.loggerService.log("HistoryUtils useHistoryAdapter");
739
+ swarm.loggerService.log(METHOD_NAME_USE_HISTORY_ADAPTER);
729
740
  _this.HistoryFactory = Ctor;
730
741
  };
731
742
  /**
@@ -734,7 +745,7 @@ var HistoryUtils = /** @class */ (function () {
734
745
  */
735
746
  this.useHistoryCallbacks = function (Callbacks) {
736
747
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
737
- swarm.loggerService.log("HistoryUtils useHistoryCallbacks");
748
+ swarm.loggerService.log(METHOD_NAME_USE_HISTORY_CALLBACKS);
738
749
  Object.assign(_this.HistoryCallbacks, Callbacks);
739
750
  };
740
751
  /**
@@ -750,7 +761,7 @@ var HistoryUtils = /** @class */ (function () {
750
761
  switch (_a.label) {
751
762
  case 0:
752
763
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
753
- swarm.loggerService.log("HistoryUtils push", {
764
+ swarm.loggerService.log(METHOD_NAME_PUSH, {
754
765
  clientId: clientId,
755
766
  agentName: agentName,
756
767
  value: value,
@@ -779,7 +790,7 @@ var HistoryUtils = /** @class */ (function () {
779
790
  switch (_a.label) {
780
791
  case 0:
781
792
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
782
- swarm.loggerService.log("HistoryUtils dispose", {
793
+ swarm.loggerService.log(METHOD_NAME_DISPOSE, {
783
794
  clientId: clientId,
784
795
  agentName: agentName,
785
796
  });
@@ -815,7 +826,7 @@ var HistoryUtils = /** @class */ (function () {
815
826
  switch (_g.label) {
816
827
  case 0:
817
828
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
818
- swarm.loggerService.log("HistoryUtils iterate", {
829
+ swarm.loggerService.log(METHOD_NAME_ITERATE, {
819
830
  clientId: clientId,
820
831
  agentName: agentName,
821
832
  });
@@ -6708,6 +6719,7 @@ var validationServices = {
6708
6719
  var swarm = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices), contextServices), connectionServices), schemaServices), publicServices), validationServices);
6709
6720
  init();
6710
6721
 
6722
+ var METHOD_NAME$C = "function.addAgent";
6711
6723
  /**
6712
6724
  * Adds a new agent to the agent registry. The swarm takes only those agents which was registered
6713
6725
  *
@@ -6716,7 +6728,7 @@ init();
6716
6728
  */
6717
6729
  var addAgent = function (agentSchema) {
6718
6730
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6719
- swarm.loggerService.log("function addAgent", {
6731
+ swarm.loggerService.log(METHOD_NAME$C, {
6720
6732
  agentSchema: agentSchema,
6721
6733
  });
6722
6734
  swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
@@ -6724,6 +6736,7 @@ var addAgent = function (agentSchema) {
6724
6736
  return agentSchema.agentName;
6725
6737
  };
6726
6738
 
6739
+ var METHOD_NAME$B = "function.addCompletion";
6727
6740
  /**
6728
6741
  * Adds a completion engine for agents. Agents could use different models and
6729
6742
  * framewords for completion like: mock, gpt4all, ollama, openai
@@ -6733,7 +6746,7 @@ var addAgent = function (agentSchema) {
6733
6746
  */
6734
6747
  var addCompletion = function (completionSchema) {
6735
6748
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6736
- swarm.loggerService.log("function addCompletion", {
6749
+ swarm.loggerService.log(METHOD_NAME$B, {
6737
6750
  completionSchema: completionSchema,
6738
6751
  });
6739
6752
  swarm.completionValidationService.addCompletion(completionSchema.completionName);
@@ -6741,6 +6754,7 @@ var addCompletion = function (completionSchema) {
6741
6754
  return completionSchema.completionName;
6742
6755
  };
6743
6756
 
6757
+ var METHOD_NAME$A = "function.addSwarm";
6744
6758
  /**
6745
6759
  * Adds a new swarm to the system. The swarm is a root for starting client session
6746
6760
  *
@@ -6749,7 +6763,7 @@ var addCompletion = function (completionSchema) {
6749
6763
  */
6750
6764
  var addSwarm = function (swarmSchema) {
6751
6765
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6752
- swarm.loggerService.log("function addSwarm", {
6766
+ swarm.loggerService.log(METHOD_NAME$A, {
6753
6767
  swarmSchema: swarmSchema,
6754
6768
  });
6755
6769
  swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
@@ -6757,6 +6771,7 @@ var addSwarm = function (swarmSchema) {
6757
6771
  return swarmSchema.swarmName;
6758
6772
  };
6759
6773
 
6774
+ var METHOD_NAME$z = "function.addTool";
6760
6775
  /**
6761
6776
  * Adds a new tool for agents in a swarm. Tool should be registered in `addAgent`
6762
6777
  * declaration
@@ -6766,7 +6781,7 @@ var addSwarm = function (swarmSchema) {
6766
6781
  */
6767
6782
  var addTool = function (toolSchema) {
6768
6783
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6769
- swarm.loggerService.log("function addTool", {
6784
+ swarm.loggerService.log(METHOD_NAME$z, {
6770
6785
  toolSchema: toolSchema,
6771
6786
  });
6772
6787
  swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
@@ -6774,6 +6789,7 @@ var addTool = function (toolSchema) {
6774
6789
  return toolSchema.toolName;
6775
6790
  };
6776
6791
 
6792
+ var METHOD_NAME$y = "function.addState";
6777
6793
  /**
6778
6794
  * Adds a new state to the state registry. The swarm takes only those states which was registered
6779
6795
  *
@@ -6782,7 +6798,7 @@ var addTool = function (toolSchema) {
6782
6798
  */
6783
6799
  var addState = function (stateSchema) {
6784
6800
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6785
- swarm.loggerService.log("function addState", {
6801
+ swarm.loggerService.log(METHOD_NAME$y, {
6786
6802
  stateSchema: stateSchema,
6787
6803
  });
6788
6804
  swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
@@ -6794,6 +6810,7 @@ var addState = function (stateSchema) {
6794
6810
  return stateSchema.stateName;
6795
6811
  };
6796
6812
 
6813
+ var METHOD_NAME$x = "function.addEmbedding";
6797
6814
  /**
6798
6815
  * Adds a new embedding to the embedding registry. The swarm takes only those embeddings which was registered
6799
6816
  *
@@ -6802,7 +6819,7 @@ var addState = function (stateSchema) {
6802
6819
  */
6803
6820
  var addEmbedding = function (embeddingSchema) {
6804
6821
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6805
- swarm.loggerService.log("function addEmbedding", {
6822
+ swarm.loggerService.log(METHOD_NAME$x, {
6806
6823
  embeddingSchema: embeddingSchema,
6807
6824
  });
6808
6825
  swarm.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
@@ -6810,6 +6827,7 @@ var addEmbedding = function (embeddingSchema) {
6810
6827
  return embeddingSchema.embeddingName;
6811
6828
  };
6812
6829
 
6830
+ var METHOD_NAME$w = "function.addStorage";
6813
6831
  /**
6814
6832
  * Adds a new storage to the storage registry. The swarm takes only those storages which was registered
6815
6833
  *
@@ -6818,7 +6836,7 @@ var addEmbedding = function (embeddingSchema) {
6818
6836
  */
6819
6837
  var addStorage = function (storageSchema) {
6820
6838
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6821
- swarm.loggerService.log("function addStorage", {
6839
+ swarm.loggerService.log(METHOD_NAME$w, {
6822
6840
  storageSchema: storageSchema,
6823
6841
  });
6824
6842
  swarm.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
@@ -6831,6 +6849,7 @@ var addStorage = function (storageSchema) {
6831
6849
  return storageSchema.storageName;
6832
6850
  };
6833
6851
 
6852
+ var METHOD_NAME$v = "function.commitSystemMessage";
6834
6853
  /**
6835
6854
  * Commits a user message to the active agent history in as swarm without answer.
6836
6855
  *
@@ -6840,22 +6859,21 @@ var addStorage = function (storageSchema) {
6840
6859
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
6841
6860
  */
6842
6861
  var commitUserMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
6843
- var methodName, swarmName, currentAgentName;
6862
+ var swarmName, currentAgentName;
6844
6863
  return __generator(this, function (_a) {
6845
6864
  switch (_a.label) {
6846
6865
  case 0:
6847
- methodName = "function commitSystemMessage";
6848
6866
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6849
- swarm.loggerService.log("function commitSystemMessage", {
6867
+ swarm.loggerService.log(METHOD_NAME$v, {
6850
6868
  content: content,
6851
6869
  clientId: clientId,
6852
6870
  agentName: agentName,
6853
6871
  });
6854
- swarm.agentValidationService.validate(agentName, "commitUserMessage");
6855
- swarm.sessionValidationService.validate(clientId, "commitUserMessage");
6872
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$v);
6873
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$v);
6856
6874
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
6857
- swarm.swarmValidationService.validate(swarmName, "commitUserMessage");
6858
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6875
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$v);
6876
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName)];
6859
6877
  case 1:
6860
6878
  currentAgentName = _a.sent();
6861
6879
  if (currentAgentName !== agentName) {
@@ -6867,7 +6885,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6867
6885
  });
6868
6886
  return [2 /*return*/];
6869
6887
  }
6870
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
6888
+ return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$v, clientId, swarmName)];
6871
6889
  case 2:
6872
6890
  _a.sent();
6873
6891
  return [2 /*return*/];
@@ -6875,6 +6893,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6875
6893
  });
6876
6894
  }); };
6877
6895
 
6896
+ var METHOD_NAME$u = "function.getAgentName";
6878
6897
  /**
6879
6898
  * Retrieves the agent name for a given client ID.
6880
6899
  *
@@ -6883,25 +6902,25 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6883
6902
  * @throws Will throw an error if the client ID is invalid or if the swarm validation fails.
6884
6903
  */
6885
6904
  var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
6886
- var methodName, swarmName;
6905
+ var swarmName;
6887
6906
  return __generator(this, function (_a) {
6888
6907
  switch (_a.label) {
6889
6908
  case 0:
6890
- methodName = "function getAgentName";
6891
6909
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6892
- swarm.loggerService.log("function getAgentName", {
6910
+ swarm.loggerService.log(METHOD_NAME$u, {
6893
6911
  clientId: clientId,
6894
6912
  });
6895
- swarm.sessionValidationService.validate(clientId, "getAgentName");
6913
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$u);
6896
6914
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
6897
- swarm.swarmValidationService.validate(swarmName, "getAgentName");
6898
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6915
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$u);
6916
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
6899
6917
  case 1: return [2 /*return*/, _a.sent()];
6900
6918
  }
6901
6919
  });
6902
6920
  }); };
6903
6921
 
6904
6922
  var SCHEDULED_DELAY$1 = 1000;
6923
+ var METHOD_NAME$t = "function.makeConnection";
6905
6924
  /**
6906
6925
  * A connection factory for a client to a swarm and returns a function to send messages.
6907
6926
  *
@@ -6911,27 +6930,26 @@ var SCHEDULED_DELAY$1 = 1000;
6911
6930
  * @returns {SendMessageFn} - A function to send messages to the swarm.
6912
6931
  */
6913
6932
  var makeConnection = function (connector, clientId, swarmName) {
6914
- var methodName = "function makeConnection";
6915
6933
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
6916
- swarm.loggerService.log("function makeConnection", {
6934
+ swarm.loggerService.log(METHOD_NAME$t, {
6917
6935
  clientId: clientId,
6918
6936
  swarmName: swarmName,
6919
6937
  });
6920
- swarm.swarmValidationService.validate(swarmName, "makeConnection");
6938
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$t);
6921
6939
  swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
6922
- var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
6940
+ var send = swarm.sessionPublicService.connect(connector, METHOD_NAME$t, clientId, swarmName);
6923
6941
  return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
6924
6942
  var _a;
6925
6943
  var _b;
6926
6944
  return __generator(this, function (_c) {
6927
6945
  switch (_c.label) {
6928
6946
  case 0:
6929
- swarm.sessionValidationService.validate(clientId, "makeConnection");
6947
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$t);
6930
6948
  _a = send;
6931
6949
  _b = {
6932
6950
  data: outgoing
6933
6951
  };
6934
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6952
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName)];
6935
6953
  case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
6936
6954
  _b.clientId = clientId,
6937
6955
  _b)])];
@@ -7017,6 +7035,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
7017
7035
  }); };
7018
7036
  };
7019
7037
 
7038
+ var METHOD_NAME$s = "function.changeAgent";
7020
7039
  /**
7021
7040
  * Time-to-live for the change agent function in milliseconds.
7022
7041
  * @constant {number}
@@ -7039,8 +7058,8 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
7039
7058
  return __generator(this, function (_d) {
7040
7059
  switch (_d.label) {
7041
7060
  case 0:
7042
- swarm.sessionValidationService.validate(clientId, "changeAgent");
7043
- swarm.agentValidationService.validate(agentName, "changeAgent");
7061
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$s);
7062
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$s);
7044
7063
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7045
7064
  return [4 /*yield*/, Promise.all(swarm.swarmValidationService
7046
7065
  .getAgentList(swarmName)
@@ -7105,13 +7124,12 @@ var createGc$1 = functoolsKit.singleshot(function () { return __awaiter(void 0,
7105
7124
  * @returns {Promise<void>} - A promise that resolves when the agent is changed.
7106
7125
  */
7107
7126
  var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7108
- var methodName, run;
7127
+ var run;
7109
7128
  return __generator(this, function (_a) {
7110
7129
  switch (_a.label) {
7111
7130
  case 0:
7112
- methodName = "function changeAgent";
7113
7131
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7114
- swarm.loggerService.log("function changeAgent", {
7132
+ swarm.loggerService.log(METHOD_NAME$s, {
7115
7133
  agentName: agentName,
7116
7134
  clientId: clientId,
7117
7135
  });
@@ -7119,12 +7137,13 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
7119
7137
  case 1:
7120
7138
  run = _a.sent();
7121
7139
  createGc$1();
7122
- return [4 /*yield*/, run(methodName, agentName)];
7140
+ return [4 /*yield*/, run(METHOD_NAME$s, agentName)];
7123
7141
  case 2: return [2 /*return*/, _a.sent()];
7124
7142
  }
7125
7143
  });
7126
7144
  }); };
7127
7145
 
7146
+ var METHOD_NAME$r = "function.disposeConnection";
7128
7147
  /**
7129
7148
  * Disposes the session for a given client with all related swarms and agents.
7130
7149
  *
@@ -7138,16 +7157,16 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7138
7157
  args_1[_i - 2] = arguments[_i];
7139
7158
  }
7140
7159
  return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName, methodName) {
7141
- if (methodName === void 0) { methodName = "function disposeConnection"; }
7160
+ if (methodName === void 0) { methodName = METHOD_NAME$r; }
7142
7161
  return __generator(this, function (_a) {
7143
7162
  switch (_a.label) {
7144
7163
  case 0:
7145
7164
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7146
- swarm.loggerService.log("function disposeConnection", {
7165
+ swarm.loggerService.log(METHOD_NAME$r, {
7147
7166
  clientId: clientId,
7148
7167
  swarmName: swarmName,
7149
7168
  });
7150
- swarm.swarmValidationService.validate(swarmName, "disposeConnection");
7169
+ swarm.swarmValidationService.validate(swarmName, methodName);
7151
7170
  swarm.sessionValidationService.removeSession(clientId);
7152
7171
  swarm.busService.dispose(clientId);
7153
7172
  return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
@@ -7218,6 +7237,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
7218
7237
  });
7219
7238
  };
7220
7239
 
7240
+ var METHOD_NAME$q = "function.complete";
7221
7241
  var COMPLETE_TTL = 15 * 60 * 1000;
7222
7242
  var COMPLETE_GC = 60 * 1000;
7223
7243
  /**
@@ -7227,17 +7247,17 @@ var COMPLETE_GC = 60 * 1000;
7227
7247
  * @returns {TCompleteRun} The complete run function.
7228
7248
  */
7229
7249
  var createComplete = functoolsKit.ttl(function (clientId, swarmName) {
7230
- return functoolsKit.queued(function (methodName, content) { return __awaiter(void 0, void 0, void 0, function () {
7250
+ return functoolsKit.queued(function (METHOD_NAME, content) { return __awaiter(void 0, void 0, void 0, function () {
7231
7251
  var result;
7232
7252
  return __generator(this, function (_a) {
7233
7253
  switch (_a.label) {
7234
7254
  case 0:
7235
- swarm.swarmValidationService.validate(swarmName, "complete");
7255
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
7236
7256
  swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
7237
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
7257
+ return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME, clientId, swarmName)];
7238
7258
  case 1:
7239
7259
  result = _a.sent();
7240
- return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
7260
+ return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME)];
7241
7261
  case 2:
7242
7262
  _a.sent();
7243
7263
  return [2 /*return*/, result];
@@ -7271,14 +7291,13 @@ var createGc = functoolsKit.singleshot(function () { return __awaiter(void 0, vo
7271
7291
  * @returns {Promise<string>} The result of the complete function.
7272
7292
  */
7273
7293
  var complete = function (content, clientId, swarmName) { return __awaiter(void 0, void 0, void 0, function () {
7274
- var methodName, executionId, run;
7294
+ var executionId, run;
7275
7295
  return __generator(this, function (_a) {
7276
7296
  switch (_a.label) {
7277
7297
  case 0:
7278
- methodName = "function complete";
7279
7298
  executionId = functoolsKit.randomString();
7280
7299
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7281
- swarm.loggerService.log("function complete", {
7300
+ swarm.loggerService.log(METHOD_NAME$q, {
7282
7301
  content: content,
7283
7302
  clientId: clientId,
7284
7303
  executionId: executionId,
@@ -7291,7 +7310,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
7291
7310
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7292
7311
  return __generator(this, function (_a) {
7293
7312
  switch (_a.label) {
7294
- case 0: return [4 /*yield*/, run(methodName, content)];
7313
+ case 0: return [4 /*yield*/, run(METHOD_NAME$q, content)];
7295
7314
  case 1: return [2 /*return*/, _a.sent()];
7296
7315
  }
7297
7316
  });
@@ -7304,6 +7323,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
7304
7323
  }); };
7305
7324
 
7306
7325
  var SCHEDULED_DELAY = 1000;
7326
+ var METHOD_NAME$p = "function.session";
7307
7327
  /**
7308
7328
  * Creates a session for the given client and swarm.
7309
7329
  *
@@ -7314,15 +7334,14 @@ var SCHEDULED_DELAY = 1000;
7314
7334
  * @returns {Function} dispose - A function to dispose of the session.
7315
7335
  */
7316
7336
  var session = function (clientId, swarmName) {
7317
- var methodName = "function session";
7318
7337
  var executionId = functoolsKit.randomString();
7319
7338
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7320
- swarm.loggerService.log("function session", {
7339
+ swarm.loggerService.log(METHOD_NAME$p, {
7321
7340
  clientId: clientId,
7322
7341
  swarmName: swarmName,
7323
7342
  executionId: executionId,
7324
7343
  });
7325
- swarm.swarmValidationService.validate(swarmName, "session");
7344
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$p);
7326
7345
  swarm.sessionValidationService.addSession(clientId, swarmName, "session");
7327
7346
  return {
7328
7347
  /**
@@ -7333,11 +7352,11 @@ var session = function (clientId, swarmName) {
7333
7352
  */
7334
7353
  complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
7335
7354
  return __generator(this, function (_a) {
7336
- swarm.sessionValidationService.validate(clientId, "session");
7355
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$p);
7337
7356
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7338
7357
  return __generator(this, function (_a) {
7339
7358
  switch (_a.label) {
7340
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
7359
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME$p, clientId, swarmName)];
7341
7360
  case 1: return [2 /*return*/, _a.sent()];
7342
7361
  }
7343
7362
  });
@@ -7355,7 +7374,7 @@ var session = function (clientId, swarmName) {
7355
7374
  dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
7356
7375
  return __generator(this, function (_a) {
7357
7376
  switch (_a.label) {
7358
- case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
7377
+ case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME$p)];
7359
7378
  case 1: return [2 /*return*/, _a.sent()];
7360
7379
  }
7361
7380
  });
@@ -7454,6 +7473,7 @@ session.scheduled = function (clientId, swarmName, _a) {
7454
7473
  };
7455
7474
  };
7456
7475
 
7476
+ var METHOD_NAME$o = "function.getRawHistory";
7457
7477
  /**
7458
7478
  * Retrieves the raw history as it is for a given client ID without any modifications.
7459
7479
  *
@@ -7467,17 +7487,17 @@ var getRawHistory = function (clientId_1) {
7467
7487
  }
7468
7488
  return __awaiter(void 0, __spreadArray([clientId_1], __read(args_1), false), void 0, function (clientId, methodName) {
7469
7489
  var swarmName, agentName, history;
7470
- if (methodName === void 0) { methodName = "function getRawHistory"; }
7490
+ if (methodName === void 0) { methodName = METHOD_NAME$o; }
7471
7491
  return __generator(this, function (_a) {
7472
7492
  switch (_a.label) {
7473
7493
  case 0:
7474
7494
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7475
- swarm.loggerService.log("function getRawHistory", {
7495
+ swarm.loggerService.log(METHOD_NAME$o, {
7476
7496
  clientId: clientId,
7477
7497
  });
7478
- swarm.sessionValidationService.validate(clientId, "getRawHistory");
7498
+ swarm.sessionValidationService.validate(clientId, methodName);
7479
7499
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7480
- swarm.swarmValidationService.validate(swarmName, "getRawHistory");
7500
+ swarm.swarmValidationService.validate(swarmName, methodName);
7481
7501
  return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7482
7502
  case 1:
7483
7503
  agentName = _a.sent();
@@ -7490,6 +7510,7 @@ var getRawHistory = function (clientId_1) {
7490
7510
  });
7491
7511
  };
7492
7512
 
7513
+ var METHOD_NAME$n = "function.getAgentHistory";
7493
7514
  /**
7494
7515
  * Retrieves the history prepared for a specific agent with resque algorithm tweaks
7495
7516
  *
@@ -7498,19 +7519,18 @@ var getRawHistory = function (clientId_1) {
7498
7519
  * @returns {Promise<Array>} - A promise that resolves to an array containing the agent's history.
7499
7520
  */
7500
7521
  var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7501
- var methodName, prompt, history;
7522
+ var prompt, history;
7502
7523
  return __generator(this, function (_a) {
7503
7524
  switch (_a.label) {
7504
7525
  case 0:
7505
- methodName = "function getAgentHistory";
7506
7526
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7507
- swarm.loggerService.log("function getAgentHistory", {
7527
+ swarm.loggerService.log(METHOD_NAME$n, {
7508
7528
  clientId: clientId,
7509
7529
  agentName: agentName,
7510
7530
  });
7511
- swarm.agentValidationService.validate(agentName, "getAgentHistory");
7531
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$n);
7512
7532
  prompt = swarm.agentSchemaService.get(agentName).prompt;
7513
- return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
7533
+ return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$n, clientId, agentName)];
7514
7534
  case 1:
7515
7535
  history = _a.sent();
7516
7536
  return [2 /*return*/, __spreadArray([], __read(history), false)];
@@ -7518,6 +7538,7 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
7518
7538
  });
7519
7539
  }); };
7520
7540
 
7541
+ var METHOD_NAME$m = "function.getSessionMode";
7521
7542
  /**
7522
7543
  * Return the session mode (`"session" | "makeConnection" | "complete"`) for clientId
7523
7544
  *
@@ -7527,15 +7548,16 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
7527
7548
  var swarmName;
7528
7549
  return __generator(this, function (_a) {
7529
7550
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7530
- swarm.loggerService.log("function getSessionMode", {
7551
+ swarm.loggerService.log(METHOD_NAME$m, {
7531
7552
  clientId: clientId,
7532
7553
  });
7533
7554
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7534
- swarm.swarmValidationService.validate(swarmName, "getSessionMode");
7555
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$m);
7535
7556
  return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
7536
7557
  });
7537
7558
  }); };
7538
7559
 
7560
+ var METHOD_NAME$l = "function.commitToolOutput";
7539
7561
  /**
7540
7562
  * Commits the tool output to the active agent in a swarm session
7541
7563
  *
@@ -7545,24 +7567,22 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
7545
7567
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
7546
7568
  */
7547
7569
  var commitToolOutput = function (toolId, content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7548
- var methodName, swarmName, currentAgentName;
7570
+ var swarmName, currentAgentName;
7549
7571
  return __generator(this, function (_a) {
7550
7572
  switch (_a.label) {
7551
7573
  case 0:
7552
- methodName = "function commitToolOutput";
7553
7574
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7554
- swarm.loggerService.log("function commitToolOutput", {
7575
+ swarm.loggerService.log(METHOD_NAME$l, {
7555
7576
  toolId: toolId,
7556
7577
  content: content,
7557
7578
  clientId: clientId,
7558
7579
  agentName: agentName,
7559
- methodName: methodName,
7560
7580
  });
7561
- swarm.agentValidationService.validate(agentName, "commitSystemMessage");
7562
- swarm.sessionValidationService.validate(clientId, "commitToolOutput");
7581
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$l);
7582
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$l);
7563
7583
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7564
- swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
7565
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7584
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$l);
7585
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
7566
7586
  case 1:
7567
7587
  currentAgentName = _a.sent();
7568
7588
  if (currentAgentName !== agentName) {
@@ -7575,7 +7595,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7575
7595
  });
7576
7596
  return [2 /*return*/];
7577
7597
  }
7578
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
7598
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$l, clientId, swarmName)];
7579
7599
  case 2:
7580
7600
  _a.sent();
7581
7601
  return [2 /*return*/];
@@ -7583,6 +7603,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7583
7603
  });
7584
7604
  }); };
7585
7605
 
7606
+ var METHOD_NAME$k = "function.commitSystemMessage";
7586
7607
  /**
7587
7608
  * Commits a system message to the active agent in the swarm.
7588
7609
  *
@@ -7592,22 +7613,21 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7592
7613
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7593
7614
  */
7594
7615
  var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7595
- var methodName, swarmName, currentAgentName;
7616
+ var swarmName, currentAgentName;
7596
7617
  return __generator(this, function (_a) {
7597
7618
  switch (_a.label) {
7598
7619
  case 0:
7599
- methodName = "function commitSystemMessage";
7600
7620
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7601
- swarm.loggerService.log("function commitSystemMessage", {
7621
+ swarm.loggerService.log(METHOD_NAME$k, {
7602
7622
  content: content,
7603
7623
  clientId: clientId,
7604
7624
  agentName: agentName,
7605
7625
  });
7606
- swarm.agentValidationService.validate(agentName, "commitSystemMessage");
7607
- swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
7626
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$k);
7627
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$k);
7608
7628
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7609
- swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
7610
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7629
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$k);
7630
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
7611
7631
  case 1:
7612
7632
  currentAgentName = _a.sent();
7613
7633
  if (currentAgentName !== agentName) {
@@ -7619,7 +7639,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7619
7639
  });
7620
7640
  return [2 /*return*/];
7621
7641
  }
7622
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
7642
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$k, clientId, swarmName)];
7623
7643
  case 2:
7624
7644
  _a.sent();
7625
7645
  return [2 /*return*/];
@@ -7627,6 +7647,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7627
7647
  });
7628
7648
  }); };
7629
7649
 
7650
+ var METHOD_NAME$j = "function.commitFlush";
7630
7651
  /**
7631
7652
  * Commits flush of agent history
7632
7653
  *
@@ -7635,21 +7656,20 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7635
7656
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7636
7657
  */
7637
7658
  var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7638
- var methodName, swarmName, currentAgentName;
7659
+ var swarmName, currentAgentName;
7639
7660
  return __generator(this, function (_a) {
7640
7661
  switch (_a.label) {
7641
7662
  case 0:
7642
- methodName = "function commitFlush";
7643
7663
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7644
- swarm.loggerService.log("function commitFlush", {
7664
+ swarm.loggerService.log(METHOD_NAME$j, {
7645
7665
  clientId: clientId,
7646
7666
  agentName: agentName,
7647
7667
  });
7648
- swarm.agentValidationService.validate(agentName, "commitFlush");
7649
- swarm.sessionValidationService.validate(clientId, "commitFlush");
7668
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$j);
7669
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$j);
7650
7670
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7651
- swarm.swarmValidationService.validate(swarmName, "commitFlush");
7652
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7671
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$j);
7672
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName)];
7653
7673
  case 1:
7654
7674
  currentAgentName = _a.sent();
7655
7675
  if (currentAgentName !== agentName) {
@@ -7661,7 +7681,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7661
7681
  });
7662
7682
  return [2 /*return*/];
7663
7683
  }
7664
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
7684
+ return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$j, clientId, swarmName)];
7665
7685
  case 2:
7666
7686
  _a.sent();
7667
7687
  return [2 /*return*/];
@@ -7669,6 +7689,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7669
7689
  });
7670
7690
  }); };
7671
7691
 
7692
+ var METHOD_NAME$i = "function.execute";
7672
7693
  /**
7673
7694
  * Send the message to the active agent in the swarm content like it income from client side
7674
7695
  * Should be used to review tool output and initiate conversation from the model side to client
@@ -7679,25 +7700,23 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7679
7700
  * @returns {Promise<void>} - A promise that resolves when the execution is complete.
7680
7701
  */
7681
7702
  var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7682
- var methodName, executionId, swarmName, currentAgentName;
7703
+ var executionId, swarmName, currentAgentName;
7683
7704
  return __generator(this, function (_a) {
7684
7705
  switch (_a.label) {
7685
7706
  case 0:
7686
- methodName = "function execute";
7687
7707
  executionId = functoolsKit.randomString();
7688
7708
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7689
- swarm.loggerService.log("function execute", {
7709
+ swarm.loggerService.log(METHOD_NAME$i, {
7690
7710
  content: content,
7691
7711
  clientId: clientId,
7692
7712
  agentName: agentName,
7693
- methodName: methodName,
7694
7713
  executionId: executionId,
7695
7714
  });
7696
- swarm.agentValidationService.validate(agentName, "execute");
7697
- swarm.sessionValidationService.validate(clientId, "execute");
7715
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$i);
7716
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$i);
7698
7717
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7699
- swarm.swarmValidationService.validate(swarmName, "execute");
7700
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7718
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$i);
7719
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
7701
7720
  case 1:
7702
7721
  currentAgentName = _a.sent();
7703
7722
  if (currentAgentName !== agentName) {
@@ -7712,7 +7731,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7712
7731
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7713
7732
  return __generator(this, function (_a) {
7714
7733
  switch (_a.label) {
7715
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
7734
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$i, clientId, swarmName)];
7716
7735
  case 1: return [2 /*return*/, _a.sent()];
7717
7736
  }
7718
7737
  });
@@ -7724,6 +7743,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7724
7743
  });
7725
7744
  }); };
7726
7745
 
7746
+ var METHOD_NAME$h = "function.emit";
7727
7747
  /**
7728
7748
  * Emits a string constant as the model output without executing incoming message
7729
7749
  * Works only for `makeConnection`
@@ -7735,13 +7755,12 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7735
7755
  * @returns {Promise<void>} A promise that resolves when the content is emitted.
7736
7756
  */
7737
7757
  var emit = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7738
- var methodName, swarmName, currentAgentName;
7758
+ var swarmName, currentAgentName;
7739
7759
  return __generator(this, function (_a) {
7740
7760
  switch (_a.label) {
7741
7761
  case 0:
7742
- methodName = "function emit";
7743
7762
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7744
- swarm.loggerService.log("function emit", {
7763
+ swarm.loggerService.log(METHOD_NAME$h, {
7745
7764
  content: content,
7746
7765
  clientId: clientId,
7747
7766
  agentName: agentName,
@@ -7749,11 +7768,11 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7749
7768
  if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7750
7769
  throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
7751
7770
  }
7752
- swarm.agentValidationService.validate(agentName, "emit");
7753
- swarm.sessionValidationService.validate(clientId, "emit");
7771
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$h);
7772
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$h);
7754
7773
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7755
- swarm.swarmValidationService.validate(swarmName, "emit");
7756
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7774
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$h);
7775
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
7757
7776
  case 1:
7758
7777
  currentAgentName = _a.sent();
7759
7778
  if (currentAgentName !== agentName) {
@@ -7765,12 +7784,13 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7765
7784
  });
7766
7785
  return [2 /*return*/];
7767
7786
  }
7768
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
7787
+ return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$h, clientId, swarmName)];
7769
7788
  case 2: return [2 /*return*/, _a.sent()];
7770
7789
  }
7771
7790
  });
7772
7791
  }); };
7773
7792
 
7793
+ var METHOD_NAME$g = "function.commitToolOutputForce";
7774
7794
  /**
7775
7795
  * Commits the tool output to the active agent in a swarm session without checking active agent
7776
7796
  *
@@ -7779,21 +7799,20 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7779
7799
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
7780
7800
  */
7781
7801
  var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7782
- var methodName, swarmName;
7802
+ var swarmName;
7783
7803
  return __generator(this, function (_a) {
7784
7804
  switch (_a.label) {
7785
7805
  case 0:
7786
- methodName = "function commitToolOutputForce";
7787
7806
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7788
- swarm.loggerService.log("function commitToolOutputForce", {
7807
+ swarm.loggerService.log(METHOD_NAME$g, {
7789
7808
  toolId: toolId,
7790
7809
  content: content,
7791
7810
  clientId: clientId,
7792
7811
  });
7793
- swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
7812
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$g);
7794
7813
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7795
- swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
7796
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
7814
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$g);
7815
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$g, clientId, swarmName)];
7797
7816
  case 1:
7798
7817
  _a.sent();
7799
7818
  return [2 /*return*/];
@@ -7801,6 +7820,7 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
7801
7820
  });
7802
7821
  }); };
7803
7822
 
7823
+ var METHOD_NAME$f = "function.commitSystemMessageForce";
7804
7824
  /**
7805
7825
  * Commits a system message to the active agent in as swarm without checking active agent.
7806
7826
  *
@@ -7809,20 +7829,19 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
7809
7829
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7810
7830
  */
7811
7831
  var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7812
- var methodName, swarmName;
7832
+ var swarmName;
7813
7833
  return __generator(this, function (_a) {
7814
7834
  switch (_a.label) {
7815
7835
  case 0:
7816
- methodName = "function commitSystemMessageForce";
7817
7836
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7818
- swarm.loggerService.log("function commitSystemMessageForce", {
7837
+ swarm.loggerService.log(METHOD_NAME$f, {
7819
7838
  content: content,
7820
7839
  clientId: clientId,
7821
7840
  });
7822
- swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
7841
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$f);
7823
7842
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7824
- swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
7825
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
7843
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$f);
7844
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$f, clientId, swarmName)];
7826
7845
  case 1:
7827
7846
  _a.sent();
7828
7847
  return [2 /*return*/];
@@ -7830,6 +7849,7 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
7830
7849
  });
7831
7850
  }); };
7832
7851
 
7852
+ var METHOD_NAME$e = "function.commitFlushForce";
7833
7853
  /**
7834
7854
  * Commits flush of agent history without active agent check
7835
7855
  *
@@ -7837,20 +7857,19 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
7837
7857
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7838
7858
  */
7839
7859
  var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7840
- var methodName, swarmName;
7860
+ var swarmName;
7841
7861
  return __generator(this, function (_a) {
7842
7862
  switch (_a.label) {
7843
7863
  case 0:
7844
- methodName = "function commitFlushForce";
7845
7864
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7846
- swarm.loggerService.log("function commitFlushForce", {
7865
+ swarm.loggerService.log(METHOD_NAME$e, {
7847
7866
  clientId: clientId,
7848
- methodName: methodName,
7867
+ METHOD_NAME: METHOD_NAME$e,
7849
7868
  });
7850
- swarm.sessionValidationService.validate(clientId, "commitFlushForce");
7869
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$e);
7851
7870
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7852
- swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
7853
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
7871
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$e);
7872
+ return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$e, clientId, swarmName)];
7854
7873
  case 1:
7855
7874
  _a.sent();
7856
7875
  return [2 /*return*/];
@@ -7858,6 +7877,7 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
7858
7877
  });
7859
7878
  }); };
7860
7879
 
7880
+ var METHOD_NAME$d = "function.commitSystemMessage";
7861
7881
  /**
7862
7882
  * Commits a user message to the active agent history in as swarm without answer and checking active agent
7863
7883
  *
@@ -7866,20 +7886,19 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
7866
7886
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7867
7887
  */
7868
7888
  var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7869
- var methodName, swarmName;
7889
+ var swarmName;
7870
7890
  return __generator(this, function (_a) {
7871
7891
  switch (_a.label) {
7872
7892
  case 0:
7873
- methodName = "function commitSystemMessage";
7874
7893
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7875
- swarm.loggerService.log("function commitSystemMessage", {
7894
+ swarm.loggerService.log(METHOD_NAME$d, {
7876
7895
  content: content,
7877
7896
  clientId: clientId,
7878
7897
  });
7879
- swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
7898
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$d);
7880
7899
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7881
- swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
7882
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
7900
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$d);
7901
+ return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$d, clientId, swarmName)];
7883
7902
  case 1:
7884
7903
  _a.sent();
7885
7904
  return [2 /*return*/];
@@ -7887,6 +7906,7 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
7887
7906
  });
7888
7907
  }); };
7889
7908
 
7909
+ var METHOD_NAME$c = "function.emitForce";
7890
7910
  /**
7891
7911
  * Emits a string constant as the model output without executing incoming message and checking active agent
7892
7912
  * Works only for `makeConnection`
@@ -7898,28 +7918,28 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
7898
7918
  * @returns {Promise<void>} A promise that resolves when the content is emitted.
7899
7919
  */
7900
7920
  var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7901
- var methodName, swarmName;
7921
+ var swarmName;
7902
7922
  return __generator(this, function (_a) {
7903
7923
  switch (_a.label) {
7904
7924
  case 0:
7905
- methodName = "function emitForce";
7906
7925
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7907
- swarm.loggerService.log("function emitForce", {
7926
+ swarm.loggerService.log(METHOD_NAME$c, {
7908
7927
  content: content,
7909
7928
  clientId: clientId,
7910
7929
  });
7911
7930
  if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7912
7931
  throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
7913
7932
  }
7914
- swarm.sessionValidationService.validate(clientId, "emitForce");
7933
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$c);
7915
7934
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7916
- swarm.swarmValidationService.validate(swarmName, "emitForce");
7917
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
7935
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$c);
7936
+ return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$c, clientId, swarmName)];
7918
7937
  case 1: return [2 /*return*/, _a.sent()];
7919
7938
  }
7920
7939
  });
7921
7940
  }); };
7922
7941
 
7942
+ var METHOD_NAME$b = "function.executeForce";
7923
7943
  /**
7924
7944
  * Send the message to the active agent in the swarm content like it income from client side
7925
7945
  * Should be used to review tool output and initiate conversation from the model side to client
@@ -7931,23 +7951,22 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
7931
7951
  * @returns {Promise<void>} - A promise that resolves when the execution is complete.
7932
7952
  */
7933
7953
  var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7934
- var methodName, executionId, swarmName;
7954
+ var executionId, swarmName;
7935
7955
  return __generator(this, function (_a) {
7936
- methodName = "function executeForce";
7937
7956
  executionId = functoolsKit.randomString();
7938
7957
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7939
- swarm.loggerService.log("function executeForce", {
7958
+ swarm.loggerService.log(METHOD_NAME$b, {
7940
7959
  content: content,
7941
7960
  clientId: clientId,
7942
7961
  executionId: executionId,
7943
7962
  });
7944
- swarm.sessionValidationService.validate(clientId, "executeForce");
7963
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$b);
7945
7964
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7946
- swarm.swarmValidationService.validate(swarmName, "executeForce");
7965
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$b);
7947
7966
  return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7948
7967
  return __generator(this, function (_a) {
7949
7968
  switch (_a.label) {
7950
- case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
7969
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$b, clientId, swarmName)];
7951
7970
  case 1: return [2 /*return*/, _a.sent()];
7952
7971
  }
7953
7972
  });
@@ -7958,6 +7977,7 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
7958
7977
  });
7959
7978
  }); };
7960
7979
 
7980
+ var METHOD_NAME$a = "function.listenEvent";
7961
7981
  var DISALLOWED_EVENT_SOURCE_LIST$2 = new Set([
7962
7982
  "agent-bus",
7963
7983
  "history-bus",
@@ -7983,7 +8003,7 @@ var validateClientId$d = function (clientId) {
7983
8003
  */
7984
8004
  var listenEvent = function (clientId, topicName, fn) {
7985
8005
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
7986
- swarm.loggerService.log("function listenEvent", {
8006
+ swarm.loggerService.log(METHOD_NAME$a, {
7987
8007
  clientId: clientId,
7988
8008
  });
7989
8009
  if (DISALLOWED_EVENT_SOURCE_LIST$2.has(topicName)) {
@@ -7996,6 +8016,7 @@ var listenEvent = function (clientId, topicName, fn) {
7996
8016
  });
7997
8017
  };
7998
8018
 
8019
+ var METHOD_NAME$9 = "function.listenEventOnce";
7999
8020
  var DISALLOWED_EVENT_SOURCE_LIST$1 = new Set([
8000
8021
  "agent-bus",
8001
8022
  "history-bus",
@@ -8021,7 +8042,7 @@ var validateClientId$c = function (clientId) {
8021
8042
  */
8022
8043
  var listenEventOnce = function (clientId, topicName, filterFn, fn) {
8023
8044
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8024
- swarm.loggerService.log("function listenEventOnce", {
8045
+ swarm.loggerService.log(METHOD_NAME$9, {
8025
8046
  clientId: clientId,
8026
8047
  });
8027
8048
  if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
@@ -8037,6 +8058,7 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
8037
8058
  });
8038
8059
  };
8039
8060
 
8061
+ var METHOD_NAME$8 = "function.getLastUserMessage";
8040
8062
  /**
8041
8063
  * Retrieves the last message sent by the user from the client's message history.
8042
8064
  *
@@ -8044,16 +8066,15 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
8044
8066
  * @returns {Promise<string | null>} - The content of the last user message, or null if no user message is found.
8045
8067
  */
8046
8068
  var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8047
- var methodName, history, last;
8069
+ var history, last;
8048
8070
  return __generator(this, function (_a) {
8049
8071
  switch (_a.label) {
8050
8072
  case 0:
8051
- methodName = "function getLastUserMessage";
8052
8073
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8053
- swarm.loggerService.log("function getLastUserMessage", {
8074
+ swarm.loggerService.log(METHOD_NAME$8, {
8054
8075
  clientId: clientId,
8055
8076
  });
8056
- return [4 /*yield*/, getRawHistory(clientId, methodName)];
8077
+ return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$8)];
8057
8078
  case 1:
8058
8079
  history = _a.sent();
8059
8080
  last = history.findLast(function (_a) {
@@ -8065,6 +8086,7 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
8065
8086
  });
8066
8087
  }); };
8067
8088
 
8089
+ var METHOD_NAME$7 = "function.getUserHistory";
8068
8090
  /**
8069
8091
  * Retrieves the user history for a given client ID.
8070
8092
  *
@@ -8072,16 +8094,15 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
8072
8094
  * @returns {Promise<Array>} A promise that resolves to an array of history objects filtered by user role.
8073
8095
  */
8074
8096
  var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8075
- var methodName, history;
8097
+ var history;
8076
8098
  return __generator(this, function (_a) {
8077
8099
  switch (_a.label) {
8078
8100
  case 0:
8079
- methodName = "function getUserHistory";
8080
8101
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8081
- swarm.loggerService.log("function getUserHistory", {
8102
+ swarm.loggerService.log(METHOD_NAME$7, {
8082
8103
  clientId: clientId,
8083
8104
  });
8084
- return [4 /*yield*/, getRawHistory(clientId, methodName)];
8105
+ return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$7)];
8085
8106
  case 1:
8086
8107
  history = _a.sent();
8087
8108
  return [2 /*return*/, history.filter(function (_a) {
@@ -8092,6 +8113,7 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
8092
8113
  });
8093
8114
  }); };
8094
8115
 
8116
+ var METHOD_NAME$6 = "function.getAssistantHistory";
8095
8117
  /**
8096
8118
  * Retrieves the assistant's history for a given client.
8097
8119
  *
@@ -8099,16 +8121,15 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
8099
8121
  * @returns {Promise<Array>} - A promise that resolves to an array of history objects where the role is "assistant".
8100
8122
  */
8101
8123
  var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8102
- var methodName, history;
8124
+ var history;
8103
8125
  return __generator(this, function (_a) {
8104
8126
  switch (_a.label) {
8105
8127
  case 0:
8106
- methodName = "function getAssistantHistory";
8107
8128
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8108
- swarm.loggerService.log("function getAssistantHistory", {
8129
+ swarm.loggerService.log(METHOD_NAME$6, {
8109
8130
  clientId: clientId,
8110
8131
  });
8111
- return [4 /*yield*/, getRawHistory(clientId, methodName)];
8132
+ return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$6)];
8112
8133
  case 1:
8113
8134
  history = _a.sent();
8114
8135
  return [2 /*return*/, history.filter(function (_a) {
@@ -8119,6 +8140,7 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
8119
8140
  });
8120
8141
  }); };
8121
8142
 
8143
+ var METHOD_NAME$5 = "function.getLastAssistantMessage";
8122
8144
  /**
8123
8145
  * Retrieves the last message sent by the assistant from the client's message history.
8124
8146
  *
@@ -8126,16 +8148,15 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
8126
8148
  * @returns {Promise<string | null>} - The content of the last assistant message, or null if no user message is found.
8127
8149
  */
8128
8150
  var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8129
- var methodName, history, last;
8151
+ var history, last;
8130
8152
  return __generator(this, function (_a) {
8131
8153
  switch (_a.label) {
8132
8154
  case 0:
8133
- methodName = "function getLastAssistantMessage";
8134
8155
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8135
- swarm.loggerService.log("function getLastAssistantMessage", {
8156
+ swarm.loggerService.log(METHOD_NAME$5, {
8136
8157
  clientId: clientId,
8137
8158
  });
8138
- return [4 /*yield*/, getRawHistory(clientId, methodName)];
8159
+ return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$5)];
8139
8160
  case 1:
8140
8161
  history = _a.sent();
8141
8162
  last = history.findLast(function (_a) {
@@ -8147,6 +8168,7 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
8147
8168
  });
8148
8169
  }); };
8149
8170
 
8171
+ var METHOD_NAME$4 = "function.getLastSystemMessage";
8150
8172
  /**
8151
8173
  * Retrieves the last message sent by the system from the client's message history.
8152
8174
  *
@@ -8154,16 +8176,15 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
8154
8176
  * @returns {Promise<string | null>} - The content of the last system message, or null if no user message is found.
8155
8177
  */
8156
8178
  var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8157
- var methodName, history, last;
8179
+ var history, last;
8158
8180
  return __generator(this, function (_a) {
8159
8181
  switch (_a.label) {
8160
8182
  case 0:
8161
- methodName = "function getLastSystemMessage";
8162
8183
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8163
- swarm.loggerService.log("function getLastSystemMessage", {
8184
+ swarm.loggerService.log(METHOD_NAME$4, {
8164
8185
  clientId: clientId,
8165
8186
  });
8166
- return [4 /*yield*/, getRawHistory(clientId, methodName)];
8187
+ return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$4)];
8167
8188
  case 1:
8168
8189
  history = _a.sent();
8169
8190
  last = history.findLast(function (_a) {
@@ -8175,6 +8196,7 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
8175
8196
  });
8176
8197
  }); };
8177
8198
 
8199
+ var METHOD_NAME$3 = "function.makeAutoDispose";
8178
8200
  var DEFAULT_TIMEOUT = 15 * 60;
8179
8201
  /**
8180
8202
  * Creates an auto-dispose mechanism for a client in a swarm.
@@ -8187,7 +8209,7 @@ var DEFAULT_TIMEOUT = 15 * 60;
8187
8209
  var makeAutoDispose = function (clientId, swarmName, _a) {
8188
8210
  var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
8189
8211
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8190
- swarm.loggerService.log("function makeAutoDispose", {
8212
+ swarm.loggerService.log(METHOD_NAME$3, {
8191
8213
  clientId: clientId,
8192
8214
  swarmName: swarmName,
8193
8215
  });
@@ -8234,6 +8256,7 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
8234
8256
  };
8235
8257
  };
8236
8258
 
8259
+ var METHOD_NAME$2 = "function.listenEvent";
8237
8260
  var DISALLOWED_EVENT_SOURCE_LIST = new Set([
8238
8261
  "agent-bus",
8239
8262
  "history-bus",
@@ -8252,7 +8275,7 @@ var DISALLOWED_EVENT_SOURCE_LIST = new Set([
8252
8275
  */
8253
8276
  var event = function (clientId, topicName, payload) {
8254
8277
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8255
- swarm.loggerService.log("function listenEvent", {
8278
+ swarm.loggerService.log(METHOD_NAME$2, {
8256
8279
  clientId: clientId,
8257
8280
  });
8258
8281
  if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
@@ -8265,6 +8288,7 @@ var event = function (clientId, topicName, payload) {
8265
8288
  });
8266
8289
  };
8267
8290
 
8291
+ var METHOD_NAME$1 = "function.cancelOutput";
8268
8292
  /**
8269
8293
  * Cancel the await of output by emit of empty string
8270
8294
  *
@@ -8273,21 +8297,20 @@ var event = function (clientId, topicName, payload) {
8273
8297
  * @returns {Promise<void>} - A promise that resolves when the output is canceled
8274
8298
  */
8275
8299
  var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
8276
- var methodName, swarmName, currentAgentName;
8300
+ var swarmName, currentAgentName;
8277
8301
  return __generator(this, function (_a) {
8278
8302
  switch (_a.label) {
8279
8303
  case 0:
8280
- methodName = "function cancelOutput";
8281
8304
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8282
- swarm.loggerService.log("function cancelOutput", {
8305
+ swarm.loggerService.log(METHOD_NAME$1, {
8283
8306
  clientId: clientId,
8284
8307
  agentName: agentName,
8285
8308
  });
8286
- swarm.agentValidationService.validate(agentName, "cancelOutput");
8287
- swarm.sessionValidationService.validate(clientId, "cancelOutput");
8309
+ swarm.agentValidationService.validate(agentName, METHOD_NAME$1);
8310
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME$1);
8288
8311
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
8289
- swarm.swarmValidationService.validate(swarmName, "cancelOutput");
8290
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
8312
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$1);
8313
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$1, clientId, swarmName)];
8291
8314
  case 1:
8292
8315
  currentAgentName = _a.sent();
8293
8316
  if (currentAgentName !== agentName) {
@@ -8299,7 +8322,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
8299
8322
  });
8300
8323
  return [2 /*return*/];
8301
8324
  }
8302
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
8325
+ return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME$1, clientId, swarmName)];
8303
8326
  case 2:
8304
8327
  _a.sent();
8305
8328
  return [2 /*return*/];
@@ -8307,6 +8330,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
8307
8330
  });
8308
8331
  }); };
8309
8332
 
8333
+ var METHOD_NAME = "function.cancelOutputForce";
8310
8334
  /**
8311
8335
  * Cancel the await of output by emit of empty string without checking active agent
8312
8336
  *
@@ -8315,19 +8339,18 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
8315
8339
  * @returns {Promise<void>} - A promise that resolves when the output is canceled
8316
8340
  */
8317
8341
  var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
8318
- var methodName, swarmName;
8342
+ var swarmName;
8319
8343
  return __generator(this, function (_a) {
8320
8344
  switch (_a.label) {
8321
8345
  case 0:
8322
- methodName = "function cancelOutputForce";
8323
8346
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8324
- swarm.loggerService.log("function cancelOutputForce", {
8347
+ swarm.loggerService.log(METHOD_NAME, {
8325
8348
  clientId: clientId,
8326
8349
  });
8327
- swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
8350
+ swarm.sessionValidationService.validate(clientId, METHOD_NAME);
8328
8351
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
8329
- swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
8330
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
8352
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
8353
+ return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME, clientId, swarmName)];
8331
8354
  case 1:
8332
8355
  _a.sent();
8333
8356
  return [2 /*return*/];
@@ -8599,6 +8622,12 @@ var listenSwarmEventOnce = function (clientId, filterFn, fn) {
8599
8622
  return swarm.busService.once(clientId, "swarm-bus", filterFn, fn);
8600
8623
  };
8601
8624
 
8625
+ var METHOD_NAME_TAKE = "StorageUtils.take";
8626
+ var METHOD_NAME_UPSERT = "StorageUtils.upsert";
8627
+ var METHOD_NAME_REMOVE = "StorageUtils.remove";
8628
+ var METHOD_NAME_GET$1 = "StorageUtils.get";
8629
+ var METHOD_NAME_LIST = "StorageUtils.list";
8630
+ var METHOD_NAME_CLEAR = "StorageUtils.clear";
8602
8631
  var StorageUtils = /** @class */ (function () {
8603
8632
  function StorageUtils() {
8604
8633
  var _this = this;
@@ -8613,24 +8642,22 @@ var StorageUtils = /** @class */ (function () {
8613
8642
  * @template T
8614
8643
  */
8615
8644
  this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8616
- var methodName;
8617
8645
  return __generator(this, function (_a) {
8618
8646
  switch (_a.label) {
8619
8647
  case 0:
8620
- methodName = "StorageUtils take";
8621
8648
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8622
- swarm.loggerService.log("StorageUtils take", {
8649
+ swarm.loggerService.log(METHOD_NAME_TAKE, {
8623
8650
  search: payload.search,
8624
8651
  total: payload.total,
8625
8652
  clientId: payload.clientId,
8626
8653
  storageName: payload.storageName,
8627
8654
  score: payload.score,
8628
8655
  });
8629
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8656
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
8630
8657
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8631
8658
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
8632
8659
  }
8633
- return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, methodName, payload.clientId, payload.storageName, payload.score)];
8660
+ return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.clientId, payload.storageName, payload.score)];
8634
8661
  case 1: return [2 /*return*/, (_a.sent())];
8635
8662
  }
8636
8663
  });
@@ -8645,22 +8672,20 @@ var StorageUtils = /** @class */ (function () {
8645
8672
  * @template T
8646
8673
  */
8647
8674
  this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8648
- var methodName;
8649
8675
  return __generator(this, function (_a) {
8650
8676
  switch (_a.label) {
8651
8677
  case 0:
8652
- methodName = "StorageUtils upsert";
8653
8678
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8654
- swarm.loggerService.log("StorageUtils upsert", {
8679
+ swarm.loggerService.log(METHOD_NAME_UPSERT, {
8655
8680
  item: payload.item,
8656
8681
  clientId: payload.clientId,
8657
8682
  storageName: payload.storageName,
8658
8683
  });
8659
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8684
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_UPSERT);
8660
8685
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8661
8686
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
8662
8687
  }
8663
- return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, methodName, payload.clientId, payload.storageName)];
8688
+ return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.clientId, payload.storageName)];
8664
8689
  case 1: return [2 /*return*/, _a.sent()];
8665
8690
  }
8666
8691
  });
@@ -8674,22 +8699,20 @@ var StorageUtils = /** @class */ (function () {
8674
8699
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
8675
8700
  */
8676
8701
  this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8677
- var methodName;
8678
8702
  return __generator(this, function (_a) {
8679
8703
  switch (_a.label) {
8680
8704
  case 0:
8681
- methodName = "StorageUtils remove";
8682
8705
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8683
- swarm.loggerService.log("StorageUtils remove", {
8706
+ swarm.loggerService.log(METHOD_NAME_REMOVE, {
8684
8707
  itemId: payload.itemId,
8685
8708
  clientId: payload.clientId,
8686
8709
  storageName: payload.storageName,
8687
8710
  });
8688
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8711
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_REMOVE);
8689
8712
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8690
8713
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
8691
8714
  }
8692
- return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, methodName, payload.clientId, payload.storageName)];
8715
+ return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.clientId, payload.storageName)];
8693
8716
  case 1: return [2 /*return*/, _a.sent()];
8694
8717
  }
8695
8718
  });
@@ -8704,22 +8727,20 @@ var StorageUtils = /** @class */ (function () {
8704
8727
  * @template T
8705
8728
  */
8706
8729
  this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8707
- var methodName;
8708
8730
  return __generator(this, function (_a) {
8709
8731
  switch (_a.label) {
8710
8732
  case 0:
8711
- methodName = "StorageUtils get";
8712
8733
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8713
- swarm.loggerService.log("StorageUtils get", {
8734
+ swarm.loggerService.log(METHOD_NAME_GET$1, {
8714
8735
  itemId: payload.itemId,
8715
8736
  clientId: payload.clientId,
8716
8737
  storageName: payload.storageName,
8717
8738
  });
8718
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8739
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_GET$1);
8719
8740
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8720
8741
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
8721
8742
  }
8722
- return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, methodName, payload.clientId, payload.storageName)];
8743
+ return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, METHOD_NAME_GET$1, payload.clientId, payload.storageName)];
8723
8744
  case 1: return [2 /*return*/, (_a.sent())];
8724
8745
  }
8725
8746
  });
@@ -8734,21 +8755,19 @@ var StorageUtils = /** @class */ (function () {
8734
8755
  * @template T
8735
8756
  */
8736
8757
  this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8737
- var methodName;
8738
8758
  return __generator(this, function (_a) {
8739
8759
  switch (_a.label) {
8740
8760
  case 0:
8741
- methodName = "StorageUtils list";
8742
8761
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8743
- swarm.loggerService.log("StorageUtils list", {
8762
+ swarm.loggerService.log(METHOD_NAME_LIST, {
8744
8763
  clientId: payload.clientId,
8745
8764
  storageName: payload.storageName,
8746
8765
  });
8747
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8766
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_LIST);
8748
8767
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8749
8768
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
8750
8769
  }
8751
- return [4 /*yield*/, swarm.storagePublicService.list(methodName, payload.clientId, payload.storageName, payload.filter)];
8770
+ return [4 /*yield*/, swarm.storagePublicService.list(METHOD_NAME_LIST, payload.clientId, payload.storageName, payload.filter)];
8752
8771
  case 1: return [2 /*return*/, (_a.sent())];
8753
8772
  }
8754
8773
  });
@@ -8761,21 +8780,19 @@ var StorageUtils = /** @class */ (function () {
8761
8780
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
8762
8781
  */
8763
8782
  this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8764
- var methodName;
8765
8783
  return __generator(this, function (_a) {
8766
8784
  switch (_a.label) {
8767
8785
  case 0:
8768
- methodName = "StorageUtils clear";
8769
8786
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8770
- swarm.loggerService.log("StorageUtils clear", {
8787
+ swarm.loggerService.log(METHOD_NAME_CLEAR, {
8771
8788
  clientId: payload.clientId,
8772
8789
  storageName: payload.storageName,
8773
8790
  });
8774
- swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8791
+ swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_CLEAR);
8775
8792
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8776
8793
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
8777
8794
  }
8778
- return [4 /*yield*/, swarm.storagePublicService.clear(methodName, payload.clientId, payload.storageName)];
8795
+ return [4 /*yield*/, swarm.storagePublicService.clear(METHOD_NAME_CLEAR, payload.clientId, payload.storageName)];
8779
8796
  case 1: return [2 /*return*/, _a.sent()];
8780
8797
  }
8781
8798
  });
@@ -8785,6 +8802,8 @@ var StorageUtils = /** @class */ (function () {
8785
8802
  }());
8786
8803
  var Storage = new StorageUtils();
8787
8804
 
8805
+ var METHOD_NAME_GET = "StateUtils.getState";
8806
+ var METHOD_NAME_SET = "StateUtils.setState";
8788
8807
  /**
8789
8808
  * Utility class for managing state in the agent swarm.
8790
8809
  * @implements {TState}
@@ -8803,20 +8822,18 @@ var StateUtils = /** @class */ (function () {
8803
8822
  * @throws Will throw an error if the state is not registered in the agent.
8804
8823
  */
8805
8824
  this.getState = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8806
- var methodName;
8807
8825
  return __generator(this, function (_a) {
8808
8826
  switch (_a.label) {
8809
8827
  case 0:
8810
- methodName = "StateUtils getState";
8811
8828
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8812
- swarm.loggerService.log("StateUtils getState", {
8829
+ swarm.loggerService.log(METHOD_NAME_GET, {
8813
8830
  clientId: payload.clientId,
8814
8831
  stateName: payload.stateName,
8815
8832
  });
8816
8833
  if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
8817
8834
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
8818
8835
  }
8819
- return [4 /*yield*/, swarm.statePublicService.getState(methodName, payload.clientId, payload.stateName)];
8836
+ return [4 /*yield*/, swarm.statePublicService.getState(METHOD_NAME_GET, payload.clientId, payload.stateName)];
8820
8837
  case 1: return [2 /*return*/, _a.sent()];
8821
8838
  }
8822
8839
  });
@@ -8833,14 +8850,12 @@ var StateUtils = /** @class */ (function () {
8833
8850
  * @throws Will throw an error if the state is not registered in the agent.
8834
8851
  */
8835
8852
  this.setState = function (dispatchFn, payload) { return __awaiter(_this, void 0, void 0, function () {
8836
- var methodName;
8837
8853
  var _this = this;
8838
8854
  return __generator(this, function (_a) {
8839
8855
  switch (_a.label) {
8840
8856
  case 0:
8841
- methodName = "StateUtils setState";
8842
8857
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8843
- swarm.loggerService.log("StateUtils setState", {
8858
+ swarm.loggerService.log(METHOD_NAME_SET, {
8844
8859
  clientId: payload.clientId,
8845
8860
  stateName: payload.stateName,
8846
8861
  });
@@ -8848,11 +8863,11 @@ var StateUtils = /** @class */ (function () {
8848
8863
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
8849
8864
  }
8850
8865
  if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
8851
- return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, methodName, payload.clientId, payload.stateName)];
8866
+ return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, METHOD_NAME_SET, payload.clientId, payload.stateName)];
8852
8867
  case 1: return [2 /*return*/, _a.sent()];
8853
8868
  case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
8854
8869
  return [2 /*return*/, dispatchFn];
8855
- }); }); }, methodName, payload.clientId, payload.stateName)];
8870
+ }); }); }, METHOD_NAME_SET, payload.clientId, payload.stateName)];
8856
8871
  case 3: return [2 /*return*/, _a.sent()];
8857
8872
  }
8858
8873
  });
@@ -8866,6 +8881,7 @@ var StateUtils = /** @class */ (function () {
8866
8881
  */
8867
8882
  var State = new StateUtils();
8868
8883
 
8884
+ var METHOD_NAME_USE_LOGGER = "HistoryInstance.useLogger";
8869
8885
  var LoggerUtils = /** @class */ (function () {
8870
8886
  function LoggerUtils() {
8871
8887
  /**
@@ -8874,7 +8890,7 @@ var LoggerUtils = /** @class */ (function () {
8874
8890
  */
8875
8891
  this.useLogger = function (logger) {
8876
8892
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8877
- swarm.loggerService.log("HistoryInstance useLogger");
8893
+ swarm.loggerService.log(METHOD_NAME_USE_LOGGER);
8878
8894
  swarm.loggerService.setLogger(logger);
8879
8895
  };
8880
8896
  }
@@ -8920,6 +8936,7 @@ var objectFlat = function (data) {
8920
8936
  };
8921
8937
 
8922
8938
  var LIST_SEPARATOR = Array.from({ length: 80 }, function () { return "-"; });
8939
+ var METHOD_NAME_SERIALIZE = "SchemaUtils.serialize";
8923
8940
  /**
8924
8941
  * Utility class for schema-related operations.
8925
8942
  */
@@ -8934,7 +8951,7 @@ var SchemaUtils = /** @class */ (function () {
8934
8951
  */
8935
8952
  this.serialize = function (data) {
8936
8953
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
8937
- swarm.loggerService.log("SchemaUtils serialize", {
8954
+ swarm.loggerService.log(METHOD_NAME_SERIALIZE, {
8938
8955
  data: data,
8939
8956
  });
8940
8957
  if (Array.isArray(data)) {