agent-swarm-kit 1.0.69 → 1.0.71
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 +1016 -131
- package/build/index.mjs +1007 -132
- package/package.json +1 -1
- package/types.d.ts +921 -686
package/build/index.cjs
CHANGED
|
@@ -227,6 +227,7 @@ var _a;
|
|
|
227
227
|
var init = (_a = diKit.createActivator("agent-swarm"), _a.init), inject = _a.inject, provide = _a.provide;
|
|
228
228
|
|
|
229
229
|
var baseServices$1 = {
|
|
230
|
+
busService: Symbol('busService'),
|
|
230
231
|
loggerService: Symbol('loggerService'),
|
|
231
232
|
contextService: Symbol('contextService'),
|
|
232
233
|
};
|
|
@@ -953,7 +954,7 @@ var ClientAgent = /** @class */ (function () {
|
|
|
953
954
|
validation = null;
|
|
954
955
|
return [4 /*yield*/, this.params.validate(result)];
|
|
955
956
|
case 2:
|
|
956
|
-
if (!(validation = _a.sent())) return [3 /*break*/,
|
|
957
|
+
if (!(validation = _a.sent())) return [3 /*break*/, 8];
|
|
957
958
|
return [4 /*yield*/, this._resurrectModel(mode, validation)];
|
|
958
959
|
case 3:
|
|
959
960
|
rawResult_1 = _a.sent();
|
|
@@ -970,12 +971,44 @@ var ClientAgent = /** @class */ (function () {
|
|
|
970
971
|
return [4 /*yield*/, this._outputSubject.next(result_1)];
|
|
971
972
|
case 6:
|
|
972
973
|
_a.sent();
|
|
973
|
-
return [
|
|
974
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
975
|
+
type: "emit-output",
|
|
976
|
+
source: "agent",
|
|
977
|
+
input: {
|
|
978
|
+
mode: mode,
|
|
979
|
+
rawResult: rawResult_1,
|
|
980
|
+
},
|
|
981
|
+
output: {
|
|
982
|
+
result: result_1,
|
|
983
|
+
},
|
|
984
|
+
context: {
|
|
985
|
+
agentName: this.params.agentName,
|
|
986
|
+
}
|
|
987
|
+
})];
|
|
974
988
|
case 7:
|
|
989
|
+
_a.sent();
|
|
990
|
+
return [2 /*return*/];
|
|
991
|
+
case 8:
|
|
975
992
|
this.params.onOutput &&
|
|
976
993
|
this.params.onOutput(this.params.clientId, this.params.agentName, result);
|
|
977
994
|
return [4 /*yield*/, this._outputSubject.next(result)];
|
|
978
|
-
case
|
|
995
|
+
case 9:
|
|
996
|
+
_a.sent();
|
|
997
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
998
|
+
type: "emit-output",
|
|
999
|
+
source: "agent",
|
|
1000
|
+
input: {
|
|
1001
|
+
mode: mode,
|
|
1002
|
+
rawResult: rawResult,
|
|
1003
|
+
},
|
|
1004
|
+
output: {
|
|
1005
|
+
result: result,
|
|
1006
|
+
},
|
|
1007
|
+
context: {
|
|
1008
|
+
agentName: this.params.agentName,
|
|
1009
|
+
}
|
|
1010
|
+
})];
|
|
1011
|
+
case 10:
|
|
979
1012
|
_a.sent();
|
|
980
1013
|
return [2 /*return*/];
|
|
981
1014
|
}
|
|
@@ -1107,6 +1140,19 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1107
1140
|
content: message.trim(),
|
|
1108
1141
|
})];
|
|
1109
1142
|
case 1:
|
|
1143
|
+
_a.sent();
|
|
1144
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1145
|
+
type: "commit-user-message",
|
|
1146
|
+
source: "agent",
|
|
1147
|
+
input: {
|
|
1148
|
+
message: message,
|
|
1149
|
+
},
|
|
1150
|
+
output: {},
|
|
1151
|
+
context: {
|
|
1152
|
+
agentName: this.params.agentName,
|
|
1153
|
+
}
|
|
1154
|
+
})];
|
|
1155
|
+
case 2:
|
|
1110
1156
|
_a.sent();
|
|
1111
1157
|
return [2 /*return*/];
|
|
1112
1158
|
}
|
|
@@ -1130,6 +1176,17 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1130
1176
|
content: "",
|
|
1131
1177
|
})];
|
|
1132
1178
|
case 1:
|
|
1179
|
+
_a.sent();
|
|
1180
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1181
|
+
type: "commit-flush",
|
|
1182
|
+
source: "agent",
|
|
1183
|
+
input: {},
|
|
1184
|
+
output: {},
|
|
1185
|
+
context: {
|
|
1186
|
+
agentName: this.params.agentName,
|
|
1187
|
+
}
|
|
1188
|
+
})];
|
|
1189
|
+
case 2:
|
|
1133
1190
|
_a.sent();
|
|
1134
1191
|
return [2 /*return*/];
|
|
1135
1192
|
}
|
|
@@ -1146,6 +1203,17 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1146
1203
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " commitAgentChange"));
|
|
1147
1204
|
return [4 /*yield*/, this._agentChangeSubject.next(AGENT_CHANGE_SYMBOL)];
|
|
1148
1205
|
case 1:
|
|
1206
|
+
_a.sent();
|
|
1207
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1208
|
+
type: "commit-agent-change",
|
|
1209
|
+
source: "agent",
|
|
1210
|
+
input: {},
|
|
1211
|
+
output: {},
|
|
1212
|
+
context: {
|
|
1213
|
+
agentName: this.params.agentName,
|
|
1214
|
+
}
|
|
1215
|
+
})];
|
|
1216
|
+
case 2:
|
|
1149
1217
|
_a.sent();
|
|
1150
1218
|
return [2 /*return*/];
|
|
1151
1219
|
}
|
|
@@ -1170,6 +1238,19 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1170
1238
|
content: message.trim(),
|
|
1171
1239
|
})];
|
|
1172
1240
|
case 1:
|
|
1241
|
+
_a.sent();
|
|
1242
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1243
|
+
type: "commit-system-message",
|
|
1244
|
+
source: "agent",
|
|
1245
|
+
input: {
|
|
1246
|
+
message: message,
|
|
1247
|
+
},
|
|
1248
|
+
output: {},
|
|
1249
|
+
context: {
|
|
1250
|
+
agentName: this.params.agentName,
|
|
1251
|
+
}
|
|
1252
|
+
})];
|
|
1253
|
+
case 2:
|
|
1173
1254
|
_a.sent();
|
|
1174
1255
|
return [2 /*return*/];
|
|
1175
1256
|
}
|
|
@@ -1198,6 +1279,20 @@ var ClientAgent = /** @class */ (function () {
|
|
|
1198
1279
|
_a.sent();
|
|
1199
1280
|
return [4 /*yield*/, this._toolCommitSubject.next()];
|
|
1200
1281
|
case 2:
|
|
1282
|
+
_a.sent();
|
|
1283
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1284
|
+
type: "commit-tool-output",
|
|
1285
|
+
source: "agent",
|
|
1286
|
+
input: {
|
|
1287
|
+
toolId: toolId,
|
|
1288
|
+
content: content,
|
|
1289
|
+
},
|
|
1290
|
+
output: {},
|
|
1291
|
+
context: {
|
|
1292
|
+
agentName: this.params.agentName,
|
|
1293
|
+
}
|
|
1294
|
+
})];
|
|
1295
|
+
case 3:
|
|
1201
1296
|
_a.sent();
|
|
1202
1297
|
return [2 /*return*/];
|
|
1203
1298
|
}
|
|
@@ -1411,6 +1506,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1411
1506
|
function AgentConnectionService() {
|
|
1412
1507
|
var _this = this;
|
|
1413
1508
|
this.loggerService = inject(TYPES.loggerService);
|
|
1509
|
+
this.busService = inject(TYPES.busService);
|
|
1414
1510
|
this.contextService = inject(TYPES.contextService);
|
|
1415
1511
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
1416
1512
|
this.historyConnectionService = inject(TYPES.historyConnectionService);
|
|
@@ -1441,7 +1537,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1441
1537
|
.getStorage(clientId, storageName)
|
|
1442
1538
|
.waitForInit();
|
|
1443
1539
|
});
|
|
1444
|
-
return new ClientAgent(__assign({ clientId: clientId, agentName: agentName, validate: validate, logger: _this.loggerService, history: _this.historyConnectionService.getHistory(clientId, agentName), prompt: prompt, system: system, transform: transform, map: map, tools: tools === null || tools === void 0 ? void 0 : tools.map(_this.toolSchemaService.get), completion: completion }, callbacks));
|
|
1540
|
+
return new ClientAgent(__assign({ clientId: clientId, agentName: agentName, validate: validate, logger: _this.loggerService, bus: _this.busService, history: _this.historyConnectionService.getHistory(clientId, agentName), prompt: prompt, system: system, transform: transform, map: map, tools: tools === null || tools === void 0 ? void 0 : tools.map(_this.toolSchemaService.get), completion: completion }, callbacks));
|
|
1445
1541
|
});
|
|
1446
1542
|
/**
|
|
1447
1543
|
* Executes an input command.
|
|
@@ -1619,6 +1715,19 @@ var ClientHistory = /** @class */ (function () {
|
|
|
1619
1715
|
this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " push"), { message: message });
|
|
1620
1716
|
return [4 /*yield*/, this.params.items.push(message, this.params.clientId, this.params.agentName)];
|
|
1621
1717
|
case 1:
|
|
1718
|
+
_a.sent();
|
|
1719
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
1720
|
+
type: "push",
|
|
1721
|
+
source: "history",
|
|
1722
|
+
input: {
|
|
1723
|
+
message: message
|
|
1724
|
+
},
|
|
1725
|
+
output: {},
|
|
1726
|
+
context: {
|
|
1727
|
+
agentName: this.params.agentName,
|
|
1728
|
+
}
|
|
1729
|
+
})];
|
|
1730
|
+
case 2:
|
|
1622
1731
|
_a.sent();
|
|
1623
1732
|
return [2 /*return*/];
|
|
1624
1733
|
}
|
|
@@ -1852,6 +1961,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
1852
1961
|
function HistoryConnectionService() {
|
|
1853
1962
|
var _this = this;
|
|
1854
1963
|
this.loggerService = inject(TYPES.loggerService);
|
|
1964
|
+
this.busService = inject(TYPES.busService);
|
|
1855
1965
|
this.contextService = inject(TYPES.contextService);
|
|
1856
1966
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
1857
1967
|
/**
|
|
@@ -1868,6 +1978,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
1868
1978
|
return new ClientHistory({
|
|
1869
1979
|
clientId: clientId,
|
|
1870
1980
|
agentName: agentName,
|
|
1981
|
+
bus: _this.busService,
|
|
1871
1982
|
items: GLOBAL_CONFIG.CC_GET_AGENT_HISTORY_ADAPTER(clientId, agentName),
|
|
1872
1983
|
logger: _this.loggerService,
|
|
1873
1984
|
});
|
|
@@ -1995,10 +2106,44 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
1995
2106
|
this.params = params;
|
|
1996
2107
|
this._agentChangedSubject = new functoolsKit.Subject();
|
|
1997
2108
|
this._activeAgent = AGENT_NEED_FETCH;
|
|
2109
|
+
this._cancelOutputSubject = new functoolsKit.Subject();
|
|
2110
|
+
/**
|
|
2111
|
+
* Cancel the await of output by emit of empty string
|
|
2112
|
+
* @returns {Promise<string>} - The output from the active agent.
|
|
2113
|
+
*/
|
|
2114
|
+
this.cancelOutput = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2115
|
+
var _a, _b;
|
|
2116
|
+
var _c;
|
|
2117
|
+
return __generator(this, function (_d) {
|
|
2118
|
+
switch (_d.label) {
|
|
2119
|
+
case 0:
|
|
2120
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " cancelOutput"));
|
|
2121
|
+
_b = (_a = this._cancelOutputSubject).next;
|
|
2122
|
+
_c = {};
|
|
2123
|
+
return [4 /*yield*/, this.getAgentName()];
|
|
2124
|
+
case 1: return [4 /*yield*/, _b.apply(_a, [(_c.agentName = _d.sent(),
|
|
2125
|
+
_c.output = "",
|
|
2126
|
+
_c)])];
|
|
2127
|
+
case 2:
|
|
2128
|
+
_d.sent();
|
|
2129
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2130
|
+
type: "cancel-output",
|
|
2131
|
+
source: "swarm",
|
|
2132
|
+
input: {},
|
|
2133
|
+
output: {},
|
|
2134
|
+
context: {
|
|
2135
|
+
swarmName: this.params.swarmName,
|
|
2136
|
+
},
|
|
2137
|
+
})];
|
|
2138
|
+
case 3:
|
|
2139
|
+
_d.sent();
|
|
2140
|
+
return [2 /*return*/];
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
}); };
|
|
1998
2144
|
/**
|
|
1999
2145
|
* Waits for output from the active agent.
|
|
2000
2146
|
* @returns {Promise<string>} - The output from the active agent.
|
|
2001
|
-
* @throws {Error} - If the timeout is reached.
|
|
2002
2147
|
*/
|
|
2003
2148
|
this.waitForOutput = functoolsKit.queued(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2004
2149
|
var _a, awaiter, resolve, getOutput, handleOutput, un, _b, agentName, output, expectAgent;
|
|
@@ -2012,18 +2157,23 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2012
2157
|
var _this = this;
|
|
2013
2158
|
return __generator(this, function (_a) {
|
|
2014
2159
|
switch (_a.label) {
|
|
2015
|
-
case 0: return [4 /*yield*/, Promise.race(this._agentList
|
|
2160
|
+
case 0: return [4 /*yield*/, Promise.race(this._agentList
|
|
2161
|
+
.map(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
2016
2162
|
var _c;
|
|
2017
2163
|
var _d = __read(_b, 2), agentName = _d[0], agent = _d[1];
|
|
2018
2164
|
return __generator(this, function (_e) {
|
|
2019
2165
|
switch (_e.label) {
|
|
2020
2166
|
case 0:
|
|
2021
|
-
_c = {
|
|
2167
|
+
_c = {
|
|
2168
|
+
agentName: agentName
|
|
2169
|
+
};
|
|
2022
2170
|
return [4 /*yield*/, agent.waitForOutput()];
|
|
2023
|
-
case 1: return [2 /*return*/, (_c.output = _e.sent(),
|
|
2171
|
+
case 1: return [2 /*return*/, (_c.output = _e.sent(),
|
|
2172
|
+
_c)];
|
|
2024
2173
|
}
|
|
2025
2174
|
});
|
|
2026
|
-
}); })
|
|
2175
|
+
}); })
|
|
2176
|
+
.concat(this._cancelOutputSubject.toPromise()))];
|
|
2027
2177
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2028
2178
|
}
|
|
2029
2179
|
});
|
|
@@ -2046,7 +2196,21 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2046
2196
|
return [4 /*yield*/, this.getAgentName()];
|
|
2047
2197
|
case 2:
|
|
2048
2198
|
expectAgent = _c.sent();
|
|
2049
|
-
agentName !== expectAgent &&
|
|
2199
|
+
agentName !== expectAgent &&
|
|
2200
|
+
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " waitForAgent agent miss"), { agentName: agentName, expectAgent: expectAgent });
|
|
2201
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2202
|
+
type: "wait-for-output",
|
|
2203
|
+
source: "swarm",
|
|
2204
|
+
input: {},
|
|
2205
|
+
output: {
|
|
2206
|
+
result: output,
|
|
2207
|
+
},
|
|
2208
|
+
context: {
|
|
2209
|
+
swarmName: this.params.swarmName,
|
|
2210
|
+
},
|
|
2211
|
+
})];
|
|
2212
|
+
case 3:
|
|
2213
|
+
_c.sent();
|
|
2050
2214
|
return [2 /*return*/, output];
|
|
2051
2215
|
}
|
|
2052
2216
|
});
|
|
@@ -2067,7 +2231,20 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2067
2231
|
case 1:
|
|
2068
2232
|
_a._activeAgent = _b.sent();
|
|
2069
2233
|
_b.label = 2;
|
|
2070
|
-
case 2: return [
|
|
2234
|
+
case 2: return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2235
|
+
type: "get-agent-name",
|
|
2236
|
+
source: "swarm",
|
|
2237
|
+
input: {},
|
|
2238
|
+
output: {
|
|
2239
|
+
activeAgent: this._activeAgent,
|
|
2240
|
+
},
|
|
2241
|
+
context: {
|
|
2242
|
+
swarmName: this.params.swarmName,
|
|
2243
|
+
},
|
|
2244
|
+
})];
|
|
2245
|
+
case 3:
|
|
2246
|
+
_b.sent();
|
|
2247
|
+
return [2 /*return*/, this._activeAgent];
|
|
2071
2248
|
}
|
|
2072
2249
|
});
|
|
2073
2250
|
}); };
|
|
@@ -2076,7 +2253,7 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2076
2253
|
* @returns {Promise<IAgent>} - The active agent.
|
|
2077
2254
|
*/
|
|
2078
2255
|
this.getAgent = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2079
|
-
var agent;
|
|
2256
|
+
var agent, result;
|
|
2080
2257
|
return __generator(this, function (_a) {
|
|
2081
2258
|
switch (_a.label) {
|
|
2082
2259
|
case 0:
|
|
@@ -2084,7 +2261,21 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2084
2261
|
return [4 /*yield*/, this.getAgentName()];
|
|
2085
2262
|
case 1:
|
|
2086
2263
|
agent = _a.sent();
|
|
2087
|
-
|
|
2264
|
+
result = this.params.agentMap[agent];
|
|
2265
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2266
|
+
type: "get-agent",
|
|
2267
|
+
source: "swarm",
|
|
2268
|
+
input: {
|
|
2269
|
+
result: result,
|
|
2270
|
+
},
|
|
2271
|
+
output: {},
|
|
2272
|
+
context: {
|
|
2273
|
+
swarmName: this.params.swarmName,
|
|
2274
|
+
},
|
|
2275
|
+
})];
|
|
2276
|
+
case 2:
|
|
2277
|
+
_a.sent();
|
|
2278
|
+
return [2 /*return*/, result];
|
|
2088
2279
|
}
|
|
2089
2280
|
});
|
|
2090
2281
|
}); };
|
|
@@ -2103,8 +2294,22 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2103
2294
|
throw new Error("agent-swarm agent ".concat(agentName, " not in the swarm"));
|
|
2104
2295
|
}
|
|
2105
2296
|
this.params.agentMap[agentName] = agent;
|
|
2106
|
-
return [4 /*yield*/, this.
|
|
2297
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2298
|
+
type: "set-agent-ref",
|
|
2299
|
+
source: "swarm",
|
|
2300
|
+
input: {
|
|
2301
|
+
agentName: agentName,
|
|
2302
|
+
agent: agent,
|
|
2303
|
+
},
|
|
2304
|
+
output: {},
|
|
2305
|
+
context: {
|
|
2306
|
+
swarmName: this.params.swarmName,
|
|
2307
|
+
},
|
|
2308
|
+
})];
|
|
2107
2309
|
case 1:
|
|
2310
|
+
_a.sent();
|
|
2311
|
+
return [4 /*yield*/, this._agentChangedSubject.next([agentName, agent])];
|
|
2312
|
+
case 2:
|
|
2108
2313
|
_a.sent();
|
|
2109
2314
|
return [2 /*return*/];
|
|
2110
2315
|
}
|
|
@@ -2122,6 +2327,19 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2122
2327
|
this._activeAgent = agentName;
|
|
2123
2328
|
return [4 /*yield*/, this.params.onAgentChanged(this.params.clientId, agentName, this.params.swarmName)];
|
|
2124
2329
|
case 1:
|
|
2330
|
+
_a.sent();
|
|
2331
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2332
|
+
type: "set-agent-name",
|
|
2333
|
+
source: "swarm",
|
|
2334
|
+
input: {
|
|
2335
|
+
agentName: agentName,
|
|
2336
|
+
},
|
|
2337
|
+
output: {},
|
|
2338
|
+
context: {
|
|
2339
|
+
swarmName: this.params.swarmName,
|
|
2340
|
+
},
|
|
2341
|
+
})];
|
|
2342
|
+
case 2:
|
|
2125
2343
|
_a.sent();
|
|
2126
2344
|
return [2 /*return*/];
|
|
2127
2345
|
}
|
|
@@ -2149,6 +2367,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2149
2367
|
function SwarmConnectionService() {
|
|
2150
2368
|
var _this = this;
|
|
2151
2369
|
this.loggerService = inject(TYPES.loggerService);
|
|
2370
|
+
this.busService = inject(TYPES.busService);
|
|
2152
2371
|
this.contextService = inject(TYPES.contextService);
|
|
2153
2372
|
this.agentConnectionService = inject(TYPES.agentConnectionService);
|
|
2154
2373
|
this.swarmSchemaService = inject(TYPES.swarmSchemaService);
|
|
@@ -2184,6 +2403,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2184
2403
|
defaultAgent: defaultAgent,
|
|
2185
2404
|
swarmName: swarmName,
|
|
2186
2405
|
logger: _this.loggerService,
|
|
2406
|
+
bus: _this.busService,
|
|
2187
2407
|
onAgentChanged: function (clientId, agentName, swarmName) {
|
|
2188
2408
|
return __awaiter(this, void 0, void 0, function () {
|
|
2189
2409
|
return __generator(this, function (_a) {
|
|
@@ -2203,6 +2423,22 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2203
2423
|
callbacks: callbacks,
|
|
2204
2424
|
});
|
|
2205
2425
|
});
|
|
2426
|
+
/**
|
|
2427
|
+
* Cancel the await of output by emit of empty string
|
|
2428
|
+
* @returns {Promise<void>}
|
|
2429
|
+
*/
|
|
2430
|
+
this.cancelOutput = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2431
|
+
return __generator(this, function (_a) {
|
|
2432
|
+
switch (_a.label) {
|
|
2433
|
+
case 0:
|
|
2434
|
+
this.loggerService.log("swarmConnectionService cancelOutput", {
|
|
2435
|
+
context: this.contextService.context,
|
|
2436
|
+
});
|
|
2437
|
+
return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).cancelOutput()];
|
|
2438
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
2439
|
+
}
|
|
2440
|
+
});
|
|
2441
|
+
}); };
|
|
2206
2442
|
/**
|
|
2207
2443
|
* Waits for the output from the swarm.
|
|
2208
2444
|
* @returns {Promise<any>} The output from the swarm.
|
|
@@ -2397,6 +2633,19 @@ var ClientSession = /** @class */ (function () {
|
|
|
2397
2633
|
this.params.onEmit(this.params.clientId, this.params.swarmName, message);
|
|
2398
2634
|
return [4 /*yield*/, this._emitSubject.next(message)];
|
|
2399
2635
|
case 1:
|
|
2636
|
+
_a.sent();
|
|
2637
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2638
|
+
type: "emit",
|
|
2639
|
+
source: "session",
|
|
2640
|
+
input: {
|
|
2641
|
+
message: message
|
|
2642
|
+
},
|
|
2643
|
+
output: {},
|
|
2644
|
+
context: {
|
|
2645
|
+
swarmName: this.params.swarmName,
|
|
2646
|
+
}
|
|
2647
|
+
})];
|
|
2648
|
+
case 2:
|
|
2400
2649
|
_a.sent();
|
|
2401
2650
|
return [2 /*return*/];
|
|
2402
2651
|
}
|
|
@@ -2427,6 +2676,22 @@ var ClientSession = /** @class */ (function () {
|
|
|
2427
2676
|
return [4 /*yield*/, outputAwaiter];
|
|
2428
2677
|
case 2:
|
|
2429
2678
|
output = _a.sent();
|
|
2679
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2680
|
+
type: "execute",
|
|
2681
|
+
source: "session",
|
|
2682
|
+
input: {
|
|
2683
|
+
message: message,
|
|
2684
|
+
mode: mode,
|
|
2685
|
+
},
|
|
2686
|
+
output: {
|
|
2687
|
+
result: output,
|
|
2688
|
+
},
|
|
2689
|
+
context: {
|
|
2690
|
+
swarmName: this.params.swarmName,
|
|
2691
|
+
}
|
|
2692
|
+
})];
|
|
2693
|
+
case 3:
|
|
2694
|
+
_a.sent();
|
|
2430
2695
|
return [2 /*return*/, output];
|
|
2431
2696
|
}
|
|
2432
2697
|
});
|
|
@@ -2438,7 +2703,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2438
2703
|
* @returns {Promise<void>}
|
|
2439
2704
|
*/
|
|
2440
2705
|
this.commitToolOutput = function (toolId, content) { return __awaiter(_this, void 0, void 0, function () {
|
|
2441
|
-
var agent;
|
|
2706
|
+
var agent, result;
|
|
2442
2707
|
return __generator(this, function (_a) {
|
|
2443
2708
|
switch (_a.label) {
|
|
2444
2709
|
case 0:
|
|
@@ -2450,7 +2715,23 @@ var ClientSession = /** @class */ (function () {
|
|
|
2450
2715
|
case 1:
|
|
2451
2716
|
agent = _a.sent();
|
|
2452
2717
|
return [4 /*yield*/, agent.commitToolOutput(toolId, content)];
|
|
2453
|
-
case 2:
|
|
2718
|
+
case 2:
|
|
2719
|
+
result = _a.sent();
|
|
2720
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2721
|
+
type: "commit-tool-output",
|
|
2722
|
+
source: "session",
|
|
2723
|
+
input: {
|
|
2724
|
+
toolId: toolId,
|
|
2725
|
+
content: content,
|
|
2726
|
+
},
|
|
2727
|
+
output: {},
|
|
2728
|
+
context: {
|
|
2729
|
+
swarmName: this.params.swarmName,
|
|
2730
|
+
}
|
|
2731
|
+
})];
|
|
2732
|
+
case 3:
|
|
2733
|
+
_a.sent();
|
|
2734
|
+
return [2 /*return*/, result];
|
|
2454
2735
|
}
|
|
2455
2736
|
});
|
|
2456
2737
|
}); };
|
|
@@ -2460,7 +2741,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2460
2741
|
* @returns {Promise<void>}
|
|
2461
2742
|
*/
|
|
2462
2743
|
this.commitUserMessage = function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
2463
|
-
var agent;
|
|
2744
|
+
var agent, result;
|
|
2464
2745
|
return __generator(this, function (_a) {
|
|
2465
2746
|
switch (_a.label) {
|
|
2466
2747
|
case 0:
|
|
@@ -2471,7 +2752,22 @@ var ClientSession = /** @class */ (function () {
|
|
|
2471
2752
|
case 1:
|
|
2472
2753
|
agent = _a.sent();
|
|
2473
2754
|
return [4 /*yield*/, agent.commitUserMessage(message)];
|
|
2474
|
-
case 2:
|
|
2755
|
+
case 2:
|
|
2756
|
+
result = _a.sent();
|
|
2757
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2758
|
+
type: "commit-user-message",
|
|
2759
|
+
source: "session",
|
|
2760
|
+
input: {
|
|
2761
|
+
message: message,
|
|
2762
|
+
},
|
|
2763
|
+
output: {},
|
|
2764
|
+
context: {
|
|
2765
|
+
swarmName: this.params.swarmName,
|
|
2766
|
+
}
|
|
2767
|
+
})];
|
|
2768
|
+
case 3:
|
|
2769
|
+
_a.sent();
|
|
2770
|
+
return [2 /*return*/, result];
|
|
2475
2771
|
}
|
|
2476
2772
|
});
|
|
2477
2773
|
}); };
|
|
@@ -2480,7 +2776,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2480
2776
|
* @returns {Promise<void>}
|
|
2481
2777
|
*/
|
|
2482
2778
|
this.commitFlush = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2483
|
-
var agent;
|
|
2779
|
+
var agent, result;
|
|
2484
2780
|
return __generator(this, function (_a) {
|
|
2485
2781
|
switch (_a.label) {
|
|
2486
2782
|
case 0:
|
|
@@ -2489,7 +2785,20 @@ var ClientSession = /** @class */ (function () {
|
|
|
2489
2785
|
case 1:
|
|
2490
2786
|
agent = _a.sent();
|
|
2491
2787
|
return [4 /*yield*/, agent.commitFlush()];
|
|
2492
|
-
case 2:
|
|
2788
|
+
case 2:
|
|
2789
|
+
result = _a.sent();
|
|
2790
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2791
|
+
type: "commit-flush",
|
|
2792
|
+
source: "session",
|
|
2793
|
+
input: {},
|
|
2794
|
+
output: {},
|
|
2795
|
+
context: {
|
|
2796
|
+
swarmName: this.params.swarmName,
|
|
2797
|
+
}
|
|
2798
|
+
})];
|
|
2799
|
+
case 3:
|
|
2800
|
+
_a.sent();
|
|
2801
|
+
return [2 /*return*/, result];
|
|
2493
2802
|
}
|
|
2494
2803
|
});
|
|
2495
2804
|
}); };
|
|
@@ -2499,7 +2808,7 @@ var ClientSession = /** @class */ (function () {
|
|
|
2499
2808
|
* @returns {Promise<void>}
|
|
2500
2809
|
*/
|
|
2501
2810
|
this.commitSystemMessage = function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
2502
|
-
var agent;
|
|
2811
|
+
var agent, result;
|
|
2503
2812
|
return __generator(this, function (_a) {
|
|
2504
2813
|
switch (_a.label) {
|
|
2505
2814
|
case 0:
|
|
@@ -2510,7 +2819,22 @@ var ClientSession = /** @class */ (function () {
|
|
|
2510
2819
|
case 1:
|
|
2511
2820
|
agent = _a.sent();
|
|
2512
2821
|
return [4 /*yield*/, agent.commitSystemMessage(message)];
|
|
2513
|
-
case 2:
|
|
2822
|
+
case 2:
|
|
2823
|
+
result = _a.sent();
|
|
2824
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2825
|
+
type: "commit-system-message",
|
|
2826
|
+
source: "session",
|
|
2827
|
+
input: {
|
|
2828
|
+
message: message
|
|
2829
|
+
},
|
|
2830
|
+
output: {},
|
|
2831
|
+
context: {
|
|
2832
|
+
swarmName: this.params.swarmName,
|
|
2833
|
+
}
|
|
2834
|
+
})];
|
|
2835
|
+
case 3:
|
|
2836
|
+
_a.sent();
|
|
2837
|
+
return [2 /*return*/, result];
|
|
2514
2838
|
}
|
|
2515
2839
|
});
|
|
2516
2840
|
}); };
|
|
@@ -2541,6 +2865,15 @@ var ClientSession = /** @class */ (function () {
|
|
|
2541
2865
|
}
|
|
2542
2866
|
});
|
|
2543
2867
|
}); });
|
|
2868
|
+
_this.params.bus.emit(_this.params.clientId, {
|
|
2869
|
+
type: "connect",
|
|
2870
|
+
source: "session",
|
|
2871
|
+
input: {},
|
|
2872
|
+
output: {},
|
|
2873
|
+
context: {
|
|
2874
|
+
swarmName: _this.params.swarmName,
|
|
2875
|
+
}
|
|
2876
|
+
});
|
|
2544
2877
|
return function (incoming) { return __awaiter(_this, void 0, void 0, function () {
|
|
2545
2878
|
var _a;
|
|
2546
2879
|
var _b;
|
|
@@ -2592,6 +2925,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2592
2925
|
function SessionConnectionService() {
|
|
2593
2926
|
var _this = this;
|
|
2594
2927
|
this.loggerService = inject(TYPES.loggerService);
|
|
2928
|
+
this.busService = inject(TYPES.busService);
|
|
2595
2929
|
this.contextService = inject(TYPES.contextService);
|
|
2596
2930
|
this.swarmConnectionService = inject(TYPES.swarmConnectionService);
|
|
2597
2931
|
this.swarmSchemaService = inject(TYPES.swarmSchemaService);
|
|
@@ -2606,7 +2940,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2606
2940
|
return "".concat(clientId, "-").concat(swarmName);
|
|
2607
2941
|
}, function (clientId, swarmName) {
|
|
2608
2942
|
var callbacks = _this.swarmSchemaService.get(swarmName).callbacks;
|
|
2609
|
-
return new ClientSession(__assign({ clientId: clientId, logger: _this.loggerService, swarm: _this.swarmConnectionService.getSwarm(clientId, swarmName), swarmName: swarmName }, callbacks));
|
|
2943
|
+
return new ClientSession(__assign({ clientId: clientId, logger: _this.loggerService, bus: _this.busService, swarm: _this.swarmConnectionService.getSwarm(clientId, swarmName), swarmName: swarmName }, callbacks));
|
|
2610
2944
|
});
|
|
2611
2945
|
/**
|
|
2612
2946
|
* Emits a message to the session.
|
|
@@ -3542,6 +3876,39 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3542
3876
|
var _this = this;
|
|
3543
3877
|
this.loggerService = inject(TYPES.loggerService);
|
|
3544
3878
|
this.swarmConnectionService = inject(TYPES.swarmConnectionService);
|
|
3879
|
+
/**
|
|
3880
|
+
* Cancel the await of output by emit of empty string
|
|
3881
|
+
* @param {string} clientId - The client ID.
|
|
3882
|
+
* @param {SwarmName} swarmName - The swarm name.
|
|
3883
|
+
* @returns {Promise<void>}
|
|
3884
|
+
*/
|
|
3885
|
+
this.cancelOutput = function (clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3886
|
+
var _this = this;
|
|
3887
|
+
return __generator(this, function (_a) {
|
|
3888
|
+
switch (_a.label) {
|
|
3889
|
+
case 0:
|
|
3890
|
+
this.loggerService.log("swarmPublicService cancelOutput", {
|
|
3891
|
+
clientId: clientId,
|
|
3892
|
+
swarmName: swarmName,
|
|
3893
|
+
});
|
|
3894
|
+
return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3895
|
+
return __generator(this, function (_a) {
|
|
3896
|
+
switch (_a.label) {
|
|
3897
|
+
case 0: return [4 /*yield*/, this.swarmConnectionService.cancelOutput()];
|
|
3898
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3899
|
+
}
|
|
3900
|
+
});
|
|
3901
|
+
}); }, {
|
|
3902
|
+
clientId: clientId,
|
|
3903
|
+
swarmName: swarmName,
|
|
3904
|
+
agentName: "",
|
|
3905
|
+
storageName: "",
|
|
3906
|
+
stateName: "",
|
|
3907
|
+
})];
|
|
3908
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3909
|
+
}
|
|
3910
|
+
});
|
|
3911
|
+
}); };
|
|
3545
3912
|
/**
|
|
3546
3913
|
* Waits for output from the swarm.
|
|
3547
3914
|
* @param {string} clientId - The client ID.
|
|
@@ -4416,6 +4783,7 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4416
4783
|
*/
|
|
4417
4784
|
function ClientStorage(params) {
|
|
4418
4785
|
var _this = this;
|
|
4786
|
+
var _a;
|
|
4419
4787
|
this.params = params;
|
|
4420
4788
|
this._itemMap = new Map();
|
|
4421
4789
|
/**
|
|
@@ -4534,6 +4902,23 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4534
4902
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onSearch) {
|
|
4535
4903
|
(_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onSearch(search, indexed, this.params.clientId, this.params.storageName);
|
|
4536
4904
|
}
|
|
4905
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
4906
|
+
type: "take",
|
|
4907
|
+
source: "storage",
|
|
4908
|
+
input: {
|
|
4909
|
+
search: search,
|
|
4910
|
+
total: total,
|
|
4911
|
+
score: score,
|
|
4912
|
+
},
|
|
4913
|
+
output: {
|
|
4914
|
+
indexed: indexed,
|
|
4915
|
+
},
|
|
4916
|
+
context: {
|
|
4917
|
+
storageName: this.params.storageName,
|
|
4918
|
+
}
|
|
4919
|
+
})];
|
|
4920
|
+
case 3:
|
|
4921
|
+
_c.sent();
|
|
4537
4922
|
return [2 /*return*/, indexed.take(total, score)];
|
|
4538
4923
|
}
|
|
4539
4924
|
});
|
|
@@ -4560,6 +4945,19 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4560
4945
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onUpdate) {
|
|
4561
4946
|
(_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onUpdate(__spreadArray([], __read(this._itemMap.values()), false), this.params.clientId, this.params.storageName);
|
|
4562
4947
|
}
|
|
4948
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
4949
|
+
type: "upsert",
|
|
4950
|
+
source: "storage",
|
|
4951
|
+
input: {
|
|
4952
|
+
item: item,
|
|
4953
|
+
},
|
|
4954
|
+
output: {},
|
|
4955
|
+
context: {
|
|
4956
|
+
storageName: this.params.storageName,
|
|
4957
|
+
}
|
|
4958
|
+
})];
|
|
4959
|
+
case 2:
|
|
4960
|
+
_c.sent();
|
|
4563
4961
|
return [2 /*return*/];
|
|
4564
4962
|
}
|
|
4565
4963
|
});
|
|
@@ -4572,15 +4970,31 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4572
4970
|
this.remove = function (itemId) { return __awaiter(_this, void 0, void 0, function () {
|
|
4573
4971
|
var _a, _b;
|
|
4574
4972
|
return __generator(this, function (_c) {
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4973
|
+
switch (_c.label) {
|
|
4974
|
+
case 0:
|
|
4975
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " remove"), {
|
|
4976
|
+
id: itemId,
|
|
4977
|
+
});
|
|
4978
|
+
this._itemMap.delete(itemId);
|
|
4979
|
+
this._createEmbedding.clear(itemId);
|
|
4980
|
+
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onUpdate) {
|
|
4981
|
+
(_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onUpdate(__spreadArray([], __read(this._itemMap.values()), false), this.params.clientId, this.params.storageName);
|
|
4982
|
+
}
|
|
4983
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
4984
|
+
type: "remove",
|
|
4985
|
+
source: "storage",
|
|
4986
|
+
input: {
|
|
4987
|
+
itemId: itemId,
|
|
4988
|
+
},
|
|
4989
|
+
output: {},
|
|
4990
|
+
context: {
|
|
4991
|
+
storageName: this.params.storageName,
|
|
4992
|
+
}
|
|
4993
|
+
})];
|
|
4994
|
+
case 1:
|
|
4995
|
+
_c.sent();
|
|
4996
|
+
return [2 /*return*/];
|
|
4582
4997
|
}
|
|
4583
|
-
return [2 /*return*/];
|
|
4584
4998
|
});
|
|
4585
4999
|
}); };
|
|
4586
5000
|
/**
|
|
@@ -4589,10 +5003,24 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4589
5003
|
*/
|
|
4590
5004
|
this.clear = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4591
5005
|
return __generator(this, function (_a) {
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
5006
|
+
switch (_a.label) {
|
|
5007
|
+
case 0:
|
|
5008
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " clear"));
|
|
5009
|
+
this._itemMap.clear();
|
|
5010
|
+
this._createEmbedding.clear();
|
|
5011
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5012
|
+
type: "clear",
|
|
5013
|
+
source: "storage",
|
|
5014
|
+
input: {},
|
|
5015
|
+
output: {},
|
|
5016
|
+
context: {
|
|
5017
|
+
storageName: this.params.storageName,
|
|
5018
|
+
}
|
|
5019
|
+
})];
|
|
5020
|
+
case 1:
|
|
5021
|
+
_a.sent();
|
|
5022
|
+
return [2 /*return*/];
|
|
5023
|
+
}
|
|
4596
5024
|
});
|
|
4597
5025
|
}); };
|
|
4598
5026
|
/**
|
|
@@ -4601,12 +5029,32 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4601
5029
|
* @returns {Promise<T | null>} - The item or null if not found.
|
|
4602
5030
|
*/
|
|
4603
5031
|
this.get = function (itemId) { return __awaiter(_this, void 0, void 0, function () {
|
|
5032
|
+
var result;
|
|
4604
5033
|
var _a;
|
|
4605
5034
|
return __generator(this, function (_b) {
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
5035
|
+
switch (_b.label) {
|
|
5036
|
+
case 0:
|
|
5037
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " get"), {
|
|
5038
|
+
id: itemId,
|
|
5039
|
+
});
|
|
5040
|
+
result = (_a = this._itemMap.get(itemId)) !== null && _a !== void 0 ? _a : null;
|
|
5041
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5042
|
+
type: "get",
|
|
5043
|
+
source: "storage",
|
|
5044
|
+
input: {
|
|
5045
|
+
itemId: itemId,
|
|
5046
|
+
},
|
|
5047
|
+
output: {
|
|
5048
|
+
result: result,
|
|
5049
|
+
},
|
|
5050
|
+
context: {
|
|
5051
|
+
storageName: this.params.storageName,
|
|
5052
|
+
}
|
|
5053
|
+
})];
|
|
5054
|
+
case 1:
|
|
5055
|
+
_b.sent();
|
|
5056
|
+
return [2 /*return*/, result];
|
|
5057
|
+
}
|
|
4610
5058
|
});
|
|
4611
5059
|
}); };
|
|
4612
5060
|
/**
|
|
@@ -4618,32 +5066,65 @@ var ClientStorage = /** @class */ (function () {
|
|
|
4618
5066
|
var result, _a, _b, item;
|
|
4619
5067
|
var e_1, _c;
|
|
4620
5068
|
return __generator(this, function (_d) {
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
try {
|
|
4627
|
-
for (_a = __values(this._itemMap.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
4628
|
-
item = _b.value;
|
|
4629
|
-
if (filter(item)) {
|
|
4630
|
-
result.push(item);
|
|
5069
|
+
switch (_d.label) {
|
|
5070
|
+
case 0:
|
|
5071
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " list"));
|
|
5072
|
+
if (!filter) {
|
|
5073
|
+
return [2 /*return*/, __spreadArray([], __read(this._itemMap.values()), false)];
|
|
4631
5074
|
}
|
|
4632
|
-
|
|
5075
|
+
result = [];
|
|
5076
|
+
try {
|
|
5077
|
+
for (_a = __values(this._itemMap.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
5078
|
+
item = _b.value;
|
|
5079
|
+
if (filter(item)) {
|
|
5080
|
+
result.push(item);
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5084
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
5085
|
+
finally {
|
|
5086
|
+
try {
|
|
5087
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
5088
|
+
}
|
|
5089
|
+
finally { if (e_1) throw e_1.error; }
|
|
5090
|
+
}
|
|
5091
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5092
|
+
type: "list",
|
|
5093
|
+
source: "storage",
|
|
5094
|
+
input: {},
|
|
5095
|
+
output: {
|
|
5096
|
+
result: result,
|
|
5097
|
+
},
|
|
5098
|
+
context: {
|
|
5099
|
+
storageName: this.params.storageName,
|
|
5100
|
+
}
|
|
5101
|
+
})];
|
|
5102
|
+
case 1:
|
|
5103
|
+
_d.sent();
|
|
5104
|
+
return [2 /*return*/, result];
|
|
4633
5105
|
}
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
5106
|
+
});
|
|
5107
|
+
}); };
|
|
5108
|
+
/**
|
|
5109
|
+
* Disposes of the state.
|
|
5110
|
+
* @returns {Promise<void>}
|
|
5111
|
+
*/
|
|
5112
|
+
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5113
|
+
var _a;
|
|
5114
|
+
return __generator(this, function (_b) {
|
|
5115
|
+
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " dispose"));
|
|
5116
|
+
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5117
|
+
this.params.callbacks.onDispose(this.params.clientId, this.params.storageName);
|
|
4640
5118
|
}
|
|
4641
|
-
return [2 /*return
|
|
5119
|
+
return [2 /*return*/];
|
|
4642
5120
|
});
|
|
4643
5121
|
}); };
|
|
4644
5122
|
this.params.logger.debug("ClientStorage storageName=".concat(this.params.storageName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " CTOR"), {
|
|
4645
5123
|
params: params,
|
|
4646
5124
|
});
|
|
5125
|
+
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5126
|
+
this.params.callbacks.onInit(this.params.clientId, this.params.storageName);
|
|
5127
|
+
}
|
|
4647
5128
|
}
|
|
4648
5129
|
return ClientStorage;
|
|
4649
5130
|
}());
|
|
@@ -4656,6 +5137,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
4656
5137
|
function StorageConnectionService() {
|
|
4657
5138
|
var _this = this;
|
|
4658
5139
|
this.loggerService = inject(TYPES.loggerService);
|
|
5140
|
+
this.busService = inject(TYPES.busService);
|
|
4659
5141
|
this.contextService = inject(TYPES.contextService);
|
|
4660
5142
|
this.storageSchemaService = inject(TYPES.storageSchemaService);
|
|
4661
5143
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
@@ -4675,7 +5157,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
4675
5157
|
if (!shared) {
|
|
4676
5158
|
throw new Error("agent-swarm storage not shared storageName=".concat(storageName));
|
|
4677
5159
|
}
|
|
4678
|
-
return new ClientStorage(__assign(__assign({ clientId: clientId, storageName: storageName, embedding: embeddingName, calculateSimilarity: calculateSimilarity, createEmbedding: createEmbedding, createIndex: createIndex, getData: getData, shared: shared, logger: _this.loggerService }, embedding), { callbacks: callbacks }));
|
|
5160
|
+
return new ClientStorage(__assign(__assign({ clientId: clientId, storageName: storageName, embedding: embeddingName, calculateSimilarity: calculateSimilarity, createEmbedding: createEmbedding, createIndex: createIndex, getData: getData, shared: shared, logger: _this.loggerService, bus: _this.busService }, embedding), { callbacks: callbacks }));
|
|
4679
5161
|
});
|
|
4680
5162
|
/**
|
|
4681
5163
|
* Retrieves a storage instance based on client ID and storage name.
|
|
@@ -4693,7 +5175,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
4693
5175
|
return _this.getSharedStorage(clientId, storageName);
|
|
4694
5176
|
}
|
|
4695
5177
|
var _c = _this.embeddingSchemaService.get(embeddingName), calculateSimilarity = _c.calculateSimilarity, createEmbedding = _c.createEmbedding, embedding = _c.callbacks;
|
|
4696
|
-
return new ClientStorage(__assign(__assign({ clientId: clientId, storageName: storageName, embedding: embeddingName, calculateSimilarity: calculateSimilarity, createEmbedding: createEmbedding, createIndex: createIndex, getData: getData, shared: shared, logger: _this.loggerService }, embedding), { callbacks: callbacks }));
|
|
5178
|
+
return new ClientStorage(__assign(__assign({ clientId: clientId, storageName: storageName, embedding: embeddingName, calculateSimilarity: calculateSimilarity, createEmbedding: createEmbedding, createIndex: createIndex, getData: getData, shared: shared, logger: _this.loggerService, bus: _this.busService }, embedding), { callbacks: callbacks }));
|
|
4697
5179
|
});
|
|
4698
5180
|
/**
|
|
4699
5181
|
* Retrieves a list of storage data based on a search query and total number of items.
|
|
@@ -4838,18 +5320,31 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
4838
5320
|
* @returns {Promise<void>}
|
|
4839
5321
|
*/
|
|
4840
5322
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4841
|
-
var key;
|
|
5323
|
+
var key, storage;
|
|
4842
5324
|
return __generator(this, function (_a) {
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
5325
|
+
switch (_a.label) {
|
|
5326
|
+
case 0:
|
|
5327
|
+
this.loggerService.log("storageConnectionService dispose", {
|
|
5328
|
+
context: this.contextService.context,
|
|
5329
|
+
});
|
|
5330
|
+
key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.storageName);
|
|
5331
|
+
if (!this.getStorage.has(key)) {
|
|
5332
|
+
return [2 /*return*/];
|
|
5333
|
+
}
|
|
5334
|
+
if (!!this.getSharedStorage.has(this.contextService.context.storageName)) return [3 /*break*/, 3];
|
|
5335
|
+
storage = this.getSharedStorage(this.contextService.context.clientId, this.contextService.context.storageName);
|
|
5336
|
+
return [4 /*yield*/, storage.waitForInit()];
|
|
5337
|
+
case 1:
|
|
5338
|
+
_a.sent();
|
|
5339
|
+
return [4 /*yield*/, storage.dispose()];
|
|
5340
|
+
case 2:
|
|
5341
|
+
_a.sent();
|
|
5342
|
+
_a.label = 3;
|
|
5343
|
+
case 3:
|
|
5344
|
+
this.getStorage.clear(key);
|
|
5345
|
+
this.sessionValidationService.removeStorageUsage(this.contextService.context.clientId, this.contextService.context.storageName);
|
|
5346
|
+
return [2 /*return*/];
|
|
4849
5347
|
}
|
|
4850
|
-
this.getStorage.clear(key);
|
|
4851
|
-
this.sessionValidationService.removeStorageUsage(this.contextService.context.clientId, this.contextService.context.storageName);
|
|
4852
|
-
return [2 /*return*/];
|
|
4853
5348
|
});
|
|
4854
5349
|
}); };
|
|
4855
5350
|
}
|
|
@@ -5268,12 +5763,12 @@ var ClientState = /** @class */ (function () {
|
|
|
5268
5763
|
return __generator(this, function (_c) {
|
|
5269
5764
|
switch (_c.label) {
|
|
5270
5765
|
case 0:
|
|
5271
|
-
this.params.logger.debug("
|
|
5766
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " waitForInit"));
|
|
5272
5767
|
_a = this;
|
|
5273
5768
|
return [4 /*yield*/, this.params.getState(this.params.clientId, this.params.stateName)];
|
|
5274
5769
|
case 1:
|
|
5275
5770
|
_a._state = _c.sent();
|
|
5276
|
-
this.params.logger.debug("
|
|
5771
|
+
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 });
|
|
5277
5772
|
if ((_b = this.params.callbacks) === null || _b === void 0 ? void 0 : _b.onLoad) {
|
|
5278
5773
|
this.params.callbacks.onLoad(this._state, this.params.clientId, this.params.stateName);
|
|
5279
5774
|
}
|
|
@@ -5292,7 +5787,7 @@ var ClientState = /** @class */ (function () {
|
|
|
5292
5787
|
return __generator(this, function (_b) {
|
|
5293
5788
|
switch (_b.label) {
|
|
5294
5789
|
case 0:
|
|
5295
|
-
this.params.logger.debug("
|
|
5790
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " setState"));
|
|
5296
5791
|
return [4 /*yield*/, this.dispatch("write", function (currentState) { return __awaiter(_this, void 0, void 0, function () {
|
|
5297
5792
|
var _a, _b, middleware, e_1_1;
|
|
5298
5793
|
var e_1, _c;
|
|
@@ -5330,12 +5825,25 @@ var ClientState = /** @class */ (function () {
|
|
|
5330
5825
|
}); })];
|
|
5331
5826
|
case 1:
|
|
5332
5827
|
_b.sent();
|
|
5333
|
-
this.params.logger.debug("
|
|
5828
|
+
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 });
|
|
5334
5829
|
this.params.setState &&
|
|
5335
5830
|
this.params.setState(this._state, this.params.clientId, this.params.stateName);
|
|
5336
5831
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onWrite) {
|
|
5337
5832
|
this.params.callbacks.onWrite(this._state, this.params.clientId, this.params.stateName);
|
|
5338
5833
|
}
|
|
5834
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5835
|
+
type: "set-state",
|
|
5836
|
+
source: "state",
|
|
5837
|
+
input: {},
|
|
5838
|
+
output: {
|
|
5839
|
+
state: this._state,
|
|
5840
|
+
},
|
|
5841
|
+
context: {
|
|
5842
|
+
stateName: this.params.stateName,
|
|
5843
|
+
}
|
|
5844
|
+
})];
|
|
5845
|
+
case 2:
|
|
5846
|
+
_b.sent();
|
|
5339
5847
|
return [2 /*return*/, this._state];
|
|
5340
5848
|
}
|
|
5341
5849
|
});
|
|
@@ -5349,13 +5857,26 @@ var ClientState = /** @class */ (function () {
|
|
|
5349
5857
|
return __generator(this, function (_b) {
|
|
5350
5858
|
switch (_b.label) {
|
|
5351
5859
|
case 0:
|
|
5352
|
-
this.params.logger.debug("
|
|
5860
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " getState"));
|
|
5353
5861
|
return [4 /*yield*/, this.dispatch("read")];
|
|
5354
5862
|
case 1:
|
|
5355
5863
|
_b.sent();
|
|
5356
5864
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onRead) {
|
|
5357
5865
|
this.params.callbacks.onRead(this._state, this.params.clientId, this.params.stateName);
|
|
5358
5866
|
}
|
|
5867
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
5868
|
+
type: "get-state",
|
|
5869
|
+
source: "state",
|
|
5870
|
+
input: {},
|
|
5871
|
+
output: {
|
|
5872
|
+
state: this._state,
|
|
5873
|
+
},
|
|
5874
|
+
context: {
|
|
5875
|
+
stateName: this.params.stateName,
|
|
5876
|
+
}
|
|
5877
|
+
})];
|
|
5878
|
+
case 2:
|
|
5879
|
+
_b.sent();
|
|
5359
5880
|
return [2 /*return*/, this._state];
|
|
5360
5881
|
}
|
|
5361
5882
|
});
|
|
@@ -5367,13 +5888,16 @@ var ClientState = /** @class */ (function () {
|
|
|
5367
5888
|
this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5368
5889
|
var _a;
|
|
5369
5890
|
return __generator(this, function (_b) {
|
|
5370
|
-
this.params.logger.debug("
|
|
5891
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " dispose"));
|
|
5371
5892
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onDispose) {
|
|
5372
5893
|
this.params.callbacks.onDispose(this.params.clientId, this.params.stateName);
|
|
5373
5894
|
}
|
|
5374
5895
|
return [2 /*return*/];
|
|
5375
5896
|
});
|
|
5376
5897
|
}); };
|
|
5898
|
+
this.params.logger.debug("ClientState stateName=".concat(this.params.stateName, " clientId=").concat(this.params.clientId, " shared=").concat(this.params.shared, " CTOR"), {
|
|
5899
|
+
params: params,
|
|
5900
|
+
});
|
|
5377
5901
|
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onInit) {
|
|
5378
5902
|
this.params.callbacks.onInit(this.params.clientId, this.params.stateName);
|
|
5379
5903
|
}
|
|
@@ -5390,9 +5914,49 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5390
5914
|
function StateConnectionService() {
|
|
5391
5915
|
var _this = this;
|
|
5392
5916
|
this.loggerService = inject(TYPES.loggerService);
|
|
5917
|
+
this.busService = inject(TYPES.busService);
|
|
5393
5918
|
this.contextService = inject(TYPES.contextService);
|
|
5394
5919
|
this.stateSchemaService = inject(TYPES.stateSchemaService);
|
|
5395
5920
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5921
|
+
/**
|
|
5922
|
+
* Memoized function to get a shared state reference.
|
|
5923
|
+
* @param {string} clientId - The client ID.
|
|
5924
|
+
* @param {StateName} stateName - The state name.
|
|
5925
|
+
* @returns {ClientState} The client state.
|
|
5926
|
+
*/
|
|
5927
|
+
this.getSharedStateRef = functoolsKit.memoize(function (_a) {
|
|
5928
|
+
var _b = __read(_a, 2), stateName = _b[1];
|
|
5929
|
+
return "".concat(stateName);
|
|
5930
|
+
}, function (clientId, stateName) {
|
|
5931
|
+
_this.sessionValidationService.addStateUsage(clientId, stateName);
|
|
5932
|
+
var _a = _this.stateSchemaService.get(stateName), getState = _a.getState, setState = _a.setState, _b = _a.middlewares, middlewares = _b === void 0 ? [] : _b, shared = _a.shared, callbacks = _a.callbacks;
|
|
5933
|
+
if (!shared) {
|
|
5934
|
+
throw new Error("agent-swarm state not shared stateName=".concat(stateName));
|
|
5935
|
+
}
|
|
5936
|
+
return new ClientState({
|
|
5937
|
+
clientId: clientId,
|
|
5938
|
+
stateName: stateName,
|
|
5939
|
+
logger: _this.loggerService,
|
|
5940
|
+
bus: _this.busService,
|
|
5941
|
+
setState: setState
|
|
5942
|
+
? functoolsKit.queued(function () {
|
|
5943
|
+
var args = [];
|
|
5944
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5945
|
+
args[_i] = arguments[_i];
|
|
5946
|
+
}
|
|
5947
|
+
return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
5948
|
+
switch (_a.label) {
|
|
5949
|
+
case 0: return [4 /*yield*/, setState.apply(void 0, __spreadArray([], __read(args), false))];
|
|
5950
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
5951
|
+
}
|
|
5952
|
+
}); });
|
|
5953
|
+
})
|
|
5954
|
+
: setState,
|
|
5955
|
+
getState: getState,
|
|
5956
|
+
middlewares: middlewares,
|
|
5957
|
+
callbacks: callbacks,
|
|
5958
|
+
});
|
|
5959
|
+
});
|
|
5396
5960
|
/**
|
|
5397
5961
|
* Memoized function to get a state reference.
|
|
5398
5962
|
* @param {string} clientId - The client ID.
|
|
@@ -5404,11 +5968,15 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5404
5968
|
return "".concat(clientId, "-").concat(stateName);
|
|
5405
5969
|
}, function (clientId, stateName) {
|
|
5406
5970
|
_this.sessionValidationService.addStateUsage(clientId, stateName);
|
|
5407
|
-
var _a = _this.stateSchemaService.get(stateName), getState = _a.getState, setState = _a.setState, _b = _a.middlewares, middlewares = _b === void 0 ? [] : _b, callbacks = _a.callbacks;
|
|
5971
|
+
var _a = _this.stateSchemaService.get(stateName), getState = _a.getState, setState = _a.setState, _b = _a.middlewares, middlewares = _b === void 0 ? [] : _b, callbacks = _a.callbacks, _c = _a.shared, shared = _c === void 0 ? false : _c;
|
|
5972
|
+
if (shared) {
|
|
5973
|
+
return _this.getSharedStateRef(clientId, stateName);
|
|
5974
|
+
}
|
|
5408
5975
|
return new ClientState({
|
|
5409
5976
|
clientId: clientId,
|
|
5410
5977
|
stateName: stateName,
|
|
5411
5978
|
logger: _this.loggerService,
|
|
5979
|
+
bus: _this.busService,
|
|
5412
5980
|
setState: setState
|
|
5413
5981
|
? functoolsKit.queued(function () {
|
|
5414
5982
|
var args = [];
|
|
@@ -5487,6 +6055,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5487
6055
|
if (!this.getStateRef.has(key)) {
|
|
5488
6056
|
return [2 /*return*/];
|
|
5489
6057
|
}
|
|
6058
|
+
if (!!this.getSharedStateRef.has(this.contextService.context.stateName)) return [3 /*break*/, 3];
|
|
5490
6059
|
state = this.getStateRef(this.contextService.context.clientId, this.contextService.context.stateName);
|
|
5491
6060
|
return [4 /*yield*/, state.waitForInit()];
|
|
5492
6061
|
case 1:
|
|
@@ -5494,6 +6063,8 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5494
6063
|
return [4 /*yield*/, state.dispose()];
|
|
5495
6064
|
case 2:
|
|
5496
6065
|
_a.sent();
|
|
6066
|
+
_a.label = 3;
|
|
6067
|
+
case 3:
|
|
5497
6068
|
this.getStateRef.clear(key);
|
|
5498
6069
|
this.sessionValidationService.removeStateUsage(this.contextService.context.clientId, this.contextService.context.stateName);
|
|
5499
6070
|
return [2 /*return*/];
|
|
@@ -5613,7 +6184,103 @@ var StatePublicService = /** @class */ (function () {
|
|
|
5613
6184
|
return StatePublicService;
|
|
5614
6185
|
}());
|
|
5615
6186
|
|
|
6187
|
+
var BusService = /** @class */ (function () {
|
|
6188
|
+
function BusService() {
|
|
6189
|
+
var _this = this;
|
|
6190
|
+
this.loggerService = inject(TYPES.loggerService);
|
|
6191
|
+
this._eventSourceSet = new Set();
|
|
6192
|
+
this.getEventSubject = functoolsKit.memoize(function (_a) {
|
|
6193
|
+
var _b = __read(_a, 2), clientId = _b[0], source = _b[1];
|
|
6194
|
+
return "".concat(clientId, "-").concat(source);
|
|
6195
|
+
}, function () { return new functoolsKit.Subject(); });
|
|
6196
|
+
/**
|
|
6197
|
+
* Subscribes to events for a specific client and source.
|
|
6198
|
+
* @param {string} clientId - The client ID.
|
|
6199
|
+
* @param {EventSource} source - The event source.
|
|
6200
|
+
* @param {(event: T) => void} fn - The callback function to handle the event.
|
|
6201
|
+
* @returns {Subscription} The subscription object.
|
|
6202
|
+
*/
|
|
6203
|
+
this.subscribe = function (clientId, source, fn) {
|
|
6204
|
+
_this.loggerService.log("busService subscribe", {
|
|
6205
|
+
clientId: clientId,
|
|
6206
|
+
source: source,
|
|
6207
|
+
});
|
|
6208
|
+
_this._eventSourceSet.add(source);
|
|
6209
|
+
return _this.getEventSubject(clientId, source).subscribe(fn);
|
|
6210
|
+
};
|
|
6211
|
+
/**
|
|
6212
|
+
* Subscribes to a single event for a specific client and source.
|
|
6213
|
+
* @param {string} clientId - The client ID.
|
|
6214
|
+
* @param {EventSource} source - The event source.
|
|
6215
|
+
* @param {(event: T) => boolean} filterFn - The filter function to determine if the event should be handled.
|
|
6216
|
+
* @param {(event: T) => void} fn - The callback function to handle the event.
|
|
6217
|
+
* @returns {Subscription} The subscription object.
|
|
6218
|
+
*/
|
|
6219
|
+
this.once = function (clientId, source, filterFn, fn) {
|
|
6220
|
+
_this.loggerService.log("busService once", {
|
|
6221
|
+
clientId: clientId,
|
|
6222
|
+
source: source,
|
|
6223
|
+
});
|
|
6224
|
+
_this._eventSourceSet.add(source);
|
|
6225
|
+
return _this.getEventSubject(clientId, source).filter(filterFn).once(fn);
|
|
6226
|
+
};
|
|
6227
|
+
/**
|
|
6228
|
+
* Emits an event for a specific client.
|
|
6229
|
+
* @param {string} clientId - The client ID.
|
|
6230
|
+
* @param {T} event - The event to emit.
|
|
6231
|
+
* @returns {Promise<void>} A promise that resolves when the event has been emitted.
|
|
6232
|
+
*/
|
|
6233
|
+
this.emit = function (clientId, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
6234
|
+
return __generator(this, function (_a) {
|
|
6235
|
+
switch (_a.label) {
|
|
6236
|
+
case 0:
|
|
6237
|
+
this.loggerService.debug("busService emit", {
|
|
6238
|
+
clientId: clientId,
|
|
6239
|
+
event: event,
|
|
6240
|
+
});
|
|
6241
|
+
if (!this.getEventSubject.has("".concat(clientId, "-").concat(event.source))) {
|
|
6242
|
+
return [2 /*return*/];
|
|
6243
|
+
}
|
|
6244
|
+
return [4 /*yield*/, this.getEventSubject(clientId, event.source).next(event)];
|
|
6245
|
+
case 1:
|
|
6246
|
+
_a.sent();
|
|
6247
|
+
return [2 /*return*/];
|
|
6248
|
+
}
|
|
6249
|
+
});
|
|
6250
|
+
}); };
|
|
6251
|
+
/**
|
|
6252
|
+
* Disposes of all event subscriptions for a specific client.
|
|
6253
|
+
* @param {string} clientId - The client ID.
|
|
6254
|
+
*/
|
|
6255
|
+
this.dispose = function (clientId) {
|
|
6256
|
+
var e_1, _a;
|
|
6257
|
+
_this.loggerService.log("busService dispose", {
|
|
6258
|
+
clientId: clientId,
|
|
6259
|
+
});
|
|
6260
|
+
try {
|
|
6261
|
+
for (var _b = __values(_this._eventSourceSet), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
6262
|
+
var source = _c.value;
|
|
6263
|
+
var key = "".concat(clientId, "-").concat(source);
|
|
6264
|
+
if (_this.getEventSubject.has(key)) {
|
|
6265
|
+
_this.getEventSubject(clientId, source).unsubscribeAll();
|
|
6266
|
+
}
|
|
6267
|
+
_this.getEventSubject.clear("".concat(clientId, "-").concat(source));
|
|
6268
|
+
}
|
|
6269
|
+
}
|
|
6270
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6271
|
+
finally {
|
|
6272
|
+
try {
|
|
6273
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6274
|
+
}
|
|
6275
|
+
finally { if (e_1) throw e_1.error; }
|
|
6276
|
+
}
|
|
6277
|
+
};
|
|
6278
|
+
}
|
|
6279
|
+
return BusService;
|
|
6280
|
+
}());
|
|
6281
|
+
|
|
5616
6282
|
{
|
|
6283
|
+
provide(TYPES.busService, function () { return new BusService(); });
|
|
5617
6284
|
provide(TYPES.loggerService, function () { return new LoggerService(); });
|
|
5618
6285
|
provide(TYPES.contextService, function () { return new ContextService(); });
|
|
5619
6286
|
}
|
|
@@ -5659,6 +6326,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
5659
6326
|
}
|
|
5660
6327
|
|
|
5661
6328
|
var baseServices = {
|
|
6329
|
+
busService: inject(TYPES.busService),
|
|
5662
6330
|
loggerService: inject(TYPES.loggerService),
|
|
5663
6331
|
contextService: inject(TYPES.contextService),
|
|
5664
6332
|
};
|
|
@@ -5768,10 +6436,15 @@ var addTool = function (toolSchema) {
|
|
|
5768
6436
|
* @returns {string} The name of the added state.
|
|
5769
6437
|
*/
|
|
5770
6438
|
var addState = function (stateSchema) {
|
|
5771
|
-
swarm.loggerService.log(
|
|
5772
|
-
stateSchema: stateSchema
|
|
6439
|
+
swarm.loggerService.log("function addState", {
|
|
6440
|
+
stateSchema: stateSchema,
|
|
5773
6441
|
});
|
|
5774
6442
|
swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
6443
|
+
if (stateSchema.shared) {
|
|
6444
|
+
swarm.stateConnectionService
|
|
6445
|
+
.getSharedStateRef("shared", stateSchema.stateName)
|
|
6446
|
+
.waitForInit();
|
|
6447
|
+
}
|
|
5775
6448
|
return stateSchema.stateName;
|
|
5776
6449
|
};
|
|
5777
6450
|
|
|
@@ -6111,69 +6784,64 @@ var disposeConnection = function (clientId, swarmName) { return __awaiter(void 0
|
|
|
6111
6784
|
});
|
|
6112
6785
|
swarm.swarmValidationService.validate(swarmName, "disposeConnection");
|
|
6113
6786
|
swarm.sessionValidationService.removeSession(clientId);
|
|
6787
|
+
swarm.busService.dispose(clientId);
|
|
6114
6788
|
return [4 /*yield*/, swarm.sessionPublicService.dispose(clientId, swarmName)];
|
|
6115
6789
|
case 1:
|
|
6116
6790
|
_a.sent();
|
|
6117
6791
|
return [4 /*yield*/, swarm.swarmPublicService.dispose(clientId, swarmName)];
|
|
6118
6792
|
case 2:
|
|
6119
6793
|
_a.sent();
|
|
6120
|
-
return [4 /*yield*/, Promise.all(
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
}); }),
|
|
6136
|
-
])];
|
|
6794
|
+
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
6795
|
+
.getAgentList(swarmName)
|
|
6796
|
+
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6797
|
+
return __generator(this, function (_a) {
|
|
6798
|
+
switch (_a.label) {
|
|
6799
|
+
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(clientId, agentName)];
|
|
6800
|
+
case 1:
|
|
6801
|
+
_a.sent();
|
|
6802
|
+
return [4 /*yield*/, swarm.historyPublicService.dispose(clientId, agentName)];
|
|
6803
|
+
case 2:
|
|
6804
|
+
_a.sent();
|
|
6805
|
+
return [2 /*return*/];
|
|
6806
|
+
}
|
|
6807
|
+
});
|
|
6808
|
+
}); }))];
|
|
6137
6809
|
case 3:
|
|
6138
6810
|
_a.sent();
|
|
6139
|
-
return [4 /*yield*/, Promise.all(
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
})
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
}); }),
|
|
6156
|
-
])];
|
|
6811
|
+
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
6812
|
+
.getAgentList(swarmName)
|
|
6813
|
+
.flatMap(function (agentName) {
|
|
6814
|
+
return swarm.agentValidationService.getStorageList(agentName);
|
|
6815
|
+
})
|
|
6816
|
+
.filter(function (storageName) { return !!storageName; })
|
|
6817
|
+
.map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6818
|
+
return __generator(this, function (_a) {
|
|
6819
|
+
switch (_a.label) {
|
|
6820
|
+
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(clientId, storageName)];
|
|
6821
|
+
case 1:
|
|
6822
|
+
_a.sent();
|
|
6823
|
+
return [2 /*return*/];
|
|
6824
|
+
}
|
|
6825
|
+
});
|
|
6826
|
+
}); }))];
|
|
6157
6827
|
case 4:
|
|
6158
6828
|
_a.sent();
|
|
6159
|
-
return [4 /*yield*/, Promise.all(
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
})
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
}); }),
|
|
6176
|
-
])];
|
|
6829
|
+
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
6830
|
+
.getAgentList(swarmName)
|
|
6831
|
+
.flatMap(function (agentName) {
|
|
6832
|
+
return swarm.agentValidationService.getStateList(agentName);
|
|
6833
|
+
})
|
|
6834
|
+
.filter(function (stateName) { return !!stateName; })
|
|
6835
|
+
.map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6836
|
+
return __generator(this, function (_a) {
|
|
6837
|
+
switch (_a.label) {
|
|
6838
|
+
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(clientId, stateName)];
|
|
6839
|
+
case 1:
|
|
6840
|
+
_a.sent();
|
|
6841
|
+
return [2 /*return*/];
|
|
6842
|
+
}
|
|
6843
|
+
});
|
|
6844
|
+
}); }))];
|
|
6177
6845
|
case 5:
|
|
6178
6846
|
_a.sent();
|
|
6179
6847
|
return [4 /*yield*/, HistoryAdapter.dispose(clientId, null)];
|
|
@@ -6841,6 +7509,35 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
6841
7509
|
});
|
|
6842
7510
|
}); };
|
|
6843
7511
|
|
|
7512
|
+
var DISALLOWED_EVENT_SOURCE_LIST$1 = new Set([
|
|
7513
|
+
"agent",
|
|
7514
|
+
"history",
|
|
7515
|
+
"session",
|
|
7516
|
+
"state",
|
|
7517
|
+
"storage",
|
|
7518
|
+
"swarm",
|
|
7519
|
+
]);
|
|
7520
|
+
/**
|
|
7521
|
+
* Listens for an event on the swarm bus service and executes a callback function when the event is received.
|
|
7522
|
+
*
|
|
7523
|
+
* @template T - The type of the data payload.
|
|
7524
|
+
* @param {string} clientId - The ID of the client to listen for events from.
|
|
7525
|
+
* @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.
|
|
7526
|
+
* @returns {void} - Returns nothing.
|
|
7527
|
+
*/
|
|
7528
|
+
var listenEvent = function (clientId, topicName, fn) {
|
|
7529
|
+
swarm.loggerService.log("function listenEvent", {
|
|
7530
|
+
clientId: clientId,
|
|
7531
|
+
});
|
|
7532
|
+
if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
|
|
7533
|
+
throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
|
|
7534
|
+
}
|
|
7535
|
+
return swarm.busService.subscribe(clientId, topicName, function (_a) {
|
|
7536
|
+
var payload = _a.payload;
|
|
7537
|
+
return fn(payload);
|
|
7538
|
+
});
|
|
7539
|
+
};
|
|
7540
|
+
|
|
6844
7541
|
/**
|
|
6845
7542
|
* Retrieves the last message sent by the user from the client's message history.
|
|
6846
7543
|
*
|
|
@@ -7023,6 +7720,184 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
7023
7720
|
};
|
|
7024
7721
|
};
|
|
7025
7722
|
|
|
7723
|
+
var DISALLOWED_EVENT_SOURCE_LIST = new Set([
|
|
7724
|
+
"agent",
|
|
7725
|
+
"history",
|
|
7726
|
+
"session",
|
|
7727
|
+
"state",
|
|
7728
|
+
"storage",
|
|
7729
|
+
"swarm",
|
|
7730
|
+
]);
|
|
7731
|
+
/**
|
|
7732
|
+
* Emits an event to the swarm bus service.
|
|
7733
|
+
*
|
|
7734
|
+
* @template T - The type of the payload.
|
|
7735
|
+
* @param {string} clientId - The ID of the client emitting the event.
|
|
7736
|
+
* @param {T} payload - The payload of the event.
|
|
7737
|
+
* @returns {boolean} - Returns true if the event was successfully emitted.
|
|
7738
|
+
*/
|
|
7739
|
+
var event = function (clientId, topicName, payload) {
|
|
7740
|
+
swarm.loggerService.log("function listenEvent", {
|
|
7741
|
+
clientId: clientId,
|
|
7742
|
+
});
|
|
7743
|
+
if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
|
|
7744
|
+
throw new Error("agent-swarm event topic is reserved topicName=".concat(topicName));
|
|
7745
|
+
}
|
|
7746
|
+
return swarm.busService.emit(clientId, {
|
|
7747
|
+
source: topicName,
|
|
7748
|
+
payload: payload,
|
|
7749
|
+
});
|
|
7750
|
+
};
|
|
7751
|
+
|
|
7752
|
+
/**
|
|
7753
|
+
* Cancel the await of output by emit of empty string
|
|
7754
|
+
*
|
|
7755
|
+
* @param {string} clientId - The ID of the client.
|
|
7756
|
+
* @param {string} agentName - The name of the agent.
|
|
7757
|
+
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7758
|
+
*/
|
|
7759
|
+
var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7760
|
+
var swarmName, currentAgentName;
|
|
7761
|
+
return __generator(this, function (_a) {
|
|
7762
|
+
switch (_a.label) {
|
|
7763
|
+
case 0:
|
|
7764
|
+
swarm.loggerService.log('function cancelOutput', {
|
|
7765
|
+
clientId: clientId,
|
|
7766
|
+
agentName: agentName,
|
|
7767
|
+
});
|
|
7768
|
+
swarm.agentValidationService.validate(agentName, "cancelOutput");
|
|
7769
|
+
swarm.sessionValidationService.validate(clientId, "cancelOutput");
|
|
7770
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7771
|
+
swarm.swarmValidationService.validate(swarmName, "cancelOutput");
|
|
7772
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
|
|
7773
|
+
case 1:
|
|
7774
|
+
currentAgentName = _a.sent();
|
|
7775
|
+
if (currentAgentName !== agentName) {
|
|
7776
|
+
swarm.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
7777
|
+
currentAgentName: currentAgentName,
|
|
7778
|
+
agentName: agentName,
|
|
7779
|
+
clientId: clientId,
|
|
7780
|
+
});
|
|
7781
|
+
return [2 /*return*/];
|
|
7782
|
+
}
|
|
7783
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(clientId, swarmName)];
|
|
7784
|
+
case 2:
|
|
7785
|
+
_a.sent();
|
|
7786
|
+
return [2 /*return*/];
|
|
7787
|
+
}
|
|
7788
|
+
});
|
|
7789
|
+
}); };
|
|
7790
|
+
|
|
7791
|
+
/**
|
|
7792
|
+
* Cancel the await of output by emit of empty string without checking active agent
|
|
7793
|
+
*
|
|
7794
|
+
* @param {string} clientId - The ID of the client.
|
|
7795
|
+
* @param {string} agentName - The name of the agent.
|
|
7796
|
+
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7797
|
+
*/
|
|
7798
|
+
var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7799
|
+
var swarmName;
|
|
7800
|
+
return __generator(this, function (_a) {
|
|
7801
|
+
switch (_a.label) {
|
|
7802
|
+
case 0:
|
|
7803
|
+
swarm.loggerService.log('function cancelOutputForce', {
|
|
7804
|
+
clientId: clientId,
|
|
7805
|
+
});
|
|
7806
|
+
swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
|
|
7807
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7808
|
+
swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
|
|
7809
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(clientId, swarmName)];
|
|
7810
|
+
case 1:
|
|
7811
|
+
_a.sent();
|
|
7812
|
+
return [2 /*return*/];
|
|
7813
|
+
}
|
|
7814
|
+
});
|
|
7815
|
+
}); };
|
|
7816
|
+
|
|
7817
|
+
/**
|
|
7818
|
+
* Hook to subscribe to agent events for a specific client.
|
|
7819
|
+
*
|
|
7820
|
+
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
7821
|
+
* @param {function} fn - The callback function to handle the event.
|
|
7822
|
+
* @returns {function} - A function to unsubscribe from the event.
|
|
7823
|
+
*/
|
|
7824
|
+
var listenAgentEvent = function (clientId, fn) {
|
|
7825
|
+
swarm.loggerService.log("middleware listenAgentEvent", {
|
|
7826
|
+
clientId: clientId,
|
|
7827
|
+
});
|
|
7828
|
+
return swarm.busService.subscribe(clientId, "agent", fn);
|
|
7829
|
+
};
|
|
7830
|
+
|
|
7831
|
+
/**
|
|
7832
|
+
* Hook to subscribe to history events for a specific client.
|
|
7833
|
+
*
|
|
7834
|
+
* @param {string} clientId - The ID of the client to subscribe to.
|
|
7835
|
+
* @param {(event: IBaseEvent) => void} fn - The callback function to handle the event.
|
|
7836
|
+
* @returns {Function} - The unsubscribe function.
|
|
7837
|
+
*/
|
|
7838
|
+
var listenHistoryEvent = function (clientId, fn) {
|
|
7839
|
+
swarm.loggerService.log("middleware listenHistoryEvent", {
|
|
7840
|
+
clientId: clientId,
|
|
7841
|
+
});
|
|
7842
|
+
return swarm.busService.subscribe(clientId, "history", fn);
|
|
7843
|
+
};
|
|
7844
|
+
|
|
7845
|
+
/**
|
|
7846
|
+
* Hook to subscribe to session events for a specific client.
|
|
7847
|
+
*
|
|
7848
|
+
* @param {string} clientId - The ID of the client to subscribe to session events for.
|
|
7849
|
+
* @param {function} fn - The callback function to handle the session events.
|
|
7850
|
+
* @returns {function} - The unsubscribe function to stop listening to session events.
|
|
7851
|
+
*/
|
|
7852
|
+
var listenSessionEvent = function (clientId, fn) {
|
|
7853
|
+
swarm.loggerService.log("middleware listenSessionEvent", {
|
|
7854
|
+
clientId: clientId,
|
|
7855
|
+
});
|
|
7856
|
+
return swarm.busService.subscribe(clientId, "session", fn);
|
|
7857
|
+
};
|
|
7858
|
+
|
|
7859
|
+
/**
|
|
7860
|
+
* Hook to subscribe to state events for a specific client.
|
|
7861
|
+
*
|
|
7862
|
+
* @param {string} clientId - The ID of the client to subscribe to.
|
|
7863
|
+
* @param {function} fn - The callback function to handle the event.
|
|
7864
|
+
* @returns {function} - The unsubscribe function to stop listening to the events.
|
|
7865
|
+
*/
|
|
7866
|
+
var listenStateEvent = function (clientId, fn) {
|
|
7867
|
+
swarm.loggerService.log("middleware listenStateEvent", {
|
|
7868
|
+
clientId: clientId,
|
|
7869
|
+
});
|
|
7870
|
+
return swarm.busService.subscribe(clientId, "state", fn);
|
|
7871
|
+
};
|
|
7872
|
+
|
|
7873
|
+
/**
|
|
7874
|
+
* Hook to subscribe to storage events for a specific client.
|
|
7875
|
+
*
|
|
7876
|
+
* @param {string} clientId - The ID of the client to subscribe to storage events for.
|
|
7877
|
+
* @param {function} fn - The callback function to handle the storage event.
|
|
7878
|
+
* @returns {function} - A function to unsubscribe from the storage events.
|
|
7879
|
+
*/
|
|
7880
|
+
var listenStorageEvent = function (clientId, fn) {
|
|
7881
|
+
swarm.loggerService.log("middleware listenStorageEvent", {
|
|
7882
|
+
clientId: clientId,
|
|
7883
|
+
});
|
|
7884
|
+
return swarm.busService.subscribe(clientId, "storage", fn);
|
|
7885
|
+
};
|
|
7886
|
+
|
|
7887
|
+
/**
|
|
7888
|
+
* Hook to subscribe to swarm events for a specific client.
|
|
7889
|
+
*
|
|
7890
|
+
* @param {string} clientId - The ID of the client to subscribe to events for.
|
|
7891
|
+
* @param {(event: IBaseEvent) => void} fn - The callback function to handle the event.
|
|
7892
|
+
* @returns {Function} - A function to unsubscribe from the event.
|
|
7893
|
+
*/
|
|
7894
|
+
var listenSwarmEvent = function (clientId, fn) {
|
|
7895
|
+
swarm.loggerService.log("middleware listenSwarmEvent", {
|
|
7896
|
+
clientId: clientId,
|
|
7897
|
+
});
|
|
7898
|
+
return swarm.busService.subscribe(clientId, "swarm", fn);
|
|
7899
|
+
};
|
|
7900
|
+
|
|
7026
7901
|
var StorageUtils = /** @class */ (function () {
|
|
7027
7902
|
function StorageUtils() {
|
|
7028
7903
|
var _this = this;
|
|
@@ -7279,6 +8154,8 @@ exports.addState = addState;
|
|
|
7279
8154
|
exports.addStorage = addStorage;
|
|
7280
8155
|
exports.addSwarm = addSwarm;
|
|
7281
8156
|
exports.addTool = addTool;
|
|
8157
|
+
exports.cancelOutput = cancelOutput;
|
|
8158
|
+
exports.cancelOutputForce = cancelOutputForce;
|
|
7282
8159
|
exports.changeAgent = changeAgent;
|
|
7283
8160
|
exports.commitFlush = commitFlush;
|
|
7284
8161
|
exports.commitFlushForce = commitFlushForce;
|
|
@@ -7292,6 +8169,7 @@ exports.complete = complete;
|
|
|
7292
8169
|
exports.disposeConnection = disposeConnection;
|
|
7293
8170
|
exports.emit = emit;
|
|
7294
8171
|
exports.emitForce = emitForce;
|
|
8172
|
+
exports.event = event;
|
|
7295
8173
|
exports.execute = execute;
|
|
7296
8174
|
exports.executeForce = executeForce;
|
|
7297
8175
|
exports.getAgentHistory = getAgentHistory;
|
|
@@ -7303,6 +8181,13 @@ exports.getLastUserMessage = getLastUserMessage;
|
|
|
7303
8181
|
exports.getRawHistory = getRawHistory;
|
|
7304
8182
|
exports.getSessionMode = getSessionMode;
|
|
7305
8183
|
exports.getUserHistory = getUserHistory;
|
|
8184
|
+
exports.listenAgentEvent = listenAgentEvent;
|
|
8185
|
+
exports.listenEvent = listenEvent;
|
|
8186
|
+
exports.listenHistoryEvent = listenHistoryEvent;
|
|
8187
|
+
exports.listenSessionEvent = listenSessionEvent;
|
|
8188
|
+
exports.listenStateEvent = listenStateEvent;
|
|
8189
|
+
exports.listenStorageEvent = listenStorageEvent;
|
|
8190
|
+
exports.listenSwarmEvent = listenSwarmEvent;
|
|
7306
8191
|
exports.makeAutoDispose = makeAutoDispose;
|
|
7307
8192
|
exports.makeConnection = makeConnection;
|
|
7308
8193
|
exports.session = session;
|