agent-swarm-kit 1.0.77 → 1.0.79
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 +1235 -827
- package/build/index.mjs +1236 -829
- package/package.json +3 -2
- package/types.d.ts +36 -4
package/build/index.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var diScoped = require('di-scoped');
|
|
4
4
|
var diKit = require('di-kit');
|
|
5
5
|
var functoolsKit = require('functools-kit');
|
|
6
|
-
var lodashEs = require('lodash-es');
|
|
7
6
|
var xml2js = require('xml2js');
|
|
7
|
+
var lodashEs = require('lodash-es');
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
10
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -250,6 +250,12 @@ var LoggerService = /** @class */ (function () {
|
|
|
250
250
|
*/
|
|
251
251
|
debug: function () {
|
|
252
252
|
},
|
|
253
|
+
/**
|
|
254
|
+
* Logs info messages.
|
|
255
|
+
* @param {...any} args - The info messages to log.
|
|
256
|
+
*/
|
|
257
|
+
info: function () {
|
|
258
|
+
},
|
|
253
259
|
};
|
|
254
260
|
/**
|
|
255
261
|
* Logs messages using the current logger.
|
|
@@ -290,6 +296,24 @@ var LoggerService = /** @class */ (function () {
|
|
|
290
296
|
: null;
|
|
291
297
|
(_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
|
|
292
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* Logs info messages using the current logger.
|
|
301
|
+
* @param {...any} args - The info messages to log.
|
|
302
|
+
*/
|
|
303
|
+
this.info = function () {
|
|
304
|
+
var _a;
|
|
305
|
+
var args = [];
|
|
306
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
307
|
+
args[_i] = arguments[_i];
|
|
308
|
+
}
|
|
309
|
+
var methodContext = MethodContextService.hasContext()
|
|
310
|
+
? _this.methodContextService.context
|
|
311
|
+
: null;
|
|
312
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
313
|
+
? _this.executionContextService.context
|
|
314
|
+
: null;
|
|
315
|
+
(_a = _this._logger).info.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
|
|
316
|
+
};
|
|
293
317
|
/**
|
|
294
318
|
* Sets a new logger.
|
|
295
319
|
* @param {ILogger} logger - The new logger to set.
|
|
@@ -301,36 +325,6 @@ var LoggerService = /** @class */ (function () {
|
|
|
301
325
|
return LoggerService;
|
|
302
326
|
}());
|
|
303
327
|
|
|
304
|
-
/**
|
|
305
|
-
* Service for managing agent schemas.
|
|
306
|
-
*/
|
|
307
|
-
var AgentSchemaService = /** @class */ (function () {
|
|
308
|
-
function AgentSchemaService() {
|
|
309
|
-
var _this = this;
|
|
310
|
-
this.loggerService = inject(TYPES.loggerService);
|
|
311
|
-
this.registry = new functoolsKit.ToolRegistry("agentSchemaService");
|
|
312
|
-
/**
|
|
313
|
-
* Registers a new agent schema.
|
|
314
|
-
* @param {AgentName} key - The name of the agent.
|
|
315
|
-
* @param {IAgentSchema} value - The schema of the agent.
|
|
316
|
-
*/
|
|
317
|
-
this.register = function (key, value) {
|
|
318
|
-
_this.loggerService.log("agentSchemaService register", { key: key });
|
|
319
|
-
_this.registry = _this.registry.register(key, value);
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* Retrieves an agent schema by name.
|
|
323
|
-
* @param {AgentName} key - The name of the agent.
|
|
324
|
-
* @returns {IAgentSchema} The schema of the agent.
|
|
325
|
-
*/
|
|
326
|
-
this.get = function (key) {
|
|
327
|
-
_this.loggerService.log("agentSchemaService get", { key: key });
|
|
328
|
-
return _this.registry.get(key);
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
return AgentSchemaService;
|
|
332
|
-
}());
|
|
333
|
-
|
|
334
328
|
/**
|
|
335
329
|
* Validates that the given output string is not empty.
|
|
336
330
|
*
|
|
@@ -458,10 +452,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
458
452
|
return __generator(this, function (_b) {
|
|
459
453
|
switch (_b.label) {
|
|
460
454
|
case 0:
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
455
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
456
|
+
swarm.loggerService.log("HistoryInstance waitForInit", {
|
|
457
|
+
clientId: this.clientId,
|
|
458
|
+
agentName: agentName,
|
|
459
|
+
});
|
|
465
460
|
if (!this.callbacks.getData) return [3 /*break*/, 2];
|
|
466
461
|
_a = this;
|
|
467
462
|
return [4 /*yield*/, this.callbacks.getData(this.clientId, agentName)];
|
|
@@ -480,10 +475,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
480
475
|
*/
|
|
481
476
|
this.push = function (value, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
482
477
|
return __generator(this, function (_a) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
478
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
479
|
+
swarm.loggerService.log("HistoryInstance push", {
|
|
480
|
+
clientId: this.clientId,
|
|
481
|
+
agentName: agentName,
|
|
482
|
+
});
|
|
487
483
|
this.callbacks.onPush &&
|
|
488
484
|
this.callbacks.onPush(value, this.clientId, agentName);
|
|
489
485
|
this._array.push(value);
|
|
@@ -499,10 +495,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
499
495
|
*/
|
|
500
496
|
this.dispose = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
501
497
|
return __generator(this, function (_a) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
498
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
499
|
+
swarm.loggerService.log("HistoryInstance dispose", {
|
|
500
|
+
clientId: this.clientId,
|
|
501
|
+
agentName: agentName,
|
|
502
|
+
});
|
|
506
503
|
if (agentName === null) {
|
|
507
504
|
this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
|
|
508
505
|
this._array = [];
|
|
@@ -510,9 +507,10 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
510
507
|
return [2 /*return*/, Promise.resolve()];
|
|
511
508
|
});
|
|
512
509
|
}); };
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
510
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
511
|
+
swarm.loggerService.log("HistoryInstance CTOR", {
|
|
512
|
+
clientId: this.clientId,
|
|
513
|
+
});
|
|
516
514
|
if (callbacks.onInit) {
|
|
517
515
|
callbacks.onInit(clientId);
|
|
518
516
|
}
|
|
@@ -527,10 +525,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
527
525
|
return __generator(this, function (_g) {
|
|
528
526
|
switch (_g.label) {
|
|
529
527
|
case 0:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
528
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
529
|
+
swarm.loggerService.log("HistoryInstance iterate condition", {
|
|
530
|
+
clientId: this.clientId,
|
|
531
|
+
agentName: agentName,
|
|
532
|
+
});
|
|
534
533
|
if (!this.callbacks.onRead) return [3 /*break*/, 12];
|
|
535
534
|
this.callbacks.onReadBegin &&
|
|
536
535
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
@@ -625,10 +624,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
625
624
|
return __generator(this, function (_g) {
|
|
626
625
|
switch (_g.label) {
|
|
627
626
|
case 0:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
627
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
628
|
+
swarm.loggerService.log("HistoryInstance iterate", {
|
|
629
|
+
clientId: this.clientId,
|
|
630
|
+
agentName: agentName,
|
|
631
|
+
});
|
|
632
632
|
if (!this.callbacks.onRead) return [3 /*break*/, 11];
|
|
633
633
|
this.callbacks.onReadBegin &&
|
|
634
634
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
@@ -724,7 +724,8 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
724
724
|
* @param Ctor - The constructor for the history instance.
|
|
725
725
|
*/
|
|
726
726
|
this.useHistoryAdapter = function (Ctor) {
|
|
727
|
-
|
|
727
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
728
|
+
swarm.loggerService.log("HistoryUtils useHistoryAdapter");
|
|
728
729
|
_this.HistoryFactory = Ctor;
|
|
729
730
|
};
|
|
730
731
|
/**
|
|
@@ -732,7 +733,8 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
732
733
|
* @param Callbacks - The callbacks dictionary.
|
|
733
734
|
*/
|
|
734
735
|
this.useHistoryCallbacks = function (Callbacks) {
|
|
735
|
-
|
|
736
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
737
|
+
swarm.loggerService.log("HistoryUtils useHistoryCallbacks");
|
|
736
738
|
Object.assign(_this.HistoryCallbacks, Callbacks);
|
|
737
739
|
};
|
|
738
740
|
/**
|
|
@@ -747,11 +749,12 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
747
749
|
return __generator(this, function (_a) {
|
|
748
750
|
switch (_a.label) {
|
|
749
751
|
case 0:
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
753
|
+
swarm.loggerService.log("HistoryUtils push", {
|
|
754
|
+
clientId: clientId,
|
|
755
|
+
agentName: agentName,
|
|
756
|
+
value: value,
|
|
757
|
+
});
|
|
755
758
|
isInitial = this.getHistory.has(clientId);
|
|
756
759
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
757
760
|
case 1:
|
|
@@ -775,10 +778,11 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
775
778
|
return __generator(this, function (_a) {
|
|
776
779
|
switch (_a.label) {
|
|
777
780
|
case 0:
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
781
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
782
|
+
swarm.loggerService.log("HistoryUtils dispose", {
|
|
783
|
+
clientId: clientId,
|
|
784
|
+
agentName: agentName,
|
|
785
|
+
});
|
|
782
786
|
isInitial = this.getHistory.has(clientId);
|
|
783
787
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
784
788
|
case 1:
|
|
@@ -810,10 +814,11 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
810
814
|
return __generator(this, function (_g) {
|
|
811
815
|
switch (_g.label) {
|
|
812
816
|
case 0:
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
818
|
+
swarm.loggerService.log("HistoryUtils iterate", {
|
|
819
|
+
clientId: clientId,
|
|
820
|
+
agentName: agentName,
|
|
821
|
+
});
|
|
817
822
|
isInitial = this.getHistory.has(clientId);
|
|
818
823
|
return [4 /*yield*/, __await(this.getHistory(clientId))];
|
|
819
824
|
case 1:
|
|
@@ -873,6 +878,25 @@ var HistoryAdapter = new HistoryUtils();
|
|
|
873
878
|
*/
|
|
874
879
|
var History = HistoryAdapter;
|
|
875
880
|
|
|
881
|
+
/**
|
|
882
|
+
* Convert a name to title case.
|
|
883
|
+
*
|
|
884
|
+
* @param name - The name to convert to title case.
|
|
885
|
+
* @return The name converted to title case.
|
|
886
|
+
*/
|
|
887
|
+
var nameToTitle = function (name) {
|
|
888
|
+
var _a;
|
|
889
|
+
if (!name) {
|
|
890
|
+
return undefined;
|
|
891
|
+
}
|
|
892
|
+
if (name.includes(".")) {
|
|
893
|
+
var tokens = name.split(".");
|
|
894
|
+
_a = __read(tokens.reverse(), 1), name = _a[0];
|
|
895
|
+
}
|
|
896
|
+
var _b = __read(name.split('_')), word = _b[0], rest = _b.slice(1);
|
|
897
|
+
return __spreadArray(["".concat(word.charAt(0).toUpperCase()).concat(word.slice(1))], __read(rest), false).join(' ');
|
|
898
|
+
};
|
|
899
|
+
|
|
876
900
|
/**
|
|
877
901
|
* @description `ask for agent function` in `llama3.1:8b` to troubleshoot (need CC_OLLAMA_EMIT_TOOL_PROTOCOL to be turned off)
|
|
878
902
|
*/
|
|
@@ -930,6 +954,10 @@ var CC_AGENT_OUTPUT_MAP = function (message) { return message; };
|
|
|
930
954
|
var CC_AGENT_SYSTEM_PROMPT = undefined;
|
|
931
955
|
var CC_STORAGE_SEARCH_SIMILARITY = 0.65;
|
|
932
956
|
var CC_STORAGE_SEARCH_POOL = 5;
|
|
957
|
+
var CC_LOGGER_ENABLE_INFO = false;
|
|
958
|
+
var CC_LOGGER_ENABLE_DEBUG = true;
|
|
959
|
+
var CC_LOGGER_ENABLE_LOG = true;
|
|
960
|
+
var CC_NAME_TO_TITLE = nameToTitle;
|
|
933
961
|
var GLOBAL_CONFIG = {
|
|
934
962
|
CC_TOOL_CALL_EXCEPTION_PROMPT: CC_TOOL_CALL_EXCEPTION_PROMPT,
|
|
935
963
|
CC_EMPTY_OUTPUT_PLACEHOLDERS: CC_EMPTY_OUTPUT_PLACEHOLDERS,
|
|
@@ -946,11 +974,47 @@ var GLOBAL_CONFIG = {
|
|
|
946
974
|
CC_AGENT_DISALLOWED_SYMBOLS: CC_AGENT_DISALLOWED_SYMBOLS,
|
|
947
975
|
CC_STORAGE_SEARCH_SIMILARITY: CC_STORAGE_SEARCH_SIMILARITY,
|
|
948
976
|
CC_STORAGE_SEARCH_POOL: CC_STORAGE_SEARCH_POOL,
|
|
977
|
+
CC_LOGGER_ENABLE_INFO: CC_LOGGER_ENABLE_INFO,
|
|
978
|
+
CC_LOGGER_ENABLE_DEBUG: CC_LOGGER_ENABLE_DEBUG,
|
|
979
|
+
CC_LOGGER_ENABLE_LOG: CC_LOGGER_ENABLE_LOG,
|
|
980
|
+
CC_NAME_TO_TITLE: CC_NAME_TO_TITLE,
|
|
949
981
|
};
|
|
950
982
|
var setConfig = function (config) {
|
|
951
983
|
Object.assign(GLOBAL_CONFIG, config);
|
|
952
984
|
};
|
|
953
985
|
|
|
986
|
+
/**
|
|
987
|
+
* Service for managing agent schemas.
|
|
988
|
+
*/
|
|
989
|
+
var AgentSchemaService = /** @class */ (function () {
|
|
990
|
+
function AgentSchemaService() {
|
|
991
|
+
var _this = this;
|
|
992
|
+
this.loggerService = inject(TYPES.loggerService);
|
|
993
|
+
this.registry = new functoolsKit.ToolRegistry("agentSchemaService");
|
|
994
|
+
/**
|
|
995
|
+
* Registers a new agent schema.
|
|
996
|
+
* @param {AgentName} key - The name of the agent.
|
|
997
|
+
* @param {IAgentSchema} value - The schema of the agent.
|
|
998
|
+
*/
|
|
999
|
+
this.register = function (key, value) {
|
|
1000
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1001
|
+
_this.loggerService.info("agentSchemaService register", { key: key });
|
|
1002
|
+
_this.registry = _this.registry.register(key, value);
|
|
1003
|
+
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Retrieves an agent schema by name.
|
|
1006
|
+
* @param {AgentName} key - The name of the agent.
|
|
1007
|
+
* @returns {IAgentSchema} The schema of the agent.
|
|
1008
|
+
*/
|
|
1009
|
+
this.get = function (key) {
|
|
1010
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1011
|
+
_this.loggerService.info("agentSchemaService get", { key: key });
|
|
1012
|
+
return _this.registry.get(key);
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
return AgentSchemaService;
|
|
1016
|
+
}());
|
|
1017
|
+
|
|
954
1018
|
var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
|
|
955
1019
|
var getPlaceholder = function () {
|
|
956
1020
|
return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
|
|
@@ -984,7 +1048,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
984
1048
|
case 0: return [4 /*yield*/, this.params.transform(rawResult, this.params.clientId, this.params.agentName)];
|
|
985
1049
|
case 1:
|
|
986
1050
|
result = _a.sent();
|
|
987
|
-
|
|
1051
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1052
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _emitOuput"), { mode: mode, result: result, rawResult: rawResult });
|
|
988
1053
|
validation = null;
|
|
989
1054
|
return [4 /*yield*/, this.params.validate(result)];
|
|
990
1055
|
case 2:
|
|
@@ -1061,7 +1126,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1061
1126
|
return __generator(this, function (_a) {
|
|
1062
1127
|
switch (_a.label) {
|
|
1063
1128
|
case 0:
|
|
1064
|
-
|
|
1129
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1130
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel"));
|
|
1065
1131
|
this.params.onResurrect &&
|
|
1066
1132
|
this.params.onResurrect(this.params.clientId, this.params.agentName, mode, reason);
|
|
1067
1133
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1093,7 +1159,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1093
1159
|
return [4 /*yield*/, this.params.validate(result)];
|
|
1094
1160
|
case 6:
|
|
1095
1161
|
if (!(validation = _a.sent())) return [3 /*break*/, 8];
|
|
1096
|
-
|
|
1162
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1163
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel validation error: ").concat(validation));
|
|
1097
1164
|
content = getPlaceholder();
|
|
1098
1165
|
return [4 /*yield*/, this.params.history.push({
|
|
1099
1166
|
agentName: this.params.agentName,
|
|
@@ -1119,7 +1186,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1119
1186
|
return __generator(this, function (_a) {
|
|
1120
1187
|
switch (_a.label) {
|
|
1121
1188
|
case 0:
|
|
1122
|
-
|
|
1189
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1190
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " waitForOutput"));
|
|
1123
1191
|
return [4 /*yield*/, this._outputSubject.toPromise()];
|
|
1124
1192
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1125
1193
|
}
|
|
@@ -1135,7 +1203,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1135
1203
|
return __generator(this, function (_d) {
|
|
1136
1204
|
switch (_d.label) {
|
|
1137
1205
|
case 0:
|
|
1138
|
-
|
|
1206
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1207
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " getCompletion"));
|
|
1139
1208
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
1140
1209
|
case 1:
|
|
1141
1210
|
messages = _d.sent();
|
|
@@ -1166,7 +1235,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1166
1235
|
return __generator(this, function (_a) {
|
|
1167
1236
|
switch (_a.label) {
|
|
1168
1237
|
case 0:
|
|
1169
|
-
|
|
1238
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1239
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitUserMessage"), { message: message });
|
|
1170
1240
|
this.params.onUserMessage &&
|
|
1171
1241
|
this.params.onUserMessage(this.params.clientId, this.params.agentName, message);
|
|
1172
1242
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1203,7 +1273,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1203
1273
|
return __generator(this, function (_a) {
|
|
1204
1274
|
switch (_a.label) {
|
|
1205
1275
|
case 0:
|
|
1206
|
-
|
|
1276
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1277
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitFlush"));
|
|
1207
1278
|
this.params.onFlush &&
|
|
1208
1279
|
this.params.onFlush(this.params.clientId, this.params.agentName);
|
|
1209
1280
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1238,7 +1309,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1238
1309
|
return __generator(this, function (_a) {
|
|
1239
1310
|
switch (_a.label) {
|
|
1240
1311
|
case 0:
|
|
1241
|
-
|
|
1312
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1313
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitAgentChange"));
|
|
1242
1314
|
return [4 /*yield*/, this._agentChangeSubject.next(AGENT_CHANGE_SYMBOL)];
|
|
1243
1315
|
case 1:
|
|
1244
1316
|
_a.sent();
|
|
@@ -1267,7 +1339,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1267
1339
|
return __generator(this, function (_a) {
|
|
1268
1340
|
switch (_a.label) {
|
|
1269
1341
|
case 0:
|
|
1270
|
-
|
|
1342
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1343
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitSystemMessage"), { message: message });
|
|
1271
1344
|
this.params.onSystemMessage &&
|
|
1272
1345
|
this.params.onSystemMessage(this.params.clientId, this.params.agentName, message);
|
|
1273
1346
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1305,7 +1378,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1305
1378
|
return __generator(this, function (_a) {
|
|
1306
1379
|
switch (_a.label) {
|
|
1307
1380
|
case 0:
|
|
1308
|
-
|
|
1381
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1382
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitToolOutput"), { content: content, toolId: toolId });
|
|
1309
1383
|
this.params.onToolOutput &&
|
|
1310
1384
|
this.params.onToolOutput(toolId, this.params.clientId, this.params.agentName, content);
|
|
1311
1385
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1351,7 +1425,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1351
1425
|
return __generator(this, function (_h) {
|
|
1352
1426
|
switch (_h.label) {
|
|
1353
1427
|
case 0:
|
|
1354
|
-
|
|
1428
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1429
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute begin"), { incoming: incoming, mode: mode });
|
|
1355
1430
|
this.params.onExecute &&
|
|
1356
1431
|
this.params.onExecute(this.params.clientId, this.params.agentName, incoming, mode);
|
|
1357
1432
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1369,7 +1444,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1369
1444
|
case 3:
|
|
1370
1445
|
message = _h.sent();
|
|
1371
1446
|
if (!message.tool_calls) return [3 /*break*/, 9];
|
|
1372
|
-
|
|
1447
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1448
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " tool call begin"));
|
|
1373
1449
|
toolCalls = message.tool_calls.map(function (call) {
|
|
1374
1450
|
var _a, _b;
|
|
1375
1451
|
return ({
|
|
@@ -1389,11 +1465,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1389
1465
|
tool = toolCalls[idx];
|
|
1390
1466
|
targetFn = (_a = this_1.params.tools) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.function.name === tool.function.name; });
|
|
1391
1467
|
if (!!targetFn) return [3 /*break*/, 3];
|
|
1392
|
-
|
|
1468
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1469
|
+
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);
|
|
1393
1470
|
return [4 /*yield*/, this_1._resurrectModel(mode, "No target function for ".concat(tool.function.name))];
|
|
1394
1471
|
case 1:
|
|
1395
1472
|
result_2 = _j.sent();
|
|
1396
|
-
|
|
1473
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1474
|
+
this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_2));
|
|
1397
1475
|
return [4 /*yield*/, this_1._emitOuput(mode, result_2)];
|
|
1398
1476
|
case 2:
|
|
1399
1477
|
_j.sent();
|
|
@@ -1409,11 +1487,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1409
1487
|
}))];
|
|
1410
1488
|
case 4:
|
|
1411
1489
|
if (!_j.sent()) return [3 /*break*/, 7];
|
|
1412
|
-
|
|
1490
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1491
|
+
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"));
|
|
1413
1492
|
return [4 /*yield*/, this_1._resurrectModel(mode, "Function validation failed: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
|
|
1414
1493
|
case 5:
|
|
1415
1494
|
result_3 = _j.sent();
|
|
1416
|
-
|
|
1495
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1496
|
+
this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_3));
|
|
1417
1497
|
return [4 /*yield*/, this_1._emitOuput(mode, result_3)];
|
|
1418
1498
|
case 6:
|
|
1419
1499
|
_j.sent();
|
|
@@ -1450,7 +1530,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1450
1530
|
((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onCallError(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments, error));
|
|
1451
1531
|
_this._toolErrorSubject.next();
|
|
1452
1532
|
});
|
|
1453
|
-
|
|
1533
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1534
|
+
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 executing"));
|
|
1454
1535
|
return [4 /*yield*/, Promise.race([
|
|
1455
1536
|
this_1._agentChangeSubject.toPromise(),
|
|
1456
1537
|
this_1._toolCommitSubject.toPromise(),
|
|
@@ -1459,9 +1540,11 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1459
1540
|
])];
|
|
1460
1541
|
case 8:
|
|
1461
1542
|
status = _j.sent();
|
|
1462
|
-
|
|
1543
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1544
|
+
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"));
|
|
1463
1545
|
if (status === AGENT_CHANGE_SYMBOL) {
|
|
1464
|
-
|
|
1546
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1547
|
+
this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " the next tool execution stopped due to the agent changed"));
|
|
1465
1548
|
((_f = this_1.params.callbacks) === null || _f === void 0 ? void 0 : _f.onAfterToolCalls) &&
|
|
1466
1549
|
this_1.params.callbacks.onAfterToolCalls(this_1.params.clientId, this_1.params.agentName, toolCalls);
|
|
1467
1550
|
return [2 /*return*/, { value: void 0 }];
|
|
@@ -1490,7 +1573,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1490
1573
|
return [2 /*return*/];
|
|
1491
1574
|
case 9:
|
|
1492
1575
|
if (!message.tool_calls) {
|
|
1493
|
-
|
|
1576
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1577
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute no tool calls detected"));
|
|
1494
1578
|
}
|
|
1495
1579
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
1496
1580
|
case 10:
|
|
@@ -1502,7 +1586,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1502
1586
|
return [4 /*yield*/, this.params.validate(result)];
|
|
1503
1587
|
case 12:
|
|
1504
1588
|
if (!(validation = _h.sent())) return [3 /*break*/, 15];
|
|
1505
|
-
|
|
1589
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1590
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
|
|
1506
1591
|
return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
|
|
1507
1592
|
case 13:
|
|
1508
1593
|
result1 = _h.sent();
|
|
@@ -1511,7 +1596,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1511
1596
|
_h.sent();
|
|
1512
1597
|
return [2 /*return*/];
|
|
1513
1598
|
case 15:
|
|
1514
|
-
|
|
1599
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1600
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
|
|
1515
1601
|
return [4 /*yield*/, this._emitOuput(mode, result)];
|
|
1516
1602
|
case 16:
|
|
1517
1603
|
_h.sent();
|
|
@@ -1525,15 +1611,17 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1525
1611
|
*/
|
|
1526
1612
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1527
1613
|
return __generator(this, function (_a) {
|
|
1528
|
-
|
|
1614
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1615
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " dispose"));
|
|
1529
1616
|
this.params.onDispose &&
|
|
1530
1617
|
this.params.onDispose(this.params.clientId, this.params.agentName);
|
|
1531
1618
|
return [2 /*return*/];
|
|
1532
1619
|
});
|
|
1533
1620
|
}); };
|
|
1534
|
-
|
|
1535
|
-
params
|
|
1536
|
-
|
|
1621
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1622
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
|
|
1623
|
+
params: params,
|
|
1624
|
+
});
|
|
1537
1625
|
this.params.onInit && this.params.onInit(params.clientId, params.agentName);
|
|
1538
1626
|
}
|
|
1539
1627
|
return ClientAgent;
|
|
@@ -1589,10 +1677,11 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1589
1677
|
return __generator(this, function (_a) {
|
|
1590
1678
|
switch (_a.label) {
|
|
1591
1679
|
case 0:
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1680
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1681
|
+
this.loggerService.info("agentConnectionService execute", {
|
|
1682
|
+
input: input,
|
|
1683
|
+
mode: mode,
|
|
1684
|
+
});
|
|
1596
1685
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).execute(input, mode)];
|
|
1597
1686
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1598
1687
|
}
|
|
@@ -1606,7 +1695,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1606
1695
|
return __generator(this, function (_a) {
|
|
1607
1696
|
switch (_a.label) {
|
|
1608
1697
|
case 0:
|
|
1609
|
-
|
|
1698
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1699
|
+
this.loggerService.info("agentConnectionService waitForOutput");
|
|
1610
1700
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).waitForOutput()];
|
|
1611
1701
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1612
1702
|
}
|
|
@@ -1622,10 +1712,11 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1622
1712
|
return __generator(this, function (_a) {
|
|
1623
1713
|
switch (_a.label) {
|
|
1624
1714
|
case 0:
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1715
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1716
|
+
this.loggerService.info("agentConnectionService commitToolOutput", {
|
|
1717
|
+
content: content,
|
|
1718
|
+
toolId: toolId,
|
|
1719
|
+
});
|
|
1629
1720
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitToolOutput(toolId, content)];
|
|
1630
1721
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1631
1722
|
}
|
|
@@ -1640,9 +1731,10 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1640
1731
|
return __generator(this, function (_a) {
|
|
1641
1732
|
switch (_a.label) {
|
|
1642
1733
|
case 0:
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1734
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1735
|
+
this.loggerService.info("agentConnectionService commitSystemMessage", {
|
|
1736
|
+
message: message,
|
|
1737
|
+
});
|
|
1646
1738
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitSystemMessage(message)];
|
|
1647
1739
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1648
1740
|
}
|
|
@@ -1657,9 +1749,10 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1657
1749
|
return __generator(this, function (_a) {
|
|
1658
1750
|
switch (_a.label) {
|
|
1659
1751
|
case 0:
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1752
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1753
|
+
this.loggerService.info("agentConnectionService commitUserMessage", {
|
|
1754
|
+
message: message,
|
|
1755
|
+
});
|
|
1663
1756
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitUserMessage(message)];
|
|
1664
1757
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1665
1758
|
}
|
|
@@ -1673,7 +1766,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1673
1766
|
return __generator(this, function (_a) {
|
|
1674
1767
|
switch (_a.label) {
|
|
1675
1768
|
case 0:
|
|
1676
|
-
|
|
1769
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1770
|
+
this.loggerService.info("agentConnectionService commitAgentChange");
|
|
1677
1771
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitAgentChange()];
|
|
1678
1772
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1679
1773
|
}
|
|
@@ -1687,7 +1781,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1687
1781
|
return __generator(this, function (_a) {
|
|
1688
1782
|
switch (_a.label) {
|
|
1689
1783
|
case 0:
|
|
1690
|
-
|
|
1784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1785
|
+
this.loggerService.info("agentConnectionService commitFlush");
|
|
1691
1786
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitFlush()];
|
|
1692
1787
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1693
1788
|
}
|
|
@@ -1702,7 +1797,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1702
1797
|
return __generator(this, function (_a) {
|
|
1703
1798
|
switch (_a.label) {
|
|
1704
1799
|
case 0:
|
|
1705
|
-
|
|
1800
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1801
|
+
this.loggerService.info("agentConnectionService dispose");
|
|
1706
1802
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
1707
1803
|
if (!this.getAgent.has(key)) {
|
|
1708
1804
|
return [2 /*return*/];
|
|
@@ -1741,7 +1837,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1741
1837
|
return __generator(this, function (_a) {
|
|
1742
1838
|
switch (_a.label) {
|
|
1743
1839
|
case 0:
|
|
1744
|
-
|
|
1840
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1841
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " push"), { message: message });
|
|
1745
1842
|
return [4 /*yield*/, this.params.items.push(message, this.params.clientId, this.params.agentName)];
|
|
1746
1843
|
case 1:
|
|
1747
1844
|
_a.sent();
|
|
@@ -1749,7 +1846,7 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1749
1846
|
type: "push",
|
|
1750
1847
|
source: "history-bus",
|
|
1751
1848
|
input: {
|
|
1752
|
-
message: message
|
|
1849
|
+
message: message,
|
|
1753
1850
|
},
|
|
1754
1851
|
output: {},
|
|
1755
1852
|
context: {
|
|
@@ -1773,7 +1870,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1773
1870
|
return __generator(this, function (_g) {
|
|
1774
1871
|
switch (_g.label) {
|
|
1775
1872
|
case 0:
|
|
1776
|
-
|
|
1873
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1874
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " toArrayForRaw"));
|
|
1777
1875
|
result = [];
|
|
1778
1876
|
_g.label = 1;
|
|
1779
1877
|
case 1:
|
|
@@ -1826,7 +1924,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1826
1924
|
return __generator(this, function (_h) {
|
|
1827
1925
|
switch (_h.label) {
|
|
1828
1926
|
case 0:
|
|
1829
|
-
|
|
1927
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1928
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " toArrayForAgent"));
|
|
1830
1929
|
commonMessagesRaw = [];
|
|
1831
1930
|
systemMessagesRaw = [];
|
|
1832
1931
|
_h.label = 1;
|
|
@@ -1967,7 +2066,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1967
2066
|
return __generator(this, function (_a) {
|
|
1968
2067
|
switch (_a.label) {
|
|
1969
2068
|
case 0:
|
|
1970
|
-
|
|
2069
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2070
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " dispose"));
|
|
1971
2071
|
return [4 /*yield*/, this.params.items.dispose(this.params.clientId, this.params.agentName)];
|
|
1972
2072
|
case 1:
|
|
1973
2073
|
_a.sent();
|
|
@@ -1975,9 +2075,10 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1975
2075
|
}
|
|
1976
2076
|
});
|
|
1977
2077
|
}); };
|
|
1978
|
-
|
|
1979
|
-
params
|
|
1980
|
-
|
|
2078
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2079
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
|
|
2080
|
+
params: params,
|
|
2081
|
+
});
|
|
1981
2082
|
this._filterCondition = GLOBAL_CONFIG.CC_AGENT_HISTORY_FILTER(this.params.agentName);
|
|
1982
2083
|
}
|
|
1983
2084
|
return ClientHistory;
|
|
@@ -2022,9 +2123,10 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2022
2123
|
return __generator(this, function (_a) {
|
|
2023
2124
|
switch (_a.label) {
|
|
2024
2125
|
case 0:
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2126
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2127
|
+
this.loggerService.info("historyConnectionService push", {
|
|
2128
|
+
message: message,
|
|
2129
|
+
});
|
|
2028
2130
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).push(message)];
|
|
2029
2131
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2030
2132
|
}
|
|
@@ -2039,9 +2141,10 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2039
2141
|
return __generator(this, function (_a) {
|
|
2040
2142
|
switch (_a.label) {
|
|
2041
2143
|
case 0:
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2144
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2145
|
+
this.loggerService.info("historyConnectionService toArrayForAgent", {
|
|
2146
|
+
prompt: prompt,
|
|
2147
|
+
});
|
|
2045
2148
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForAgent(prompt)];
|
|
2046
2149
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2047
2150
|
}
|
|
@@ -2055,7 +2158,8 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2055
2158
|
return __generator(this, function (_a) {
|
|
2056
2159
|
switch (_a.label) {
|
|
2057
2160
|
case 0:
|
|
2058
|
-
|
|
2161
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2162
|
+
this.loggerService.info("historyConnectionService toArrayForRaw");
|
|
2059
2163
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForRaw()];
|
|
2060
2164
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2061
2165
|
}
|
|
@@ -2070,7 +2174,8 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2070
2174
|
return __generator(this, function (_a) {
|
|
2071
2175
|
switch (_a.label) {
|
|
2072
2176
|
case 0:
|
|
2073
|
-
|
|
2177
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2178
|
+
this.loggerService.info("historyConnectionService dispose");
|
|
2074
2179
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
2075
2180
|
if (!this.getHistory.has(key)) {
|
|
2076
2181
|
return [2 /*return*/];
|
|
@@ -2102,7 +2207,8 @@ var ToolSchemaService = /** @class */ (function () {
|
|
|
2102
2207
|
* @param {IAgentTool} value - The tool to register.
|
|
2103
2208
|
*/
|
|
2104
2209
|
this.register = function (key, value) {
|
|
2105
|
-
|
|
2210
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2211
|
+
_this.loggerService.info("toolSchemaService register");
|
|
2106
2212
|
_this.registry = _this.registry.register(key, value);
|
|
2107
2213
|
};
|
|
2108
2214
|
/**
|
|
@@ -2111,7 +2217,8 @@ var ToolSchemaService = /** @class */ (function () {
|
|
|
2111
2217
|
* @returns {IAgentTool} The tool associated with the given key.
|
|
2112
2218
|
*/
|
|
2113
2219
|
this.get = function (key) {
|
|
2114
|
-
|
|
2220
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2221
|
+
_this.loggerService.info("toolSchemaService get", { key: key });
|
|
2115
2222
|
return _this.registry.get(key);
|
|
2116
2223
|
};
|
|
2117
2224
|
}
|
|
@@ -2143,7 +2250,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2143
2250
|
return __generator(this, function (_d) {
|
|
2144
2251
|
switch (_d.label) {
|
|
2145
2252
|
case 0:
|
|
2146
|
-
|
|
2253
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2254
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " cancelOutput"));
|
|
2147
2255
|
_b = (_a = this._cancelOutputSubject).next;
|
|
2148
2256
|
_c = {};
|
|
2149
2257
|
return [4 /*yield*/, this.getAgentName()];
|
|
@@ -2178,7 +2286,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2178
2286
|
return __generator(this, function (_c) {
|
|
2179
2287
|
switch (_c.label) {
|
|
2180
2288
|
case 0:
|
|
2181
|
-
|
|
2289
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2290
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " waitForOutput"));
|
|
2182
2291
|
_a = __read(functoolsKit.createAwaiter(), 2), awaiter = _a[0], resolve = _a[1].resolve;
|
|
2183
2292
|
getOutput = functoolsKit.cancelable(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2184
2293
|
var _this = this;
|
|
@@ -2224,6 +2333,7 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2224
2333
|
case 2:
|
|
2225
2334
|
expectAgent = _c.sent();
|
|
2226
2335
|
agentName !== expectAgent &&
|
|
2336
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2227
2337
|
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " waitForAgent agent miss"), { agentName: agentName, expectAgent: expectAgent });
|
|
2228
2338
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2229
2339
|
type: "wait-for-output",
|
|
@@ -2252,7 +2362,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2252
2362
|
return __generator(this, function (_b) {
|
|
2253
2363
|
switch (_b.label) {
|
|
2254
2364
|
case 0:
|
|
2255
|
-
|
|
2365
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2366
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgentName"));
|
|
2256
2367
|
if (!(this._activeAgent === AGENT_NEED_FETCH)) return [3 /*break*/, 2];
|
|
2257
2368
|
_a = this;
|
|
2258
2369
|
return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_DEFAULT_AGENT(this.params.clientId, this.params.swarmName, this.params.defaultAgent)];
|
|
@@ -2286,7 +2397,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2286
2397
|
return __generator(this, function (_a) {
|
|
2287
2398
|
switch (_a.label) {
|
|
2288
2399
|
case 0:
|
|
2289
|
-
|
|
2400
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2401
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgent"));
|
|
2290
2402
|
return [4 /*yield*/, this.getAgentName()];
|
|
2291
2403
|
case 1:
|
|
2292
2404
|
agent = _a.sent();
|
|
@@ -2319,7 +2431,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2319
2431
|
return __generator(this, function (_a) {
|
|
2320
2432
|
switch (_a.label) {
|
|
2321
2433
|
case 0:
|
|
2322
|
-
|
|
2434
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2435
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " setAgentRef agentName=").concat(agentName));
|
|
2323
2436
|
if (!this.params.agentMap[agentName]) {
|
|
2324
2437
|
throw new Error("agent-swarm agent ".concat(agentName, " not in the swarm"));
|
|
2325
2438
|
}
|
|
@@ -2354,7 +2467,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2354
2467
|
return __generator(this, function (_a) {
|
|
2355
2468
|
switch (_a.label) {
|
|
2356
2469
|
case 0:
|
|
2357
|
-
|
|
2470
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2471
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " setAgentName agentName=").concat(agentName));
|
|
2358
2472
|
this._activeAgent = agentName;
|
|
2359
2473
|
return [4 /*yield*/, this.params.onAgentChanged(this.params.clientId, agentName, this.params.swarmName)];
|
|
2360
2474
|
case 1:
|
|
@@ -2377,9 +2491,10 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2377
2491
|
}
|
|
2378
2492
|
});
|
|
2379
2493
|
}); };
|
|
2380
|
-
|
|
2381
|
-
params
|
|
2382
|
-
|
|
2494
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2495
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " CTOR"), {
|
|
2496
|
+
params: params,
|
|
2497
|
+
});
|
|
2383
2498
|
}
|
|
2384
2499
|
Object.defineProperty(ClientSwarm.prototype, "_agentList", {
|
|
2385
2500
|
get: function () {
|
|
@@ -2463,7 +2578,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2463
2578
|
return __generator(this, function (_a) {
|
|
2464
2579
|
switch (_a.label) {
|
|
2465
2580
|
case 0:
|
|
2466
|
-
|
|
2581
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2582
|
+
this.loggerService.info("swarmConnectionService cancelOutput");
|
|
2467
2583
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).cancelOutput()];
|
|
2468
2584
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2469
2585
|
}
|
|
@@ -2477,7 +2593,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2477
2593
|
return __generator(this, function (_a) {
|
|
2478
2594
|
switch (_a.label) {
|
|
2479
2595
|
case 0:
|
|
2480
|
-
|
|
2596
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2597
|
+
this.loggerService.info("swarmConnectionService waitForOutput");
|
|
2481
2598
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).waitForOutput()];
|
|
2482
2599
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2483
2600
|
}
|
|
@@ -2491,7 +2608,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2491
2608
|
return __generator(this, function (_a) {
|
|
2492
2609
|
switch (_a.label) {
|
|
2493
2610
|
case 0:
|
|
2494
|
-
|
|
2611
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2612
|
+
this.loggerService.info("swarmConnectionService getAgentName");
|
|
2495
2613
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgentName()];
|
|
2496
2614
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2497
2615
|
}
|
|
@@ -2505,7 +2623,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2505
2623
|
return __generator(this, function (_a) {
|
|
2506
2624
|
switch (_a.label) {
|
|
2507
2625
|
case 0:
|
|
2508
|
-
|
|
2626
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2627
|
+
this.loggerService.info("swarmConnectionService getAgent");
|
|
2509
2628
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgent()];
|
|
2510
2629
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2511
2630
|
}
|
|
@@ -2521,9 +2640,10 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2521
2640
|
return __generator(this, function (_a) {
|
|
2522
2641
|
switch (_a.label) {
|
|
2523
2642
|
case 0:
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2643
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2644
|
+
this.loggerService.info("swarmConnectionService setAgentRef", {
|
|
2645
|
+
agentName: agentName,
|
|
2646
|
+
});
|
|
2527
2647
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentRef(agentName, agent)];
|
|
2528
2648
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2529
2649
|
}
|
|
@@ -2538,9 +2658,10 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2538
2658
|
return __generator(this, function (_a) {
|
|
2539
2659
|
switch (_a.label) {
|
|
2540
2660
|
case 0:
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2661
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2662
|
+
this.loggerService.info("swarmConnectionService setAgentName", {
|
|
2663
|
+
agentName: agentName,
|
|
2664
|
+
});
|
|
2544
2665
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentName(agentName)];
|
|
2545
2666
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2546
2667
|
}
|
|
@@ -2553,7 +2674,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2553
2674
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2554
2675
|
var key;
|
|
2555
2676
|
return __generator(this, function (_a) {
|
|
2556
|
-
|
|
2677
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2678
|
+
this.loggerService.info("swarmConnectionService dispose");
|
|
2557
2679
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
2558
2680
|
if (!this.getSwarm.has(key)) {
|
|
2559
2681
|
return [2 /*return*/];
|
|
@@ -2580,7 +2702,8 @@ var SwarmSchemaService = /** @class */ (function () {
|
|
|
2580
2702
|
* @param {ISwarmSchema} value - The schema of the swarm.
|
|
2581
2703
|
*/
|
|
2582
2704
|
this.register = function (key, value) {
|
|
2583
|
-
|
|
2705
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2706
|
+
_this.loggerService.info("swarmSchemaService register", { key: key });
|
|
2584
2707
|
_this.registry = _this.registry.register(key, value);
|
|
2585
2708
|
};
|
|
2586
2709
|
/**
|
|
@@ -2589,7 +2712,8 @@ var SwarmSchemaService = /** @class */ (function () {
|
|
|
2589
2712
|
* @returns {ISwarmSchema} The schema of the swarm.
|
|
2590
2713
|
*/
|
|
2591
2714
|
this.get = function (key) {
|
|
2592
|
-
|
|
2715
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2716
|
+
_this.loggerService.info("swarmSchemaService get", { key: key });
|
|
2593
2717
|
return _this.registry.get(key);
|
|
2594
2718
|
};
|
|
2595
2719
|
}
|
|
@@ -2610,7 +2734,8 @@ var CompletionSchemaService = /** @class */ (function () {
|
|
|
2610
2734
|
* @param {ICompletionSchema} value - The schema to register.
|
|
2611
2735
|
*/
|
|
2612
2736
|
this.register = function (key, value) {
|
|
2613
|
-
|
|
2737
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2738
|
+
_this.loggerService.info("completionSchemaService register", { key: key });
|
|
2614
2739
|
_this.registry = _this.registry.register(key, value);
|
|
2615
2740
|
};
|
|
2616
2741
|
/**
|
|
@@ -2619,7 +2744,8 @@ var CompletionSchemaService = /** @class */ (function () {
|
|
|
2619
2744
|
* @returns {ICompletionSchema} The retrieved schema.
|
|
2620
2745
|
*/
|
|
2621
2746
|
this.get = function (key) {
|
|
2622
|
-
|
|
2747
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2748
|
+
_this.loggerService.info("completionSchemaService get", { key: key });
|
|
2623
2749
|
return _this.registry.get(key);
|
|
2624
2750
|
};
|
|
2625
2751
|
}
|
|
@@ -2647,9 +2773,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2647
2773
|
return __generator(this, function (_a) {
|
|
2648
2774
|
switch (_a.label) {
|
|
2649
2775
|
case 0:
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2776
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2777
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " emit"), {
|
|
2778
|
+
message: message,
|
|
2779
|
+
});
|
|
2653
2780
|
this.params.onEmit &&
|
|
2654
2781
|
this.params.onEmit(this.params.clientId, this.params.swarmName, message);
|
|
2655
2782
|
return [4 /*yield*/, this._emitSubject.next(message)];
|
|
@@ -2659,7 +2786,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2659
2786
|
type: "emit",
|
|
2660
2787
|
source: "session-bus",
|
|
2661
2788
|
input: {
|
|
2662
|
-
message: message
|
|
2789
|
+
message: message,
|
|
2663
2790
|
},
|
|
2664
2791
|
output: {},
|
|
2665
2792
|
context: {
|
|
@@ -2684,10 +2811,11 @@ var ClientSession = /** @class */ (function () {
|
|
|
2684
2811
|
return __generator(this, function (_a) {
|
|
2685
2812
|
switch (_a.label) {
|
|
2686
2813
|
case 0:
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2814
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2815
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " execute"), {
|
|
2816
|
+
message: message,
|
|
2817
|
+
mode: mode,
|
|
2818
|
+
});
|
|
2691
2819
|
this.params.onExecute &&
|
|
2692
2820
|
this.params.onExecute(this.params.clientId, this.params.swarmName, message, mode);
|
|
2693
2821
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
@@ -2730,10 +2858,11 @@ var ClientSession = /** @class */ (function () {
|
|
|
2730
2858
|
return __generator(this, function (_a) {
|
|
2731
2859
|
switch (_a.label) {
|
|
2732
2860
|
case 0:
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2861
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2862
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitToolOutput"), {
|
|
2863
|
+
content: content,
|
|
2864
|
+
toolId: toolId,
|
|
2865
|
+
});
|
|
2737
2866
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2738
2867
|
case 1:
|
|
2739
2868
|
agent = _a.sent();
|
|
@@ -2769,9 +2898,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2769
2898
|
return __generator(this, function (_a) {
|
|
2770
2899
|
switch (_a.label) {
|
|
2771
2900
|
case 0:
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2901
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2902
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitUserMessage"), {
|
|
2903
|
+
message: message,
|
|
2904
|
+
});
|
|
2775
2905
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2776
2906
|
case 1:
|
|
2777
2907
|
agent = _a.sent();
|
|
@@ -2805,7 +2935,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2805
2935
|
return __generator(this, function (_a) {
|
|
2806
2936
|
switch (_a.label) {
|
|
2807
2937
|
case 0:
|
|
2808
|
-
|
|
2938
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2939
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitFlush"));
|
|
2809
2940
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2810
2941
|
case 1:
|
|
2811
2942
|
agent = _a.sent();
|
|
@@ -2838,9 +2969,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2838
2969
|
return __generator(this, function (_a) {
|
|
2839
2970
|
switch (_a.label) {
|
|
2840
2971
|
case 0:
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2972
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2973
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitSystemMessage"), {
|
|
2974
|
+
message: message,
|
|
2975
|
+
});
|
|
2844
2976
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2845
2977
|
case 1:
|
|
2846
2978
|
agent = _a.sent();
|
|
@@ -2851,7 +2983,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2851
2983
|
type: "commit-system-message",
|
|
2852
2984
|
source: "session-bus",
|
|
2853
2985
|
input: {
|
|
2854
|
-
message: message
|
|
2986
|
+
message: message,
|
|
2855
2987
|
},
|
|
2856
2988
|
output: {},
|
|
2857
2989
|
context: {
|
|
@@ -2871,7 +3003,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2871
3003
|
* @returns {ReceiveMessageFn} - The function to receive messages.
|
|
2872
3004
|
*/
|
|
2873
3005
|
this.connect = function (connector) {
|
|
2874
|
-
|
|
3006
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3007
|
+
_this.params.logger.debug("ClientSession clientId=".concat(_this.params.clientId, " connect"));
|
|
2875
3008
|
_this.params.onConnect &&
|
|
2876
3009
|
_this.params.onConnect(_this.params.clientId, _this.params.swarmName);
|
|
2877
3010
|
_this._emitSubject.subscribe(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2908,7 +3041,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2908
3041
|
return __generator(this, function (_c) {
|
|
2909
3042
|
switch (_c.label) {
|
|
2910
3043
|
case 0:
|
|
2911
|
-
|
|
3044
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3045
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " connect call"));
|
|
2912
3046
|
return [4 /*yield*/, this.execute(incoming.data, "user")];
|
|
2913
3047
|
case 1:
|
|
2914
3048
|
data = _c.sent();
|
|
@@ -2936,15 +3070,17 @@ var ClientSession = /** @class */ (function () {
|
|
|
2936
3070
|
*/
|
|
2937
3071
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2938
3072
|
return __generator(this, function (_a) {
|
|
2939
|
-
|
|
3073
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3074
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " dispose"));
|
|
2940
3075
|
this.params.onDispose &&
|
|
2941
3076
|
this.params.onDispose(this.params.clientId, this.params.swarmName);
|
|
2942
3077
|
return [2 /*return*/];
|
|
2943
3078
|
});
|
|
2944
3079
|
}); };
|
|
2945
|
-
|
|
2946
|
-
params
|
|
2947
|
-
|
|
3080
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3081
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"), {
|
|
3082
|
+
params: params,
|
|
3083
|
+
});
|
|
2948
3084
|
this.params.onInit && this.params.onInit(params.clientId, params.swarmName);
|
|
2949
3085
|
}
|
|
2950
3086
|
return ClientSession;
|
|
@@ -2984,9 +3120,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2984
3120
|
return __generator(this, function (_a) {
|
|
2985
3121
|
switch (_a.label) {
|
|
2986
3122
|
case 0:
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
3123
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3124
|
+
this.loggerService.info("sessionConnectionService emit", {
|
|
3125
|
+
content: content,
|
|
3126
|
+
});
|
|
2990
3127
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).emit(content)];
|
|
2991
3128
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2992
3129
|
}
|
|
@@ -3001,10 +3138,11 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3001
3138
|
return __generator(this, function (_a) {
|
|
3002
3139
|
switch (_a.label) {
|
|
3003
3140
|
case 0:
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3141
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3142
|
+
this.loggerService.info("sessionConnectionService execute", {
|
|
3143
|
+
content: content,
|
|
3144
|
+
mode: mode,
|
|
3145
|
+
});
|
|
3008
3146
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).execute(content, mode)];
|
|
3009
3147
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3010
3148
|
}
|
|
@@ -3016,7 +3154,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3016
3154
|
* @returns {ReceiveMessageFn} The function to receive messages.
|
|
3017
3155
|
*/
|
|
3018
3156
|
this.connect = function (connector, clientId, swarmName) {
|
|
3019
|
-
|
|
3157
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3158
|
+
_this.loggerService.info("sessionConnectionService connect");
|
|
3020
3159
|
return _this.getSession(clientId, swarmName).connect(connector);
|
|
3021
3160
|
};
|
|
3022
3161
|
/**
|
|
@@ -3029,10 +3168,11 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3029
3168
|
return __generator(this, function (_a) {
|
|
3030
3169
|
switch (_a.label) {
|
|
3031
3170
|
case 0:
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3171
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3172
|
+
this.loggerService.info("sessionConnectionService commitToolOutput", {
|
|
3173
|
+
content: content,
|
|
3174
|
+
toolId: toolId,
|
|
3175
|
+
});
|
|
3036
3176
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitToolOutput(toolId, content)];
|
|
3037
3177
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3038
3178
|
}
|
|
@@ -3047,9 +3187,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3047
3187
|
return __generator(this, function (_a) {
|
|
3048
3188
|
switch (_a.label) {
|
|
3049
3189
|
case 0:
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3190
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3191
|
+
this.loggerService.info("sessionConnectionService commitSystemMessage", {
|
|
3192
|
+
message: message,
|
|
3193
|
+
});
|
|
3053
3194
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitSystemMessage(message)];
|
|
3054
3195
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3055
3196
|
}
|
|
@@ -3064,9 +3205,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3064
3205
|
return __generator(this, function (_a) {
|
|
3065
3206
|
switch (_a.label) {
|
|
3066
3207
|
case 0:
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3208
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3209
|
+
this.loggerService.info("sessionConnectionService commitUserMessage", {
|
|
3210
|
+
message: message,
|
|
3211
|
+
});
|
|
3070
3212
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitUserMessage(message)];
|
|
3071
3213
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3072
3214
|
}
|
|
@@ -3081,7 +3223,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3081
3223
|
return __generator(this, function (_a) {
|
|
3082
3224
|
switch (_a.label) {
|
|
3083
3225
|
case 0:
|
|
3084
|
-
|
|
3226
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3227
|
+
this.loggerService.info("sessionConnectionService commitFlush");
|
|
3085
3228
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitFlush()];
|
|
3086
3229
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3087
3230
|
}
|
|
@@ -3096,7 +3239,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3096
3239
|
return __generator(this, function (_a) {
|
|
3097
3240
|
switch (_a.label) {
|
|
3098
3241
|
case 0:
|
|
3099
|
-
|
|
3242
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3243
|
+
this.loggerService.info("sessionConnectionService dispose");
|
|
3100
3244
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
3101
3245
|
if (!this.getSession.has(key)) {
|
|
3102
3246
|
return [2 /*return*/];
|
|
@@ -3132,11 +3276,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3132
3276
|
return __generator(this, function (_a) {
|
|
3133
3277
|
switch (_a.label) {
|
|
3134
3278
|
case 0:
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3279
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3280
|
+
this.loggerService.info("agentPublicService createAgentRef", {
|
|
3281
|
+
methodName: methodName,
|
|
3282
|
+
clientId: clientId,
|
|
3283
|
+
agentName: agentName,
|
|
3284
|
+
});
|
|
3140
3285
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3141
3286
|
return __generator(this, function (_a) {
|
|
3142
3287
|
switch (_a.label) {
|
|
@@ -3168,13 +3313,14 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3168
3313
|
return __generator(this, function (_a) {
|
|
3169
3314
|
switch (_a.label) {
|
|
3170
3315
|
case 0:
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3316
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3317
|
+
this.loggerService.info("agentPublicService execute", {
|
|
3318
|
+
methodName: methodName,
|
|
3319
|
+
input: input,
|
|
3320
|
+
clientId: clientId,
|
|
3321
|
+
agentName: agentName,
|
|
3322
|
+
mode: mode,
|
|
3323
|
+
});
|
|
3178
3324
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3179
3325
|
return __generator(this, function (_a) {
|
|
3180
3326
|
switch (_a.label) {
|
|
@@ -3205,11 +3351,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3205
3351
|
return __generator(this, function (_a) {
|
|
3206
3352
|
switch (_a.label) {
|
|
3207
3353
|
case 0:
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3354
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3355
|
+
this.loggerService.info("agentPublicService waitForOutput", {
|
|
3356
|
+
methodName: methodName,
|
|
3357
|
+
clientId: clientId,
|
|
3358
|
+
agentName: agentName,
|
|
3359
|
+
});
|
|
3213
3360
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3214
3361
|
return __generator(this, function (_a) {
|
|
3215
3362
|
switch (_a.label) {
|
|
@@ -3242,13 +3389,14 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3242
3389
|
return __generator(this, function (_a) {
|
|
3243
3390
|
switch (_a.label) {
|
|
3244
3391
|
case 0:
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3392
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3393
|
+
this.loggerService.info("agentPublicService commitToolOutput", {
|
|
3394
|
+
methodName: methodName,
|
|
3395
|
+
content: content,
|
|
3396
|
+
clientId: clientId,
|
|
3397
|
+
toolId: toolId,
|
|
3398
|
+
agentName: agentName,
|
|
3399
|
+
});
|
|
3252
3400
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3253
3401
|
return __generator(this, function (_a) {
|
|
3254
3402
|
switch (_a.label) {
|
|
@@ -3280,12 +3428,13 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3280
3428
|
return __generator(this, function (_a) {
|
|
3281
3429
|
switch (_a.label) {
|
|
3282
3430
|
case 0:
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3431
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3432
|
+
this.loggerService.info("agentPublicService commitSystemMessage", {
|
|
3433
|
+
methodName: methodName,
|
|
3434
|
+
message: message,
|
|
3435
|
+
clientId: clientId,
|
|
3436
|
+
agentName: agentName,
|
|
3437
|
+
});
|
|
3289
3438
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3290
3439
|
return __generator(this, function (_a) {
|
|
3291
3440
|
switch (_a.label) {
|
|
@@ -3317,12 +3466,13 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3317
3466
|
return __generator(this, function (_a) {
|
|
3318
3467
|
switch (_a.label) {
|
|
3319
3468
|
case 0:
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3469
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3470
|
+
this.loggerService.info("agentPublicService commitUserMessage", {
|
|
3471
|
+
methodName: methodName,
|
|
3472
|
+
message: message,
|
|
3473
|
+
clientId: clientId,
|
|
3474
|
+
agentName: agentName,
|
|
3475
|
+
});
|
|
3326
3476
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3327
3477
|
return __generator(this, function (_a) {
|
|
3328
3478
|
switch (_a.label) {
|
|
@@ -3353,11 +3503,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3353
3503
|
return __generator(this, function (_a) {
|
|
3354
3504
|
switch (_a.label) {
|
|
3355
3505
|
case 0:
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3506
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3507
|
+
this.loggerService.info("agentPublicService commitFlush", {
|
|
3508
|
+
methodName: methodName,
|
|
3509
|
+
clientId: clientId,
|
|
3510
|
+
agentName: agentName,
|
|
3511
|
+
});
|
|
3361
3512
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3362
3513
|
return __generator(this, function (_a) {
|
|
3363
3514
|
switch (_a.label) {
|
|
@@ -3388,11 +3539,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3388
3539
|
return __generator(this, function (_a) {
|
|
3389
3540
|
switch (_a.label) {
|
|
3390
3541
|
case 0:
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3542
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3543
|
+
this.loggerService.info("agentPublicService commitAgentChange", {
|
|
3544
|
+
methodName: methodName,
|
|
3545
|
+
clientId: clientId,
|
|
3546
|
+
agentName: agentName,
|
|
3547
|
+
});
|
|
3396
3548
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3397
3549
|
return __generator(this, function (_a) {
|
|
3398
3550
|
switch (_a.label) {
|
|
@@ -3423,11 +3575,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3423
3575
|
return __generator(this, function (_a) {
|
|
3424
3576
|
switch (_a.label) {
|
|
3425
3577
|
case 0:
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3578
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3579
|
+
this.loggerService.info("agentPublicService dispose", {
|
|
3580
|
+
methodName: methodName,
|
|
3581
|
+
clientId: clientId,
|
|
3582
|
+
agentName: agentName,
|
|
3583
|
+
});
|
|
3431
3584
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3432
3585
|
return __generator(this, function (_a) {
|
|
3433
3586
|
switch (_a.label) {
|
|
@@ -3471,12 +3624,13 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3471
3624
|
return __generator(this, function (_a) {
|
|
3472
3625
|
switch (_a.label) {
|
|
3473
3626
|
case 0:
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3627
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3628
|
+
this.loggerService.info("historyPublicService push", {
|
|
3629
|
+
methodName: methodName,
|
|
3630
|
+
message: message,
|
|
3631
|
+
clientId: clientId,
|
|
3632
|
+
agentName: agentName,
|
|
3633
|
+
});
|
|
3480
3634
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3481
3635
|
return __generator(this, function (_a) {
|
|
3482
3636
|
switch (_a.label) {
|
|
@@ -3508,11 +3662,12 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3508
3662
|
return __generator(this, function (_a) {
|
|
3509
3663
|
switch (_a.label) {
|
|
3510
3664
|
case 0:
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3665
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3666
|
+
this.loggerService.info("historyPublicService toArrayForAgent", {
|
|
3667
|
+
prompt: prompt,
|
|
3668
|
+
clientId: clientId,
|
|
3669
|
+
agentName: agentName,
|
|
3670
|
+
});
|
|
3516
3671
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3517
3672
|
return __generator(this, function (_a) {
|
|
3518
3673
|
switch (_a.label) {
|
|
@@ -3543,11 +3698,12 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3543
3698
|
return __generator(this, function (_a) {
|
|
3544
3699
|
switch (_a.label) {
|
|
3545
3700
|
case 0:
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3701
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3702
|
+
this.loggerService.info("historyPublicService toArrayForRaw", {
|
|
3703
|
+
methodName: methodName,
|
|
3704
|
+
clientId: clientId,
|
|
3705
|
+
agentName: agentName,
|
|
3706
|
+
});
|
|
3551
3707
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3552
3708
|
return __generator(this, function (_a) {
|
|
3553
3709
|
switch (_a.label) {
|
|
@@ -3578,10 +3734,11 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3578
3734
|
return __generator(this, function (_a) {
|
|
3579
3735
|
switch (_a.label) {
|
|
3580
3736
|
case 0:
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3737
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3738
|
+
this.loggerService.info("historyPublicService dispose", {
|
|
3739
|
+
clientId: clientId,
|
|
3740
|
+
agentName: agentName,
|
|
3741
|
+
});
|
|
3585
3742
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3586
3743
|
return __generator(this, function (_a) {
|
|
3587
3744
|
switch (_a.label) {
|
|
@@ -3625,12 +3782,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3625
3782
|
return __generator(this, function (_a) {
|
|
3626
3783
|
switch (_a.label) {
|
|
3627
3784
|
case 0:
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3785
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3786
|
+
this.loggerService.info("sessionPublicService emit", {
|
|
3787
|
+
content: content,
|
|
3788
|
+
clientId: clientId,
|
|
3789
|
+
methodName: methodName,
|
|
3790
|
+
swarmName: swarmName,
|
|
3791
|
+
});
|
|
3634
3792
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3635
3793
|
return __generator(this, function (_a) {
|
|
3636
3794
|
switch (_a.label) {
|
|
@@ -3662,12 +3820,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3662
3820
|
return __generator(this, function (_a) {
|
|
3663
3821
|
switch (_a.label) {
|
|
3664
3822
|
case 0:
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3823
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3824
|
+
this.loggerService.info("sessionPublicService execute", {
|
|
3825
|
+
content: content,
|
|
3826
|
+
mode: mode,
|
|
3827
|
+
clientId: clientId,
|
|
3828
|
+
swarmName: swarmName,
|
|
3829
|
+
});
|
|
3671
3830
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3672
3831
|
return __generator(this, function (_a) {
|
|
3673
3832
|
switch (_a.label) {
|
|
@@ -3695,11 +3854,12 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3695
3854
|
* @returns {ReceiveMessageFn}
|
|
3696
3855
|
*/
|
|
3697
3856
|
this.connect = function (connector, methodName, clientId, swarmName) {
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3857
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3858
|
+
_this.loggerService.info("sessionPublicService connect", {
|
|
3859
|
+
methodName: methodName,
|
|
3860
|
+
clientId: clientId,
|
|
3861
|
+
swarmName: swarmName,
|
|
3862
|
+
});
|
|
3703
3863
|
var send = _this.sessionConnectionService.connect(connector, clientId, swarmName);
|
|
3704
3864
|
return function (incoming) { return __awaiter(_this, void 0, void 0, function () {
|
|
3705
3865
|
var executionId;
|
|
@@ -3709,7 +3869,15 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3709
3869
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3710
3870
|
return __generator(this, function (_a) {
|
|
3711
3871
|
switch (_a.label) {
|
|
3712
|
-
case 0:
|
|
3872
|
+
case 0:
|
|
3873
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
3874
|
+
this.loggerService.log("sessionPublicService connect execute", {
|
|
3875
|
+
content: incoming,
|
|
3876
|
+
methodName: methodName,
|
|
3877
|
+
clientId: clientId,
|
|
3878
|
+
executionId: executionId,
|
|
3879
|
+
});
|
|
3880
|
+
return [4 /*yield*/, send(incoming)];
|
|
3713
3881
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3714
3882
|
}
|
|
3715
3883
|
});
|
|
@@ -3733,13 +3901,14 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3733
3901
|
return __generator(this, function (_a) {
|
|
3734
3902
|
switch (_a.label) {
|
|
3735
3903
|
case 0:
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3904
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3905
|
+
this.loggerService.info("sessionPublicService commitToolOutput", {
|
|
3906
|
+
methodName: methodName,
|
|
3907
|
+
toolId: toolId,
|
|
3908
|
+
content: content,
|
|
3909
|
+
clientId: clientId,
|
|
3910
|
+
swarmName: swarmName,
|
|
3911
|
+
});
|
|
3743
3912
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3744
3913
|
return __generator(this, function (_a) {
|
|
3745
3914
|
switch (_a.label) {
|
|
@@ -3771,12 +3940,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3771
3940
|
return __generator(this, function (_a) {
|
|
3772
3941
|
switch (_a.label) {
|
|
3773
3942
|
case 0:
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3943
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3944
|
+
this.loggerService.info("sessionPublicService commitSystemMessage", {
|
|
3945
|
+
methodName: methodName,
|
|
3946
|
+
message: message,
|
|
3947
|
+
clientId: clientId,
|
|
3948
|
+
swarmName: swarmName,
|
|
3949
|
+
});
|
|
3780
3950
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3781
3951
|
return __generator(this, function (_a) {
|
|
3782
3952
|
switch (_a.label) {
|
|
@@ -3808,12 +3978,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3808
3978
|
return __generator(this, function (_a) {
|
|
3809
3979
|
switch (_a.label) {
|
|
3810
3980
|
case 0:
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3981
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3982
|
+
this.loggerService.info("sessionPublicService commitUserMessage", {
|
|
3983
|
+
methodName: methodName,
|
|
3984
|
+
message: message,
|
|
3985
|
+
clientId: clientId,
|
|
3986
|
+
swarmName: swarmName,
|
|
3987
|
+
});
|
|
3817
3988
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3818
3989
|
return __generator(this, function (_a) {
|
|
3819
3990
|
switch (_a.label) {
|
|
@@ -3844,10 +4015,11 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3844
4015
|
return __generator(this, function (_a) {
|
|
3845
4016
|
switch (_a.label) {
|
|
3846
4017
|
case 0:
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
4018
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4019
|
+
this.loggerService.info("sessionPublicService commitFlush", {
|
|
4020
|
+
clientId: clientId,
|
|
4021
|
+
swarmName: swarmName,
|
|
4022
|
+
});
|
|
3851
4023
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3852
4024
|
return __generator(this, function (_a) {
|
|
3853
4025
|
switch (_a.label) {
|
|
@@ -3878,11 +4050,12 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3878
4050
|
return __generator(this, function (_a) {
|
|
3879
4051
|
switch (_a.label) {
|
|
3880
4052
|
case 0:
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
4053
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4054
|
+
this.loggerService.info("sessionPublicService dispose", {
|
|
4055
|
+
methodName: methodName,
|
|
4056
|
+
clientId: clientId,
|
|
4057
|
+
swarmName: swarmName,
|
|
4058
|
+
});
|
|
3886
4059
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3887
4060
|
return __generator(this, function (_a) {
|
|
3888
4061
|
switch (_a.label) {
|
|
@@ -3925,10 +4098,11 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3925
4098
|
return __generator(this, function (_a) {
|
|
3926
4099
|
switch (_a.label) {
|
|
3927
4100
|
case 0:
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
4101
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4102
|
+
this.loggerService.info("swarmPublicService cancelOutput", {
|
|
4103
|
+
clientId: clientId,
|
|
4104
|
+
swarmName: swarmName,
|
|
4105
|
+
});
|
|
3932
4106
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3933
4107
|
return __generator(this, function (_a) {
|
|
3934
4108
|
switch (_a.label) {
|
|
@@ -3959,11 +4133,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3959
4133
|
return __generator(this, function (_a) {
|
|
3960
4134
|
switch (_a.label) {
|
|
3961
4135
|
case 0:
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
4136
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4137
|
+
this.loggerService.info("swarmPublicService waitForOutput", {
|
|
4138
|
+
clientId: clientId,
|
|
4139
|
+
methodName: methodName,
|
|
4140
|
+
swarmName: swarmName,
|
|
4141
|
+
});
|
|
3967
4142
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3968
4143
|
return __generator(this, function (_a) {
|
|
3969
4144
|
switch (_a.label) {
|
|
@@ -3994,11 +4169,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3994
4169
|
return __generator(this, function (_a) {
|
|
3995
4170
|
switch (_a.label) {
|
|
3996
4171
|
case 0:
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4172
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4173
|
+
this.loggerService.info("swarmPublicService getAgentName", {
|
|
4174
|
+
clientId: clientId,
|
|
4175
|
+
swarmName: swarmName,
|
|
4176
|
+
methodName: methodName,
|
|
4177
|
+
});
|
|
4002
4178
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4003
4179
|
return __generator(this, function (_a) {
|
|
4004
4180
|
switch (_a.label) {
|
|
@@ -4029,10 +4205,11 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4029
4205
|
return __generator(this, function (_a) {
|
|
4030
4206
|
switch (_a.label) {
|
|
4031
4207
|
case 0:
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4208
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4209
|
+
this.loggerService.info("swarmPublicService getAgent", {
|
|
4210
|
+
clientId: clientId,
|
|
4211
|
+
swarmName: swarmName,
|
|
4212
|
+
});
|
|
4036
4213
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4037
4214
|
return __generator(this, function (_a) {
|
|
4038
4215
|
switch (_a.label) {
|
|
@@ -4065,13 +4242,14 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4065
4242
|
return __generator(this, function (_a) {
|
|
4066
4243
|
switch (_a.label) {
|
|
4067
4244
|
case 0:
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4245
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4246
|
+
this.loggerService.info("swarmPublicService setAgentRef", {
|
|
4247
|
+
methodName: methodName,
|
|
4248
|
+
agentName: agentName,
|
|
4249
|
+
agent: agent,
|
|
4250
|
+
clientId: clientId,
|
|
4251
|
+
swarmName: swarmName,
|
|
4252
|
+
});
|
|
4075
4253
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4076
4254
|
return __generator(this, function (_a) {
|
|
4077
4255
|
switch (_a.label) {
|
|
@@ -4103,12 +4281,13 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4103
4281
|
return __generator(this, function (_a) {
|
|
4104
4282
|
switch (_a.label) {
|
|
4105
4283
|
case 0:
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4284
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4285
|
+
this.loggerService.info("swarmPublicService setAgentName", {
|
|
4286
|
+
methodName: methodName,
|
|
4287
|
+
agentName: agentName,
|
|
4288
|
+
clientId: clientId,
|
|
4289
|
+
swarmName: swarmName,
|
|
4290
|
+
});
|
|
4112
4291
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4113
4292
|
return __generator(this, function (_a) {
|
|
4114
4293
|
switch (_a.label) {
|
|
@@ -4139,11 +4318,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4139
4318
|
return __generator(this, function (_a) {
|
|
4140
4319
|
switch (_a.label) {
|
|
4141
4320
|
case 0:
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4321
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4322
|
+
this.loggerService.info("swarmPublicService dispose", {
|
|
4323
|
+
methodName: methodName,
|
|
4324
|
+
clientId: clientId,
|
|
4325
|
+
swarmName: swarmName,
|
|
4326
|
+
});
|
|
4147
4327
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4148
4328
|
return __generator(this, function (_a) {
|
|
4149
4329
|
switch (_a.label) {
|
|
@@ -4209,10 +4389,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4209
4389
|
* @throws {Error} If the agent already exists.
|
|
4210
4390
|
*/
|
|
4211
4391
|
this.addAgent = function (agentName, agentSchema) {
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4392
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4393
|
+
_this.loggerService.info("agentValidationService addAgent", {
|
|
4394
|
+
agentName: agentName,
|
|
4395
|
+
agentSchema: agentSchema,
|
|
4396
|
+
});
|
|
4216
4397
|
if (_this._agentMap.has(agentName)) {
|
|
4217
4398
|
throw new Error("agent-swarm agent ".concat(agentName, " already exist"));
|
|
4218
4399
|
}
|
|
@@ -4225,10 +4406,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4225
4406
|
var _b = __read(_a, 2), agentName = _b[0], storageName = _b[1];
|
|
4226
4407
|
return "".concat(agentName, "-").concat(storageName);
|
|
4227
4408
|
}, function (agentName, storageName) {
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4409
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4410
|
+
_this.loggerService.info("agentValidationService hasStorage", {
|
|
4411
|
+
agentName: agentName,
|
|
4412
|
+
storageName: storageName,
|
|
4413
|
+
});
|
|
4232
4414
|
if (!_this._agentMap.has(agentName)) {
|
|
4233
4415
|
throw new Error("agent-swarm agent ".concat(agentName, " not exist (hasStorage)"));
|
|
4234
4416
|
}
|
|
@@ -4242,10 +4424,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4242
4424
|
var _b = __read(_a, 2), agentName = _b[0], stateName = _b[1];
|
|
4243
4425
|
return "".concat(agentName, "-").concat(stateName);
|
|
4244
4426
|
}, function (agentName, stateName) {
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4427
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4428
|
+
_this.loggerService.info("agentValidationService hasState", {
|
|
4429
|
+
agentName: agentName,
|
|
4430
|
+
stateName: stateName,
|
|
4431
|
+
});
|
|
4249
4432
|
if (!_this._agentMap.has(agentName)) {
|
|
4250
4433
|
throw new Error("agent-swarm agent ".concat(agentName, " not exist (hasState)"));
|
|
4251
4434
|
}
|
|
@@ -4263,10 +4446,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4263
4446
|
return agentName;
|
|
4264
4447
|
}, function (agentName, source) {
|
|
4265
4448
|
var _a, _b;
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4449
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4450
|
+
_this.loggerService.info("agentValidationService validate", {
|
|
4451
|
+
agentName: agentName,
|
|
4452
|
+
source: source,
|
|
4453
|
+
});
|
|
4270
4454
|
var agent = _this._agentMap.get(agentName);
|
|
4271
4455
|
if (!agent) {
|
|
4272
4456
|
throw new Error("agent-swarm agent ".concat(agentName, " not found source=").concat(source));
|
|
@@ -4304,9 +4488,10 @@ var CompletionValidationService = /** @class */ (function () {
|
|
|
4304
4488
|
* @throws Will throw an error if the completion name already exists.
|
|
4305
4489
|
*/
|
|
4306
4490
|
this.addCompletion = function (completionName) {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4491
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4492
|
+
_this.loggerService.info("completionValidationService addCompletion", {
|
|
4493
|
+
completionName: completionName,
|
|
4494
|
+
});
|
|
4310
4495
|
if (_this._completionSet.has(completionName)) {
|
|
4311
4496
|
throw new Error("agent-swarm completion ".concat(completionName, " already exist"));
|
|
4312
4497
|
}
|
|
@@ -4322,10 +4507,11 @@ var CompletionValidationService = /** @class */ (function () {
|
|
|
4322
4507
|
var _b = __read(_a, 1), completionName = _b[0];
|
|
4323
4508
|
return completionName;
|
|
4324
4509
|
}, function (completionName, source) {
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4510
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4511
|
+
_this.loggerService.info("completionValidationService validate", {
|
|
4512
|
+
completionName: completionName,
|
|
4513
|
+
source: source,
|
|
4514
|
+
});
|
|
4329
4515
|
if (!_this._completionSet.has(completionName)) {
|
|
4330
4516
|
throw new Error("agent-swarm completion ".concat(completionName, " not found source=").concat(source));
|
|
4331
4517
|
}
|
|
@@ -4356,9 +4542,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4356
4542
|
* @throws Will throw an error if the session already exists.
|
|
4357
4543
|
*/
|
|
4358
4544
|
this.addSession = function (clientId, swarmName, sessionMode) {
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4545
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4546
|
+
_this.loggerService.info("sessionValidationService addSession", {
|
|
4547
|
+
clientId: clientId,
|
|
4548
|
+
});
|
|
4362
4549
|
if (_this._sessionSwarmMap.has(clientId)) {
|
|
4363
4550
|
throw new Error("agent-swarm session clientId=".concat(clientId, " already exist"));
|
|
4364
4551
|
}
|
|
@@ -4371,10 +4558,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4371
4558
|
* @param {AgentName} agentName - The name of the agent.
|
|
4372
4559
|
*/
|
|
4373
4560
|
this.addAgentUsage = function (sessionId, agentName) {
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4561
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4562
|
+
_this.loggerService.info("sessionValidationService addAgentUsage", {
|
|
4563
|
+
sessionId: sessionId,
|
|
4564
|
+
agentName: agentName,
|
|
4565
|
+
});
|
|
4378
4566
|
if (_this._agentSwarmMap.has(sessionId)) {
|
|
4379
4567
|
var agents = _this._agentSwarmMap.get(sessionId);
|
|
4380
4568
|
if (!agents.includes(agentName)) {
|
|
@@ -4391,10 +4579,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4391
4579
|
* @param {AgentName} agentName - The name of the agent.
|
|
4392
4580
|
*/
|
|
4393
4581
|
this.addHistoryUsage = function (sessionId, agentName) {
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4582
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4583
|
+
_this.loggerService.info("sessionValidationService addHistoryUsage", {
|
|
4584
|
+
sessionId: sessionId,
|
|
4585
|
+
agentName: agentName,
|
|
4586
|
+
});
|
|
4398
4587
|
if (_this._historySwarmMap.has(sessionId)) {
|
|
4399
4588
|
var agents = _this._historySwarmMap.get(sessionId);
|
|
4400
4589
|
if (!agents.includes(agentName)) {
|
|
@@ -4411,10 +4600,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4411
4600
|
* @param {StorageName} storageName - The name of the storage.
|
|
4412
4601
|
*/
|
|
4413
4602
|
this.addStorageUsage = function (sessionId, storageName) {
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4603
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4604
|
+
_this.loggerService.info("sessionValidationService addStorageUsage", {
|
|
4605
|
+
sessionId: sessionId,
|
|
4606
|
+
storageName: storageName,
|
|
4607
|
+
});
|
|
4418
4608
|
if (_this._storageSwarmMap.has(sessionId)) {
|
|
4419
4609
|
var storages = _this._storageSwarmMap.get(sessionId);
|
|
4420
4610
|
if (!storages.includes(storageName)) {
|
|
@@ -4431,10 +4621,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4431
4621
|
* @param {StateName} stateName - The name of the state.
|
|
4432
4622
|
*/
|
|
4433
4623
|
this.addStateUsage = function (sessionId, stateName) {
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4624
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4625
|
+
_this.loggerService.info("sessionValidationService addStateUsage", {
|
|
4626
|
+
sessionId: sessionId,
|
|
4627
|
+
stateName: stateName,
|
|
4628
|
+
});
|
|
4438
4629
|
if (_this._stateSwarmMap.has(sessionId)) {
|
|
4439
4630
|
var states = _this._stateSwarmMap.get(sessionId);
|
|
4440
4631
|
if (!states.includes(stateName)) {
|
|
@@ -4452,10 +4643,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4452
4643
|
* @throws Will throw an error if no agents are found for the session.
|
|
4453
4644
|
*/
|
|
4454
4645
|
this.removeAgentUsage = function (sessionId, agentName) {
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4646
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4647
|
+
_this.loggerService.info("sessionValidationService removeAgentUsage", {
|
|
4648
|
+
sessionId: sessionId,
|
|
4649
|
+
agentName: agentName,
|
|
4650
|
+
});
|
|
4459
4651
|
if (_this._agentSwarmMap.has(sessionId)) {
|
|
4460
4652
|
var agents = _this._agentSwarmMap.get(sessionId);
|
|
4461
4653
|
var agentIndex = agents.indexOf(agentName);
|
|
@@ -4477,10 +4669,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4477
4669
|
* @throws Will throw an error if no agents are found for the session.
|
|
4478
4670
|
*/
|
|
4479
4671
|
this.removeHistoryUsage = function (sessionId, agentName) {
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4672
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4673
|
+
_this.loggerService.info("sessionValidationService removeHistoryUsage", {
|
|
4674
|
+
sessionId: sessionId,
|
|
4675
|
+
agentName: agentName,
|
|
4676
|
+
});
|
|
4484
4677
|
if (_this._historySwarmMap.has(sessionId)) {
|
|
4485
4678
|
var agents = _this._historySwarmMap.get(sessionId);
|
|
4486
4679
|
var agentIndex = agents.indexOf(agentName);
|
|
@@ -4502,10 +4695,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4502
4695
|
* @throws Will throw an error if no storages are found for the session.
|
|
4503
4696
|
*/
|
|
4504
4697
|
this.removeStorageUsage = function (sessionId, storageName) {
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4698
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4699
|
+
_this.loggerService.info("sessionValidationService removeStorageUsage", {
|
|
4700
|
+
sessionId: sessionId,
|
|
4701
|
+
storageName: storageName,
|
|
4702
|
+
});
|
|
4509
4703
|
if (_this._storageSwarmMap.has(sessionId)) {
|
|
4510
4704
|
var agents = _this._storageSwarmMap.get(sessionId);
|
|
4511
4705
|
var agentIndex = agents.indexOf(storageName);
|
|
@@ -4527,10 +4721,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4527
4721
|
* @throws Will throw an error if no states are found for the session.
|
|
4528
4722
|
*/
|
|
4529
4723
|
this.removeStateUsage = function (sessionId, stateName) {
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4724
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4725
|
+
_this.loggerService.info("sessionValidationService removeStateUsage", {
|
|
4726
|
+
sessionId: sessionId,
|
|
4727
|
+
stateName: stateName,
|
|
4728
|
+
});
|
|
4534
4729
|
if (_this._stateSwarmMap.has(sessionId)) {
|
|
4535
4730
|
var agents = _this._stateSwarmMap.get(sessionId);
|
|
4536
4731
|
var agentIndex = agents.indexOf(stateName);
|
|
@@ -4552,9 +4747,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4552
4747
|
* @throws Will throw an error if the session does not exist.
|
|
4553
4748
|
*/
|
|
4554
4749
|
this.getSessionMode = function (clientId) {
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4750
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4751
|
+
_this.loggerService.info("sessionValidationService getSessionMode", {
|
|
4752
|
+
clientId: clientId,
|
|
4753
|
+
});
|
|
4558
4754
|
if (!_this._sessionModeMap.has(clientId)) {
|
|
4559
4755
|
throw new Error("agent-swarm session getSessionMode clientId=".concat(clientId, " session not exist"));
|
|
4560
4756
|
}
|
|
@@ -4565,7 +4761,8 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4565
4761
|
* @returns {boolean}
|
|
4566
4762
|
*/
|
|
4567
4763
|
this.hasSession = function (clientId) {
|
|
4568
|
-
|
|
4764
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4765
|
+
_this.loggerService.info("sessionValidationService hasSession");
|
|
4569
4766
|
return _this._sessionSwarmMap.has(clientId);
|
|
4570
4767
|
};
|
|
4571
4768
|
/**
|
|
@@ -4573,7 +4770,8 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4573
4770
|
* @returns {SessionId[]} The list of session IDs.
|
|
4574
4771
|
*/
|
|
4575
4772
|
this.getSessionList = function () {
|
|
4576
|
-
|
|
4773
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4774
|
+
_this.loggerService.info("sessionValidationService getSessionList");
|
|
4577
4775
|
return __spreadArray([], __read(_this._sessionSwarmMap.keys()), false);
|
|
4578
4776
|
};
|
|
4579
4777
|
/**
|
|
@@ -4583,9 +4781,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4583
4781
|
*/
|
|
4584
4782
|
this.getSessionAgentList = function (clientId) {
|
|
4585
4783
|
var _a;
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4785
|
+
_this.loggerService.info("sessionValidationService getSessionAgentList", {
|
|
4786
|
+
clientId: clientId,
|
|
4787
|
+
});
|
|
4589
4788
|
return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
|
|
4590
4789
|
};
|
|
4591
4790
|
/**
|
|
@@ -4595,9 +4794,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4595
4794
|
*/
|
|
4596
4795
|
this.getSessionHistoryList = function (clientId) {
|
|
4597
4796
|
var _a;
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4797
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4798
|
+
_this.loggerService.info("sessionValidationService getSessionHistoryList", {
|
|
4799
|
+
clientId: clientId,
|
|
4800
|
+
});
|
|
4601
4801
|
return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
|
|
4602
4802
|
};
|
|
4603
4803
|
/**
|
|
@@ -4607,9 +4807,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4607
4807
|
* @throws Will throw an error if the session does not exist.
|
|
4608
4808
|
*/
|
|
4609
4809
|
this.getSwarm = function (clientId) {
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4810
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4811
|
+
_this.loggerService.info("sessionValidationService getSwarm", {
|
|
4812
|
+
clientId: clientId,
|
|
4813
|
+
});
|
|
4613
4814
|
var session = _this._sessionSwarmMap.get(clientId);
|
|
4614
4815
|
if (session === undefined) {
|
|
4615
4816
|
throw new Error("agent-swarm session clientId=".concat(clientId, " not found"));
|
|
@@ -4623,7 +4824,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4623
4824
|
* @throws Will throw an error if the session does not exist.
|
|
4624
4825
|
*/
|
|
4625
4826
|
this.validate = function (clientId, source) {
|
|
4626
|
-
|
|
4827
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4828
|
+
_this.loggerService.info("sessionValidationService validate", {
|
|
4829
|
+
clientId: clientId,
|
|
4830
|
+
});
|
|
4627
4831
|
if (!_this._sessionSwarmMap.has(clientId)) {
|
|
4628
4832
|
throw new Error("agent-swarm session clientId=".concat(clientId, " not exist source=").concat(source));
|
|
4629
4833
|
}
|
|
@@ -4634,9 +4838,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4634
4838
|
* @param {SessionId} clientId - The ID of the client.
|
|
4635
4839
|
*/
|
|
4636
4840
|
this.removeSession = function (clientId) {
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4841
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4842
|
+
_this.loggerService.info("sessionValidationService addSession", {
|
|
4843
|
+
clientId: clientId,
|
|
4844
|
+
});
|
|
4640
4845
|
_this._sessionSwarmMap.delete(clientId);
|
|
4641
4846
|
_this._sessionModeMap.delete(clientId);
|
|
4642
4847
|
};
|
|
@@ -4660,10 +4865,11 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4660
4865
|
* @throws Will throw an error if the swarm already exists.
|
|
4661
4866
|
*/
|
|
4662
4867
|
this.addSwarm = function (swarmName, swarmSchema) {
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4868
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4869
|
+
_this.loggerService.info("swarmValidationService addSwarm", {
|
|
4870
|
+
swarmName: swarmName,
|
|
4871
|
+
swarmSchema: swarmSchema,
|
|
4872
|
+
});
|
|
4667
4873
|
if (_this._swarmMap.has(swarmName)) {
|
|
4668
4874
|
throw new Error("swarm-swarm swarm ".concat(swarmName, " already exist"));
|
|
4669
4875
|
}
|
|
@@ -4676,9 +4882,10 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4676
4882
|
* @throws Will throw an error if the swarm is not found.
|
|
4677
4883
|
*/
|
|
4678
4884
|
this.getAgentList = function (swarmName) {
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4885
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4886
|
+
_this.loggerService.info("swarmValidationService getAgentList", {
|
|
4887
|
+
swarmName: swarmName,
|
|
4888
|
+
});
|
|
4682
4889
|
var swarm = _this._swarmMap.get(swarmName);
|
|
4683
4890
|
if (!swarm) {
|
|
4684
4891
|
throw new Error("agent-swarm swarm ".concat(swarmName, " not found"));
|
|
@@ -4695,10 +4902,11 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4695
4902
|
var _b = __read(_a, 1), swarmName = _b[0];
|
|
4696
4903
|
return swarmName;
|
|
4697
4904
|
}, function (swarmName, source) {
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4905
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4906
|
+
_this.loggerService.info("swarmValidationService validate", {
|
|
4907
|
+
swarmName: swarmName,
|
|
4908
|
+
source: source,
|
|
4909
|
+
});
|
|
4702
4910
|
var swarm = _this._swarmMap.get(swarmName);
|
|
4703
4911
|
if (!swarm) {
|
|
4704
4912
|
throw new Error("agent-swarm swarm ".concat(swarmName, " not found"));
|
|
@@ -4730,10 +4938,11 @@ var ToolValidationService = /** @class */ (function () {
|
|
|
4730
4938
|
* @throws Will throw an error if the tool already exists.
|
|
4731
4939
|
*/
|
|
4732
4940
|
this.addTool = function (toolName, toolSchema) {
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4941
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4942
|
+
_this.loggerService.info("toolValidationService addTool", {
|
|
4943
|
+
toolName: toolName,
|
|
4944
|
+
toolSchema: toolSchema,
|
|
4945
|
+
});
|
|
4737
4946
|
if (_this._toolMap.has(toolName)) {
|
|
4738
4947
|
throw new Error("agent-swarm tool ".concat(toolName, " already exist"));
|
|
4739
4948
|
}
|
|
@@ -4749,10 +4958,11 @@ var ToolValidationService = /** @class */ (function () {
|
|
|
4749
4958
|
var _b = __read(_a, 1), toolName = _b[0];
|
|
4750
4959
|
return toolName;
|
|
4751
4960
|
}, function (toolName, source) {
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4961
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4962
|
+
_this.loggerService.info("toolValidationService validate", {
|
|
4963
|
+
toolName: toolName,
|
|
4964
|
+
source: source,
|
|
4965
|
+
});
|
|
4756
4966
|
if (!_this._toolMap.has(toolName)) {
|
|
4757
4967
|
throw new Error("agent-swarm tool ".concat(toolName, " not found source=").concat(source));
|
|
4758
4968
|
}
|
|
@@ -4776,7 +4986,8 @@ var EmbeddingSchemaService = /** @class */ (function () {
|
|
|
4776
4986
|
* @param {IAgentTool} value - The embedding to register.
|
|
4777
4987
|
*/
|
|
4778
4988
|
this.register = function (key, value) {
|
|
4779
|
-
|
|
4989
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4990
|
+
_this.loggerService.info("embeddingSchemaService register");
|
|
4780
4991
|
_this.registry = _this.registry.register(key, value);
|
|
4781
4992
|
};
|
|
4782
4993
|
/**
|
|
@@ -4785,7 +4996,8 @@ var EmbeddingSchemaService = /** @class */ (function () {
|
|
|
4785
4996
|
* @returns {IAgentTool} The embedding associated with the given key.
|
|
4786
4997
|
*/
|
|
4787
4998
|
this.get = function (key) {
|
|
4788
|
-
|
|
4999
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5000
|
+
_this.loggerService.info("embeddingSchemaService get", { key: key });
|
|
4789
5001
|
return _this.registry.get(key);
|
|
4790
5002
|
};
|
|
4791
5003
|
}
|
|
@@ -4806,7 +5018,8 @@ var StorageSchemaService = /** @class */ (function () {
|
|
|
4806
5018
|
* @param {IStorageSchema} value - The schema to register.
|
|
4807
5019
|
*/
|
|
4808
5020
|
this.register = function (key, value) {
|
|
4809
|
-
|
|
5021
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5022
|
+
_this.loggerService.info("storageSchemaService register", { key: key });
|
|
4810
5023
|
_this.registry = _this.registry.register(key, value);
|
|
4811
5024
|
};
|
|
4812
5025
|
/**
|
|
@@ -4815,7 +5028,8 @@ var StorageSchemaService = /** @class */ (function () {
|
|
|
4815
5028
|
* @returns {IStorageSchema} The retrieved schema.
|
|
4816
5029
|
*/
|
|
4817
5030
|
this.get = function (key) {
|
|
4818
|
-
|
|
5031
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5032
|
+
_this.loggerService.info("storageSchemaService get", { key: key });
|
|
4819
5033
|
return _this.registry.get(key);
|
|
4820
5034
|
};
|
|
4821
5035
|
}
|
|
@@ -4849,9 +5063,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4849
5063
|
return __generator(this, function (_a) {
|
|
4850
5064
|
switch (_a.label) {
|
|
4851
5065
|
case 0:
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
5066
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5067
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " _createEmbedding"), {
|
|
5068
|
+
id: item.id,
|
|
5069
|
+
});
|
|
4855
5070
|
return [4 /*yield*/, this.params.createIndex(item)];
|
|
4856
5071
|
case 1:
|
|
4857
5072
|
index = _a.sent();
|
|
@@ -4874,7 +5089,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4874
5089
|
return __generator(this, function (_a) {
|
|
4875
5090
|
switch (_a.label) {
|
|
4876
5091
|
case 0:
|
|
4877
|
-
|
|
5092
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5093
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " waitForInit"));
|
|
4878
5094
|
if (!this.params.getData) {
|
|
4879
5095
|
return [2 /*return*/];
|
|
4880
5096
|
}
|
|
@@ -4912,10 +5128,11 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4912
5128
|
return __generator(this, function (_c) {
|
|
4913
5129
|
switch (_c.label) {
|
|
4914
5130
|
case 0:
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
5131
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5132
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " take"), {
|
|
5133
|
+
search: search,
|
|
5134
|
+
total: total,
|
|
5135
|
+
});
|
|
4919
5136
|
indexed = new functoolsKit.SortedArray();
|
|
4920
5137
|
return [4 /*yield*/, this.params.createEmbedding(search)];
|
|
4921
5138
|
case 1:
|
|
@@ -4946,9 +5163,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4946
5163
|
})))];
|
|
4947
5164
|
case 2:
|
|
4948
5165
|
_c.sent();
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
5166
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5167
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " take indexed"), {
|
|
5168
|
+
indexed: indexed.getEntries(),
|
|
5169
|
+
});
|
|
4952
5170
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onSearch) {
|
|
4953
5171
|
(_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onSearch(search, indexed, this.params.clientId, this.params.storageName);
|
|
4954
5172
|
}
|
|
@@ -4985,9 +5203,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4985
5203
|
return __generator(this, function (_c) {
|
|
4986
5204
|
switch (_c.label) {
|
|
4987
5205
|
case 0:
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
5206
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5207
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " upsert"), {
|
|
5208
|
+
item: item,
|
|
5209
|
+
});
|
|
4991
5210
|
this._itemMap.set(item.id, item);
|
|
4992
5211
|
this._createEmbedding.clear(item.id);
|
|
4993
5212
|
return [4 /*yield*/, this._createEmbedding(item)];
|
|
@@ -5024,9 +5243,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5024
5243
|
return __generator(this, function (_c) {
|
|
5025
5244
|
switch (_c.label) {
|
|
5026
5245
|
case 0:
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5246
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5247
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " remove"), {
|
|
5248
|
+
id: itemId,
|
|
5249
|
+
});
|
|
5030
5250
|
this._itemMap.delete(itemId);
|
|
5031
5251
|
this._createEmbedding.clear(itemId);
|
|
5032
5252
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onUpdate) {
|
|
@@ -5058,7 +5278,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5058
5278
|
return __generator(this, function (_a) {
|
|
5059
5279
|
switch (_a.label) {
|
|
5060
5280
|
case 0:
|
|
5061
|
-
|
|
5281
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5282
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " clear"));
|
|
5062
5283
|
this._itemMap.clear();
|
|
5063
5284
|
this._createEmbedding.clear();
|
|
5064
5285
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
@@ -5088,9 +5309,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5088
5309
|
return __generator(this, function (_b) {
|
|
5089
5310
|
switch (_b.label) {
|
|
5090
5311
|
case 0:
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5312
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5313
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " get"), {
|
|
5314
|
+
id: itemId,
|
|
5315
|
+
});
|
|
5094
5316
|
result = (_a = this._itemMap.get(itemId)) !== null && _a !== void 0 ? _a : null;
|
|
5095
5317
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5096
5318
|
type: "get",
|
|
@@ -5123,7 +5345,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5123
5345
|
return __generator(this, function (_d) {
|
|
5124
5346
|
switch (_d.label) {
|
|
5125
5347
|
case 0:
|
|
5126
|
-
|
|
5348
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5349
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " list"));
|
|
5127
5350
|
if (!filter) {
|
|
5128
5351
|
return [2 /*return*/, __spreadArray([], __read(this._itemMap.values()), false)];
|
|
5129
5352
|
}
|
|
@@ -5168,16 +5391,18 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5168
5391
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5169
5392
|
var _a;
|
|
5170
5393
|
return __generator(this, function (_b) {
|
|
5171
|
-
|
|
5394
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5395
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " dispose"));
|
|
5172
5396
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5173
5397
|
this.params.callbacks.onDispose(this.params.clientId, this.params.storageName);
|
|
5174
5398
|
}
|
|
5175
5399
|
return [2 /*return*/];
|
|
5176
5400
|
});
|
|
5177
5401
|
}); };
|
|
5178
|
-
|
|
5179
|
-
params
|
|
5180
|
-
|
|
5402
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5403
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " CTOR"), {
|
|
5404
|
+
params: params,
|
|
5405
|
+
});
|
|
5181
5406
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5182
5407
|
this.params.callbacks.onInit(this.params.clientId, this.params.storageName);
|
|
5183
5408
|
}
|
|
@@ -5244,11 +5469,12 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5244
5469
|
return __generator(this, function (_a) {
|
|
5245
5470
|
switch (_a.label) {
|
|
5246
5471
|
case 0:
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5472
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5473
|
+
this.loggerService.info("storageConnectionService take", {
|
|
5474
|
+
search: search,
|
|
5475
|
+
total: total,
|
|
5476
|
+
score: score,
|
|
5477
|
+
});
|
|
5252
5478
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5253
5479
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5254
5480
|
case 1:
|
|
@@ -5268,9 +5494,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5268
5494
|
return __generator(this, function (_a) {
|
|
5269
5495
|
switch (_a.label) {
|
|
5270
5496
|
case 0:
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5497
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5498
|
+
this.loggerService.info("storageConnectionService upsert", {
|
|
5499
|
+
item: item,
|
|
5500
|
+
});
|
|
5274
5501
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5275
5502
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5276
5503
|
case 1:
|
|
@@ -5290,9 +5517,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5290
5517
|
return __generator(this, function (_a) {
|
|
5291
5518
|
switch (_a.label) {
|
|
5292
5519
|
case 0:
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5520
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5521
|
+
this.loggerService.info("storageConnectionService remove", {
|
|
5522
|
+
itemId: itemId,
|
|
5523
|
+
});
|
|
5296
5524
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5297
5525
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5298
5526
|
case 1:
|
|
@@ -5312,9 +5540,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5312
5540
|
return __generator(this, function (_a) {
|
|
5313
5541
|
switch (_a.label) {
|
|
5314
5542
|
case 0:
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5543
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5544
|
+
this.loggerService.info("storageConnectionService get", {
|
|
5545
|
+
itemId: itemId,
|
|
5546
|
+
});
|
|
5318
5547
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5319
5548
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5320
5549
|
case 1:
|
|
@@ -5334,7 +5563,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5334
5563
|
return __generator(this, function (_a) {
|
|
5335
5564
|
switch (_a.label) {
|
|
5336
5565
|
case 0:
|
|
5337
|
-
|
|
5566
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5567
|
+
this.loggerService.info("storageConnectionService list");
|
|
5338
5568
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5339
5569
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5340
5570
|
case 1:
|
|
@@ -5353,7 +5583,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5353
5583
|
return __generator(this, function (_a) {
|
|
5354
5584
|
switch (_a.label) {
|
|
5355
5585
|
case 0:
|
|
5356
|
-
|
|
5586
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5587
|
+
this.loggerService.info("storageConnectionService clear");
|
|
5357
5588
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5358
5589
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5359
5590
|
case 1:
|
|
@@ -5372,7 +5603,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5372
5603
|
return __generator(this, function (_a) {
|
|
5373
5604
|
switch (_a.label) {
|
|
5374
5605
|
case 0:
|
|
5375
|
-
|
|
5606
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5607
|
+
this.loggerService.info("storageConnectionService dispose");
|
|
5376
5608
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.storageName);
|
|
5377
5609
|
if (!this.getStorage.has(key)) {
|
|
5378
5610
|
return [2 /*return*/];
|
|
@@ -5416,14 +5648,15 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5416
5648
|
return __generator(this, function (_a) {
|
|
5417
5649
|
switch (_a.label) {
|
|
5418
5650
|
case 0:
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5651
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5652
|
+
this.loggerService.info("storagePublicService take", {
|
|
5653
|
+
methodName: methodName,
|
|
5654
|
+
search: search,
|
|
5655
|
+
total: total,
|
|
5656
|
+
clientId: clientId,
|
|
5657
|
+
storageName: storageName,
|
|
5658
|
+
score: score,
|
|
5659
|
+
});
|
|
5427
5660
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5428
5661
|
return __generator(this, function (_a) {
|
|
5429
5662
|
switch (_a.label) {
|
|
@@ -5453,11 +5686,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5453
5686
|
return __generator(this, function (_a) {
|
|
5454
5687
|
switch (_a.label) {
|
|
5455
5688
|
case 0:
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5689
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5690
|
+
this.loggerService.info("storagePublicService upsert", {
|
|
5691
|
+
item: item,
|
|
5692
|
+
clientId: clientId,
|
|
5693
|
+
storageName: storageName,
|
|
5694
|
+
});
|
|
5461
5695
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5462
5696
|
return __generator(this, function (_a) {
|
|
5463
5697
|
switch (_a.label) {
|
|
@@ -5487,11 +5721,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5487
5721
|
return __generator(this, function (_a) {
|
|
5488
5722
|
switch (_a.label) {
|
|
5489
5723
|
case 0:
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5724
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5725
|
+
this.loggerService.info("storagePublicService remove", {
|
|
5726
|
+
itemId: itemId,
|
|
5727
|
+
clientId: clientId,
|
|
5728
|
+
storageName: storageName,
|
|
5729
|
+
});
|
|
5495
5730
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5496
5731
|
return __generator(this, function (_a) {
|
|
5497
5732
|
switch (_a.label) {
|
|
@@ -5521,12 +5756,13 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5521
5756
|
return __generator(this, function (_a) {
|
|
5522
5757
|
switch (_a.label) {
|
|
5523
5758
|
case 0:
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5759
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5760
|
+
this.loggerService.info("storagePublicService get", {
|
|
5761
|
+
methodName: methodName,
|
|
5762
|
+
itemId: itemId,
|
|
5763
|
+
clientId: clientId,
|
|
5764
|
+
storageName: storageName,
|
|
5765
|
+
});
|
|
5530
5766
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5531
5767
|
return __generator(this, function (_a) {
|
|
5532
5768
|
switch (_a.label) {
|
|
@@ -5556,11 +5792,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5556
5792
|
return __generator(this, function (_a) {
|
|
5557
5793
|
switch (_a.label) {
|
|
5558
5794
|
case 0:
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5795
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5796
|
+
this.loggerService.info("storagePublicService list", {
|
|
5797
|
+
methodName: methodName,
|
|
5798
|
+
clientId: clientId,
|
|
5799
|
+
storageName: storageName,
|
|
5800
|
+
});
|
|
5564
5801
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5565
5802
|
return __generator(this, function (_a) {
|
|
5566
5803
|
switch (_a.label) {
|
|
@@ -5589,11 +5826,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5589
5826
|
return __generator(this, function (_a) {
|
|
5590
5827
|
switch (_a.label) {
|
|
5591
5828
|
case 0:
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5829
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5830
|
+
this.loggerService.info("storagePublicService clear", {
|
|
5831
|
+
methodName: methodName,
|
|
5832
|
+
clientId: clientId,
|
|
5833
|
+
storageName: storageName,
|
|
5834
|
+
});
|
|
5597
5835
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5598
5836
|
return __generator(this, function (_a) {
|
|
5599
5837
|
switch (_a.label) {
|
|
@@ -5624,10 +5862,11 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5624
5862
|
return __generator(this, function (_a) {
|
|
5625
5863
|
switch (_a.label) {
|
|
5626
5864
|
case 0:
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5865
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5866
|
+
this.loggerService.info("storagePublicService dispose", {
|
|
5867
|
+
clientId: clientId,
|
|
5868
|
+
storageName: storageName,
|
|
5869
|
+
});
|
|
5631
5870
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5632
5871
|
return __generator(this, function (_a) {
|
|
5633
5872
|
switch (_a.label) {
|
|
@@ -5667,10 +5906,11 @@ var StorageValidationService = /** @class */ (function () {
|
|
|
5667
5906
|
* @throws {Error} If the storage already exists.
|
|
5668
5907
|
*/
|
|
5669
5908
|
this.addStorage = function (storageName, storageSchema) {
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5909
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5910
|
+
_this.loggerService.info("storageValidationService addStorage", {
|
|
5911
|
+
storageName: storageName,
|
|
5912
|
+
storageSchema: storageSchema,
|
|
5913
|
+
});
|
|
5674
5914
|
if (_this._storageMap.has(storageName)) {
|
|
5675
5915
|
throw new Error("storage-swarm storage ".concat(storageName, " already exist"));
|
|
5676
5916
|
}
|
|
@@ -5686,10 +5926,11 @@ var StorageValidationService = /** @class */ (function () {
|
|
|
5686
5926
|
var _b = __read(_a, 1), storageName = _b[0];
|
|
5687
5927
|
return storageName;
|
|
5688
5928
|
}, function (storageName, source) {
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5929
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5930
|
+
_this.loggerService.info("storageValidationService validate", {
|
|
5931
|
+
storageName: storageName,
|
|
5932
|
+
source: source,
|
|
5933
|
+
});
|
|
5693
5934
|
var storage = _this._storageMap.get(storageName);
|
|
5694
5935
|
if (!storage) {
|
|
5695
5936
|
throw new Error("storage-swarm storage ".concat(storageName, " not found source=").concat(source));
|
|
@@ -5716,10 +5957,11 @@ var EmbeddingValidationService = /** @class */ (function () {
|
|
|
5716
5957
|
* @throws Will throw an error if the embedding already exists.
|
|
5717
5958
|
*/
|
|
5718
5959
|
this.addEmbedding = function (embeddingName, embeddingSchema) {
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5960
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5961
|
+
_this.loggerService.info("embeddingValidationService addEmbedding", {
|
|
5962
|
+
embeddingName: embeddingName,
|
|
5963
|
+
embeddingSchema: embeddingSchema,
|
|
5964
|
+
});
|
|
5723
5965
|
if (_this._embeddingMap.has(embeddingName)) {
|
|
5724
5966
|
throw new Error("agent-swarm embedding ".concat(embeddingName, " already exist"));
|
|
5725
5967
|
}
|
|
@@ -5735,10 +5977,11 @@ var EmbeddingValidationService = /** @class */ (function () {
|
|
|
5735
5977
|
var _b = __read(_a, 1), embeddingName = _b[0];
|
|
5736
5978
|
return embeddingName;
|
|
5737
5979
|
}, function (embeddingName, source) {
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5980
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5981
|
+
_this.loggerService.info("embeddingValidationService validate", {
|
|
5982
|
+
embeddingName: embeddingName,
|
|
5983
|
+
source: source,
|
|
5984
|
+
});
|
|
5742
5985
|
if (!_this._embeddingMap.has(embeddingName)) {
|
|
5743
5986
|
throw new Error("agent-swarm embedding ".concat(embeddingName, " not found source=").concat(source));
|
|
5744
5987
|
}
|
|
@@ -5762,7 +6005,8 @@ var StateSchemaService = /** @class */ (function () {
|
|
|
5762
6005
|
* @param {IStateSchema} value - The schema to register.
|
|
5763
6006
|
*/
|
|
5764
6007
|
this.register = function (key, value) {
|
|
5765
|
-
|
|
6008
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6009
|
+
_this.loggerService.info("stateSchemaService register", { key: key });
|
|
5766
6010
|
_this.registry = _this.registry.register(key, value);
|
|
5767
6011
|
};
|
|
5768
6012
|
/**
|
|
@@ -5771,7 +6015,8 @@ var StateSchemaService = /** @class */ (function () {
|
|
|
5771
6015
|
* @returns {IStateSchema} The retrieved schema.
|
|
5772
6016
|
*/
|
|
5773
6017
|
this.get = function (key) {
|
|
5774
|
-
|
|
6018
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6019
|
+
_this.loggerService.info("stateSchemaService get", { key: key });
|
|
5775
6020
|
return _this.registry.get(key);
|
|
5776
6021
|
};
|
|
5777
6022
|
}
|
|
@@ -5805,7 +6050,7 @@ var ClientState = /** @class */ (function () {
|
|
|
5805
6050
|
console.assert(payload, "agent-swarm ClientState write action undefined payload");
|
|
5806
6051
|
_a = this;
|
|
5807
6052
|
return [4 /*yield*/, payload(this._state)];
|
|
5808
|
-
case 1: return [2 /*return*/, _a._state = _b.sent()];
|
|
6053
|
+
case 1: return [2 /*return*/, (_a._state = _b.sent())];
|
|
5809
6054
|
case 2: throw new Error("agent-swarm ClientState unknown action");
|
|
5810
6055
|
}
|
|
5811
6056
|
});
|
|
@@ -5820,12 +6065,14 @@ var ClientState = /** @class */ (function () {
|
|
|
5820
6065
|
return __generator(this, function (_c) {
|
|
5821
6066
|
switch (_c.label) {
|
|
5822
6067
|
case 0:
|
|
5823
|
-
|
|
6068
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6069
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " waitForInit"));
|
|
5824
6070
|
_a = this;
|
|
5825
6071
|
return [4 /*yield*/, this.params.getState(this.params.clientId, this.params.stateName)];
|
|
5826
6072
|
case 1:
|
|
5827
6073
|
_a._state = _c.sent();
|
|
5828
|
-
|
|
6074
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6075
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " waitForInit output"), { initialState: this._state });
|
|
5829
6076
|
if ((_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onLoad) {
|
|
5830
6077
|
this.params.callbacks.onLoad(this._state, this.params.clientId, this.params.stateName);
|
|
5831
6078
|
}
|
|
@@ -5844,7 +6091,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5844
6091
|
return __generator(this, function (_b) {
|
|
5845
6092
|
switch (_b.label) {
|
|
5846
6093
|
case 0:
|
|
5847
|
-
|
|
6094
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6095
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " setState"));
|
|
5848
6096
|
return [4 /*yield*/, this.dispatch("write", function (currentState) { return __awaiter(_this, void 0, void 0, function () {
|
|
5849
6097
|
var _a, _b, middleware, e_1_1;
|
|
5850
6098
|
var e_1, _c;
|
|
@@ -5882,7 +6130,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5882
6130
|
}); })];
|
|
5883
6131
|
case 1:
|
|
5884
6132
|
_b.sent();
|
|
5885
|
-
|
|
6133
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6134
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " setState output"), { pendingState: this._state });
|
|
5886
6135
|
this.params.setState &&
|
|
5887
6136
|
this.params.setState(this._state, this.params.clientId, this.params.stateName);
|
|
5888
6137
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onWrite) {
|
|
@@ -5915,7 +6164,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5915
6164
|
return __generator(this, function (_b) {
|
|
5916
6165
|
switch (_b.label) {
|
|
5917
6166
|
case 0:
|
|
5918
|
-
|
|
6167
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6168
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " getState"));
|
|
5919
6169
|
return [4 /*yield*/, this.dispatch("read")];
|
|
5920
6170
|
case 1:
|
|
5921
6171
|
_b.sent();
|
|
@@ -5947,16 +6197,18 @@ var ClientState = /** @class */ (function () {
|
|
|
5947
6197
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5948
6198
|
var _a;
|
|
5949
6199
|
return __generator(this, function (_b) {
|
|
5950
|
-
|
|
6200
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6201
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " dispose"));
|
|
5951
6202
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5952
6203
|
this.params.callbacks.onDispose(this.params.clientId, this.params.stateName);
|
|
5953
6204
|
}
|
|
5954
6205
|
return [2 /*return*/];
|
|
5955
6206
|
});
|
|
5956
6207
|
}); };
|
|
5957
|
-
|
|
5958
|
-
params
|
|
5959
|
-
|
|
6208
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
6209
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " CTOR"), {
|
|
6210
|
+
params: params,
|
|
6211
|
+
});
|
|
5960
6212
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5961
6213
|
this.params.callbacks.onInit(this.params.clientId, this.params.stateName);
|
|
5962
6214
|
}
|
|
@@ -6065,7 +6317,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6065
6317
|
return __generator(this, function (_a) {
|
|
6066
6318
|
switch (_a.label) {
|
|
6067
6319
|
case 0:
|
|
6068
|
-
|
|
6320
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6321
|
+
this.loggerService.info("stateConnectionService setState");
|
|
6069
6322
|
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6070
6323
|
return [4 /*yield*/, state.waitForInit()];
|
|
6071
6324
|
case 1:
|
|
@@ -6084,7 +6337,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6084
6337
|
return __generator(this, function (_a) {
|
|
6085
6338
|
switch (_a.label) {
|
|
6086
6339
|
case 0:
|
|
6087
|
-
|
|
6340
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6341
|
+
this.loggerService.info("stateConnectionService getState");
|
|
6088
6342
|
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6089
6343
|
return [4 /*yield*/, state.waitForInit()];
|
|
6090
6344
|
case 1:
|
|
@@ -6103,7 +6357,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6103
6357
|
return __generator(this, function (_a) {
|
|
6104
6358
|
switch (_a.label) {
|
|
6105
6359
|
case 0:
|
|
6106
|
-
|
|
6360
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6361
|
+
this.loggerService.info("stateConnectionService dispose");
|
|
6107
6362
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.stateName);
|
|
6108
6363
|
if (!this.getStateRef.has(key)) {
|
|
6109
6364
|
return [2 /*return*/];
|
|
@@ -6145,11 +6400,12 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6145
6400
|
return __generator(this, function (_a) {
|
|
6146
6401
|
switch (_a.label) {
|
|
6147
6402
|
case 0:
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6403
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6404
|
+
this.loggerService.info("statePublicService setState", {
|
|
6405
|
+
methodName: methodName,
|
|
6406
|
+
clientId: clientId,
|
|
6407
|
+
stateName: stateName,
|
|
6408
|
+
});
|
|
6153
6409
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6154
6410
|
return __generator(this, function (_a) {
|
|
6155
6411
|
switch (_a.label) {
|
|
@@ -6180,10 +6436,11 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6180
6436
|
return __generator(this, function (_a) {
|
|
6181
6437
|
switch (_a.label) {
|
|
6182
6438
|
case 0:
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6439
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6440
|
+
this.loggerService.info("statePublicService getState", {
|
|
6441
|
+
clientId: clientId,
|
|
6442
|
+
stateName: stateName,
|
|
6443
|
+
});
|
|
6187
6444
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6188
6445
|
return __generator(this, function (_a) {
|
|
6189
6446
|
switch (_a.label) {
|
|
@@ -6214,11 +6471,12 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6214
6471
|
return __generator(this, function (_a) {
|
|
6215
6472
|
switch (_a.label) {
|
|
6216
6473
|
case 0:
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6474
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6475
|
+
this.loggerService.info("statePublicService dispose", {
|
|
6476
|
+
methodName: methodName,
|
|
6477
|
+
clientId: clientId,
|
|
6478
|
+
stateName: stateName,
|
|
6479
|
+
});
|
|
6222
6480
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6223
6481
|
return __generator(this, function (_a) {
|
|
6224
6482
|
switch (_a.label) {
|
|
@@ -6260,10 +6518,11 @@ var BusService = /** @class */ (function () {
|
|
|
6260
6518
|
* @param {(event: T) => void} fn - The callback function to handle the event.
|
|
6261
6519
|
*/
|
|
6262
6520
|
this.subscribe = function (clientId, source, fn) {
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6521
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6522
|
+
_this.loggerService.info("busService subscribe", {
|
|
6523
|
+
clientId: clientId,
|
|
6524
|
+
source: source,
|
|
6525
|
+
});
|
|
6267
6526
|
if (clientId === "*") {
|
|
6268
6527
|
_this._eventWildcardMap.set(source, true);
|
|
6269
6528
|
}
|
|
@@ -6279,10 +6538,11 @@ var BusService = /** @class */ (function () {
|
|
|
6279
6538
|
* @returns {Subscription} The subscription object.
|
|
6280
6539
|
*/
|
|
6281
6540
|
this.once = function (clientId, source, filterFn, fn) {
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6541
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6542
|
+
_this.loggerService.info("busService once", {
|
|
6543
|
+
clientId: clientId,
|
|
6544
|
+
source: source,
|
|
6545
|
+
});
|
|
6286
6546
|
if (clientId === "*") {
|
|
6287
6547
|
_this._eventWildcardMap.set(source, true);
|
|
6288
6548
|
}
|
|
@@ -6299,10 +6559,11 @@ var BusService = /** @class */ (function () {
|
|
|
6299
6559
|
return __generator(this, function (_a) {
|
|
6300
6560
|
switch (_a.label) {
|
|
6301
6561
|
case 0:
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6562
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6563
|
+
this.loggerService.info("busService emit", {
|
|
6564
|
+
clientId: clientId,
|
|
6565
|
+
event: event,
|
|
6566
|
+
});
|
|
6306
6567
|
if (!this.sessionValidationService.hasSession(clientId)) {
|
|
6307
6568
|
return [2 /*return*/];
|
|
6308
6569
|
}
|
|
@@ -6327,9 +6588,10 @@ var BusService = /** @class */ (function () {
|
|
|
6327
6588
|
*/
|
|
6328
6589
|
this.dispose = function (clientId) {
|
|
6329
6590
|
var e_1, _a;
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6591
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6592
|
+
_this.loggerService.info("busService dispose", {
|
|
6593
|
+
clientId: clientId,
|
|
6594
|
+
});
|
|
6333
6595
|
try {
|
|
6334
6596
|
for (var _b = __values(_this._eventSourceSet), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6335
6597
|
var source = _c.value;
|
|
@@ -6453,9 +6715,10 @@ init();
|
|
|
6453
6715
|
* @returns {string} The name of the added agent.
|
|
6454
6716
|
*/
|
|
6455
6717
|
var addAgent = function (agentSchema) {
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6718
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6719
|
+
swarm.loggerService.log("function addAgent", {
|
|
6720
|
+
agentSchema: agentSchema,
|
|
6721
|
+
});
|
|
6459
6722
|
swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
|
|
6460
6723
|
swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
|
|
6461
6724
|
return agentSchema.agentName;
|
|
@@ -6469,9 +6732,10 @@ var addAgent = function (agentSchema) {
|
|
|
6469
6732
|
* @returns {string} The name of the completion that was added.
|
|
6470
6733
|
*/
|
|
6471
6734
|
var addCompletion = function (completionSchema) {
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6735
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6736
|
+
swarm.loggerService.log("function addCompletion", {
|
|
6737
|
+
completionSchema: completionSchema,
|
|
6738
|
+
});
|
|
6475
6739
|
swarm.completionValidationService.addCompletion(completionSchema.completionName);
|
|
6476
6740
|
swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
|
|
6477
6741
|
return completionSchema.completionName;
|
|
@@ -6484,9 +6748,10 @@ var addCompletion = function (completionSchema) {
|
|
|
6484
6748
|
* @returns {string} The name of the added swarm.
|
|
6485
6749
|
*/
|
|
6486
6750
|
var addSwarm = function (swarmSchema) {
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6751
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6752
|
+
swarm.loggerService.log("function addSwarm", {
|
|
6753
|
+
swarmSchema: swarmSchema,
|
|
6754
|
+
});
|
|
6490
6755
|
swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
|
|
6491
6756
|
swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
|
|
6492
6757
|
return swarmSchema.swarmName;
|
|
@@ -6500,9 +6765,10 @@ var addSwarm = function (swarmSchema) {
|
|
|
6500
6765
|
* @returns {string} The name of the tool that was added.
|
|
6501
6766
|
*/
|
|
6502
6767
|
var addTool = function (toolSchema) {
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6768
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6769
|
+
swarm.loggerService.log("function addTool", {
|
|
6770
|
+
toolSchema: toolSchema,
|
|
6771
|
+
});
|
|
6506
6772
|
swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
|
|
6507
6773
|
swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
|
|
6508
6774
|
return toolSchema.toolName;
|
|
@@ -6515,9 +6781,10 @@ var addTool = function (toolSchema) {
|
|
|
6515
6781
|
* @returns {string} The name of the added state.
|
|
6516
6782
|
*/
|
|
6517
6783
|
var addState = function (stateSchema) {
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6785
|
+
swarm.loggerService.log("function addState", {
|
|
6786
|
+
stateSchema: stateSchema,
|
|
6787
|
+
});
|
|
6521
6788
|
swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
6522
6789
|
if (stateSchema.shared) {
|
|
6523
6790
|
swarm.stateConnectionService
|
|
@@ -6534,9 +6801,10 @@ var addState = function (stateSchema) {
|
|
|
6534
6801
|
* @returns {string} The name of the added embedding.
|
|
6535
6802
|
*/
|
|
6536
6803
|
var addEmbedding = function (embeddingSchema) {
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6804
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6805
|
+
swarm.loggerService.log("function addEmbedding", {
|
|
6806
|
+
embeddingSchema: embeddingSchema,
|
|
6807
|
+
});
|
|
6540
6808
|
swarm.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
|
|
6541
6809
|
swarm.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
|
|
6542
6810
|
return embeddingSchema.embeddingName;
|
|
@@ -6549,9 +6817,10 @@ var addEmbedding = function (embeddingSchema) {
|
|
|
6549
6817
|
* @returns {string} The name of the added storage.
|
|
6550
6818
|
*/
|
|
6551
6819
|
var addStorage = function (storageSchema) {
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6820
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6821
|
+
swarm.loggerService.log("function addStorage", {
|
|
6822
|
+
storageSchema: storageSchema,
|
|
6823
|
+
});
|
|
6555
6824
|
swarm.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
|
|
6556
6825
|
swarm.storageSchemaService.register(storageSchema.storageName, storageSchema);
|
|
6557
6826
|
if (storageSchema.shared) {
|
|
@@ -6575,12 +6844,13 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6575
6844
|
return __generator(this, function (_a) {
|
|
6576
6845
|
switch (_a.label) {
|
|
6577
6846
|
case 0:
|
|
6578
|
-
methodName =
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6847
|
+
methodName = "function commitSystemMessage";
|
|
6848
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6849
|
+
swarm.loggerService.log("function commitSystemMessage", {
|
|
6850
|
+
content: content,
|
|
6851
|
+
clientId: clientId,
|
|
6852
|
+
agentName: agentName,
|
|
6853
|
+
});
|
|
6584
6854
|
swarm.agentValidationService.validate(agentName, "commitUserMessage");
|
|
6585
6855
|
swarm.sessionValidationService.validate(clientId, "commitUserMessage");
|
|
6586
6856
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -6589,11 +6859,12 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6589
6859
|
case 1:
|
|
6590
6860
|
currentAgentName = _a.sent();
|
|
6591
6861
|
if (currentAgentName !== agentName) {
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6862
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6863
|
+
swarm.loggerService.log('function "commitUserMessage" skipped due to the agent change', {
|
|
6864
|
+
currentAgentName: currentAgentName,
|
|
6865
|
+
agentName: agentName,
|
|
6866
|
+
clientId: clientId,
|
|
6867
|
+
});
|
|
6597
6868
|
return [2 /*return*/];
|
|
6598
6869
|
}
|
|
6599
6870
|
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
@@ -6617,9 +6888,10 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
6617
6888
|
switch (_a.label) {
|
|
6618
6889
|
case 0:
|
|
6619
6890
|
methodName = "function getAgentName";
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6891
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6892
|
+
swarm.loggerService.log("function getAgentName", {
|
|
6893
|
+
clientId: clientId,
|
|
6894
|
+
});
|
|
6623
6895
|
swarm.sessionValidationService.validate(clientId, "getAgentName");
|
|
6624
6896
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6625
6897
|
swarm.swarmValidationService.validate(swarmName, "getAgentName");
|
|
@@ -6640,10 +6912,11 @@ var SCHEDULED_DELAY$1 = 1000;
|
|
|
6640
6912
|
*/
|
|
6641
6913
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
6642
6914
|
var methodName = "function makeConnection";
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6915
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6916
|
+
swarm.loggerService.log("function makeConnection", {
|
|
6917
|
+
clientId: clientId,
|
|
6918
|
+
swarmName: swarmName,
|
|
6919
|
+
});
|
|
6647
6920
|
swarm.swarmValidationService.validate(swarmName, "makeConnection");
|
|
6648
6921
|
swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
6649
6922
|
var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
|
|
@@ -6837,10 +7110,11 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
|
|
|
6837
7110
|
switch (_a.label) {
|
|
6838
7111
|
case 0:
|
|
6839
7112
|
methodName = "function changeAgent";
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
7113
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7114
|
+
swarm.loggerService.log("function changeAgent", {
|
|
7115
|
+
agentName: agentName,
|
|
7116
|
+
clientId: clientId,
|
|
7117
|
+
});
|
|
6844
7118
|
return [4 /*yield*/, createChangeAgent(clientId)];
|
|
6845
7119
|
case 1:
|
|
6846
7120
|
run = _a.sent();
|
|
@@ -6868,10 +7142,11 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6868
7142
|
return __generator(this, function (_a) {
|
|
6869
7143
|
switch (_a.label) {
|
|
6870
7144
|
case 0:
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
7145
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7146
|
+
swarm.loggerService.log("function disposeConnection", {
|
|
7147
|
+
clientId: clientId,
|
|
7148
|
+
swarmName: swarmName,
|
|
7149
|
+
});
|
|
6875
7150
|
swarm.swarmValidationService.validate(swarmName, "disposeConnection");
|
|
6876
7151
|
swarm.sessionValidationService.removeSession(clientId);
|
|
6877
7152
|
swarm.busService.dispose(clientId);
|
|
@@ -7002,12 +7277,13 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
7002
7277
|
case 0:
|
|
7003
7278
|
methodName = "function complete";
|
|
7004
7279
|
executionId = functoolsKit.randomString();
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7280
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7281
|
+
swarm.loggerService.log("function complete", {
|
|
7282
|
+
content: content,
|
|
7283
|
+
clientId: clientId,
|
|
7284
|
+
executionId: executionId,
|
|
7285
|
+
swarmName: swarmName,
|
|
7286
|
+
});
|
|
7011
7287
|
return [4 /*yield*/, createComplete(clientId, swarmName)];
|
|
7012
7288
|
case 1:
|
|
7013
7289
|
run = _a.sent();
|
|
@@ -7040,11 +7316,12 @@ var SCHEDULED_DELAY = 1000;
|
|
|
7040
7316
|
var session = function (clientId, swarmName) {
|
|
7041
7317
|
var methodName = "function session";
|
|
7042
7318
|
var executionId = functoolsKit.randomString();
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7319
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7320
|
+
swarm.loggerService.log("function session", {
|
|
7321
|
+
clientId: clientId,
|
|
7322
|
+
swarmName: swarmName,
|
|
7323
|
+
executionId: executionId,
|
|
7324
|
+
});
|
|
7048
7325
|
swarm.swarmValidationService.validate(swarmName, "session");
|
|
7049
7326
|
swarm.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
7050
7327
|
return {
|
|
@@ -7194,9 +7471,10 @@ var getRawHistory = function (clientId_1) {
|
|
|
7194
7471
|
return __generator(this, function (_a) {
|
|
7195
7472
|
switch (_a.label) {
|
|
7196
7473
|
case 0:
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7474
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7475
|
+
swarm.loggerService.log("function getRawHistory", {
|
|
7476
|
+
clientId: clientId,
|
|
7477
|
+
});
|
|
7200
7478
|
swarm.sessionValidationService.validate(clientId, "getRawHistory");
|
|
7201
7479
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7202
7480
|
swarm.swarmValidationService.validate(swarmName, "getRawHistory");
|
|
@@ -7225,10 +7503,11 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
7225
7503
|
switch (_a.label) {
|
|
7226
7504
|
case 0:
|
|
7227
7505
|
methodName = "function getAgentHistory";
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7506
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7507
|
+
swarm.loggerService.log("function getAgentHistory", {
|
|
7508
|
+
clientId: clientId,
|
|
7509
|
+
agentName: agentName,
|
|
7510
|
+
});
|
|
7232
7511
|
swarm.agentValidationService.validate(agentName, "getAgentHistory");
|
|
7233
7512
|
prompt = swarm.agentSchemaService.get(agentName).prompt;
|
|
7234
7513
|
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
|
|
@@ -7247,9 +7526,10 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
7247
7526
|
var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7248
7527
|
var swarmName;
|
|
7249
7528
|
return __generator(this, function (_a) {
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7529
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7530
|
+
swarm.loggerService.log("function getSessionMode", {
|
|
7531
|
+
clientId: clientId,
|
|
7532
|
+
});
|
|
7253
7533
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7254
7534
|
swarm.swarmValidationService.validate(swarmName, "getSessionMode");
|
|
7255
7535
|
return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
|
|
@@ -7269,14 +7549,15 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7269
7549
|
return __generator(this, function (_a) {
|
|
7270
7550
|
switch (_a.label) {
|
|
7271
7551
|
case 0:
|
|
7272
|
-
methodName =
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7552
|
+
methodName = "function commitToolOutput";
|
|
7553
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7554
|
+
swarm.loggerService.log("function commitToolOutput", {
|
|
7555
|
+
toolId: toolId,
|
|
7556
|
+
content: content,
|
|
7557
|
+
clientId: clientId,
|
|
7558
|
+
agentName: agentName,
|
|
7559
|
+
methodName: methodName,
|
|
7560
|
+
});
|
|
7280
7561
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7281
7562
|
swarm.sessionValidationService.validate(clientId, "commitToolOutput");
|
|
7282
7563
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7285,12 +7566,13 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7285
7566
|
case 1:
|
|
7286
7567
|
currentAgentName = _a.sent();
|
|
7287
7568
|
if (currentAgentName !== agentName) {
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7569
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7570
|
+
swarm.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
|
|
7571
|
+
toolId: toolId,
|
|
7572
|
+
currentAgentName: currentAgentName,
|
|
7573
|
+
agentName: agentName,
|
|
7574
|
+
clientId: clientId,
|
|
7575
|
+
});
|
|
7294
7576
|
return [2 /*return*/];
|
|
7295
7577
|
}
|
|
7296
7578
|
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
@@ -7302,7 +7584,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7302
7584
|
}); };
|
|
7303
7585
|
|
|
7304
7586
|
/**
|
|
7305
|
-
* Commits a system message to the active agent in
|
|
7587
|
+
* Commits a system message to the active agent in the swarm.
|
|
7306
7588
|
*
|
|
7307
7589
|
* @param {string} content - The content of the system message.
|
|
7308
7590
|
* @param {string} clientId - The ID of the client.
|
|
@@ -7314,12 +7596,13 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7314
7596
|
return __generator(this, function (_a) {
|
|
7315
7597
|
switch (_a.label) {
|
|
7316
7598
|
case 0:
|
|
7317
|
-
methodName =
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7599
|
+
methodName = "function commitSystemMessage";
|
|
7600
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7601
|
+
swarm.loggerService.log("function commitSystemMessage", {
|
|
7602
|
+
content: content,
|
|
7603
|
+
clientId: clientId,
|
|
7604
|
+
agentName: agentName,
|
|
7605
|
+
});
|
|
7323
7606
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7324
7607
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
|
|
7325
7608
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7328,11 +7611,12 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7328
7611
|
case 1:
|
|
7329
7612
|
currentAgentName = _a.sent();
|
|
7330
7613
|
if (currentAgentName !== agentName) {
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7614
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7615
|
+
swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
7616
|
+
currentAgentName: currentAgentName,
|
|
7617
|
+
agentName: agentName,
|
|
7618
|
+
clientId: clientId,
|
|
7619
|
+
});
|
|
7336
7620
|
return [2 /*return*/];
|
|
7337
7621
|
}
|
|
7338
7622
|
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
@@ -7355,11 +7639,12 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7355
7639
|
return __generator(this, function (_a) {
|
|
7356
7640
|
switch (_a.label) {
|
|
7357
7641
|
case 0:
|
|
7358
|
-
methodName =
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7642
|
+
methodName = "function commitFlush";
|
|
7643
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7644
|
+
swarm.loggerService.log("function commitFlush", {
|
|
7645
|
+
clientId: clientId,
|
|
7646
|
+
agentName: agentName,
|
|
7647
|
+
});
|
|
7363
7648
|
swarm.agentValidationService.validate(agentName, "commitFlush");
|
|
7364
7649
|
swarm.sessionValidationService.validate(clientId, "commitFlush");
|
|
7365
7650
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7368,11 +7653,12 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7368
7653
|
case 1:
|
|
7369
7654
|
currentAgentName = _a.sent();
|
|
7370
7655
|
if (currentAgentName !== agentName) {
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7656
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7657
|
+
swarm.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
7658
|
+
currentAgentName: currentAgentName,
|
|
7659
|
+
agentName: agentName,
|
|
7660
|
+
clientId: clientId,
|
|
7661
|
+
});
|
|
7376
7662
|
return [2 /*return*/];
|
|
7377
7663
|
}
|
|
7378
7664
|
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
@@ -7399,13 +7685,14 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7399
7685
|
case 0:
|
|
7400
7686
|
methodName = "function execute";
|
|
7401
7687
|
executionId = functoolsKit.randomString();
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7688
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7689
|
+
swarm.loggerService.log("function execute", {
|
|
7690
|
+
content: content,
|
|
7691
|
+
clientId: clientId,
|
|
7692
|
+
agentName: agentName,
|
|
7693
|
+
methodName: methodName,
|
|
7694
|
+
executionId: executionId,
|
|
7695
|
+
});
|
|
7409
7696
|
swarm.agentValidationService.validate(agentName, "execute");
|
|
7410
7697
|
swarm.sessionValidationService.validate(clientId, "execute");
|
|
7411
7698
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7414,11 +7701,12 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7414
7701
|
case 1:
|
|
7415
7702
|
currentAgentName = _a.sent();
|
|
7416
7703
|
if (currentAgentName !== agentName) {
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7704
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7705
|
+
swarm.loggerService.log('function "execute" skipped due to the agent change', {
|
|
7706
|
+
currentAgentName: currentAgentName,
|
|
7707
|
+
agentName: agentName,
|
|
7708
|
+
clientId: clientId,
|
|
7709
|
+
});
|
|
7422
7710
|
return [2 /*return*/];
|
|
7423
7711
|
}
|
|
7424
7712
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -7452,11 +7740,12 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7452
7740
|
switch (_a.label) {
|
|
7453
7741
|
case 0:
|
|
7454
7742
|
methodName = "function emit";
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7743
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7744
|
+
swarm.loggerService.log("function emit", {
|
|
7745
|
+
content: content,
|
|
7746
|
+
clientId: clientId,
|
|
7747
|
+
agentName: agentName,
|
|
7748
|
+
});
|
|
7460
7749
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7461
7750
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
7462
7751
|
}
|
|
@@ -7468,11 +7757,12 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7468
7757
|
case 1:
|
|
7469
7758
|
currentAgentName = _a.sent();
|
|
7470
7759
|
if (currentAgentName !== agentName) {
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7760
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7761
|
+
swarm.loggerService.log('function "emit" skipped due to the agent change', {
|
|
7762
|
+
currentAgentName: currentAgentName,
|
|
7763
|
+
agentName: agentName,
|
|
7764
|
+
clientId: clientId,
|
|
7765
|
+
});
|
|
7476
7766
|
return [2 /*return*/];
|
|
7477
7767
|
}
|
|
7478
7768
|
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
@@ -7493,12 +7783,13 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
7493
7783
|
return __generator(this, function (_a) {
|
|
7494
7784
|
switch (_a.label) {
|
|
7495
7785
|
case 0:
|
|
7496
|
-
methodName =
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7786
|
+
methodName = "function commitToolOutputForce";
|
|
7787
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7788
|
+
swarm.loggerService.log("function commitToolOutputForce", {
|
|
7789
|
+
toolId: toolId,
|
|
7790
|
+
content: content,
|
|
7791
|
+
clientId: clientId,
|
|
7792
|
+
});
|
|
7502
7793
|
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
7503
7794
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7504
7795
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
@@ -7522,11 +7813,12 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
7522
7813
|
return __generator(this, function (_a) {
|
|
7523
7814
|
switch (_a.label) {
|
|
7524
7815
|
case 0:
|
|
7525
|
-
methodName =
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7816
|
+
methodName = "function commitSystemMessageForce";
|
|
7817
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7818
|
+
swarm.loggerService.log("function commitSystemMessageForce", {
|
|
7819
|
+
content: content,
|
|
7820
|
+
clientId: clientId,
|
|
7821
|
+
});
|
|
7530
7822
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
7531
7823
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7532
7824
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
@@ -7549,11 +7841,12 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
7549
7841
|
return __generator(this, function (_a) {
|
|
7550
7842
|
switch (_a.label) {
|
|
7551
7843
|
case 0:
|
|
7552
|
-
methodName =
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7844
|
+
methodName = "function commitFlushForce";
|
|
7845
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7846
|
+
swarm.loggerService.log("function commitFlushForce", {
|
|
7847
|
+
clientId: clientId,
|
|
7848
|
+
methodName: methodName,
|
|
7849
|
+
});
|
|
7557
7850
|
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
7558
7851
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7559
7852
|
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
@@ -7577,11 +7870,12 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
7577
7870
|
return __generator(this, function (_a) {
|
|
7578
7871
|
switch (_a.label) {
|
|
7579
7872
|
case 0:
|
|
7580
|
-
methodName =
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7873
|
+
methodName = "function commitSystemMessage";
|
|
7874
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7875
|
+
swarm.loggerService.log("function commitSystemMessage", {
|
|
7876
|
+
content: content,
|
|
7877
|
+
clientId: clientId,
|
|
7878
|
+
});
|
|
7585
7879
|
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
7586
7880
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7587
7881
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
@@ -7609,10 +7903,11 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7609
7903
|
switch (_a.label) {
|
|
7610
7904
|
case 0:
|
|
7611
7905
|
methodName = "function emitForce";
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7906
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7907
|
+
swarm.loggerService.log("function emitForce", {
|
|
7908
|
+
content: content,
|
|
7909
|
+
clientId: clientId,
|
|
7910
|
+
});
|
|
7616
7911
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7617
7912
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
7618
7913
|
}
|
|
@@ -7640,11 +7935,12 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
7640
7935
|
return __generator(this, function (_a) {
|
|
7641
7936
|
methodName = "function executeForce";
|
|
7642
7937
|
executionId = functoolsKit.randomString();
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7938
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7939
|
+
swarm.loggerService.log("function executeForce", {
|
|
7940
|
+
content: content,
|
|
7941
|
+
clientId: clientId,
|
|
7942
|
+
executionId: executionId,
|
|
7943
|
+
});
|
|
7648
7944
|
swarm.sessionValidationService.validate(clientId, "executeForce");
|
|
7649
7945
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7650
7946
|
swarm.swarmValidationService.validate(swarmName, "executeForce");
|
|
@@ -7686,9 +7982,10 @@ var validateClientId$d = function (clientId) {
|
|
|
7686
7982
|
* @param {(data: T) => void} fn - The callback function to execute when the event is received. The data payload is passed as an argument to this function.
|
|
7687
7983
|
*/
|
|
7688
7984
|
var listenEvent = function (clientId, topicName, fn) {
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7985
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7986
|
+
swarm.loggerService.log("function listenEvent", {
|
|
7987
|
+
clientId: clientId,
|
|
7988
|
+
});
|
|
7692
7989
|
if (DISALLOWED_EVENT_SOURCE_LIST$2.has(topicName)) {
|
|
7693
7990
|
throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
|
|
7694
7991
|
}
|
|
@@ -7723,9 +8020,10 @@ var validateClientId$c = function (clientId) {
|
|
|
7723
8020
|
* @param {(data: T) => void} fn - The callback function to execute when the event is received. The data payload is passed as an argument to this function.
|
|
7724
8021
|
*/
|
|
7725
8022
|
var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
8023
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8024
|
+
swarm.loggerService.log("function listenEventOnce", {
|
|
8025
|
+
clientId: clientId,
|
|
8026
|
+
});
|
|
7729
8027
|
if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
|
|
7730
8028
|
throw new Error("agent-swarm listenEventOnce topic is reserved topicName=".concat(topicName));
|
|
7731
8029
|
}
|
|
@@ -7751,9 +8049,10 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7751
8049
|
switch (_a.label) {
|
|
7752
8050
|
case 0:
|
|
7753
8051
|
methodName = "function getLastUserMessage";
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
8052
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8053
|
+
swarm.loggerService.log("function getLastUserMessage", {
|
|
8054
|
+
clientId: clientId,
|
|
8055
|
+
});
|
|
7757
8056
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7758
8057
|
case 1:
|
|
7759
8058
|
history = _a.sent();
|
|
@@ -7778,9 +8077,10 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7778
8077
|
switch (_a.label) {
|
|
7779
8078
|
case 0:
|
|
7780
8079
|
methodName = "function getUserHistory";
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
8080
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8081
|
+
swarm.loggerService.log("function getUserHistory", {
|
|
8082
|
+
clientId: clientId,
|
|
8083
|
+
});
|
|
7784
8084
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7785
8085
|
case 1:
|
|
7786
8086
|
history = _a.sent();
|
|
@@ -7804,9 +8104,10 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7804
8104
|
switch (_a.label) {
|
|
7805
8105
|
case 0:
|
|
7806
8106
|
methodName = "function getAssistantHistory";
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
8107
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8108
|
+
swarm.loggerService.log("function getAssistantHistory", {
|
|
8109
|
+
clientId: clientId,
|
|
8110
|
+
});
|
|
7810
8111
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7811
8112
|
case 1:
|
|
7812
8113
|
history = _a.sent();
|
|
@@ -7830,9 +8131,10 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
7830
8131
|
switch (_a.label) {
|
|
7831
8132
|
case 0:
|
|
7832
8133
|
methodName = "function getLastAssistantMessage";
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
8134
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8135
|
+
swarm.loggerService.log("function getLastAssistantMessage", {
|
|
8136
|
+
clientId: clientId,
|
|
8137
|
+
});
|
|
7836
8138
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7837
8139
|
case 1:
|
|
7838
8140
|
history = _a.sent();
|
|
@@ -7857,9 +8159,10 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
|
|
|
7857
8159
|
switch (_a.label) {
|
|
7858
8160
|
case 0:
|
|
7859
8161
|
methodName = "function getLastSystemMessage";
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
8162
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8163
|
+
swarm.loggerService.log("function getLastSystemMessage", {
|
|
8164
|
+
clientId: clientId,
|
|
8165
|
+
});
|
|
7863
8166
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7864
8167
|
case 1:
|
|
7865
8168
|
history = _a.sent();
|
|
@@ -7883,6 +8186,11 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
7883
8186
|
*/
|
|
7884
8187
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
7885
8188
|
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
|
|
8189
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8190
|
+
swarm.loggerService.log("function makeAutoDispose", {
|
|
8191
|
+
clientId: clientId,
|
|
8192
|
+
swarmName: swarmName,
|
|
8193
|
+
});
|
|
7886
8194
|
var isOk = true;
|
|
7887
8195
|
var unSource = functoolsKit.Source.fromInterval(1000)
|
|
7888
8196
|
.reduce(function (acm) {
|
|
@@ -7943,9 +8251,10 @@ var DISALLOWED_EVENT_SOURCE_LIST = new Set([
|
|
|
7943
8251
|
* @returns {boolean} - Returns true if the event was successfully emitted.
|
|
7944
8252
|
*/
|
|
7945
8253
|
var event = function (clientId, topicName, payload) {
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
8254
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8255
|
+
swarm.loggerService.log("function listenEvent", {
|
|
8256
|
+
clientId: clientId,
|
|
8257
|
+
});
|
|
7949
8258
|
if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
|
|
7950
8259
|
throw new Error("agent-swarm event topic is reserved topicName=".concat(topicName));
|
|
7951
8260
|
}
|
|
@@ -7968,11 +8277,12 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7968
8277
|
return __generator(this, function (_a) {
|
|
7969
8278
|
switch (_a.label) {
|
|
7970
8279
|
case 0:
|
|
7971
|
-
methodName =
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
8280
|
+
methodName = "function cancelOutput";
|
|
8281
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8282
|
+
swarm.loggerService.log("function cancelOutput", {
|
|
8283
|
+
clientId: clientId,
|
|
8284
|
+
agentName: agentName,
|
|
8285
|
+
});
|
|
7976
8286
|
swarm.agentValidationService.validate(agentName, "cancelOutput");
|
|
7977
8287
|
swarm.sessionValidationService.validate(clientId, "cancelOutput");
|
|
7978
8288
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7981,11 +8291,12 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7981
8291
|
case 1:
|
|
7982
8292
|
currentAgentName = _a.sent();
|
|
7983
8293
|
if (currentAgentName !== agentName) {
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
8294
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8295
|
+
swarm.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
8296
|
+
currentAgentName: currentAgentName,
|
|
8297
|
+
agentName: agentName,
|
|
8298
|
+
clientId: clientId,
|
|
8299
|
+
});
|
|
7989
8300
|
return [2 /*return*/];
|
|
7990
8301
|
}
|
|
7991
8302
|
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
@@ -8008,10 +8319,11 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
8008
8319
|
return __generator(this, function (_a) {
|
|
8009
8320
|
switch (_a.label) {
|
|
8010
8321
|
case 0:
|
|
8011
|
-
methodName =
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8322
|
+
methodName = "function cancelOutputForce";
|
|
8323
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8324
|
+
swarm.loggerService.log("function cancelOutputForce", {
|
|
8325
|
+
clientId: clientId,
|
|
8326
|
+
});
|
|
8015
8327
|
swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
|
|
8016
8328
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
8017
8329
|
swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
|
|
@@ -8306,13 +8618,14 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8306
8618
|
switch (_a.label) {
|
|
8307
8619
|
case 0:
|
|
8308
8620
|
methodName = "StorageUtils take";
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8621
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8622
|
+
swarm.loggerService.log("StorageUtils take", {
|
|
8623
|
+
search: payload.search,
|
|
8624
|
+
total: payload.total,
|
|
8625
|
+
clientId: payload.clientId,
|
|
8626
|
+
storageName: payload.storageName,
|
|
8627
|
+
score: payload.score,
|
|
8628
|
+
});
|
|
8316
8629
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8317
8630
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8318
8631
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
@@ -8337,11 +8650,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8337
8650
|
switch (_a.label) {
|
|
8338
8651
|
case 0:
|
|
8339
8652
|
methodName = "StorageUtils upsert";
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8653
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8654
|
+
swarm.loggerService.log("StorageUtils upsert", {
|
|
8655
|
+
item: payload.item,
|
|
8656
|
+
clientId: payload.clientId,
|
|
8657
|
+
storageName: payload.storageName,
|
|
8658
|
+
});
|
|
8345
8659
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8346
8660
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8347
8661
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
@@ -8365,11 +8679,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8365
8679
|
switch (_a.label) {
|
|
8366
8680
|
case 0:
|
|
8367
8681
|
methodName = "StorageUtils remove";
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8682
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8683
|
+
swarm.loggerService.log("StorageUtils remove", {
|
|
8684
|
+
itemId: payload.itemId,
|
|
8685
|
+
clientId: payload.clientId,
|
|
8686
|
+
storageName: payload.storageName,
|
|
8687
|
+
});
|
|
8373
8688
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8374
8689
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8375
8690
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
@@ -8394,11 +8709,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8394
8709
|
switch (_a.label) {
|
|
8395
8710
|
case 0:
|
|
8396
8711
|
methodName = "StorageUtils get";
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8712
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8713
|
+
swarm.loggerService.log("StorageUtils get", {
|
|
8714
|
+
itemId: payload.itemId,
|
|
8715
|
+
clientId: payload.clientId,
|
|
8716
|
+
storageName: payload.storageName,
|
|
8717
|
+
});
|
|
8402
8718
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8403
8719
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8404
8720
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
@@ -8423,10 +8739,11 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8423
8739
|
switch (_a.label) {
|
|
8424
8740
|
case 0:
|
|
8425
8741
|
methodName = "StorageUtils list";
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8742
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8743
|
+
swarm.loggerService.log("StorageUtils list", {
|
|
8744
|
+
clientId: payload.clientId,
|
|
8745
|
+
storageName: payload.storageName,
|
|
8746
|
+
});
|
|
8430
8747
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8431
8748
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8432
8749
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
@@ -8449,10 +8766,11 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8449
8766
|
switch (_a.label) {
|
|
8450
8767
|
case 0:
|
|
8451
8768
|
methodName = "StorageUtils clear";
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8769
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8770
|
+
swarm.loggerService.log("StorageUtils clear", {
|
|
8771
|
+
clientId: payload.clientId,
|
|
8772
|
+
storageName: payload.storageName,
|
|
8773
|
+
});
|
|
8456
8774
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8457
8775
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8458
8776
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
@@ -8490,10 +8808,11 @@ var StateUtils = /** @class */ (function () {
|
|
|
8490
8808
|
switch (_a.label) {
|
|
8491
8809
|
case 0:
|
|
8492
8810
|
methodName = "StateUtils getState";
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8811
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8812
|
+
swarm.loggerService.log("StateUtils getState", {
|
|
8813
|
+
clientId: payload.clientId,
|
|
8814
|
+
stateName: payload.stateName,
|
|
8815
|
+
});
|
|
8497
8816
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8498
8817
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
|
|
8499
8818
|
}
|
|
@@ -8520,10 +8839,11 @@ var StateUtils = /** @class */ (function () {
|
|
|
8520
8839
|
switch (_a.label) {
|
|
8521
8840
|
case 0:
|
|
8522
8841
|
methodName = "StateUtils setState";
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8842
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8843
|
+
swarm.loggerService.log("StateUtils setState", {
|
|
8844
|
+
clientId: payload.clientId,
|
|
8845
|
+
stateName: payload.stateName,
|
|
8846
|
+
});
|
|
8527
8847
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8528
8848
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
8529
8849
|
}
|
|
@@ -8553,7 +8873,8 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8553
8873
|
* @param {ILogger} logger - The logger instance to be used.
|
|
8554
8874
|
*/
|
|
8555
8875
|
this.useLogger = function (logger) {
|
|
8556
|
-
|
|
8876
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8877
|
+
swarm.loggerService.log("HistoryInstance useLogger");
|
|
8557
8878
|
swarm.loggerService.setLogger(logger);
|
|
8558
8879
|
};
|
|
8559
8880
|
}
|
|
@@ -8565,12 +8886,99 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8565
8886
|
*/
|
|
8566
8887
|
var Logger = new LoggerUtils();
|
|
8567
8888
|
|
|
8889
|
+
/**
|
|
8890
|
+
* Function that recursively flattens a nested object to array of entries.
|
|
8891
|
+
*/
|
|
8892
|
+
var objectFlat = function (data) {
|
|
8893
|
+
var result = [];
|
|
8894
|
+
var process = function (entries) {
|
|
8895
|
+
if (entries === void 0) { entries = []; }
|
|
8896
|
+
return entries.forEach(function (_a) {
|
|
8897
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8898
|
+
if (typeof value === "function") {
|
|
8899
|
+
return;
|
|
8900
|
+
}
|
|
8901
|
+
if (functoolsKit.isObject(value)) {
|
|
8902
|
+
result.push(["", ""]);
|
|
8903
|
+
result.push([key, ""]);
|
|
8904
|
+
process(Object.entries(value));
|
|
8905
|
+
result.push(["", ""]);
|
|
8906
|
+
return;
|
|
8907
|
+
}
|
|
8908
|
+
if (Array.isArray(value)) {
|
|
8909
|
+
result.push(["", ""]);
|
|
8910
|
+
result.push([key, ""]);
|
|
8911
|
+
process(value.map(function (value, idx) { return [String(idx + 1), value]; }));
|
|
8912
|
+
result.push(["", ""]);
|
|
8913
|
+
return;
|
|
8914
|
+
}
|
|
8915
|
+
result.push([key, String(value)]);
|
|
8916
|
+
});
|
|
8917
|
+
};
|
|
8918
|
+
process(Object.entries(data));
|
|
8919
|
+
return result;
|
|
8920
|
+
};
|
|
8921
|
+
|
|
8922
|
+
var LIST_SEPARATOR = Array.from({ length: 80 }, function () { return "-"; });
|
|
8923
|
+
/**
|
|
8924
|
+
* Utility class for schema-related operations.
|
|
8925
|
+
*/
|
|
8926
|
+
var SchemaUtils = /** @class */ (function () {
|
|
8927
|
+
function SchemaUtils() {
|
|
8928
|
+
/**
|
|
8929
|
+
* Serializes an object or an array of objects into a formatted string.
|
|
8930
|
+
*
|
|
8931
|
+
* @template T - The type of the object.
|
|
8932
|
+
* @param {T[] | T} data - The data to serialize.
|
|
8933
|
+
* @returns {string} The serialized string.
|
|
8934
|
+
*/
|
|
8935
|
+
this.serialize = function (data) {
|
|
8936
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8937
|
+
swarm.loggerService.log("SchemaUtils serialize", {
|
|
8938
|
+
data: data,
|
|
8939
|
+
});
|
|
8940
|
+
if (Array.isArray(data)) {
|
|
8941
|
+
return data
|
|
8942
|
+
.map(function (item) {
|
|
8943
|
+
return objectFlat(item)
|
|
8944
|
+
.map(function (_a) {
|
|
8945
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8946
|
+
return [GLOBAL_CONFIG.CC_NAME_TO_TITLE(key), value];
|
|
8947
|
+
})
|
|
8948
|
+
.map(function (_a) {
|
|
8949
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8950
|
+
return "".concat(key, ": ").concat(value);
|
|
8951
|
+
})
|
|
8952
|
+
.join("\n");
|
|
8953
|
+
})
|
|
8954
|
+
.join("\n".concat(LIST_SEPARATOR, "\n"));
|
|
8955
|
+
}
|
|
8956
|
+
return objectFlat(data)
|
|
8957
|
+
.map(function (_a) {
|
|
8958
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8959
|
+
return [GLOBAL_CONFIG.CC_NAME_TO_TITLE(key), value];
|
|
8960
|
+
})
|
|
8961
|
+
.map(function (_a) {
|
|
8962
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
8963
|
+
return "".concat(key, ": ").concat(value);
|
|
8964
|
+
})
|
|
8965
|
+
.join("\n");
|
|
8966
|
+
};
|
|
8967
|
+
}
|
|
8968
|
+
return SchemaUtils;
|
|
8969
|
+
}());
|
|
8970
|
+
/**
|
|
8971
|
+
* An instance of the SchemaUtils class.
|
|
8972
|
+
*/
|
|
8973
|
+
var Schema = new SchemaUtils();
|
|
8974
|
+
|
|
8568
8975
|
exports.ExecutionContextService = ExecutionContextService;
|
|
8569
8976
|
exports.History = History;
|
|
8570
8977
|
exports.HistoryAdapter = HistoryAdapter;
|
|
8571
8978
|
exports.HistoryInstance = HistoryInstance;
|
|
8572
8979
|
exports.Logger = Logger;
|
|
8573
8980
|
exports.MethodContextService = MethodContextService;
|
|
8981
|
+
exports.Schema = Schema;
|
|
8574
8982
|
exports.State = State;
|
|
8575
8983
|
exports.Storage = Storage;
|
|
8576
8984
|
exports.addAgent = addAgent;
|