agent-swarm-kit 1.0.75 → 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 +456 -442
- package/build/index.mjs +455 -442
- package/package.json +1 -1
- package/types.d.ts +84 -62
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
|
});
|
|
@@ -2990,9 +3015,9 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
2990
3015
|
* @param {SendMessageFn} connector - The function to send messages.
|
|
2991
3016
|
* @returns {ReceiveMessageFn} The function to receive messages.
|
|
2992
3017
|
*/
|
|
2993
|
-
this.connect = function (connector) {
|
|
3018
|
+
this.connect = function (connector, clientId, swarmName) {
|
|
2994
3019
|
_this.loggerService.log("sessionConnectionService connect");
|
|
2995
|
-
return _this.getSession(
|
|
3020
|
+
return _this.getSession(clientId, swarmName).connect(connector);
|
|
2996
3021
|
};
|
|
2997
3022
|
/**
|
|
2998
3023
|
* Commits tool output to the session.
|
|
@@ -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,56 +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
|
-
|
|
3675
|
-
clientId: clientId,
|
|
3676
|
-
swarmName: swarmName,
|
|
3677
|
-
});
|
|
3678
|
-
return ContextService.runInContext(function () {
|
|
3679
|
-
var receive = _this.sessionConnectionService.connect(function (outgoing) { return __awaiter(_this, void 0, void 0, function () {
|
|
3680
|
-
var _this = this;
|
|
3681
|
-
return __generator(this, function (_a) {
|
|
3682
|
-
switch (_a.label) {
|
|
3683
|
-
case 0: return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3684
|
-
return __generator(this, function (_a) {
|
|
3685
|
-
switch (_a.label) {
|
|
3686
|
-
case 0: return [4 /*yield*/, connector(outgoing)];
|
|
3687
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
3688
|
-
}
|
|
3689
|
-
});
|
|
3690
|
-
}); }, {
|
|
3691
|
-
requestId: requestId,
|
|
3692
|
-
clientId: clientId,
|
|
3693
|
-
swarmName: swarmName,
|
|
3694
|
-
agentName: "",
|
|
3695
|
-
storageName: "",
|
|
3696
|
-
stateName: "",
|
|
3697
|
-
})];
|
|
3698
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
3699
|
-
}
|
|
3700
|
-
});
|
|
3701
|
-
}); });
|
|
3702
|
-
return function (incoming) {
|
|
3703
|
-
return ContextService.runInContext(function () {
|
|
3704
|
-
return receive(incoming);
|
|
3705
|
-
}, {
|
|
3706
|
-
requestId: requestId,
|
|
3707
|
-
clientId: clientId,
|
|
3708
|
-
swarmName: swarmName,
|
|
3709
|
-
agentName: "",
|
|
3710
|
-
storageName: "",
|
|
3711
|
-
stateName: "",
|
|
3712
|
-
});
|
|
3713
|
-
};
|
|
3714
|
-
}, {
|
|
3715
|
-
requestId: requestId,
|
|
3699
|
+
methodName: methodName,
|
|
3716
3700
|
clientId: clientId,
|
|
3717
3701
|
swarmName: swarmName,
|
|
3718
|
-
agentName: "",
|
|
3719
|
-
storageName: "",
|
|
3720
|
-
stateName: "",
|
|
3721
3702
|
});
|
|
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
|
+
}); };
|
|
3722
3722
|
};
|
|
3723
3723
|
/**
|
|
3724
3724
|
* Commits tool output to the session.
|
|
@@ -3728,19 +3728,19 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3728
3728
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3729
3729
|
* @returns {Promise<void>}
|
|
3730
3730
|
*/
|
|
3731
|
-
this.commitToolOutput = function (toolId, content,
|
|
3731
|
+
this.commitToolOutput = function (toolId, content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3732
3732
|
var _this = this;
|
|
3733
3733
|
return __generator(this, function (_a) {
|
|
3734
3734
|
switch (_a.label) {
|
|
3735
3735
|
case 0:
|
|
3736
3736
|
this.loggerService.log("sessionPublicService commitToolOutput", {
|
|
3737
|
-
|
|
3737
|
+
methodName: methodName,
|
|
3738
3738
|
toolId: toolId,
|
|
3739
3739
|
content: content,
|
|
3740
3740
|
clientId: clientId,
|
|
3741
3741
|
swarmName: swarmName,
|
|
3742
3742
|
});
|
|
3743
|
-
return [4 /*yield*/,
|
|
3743
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3744
3744
|
return __generator(this, function (_a) {
|
|
3745
3745
|
switch (_a.label) {
|
|
3746
3746
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitToolOutput(toolId, content)];
|
|
@@ -3748,7 +3748,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
});
|
|
3750
3750
|
}); }, {
|
|
3751
|
-
|
|
3751
|
+
methodName: methodName,
|
|
3752
3752
|
clientId: clientId,
|
|
3753
3753
|
swarmName: swarmName,
|
|
3754
3754
|
agentName: "",
|
|
@@ -3766,18 +3766,18 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3766
3766
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3767
3767
|
* @returns {Promise<void>}
|
|
3768
3768
|
*/
|
|
3769
|
-
this.commitSystemMessage = function (message,
|
|
3769
|
+
this.commitSystemMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3770
3770
|
var _this = this;
|
|
3771
3771
|
return __generator(this, function (_a) {
|
|
3772
3772
|
switch (_a.label) {
|
|
3773
3773
|
case 0:
|
|
3774
3774
|
this.loggerService.log("sessionPublicService commitSystemMessage", {
|
|
3775
|
-
|
|
3775
|
+
methodName: methodName,
|
|
3776
3776
|
message: message,
|
|
3777
3777
|
clientId: clientId,
|
|
3778
3778
|
swarmName: swarmName,
|
|
3779
3779
|
});
|
|
3780
|
-
return [4 /*yield*/,
|
|
3780
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3781
3781
|
return __generator(this, function (_a) {
|
|
3782
3782
|
switch (_a.label) {
|
|
3783
3783
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitSystemMessage(message)];
|
|
@@ -3785,7 +3785,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3785
3785
|
}
|
|
3786
3786
|
});
|
|
3787
3787
|
}); }, {
|
|
3788
|
-
|
|
3788
|
+
methodName: methodName,
|
|
3789
3789
|
clientId: clientId,
|
|
3790
3790
|
swarmName: swarmName,
|
|
3791
3791
|
agentName: "",
|
|
@@ -3803,18 +3803,18 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3803
3803
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3804
3804
|
* @returns {Promise<void>}
|
|
3805
3805
|
*/
|
|
3806
|
-
this.commitUserMessage = function (message,
|
|
3806
|
+
this.commitUserMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3807
3807
|
var _this = this;
|
|
3808
3808
|
return __generator(this, function (_a) {
|
|
3809
3809
|
switch (_a.label) {
|
|
3810
3810
|
case 0:
|
|
3811
3811
|
this.loggerService.log("sessionPublicService commitUserMessage", {
|
|
3812
|
-
|
|
3812
|
+
methodName: methodName,
|
|
3813
3813
|
message: message,
|
|
3814
3814
|
clientId: clientId,
|
|
3815
3815
|
swarmName: swarmName,
|
|
3816
3816
|
});
|
|
3817
|
-
return [4 /*yield*/,
|
|
3817
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3818
3818
|
return __generator(this, function (_a) {
|
|
3819
3819
|
switch (_a.label) {
|
|
3820
3820
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitUserMessage(message)];
|
|
@@ -3822,7 +3822,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3822
3822
|
}
|
|
3823
3823
|
});
|
|
3824
3824
|
}); }, {
|
|
3825
|
-
|
|
3825
|
+
methodName: methodName,
|
|
3826
3826
|
clientId: clientId,
|
|
3827
3827
|
swarmName: swarmName,
|
|
3828
3828
|
agentName: "",
|
|
@@ -3839,7 +3839,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3839
3839
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3840
3840
|
* @returns {Promise<void>}
|
|
3841
3841
|
*/
|
|
3842
|
-
this.commitFlush = function (
|
|
3842
|
+
this.commitFlush = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3843
3843
|
var _this = this;
|
|
3844
3844
|
return __generator(this, function (_a) {
|
|
3845
3845
|
switch (_a.label) {
|
|
@@ -3848,7 +3848,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3848
3848
|
clientId: clientId,
|
|
3849
3849
|
swarmName: swarmName,
|
|
3850
3850
|
});
|
|
3851
|
-
return [4 /*yield*/,
|
|
3851
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3852
3852
|
return __generator(this, function (_a) {
|
|
3853
3853
|
switch (_a.label) {
|
|
3854
3854
|
case 0: return [4 /*yield*/, this.sessionConnectionService.commitFlush()];
|
|
@@ -3856,7 +3856,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3856
3856
|
}
|
|
3857
3857
|
});
|
|
3858
3858
|
}); }, {
|
|
3859
|
-
|
|
3859
|
+
methodName: methodName,
|
|
3860
3860
|
clientId: clientId,
|
|
3861
3861
|
swarmName: swarmName,
|
|
3862
3862
|
agentName: "",
|
|
@@ -3873,17 +3873,17 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3873
3873
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3874
3874
|
* @returns {Promise<void>}
|
|
3875
3875
|
*/
|
|
3876
|
-
this.dispose = function (
|
|
3876
|
+
this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3877
3877
|
var _this = this;
|
|
3878
3878
|
return __generator(this, function (_a) {
|
|
3879
3879
|
switch (_a.label) {
|
|
3880
3880
|
case 0:
|
|
3881
3881
|
this.loggerService.log("sessionPublicService dispose", {
|
|
3882
|
-
|
|
3882
|
+
methodName: methodName,
|
|
3883
3883
|
clientId: clientId,
|
|
3884
3884
|
swarmName: swarmName,
|
|
3885
3885
|
});
|
|
3886
|
-
return [4 /*yield*/,
|
|
3886
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3887
3887
|
return __generator(this, function (_a) {
|
|
3888
3888
|
switch (_a.label) {
|
|
3889
3889
|
case 0: return [4 /*yield*/, this.sessionConnectionService.dispose()];
|
|
@@ -3891,7 +3891,7 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
3891
3891
|
}
|
|
3892
3892
|
});
|
|
3893
3893
|
}); }, {
|
|
3894
|
-
|
|
3894
|
+
methodName: methodName,
|
|
3895
3895
|
clientId: clientId,
|
|
3896
3896
|
swarmName: swarmName,
|
|
3897
3897
|
agentName: "",
|
|
@@ -3920,7 +3920,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3920
3920
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3921
3921
|
* @returns {Promise<void>}
|
|
3922
3922
|
*/
|
|
3923
|
-
this.cancelOutput = function (
|
|
3923
|
+
this.cancelOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3924
3924
|
var _this = this;
|
|
3925
3925
|
return __generator(this, function (_a) {
|
|
3926
3926
|
switch (_a.label) {
|
|
@@ -3929,7 +3929,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3929
3929
|
clientId: clientId,
|
|
3930
3930
|
swarmName: swarmName,
|
|
3931
3931
|
});
|
|
3932
|
-
return [4 /*yield*/,
|
|
3932
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3933
3933
|
return __generator(this, function (_a) {
|
|
3934
3934
|
switch (_a.label) {
|
|
3935
3935
|
case 0: return [4 /*yield*/, this.swarmConnectionService.cancelOutput()];
|
|
@@ -3937,7 +3937,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3937
3937
|
}
|
|
3938
3938
|
});
|
|
3939
3939
|
}); }, {
|
|
3940
|
-
|
|
3940
|
+
methodName: methodName,
|
|
3941
3941
|
clientId: clientId,
|
|
3942
3942
|
swarmName: swarmName,
|
|
3943
3943
|
agentName: "",
|
|
@@ -3954,17 +3954,17 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3954
3954
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3955
3955
|
* @returns {Promise<void>}
|
|
3956
3956
|
*/
|
|
3957
|
-
this.waitForOutput = function (
|
|
3957
|
+
this.waitForOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3958
3958
|
var _this = this;
|
|
3959
3959
|
return __generator(this, function (_a) {
|
|
3960
3960
|
switch (_a.label) {
|
|
3961
3961
|
case 0:
|
|
3962
3962
|
this.loggerService.log("swarmPublicService waitForOutput", {
|
|
3963
3963
|
clientId: clientId,
|
|
3964
|
-
|
|
3964
|
+
methodName: methodName,
|
|
3965
3965
|
swarmName: swarmName,
|
|
3966
3966
|
});
|
|
3967
|
-
return [4 /*yield*/,
|
|
3967
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3968
3968
|
return __generator(this, function (_a) {
|
|
3969
3969
|
switch (_a.label) {
|
|
3970
3970
|
case 0: return [4 /*yield*/, this.swarmConnectionService.waitForOutput()];
|
|
@@ -3972,7 +3972,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3972
3972
|
}
|
|
3973
3973
|
});
|
|
3974
3974
|
}); }, {
|
|
3975
|
-
|
|
3975
|
+
methodName: methodName,
|
|
3976
3976
|
clientId: clientId,
|
|
3977
3977
|
swarmName: swarmName,
|
|
3978
3978
|
agentName: "",
|
|
@@ -3989,7 +3989,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3989
3989
|
* @param {SwarmName} swarmName - The swarm name.
|
|
3990
3990
|
* @returns {Promise<string>}
|
|
3991
3991
|
*/
|
|
3992
|
-
this.getAgentName = function (
|
|
3992
|
+
this.getAgentName = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
3993
3993
|
var _this = this;
|
|
3994
3994
|
return __generator(this, function (_a) {
|
|
3995
3995
|
switch (_a.label) {
|
|
@@ -3997,9 +3997,9 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
3997
3997
|
this.loggerService.log("swarmPublicService getAgentName", {
|
|
3998
3998
|
clientId: clientId,
|
|
3999
3999
|
swarmName: swarmName,
|
|
4000
|
-
|
|
4000
|
+
methodName: methodName,
|
|
4001
4001
|
});
|
|
4002
|
-
return [4 /*yield*/,
|
|
4002
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4003
4003
|
return __generator(this, function (_a) {
|
|
4004
4004
|
switch (_a.label) {
|
|
4005
4005
|
case 0: return [4 /*yield*/, this.swarmConnectionService.getAgentName()];
|
|
@@ -4007,7 +4007,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4007
4007
|
}
|
|
4008
4008
|
});
|
|
4009
4009
|
}); }, {
|
|
4010
|
-
|
|
4010
|
+
methodName: methodName,
|
|
4011
4011
|
clientId: clientId,
|
|
4012
4012
|
swarmName: swarmName,
|
|
4013
4013
|
agentName: "",
|
|
@@ -4024,7 +4024,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4024
4024
|
* @param {SwarmName} swarmName - The swarm name.
|
|
4025
4025
|
* @returns {Promise<IAgent>}
|
|
4026
4026
|
*/
|
|
4027
|
-
this.getAgent = function (
|
|
4027
|
+
this.getAgent = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4028
4028
|
var _this = this;
|
|
4029
4029
|
return __generator(this, function (_a) {
|
|
4030
4030
|
switch (_a.label) {
|
|
@@ -4033,7 +4033,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4033
4033
|
clientId: clientId,
|
|
4034
4034
|
swarmName: swarmName,
|
|
4035
4035
|
});
|
|
4036
|
-
return [4 /*yield*/,
|
|
4036
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4037
4037
|
return __generator(this, function (_a) {
|
|
4038
4038
|
switch (_a.label) {
|
|
4039
4039
|
case 0: return [4 /*yield*/, this.swarmConnectionService.getAgent()];
|
|
@@ -4041,7 +4041,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4041
4041
|
}
|
|
4042
4042
|
});
|
|
4043
4043
|
}); }, {
|
|
4044
|
-
|
|
4044
|
+
methodName: methodName,
|
|
4045
4045
|
clientId: clientId,
|
|
4046
4046
|
swarmName: swarmName,
|
|
4047
4047
|
agentName: "",
|
|
@@ -4060,19 +4060,19 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4060
4060
|
* @param {IAgent} agent - The agent instance.
|
|
4061
4061
|
* @returns {Promise<void>}
|
|
4062
4062
|
*/
|
|
4063
|
-
this.setAgentRef = function (
|
|
4063
|
+
this.setAgentRef = function (methodName, clientId, swarmName, agentName, agent) { return __awaiter(_this, void 0, void 0, function () {
|
|
4064
4064
|
var _this = this;
|
|
4065
4065
|
return __generator(this, function (_a) {
|
|
4066
4066
|
switch (_a.label) {
|
|
4067
4067
|
case 0:
|
|
4068
4068
|
this.loggerService.log("swarmPublicService setAgentRef", {
|
|
4069
|
-
|
|
4069
|
+
methodName: methodName,
|
|
4070
4070
|
agentName: agentName,
|
|
4071
4071
|
agent: agent,
|
|
4072
4072
|
clientId: clientId,
|
|
4073
4073
|
swarmName: swarmName,
|
|
4074
4074
|
});
|
|
4075
|
-
return [4 /*yield*/,
|
|
4075
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4076
4076
|
return __generator(this, function (_a) {
|
|
4077
4077
|
switch (_a.label) {
|
|
4078
4078
|
case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentRef(agentName, agent)];
|
|
@@ -4080,7 +4080,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4080
4080
|
}
|
|
4081
4081
|
});
|
|
4082
4082
|
}); }, {
|
|
4083
|
-
|
|
4083
|
+
methodName: methodName,
|
|
4084
4084
|
clientId: clientId,
|
|
4085
4085
|
swarmName: swarmName,
|
|
4086
4086
|
agentName: "",
|
|
@@ -4098,18 +4098,18 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4098
4098
|
* @param {SwarmName} swarmName - The swarm name.
|
|
4099
4099
|
* @returns {Promise<void>}
|
|
4100
4100
|
*/
|
|
4101
|
-
this.setAgentName = function (agentName,
|
|
4101
|
+
this.setAgentName = function (agentName, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4102
4102
|
var _this = this;
|
|
4103
4103
|
return __generator(this, function (_a) {
|
|
4104
4104
|
switch (_a.label) {
|
|
4105
4105
|
case 0:
|
|
4106
4106
|
this.loggerService.log("swarmPublicService setAgentName", {
|
|
4107
|
-
|
|
4107
|
+
methodName: methodName,
|
|
4108
4108
|
agentName: agentName,
|
|
4109
4109
|
clientId: clientId,
|
|
4110
4110
|
swarmName: swarmName,
|
|
4111
4111
|
});
|
|
4112
|
-
return [4 /*yield*/,
|
|
4112
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4113
4113
|
return __generator(this, function (_a) {
|
|
4114
4114
|
switch (_a.label) {
|
|
4115
4115
|
case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentName(agentName)];
|
|
@@ -4117,7 +4117,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4117
4117
|
}
|
|
4118
4118
|
});
|
|
4119
4119
|
}); }, {
|
|
4120
|
-
|
|
4120
|
+
methodName: methodName,
|
|
4121
4121
|
clientId: clientId,
|
|
4122
4122
|
swarmName: swarmName,
|
|
4123
4123
|
agentName: "",
|
|
@@ -4134,17 +4134,17 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4134
4134
|
* @param {SwarmName} swarmName - The swarm name.
|
|
4135
4135
|
* @returns {Promise<void>}
|
|
4136
4136
|
*/
|
|
4137
|
-
this.dispose = function (
|
|
4137
|
+
this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4138
4138
|
var _this = this;
|
|
4139
4139
|
return __generator(this, function (_a) {
|
|
4140
4140
|
switch (_a.label) {
|
|
4141
4141
|
case 0:
|
|
4142
4142
|
this.loggerService.log("swarmPublicService dispose", {
|
|
4143
|
-
|
|
4143
|
+
methodName: methodName,
|
|
4144
4144
|
clientId: clientId,
|
|
4145
4145
|
swarmName: swarmName,
|
|
4146
4146
|
});
|
|
4147
|
-
return [4 /*yield*/,
|
|
4147
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4148
4148
|
return __generator(this, function (_a) {
|
|
4149
4149
|
switch (_a.label) {
|
|
4150
4150
|
case 0: return [4 /*yield*/, this.swarmConnectionService.dispose()];
|
|
@@ -4152,7 +4152,7 @@ var SwarmPublicService = /** @class */ (function () {
|
|
|
4152
4152
|
}
|
|
4153
4153
|
});
|
|
4154
4154
|
}); }, {
|
|
4155
|
-
|
|
4155
|
+
methodName: methodName,
|
|
4156
4156
|
clientId: clientId,
|
|
4157
4157
|
swarmName: swarmName,
|
|
4158
4158
|
agentName: "",
|
|
@@ -5194,7 +5194,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5194
5194
|
var _this = this;
|
|
5195
5195
|
this.loggerService = inject(TYPES.loggerService);
|
|
5196
5196
|
this.busService = inject(TYPES.busService);
|
|
5197
|
-
this.
|
|
5197
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
5198
5198
|
this.storageSchemaService = inject(TYPES.storageSchemaService);
|
|
5199
5199
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5200
5200
|
this.embeddingSchemaService = inject(TYPES.embeddingSchemaService);
|
|
@@ -5249,7 +5249,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5249
5249
|
total: total,
|
|
5250
5250
|
score: score,
|
|
5251
5251
|
});
|
|
5252
|
-
storage = this.getStorage(this.
|
|
5252
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5253
5253
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5254
5254
|
case 1:
|
|
5255
5255
|
_a.sent();
|
|
@@ -5271,7 +5271,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5271
5271
|
this.loggerService.log("storageConnectionService upsert", {
|
|
5272
5272
|
item: item,
|
|
5273
5273
|
});
|
|
5274
|
-
storage = this.getStorage(this.
|
|
5274
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5275
5275
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5276
5276
|
case 1:
|
|
5277
5277
|
_a.sent();
|
|
@@ -5293,7 +5293,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5293
5293
|
this.loggerService.log("storageConnectionService remove", {
|
|
5294
5294
|
itemId: itemId,
|
|
5295
5295
|
});
|
|
5296
|
-
storage = this.getStorage(this.
|
|
5296
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5297
5297
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5298
5298
|
case 1:
|
|
5299
5299
|
_a.sent();
|
|
@@ -5315,7 +5315,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5315
5315
|
this.loggerService.log("storageConnectionService get", {
|
|
5316
5316
|
itemId: itemId,
|
|
5317
5317
|
});
|
|
5318
|
-
storage = this.getStorage(this.
|
|
5318
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5319
5319
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5320
5320
|
case 1:
|
|
5321
5321
|
_a.sent();
|
|
@@ -5335,7 +5335,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5335
5335
|
switch (_a.label) {
|
|
5336
5336
|
case 0:
|
|
5337
5337
|
this.loggerService.log("storageConnectionService list");
|
|
5338
|
-
storage = this.getStorage(this.
|
|
5338
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5339
5339
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5340
5340
|
case 1:
|
|
5341
5341
|
_a.sent();
|
|
@@ -5354,7 +5354,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5354
5354
|
switch (_a.label) {
|
|
5355
5355
|
case 0:
|
|
5356
5356
|
this.loggerService.log("storageConnectionService clear");
|
|
5357
|
-
storage = this.getStorage(this.
|
|
5357
|
+
storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5358
5358
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5359
5359
|
case 1:
|
|
5360
5360
|
_a.sent();
|
|
@@ -5373,12 +5373,12 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5373
5373
|
switch (_a.label) {
|
|
5374
5374
|
case 0:
|
|
5375
5375
|
this.loggerService.log("storageConnectionService dispose");
|
|
5376
|
-
key = "".concat(this.
|
|
5376
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.storageName);
|
|
5377
5377
|
if (!this.getStorage.has(key)) {
|
|
5378
5378
|
return [2 /*return*/];
|
|
5379
5379
|
}
|
|
5380
|
-
if (!!this.getSharedStorage.has(this.
|
|
5381
|
-
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);
|
|
5382
5382
|
return [4 /*yield*/, storage.waitForInit()];
|
|
5383
5383
|
case 1:
|
|
5384
5384
|
_a.sent();
|
|
@@ -5388,7 +5388,7 @@ var StorageConnectionService = /** @class */ (function () {
|
|
|
5388
5388
|
_a.label = 3;
|
|
5389
5389
|
case 3:
|
|
5390
5390
|
this.getStorage.clear(key);
|
|
5391
|
-
this.sessionValidationService.removeStorageUsage(this.
|
|
5391
|
+
this.sessionValidationService.removeStorageUsage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
|
|
5392
5392
|
return [2 /*return*/];
|
|
5393
5393
|
}
|
|
5394
5394
|
});
|
|
@@ -5411,20 +5411,20 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5411
5411
|
* @param {number} total - The total number of items to retrieve.
|
|
5412
5412
|
* @returns {Promise<IStorageData[]>} The list of storage data.
|
|
5413
5413
|
*/
|
|
5414
|
-
this.take = function (search, total,
|
|
5414
|
+
this.take = function (search, total, methodName, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
|
|
5415
5415
|
var _this = this;
|
|
5416
5416
|
return __generator(this, function (_a) {
|
|
5417
5417
|
switch (_a.label) {
|
|
5418
5418
|
case 0:
|
|
5419
5419
|
this.loggerService.log("storagePublicService take", {
|
|
5420
|
-
|
|
5420
|
+
methodName: methodName,
|
|
5421
5421
|
search: search,
|
|
5422
5422
|
total: total,
|
|
5423
5423
|
clientId: clientId,
|
|
5424
5424
|
storageName: storageName,
|
|
5425
5425
|
score: score,
|
|
5426
5426
|
});
|
|
5427
|
-
return [4 /*yield*/,
|
|
5427
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5428
5428
|
return __generator(this, function (_a) {
|
|
5429
5429
|
switch (_a.label) {
|
|
5430
5430
|
case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
|
|
@@ -5432,7 +5432,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5432
5432
|
}
|
|
5433
5433
|
});
|
|
5434
5434
|
}); }, {
|
|
5435
|
-
|
|
5435
|
+
methodName: methodName,
|
|
5436
5436
|
clientId: clientId,
|
|
5437
5437
|
storageName: storageName,
|
|
5438
5438
|
agentName: "",
|
|
@@ -5448,7 +5448,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5448
5448
|
* @param {IStorageData} item - The item to upsert.
|
|
5449
5449
|
* @returns {Promise<void>}
|
|
5450
5450
|
*/
|
|
5451
|
-
this.upsert = function (item,
|
|
5451
|
+
this.upsert = function (item, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5452
5452
|
var _this = this;
|
|
5453
5453
|
return __generator(this, function (_a) {
|
|
5454
5454
|
switch (_a.label) {
|
|
@@ -5458,7 +5458,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5458
5458
|
clientId: clientId,
|
|
5459
5459
|
storageName: storageName,
|
|
5460
5460
|
});
|
|
5461
|
-
return [4 /*yield*/,
|
|
5461
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5462
5462
|
return __generator(this, function (_a) {
|
|
5463
5463
|
switch (_a.label) {
|
|
5464
5464
|
case 0: return [4 /*yield*/, this.storageConnectionService.upsert(item)];
|
|
@@ -5466,7 +5466,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5466
5466
|
}
|
|
5467
5467
|
});
|
|
5468
5468
|
}); }, {
|
|
5469
|
-
|
|
5469
|
+
methodName: methodName,
|
|
5470
5470
|
clientId: clientId,
|
|
5471
5471
|
storageName: storageName,
|
|
5472
5472
|
agentName: "",
|
|
@@ -5482,7 +5482,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5482
5482
|
* @param {IStorageData["id"]} itemId - The ID of the item to remove.
|
|
5483
5483
|
* @returns {Promise<void>}
|
|
5484
5484
|
*/
|
|
5485
|
-
this.remove = function (itemId,
|
|
5485
|
+
this.remove = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5486
5486
|
var _this = this;
|
|
5487
5487
|
return __generator(this, function (_a) {
|
|
5488
5488
|
switch (_a.label) {
|
|
@@ -5492,7 +5492,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5492
5492
|
clientId: clientId,
|
|
5493
5493
|
storageName: storageName,
|
|
5494
5494
|
});
|
|
5495
|
-
return [4 /*yield*/,
|
|
5495
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5496
5496
|
return __generator(this, function (_a) {
|
|
5497
5497
|
switch (_a.label) {
|
|
5498
5498
|
case 0: return [4 /*yield*/, this.storageConnectionService.remove(itemId)];
|
|
@@ -5500,7 +5500,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5500
5500
|
}
|
|
5501
5501
|
});
|
|
5502
5502
|
}); }, {
|
|
5503
|
-
|
|
5503
|
+
methodName: methodName,
|
|
5504
5504
|
clientId: clientId,
|
|
5505
5505
|
storageName: storageName,
|
|
5506
5506
|
agentName: "",
|
|
@@ -5516,18 +5516,18 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5516
5516
|
* @param {IStorageData["id"]} itemId - The ID of the item to retrieve.
|
|
5517
5517
|
* @returns {Promise<IStorageData>} The retrieved item.
|
|
5518
5518
|
*/
|
|
5519
|
-
this.get = function (itemId,
|
|
5519
|
+
this.get = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5520
5520
|
var _this = this;
|
|
5521
5521
|
return __generator(this, function (_a) {
|
|
5522
5522
|
switch (_a.label) {
|
|
5523
5523
|
case 0:
|
|
5524
5524
|
this.loggerService.log("storagePublicService get", {
|
|
5525
|
-
|
|
5525
|
+
methodName: methodName,
|
|
5526
5526
|
itemId: itemId,
|
|
5527
5527
|
clientId: clientId,
|
|
5528
5528
|
storageName: storageName,
|
|
5529
5529
|
});
|
|
5530
|
-
return [4 /*yield*/,
|
|
5530
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5531
5531
|
return __generator(this, function (_a) {
|
|
5532
5532
|
switch (_a.label) {
|
|
5533
5533
|
case 0: return [4 /*yield*/, this.storageConnectionService.get(itemId)];
|
|
@@ -5535,7 +5535,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5535
5535
|
}
|
|
5536
5536
|
});
|
|
5537
5537
|
}); }, {
|
|
5538
|
-
|
|
5538
|
+
methodName: methodName,
|
|
5539
5539
|
clientId: clientId,
|
|
5540
5540
|
storageName: storageName,
|
|
5541
5541
|
agentName: "",
|
|
@@ -5551,17 +5551,17 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5551
5551
|
* @param {function(IStorageData): boolean} [filter] - The optional filter function.
|
|
5552
5552
|
* @returns {Promise<IStorageData[]>} The list of items.
|
|
5553
5553
|
*/
|
|
5554
|
-
this.list = function (
|
|
5554
|
+
this.list = function (methodName, clientId, storageName, filter) { return __awaiter(_this, void 0, void 0, function () {
|
|
5555
5555
|
var _this = this;
|
|
5556
5556
|
return __generator(this, function (_a) {
|
|
5557
5557
|
switch (_a.label) {
|
|
5558
5558
|
case 0:
|
|
5559
5559
|
this.loggerService.log("storagePublicService list", {
|
|
5560
|
-
|
|
5560
|
+
methodName: methodName,
|
|
5561
5561
|
clientId: clientId,
|
|
5562
5562
|
storageName: storageName,
|
|
5563
5563
|
});
|
|
5564
|
-
return [4 /*yield*/,
|
|
5564
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5565
5565
|
return __generator(this, function (_a) {
|
|
5566
5566
|
switch (_a.label) {
|
|
5567
5567
|
case 0: return [4 /*yield*/, this.storageConnectionService.list(filter)];
|
|
@@ -5569,7 +5569,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5569
5569
|
}
|
|
5570
5570
|
});
|
|
5571
5571
|
}); }, {
|
|
5572
|
-
|
|
5572
|
+
methodName: methodName,
|
|
5573
5573
|
clientId: clientId,
|
|
5574
5574
|
storageName: storageName,
|
|
5575
5575
|
agentName: "",
|
|
@@ -5584,17 +5584,17 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5584
5584
|
* Clears all items from the storage.
|
|
5585
5585
|
* @returns {Promise<void>}
|
|
5586
5586
|
*/
|
|
5587
|
-
this.clear = function (
|
|
5587
|
+
this.clear = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5588
5588
|
var _this = this;
|
|
5589
5589
|
return __generator(this, function (_a) {
|
|
5590
5590
|
switch (_a.label) {
|
|
5591
5591
|
case 0:
|
|
5592
5592
|
this.loggerService.log("storagePublicService clear", {
|
|
5593
|
-
|
|
5593
|
+
methodName: methodName,
|
|
5594
5594
|
clientId: clientId,
|
|
5595
5595
|
storageName: storageName,
|
|
5596
5596
|
});
|
|
5597
|
-
return [4 /*yield*/,
|
|
5597
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5598
5598
|
return __generator(this, function (_a) {
|
|
5599
5599
|
switch (_a.label) {
|
|
5600
5600
|
case 0: return [4 /*yield*/, this.storageConnectionService.clear()];
|
|
@@ -5602,7 +5602,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5602
5602
|
}
|
|
5603
5603
|
});
|
|
5604
5604
|
}); }, {
|
|
5605
|
-
|
|
5605
|
+
methodName: methodName,
|
|
5606
5606
|
clientId: clientId,
|
|
5607
5607
|
storageName: storageName,
|
|
5608
5608
|
agentName: "",
|
|
@@ -5619,7 +5619,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5619
5619
|
* @param {StorageName} storageName - The storage name.
|
|
5620
5620
|
* @returns {Promise<void>}
|
|
5621
5621
|
*/
|
|
5622
|
-
this.dispose = function (
|
|
5622
|
+
this.dispose = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5623
5623
|
var _this = this;
|
|
5624
5624
|
return __generator(this, function (_a) {
|
|
5625
5625
|
switch (_a.label) {
|
|
@@ -5628,7 +5628,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5628
5628
|
clientId: clientId,
|
|
5629
5629
|
storageName: storageName,
|
|
5630
5630
|
});
|
|
5631
|
-
return [4 /*yield*/,
|
|
5631
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5632
5632
|
return __generator(this, function (_a) {
|
|
5633
5633
|
switch (_a.label) {
|
|
5634
5634
|
case 0: return [4 /*yield*/, this.storageConnectionService.dispose()];
|
|
@@ -5636,7 +5636,7 @@ var StoragePublicService = /** @class */ (function () {
|
|
|
5636
5636
|
}
|
|
5637
5637
|
});
|
|
5638
5638
|
}); }, {
|
|
5639
|
-
|
|
5639
|
+
methodName: methodName,
|
|
5640
5640
|
clientId: clientId,
|
|
5641
5641
|
storageName: storageName,
|
|
5642
5642
|
agentName: "",
|
|
@@ -5974,7 +5974,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
5974
5974
|
var _this = this;
|
|
5975
5975
|
this.loggerService = inject(TYPES.loggerService);
|
|
5976
5976
|
this.busService = inject(TYPES.busService);
|
|
5977
|
-
this.
|
|
5977
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
5978
5978
|
this.stateSchemaService = inject(TYPES.stateSchemaService);
|
|
5979
5979
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5980
5980
|
/**
|
|
@@ -6066,7 +6066,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6066
6066
|
switch (_a.label) {
|
|
6067
6067
|
case 0:
|
|
6068
6068
|
this.loggerService.log("stateConnectionService setState");
|
|
6069
|
-
state = this.getStateRef(this.
|
|
6069
|
+
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6070
6070
|
return [4 /*yield*/, state.waitForInit()];
|
|
6071
6071
|
case 1:
|
|
6072
6072
|
_a.sent();
|
|
@@ -6085,7 +6085,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6085
6085
|
switch (_a.label) {
|
|
6086
6086
|
case 0:
|
|
6087
6087
|
this.loggerService.log("stateConnectionService getState");
|
|
6088
|
-
state = this.getStateRef(this.
|
|
6088
|
+
state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6089
6089
|
return [4 /*yield*/, state.waitForInit()];
|
|
6090
6090
|
case 1:
|
|
6091
6091
|
_a.sent();
|
|
@@ -6104,12 +6104,12 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6104
6104
|
switch (_a.label) {
|
|
6105
6105
|
case 0:
|
|
6106
6106
|
this.loggerService.log("stateConnectionService dispose");
|
|
6107
|
-
key = "".concat(this.
|
|
6107
|
+
key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.stateName);
|
|
6108
6108
|
if (!this.getStateRef.has(key)) {
|
|
6109
6109
|
return [2 /*return*/];
|
|
6110
6110
|
}
|
|
6111
|
-
if (!!this.getSharedStateRef.has(this.
|
|
6112
|
-
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);
|
|
6113
6113
|
return [4 /*yield*/, state.waitForInit()];
|
|
6114
6114
|
case 1:
|
|
6115
6115
|
_a.sent();
|
|
@@ -6119,7 +6119,7 @@ var StateConnectionService = /** @class */ (function () {
|
|
|
6119
6119
|
_a.label = 3;
|
|
6120
6120
|
case 3:
|
|
6121
6121
|
this.getStateRef.clear(key);
|
|
6122
|
-
this.sessionValidationService.removeStateUsage(this.
|
|
6122
|
+
this.sessionValidationService.removeStateUsage(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
|
|
6123
6123
|
return [2 /*return*/];
|
|
6124
6124
|
}
|
|
6125
6125
|
});
|
|
@@ -6140,17 +6140,17 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6140
6140
|
* @param {StateName} stateName - The name of the state.
|
|
6141
6141
|
* @returns {Promise<T>} - The updated state.
|
|
6142
6142
|
*/
|
|
6143
|
-
this.setState = function (dispatchFn,
|
|
6143
|
+
this.setState = function (dispatchFn, methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6144
6144
|
var _this = this;
|
|
6145
6145
|
return __generator(this, function (_a) {
|
|
6146
6146
|
switch (_a.label) {
|
|
6147
6147
|
case 0:
|
|
6148
6148
|
this.loggerService.log("statePublicService setState", {
|
|
6149
|
-
|
|
6149
|
+
methodName: methodName,
|
|
6150
6150
|
clientId: clientId,
|
|
6151
6151
|
stateName: stateName,
|
|
6152
6152
|
});
|
|
6153
|
-
return [4 /*yield*/,
|
|
6153
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6154
6154
|
return __generator(this, function (_a) {
|
|
6155
6155
|
switch (_a.label) {
|
|
6156
6156
|
case 0: return [4 /*yield*/, this.stateConnectionService.setState(dispatchFn)];
|
|
@@ -6158,7 +6158,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6158
6158
|
}
|
|
6159
6159
|
});
|
|
6160
6160
|
}); }, {
|
|
6161
|
-
|
|
6161
|
+
methodName: methodName,
|
|
6162
6162
|
clientId: clientId,
|
|
6163
6163
|
stateName: stateName,
|
|
6164
6164
|
agentName: "",
|
|
@@ -6175,7 +6175,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6175
6175
|
* @param {StateName} stateName - The name of the state.
|
|
6176
6176
|
* @returns {Promise<T>} - The current state.
|
|
6177
6177
|
*/
|
|
6178
|
-
this.getState = function (
|
|
6178
|
+
this.getState = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6179
6179
|
var _this = this;
|
|
6180
6180
|
return __generator(this, function (_a) {
|
|
6181
6181
|
switch (_a.label) {
|
|
@@ -6184,7 +6184,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6184
6184
|
clientId: clientId,
|
|
6185
6185
|
stateName: stateName,
|
|
6186
6186
|
});
|
|
6187
|
-
return [4 /*yield*/,
|
|
6187
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6188
6188
|
return __generator(this, function (_a) {
|
|
6189
6189
|
switch (_a.label) {
|
|
6190
6190
|
case 0: return [4 /*yield*/, this.stateConnectionService.getState()];
|
|
@@ -6192,7 +6192,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6192
6192
|
}
|
|
6193
6193
|
});
|
|
6194
6194
|
}); }, {
|
|
6195
|
-
|
|
6195
|
+
methodName: methodName,
|
|
6196
6196
|
clientId: clientId,
|
|
6197
6197
|
stateName: stateName,
|
|
6198
6198
|
agentName: "",
|
|
@@ -6209,17 +6209,17 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6209
6209
|
* @param {StateName} stateName - The name of the state.
|
|
6210
6210
|
* @returns {Promise<void>} - A promise that resolves when the state is disposed.
|
|
6211
6211
|
*/
|
|
6212
|
-
this.dispose = function (
|
|
6212
|
+
this.dispose = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
6213
6213
|
var _this = this;
|
|
6214
6214
|
return __generator(this, function (_a) {
|
|
6215
6215
|
switch (_a.label) {
|
|
6216
6216
|
case 0:
|
|
6217
6217
|
this.loggerService.log("statePublicService dispose", {
|
|
6218
|
-
|
|
6218
|
+
methodName: methodName,
|
|
6219
6219
|
clientId: clientId,
|
|
6220
6220
|
stateName: stateName,
|
|
6221
6221
|
});
|
|
6222
|
-
return [4 /*yield*/,
|
|
6222
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
6223
6223
|
return __generator(this, function (_a) {
|
|
6224
6224
|
switch (_a.label) {
|
|
6225
6225
|
case 0: return [4 /*yield*/, this.stateConnectionService.dispose()];
|
|
@@ -6227,7 +6227,7 @@ var StatePublicService = /** @class */ (function () {
|
|
|
6227
6227
|
}
|
|
6228
6228
|
});
|
|
6229
6229
|
}); }, {
|
|
6230
|
-
|
|
6230
|
+
methodName: methodName,
|
|
6231
6231
|
clientId: clientId,
|
|
6232
6232
|
stateName: stateName,
|
|
6233
6233
|
agentName: "",
|
|
@@ -6355,7 +6355,10 @@ var BusService = /** @class */ (function () {
|
|
|
6355
6355
|
{
|
|
6356
6356
|
provide(TYPES.busService, function () { return new BusService(); });
|
|
6357
6357
|
provide(TYPES.loggerService, function () { return new LoggerService(); });
|
|
6358
|
-
|
|
6358
|
+
}
|
|
6359
|
+
{
|
|
6360
|
+
provide(TYPES.methodContextService, function () { return new MethodContextService(); });
|
|
6361
|
+
provide(TYPES.executionContextService, function () { return new ExecutionContextService(); });
|
|
6359
6362
|
}
|
|
6360
6363
|
{
|
|
6361
6364
|
provide(TYPES.agentConnectionService, function () { return new AgentConnectionService(); });
|
|
@@ -6401,7 +6404,10 @@ var BusService = /** @class */ (function () {
|
|
|
6401
6404
|
var baseServices = {
|
|
6402
6405
|
busService: inject(TYPES.busService),
|
|
6403
6406
|
loggerService: inject(TYPES.loggerService),
|
|
6404
|
-
|
|
6407
|
+
};
|
|
6408
|
+
var contextServices = {
|
|
6409
|
+
methodContextService: inject(TYPES.methodContextService),
|
|
6410
|
+
executionContextService: inject(TYPES.executionContextService),
|
|
6405
6411
|
};
|
|
6406
6412
|
var connectionServices = {
|
|
6407
6413
|
agentConnectionService: inject(TYPES.agentConnectionService),
|
|
@@ -6437,7 +6443,7 @@ var validationServices = {
|
|
|
6437
6443
|
storageValidationService: inject(TYPES.storageValidationService),
|
|
6438
6444
|
embeddingValidationService: inject(TYPES.embeddingValidationService),
|
|
6439
6445
|
};
|
|
6440
|
-
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);
|
|
6441
6447
|
init();
|
|
6442
6448
|
|
|
6443
6449
|
/**
|
|
@@ -6565,22 +6571,21 @@ var addStorage = function (storageSchema) {
|
|
|
6565
6571
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
6566
6572
|
*/
|
|
6567
6573
|
var commitUserMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6568
|
-
var
|
|
6574
|
+
var methodName, swarmName, currentAgentName;
|
|
6569
6575
|
return __generator(this, function (_a) {
|
|
6570
6576
|
switch (_a.label) {
|
|
6571
6577
|
case 0:
|
|
6572
|
-
|
|
6578
|
+
methodName = 'function commitSystemMessage';
|
|
6573
6579
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
6574
6580
|
content: content,
|
|
6575
6581
|
clientId: clientId,
|
|
6576
6582
|
agentName: agentName,
|
|
6577
|
-
requestId: requestId,
|
|
6578
6583
|
});
|
|
6579
6584
|
swarm.agentValidationService.validate(agentName, "commitUserMessage");
|
|
6580
6585
|
swarm.sessionValidationService.validate(clientId, "commitUserMessage");
|
|
6581
6586
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6582
6587
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessage");
|
|
6583
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6588
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6584
6589
|
case 1:
|
|
6585
6590
|
currentAgentName = _a.sent();
|
|
6586
6591
|
if (currentAgentName !== agentName) {
|
|
@@ -6591,7 +6596,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6591
6596
|
});
|
|
6592
6597
|
return [2 /*return*/];
|
|
6593
6598
|
}
|
|
6594
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content,
|
|
6599
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
6595
6600
|
case 2:
|
|
6596
6601
|
_a.sent();
|
|
6597
6602
|
return [2 /*return*/];
|
|
@@ -6607,19 +6612,18 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6607
6612
|
* @throws Will throw an error if the client ID is invalid or if the swarm validation fails.
|
|
6608
6613
|
*/
|
|
6609
6614
|
var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6610
|
-
var
|
|
6615
|
+
var methodName, swarmName;
|
|
6611
6616
|
return __generator(this, function (_a) {
|
|
6612
6617
|
switch (_a.label) {
|
|
6613
6618
|
case 0:
|
|
6614
|
-
|
|
6619
|
+
methodName = "function getAgentName";
|
|
6615
6620
|
swarm.loggerService.log("function getAgentName", {
|
|
6616
6621
|
clientId: clientId,
|
|
6617
|
-
requestId: requestId,
|
|
6618
6622
|
});
|
|
6619
6623
|
swarm.sessionValidationService.validate(clientId, "getAgentName");
|
|
6620
6624
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6621
6625
|
swarm.swarmValidationService.validate(swarmName, "getAgentName");
|
|
6622
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6626
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6623
6627
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6624
6628
|
}
|
|
6625
6629
|
});
|
|
@@ -6635,15 +6639,14 @@ var SCHEDULED_DELAY$1 = 1000;
|
|
|
6635
6639
|
* @returns {SendMessageFn} - A function to send messages to the swarm.
|
|
6636
6640
|
*/
|
|
6637
6641
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
6638
|
-
var
|
|
6642
|
+
var methodName = "function makeConnection";
|
|
6639
6643
|
swarm.loggerService.log("function makeConnection", {
|
|
6640
6644
|
clientId: clientId,
|
|
6641
6645
|
swarmName: swarmName,
|
|
6642
|
-
requestId: requestId,
|
|
6643
6646
|
});
|
|
6644
6647
|
swarm.swarmValidationService.validate(swarmName, "makeConnection");
|
|
6645
6648
|
swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
6646
|
-
var send = swarm.sessionPublicService.connect(connector,
|
|
6649
|
+
var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
|
|
6647
6650
|
return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6648
6651
|
var _a;
|
|
6649
6652
|
var _b;
|
|
@@ -6655,7 +6658,7 @@ var makeConnection = function (connector, clientId, swarmName) {
|
|
|
6655
6658
|
_b = {
|
|
6656
6659
|
data: outgoing
|
|
6657
6660
|
};
|
|
6658
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
6661
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
6659
6662
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
|
|
6660
6663
|
_b.clientId = clientId,
|
|
6661
6664
|
_b)])];
|
|
@@ -6758,7 +6761,7 @@ var CHANGE_AGENT_GC = 60 * 1000;
|
|
|
6758
6761
|
* @returns {TChangeAgentRun} - The change agent function.
|
|
6759
6762
|
*/
|
|
6760
6763
|
var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
6761
|
-
return functoolsKit.queued(function (
|
|
6764
|
+
return functoolsKit.queued(function (methodName, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6762
6765
|
var swarmName, _a, _b, _c;
|
|
6763
6766
|
return __generator(this, function (_d) {
|
|
6764
6767
|
switch (_d.label) {
|
|
@@ -6771,7 +6774,7 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
6771
6774
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6772
6775
|
return __generator(this, function (_a) {
|
|
6773
6776
|
switch (_a.label) {
|
|
6774
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(
|
|
6777
|
+
case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
|
|
6775
6778
|
case 1:
|
|
6776
6779
|
_a.sent();
|
|
6777
6780
|
return [2 /*return*/];
|
|
@@ -6780,22 +6783,22 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
6780
6783
|
}); }))];
|
|
6781
6784
|
case 1:
|
|
6782
6785
|
_d.sent();
|
|
6783
|
-
return [4 /*yield*/, swarm.agentPublicService.dispose(
|
|
6786
|
+
return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
6784
6787
|
case 2:
|
|
6785
6788
|
_d.sent();
|
|
6786
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(
|
|
6789
|
+
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
6787
6790
|
case 3:
|
|
6788
6791
|
_d.sent();
|
|
6789
6792
|
_b = (_a = swarm.swarmPublicService).setAgentRef;
|
|
6790
|
-
_c = [
|
|
6793
|
+
_c = [methodName,
|
|
6791
6794
|
clientId,
|
|
6792
6795
|
swarmName,
|
|
6793
6796
|
agentName];
|
|
6794
|
-
return [4 /*yield*/, swarm.agentPublicService.createAgentRef(
|
|
6797
|
+
return [4 /*yield*/, swarm.agentPublicService.createAgentRef(methodName, clientId, agentName)];
|
|
6795
6798
|
case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
|
|
6796
6799
|
case 5:
|
|
6797
6800
|
_d.sent();
|
|
6798
|
-
return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName,
|
|
6801
|
+
return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
|
|
6799
6802
|
case 6:
|
|
6800
6803
|
_d.sent();
|
|
6801
6804
|
return [2 /*return*/];
|
|
@@ -6829,11 +6832,11 @@ var createGc$1 = functoolsKit.singleshot(function () { return __awaiter(void 0,
|
|
|
6829
6832
|
* @returns {Promise<void>} - A promise that resolves when the agent is changed.
|
|
6830
6833
|
*/
|
|
6831
6834
|
var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6832
|
-
var
|
|
6835
|
+
var methodName, run;
|
|
6833
6836
|
return __generator(this, function (_a) {
|
|
6834
6837
|
switch (_a.label) {
|
|
6835
6838
|
case 0:
|
|
6836
|
-
|
|
6839
|
+
methodName = "function changeAgent";
|
|
6837
6840
|
swarm.loggerService.log("function changeAgent", {
|
|
6838
6841
|
agentName: agentName,
|
|
6839
6842
|
clientId: clientId,
|
|
@@ -6842,7 +6845,7 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
|
|
|
6842
6845
|
case 1:
|
|
6843
6846
|
run = _a.sent();
|
|
6844
6847
|
createGc$1();
|
|
6845
|
-
return [4 /*yield*/, run(
|
|
6848
|
+
return [4 /*yield*/, run(methodName, agentName)];
|
|
6846
6849
|
case 2: return [2 /*return*/, _a.sent()];
|
|
6847
6850
|
}
|
|
6848
6851
|
});
|
|
@@ -6860,23 +6863,22 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6860
6863
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
6861
6864
|
args_1[_i - 2] = arguments[_i];
|
|
6862
6865
|
}
|
|
6863
|
-
return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName,
|
|
6864
|
-
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"; }
|
|
6865
6868
|
return __generator(this, function (_a) {
|
|
6866
6869
|
switch (_a.label) {
|
|
6867
6870
|
case 0:
|
|
6868
6871
|
swarm.loggerService.log("function disposeConnection", {
|
|
6869
6872
|
clientId: clientId,
|
|
6870
6873
|
swarmName: swarmName,
|
|
6871
|
-
requestId: requestId,
|
|
6872
6874
|
});
|
|
6873
6875
|
swarm.swarmValidationService.validate(swarmName, "disposeConnection");
|
|
6874
6876
|
swarm.sessionValidationService.removeSession(clientId);
|
|
6875
6877
|
swarm.busService.dispose(clientId);
|
|
6876
|
-
return [4 /*yield*/, swarm.sessionPublicService.dispose(
|
|
6878
|
+
return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
|
|
6877
6879
|
case 1:
|
|
6878
6880
|
_a.sent();
|
|
6879
|
-
return [4 /*yield*/, swarm.swarmPublicService.dispose(
|
|
6881
|
+
return [4 /*yield*/, swarm.swarmPublicService.dispose(methodName, clientId, swarmName)];
|
|
6880
6882
|
case 2:
|
|
6881
6883
|
_a.sent();
|
|
6882
6884
|
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
@@ -6884,10 +6886,10 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6884
6886
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6885
6887
|
return __generator(this, function (_a) {
|
|
6886
6888
|
switch (_a.label) {
|
|
6887
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(
|
|
6889
|
+
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
6888
6890
|
case 1:
|
|
6889
6891
|
_a.sent();
|
|
6890
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(
|
|
6892
|
+
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
6891
6893
|
case 2:
|
|
6892
6894
|
_a.sent();
|
|
6893
6895
|
return [2 /*return*/];
|
|
@@ -6905,7 +6907,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6905
6907
|
.map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6906
6908
|
return __generator(this, function (_a) {
|
|
6907
6909
|
switch (_a.label) {
|
|
6908
|
-
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(
|
|
6910
|
+
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(methodName, clientId, storageName)];
|
|
6909
6911
|
case 1:
|
|
6910
6912
|
_a.sent();
|
|
6911
6913
|
return [2 /*return*/];
|
|
@@ -6923,7 +6925,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
6923
6925
|
.map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6924
6926
|
return __generator(this, function (_a) {
|
|
6925
6927
|
switch (_a.label) {
|
|
6926
|
-
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(
|
|
6928
|
+
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(methodName, clientId, stateName)];
|
|
6927
6929
|
case 1:
|
|
6928
6930
|
_a.sent();
|
|
6929
6931
|
return [2 /*return*/];
|
|
@@ -6950,17 +6952,17 @@ var COMPLETE_GC = 60 * 1000;
|
|
|
6950
6952
|
* @returns {TCompleteRun} The complete run function.
|
|
6951
6953
|
*/
|
|
6952
6954
|
var createComplete = functoolsKit.ttl(function (clientId, swarmName) {
|
|
6953
|
-
return functoolsKit.queued(function (
|
|
6955
|
+
return functoolsKit.queued(function (methodName, content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6954
6956
|
var result;
|
|
6955
6957
|
return __generator(this, function (_a) {
|
|
6956
6958
|
switch (_a.label) {
|
|
6957
6959
|
case 0:
|
|
6958
6960
|
swarm.swarmValidationService.validate(swarmName, "complete");
|
|
6959
6961
|
swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
|
|
6960
|
-
return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user",
|
|
6962
|
+
return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
|
|
6961
6963
|
case 1:
|
|
6962
6964
|
result = _a.sent();
|
|
6963
|
-
return [4 /*yield*/, disposeConnection(clientId, swarmName,
|
|
6965
|
+
return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
|
|
6964
6966
|
case 2:
|
|
6965
6967
|
_a.sent();
|
|
6966
6968
|
return [2 /*return*/, result];
|
|
@@ -6994,23 +6996,33 @@ var createGc = functoolsKit.singleshot(function () { return __awaiter(void 0, vo
|
|
|
6994
6996
|
* @returns {Promise<string>} The result of the complete function.
|
|
6995
6997
|
*/
|
|
6996
6998
|
var complete = function (content, clientId, swarmName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6997
|
-
var
|
|
6999
|
+
var methodName, executionId, run;
|
|
6998
7000
|
return __generator(this, function (_a) {
|
|
6999
7001
|
switch (_a.label) {
|
|
7000
7002
|
case 0:
|
|
7001
|
-
|
|
7003
|
+
methodName = "function complete";
|
|
7004
|
+
executionId = functoolsKit.randomString();
|
|
7002
7005
|
swarm.loggerService.log("function complete", {
|
|
7003
7006
|
content: content,
|
|
7004
7007
|
clientId: clientId,
|
|
7008
|
+
executionId: executionId,
|
|
7005
7009
|
swarmName: swarmName,
|
|
7006
|
-
requestId: requestId,
|
|
7007
7010
|
});
|
|
7008
7011
|
return [4 /*yield*/, createComplete(clientId, swarmName)];
|
|
7009
7012
|
case 1:
|
|
7010
7013
|
run = _a.sent();
|
|
7011
7014
|
createGc();
|
|
7012
|
-
return [
|
|
7013
|
-
|
|
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
|
+
})];
|
|
7014
7026
|
}
|
|
7015
7027
|
});
|
|
7016
7028
|
}); };
|
|
@@ -7026,11 +7038,12 @@ var SCHEDULED_DELAY = 1000;
|
|
|
7026
7038
|
* @returns {Function} dispose - A function to dispose of the session.
|
|
7027
7039
|
*/
|
|
7028
7040
|
var session = function (clientId, swarmName) {
|
|
7029
|
-
var
|
|
7041
|
+
var methodName = "function session";
|
|
7042
|
+
var executionId = functoolsKit.randomString();
|
|
7030
7043
|
swarm.loggerService.log("function session", {
|
|
7031
7044
|
clientId: clientId,
|
|
7032
7045
|
swarmName: swarmName,
|
|
7033
|
-
|
|
7046
|
+
executionId: executionId,
|
|
7034
7047
|
});
|
|
7035
7048
|
swarm.swarmValidationService.validate(swarmName, "session");
|
|
7036
7049
|
swarm.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
@@ -7043,12 +7056,18 @@ var session = function (clientId, swarmName) {
|
|
|
7043
7056
|
*/
|
|
7044
7057
|
complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7045
7058
|
return __generator(this, function (_a) {
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
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
|
+
})];
|
|
7052
7071
|
});
|
|
7053
7072
|
}); }),
|
|
7054
7073
|
/**
|
|
@@ -7059,7 +7078,7 @@ var session = function (clientId, swarmName) {
|
|
|
7059
7078
|
dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7060
7079
|
return __generator(this, function (_a) {
|
|
7061
7080
|
switch (_a.label) {
|
|
7062
|
-
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName,
|
|
7081
|
+
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
|
|
7063
7082
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7064
7083
|
}
|
|
7065
7084
|
});
|
|
@@ -7169,23 +7188,22 @@ var getRawHistory = function (clientId_1) {
|
|
|
7169
7188
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7170
7189
|
args_1[_i - 1] = arguments[_i];
|
|
7171
7190
|
}
|
|
7172
|
-
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) {
|
|
7173
7192
|
var swarmName, agentName, history;
|
|
7174
|
-
if (
|
|
7193
|
+
if (methodName === void 0) { methodName = "function getRawHistory"; }
|
|
7175
7194
|
return __generator(this, function (_a) {
|
|
7176
7195
|
switch (_a.label) {
|
|
7177
7196
|
case 0:
|
|
7178
7197
|
swarm.loggerService.log("function getRawHistory", {
|
|
7179
7198
|
clientId: clientId,
|
|
7180
|
-
requestId: requestId,
|
|
7181
7199
|
});
|
|
7182
7200
|
swarm.sessionValidationService.validate(clientId, "getRawHistory");
|
|
7183
7201
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7184
7202
|
swarm.swarmValidationService.validate(swarmName, "getRawHistory");
|
|
7185
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7203
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7186
7204
|
case 1:
|
|
7187
7205
|
agentName = _a.sent();
|
|
7188
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(
|
|
7206
|
+
return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
|
|
7189
7207
|
case 2:
|
|
7190
7208
|
history = _a.sent();
|
|
7191
7209
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7202,19 +7220,18 @@ var getRawHistory = function (clientId_1) {
|
|
|
7202
7220
|
* @returns {Promise<Array>} - A promise that resolves to an array containing the agent's history.
|
|
7203
7221
|
*/
|
|
7204
7222
|
var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7205
|
-
var
|
|
7223
|
+
var methodName, prompt, history;
|
|
7206
7224
|
return __generator(this, function (_a) {
|
|
7207
7225
|
switch (_a.label) {
|
|
7208
7226
|
case 0:
|
|
7209
|
-
|
|
7227
|
+
methodName = "function getAgentHistory";
|
|
7210
7228
|
swarm.loggerService.log("function getAgentHistory", {
|
|
7211
7229
|
clientId: clientId,
|
|
7212
7230
|
agentName: agentName,
|
|
7213
|
-
requestId: requestId,
|
|
7214
7231
|
});
|
|
7215
7232
|
swarm.agentValidationService.validate(agentName, "getAgentHistory");
|
|
7216
7233
|
prompt = swarm.agentSchemaService.get(agentName).prompt;
|
|
7217
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt,
|
|
7234
|
+
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
|
|
7218
7235
|
case 1:
|
|
7219
7236
|
history = _a.sent();
|
|
7220
7237
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7248,23 +7265,23 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7248
7265
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
7249
7266
|
*/
|
|
7250
7267
|
var commitToolOutput = function (toolId, content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7251
|
-
var
|
|
7268
|
+
var methodName, swarmName, currentAgentName;
|
|
7252
7269
|
return __generator(this, function (_a) {
|
|
7253
7270
|
switch (_a.label) {
|
|
7254
7271
|
case 0:
|
|
7255
|
-
|
|
7272
|
+
methodName = 'function commitToolOutput';
|
|
7256
7273
|
swarm.loggerService.log('function commitToolOutput', {
|
|
7257
7274
|
toolId: toolId,
|
|
7258
7275
|
content: content,
|
|
7259
7276
|
clientId: clientId,
|
|
7260
7277
|
agentName: agentName,
|
|
7261
|
-
|
|
7278
|
+
methodName: methodName,
|
|
7262
7279
|
});
|
|
7263
7280
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7264
7281
|
swarm.sessionValidationService.validate(clientId, "commitToolOutput");
|
|
7265
7282
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7266
7283
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
|
|
7267
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7284
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7268
7285
|
case 1:
|
|
7269
7286
|
currentAgentName = _a.sent();
|
|
7270
7287
|
if (currentAgentName !== agentName) {
|
|
@@ -7276,7 +7293,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7276
7293
|
});
|
|
7277
7294
|
return [2 /*return*/];
|
|
7278
7295
|
}
|
|
7279
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content,
|
|
7296
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
7280
7297
|
case 2:
|
|
7281
7298
|
_a.sent();
|
|
7282
7299
|
return [2 /*return*/];
|
|
@@ -7293,22 +7310,21 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7293
7310
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7294
7311
|
*/
|
|
7295
7312
|
var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7296
|
-
var
|
|
7313
|
+
var methodName, swarmName, currentAgentName;
|
|
7297
7314
|
return __generator(this, function (_a) {
|
|
7298
7315
|
switch (_a.label) {
|
|
7299
7316
|
case 0:
|
|
7300
|
-
|
|
7317
|
+
methodName = 'function commitSystemMessage';
|
|
7301
7318
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
7302
7319
|
content: content,
|
|
7303
7320
|
clientId: clientId,
|
|
7304
7321
|
agentName: agentName,
|
|
7305
|
-
requestId: requestId,
|
|
7306
7322
|
});
|
|
7307
7323
|
swarm.agentValidationService.validate(agentName, "commitSystemMessage");
|
|
7308
7324
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
|
|
7309
7325
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7310
7326
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
|
|
7311
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7327
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7312
7328
|
case 1:
|
|
7313
7329
|
currentAgentName = _a.sent();
|
|
7314
7330
|
if (currentAgentName !== agentName) {
|
|
@@ -7319,7 +7335,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7319
7335
|
});
|
|
7320
7336
|
return [2 /*return*/];
|
|
7321
7337
|
}
|
|
7322
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content,
|
|
7338
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
7323
7339
|
case 2:
|
|
7324
7340
|
_a.sent();
|
|
7325
7341
|
return [2 /*return*/];
|
|
@@ -7335,21 +7351,20 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7335
7351
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7336
7352
|
*/
|
|
7337
7353
|
var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7338
|
-
var
|
|
7354
|
+
var methodName, swarmName, currentAgentName;
|
|
7339
7355
|
return __generator(this, function (_a) {
|
|
7340
7356
|
switch (_a.label) {
|
|
7341
7357
|
case 0:
|
|
7342
|
-
|
|
7358
|
+
methodName = 'function commitFlush';
|
|
7343
7359
|
swarm.loggerService.log('function commitFlush', {
|
|
7344
7360
|
clientId: clientId,
|
|
7345
7361
|
agentName: agentName,
|
|
7346
|
-
requestId: requestId,
|
|
7347
7362
|
});
|
|
7348
7363
|
swarm.agentValidationService.validate(agentName, "commitFlush");
|
|
7349
7364
|
swarm.sessionValidationService.validate(clientId, "commitFlush");
|
|
7350
7365
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7351
7366
|
swarm.swarmValidationService.validate(swarmName, "commitFlush");
|
|
7352
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7367
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7353
7368
|
case 1:
|
|
7354
7369
|
currentAgentName = _a.sent();
|
|
7355
7370
|
if (currentAgentName !== agentName) {
|
|
@@ -7360,7 +7375,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7360
7375
|
});
|
|
7361
7376
|
return [2 /*return*/];
|
|
7362
7377
|
}
|
|
7363
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(
|
|
7378
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
7364
7379
|
case 2:
|
|
7365
7380
|
_a.sent();
|
|
7366
7381
|
return [2 /*return*/];
|
|
@@ -7378,22 +7393,24 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7378
7393
|
* @returns {Promise<void>} - A promise that resolves when the execution is complete.
|
|
7379
7394
|
*/
|
|
7380
7395
|
var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7381
|
-
var
|
|
7396
|
+
var methodName, executionId, swarmName, currentAgentName;
|
|
7382
7397
|
return __generator(this, function (_a) {
|
|
7383
7398
|
switch (_a.label) {
|
|
7384
7399
|
case 0:
|
|
7385
|
-
|
|
7400
|
+
methodName = "function execute";
|
|
7401
|
+
executionId = functoolsKit.randomString();
|
|
7386
7402
|
swarm.loggerService.log("function execute", {
|
|
7387
7403
|
content: content,
|
|
7388
7404
|
clientId: clientId,
|
|
7389
7405
|
agentName: agentName,
|
|
7390
|
-
|
|
7406
|
+
methodName: methodName,
|
|
7407
|
+
executionId: executionId,
|
|
7391
7408
|
});
|
|
7392
7409
|
swarm.agentValidationService.validate(agentName, "execute");
|
|
7393
7410
|
swarm.sessionValidationService.validate(clientId, "execute");
|
|
7394
7411
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7395
7412
|
swarm.swarmValidationService.validate(swarmName, "execute");
|
|
7396
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7413
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7397
7414
|
case 1:
|
|
7398
7415
|
currentAgentName = _a.sent();
|
|
7399
7416
|
if (currentAgentName !== agentName) {
|
|
@@ -7404,8 +7421,17 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7404
7421
|
});
|
|
7405
7422
|
return [2 /*return*/];
|
|
7406
7423
|
}
|
|
7407
|
-
return [
|
|
7408
|
-
|
|
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
|
+
})];
|
|
7409
7435
|
}
|
|
7410
7436
|
});
|
|
7411
7437
|
}); };
|
|
@@ -7421,16 +7447,15 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7421
7447
|
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
7422
7448
|
*/
|
|
7423
7449
|
var emit = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7424
|
-
var
|
|
7450
|
+
var methodName, swarmName, currentAgentName;
|
|
7425
7451
|
return __generator(this, function (_a) {
|
|
7426
7452
|
switch (_a.label) {
|
|
7427
7453
|
case 0:
|
|
7428
|
-
|
|
7454
|
+
methodName = "function emit";
|
|
7429
7455
|
swarm.loggerService.log("function emit", {
|
|
7430
7456
|
content: content,
|
|
7431
7457
|
clientId: clientId,
|
|
7432
7458
|
agentName: agentName,
|
|
7433
|
-
requestId: requestId,
|
|
7434
7459
|
});
|
|
7435
7460
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7436
7461
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
@@ -7439,7 +7464,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7439
7464
|
swarm.sessionValidationService.validate(clientId, "emit");
|
|
7440
7465
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7441
7466
|
swarm.swarmValidationService.validate(swarmName, "emit");
|
|
7442
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7467
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7443
7468
|
case 1:
|
|
7444
7469
|
currentAgentName = _a.sent();
|
|
7445
7470
|
if (currentAgentName !== agentName) {
|
|
@@ -7450,7 +7475,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7450
7475
|
});
|
|
7451
7476
|
return [2 /*return*/];
|
|
7452
7477
|
}
|
|
7453
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content,
|
|
7478
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
7454
7479
|
case 2: return [2 /*return*/, _a.sent()];
|
|
7455
7480
|
}
|
|
7456
7481
|
});
|
|
@@ -7464,21 +7489,20 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7464
7489
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
7465
7490
|
*/
|
|
7466
7491
|
var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7467
|
-
var
|
|
7492
|
+
var methodName, swarmName;
|
|
7468
7493
|
return __generator(this, function (_a) {
|
|
7469
7494
|
switch (_a.label) {
|
|
7470
7495
|
case 0:
|
|
7471
|
-
|
|
7496
|
+
methodName = 'function commitToolOutputForce';
|
|
7472
7497
|
swarm.loggerService.log('function commitToolOutputForce', {
|
|
7473
7498
|
toolId: toolId,
|
|
7474
7499
|
content: content,
|
|
7475
7500
|
clientId: clientId,
|
|
7476
|
-
requestId: requestId,
|
|
7477
7501
|
});
|
|
7478
7502
|
swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
|
|
7479
7503
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7480
7504
|
swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
|
|
7481
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content,
|
|
7505
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
|
|
7482
7506
|
case 1:
|
|
7483
7507
|
_a.sent();
|
|
7484
7508
|
return [2 /*return*/];
|
|
@@ -7494,20 +7518,19 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
7494
7518
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7495
7519
|
*/
|
|
7496
7520
|
var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7497
|
-
var
|
|
7521
|
+
var methodName, swarmName;
|
|
7498
7522
|
return __generator(this, function (_a) {
|
|
7499
7523
|
switch (_a.label) {
|
|
7500
7524
|
case 0:
|
|
7501
|
-
|
|
7525
|
+
methodName = 'function commitSystemMessageForce';
|
|
7502
7526
|
swarm.loggerService.log('function commitSystemMessageForce', {
|
|
7503
7527
|
content: content,
|
|
7504
7528
|
clientId: clientId,
|
|
7505
|
-
requestId: requestId,
|
|
7506
7529
|
});
|
|
7507
7530
|
swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
|
|
7508
7531
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7509
7532
|
swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
|
|
7510
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content,
|
|
7533
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
|
|
7511
7534
|
case 1:
|
|
7512
7535
|
_a.sent();
|
|
7513
7536
|
return [2 /*return*/];
|
|
@@ -7522,19 +7545,19 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
7522
7545
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7523
7546
|
*/
|
|
7524
7547
|
var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7525
|
-
var
|
|
7548
|
+
var methodName, swarmName;
|
|
7526
7549
|
return __generator(this, function (_a) {
|
|
7527
7550
|
switch (_a.label) {
|
|
7528
7551
|
case 0:
|
|
7529
|
-
|
|
7552
|
+
methodName = 'function commitFlushForce';
|
|
7530
7553
|
swarm.loggerService.log('function commitFlushForce', {
|
|
7531
7554
|
clientId: clientId,
|
|
7532
|
-
|
|
7555
|
+
methodName: methodName,
|
|
7533
7556
|
});
|
|
7534
7557
|
swarm.sessionValidationService.validate(clientId, "commitFlushForce");
|
|
7535
7558
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7536
7559
|
swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
|
|
7537
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(
|
|
7560
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
|
|
7538
7561
|
case 1:
|
|
7539
7562
|
_a.sent();
|
|
7540
7563
|
return [2 /*return*/];
|
|
@@ -7550,20 +7573,19 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
7550
7573
|
* @returns {Promise<void>} - A promise that resolves when the message is committed.
|
|
7551
7574
|
*/
|
|
7552
7575
|
var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7553
|
-
var
|
|
7576
|
+
var methodName, swarmName;
|
|
7554
7577
|
return __generator(this, function (_a) {
|
|
7555
7578
|
switch (_a.label) {
|
|
7556
7579
|
case 0:
|
|
7557
|
-
|
|
7580
|
+
methodName = 'function commitSystemMessage';
|
|
7558
7581
|
swarm.loggerService.log('function commitSystemMessage', {
|
|
7559
7582
|
content: content,
|
|
7560
7583
|
clientId: clientId,
|
|
7561
|
-
requestId: requestId,
|
|
7562
7584
|
});
|
|
7563
7585
|
swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
|
|
7564
7586
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7565
7587
|
swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
|
|
7566
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content,
|
|
7588
|
+
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
|
|
7567
7589
|
case 1:
|
|
7568
7590
|
_a.sent();
|
|
7569
7591
|
return [2 /*return*/];
|
|
@@ -7582,15 +7604,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
7582
7604
|
* @returns {Promise<void>} A promise that resolves when the content is emitted.
|
|
7583
7605
|
*/
|
|
7584
7606
|
var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7585
|
-
var
|
|
7607
|
+
var methodName, swarmName;
|
|
7586
7608
|
return __generator(this, function (_a) {
|
|
7587
7609
|
switch (_a.label) {
|
|
7588
7610
|
case 0:
|
|
7589
|
-
|
|
7611
|
+
methodName = "function emitForce";
|
|
7590
7612
|
swarm.loggerService.log("function emitForce", {
|
|
7591
7613
|
content: content,
|
|
7592
7614
|
clientId: clientId,
|
|
7593
|
-
requestId: requestId,
|
|
7594
7615
|
});
|
|
7595
7616
|
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7596
7617
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
@@ -7598,7 +7619,7 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7598
7619
|
swarm.sessionValidationService.validate(clientId, "emitForce");
|
|
7599
7620
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7600
7621
|
swarm.swarmValidationService.validate(swarmName, "emitForce");
|
|
7601
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content,
|
|
7622
|
+
return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
|
|
7602
7623
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7603
7624
|
}
|
|
7604
7625
|
});
|
|
@@ -7615,22 +7636,29 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7615
7636
|
* @returns {Promise<void>} - A promise that resolves when the execution is complete.
|
|
7616
7637
|
*/
|
|
7617
7638
|
var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7618
|
-
var
|
|
7639
|
+
var methodName, executionId, swarmName;
|
|
7619
7640
|
return __generator(this, function (_a) {
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
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
|
+
}
|
|
7627
7657
|
});
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
7633
|
-
}
|
|
7658
|
+
}); }, {
|
|
7659
|
+
clientId: clientId,
|
|
7660
|
+
executionId: executionId,
|
|
7661
|
+
})];
|
|
7634
7662
|
});
|
|
7635
7663
|
}); };
|
|
7636
7664
|
|
|
@@ -7718,16 +7746,15 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
|
7718
7746
|
* @returns {Promise<string | null>} - The content of the last user message, or null if no user message is found.
|
|
7719
7747
|
*/
|
|
7720
7748
|
var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7721
|
-
var
|
|
7749
|
+
var methodName, history, last;
|
|
7722
7750
|
return __generator(this, function (_a) {
|
|
7723
7751
|
switch (_a.label) {
|
|
7724
7752
|
case 0:
|
|
7725
|
-
|
|
7753
|
+
methodName = "function getLastUserMessage";
|
|
7726
7754
|
swarm.loggerService.log("function getLastUserMessage", {
|
|
7727
7755
|
clientId: clientId,
|
|
7728
|
-
requestId: requestId,
|
|
7729
7756
|
});
|
|
7730
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7757
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7731
7758
|
case 1:
|
|
7732
7759
|
history = _a.sent();
|
|
7733
7760
|
last = history.findLast(function (_a) {
|
|
@@ -7746,16 +7773,15 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7746
7773
|
* @returns {Promise<Array>} A promise that resolves to an array of history objects filtered by user role.
|
|
7747
7774
|
*/
|
|
7748
7775
|
var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7749
|
-
var
|
|
7776
|
+
var methodName, history;
|
|
7750
7777
|
return __generator(this, function (_a) {
|
|
7751
7778
|
switch (_a.label) {
|
|
7752
7779
|
case 0:
|
|
7753
|
-
|
|
7780
|
+
methodName = "function getUserHistory";
|
|
7754
7781
|
swarm.loggerService.log("function getUserHistory", {
|
|
7755
7782
|
clientId: clientId,
|
|
7756
|
-
requestId: requestId,
|
|
7757
7783
|
});
|
|
7758
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7784
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7759
7785
|
case 1:
|
|
7760
7786
|
history = _a.sent();
|
|
7761
7787
|
return [2 /*return*/, history.filter(function (_a) {
|
|
@@ -7773,16 +7799,15 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7773
7799
|
* @returns {Promise<Array>} - A promise that resolves to an array of history objects where the role is "assistant".
|
|
7774
7800
|
*/
|
|
7775
7801
|
var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7776
|
-
var
|
|
7802
|
+
var methodName, history;
|
|
7777
7803
|
return __generator(this, function (_a) {
|
|
7778
7804
|
switch (_a.label) {
|
|
7779
7805
|
case 0:
|
|
7780
|
-
|
|
7806
|
+
methodName = "function getAssistantHistory";
|
|
7781
7807
|
swarm.loggerService.log("function getAssistantHistory", {
|
|
7782
7808
|
clientId: clientId,
|
|
7783
|
-
requestId: requestId,
|
|
7784
7809
|
});
|
|
7785
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7810
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7786
7811
|
case 1:
|
|
7787
7812
|
history = _a.sent();
|
|
7788
7813
|
return [2 /*return*/, history.filter(function (_a) {
|
|
@@ -7800,16 +7825,15 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
7800
7825
|
* @returns {Promise<string | null>} - The content of the last assistant message, or null if no user message is found.
|
|
7801
7826
|
*/
|
|
7802
7827
|
var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7803
|
-
var
|
|
7828
|
+
var methodName, history, last;
|
|
7804
7829
|
return __generator(this, function (_a) {
|
|
7805
7830
|
switch (_a.label) {
|
|
7806
7831
|
case 0:
|
|
7807
|
-
|
|
7832
|
+
methodName = "function getLastAssistantMessage";
|
|
7808
7833
|
swarm.loggerService.log("function getLastAssistantMessage", {
|
|
7809
7834
|
clientId: clientId,
|
|
7810
|
-
requestId: requestId,
|
|
7811
7835
|
});
|
|
7812
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7836
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7813
7837
|
case 1:
|
|
7814
7838
|
history = _a.sent();
|
|
7815
7839
|
last = history.findLast(function (_a) {
|
|
@@ -7828,16 +7852,15 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
7828
7852
|
* @returns {Promise<string | null>} - The content of the last system message, or null if no user message is found.
|
|
7829
7853
|
*/
|
|
7830
7854
|
var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7831
|
-
var
|
|
7855
|
+
var methodName, history, last;
|
|
7832
7856
|
return __generator(this, function (_a) {
|
|
7833
7857
|
switch (_a.label) {
|
|
7834
7858
|
case 0:
|
|
7835
|
-
|
|
7859
|
+
methodName = "function getLastSystemMessage";
|
|
7836
7860
|
swarm.loggerService.log("function getLastSystemMessage", {
|
|
7837
7861
|
clientId: clientId,
|
|
7838
|
-
requestId: requestId,
|
|
7839
7862
|
});
|
|
7840
|
-
return [4 /*yield*/, getRawHistory(clientId,
|
|
7863
|
+
return [4 /*yield*/, getRawHistory(clientId, methodName)];
|
|
7841
7864
|
case 1:
|
|
7842
7865
|
history = _a.sent();
|
|
7843
7866
|
last = history.findLast(function (_a) {
|
|
@@ -7941,21 +7964,20 @@ var event = function (clientId, topicName, payload) {
|
|
|
7941
7964
|
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7942
7965
|
*/
|
|
7943
7966
|
var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7944
|
-
var
|
|
7967
|
+
var methodName, swarmName, currentAgentName;
|
|
7945
7968
|
return __generator(this, function (_a) {
|
|
7946
7969
|
switch (_a.label) {
|
|
7947
7970
|
case 0:
|
|
7948
|
-
|
|
7971
|
+
methodName = 'function cancelOutput';
|
|
7949
7972
|
swarm.loggerService.log('function cancelOutput', {
|
|
7950
7973
|
clientId: clientId,
|
|
7951
7974
|
agentName: agentName,
|
|
7952
|
-
requestId: requestId,
|
|
7953
7975
|
});
|
|
7954
7976
|
swarm.agentValidationService.validate(agentName, "cancelOutput");
|
|
7955
7977
|
swarm.sessionValidationService.validate(clientId, "cancelOutput");
|
|
7956
7978
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7957
7979
|
swarm.swarmValidationService.validate(swarmName, "cancelOutput");
|
|
7958
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(
|
|
7980
|
+
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7959
7981
|
case 1:
|
|
7960
7982
|
currentAgentName = _a.sent();
|
|
7961
7983
|
if (currentAgentName !== agentName) {
|
|
@@ -7966,7 +7988,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7966
7988
|
});
|
|
7967
7989
|
return [2 /*return*/];
|
|
7968
7990
|
}
|
|
7969
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(
|
|
7991
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
7970
7992
|
case 2:
|
|
7971
7993
|
_a.sent();
|
|
7972
7994
|
return [2 /*return*/];
|
|
@@ -7982,19 +8004,18 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
7982
8004
|
* @returns {Promise<void>} - A promise that resolves when the output is canceled
|
|
7983
8005
|
*/
|
|
7984
8006
|
var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7985
|
-
var
|
|
8007
|
+
var methodName, swarmName;
|
|
7986
8008
|
return __generator(this, function (_a) {
|
|
7987
8009
|
switch (_a.label) {
|
|
7988
8010
|
case 0:
|
|
7989
|
-
|
|
8011
|
+
methodName = 'function cancelOutputForce';
|
|
7990
8012
|
swarm.loggerService.log('function cancelOutputForce', {
|
|
7991
8013
|
clientId: clientId,
|
|
7992
|
-
requestId: requestId
|
|
7993
8014
|
});
|
|
7994
8015
|
swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
|
|
7995
8016
|
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7996
8017
|
swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
|
|
7997
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(
|
|
8018
|
+
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
|
|
7998
8019
|
case 1:
|
|
7999
8020
|
_a.sent();
|
|
8000
8021
|
return [2 /*return*/];
|
|
@@ -8280,24 +8301,23 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8280
8301
|
* @template T
|
|
8281
8302
|
*/
|
|
8282
8303
|
this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8283
|
-
var
|
|
8304
|
+
var methodName;
|
|
8284
8305
|
return __generator(this, function (_a) {
|
|
8285
8306
|
switch (_a.label) {
|
|
8286
8307
|
case 0:
|
|
8287
|
-
|
|
8308
|
+
methodName = "StorageUtils take";
|
|
8288
8309
|
swarm.loggerService.log("StorageUtils take", {
|
|
8289
8310
|
search: payload.search,
|
|
8290
8311
|
total: payload.total,
|
|
8291
8312
|
clientId: payload.clientId,
|
|
8292
8313
|
storageName: payload.storageName,
|
|
8293
8314
|
score: payload.score,
|
|
8294
|
-
requestId: requestId,
|
|
8295
8315
|
});
|
|
8296
8316
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8297
8317
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8298
8318
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
8299
8319
|
}
|
|
8300
|
-
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)];
|
|
8301
8321
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8302
8322
|
}
|
|
8303
8323
|
});
|
|
@@ -8312,22 +8332,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8312
8332
|
* @template T
|
|
8313
8333
|
*/
|
|
8314
8334
|
this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8315
|
-
var
|
|
8335
|
+
var methodName;
|
|
8316
8336
|
return __generator(this, function (_a) {
|
|
8317
8337
|
switch (_a.label) {
|
|
8318
8338
|
case 0:
|
|
8319
|
-
|
|
8339
|
+
methodName = "StorageUtils upsert";
|
|
8320
8340
|
swarm.loggerService.log("StorageUtils upsert", {
|
|
8321
8341
|
item: payload.item,
|
|
8322
8342
|
clientId: payload.clientId,
|
|
8323
8343
|
storageName: payload.storageName,
|
|
8324
|
-
requestId: requestId,
|
|
8325
8344
|
});
|
|
8326
8345
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8327
8346
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8328
8347
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
8329
8348
|
}
|
|
8330
|
-
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item,
|
|
8349
|
+
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, methodName, payload.clientId, payload.storageName)];
|
|
8331
8350
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8332
8351
|
}
|
|
8333
8352
|
});
|
|
@@ -8341,22 +8360,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8341
8360
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
8342
8361
|
*/
|
|
8343
8362
|
this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8344
|
-
var
|
|
8363
|
+
var methodName;
|
|
8345
8364
|
return __generator(this, function (_a) {
|
|
8346
8365
|
switch (_a.label) {
|
|
8347
8366
|
case 0:
|
|
8348
|
-
|
|
8367
|
+
methodName = "StorageUtils remove";
|
|
8349
8368
|
swarm.loggerService.log("StorageUtils remove", {
|
|
8350
8369
|
itemId: payload.itemId,
|
|
8351
8370
|
clientId: payload.clientId,
|
|
8352
8371
|
storageName: payload.storageName,
|
|
8353
|
-
requestId: requestId,
|
|
8354
8372
|
});
|
|
8355
8373
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8356
8374
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8357
8375
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
8358
8376
|
}
|
|
8359
|
-
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId,
|
|
8377
|
+
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, methodName, payload.clientId, payload.storageName)];
|
|
8360
8378
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8361
8379
|
}
|
|
8362
8380
|
});
|
|
@@ -8371,22 +8389,21 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8371
8389
|
* @template T
|
|
8372
8390
|
*/
|
|
8373
8391
|
this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8374
|
-
var
|
|
8392
|
+
var methodName;
|
|
8375
8393
|
return __generator(this, function (_a) {
|
|
8376
8394
|
switch (_a.label) {
|
|
8377
8395
|
case 0:
|
|
8378
|
-
|
|
8396
|
+
methodName = "StorageUtils get";
|
|
8379
8397
|
swarm.loggerService.log("StorageUtils get", {
|
|
8380
8398
|
itemId: payload.itemId,
|
|
8381
8399
|
clientId: payload.clientId,
|
|
8382
8400
|
storageName: payload.storageName,
|
|
8383
|
-
requestId: requestId,
|
|
8384
8401
|
});
|
|
8385
8402
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8386
8403
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8387
8404
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
8388
8405
|
}
|
|
8389
|
-
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId,
|
|
8406
|
+
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, methodName, payload.clientId, payload.storageName)];
|
|
8390
8407
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8391
8408
|
}
|
|
8392
8409
|
});
|
|
@@ -8401,21 +8418,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8401
8418
|
* @template T
|
|
8402
8419
|
*/
|
|
8403
8420
|
this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8404
|
-
var
|
|
8421
|
+
var methodName;
|
|
8405
8422
|
return __generator(this, function (_a) {
|
|
8406
8423
|
switch (_a.label) {
|
|
8407
8424
|
case 0:
|
|
8408
|
-
|
|
8425
|
+
methodName = "StorageUtils list";
|
|
8409
8426
|
swarm.loggerService.log("StorageUtils list", {
|
|
8410
8427
|
clientId: payload.clientId,
|
|
8411
8428
|
storageName: payload.storageName,
|
|
8412
|
-
requestId: requestId,
|
|
8413
8429
|
});
|
|
8414
8430
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8415
8431
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8416
8432
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
8417
8433
|
}
|
|
8418
|
-
return [4 /*yield*/, swarm.storagePublicService.list(
|
|
8434
|
+
return [4 /*yield*/, swarm.storagePublicService.list(methodName, payload.clientId, payload.storageName, payload.filter)];
|
|
8419
8435
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8420
8436
|
}
|
|
8421
8437
|
});
|
|
@@ -8428,21 +8444,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8428
8444
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
8429
8445
|
*/
|
|
8430
8446
|
this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8431
|
-
var
|
|
8447
|
+
var methodName;
|
|
8432
8448
|
return __generator(this, function (_a) {
|
|
8433
8449
|
switch (_a.label) {
|
|
8434
8450
|
case 0:
|
|
8435
|
-
|
|
8451
|
+
methodName = "StorageUtils clear";
|
|
8436
8452
|
swarm.loggerService.log("StorageUtils clear", {
|
|
8437
8453
|
clientId: payload.clientId,
|
|
8438
8454
|
storageName: payload.storageName,
|
|
8439
|
-
requestId: requestId,
|
|
8440
8455
|
});
|
|
8441
8456
|
swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
|
|
8442
8457
|
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8443
8458
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
8444
8459
|
}
|
|
8445
|
-
return [4 /*yield*/, swarm.storagePublicService.clear(
|
|
8460
|
+
return [4 /*yield*/, swarm.storagePublicService.clear(methodName, payload.clientId, payload.storageName)];
|
|
8446
8461
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8447
8462
|
}
|
|
8448
8463
|
});
|
|
@@ -8470,20 +8485,19 @@ var StateUtils = /** @class */ (function () {
|
|
|
8470
8485
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
8471
8486
|
*/
|
|
8472
8487
|
this.getState = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8473
|
-
var
|
|
8488
|
+
var methodName;
|
|
8474
8489
|
return __generator(this, function (_a) {
|
|
8475
8490
|
switch (_a.label) {
|
|
8476
8491
|
case 0:
|
|
8477
|
-
|
|
8492
|
+
methodName = "StateUtils getState";
|
|
8478
8493
|
swarm.loggerService.log("StateUtils getState", {
|
|
8479
8494
|
clientId: payload.clientId,
|
|
8480
8495
|
stateName: payload.stateName,
|
|
8481
|
-
requestId: requestId,
|
|
8482
8496
|
});
|
|
8483
8497
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8484
8498
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
|
|
8485
8499
|
}
|
|
8486
|
-
return [4 /*yield*/, swarm.statePublicService.getState(
|
|
8500
|
+
return [4 /*yield*/, swarm.statePublicService.getState(methodName, payload.clientId, payload.stateName)];
|
|
8487
8501
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8488
8502
|
}
|
|
8489
8503
|
});
|
|
@@ -8500,26 +8514,25 @@ var StateUtils = /** @class */ (function () {
|
|
|
8500
8514
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
8501
8515
|
*/
|
|
8502
8516
|
this.setState = function (dispatchFn, payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
8503
|
-
var
|
|
8517
|
+
var methodName;
|
|
8504
8518
|
var _this = this;
|
|
8505
8519
|
return __generator(this, function (_a) {
|
|
8506
8520
|
switch (_a.label) {
|
|
8507
8521
|
case 0:
|
|
8508
|
-
|
|
8522
|
+
methodName = "StateUtils setState";
|
|
8509
8523
|
swarm.loggerService.log("StateUtils setState", {
|
|
8510
8524
|
clientId: payload.clientId,
|
|
8511
8525
|
stateName: payload.stateName,
|
|
8512
|
-
requestId: requestId,
|
|
8513
8526
|
});
|
|
8514
8527
|
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8515
8528
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
8516
8529
|
}
|
|
8517
8530
|
if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
|
|
8518
|
-
return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn,
|
|
8531
|
+
return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, methodName, payload.clientId, payload.stateName)];
|
|
8519
8532
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8520
8533
|
case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
8521
8534
|
return [2 /*return*/, dispatchFn];
|
|
8522
|
-
}); }); },
|
|
8535
|
+
}); }); }, methodName, payload.clientId, payload.stateName)];
|
|
8523
8536
|
case 3: return [2 /*return*/, _a.sent()];
|
|
8524
8537
|
}
|
|
8525
8538
|
});
|
|
@@ -8552,11 +8565,12 @@ var LoggerUtils = /** @class */ (function () {
|
|
|
8552
8565
|
*/
|
|
8553
8566
|
var Logger = new LoggerUtils();
|
|
8554
8567
|
|
|
8555
|
-
exports.
|
|
8568
|
+
exports.ExecutionContextService = ExecutionContextService;
|
|
8556
8569
|
exports.History = History;
|
|
8557
8570
|
exports.HistoryAdapter = HistoryAdapter;
|
|
8558
8571
|
exports.HistoryInstance = HistoryInstance;
|
|
8559
8572
|
exports.Logger = Logger;
|
|
8573
|
+
exports.MethodContextService = MethodContextService;
|
|
8560
8574
|
exports.State = State;
|
|
8561
8575
|
exports.Storage = Storage;
|
|
8562
8576
|
exports.addAgent = addAgent;
|