agent-swarm-kit 1.0.76 → 1.0.77
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 +454 -397
- package/build/index.mjs +453 -397
- package/package.json +1 -1
- package/types.d.ts +82 -60
package/build/index.cjs
CHANGED
|
@@ -154,12 +154,12 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* Service providing context information.
|
|
157
|
+
* Service providing method call context information.
|
|
158
158
|
*/
|
|
159
|
-
var
|
|
159
|
+
var MethodContextService = diScoped.scoped(/** @class */ (function () {
|
|
160
160
|
/**
|
|
161
|
-
* Creates an instance of
|
|
162
|
-
* @param {
|
|
161
|
+
* Creates an instance of MethodContextService.
|
|
162
|
+
* @param {IMethodContext} context - The context object.
|
|
163
163
|
*/
|
|
164
164
|
function class_1(context) {
|
|
165
165
|
this.context = context;
|
|
@@ -173,7 +173,10 @@ var init = (_a = diKit.createActivator("agent-swarm"), _a.init), inject = _a.inj
|
|
|
173
173
|
var baseServices$1 = {
|
|
174
174
|
busService: Symbol('busService'),
|
|
175
175
|
loggerService: Symbol('loggerService'),
|
|
176
|
-
|
|
176
|
+
};
|
|
177
|
+
var contextServices$1 = {
|
|
178
|
+
methodContextService: Symbol('methodContextService'),
|
|
179
|
+
executionContextService: Symbol('executionContextService'),
|
|
177
180
|
};
|
|
178
181
|
var connectionServices$1 = {
|
|
179
182
|
agentConnectionService: Symbol('agentConnectionService'),
|
|
@@ -209,7 +212,21 @@ var validationServices$1 = {
|
|
|
209
212
|
embeddingValidationService: Symbol('embeddingValidationService'),
|
|
210
213
|
storageValidationService: Symbol('storageValidationService'),
|
|
211
214
|
};
|
|
212
|
-
var TYPES = __assign(__assign(__assign(__assign(__assign({}, baseServices$1), schemaServices$1), connectionServices$1), publicServices$1), validationServices$1);
|
|
215
|
+
var TYPES = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices$1), contextServices$1), schemaServices$1), connectionServices$1), publicServices$1), validationServices$1);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Service providing execution context information.
|
|
219
|
+
*/
|
|
220
|
+
var ExecutionContextService = diScoped.scoped(/** @class */ (function () {
|
|
221
|
+
/**
|
|
222
|
+
* Creates an instance of ExecutionContextService.
|
|
223
|
+
* @param {IExecutionContext} context - The context object.
|
|
224
|
+
*/
|
|
225
|
+
function class_1(context) {
|
|
226
|
+
this.context = context;
|
|
227
|
+
}
|
|
228
|
+
return class_1;
|
|
229
|
+
}()));
|
|
213
230
|
|
|
214
231
|
/**
|
|
215
232
|
* LoggerService class that implements the ILogger interface.
|
|
@@ -218,7 +235,8 @@ var TYPES = __assign(__assign(__assign(__assign(__assign({}, baseServices$1), sc
|
|
|
218
235
|
var LoggerService = /** @class */ (function () {
|
|
219
236
|
function LoggerService() {
|
|
220
237
|
var _this = this;
|
|
221
|
-
this.
|
|
238
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
239
|
+
this.executionContextService = inject(TYPES.executionContextService);
|
|
222
240
|
this._logger = {
|
|
223
241
|
/**
|
|
224
242
|
* Logs messages.
|
|
@@ -238,32 +256,39 @@ var LoggerService = /** @class */ (function () {
|
|
|
238
256
|
* @param {...any} args - The messages to log.
|
|
239
257
|
*/
|
|
240
258
|
this.log = function () {
|
|
241
|
-
var _a
|
|
259
|
+
var _a;
|
|
242
260
|
var args = [];
|
|
243
261
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
244
262
|
args[_i] = arguments[_i];
|
|
245
263
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
264
|
+
var methodContext = MethodContextService.hasContext()
|
|
265
|
+
? _this.methodContextService.context
|
|
266
|
+
: null;
|
|
267
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
268
|
+
? _this.executionContextService.context
|
|
269
|
+
: null;
|
|
270
|
+
(_a = _this._logger).log.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{
|
|
271
|
+
methodContext: methodContext,
|
|
272
|
+
executionContext: executionContext,
|
|
273
|
+
}], false));
|
|
251
274
|
};
|
|
252
275
|
/**
|
|
253
276
|
* Logs debug messages using the current logger.
|
|
254
277
|
* @param {...any} args - The debug messages to log.
|
|
255
278
|
*/
|
|
256
279
|
this.debug = function () {
|
|
257
|
-
var _a
|
|
280
|
+
var _a;
|
|
258
281
|
var args = [];
|
|
259
282
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
260
283
|
args[_i] = arguments[_i];
|
|
261
284
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
285
|
+
var methodContext = MethodContextService.hasContext()
|
|
286
|
+
? _this.methodContextService.context
|
|
287
|
+
: null;
|
|
288
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
289
|
+
? _this.executionContextService.context
|
|
290
|
+
: null;
|
|
291
|
+
(_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
|
|
267
292
|
};
|
|
268
293
|
/**
|
|
269
294
|
* Sets a new logger.
|
|
@@ -1523,7 +1548,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1523
1548
|
var _this = this;
|
|
1524
1549
|
this.loggerService = inject(TYPES.loggerService);
|
|
1525
1550
|
this.busService = inject(TYPES.busService);
|
|
1526
|
-
this.
|
|
1551
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
1527
1552
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
1528
1553
|
this.historyConnectionService = inject(TYPES.historyConnectionService);
|
|
1529
1554
|
this.storageConnectionService = inject(TYPES.storageConnectionService);
|
|
@@ -1568,7 +1593,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1568
1593
|
input: input,
|
|
1569
1594
|
mode: mode,
|
|
1570
1595
|
});
|
|
1571
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1596
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).execute(input, mode)];
|
|
1572
1597
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1573
1598
|
}
|
|
1574
1599
|
});
|
|
@@ -1582,7 +1607,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1582
1607
|
switch (_a.label) {
|
|
1583
1608
|
case 0:
|
|
1584
1609
|
this.loggerService.log("agentConnectionService waitForOutput");
|
|
1585
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1610
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).waitForOutput()];
|
|
1586
1611
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1587
1612
|
}
|
|
1588
1613
|
});
|
|
@@ -1601,7 +1626,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1601
1626
|
content: content,
|
|
1602
1627
|
toolId: toolId,
|
|
1603
1628
|
});
|
|
1604
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1629
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitToolOutput(toolId, content)];
|
|
1605
1630
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1606
1631
|
}
|
|
1607
1632
|
});
|
|
@@ -1618,7 +1643,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1618
1643
|
this.loggerService.log("agentConnectionService commitSystemMessage", {
|
|
1619
1644
|
message: message,
|
|
1620
1645
|
});
|
|
1621
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1646
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitSystemMessage(message)];
|
|
1622
1647
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1623
1648
|
}
|
|
1624
1649
|
});
|
|
@@ -1635,7 +1660,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1635
1660
|
this.loggerService.log("agentConnectionService commitUserMessage", {
|
|
1636
1661
|
message: message,
|
|
1637
1662
|
});
|
|
1638
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1663
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitUserMessage(message)];
|
|
1639
1664
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1640
1665
|
}
|
|
1641
1666
|
});
|
|
@@ -1649,7 +1674,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1649
1674
|
switch (_a.label) {
|
|
1650
1675
|
case 0:
|
|
1651
1676
|
this.loggerService.log("agentConnectionService commitAgentChange");
|
|
1652
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1677
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitAgentChange()];
|
|
1653
1678
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1654
1679
|
}
|
|
1655
1680
|
});
|
|
@@ -1663,7 +1688,7 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1663
1688
|
switch (_a.label) {
|
|
1664
1689
|
case 0:
|
|
1665
1690
|
this.loggerService.log("agentConnectionService commitFlush");
|
|
1666
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1691
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitFlush()];
|
|
1667
1692
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1668
1693
|
}
|
|
1669
1694
|
});
|
|
@@ -1678,15 +1703,15 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
1678
1703
|
switch (_a.label) {
|
|
1679
1704
|
case 0:
|
|
1680
1705
|
this.loggerService.log("agentConnectionService dispose");
|
|
1681
|
-
key = "".concat(this.
|
|
1706
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
1682
1707
|
if (!this.getAgent.has(key)) {
|
|
1683
1708
|
return [2 /*return*/];
|
|
1684
1709
|
}
|
|
1685
|
-
return [4 /*yield*/, this.getAgent(this.
|
|
1710
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).dispose()];
|
|
1686
1711
|
case 1:
|
|
1687
1712
|
_a.sent();
|
|
1688
1713
|
this.getAgent.clear(key);
|
|
1689
|
-
this.sessionValidationService.removeAgentUsage(this.
|
|
1714
|
+
this.sessionValidationService.removeAgentUsage(this.methodContextService.context.clientId, this.methodContextService.context.agentName);
|
|
1690
1715
|
return [2 /*return*/];
|
|
1691
1716
|
}
|
|
1692
1717
|
});
|
|
@@ -1967,7 +1992,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
1967
1992
|
var _this = this;
|
|
1968
1993
|
this.loggerService = inject(TYPES.loggerService);
|
|
1969
1994
|
this.busService = inject(TYPES.busService);
|
|
1970
|
-
this.
|
|
1995
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
1971
1996
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
1972
1997
|
/**
|
|
1973
1998
|
* Retrieves the history for a given client and agent.
|
|
@@ -2000,7 +2025,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2000
2025
|
this.loggerService.log("historyConnectionService push", {
|
|
2001
2026
|
message: message,
|
|
2002
2027
|
});
|
|
2003
|
-
return [4 /*yield*/, this.getHistory(this.
|
|
2028
|
+
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).push(message)];
|
|
2004
2029
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2005
2030
|
}
|
|
2006
2031
|
});
|
|
@@ -2017,7 +2042,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2017
2042
|
this.loggerService.log("historyConnectionService toArrayForAgent", {
|
|
2018
2043
|
prompt: prompt,
|
|
2019
2044
|
});
|
|
2020
|
-
return [4 /*yield*/, this.getHistory(this.
|
|
2045
|
+
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForAgent(prompt)];
|
|
2021
2046
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2022
2047
|
}
|
|
2023
2048
|
});
|
|
@@ -2031,7 +2056,7 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2031
2056
|
switch (_a.label) {
|
|
2032
2057
|
case 0:
|
|
2033
2058
|
this.loggerService.log("historyConnectionService toArrayForRaw");
|
|
2034
|
-
return [4 /*yield*/, this.getHistory(this.
|
|
2059
|
+
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForRaw()];
|
|
2035
2060
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2036
2061
|
}
|
|
2037
2062
|
});
|
|
@@ -2046,15 +2071,15 @@ var HistoryConnectionService = /** @class */ (function () {
|
|
|
2046
2071
|
switch (_a.label) {
|
|
2047
2072
|
case 0:
|
|
2048
2073
|
this.loggerService.log("historyConnectionService dispose");
|
|
2049
|
-
key = "".concat(this.
|
|
2074
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
|
|
2050
2075
|
if (!this.getHistory.has(key)) {
|
|
2051
2076
|
return [2 /*return*/];
|
|
2052
2077
|
}
|
|
2053
|
-
return [4 /*yield*/, this.getHistory(this.
|
|
2078
|
+
return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).dispose()];
|
|
2054
2079
|
case 1:
|
|
2055
2080
|
_a.sent();
|
|
2056
2081
|
this.getHistory.clear(key);
|
|
2057
|
-
this.sessionValidationService.removeHistoryUsage(this.
|
|
2082
|
+
this.sessionValidationService.removeHistoryUsage(this.methodContextService.context.clientId, this.methodContextService.context.agentName);
|
|
2058
2083
|
return [2 /*return*/];
|
|
2059
2084
|
}
|
|
2060
2085
|
});
|
|
@@ -2375,7 +2400,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2375
2400
|
var _this = this;
|
|
2376
2401
|
this.loggerService = inject(TYPES.loggerService);
|
|
2377
2402
|
this.busService = inject(TYPES.busService);
|
|
2378
|
-
this.
|
|
2403
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
2379
2404
|
this.agentConnectionService = inject(TYPES.agentConnectionService);
|
|
2380
2405
|
this.swarmSchemaService = inject(TYPES.swarmSchemaService);
|
|
2381
2406
|
/**
|
|
@@ -2439,7 +2464,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2439
2464
|
switch (_a.label) {
|
|
2440
2465
|
case 0:
|
|
2441
2466
|
this.loggerService.log("swarmConnectionService cancelOutput");
|
|
2442
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2467
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).cancelOutput()];
|
|
2443
2468
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2444
2469
|
}
|
|
2445
2470
|
});
|
|
@@ -2453,7 +2478,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2453
2478
|
switch (_a.label) {
|
|
2454
2479
|
case 0:
|
|
2455
2480
|
this.loggerService.log("swarmConnectionService waitForOutput");
|
|
2456
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2481
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).waitForOutput()];
|
|
2457
2482
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2458
2483
|
}
|
|
2459
2484
|
});
|
|
@@ -2467,7 +2492,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2467
2492
|
switch (_a.label) {
|
|
2468
2493
|
case 0:
|
|
2469
2494
|
this.loggerService.log("swarmConnectionService getAgentName");
|
|
2470
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2495
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgentName()];
|
|
2471
2496
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2472
2497
|
}
|
|
2473
2498
|
});
|
|
@@ -2481,7 +2506,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2481
2506
|
switch (_a.label) {
|
|
2482
2507
|
case 0:
|
|
2483
2508
|
this.loggerService.log("swarmConnectionService getAgent");
|
|
2484
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2509
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgent()];
|
|
2485
2510
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2486
2511
|
}
|
|
2487
2512
|
});
|
|
@@ -2499,7 +2524,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2499
2524
|
this.loggerService.log("swarmConnectionService setAgentRef", {
|
|
2500
2525
|
agentName: agentName,
|
|
2501
2526
|
});
|
|
2502
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2527
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentRef(agentName, agent)];
|
|
2503
2528
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2504
2529
|
}
|
|
2505
2530
|
});
|
|
@@ -2516,7 +2541,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2516
2541
|
this.loggerService.log("swarmConnectionService setAgentName", {
|
|
2517
2542
|
agentName: agentName,
|
|
2518
2543
|
});
|
|
2519
|
-
return [4 /*yield*/, this.getSwarm(this.
|
|
2544
|
+
return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentName(agentName)];
|
|
2520
2545
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2521
2546
|
}
|
|
2522
2547
|
});
|
|
@@ -2529,7 +2554,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2529
2554
|
var key;
|
|
2530
2555
|
return __generator(this, function (_a) {
|
|
2531
2556
|
this.loggerService.log("swarmConnectionService dispose");
|
|
2532
|
-
key = "".concat(this.
|
|
2557
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
2533
2558
|
if (!this.getSwarm.has(key)) {
|
|
2534
2559
|
return [2 /*return*/];
|
|
2535
2560
|
}
|
|
@@ -2934,7 +2959,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2934
2959
|
var _this = this;
|
|
2935
2960
|
this.loggerService = inject(TYPES.loggerService);
|
|
2936
2961
|
this.busService = inject(TYPES.busService);
|
|
2937
|
-
this.
|
|
2962
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
2938
2963
|
this.swarmConnectionService = inject(TYPES.swarmConnectionService);
|
|
2939
2964
|
this.swarmSchemaService = inject(TYPES.swarmSchemaService);
|
|
2940
2965
|
/**
|
|
@@ -2962,7 +2987,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2962
2987
|
this.loggerService.log("sessionConnectionService emit", {
|
|
2963
2988
|
content: content,
|
|
2964
2989
|
});
|
|
2965
|
-
return [4 /*yield*/, this.getSession(this.
|
|
2990
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).emit(content)];
|
|
2966
2991
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2967
2992
|
}
|
|
2968
2993
|
});
|
|
@@ -2980,7 +3005,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2980
3005
|
content: content,
|
|
2981
3006
|
mode: mode,
|
|
2982
3007
|
});
|
|
2983
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3008
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).execute(content, mode)];
|
|
2984
3009
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2985
3010
|
}
|
|
2986
3011
|
});
|
|
@@ -3008,7 +3033,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3008
3033
|
content: content,
|
|
3009
3034
|
toolId: toolId,
|
|
3010
3035
|
});
|
|
3011
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3036
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitToolOutput(toolId, content)];
|
|
3012
3037
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3013
3038
|
}
|
|
3014
3039
|
});
|
|
@@ -3025,7 +3050,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3025
3050
|
this.loggerService.log("sessionConnectionService commitSystemMessage", {
|
|
3026
3051
|
message: message,
|
|
3027
3052
|
});
|
|
3028
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3053
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitSystemMessage(message)];
|
|
3029
3054
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3030
3055
|
}
|
|
3031
3056
|
});
|
|
@@ -3042,7 +3067,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3042
3067
|
this.loggerService.log("sessionConnectionService commitUserMessage", {
|
|
3043
3068
|
message: message,
|
|
3044
3069
|
});
|
|
3045
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3070
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitUserMessage(message)];
|
|
3046
3071
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3047
3072
|
}
|
|
3048
3073
|
});
|
|
@@ -3057,7 +3082,7 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3057
3082
|
switch (_a.label) {
|
|
3058
3083
|
case 0:
|
|
3059
3084
|
this.loggerService.log("sessionConnectionService commitFlush");
|
|
3060
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3085
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitFlush()];
|
|
3061
3086
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3062
3087
|
}
|
|
3063
3088
|
});
|
|
@@ -3072,11 +3097,11 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
3072
3097
|
switch (_a.label) {
|
|
3073
3098
|
case 0:
|
|
3074
3099
|
this.loggerService.log("sessionConnectionService dispose");
|
|
3075
|
-
key = "".concat(this.
|
|
3100
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
|
|
3076
3101
|
if (!this.getSession.has(key)) {
|
|
3077
3102
|
return [2 /*return*/];
|
|
3078
3103
|
}
|
|
3079
|
-
return [4 /*yield*/, this.getSession(this.
|
|
3104
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).dispose()];
|
|
3080
3105
|
case 1:
|
|
3081
3106
|
_a.sent();
|
|
3082
3107
|
this.getSession.clear(key);
|
|
@@ -3102,17 +3127,17 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3102
3127
|
* @param {AgentName} agentName - The name of the agent.
|
|
3103
3128
|
* @returns {Promise<unknown>} The agent reference.
|
|
3104
3129
|
*/
|
|
3105
|
-
this.createAgentRef = function (
|
|
3130
|
+
this.createAgentRef = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3106
3131
|
var _this = this;
|
|
3107
3132
|
return __generator(this, function (_a) {
|
|
3108
3133
|
switch (_a.label) {
|
|
3109
3134
|
case 0:
|
|
3110
3135
|
this.loggerService.log("agentPublicService createAgentRef", {
|
|
3111
|
-
|
|
3136
|
+
methodName: methodName,
|
|
3112
3137
|
clientId: clientId,
|
|
3113
3138
|
agentName: agentName,
|
|
3114
3139
|
});
|
|
3115
|
-
return [4 /*yield*/,
|
|
3140
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3116
3141
|
return __generator(this, function (_a) {
|
|
3117
3142
|
switch (_a.label) {
|
|
3118
3143
|
case 0: return [4 /*yield*/, this.agentConnectionService.getAgent(clientId, agentName)];
|
|
@@ -3120,7 +3145,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3120
3145
|
}
|
|
3121
3146
|
});
|
|
3122
3147
|
}); }, {
|
|
3123
|
-
|
|
3148
|
+
methodName: methodName,
|
|
3124
3149
|
clientId: clientId,
|
|
3125
3150
|
agentName: agentName,
|
|
3126
3151
|
swarmName: "",
|
|
@@ -3138,19 +3163,19 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3138
3163
|
* @param {AgentName} agentName - The name of the agent.
|
|
3139
3164
|
* @returns {Promise<unknown>} The execution result.
|
|
3140
3165
|
*/
|
|
3141
|
-
this.execute = function (input, mode,
|
|
3166
|
+
this.execute = function (input, mode, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3142
3167
|
var _this = this;
|
|
3143
3168
|
return __generator(this, function (_a) {
|
|
3144
3169
|
switch (_a.label) {
|
|
3145
3170
|
case 0:
|
|
3146
3171
|
this.loggerService.log("agentPublicService execute", {
|
|
3147
|
-
|
|
3172
|
+
methodName: methodName,
|
|
3148
3173
|
input: input,
|
|
3149
3174
|
clientId: clientId,
|
|
3150
3175
|
agentName: agentName,
|
|
3151
3176
|
mode: mode,
|
|
3152
3177
|
});
|
|
3153
|
-
return [4 /*yield*/,
|
|
3178
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3154
3179
|
return __generator(this, function (_a) {
|
|
3155
3180
|
switch (_a.label) {
|
|
3156
3181
|
case 0: return [4 /*yield*/, this.agentConnectionService.execute(input, mode)];
|
|
@@ -3158,7 +3183,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3158
3183
|
}
|
|
3159
3184
|
});
|
|
3160
3185
|
}); }, {
|
|
3161
|
-
|
|
3186
|
+
methodName: methodName,
|
|
3162
3187
|
clientId: clientId,
|
|
3163
3188
|
agentName: agentName,
|
|
3164
3189
|
swarmName: "",
|
|
@@ -3175,17 +3200,17 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3175
3200
|
* @param {AgentName} agentName - The name of the agent.
|
|
3176
3201
|
* @returns {Promise<unknown>} The output result.
|
|
3177
3202
|
*/
|
|
3178
|
-
this.waitForOutput = function (
|
|
3203
|
+
this.waitForOutput = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3179
3204
|
var _this = this;
|
|
3180
3205
|
return __generator(this, function (_a) {
|
|
3181
3206
|
switch (_a.label) {
|
|
3182
3207
|
case 0:
|
|
3183
3208
|
this.loggerService.log("agentPublicService waitForOutput", {
|
|
3184
|
-
|
|
3209
|
+
methodName: methodName,
|
|
3185
3210
|
clientId: clientId,
|
|
3186
3211
|
agentName: agentName,
|
|
3187
3212
|
});
|
|
3188
|
-
return [4 /*yield*/,
|
|
3213
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3189
3214
|
return __generator(this, function (_a) {
|
|
3190
3215
|
switch (_a.label) {
|
|
3191
3216
|
case 0: return [4 /*yield*/, this.agentConnectionService.waitForOutput()];
|
|
@@ -3193,7 +3218,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3193
3218
|
}
|
|
3194
3219
|
});
|
|
3195
3220
|
}); }, {
|
|
3196
|
-
|
|
3221
|
+
methodName: methodName,
|
|
3197
3222
|
clientId: clientId,
|
|
3198
3223
|
agentName: agentName,
|
|
3199
3224
|
swarmName: "",
|
|
@@ -3212,19 +3237,19 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3212
3237
|
* @param {AgentName} agentName - The name of the agent.
|
|
3213
3238
|
* @returns {Promise<unknown>} The commit result.
|
|
3214
3239
|
*/
|
|
3215
|
-
this.commitToolOutput = function (toolId, content,
|
|
3240
|
+
this.commitToolOutput = function (toolId, content, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3216
3241
|
var _this = this;
|
|
3217
3242
|
return __generator(this, function (_a) {
|
|
3218
3243
|
switch (_a.label) {
|
|
3219
3244
|
case 0:
|
|
3220
3245
|
this.loggerService.log("agentPublicService commitToolOutput", {
|
|
3221
|
-
|
|
3246
|
+
methodName: methodName,
|
|
3222
3247
|
content: content,
|
|
3223
3248
|
clientId: clientId,
|
|
3224
3249
|
toolId: toolId,
|
|
3225
3250
|
agentName: agentName,
|
|
3226
3251
|
});
|
|
3227
|
-
return [4 /*yield*/,
|
|
3252
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3228
3253
|
return __generator(this, function (_a) {
|
|
3229
3254
|
switch (_a.label) {
|
|
3230
3255
|
case 0: return [4 /*yield*/, this.agentConnectionService.commitToolOutput(toolId, content)];
|
|
@@ -3232,7 +3257,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3232
3257
|
}
|
|
3233
3258
|
});
|
|
3234
3259
|
}); }, {
|
|
3235
|
-
|
|
3260
|
+
methodName: methodName,
|
|
3236
3261
|
clientId: clientId,
|
|
3237
3262
|
agentName: agentName,
|
|
3238
3263
|
swarmName: "",
|
|
@@ -3250,18 +3275,18 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3250
3275
|
* @param {AgentName} agentName - The name of the agent.
|
|
3251
3276
|
* @returns {Promise<unknown>} The commit result.
|
|
3252
3277
|
*/
|
|
3253
|
-
this.commitSystemMessage = function (message,
|
|
3278
|
+
this.commitSystemMessage = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3254
3279
|
var _this = this;
|
|
3255
3280
|
return __generator(this, function (_a) {
|
|
3256
3281
|
switch (_a.label) {
|
|
3257
3282
|
case 0:
|
|
3258
3283
|
this.loggerService.log("agentPublicService commitSystemMessage", {
|
|
3259
|
-
|
|
3284
|
+
methodName: methodName,
|
|
3260
3285
|
message: message,
|
|
3261
3286
|
clientId: clientId,
|
|
3262
3287
|
agentName: agentName,
|
|
3263
3288
|
});
|
|
3264
|
-
return [4 /*yield*/,
|
|
3289
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3265
3290
|
return __generator(this, function (_a) {
|
|
3266
3291
|
switch (_a.label) {
|
|
3267
3292
|
case 0: return [4 /*yield*/, this.agentConnectionService.commitSystemMessage(message)];
|
|
@@ -3269,7 +3294,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3269
3294
|
}
|
|
3270
3295
|
});
|
|
3271
3296
|
}); }, {
|
|
3272
|
-
|
|
3297
|
+
methodName: methodName,
|
|
3273
3298
|
clientId: clientId,
|
|
3274
3299
|
agentName: agentName,
|
|
3275
3300
|
swarmName: "",
|
|
@@ -3287,18 +3312,18 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3287
3312
|
* @param {AgentName} agentName - The name of the agent.
|
|
3288
3313
|
* @returns {Promise<unknown>} The commit result.
|
|
3289
3314
|
*/
|
|
3290
|
-
this.commitUserMessage = function (message,
|
|
3315
|
+
this.commitUserMessage = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3291
3316
|
var _this = this;
|
|
3292
3317
|
return __generator(this, function (_a) {
|
|
3293
3318
|
switch (_a.label) {
|
|
3294
3319
|
case 0:
|
|
3295
3320
|
this.loggerService.log("agentPublicService commitUserMessage", {
|
|
3296
|
-
|
|
3321
|
+
methodName: methodName,
|
|
3297
3322
|
message: message,
|
|
3298
3323
|
clientId: clientId,
|
|
3299
3324
|
agentName: agentName,
|
|
3300
3325
|
});
|
|
3301
|
-
return [4 /*yield*/,
|
|
3326
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3302
3327
|
return __generator(this, function (_a) {
|
|
3303
3328
|
switch (_a.label) {
|
|
3304
3329
|
case 0: return [4 /*yield*/, this.agentConnectionService.commitUserMessage(message)];
|
|
@@ -3306,7 +3331,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3306
3331
|
}
|
|
3307
3332
|
});
|
|
3308
3333
|
}); }, {
|
|
3309
|
-
|
|
3334
|
+
methodName: methodName,
|
|
3310
3335
|
clientId: clientId,
|
|
3311
3336
|
agentName: agentName,
|
|
3312
3337
|
swarmName: "",
|
|
@@ -3323,17 +3348,17 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3323
3348
|
* @param {AgentName} agentName - The name of the agent.
|
|
3324
3349
|
* @returns {Promise<unknown>} The commit result.
|
|
3325
3350
|
*/
|
|
3326
|
-
this.commitFlush = function (
|
|
3351
|
+
this.commitFlush = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3327
3352
|
var _this = this;
|
|
3328
3353
|
return __generator(this, function (_a) {
|
|
3329
3354
|
switch (_a.label) {
|
|
3330
3355
|
case 0:
|
|
3331
3356
|
this.loggerService.log("agentPublicService commitFlush", {
|
|
3332
|
-
|
|
3357
|
+
methodName: methodName,
|
|
3333
3358
|
clientId: clientId,
|
|
3334
3359
|
agentName: agentName,
|
|
3335
3360
|
});
|
|
3336
|
-
return [4 /*yield*/,
|
|
3361
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3337
3362
|
return __generator(this, function (_a) {
|
|
3338
3363
|
switch (_a.label) {
|
|
3339
3364
|
case 0: return [4 /*yield*/, this.agentConnectionService.commitFlush()];
|
|
@@ -3341,7 +3366,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3341
3366
|
}
|
|
3342
3367
|
});
|
|
3343
3368
|
}); }, {
|
|
3344
|
-
|
|
3369
|
+
methodName: methodName,
|
|
3345
3370
|
clientId: clientId,
|
|
3346
3371
|
agentName: agentName,
|
|
3347
3372
|
swarmName: "",
|
|
@@ -3358,17 +3383,17 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3358
3383
|
* @param {AgentName} agentName - The name of the agent.
|
|
3359
3384
|
* @returns {Promise<unknown>} The commit result.
|
|
3360
3385
|
*/
|
|
3361
|
-
this.commitAgentChange = function (
|
|
3386
|
+
this.commitAgentChange = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3362
3387
|
var _this = this;
|
|
3363
3388
|
return __generator(this, function (_a) {
|
|
3364
3389
|
switch (_a.label) {
|
|
3365
3390
|
case 0:
|
|
3366
3391
|
this.loggerService.log("agentPublicService commitAgentChange", {
|
|
3367
|
-
|
|
3392
|
+
methodName: methodName,
|
|
3368
3393
|
clientId: clientId,
|
|
3369
3394
|
agentName: agentName,
|
|
3370
3395
|
});
|
|
3371
|
-
return [4 /*yield*/,
|
|
3396
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3372
3397
|
return __generator(this, function (_a) {
|
|
3373
3398
|
switch (_a.label) {
|
|
3374
3399
|
case 0: return [4 /*yield*/, this.agentConnectionService.commitAgentChange()];
|
|
@@ -3376,7 +3401,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3376
3401
|
}
|
|
3377
3402
|
});
|
|
3378
3403
|
}); }, {
|
|
3379
|
-
|
|
3404
|
+
methodName: methodName,
|
|
3380
3405
|
clientId: clientId,
|
|
3381
3406
|
agentName: agentName,
|
|
3382
3407
|
swarmName: "",
|
|
@@ -3393,17 +3418,17 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3393
3418
|
* @param {AgentName} agentName - The name of the agent.
|
|
3394
3419
|
* @returns {Promise<unknown>} The dispose result.
|
|
3395
3420
|
*/
|
|
3396
|
-
this.dispose = function (
|
|
3421
|
+
this.dispose = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3397
3422
|
var _this = this;
|
|
3398
3423
|
return __generator(this, function (_a) {
|
|
3399
3424
|
switch (_a.label) {
|
|
3400
3425
|
case 0:
|
|
3401
3426
|
this.loggerService.log("agentPublicService dispose", {
|
|
3402
|
-
|
|
3427
|
+
methodName: methodName,
|
|
3403
3428
|
clientId: clientId,
|
|
3404
3429
|
agentName: agentName,
|
|
3405
3430
|
});
|
|
3406
|
-
return [4 /*yield*/,
|
|
3431
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3407
3432
|
return __generator(this, function (_a) {
|
|
3408
3433
|
switch (_a.label) {
|
|
3409
3434
|
case 0: return [4 /*yield*/, this.agentConnectionService.dispose()];
|
|
@@ -3411,7 +3436,7 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
3411
3436
|
}
|
|
3412
3437
|
});
|
|
3413
3438
|
}); }, {
|
|
3414
|
-
|
|
3439
|
+
methodName: methodName,
|
|
3415
3440
|
clientId: clientId,
|
|
3416
3441
|
agentName: agentName,
|
|
3417
3442
|
swarmName: "",
|
|
@@ -3441,18 +3466,18 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3441
3466
|
* @param {AgentName} agentName - The agent name.
|
|
3442
3467
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
3443
3468
|
*/
|
|
3444
|
-
this.push = function (message,
|
|
3469
|
+
this.push = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3445
3470
|
var _this = this;
|
|
3446
3471
|
return __generator(this, function (_a) {
|
|
3447
3472
|
switch (_a.label) {
|
|
3448
3473
|
case 0:
|
|
3449
3474
|
this.loggerService.log("historyPublicService push", {
|
|
3450
|
-
|
|
3475
|
+
methodName: methodName,
|
|
3451
3476
|
message: message,
|
|
3452
3477
|
clientId: clientId,
|
|
3453
3478
|
agentName: agentName,
|
|
3454
3479
|
});
|
|
3455
|
-
return [4 /*yield*/,
|
|
3480
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3456
3481
|
return __generator(this, function (_a) {
|
|
3457
3482
|
switch (_a.label) {
|
|
3458
3483
|
case 0: return [4 /*yield*/, this.historyConnectionService.push(message)];
|
|
@@ -3460,7 +3485,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3460
3485
|
}
|
|
3461
3486
|
});
|
|
3462
3487
|
}); }, {
|
|
3463
|
-
|
|
3488
|
+
methodName: methodName,
|
|
3464
3489
|
clientId: clientId,
|
|
3465
3490
|
agentName: agentName,
|
|
3466
3491
|
swarmName: "",
|
|
@@ -3478,7 +3503,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3478
3503
|
* @param {AgentName} agentName - The agent name.
|
|
3479
3504
|
* @returns {Promise<any[]>} A promise that resolves to an array of history items.
|
|
3480
3505
|
*/
|
|
3481
|
-
this.toArrayForAgent = function (prompt,
|
|
3506
|
+
this.toArrayForAgent = function (prompt, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3482
3507
|
var _this = this;
|
|
3483
3508
|
return __generator(this, function (_a) {
|
|
3484
3509
|
switch (_a.label) {
|
|
@@ -3488,7 +3513,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3488
3513
|
clientId: clientId,
|
|
3489
3514
|
agentName: agentName,
|
|
3490
3515
|
});
|
|
3491
|
-
return [4 /*yield*/,
|
|
3516
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3492
3517
|
return __generator(this, function (_a) {
|
|
3493
3518
|
switch (_a.label) {
|
|
3494
3519
|
case 0: return [4 /*yield*/, this.historyConnectionService.toArrayForAgent(prompt)];
|
|
@@ -3496,7 +3521,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3496
3521
|
}
|
|
3497
3522
|
});
|
|
3498
3523
|
}); }, {
|
|
3499
|
-
|
|
3524
|
+
methodName: methodName,
|
|
3500
3525
|
clientId: clientId,
|
|
3501
3526
|
agentName: agentName,
|
|
3502
3527
|
swarmName: "",
|
|
@@ -3513,17 +3538,17 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3513
3538
|
* @param {AgentName} agentName - The agent name.
|
|
3514
3539
|
* @returns {Promise<any[]>} A promise that resolves to a raw array of history items.
|
|
3515
3540
|
*/
|
|
3516
|
-
this.toArrayForRaw = function (
|
|
3541
|
+
this.toArrayForRaw = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3517
3542
|
var _this = this;
|
|
3518
3543
|
return __generator(this, function (_a) {
|
|
3519
3544
|
switch (_a.label) {
|
|
3520
3545
|
case 0:
|
|
3521
3546
|
this.loggerService.log("historyPublicService toArrayForRaw", {
|
|
3522
|
-
|
|
3547
|
+
methodName: methodName,
|
|
3523
3548
|
clientId: clientId,
|
|
3524
3549
|
agentName: agentName,
|
|
3525
3550
|
});
|
|
3526
|
-
return [4 /*yield*/,
|
|
3551
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3527
3552
|
return __generator(this, function (_a) {
|
|
3528
3553
|
switch (_a.label) {
|
|
3529
3554
|
case 0: return [4 /*yield*/, this.historyConnectionService.toArrayForRaw()];
|
|
@@ -3531,7 +3556,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3531
3556
|
}
|
|
3532
3557
|
});
|
|
3533
3558
|
}); }, {
|
|
3534
|
-
|
|
3559
|
+
methodName: methodName,
|
|
3535
3560
|
clientId: clientId,
|
|
3536
3561
|
agentName: agentName,
|
|
3537
3562
|
swarmName: "",
|
|
@@ -3548,7 +3573,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3548
3573
|
* @param {AgentName} agentName - The agent name.
|
|
3549
3574
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
3550
3575
|
*/
|
|
3551
|
-
this.dispose = function (
|
|
3576
|
+
this.dispose = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3552
3577
|
var _this = this;
|
|
3553
3578
|
return __generator(this, function (_a) {
|
|
3554
3579
|
switch (_a.label) {
|
|
@@ -3557,7 +3582,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3557
3582
|
clientId: clientId,
|
|
3558
3583
|
agentName: agentName,
|
|
3559
3584
|
});
|
|
3560
|
-
return [4 /*yield*/,
|
|
3585
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3561
3586
|
return __generator(this, function (_a) {
|
|
3562
3587
|
switch (_a.label) {
|
|
3563
3588
|
case 0: return [4 /*yield*/, this.historyConnectionService.dispose()];
|
|
@@ -3565,7 +3590,7 @@ var HistoryPublicService = /** @class */ (function () {
|
|
|
3565
3590
|
}
|
|
3566
3591
|
});
|
|
3567
3592
|
}); }, {
|
|
3568
|
-
|
|
3593
|
+
methodName: methodName,
|
|
3569
3594
|
clientId: clientId,
|
|
3570
3595
|
agentName: agentName,
|
|
3571
3596
|
swarmName: "",
|
|
@@ -3595,7 +3620,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3595
3620
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3596
3621
|
* @returns {Promise<void>}
|
|
3597
3622
|
*/
|
|
3598
|
-
this.emit = function (content,
|
|
3623
|
+
this.emit = function (content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3599
3624
|
var _this = this;
|
|
3600
3625
|
return __generator(this, function (_a) {
|
|
3601
3626
|
switch (_a.label) {
|
|
@@ -3603,10 +3628,10 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3603
3628
|
this.loggerService.log("sessionPublicService emit", {
|
|
3604
3629
|
content: content,
|
|
3605
3630
|
clientId: clientId,
|
|
3606
|
-
|
|
3631
|
+
methodName: methodName,
|
|
3607
3632
|
swarmName: swarmName,
|
|
3608
3633
|
});
|
|
3609
|
-
return [4 /*yield*/,
|
|
3634
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3610
3635
|
return __generator(this, function (_a) {
|
|
3611
3636
|
switch (_a.label) {
|
|
3612
3637
|
case 0: return [4 /*yield*/, this.sessionConnectionService.emit(content)];
|
|
@@ -3614,7 +3639,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3614
3639
|
}
|
|
3615
3640
|
});
|
|
3616
3641
|
}); }, {
|
|
3617
|
-
|
|
3642
|
+
methodName: methodName,
|
|
3618
3643
|
clientId: clientId,
|
|
3619
3644
|
swarmName: swarmName,
|
|
3620
3645
|
agentName: "",
|
|
@@ -3632,7 +3657,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3632
3657
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3633
3658
|
* @returns {Promise<void>}
|
|
3634
3659
|
*/
|
|
3635
|
-
this.execute = function (content, mode,
|
|
3660
|
+
this.execute = function (content, mode, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3636
3661
|
var _this = this;
|
|
3637
3662
|
return __generator(this, function (_a) {
|
|
3638
3663
|
switch (_a.label) {
|
|
@@ -3643,7 +3668,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3643
3668
|
clientId: clientId,
|
|
3644
3669
|
swarmName: swarmName,
|
|
3645
3670
|
});
|
|
3646
|
-
return [4 /*yield*/,
|
|
3671
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3647
3672
|
return __generator(this, function (_a) {
|
|
3648
3673
|
switch (_a.label) {
|
|
3649
3674
|
case 0: return [4 /*yield*/, this.sessionConnectionService.execute(content, mode)];
|
|
@@ -3651,7 +3676,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3651
3676
|
}
|
|
3652
3677
|
});
|
|
3653
3678
|
}); }, {
|
|
3654
|
-
|
|
3679
|
+
methodName: methodName,
|
|
3655
3680
|
clientId: clientId,
|
|
3656
3681
|
swarmName: swarmName,
|
|
3657
3682
|
agentName: "",
|
|
@@ -3669,13 +3694,31 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3669
3694
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3670
3695
|
* @returns {ReceiveMessageFn}
|
|
3671
3696
|
*/
|
|
3672
|
-
this.connect = function (connector,
|
|
3697
|
+
this.connect = function (connector, methodName, clientId, swarmName) {
|
|
3673
3698
|
_this.loggerService.log("sessionPublicService connect", {
|
|
3674
|
-
|
|
3699
|
+
methodName: methodName,
|
|
3675
3700
|
clientId: clientId,
|
|
3676
3701
|
swarmName: swarmName,
|
|
3677
3702
|
});
|
|
3678
|
-
|
|
3703
|
+
var send = _this.sessionConnectionService.connect(connector, clientId, swarmName);
|
|
3704
|
+
return function (incoming) { return __awaiter(_this, void 0, void 0, function () {
|
|
3705
|
+
var executionId;
|
|
3706
|
+
var _this = this;
|
|
3707
|
+
return __generator(this, function (_a) {
|
|
3708
|
+
executionId = functoolsKit.randomString();
|
|
3709
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3710
|
+
return __generator(this, function (_a) {
|
|
3711
|
+
switch (_a.label) {
|
|
3712
|
+
case 0: return [4 /*yield*/, send(incoming)];
|
|
3713
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3716
|
+
}); }, {
|
|
3717
|
+
clientId: clientId,
|
|
3718
|
+
executionId: executionId,
|
|
3719
|
+
})];
|
|
3720
|
+
});
|
|
3721
|
+
}); };
|
|
3679
3722
|
};
|
|
3680
3723
|
/**
|
|
3681
3724
|
* Commits tool output to the session.
|
|
@@ -3685,19 +3728,19 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3685
3728
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3686
3729
|
* @returns {Promise<void>}
|
|
3687
3730
|
*/
|
|
3688
|
-
this.commitToolOutput = function (toolId, content,
|
|
3731
|
+
this.commitToolOutput = function (toolId, content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3689
3732
|
var _this = this;
|
|
3690
3733
|
return __generator(this, function (_a) {
|
|
3691
3734
|
switch (_a.label) {
|
|
3692
3735
|
case 0:
|
|
3693
3736
|
this.loggerService.log("sessionPublicService commitToolOutput", {
|
|
3694
|
-
|
|
3737
|
+
methodName: methodName,
|
|
3695
3738
|
toolId: toolId,
|
|
3696
3739
|
content: content,
|
|
3697
3740
|
clientId: clientId,
|
|
3698
3741
|
swarmName: swarmName,
|
|
3699
3742
|
});
|
|
3700
|
-
return [4 /*yield*/,
|
|
3743
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3701
3744
|
return __generator(this, function (_a) {
|
|
3702
3745
|
switch (_a.label) {
|
|
3703
3746
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitToolOutput(toolId, content)];
|
|
@@ -3705,7 +3748,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3705
3748
|
}
|
|
3706
3749
|
});
|
|
3707
3750
|
}); }, {
|
|
3708
|
-
|
|
3751
|
+
methodName: methodName,
|
|
3709
3752
|
clientId: clientId,
|
|
3710
3753
|
swarmName: swarmName,
|
|
3711
3754
|
agentName: "",
|
|
@@ -3723,18 +3766,18 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3723
3766
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3724
3767
|
* @returns {Promise<void>}
|
|
3725
3768
|
*/
|
|
3726
|
-
this.commitSystemMessage = function (message,
|
|
3769
|
+
this.commitSystemMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3727
3770
|
var _this = this;
|
|
3728
3771
|
return __generator(this, function (_a) {
|
|
3729
3772
|
switch (_a.label) {
|
|
3730
3773
|
case 0:
|
|
3731
3774
|
this.loggerService.log("sessionPublicService commitSystemMessage", {
|
|
3732
|
-
|
|
3775
|
+
methodName: methodName,
|
|
3733
3776
|
message: message,
|
|
3734
3777
|
clientId: clientId,
|
|
3735
3778
|
swarmName: swarmName,
|
|
3736
3779
|
});
|
|
3737
|
-
return [4 /*yield*/,
|
|
3780
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3738
3781
|
return __generator(this, function (_a) {
|
|
3739
3782
|
switch (_a.label) {
|
|
3740
3783
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitSystemMessage(message)];
|
|
@@ -3742,7 +3785,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3742
3785
|
}
|
|
3743
3786
|
});
|
|
3744
3787
|
}); }, {
|
|
3745
|
-
|
|
3788
|
+
methodName: methodName,
|
|
3746
3789
|
clientId: clientId,
|
|
3747
3790
|
swarmName: swarmName,
|
|
3748
3791
|
agentName: "",
|
|
@@ -3760,18 +3803,18 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3760
3803
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3761
3804
|
* @returns {Promise<void>}
|
|
3762
3805
|
*/
|
|
3763
|
-
this.commitUserMessage = function (message,
|
|
3806
|
+
this.commitUserMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3764
3807
|
var _this = this;
|
|
3765
3808
|
return __generator(this, function (_a) {
|
|
3766
3809
|
switch (_a.label) {
|
|
3767
3810
|
case 0:
|
|
3768
3811
|
this.loggerService.log("sessionPublicService commitUserMessage", {
|
|
3769
|
-
|
|
3812
|
+
methodName: methodName,
|
|
3770
3813
|
message: message,
|
|
3771
3814
|
clientId: clientId,
|
|
3772
3815
|
swarmName: swarmName,
|
|
3773
3816
|
});
|
|
3774
|
-
return [4 /*yield*/,
|
|
3817
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3775
3818
|
return __generator(this, function (_a) {
|
|
3776
3819
|
switch (_a.label) {
|
|
3777
3820
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitUserMessage(message)];
|
|
@@ -3779,7 +3822,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3779
3822
|
}
|
|
3780
3823
|
});
|
|
3781
3824
|
}); }, {
|
|
3782
|
-
|
|
3825
|
+
methodName: methodName,
|
|
3783
3826
|
clientId: clientId,
|
|
3784
3827
|
swarmName: swarmName,
|
|
3785
3828
|
agentName: "",
|
|
@@ -3796,7 +3839,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3796
3839
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3797
3840
|
* @returns {Promise<void>}
|
|
3798
3841
|
*/
|
|
3799
|
-
this.commitFlush = function (
|
|
3842
|
+
this.commitFlush = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3800
3843
|
var _this = this;
|
|
3801
3844
|
return __generator(this, function (_a) {
|
|
3802
3845
|
switch (_a.label) {
|
|
@@ -3805,7 +3848,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3805
3848
|
clientId: clientId,
|
|
3806
3849
|
swarmName: swarmName,
|
|
3807
3850
|
});
|
|
3808
|
-
return [4 /*yield*/,
|
|
3851
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3809
3852
|
return __generator(this, function (_a) {
|
|
3810
3853
|
switch (_a.label) {
|
|
3811
3854
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitFlush()];
|
|
@@ -3813,7 +3856,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3813
3856
|
}
|
|
3814
3857
|
});
|
|
3815
3858
|
}); }, {
|
|
3816
|
-
|
|
3859
|
+
methodName: methodName,
|
|
3817
3860
|
clientId: clientId,
|
|
3818
3861
|
swarmName: swarmName,
|
|
3819
3862
|
agentName: "",
|
|
@@ -3830,17 +3873,17 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3830
3873
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3831
3874
|
* @returns {Promise<void>}
|
|
3832
3875
|
*/
|
|
3833
|
-
this.dispose = function (
|
|
3876
|
+
this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3834
3877
|
var _this = this;
|
|
3835
3878
|
return __generator(this, function (_a) {
|
|
3836
3879
|
switch (_a.label) {
|
|
3837
3880
|
case 0:
|
|
3838
3881
|
this.loggerService.log("sessionPublicService dispose", {
|
|
3839
|
-
|
|
3882
|
+
methodName: methodName,
|
|
3840
3883
|
clientId: clientId,
|
|
3841
3884
|
swarmName: swarmName,
|
|
3842
3885
|
});
|
|
3843
|
-
return [4 /*yield*/,
|
|
3886
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3844
3887
|
return __generator(this, function (_a) {
|
|
3845
3888
|
switch (_a.label) {
|
|
3846
3889
|
case 0: return [4 /*yield*/, this.sessionConnectionService.dispose()];
|
|
@@ -3848,7 +3891,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3848
3891
|
}
|
|
3849
3892
|
});
|
|
3850
3893
|
}); }, {
|
|
3851
|
-
|
|
3894
|
+
methodName: methodName,
|
|
3852
3895
|
clientId: clientId,
|
|
3853
3896
|
swarmName: swarmName,
|
|
3854
3897
|
agentName: "",
|
|
@@ -3877,7 +3920,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3877
3920
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3878
3921
|
* @returns {Promise<void>}
|
|
3879
3922
|
*/
|
|
3880
|
-
this.cancelOutput = function (
|
|
3923
|
+
this.cancelOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3881
3924
|
var _this = this;
|
|
3882
3925
|
return __generator(this, function (_a) {
|
|
3883
3926
|
switch (_a.label) {
|
|
@@ -3886,7 +3929,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3886
3929
|
clientId: clientId,
|
|
3887
3930
|
swarmName: swarmName,
|
|
3888
3931
|
});
|
|
3889
|
-
return [4 /*yield*/,
|
|
3932
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3890
3933
|
return __generator(this, function (_a) {
|
|
3891
3934
|
switch (_a.label) {
|
|
3892
3935
|
case 0: return [4 /*yield*/, this.swarmConnectionService.cancelOutput()];
|
|
@@ -3894,7 +3937,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3894
3937
|
}
|
|
3895
3938
|
});
|
|
3896
3939
|
}); }, {
|
|
3897
|
-
|
|
3940
|
+
methodName: methodName,
|
|
3898
3941
|
clientId: clientId,
|
|
3899
3942
|
swarmName: swarmName,
|
|
3900
3943
|
agentName: "",
|
|
@@ -3911,17 +3954,17 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3911
3954
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3912
3955
|
* @returns {Promise<void>}
|
|
3913
3956
|
*/
|
|
3914
|
-
this.waitForOutput = function (
|
|
3957
|
+
this.waitForOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3915
3958
|
var _this = this;
|
|
3916
3959
|
return __generator(this, function (_a) {
|
|
3917
3960
|
switch (_a.label) {
|
|
3918
3961
|
case 0:
|
|
3919
3962
|
this.loggerService.log("swarmPublicService waitForOutput", {
|
|
3920
3963
|
clientId: clientId,
|
|
3921
|
-
|
|
3964
|
+
methodName: methodName,
|
|
3922
3965
|
swarmName: swarmName,
|
|
3923
3966
|
});
|
|
3924
|
-
return [4 /*yield*/,
|
|
3967
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3925
3968
|
return __generator(this, function (_a) {
|
|
3926
3969
|
switch (_a.label) {
|
|
3927
3970
|
case 0: return [4 /*yield*/, this.swarmConnectionService.waitForOutput()];
|
|
@@ -3929,7 +3972,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3929
3972
|
}
|
|
3930
3973
|
});
|
|
3931
3974
|
}); }, {
|
|
3932
|
-
|
|
3975
|
+
methodName: methodName,
|
|
3933
3976
|
clientId: clientId,
|
|
3934
3977
|
swarmName: swarmName,
|
|
3935
3978
|
agentName: "",
|
|
@@ -3946,7 +3989,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3946
3989
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3947
3990
|
* @returns {Promise<string>}
|
|
3948
3991
|
*/
|
|
3949
|
-
this.getAgentName = function (
|
|
3992
|
+
this.getAgentName = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3950
3993
|
var _this = this;
|
|
3951
3994
|
return __generator(this, function (_a) {
|
|
3952
3995
|
switch (_a.label) {
|
|
@@ -3954,9 +3997,9 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3954
3997
|
this.loggerService.log("swarmPublicService getAgentName", {
|
|
3955
3998
|
clientId: clientId,
|
|
3956
3999
|
swarmName: swarmName,
|
|
3957
|
-
|
|
4000
|
+
methodName: methodName,
|
|
3958
4001
|
});
|
|
3959
|
-
return [4 /*yield*/,
|
|
4002
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3960
4003
|
return __generator(this, function (_a) {
|
|
3961
4004
|
switch (_a.label) {
|
|
3962
4005
|
case 0: return [4 /*yield*/, this.swarmConnectionService.getAgentName()];
|
|
@@ -3964,7 +4007,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3964
4007
|
}
|
|
3965
4008
|
});
|
|
3966
4009
|
}); }, {
|
|
3967
|
-
|
|
4010
|
+
methodName: methodName,
|
|
3968
4011
|
clientId: clientId,
|
|
3969
4012
|
swarmName: swarmName,
|
|
3970
4013
|
agentName: "",
|
|
@@ -3981,7 +4024,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3981
4024
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3982
4025
|
* @returns {Promise<IAgent>}
|
|
3983
4026
|
*/
|
|
3984
|
-
this.getAgent = function (
|
|
4027
|
+
this.getAgent = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3985
4028
|
var _this = this;
|
|
3986
4029
|
return __generator(this, function (_a) {
|
|
3987
4030
|
switch (_a.label) {
|
|
@@ -3990,7 +4033,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3990
4033
|
clientId: clientId,
|
|
3991
4034
|
swarmName: swarmName,
|
|
3992
4035
|
});
|
|
3993
|
-
return [4 /*yield*/,
|
|
4036
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3994
4037
|
return __generator(this, function (_a) {
|
|
3995
4038
|
switch (_a.label) {
|
|
3996
4039
|
case 0: return [4 /*yield*/, this.swarmConnectionService.getAgent()];
|
|
@@ -3998,7 +4041,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3998
4041
|
}
|
|
3999
4042
|
});
|
|
4000
4043
|
}); }, {
|
|
4001
|
-
|
|
4044
|
+
methodName: methodName,
|
|
4002
4045
|
clientId: clientId,
|
|
4003
4046
|
swarmName: swarmName,
|
|
4004
4047
|
agentName: "",
|
|
@@ -4017,19 +4060,19 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4017
4060
|
* @param {IAgent} agent - The agent instance.
|
|
4018
4061
|
* @returns {Promise<void>}
|
|
4019
4062
|
*/
|
|
4020
|
-
this.setAgentRef = function (
|
|
4063
|
+
this.setAgentRef = function (methodName, clientId, swarmName, agentName, agent) { return __awaiter(_this, void 0, void 0, function () {
|
|
4021
4064
|
var _this = this;
|
|
4022
4065
|
return __generator(this, function (_a) {
|
|
4023
4066
|
switch (_a.label) {
|
|
4024
4067
|
case 0:
|
|
4025
4068
|
this.loggerService.log("swarmPublicService setAgentRef", {
|
|
4026
|
-
|
|
4069
|
+
methodName: methodName,
|
|
4027
4070
|
agentName: agentName,
|
|
4028
4071
|
agent: agent,
|
|
4029
4072
|
clientId: clientId,
|
|
4030
4073
|
swarmName: swarmName,
|
|
4031
4074
|
});
|
|
4032
|
-
return [4 /*yield*/,
|
|
4075
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4033
4076
|
return __generator(this, function (_a) {
|
|
4034
4077
|
switch (_a.label) {
|
|
4035
4078
|
case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentRef(agentName, agent)];
|
|
@@ -4037,7 +4080,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4037
4080
|
}
|
|
4038
4081
|
});
|
|
4039
4082
|
}); }, {
|
|
4040
|
-
|
|
4083
|
+
methodName: methodName,
|
|
4041
4084
|
clientId: clientId,
|
|
4042
4085
|
swarmName: swarmName,
|
|
4043
4086
|
agentName: "",
|
|
@@ -4055,18 +4098,18 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4055
4098
|
* @param {SwarmName} swarmName - The swarm name.
|
|
4056
4099
|
* @returns {Promise<void>}
|
|
4057
4100
|
*/
|
|
4058
|
-
this.setAgentName = function (agentName,
|
|
4101
|
+
this.setAgentName = function (agentName, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4059
4102
|
var _this = this;
|
|
4060
4103
|
return __generator(this, function (_a) {
|
|
4061
4104
|
switch (_a.label) {
|
|
4062
4105
|
case 0:
|
|
4063
4106
|
this.loggerService.log("swarmPublicService setAgentName", {
|
|
4064
|
-
|
|
4107
|
+
methodName: methodName,
|
|
4065
4108
|
agentName: agentName,
|
|
4066
4109
|
clientId: clientId,
|
|
4067
4110
|
swarmName: swarmName,
|
|
4068
4111
|
});
|
|
4069
|
-
return [4 /*yield*/,
|
|
4112
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4070
4113
|
return __generator(this, function (_a) {
|
|
4071
4114
|
switch (_a.label) {
|
|
4072
4115
|
case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentName(agentName)];
|
|
@@ -4074,7 +4117,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4074
4117
|
}
|
|
4075
4118
|
});
|
|
4076
4119
|
}); }, {
|
|
4077
|
-
|
|
4120
|
+
methodName: methodName,
|
|
4078
4121
|
clientId: clientId,
|
|
4079
4122
|
swarmName: swarmName,
|
|
4080
4123
|
agentName: "",
|
|
@@ -4091,17 +4134,17 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4091
4134
|
* @param {SwarmName} swarmName - The swarm name.
|
|
4092
4135
|
* @returns {Promise<void>}
|
|
4093
4136
|
*/
|
|
4094
|
-
this.dispose = function (
|
|
4137
|
+
this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4095
4138
|
var _this = this;
|
|
4096
4139
|
return __generator(this, function (_a) {
|
|
4097
4140
|
switch (_a.label) {
|
|
4098
4141
|
case 0:
|
|
4099
4142
|
this.loggerService.log("swarmPublicService dispose", {
|
|
4100
|
-
|
|
4143
|
+
methodName: methodName,
|
|
4101
4144
|
clientId: clientId,
|
|
4102
4145
|
swarmName: swarmName,
|
|
4103
4146
|
});
|
|
4104
|
-
return [4 /*yield*/,
|
|
4147
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4105
4148
|
return __generator(this, function (_a) {
|
|
4106
4149
|
switch (_a.label) {
|
|
4107
4150
|
case 0: return [4 /*yield*/, this.swarmConnectionService.dispose()];
|
|
@@ -4109,7 +4152,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4109
4152
|
}
|
|
4110
4153
|
});
|
|
4111
4154
|
}); }, {
|
|
4112
|
-
|
|
4155
|
+
methodName: methodName,
|
|
4113
4156
|
clientId: clientId,
|
|
4114
4157
|
swarmName: swarmName,
|
|
4115
4158
|
agentName: "",
|
|
@@ -5151,7 +5194,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5151
5194
|
var _this = this;
|
|
5152
5195
|
this.loggerService = inject(TYPES.loggerService);
|
|
5153
5196
|
this.busService = inject(TYPES.busService);
|
|
5154
|
-
this.
|
|
5197
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
5155
5198
|
this.storageSchemaService = inject(TYPES.storageSchemaService);
|
|
5156
5199
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5157
5200
|
this.embeddingSchemaService = inject(TYPES.embeddingSchemaService);
|
|
@@ -5206,7 +5249,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5206
5249
|
total: total,
|
|
5207
5250
|
score: score,
|
|
5208
5251
|
});
|
|
5209
|
-
storage = this.getStorage(this.
|
|
5252
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5210
5253
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5211
5254
|
case 1:
|
|
5212
5255
|
_a.sent();
|
|
@@ -5228,7 +5271,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5228
5271
|
this.loggerService.log("storageConnectionService upsert", {
|
|
5229
5272
|
item: item,
|
|
5230
5273
|
});
|
|
5231
|
-
storage = this.getStorage(this.
|
|
5274
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5232
5275
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5233
5276
|
case 1:
|
|
5234
5277
|
_a.sent();
|
|
@@ -5250,7 +5293,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5250
5293
|
this.loggerService.log("storageConnectionService remove", {
|
|
5251
5294
|
itemId: itemId,
|
|
5252
5295
|
});
|
|
5253
|
-
storage = this.getStorage(this.
|
|
5296
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5254
5297
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5255
5298
|
case 1:
|
|
5256
5299
|
_a.sent();
|
|
@@ -5272,7 +5315,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5272
5315
|
this.loggerService.log("storageConnectionService get", {
|
|
5273
5316
|
itemId: itemId,
|
|
5274
5317
|
});
|
|
5275
|
-
storage = this.getStorage(this.
|
|
5318
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5276
5319
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5277
5320
|
case 1:
|
|
5278
5321
|
_a.sent();
|
|
@@ -5292,7 +5335,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5292
5335
|
switch (_a.label) {
|
|
5293
5336
|
case 0:
|
|
5294
5337
|
this.loggerService.log("storageConnectionService list");
|
|
5295
|
-
storage = this.getStorage(this.
|
|
5338
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5296
5339
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5297
5340
|
case 1:
|
|
5298
5341
|
_a.sent();
|
|
@@ -5311,7 +5354,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5311
5354
|
switch (_a.label) {
|
|
5312
5355
|
case 0:
|
|
5313
5356
|
this.loggerService.log("storageConnectionService clear");
|
|
5314
|
-
storage = this.getStorage(this.
|
|
5357
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5315
5358
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5316
5359
|
case 1:
|
|
5317
5360
|
_a.sent();
|
|
@@ -5330,12 +5373,12 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5330
5373
|
switch (_a.label) {
|
|
5331
5374
|
case 0:
|
|
5332
5375
|
this.loggerService.log("storageConnectionService dispose");
|
|
5333
|
-
key = "".concat(this.
|
|
5376
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.storageName);
|
|
5334
5377
|
if (!this.getStorage.has(key)) {
|
|
5335
5378
|
return [2 /*return*/];
|
|
5336
5379
|
}
|
|
5337
|
-
if (!!this.getSharedStorage.has(this.
|
|
5338
|
-
storage = this.getSharedStorage(this.
|
|
5380
|
+
if (!!this.getSharedStorage.has(this.methodContextService.context.storageName)) return [3 /*break*/, 3];
|
|
5381
|
+
storage = this.getSharedStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5339
5382
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5340
5383
|
case 1:
|
|
5341
5384
|
_a.sent();
|
|
@@ -5345,7 +5388,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5345
5388
|
_a.label = 3;
|
|
5346
5389
|
case 3:
|
|
5347
5390
|
this.getStorage.clear(key);
|
|
5348
|
-
this.sessionValidationService.removeStorageUsage(this.
|
|
5391
|
+
this.sessionValidationService.removeStorageUsage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5349
5392
|
return [2 /*return*/];
|
|
5350
5393
|
}
|
|
5351
5394
|
});
|
|
@@ -5368,20 +5411,20 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5368
5411
|
* @param {number} total - The total number of items to retrieve.
|
|
5369
5412
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
5370
5413
|
*/
|
|
5371
|
-
this.take = function (search, total,
|
|
5414
|
+
this.take = function (search, total, methodName, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
5372
5415
|
var _this = this;
|
|
5373
5416
|
return __generator(this, function (_a) {
|
|
5374
5417
|
switch (_a.label) {
|
|
5375
5418
|
case 0:
|
|
5376
5419
|
this.loggerService.log("storagePublicService take", {
|
|
5377
|
-
|
|
5420
|
+
methodName: methodName,
|
|
5378
5421
|
search: search,
|
|
5379
5422
|
total: total,
|
|
5380
5423
|
clientId: clientId,
|
|
5381
5424
|
storageName: storageName,
|
|
5382
5425
|
score: score,
|
|
5383
5426
|
});
|
|
5384
|
-
return [4 /*yield*/,
|
|
5427
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5385
5428
|
return __generator(this, function (_a) {
|
|
5386
5429
|
switch (_a.label) {
|
|
5387
5430
|
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
|
|
@@ -5389,7 +5432,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5389
5432
|
}
|
|
5390
5433
|
});
|
|
5391
5434
|
}); }, {
|
|
5392
|
-
|
|
5435
|
+
methodName: methodName,
|
|
5393
5436
|
clientId: clientId,
|
|
5394
5437
|
storageName: storageName,
|
|
5395
5438
|
agentName: "",
|
|
@@ -5405,7 +5448,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5405
5448
|
* @param {IStorageData} item - The item to upsert.
|
|
5406
5449
|
* @returns {Promise<void>}
|
|
5407
5450
|
*/
|
|
5408
|
-
this.upsert = function (item,
|
|
5451
|
+
this.upsert = function (item, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5409
5452
|
var _this = this;
|
|
5410
5453
|
return __generator(this, function (_a) {
|
|
5411
5454
|
switch (_a.label) {
|
|
@@ -5415,7 +5458,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5415
5458
|
clientId: clientId,
|
|
5416
5459
|
storageName: storageName,
|
|
5417
5460
|
});
|
|
5418
|
-
return [4 /*yield*/,
|
|
5461
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5419
5462
|
return __generator(this, function (_a) {
|
|
5420
5463
|
switch (_a.label) {
|
|
5421
5464
|
case 0: return [4 /*yield*/, this.storageConnectionService.upsert(item)];
|
|
@@ -5423,7 +5466,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5423
5466
|
}
|
|
5424
5467
|
});
|
|
5425
5468
|
}); }, {
|
|
5426
|
-
|
|
5469
|
+
methodName: methodName,
|
|
5427
5470
|
clientId: clientId,
|
|
5428
5471
|
storageName: storageName,
|
|
5429
5472
|
agentName: "",
|
|
@@ -5439,7 +5482,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5439
5482
|
* @param {IStorageData["id"]} itemId - The ID of the item to remove.
|
|
5440
5483
|
* @returns {Promise<void>}
|
|
5441
5484
|
*/
|
|
5442
|
-
this.remove = function (itemId,
|
|
5485
|
+
this.remove = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5443
5486
|
var _this = this;
|
|
5444
5487
|
return __generator(this, function (_a) {
|
|
5445
5488
|
switch (_a.label) {
|
|
@@ -5449,7 +5492,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5449
5492
|
clientId: clientId,
|
|
5450
5493
|
storageName: storageName,
|
|
5451
5494
|
});
|
|
5452
|
-
return [4 /*yield*/,
|
|
5495
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5453
5496
|
return __generator(this, function (_a) {
|
|
5454
5497
|
switch (_a.label) {
|
|
5455
5498
|
case 0: return [4 /*yield*/, this.storageConnectionService.remove(itemId)];
|
|
@@ -5457,7 +5500,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5457
5500
|
}
|
|
5458
5501
|
});
|
|
5459
5502
|
}); }, {
|
|
5460
|
-
|
|
5503
|
+
methodName: methodName,
|
|
5461
5504
|
clientId: clientId,
|
|
5462
5505
|
storageName: storageName,
|
|
5463
5506
|
agentName: "",
|
|
@@ -5473,18 +5516,18 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5473
5516
|
* @param {IStorageData["id"]} itemId - The ID of the item to retrieve.
|
|
5474
5517
|
* @returns {Promise<IStorageData>} The retrieved item.
|
|
5475
5518
|
*/
|
|
5476
|
-
this.get = function (itemId,
|
|
5519
|
+
this.get = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5477
5520
|
var _this = this;
|
|
5478
5521
|
return __generator(this, function (_a) {
|
|
5479
5522
|
switch (_a.label) {
|
|
5480
5523
|
case 0:
|
|
5481
5524
|
this.loggerService.log("storagePublicService get", {
|
|
5482
|
-
|
|
5525
|
+
methodName: methodName,
|
|
5483
5526
|
itemId: itemId,
|
|
5484
5527
|
clientId: clientId,
|
|
5485
5528
|
storageName: storageName,
|
|
5486
5529
|
});
|
|
5487
|
-
return [4 /*yield*/,
|
|
5530
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5488
5531
|
return __generator(this, function (_a) {
|
|
5489
5532
|
switch (_a.label) {
|
|
5490
5533
|
case 0: return [4 /*yield*/, this.storageConnectionService.get(itemId)];
|
|
@@ -5492,7 +5535,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5492
5535
|
}
|
|
5493
5536
|
});
|
|
5494
5537
|
}); }, {
|
|
5495
|
-
|
|
5538
|
+
methodName: methodName,
|
|
5496
5539
|
clientId: clientId,
|
|
5497
5540
|
storageName: storageName,
|
|
5498
5541
|
agentName: "",
|
|
@@ -5508,17 +5551,17 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5508
5551
|
* @param {function(IStorageData): boolean} [filter] - The optional filter function.
|
|
5509
5552
|
* @returns {Promise<IStorageData[]>} The list of items.
|
|
5510
5553
|
*/
|
|
5511
|
-
this.list = function (
|
|
5554
|
+
this.list = function (methodName, clientId, storageName, filter) { return __awaiter(_this, void 0, void 0, function () {
|
|
5512
5555
|
var _this = this;
|
|
5513
5556
|
return __generator(this, function (_a) {
|
|
5514
5557
|
switch (_a.label) {
|
|
5515
5558
|
case 0:
|
|
5516
5559
|
this.loggerService.log("storagePublicService list", {
|
|
5517
|
-
|
|
5560
|
+
methodName: methodName,
|
|
5518
5561
|
clientId: clientId,
|
|
5519
5562
|
storageName: storageName,
|
|
5520
5563
|
});
|
|
5521
|
-
return [4 /*yield*/,
|
|
5564
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5522
5565
|
return __generator(this, function (_a) {
|
|
5523
5566
|
switch (_a.label) {
|
|
5524
5567
|
case 0: return [4 /*yield*/, this.storageConnectionService.list(filter)];
|
|
@@ -5526,7 +5569,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5526
5569
|
}
|
|
5527
5570
|
});
|
|
5528
5571
|
}); }, {
|
|
5529
|
-
|
|
5572
|
+
methodName: methodName,
|
|
5530
5573
|
clientId: clientId,
|
|
5531
5574
|
storageName: storageName,
|
|
5532
5575
|
agentName: "",
|
|
@@ -5541,17 +5584,17 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5541
5584
|
* Clears all items from the storage.
|
|
5542
5585
|
* @returns {Promise<void>}
|
|
5543
5586
|
*/
|
|
5544
|
-
this.clear = function (
|
|
5587
|
+
this.clear = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5545
5588
|
var _this = this;
|
|
5546
5589
|
return __generator(this, function (_a) {
|
|
5547
5590
|
switch (_a.label) {
|
|
5548
5591
|
case 0:
|
|
5549
5592
|
this.loggerService.log("storagePublicService clear", {
|
|
5550
|
-
|
|
5593
|
+
methodName: methodName,
|
|
5551
5594
|
clientId: clientId,
|
|
5552
5595
|
storageName: storageName,
|
|
5553
5596
|
});
|
|
5554
|
-
return [4 /*yield*/,
|
|
5597
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5555
5598
|
return __generator(this, function (_a) {
|
|
5556
5599
|
switch (_a.label) {
|
|
5557
5600
|
case 0: return [4 /*yield*/, this.storageConnectionService.clear()];
|
|
@@ -5559,7 +5602,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5559
5602
|
}
|
|
5560
5603
|
});
|
|
5561
5604
|
}); }, {
|
|
5562
|
-
|
|
5605
|
+
methodName: methodName,
|
|
5563
5606
|
clientId: clientId,
|
|
5564
5607
|
storageName: storageName,
|
|
5565
5608
|
agentName: "",
|
|
@@ -5576,7 +5619,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5576
5619
|
* @param {StorageName} storageName - The storage name.
|
|
5577
5620
|
* @returns {Promise<void>}
|
|
5578
5621
|
*/
|
|
5579
|
-
this.dispose = function (
|
|
5622
|
+
this.dispose = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5580
5623
|
var _this = this;
|
|
5581
5624
|
return __generator(this, function (_a) {
|
|
5582
5625
|
switch (_a.label) {
|
|
@@ -5585,7 +5628,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5585
5628
|
clientId: clientId,
|
|
5586
5629
|
storageName: storageName,
|
|
5587
5630
|
});
|
|
5588
|
-
return [4 /*yield*/,
|
|
5631
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5589
5632
|
return __generator(this, function (_a) {
|
|
5590
5633
|
switch (_a.label) {
|
|
5591
5634
|
case 0: return [4 /*yield*/, this.storageConnectionService.dispose()];
|
|
@@ -5593,7 +5636,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5593
5636
|
}
|
|
5594
5637
|
});
|
|
5595
5638
|
}); }, {
|
|
5596
|
-
|
|
5639
|
+
methodName: methodName,
|
|
5597
5640
|
clientId: clientId,
|
|
5598
5641
|
storageName: storageName,
|
|
5599
5642
|
agentName: "",
|
|
@@ -5931,7 +5974,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5931
5974
|
var _this = this;
|
|
5932
5975
|
this.loggerService = inject(TYPES.loggerService);
|
|
5933
5976
|
this.busService = inject(TYPES.busService);
|
|
5934
|
-
this.
|
|
5977
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
5935
5978
|
this.stateSchemaService = inject(TYPES.stateSchemaService);
|
|
5936
5979
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5937
5980
|
/**
|
|
@@ -6023,7 +6066,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6023
6066
|
switch (_a.label) {
|
|
6024
6067
|
case 0:
|
|
6025
6068
|
this.loggerService.log("stateConnectionService setState");
|
|
6026
|
-
state = this.getStateRef(this.
|
|
6069
|
+
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6027
6070
|
return [4 /*yield*/, state.waitForInit()];
|
|
6028
6071
|
case 1:
|
|
6029
6072
|
_a.sent();
|
|
@@ -6042,7 +6085,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6042
6085
|
switch (_a.label) {
|
|
6043
6086
|
case 0:
|
|
6044
6087
|
this.loggerService.log("stateConnectionService getState");
|
|
6045
|
-
state = this.getStateRef(this.
|
|
6088
|
+
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6046
6089
|
return [4 /*yield*/, state.waitForInit()];
|
|
6047
6090
|
case 1:
|
|
6048
6091
|
_a.sent();
|
|
@@ -6061,12 +6104,12 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6061
6104
|
switch (_a.label) {
|
|
6062
6105
|
case 0:
|
|
6063
6106
|
this.loggerService.log("stateConnectionService dispose");
|
|
6064
|
-
key = "".concat(this.
|
|
6107
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.stateName);
|
|
6065
6108
|
if (!this.getStateRef.has(key)) {
|
|
6066
6109
|
return [2 /*return*/];
|
|
6067
6110
|
}
|
|
6068
|
-
if (!!this.getSharedStateRef.has(this.
|
|
6069
|
-
state = this.getStateRef(this.
|
|
6111
|
+
if (!!this.getSharedStateRef.has(this.methodContextService.context.stateName)) return [3 /*break*/, 3];
|
|
6112
|
+
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6070
6113
|
return [4 /*yield*/, state.waitForInit()];
|
|
6071
6114
|
case 1:
|
|
6072
6115
|
_a.sent();
|
|
@@ -6076,7 +6119,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6076
6119
|
_a.label = 3;
|
|
6077
6120
|
case 3:
|
|
6078
6121
|
this.getStateRef.clear(key);
|
|
6079
|
-
this.sessionValidationService.removeStateUsage(this.
|
|
6122
|
+
this.sessionValidationService.removeStateUsage(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6080
6123
|
return [2 /*return*/];
|
|
6081
6124
|
}
|
|
6082
6125
|
});
|
|
@@ -6097,17 +6140,17 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6097
6140
|
* @param {StateName} stateName - The name of the state.
|
|
6098
6141
|
* @returns {Promise<T>} - The updated state.
|
|
6099
6142
|
*/
|
|
6100
|
-
this.setState = function (dispatchFn,
|
|
6143
|
+
this.setState = function (dispatchFn, methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6101
6144
|
var _this = this;
|
|
6102
6145
|
return __generator(this, function (_a) {
|
|
6103
6146
|
switch (_a.label) {
|
|
6104
6147
|
case 0:
|
|
6105
6148
|
this.loggerService.log("statePublicService setState", {
|
|
6106
|
-
|
|
6149
|
+
methodName: methodName,
|
|
6107
6150
|
clientId: clientId,
|
|
6108
6151
|
stateName: stateName,
|
|
6109
6152
|
});
|
|
6110
|
-
return [4 /*yield*/,
|
|
6153
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6111
6154
|
return __generator(this, function (_a) {
|
|
6112
6155
|
switch (_a.label) {
|
|
6113
6156
|
case 0: return [4 /*yield*/, this.stateConnectionService.setState(dispatchFn)];
|
|
@@ -6115,7 +6158,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6115
6158
|
}
|
|
6116
6159
|
});
|
|
6117
6160
|
}); }, {
|
|
6118
|
-
|
|
6161
|
+
methodName: methodName,
|
|
6119
6162
|
clientId: clientId,
|
|
6120
6163
|
stateName: stateName,
|
|
6121
6164
|
agentName: "",
|
|
@@ -6132,7 +6175,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6132
6175
|
* @param {StateName} stateName - The name of the state.
|
|
6133
6176
|
* @returns {Promise<T>} - The current state.
|
|
6134
6177
|
*/
|
|
6135
|
-
this.getState = function (
|
|
6178
|
+
this.getState = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6136
6179
|
var _this = this;
|
|
6137
6180
|
return __generator(this, function (_a) {
|
|
6138
6181
|
switch (_a.label) {
|
|
@@ -6141,7 +6184,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6141
6184
|
clientId: clientId,
|
|
6142
6185
|
stateName: stateName,
|
|
6143
6186
|
});
|
|
6144
|
-
return [4 /*yield*/,
|
|
6187
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6145
6188
|
return __generator(this, function (_a) {
|
|
6146
6189
|
switch (_a.label) {
|
|
6147
6190
|
case 0: return [4 /*yield*/, this.stateConnectionService.getState()];
|
|
@@ -6149,7 +6192,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6149
6192
|
}
|
|
6150
6193
|
});
|
|
6151
6194
|
}); }, {
|
|
6152
|
-
|
|
6195
|
+
methodName: methodName,
|
|
6153
6196
|
clientId: clientId,
|
|
6154
6197
|
stateName: stateName,
|
|
6155
6198
|
agentName: "",
|
|
@@ -6166,17 +6209,17 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6166
6209
|
* @param {StateName} stateName - The name of the state.
|
|
6167
6210
|
* @returns {Promise<void>} - A promise that resolves when the state is disposed.
|
|
6168
6211
|
*/
|
|
6169
|
-
this.dispose = function (
|
|
6212
|
+
this.dispose = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6170
6213
|
var _this = this;
|
|
6171
6214
|
return __generator(this, function (_a) {
|
|
6172
6215
|
switch (_a.label) {
|
|
6173
6216
|
case 0:
|
|
6174
6217
|
this.loggerService.log("statePublicService dispose", {
|
|
6175
|
-
|
|
6218
|
+
methodName: methodName,
|
|
6176
6219
|
clientId: clientId,
|
|
6177
6220
|
stateName: stateName,
|
|
6178
6221
|
});
|
|
6179
|
-
return [4 /*yield*/,
|
|
6222
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6180
6223
|
return __generator(this, function (_a) {
|
|
6181
6224
|
switch (_a.label) {
|
|
6182
6225
|
case 0: return [4 /*yield*/, this.stateConnectionService.dispose()];
|
|
@@ -6184,7 +6227,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6184
6227
|
}
|
|
6185
6228
|
});
|
|
6186
6229
|
}); }, {
|
|
6187
|
-
|
|
6230
|
+
methodName: methodName,
|
|
6188
6231
|
clientId: clientId,
|
|
6189
6232
|
stateName: stateName,
|
|
6190
6233
|
agentName: "",
|
|
@@ -6312,7 +6355,10 @@ var BusService = /** @class */ (function () {
|
|
|
6312
6355
|
{
|
|
6313
6356
|
provide(TYPES.busService, function () { return new BusService(); });
|
|
6314
6357
|
provide(TYPES.loggerService, function () { return new LoggerService(); });
|
|
6315
|
-
|
|
6358
|
+
}
|
|
6359
|
+
{
|
|
6360
|
+
provide(TYPES.methodContextService, function () { return new MethodContextService(); });
|
|
6361
|
+
provide(TYPES.executionContextService, function () { return new ExecutionContextService(); });
|
|
6316
6362
|
}
|
|
6317
6363
|
{
|
|
6318
6364
|
provide(TYPES.agentConnectionService, function () { return new AgentConnectionService(); });
|
|
@@ -6358,7 +6404,10 @@ var BusService = /** @class */ (function () {
|
|
|
6358
6404
|
var baseServices = {
|
|
6359
6405
|
busService: inject(TYPES.busService),
|
|
6360
6406
|
loggerService: inject(TYPES.loggerService),
|
|
6361
|
-
|
|
6407
|
+
};
|
|
6408
|
+
var contextServices = {
|
|
6409
|
+
methodContextService: inject(TYPES.methodContextService),
|
|
6410
|
+
executionContextService: inject(TYPES.executionContextService),
|
|
6362
6411
|
};
|
|
6363
6412
|
var connectionServices = {
|
|
6364
6413
|
agentConnectionService: inject(TYPES.agentConnectionService),
|
|
@@ -6394,7 +6443,7 @@ var validationServices = {
|
|
|
6394
6443
|
storageValidationService: inject(TYPES.storageValidationService),
|
|
6395
6444
|
embeddingValidationService: inject(TYPES.embeddingValidationService),
|
|
6396
6445
|
};
|
|
6397
|
-
var swarm = __assign(__assign(__assign(__assign(__assign({}, baseServices), connectionServices), schemaServices), publicServices), validationServices);
|
|
6446
|
+
var swarm = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices), contextServices), connectionServices), schemaServices), publicServices), validationServices);
|
|
6398
6447
|
init();
|
|
6399
6448
|
|
|
6400
6449
|
/**
|
|
@@ -6522,22 +6571,21 @@ var addStorage = function (storageSchema) {
|
|
|
6522
6571
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
6523
6572
|
*/
|
|
6524
6573
|
var commitUserMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6525
|
-
var
|
|
6574
|
+
var methodName, swarmName, currentAgentName;
|
|
6526
6575
|
return __generator(this, function (_a) {
|
|
6527
6576
|
switch (_a.label) {
|
|
6528
6577
|
case 0:
|
|
6529
|
-
|
|
6578
|
+
methodName = 'function commitSystemMessage';
|
|
6530
6579
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
6531
6580
|
content: content,
|
|
6532
6581
|
clientId: clientId,
|
|
6533
6582
|
agentName: agentName,
|
|
6534
|
-
requestId: requestId,
|
|
6535
6583
|
});
|
|
6536
6584
|
swarm.agentValidationService.validate(agentName, "commitUserMessage");
|
|
6537
6585
|
swarm.sessionValidationService.validate(clientId, "commitUserMessage");
|
|
6538
6586
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6539
6587
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessage");
|
|
6540
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6588
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6541
6589
|
case 1:
|
|
6542
6590
|
currentAgentName = _a.sent();
|
|
6543
6591
|
if (currentAgentName !== agentName) {
|
|
@@ -6548,7 +6596,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6548
6596
|
});
|
|
6549
6597
|
return [2 /*return*/];
|
|
6550
6598
|
}
|
|
6551
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content,
|
|
6599
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
6552
6600
|
case 2:
|
|
6553
6601
|
_a.sent();
|
|
6554
6602
|
return [2 /*return*/];
|
|
@@ -6564,19 +6612,18 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6564
6612
|
* @throws Will throw an error if the client ID is invalid or if the swarm validation fails.
|
|
6565
6613
|
*/
|
|
6566
6614
|
var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6567
|
-
var
|
|
6615
|
+
var methodName, swarmName;
|
|
6568
6616
|
return __generator(this, function (_a) {
|
|
6569
6617
|
switch (_a.label) {
|
|
6570
6618
|
case 0:
|
|
6571
|
-
|
|
6619
|
+
methodName = "function getAgentName";
|
|
6572
6620
|
swarm.loggerService.log("function getAgentName", {
|
|
6573
6621
|
clientId: clientId,
|
|
6574
|
-
requestId: requestId,
|
|
6575
6622
|
});
|
|
6576
6623
|
swarm.sessionValidationService.validate(clientId, "getAgentName");
|
|
6577
6624
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6578
6625
|
swarm.swarmValidationService.validate(swarmName, "getAgentName");
|
|
6579
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6626
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6580
6627
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6581
6628
|
}
|
|
6582
6629
|
});
|
|
@@ -6592,15 +6639,14 @@ var SCHEDULED_DELAY$1 = 1000;
|
|
|
6592
6639
|
* @returns {SendMessageFn} - A function to send messages to the swarm.
|
|
6593
6640
|
*/
|
|
6594
6641
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
6595
|
-
var
|
|
6642
|
+
var methodName = "function makeConnection";
|
|
6596
6643
|
swarm.loggerService.log("function makeConnection", {
|
|
6597
6644
|
clientId: clientId,
|
|
6598
6645
|
swarmName: swarmName,
|
|
6599
|
-
requestId: requestId,
|
|
6600
6646
|
});
|
|
6601
6647
|
swarm.swarmValidationService.validate(swarmName, "makeConnection");
|
|
6602
6648
|
swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
6603
|
-
var send = swarm.sessionPublicService.connect(connector,
|
|
6649
|
+
var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
|
|
6604
6650
|
return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6605
6651
|
var _a;
|
|
6606
6652
|
var _b;
|
|
@@ -6612,7 +6658,7 @@ var makeConnection = function (connector, clientId, swarmName) {
|
|
|
6612
6658
|
_b = {
|
|
6613
6659
|
data: outgoing
|
|
6614
6660
|
};
|
|
6615
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6661
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6616
6662
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
|
|
6617
6663
|
_b.clientId = clientId,
|
|
6618
6664
|
_b)])];
|
|
@@ -6715,7 +6761,7 @@ var CHANGE_AGENT_GC = 60 * 1000;
|
|
|
6715
6761
|
* @returns {TChangeAgentRun} - The change agent function.
|
|
6716
6762
|
*/
|
|
6717
6763
|
var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
6718
|
-
return functoolsKit.queued(function (
|
|
6764
|
+
return functoolsKit.queued(function (methodName, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6719
6765
|
var swarmName, _a, _b, _c;
|
|
6720
6766
|
return __generator(this, function (_d) {
|
|
6721
6767
|
switch (_d.label) {
|
|
@@ -6728,7 +6774,7 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
6728
6774
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6729
6775
|
return __generator(this, function (_a) {
|
|
6730
6776
|
switch (_a.label) {
|
|
6731
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(
|
|
6777
|
+
case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
|
|
6732
6778
|
case 1:
|
|
6733
6779
|
_a.sent();
|
|
6734
6780
|
return [2 /*return*/];
|
|
@@ -6737,22 +6783,22 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
6737
6783
|
}); }))];
|
|
6738
6784
|
case 1:
|
|
6739
6785
|
_d.sent();
|
|
6740
|
-
return [4 /*yield*/, swarm.agentPublicService.dispose(
|
|
6786
|
+
return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
6741
6787
|
case 2:
|
|
6742
6788
|
_d.sent();
|
|
6743
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(
|
|
6789
|
+
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
6744
6790
|
case 3:
|
|
6745
6791
|
_d.sent();
|
|
6746
6792
|
_b = (_a = swarm.swarmPublicService).setAgentRef;
|
|
6747
|
-
_c = [
|
|
6793
|
+
_c = [methodName,
|
|
6748
6794
|
clientId,
|
|
6749
6795
|
swarmName,
|
|
6750
6796
|
agentName];
|
|
6751
|
-
return [4 /*yield*/, swarm.agentPublicService.createAgentRef(
|
|
6797
|
+
return [4 /*yield*/, swarm.agentPublicService.createAgentRef(methodName, clientId, agentName)];
|
|
6752
6798
|
case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
|
|
6753
6799
|
case 5:
|
|
6754
6800
|
_d.sent();
|
|
6755
|
-
return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName,
|
|
6801
|
+
return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
|
|
6756
6802
|
case 6:
|
|
6757
6803
|
_d.sent();
|
|
6758
6804
|
return [2 /*return*/];
|
|
@@ -6786,11 +6832,11 @@ var createGc$1 = functoolsKit.singleshot(function () { return __awaiter(void 0,
|
|
|
6786
6832
|
* @returns {Promise<void>} - A promise that resolves when the agent is changed.
|
|
6787
6833
|
*/
|
|
6788
6834
|
var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6789
|
-
var
|
|
6835
|
+
var methodName, run;
|
|
6790
6836
|
return __generator(this, function (_a) {
|
|
6791
6837
|
switch (_a.label) {
|
|
6792
6838
|
case 0:
|
|
6793
|
-
|
|
6839
|
+
methodName = "function changeAgent";
|
|
6794
6840
|
swarm.loggerService.log("function changeAgent", {
|
|
6795
6841
|
agentName: agentName,
|
|
6796
6842
|
clientId: clientId,
|
|
@@ -6799,7 +6845,7 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
|
|
|
6799
6845
|
case 1:
|
|
6800
6846
|
run = _a.sent();
|
|
6801
6847
|
createGc$1();
|
|
6802
|
-
return [4 /*yield*/, run(
|
|
6848
|
+
return [4 /*yield*/, run(methodName, agentName)];
|
|
6803
6849
|
case 2: return [2 /*return*/, _a.sent()];
|
|
6804
6850
|
}
|
|
6805
6851
|
});
|
|
@@ -6817,23 +6863,22 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6817
6863
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
6818
6864
|
args_1[_i - 2] = arguments[_i];
|
|
6819
6865
|
}
|
|
6820
|
-
return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName,
|
|
6821
|
-
if (
|
|
6866
|
+
return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName, methodName) {
|
|
6867
|
+
if (methodName === void 0) { methodName = "function disposeConnection"; }
|
|
6822
6868
|
return __generator(this, function (_a) {
|
|
6823
6869
|
switch (_a.label) {
|
|
6824
6870
|
case 0:
|
|
6825
6871
|
swarm.loggerService.log("function disposeConnection", {
|
|
6826
6872
|
clientId: clientId,
|
|
6827
6873
|
swarmName: swarmName,
|
|
6828
|
-
requestId: requestId,
|
|
6829
6874
|
});
|
|
6830
6875
|
swarm.swarmValidationService.validate(swarmName, "disposeConnection");
|
|
6831
6876
|
swarm.sessionValidationService.removeSession(clientId);
|
|
6832
6877
|
swarm.busService.dispose(clientId);
|
|
6833
|
-
return [4 /*yield*/, swarm.sessionPublicService.dispose(
|
|
6878
|
+
return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
|
|
6834
6879
|
case 1:
|
|
6835
6880
|
_a.sent();
|
|
6836
|
-
return [4 /*yield*/, swarm.swarmPublicService.dispose(
|
|
6881
|
+
return [4 /*yield*/, swarm.swarmPublicService.dispose(methodName, clientId, swarmName)];
|
|
6837
6882
|
case 2:
|
|
6838
6883
|
_a.sent();
|
|
6839
6884
|
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
@@ -6841,10 +6886,10 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6841
6886
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6842
6887
|
return __generator(this, function (_a) {
|
|
6843
6888
|
switch (_a.label) {
|
|
6844
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(
|
|
6889
|
+
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
6845
6890
|
case 1:
|
|
6846
6891
|
_a.sent();
|
|
6847
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(
|
|
6892
|
+
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
6848
6893
|
case 2:
|
|
6849
6894
|
_a.sent();
|
|
6850
6895
|
return [2 /*return*/];
|
|
@@ -6862,7 +6907,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6862
6907
|
.map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6863
6908
|
return __generator(this, function (_a) {
|
|
6864
6909
|
switch (_a.label) {
|
|
6865
|
-
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(
|
|
6910
|
+
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(methodName, clientId, storageName)];
|
|
6866
6911
|
case 1:
|
|
6867
6912
|
_a.sent();
|
|
6868
6913
|
return [2 /*return*/];
|
|
@@ -6880,7 +6925,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6880
6925
|
.map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6881
6926
|
return __generator(this, function (_a) {
|
|
6882
6927
|
switch (_a.label) {
|
|
6883
|
-
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(
|
|
6928
|
+
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(methodName, clientId, stateName)];
|
|
6884
6929
|
case 1:
|
|
6885
6930
|
_a.sent();
|
|
6886
6931
|
return [2 /*return*/];
|
|
@@ -6907,17 +6952,17 @@ var COMPLETE_GC = 60 * 1000;
|
|
|
6907
6952
|
* @returns {TCompleteRun} The complete run function.
|
|
6908
6953
|
*/
|
|
6909
6954
|
var createComplete = functoolsKit.ttl(function (clientId, swarmName) {
|
|
6910
|
-
return functoolsKit.queued(function (
|
|
6955
|
+
return functoolsKit.queued(function (methodName, content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6911
6956
|
var result;
|
|
6912
6957
|
return __generator(this, function (_a) {
|
|
6913
6958
|
switch (_a.label) {
|
|
6914
6959
|
case 0:
|
|
6915
6960
|
swarm.swarmValidationService.validate(swarmName, "complete");
|
|
6916
6961
|
swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
|
|
6917
|
-
return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user",
|
|
6962
|
+
return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
|
|
6918
6963
|
case 1:
|
|
6919
6964
|
result = _a.sent();
|
|
6920
|
-
return [4 /*yield*/, disposeConnection(clientId, swarmName,
|
|
6965
|
+
return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
|
|
6921
6966
|
case 2:
|
|
6922
6967
|
_a.sent();
|
|
6923
6968
|
return [2 /*return*/, result];
|
|
@@ -6951,23 +6996,33 @@ var createGc = functoolsKit.singleshot(function () { return __awaiter(void 0, vo
|
|
|
6951
6996
|
* @returns {Promise<string>} The result of the complete function.
|
|
6952
6997
|
*/
|
|
6953
6998
|
var complete = function (content, clientId, swarmName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6954
|
-
var
|
|
6999
|
+
var methodName, executionId, run;
|
|
6955
7000
|
return __generator(this, function (_a) {
|
|
6956
7001
|
switch (_a.label) {
|
|
6957
7002
|
case 0:
|
|
6958
|
-
|
|
7003
|
+
methodName = "function complete";
|
|
7004
|
+
executionId = functoolsKit.randomString();
|
|
6959
7005
|
swarm.loggerService.log("function complete", {
|
|
6960
7006
|
content: content,
|
|
6961
7007
|
clientId: clientId,
|
|
7008
|
+
executionId: executionId,
|
|
6962
7009
|
swarmName: swarmName,
|
|
6963
|
-
requestId: requestId,
|
|
6964
7010
|
});
|
|
6965
7011
|
return [4 /*yield*/, createComplete(clientId, swarmName)];
|
|
6966
7012
|
case 1:
|
|
6967
7013
|
run = _a.sent();
|
|
6968
7014
|
createGc();
|
|
6969
|
-
return [
|
|
6970
|
-
|
|
7015
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7016
|
+
return __generator(this, function (_a) {
|
|
7017
|
+
switch (_a.label) {
|
|
7018
|
+
case 0: return [4 /*yield*/, run(methodName, content)];
|
|
7019
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
7020
|
+
}
|
|
7021
|
+
});
|
|
7022
|
+
}); }, {
|
|
7023
|
+
clientId: clientId,
|
|
7024
|
+
executionId: executionId,
|
|
7025
|
+
})];
|
|
6971
7026
|
}
|
|
6972
7027
|
});
|
|
6973
7028
|
}); };
|
|
@@ -6983,11 +7038,12 @@ var SCHEDULED_DELAY = 1000;
|
|
|
6983
7038
|
* @returns {Function} dispose - A function to dispose of the session.
|
|
6984
7039
|
*/
|
|
6985
7040
|
var session = function (clientId, swarmName) {
|
|
6986
|
-
var
|
|
7041
|
+
var methodName = "function session";
|
|
7042
|
+
var executionId = functoolsKit.randomString();
|
|
6987
7043
|
swarm.loggerService.log("function session", {
|
|
6988
7044
|
clientId: clientId,
|
|
6989
7045
|
swarmName: swarmName,
|
|
6990
|
-
|
|
7046
|
+
executionId: executionId,
|
|
6991
7047
|
});
|
|
6992
7048
|
swarm.swarmValidationService.validate(swarmName, "session");
|
|
6993
7049
|
swarm.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
@@ -7000,12 +7056,18 @@ var session = function (clientId, swarmName) {
|
|
|
7000
7056
|
*/
|
|
7001
7057
|
complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7002
7058
|
return __generator(this, function (_a) {
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7059
|
+
swarm.sessionValidationService.validate(clientId, "session");
|
|
7060
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7061
|
+
return __generator(this, function (_a) {
|
|
7062
|
+
switch (_a.label) {
|
|
7063
|
+
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
|
|
7064
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
7065
|
+
}
|
|
7066
|
+
});
|
|
7067
|
+
}); }, {
|
|
7068
|
+
clientId: clientId,
|
|
7069
|
+
executionId: executionId,
|
|
7070
|
+
})];
|
|
7009
7071
|
});
|
|
7010
7072
|
}); }),
|
|
7011
7073
|
/**
|
|
@@ -7016,7 +7078,7 @@ var session = function (clientId, swarmName) {
|
|
|
7016
7078
|
dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7017
7079
|
return __generator(this, function (_a) {
|
|
7018
7080
|
switch (_a.label) {
|
|
7019
|
-
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName,
|
|
7081
|
+
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
|
|
7020
7082
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7021
7083
|
}
|
|
7022
7084
|
});
|
|
@@ -7126,23 +7188,22 @@ var getRawHistory = function (clientId_1) {
|
|
|
7126
7188
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7127
7189
|
args_1[_i - 1] = arguments[_i];
|
|
7128
7190
|
}
|
|
7129
|
-
return __awaiter(void 0, __spreadArray([clientId_1], __read(args_1), false), void 0, function (clientId,
|
|
7191
|
+
return __awaiter(void 0, __spreadArray([clientId_1], __read(args_1), false), void 0, function (clientId, methodName) {
|
|
7130
7192
|
var swarmName, agentName, history;
|
|
7131
|
-
if (
|
|
7193
|
+
if (methodName === void 0) { methodName = "function getRawHistory"; }
|
|
7132
7194
|
return __generator(this, function (_a) {
|
|
7133
7195
|
switch (_a.label) {
|
|
7134
7196
|
case 0:
|
|
7135
7197
|
swarm.loggerService.log("function getRawHistory", {
|
|
7136
7198
|
clientId: clientId,
|
|
7137
|
-
requestId: requestId,
|
|
7138
7199
|
});
|
|
7139
7200
|
swarm.sessionValidationService.validate(clientId, "getRawHistory");
|
|
7140
7201
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7141
7202
|
swarm.swarmValidationService.validate(swarmName, "getRawHistory");
|
|
7142
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7203
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7143
7204
|
case 1:
|
|
7144
7205
|
agentName = _a.sent();
|
|
7145
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(
|
|
7206
|
+
return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
|
|
7146
7207
|
case 2:
|
|
7147
7208
|
history = _a.sent();
|
|
7148
7209
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7159,19 +7220,18 @@ var getRawHistory = function (clientId_1) {
|
|
|
7159
7220
|
* @returns {Promise<Array>} - A promise that resolves to an array containing the agent's history.
|
|
7160
7221
|
*/
|
|
7161
7222
|
var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7162
|
-
var
|
|
7223
|
+
var methodName, prompt, history;
|
|
7163
7224
|
return __generator(this, function (_a) {
|
|
7164
7225
|
switch (_a.label) {
|
|
7165
7226
|
case 0:
|
|
7166
|
-
|
|
7227
|
+
methodName = "function getAgentHistory";
|
|
7167
7228
|
swarm.loggerService.log("function getAgentHistory", {
|
|
7168
7229
|
clientId: clientId,
|
|
7169
7230
|
agentName: agentName,
|
|
7170
|
-
requestId: requestId,
|
|
7171
7231
|
});
|
|
7172
7232
|
swarm.agentValidationService.validate(agentName, "getAgentHistory");
|
|
7173
7233
|
prompt = swarm.agentSchemaService.get(agentName).prompt;
|
|
7174
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt,
|
|
7234
|
+
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
|
|
7175
7235
|
case 1:
|
|
7176
7236
|
history = _a.sent();
|
|
7177
7237
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7205,23 +7265,23 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7205
7265
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
7206
7266
|
*/
|
|
7207
7267
|
var commitToolOutput = function (toolId, content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7208
|
-
var
|
|
7268
|
+
var methodName, swarmName, currentAgentName;
|
|
7209
7269
|
return __generator(this, function (_a) {
|
|
7210
7270
|
switch (_a.label) {
|
|
7211
7271
|
case 0:
|
|
7212
|
-
|
|
7272
|
+
methodName = 'function commitToolOutput';
|
|
7213
7273
|
swarm.loggerService.log('function commitToolOutput', {
|
|
7214
7274
|
toolId: toolId,
|
|
7215
7275
|
content: content,
|
|
7216
7276
|
clientId: clientId,
|
|
7217
7277
|
agentName: agentName,
|
|
7218
|
-
|
|
7278
|
+
methodName: methodName,
|
|
7219
7279
|
});
|
|
7220
7280
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7221
7281
|
swarm.sessionValidationService.validate(clientId, "commitToolOutput");
|
|
7222
7282
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7223
7283
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
|
|
7224
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7284
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7225
7285
|
case 1:
|
|
7226
7286
|
currentAgentName = _a.sent();
|
|
7227
7287
|
if (currentAgentName !== agentName) {
|
|
@@ -7233,7 +7293,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7233
7293
|
});
|
|
7234
7294
|
return [2 /*return*/];
|
|
7235
7295
|
}
|
|
7236
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content,
|
|
7296
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
7237
7297
|
case 2:
|
|
7238
7298
|
_a.sent();
|
|
7239
7299
|
return [2 /*return*/];
|
|
@@ -7250,22 +7310,21 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7250
7310
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7251
7311
|
*/
|
|
7252
7312
|
var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7253
|
-
var
|
|
7313
|
+
var methodName, swarmName, currentAgentName;
|
|
7254
7314
|
return __generator(this, function (_a) {
|
|
7255
7315
|
switch (_a.label) {
|
|
7256
7316
|
case 0:
|
|
7257
|
-
|
|
7317
|
+
methodName = 'function commitSystemMessage';
|
|
7258
7318
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
7259
7319
|
content: content,
|
|
7260
7320
|
clientId: clientId,
|
|
7261
7321
|
agentName: agentName,
|
|
7262
|
-
requestId: requestId,
|
|
7263
7322
|
});
|
|
7264
7323
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7265
7324
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
|
|
7266
7325
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7267
7326
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
|
|
7268
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7327
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7269
7328
|
case 1:
|
|
7270
7329
|
currentAgentName = _a.sent();
|
|
7271
7330
|
if (currentAgentName !== agentName) {
|
|
@@ -7276,7 +7335,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7276
7335
|
});
|
|
7277
7336
|
return [2 /*return*/];
|
|
7278
7337
|
}
|
|
7279
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content,
|
|
7338
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
7280
7339
|
case 2:
|
|
7281
7340
|
_a.sent();
|
|
7282
7341
|
return [2 /*return*/];
|
|
@@ -7292,21 +7351,20 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7292
7351
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7293
7352
|
*/
|
|
7294
7353
|
var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7295
|
-
var
|
|
7354
|
+
var methodName, swarmName, currentAgentName;
|
|
7296
7355
|
return __generator(this, function (_a) {
|
|
7297
7356
|
switch (_a.label) {
|
|
7298
7357
|
case 0:
|
|
7299
|
-
|
|
7358
|
+
methodName = 'function commitFlush';
|
|
7300
7359
|
swarm.loggerService.log('function commitFlush', {
|
|
7301
7360
|
clientId: clientId,
|
|
7302
7361
|
agentName: agentName,
|
|
7303
|
-
requestId: requestId,
|
|
7304
7362
|
});
|
|
7305
7363
|
swarm.agentValidationService.validate(agentName, "commitFlush");
|
|
7306
7364
|
swarm.sessionValidationService.validate(clientId, "commitFlush");
|
|
7307
7365
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7308
7366
|
swarm.swarmValidationService.validate(swarmName, "commitFlush");
|
|
7309
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7367
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7310
7368
|
case 1:
|
|
7311
7369
|
currentAgentName = _a.sent();
|
|
7312
7370
|
if (currentAgentName !== agentName) {
|
|
@@ -7317,7 +7375,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7317
7375
|
});
|
|
7318
7376
|
return [2 /*return*/];
|
|
7319
7377
|
}
|
|
7320
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(
|
|
7378
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
7321
7379
|
case 2:
|
|
7322
7380
|
_a.sent();
|
|
7323
7381
|
return [2 /*return*/];
|
|
@@ -7335,22 +7393,24 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7335
7393
|
* @returns {Promise<void>} - A promise that resolves when the execution is complete.
|
|
7336
7394
|
*/
|
|
7337
7395
|
var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7338
|
-
var
|
|
7396
|
+
var methodName, executionId, swarmName, currentAgentName;
|
|
7339
7397
|
return __generator(this, function (_a) {
|
|
7340
7398
|
switch (_a.label) {
|
|
7341
7399
|
case 0:
|
|
7342
|
-
|
|
7400
|
+
methodName = "function execute";
|
|
7401
|
+
executionId = functoolsKit.randomString();
|
|
7343
7402
|
swarm.loggerService.log("function execute", {
|
|
7344
7403
|
content: content,
|
|
7345
7404
|
clientId: clientId,
|
|
7346
7405
|
agentName: agentName,
|
|
7347
|
-
|
|
7406
|
+
methodName: methodName,
|
|
7407
|
+
executionId: executionId,
|
|
7348
7408
|
});
|
|
7349
7409
|
swarm.agentValidationService.validate(agentName, "execute");
|
|
7350
7410
|
swarm.sessionValidationService.validate(clientId, "execute");
|
|
7351
7411
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7352
7412
|
swarm.swarmValidationService.validate(swarmName, "execute");
|
|
7353
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7413
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7354
7414
|
case 1:
|
|
7355
7415
|
currentAgentName = _a.sent();
|
|
7356
7416
|
if (currentAgentName !== agentName) {
|
|
@@ -7361,8 +7421,17 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7361
7421
|
});
|
|
7362
7422
|
return [2 /*return*/];
|
|
7363
7423
|
}
|
|
7364
|
-
return [
|
|
7365
|
-
|
|
7424
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7425
|
+
return __generator(this, function (_a) {
|
|
7426
|
+
switch (_a.label) {
|
|
7427
|
+
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
|
|
7428
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
7429
|
+
}
|
|
7430
|
+
});
|
|
7431
|
+
}); }, {
|
|
7432
|
+
clientId: clientId,
|
|
7433
|
+
executionId: executionId,
|
|
7434
|
+
})];
|
|
7366
7435
|
}
|
|
7367
7436
|
});
|
|
7368
7437
|
}); };
|
|
@@ -7378,16 +7447,15 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7378
7447
|
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
7379
7448
|
*/
|
|
7380
7449
|
var emit = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7381
|
-
var
|
|
7450
|
+
var methodName, swarmName, currentAgentName;
|
|
7382
7451
|
return __generator(this, function (_a) {
|
|
7383
7452
|
switch (_a.label) {
|
|
7384
7453
|
case 0:
|
|
7385
|
-
|
|
7454
|
+
methodName = "function emit";
|
|
7386
7455
|
swarm.loggerService.log("function emit", {
|
|
7387
7456
|
content: content,
|
|
7388
7457
|
clientId: clientId,
|
|
7389
7458
|
agentName: agentName,
|
|
7390
|
-
requestId: requestId,
|
|
7391
7459
|
});
|
|
7392
7460
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7393
7461
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
@@ -7396,7 +7464,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7396
7464
|
swarm.sessionValidationService.validate(clientId, "emit");
|
|
7397
7465
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7398
7466
|
swarm.swarmValidationService.validate(swarmName, "emit");
|
|
7399
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7467
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7400
7468
|
case 1:
|
|
7401
7469
|
currentAgentName = _a.sent();
|
|
7402
7470
|
if (currentAgentName !== agentName) {
|
|
@@ -7407,7 +7475,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7407
7475
|
});
|
|
7408
7476
|
return [2 /*return*/];
|
|
7409
7477
|
}
|
|
7410
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content,
|
|
7478
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
7411
7479
|
case 2: return [2 /*return*/, _a.sent()];
|
|
7412
7480
|
}
|
|
7413
7481
|
});
|
|
@@ -7421,21 +7489,20 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7421
7489
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
7422
7490
|
*/
|
|
7423
7491
|
var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7424
|
-
var
|
|
7492
|
+
var methodName, swarmName;
|
|
7425
7493
|
return __generator(this, function (_a) {
|
|
7426
7494
|
switch (_a.label) {
|
|
7427
7495
|
case 0:
|
|
7428
|
-
|
|
7496
|
+
methodName = 'function commitToolOutputForce';
|
|
7429
7497
|
swarm.loggerService.log('function commitToolOutputForce', {
|
|
7430
7498
|
toolId: toolId,
|
|
7431
7499
|
content: content,
|
|
7432
7500
|
clientId: clientId,
|
|
7433
|
-
requestId: requestId,
|
|
7434
7501
|
});
|
|
7435
7502
|
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
7436
7503
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7437
7504
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
7438
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content,
|
|
7505
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
7439
7506
|
case 1:
|
|
7440
7507
|
_a.sent();
|
|
7441
7508
|
return [2 /*return*/];
|
|
@@ -7451,20 +7518,19 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
7451
7518
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7452
7519
|
*/
|
|
7453
7520
|
var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7454
|
-
var
|
|
7521
|
+
var methodName, swarmName;
|
|
7455
7522
|
return __generator(this, function (_a) {
|
|
7456
7523
|
switch (_a.label) {
|
|
7457
7524
|
case 0:
|
|
7458
|
-
|
|
7525
|
+
methodName = 'function commitSystemMessageForce';
|
|
7459
7526
|
swarm.loggerService.log('function commitSystemMessageForce', {
|
|
7460
7527
|
content: content,
|
|
7461
7528
|
clientId: clientId,
|
|
7462
|
-
requestId: requestId,
|
|
7463
7529
|
});
|
|
7464
7530
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
7465
7531
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7466
7532
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
7467
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content,
|
|
7533
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
7468
7534
|
case 1:
|
|
7469
7535
|
_a.sent();
|
|
7470
7536
|
return [2 /*return*/];
|
|
@@ -7479,19 +7545,19 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
7479
7545
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7480
7546
|
*/
|
|
7481
7547
|
var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7482
|
-
var
|
|
7548
|
+
var methodName, swarmName;
|
|
7483
7549
|
return __generator(this, function (_a) {
|
|
7484
7550
|
switch (_a.label) {
|
|
7485
7551
|
case 0:
|
|
7486
|
-
|
|
7552
|
+
methodName = 'function commitFlushForce';
|
|
7487
7553
|
swarm.loggerService.log('function commitFlushForce', {
|
|
7488
7554
|
clientId: clientId,
|
|
7489
|
-
|
|
7555
|
+
methodName: methodName,
|
|
7490
7556
|
});
|
|
7491
7557
|
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
7492
7558
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7493
7559
|
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
7494
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(
|
|
7560
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
7495
7561
|
case 1:
|
|
7496
7562
|
_a.sent();
|
|
7497
7563
|
return [2 /*return*/];
|
|
@@ -7507,20 +7573,19 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
7507
7573
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7508
7574
|
*/
|
|
7509
7575
|
var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7510
|
-
var
|
|
7576
|
+
var methodName, swarmName;
|
|
7511
7577
|
return __generator(this, function (_a) {
|
|
7512
7578
|
switch (_a.label) {
|
|
7513
7579
|
case 0:
|
|
7514
|
-
|
|
7580
|
+
methodName = 'function commitSystemMessage';
|
|
7515
7581
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
7516
7582
|
content: content,
|
|
7517
7583
|
clientId: clientId,
|
|
7518
|
-
requestId: requestId,
|
|
7519
7584
|
});
|
|
7520
7585
|
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
7521
7586
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7522
7587
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
7523
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content,
|
|
7588
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
7524
7589
|
case 1:
|
|
7525
7590
|
_a.sent();
|
|
7526
7591
|
return [2 /*return*/];
|
|
@@ -7539,15 +7604,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
7539
7604
|
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
7540
7605
|
*/
|
|
7541
7606
|
var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7542
|
-
var
|
|
7607
|
+
var methodName, swarmName;
|
|
7543
7608
|
return __generator(this, function (_a) {
|
|
7544
7609
|
switch (_a.label) {
|
|
7545
7610
|
case 0:
|
|
7546
|
-
|
|
7611
|
+
methodName = "function emitForce";
|
|
7547
7612
|
swarm.loggerService.log("function emitForce", {
|
|
7548
7613
|
content: content,
|
|
7549
7614
|
clientId: clientId,
|
|
7550
|
-
requestId: requestId,
|
|
7551
7615
|
});
|
|
7552
7616
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7553
7617
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
@@ -7555,7 +7619,7 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7555
7619
|
swarm.sessionValidationService.validate(clientId, "emitForce");
|
|
7556
7620
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7557
7621
|
swarm.swarmValidationService.validate(swarmName, "emitForce");
|
|
7558
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content,
|
|
7622
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
7559
7623
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7560
7624
|
}
|
|
7561
7625
|
});
|
|
@@ -7572,22 +7636,29 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7572
7636
|
* @returns {Promise<void>} - A promise that resolves when the execution is complete.
|
|
7573
7637
|
*/
|
|
7574
7638
|
var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7575
|
-
var
|
|
7639
|
+
var methodName, executionId, swarmName;
|
|
7576
7640
|
return __generator(this, function (_a) {
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7641
|
+
methodName = "function executeForce";
|
|
7642
|
+
executionId = functoolsKit.randomString();
|
|
7643
|
+
swarm.loggerService.log("function executeForce", {
|
|
7644
|
+
content: content,
|
|
7645
|
+
clientId: clientId,
|
|
7646
|
+
executionId: executionId,
|
|
7647
|
+
});
|
|
7648
|
+
swarm.sessionValidationService.validate(clientId, "executeForce");
|
|
7649
|
+
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7650
|
+
swarm.swarmValidationService.validate(swarmName, "executeForce");
|
|
7651
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7652
|
+
return __generator(this, function (_a) {
|
|
7653
|
+
switch (_a.label) {
|
|
7654
|
+
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
|
|
7655
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
7656
|
+
}
|
|
7584
7657
|
});
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
7590
|
-
}
|
|
7658
|
+
}); }, {
|
|
7659
|
+
clientId: clientId,
|
|
7660
|
+
executionId: executionId,
|
|
7661
|
+
})];
|
|
7591
7662
|
});
|
|
7592
7663
|
}); };
|
|
7593
7664
|
|
|
@@ -7675,16 +7746,15 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
|
7675
7746
|
* @returns {Promise<string | null>} - The content of the last user message, or null if no user message is found.
|
|
7676
7747
|
*/
|
|
7677
7748
|
var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7678
|
-
var
|
|
7749
|
+
var methodName, history, last;
|
|
7679
7750
|
return __generator(this, function (_a) {
|
|
7680
7751
|
switch (_a.label) {
|
|
7681
7752
|
case 0:
|
|
7682
|
-
|
|
7753
|
+
methodName = "function getLastUserMessage";
|
|
7683
7754
|
swarm.loggerService.log("function getLastUserMessage", {
|
|
7684
7755
|
clientId: clientId,
|
|
7685
|
-
requestId: requestId,
|
|
7686
7756
|
});
|
|
7687
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7757
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7688
7758
|
case 1:
|
|
7689
7759
|
history = _a.sent();
|
|
7690
7760
|
last = history.findLast(function (_a) {
|
|
@@ -7703,16 +7773,15 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7703
7773
|
* @returns {Promise<Array>} A promise that resolves to an array of history objects filtered by user role.
|
|
7704
7774
|
*/
|
|
7705
7775
|
var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7706
|
-
var
|
|
7776
|
+
var methodName, history;
|
|
7707
7777
|
return __generator(this, function (_a) {
|
|
7708
7778
|
switch (_a.label) {
|
|
7709
7779
|
case 0:
|
|
7710
|
-
|
|
7780
|
+
methodName = "function getUserHistory";
|
|
7711
7781
|
swarm.loggerService.log("function getUserHistory", {
|
|
7712
7782
|
clientId: clientId,
|
|
7713
|
-
requestId: requestId,
|
|
7714
7783
|
});
|
|
7715
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7784
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7716
7785
|
case 1:
|
|
7717
7786
|
history = _a.sent();
|
|
7718
7787
|
return [2 /*return*/, history.filter(function (_a) {
|
|
@@ -7730,16 +7799,15 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7730
7799
|
* @returns {Promise<Array>} - A promise that resolves to an array of history objects where the role is "assistant".
|
|
7731
7800
|
*/
|
|
7732
7801
|
var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7733
|
-
var
|
|
7802
|
+
var methodName, history;
|
|
7734
7803
|
return __generator(this, function (_a) {
|
|
7735
7804
|
switch (_a.label) {
|
|
7736
7805
|
case 0:
|
|
7737
|
-
|
|
7806
|
+
methodName = "function getAssistantHistory";
|
|
7738
7807
|
swarm.loggerService.log("function getAssistantHistory", {
|
|
7739
7808
|
clientId: clientId,
|
|
7740
|
-
requestId: requestId,
|
|
7741
7809
|
});
|
|
7742
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7810
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7743
7811
|
case 1:
|
|
7744
7812
|
history = _a.sent();
|
|
7745
7813
|
return [2 /*return*/, history.filter(function (_a) {
|
|
@@ -7757,16 +7825,15 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7757
7825
|
* @returns {Promise<string | null>} - The content of the last assistant message, or null if no user message is found.
|
|
7758
7826
|
*/
|
|
7759
7827
|
var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7760
|
-
var
|
|
7828
|
+
var methodName, history, last;
|
|
7761
7829
|
return __generator(this, function (_a) {
|
|
7762
7830
|
switch (_a.label) {
|
|
7763
7831
|
case 0:
|
|
7764
|
-
|
|
7832
|
+
methodName = "function getLastAssistantMessage";
|
|
7765
7833
|
swarm.loggerService.log("function getLastAssistantMessage", {
|
|
7766
7834
|
clientId: clientId,
|
|
7767
|
-
requestId: requestId,
|
|
7768
7835
|
});
|
|
7769
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7836
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7770
7837
|
case 1:
|
|
7771
7838
|
history = _a.sent();
|
|
7772
7839
|
last = history.findLast(function (_a) {
|
|
@@ -7785,16 +7852,15 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
7785
7852
|
* @returns {Promise<string | null>} - The content of the last system message, or null if no user message is found.
|
|
7786
7853
|
*/
|
|
7787
7854
|
var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7788
|
-
var
|
|
7855
|
+
var methodName, history, last;
|
|
7789
7856
|
return __generator(this, function (_a) {
|
|
7790
7857
|
switch (_a.label) {
|
|
7791
7858
|
case 0:
|
|
7792
|
-
|
|
7859
|
+
methodName = "function getLastSystemMessage";
|
|
7793
7860
|
swarm.loggerService.log("function getLastSystemMessage", {
|
|
7794
7861
|
clientId: clientId,
|
|
7795
|
-
requestId: requestId,
|
|
7796
7862
|
});
|
|
7797
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7863
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7798
7864
|
case 1:
|
|
7799
7865
|
history = _a.sent();
|
|
7800
7866
|
last = history.findLast(function (_a) {
|
|
@@ -7898,21 +7964,20 @@ var event = function (clientId, topicName, payload) {
|
|
|
7898
7964
|
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7899
7965
|
*/
|
|
7900
7966
|
var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7901
|
-
var
|
|
7967
|
+
var methodName, swarmName, currentAgentName;
|
|
7902
7968
|
return __generator(this, function (_a) {
|
|
7903
7969
|
switch (_a.label) {
|
|
7904
7970
|
case 0:
|
|
7905
|
-
|
|
7971
|
+
methodName = 'function cancelOutput';
|
|
7906
7972
|
swarm.loggerService.log('function cancelOutput', {
|
|
7907
7973
|
clientId: clientId,
|
|
7908
7974
|
agentName: agentName,
|
|
7909
|
-
requestId: requestId,
|
|
7910
7975
|
});
|
|
7911
7976
|
swarm.agentValidationService.validate(agentName, "cancelOutput");
|
|
7912
7977
|
swarm.sessionValidationService.validate(clientId, "cancelOutput");
|
|
7913
7978
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7914
7979
|
swarm.swarmValidationService.validate(swarmName, "cancelOutput");
|
|
7915
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7980
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7916
7981
|
case 1:
|
|
7917
7982
|
currentAgentName = _a.sent();
|
|
7918
7983
|
if (currentAgentName !== agentName) {
|
|
@@ -7923,7 +7988,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7923
7988
|
});
|
|
7924
7989
|
return [2 /*return*/];
|
|
7925
7990
|
}
|
|
7926
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(
|
|
7991
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
7927
7992
|
case 2:
|
|
7928
7993
|
_a.sent();
|
|
7929
7994
|
return [2 /*return*/];
|
|
@@ -7939,19 +8004,18 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7939
8004
|
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7940
8005
|
*/
|
|
7941
8006
|
var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7942
|
-
var
|
|
8007
|
+
var methodName, swarmName;
|
|
7943
8008
|
return __generator(this, function (_a) {
|
|
7944
8009
|
switch (_a.label) {
|
|
7945
8010
|
case 0:
|
|
7946
|
-
|
|
8011
|
+
methodName = 'function cancelOutputForce';
|
|
7947
8012
|
swarm.loggerService.log('function cancelOutputForce', {
|
|
7948
8013
|
clientId: clientId,
|
|
7949
|
-
requestId: requestId
|
|
7950
8014
|
});
|
|
7951
8015
|
swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
|
|
7952
8016
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7953
8017
|
swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
|
|
7954
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(
|
|
8018
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
7955
8019
|
case 1:
|
|
7956
8020
|
_a.sent();
|
|
7957
8021
|
return [2 /*return*/];
|
|
@@ -8237,24 +8301,23 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8237
8301
|
* @template T
|
|
8238
8302
|
*/
|
|
8239
8303
|
this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8240
|
-
var
|
|
8304
|
+
var methodName;
|
|
8241
8305
|
return __generator(this, function (_a) {
|
|
8242
8306
|
switch (_a.label) {
|
|
8243
8307
|
case 0:
|
|
8244
|
-
|
|
8308
|
+
methodName = "StorageUtils take";
|
|
8245
8309
|
swarm.loggerService.log("StorageUtils take", {
|
|
8246
8310
|
search: payload.search,
|
|
8247
8311
|
total: payload.total,
|
|
8248
8312
|
clientId: payload.clientId,
|
|
8249
8313
|
storageName: payload.storageName,
|
|
8250
8314
|
score: payload.score,
|
|
8251
|
-
requestId: requestId,
|
|
8252
8315
|
});
|
|
8253
8316
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8254
8317
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8255
8318
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
8256
8319
|
}
|
|
8257
|
-
return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total,
|
|
8320
|
+
return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, methodName, payload.clientId, payload.storageName, payload.score)];
|
|
8258
8321
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8259
8322
|
}
|
|
8260
8323
|
});
|
|
@@ -8269,22 +8332,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8269
8332
|
* @template T
|
|
8270
8333
|
*/
|
|
8271
8334
|
this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8272
|
-
var
|
|
8335
|
+
var methodName;
|
|
8273
8336
|
return __generator(this, function (_a) {
|
|
8274
8337
|
switch (_a.label) {
|
|
8275
8338
|
case 0:
|
|
8276
|
-
|
|
8339
|
+
methodName = "StorageUtils upsert";
|
|
8277
8340
|
swarm.loggerService.log("StorageUtils upsert", {
|
|
8278
8341
|
item: payload.item,
|
|
8279
8342
|
clientId: payload.clientId,
|
|
8280
8343
|
storageName: payload.storageName,
|
|
8281
|
-
requestId: requestId,
|
|
8282
8344
|
});
|
|
8283
8345
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8284
8346
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8285
8347
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
8286
8348
|
}
|
|
8287
|
-
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item,
|
|
8349
|
+
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, methodName, payload.clientId, payload.storageName)];
|
|
8288
8350
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8289
8351
|
}
|
|
8290
8352
|
});
|
|
@@ -8298,22 +8360,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8298
8360
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
8299
8361
|
*/
|
|
8300
8362
|
this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8301
|
-
var
|
|
8363
|
+
var methodName;
|
|
8302
8364
|
return __generator(this, function (_a) {
|
|
8303
8365
|
switch (_a.label) {
|
|
8304
8366
|
case 0:
|
|
8305
|
-
|
|
8367
|
+
methodName = "StorageUtils remove";
|
|
8306
8368
|
swarm.loggerService.log("StorageUtils remove", {
|
|
8307
8369
|
itemId: payload.itemId,
|
|
8308
8370
|
clientId: payload.clientId,
|
|
8309
8371
|
storageName: payload.storageName,
|
|
8310
|
-
requestId: requestId,
|
|
8311
8372
|
});
|
|
8312
8373
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8313
8374
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8314
8375
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
8315
8376
|
}
|
|
8316
|
-
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId,
|
|
8377
|
+
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, methodName, payload.clientId, payload.storageName)];
|
|
8317
8378
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8318
8379
|
}
|
|
8319
8380
|
});
|
|
@@ -8328,22 +8389,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8328
8389
|
* @template T
|
|
8329
8390
|
*/
|
|
8330
8391
|
this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8331
|
-
var
|
|
8392
|
+
var methodName;
|
|
8332
8393
|
return __generator(this, function (_a) {
|
|
8333
8394
|
switch (_a.label) {
|
|
8334
8395
|
case 0:
|
|
8335
|
-
|
|
8396
|
+
methodName = "StorageUtils get";
|
|
8336
8397
|
swarm.loggerService.log("StorageUtils get", {
|
|
8337
8398
|
itemId: payload.itemId,
|
|
8338
8399
|
clientId: payload.clientId,
|
|
8339
8400
|
storageName: payload.storageName,
|
|
8340
|
-
requestId: requestId,
|
|
8341
8401
|
});
|
|
8342
8402
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8343
8403
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8344
8404
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
8345
8405
|
}
|
|
8346
|
-
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId,
|
|
8406
|
+
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, methodName, payload.clientId, payload.storageName)];
|
|
8347
8407
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8348
8408
|
}
|
|
8349
8409
|
});
|
|
@@ -8358,21 +8418,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8358
8418
|
* @template T
|
|
8359
8419
|
*/
|
|
8360
8420
|
this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8361
|
-
var
|
|
8421
|
+
var methodName;
|
|
8362
8422
|
return __generator(this, function (_a) {
|
|
8363
8423
|
switch (_a.label) {
|
|
8364
8424
|
case 0:
|
|
8365
|
-
|
|
8425
|
+
methodName = "StorageUtils list";
|
|
8366
8426
|
swarm.loggerService.log("StorageUtils list", {
|
|
8367
8427
|
clientId: payload.clientId,
|
|
8368
8428
|
storageName: payload.storageName,
|
|
8369
|
-
requestId: requestId,
|
|
8370
8429
|
});
|
|
8371
8430
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8372
8431
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8373
8432
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
8374
8433
|
}
|
|
8375
|
-
return [4 /*yield*/, swarm.storagePublicService.list(
|
|
8434
|
+
return [4 /*yield*/, swarm.storagePublicService.list(methodName, payload.clientId, payload.storageName, payload.filter)];
|
|
8376
8435
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8377
8436
|
}
|
|
8378
8437
|
});
|
|
@@ -8385,21 +8444,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8385
8444
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
8386
8445
|
*/
|
|
8387
8446
|
this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8388
|
-
var
|
|
8447
|
+
var methodName;
|
|
8389
8448
|
return __generator(this, function (_a) {
|
|
8390
8449
|
switch (_a.label) {
|
|
8391
8450
|
case 0:
|
|
8392
|
-
|
|
8451
|
+
methodName = "StorageUtils clear";
|
|
8393
8452
|
swarm.loggerService.log("StorageUtils clear", {
|
|
8394
8453
|
clientId: payload.clientId,
|
|
8395
8454
|
storageName: payload.storageName,
|
|
8396
|
-
requestId: requestId,
|
|
8397
8455
|
});
|
|
8398
8456
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8399
8457
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8400
8458
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
8401
8459
|
}
|
|
8402
|
-
return [4 /*yield*/, swarm.storagePublicService.clear(
|
|
8460
|
+
return [4 /*yield*/, swarm.storagePublicService.clear(methodName, payload.clientId, payload.storageName)];
|
|
8403
8461
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8404
8462
|
}
|
|
8405
8463
|
});
|
|
@@ -8427,20 +8485,19 @@ var StateUtils = /** @class */ (function () {
|
|
|
8427
8485
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
8428
8486
|
*/
|
|
8429
8487
|
this.getState = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8430
|
-
var
|
|
8488
|
+
var methodName;
|
|
8431
8489
|
return __generator(this, function (_a) {
|
|
8432
8490
|
switch (_a.label) {
|
|
8433
8491
|
case 0:
|
|
8434
|
-
|
|
8492
|
+
methodName = "StateUtils getState";
|
|
8435
8493
|
swarm.loggerService.log("StateUtils getState", {
|
|
8436
8494
|
clientId: payload.clientId,
|
|
8437
8495
|
stateName: payload.stateName,
|
|
8438
|
-
requestId: requestId,
|
|
8439
8496
|
});
|
|
8440
8497
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8441
8498
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
|
|
8442
8499
|
}
|
|
8443
|
-
return [4 /*yield*/, swarm.statePublicService.getState(
|
|
8500
|
+
return [4 /*yield*/, swarm.statePublicService.getState(methodName, payload.clientId, payload.stateName)];
|
|
8444
8501
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8445
8502
|
}
|
|
8446
8503
|
});
|
|
@@ -8457,26 +8514,25 @@ var StateUtils = /** @class */ (function () {
|
|
|
8457
8514
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
8458
8515
|
*/
|
|
8459
8516
|
this.setState = function (dispatchFn, payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8460
|
-
var
|
|
8517
|
+
var methodName;
|
|
8461
8518
|
var _this = this;
|
|
8462
8519
|
return __generator(this, function (_a) {
|
|
8463
8520
|
switch (_a.label) {
|
|
8464
8521
|
case 0:
|
|
8465
|
-
|
|
8522
|
+
methodName = "StateUtils setState";
|
|
8466
8523
|
swarm.loggerService.log("StateUtils setState", {
|
|
8467
8524
|
clientId: payload.clientId,
|
|
8468
8525
|
stateName: payload.stateName,
|
|
8469
|
-
requestId: requestId,
|
|
8470
8526
|
});
|
|
8471
8527
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8472
8528
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
8473
8529
|
}
|
|
8474
8530
|
if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
|
|
8475
|
-
return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn,
|
|
8531
|
+
return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, methodName, payload.clientId, payload.stateName)];
|
|
8476
8532
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8477
8533
|
case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
8478
8534
|
return [2 /*return*/, dispatchFn];
|
|
8479
|
-
}); }); },
|
|
8535
|
+
}); }); }, methodName, payload.clientId, payload.stateName)];
|
|
8480
8536
|
case 3: return [2 /*return*/, _a.sent()];
|
|
8481
8537
|
}
|
|
8482
8538
|
});
|
|
@@ -8509,11 +8565,12 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8509
8565
|
*/
|
|
8510
8566
|
var Logger = new LoggerUtils();
|
|
8511
8567
|
|
|
8512
|
-
exports.
|
|
8568
|
+
exports.ExecutionContextService = ExecutionContextService;
|
|
8513
8569
|
exports.History = History;
|
|
8514
8570
|
exports.HistoryAdapter = HistoryAdapter;
|
|
8515
8571
|
exports.HistoryInstance = HistoryInstance;
|
|
8516
8572
|
exports.Logger = Logger;
|
|
8573
|
+
exports.MethodContextService = MethodContextService;
|
|
8517
8574
|
exports.State = State;
|
|
8518
8575
|
exports.Storage = Storage;
|
|
8519
8576
|
exports.addAgent = addAgent;
|