agent-swarm-kit 1.0.78 → 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 +1209 -832
- package/build/index.mjs +1210 -834
- package/package.json +3 -2
- package/types.d.ts +26 -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.
|
|
@@ -325,36 +325,6 @@ var LoggerService = /** @class */ (function () {
|
|
|
325
325
|
return LoggerService;
|
|
326
326
|
}());
|
|
327
327
|
|
|
328
|
-
/**
|
|
329
|
-
* Service for managing agent schemas.
|
|
330
|
-
*/
|
|
331
|
-
var AgentSchemaService = /** @class */ (function () {
|
|
332
|
-
function AgentSchemaService() {
|
|
333
|
-
var _this = this;
|
|
334
|
-
this.loggerService = inject(TYPES.loggerService);
|
|
335
|
-
this.registry = new functoolsKit.ToolRegistry("agentSchemaService");
|
|
336
|
-
/**
|
|
337
|
-
* Registers a new agent schema.
|
|
338
|
-
* @param {AgentName} key - The name of the agent.
|
|
339
|
-
* @param {IAgentSchema} value - The schema of the agent.
|
|
340
|
-
*/
|
|
341
|
-
this.register = function (key, value) {
|
|
342
|
-
_this.loggerService.info("agentSchemaService register", { key: key });
|
|
343
|
-
_this.registry = _this.registry.register(key, value);
|
|
344
|
-
};
|
|
345
|
-
/**
|
|
346
|
-
* Retrieves an agent schema by name.
|
|
347
|
-
* @param {AgentName} key - The name of the agent.
|
|
348
|
-
* @returns {IAgentSchema} The schema of the agent.
|
|
349
|
-
*/
|
|
350
|
-
this.get = function (key) {
|
|
351
|
-
_this.loggerService.info("agentSchemaService get", { key: key });
|
|
352
|
-
return _this.registry.get(key);
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
return AgentSchemaService;
|
|
356
|
-
}());
|
|
357
|
-
|
|
358
328
|
/**
|
|
359
329
|
* Validates that the given output string is not empty.
|
|
360
330
|
*
|
|
@@ -482,10 +452,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
482
452
|
return __generator(this, function (_b) {
|
|
483
453
|
switch (_b.label) {
|
|
484
454
|
case 0:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
455
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
456
|
+
swarm.loggerService.log("HistoryInstance waitForInit", {
|
|
457
|
+
clientId: this.clientId,
|
|
458
|
+
agentName: agentName,
|
|
459
|
+
});
|
|
489
460
|
if (!this.callbacks.getData) return [3 /*break*/, 2];
|
|
490
461
|
_a = this;
|
|
491
462
|
return [4 /*yield*/, this.callbacks.getData(this.clientId, agentName)];
|
|
@@ -504,10 +475,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
504
475
|
*/
|
|
505
476
|
this.push = function (value, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
506
477
|
return __generator(this, function (_a) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
478
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
479
|
+
swarm.loggerService.log("HistoryInstance push", {
|
|
480
|
+
clientId: this.clientId,
|
|
481
|
+
agentName: agentName,
|
|
482
|
+
});
|
|
511
483
|
this.callbacks.onPush &&
|
|
512
484
|
this.callbacks.onPush(value, this.clientId, agentName);
|
|
513
485
|
this._array.push(value);
|
|
@@ -523,10 +495,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
523
495
|
*/
|
|
524
496
|
this.dispose = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
525
497
|
return __generator(this, function (_a) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
498
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
499
|
+
swarm.loggerService.log("HistoryInstance dispose", {
|
|
500
|
+
clientId: this.clientId,
|
|
501
|
+
agentName: agentName,
|
|
502
|
+
});
|
|
530
503
|
if (agentName === null) {
|
|
531
504
|
this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
|
|
532
505
|
this._array = [];
|
|
@@ -534,9 +507,10 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
534
507
|
return [2 /*return*/, Promise.resolve()];
|
|
535
508
|
});
|
|
536
509
|
}); };
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
510
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
511
|
+
swarm.loggerService.log("HistoryInstance CTOR", {
|
|
512
|
+
clientId: this.clientId,
|
|
513
|
+
});
|
|
540
514
|
if (callbacks.onInit) {
|
|
541
515
|
callbacks.onInit(clientId);
|
|
542
516
|
}
|
|
@@ -551,10 +525,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
551
525
|
return __generator(this, function (_g) {
|
|
552
526
|
switch (_g.label) {
|
|
553
527
|
case 0:
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
528
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
529
|
+
swarm.loggerService.log("HistoryInstance iterate condition", {
|
|
530
|
+
clientId: this.clientId,
|
|
531
|
+
agentName: agentName,
|
|
532
|
+
});
|
|
558
533
|
if (!this.callbacks.onRead) return [3 /*break*/, 12];
|
|
559
534
|
this.callbacks.onReadBegin &&
|
|
560
535
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
@@ -649,10 +624,11 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
649
624
|
return __generator(this, function (_g) {
|
|
650
625
|
switch (_g.label) {
|
|
651
626
|
case 0:
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
627
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
628
|
+
swarm.loggerService.log("HistoryInstance iterate", {
|
|
629
|
+
clientId: this.clientId,
|
|
630
|
+
agentName: agentName,
|
|
631
|
+
});
|
|
656
632
|
if (!this.callbacks.onRead) return [3 /*break*/, 11];
|
|
657
633
|
this.callbacks.onReadBegin &&
|
|
658
634
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
@@ -748,7 +724,8 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
748
724
|
* @param Ctor - The constructor for the history instance.
|
|
749
725
|
*/
|
|
750
726
|
this.useHistoryAdapter = function (Ctor) {
|
|
751
|
-
|
|
727
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
728
|
+
swarm.loggerService.log("HistoryUtils useHistoryAdapter");
|
|
752
729
|
_this.HistoryFactory = Ctor;
|
|
753
730
|
};
|
|
754
731
|
/**
|
|
@@ -756,7 +733,8 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
756
733
|
* @param Callbacks - The callbacks dictionary.
|
|
757
734
|
*/
|
|
758
735
|
this.useHistoryCallbacks = function (Callbacks) {
|
|
759
|
-
|
|
736
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
737
|
+
swarm.loggerService.log("HistoryUtils useHistoryCallbacks");
|
|
760
738
|
Object.assign(_this.HistoryCallbacks, Callbacks);
|
|
761
739
|
};
|
|
762
740
|
/**
|
|
@@ -771,11 +749,12 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
771
749
|
return __generator(this, function (_a) {
|
|
772
750
|
switch (_a.label) {
|
|
773
751
|
case 0:
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
752
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
753
|
+
swarm.loggerService.log("HistoryUtils push", {
|
|
754
|
+
clientId: clientId,
|
|
755
|
+
agentName: agentName,
|
|
756
|
+
value: value,
|
|
757
|
+
});
|
|
779
758
|
isInitial = this.getHistory.has(clientId);
|
|
780
759
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
781
760
|
case 1:
|
|
@@ -799,10 +778,11 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
799
778
|
return __generator(this, function (_a) {
|
|
800
779
|
switch (_a.label) {
|
|
801
780
|
case 0:
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
781
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
782
|
+
swarm.loggerService.log("HistoryUtils dispose", {
|
|
783
|
+
clientId: clientId,
|
|
784
|
+
agentName: agentName,
|
|
785
|
+
});
|
|
806
786
|
isInitial = this.getHistory.has(clientId);
|
|
807
787
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
808
788
|
case 1:
|
|
@@ -834,10 +814,11 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
834
814
|
return __generator(this, function (_g) {
|
|
835
815
|
switch (_g.label) {
|
|
836
816
|
case 0:
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
817
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
818
|
+
swarm.loggerService.log("HistoryUtils iterate", {
|
|
819
|
+
clientId: clientId,
|
|
820
|
+
agentName: agentName,
|
|
821
|
+
});
|
|
841
822
|
isInitial = this.getHistory.has(clientId);
|
|
842
823
|
return [4 /*yield*/, __await(this.getHistory(clientId))];
|
|
843
824
|
case 1:
|
|
@@ -897,6 +878,25 @@ var HistoryAdapter = new HistoryUtils();
|
|
|
897
878
|
*/
|
|
898
879
|
var History = HistoryAdapter;
|
|
899
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
|
+
|
|
900
900
|
/**
|
|
901
901
|
* @description `ask for agent function` in `llama3.1:8b` to troubleshoot (need CC_OLLAMA_EMIT_TOOL_PROTOCOL to be turned off)
|
|
902
902
|
*/
|
|
@@ -954,6 +954,10 @@ var CC_AGENT_OUTPUT_MAP = function (message) { return message; };
|
|
|
954
954
|
var CC_AGENT_SYSTEM_PROMPT = undefined;
|
|
955
955
|
var CC_STORAGE_SEARCH_SIMILARITY = 0.65;
|
|
956
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;
|
|
957
961
|
var GLOBAL_CONFIG = {
|
|
958
962
|
CC_TOOL_CALL_EXCEPTION_PROMPT: CC_TOOL_CALL_EXCEPTION_PROMPT,
|
|
959
963
|
CC_EMPTY_OUTPUT_PLACEHOLDERS: CC_EMPTY_OUTPUT_PLACEHOLDERS,
|
|
@@ -970,11 +974,47 @@ var GLOBAL_CONFIG = {
|
|
|
970
974
|
CC_AGENT_DISALLOWED_SYMBOLS: CC_AGENT_DISALLOWED_SYMBOLS,
|
|
971
975
|
CC_STORAGE_SEARCH_SIMILARITY: CC_STORAGE_SEARCH_SIMILARITY,
|
|
972
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,
|
|
973
981
|
};
|
|
974
982
|
var setConfig = function (config) {
|
|
975
983
|
Object.assign(GLOBAL_CONFIG, config);
|
|
976
984
|
};
|
|
977
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
|
+
|
|
978
1018
|
var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
|
|
979
1019
|
var getPlaceholder = function () {
|
|
980
1020
|
return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
|
|
@@ -1008,7 +1048,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1008
1048
|
case 0: return [4 /*yield*/, this.params.transform(rawResult, this.params.clientId, this.params.agentName)];
|
|
1009
1049
|
case 1:
|
|
1010
1050
|
result = _a.sent();
|
|
1011
|
-
|
|
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 });
|
|
1012
1053
|
validation = null;
|
|
1013
1054
|
return [4 /*yield*/, this.params.validate(result)];
|
|
1014
1055
|
case 2:
|
|
@@ -1085,7 +1126,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1085
1126
|
return __generator(this, function (_a) {
|
|
1086
1127
|
switch (_a.label) {
|
|
1087
1128
|
case 0:
|
|
1088
|
-
|
|
1129
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1130
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel"));
|
|
1089
1131
|
this.params.onResurrect &&
|
|
1090
1132
|
this.params.onResurrect(this.params.clientId, this.params.agentName, mode, reason);
|
|
1091
1133
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1117,7 +1159,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1117
1159
|
return [4 /*yield*/, this.params.validate(result)];
|
|
1118
1160
|
case 6:
|
|
1119
1161
|
if (!(validation = _a.sent())) return [3 /*break*/, 8];
|
|
1120
|
-
|
|
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));
|
|
1121
1164
|
content = getPlaceholder();
|
|
1122
1165
|
return [4 /*yield*/, this.params.history.push({
|
|
1123
1166
|
agentName: this.params.agentName,
|
|
@@ -1143,7 +1186,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1143
1186
|
return __generator(this, function (_a) {
|
|
1144
1187
|
switch (_a.label) {
|
|
1145
1188
|
case 0:
|
|
1146
|
-
|
|
1189
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1190
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " waitForOutput"));
|
|
1147
1191
|
return [4 /*yield*/, this._outputSubject.toPromise()];
|
|
1148
1192
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1149
1193
|
}
|
|
@@ -1159,7 +1203,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1159
1203
|
return __generator(this, function (_d) {
|
|
1160
1204
|
switch (_d.label) {
|
|
1161
1205
|
case 0:
|
|
1162
|
-
|
|
1206
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1207
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " getCompletion"));
|
|
1163
1208
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
1164
1209
|
case 1:
|
|
1165
1210
|
messages = _d.sent();
|
|
@@ -1190,7 +1235,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1190
1235
|
return __generator(this, function (_a) {
|
|
1191
1236
|
switch (_a.label) {
|
|
1192
1237
|
case 0:
|
|
1193
|
-
|
|
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 });
|
|
1194
1240
|
this.params.onUserMessage &&
|
|
1195
1241
|
this.params.onUserMessage(this.params.clientId, this.params.agentName, message);
|
|
1196
1242
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1227,7 +1273,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1227
1273
|
return __generator(this, function (_a) {
|
|
1228
1274
|
switch (_a.label) {
|
|
1229
1275
|
case 0:
|
|
1230
|
-
|
|
1276
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1277
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitFlush"));
|
|
1231
1278
|
this.params.onFlush &&
|
|
1232
1279
|
this.params.onFlush(this.params.clientId, this.params.agentName);
|
|
1233
1280
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1262,7 +1309,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1262
1309
|
return __generator(this, function (_a) {
|
|
1263
1310
|
switch (_a.label) {
|
|
1264
1311
|
case 0:
|
|
1265
|
-
|
|
1312
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1313
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitAgentChange"));
|
|
1266
1314
|
return [4 /*yield*/, this._agentChangeSubject.next(AGENT_CHANGE_SYMBOL)];
|
|
1267
1315
|
case 1:
|
|
1268
1316
|
_a.sent();
|
|
@@ -1291,7 +1339,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1291
1339
|
return __generator(this, function (_a) {
|
|
1292
1340
|
switch (_a.label) {
|
|
1293
1341
|
case 0:
|
|
1294
|
-
|
|
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 });
|
|
1295
1344
|
this.params.onSystemMessage &&
|
|
1296
1345
|
this.params.onSystemMessage(this.params.clientId, this.params.agentName, message);
|
|
1297
1346
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1329,7 +1378,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1329
1378
|
return __generator(this, function (_a) {
|
|
1330
1379
|
switch (_a.label) {
|
|
1331
1380
|
case 0:
|
|
1332
|
-
|
|
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 });
|
|
1333
1383
|
this.params.onToolOutput &&
|
|
1334
1384
|
this.params.onToolOutput(toolId, this.params.clientId, this.params.agentName, content);
|
|
1335
1385
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1375,7 +1425,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1375
1425
|
return __generator(this, function (_h) {
|
|
1376
1426
|
switch (_h.label) {
|
|
1377
1427
|
case 0:
|
|
1378
|
-
|
|
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 });
|
|
1379
1430
|
this.params.onExecute &&
|
|
1380
1431
|
this.params.onExecute(this.params.clientId, this.params.agentName, incoming, mode);
|
|
1381
1432
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -1393,7 +1444,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1393
1444
|
case 3:
|
|
1394
1445
|
message = _h.sent();
|
|
1395
1446
|
if (!message.tool_calls) return [3 /*break*/, 9];
|
|
1396
|
-
|
|
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"));
|
|
1397
1449
|
toolCalls = message.tool_calls.map(function (call) {
|
|
1398
1450
|
var _a, _b;
|
|
1399
1451
|
return ({
|
|
@@ -1413,11 +1465,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1413
1465
|
tool = toolCalls[idx];
|
|
1414
1466
|
targetFn = (_a = this_1.params.tools) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.function.name === tool.function.name; });
|
|
1415
1467
|
if (!!targetFn) return [3 /*break*/, 3];
|
|
1416
|
-
|
|
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);
|
|
1417
1470
|
return [4 /*yield*/, this_1._resurrectModel(mode, "No target function for ".concat(tool.function.name))];
|
|
1418
1471
|
case 1:
|
|
1419
1472
|
result_2 = _j.sent();
|
|
1420
|
-
|
|
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));
|
|
1421
1475
|
return [4 /*yield*/, this_1._emitOuput(mode, result_2)];
|
|
1422
1476
|
case 2:
|
|
1423
1477
|
_j.sent();
|
|
@@ -1433,11 +1487,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1433
1487
|
}))];
|
|
1434
1488
|
case 4:
|
|
1435
1489
|
if (!_j.sent()) return [3 /*break*/, 7];
|
|
1436
|
-
|
|
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"));
|
|
1437
1492
|
return [4 /*yield*/, this_1._resurrectModel(mode, "Function validation failed: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
|
|
1438
1493
|
case 5:
|
|
1439
1494
|
result_3 = _j.sent();
|
|
1440
|
-
|
|
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));
|
|
1441
1497
|
return [4 /*yield*/, this_1._emitOuput(mode, result_3)];
|
|
1442
1498
|
case 6:
|
|
1443
1499
|
_j.sent();
|
|
@@ -1474,7 +1530,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1474
1530
|
((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onCallError(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments, error));
|
|
1475
1531
|
_this._toolErrorSubject.next();
|
|
1476
1532
|
});
|
|
1477
|
-
|
|
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"));
|
|
1478
1535
|
return [4 /*yield*/, Promise.race([
|
|
1479
1536
|
this_1._agentChangeSubject.toPromise(),
|
|
1480
1537
|
this_1._toolCommitSubject.toPromise(),
|
|
@@ -1483,9 +1540,11 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1483
1540
|
])];
|
|
1484
1541
|
case 8:
|
|
1485
1542
|
status = _j.sent();
|
|
1486
|
-
|
|
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"));
|
|
1487
1545
|
if (status === AGENT_CHANGE_SYMBOL) {
|
|
1488
|
-
|
|
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"));
|
|
1489
1548
|
((_f = this_1.params.callbacks) === null || _f === void 0 ? void 0 : _f.onAfterToolCalls) &&
|
|
1490
1549
|
this_1.params.callbacks.onAfterToolCalls(this_1.params.clientId, this_1.params.agentName, toolCalls);
|
|
1491
1550
|
return [2 /*return*/, { value: void 0 }];
|
|
@@ -1514,7 +1573,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1514
1573
|
return [2 /*return*/];
|
|
1515
1574
|
case 9:
|
|
1516
1575
|
if (!message.tool_calls) {
|
|
1517
|
-
|
|
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"));
|
|
1518
1578
|
}
|
|
1519
1579
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
1520
1580
|
case 10:
|
|
@@ -1526,7 +1586,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1526
1586
|
return [4 /*yield*/, this.params.validate(result)];
|
|
1527
1587
|
case 12:
|
|
1528
1588
|
if (!(validation = _h.sent())) return [3 /*break*/, 15];
|
|
1529
|
-
|
|
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 });
|
|
1530
1591
|
return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
|
|
1531
1592
|
case 13:
|
|
1532
1593
|
result1 = _h.sent();
|
|
@@ -1535,7 +1596,8 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1535
1596
|
_h.sent();
|
|
1536
1597
|
return [2 /*return*/];
|
|
1537
1598
|
case 15:
|
|
1538
|
-
|
|
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));
|
|
1539
1601
|
return [4 /*yield*/, this._emitOuput(mode, result)];
|
|
1540
1602
|
case 16:
|
|
1541
1603
|
_h.sent();
|
|
@@ -1549,15 +1611,17 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1549
1611
|
*/
|
|
1550
1612
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1551
1613
|
return __generator(this, function (_a) {
|
|
1552
|
-
|
|
1614
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1615
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " dispose"));
|
|
1553
1616
|
this.params.onDispose &&
|
|
1554
1617
|
this.params.onDispose(this.params.clientId, this.params.agentName);
|
|
1555
1618
|
return [2 /*return*/];
|
|
1556
1619
|
});
|
|
1557
1620
|
}); };
|
|
1558
|
-
|
|
1559
|
-
params
|
|
1560
|
-
|
|
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
|
+
});
|
|
1561
1625
|
this.params.onInit && this.params.onInit(params.clientId, params.agentName);
|
|
1562
1626
|
}
|
|
1563
1627
|
return ClientAgent;
|
|
@@ -1613,10 +1677,11 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1613
1677
|
return __generator(this, function (_a) {
|
|
1614
1678
|
switch (_a.label) {
|
|
1615
1679
|
case 0:
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1680
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1681
|
+
this.loggerService.info("agentConnectionService execute", {
|
|
1682
|
+
input: input,
|
|
1683
|
+
mode: mode,
|
|
1684
|
+
});
|
|
1620
1685
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).execute(input, mode)];
|
|
1621
1686
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1622
1687
|
}
|
|
@@ -1630,7 +1695,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1630
1695
|
return __generator(this, function (_a) {
|
|
1631
1696
|
switch (_a.label) {
|
|
1632
1697
|
case 0:
|
|
1633
|
-
|
|
1698
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1699
|
+
this.loggerService.info("agentConnectionService waitForOutput");
|
|
1634
1700
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).waitForOutput()];
|
|
1635
1701
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1636
1702
|
}
|
|
@@ -1646,10 +1712,11 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1646
1712
|
return __generator(this, function (_a) {
|
|
1647
1713
|
switch (_a.label) {
|
|
1648
1714
|
case 0:
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1715
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1716
|
+
this.loggerService.info("agentConnectionService commitToolOutput", {
|
|
1717
|
+
content: content,
|
|
1718
|
+
toolId: toolId,
|
|
1719
|
+
});
|
|
1653
1720
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitToolOutput(toolId, content)];
|
|
1654
1721
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1655
1722
|
}
|
|
@@ -1664,9 +1731,10 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1664
1731
|
return __generator(this, function (_a) {
|
|
1665
1732
|
switch (_a.label) {
|
|
1666
1733
|
case 0:
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1734
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1735
|
+
this.loggerService.info("agentConnectionService commitSystemMessage", {
|
|
1736
|
+
message: message,
|
|
1737
|
+
});
|
|
1670
1738
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitSystemMessage(message)];
|
|
1671
1739
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1672
1740
|
}
|
|
@@ -1681,9 +1749,10 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1681
1749
|
return __generator(this, function (_a) {
|
|
1682
1750
|
switch (_a.label) {
|
|
1683
1751
|
case 0:
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1752
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1753
|
+
this.loggerService.info("agentConnectionService commitUserMessage", {
|
|
1754
|
+
message: message,
|
|
1755
|
+
});
|
|
1687
1756
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitUserMessage(message)];
|
|
1688
1757
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1689
1758
|
}
|
|
@@ -1697,7 +1766,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1697
1766
|
return __generator(this, function (_a) {
|
|
1698
1767
|
switch (_a.label) {
|
|
1699
1768
|
case 0:
|
|
1700
|
-
|
|
1769
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1770
|
+
this.loggerService.info("agentConnectionService commitAgentChange");
|
|
1701
1771
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitAgentChange()];
|
|
1702
1772
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1703
1773
|
}
|
|
@@ -1711,7 +1781,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1711
1781
|
return __generator(this, function (_a) {
|
|
1712
1782
|
switch (_a.label) {
|
|
1713
1783
|
case 0:
|
|
1714
|
-
|
|
1784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1785
|
+
this.loggerService.info("agentConnectionService commitFlush");
|
|
1715
1786
|
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitFlush()];
|
|
1716
1787
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1717
1788
|
}
|
|
@@ -1726,7 +1797,8 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1726
1797
|
return __generator(this, function (_a) {
|
|
1727
1798
|
switch (_a.label) {
|
|
1728
1799
|
case 0:
|
|
1729
|
-
|
|
1800
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
1801
|
+
this.loggerService.info("agentConnectionService dispose");
|
|
1730
1802
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
1731
1803
|
if (!this.getAgent.has(key)) {
|
|
1732
1804
|
return [2 /*return*/];
|
|
@@ -1765,7 +1837,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1765
1837
|
return __generator(this, function (_a) {
|
|
1766
1838
|
switch (_a.label) {
|
|
1767
1839
|
case 0:
|
|
1768
|
-
|
|
1840
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1841
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " push"), { message: message });
|
|
1769
1842
|
return [4 /*yield*/, this.params.items.push(message, this.params.clientId, this.params.agentName)];
|
|
1770
1843
|
case 1:
|
|
1771
1844
|
_a.sent();
|
|
@@ -1773,7 +1846,7 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1773
1846
|
type: "push",
|
|
1774
1847
|
source: "history-bus",
|
|
1775
1848
|
input: {
|
|
1776
|
-
message: message
|
|
1849
|
+
message: message,
|
|
1777
1850
|
},
|
|
1778
1851
|
output: {},
|
|
1779
1852
|
context: {
|
|
@@ -1797,7 +1870,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1797
1870
|
return __generator(this, function (_g) {
|
|
1798
1871
|
switch (_g.label) {
|
|
1799
1872
|
case 0:
|
|
1800
|
-
|
|
1873
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1874
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " toArrayForRaw"));
|
|
1801
1875
|
result = [];
|
|
1802
1876
|
_g.label = 1;
|
|
1803
1877
|
case 1:
|
|
@@ -1850,7 +1924,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1850
1924
|
return __generator(this, function (_h) {
|
|
1851
1925
|
switch (_h.label) {
|
|
1852
1926
|
case 0:
|
|
1853
|
-
|
|
1927
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
1928
|
+
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " toArrayForAgent"));
|
|
1854
1929
|
commonMessagesRaw = [];
|
|
1855
1930
|
systemMessagesRaw = [];
|
|
1856
1931
|
_h.label = 1;
|
|
@@ -1991,7 +2066,8 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1991
2066
|
return __generator(this, function (_a) {
|
|
1992
2067
|
switch (_a.label) {
|
|
1993
2068
|
case 0:
|
|
1994
|
-
|
|
2069
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2070
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " dispose"));
|
|
1995
2071
|
return [4 /*yield*/, this.params.items.dispose(this.params.clientId, this.params.agentName)];
|
|
1996
2072
|
case 1:
|
|
1997
2073
|
_a.sent();
|
|
@@ -1999,9 +2075,10 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1999
2075
|
}
|
|
2000
2076
|
});
|
|
2001
2077
|
}); };
|
|
2002
|
-
|
|
2003
|
-
params
|
|
2004
|
-
|
|
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
|
+
});
|
|
2005
2082
|
this._filterCondition = GLOBAL_CONFIG.CC_AGENT_HISTORY_FILTER(this.params.agentName);
|
|
2006
2083
|
}
|
|
2007
2084
|
return ClientHistory;
|
|
@@ -2046,9 +2123,10 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2046
2123
|
return __generator(this, function (_a) {
|
|
2047
2124
|
switch (_a.label) {
|
|
2048
2125
|
case 0:
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2126
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2127
|
+
this.loggerService.info("historyConnectionService push", {
|
|
2128
|
+
message: message,
|
|
2129
|
+
});
|
|
2052
2130
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).push(message)];
|
|
2053
2131
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2054
2132
|
}
|
|
@@ -2063,9 +2141,10 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2063
2141
|
return __generator(this, function (_a) {
|
|
2064
2142
|
switch (_a.label) {
|
|
2065
2143
|
case 0:
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2144
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2145
|
+
this.loggerService.info("historyConnectionService toArrayForAgent", {
|
|
2146
|
+
prompt: prompt,
|
|
2147
|
+
});
|
|
2069
2148
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForAgent(prompt)];
|
|
2070
2149
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2071
2150
|
}
|
|
@@ -2079,7 +2158,8 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2079
2158
|
return __generator(this, function (_a) {
|
|
2080
2159
|
switch (_a.label) {
|
|
2081
2160
|
case 0:
|
|
2082
|
-
|
|
2161
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2162
|
+
this.loggerService.info("historyConnectionService toArrayForRaw");
|
|
2083
2163
|
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForRaw()];
|
|
2084
2164
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2085
2165
|
}
|
|
@@ -2094,7 +2174,8 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2094
2174
|
return __generator(this, function (_a) {
|
|
2095
2175
|
switch (_a.label) {
|
|
2096
2176
|
case 0:
|
|
2097
|
-
|
|
2177
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2178
|
+
this.loggerService.info("historyConnectionService dispose");
|
|
2098
2179
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
2099
2180
|
if (!this.getHistory.has(key)) {
|
|
2100
2181
|
return [2 /*return*/];
|
|
@@ -2126,7 +2207,8 @@ var ToolSchemaService = /** @class */ (function () {
|
|
|
2126
2207
|
* @param {IAgentTool} value - The tool to register.
|
|
2127
2208
|
*/
|
|
2128
2209
|
this.register = function (key, value) {
|
|
2129
|
-
|
|
2210
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2211
|
+
_this.loggerService.info("toolSchemaService register");
|
|
2130
2212
|
_this.registry = _this.registry.register(key, value);
|
|
2131
2213
|
};
|
|
2132
2214
|
/**
|
|
@@ -2135,7 +2217,8 @@ var ToolSchemaService = /** @class */ (function () {
|
|
|
2135
2217
|
* @returns {IAgentTool} The tool associated with the given key.
|
|
2136
2218
|
*/
|
|
2137
2219
|
this.get = function (key) {
|
|
2138
|
-
|
|
2220
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2221
|
+
_this.loggerService.info("toolSchemaService get", { key: key });
|
|
2139
2222
|
return _this.registry.get(key);
|
|
2140
2223
|
};
|
|
2141
2224
|
}
|
|
@@ -2167,7 +2250,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2167
2250
|
return __generator(this, function (_d) {
|
|
2168
2251
|
switch (_d.label) {
|
|
2169
2252
|
case 0:
|
|
2170
|
-
|
|
2253
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2254
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " cancelOutput"));
|
|
2171
2255
|
_b = (_a = this._cancelOutputSubject).next;
|
|
2172
2256
|
_c = {};
|
|
2173
2257
|
return [4 /*yield*/, this.getAgentName()];
|
|
@@ -2202,7 +2286,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2202
2286
|
return __generator(this, function (_c) {
|
|
2203
2287
|
switch (_c.label) {
|
|
2204
2288
|
case 0:
|
|
2205
|
-
|
|
2289
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2290
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " waitForOutput"));
|
|
2206
2291
|
_a = __read(functoolsKit.createAwaiter(), 2), awaiter = _a[0], resolve = _a[1].resolve;
|
|
2207
2292
|
getOutput = functoolsKit.cancelable(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2208
2293
|
var _this = this;
|
|
@@ -2248,6 +2333,7 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2248
2333
|
case 2:
|
|
2249
2334
|
expectAgent = _c.sent();
|
|
2250
2335
|
agentName !== expectAgent &&
|
|
2336
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2251
2337
|
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " waitForAgent agent miss"), { agentName: agentName, expectAgent: expectAgent });
|
|
2252
2338
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2253
2339
|
type: "wait-for-output",
|
|
@@ -2276,7 +2362,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2276
2362
|
return __generator(this, function (_b) {
|
|
2277
2363
|
switch (_b.label) {
|
|
2278
2364
|
case 0:
|
|
2279
|
-
|
|
2365
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2366
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgentName"));
|
|
2280
2367
|
if (!(this._activeAgent === AGENT_NEED_FETCH)) return [3 /*break*/, 2];
|
|
2281
2368
|
_a = this;
|
|
2282
2369
|
return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_DEFAULT_AGENT(this.params.clientId, this.params.swarmName, this.params.defaultAgent)];
|
|
@@ -2310,7 +2397,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2310
2397
|
return __generator(this, function (_a) {
|
|
2311
2398
|
switch (_a.label) {
|
|
2312
2399
|
case 0:
|
|
2313
|
-
|
|
2400
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2401
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgent"));
|
|
2314
2402
|
return [4 /*yield*/, this.getAgentName()];
|
|
2315
2403
|
case 1:
|
|
2316
2404
|
agent = _a.sent();
|
|
@@ -2343,7 +2431,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2343
2431
|
return __generator(this, function (_a) {
|
|
2344
2432
|
switch (_a.label) {
|
|
2345
2433
|
case 0:
|
|
2346
|
-
|
|
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));
|
|
2347
2436
|
if (!this.params.agentMap[agentName]) {
|
|
2348
2437
|
throw new Error("agent-swarm agent ".concat(agentName, " not in the swarm"));
|
|
2349
2438
|
}
|
|
@@ -2378,7 +2467,8 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2378
2467
|
return __generator(this, function (_a) {
|
|
2379
2468
|
switch (_a.label) {
|
|
2380
2469
|
case 0:
|
|
2381
|
-
|
|
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));
|
|
2382
2472
|
this._activeAgent = agentName;
|
|
2383
2473
|
return [4 /*yield*/, this.params.onAgentChanged(this.params.clientId, agentName, this.params.swarmName)];
|
|
2384
2474
|
case 1:
|
|
@@ -2401,9 +2491,10 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2401
2491
|
}
|
|
2402
2492
|
});
|
|
2403
2493
|
}); };
|
|
2404
|
-
|
|
2405
|
-
params
|
|
2406
|
-
|
|
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
|
+
});
|
|
2407
2498
|
}
|
|
2408
2499
|
Object.defineProperty(ClientSwarm.prototype, "_agentList", {
|
|
2409
2500
|
get: function () {
|
|
@@ -2487,7 +2578,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2487
2578
|
return __generator(this, function (_a) {
|
|
2488
2579
|
switch (_a.label) {
|
|
2489
2580
|
case 0:
|
|
2490
|
-
|
|
2581
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2582
|
+
this.loggerService.info("swarmConnectionService cancelOutput");
|
|
2491
2583
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).cancelOutput()];
|
|
2492
2584
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2493
2585
|
}
|
|
@@ -2501,7 +2593,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2501
2593
|
return __generator(this, function (_a) {
|
|
2502
2594
|
switch (_a.label) {
|
|
2503
2595
|
case 0:
|
|
2504
|
-
|
|
2596
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2597
|
+
this.loggerService.info("swarmConnectionService waitForOutput");
|
|
2505
2598
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).waitForOutput()];
|
|
2506
2599
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2507
2600
|
}
|
|
@@ -2515,7 +2608,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2515
2608
|
return __generator(this, function (_a) {
|
|
2516
2609
|
switch (_a.label) {
|
|
2517
2610
|
case 0:
|
|
2518
|
-
|
|
2611
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2612
|
+
this.loggerService.info("swarmConnectionService getAgentName");
|
|
2519
2613
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgentName()];
|
|
2520
2614
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2521
2615
|
}
|
|
@@ -2529,7 +2623,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2529
2623
|
return __generator(this, function (_a) {
|
|
2530
2624
|
switch (_a.label) {
|
|
2531
2625
|
case 0:
|
|
2532
|
-
|
|
2626
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2627
|
+
this.loggerService.info("swarmConnectionService getAgent");
|
|
2533
2628
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgent()];
|
|
2534
2629
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2535
2630
|
}
|
|
@@ -2545,9 +2640,10 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2545
2640
|
return __generator(this, function (_a) {
|
|
2546
2641
|
switch (_a.label) {
|
|
2547
2642
|
case 0:
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2643
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2644
|
+
this.loggerService.info("swarmConnectionService setAgentRef", {
|
|
2645
|
+
agentName: agentName,
|
|
2646
|
+
});
|
|
2551
2647
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentRef(agentName, agent)];
|
|
2552
2648
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2553
2649
|
}
|
|
@@ -2562,9 +2658,10 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2562
2658
|
return __generator(this, function (_a) {
|
|
2563
2659
|
switch (_a.label) {
|
|
2564
2660
|
case 0:
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2661
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2662
|
+
this.loggerService.info("swarmConnectionService setAgentName", {
|
|
2663
|
+
agentName: agentName,
|
|
2664
|
+
});
|
|
2568
2665
|
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentName(agentName)];
|
|
2569
2666
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2570
2667
|
}
|
|
@@ -2577,7 +2674,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2577
2674
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2578
2675
|
var key;
|
|
2579
2676
|
return __generator(this, function (_a) {
|
|
2580
|
-
|
|
2677
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2678
|
+
this.loggerService.info("swarmConnectionService dispose");
|
|
2581
2679
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
2582
2680
|
if (!this.getSwarm.has(key)) {
|
|
2583
2681
|
return [2 /*return*/];
|
|
@@ -2604,7 +2702,8 @@ var SwarmSchemaService = /** @class */ (function () {
|
|
|
2604
2702
|
* @param {ISwarmSchema} value - The schema of the swarm.
|
|
2605
2703
|
*/
|
|
2606
2704
|
this.register = function (key, value) {
|
|
2607
|
-
|
|
2705
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2706
|
+
_this.loggerService.info("swarmSchemaService register", { key: key });
|
|
2608
2707
|
_this.registry = _this.registry.register(key, value);
|
|
2609
2708
|
};
|
|
2610
2709
|
/**
|
|
@@ -2613,7 +2712,8 @@ var SwarmSchemaService = /** @class */ (function () {
|
|
|
2613
2712
|
* @returns {ISwarmSchema} The schema of the swarm.
|
|
2614
2713
|
*/
|
|
2615
2714
|
this.get = function (key) {
|
|
2616
|
-
|
|
2715
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2716
|
+
_this.loggerService.info("swarmSchemaService get", { key: key });
|
|
2617
2717
|
return _this.registry.get(key);
|
|
2618
2718
|
};
|
|
2619
2719
|
}
|
|
@@ -2634,7 +2734,8 @@ var CompletionSchemaService = /** @class */ (function () {
|
|
|
2634
2734
|
* @param {ICompletionSchema} value - The schema to register.
|
|
2635
2735
|
*/
|
|
2636
2736
|
this.register = function (key, value) {
|
|
2637
|
-
|
|
2737
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2738
|
+
_this.loggerService.info("completionSchemaService register", { key: key });
|
|
2638
2739
|
_this.registry = _this.registry.register(key, value);
|
|
2639
2740
|
};
|
|
2640
2741
|
/**
|
|
@@ -2643,7 +2744,8 @@ var CompletionSchemaService = /** @class */ (function () {
|
|
|
2643
2744
|
* @returns {ICompletionSchema} The retrieved schema.
|
|
2644
2745
|
*/
|
|
2645
2746
|
this.get = function (key) {
|
|
2646
|
-
|
|
2747
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2748
|
+
_this.loggerService.info("completionSchemaService get", { key: key });
|
|
2647
2749
|
return _this.registry.get(key);
|
|
2648
2750
|
};
|
|
2649
2751
|
}
|
|
@@ -2671,9 +2773,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2671
2773
|
return __generator(this, function (_a) {
|
|
2672
2774
|
switch (_a.label) {
|
|
2673
2775
|
case 0:
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2776
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2777
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " emit"), {
|
|
2778
|
+
message: message,
|
|
2779
|
+
});
|
|
2677
2780
|
this.params.onEmit &&
|
|
2678
2781
|
this.params.onEmit(this.params.clientId, this.params.swarmName, message);
|
|
2679
2782
|
return [4 /*yield*/, this._emitSubject.next(message)];
|
|
@@ -2683,7 +2786,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2683
2786
|
type: "emit",
|
|
2684
2787
|
source: "session-bus",
|
|
2685
2788
|
input: {
|
|
2686
|
-
message: message
|
|
2789
|
+
message: message,
|
|
2687
2790
|
},
|
|
2688
2791
|
output: {},
|
|
2689
2792
|
context: {
|
|
@@ -2708,10 +2811,11 @@ var ClientSession = /** @class */ (function () {
|
|
|
2708
2811
|
return __generator(this, function (_a) {
|
|
2709
2812
|
switch (_a.label) {
|
|
2710
2813
|
case 0:
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
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
|
+
});
|
|
2715
2819
|
this.params.onExecute &&
|
|
2716
2820
|
this.params.onExecute(this.params.clientId, this.params.swarmName, message, mode);
|
|
2717
2821
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
@@ -2754,10 +2858,11 @@ var ClientSession = /** @class */ (function () {
|
|
|
2754
2858
|
return __generator(this, function (_a) {
|
|
2755
2859
|
switch (_a.label) {
|
|
2756
2860
|
case 0:
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
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
|
+
});
|
|
2761
2866
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2762
2867
|
case 1:
|
|
2763
2868
|
agent = _a.sent();
|
|
@@ -2793,9 +2898,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2793
2898
|
return __generator(this, function (_a) {
|
|
2794
2899
|
switch (_a.label) {
|
|
2795
2900
|
case 0:
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2901
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2902
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitUserMessage"), {
|
|
2903
|
+
message: message,
|
|
2904
|
+
});
|
|
2799
2905
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2800
2906
|
case 1:
|
|
2801
2907
|
agent = _a.sent();
|
|
@@ -2829,7 +2935,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2829
2935
|
return __generator(this, function (_a) {
|
|
2830
2936
|
switch (_a.label) {
|
|
2831
2937
|
case 0:
|
|
2832
|
-
|
|
2938
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2939
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitFlush"));
|
|
2833
2940
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2834
2941
|
case 1:
|
|
2835
2942
|
agent = _a.sent();
|
|
@@ -2862,9 +2969,10 @@ var ClientSession = /** @class */ (function () {
|
|
|
2862
2969
|
return __generator(this, function (_a) {
|
|
2863
2970
|
switch (_a.label) {
|
|
2864
2971
|
case 0:
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2972
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2973
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " commitSystemMessage"), {
|
|
2974
|
+
message: message,
|
|
2975
|
+
});
|
|
2868
2976
|
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
2869
2977
|
case 1:
|
|
2870
2978
|
agent = _a.sent();
|
|
@@ -2875,7 +2983,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2875
2983
|
type: "commit-system-message",
|
|
2876
2984
|
source: "session-bus",
|
|
2877
2985
|
input: {
|
|
2878
|
-
message: message
|
|
2986
|
+
message: message,
|
|
2879
2987
|
},
|
|
2880
2988
|
output: {},
|
|
2881
2989
|
context: {
|
|
@@ -2895,7 +3003,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2895
3003
|
* @returns {ReceiveMessageFn} - The function to receive messages.
|
|
2896
3004
|
*/
|
|
2897
3005
|
this.connect = function (connector) {
|
|
2898
|
-
|
|
3006
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3007
|
+
_this.params.logger.debug("ClientSession clientId=".concat(_this.params.clientId, " connect"));
|
|
2899
3008
|
_this.params.onConnect &&
|
|
2900
3009
|
_this.params.onConnect(_this.params.clientId, _this.params.swarmName);
|
|
2901
3010
|
_this._emitSubject.subscribe(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2932,7 +3041,8 @@ var ClientSession = /** @class */ (function () {
|
|
|
2932
3041
|
return __generator(this, function (_c) {
|
|
2933
3042
|
switch (_c.label) {
|
|
2934
3043
|
case 0:
|
|
2935
|
-
|
|
3044
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3045
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " connect call"));
|
|
2936
3046
|
return [4 /*yield*/, this.execute(incoming.data, "user")];
|
|
2937
3047
|
case 1:
|
|
2938
3048
|
data = _c.sent();
|
|
@@ -2960,15 +3070,17 @@ var ClientSession = /** @class */ (function () {
|
|
|
2960
3070
|
*/
|
|
2961
3071
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2962
3072
|
return __generator(this, function (_a) {
|
|
2963
|
-
|
|
3073
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3074
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " dispose"));
|
|
2964
3075
|
this.params.onDispose &&
|
|
2965
3076
|
this.params.onDispose(this.params.clientId, this.params.swarmName);
|
|
2966
3077
|
return [2 /*return*/];
|
|
2967
3078
|
});
|
|
2968
3079
|
}); };
|
|
2969
|
-
|
|
2970
|
-
params
|
|
2971
|
-
|
|
3080
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3081
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"), {
|
|
3082
|
+
params: params,
|
|
3083
|
+
});
|
|
2972
3084
|
this.params.onInit && this.params.onInit(params.clientId, params.swarmName);
|
|
2973
3085
|
}
|
|
2974
3086
|
return ClientSession;
|
|
@@ -3008,9 +3120,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3008
3120
|
return __generator(this, function (_a) {
|
|
3009
3121
|
switch (_a.label) {
|
|
3010
3122
|
case 0:
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3123
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3124
|
+
this.loggerService.info("sessionConnectionService emit", {
|
|
3125
|
+
content: content,
|
|
3126
|
+
});
|
|
3014
3127
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).emit(content)];
|
|
3015
3128
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3016
3129
|
}
|
|
@@ -3025,10 +3138,11 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3025
3138
|
return __generator(this, function (_a) {
|
|
3026
3139
|
switch (_a.label) {
|
|
3027
3140
|
case 0:
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3141
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3142
|
+
this.loggerService.info("sessionConnectionService execute", {
|
|
3143
|
+
content: content,
|
|
3144
|
+
mode: mode,
|
|
3145
|
+
});
|
|
3032
3146
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).execute(content, mode)];
|
|
3033
3147
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3034
3148
|
}
|
|
@@ -3040,7 +3154,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3040
3154
|
* @returns {ReceiveMessageFn} The function to receive messages.
|
|
3041
3155
|
*/
|
|
3042
3156
|
this.connect = function (connector, clientId, swarmName) {
|
|
3043
|
-
|
|
3157
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3158
|
+
_this.loggerService.info("sessionConnectionService connect");
|
|
3044
3159
|
return _this.getSession(clientId, swarmName).connect(connector);
|
|
3045
3160
|
};
|
|
3046
3161
|
/**
|
|
@@ -3053,10 +3168,11 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3053
3168
|
return __generator(this, function (_a) {
|
|
3054
3169
|
switch (_a.label) {
|
|
3055
3170
|
case 0:
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3171
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3172
|
+
this.loggerService.info("sessionConnectionService commitToolOutput", {
|
|
3173
|
+
content: content,
|
|
3174
|
+
toolId: toolId,
|
|
3175
|
+
});
|
|
3060
3176
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitToolOutput(toolId, content)];
|
|
3061
3177
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3062
3178
|
}
|
|
@@ -3071,9 +3187,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3071
3187
|
return __generator(this, function (_a) {
|
|
3072
3188
|
switch (_a.label) {
|
|
3073
3189
|
case 0:
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3190
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3191
|
+
this.loggerService.info("sessionConnectionService commitSystemMessage", {
|
|
3192
|
+
message: message,
|
|
3193
|
+
});
|
|
3077
3194
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitSystemMessage(message)];
|
|
3078
3195
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3079
3196
|
}
|
|
@@ -3088,9 +3205,10 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3088
3205
|
return __generator(this, function (_a) {
|
|
3089
3206
|
switch (_a.label) {
|
|
3090
3207
|
case 0:
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3208
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3209
|
+
this.loggerService.info("sessionConnectionService commitUserMessage", {
|
|
3210
|
+
message: message,
|
|
3211
|
+
});
|
|
3094
3212
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitUserMessage(message)];
|
|
3095
3213
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3096
3214
|
}
|
|
@@ -3105,7 +3223,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3105
3223
|
return __generator(this, function (_a) {
|
|
3106
3224
|
switch (_a.label) {
|
|
3107
3225
|
case 0:
|
|
3108
|
-
|
|
3226
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3227
|
+
this.loggerService.info("sessionConnectionService commitFlush");
|
|
3109
3228
|
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitFlush()];
|
|
3110
3229
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3111
3230
|
}
|
|
@@ -3120,7 +3239,8 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3120
3239
|
return __generator(this, function (_a) {
|
|
3121
3240
|
switch (_a.label) {
|
|
3122
3241
|
case 0:
|
|
3123
|
-
|
|
3242
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3243
|
+
this.loggerService.info("sessionConnectionService dispose");
|
|
3124
3244
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
3125
3245
|
if (!this.getSession.has(key)) {
|
|
3126
3246
|
return [2 /*return*/];
|
|
@@ -3156,11 +3276,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3156
3276
|
return __generator(this, function (_a) {
|
|
3157
3277
|
switch (_a.label) {
|
|
3158
3278
|
case 0:
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3279
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3280
|
+
this.loggerService.info("agentPublicService createAgentRef", {
|
|
3281
|
+
methodName: methodName,
|
|
3282
|
+
clientId: clientId,
|
|
3283
|
+
agentName: agentName,
|
|
3284
|
+
});
|
|
3164
3285
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3165
3286
|
return __generator(this, function (_a) {
|
|
3166
3287
|
switch (_a.label) {
|
|
@@ -3192,13 +3313,14 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3192
3313
|
return __generator(this, function (_a) {
|
|
3193
3314
|
switch (_a.label) {
|
|
3194
3315
|
case 0:
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
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
|
+
});
|
|
3202
3324
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3203
3325
|
return __generator(this, function (_a) {
|
|
3204
3326
|
switch (_a.label) {
|
|
@@ -3229,11 +3351,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3229
3351
|
return __generator(this, function (_a) {
|
|
3230
3352
|
switch (_a.label) {
|
|
3231
3353
|
case 0:
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3354
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3355
|
+
this.loggerService.info("agentPublicService waitForOutput", {
|
|
3356
|
+
methodName: methodName,
|
|
3357
|
+
clientId: clientId,
|
|
3358
|
+
agentName: agentName,
|
|
3359
|
+
});
|
|
3237
3360
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3238
3361
|
return __generator(this, function (_a) {
|
|
3239
3362
|
switch (_a.label) {
|
|
@@ -3266,13 +3389,14 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3266
3389
|
return __generator(this, function (_a) {
|
|
3267
3390
|
switch (_a.label) {
|
|
3268
3391
|
case 0:
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
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
|
+
});
|
|
3276
3400
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3277
3401
|
return __generator(this, function (_a) {
|
|
3278
3402
|
switch (_a.label) {
|
|
@@ -3304,12 +3428,13 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3304
3428
|
return __generator(this, function (_a) {
|
|
3305
3429
|
switch (_a.label) {
|
|
3306
3430
|
case 0:
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
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
|
+
});
|
|
3313
3438
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3314
3439
|
return __generator(this, function (_a) {
|
|
3315
3440
|
switch (_a.label) {
|
|
@@ -3341,12 +3466,13 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3341
3466
|
return __generator(this, function (_a) {
|
|
3342
3467
|
switch (_a.label) {
|
|
3343
3468
|
case 0:
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
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
|
+
});
|
|
3350
3476
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3351
3477
|
return __generator(this, function (_a) {
|
|
3352
3478
|
switch (_a.label) {
|
|
@@ -3377,11 +3503,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3377
3503
|
return __generator(this, function (_a) {
|
|
3378
3504
|
switch (_a.label) {
|
|
3379
3505
|
case 0:
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3506
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3507
|
+
this.loggerService.info("agentPublicService commitFlush", {
|
|
3508
|
+
methodName: methodName,
|
|
3509
|
+
clientId: clientId,
|
|
3510
|
+
agentName: agentName,
|
|
3511
|
+
});
|
|
3385
3512
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3386
3513
|
return __generator(this, function (_a) {
|
|
3387
3514
|
switch (_a.label) {
|
|
@@ -3412,11 +3539,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3412
3539
|
return __generator(this, function (_a) {
|
|
3413
3540
|
switch (_a.label) {
|
|
3414
3541
|
case 0:
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3542
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3543
|
+
this.loggerService.info("agentPublicService commitAgentChange", {
|
|
3544
|
+
methodName: methodName,
|
|
3545
|
+
clientId: clientId,
|
|
3546
|
+
agentName: agentName,
|
|
3547
|
+
});
|
|
3420
3548
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3421
3549
|
return __generator(this, function (_a) {
|
|
3422
3550
|
switch (_a.label) {
|
|
@@ -3447,11 +3575,12 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3447
3575
|
return __generator(this, function (_a) {
|
|
3448
3576
|
switch (_a.label) {
|
|
3449
3577
|
case 0:
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3578
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3579
|
+
this.loggerService.info("agentPublicService dispose", {
|
|
3580
|
+
methodName: methodName,
|
|
3581
|
+
clientId: clientId,
|
|
3582
|
+
agentName: agentName,
|
|
3583
|
+
});
|
|
3455
3584
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3456
3585
|
return __generator(this, function (_a) {
|
|
3457
3586
|
switch (_a.label) {
|
|
@@ -3495,12 +3624,13 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3495
3624
|
return __generator(this, function (_a) {
|
|
3496
3625
|
switch (_a.label) {
|
|
3497
3626
|
case 0:
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
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
|
+
});
|
|
3504
3634
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3505
3635
|
return __generator(this, function (_a) {
|
|
3506
3636
|
switch (_a.label) {
|
|
@@ -3532,11 +3662,12 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3532
3662
|
return __generator(this, function (_a) {
|
|
3533
3663
|
switch (_a.label) {
|
|
3534
3664
|
case 0:
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3665
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3666
|
+
this.loggerService.info("historyPublicService toArrayForAgent", {
|
|
3667
|
+
prompt: prompt,
|
|
3668
|
+
clientId: clientId,
|
|
3669
|
+
agentName: agentName,
|
|
3670
|
+
});
|
|
3540
3671
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3541
3672
|
return __generator(this, function (_a) {
|
|
3542
3673
|
switch (_a.label) {
|
|
@@ -3567,11 +3698,12 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3567
3698
|
return __generator(this, function (_a) {
|
|
3568
3699
|
switch (_a.label) {
|
|
3569
3700
|
case 0:
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3701
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3702
|
+
this.loggerService.info("historyPublicService toArrayForRaw", {
|
|
3703
|
+
methodName: methodName,
|
|
3704
|
+
clientId: clientId,
|
|
3705
|
+
agentName: agentName,
|
|
3706
|
+
});
|
|
3575
3707
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3576
3708
|
return __generator(this, function (_a) {
|
|
3577
3709
|
switch (_a.label) {
|
|
@@ -3602,10 +3734,11 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3602
3734
|
return __generator(this, function (_a) {
|
|
3603
3735
|
switch (_a.label) {
|
|
3604
3736
|
case 0:
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3737
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3738
|
+
this.loggerService.info("historyPublicService dispose", {
|
|
3739
|
+
clientId: clientId,
|
|
3740
|
+
agentName: agentName,
|
|
3741
|
+
});
|
|
3609
3742
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3610
3743
|
return __generator(this, function (_a) {
|
|
3611
3744
|
switch (_a.label) {
|
|
@@ -3649,12 +3782,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3649
3782
|
return __generator(this, function (_a) {
|
|
3650
3783
|
switch (_a.label) {
|
|
3651
3784
|
case 0:
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
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
|
+
});
|
|
3658
3792
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3659
3793
|
return __generator(this, function (_a) {
|
|
3660
3794
|
switch (_a.label) {
|
|
@@ -3686,12 +3820,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3686
3820
|
return __generator(this, function (_a) {
|
|
3687
3821
|
switch (_a.label) {
|
|
3688
3822
|
case 0:
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
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
|
+
});
|
|
3695
3830
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3696
3831
|
return __generator(this, function (_a) {
|
|
3697
3832
|
switch (_a.label) {
|
|
@@ -3719,11 +3854,12 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3719
3854
|
* @returns {ReceiveMessageFn}
|
|
3720
3855
|
*/
|
|
3721
3856
|
this.connect = function (connector, methodName, clientId, swarmName) {
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3857
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3858
|
+
_this.loggerService.info("sessionPublicService connect", {
|
|
3859
|
+
methodName: methodName,
|
|
3860
|
+
clientId: clientId,
|
|
3861
|
+
swarmName: swarmName,
|
|
3862
|
+
});
|
|
3727
3863
|
var send = _this.sessionConnectionService.connect(connector, clientId, swarmName);
|
|
3728
3864
|
return function (incoming) { return __awaiter(_this, void 0, void 0, function () {
|
|
3729
3865
|
var executionId;
|
|
@@ -3734,12 +3870,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3734
3870
|
return __generator(this, function (_a) {
|
|
3735
3871
|
switch (_a.label) {
|
|
3736
3872
|
case 0:
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
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
|
+
});
|
|
3743
3880
|
return [4 /*yield*/, send(incoming)];
|
|
3744
3881
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3745
3882
|
}
|
|
@@ -3764,13 +3901,14 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3764
3901
|
return __generator(this, function (_a) {
|
|
3765
3902
|
switch (_a.label) {
|
|
3766
3903
|
case 0:
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
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
|
+
});
|
|
3774
3912
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3775
3913
|
return __generator(this, function (_a) {
|
|
3776
3914
|
switch (_a.label) {
|
|
@@ -3802,12 +3940,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3802
3940
|
return __generator(this, function (_a) {
|
|
3803
3941
|
switch (_a.label) {
|
|
3804
3942
|
case 0:
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
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
|
+
});
|
|
3811
3950
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3812
3951
|
return __generator(this, function (_a) {
|
|
3813
3952
|
switch (_a.label) {
|
|
@@ -3839,12 +3978,13 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3839
3978
|
return __generator(this, function (_a) {
|
|
3840
3979
|
switch (_a.label) {
|
|
3841
3980
|
case 0:
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
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
|
+
});
|
|
3848
3988
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3849
3989
|
return __generator(this, function (_a) {
|
|
3850
3990
|
switch (_a.label) {
|
|
@@ -3875,10 +4015,11 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3875
4015
|
return __generator(this, function (_a) {
|
|
3876
4016
|
switch (_a.label) {
|
|
3877
4017
|
case 0:
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
4018
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4019
|
+
this.loggerService.info("sessionPublicService commitFlush", {
|
|
4020
|
+
clientId: clientId,
|
|
4021
|
+
swarmName: swarmName,
|
|
4022
|
+
});
|
|
3882
4023
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3883
4024
|
return __generator(this, function (_a) {
|
|
3884
4025
|
switch (_a.label) {
|
|
@@ -3909,11 +4050,12 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3909
4050
|
return __generator(this, function (_a) {
|
|
3910
4051
|
switch (_a.label) {
|
|
3911
4052
|
case 0:
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
4053
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4054
|
+
this.loggerService.info("sessionPublicService dispose", {
|
|
4055
|
+
methodName: methodName,
|
|
4056
|
+
clientId: clientId,
|
|
4057
|
+
swarmName: swarmName,
|
|
4058
|
+
});
|
|
3917
4059
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3918
4060
|
return __generator(this, function (_a) {
|
|
3919
4061
|
switch (_a.label) {
|
|
@@ -3956,10 +4098,11 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3956
4098
|
return __generator(this, function (_a) {
|
|
3957
4099
|
switch (_a.label) {
|
|
3958
4100
|
case 0:
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
4101
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4102
|
+
this.loggerService.info("swarmPublicService cancelOutput", {
|
|
4103
|
+
clientId: clientId,
|
|
4104
|
+
swarmName: swarmName,
|
|
4105
|
+
});
|
|
3963
4106
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3964
4107
|
return __generator(this, function (_a) {
|
|
3965
4108
|
switch (_a.label) {
|
|
@@ -3990,11 +4133,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3990
4133
|
return __generator(this, function (_a) {
|
|
3991
4134
|
switch (_a.label) {
|
|
3992
4135
|
case 0:
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
4136
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4137
|
+
this.loggerService.info("swarmPublicService waitForOutput", {
|
|
4138
|
+
clientId: clientId,
|
|
4139
|
+
methodName: methodName,
|
|
4140
|
+
swarmName: swarmName,
|
|
4141
|
+
});
|
|
3998
4142
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3999
4143
|
return __generator(this, function (_a) {
|
|
4000
4144
|
switch (_a.label) {
|
|
@@ -4025,11 +4169,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4025
4169
|
return __generator(this, function (_a) {
|
|
4026
4170
|
switch (_a.label) {
|
|
4027
4171
|
case 0:
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4172
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4173
|
+
this.loggerService.info("swarmPublicService getAgentName", {
|
|
4174
|
+
clientId: clientId,
|
|
4175
|
+
swarmName: swarmName,
|
|
4176
|
+
methodName: methodName,
|
|
4177
|
+
});
|
|
4033
4178
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4034
4179
|
return __generator(this, function (_a) {
|
|
4035
4180
|
switch (_a.label) {
|
|
@@ -4060,10 +4205,11 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4060
4205
|
return __generator(this, function (_a) {
|
|
4061
4206
|
switch (_a.label) {
|
|
4062
4207
|
case 0:
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4208
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4209
|
+
this.loggerService.info("swarmPublicService getAgent", {
|
|
4210
|
+
clientId: clientId,
|
|
4211
|
+
swarmName: swarmName,
|
|
4212
|
+
});
|
|
4067
4213
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4068
4214
|
return __generator(this, function (_a) {
|
|
4069
4215
|
switch (_a.label) {
|
|
@@ -4096,13 +4242,14 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4096
4242
|
return __generator(this, function (_a) {
|
|
4097
4243
|
switch (_a.label) {
|
|
4098
4244
|
case 0:
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
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
|
+
});
|
|
4106
4253
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4107
4254
|
return __generator(this, function (_a) {
|
|
4108
4255
|
switch (_a.label) {
|
|
@@ -4134,12 +4281,13 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4134
4281
|
return __generator(this, function (_a) {
|
|
4135
4282
|
switch (_a.label) {
|
|
4136
4283
|
case 0:
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
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
|
+
});
|
|
4143
4291
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4144
4292
|
return __generator(this, function (_a) {
|
|
4145
4293
|
switch (_a.label) {
|
|
@@ -4170,11 +4318,12 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4170
4318
|
return __generator(this, function (_a) {
|
|
4171
4319
|
switch (_a.label) {
|
|
4172
4320
|
case 0:
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4321
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4322
|
+
this.loggerService.info("swarmPublicService dispose", {
|
|
4323
|
+
methodName: methodName,
|
|
4324
|
+
clientId: clientId,
|
|
4325
|
+
swarmName: swarmName,
|
|
4326
|
+
});
|
|
4178
4327
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4179
4328
|
return __generator(this, function (_a) {
|
|
4180
4329
|
switch (_a.label) {
|
|
@@ -4240,10 +4389,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4240
4389
|
* @throws {Error} If the agent already exists.
|
|
4241
4390
|
*/
|
|
4242
4391
|
this.addAgent = function (agentName, agentSchema) {
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4392
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4393
|
+
_this.loggerService.info("agentValidationService addAgent", {
|
|
4394
|
+
agentName: agentName,
|
|
4395
|
+
agentSchema: agentSchema,
|
|
4396
|
+
});
|
|
4247
4397
|
if (_this._agentMap.has(agentName)) {
|
|
4248
4398
|
throw new Error("agent-swarm agent ".concat(agentName, " already exist"));
|
|
4249
4399
|
}
|
|
@@ -4256,10 +4406,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4256
4406
|
var _b = __read(_a, 2), agentName = _b[0], storageName = _b[1];
|
|
4257
4407
|
return "".concat(agentName, "-").concat(storageName);
|
|
4258
4408
|
}, function (agentName, storageName) {
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4409
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4410
|
+
_this.loggerService.info("agentValidationService hasStorage", {
|
|
4411
|
+
agentName: agentName,
|
|
4412
|
+
storageName: storageName,
|
|
4413
|
+
});
|
|
4263
4414
|
if (!_this._agentMap.has(agentName)) {
|
|
4264
4415
|
throw new Error("agent-swarm agent ".concat(agentName, " not exist (hasStorage)"));
|
|
4265
4416
|
}
|
|
@@ -4273,10 +4424,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4273
4424
|
var _b = __read(_a, 2), agentName = _b[0], stateName = _b[1];
|
|
4274
4425
|
return "".concat(agentName, "-").concat(stateName);
|
|
4275
4426
|
}, function (agentName, stateName) {
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4427
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4428
|
+
_this.loggerService.info("agentValidationService hasState", {
|
|
4429
|
+
agentName: agentName,
|
|
4430
|
+
stateName: stateName,
|
|
4431
|
+
});
|
|
4280
4432
|
if (!_this._agentMap.has(agentName)) {
|
|
4281
4433
|
throw new Error("agent-swarm agent ".concat(agentName, " not exist (hasState)"));
|
|
4282
4434
|
}
|
|
@@ -4294,10 +4446,11 @@ var AgentValidationService = /** @class */ (function () {
|
|
|
4294
4446
|
return agentName;
|
|
4295
4447
|
}, function (agentName, source) {
|
|
4296
4448
|
var _a, _b;
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4449
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4450
|
+
_this.loggerService.info("agentValidationService validate", {
|
|
4451
|
+
agentName: agentName,
|
|
4452
|
+
source: source,
|
|
4453
|
+
});
|
|
4301
4454
|
var agent = _this._agentMap.get(agentName);
|
|
4302
4455
|
if (!agent) {
|
|
4303
4456
|
throw new Error("agent-swarm agent ".concat(agentName, " not found source=").concat(source));
|
|
@@ -4335,9 +4488,10 @@ var CompletionValidationService = /** @class */ (function () {
|
|
|
4335
4488
|
* @throws Will throw an error if the completion name already exists.
|
|
4336
4489
|
*/
|
|
4337
4490
|
this.addCompletion = function (completionName) {
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4491
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4492
|
+
_this.loggerService.info("completionValidationService addCompletion", {
|
|
4493
|
+
completionName: completionName,
|
|
4494
|
+
});
|
|
4341
4495
|
if (_this._completionSet.has(completionName)) {
|
|
4342
4496
|
throw new Error("agent-swarm completion ".concat(completionName, " already exist"));
|
|
4343
4497
|
}
|
|
@@ -4353,10 +4507,11 @@ var CompletionValidationService = /** @class */ (function () {
|
|
|
4353
4507
|
var _b = __read(_a, 1), completionName = _b[0];
|
|
4354
4508
|
return completionName;
|
|
4355
4509
|
}, function (completionName, source) {
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4510
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4511
|
+
_this.loggerService.info("completionValidationService validate", {
|
|
4512
|
+
completionName: completionName,
|
|
4513
|
+
source: source,
|
|
4514
|
+
});
|
|
4360
4515
|
if (!_this._completionSet.has(completionName)) {
|
|
4361
4516
|
throw new Error("agent-swarm completion ".concat(completionName, " not found source=").concat(source));
|
|
4362
4517
|
}
|
|
@@ -4387,9 +4542,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4387
4542
|
* @throws Will throw an error if the session already exists.
|
|
4388
4543
|
*/
|
|
4389
4544
|
this.addSession = function (clientId, swarmName, sessionMode) {
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4545
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4546
|
+
_this.loggerService.info("sessionValidationService addSession", {
|
|
4547
|
+
clientId: clientId,
|
|
4548
|
+
});
|
|
4393
4549
|
if (_this._sessionSwarmMap.has(clientId)) {
|
|
4394
4550
|
throw new Error("agent-swarm session clientId=".concat(clientId, " already exist"));
|
|
4395
4551
|
}
|
|
@@ -4402,10 +4558,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4402
4558
|
* @param {AgentName} agentName - The name of the agent.
|
|
4403
4559
|
*/
|
|
4404
4560
|
this.addAgentUsage = function (sessionId, agentName) {
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4561
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4562
|
+
_this.loggerService.info("sessionValidationService addAgentUsage", {
|
|
4563
|
+
sessionId: sessionId,
|
|
4564
|
+
agentName: agentName,
|
|
4565
|
+
});
|
|
4409
4566
|
if (_this._agentSwarmMap.has(sessionId)) {
|
|
4410
4567
|
var agents = _this._agentSwarmMap.get(sessionId);
|
|
4411
4568
|
if (!agents.includes(agentName)) {
|
|
@@ -4422,10 +4579,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4422
4579
|
* @param {AgentName} agentName - The name of the agent.
|
|
4423
4580
|
*/
|
|
4424
4581
|
this.addHistoryUsage = function (sessionId, agentName) {
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4582
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4583
|
+
_this.loggerService.info("sessionValidationService addHistoryUsage", {
|
|
4584
|
+
sessionId: sessionId,
|
|
4585
|
+
agentName: agentName,
|
|
4586
|
+
});
|
|
4429
4587
|
if (_this._historySwarmMap.has(sessionId)) {
|
|
4430
4588
|
var agents = _this._historySwarmMap.get(sessionId);
|
|
4431
4589
|
if (!agents.includes(agentName)) {
|
|
@@ -4442,10 +4600,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4442
4600
|
* @param {StorageName} storageName - The name of the storage.
|
|
4443
4601
|
*/
|
|
4444
4602
|
this.addStorageUsage = function (sessionId, storageName) {
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4603
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4604
|
+
_this.loggerService.info("sessionValidationService addStorageUsage", {
|
|
4605
|
+
sessionId: sessionId,
|
|
4606
|
+
storageName: storageName,
|
|
4607
|
+
});
|
|
4449
4608
|
if (_this._storageSwarmMap.has(sessionId)) {
|
|
4450
4609
|
var storages = _this._storageSwarmMap.get(sessionId);
|
|
4451
4610
|
if (!storages.includes(storageName)) {
|
|
@@ -4462,10 +4621,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4462
4621
|
* @param {StateName} stateName - The name of the state.
|
|
4463
4622
|
*/
|
|
4464
4623
|
this.addStateUsage = function (sessionId, stateName) {
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4624
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4625
|
+
_this.loggerService.info("sessionValidationService addStateUsage", {
|
|
4626
|
+
sessionId: sessionId,
|
|
4627
|
+
stateName: stateName,
|
|
4628
|
+
});
|
|
4469
4629
|
if (_this._stateSwarmMap.has(sessionId)) {
|
|
4470
4630
|
var states = _this._stateSwarmMap.get(sessionId);
|
|
4471
4631
|
if (!states.includes(stateName)) {
|
|
@@ -4483,10 +4643,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4483
4643
|
* @throws Will throw an error if no agents are found for the session.
|
|
4484
4644
|
*/
|
|
4485
4645
|
this.removeAgentUsage = function (sessionId, agentName) {
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4646
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4647
|
+
_this.loggerService.info("sessionValidationService removeAgentUsage", {
|
|
4648
|
+
sessionId: sessionId,
|
|
4649
|
+
agentName: agentName,
|
|
4650
|
+
});
|
|
4490
4651
|
if (_this._agentSwarmMap.has(sessionId)) {
|
|
4491
4652
|
var agents = _this._agentSwarmMap.get(sessionId);
|
|
4492
4653
|
var agentIndex = agents.indexOf(agentName);
|
|
@@ -4508,10 +4669,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4508
4669
|
* @throws Will throw an error if no agents are found for the session.
|
|
4509
4670
|
*/
|
|
4510
4671
|
this.removeHistoryUsage = function (sessionId, agentName) {
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4672
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4673
|
+
_this.loggerService.info("sessionValidationService removeHistoryUsage", {
|
|
4674
|
+
sessionId: sessionId,
|
|
4675
|
+
agentName: agentName,
|
|
4676
|
+
});
|
|
4515
4677
|
if (_this._historySwarmMap.has(sessionId)) {
|
|
4516
4678
|
var agents = _this._historySwarmMap.get(sessionId);
|
|
4517
4679
|
var agentIndex = agents.indexOf(agentName);
|
|
@@ -4533,10 +4695,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4533
4695
|
* @throws Will throw an error if no storages are found for the session.
|
|
4534
4696
|
*/
|
|
4535
4697
|
this.removeStorageUsage = function (sessionId, storageName) {
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4698
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4699
|
+
_this.loggerService.info("sessionValidationService removeStorageUsage", {
|
|
4700
|
+
sessionId: sessionId,
|
|
4701
|
+
storageName: storageName,
|
|
4702
|
+
});
|
|
4540
4703
|
if (_this._storageSwarmMap.has(sessionId)) {
|
|
4541
4704
|
var agents = _this._storageSwarmMap.get(sessionId);
|
|
4542
4705
|
var agentIndex = agents.indexOf(storageName);
|
|
@@ -4558,10 +4721,11 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4558
4721
|
* @throws Will throw an error if no states are found for the session.
|
|
4559
4722
|
*/
|
|
4560
4723
|
this.removeStateUsage = function (sessionId, stateName) {
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4724
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4725
|
+
_this.loggerService.info("sessionValidationService removeStateUsage", {
|
|
4726
|
+
sessionId: sessionId,
|
|
4727
|
+
stateName: stateName,
|
|
4728
|
+
});
|
|
4565
4729
|
if (_this._stateSwarmMap.has(sessionId)) {
|
|
4566
4730
|
var agents = _this._stateSwarmMap.get(sessionId);
|
|
4567
4731
|
var agentIndex = agents.indexOf(stateName);
|
|
@@ -4583,9 +4747,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4583
4747
|
* @throws Will throw an error if the session does not exist.
|
|
4584
4748
|
*/
|
|
4585
4749
|
this.getSessionMode = function (clientId) {
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4750
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4751
|
+
_this.loggerService.info("sessionValidationService getSessionMode", {
|
|
4752
|
+
clientId: clientId,
|
|
4753
|
+
});
|
|
4589
4754
|
if (!_this._sessionModeMap.has(clientId)) {
|
|
4590
4755
|
throw new Error("agent-swarm session getSessionMode clientId=".concat(clientId, " session not exist"));
|
|
4591
4756
|
}
|
|
@@ -4596,7 +4761,8 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4596
4761
|
* @returns {boolean}
|
|
4597
4762
|
*/
|
|
4598
4763
|
this.hasSession = function (clientId) {
|
|
4599
|
-
|
|
4764
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4765
|
+
_this.loggerService.info("sessionValidationService hasSession");
|
|
4600
4766
|
return _this._sessionSwarmMap.has(clientId);
|
|
4601
4767
|
};
|
|
4602
4768
|
/**
|
|
@@ -4604,7 +4770,8 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4604
4770
|
* @returns {SessionId[]} The list of session IDs.
|
|
4605
4771
|
*/
|
|
4606
4772
|
this.getSessionList = function () {
|
|
4607
|
-
|
|
4773
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4774
|
+
_this.loggerService.info("sessionValidationService getSessionList");
|
|
4608
4775
|
return __spreadArray([], __read(_this._sessionSwarmMap.keys()), false);
|
|
4609
4776
|
};
|
|
4610
4777
|
/**
|
|
@@ -4614,9 +4781,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4614
4781
|
*/
|
|
4615
4782
|
this.getSessionAgentList = function (clientId) {
|
|
4616
4783
|
var _a;
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4785
|
+
_this.loggerService.info("sessionValidationService getSessionAgentList", {
|
|
4786
|
+
clientId: clientId,
|
|
4787
|
+
});
|
|
4620
4788
|
return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
|
|
4621
4789
|
};
|
|
4622
4790
|
/**
|
|
@@ -4626,9 +4794,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4626
4794
|
*/
|
|
4627
4795
|
this.getSessionHistoryList = function (clientId) {
|
|
4628
4796
|
var _a;
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4797
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4798
|
+
_this.loggerService.info("sessionValidationService getSessionHistoryList", {
|
|
4799
|
+
clientId: clientId,
|
|
4800
|
+
});
|
|
4632
4801
|
return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
|
|
4633
4802
|
};
|
|
4634
4803
|
/**
|
|
@@ -4638,9 +4807,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4638
4807
|
* @throws Will throw an error if the session does not exist.
|
|
4639
4808
|
*/
|
|
4640
4809
|
this.getSwarm = function (clientId) {
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4810
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4811
|
+
_this.loggerService.info("sessionValidationService getSwarm", {
|
|
4812
|
+
clientId: clientId,
|
|
4813
|
+
});
|
|
4644
4814
|
var session = _this._sessionSwarmMap.get(clientId);
|
|
4645
4815
|
if (session === undefined) {
|
|
4646
4816
|
throw new Error("agent-swarm session clientId=".concat(clientId, " not found"));
|
|
@@ -4654,7 +4824,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4654
4824
|
* @throws Will throw an error if the session does not exist.
|
|
4655
4825
|
*/
|
|
4656
4826
|
this.validate = function (clientId, source) {
|
|
4657
|
-
|
|
4827
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4828
|
+
_this.loggerService.info("sessionValidationService validate", {
|
|
4829
|
+
clientId: clientId,
|
|
4830
|
+
});
|
|
4658
4831
|
if (!_this._sessionSwarmMap.has(clientId)) {
|
|
4659
4832
|
throw new Error("agent-swarm session clientId=".concat(clientId, " not exist source=").concat(source));
|
|
4660
4833
|
}
|
|
@@ -4665,9 +4838,10 @@ var SessionValidationService = /** @class */ (function () {
|
|
|
4665
4838
|
* @param {SessionId} clientId - The ID of the client.
|
|
4666
4839
|
*/
|
|
4667
4840
|
this.removeSession = function (clientId) {
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4841
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4842
|
+
_this.loggerService.info("sessionValidationService addSession", {
|
|
4843
|
+
clientId: clientId,
|
|
4844
|
+
});
|
|
4671
4845
|
_this._sessionSwarmMap.delete(clientId);
|
|
4672
4846
|
_this._sessionModeMap.delete(clientId);
|
|
4673
4847
|
};
|
|
@@ -4691,10 +4865,11 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4691
4865
|
* @throws Will throw an error if the swarm already exists.
|
|
4692
4866
|
*/
|
|
4693
4867
|
this.addSwarm = function (swarmName, swarmSchema) {
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4868
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4869
|
+
_this.loggerService.info("swarmValidationService addSwarm", {
|
|
4870
|
+
swarmName: swarmName,
|
|
4871
|
+
swarmSchema: swarmSchema,
|
|
4872
|
+
});
|
|
4698
4873
|
if (_this._swarmMap.has(swarmName)) {
|
|
4699
4874
|
throw new Error("swarm-swarm swarm ".concat(swarmName, " already exist"));
|
|
4700
4875
|
}
|
|
@@ -4707,9 +4882,10 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4707
4882
|
* @throws Will throw an error if the swarm is not found.
|
|
4708
4883
|
*/
|
|
4709
4884
|
this.getAgentList = function (swarmName) {
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4885
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4886
|
+
_this.loggerService.info("swarmValidationService getAgentList", {
|
|
4887
|
+
swarmName: swarmName,
|
|
4888
|
+
});
|
|
4713
4889
|
var swarm = _this._swarmMap.get(swarmName);
|
|
4714
4890
|
if (!swarm) {
|
|
4715
4891
|
throw new Error("agent-swarm swarm ".concat(swarmName, " not found"));
|
|
@@ -4726,10 +4902,11 @@ var SwarmValidationService = /** @class */ (function () {
|
|
|
4726
4902
|
var _b = __read(_a, 1), swarmName = _b[0];
|
|
4727
4903
|
return swarmName;
|
|
4728
4904
|
}, function (swarmName, source) {
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4905
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4906
|
+
_this.loggerService.info("swarmValidationService validate", {
|
|
4907
|
+
swarmName: swarmName,
|
|
4908
|
+
source: source,
|
|
4909
|
+
});
|
|
4733
4910
|
var swarm = _this._swarmMap.get(swarmName);
|
|
4734
4911
|
if (!swarm) {
|
|
4735
4912
|
throw new Error("agent-swarm swarm ".concat(swarmName, " not found"));
|
|
@@ -4761,10 +4938,11 @@ var ToolValidationService = /** @class */ (function () {
|
|
|
4761
4938
|
* @throws Will throw an error if the tool already exists.
|
|
4762
4939
|
*/
|
|
4763
4940
|
this.addTool = function (toolName, toolSchema) {
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4941
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4942
|
+
_this.loggerService.info("toolValidationService addTool", {
|
|
4943
|
+
toolName: toolName,
|
|
4944
|
+
toolSchema: toolSchema,
|
|
4945
|
+
});
|
|
4768
4946
|
if (_this._toolMap.has(toolName)) {
|
|
4769
4947
|
throw new Error("agent-swarm tool ".concat(toolName, " already exist"));
|
|
4770
4948
|
}
|
|
@@ -4780,10 +4958,11 @@ var ToolValidationService = /** @class */ (function () {
|
|
|
4780
4958
|
var _b = __read(_a, 1), toolName = _b[0];
|
|
4781
4959
|
return toolName;
|
|
4782
4960
|
}, function (toolName, source) {
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4961
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4962
|
+
_this.loggerService.info("toolValidationService validate", {
|
|
4963
|
+
toolName: toolName,
|
|
4964
|
+
source: source,
|
|
4965
|
+
});
|
|
4787
4966
|
if (!_this._toolMap.has(toolName)) {
|
|
4788
4967
|
throw new Error("agent-swarm tool ".concat(toolName, " not found source=").concat(source));
|
|
4789
4968
|
}
|
|
@@ -4807,7 +4986,8 @@ var EmbeddingSchemaService = /** @class */ (function () {
|
|
|
4807
4986
|
* @param {IAgentTool} value - The embedding to register.
|
|
4808
4987
|
*/
|
|
4809
4988
|
this.register = function (key, value) {
|
|
4810
|
-
|
|
4989
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4990
|
+
_this.loggerService.info("embeddingSchemaService register");
|
|
4811
4991
|
_this.registry = _this.registry.register(key, value);
|
|
4812
4992
|
};
|
|
4813
4993
|
/**
|
|
@@ -4816,7 +4996,8 @@ var EmbeddingSchemaService = /** @class */ (function () {
|
|
|
4816
4996
|
* @returns {IAgentTool} The embedding associated with the given key.
|
|
4817
4997
|
*/
|
|
4818
4998
|
this.get = function (key) {
|
|
4819
|
-
|
|
4999
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5000
|
+
_this.loggerService.info("embeddingSchemaService get", { key: key });
|
|
4820
5001
|
return _this.registry.get(key);
|
|
4821
5002
|
};
|
|
4822
5003
|
}
|
|
@@ -4837,7 +5018,8 @@ var StorageSchemaService = /** @class */ (function () {
|
|
|
4837
5018
|
* @param {IStorageSchema} value - The schema to register.
|
|
4838
5019
|
*/
|
|
4839
5020
|
this.register = function (key, value) {
|
|
4840
|
-
|
|
5021
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5022
|
+
_this.loggerService.info("storageSchemaService register", { key: key });
|
|
4841
5023
|
_this.registry = _this.registry.register(key, value);
|
|
4842
5024
|
};
|
|
4843
5025
|
/**
|
|
@@ -4846,7 +5028,8 @@ var StorageSchemaService = /** @class */ (function () {
|
|
|
4846
5028
|
* @returns {IStorageSchema} The retrieved schema.
|
|
4847
5029
|
*/
|
|
4848
5030
|
this.get = function (key) {
|
|
4849
|
-
|
|
5031
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5032
|
+
_this.loggerService.info("storageSchemaService get", { key: key });
|
|
4850
5033
|
return _this.registry.get(key);
|
|
4851
5034
|
};
|
|
4852
5035
|
}
|
|
@@ -4880,9 +5063,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4880
5063
|
return __generator(this, function (_a) {
|
|
4881
5064
|
switch (_a.label) {
|
|
4882
5065
|
case 0:
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
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
|
+
});
|
|
4886
5070
|
return [4 /*yield*/, this.params.createIndex(item)];
|
|
4887
5071
|
case 1:
|
|
4888
5072
|
index = _a.sent();
|
|
@@ -4905,7 +5089,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4905
5089
|
return __generator(this, function (_a) {
|
|
4906
5090
|
switch (_a.label) {
|
|
4907
5091
|
case 0:
|
|
4908
|
-
|
|
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"));
|
|
4909
5094
|
if (!this.params.getData) {
|
|
4910
5095
|
return [2 /*return*/];
|
|
4911
5096
|
}
|
|
@@ -4943,10 +5128,11 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4943
5128
|
return __generator(this, function (_c) {
|
|
4944
5129
|
switch (_c.label) {
|
|
4945
5130
|
case 0:
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
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
|
+
});
|
|
4950
5136
|
indexed = new functoolsKit.SortedArray();
|
|
4951
5137
|
return [4 /*yield*/, this.params.createEmbedding(search)];
|
|
4952
5138
|
case 1:
|
|
@@ -4977,9 +5163,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4977
5163
|
})))];
|
|
4978
5164
|
case 2:
|
|
4979
5165
|
_c.sent();
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
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
|
+
});
|
|
4983
5170
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onSearch) {
|
|
4984
5171
|
(_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onSearch(search, indexed, this.params.clientId, this.params.storageName);
|
|
4985
5172
|
}
|
|
@@ -5016,9 +5203,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5016
5203
|
return __generator(this, function (_c) {
|
|
5017
5204
|
switch (_c.label) {
|
|
5018
5205
|
case 0:
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
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
|
+
});
|
|
5022
5210
|
this._itemMap.set(item.id, item);
|
|
5023
5211
|
this._createEmbedding.clear(item.id);
|
|
5024
5212
|
return [4 /*yield*/, this._createEmbedding(item)];
|
|
@@ -5055,9 +5243,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5055
5243
|
return __generator(this, function (_c) {
|
|
5056
5244
|
switch (_c.label) {
|
|
5057
5245
|
case 0:
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
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
|
+
});
|
|
5061
5250
|
this._itemMap.delete(itemId);
|
|
5062
5251
|
this._createEmbedding.clear(itemId);
|
|
5063
5252
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onUpdate) {
|
|
@@ -5089,7 +5278,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5089
5278
|
return __generator(this, function (_a) {
|
|
5090
5279
|
switch (_a.label) {
|
|
5091
5280
|
case 0:
|
|
5092
|
-
|
|
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"));
|
|
5093
5283
|
this._itemMap.clear();
|
|
5094
5284
|
this._createEmbedding.clear();
|
|
5095
5285
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
@@ -5119,9 +5309,10 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5119
5309
|
return __generator(this, function (_b) {
|
|
5120
5310
|
switch (_b.label) {
|
|
5121
5311
|
case 0:
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
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
|
+
});
|
|
5125
5316
|
result = (_a = this._itemMap.get(itemId)) !== null && _a !== void 0 ? _a : null;
|
|
5126
5317
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5127
5318
|
type: "get",
|
|
@@ -5154,7 +5345,8 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5154
5345
|
return __generator(this, function (_d) {
|
|
5155
5346
|
switch (_d.label) {
|
|
5156
5347
|
case 0:
|
|
5157
|
-
|
|
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"));
|
|
5158
5350
|
if (!filter) {
|
|
5159
5351
|
return [2 /*return*/, __spreadArray([], __read(this._itemMap.values()), false)];
|
|
5160
5352
|
}
|
|
@@ -5199,16 +5391,18 @@ var ClientStorage = /** @class */ (function () {
|
|
|
5199
5391
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5200
5392
|
var _a;
|
|
5201
5393
|
return __generator(this, function (_b) {
|
|
5202
|
-
|
|
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"));
|
|
5203
5396
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5204
5397
|
this.params.callbacks.onDispose(this.params.clientId, this.params.storageName);
|
|
5205
5398
|
}
|
|
5206
5399
|
return [2 /*return*/];
|
|
5207
5400
|
});
|
|
5208
5401
|
}); };
|
|
5209
|
-
|
|
5210
|
-
params
|
|
5211
|
-
|
|
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
|
+
});
|
|
5212
5406
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5213
5407
|
this.params.callbacks.onInit(this.params.clientId, this.params.storageName);
|
|
5214
5408
|
}
|
|
@@ -5275,11 +5469,12 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5275
5469
|
return __generator(this, function (_a) {
|
|
5276
5470
|
switch (_a.label) {
|
|
5277
5471
|
case 0:
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5472
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5473
|
+
this.loggerService.info("storageConnectionService take", {
|
|
5474
|
+
search: search,
|
|
5475
|
+
total: total,
|
|
5476
|
+
score: score,
|
|
5477
|
+
});
|
|
5283
5478
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5284
5479
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5285
5480
|
case 1:
|
|
@@ -5299,9 +5494,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5299
5494
|
return __generator(this, function (_a) {
|
|
5300
5495
|
switch (_a.label) {
|
|
5301
5496
|
case 0:
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5497
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5498
|
+
this.loggerService.info("storageConnectionService upsert", {
|
|
5499
|
+
item: item,
|
|
5500
|
+
});
|
|
5305
5501
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5306
5502
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5307
5503
|
case 1:
|
|
@@ -5321,9 +5517,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5321
5517
|
return __generator(this, function (_a) {
|
|
5322
5518
|
switch (_a.label) {
|
|
5323
5519
|
case 0:
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5520
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5521
|
+
this.loggerService.info("storageConnectionService remove", {
|
|
5522
|
+
itemId: itemId,
|
|
5523
|
+
});
|
|
5327
5524
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5328
5525
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5329
5526
|
case 1:
|
|
@@ -5343,9 +5540,10 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5343
5540
|
return __generator(this, function (_a) {
|
|
5344
5541
|
switch (_a.label) {
|
|
5345
5542
|
case 0:
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5543
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5544
|
+
this.loggerService.info("storageConnectionService get", {
|
|
5545
|
+
itemId: itemId,
|
|
5546
|
+
});
|
|
5349
5547
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5350
5548
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5351
5549
|
case 1:
|
|
@@ -5365,7 +5563,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5365
5563
|
return __generator(this, function (_a) {
|
|
5366
5564
|
switch (_a.label) {
|
|
5367
5565
|
case 0:
|
|
5368
|
-
|
|
5566
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5567
|
+
this.loggerService.info("storageConnectionService list");
|
|
5369
5568
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5370
5569
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5371
5570
|
case 1:
|
|
@@ -5384,7 +5583,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5384
5583
|
return __generator(this, function (_a) {
|
|
5385
5584
|
switch (_a.label) {
|
|
5386
5585
|
case 0:
|
|
5387
|
-
|
|
5586
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5587
|
+
this.loggerService.info("storageConnectionService clear");
|
|
5388
5588
|
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5389
5589
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5390
5590
|
case 1:
|
|
@@ -5403,7 +5603,8 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5403
5603
|
return __generator(this, function (_a) {
|
|
5404
5604
|
switch (_a.label) {
|
|
5405
5605
|
case 0:
|
|
5406
|
-
|
|
5606
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5607
|
+
this.loggerService.info("storageConnectionService dispose");
|
|
5407
5608
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.storageName);
|
|
5408
5609
|
if (!this.getStorage.has(key)) {
|
|
5409
5610
|
return [2 /*return*/];
|
|
@@ -5447,14 +5648,15 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5447
5648
|
return __generator(this, function (_a) {
|
|
5448
5649
|
switch (_a.label) {
|
|
5449
5650
|
case 0:
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
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
|
+
});
|
|
5458
5660
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5459
5661
|
return __generator(this, function (_a) {
|
|
5460
5662
|
switch (_a.label) {
|
|
@@ -5484,11 +5686,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5484
5686
|
return __generator(this, function (_a) {
|
|
5485
5687
|
switch (_a.label) {
|
|
5486
5688
|
case 0:
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5689
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5690
|
+
this.loggerService.info("storagePublicService upsert", {
|
|
5691
|
+
item: item,
|
|
5692
|
+
clientId: clientId,
|
|
5693
|
+
storageName: storageName,
|
|
5694
|
+
});
|
|
5492
5695
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5493
5696
|
return __generator(this, function (_a) {
|
|
5494
5697
|
switch (_a.label) {
|
|
@@ -5518,11 +5721,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5518
5721
|
return __generator(this, function (_a) {
|
|
5519
5722
|
switch (_a.label) {
|
|
5520
5723
|
case 0:
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5724
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5725
|
+
this.loggerService.info("storagePublicService remove", {
|
|
5726
|
+
itemId: itemId,
|
|
5727
|
+
clientId: clientId,
|
|
5728
|
+
storageName: storageName,
|
|
5729
|
+
});
|
|
5526
5730
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5527
5731
|
return __generator(this, function (_a) {
|
|
5528
5732
|
switch (_a.label) {
|
|
@@ -5552,12 +5756,13 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5552
5756
|
return __generator(this, function (_a) {
|
|
5553
5757
|
switch (_a.label) {
|
|
5554
5758
|
case 0:
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
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
|
+
});
|
|
5561
5766
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5562
5767
|
return __generator(this, function (_a) {
|
|
5563
5768
|
switch (_a.label) {
|
|
@@ -5587,11 +5792,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5587
5792
|
return __generator(this, function (_a) {
|
|
5588
5793
|
switch (_a.label) {
|
|
5589
5794
|
case 0:
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5795
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5796
|
+
this.loggerService.info("storagePublicService list", {
|
|
5797
|
+
methodName: methodName,
|
|
5798
|
+
clientId: clientId,
|
|
5799
|
+
storageName: storageName,
|
|
5800
|
+
});
|
|
5595
5801
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5596
5802
|
return __generator(this, function (_a) {
|
|
5597
5803
|
switch (_a.label) {
|
|
@@ -5620,11 +5826,12 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5620
5826
|
return __generator(this, function (_a) {
|
|
5621
5827
|
switch (_a.label) {
|
|
5622
5828
|
case 0:
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5829
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5830
|
+
this.loggerService.info("storagePublicService clear", {
|
|
5831
|
+
methodName: methodName,
|
|
5832
|
+
clientId: clientId,
|
|
5833
|
+
storageName: storageName,
|
|
5834
|
+
});
|
|
5628
5835
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5629
5836
|
return __generator(this, function (_a) {
|
|
5630
5837
|
switch (_a.label) {
|
|
@@ -5655,10 +5862,11 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5655
5862
|
return __generator(this, function (_a) {
|
|
5656
5863
|
switch (_a.label) {
|
|
5657
5864
|
case 0:
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5865
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5866
|
+
this.loggerService.info("storagePublicService dispose", {
|
|
5867
|
+
clientId: clientId,
|
|
5868
|
+
storageName: storageName,
|
|
5869
|
+
});
|
|
5662
5870
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5663
5871
|
return __generator(this, function (_a) {
|
|
5664
5872
|
switch (_a.label) {
|
|
@@ -5698,10 +5906,11 @@ var StorageValidationService = /** @class */ (function () {
|
|
|
5698
5906
|
* @throws {Error} If the storage already exists.
|
|
5699
5907
|
*/
|
|
5700
5908
|
this.addStorage = function (storageName, storageSchema) {
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5909
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5910
|
+
_this.loggerService.info("storageValidationService addStorage", {
|
|
5911
|
+
storageName: storageName,
|
|
5912
|
+
storageSchema: storageSchema,
|
|
5913
|
+
});
|
|
5705
5914
|
if (_this._storageMap.has(storageName)) {
|
|
5706
5915
|
throw new Error("storage-swarm storage ".concat(storageName, " already exist"));
|
|
5707
5916
|
}
|
|
@@ -5717,10 +5926,11 @@ var StorageValidationService = /** @class */ (function () {
|
|
|
5717
5926
|
var _b = __read(_a, 1), storageName = _b[0];
|
|
5718
5927
|
return storageName;
|
|
5719
5928
|
}, function (storageName, source) {
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5929
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5930
|
+
_this.loggerService.info("storageValidationService validate", {
|
|
5931
|
+
storageName: storageName,
|
|
5932
|
+
source: source,
|
|
5933
|
+
});
|
|
5724
5934
|
var storage = _this._storageMap.get(storageName);
|
|
5725
5935
|
if (!storage) {
|
|
5726
5936
|
throw new Error("storage-swarm storage ".concat(storageName, " not found source=").concat(source));
|
|
@@ -5747,10 +5957,11 @@ var EmbeddingValidationService = /** @class */ (function () {
|
|
|
5747
5957
|
* @throws Will throw an error if the embedding already exists.
|
|
5748
5958
|
*/
|
|
5749
5959
|
this.addEmbedding = function (embeddingName, embeddingSchema) {
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5960
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5961
|
+
_this.loggerService.info("embeddingValidationService addEmbedding", {
|
|
5962
|
+
embeddingName: embeddingName,
|
|
5963
|
+
embeddingSchema: embeddingSchema,
|
|
5964
|
+
});
|
|
5754
5965
|
if (_this._embeddingMap.has(embeddingName)) {
|
|
5755
5966
|
throw new Error("agent-swarm embedding ".concat(embeddingName, " already exist"));
|
|
5756
5967
|
}
|
|
@@ -5766,10 +5977,11 @@ var EmbeddingValidationService = /** @class */ (function () {
|
|
|
5766
5977
|
var _b = __read(_a, 1), embeddingName = _b[0];
|
|
5767
5978
|
return embeddingName;
|
|
5768
5979
|
}, function (embeddingName, source) {
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5980
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5981
|
+
_this.loggerService.info("embeddingValidationService validate", {
|
|
5982
|
+
embeddingName: embeddingName,
|
|
5983
|
+
source: source,
|
|
5984
|
+
});
|
|
5773
5985
|
if (!_this._embeddingMap.has(embeddingName)) {
|
|
5774
5986
|
throw new Error("agent-swarm embedding ".concat(embeddingName, " not found source=").concat(source));
|
|
5775
5987
|
}
|
|
@@ -5793,7 +6005,8 @@ var StateSchemaService = /** @class */ (function () {
|
|
|
5793
6005
|
* @param {IStateSchema} value - The schema to register.
|
|
5794
6006
|
*/
|
|
5795
6007
|
this.register = function (key, value) {
|
|
5796
|
-
|
|
6008
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6009
|
+
_this.loggerService.info("stateSchemaService register", { key: key });
|
|
5797
6010
|
_this.registry = _this.registry.register(key, value);
|
|
5798
6011
|
};
|
|
5799
6012
|
/**
|
|
@@ -5802,7 +6015,8 @@ var StateSchemaService = /** @class */ (function () {
|
|
|
5802
6015
|
* @returns {IStateSchema} The retrieved schema.
|
|
5803
6016
|
*/
|
|
5804
6017
|
this.get = function (key) {
|
|
5805
|
-
|
|
6018
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6019
|
+
_this.loggerService.info("stateSchemaService get", { key: key });
|
|
5806
6020
|
return _this.registry.get(key);
|
|
5807
6021
|
};
|
|
5808
6022
|
}
|
|
@@ -5836,7 +6050,7 @@ var ClientState = /** @class */ (function () {
|
|
|
5836
6050
|
console.assert(payload, "agent-swarm ClientState write action undefined payload");
|
|
5837
6051
|
_a = this;
|
|
5838
6052
|
return [4 /*yield*/, payload(this._state)];
|
|
5839
|
-
case 1: return [2 /*return*/, _a._state = _b.sent()];
|
|
6053
|
+
case 1: return [2 /*return*/, (_a._state = _b.sent())];
|
|
5840
6054
|
case 2: throw new Error("agent-swarm ClientState unknown action");
|
|
5841
6055
|
}
|
|
5842
6056
|
});
|
|
@@ -5851,12 +6065,14 @@ var ClientState = /** @class */ (function () {
|
|
|
5851
6065
|
return __generator(this, function (_c) {
|
|
5852
6066
|
switch (_c.label) {
|
|
5853
6067
|
case 0:
|
|
5854
|
-
|
|
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"));
|
|
5855
6070
|
_a = this;
|
|
5856
6071
|
return [4 /*yield*/, this.params.getState(this.params.clientId, this.params.stateName)];
|
|
5857
6072
|
case 1:
|
|
5858
6073
|
_a._state = _c.sent();
|
|
5859
|
-
|
|
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 });
|
|
5860
6076
|
if ((_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onLoad) {
|
|
5861
6077
|
this.params.callbacks.onLoad(this._state, this.params.clientId, this.params.stateName);
|
|
5862
6078
|
}
|
|
@@ -5875,7 +6091,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5875
6091
|
return __generator(this, function (_b) {
|
|
5876
6092
|
switch (_b.label) {
|
|
5877
6093
|
case 0:
|
|
5878
|
-
|
|
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"));
|
|
5879
6096
|
return [4 /*yield*/, this.dispatch("write", function (currentState) { return __awaiter(_this, void 0, void 0, function () {
|
|
5880
6097
|
var _a, _b, middleware, e_1_1;
|
|
5881
6098
|
var e_1, _c;
|
|
@@ -5913,7 +6130,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5913
6130
|
}); })];
|
|
5914
6131
|
case 1:
|
|
5915
6132
|
_b.sent();
|
|
5916
|
-
|
|
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 });
|
|
5917
6135
|
this.params.setState &&
|
|
5918
6136
|
this.params.setState(this._state, this.params.clientId, this.params.stateName);
|
|
5919
6137
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onWrite) {
|
|
@@ -5946,7 +6164,8 @@ var ClientState = /** @class */ (function () {
|
|
|
5946
6164
|
return __generator(this, function (_b) {
|
|
5947
6165
|
switch (_b.label) {
|
|
5948
6166
|
case 0:
|
|
5949
|
-
|
|
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"));
|
|
5950
6169
|
return [4 /*yield*/, this.dispatch("read")];
|
|
5951
6170
|
case 1:
|
|
5952
6171
|
_b.sent();
|
|
@@ -5978,16 +6197,18 @@ var ClientState = /** @class */ (function () {
|
|
|
5978
6197
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5979
6198
|
var _a;
|
|
5980
6199
|
return __generator(this, function (_b) {
|
|
5981
|
-
|
|
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"));
|
|
5982
6202
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5983
6203
|
this.params.callbacks.onDispose(this.params.clientId, this.params.stateName);
|
|
5984
6204
|
}
|
|
5985
6205
|
return [2 /*return*/];
|
|
5986
6206
|
});
|
|
5987
6207
|
}); };
|
|
5988
|
-
|
|
5989
|
-
params
|
|
5990
|
-
|
|
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
|
+
});
|
|
5991
6212
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5992
6213
|
this.params.callbacks.onInit(this.params.clientId, this.params.stateName);
|
|
5993
6214
|
}
|
|
@@ -6096,7 +6317,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6096
6317
|
return __generator(this, function (_a) {
|
|
6097
6318
|
switch (_a.label) {
|
|
6098
6319
|
case 0:
|
|
6099
|
-
|
|
6320
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6321
|
+
this.loggerService.info("stateConnectionService setState");
|
|
6100
6322
|
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6101
6323
|
return [4 /*yield*/, state.waitForInit()];
|
|
6102
6324
|
case 1:
|
|
@@ -6115,7 +6337,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6115
6337
|
return __generator(this, function (_a) {
|
|
6116
6338
|
switch (_a.label) {
|
|
6117
6339
|
case 0:
|
|
6118
|
-
|
|
6340
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6341
|
+
this.loggerService.info("stateConnectionService getState");
|
|
6119
6342
|
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6120
6343
|
return [4 /*yield*/, state.waitForInit()];
|
|
6121
6344
|
case 1:
|
|
@@ -6134,7 +6357,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6134
6357
|
return __generator(this, function (_a) {
|
|
6135
6358
|
switch (_a.label) {
|
|
6136
6359
|
case 0:
|
|
6137
|
-
|
|
6360
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6361
|
+
this.loggerService.info("stateConnectionService dispose");
|
|
6138
6362
|
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.stateName);
|
|
6139
6363
|
if (!this.getStateRef.has(key)) {
|
|
6140
6364
|
return [2 /*return*/];
|
|
@@ -6176,11 +6400,12 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6176
6400
|
return __generator(this, function (_a) {
|
|
6177
6401
|
switch (_a.label) {
|
|
6178
6402
|
case 0:
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6403
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6404
|
+
this.loggerService.info("statePublicService setState", {
|
|
6405
|
+
methodName: methodName,
|
|
6406
|
+
clientId: clientId,
|
|
6407
|
+
stateName: stateName,
|
|
6408
|
+
});
|
|
6184
6409
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6185
6410
|
return __generator(this, function (_a) {
|
|
6186
6411
|
switch (_a.label) {
|
|
@@ -6211,10 +6436,11 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6211
6436
|
return __generator(this, function (_a) {
|
|
6212
6437
|
switch (_a.label) {
|
|
6213
6438
|
case 0:
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6439
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6440
|
+
this.loggerService.info("statePublicService getState", {
|
|
6441
|
+
clientId: clientId,
|
|
6442
|
+
stateName: stateName,
|
|
6443
|
+
});
|
|
6218
6444
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6219
6445
|
return __generator(this, function (_a) {
|
|
6220
6446
|
switch (_a.label) {
|
|
@@ -6245,11 +6471,12 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6245
6471
|
return __generator(this, function (_a) {
|
|
6246
6472
|
switch (_a.label) {
|
|
6247
6473
|
case 0:
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6474
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6475
|
+
this.loggerService.info("statePublicService dispose", {
|
|
6476
|
+
methodName: methodName,
|
|
6477
|
+
clientId: clientId,
|
|
6478
|
+
stateName: stateName,
|
|
6479
|
+
});
|
|
6253
6480
|
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6254
6481
|
return __generator(this, function (_a) {
|
|
6255
6482
|
switch (_a.label) {
|
|
@@ -6291,10 +6518,11 @@ var BusService = /** @class */ (function () {
|
|
|
6291
6518
|
* @param {(event: T) => void} fn - The callback function to handle the event.
|
|
6292
6519
|
*/
|
|
6293
6520
|
this.subscribe = function (clientId, source, fn) {
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6521
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6522
|
+
_this.loggerService.info("busService subscribe", {
|
|
6523
|
+
clientId: clientId,
|
|
6524
|
+
source: source,
|
|
6525
|
+
});
|
|
6298
6526
|
if (clientId === "*") {
|
|
6299
6527
|
_this._eventWildcardMap.set(source, true);
|
|
6300
6528
|
}
|
|
@@ -6310,10 +6538,11 @@ var BusService = /** @class */ (function () {
|
|
|
6310
6538
|
* @returns {Subscription} The subscription object.
|
|
6311
6539
|
*/
|
|
6312
6540
|
this.once = function (clientId, source, filterFn, fn) {
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6541
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6542
|
+
_this.loggerService.info("busService once", {
|
|
6543
|
+
clientId: clientId,
|
|
6544
|
+
source: source,
|
|
6545
|
+
});
|
|
6317
6546
|
if (clientId === "*") {
|
|
6318
6547
|
_this._eventWildcardMap.set(source, true);
|
|
6319
6548
|
}
|
|
@@ -6330,10 +6559,11 @@ var BusService = /** @class */ (function () {
|
|
|
6330
6559
|
return __generator(this, function (_a) {
|
|
6331
6560
|
switch (_a.label) {
|
|
6332
6561
|
case 0:
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6562
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6563
|
+
this.loggerService.info("busService emit", {
|
|
6564
|
+
clientId: clientId,
|
|
6565
|
+
event: event,
|
|
6566
|
+
});
|
|
6337
6567
|
if (!this.sessionValidationService.hasSession(clientId)) {
|
|
6338
6568
|
return [2 /*return*/];
|
|
6339
6569
|
}
|
|
@@ -6358,9 +6588,10 @@ var BusService = /** @class */ (function () {
|
|
|
6358
6588
|
*/
|
|
6359
6589
|
this.dispose = function (clientId) {
|
|
6360
6590
|
var e_1, _a;
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6591
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6592
|
+
_this.loggerService.info("busService dispose", {
|
|
6593
|
+
clientId: clientId,
|
|
6594
|
+
});
|
|
6364
6595
|
try {
|
|
6365
6596
|
for (var _b = __values(_this._eventSourceSet), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6366
6597
|
var source = _c.value;
|
|
@@ -6484,9 +6715,10 @@ init();
|
|
|
6484
6715
|
* @returns {string} The name of the added agent.
|
|
6485
6716
|
*/
|
|
6486
6717
|
var addAgent = function (agentSchema) {
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6718
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6719
|
+
swarm.loggerService.log("function addAgent", {
|
|
6720
|
+
agentSchema: agentSchema,
|
|
6721
|
+
});
|
|
6490
6722
|
swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
|
|
6491
6723
|
swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
|
|
6492
6724
|
return agentSchema.agentName;
|
|
@@ -6500,9 +6732,10 @@ var addAgent = function (agentSchema) {
|
|
|
6500
6732
|
* @returns {string} The name of the completion that was added.
|
|
6501
6733
|
*/
|
|
6502
6734
|
var addCompletion = function (completionSchema) {
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6735
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6736
|
+
swarm.loggerService.log("function addCompletion", {
|
|
6737
|
+
completionSchema: completionSchema,
|
|
6738
|
+
});
|
|
6506
6739
|
swarm.completionValidationService.addCompletion(completionSchema.completionName);
|
|
6507
6740
|
swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
|
|
6508
6741
|
return completionSchema.completionName;
|
|
@@ -6515,9 +6748,10 @@ var addCompletion = function (completionSchema) {
|
|
|
6515
6748
|
* @returns {string} The name of the added swarm.
|
|
6516
6749
|
*/
|
|
6517
6750
|
var addSwarm = function (swarmSchema) {
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6751
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6752
|
+
swarm.loggerService.log("function addSwarm", {
|
|
6753
|
+
swarmSchema: swarmSchema,
|
|
6754
|
+
});
|
|
6521
6755
|
swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
|
|
6522
6756
|
swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
|
|
6523
6757
|
return swarmSchema.swarmName;
|
|
@@ -6531,9 +6765,10 @@ var addSwarm = function (swarmSchema) {
|
|
|
6531
6765
|
* @returns {string} The name of the tool that was added.
|
|
6532
6766
|
*/
|
|
6533
6767
|
var addTool = function (toolSchema) {
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6768
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6769
|
+
swarm.loggerService.log("function addTool", {
|
|
6770
|
+
toolSchema: toolSchema,
|
|
6771
|
+
});
|
|
6537
6772
|
swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
|
|
6538
6773
|
swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
|
|
6539
6774
|
return toolSchema.toolName;
|
|
@@ -6546,9 +6781,10 @@ var addTool = function (toolSchema) {
|
|
|
6546
6781
|
* @returns {string} The name of the added state.
|
|
6547
6782
|
*/
|
|
6548
6783
|
var addState = function (stateSchema) {
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6784
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6785
|
+
swarm.loggerService.log("function addState", {
|
|
6786
|
+
stateSchema: stateSchema,
|
|
6787
|
+
});
|
|
6552
6788
|
swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
6553
6789
|
if (stateSchema.shared) {
|
|
6554
6790
|
swarm.stateConnectionService
|
|
@@ -6565,9 +6801,10 @@ var addState = function (stateSchema) {
|
|
|
6565
6801
|
* @returns {string} The name of the added embedding.
|
|
6566
6802
|
*/
|
|
6567
6803
|
var addEmbedding = function (embeddingSchema) {
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6804
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6805
|
+
swarm.loggerService.log("function addEmbedding", {
|
|
6806
|
+
embeddingSchema: embeddingSchema,
|
|
6807
|
+
});
|
|
6571
6808
|
swarm.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
|
|
6572
6809
|
swarm.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
|
|
6573
6810
|
return embeddingSchema.embeddingName;
|
|
@@ -6580,9 +6817,10 @@ var addEmbedding = function (embeddingSchema) {
|
|
|
6580
6817
|
* @returns {string} The name of the added storage.
|
|
6581
6818
|
*/
|
|
6582
6819
|
var addStorage = function (storageSchema) {
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6820
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6821
|
+
swarm.loggerService.log("function addStorage", {
|
|
6822
|
+
storageSchema: storageSchema,
|
|
6823
|
+
});
|
|
6586
6824
|
swarm.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
|
|
6587
6825
|
swarm.storageSchemaService.register(storageSchema.storageName, storageSchema);
|
|
6588
6826
|
if (storageSchema.shared) {
|
|
@@ -6606,12 +6844,13 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6606
6844
|
return __generator(this, function (_a) {
|
|
6607
6845
|
switch (_a.label) {
|
|
6608
6846
|
case 0:
|
|
6609
|
-
methodName =
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
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
|
+
});
|
|
6615
6854
|
swarm.agentValidationService.validate(agentName, "commitUserMessage");
|
|
6616
6855
|
swarm.sessionValidationService.validate(clientId, "commitUserMessage");
|
|
6617
6856
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -6620,11 +6859,12 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6620
6859
|
case 1:
|
|
6621
6860
|
currentAgentName = _a.sent();
|
|
6622
6861
|
if (currentAgentName !== agentName) {
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
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
|
+
});
|
|
6628
6868
|
return [2 /*return*/];
|
|
6629
6869
|
}
|
|
6630
6870
|
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
@@ -6648,9 +6888,10 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
6648
6888
|
switch (_a.label) {
|
|
6649
6889
|
case 0:
|
|
6650
6890
|
methodName = "function getAgentName";
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6891
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6892
|
+
swarm.loggerService.log("function getAgentName", {
|
|
6893
|
+
clientId: clientId,
|
|
6894
|
+
});
|
|
6654
6895
|
swarm.sessionValidationService.validate(clientId, "getAgentName");
|
|
6655
6896
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6656
6897
|
swarm.swarmValidationService.validate(swarmName, "getAgentName");
|
|
@@ -6671,10 +6912,11 @@ var SCHEDULED_DELAY$1 = 1000;
|
|
|
6671
6912
|
*/
|
|
6672
6913
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
6673
6914
|
var methodName = "function makeConnection";
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6915
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6916
|
+
swarm.loggerService.log("function makeConnection", {
|
|
6917
|
+
clientId: clientId,
|
|
6918
|
+
swarmName: swarmName,
|
|
6919
|
+
});
|
|
6678
6920
|
swarm.swarmValidationService.validate(swarmName, "makeConnection");
|
|
6679
6921
|
swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
6680
6922
|
var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
|
|
@@ -6868,10 +7110,11 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
|
|
|
6868
7110
|
switch (_a.label) {
|
|
6869
7111
|
case 0:
|
|
6870
7112
|
methodName = "function changeAgent";
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
7113
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7114
|
+
swarm.loggerService.log("function changeAgent", {
|
|
7115
|
+
agentName: agentName,
|
|
7116
|
+
clientId: clientId,
|
|
7117
|
+
});
|
|
6875
7118
|
return [4 /*yield*/, createChangeAgent(clientId)];
|
|
6876
7119
|
case 1:
|
|
6877
7120
|
run = _a.sent();
|
|
@@ -6899,10 +7142,11 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6899
7142
|
return __generator(this, function (_a) {
|
|
6900
7143
|
switch (_a.label) {
|
|
6901
7144
|
case 0:
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
7145
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7146
|
+
swarm.loggerService.log("function disposeConnection", {
|
|
7147
|
+
clientId: clientId,
|
|
7148
|
+
swarmName: swarmName,
|
|
7149
|
+
});
|
|
6906
7150
|
swarm.swarmValidationService.validate(swarmName, "disposeConnection");
|
|
6907
7151
|
swarm.sessionValidationService.removeSession(clientId);
|
|
6908
7152
|
swarm.busService.dispose(clientId);
|
|
@@ -7033,12 +7277,13 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
7033
7277
|
case 0:
|
|
7034
7278
|
methodName = "function complete";
|
|
7035
7279
|
executionId = functoolsKit.randomString();
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
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
|
+
});
|
|
7042
7287
|
return [4 /*yield*/, createComplete(clientId, swarmName)];
|
|
7043
7288
|
case 1:
|
|
7044
7289
|
run = _a.sent();
|
|
@@ -7071,11 +7316,12 @@ var SCHEDULED_DELAY = 1000;
|
|
|
7071
7316
|
var session = function (clientId, swarmName) {
|
|
7072
7317
|
var methodName = "function session";
|
|
7073
7318
|
var executionId = functoolsKit.randomString();
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7319
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7320
|
+
swarm.loggerService.log("function session", {
|
|
7321
|
+
clientId: clientId,
|
|
7322
|
+
swarmName: swarmName,
|
|
7323
|
+
executionId: executionId,
|
|
7324
|
+
});
|
|
7079
7325
|
swarm.swarmValidationService.validate(swarmName, "session");
|
|
7080
7326
|
swarm.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
7081
7327
|
return {
|
|
@@ -7225,9 +7471,10 @@ var getRawHistory = function (clientId_1) {
|
|
|
7225
7471
|
return __generator(this, function (_a) {
|
|
7226
7472
|
switch (_a.label) {
|
|
7227
7473
|
case 0:
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7474
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7475
|
+
swarm.loggerService.log("function getRawHistory", {
|
|
7476
|
+
clientId: clientId,
|
|
7477
|
+
});
|
|
7231
7478
|
swarm.sessionValidationService.validate(clientId, "getRawHistory");
|
|
7232
7479
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7233
7480
|
swarm.swarmValidationService.validate(swarmName, "getRawHistory");
|
|
@@ -7256,10 +7503,11 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
7256
7503
|
switch (_a.label) {
|
|
7257
7504
|
case 0:
|
|
7258
7505
|
methodName = "function getAgentHistory";
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7506
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7507
|
+
swarm.loggerService.log("function getAgentHistory", {
|
|
7508
|
+
clientId: clientId,
|
|
7509
|
+
agentName: agentName,
|
|
7510
|
+
});
|
|
7263
7511
|
swarm.agentValidationService.validate(agentName, "getAgentHistory");
|
|
7264
7512
|
prompt = swarm.agentSchemaService.get(agentName).prompt;
|
|
7265
7513
|
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
|
|
@@ -7278,9 +7526,10 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
7278
7526
|
var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7279
7527
|
var swarmName;
|
|
7280
7528
|
return __generator(this, function (_a) {
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7529
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7530
|
+
swarm.loggerService.log("function getSessionMode", {
|
|
7531
|
+
clientId: clientId,
|
|
7532
|
+
});
|
|
7284
7533
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7285
7534
|
swarm.swarmValidationService.validate(swarmName, "getSessionMode");
|
|
7286
7535
|
return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
|
|
@@ -7300,14 +7549,15 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7300
7549
|
return __generator(this, function (_a) {
|
|
7301
7550
|
switch (_a.label) {
|
|
7302
7551
|
case 0:
|
|
7303
|
-
methodName =
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
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
|
+
});
|
|
7311
7561
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7312
7562
|
swarm.sessionValidationService.validate(clientId, "commitToolOutput");
|
|
7313
7563
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7316,12 +7566,13 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7316
7566
|
case 1:
|
|
7317
7567
|
currentAgentName = _a.sent();
|
|
7318
7568
|
if (currentAgentName !== agentName) {
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
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
|
+
});
|
|
7325
7576
|
return [2 /*return*/];
|
|
7326
7577
|
}
|
|
7327
7578
|
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
@@ -7333,7 +7584,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7333
7584
|
}); };
|
|
7334
7585
|
|
|
7335
7586
|
/**
|
|
7336
|
-
* Commits a system message to the active agent in
|
|
7587
|
+
* Commits a system message to the active agent in the swarm.
|
|
7337
7588
|
*
|
|
7338
7589
|
* @param {string} content - The content of the system message.
|
|
7339
7590
|
* @param {string} clientId - The ID of the client.
|
|
@@ -7345,12 +7596,13 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7345
7596
|
return __generator(this, function (_a) {
|
|
7346
7597
|
switch (_a.label) {
|
|
7347
7598
|
case 0:
|
|
7348
|
-
methodName =
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
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
|
+
});
|
|
7354
7606
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7355
7607
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
|
|
7356
7608
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7359,11 +7611,12 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7359
7611
|
case 1:
|
|
7360
7612
|
currentAgentName = _a.sent();
|
|
7361
7613
|
if (currentAgentName !== agentName) {
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
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
|
+
});
|
|
7367
7620
|
return [2 /*return*/];
|
|
7368
7621
|
}
|
|
7369
7622
|
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
@@ -7386,11 +7639,12 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7386
7639
|
return __generator(this, function (_a) {
|
|
7387
7640
|
switch (_a.label) {
|
|
7388
7641
|
case 0:
|
|
7389
|
-
methodName =
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7642
|
+
methodName = "function commitFlush";
|
|
7643
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7644
|
+
swarm.loggerService.log("function commitFlush", {
|
|
7645
|
+
clientId: clientId,
|
|
7646
|
+
agentName: agentName,
|
|
7647
|
+
});
|
|
7394
7648
|
swarm.agentValidationService.validate(agentName, "commitFlush");
|
|
7395
7649
|
swarm.sessionValidationService.validate(clientId, "commitFlush");
|
|
7396
7650
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7399,11 +7653,12 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7399
7653
|
case 1:
|
|
7400
7654
|
currentAgentName = _a.sent();
|
|
7401
7655
|
if (currentAgentName !== agentName) {
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
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
|
+
});
|
|
7407
7662
|
return [2 /*return*/];
|
|
7408
7663
|
}
|
|
7409
7664
|
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
@@ -7430,13 +7685,14 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7430
7685
|
case 0:
|
|
7431
7686
|
methodName = "function execute";
|
|
7432
7687
|
executionId = functoolsKit.randomString();
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
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
|
+
});
|
|
7440
7696
|
swarm.agentValidationService.validate(agentName, "execute");
|
|
7441
7697
|
swarm.sessionValidationService.validate(clientId, "execute");
|
|
7442
7698
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -7445,11 +7701,12 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7445
7701
|
case 1:
|
|
7446
7702
|
currentAgentName = _a.sent();
|
|
7447
7703
|
if (currentAgentName !== agentName) {
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
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
|
+
});
|
|
7453
7710
|
return [2 /*return*/];
|
|
7454
7711
|
}
|
|
7455
7712
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -7483,11 +7740,12 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7483
7740
|
switch (_a.label) {
|
|
7484
7741
|
case 0:
|
|
7485
7742
|
methodName = "function emit";
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7743
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7744
|
+
swarm.loggerService.log("function emit", {
|
|
7745
|
+
content: content,
|
|
7746
|
+
clientId: clientId,
|
|
7747
|
+
agentName: agentName,
|
|
7748
|
+
});
|
|
7491
7749
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7492
7750
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
7493
7751
|
}
|
|
@@ -7499,11 +7757,12 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7499
7757
|
case 1:
|
|
7500
7758
|
currentAgentName = _a.sent();
|
|
7501
7759
|
if (currentAgentName !== agentName) {
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
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
|
+
});
|
|
7507
7766
|
return [2 /*return*/];
|
|
7508
7767
|
}
|
|
7509
7768
|
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
@@ -7524,12 +7783,13 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
7524
7783
|
return __generator(this, function (_a) {
|
|
7525
7784
|
switch (_a.label) {
|
|
7526
7785
|
case 0:
|
|
7527
|
-
methodName =
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
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
|
+
});
|
|
7533
7793
|
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
7534
7794
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7535
7795
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
@@ -7553,11 +7813,12 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
7553
7813
|
return __generator(this, function (_a) {
|
|
7554
7814
|
switch (_a.label) {
|
|
7555
7815
|
case 0:
|
|
7556
|
-
methodName =
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7816
|
+
methodName = "function commitSystemMessageForce";
|
|
7817
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7818
|
+
swarm.loggerService.log("function commitSystemMessageForce", {
|
|
7819
|
+
content: content,
|
|
7820
|
+
clientId: clientId,
|
|
7821
|
+
});
|
|
7561
7822
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
7562
7823
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7563
7824
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
@@ -7580,11 +7841,12 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
7580
7841
|
return __generator(this, function (_a) {
|
|
7581
7842
|
switch (_a.label) {
|
|
7582
7843
|
case 0:
|
|
7583
|
-
methodName =
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7844
|
+
methodName = "function commitFlushForce";
|
|
7845
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7846
|
+
swarm.loggerService.log("function commitFlushForce", {
|
|
7847
|
+
clientId: clientId,
|
|
7848
|
+
methodName: methodName,
|
|
7849
|
+
});
|
|
7588
7850
|
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
7589
7851
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7590
7852
|
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
@@ -7608,11 +7870,12 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
7608
7870
|
return __generator(this, function (_a) {
|
|
7609
7871
|
switch (_a.label) {
|
|
7610
7872
|
case 0:
|
|
7611
|
-
methodName =
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7873
|
+
methodName = "function commitSystemMessage";
|
|
7874
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7875
|
+
swarm.loggerService.log("function commitSystemMessage", {
|
|
7876
|
+
content: content,
|
|
7877
|
+
clientId: clientId,
|
|
7878
|
+
});
|
|
7616
7879
|
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
7617
7880
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7618
7881
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
@@ -7640,10 +7903,11 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7640
7903
|
switch (_a.label) {
|
|
7641
7904
|
case 0:
|
|
7642
7905
|
methodName = "function emitForce";
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7906
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7907
|
+
swarm.loggerService.log("function emitForce", {
|
|
7908
|
+
content: content,
|
|
7909
|
+
clientId: clientId,
|
|
7910
|
+
});
|
|
7647
7911
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7648
7912
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
7649
7913
|
}
|
|
@@ -7671,11 +7935,12 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
7671
7935
|
return __generator(this, function (_a) {
|
|
7672
7936
|
methodName = "function executeForce";
|
|
7673
7937
|
executionId = functoolsKit.randomString();
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7938
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7939
|
+
swarm.loggerService.log("function executeForce", {
|
|
7940
|
+
content: content,
|
|
7941
|
+
clientId: clientId,
|
|
7942
|
+
executionId: executionId,
|
|
7943
|
+
});
|
|
7679
7944
|
swarm.sessionValidationService.validate(clientId, "executeForce");
|
|
7680
7945
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7681
7946
|
swarm.swarmValidationService.validate(swarmName, "executeForce");
|
|
@@ -7717,9 +7982,10 @@ var validateClientId$d = function (clientId) {
|
|
|
7717
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.
|
|
7718
7983
|
*/
|
|
7719
7984
|
var listenEvent = function (clientId, topicName, fn) {
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7985
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7986
|
+
swarm.loggerService.log("function listenEvent", {
|
|
7987
|
+
clientId: clientId,
|
|
7988
|
+
});
|
|
7723
7989
|
if (DISALLOWED_EVENT_SOURCE_LIST$2.has(topicName)) {
|
|
7724
7990
|
throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
|
|
7725
7991
|
}
|
|
@@ -7754,9 +8020,10 @@ var validateClientId$c = function (clientId) {
|
|
|
7754
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.
|
|
7755
8021
|
*/
|
|
7756
8022
|
var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
8023
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8024
|
+
swarm.loggerService.log("function listenEventOnce", {
|
|
8025
|
+
clientId: clientId,
|
|
8026
|
+
});
|
|
7760
8027
|
if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
|
|
7761
8028
|
throw new Error("agent-swarm listenEventOnce topic is reserved topicName=".concat(topicName));
|
|
7762
8029
|
}
|
|
@@ -7782,9 +8049,10 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7782
8049
|
switch (_a.label) {
|
|
7783
8050
|
case 0:
|
|
7784
8051
|
methodName = "function getLastUserMessage";
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
8052
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8053
|
+
swarm.loggerService.log("function getLastUserMessage", {
|
|
8054
|
+
clientId: clientId,
|
|
8055
|
+
});
|
|
7788
8056
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7789
8057
|
case 1:
|
|
7790
8058
|
history = _a.sent();
|
|
@@ -7809,9 +8077,10 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7809
8077
|
switch (_a.label) {
|
|
7810
8078
|
case 0:
|
|
7811
8079
|
methodName = "function getUserHistory";
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
8080
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8081
|
+
swarm.loggerService.log("function getUserHistory", {
|
|
8082
|
+
clientId: clientId,
|
|
8083
|
+
});
|
|
7815
8084
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7816
8085
|
case 1:
|
|
7817
8086
|
history = _a.sent();
|
|
@@ -7835,9 +8104,10 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7835
8104
|
switch (_a.label) {
|
|
7836
8105
|
case 0:
|
|
7837
8106
|
methodName = "function getAssistantHistory";
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
8107
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8108
|
+
swarm.loggerService.log("function getAssistantHistory", {
|
|
8109
|
+
clientId: clientId,
|
|
8110
|
+
});
|
|
7841
8111
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7842
8112
|
case 1:
|
|
7843
8113
|
history = _a.sent();
|
|
@@ -7861,9 +8131,10 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
7861
8131
|
switch (_a.label) {
|
|
7862
8132
|
case 0:
|
|
7863
8133
|
methodName = "function getLastAssistantMessage";
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
8134
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8135
|
+
swarm.loggerService.log("function getLastAssistantMessage", {
|
|
8136
|
+
clientId: clientId,
|
|
8137
|
+
});
|
|
7867
8138
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7868
8139
|
case 1:
|
|
7869
8140
|
history = _a.sent();
|
|
@@ -7888,9 +8159,10 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
|
|
|
7888
8159
|
switch (_a.label) {
|
|
7889
8160
|
case 0:
|
|
7890
8161
|
methodName = "function getLastSystemMessage";
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
8162
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8163
|
+
swarm.loggerService.log("function getLastSystemMessage", {
|
|
8164
|
+
clientId: clientId,
|
|
8165
|
+
});
|
|
7894
8166
|
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7895
8167
|
case 1:
|
|
7896
8168
|
history = _a.sent();
|
|
@@ -7914,6 +8186,11 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
7914
8186
|
*/
|
|
7915
8187
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
7916
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
|
+
});
|
|
7917
8194
|
var isOk = true;
|
|
7918
8195
|
var unSource = functoolsKit.Source.fromInterval(1000)
|
|
7919
8196
|
.reduce(function (acm) {
|
|
@@ -7974,9 +8251,10 @@ var DISALLOWED_EVENT_SOURCE_LIST = new Set([
|
|
|
7974
8251
|
* @returns {boolean} - Returns true if the event was successfully emitted.
|
|
7975
8252
|
*/
|
|
7976
8253
|
var event = function (clientId, topicName, payload) {
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
8254
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8255
|
+
swarm.loggerService.log("function listenEvent", {
|
|
8256
|
+
clientId: clientId,
|
|
8257
|
+
});
|
|
7980
8258
|
if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
|
|
7981
8259
|
throw new Error("agent-swarm event topic is reserved topicName=".concat(topicName));
|
|
7982
8260
|
}
|
|
@@ -7999,11 +8277,12 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7999
8277
|
return __generator(this, function (_a) {
|
|
8000
8278
|
switch (_a.label) {
|
|
8001
8279
|
case 0:
|
|
8002
|
-
methodName =
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8280
|
+
methodName = "function cancelOutput";
|
|
8281
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8282
|
+
swarm.loggerService.log("function cancelOutput", {
|
|
8283
|
+
clientId: clientId,
|
|
8284
|
+
agentName: agentName,
|
|
8285
|
+
});
|
|
8007
8286
|
swarm.agentValidationService.validate(agentName, "cancelOutput");
|
|
8008
8287
|
swarm.sessionValidationService.validate(clientId, "cancelOutput");
|
|
8009
8288
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
@@ -8012,11 +8291,12 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
8012
8291
|
case 1:
|
|
8013
8292
|
currentAgentName = _a.sent();
|
|
8014
8293
|
if (currentAgentName !== agentName) {
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
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
|
+
});
|
|
8020
8300
|
return [2 /*return*/];
|
|
8021
8301
|
}
|
|
8022
8302
|
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
@@ -8039,10 +8319,11 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
8039
8319
|
return __generator(this, function (_a) {
|
|
8040
8320
|
switch (_a.label) {
|
|
8041
8321
|
case 0:
|
|
8042
|
-
methodName =
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8322
|
+
methodName = "function cancelOutputForce";
|
|
8323
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8324
|
+
swarm.loggerService.log("function cancelOutputForce", {
|
|
8325
|
+
clientId: clientId,
|
|
8326
|
+
});
|
|
8046
8327
|
swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
|
|
8047
8328
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
8048
8329
|
swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
|
|
@@ -8337,13 +8618,14 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8337
8618
|
switch (_a.label) {
|
|
8338
8619
|
case 0:
|
|
8339
8620
|
methodName = "StorageUtils take";
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
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
|
+
});
|
|
8347
8629
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8348
8630
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8349
8631
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
@@ -8368,11 +8650,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8368
8650
|
switch (_a.label) {
|
|
8369
8651
|
case 0:
|
|
8370
8652
|
methodName = "StorageUtils upsert";
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
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
|
+
});
|
|
8376
8659
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8377
8660
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8378
8661
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
@@ -8396,11 +8679,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8396
8679
|
switch (_a.label) {
|
|
8397
8680
|
case 0:
|
|
8398
8681
|
methodName = "StorageUtils remove";
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
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
|
+
});
|
|
8404
8688
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8405
8689
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8406
8690
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
@@ -8425,11 +8709,12 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8425
8709
|
switch (_a.label) {
|
|
8426
8710
|
case 0:
|
|
8427
8711
|
methodName = "StorageUtils get";
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
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
|
+
});
|
|
8433
8718
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8434
8719
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8435
8720
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
@@ -8454,10 +8739,11 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8454
8739
|
switch (_a.label) {
|
|
8455
8740
|
case 0:
|
|
8456
8741
|
methodName = "StorageUtils list";
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8742
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8743
|
+
swarm.loggerService.log("StorageUtils list", {
|
|
8744
|
+
clientId: payload.clientId,
|
|
8745
|
+
storageName: payload.storageName,
|
|
8746
|
+
});
|
|
8461
8747
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8462
8748
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8463
8749
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
@@ -8480,10 +8766,11 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8480
8766
|
switch (_a.label) {
|
|
8481
8767
|
case 0:
|
|
8482
8768
|
methodName = "StorageUtils clear";
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8769
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8770
|
+
swarm.loggerService.log("StorageUtils clear", {
|
|
8771
|
+
clientId: payload.clientId,
|
|
8772
|
+
storageName: payload.storageName,
|
|
8773
|
+
});
|
|
8487
8774
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8488
8775
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8489
8776
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
@@ -8521,10 +8808,11 @@ var StateUtils = /** @class */ (function () {
|
|
|
8521
8808
|
switch (_a.label) {
|
|
8522
8809
|
case 0:
|
|
8523
8810
|
methodName = "StateUtils getState";
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8811
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8812
|
+
swarm.loggerService.log("StateUtils getState", {
|
|
8813
|
+
clientId: payload.clientId,
|
|
8814
|
+
stateName: payload.stateName,
|
|
8815
|
+
});
|
|
8528
8816
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8529
8817
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
|
|
8530
8818
|
}
|
|
@@ -8551,10 +8839,11 @@ var StateUtils = /** @class */ (function () {
|
|
|
8551
8839
|
switch (_a.label) {
|
|
8552
8840
|
case 0:
|
|
8553
8841
|
methodName = "StateUtils setState";
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8842
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8843
|
+
swarm.loggerService.log("StateUtils setState", {
|
|
8844
|
+
clientId: payload.clientId,
|
|
8845
|
+
stateName: payload.stateName,
|
|
8846
|
+
});
|
|
8558
8847
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8559
8848
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
8560
8849
|
}
|
|
@@ -8584,7 +8873,8 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8584
8873
|
* @param {ILogger} logger - The logger instance to be used.
|
|
8585
8874
|
*/
|
|
8586
8875
|
this.useLogger = function (logger) {
|
|
8587
|
-
|
|
8876
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8877
|
+
swarm.loggerService.log("HistoryInstance useLogger");
|
|
8588
8878
|
swarm.loggerService.setLogger(logger);
|
|
8589
8879
|
};
|
|
8590
8880
|
}
|
|
@@ -8596,12 +8886,99 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8596
8886
|
*/
|
|
8597
8887
|
var Logger = new LoggerUtils();
|
|
8598
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
|
+
|
|
8599
8975
|
exports.ExecutionContextService = ExecutionContextService;
|
|
8600
8976
|
exports.History = History;
|
|
8601
8977
|
exports.HistoryAdapter = HistoryAdapter;
|
|
8602
8978
|
exports.HistoryInstance = HistoryInstance;
|
|
8603
8979
|
exports.Logger = Logger;
|
|
8604
8980
|
exports.MethodContextService = MethodContextService;
|
|
8981
|
+
exports.Schema = Schema;
|
|
8605
8982
|
exports.State = State;
|
|
8606
8983
|
exports.Storage = Storage;
|
|
8607
8984
|
exports.addAgent = addAgent;
|