agent-swarm-kit 1.0.76 → 1.0.78

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 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 ContextService = diScoped.scoped(/** @class */ (function () {
159
+ var MethodContextService = diScoped.scoped(/** @class */ (function () {
160
160
  /**
161
- * Creates an instance of ContextService.
162
- * @param {IContext} context - The context object.
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
- contextService: Symbol('contextService'),
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.contextService = inject(TYPES.contextService);
238
+ this.methodContextService = inject(TYPES.methodContextService);
239
+ this.executionContextService = inject(TYPES.executionContextService);
222
240
  this._logger = {
223
241
  /**
224
242
  * Logs messages.
@@ -232,38 +250,69 @@ var LoggerService = /** @class */ (function () {
232
250
  */
233
251
  debug: function () {
234
252
  },
253
+ /**
254
+ * Logs info messages.
255
+ * @param {...any} args - The info messages to log.
256
+ */
257
+ info: function () {
258
+ },
235
259
  };
236
260
  /**
237
261
  * Logs messages using the current logger.
238
262
  * @param {...any} args - The messages to log.
239
263
  */
240
264
  this.log = function () {
241
- var _a, _b;
265
+ var _a;
242
266
  var args = [];
243
267
  for (var _i = 0; _i < arguments.length; _i++) {
244
268
  args[_i] = arguments[_i];
245
269
  }
246
- if (ContextService.hasContext()) {
247
- (_a = _this._logger).log.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [_this.contextService.context], false));
248
- return;
249
- }
250
- (_b = _this._logger).log.apply(_b, __spreadArray([], __read(args), false));
270
+ var methodContext = MethodContextService.hasContext()
271
+ ? _this.methodContextService.context
272
+ : null;
273
+ var executionContext = ExecutionContextService.hasContext()
274
+ ? _this.executionContextService.context
275
+ : null;
276
+ (_a = _this._logger).log.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{
277
+ methodContext: methodContext,
278
+ executionContext: executionContext,
279
+ }], false));
251
280
  };
252
281
  /**
253
282
  * Logs debug messages using the current logger.
254
283
  * @param {...any} args - The debug messages to log.
255
284
  */
256
285
  this.debug = function () {
257
- var _a, _b;
286
+ var _a;
258
287
  var args = [];
259
288
  for (var _i = 0; _i < arguments.length; _i++) {
260
289
  args[_i] = arguments[_i];
261
290
  }
262
- if (ContextService.hasContext()) {
263
- (_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [_this.contextService.context], false));
264
- return;
291
+ var methodContext = MethodContextService.hasContext()
292
+ ? _this.methodContextService.context
293
+ : null;
294
+ var executionContext = ExecutionContextService.hasContext()
295
+ ? _this.executionContextService.context
296
+ : null;
297
+ (_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
298
+ };
299
+ /**
300
+ * Logs info messages using the current logger.
301
+ * @param {...any} args - The info messages to log.
302
+ */
303
+ this.info = function () {
304
+ var _a;
305
+ var args = [];
306
+ for (var _i = 0; _i < arguments.length; _i++) {
307
+ args[_i] = arguments[_i];
265
308
  }
266
- (_b = _this._logger).debug.apply(_b, __spreadArray([], __read(args), false));
309
+ var methodContext = MethodContextService.hasContext()
310
+ ? _this.methodContextService.context
311
+ : null;
312
+ var executionContext = ExecutionContextService.hasContext()
313
+ ? _this.executionContextService.context
314
+ : null;
315
+ (_a = _this._logger).info.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
267
316
  };
268
317
  /**
269
318
  * Sets a new logger.
@@ -290,7 +339,7 @@ var AgentSchemaService = /** @class */ (function () {
290
339
  * @param {IAgentSchema} value - The schema of the agent.
291
340
  */
292
341
  this.register = function (key, value) {
293
- _this.loggerService.log("agentSchemaService register", { key: key });
342
+ _this.loggerService.info("agentSchemaService register", { key: key });
294
343
  _this.registry = _this.registry.register(key, value);
295
344
  };
296
345
  /**
@@ -299,7 +348,7 @@ var AgentSchemaService = /** @class */ (function () {
299
348
  * @returns {IAgentSchema} The schema of the agent.
300
349
  */
301
350
  this.get = function (key) {
302
- _this.loggerService.log("agentSchemaService get", { key: key });
351
+ _this.loggerService.info("agentSchemaService get", { key: key });
303
352
  return _this.registry.get(key);
304
353
  };
305
354
  }
@@ -1523,7 +1572,7 @@ var AgentConnectionService = /** @class */ (function () {
1523
1572
  var _this = this;
1524
1573
  this.loggerService = inject(TYPES.loggerService);
1525
1574
  this.busService = inject(TYPES.busService);
1526
- this.contextService = inject(TYPES.contextService);
1575
+ this.methodContextService = inject(TYPES.methodContextService);
1527
1576
  this.sessionValidationService = inject(TYPES.sessionValidationService);
1528
1577
  this.historyConnectionService = inject(TYPES.historyConnectionService);
1529
1578
  this.storageConnectionService = inject(TYPES.storageConnectionService);
@@ -1564,11 +1613,11 @@ var AgentConnectionService = /** @class */ (function () {
1564
1613
  return __generator(this, function (_a) {
1565
1614
  switch (_a.label) {
1566
1615
  case 0:
1567
- this.loggerService.log("agentConnectionService execute", {
1616
+ this.loggerService.info("agentConnectionService execute", {
1568
1617
  input: input,
1569
1618
  mode: mode,
1570
1619
  });
1571
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).execute(input, mode)];
1620
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).execute(input, mode)];
1572
1621
  case 1: return [2 /*return*/, _a.sent()];
1573
1622
  }
1574
1623
  });
@@ -1581,8 +1630,8 @@ var AgentConnectionService = /** @class */ (function () {
1581
1630
  return __generator(this, function (_a) {
1582
1631
  switch (_a.label) {
1583
1632
  case 0:
1584
- this.loggerService.log("agentConnectionService waitForOutput");
1585
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).waitForOutput()];
1633
+ this.loggerService.info("agentConnectionService waitForOutput");
1634
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).waitForOutput()];
1586
1635
  case 1: return [2 /*return*/, _a.sent()];
1587
1636
  }
1588
1637
  });
@@ -1597,11 +1646,11 @@ var AgentConnectionService = /** @class */ (function () {
1597
1646
  return __generator(this, function (_a) {
1598
1647
  switch (_a.label) {
1599
1648
  case 0:
1600
- this.loggerService.log("agentConnectionService commitToolOutput", {
1649
+ this.loggerService.info("agentConnectionService commitToolOutput", {
1601
1650
  content: content,
1602
1651
  toolId: toolId,
1603
1652
  });
1604
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).commitToolOutput(toolId, content)];
1653
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitToolOutput(toolId, content)];
1605
1654
  case 1: return [2 /*return*/, _a.sent()];
1606
1655
  }
1607
1656
  });
@@ -1615,10 +1664,10 @@ var AgentConnectionService = /** @class */ (function () {
1615
1664
  return __generator(this, function (_a) {
1616
1665
  switch (_a.label) {
1617
1666
  case 0:
1618
- this.loggerService.log("agentConnectionService commitSystemMessage", {
1667
+ this.loggerService.info("agentConnectionService commitSystemMessage", {
1619
1668
  message: message,
1620
1669
  });
1621
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).commitSystemMessage(message)];
1670
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitSystemMessage(message)];
1622
1671
  case 1: return [2 /*return*/, _a.sent()];
1623
1672
  }
1624
1673
  });
@@ -1632,10 +1681,10 @@ var AgentConnectionService = /** @class */ (function () {
1632
1681
  return __generator(this, function (_a) {
1633
1682
  switch (_a.label) {
1634
1683
  case 0:
1635
- this.loggerService.log("agentConnectionService commitUserMessage", {
1684
+ this.loggerService.info("agentConnectionService commitUserMessage", {
1636
1685
  message: message,
1637
1686
  });
1638
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).commitUserMessage(message)];
1687
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitUserMessage(message)];
1639
1688
  case 1: return [2 /*return*/, _a.sent()];
1640
1689
  }
1641
1690
  });
@@ -1648,8 +1697,8 @@ var AgentConnectionService = /** @class */ (function () {
1648
1697
  return __generator(this, function (_a) {
1649
1698
  switch (_a.label) {
1650
1699
  case 0:
1651
- this.loggerService.log("agentConnectionService commitAgentChange");
1652
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).commitAgentChange()];
1700
+ this.loggerService.info("agentConnectionService commitAgentChange");
1701
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitAgentChange()];
1653
1702
  case 1: return [2 /*return*/, _a.sent()];
1654
1703
  }
1655
1704
  });
@@ -1662,8 +1711,8 @@ var AgentConnectionService = /** @class */ (function () {
1662
1711
  return __generator(this, function (_a) {
1663
1712
  switch (_a.label) {
1664
1713
  case 0:
1665
- this.loggerService.log("agentConnectionService commitFlush");
1666
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).commitFlush()];
1714
+ this.loggerService.info("agentConnectionService commitFlush");
1715
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitFlush()];
1667
1716
  case 1: return [2 /*return*/, _a.sent()];
1668
1717
  }
1669
1718
  });
@@ -1677,16 +1726,16 @@ var AgentConnectionService = /** @class */ (function () {
1677
1726
  return __generator(this, function (_a) {
1678
1727
  switch (_a.label) {
1679
1728
  case 0:
1680
- this.loggerService.log("agentConnectionService dispose");
1681
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.agentName);
1729
+ this.loggerService.info("agentConnectionService dispose");
1730
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
1682
1731
  if (!this.getAgent.has(key)) {
1683
1732
  return [2 /*return*/];
1684
1733
  }
1685
- return [4 /*yield*/, this.getAgent(this.contextService.context.clientId, this.contextService.context.agentName).dispose()];
1734
+ return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).dispose()];
1686
1735
  case 1:
1687
1736
  _a.sent();
1688
1737
  this.getAgent.clear(key);
1689
- this.sessionValidationService.removeAgentUsage(this.contextService.context.clientId, this.contextService.context.agentName);
1738
+ this.sessionValidationService.removeAgentUsage(this.methodContextService.context.clientId, this.methodContextService.context.agentName);
1690
1739
  return [2 /*return*/];
1691
1740
  }
1692
1741
  });
@@ -1967,7 +2016,7 @@ var HistoryConnectionService = /** @class */ (function () {
1967
2016
  var _this = this;
1968
2017
  this.loggerService = inject(TYPES.loggerService);
1969
2018
  this.busService = inject(TYPES.busService);
1970
- this.contextService = inject(TYPES.contextService);
2019
+ this.methodContextService = inject(TYPES.methodContextService);
1971
2020
  this.sessionValidationService = inject(TYPES.sessionValidationService);
1972
2021
  /**
1973
2022
  * Retrieves the history for a given client and agent.
@@ -1997,10 +2046,10 @@ var HistoryConnectionService = /** @class */ (function () {
1997
2046
  return __generator(this, function (_a) {
1998
2047
  switch (_a.label) {
1999
2048
  case 0:
2000
- this.loggerService.log("historyConnectionService push", {
2049
+ this.loggerService.info("historyConnectionService push", {
2001
2050
  message: message,
2002
2051
  });
2003
- return [4 /*yield*/, this.getHistory(this.contextService.context.clientId, this.contextService.context.agentName).push(message)];
2052
+ return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).push(message)];
2004
2053
  case 1: return [2 /*return*/, _a.sent()];
2005
2054
  }
2006
2055
  });
@@ -2014,10 +2063,10 @@ var HistoryConnectionService = /** @class */ (function () {
2014
2063
  return __generator(this, function (_a) {
2015
2064
  switch (_a.label) {
2016
2065
  case 0:
2017
- this.loggerService.log("historyConnectionService toArrayForAgent", {
2066
+ this.loggerService.info("historyConnectionService toArrayForAgent", {
2018
2067
  prompt: prompt,
2019
2068
  });
2020
- return [4 /*yield*/, this.getHistory(this.contextService.context.clientId, this.contextService.context.agentName).toArrayForAgent(prompt)];
2069
+ return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForAgent(prompt)];
2021
2070
  case 1: return [2 /*return*/, _a.sent()];
2022
2071
  }
2023
2072
  });
@@ -2030,8 +2079,8 @@ var HistoryConnectionService = /** @class */ (function () {
2030
2079
  return __generator(this, function (_a) {
2031
2080
  switch (_a.label) {
2032
2081
  case 0:
2033
- this.loggerService.log("historyConnectionService toArrayForRaw");
2034
- return [4 /*yield*/, this.getHistory(this.contextService.context.clientId, this.contextService.context.agentName).toArrayForRaw()];
2082
+ this.loggerService.info("historyConnectionService toArrayForRaw");
2083
+ return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).toArrayForRaw()];
2035
2084
  case 1: return [2 /*return*/, _a.sent()];
2036
2085
  }
2037
2086
  });
@@ -2045,16 +2094,16 @@ var HistoryConnectionService = /** @class */ (function () {
2045
2094
  return __generator(this, function (_a) {
2046
2095
  switch (_a.label) {
2047
2096
  case 0:
2048
- this.loggerService.log("historyConnectionService dispose");
2049
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.agentName);
2097
+ this.loggerService.info("historyConnectionService dispose");
2098
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.agentName);
2050
2099
  if (!this.getHistory.has(key)) {
2051
2100
  return [2 /*return*/];
2052
2101
  }
2053
- return [4 /*yield*/, this.getHistory(this.contextService.context.clientId, this.contextService.context.agentName).dispose()];
2102
+ return [4 /*yield*/, this.getHistory(this.methodContextService.context.clientId, this.methodContextService.context.agentName).dispose()];
2054
2103
  case 1:
2055
2104
  _a.sent();
2056
2105
  this.getHistory.clear(key);
2057
- this.sessionValidationService.removeHistoryUsage(this.contextService.context.clientId, this.contextService.context.agentName);
2106
+ this.sessionValidationService.removeHistoryUsage(this.methodContextService.context.clientId, this.methodContextService.context.agentName);
2058
2107
  return [2 /*return*/];
2059
2108
  }
2060
2109
  });
@@ -2077,7 +2126,7 @@ var ToolSchemaService = /** @class */ (function () {
2077
2126
  * @param {IAgentTool} value - The tool to register.
2078
2127
  */
2079
2128
  this.register = function (key, value) {
2080
- _this.loggerService.log('toolSchemaService register');
2129
+ _this.loggerService.info('toolSchemaService register');
2081
2130
  _this.registry = _this.registry.register(key, value);
2082
2131
  };
2083
2132
  /**
@@ -2086,7 +2135,7 @@ var ToolSchemaService = /** @class */ (function () {
2086
2135
  * @returns {IAgentTool} The tool associated with the given key.
2087
2136
  */
2088
2137
  this.get = function (key) {
2089
- _this.loggerService.log('toolSchemaService get', { key: key });
2138
+ _this.loggerService.info('toolSchemaService get', { key: key });
2090
2139
  return _this.registry.get(key);
2091
2140
  };
2092
2141
  }
@@ -2375,7 +2424,7 @@ var SwarmConnectionService = /** @class */ (function () {
2375
2424
  var _this = this;
2376
2425
  this.loggerService = inject(TYPES.loggerService);
2377
2426
  this.busService = inject(TYPES.busService);
2378
- this.contextService = inject(TYPES.contextService);
2427
+ this.methodContextService = inject(TYPES.methodContextService);
2379
2428
  this.agentConnectionService = inject(TYPES.agentConnectionService);
2380
2429
  this.swarmSchemaService = inject(TYPES.swarmSchemaService);
2381
2430
  /**
@@ -2438,8 +2487,8 @@ var SwarmConnectionService = /** @class */ (function () {
2438
2487
  return __generator(this, function (_a) {
2439
2488
  switch (_a.label) {
2440
2489
  case 0:
2441
- this.loggerService.log("swarmConnectionService cancelOutput");
2442
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).cancelOutput()];
2490
+ this.loggerService.info("swarmConnectionService cancelOutput");
2491
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).cancelOutput()];
2443
2492
  case 1: return [2 /*return*/, _a.sent()];
2444
2493
  }
2445
2494
  });
@@ -2452,8 +2501,8 @@ var SwarmConnectionService = /** @class */ (function () {
2452
2501
  return __generator(this, function (_a) {
2453
2502
  switch (_a.label) {
2454
2503
  case 0:
2455
- this.loggerService.log("swarmConnectionService waitForOutput");
2456
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).waitForOutput()];
2504
+ this.loggerService.info("swarmConnectionService waitForOutput");
2505
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).waitForOutput()];
2457
2506
  case 1: return [2 /*return*/, _a.sent()];
2458
2507
  }
2459
2508
  });
@@ -2466,8 +2515,8 @@ var SwarmConnectionService = /** @class */ (function () {
2466
2515
  return __generator(this, function (_a) {
2467
2516
  switch (_a.label) {
2468
2517
  case 0:
2469
- this.loggerService.log("swarmConnectionService getAgentName");
2470
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).getAgentName()];
2518
+ this.loggerService.info("swarmConnectionService getAgentName");
2519
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgentName()];
2471
2520
  case 1: return [2 /*return*/, _a.sent()];
2472
2521
  }
2473
2522
  });
@@ -2480,8 +2529,8 @@ var SwarmConnectionService = /** @class */ (function () {
2480
2529
  return __generator(this, function (_a) {
2481
2530
  switch (_a.label) {
2482
2531
  case 0:
2483
- this.loggerService.log("swarmConnectionService getAgent");
2484
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).getAgent()];
2532
+ this.loggerService.info("swarmConnectionService getAgent");
2533
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).getAgent()];
2485
2534
  case 1: return [2 /*return*/, _a.sent()];
2486
2535
  }
2487
2536
  });
@@ -2496,10 +2545,10 @@ var SwarmConnectionService = /** @class */ (function () {
2496
2545
  return __generator(this, function (_a) {
2497
2546
  switch (_a.label) {
2498
2547
  case 0:
2499
- this.loggerService.log("swarmConnectionService setAgentRef", {
2548
+ this.loggerService.info("swarmConnectionService setAgentRef", {
2500
2549
  agentName: agentName,
2501
2550
  });
2502
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).setAgentRef(agentName, agent)];
2551
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentRef(agentName, agent)];
2503
2552
  case 1: return [2 /*return*/, _a.sent()];
2504
2553
  }
2505
2554
  });
@@ -2513,10 +2562,10 @@ var SwarmConnectionService = /** @class */ (function () {
2513
2562
  return __generator(this, function (_a) {
2514
2563
  switch (_a.label) {
2515
2564
  case 0:
2516
- this.loggerService.log("swarmConnectionService setAgentName", {
2565
+ this.loggerService.info("swarmConnectionService setAgentName", {
2517
2566
  agentName: agentName,
2518
2567
  });
2519
- return [4 /*yield*/, this.getSwarm(this.contextService.context.clientId, this.contextService.context.swarmName).setAgentName(agentName)];
2568
+ return [4 /*yield*/, this.getSwarm(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).setAgentName(agentName)];
2520
2569
  case 1: return [2 /*return*/, _a.sent()];
2521
2570
  }
2522
2571
  });
@@ -2528,8 +2577,8 @@ var SwarmConnectionService = /** @class */ (function () {
2528
2577
  this.dispose = function () { return __awaiter(_this, void 0, void 0, function () {
2529
2578
  var key;
2530
2579
  return __generator(this, function (_a) {
2531
- this.loggerService.log("swarmConnectionService dispose");
2532
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.swarmName);
2580
+ this.loggerService.info("swarmConnectionService dispose");
2581
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
2533
2582
  if (!this.getSwarm.has(key)) {
2534
2583
  return [2 /*return*/];
2535
2584
  }
@@ -2555,7 +2604,7 @@ var SwarmSchemaService = /** @class */ (function () {
2555
2604
  * @param {ISwarmSchema} value - The schema of the swarm.
2556
2605
  */
2557
2606
  this.register = function (key, value) {
2558
- _this.loggerService.log("swarmSchemaService register", { key: key });
2607
+ _this.loggerService.info("swarmSchemaService register", { key: key });
2559
2608
  _this.registry = _this.registry.register(key, value);
2560
2609
  };
2561
2610
  /**
@@ -2564,7 +2613,7 @@ var SwarmSchemaService = /** @class */ (function () {
2564
2613
  * @returns {ISwarmSchema} The schema of the swarm.
2565
2614
  */
2566
2615
  this.get = function (key) {
2567
- _this.loggerService.log("swarmSchemaService get", { key: key });
2616
+ _this.loggerService.info("swarmSchemaService get", { key: key });
2568
2617
  return _this.registry.get(key);
2569
2618
  };
2570
2619
  }
@@ -2585,7 +2634,7 @@ var CompletionSchemaService = /** @class */ (function () {
2585
2634
  * @param {ICompletionSchema} value - The schema to register.
2586
2635
  */
2587
2636
  this.register = function (key, value) {
2588
- _this.loggerService.log("completionSchemaService register", { key: key });
2637
+ _this.loggerService.info("completionSchemaService register", { key: key });
2589
2638
  _this.registry = _this.registry.register(key, value);
2590
2639
  };
2591
2640
  /**
@@ -2594,7 +2643,7 @@ var CompletionSchemaService = /** @class */ (function () {
2594
2643
  * @returns {ICompletionSchema} The retrieved schema.
2595
2644
  */
2596
2645
  this.get = function (key) {
2597
- _this.loggerService.log("completionSchemaService get", { key: key });
2646
+ _this.loggerService.info("completionSchemaService get", { key: key });
2598
2647
  return _this.registry.get(key);
2599
2648
  };
2600
2649
  }
@@ -2934,7 +2983,7 @@ var SessionConnectionService = /** @class */ (function () {
2934
2983
  var _this = this;
2935
2984
  this.loggerService = inject(TYPES.loggerService);
2936
2985
  this.busService = inject(TYPES.busService);
2937
- this.contextService = inject(TYPES.contextService);
2986
+ this.methodContextService = inject(TYPES.methodContextService);
2938
2987
  this.swarmConnectionService = inject(TYPES.swarmConnectionService);
2939
2988
  this.swarmSchemaService = inject(TYPES.swarmSchemaService);
2940
2989
  /**
@@ -2959,10 +3008,10 @@ var SessionConnectionService = /** @class */ (function () {
2959
3008
  return __generator(this, function (_a) {
2960
3009
  switch (_a.label) {
2961
3010
  case 0:
2962
- this.loggerService.log("sessionConnectionService emit", {
3011
+ this.loggerService.info("sessionConnectionService emit", {
2963
3012
  content: content,
2964
3013
  });
2965
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).emit(content)];
3014
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).emit(content)];
2966
3015
  case 1: return [2 /*return*/, _a.sent()];
2967
3016
  }
2968
3017
  });
@@ -2976,11 +3025,11 @@ var SessionConnectionService = /** @class */ (function () {
2976
3025
  return __generator(this, function (_a) {
2977
3026
  switch (_a.label) {
2978
3027
  case 0:
2979
- this.loggerService.log("sessionConnectionService execute", {
3028
+ this.loggerService.info("sessionConnectionService execute", {
2980
3029
  content: content,
2981
3030
  mode: mode,
2982
3031
  });
2983
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).execute(content, mode)];
3032
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).execute(content, mode)];
2984
3033
  case 1: return [2 /*return*/, _a.sent()];
2985
3034
  }
2986
3035
  });
@@ -2991,7 +3040,7 @@ var SessionConnectionService = /** @class */ (function () {
2991
3040
  * @returns {ReceiveMessageFn} The function to receive messages.
2992
3041
  */
2993
3042
  this.connect = function (connector, clientId, swarmName) {
2994
- _this.loggerService.log("sessionConnectionService connect");
3043
+ _this.loggerService.info("sessionConnectionService connect");
2995
3044
  return _this.getSession(clientId, swarmName).connect(connector);
2996
3045
  };
2997
3046
  /**
@@ -3004,11 +3053,11 @@ var SessionConnectionService = /** @class */ (function () {
3004
3053
  return __generator(this, function (_a) {
3005
3054
  switch (_a.label) {
3006
3055
  case 0:
3007
- this.loggerService.log("sessionConnectionService commitToolOutput", {
3056
+ this.loggerService.info("sessionConnectionService commitToolOutput", {
3008
3057
  content: content,
3009
3058
  toolId: toolId,
3010
3059
  });
3011
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).commitToolOutput(toolId, content)];
3060
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitToolOutput(toolId, content)];
3012
3061
  case 1: return [2 /*return*/, _a.sent()];
3013
3062
  }
3014
3063
  });
@@ -3022,10 +3071,10 @@ var SessionConnectionService = /** @class */ (function () {
3022
3071
  return __generator(this, function (_a) {
3023
3072
  switch (_a.label) {
3024
3073
  case 0:
3025
- this.loggerService.log("sessionConnectionService commitSystemMessage", {
3074
+ this.loggerService.info("sessionConnectionService commitSystemMessage", {
3026
3075
  message: message,
3027
3076
  });
3028
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).commitSystemMessage(message)];
3077
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitSystemMessage(message)];
3029
3078
  case 1: return [2 /*return*/, _a.sent()];
3030
3079
  }
3031
3080
  });
@@ -3039,10 +3088,10 @@ var SessionConnectionService = /** @class */ (function () {
3039
3088
  return __generator(this, function (_a) {
3040
3089
  switch (_a.label) {
3041
3090
  case 0:
3042
- this.loggerService.log("sessionConnectionService commitUserMessage", {
3091
+ this.loggerService.info("sessionConnectionService commitUserMessage", {
3043
3092
  message: message,
3044
3093
  });
3045
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).commitUserMessage(message)];
3094
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitUserMessage(message)];
3046
3095
  case 1: return [2 /*return*/, _a.sent()];
3047
3096
  }
3048
3097
  });
@@ -3056,8 +3105,8 @@ var SessionConnectionService = /** @class */ (function () {
3056
3105
  return __generator(this, function (_a) {
3057
3106
  switch (_a.label) {
3058
3107
  case 0:
3059
- this.loggerService.log("sessionConnectionService commitFlush");
3060
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).commitFlush()];
3108
+ this.loggerService.info("sessionConnectionService commitFlush");
3109
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitFlush()];
3061
3110
  case 1: return [2 /*return*/, _a.sent()];
3062
3111
  }
3063
3112
  });
@@ -3071,12 +3120,12 @@ var SessionConnectionService = /** @class */ (function () {
3071
3120
  return __generator(this, function (_a) {
3072
3121
  switch (_a.label) {
3073
3122
  case 0:
3074
- this.loggerService.log("sessionConnectionService dispose");
3075
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.swarmName);
3123
+ this.loggerService.info("sessionConnectionService dispose");
3124
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.swarmName);
3076
3125
  if (!this.getSession.has(key)) {
3077
3126
  return [2 /*return*/];
3078
3127
  }
3079
- return [4 /*yield*/, this.getSession(this.contextService.context.clientId, this.contextService.context.swarmName).dispose()];
3128
+ return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).dispose()];
3080
3129
  case 1:
3081
3130
  _a.sent();
3082
3131
  this.getSession.clear(key);
@@ -3102,17 +3151,17 @@ var AgentPublicService = /** @class */ (function () {
3102
3151
  * @param {AgentName} agentName - The name of the agent.
3103
3152
  * @returns {Promise<unknown>} The agent reference.
3104
3153
  */
3105
- this.createAgentRef = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3154
+ this.createAgentRef = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3106
3155
  var _this = this;
3107
3156
  return __generator(this, function (_a) {
3108
3157
  switch (_a.label) {
3109
3158
  case 0:
3110
- this.loggerService.log("agentPublicService createAgentRef", {
3111
- requestId: requestId,
3159
+ this.loggerService.info("agentPublicService createAgentRef", {
3160
+ methodName: methodName,
3112
3161
  clientId: clientId,
3113
3162
  agentName: agentName,
3114
3163
  });
3115
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3164
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3116
3165
  return __generator(this, function (_a) {
3117
3166
  switch (_a.label) {
3118
3167
  case 0: return [4 /*yield*/, this.agentConnectionService.getAgent(clientId, agentName)];
@@ -3120,7 +3169,7 @@ var AgentPublicService = /** @class */ (function () {
3120
3169
  }
3121
3170
  });
3122
3171
  }); }, {
3123
- requestId: requestId,
3172
+ methodName: methodName,
3124
3173
  clientId: clientId,
3125
3174
  agentName: agentName,
3126
3175
  swarmName: "",
@@ -3138,19 +3187,19 @@ var AgentPublicService = /** @class */ (function () {
3138
3187
  * @param {AgentName} agentName - The name of the agent.
3139
3188
  * @returns {Promise<unknown>} The execution result.
3140
3189
  */
3141
- this.execute = function (input, mode, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3190
+ this.execute = function (input, mode, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3142
3191
  var _this = this;
3143
3192
  return __generator(this, function (_a) {
3144
3193
  switch (_a.label) {
3145
3194
  case 0:
3146
- this.loggerService.log("agentPublicService execute", {
3147
- requestId: requestId,
3195
+ this.loggerService.info("agentPublicService execute", {
3196
+ methodName: methodName,
3148
3197
  input: input,
3149
3198
  clientId: clientId,
3150
3199
  agentName: agentName,
3151
3200
  mode: mode,
3152
3201
  });
3153
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3202
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3154
3203
  return __generator(this, function (_a) {
3155
3204
  switch (_a.label) {
3156
3205
  case 0: return [4 /*yield*/, this.agentConnectionService.execute(input, mode)];
@@ -3158,7 +3207,7 @@ var AgentPublicService = /** @class */ (function () {
3158
3207
  }
3159
3208
  });
3160
3209
  }); }, {
3161
- requestId: requestId,
3210
+ methodName: methodName,
3162
3211
  clientId: clientId,
3163
3212
  agentName: agentName,
3164
3213
  swarmName: "",
@@ -3175,17 +3224,17 @@ var AgentPublicService = /** @class */ (function () {
3175
3224
  * @param {AgentName} agentName - The name of the agent.
3176
3225
  * @returns {Promise<unknown>} The output result.
3177
3226
  */
3178
- this.waitForOutput = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3227
+ this.waitForOutput = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3179
3228
  var _this = this;
3180
3229
  return __generator(this, function (_a) {
3181
3230
  switch (_a.label) {
3182
3231
  case 0:
3183
- this.loggerService.log("agentPublicService waitForOutput", {
3184
- requestId: requestId,
3232
+ this.loggerService.info("agentPublicService waitForOutput", {
3233
+ methodName: methodName,
3185
3234
  clientId: clientId,
3186
3235
  agentName: agentName,
3187
3236
  });
3188
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3237
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3189
3238
  return __generator(this, function (_a) {
3190
3239
  switch (_a.label) {
3191
3240
  case 0: return [4 /*yield*/, this.agentConnectionService.waitForOutput()];
@@ -3193,7 +3242,7 @@ var AgentPublicService = /** @class */ (function () {
3193
3242
  }
3194
3243
  });
3195
3244
  }); }, {
3196
- requestId: requestId,
3245
+ methodName: methodName,
3197
3246
  clientId: clientId,
3198
3247
  agentName: agentName,
3199
3248
  swarmName: "",
@@ -3212,19 +3261,19 @@ var AgentPublicService = /** @class */ (function () {
3212
3261
  * @param {AgentName} agentName - The name of the agent.
3213
3262
  * @returns {Promise<unknown>} The commit result.
3214
3263
  */
3215
- this.commitToolOutput = function (toolId, content, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3264
+ this.commitToolOutput = function (toolId, content, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3216
3265
  var _this = this;
3217
3266
  return __generator(this, function (_a) {
3218
3267
  switch (_a.label) {
3219
3268
  case 0:
3220
- this.loggerService.log("agentPublicService commitToolOutput", {
3221
- requestId: requestId,
3269
+ this.loggerService.info("agentPublicService commitToolOutput", {
3270
+ methodName: methodName,
3222
3271
  content: content,
3223
3272
  clientId: clientId,
3224
3273
  toolId: toolId,
3225
3274
  agentName: agentName,
3226
3275
  });
3227
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3276
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3228
3277
  return __generator(this, function (_a) {
3229
3278
  switch (_a.label) {
3230
3279
  case 0: return [4 /*yield*/, this.agentConnectionService.commitToolOutput(toolId, content)];
@@ -3232,7 +3281,7 @@ var AgentPublicService = /** @class */ (function () {
3232
3281
  }
3233
3282
  });
3234
3283
  }); }, {
3235
- requestId: requestId,
3284
+ methodName: methodName,
3236
3285
  clientId: clientId,
3237
3286
  agentName: agentName,
3238
3287
  swarmName: "",
@@ -3250,18 +3299,18 @@ var AgentPublicService = /** @class */ (function () {
3250
3299
  * @param {AgentName} agentName - The name of the agent.
3251
3300
  * @returns {Promise<unknown>} The commit result.
3252
3301
  */
3253
- this.commitSystemMessage = function (message, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3302
+ this.commitSystemMessage = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3254
3303
  var _this = this;
3255
3304
  return __generator(this, function (_a) {
3256
3305
  switch (_a.label) {
3257
3306
  case 0:
3258
- this.loggerService.log("agentPublicService commitSystemMessage", {
3259
- requestId: requestId,
3307
+ this.loggerService.info("agentPublicService commitSystemMessage", {
3308
+ methodName: methodName,
3260
3309
  message: message,
3261
3310
  clientId: clientId,
3262
3311
  agentName: agentName,
3263
3312
  });
3264
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3313
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3265
3314
  return __generator(this, function (_a) {
3266
3315
  switch (_a.label) {
3267
3316
  case 0: return [4 /*yield*/, this.agentConnectionService.commitSystemMessage(message)];
@@ -3269,7 +3318,7 @@ var AgentPublicService = /** @class */ (function () {
3269
3318
  }
3270
3319
  });
3271
3320
  }); }, {
3272
- requestId: requestId,
3321
+ methodName: methodName,
3273
3322
  clientId: clientId,
3274
3323
  agentName: agentName,
3275
3324
  swarmName: "",
@@ -3287,18 +3336,18 @@ var AgentPublicService = /** @class */ (function () {
3287
3336
  * @param {AgentName} agentName - The name of the agent.
3288
3337
  * @returns {Promise<unknown>} The commit result.
3289
3338
  */
3290
- this.commitUserMessage = function (message, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3339
+ this.commitUserMessage = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3291
3340
  var _this = this;
3292
3341
  return __generator(this, function (_a) {
3293
3342
  switch (_a.label) {
3294
3343
  case 0:
3295
- this.loggerService.log("agentPublicService commitUserMessage", {
3296
- requestId: requestId,
3344
+ this.loggerService.info("agentPublicService commitUserMessage", {
3345
+ methodName: methodName,
3297
3346
  message: message,
3298
3347
  clientId: clientId,
3299
3348
  agentName: agentName,
3300
3349
  });
3301
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3350
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3302
3351
  return __generator(this, function (_a) {
3303
3352
  switch (_a.label) {
3304
3353
  case 0: return [4 /*yield*/, this.agentConnectionService.commitUserMessage(message)];
@@ -3306,7 +3355,7 @@ var AgentPublicService = /** @class */ (function () {
3306
3355
  }
3307
3356
  });
3308
3357
  }); }, {
3309
- requestId: requestId,
3358
+ methodName: methodName,
3310
3359
  clientId: clientId,
3311
3360
  agentName: agentName,
3312
3361
  swarmName: "",
@@ -3323,17 +3372,17 @@ var AgentPublicService = /** @class */ (function () {
3323
3372
  * @param {AgentName} agentName - The name of the agent.
3324
3373
  * @returns {Promise<unknown>} The commit result.
3325
3374
  */
3326
- this.commitFlush = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3375
+ this.commitFlush = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3327
3376
  var _this = this;
3328
3377
  return __generator(this, function (_a) {
3329
3378
  switch (_a.label) {
3330
3379
  case 0:
3331
- this.loggerService.log("agentPublicService commitFlush", {
3332
- requestId: requestId,
3380
+ this.loggerService.info("agentPublicService commitFlush", {
3381
+ methodName: methodName,
3333
3382
  clientId: clientId,
3334
3383
  agentName: agentName,
3335
3384
  });
3336
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3385
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3337
3386
  return __generator(this, function (_a) {
3338
3387
  switch (_a.label) {
3339
3388
  case 0: return [4 /*yield*/, this.agentConnectionService.commitFlush()];
@@ -3341,7 +3390,7 @@ var AgentPublicService = /** @class */ (function () {
3341
3390
  }
3342
3391
  });
3343
3392
  }); }, {
3344
- requestId: requestId,
3393
+ methodName: methodName,
3345
3394
  clientId: clientId,
3346
3395
  agentName: agentName,
3347
3396
  swarmName: "",
@@ -3358,17 +3407,17 @@ var AgentPublicService = /** @class */ (function () {
3358
3407
  * @param {AgentName} agentName - The name of the agent.
3359
3408
  * @returns {Promise<unknown>} The commit result.
3360
3409
  */
3361
- this.commitAgentChange = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3410
+ this.commitAgentChange = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3362
3411
  var _this = this;
3363
3412
  return __generator(this, function (_a) {
3364
3413
  switch (_a.label) {
3365
3414
  case 0:
3366
- this.loggerService.log("agentPublicService commitAgentChange", {
3367
- requestId: requestId,
3415
+ this.loggerService.info("agentPublicService commitAgentChange", {
3416
+ methodName: methodName,
3368
3417
  clientId: clientId,
3369
3418
  agentName: agentName,
3370
3419
  });
3371
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3420
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3372
3421
  return __generator(this, function (_a) {
3373
3422
  switch (_a.label) {
3374
3423
  case 0: return [4 /*yield*/, this.agentConnectionService.commitAgentChange()];
@@ -3376,7 +3425,7 @@ var AgentPublicService = /** @class */ (function () {
3376
3425
  }
3377
3426
  });
3378
3427
  }); }, {
3379
- requestId: requestId,
3428
+ methodName: methodName,
3380
3429
  clientId: clientId,
3381
3430
  agentName: agentName,
3382
3431
  swarmName: "",
@@ -3393,17 +3442,17 @@ var AgentPublicService = /** @class */ (function () {
3393
3442
  * @param {AgentName} agentName - The name of the agent.
3394
3443
  * @returns {Promise<unknown>} The dispose result.
3395
3444
  */
3396
- this.dispose = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3445
+ this.dispose = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3397
3446
  var _this = this;
3398
3447
  return __generator(this, function (_a) {
3399
3448
  switch (_a.label) {
3400
3449
  case 0:
3401
- this.loggerService.log("agentPublicService dispose", {
3402
- requestId: requestId,
3450
+ this.loggerService.info("agentPublicService dispose", {
3451
+ methodName: methodName,
3403
3452
  clientId: clientId,
3404
3453
  agentName: agentName,
3405
3454
  });
3406
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3455
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3407
3456
  return __generator(this, function (_a) {
3408
3457
  switch (_a.label) {
3409
3458
  case 0: return [4 /*yield*/, this.agentConnectionService.dispose()];
@@ -3411,7 +3460,7 @@ var AgentPublicService = /** @class */ (function () {
3411
3460
  }
3412
3461
  });
3413
3462
  }); }, {
3414
- requestId: requestId,
3463
+ methodName: methodName,
3415
3464
  clientId: clientId,
3416
3465
  agentName: agentName,
3417
3466
  swarmName: "",
@@ -3441,18 +3490,18 @@ var HistoryPublicService = /** @class */ (function () {
3441
3490
  * @param {AgentName} agentName - The agent name.
3442
3491
  * @returns {Promise<void>} A promise that resolves when the operation is complete.
3443
3492
  */
3444
- this.push = function (message, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3493
+ this.push = function (message, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3445
3494
  var _this = this;
3446
3495
  return __generator(this, function (_a) {
3447
3496
  switch (_a.label) {
3448
3497
  case 0:
3449
- this.loggerService.log("historyPublicService push", {
3450
- requestId: requestId,
3498
+ this.loggerService.info("historyPublicService push", {
3499
+ methodName: methodName,
3451
3500
  message: message,
3452
3501
  clientId: clientId,
3453
3502
  agentName: agentName,
3454
3503
  });
3455
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3504
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3456
3505
  return __generator(this, function (_a) {
3457
3506
  switch (_a.label) {
3458
3507
  case 0: return [4 /*yield*/, this.historyConnectionService.push(message)];
@@ -3460,7 +3509,7 @@ var HistoryPublicService = /** @class */ (function () {
3460
3509
  }
3461
3510
  });
3462
3511
  }); }, {
3463
- requestId: requestId,
3512
+ methodName: methodName,
3464
3513
  clientId: clientId,
3465
3514
  agentName: agentName,
3466
3515
  swarmName: "",
@@ -3478,17 +3527,17 @@ var HistoryPublicService = /** @class */ (function () {
3478
3527
  * @param {AgentName} agentName - The agent name.
3479
3528
  * @returns {Promise<any[]>} A promise that resolves to an array of history items.
3480
3529
  */
3481
- this.toArrayForAgent = function (prompt, requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3530
+ this.toArrayForAgent = function (prompt, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3482
3531
  var _this = this;
3483
3532
  return __generator(this, function (_a) {
3484
3533
  switch (_a.label) {
3485
3534
  case 0:
3486
- this.loggerService.log("historyPublicService toArrayForAgent", {
3535
+ this.loggerService.info("historyPublicService toArrayForAgent", {
3487
3536
  prompt: prompt,
3488
3537
  clientId: clientId,
3489
3538
  agentName: agentName,
3490
3539
  });
3491
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3540
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3492
3541
  return __generator(this, function (_a) {
3493
3542
  switch (_a.label) {
3494
3543
  case 0: return [4 /*yield*/, this.historyConnectionService.toArrayForAgent(prompt)];
@@ -3496,7 +3545,7 @@ var HistoryPublicService = /** @class */ (function () {
3496
3545
  }
3497
3546
  });
3498
3547
  }); }, {
3499
- requestId: requestId,
3548
+ methodName: methodName,
3500
3549
  clientId: clientId,
3501
3550
  agentName: agentName,
3502
3551
  swarmName: "",
@@ -3513,17 +3562,17 @@ var HistoryPublicService = /** @class */ (function () {
3513
3562
  * @param {AgentName} agentName - The agent name.
3514
3563
  * @returns {Promise<any[]>} A promise that resolves to a raw array of history items.
3515
3564
  */
3516
- this.toArrayForRaw = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3565
+ this.toArrayForRaw = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3517
3566
  var _this = this;
3518
3567
  return __generator(this, function (_a) {
3519
3568
  switch (_a.label) {
3520
3569
  case 0:
3521
- this.loggerService.log("historyPublicService toArrayForRaw", {
3522
- requestId: requestId,
3570
+ this.loggerService.info("historyPublicService toArrayForRaw", {
3571
+ methodName: methodName,
3523
3572
  clientId: clientId,
3524
3573
  agentName: agentName,
3525
3574
  });
3526
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3575
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3527
3576
  return __generator(this, function (_a) {
3528
3577
  switch (_a.label) {
3529
3578
  case 0: return [4 /*yield*/, this.historyConnectionService.toArrayForRaw()];
@@ -3531,7 +3580,7 @@ var HistoryPublicService = /** @class */ (function () {
3531
3580
  }
3532
3581
  });
3533
3582
  }); }, {
3534
- requestId: requestId,
3583
+ methodName: methodName,
3535
3584
  clientId: clientId,
3536
3585
  agentName: agentName,
3537
3586
  swarmName: "",
@@ -3548,16 +3597,16 @@ var HistoryPublicService = /** @class */ (function () {
3548
3597
  * @param {AgentName} agentName - The agent name.
3549
3598
  * @returns {Promise<void>} A promise that resolves when the operation is complete.
3550
3599
  */
3551
- this.dispose = function (requestId, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3600
+ this.dispose = function (methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
3552
3601
  var _this = this;
3553
3602
  return __generator(this, function (_a) {
3554
3603
  switch (_a.label) {
3555
3604
  case 0:
3556
- this.loggerService.log("historyPublicService dispose", {
3605
+ this.loggerService.info("historyPublicService dispose", {
3557
3606
  clientId: clientId,
3558
3607
  agentName: agentName,
3559
3608
  });
3560
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3609
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3561
3610
  return __generator(this, function (_a) {
3562
3611
  switch (_a.label) {
3563
3612
  case 0: return [4 /*yield*/, this.historyConnectionService.dispose()];
@@ -3565,7 +3614,7 @@ var HistoryPublicService = /** @class */ (function () {
3565
3614
  }
3566
3615
  });
3567
3616
  }); }, {
3568
- requestId: requestId,
3617
+ methodName: methodName,
3569
3618
  clientId: clientId,
3570
3619
  agentName: agentName,
3571
3620
  swarmName: "",
@@ -3595,18 +3644,18 @@ var SessionPublicService = /** @class */ (function () {
3595
3644
  * @param {SwarmName} swarmName - The swarm name.
3596
3645
  * @returns {Promise<void>}
3597
3646
  */
3598
- this.emit = function (content, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3647
+ this.emit = function (content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3599
3648
  var _this = this;
3600
3649
  return __generator(this, function (_a) {
3601
3650
  switch (_a.label) {
3602
3651
  case 0:
3603
- this.loggerService.log("sessionPublicService emit", {
3652
+ this.loggerService.info("sessionPublicService emit", {
3604
3653
  content: content,
3605
3654
  clientId: clientId,
3606
- requestId: requestId,
3655
+ methodName: methodName,
3607
3656
  swarmName: swarmName,
3608
3657
  });
3609
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3658
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3610
3659
  return __generator(this, function (_a) {
3611
3660
  switch (_a.label) {
3612
3661
  case 0: return [4 /*yield*/, this.sessionConnectionService.emit(content)];
@@ -3614,7 +3663,7 @@ var SessionPublicService = /** @class */ (function () {
3614
3663
  }
3615
3664
  });
3616
3665
  }); }, {
3617
- requestId: requestId,
3666
+ methodName: methodName,
3618
3667
  clientId: clientId,
3619
3668
  swarmName: swarmName,
3620
3669
  agentName: "",
@@ -3632,18 +3681,18 @@ var SessionPublicService = /** @class */ (function () {
3632
3681
  * @param {SwarmName} swarmName - The swarm name.
3633
3682
  * @returns {Promise<void>}
3634
3683
  */
3635
- this.execute = function (content, mode, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3684
+ this.execute = function (content, mode, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3636
3685
  var _this = this;
3637
3686
  return __generator(this, function (_a) {
3638
3687
  switch (_a.label) {
3639
3688
  case 0:
3640
- this.loggerService.log("sessionPublicService execute", {
3689
+ this.loggerService.info("sessionPublicService execute", {
3641
3690
  content: content,
3642
3691
  mode: mode,
3643
3692
  clientId: clientId,
3644
3693
  swarmName: swarmName,
3645
3694
  });
3646
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3695
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3647
3696
  return __generator(this, function (_a) {
3648
3697
  switch (_a.label) {
3649
3698
  case 0: return [4 /*yield*/, this.sessionConnectionService.execute(content, mode)];
@@ -3651,7 +3700,7 @@ var SessionPublicService = /** @class */ (function () {
3651
3700
  }
3652
3701
  });
3653
3702
  }); }, {
3654
- requestId: requestId,
3703
+ methodName: methodName,
3655
3704
  clientId: clientId,
3656
3705
  swarmName: swarmName,
3657
3706
  agentName: "",
@@ -3669,13 +3718,38 @@ var SessionPublicService = /** @class */ (function () {
3669
3718
  * @param {SwarmName} swarmName - The swarm name.
3670
3719
  * @returns {ReceiveMessageFn}
3671
3720
  */
3672
- this.connect = function (connector, requestId, clientId, swarmName) {
3673
- _this.loggerService.log("sessionPublicService connect", {
3674
- requestId: requestId,
3721
+ this.connect = function (connector, methodName, clientId, swarmName) {
3722
+ _this.loggerService.info("sessionPublicService connect", {
3723
+ methodName: methodName,
3675
3724
  clientId: clientId,
3676
3725
  swarmName: swarmName,
3677
3726
  });
3678
- return _this.sessionConnectionService.connect(connector, clientId, swarmName);
3727
+ var send = _this.sessionConnectionService.connect(connector, clientId, swarmName);
3728
+ return function (incoming) { return __awaiter(_this, void 0, void 0, function () {
3729
+ var executionId;
3730
+ var _this = this;
3731
+ return __generator(this, function (_a) {
3732
+ executionId = functoolsKit.randomString();
3733
+ return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3734
+ return __generator(this, function (_a) {
3735
+ switch (_a.label) {
3736
+ case 0:
3737
+ this.loggerService.log("sessionPublicService connect execute", {
3738
+ content: incoming,
3739
+ methodName: methodName,
3740
+ clientId: clientId,
3741
+ executionId: executionId,
3742
+ });
3743
+ return [4 /*yield*/, send(incoming)];
3744
+ case 1: return [2 /*return*/, _a.sent()];
3745
+ }
3746
+ });
3747
+ }); }, {
3748
+ clientId: clientId,
3749
+ executionId: executionId,
3750
+ })];
3751
+ });
3752
+ }); };
3679
3753
  };
3680
3754
  /**
3681
3755
  * Commits tool output to the session.
@@ -3685,19 +3759,19 @@ var SessionPublicService = /** @class */ (function () {
3685
3759
  * @param {SwarmName} swarmName - The swarm name.
3686
3760
  * @returns {Promise<void>}
3687
3761
  */
3688
- this.commitToolOutput = function (toolId, content, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3762
+ this.commitToolOutput = function (toolId, content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3689
3763
  var _this = this;
3690
3764
  return __generator(this, function (_a) {
3691
3765
  switch (_a.label) {
3692
3766
  case 0:
3693
- this.loggerService.log("sessionPublicService commitToolOutput", {
3694
- requestId: requestId,
3767
+ this.loggerService.info("sessionPublicService commitToolOutput", {
3768
+ methodName: methodName,
3695
3769
  toolId: toolId,
3696
3770
  content: content,
3697
3771
  clientId: clientId,
3698
3772
  swarmName: swarmName,
3699
3773
  });
3700
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3774
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3701
3775
  return __generator(this, function (_a) {
3702
3776
  switch (_a.label) {
3703
3777
  case 0: return [4 /*yield*/, this.sessionConnectionService.commitToolOutput(toolId, content)];
@@ -3705,7 +3779,7 @@ var SessionPublicService = /** @class */ (function () {
3705
3779
  }
3706
3780
  });
3707
3781
  }); }, {
3708
- requestId: requestId,
3782
+ methodName: methodName,
3709
3783
  clientId: clientId,
3710
3784
  swarmName: swarmName,
3711
3785
  agentName: "",
@@ -3723,18 +3797,18 @@ var SessionPublicService = /** @class */ (function () {
3723
3797
  * @param {SwarmName} swarmName - The swarm name.
3724
3798
  * @returns {Promise<void>}
3725
3799
  */
3726
- this.commitSystemMessage = function (message, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3800
+ this.commitSystemMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3727
3801
  var _this = this;
3728
3802
  return __generator(this, function (_a) {
3729
3803
  switch (_a.label) {
3730
3804
  case 0:
3731
- this.loggerService.log("sessionPublicService commitSystemMessage", {
3732
- requestId: requestId,
3805
+ this.loggerService.info("sessionPublicService commitSystemMessage", {
3806
+ methodName: methodName,
3733
3807
  message: message,
3734
3808
  clientId: clientId,
3735
3809
  swarmName: swarmName,
3736
3810
  });
3737
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3811
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3738
3812
  return __generator(this, function (_a) {
3739
3813
  switch (_a.label) {
3740
3814
  case 0: return [4 /*yield*/, this.sessionConnectionService.commitSystemMessage(message)];
@@ -3742,7 +3816,7 @@ var SessionPublicService = /** @class */ (function () {
3742
3816
  }
3743
3817
  });
3744
3818
  }); }, {
3745
- requestId: requestId,
3819
+ methodName: methodName,
3746
3820
  clientId: clientId,
3747
3821
  swarmName: swarmName,
3748
3822
  agentName: "",
@@ -3760,18 +3834,18 @@ var SessionPublicService = /** @class */ (function () {
3760
3834
  * @param {SwarmName} swarmName - The swarm name.
3761
3835
  * @returns {Promise<void>}
3762
3836
  */
3763
- this.commitUserMessage = function (message, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3837
+ this.commitUserMessage = function (message, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3764
3838
  var _this = this;
3765
3839
  return __generator(this, function (_a) {
3766
3840
  switch (_a.label) {
3767
3841
  case 0:
3768
- this.loggerService.log("sessionPublicService commitUserMessage", {
3769
- requestId: requestId,
3842
+ this.loggerService.info("sessionPublicService commitUserMessage", {
3843
+ methodName: methodName,
3770
3844
  message: message,
3771
3845
  clientId: clientId,
3772
3846
  swarmName: swarmName,
3773
3847
  });
3774
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3848
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3775
3849
  return __generator(this, function (_a) {
3776
3850
  switch (_a.label) {
3777
3851
  case 0: return [4 /*yield*/, this.sessionConnectionService.commitUserMessage(message)];
@@ -3779,7 +3853,7 @@ var SessionPublicService = /** @class */ (function () {
3779
3853
  }
3780
3854
  });
3781
3855
  }); }, {
3782
- requestId: requestId,
3856
+ methodName: methodName,
3783
3857
  clientId: clientId,
3784
3858
  swarmName: swarmName,
3785
3859
  agentName: "",
@@ -3796,16 +3870,16 @@ var SessionPublicService = /** @class */ (function () {
3796
3870
  * @param {SwarmName} swarmName - The swarm name.
3797
3871
  * @returns {Promise<void>}
3798
3872
  */
3799
- this.commitFlush = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3873
+ this.commitFlush = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3800
3874
  var _this = this;
3801
3875
  return __generator(this, function (_a) {
3802
3876
  switch (_a.label) {
3803
3877
  case 0:
3804
- this.loggerService.log("sessionPublicService commitFlush", {
3878
+ this.loggerService.info("sessionPublicService commitFlush", {
3805
3879
  clientId: clientId,
3806
3880
  swarmName: swarmName,
3807
3881
  });
3808
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3882
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3809
3883
  return __generator(this, function (_a) {
3810
3884
  switch (_a.label) {
3811
3885
  case 0: return [4 /*yield*/, this.sessionConnectionService.commitFlush()];
@@ -3813,7 +3887,7 @@ var SessionPublicService = /** @class */ (function () {
3813
3887
  }
3814
3888
  });
3815
3889
  }); }, {
3816
- requestId: requestId,
3890
+ methodName: methodName,
3817
3891
  clientId: clientId,
3818
3892
  swarmName: swarmName,
3819
3893
  agentName: "",
@@ -3830,17 +3904,17 @@ var SessionPublicService = /** @class */ (function () {
3830
3904
  * @param {SwarmName} swarmName - The swarm name.
3831
3905
  * @returns {Promise<void>}
3832
3906
  */
3833
- this.dispose = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3907
+ this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3834
3908
  var _this = this;
3835
3909
  return __generator(this, function (_a) {
3836
3910
  switch (_a.label) {
3837
3911
  case 0:
3838
- this.loggerService.log("sessionPublicService dispose", {
3839
- requestId: requestId,
3912
+ this.loggerService.info("sessionPublicService dispose", {
3913
+ methodName: methodName,
3840
3914
  clientId: clientId,
3841
3915
  swarmName: swarmName,
3842
3916
  });
3843
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3917
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3844
3918
  return __generator(this, function (_a) {
3845
3919
  switch (_a.label) {
3846
3920
  case 0: return [4 /*yield*/, this.sessionConnectionService.dispose()];
@@ -3848,7 +3922,7 @@ var SessionPublicService = /** @class */ (function () {
3848
3922
  }
3849
3923
  });
3850
3924
  }); }, {
3851
- requestId: requestId,
3925
+ methodName: methodName,
3852
3926
  clientId: clientId,
3853
3927
  swarmName: swarmName,
3854
3928
  agentName: "",
@@ -3877,16 +3951,16 @@ var SwarmPublicService = /** @class */ (function () {
3877
3951
  * @param {SwarmName} swarmName - The swarm name.
3878
3952
  * @returns {Promise<void>}
3879
3953
  */
3880
- this.cancelOutput = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3954
+ this.cancelOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3881
3955
  var _this = this;
3882
3956
  return __generator(this, function (_a) {
3883
3957
  switch (_a.label) {
3884
3958
  case 0:
3885
- this.loggerService.log("swarmPublicService cancelOutput", {
3959
+ this.loggerService.info("swarmPublicService cancelOutput", {
3886
3960
  clientId: clientId,
3887
3961
  swarmName: swarmName,
3888
3962
  });
3889
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3963
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3890
3964
  return __generator(this, function (_a) {
3891
3965
  switch (_a.label) {
3892
3966
  case 0: return [4 /*yield*/, this.swarmConnectionService.cancelOutput()];
@@ -3894,7 +3968,7 @@ var SwarmPublicService = /** @class */ (function () {
3894
3968
  }
3895
3969
  });
3896
3970
  }); }, {
3897
- requestId: requestId,
3971
+ methodName: methodName,
3898
3972
  clientId: clientId,
3899
3973
  swarmName: swarmName,
3900
3974
  agentName: "",
@@ -3911,17 +3985,17 @@ var SwarmPublicService = /** @class */ (function () {
3911
3985
  * @param {SwarmName} swarmName - The swarm name.
3912
3986
  * @returns {Promise<void>}
3913
3987
  */
3914
- this.waitForOutput = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3988
+ this.waitForOutput = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3915
3989
  var _this = this;
3916
3990
  return __generator(this, function (_a) {
3917
3991
  switch (_a.label) {
3918
3992
  case 0:
3919
- this.loggerService.log("swarmPublicService waitForOutput", {
3993
+ this.loggerService.info("swarmPublicService waitForOutput", {
3920
3994
  clientId: clientId,
3921
- requestId: requestId,
3995
+ methodName: methodName,
3922
3996
  swarmName: swarmName,
3923
3997
  });
3924
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3998
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3925
3999
  return __generator(this, function (_a) {
3926
4000
  switch (_a.label) {
3927
4001
  case 0: return [4 /*yield*/, this.swarmConnectionService.waitForOutput()];
@@ -3929,7 +4003,7 @@ var SwarmPublicService = /** @class */ (function () {
3929
4003
  }
3930
4004
  });
3931
4005
  }); }, {
3932
- requestId: requestId,
4006
+ methodName: methodName,
3933
4007
  clientId: clientId,
3934
4008
  swarmName: swarmName,
3935
4009
  agentName: "",
@@ -3946,17 +4020,17 @@ var SwarmPublicService = /** @class */ (function () {
3946
4020
  * @param {SwarmName} swarmName - The swarm name.
3947
4021
  * @returns {Promise<string>}
3948
4022
  */
3949
- this.getAgentName = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4023
+ this.getAgentName = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3950
4024
  var _this = this;
3951
4025
  return __generator(this, function (_a) {
3952
4026
  switch (_a.label) {
3953
4027
  case 0:
3954
- this.loggerService.log("swarmPublicService getAgentName", {
4028
+ this.loggerService.info("swarmPublicService getAgentName", {
3955
4029
  clientId: clientId,
3956
4030
  swarmName: swarmName,
3957
- requestId: requestId,
4031
+ methodName: methodName,
3958
4032
  });
3959
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4033
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3960
4034
  return __generator(this, function (_a) {
3961
4035
  switch (_a.label) {
3962
4036
  case 0: return [4 /*yield*/, this.swarmConnectionService.getAgentName()];
@@ -3964,7 +4038,7 @@ var SwarmPublicService = /** @class */ (function () {
3964
4038
  }
3965
4039
  });
3966
4040
  }); }, {
3967
- requestId: requestId,
4041
+ methodName: methodName,
3968
4042
  clientId: clientId,
3969
4043
  swarmName: swarmName,
3970
4044
  agentName: "",
@@ -3981,16 +4055,16 @@ var SwarmPublicService = /** @class */ (function () {
3981
4055
  * @param {SwarmName} swarmName - The swarm name.
3982
4056
  * @returns {Promise<IAgent>}
3983
4057
  */
3984
- this.getAgent = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4058
+ this.getAgent = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
3985
4059
  var _this = this;
3986
4060
  return __generator(this, function (_a) {
3987
4061
  switch (_a.label) {
3988
4062
  case 0:
3989
- this.loggerService.log("swarmPublicService getAgent", {
4063
+ this.loggerService.info("swarmPublicService getAgent", {
3990
4064
  clientId: clientId,
3991
4065
  swarmName: swarmName,
3992
4066
  });
3993
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4067
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
3994
4068
  return __generator(this, function (_a) {
3995
4069
  switch (_a.label) {
3996
4070
  case 0: return [4 /*yield*/, this.swarmConnectionService.getAgent()];
@@ -3998,7 +4072,7 @@ var SwarmPublicService = /** @class */ (function () {
3998
4072
  }
3999
4073
  });
4000
4074
  }); }, {
4001
- requestId: requestId,
4075
+ methodName: methodName,
4002
4076
  clientId: clientId,
4003
4077
  swarmName: swarmName,
4004
4078
  agentName: "",
@@ -4017,19 +4091,19 @@ var SwarmPublicService = /** @class */ (function () {
4017
4091
  * @param {IAgent} agent - The agent instance.
4018
4092
  * @returns {Promise<void>}
4019
4093
  */
4020
- this.setAgentRef = function (requestId, clientId, swarmName, agentName, agent) { return __awaiter(_this, void 0, void 0, function () {
4094
+ this.setAgentRef = function (methodName, clientId, swarmName, agentName, agent) { return __awaiter(_this, void 0, void 0, function () {
4021
4095
  var _this = this;
4022
4096
  return __generator(this, function (_a) {
4023
4097
  switch (_a.label) {
4024
4098
  case 0:
4025
- this.loggerService.log("swarmPublicService setAgentRef", {
4026
- requestId: requestId,
4099
+ this.loggerService.info("swarmPublicService setAgentRef", {
4100
+ methodName: methodName,
4027
4101
  agentName: agentName,
4028
4102
  agent: agent,
4029
4103
  clientId: clientId,
4030
4104
  swarmName: swarmName,
4031
4105
  });
4032
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4106
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4033
4107
  return __generator(this, function (_a) {
4034
4108
  switch (_a.label) {
4035
4109
  case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentRef(agentName, agent)];
@@ -4037,7 +4111,7 @@ var SwarmPublicService = /** @class */ (function () {
4037
4111
  }
4038
4112
  });
4039
4113
  }); }, {
4040
- requestId: requestId,
4114
+ methodName: methodName,
4041
4115
  clientId: clientId,
4042
4116
  swarmName: swarmName,
4043
4117
  agentName: "",
@@ -4055,18 +4129,18 @@ var SwarmPublicService = /** @class */ (function () {
4055
4129
  * @param {SwarmName} swarmName - The swarm name.
4056
4130
  * @returns {Promise<void>}
4057
4131
  */
4058
- this.setAgentName = function (agentName, requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4132
+ this.setAgentName = function (agentName, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4059
4133
  var _this = this;
4060
4134
  return __generator(this, function (_a) {
4061
4135
  switch (_a.label) {
4062
4136
  case 0:
4063
- this.loggerService.log("swarmPublicService setAgentName", {
4064
- requestId: requestId,
4137
+ this.loggerService.info("swarmPublicService setAgentName", {
4138
+ methodName: methodName,
4065
4139
  agentName: agentName,
4066
4140
  clientId: clientId,
4067
4141
  swarmName: swarmName,
4068
4142
  });
4069
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4143
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4070
4144
  return __generator(this, function (_a) {
4071
4145
  switch (_a.label) {
4072
4146
  case 0: return [4 /*yield*/, this.swarmConnectionService.setAgentName(agentName)];
@@ -4074,7 +4148,7 @@ var SwarmPublicService = /** @class */ (function () {
4074
4148
  }
4075
4149
  });
4076
4150
  }); }, {
4077
- requestId: requestId,
4151
+ methodName: methodName,
4078
4152
  clientId: clientId,
4079
4153
  swarmName: swarmName,
4080
4154
  agentName: "",
@@ -4091,17 +4165,17 @@ var SwarmPublicService = /** @class */ (function () {
4091
4165
  * @param {SwarmName} swarmName - The swarm name.
4092
4166
  * @returns {Promise<void>}
4093
4167
  */
4094
- this.dispose = function (requestId, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4168
+ this.dispose = function (methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
4095
4169
  var _this = this;
4096
4170
  return __generator(this, function (_a) {
4097
4171
  switch (_a.label) {
4098
4172
  case 0:
4099
- this.loggerService.log("swarmPublicService dispose", {
4100
- requestId: requestId,
4173
+ this.loggerService.info("swarmPublicService dispose", {
4174
+ methodName: methodName,
4101
4175
  clientId: clientId,
4102
4176
  swarmName: swarmName,
4103
4177
  });
4104
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4178
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
4105
4179
  return __generator(this, function (_a) {
4106
4180
  switch (_a.label) {
4107
4181
  case 0: return [4 /*yield*/, this.swarmConnectionService.dispose()];
@@ -4109,7 +4183,7 @@ var SwarmPublicService = /** @class */ (function () {
4109
4183
  }
4110
4184
  });
4111
4185
  }); }, {
4112
- requestId: requestId,
4186
+ methodName: methodName,
4113
4187
  clientId: clientId,
4114
4188
  swarmName: swarmName,
4115
4189
  agentName: "",
@@ -4166,7 +4240,7 @@ var AgentValidationService = /** @class */ (function () {
4166
4240
  * @throws {Error} If the agent already exists.
4167
4241
  */
4168
4242
  this.addAgent = function (agentName, agentSchema) {
4169
- _this.loggerService.log("agentValidationService addAgent", {
4243
+ _this.loggerService.info("agentValidationService addAgent", {
4170
4244
  agentName: agentName,
4171
4245
  agentSchema: agentSchema,
4172
4246
  });
@@ -4182,7 +4256,7 @@ var AgentValidationService = /** @class */ (function () {
4182
4256
  var _b = __read(_a, 2), agentName = _b[0], storageName = _b[1];
4183
4257
  return "".concat(agentName, "-").concat(storageName);
4184
4258
  }, function (agentName, storageName) {
4185
- _this.loggerService.log("agentValidationService hasStorage", {
4259
+ _this.loggerService.info("agentValidationService hasStorage", {
4186
4260
  agentName: agentName,
4187
4261
  storageName: storageName,
4188
4262
  });
@@ -4199,7 +4273,7 @@ var AgentValidationService = /** @class */ (function () {
4199
4273
  var _b = __read(_a, 2), agentName = _b[0], stateName = _b[1];
4200
4274
  return "".concat(agentName, "-").concat(stateName);
4201
4275
  }, function (agentName, stateName) {
4202
- _this.loggerService.log("agentValidationService hasState", {
4276
+ _this.loggerService.info("agentValidationService hasState", {
4203
4277
  agentName: agentName,
4204
4278
  stateName: stateName,
4205
4279
  });
@@ -4220,7 +4294,7 @@ var AgentValidationService = /** @class */ (function () {
4220
4294
  return agentName;
4221
4295
  }, function (agentName, source) {
4222
4296
  var _a, _b;
4223
- _this.loggerService.log("agentValidationService validate", {
4297
+ _this.loggerService.info("agentValidationService validate", {
4224
4298
  agentName: agentName,
4225
4299
  source: source,
4226
4300
  });
@@ -4261,7 +4335,7 @@ var CompletionValidationService = /** @class */ (function () {
4261
4335
  * @throws Will throw an error if the completion name already exists.
4262
4336
  */
4263
4337
  this.addCompletion = function (completionName) {
4264
- _this.loggerService.log("completionValidationService addCompletion", {
4338
+ _this.loggerService.info("completionValidationService addCompletion", {
4265
4339
  completionName: completionName,
4266
4340
  });
4267
4341
  if (_this._completionSet.has(completionName)) {
@@ -4279,7 +4353,7 @@ var CompletionValidationService = /** @class */ (function () {
4279
4353
  var _b = __read(_a, 1), completionName = _b[0];
4280
4354
  return completionName;
4281
4355
  }, function (completionName, source) {
4282
- _this.loggerService.log("completionValidationService validate", {
4356
+ _this.loggerService.info("completionValidationService validate", {
4283
4357
  completionName: completionName,
4284
4358
  source: source,
4285
4359
  });
@@ -4313,7 +4387,7 @@ var SessionValidationService = /** @class */ (function () {
4313
4387
  * @throws Will throw an error if the session already exists.
4314
4388
  */
4315
4389
  this.addSession = function (clientId, swarmName, sessionMode) {
4316
- _this.loggerService.log("sessionValidationService addSession", {
4390
+ _this.loggerService.info("sessionValidationService addSession", {
4317
4391
  clientId: clientId,
4318
4392
  });
4319
4393
  if (_this._sessionSwarmMap.has(clientId)) {
@@ -4328,7 +4402,7 @@ var SessionValidationService = /** @class */ (function () {
4328
4402
  * @param {AgentName} agentName - The name of the agent.
4329
4403
  */
4330
4404
  this.addAgentUsage = function (sessionId, agentName) {
4331
- _this.loggerService.log("sessionValidationService addAgentUsage", {
4405
+ _this.loggerService.info("sessionValidationService addAgentUsage", {
4332
4406
  sessionId: sessionId,
4333
4407
  agentName: agentName,
4334
4408
  });
@@ -4348,7 +4422,7 @@ var SessionValidationService = /** @class */ (function () {
4348
4422
  * @param {AgentName} agentName - The name of the agent.
4349
4423
  */
4350
4424
  this.addHistoryUsage = function (sessionId, agentName) {
4351
- _this.loggerService.log("sessionValidationService addHistoryUsage", {
4425
+ _this.loggerService.info("sessionValidationService addHistoryUsage", {
4352
4426
  sessionId: sessionId,
4353
4427
  agentName: agentName,
4354
4428
  });
@@ -4368,7 +4442,7 @@ var SessionValidationService = /** @class */ (function () {
4368
4442
  * @param {StorageName} storageName - The name of the storage.
4369
4443
  */
4370
4444
  this.addStorageUsage = function (sessionId, storageName) {
4371
- _this.loggerService.log("sessionValidationService addStorageUsage", {
4445
+ _this.loggerService.info("sessionValidationService addStorageUsage", {
4372
4446
  sessionId: sessionId,
4373
4447
  storageName: storageName,
4374
4448
  });
@@ -4388,7 +4462,7 @@ var SessionValidationService = /** @class */ (function () {
4388
4462
  * @param {StateName} stateName - The name of the state.
4389
4463
  */
4390
4464
  this.addStateUsage = function (sessionId, stateName) {
4391
- _this.loggerService.log("sessionValidationService addStateUsage", {
4465
+ _this.loggerService.info("sessionValidationService addStateUsage", {
4392
4466
  sessionId: sessionId,
4393
4467
  stateName: stateName,
4394
4468
  });
@@ -4409,7 +4483,7 @@ var SessionValidationService = /** @class */ (function () {
4409
4483
  * @throws Will throw an error if no agents are found for the session.
4410
4484
  */
4411
4485
  this.removeAgentUsage = function (sessionId, agentName) {
4412
- _this.loggerService.log("sessionValidationService removeAgentUsage", {
4486
+ _this.loggerService.info("sessionValidationService removeAgentUsage", {
4413
4487
  sessionId: sessionId,
4414
4488
  agentName: agentName,
4415
4489
  });
@@ -4434,7 +4508,7 @@ var SessionValidationService = /** @class */ (function () {
4434
4508
  * @throws Will throw an error if no agents are found for the session.
4435
4509
  */
4436
4510
  this.removeHistoryUsage = function (sessionId, agentName) {
4437
- _this.loggerService.log("sessionValidationService removeHistoryUsage", {
4511
+ _this.loggerService.info("sessionValidationService removeHistoryUsage", {
4438
4512
  sessionId: sessionId,
4439
4513
  agentName: agentName,
4440
4514
  });
@@ -4459,7 +4533,7 @@ var SessionValidationService = /** @class */ (function () {
4459
4533
  * @throws Will throw an error if no storages are found for the session.
4460
4534
  */
4461
4535
  this.removeStorageUsage = function (sessionId, storageName) {
4462
- _this.loggerService.log("sessionValidationService removeStorageUsage", {
4536
+ _this.loggerService.info("sessionValidationService removeStorageUsage", {
4463
4537
  sessionId: sessionId,
4464
4538
  storageName: storageName,
4465
4539
  });
@@ -4484,7 +4558,7 @@ var SessionValidationService = /** @class */ (function () {
4484
4558
  * @throws Will throw an error if no states are found for the session.
4485
4559
  */
4486
4560
  this.removeStateUsage = function (sessionId, stateName) {
4487
- _this.loggerService.log("sessionValidationService removeStateUsage", {
4561
+ _this.loggerService.info("sessionValidationService removeStateUsage", {
4488
4562
  sessionId: sessionId,
4489
4563
  stateName: stateName,
4490
4564
  });
@@ -4509,7 +4583,7 @@ var SessionValidationService = /** @class */ (function () {
4509
4583
  * @throws Will throw an error if the session does not exist.
4510
4584
  */
4511
4585
  this.getSessionMode = function (clientId) {
4512
- _this.loggerService.log("sessionValidationService getSessionMode", {
4586
+ _this.loggerService.info("sessionValidationService getSessionMode", {
4513
4587
  clientId: clientId,
4514
4588
  });
4515
4589
  if (!_this._sessionModeMap.has(clientId)) {
@@ -4522,7 +4596,7 @@ var SessionValidationService = /** @class */ (function () {
4522
4596
  * @returns {boolean}
4523
4597
  */
4524
4598
  this.hasSession = function (clientId) {
4525
- _this.loggerService.log("sessionValidationService hasSession");
4599
+ _this.loggerService.info("sessionValidationService hasSession");
4526
4600
  return _this._sessionSwarmMap.has(clientId);
4527
4601
  };
4528
4602
  /**
@@ -4530,7 +4604,7 @@ var SessionValidationService = /** @class */ (function () {
4530
4604
  * @returns {SessionId[]} The list of session IDs.
4531
4605
  */
4532
4606
  this.getSessionList = function () {
4533
- _this.loggerService.log("sessionValidationService getSessionList");
4607
+ _this.loggerService.info("sessionValidationService getSessionList");
4534
4608
  return __spreadArray([], __read(_this._sessionSwarmMap.keys()), false);
4535
4609
  };
4536
4610
  /**
@@ -4540,7 +4614,7 @@ var SessionValidationService = /** @class */ (function () {
4540
4614
  */
4541
4615
  this.getSessionAgentList = function (clientId) {
4542
4616
  var _a;
4543
- _this.loggerService.log("sessionValidationService getSessionAgentList", {
4617
+ _this.loggerService.info("sessionValidationService getSessionAgentList", {
4544
4618
  clientId: clientId,
4545
4619
  });
4546
4620
  return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
@@ -4552,7 +4626,7 @@ var SessionValidationService = /** @class */ (function () {
4552
4626
  */
4553
4627
  this.getSessionHistoryList = function (clientId) {
4554
4628
  var _a;
4555
- _this.loggerService.log("sessionValidationService getSessionHistoryList", {
4629
+ _this.loggerService.info("sessionValidationService getSessionHistoryList", {
4556
4630
  clientId: clientId,
4557
4631
  });
4558
4632
  return (_a = _this._agentSwarmMap.get(clientId)) !== null && _a !== void 0 ? _a : [];
@@ -4564,7 +4638,7 @@ var SessionValidationService = /** @class */ (function () {
4564
4638
  * @throws Will throw an error if the session does not exist.
4565
4639
  */
4566
4640
  this.getSwarm = function (clientId) {
4567
- _this.loggerService.log("sessionValidationService getSwarm", {
4641
+ _this.loggerService.info("sessionValidationService getSwarm", {
4568
4642
  clientId: clientId,
4569
4643
  });
4570
4644
  var session = _this._sessionSwarmMap.get(clientId);
@@ -4580,7 +4654,7 @@ var SessionValidationService = /** @class */ (function () {
4580
4654
  * @throws Will throw an error if the session does not exist.
4581
4655
  */
4582
4656
  this.validate = function (clientId, source) {
4583
- _this.loggerService.log("sessionValidationService validate", { clientId: clientId });
4657
+ _this.loggerService.info("sessionValidationService validate", { clientId: clientId });
4584
4658
  if (!_this._sessionSwarmMap.has(clientId)) {
4585
4659
  throw new Error("agent-swarm session clientId=".concat(clientId, " not exist source=").concat(source));
4586
4660
  }
@@ -4591,7 +4665,7 @@ var SessionValidationService = /** @class */ (function () {
4591
4665
  * @param {SessionId} clientId - The ID of the client.
4592
4666
  */
4593
4667
  this.removeSession = function (clientId) {
4594
- _this.loggerService.log("sessionValidationService addSession", {
4668
+ _this.loggerService.info("sessionValidationService addSession", {
4595
4669
  clientId: clientId,
4596
4670
  });
4597
4671
  _this._sessionSwarmMap.delete(clientId);
@@ -4617,7 +4691,7 @@ var SwarmValidationService = /** @class */ (function () {
4617
4691
  * @throws Will throw an error if the swarm already exists.
4618
4692
  */
4619
4693
  this.addSwarm = function (swarmName, swarmSchema) {
4620
- _this.loggerService.log("swarmValidationService addSwarm", {
4694
+ _this.loggerService.info("swarmValidationService addSwarm", {
4621
4695
  swarmName: swarmName,
4622
4696
  swarmSchema: swarmSchema,
4623
4697
  });
@@ -4633,7 +4707,7 @@ var SwarmValidationService = /** @class */ (function () {
4633
4707
  * @throws Will throw an error if the swarm is not found.
4634
4708
  */
4635
4709
  this.getAgentList = function (swarmName) {
4636
- _this.loggerService.log("swarmValidationService getAgentList", {
4710
+ _this.loggerService.info("swarmValidationService getAgentList", {
4637
4711
  swarmName: swarmName,
4638
4712
  });
4639
4713
  var swarm = _this._swarmMap.get(swarmName);
@@ -4652,7 +4726,7 @@ var SwarmValidationService = /** @class */ (function () {
4652
4726
  var _b = __read(_a, 1), swarmName = _b[0];
4653
4727
  return swarmName;
4654
4728
  }, function (swarmName, source) {
4655
- _this.loggerService.log("swarmValidationService validate", {
4729
+ _this.loggerService.info("swarmValidationService validate", {
4656
4730
  swarmName: swarmName,
4657
4731
  source: source,
4658
4732
  });
@@ -4687,7 +4761,7 @@ var ToolValidationService = /** @class */ (function () {
4687
4761
  * @throws Will throw an error if the tool already exists.
4688
4762
  */
4689
4763
  this.addTool = function (toolName, toolSchema) {
4690
- _this.loggerService.log("toolValidationService addTool", {
4764
+ _this.loggerService.info("toolValidationService addTool", {
4691
4765
  toolName: toolName,
4692
4766
  toolSchema: toolSchema,
4693
4767
  });
@@ -4706,7 +4780,7 @@ var ToolValidationService = /** @class */ (function () {
4706
4780
  var _b = __read(_a, 1), toolName = _b[0];
4707
4781
  return toolName;
4708
4782
  }, function (toolName, source) {
4709
- _this.loggerService.log("toolValidationService validate", {
4783
+ _this.loggerService.info("toolValidationService validate", {
4710
4784
  toolName: toolName,
4711
4785
  source: source,
4712
4786
  });
@@ -4733,7 +4807,7 @@ var EmbeddingSchemaService = /** @class */ (function () {
4733
4807
  * @param {IAgentTool} value - The embedding to register.
4734
4808
  */
4735
4809
  this.register = function (key, value) {
4736
- _this.loggerService.log('embeddingSchemaService register');
4810
+ _this.loggerService.info('embeddingSchemaService register');
4737
4811
  _this.registry = _this.registry.register(key, value);
4738
4812
  };
4739
4813
  /**
@@ -4742,7 +4816,7 @@ var EmbeddingSchemaService = /** @class */ (function () {
4742
4816
  * @returns {IAgentTool} The embedding associated with the given key.
4743
4817
  */
4744
4818
  this.get = function (key) {
4745
- _this.loggerService.log('embeddingSchemaService get', { key: key });
4819
+ _this.loggerService.info('embeddingSchemaService get', { key: key });
4746
4820
  return _this.registry.get(key);
4747
4821
  };
4748
4822
  }
@@ -4763,7 +4837,7 @@ var StorageSchemaService = /** @class */ (function () {
4763
4837
  * @param {IStorageSchema} value - The schema to register.
4764
4838
  */
4765
4839
  this.register = function (key, value) {
4766
- _this.loggerService.log("storageSchemaService register", { key: key });
4840
+ _this.loggerService.info("storageSchemaService register", { key: key });
4767
4841
  _this.registry = _this.registry.register(key, value);
4768
4842
  };
4769
4843
  /**
@@ -4772,7 +4846,7 @@ var StorageSchemaService = /** @class */ (function () {
4772
4846
  * @returns {IStorageSchema} The retrieved schema.
4773
4847
  */
4774
4848
  this.get = function (key) {
4775
- _this.loggerService.log("storageSchemaService get", { key: key });
4849
+ _this.loggerService.info("storageSchemaService get", { key: key });
4776
4850
  return _this.registry.get(key);
4777
4851
  };
4778
4852
  }
@@ -5151,7 +5225,7 @@ var StorageConnectionService = /** @class */ (function () {
5151
5225
  var _this = this;
5152
5226
  this.loggerService = inject(TYPES.loggerService);
5153
5227
  this.busService = inject(TYPES.busService);
5154
- this.contextService = inject(TYPES.contextService);
5228
+ this.methodContextService = inject(TYPES.methodContextService);
5155
5229
  this.storageSchemaService = inject(TYPES.storageSchemaService);
5156
5230
  this.sessionValidationService = inject(TYPES.sessionValidationService);
5157
5231
  this.embeddingSchemaService = inject(TYPES.embeddingSchemaService);
@@ -5201,12 +5275,12 @@ var StorageConnectionService = /** @class */ (function () {
5201
5275
  return __generator(this, function (_a) {
5202
5276
  switch (_a.label) {
5203
5277
  case 0:
5204
- this.loggerService.log("storageConnectionService take", {
5278
+ this.loggerService.info("storageConnectionService take", {
5205
5279
  search: search,
5206
5280
  total: total,
5207
5281
  score: score,
5208
5282
  });
5209
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5283
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5210
5284
  return [4 /*yield*/, storage.waitForInit()];
5211
5285
  case 1:
5212
5286
  _a.sent();
@@ -5225,10 +5299,10 @@ var StorageConnectionService = /** @class */ (function () {
5225
5299
  return __generator(this, function (_a) {
5226
5300
  switch (_a.label) {
5227
5301
  case 0:
5228
- this.loggerService.log("storageConnectionService upsert", {
5302
+ this.loggerService.info("storageConnectionService upsert", {
5229
5303
  item: item,
5230
5304
  });
5231
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5305
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5232
5306
  return [4 /*yield*/, storage.waitForInit()];
5233
5307
  case 1:
5234
5308
  _a.sent();
@@ -5247,10 +5321,10 @@ var StorageConnectionService = /** @class */ (function () {
5247
5321
  return __generator(this, function (_a) {
5248
5322
  switch (_a.label) {
5249
5323
  case 0:
5250
- this.loggerService.log("storageConnectionService remove", {
5324
+ this.loggerService.info("storageConnectionService remove", {
5251
5325
  itemId: itemId,
5252
5326
  });
5253
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5327
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5254
5328
  return [4 /*yield*/, storage.waitForInit()];
5255
5329
  case 1:
5256
5330
  _a.sent();
@@ -5269,10 +5343,10 @@ var StorageConnectionService = /** @class */ (function () {
5269
5343
  return __generator(this, function (_a) {
5270
5344
  switch (_a.label) {
5271
5345
  case 0:
5272
- this.loggerService.log("storageConnectionService get", {
5346
+ this.loggerService.info("storageConnectionService get", {
5273
5347
  itemId: itemId,
5274
5348
  });
5275
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5349
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5276
5350
  return [4 /*yield*/, storage.waitForInit()];
5277
5351
  case 1:
5278
5352
  _a.sent();
@@ -5291,8 +5365,8 @@ var StorageConnectionService = /** @class */ (function () {
5291
5365
  return __generator(this, function (_a) {
5292
5366
  switch (_a.label) {
5293
5367
  case 0:
5294
- this.loggerService.log("storageConnectionService list");
5295
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5368
+ this.loggerService.info("storageConnectionService list");
5369
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5296
5370
  return [4 /*yield*/, storage.waitForInit()];
5297
5371
  case 1:
5298
5372
  _a.sent();
@@ -5310,8 +5384,8 @@ var StorageConnectionService = /** @class */ (function () {
5310
5384
  return __generator(this, function (_a) {
5311
5385
  switch (_a.label) {
5312
5386
  case 0:
5313
- this.loggerService.log("storageConnectionService clear");
5314
- storage = this.getStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5387
+ this.loggerService.info("storageConnectionService clear");
5388
+ storage = this.getStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5315
5389
  return [4 /*yield*/, storage.waitForInit()];
5316
5390
  case 1:
5317
5391
  _a.sent();
@@ -5329,13 +5403,13 @@ var StorageConnectionService = /** @class */ (function () {
5329
5403
  return __generator(this, function (_a) {
5330
5404
  switch (_a.label) {
5331
5405
  case 0:
5332
- this.loggerService.log("storageConnectionService dispose");
5333
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.storageName);
5406
+ this.loggerService.info("storageConnectionService dispose");
5407
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.storageName);
5334
5408
  if (!this.getStorage.has(key)) {
5335
5409
  return [2 /*return*/];
5336
5410
  }
5337
- if (!!this.getSharedStorage.has(this.contextService.context.storageName)) return [3 /*break*/, 3];
5338
- storage = this.getSharedStorage(this.contextService.context.clientId, this.contextService.context.storageName);
5411
+ if (!!this.getSharedStorage.has(this.methodContextService.context.storageName)) return [3 /*break*/, 3];
5412
+ storage = this.getSharedStorage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5339
5413
  return [4 /*yield*/, storage.waitForInit()];
5340
5414
  case 1:
5341
5415
  _a.sent();
@@ -5345,7 +5419,7 @@ var StorageConnectionService = /** @class */ (function () {
5345
5419
  _a.label = 3;
5346
5420
  case 3:
5347
5421
  this.getStorage.clear(key);
5348
- this.sessionValidationService.removeStorageUsage(this.contextService.context.clientId, this.contextService.context.storageName);
5422
+ this.sessionValidationService.removeStorageUsage(this.methodContextService.context.clientId, this.methodContextService.context.storageName);
5349
5423
  return [2 /*return*/];
5350
5424
  }
5351
5425
  });
@@ -5368,20 +5442,20 @@ var StoragePublicService = /** @class */ (function () {
5368
5442
  * @param {number} total - The total number of items to retrieve.
5369
5443
  * @returns {Promise<IStorageData[]>} The list of storage data.
5370
5444
  */
5371
- this.take = function (search, total, requestId, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
5445
+ this.take = function (search, total, methodName, clientId, storageName, score) { return __awaiter(_this, void 0, void 0, function () {
5372
5446
  var _this = this;
5373
5447
  return __generator(this, function (_a) {
5374
5448
  switch (_a.label) {
5375
5449
  case 0:
5376
- this.loggerService.log("storagePublicService take", {
5377
- requestId: requestId,
5450
+ this.loggerService.info("storagePublicService take", {
5451
+ methodName: methodName,
5378
5452
  search: search,
5379
5453
  total: total,
5380
5454
  clientId: clientId,
5381
5455
  storageName: storageName,
5382
5456
  score: score,
5383
5457
  });
5384
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5458
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5385
5459
  return __generator(this, function (_a) {
5386
5460
  switch (_a.label) {
5387
5461
  case 0: return [4 /*yield*/, this.storageConnectionService.take(search, total, score)];
@@ -5389,7 +5463,7 @@ var StoragePublicService = /** @class */ (function () {
5389
5463
  }
5390
5464
  });
5391
5465
  }); }, {
5392
- requestId: requestId,
5466
+ methodName: methodName,
5393
5467
  clientId: clientId,
5394
5468
  storageName: storageName,
5395
5469
  agentName: "",
@@ -5405,17 +5479,17 @@ var StoragePublicService = /** @class */ (function () {
5405
5479
  * @param {IStorageData} item - The item to upsert.
5406
5480
  * @returns {Promise<void>}
5407
5481
  */
5408
- this.upsert = function (item, requestId, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5482
+ this.upsert = function (item, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5409
5483
  var _this = this;
5410
5484
  return __generator(this, function (_a) {
5411
5485
  switch (_a.label) {
5412
5486
  case 0:
5413
- this.loggerService.log("storagePublicService upsert", {
5487
+ this.loggerService.info("storagePublicService upsert", {
5414
5488
  item: item,
5415
5489
  clientId: clientId,
5416
5490
  storageName: storageName,
5417
5491
  });
5418
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5492
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5419
5493
  return __generator(this, function (_a) {
5420
5494
  switch (_a.label) {
5421
5495
  case 0: return [4 /*yield*/, this.storageConnectionService.upsert(item)];
@@ -5423,7 +5497,7 @@ var StoragePublicService = /** @class */ (function () {
5423
5497
  }
5424
5498
  });
5425
5499
  }); }, {
5426
- requestId: requestId,
5500
+ methodName: methodName,
5427
5501
  clientId: clientId,
5428
5502
  storageName: storageName,
5429
5503
  agentName: "",
@@ -5439,17 +5513,17 @@ var StoragePublicService = /** @class */ (function () {
5439
5513
  * @param {IStorageData["id"]} itemId - The ID of the item to remove.
5440
5514
  * @returns {Promise<void>}
5441
5515
  */
5442
- this.remove = function (itemId, requestId, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5516
+ this.remove = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5443
5517
  var _this = this;
5444
5518
  return __generator(this, function (_a) {
5445
5519
  switch (_a.label) {
5446
5520
  case 0:
5447
- this.loggerService.log("storagePublicService remove", {
5521
+ this.loggerService.info("storagePublicService remove", {
5448
5522
  itemId: itemId,
5449
5523
  clientId: clientId,
5450
5524
  storageName: storageName,
5451
5525
  });
5452
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5526
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5453
5527
  return __generator(this, function (_a) {
5454
5528
  switch (_a.label) {
5455
5529
  case 0: return [4 /*yield*/, this.storageConnectionService.remove(itemId)];
@@ -5457,7 +5531,7 @@ var StoragePublicService = /** @class */ (function () {
5457
5531
  }
5458
5532
  });
5459
5533
  }); }, {
5460
- requestId: requestId,
5534
+ methodName: methodName,
5461
5535
  clientId: clientId,
5462
5536
  storageName: storageName,
5463
5537
  agentName: "",
@@ -5473,18 +5547,18 @@ var StoragePublicService = /** @class */ (function () {
5473
5547
  * @param {IStorageData["id"]} itemId - The ID of the item to retrieve.
5474
5548
  * @returns {Promise<IStorageData>} The retrieved item.
5475
5549
  */
5476
- this.get = function (itemId, requestId, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5550
+ this.get = function (itemId, methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5477
5551
  var _this = this;
5478
5552
  return __generator(this, function (_a) {
5479
5553
  switch (_a.label) {
5480
5554
  case 0:
5481
- this.loggerService.log("storagePublicService get", {
5482
- requestId: requestId,
5555
+ this.loggerService.info("storagePublicService get", {
5556
+ methodName: methodName,
5483
5557
  itemId: itemId,
5484
5558
  clientId: clientId,
5485
5559
  storageName: storageName,
5486
5560
  });
5487
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5561
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5488
5562
  return __generator(this, function (_a) {
5489
5563
  switch (_a.label) {
5490
5564
  case 0: return [4 /*yield*/, this.storageConnectionService.get(itemId)];
@@ -5492,7 +5566,7 @@ var StoragePublicService = /** @class */ (function () {
5492
5566
  }
5493
5567
  });
5494
5568
  }); }, {
5495
- requestId: requestId,
5569
+ methodName: methodName,
5496
5570
  clientId: clientId,
5497
5571
  storageName: storageName,
5498
5572
  agentName: "",
@@ -5508,17 +5582,17 @@ var StoragePublicService = /** @class */ (function () {
5508
5582
  * @param {function(IStorageData): boolean} [filter] - The optional filter function.
5509
5583
  * @returns {Promise<IStorageData[]>} The list of items.
5510
5584
  */
5511
- this.list = function (requestId, clientId, storageName, filter) { return __awaiter(_this, void 0, void 0, function () {
5585
+ this.list = function (methodName, clientId, storageName, filter) { return __awaiter(_this, void 0, void 0, function () {
5512
5586
  var _this = this;
5513
5587
  return __generator(this, function (_a) {
5514
5588
  switch (_a.label) {
5515
5589
  case 0:
5516
- this.loggerService.log("storagePublicService list", {
5517
- requestId: requestId,
5590
+ this.loggerService.info("storagePublicService list", {
5591
+ methodName: methodName,
5518
5592
  clientId: clientId,
5519
5593
  storageName: storageName,
5520
5594
  });
5521
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5595
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5522
5596
  return __generator(this, function (_a) {
5523
5597
  switch (_a.label) {
5524
5598
  case 0: return [4 /*yield*/, this.storageConnectionService.list(filter)];
@@ -5526,7 +5600,7 @@ var StoragePublicService = /** @class */ (function () {
5526
5600
  }
5527
5601
  });
5528
5602
  }); }, {
5529
- requestId: requestId,
5603
+ methodName: methodName,
5530
5604
  clientId: clientId,
5531
5605
  storageName: storageName,
5532
5606
  agentName: "",
@@ -5541,17 +5615,17 @@ var StoragePublicService = /** @class */ (function () {
5541
5615
  * Clears all items from the storage.
5542
5616
  * @returns {Promise<void>}
5543
5617
  */
5544
- this.clear = function (requestId, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5618
+ this.clear = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5545
5619
  var _this = this;
5546
5620
  return __generator(this, function (_a) {
5547
5621
  switch (_a.label) {
5548
5622
  case 0:
5549
- this.loggerService.log("storagePublicService clear", {
5550
- requestId: requestId,
5623
+ this.loggerService.info("storagePublicService clear", {
5624
+ methodName: methodName,
5551
5625
  clientId: clientId,
5552
5626
  storageName: storageName,
5553
5627
  });
5554
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5628
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5555
5629
  return __generator(this, function (_a) {
5556
5630
  switch (_a.label) {
5557
5631
  case 0: return [4 /*yield*/, this.storageConnectionService.clear()];
@@ -5559,7 +5633,7 @@ var StoragePublicService = /** @class */ (function () {
5559
5633
  }
5560
5634
  });
5561
5635
  }); }, {
5562
- requestId: requestId,
5636
+ methodName: methodName,
5563
5637
  clientId: clientId,
5564
5638
  storageName: storageName,
5565
5639
  agentName: "",
@@ -5576,16 +5650,16 @@ var StoragePublicService = /** @class */ (function () {
5576
5650
  * @param {StorageName} storageName - The storage name.
5577
5651
  * @returns {Promise<void>}
5578
5652
  */
5579
- this.dispose = function (requestId, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5653
+ this.dispose = function (methodName, clientId, storageName) { return __awaiter(_this, void 0, void 0, function () {
5580
5654
  var _this = this;
5581
5655
  return __generator(this, function (_a) {
5582
5656
  switch (_a.label) {
5583
5657
  case 0:
5584
- this.loggerService.log("storagePublicService dispose", {
5658
+ this.loggerService.info("storagePublicService dispose", {
5585
5659
  clientId: clientId,
5586
5660
  storageName: storageName,
5587
5661
  });
5588
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5662
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
5589
5663
  return __generator(this, function (_a) {
5590
5664
  switch (_a.label) {
5591
5665
  case 0: return [4 /*yield*/, this.storageConnectionService.dispose()];
@@ -5593,7 +5667,7 @@ var StoragePublicService = /** @class */ (function () {
5593
5667
  }
5594
5668
  });
5595
5669
  }); }, {
5596
- requestId: requestId,
5670
+ methodName: methodName,
5597
5671
  clientId: clientId,
5598
5672
  storageName: storageName,
5599
5673
  agentName: "",
@@ -5624,7 +5698,7 @@ var StorageValidationService = /** @class */ (function () {
5624
5698
  * @throws {Error} If the storage already exists.
5625
5699
  */
5626
5700
  this.addStorage = function (storageName, storageSchema) {
5627
- _this.loggerService.log("storageValidationService addStorage", {
5701
+ _this.loggerService.info("storageValidationService addStorage", {
5628
5702
  storageName: storageName,
5629
5703
  storageSchema: storageSchema,
5630
5704
  });
@@ -5643,7 +5717,7 @@ var StorageValidationService = /** @class */ (function () {
5643
5717
  var _b = __read(_a, 1), storageName = _b[0];
5644
5718
  return storageName;
5645
5719
  }, function (storageName, source) {
5646
- _this.loggerService.log("storageValidationService validate", {
5720
+ _this.loggerService.info("storageValidationService validate", {
5647
5721
  storageName: storageName,
5648
5722
  source: source,
5649
5723
  });
@@ -5673,7 +5747,7 @@ var EmbeddingValidationService = /** @class */ (function () {
5673
5747
  * @throws Will throw an error if the embedding already exists.
5674
5748
  */
5675
5749
  this.addEmbedding = function (embeddingName, embeddingSchema) {
5676
- _this.loggerService.log("embeddingValidationService addEmbedding", {
5750
+ _this.loggerService.info("embeddingValidationService addEmbedding", {
5677
5751
  embeddingName: embeddingName,
5678
5752
  embeddingSchema: embeddingSchema,
5679
5753
  });
@@ -5692,7 +5766,7 @@ var EmbeddingValidationService = /** @class */ (function () {
5692
5766
  var _b = __read(_a, 1), embeddingName = _b[0];
5693
5767
  return embeddingName;
5694
5768
  }, function (embeddingName, source) {
5695
- _this.loggerService.log("embeddingValidationService validate", {
5769
+ _this.loggerService.info("embeddingValidationService validate", {
5696
5770
  embeddingName: embeddingName,
5697
5771
  source: source,
5698
5772
  });
@@ -5719,7 +5793,7 @@ var StateSchemaService = /** @class */ (function () {
5719
5793
  * @param {IStateSchema} value - The schema to register.
5720
5794
  */
5721
5795
  this.register = function (key, value) {
5722
- _this.loggerService.log("stateSchemaService register", { key: key });
5796
+ _this.loggerService.info("stateSchemaService register", { key: key });
5723
5797
  _this.registry = _this.registry.register(key, value);
5724
5798
  };
5725
5799
  /**
@@ -5728,7 +5802,7 @@ var StateSchemaService = /** @class */ (function () {
5728
5802
  * @returns {IStateSchema} The retrieved schema.
5729
5803
  */
5730
5804
  this.get = function (key) {
5731
- _this.loggerService.log("stateSchemaService get", { key: key });
5805
+ _this.loggerService.info("stateSchemaService get", { key: key });
5732
5806
  return _this.registry.get(key);
5733
5807
  };
5734
5808
  }
@@ -5931,7 +6005,7 @@ var StateConnectionService = /** @class */ (function () {
5931
6005
  var _this = this;
5932
6006
  this.loggerService = inject(TYPES.loggerService);
5933
6007
  this.busService = inject(TYPES.busService);
5934
- this.contextService = inject(TYPES.contextService);
6008
+ this.methodContextService = inject(TYPES.methodContextService);
5935
6009
  this.stateSchemaService = inject(TYPES.stateSchemaService);
5936
6010
  this.sessionValidationService = inject(TYPES.sessionValidationService);
5937
6011
  /**
@@ -6022,8 +6096,8 @@ var StateConnectionService = /** @class */ (function () {
6022
6096
  return __generator(this, function (_a) {
6023
6097
  switch (_a.label) {
6024
6098
  case 0:
6025
- this.loggerService.log("stateConnectionService setState");
6026
- state = this.getStateRef(this.contextService.context.clientId, this.contextService.context.stateName);
6099
+ this.loggerService.info("stateConnectionService setState");
6100
+ state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
6027
6101
  return [4 /*yield*/, state.waitForInit()];
6028
6102
  case 1:
6029
6103
  _a.sent();
@@ -6041,8 +6115,8 @@ var StateConnectionService = /** @class */ (function () {
6041
6115
  return __generator(this, function (_a) {
6042
6116
  switch (_a.label) {
6043
6117
  case 0:
6044
- this.loggerService.log("stateConnectionService getState");
6045
- state = this.getStateRef(this.contextService.context.clientId, this.contextService.context.stateName);
6118
+ this.loggerService.info("stateConnectionService getState");
6119
+ state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
6046
6120
  return [4 /*yield*/, state.waitForInit()];
6047
6121
  case 1:
6048
6122
  _a.sent();
@@ -6060,13 +6134,13 @@ var StateConnectionService = /** @class */ (function () {
6060
6134
  return __generator(this, function (_a) {
6061
6135
  switch (_a.label) {
6062
6136
  case 0:
6063
- this.loggerService.log("stateConnectionService dispose");
6064
- key = "".concat(this.contextService.context.clientId, "-").concat(this.contextService.context.stateName);
6137
+ this.loggerService.info("stateConnectionService dispose");
6138
+ key = "".concat(this.methodContextService.context.clientId, "-").concat(this.methodContextService.context.stateName);
6065
6139
  if (!this.getStateRef.has(key)) {
6066
6140
  return [2 /*return*/];
6067
6141
  }
6068
- if (!!this.getSharedStateRef.has(this.contextService.context.stateName)) return [3 /*break*/, 3];
6069
- state = this.getStateRef(this.contextService.context.clientId, this.contextService.context.stateName);
6142
+ if (!!this.getSharedStateRef.has(this.methodContextService.context.stateName)) return [3 /*break*/, 3];
6143
+ state = this.getStateRef(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
6070
6144
  return [4 /*yield*/, state.waitForInit()];
6071
6145
  case 1:
6072
6146
  _a.sent();
@@ -6076,7 +6150,7 @@ var StateConnectionService = /** @class */ (function () {
6076
6150
  _a.label = 3;
6077
6151
  case 3:
6078
6152
  this.getStateRef.clear(key);
6079
- this.sessionValidationService.removeStateUsage(this.contextService.context.clientId, this.contextService.context.stateName);
6153
+ this.sessionValidationService.removeStateUsage(this.methodContextService.context.clientId, this.methodContextService.context.stateName);
6080
6154
  return [2 /*return*/];
6081
6155
  }
6082
6156
  });
@@ -6097,17 +6171,17 @@ var StatePublicService = /** @class */ (function () {
6097
6171
  * @param {StateName} stateName - The name of the state.
6098
6172
  * @returns {Promise<T>} - The updated state.
6099
6173
  */
6100
- this.setState = function (dispatchFn, requestId, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6174
+ this.setState = function (dispatchFn, methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6101
6175
  var _this = this;
6102
6176
  return __generator(this, function (_a) {
6103
6177
  switch (_a.label) {
6104
6178
  case 0:
6105
- this.loggerService.log("statePublicService setState", {
6106
- requestId: requestId,
6179
+ this.loggerService.info("statePublicService setState", {
6180
+ methodName: methodName,
6107
6181
  clientId: clientId,
6108
6182
  stateName: stateName,
6109
6183
  });
6110
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6184
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6111
6185
  return __generator(this, function (_a) {
6112
6186
  switch (_a.label) {
6113
6187
  case 0: return [4 /*yield*/, this.stateConnectionService.setState(dispatchFn)];
@@ -6115,7 +6189,7 @@ var StatePublicService = /** @class */ (function () {
6115
6189
  }
6116
6190
  });
6117
6191
  }); }, {
6118
- requestId: requestId,
6192
+ methodName: methodName,
6119
6193
  clientId: clientId,
6120
6194
  stateName: stateName,
6121
6195
  agentName: "",
@@ -6132,16 +6206,16 @@ var StatePublicService = /** @class */ (function () {
6132
6206
  * @param {StateName} stateName - The name of the state.
6133
6207
  * @returns {Promise<T>} - The current state.
6134
6208
  */
6135
- this.getState = function (requestId, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6209
+ this.getState = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6136
6210
  var _this = this;
6137
6211
  return __generator(this, function (_a) {
6138
6212
  switch (_a.label) {
6139
6213
  case 0:
6140
- this.loggerService.log("statePublicService getState", {
6214
+ this.loggerService.info("statePublicService getState", {
6141
6215
  clientId: clientId,
6142
6216
  stateName: stateName,
6143
6217
  });
6144
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6218
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6145
6219
  return __generator(this, function (_a) {
6146
6220
  switch (_a.label) {
6147
6221
  case 0: return [4 /*yield*/, this.stateConnectionService.getState()];
@@ -6149,7 +6223,7 @@ var StatePublicService = /** @class */ (function () {
6149
6223
  }
6150
6224
  });
6151
6225
  }); }, {
6152
- requestId: requestId,
6226
+ methodName: methodName,
6153
6227
  clientId: clientId,
6154
6228
  stateName: stateName,
6155
6229
  agentName: "",
@@ -6166,17 +6240,17 @@ var StatePublicService = /** @class */ (function () {
6166
6240
  * @param {StateName} stateName - The name of the state.
6167
6241
  * @returns {Promise<void>} - A promise that resolves when the state is disposed.
6168
6242
  */
6169
- this.dispose = function (requestId, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6243
+ this.dispose = function (methodName, clientId, stateName) { return __awaiter(_this, void 0, void 0, function () {
6170
6244
  var _this = this;
6171
6245
  return __generator(this, function (_a) {
6172
6246
  switch (_a.label) {
6173
6247
  case 0:
6174
- this.loggerService.log("statePublicService dispose", {
6175
- requestId: requestId,
6248
+ this.loggerService.info("statePublicService dispose", {
6249
+ methodName: methodName,
6176
6250
  clientId: clientId,
6177
6251
  stateName: stateName,
6178
6252
  });
6179
- return [4 /*yield*/, ContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6253
+ return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
6180
6254
  return __generator(this, function (_a) {
6181
6255
  switch (_a.label) {
6182
6256
  case 0: return [4 /*yield*/, this.stateConnectionService.dispose()];
@@ -6184,7 +6258,7 @@ var StatePublicService = /** @class */ (function () {
6184
6258
  }
6185
6259
  });
6186
6260
  }); }, {
6187
- requestId: requestId,
6261
+ methodName: methodName,
6188
6262
  clientId: clientId,
6189
6263
  stateName: stateName,
6190
6264
  agentName: "",
@@ -6217,7 +6291,7 @@ var BusService = /** @class */ (function () {
6217
6291
  * @param {(event: T) => void} fn - The callback function to handle the event.
6218
6292
  */
6219
6293
  this.subscribe = function (clientId, source, fn) {
6220
- _this.loggerService.log("busService subscribe", {
6294
+ _this.loggerService.info("busService subscribe", {
6221
6295
  clientId: clientId,
6222
6296
  source: source,
6223
6297
  });
@@ -6236,7 +6310,7 @@ var BusService = /** @class */ (function () {
6236
6310
  * @returns {Subscription} The subscription object.
6237
6311
  */
6238
6312
  this.once = function (clientId, source, filterFn, fn) {
6239
- _this.loggerService.log("busService once", {
6313
+ _this.loggerService.info("busService once", {
6240
6314
  clientId: clientId,
6241
6315
  source: source,
6242
6316
  });
@@ -6284,7 +6358,7 @@ var BusService = /** @class */ (function () {
6284
6358
  */
6285
6359
  this.dispose = function (clientId) {
6286
6360
  var e_1, _a;
6287
- _this.loggerService.log("busService dispose", {
6361
+ _this.loggerService.info("busService dispose", {
6288
6362
  clientId: clientId,
6289
6363
  });
6290
6364
  try {
@@ -6312,7 +6386,10 @@ var BusService = /** @class */ (function () {
6312
6386
  {
6313
6387
  provide(TYPES.busService, function () { return new BusService(); });
6314
6388
  provide(TYPES.loggerService, function () { return new LoggerService(); });
6315
- provide(TYPES.contextService, function () { return new ContextService(); });
6389
+ }
6390
+ {
6391
+ provide(TYPES.methodContextService, function () { return new MethodContextService(); });
6392
+ provide(TYPES.executionContextService, function () { return new ExecutionContextService(); });
6316
6393
  }
6317
6394
  {
6318
6395
  provide(TYPES.agentConnectionService, function () { return new AgentConnectionService(); });
@@ -6358,7 +6435,10 @@ var BusService = /** @class */ (function () {
6358
6435
  var baseServices = {
6359
6436
  busService: inject(TYPES.busService),
6360
6437
  loggerService: inject(TYPES.loggerService),
6361
- contextService: inject(TYPES.contextService),
6438
+ };
6439
+ var contextServices = {
6440
+ methodContextService: inject(TYPES.methodContextService),
6441
+ executionContextService: inject(TYPES.executionContextService),
6362
6442
  };
6363
6443
  var connectionServices = {
6364
6444
  agentConnectionService: inject(TYPES.agentConnectionService),
@@ -6394,7 +6474,7 @@ var validationServices = {
6394
6474
  storageValidationService: inject(TYPES.storageValidationService),
6395
6475
  embeddingValidationService: inject(TYPES.embeddingValidationService),
6396
6476
  };
6397
- var swarm = __assign(__assign(__assign(__assign(__assign({}, baseServices), connectionServices), schemaServices), publicServices), validationServices);
6477
+ var swarm = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices), contextServices), connectionServices), schemaServices), publicServices), validationServices);
6398
6478
  init();
6399
6479
 
6400
6480
  /**
@@ -6522,22 +6602,21 @@ var addStorage = function (storageSchema) {
6522
6602
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
6523
6603
  */
6524
6604
  var commitUserMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
6525
- var requestId, swarmName, currentAgentName;
6605
+ var methodName, swarmName, currentAgentName;
6526
6606
  return __generator(this, function (_a) {
6527
6607
  switch (_a.label) {
6528
6608
  case 0:
6529
- requestId = functoolsKit.randomString();
6609
+ methodName = 'function commitSystemMessage';
6530
6610
  swarm.loggerService.log('function commitSystemMessage', {
6531
6611
  content: content,
6532
6612
  clientId: clientId,
6533
6613
  agentName: agentName,
6534
- requestId: requestId,
6535
6614
  });
6536
6615
  swarm.agentValidationService.validate(agentName, "commitUserMessage");
6537
6616
  swarm.sessionValidationService.validate(clientId, "commitUserMessage");
6538
6617
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
6539
6618
  swarm.swarmValidationService.validate(swarmName, "commitUserMessage");
6540
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
6619
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6541
6620
  case 1:
6542
6621
  currentAgentName = _a.sent();
6543
6622
  if (currentAgentName !== agentName) {
@@ -6548,7 +6627,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6548
6627
  });
6549
6628
  return [2 /*return*/];
6550
6629
  }
6551
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, requestId, clientId, swarmName)];
6630
+ return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
6552
6631
  case 2:
6553
6632
  _a.sent();
6554
6633
  return [2 /*return*/];
@@ -6564,19 +6643,18 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
6564
6643
  * @throws Will throw an error if the client ID is invalid or if the swarm validation fails.
6565
6644
  */
6566
6645
  var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
6567
- var requestId, swarmName;
6646
+ var methodName, swarmName;
6568
6647
  return __generator(this, function (_a) {
6569
6648
  switch (_a.label) {
6570
6649
  case 0:
6571
- requestId = functoolsKit.randomString();
6650
+ methodName = "function getAgentName";
6572
6651
  swarm.loggerService.log("function getAgentName", {
6573
6652
  clientId: clientId,
6574
- requestId: requestId,
6575
6653
  });
6576
6654
  swarm.sessionValidationService.validate(clientId, "getAgentName");
6577
6655
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
6578
6656
  swarm.swarmValidationService.validate(swarmName, "getAgentName");
6579
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
6657
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6580
6658
  case 1: return [2 /*return*/, _a.sent()];
6581
6659
  }
6582
6660
  });
@@ -6592,15 +6670,14 @@ var SCHEDULED_DELAY$1 = 1000;
6592
6670
  * @returns {SendMessageFn} - A function to send messages to the swarm.
6593
6671
  */
6594
6672
  var makeConnection = function (connector, clientId, swarmName) {
6595
- var requestId = functoolsKit.randomString();
6673
+ var methodName = "function makeConnection";
6596
6674
  swarm.loggerService.log("function makeConnection", {
6597
6675
  clientId: clientId,
6598
6676
  swarmName: swarmName,
6599
- requestId: requestId,
6600
6677
  });
6601
6678
  swarm.swarmValidationService.validate(swarmName, "makeConnection");
6602
6679
  swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
6603
- var send = swarm.sessionPublicService.connect(connector, requestId, clientId, swarmName);
6680
+ var send = swarm.sessionPublicService.connect(connector, methodName, clientId, swarmName);
6604
6681
  return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
6605
6682
  var _a;
6606
6683
  var _b;
@@ -6612,7 +6689,7 @@ var makeConnection = function (connector, clientId, swarmName) {
6612
6689
  _b = {
6613
6690
  data: outgoing
6614
6691
  };
6615
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
6692
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
6616
6693
  case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
6617
6694
  _b.clientId = clientId,
6618
6695
  _b)])];
@@ -6715,7 +6792,7 @@ var CHANGE_AGENT_GC = 60 * 1000;
6715
6792
  * @returns {TChangeAgentRun} - The change agent function.
6716
6793
  */
6717
6794
  var createChangeAgent = functoolsKit.ttl(function (clientId) {
6718
- return functoolsKit.queued(function (requestId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
6795
+ return functoolsKit.queued(function (methodName, agentName) { return __awaiter(void 0, void 0, void 0, function () {
6719
6796
  var swarmName, _a, _b, _c;
6720
6797
  return __generator(this, function (_d) {
6721
6798
  switch (_d.label) {
@@ -6728,7 +6805,7 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
6728
6805
  .map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
6729
6806
  return __generator(this, function (_a) {
6730
6807
  switch (_a.label) {
6731
- case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(requestId, clientId, agentName)];
6808
+ case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
6732
6809
  case 1:
6733
6810
  _a.sent();
6734
6811
  return [2 /*return*/];
@@ -6737,22 +6814,22 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
6737
6814
  }); }))];
6738
6815
  case 1:
6739
6816
  _d.sent();
6740
- return [4 /*yield*/, swarm.agentPublicService.dispose(requestId, clientId, agentName)];
6817
+ return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
6741
6818
  case 2:
6742
6819
  _d.sent();
6743
- return [4 /*yield*/, swarm.historyPublicService.dispose(requestId, clientId, agentName)];
6820
+ return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
6744
6821
  case 3:
6745
6822
  _d.sent();
6746
6823
  _b = (_a = swarm.swarmPublicService).setAgentRef;
6747
- _c = [requestId,
6824
+ _c = [methodName,
6748
6825
  clientId,
6749
6826
  swarmName,
6750
6827
  agentName];
6751
- return [4 /*yield*/, swarm.agentPublicService.createAgentRef(requestId, clientId, agentName)];
6828
+ return [4 /*yield*/, swarm.agentPublicService.createAgentRef(methodName, clientId, agentName)];
6752
6829
  case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
6753
6830
  case 5:
6754
6831
  _d.sent();
6755
- return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, requestId, clientId, swarmName)];
6832
+ return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
6756
6833
  case 6:
6757
6834
  _d.sent();
6758
6835
  return [2 /*return*/];
@@ -6786,11 +6863,11 @@ var createGc$1 = functoolsKit.singleshot(function () { return __awaiter(void 0,
6786
6863
  * @returns {Promise<void>} - A promise that resolves when the agent is changed.
6787
6864
  */
6788
6865
  var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void 0, void 0, function () {
6789
- var requestId, run;
6866
+ var methodName, run;
6790
6867
  return __generator(this, function (_a) {
6791
6868
  switch (_a.label) {
6792
6869
  case 0:
6793
- requestId = functoolsKit.randomString();
6870
+ methodName = "function changeAgent";
6794
6871
  swarm.loggerService.log("function changeAgent", {
6795
6872
  agentName: agentName,
6796
6873
  clientId: clientId,
@@ -6799,7 +6876,7 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
6799
6876
  case 1:
6800
6877
  run = _a.sent();
6801
6878
  createGc$1();
6802
- return [4 /*yield*/, run(requestId, agentName)];
6879
+ return [4 /*yield*/, run(methodName, agentName)];
6803
6880
  case 2: return [2 /*return*/, _a.sent()];
6804
6881
  }
6805
6882
  });
@@ -6817,23 +6894,22 @@ var disposeConnection = function (clientId_1, swarmName_1) {
6817
6894
  for (var _i = 2; _i < arguments.length; _i++) {
6818
6895
  args_1[_i - 2] = arguments[_i];
6819
6896
  }
6820
- return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName, requestId) {
6821
- if (requestId === void 0) { requestId = functoolsKit.randomString(); }
6897
+ return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName, methodName) {
6898
+ if (methodName === void 0) { methodName = "function disposeConnection"; }
6822
6899
  return __generator(this, function (_a) {
6823
6900
  switch (_a.label) {
6824
6901
  case 0:
6825
6902
  swarm.loggerService.log("function disposeConnection", {
6826
6903
  clientId: clientId,
6827
6904
  swarmName: swarmName,
6828
- requestId: requestId,
6829
6905
  });
6830
6906
  swarm.swarmValidationService.validate(swarmName, "disposeConnection");
6831
6907
  swarm.sessionValidationService.removeSession(clientId);
6832
6908
  swarm.busService.dispose(clientId);
6833
- return [4 /*yield*/, swarm.sessionPublicService.dispose(requestId, clientId, swarmName)];
6909
+ return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
6834
6910
  case 1:
6835
6911
  _a.sent();
6836
- return [4 /*yield*/, swarm.swarmPublicService.dispose(requestId, clientId, swarmName)];
6912
+ return [4 /*yield*/, swarm.swarmPublicService.dispose(methodName, clientId, swarmName)];
6837
6913
  case 2:
6838
6914
  _a.sent();
6839
6915
  return [4 /*yield*/, Promise.all(swarm.swarmValidationService
@@ -6841,10 +6917,10 @@ var disposeConnection = function (clientId_1, swarmName_1) {
6841
6917
  .map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
6842
6918
  return __generator(this, function (_a) {
6843
6919
  switch (_a.label) {
6844
- case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(requestId, clientId, agentName)];
6920
+ case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
6845
6921
  case 1:
6846
6922
  _a.sent();
6847
- return [4 /*yield*/, swarm.historyPublicService.dispose(requestId, clientId, agentName)];
6923
+ return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
6848
6924
  case 2:
6849
6925
  _a.sent();
6850
6926
  return [2 /*return*/];
@@ -6862,7 +6938,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
6862
6938
  .map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
6863
6939
  return __generator(this, function (_a) {
6864
6940
  switch (_a.label) {
6865
- case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(requestId, clientId, storageName)];
6941
+ case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(methodName, clientId, storageName)];
6866
6942
  case 1:
6867
6943
  _a.sent();
6868
6944
  return [2 /*return*/];
@@ -6880,7 +6956,7 @@ var disposeConnection = function (clientId_1, swarmName_1) {
6880
6956
  .map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
6881
6957
  return __generator(this, function (_a) {
6882
6958
  switch (_a.label) {
6883
- case 0: return [4 /*yield*/, swarm.statePublicService.dispose(requestId, clientId, stateName)];
6959
+ case 0: return [4 /*yield*/, swarm.statePublicService.dispose(methodName, clientId, stateName)];
6884
6960
  case 1:
6885
6961
  _a.sent();
6886
6962
  return [2 /*return*/];
@@ -6907,17 +6983,17 @@ var COMPLETE_GC = 60 * 1000;
6907
6983
  * @returns {TCompleteRun} The complete run function.
6908
6984
  */
6909
6985
  var createComplete = functoolsKit.ttl(function (clientId, swarmName) {
6910
- return functoolsKit.queued(function (requestId, content) { return __awaiter(void 0, void 0, void 0, function () {
6986
+ return functoolsKit.queued(function (methodName, content) { return __awaiter(void 0, void 0, void 0, function () {
6911
6987
  var result;
6912
6988
  return __generator(this, function (_a) {
6913
6989
  switch (_a.label) {
6914
6990
  case 0:
6915
6991
  swarm.swarmValidationService.validate(swarmName, "complete");
6916
6992
  swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
6917
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", requestId, clientId, swarmName)];
6993
+ return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
6918
6994
  case 1:
6919
6995
  result = _a.sent();
6920
- return [4 /*yield*/, disposeConnection(clientId, swarmName, requestId)];
6996
+ return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
6921
6997
  case 2:
6922
6998
  _a.sent();
6923
6999
  return [2 /*return*/, result];
@@ -6951,23 +7027,33 @@ var createGc = functoolsKit.singleshot(function () { return __awaiter(void 0, vo
6951
7027
  * @returns {Promise<string>} The result of the complete function.
6952
7028
  */
6953
7029
  var complete = function (content, clientId, swarmName) { return __awaiter(void 0, void 0, void 0, function () {
6954
- var requestId, run;
7030
+ var methodName, executionId, run;
6955
7031
  return __generator(this, function (_a) {
6956
7032
  switch (_a.label) {
6957
7033
  case 0:
6958
- requestId = functoolsKit.randomString();
7034
+ methodName = "function complete";
7035
+ executionId = functoolsKit.randomString();
6959
7036
  swarm.loggerService.log("function complete", {
6960
7037
  content: content,
6961
7038
  clientId: clientId,
7039
+ executionId: executionId,
6962
7040
  swarmName: swarmName,
6963
- requestId: requestId,
6964
7041
  });
6965
7042
  return [4 /*yield*/, createComplete(clientId, swarmName)];
6966
7043
  case 1:
6967
7044
  run = _a.sent();
6968
7045
  createGc();
6969
- return [4 /*yield*/, run(requestId, content)];
6970
- case 2: return [2 /*return*/, _a.sent()];
7046
+ return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7047
+ return __generator(this, function (_a) {
7048
+ switch (_a.label) {
7049
+ case 0: return [4 /*yield*/, run(methodName, content)];
7050
+ case 1: return [2 /*return*/, _a.sent()];
7051
+ }
7052
+ });
7053
+ }); }, {
7054
+ clientId: clientId,
7055
+ executionId: executionId,
7056
+ })];
6971
7057
  }
6972
7058
  });
6973
7059
  }); };
@@ -6983,11 +7069,12 @@ var SCHEDULED_DELAY = 1000;
6983
7069
  * @returns {Function} dispose - A function to dispose of the session.
6984
7070
  */
6985
7071
  var session = function (clientId, swarmName) {
6986
- var requestId = functoolsKit.randomString();
7072
+ var methodName = "function session";
7073
+ var executionId = functoolsKit.randomString();
6987
7074
  swarm.loggerService.log("function session", {
6988
7075
  clientId: clientId,
6989
7076
  swarmName: swarmName,
6990
- requestId: requestId,
7077
+ executionId: executionId,
6991
7078
  });
6992
7079
  swarm.swarmValidationService.validate(swarmName, "session");
6993
7080
  swarm.sessionValidationService.addSession(clientId, swarmName, "session");
@@ -7000,12 +7087,18 @@ var session = function (clientId, swarmName) {
7000
7087
  */
7001
7088
  complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
7002
7089
  return __generator(this, function (_a) {
7003
- switch (_a.label) {
7004
- case 0:
7005
- swarm.sessionValidationService.validate(clientId, "session");
7006
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", requestId, clientId, swarmName)];
7007
- case 1: return [2 /*return*/, _a.sent()];
7008
- }
7090
+ swarm.sessionValidationService.validate(clientId, "session");
7091
+ return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7092
+ return __generator(this, function (_a) {
7093
+ switch (_a.label) {
7094
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", methodName, clientId, swarmName)];
7095
+ case 1: return [2 /*return*/, _a.sent()];
7096
+ }
7097
+ });
7098
+ }); }, {
7099
+ clientId: clientId,
7100
+ executionId: executionId,
7101
+ })];
7009
7102
  });
7010
7103
  }); }),
7011
7104
  /**
@@ -7016,7 +7109,7 @@ var session = function (clientId, swarmName) {
7016
7109
  dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
7017
7110
  return __generator(this, function (_a) {
7018
7111
  switch (_a.label) {
7019
- case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, requestId)];
7112
+ case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, methodName)];
7020
7113
  case 1: return [2 /*return*/, _a.sent()];
7021
7114
  }
7022
7115
  });
@@ -7126,23 +7219,22 @@ var getRawHistory = function (clientId_1) {
7126
7219
  for (var _i = 1; _i < arguments.length; _i++) {
7127
7220
  args_1[_i - 1] = arguments[_i];
7128
7221
  }
7129
- return __awaiter(void 0, __spreadArray([clientId_1], __read(args_1), false), void 0, function (clientId, requestId) {
7222
+ return __awaiter(void 0, __spreadArray([clientId_1], __read(args_1), false), void 0, function (clientId, methodName) {
7130
7223
  var swarmName, agentName, history;
7131
- if (requestId === void 0) { requestId = functoolsKit.randomString(); }
7224
+ if (methodName === void 0) { methodName = "function getRawHistory"; }
7132
7225
  return __generator(this, function (_a) {
7133
7226
  switch (_a.label) {
7134
7227
  case 0:
7135
7228
  swarm.loggerService.log("function getRawHistory", {
7136
7229
  clientId: clientId,
7137
- requestId: requestId,
7138
7230
  });
7139
7231
  swarm.sessionValidationService.validate(clientId, "getRawHistory");
7140
7232
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7141
7233
  swarm.swarmValidationService.validate(swarmName, "getRawHistory");
7142
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7234
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7143
7235
  case 1:
7144
7236
  agentName = _a.sent();
7145
- return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(requestId, clientId, agentName)];
7237
+ return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
7146
7238
  case 2:
7147
7239
  history = _a.sent();
7148
7240
  return [2 /*return*/, __spreadArray([], __read(history), false)];
@@ -7159,19 +7251,18 @@ var getRawHistory = function (clientId_1) {
7159
7251
  * @returns {Promise<Array>} - A promise that resolves to an array containing the agent's history.
7160
7252
  */
7161
7253
  var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7162
- var requestId, prompt, history;
7254
+ var methodName, prompt, history;
7163
7255
  return __generator(this, function (_a) {
7164
7256
  switch (_a.label) {
7165
7257
  case 0:
7166
- requestId = functoolsKit.randomString();
7258
+ methodName = "function getAgentHistory";
7167
7259
  swarm.loggerService.log("function getAgentHistory", {
7168
7260
  clientId: clientId,
7169
7261
  agentName: agentName,
7170
- requestId: requestId,
7171
7262
  });
7172
7263
  swarm.agentValidationService.validate(agentName, "getAgentHistory");
7173
7264
  prompt = swarm.agentSchemaService.get(agentName).prompt;
7174
- return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, requestId, clientId, agentName)];
7265
+ return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, methodName, clientId, agentName)];
7175
7266
  case 1:
7176
7267
  history = _a.sent();
7177
7268
  return [2 /*return*/, __spreadArray([], __read(history), false)];
@@ -7205,23 +7296,23 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
7205
7296
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
7206
7297
  */
7207
7298
  var commitToolOutput = function (toolId, content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7208
- var requestId, swarmName, currentAgentName;
7299
+ var methodName, swarmName, currentAgentName;
7209
7300
  return __generator(this, function (_a) {
7210
7301
  switch (_a.label) {
7211
7302
  case 0:
7212
- requestId = functoolsKit.randomString();
7303
+ methodName = 'function commitToolOutput';
7213
7304
  swarm.loggerService.log('function commitToolOutput', {
7214
7305
  toolId: toolId,
7215
7306
  content: content,
7216
7307
  clientId: clientId,
7217
7308
  agentName: agentName,
7218
- requestId: requestId,
7309
+ methodName: methodName,
7219
7310
  });
7220
7311
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
7221
7312
  swarm.sessionValidationService.validate(clientId, "commitToolOutput");
7222
7313
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7223
7314
  swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
7224
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7315
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7225
7316
  case 1:
7226
7317
  currentAgentName = _a.sent();
7227
7318
  if (currentAgentName !== agentName) {
@@ -7233,7 +7324,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7233
7324
  });
7234
7325
  return [2 /*return*/];
7235
7326
  }
7236
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, requestId, clientId, swarmName)];
7327
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
7237
7328
  case 2:
7238
7329
  _a.sent();
7239
7330
  return [2 /*return*/];
@@ -7250,22 +7341,21 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
7250
7341
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7251
7342
  */
7252
7343
  var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7253
- var requestId, swarmName, currentAgentName;
7344
+ var methodName, swarmName, currentAgentName;
7254
7345
  return __generator(this, function (_a) {
7255
7346
  switch (_a.label) {
7256
7347
  case 0:
7257
- requestId = functoolsKit.randomString();
7348
+ methodName = 'function commitSystemMessage';
7258
7349
  swarm.loggerService.log('function commitSystemMessage', {
7259
7350
  content: content,
7260
7351
  clientId: clientId,
7261
7352
  agentName: agentName,
7262
- requestId: requestId,
7263
7353
  });
7264
7354
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
7265
7355
  swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
7266
7356
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7267
7357
  swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
7268
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7358
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7269
7359
  case 1:
7270
7360
  currentAgentName = _a.sent();
7271
7361
  if (currentAgentName !== agentName) {
@@ -7276,7 +7366,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7276
7366
  });
7277
7367
  return [2 /*return*/];
7278
7368
  }
7279
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, requestId, clientId, swarmName)];
7369
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
7280
7370
  case 2:
7281
7371
  _a.sent();
7282
7372
  return [2 /*return*/];
@@ -7292,21 +7382,20 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
7292
7382
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7293
7383
  */
7294
7384
  var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7295
- var requestId, swarmName, currentAgentName;
7385
+ var methodName, swarmName, currentAgentName;
7296
7386
  return __generator(this, function (_a) {
7297
7387
  switch (_a.label) {
7298
7388
  case 0:
7299
- requestId = functoolsKit.randomString();
7389
+ methodName = 'function commitFlush';
7300
7390
  swarm.loggerService.log('function commitFlush', {
7301
7391
  clientId: clientId,
7302
7392
  agentName: agentName,
7303
- requestId: requestId,
7304
7393
  });
7305
7394
  swarm.agentValidationService.validate(agentName, "commitFlush");
7306
7395
  swarm.sessionValidationService.validate(clientId, "commitFlush");
7307
7396
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7308
7397
  swarm.swarmValidationService.validate(swarmName, "commitFlush");
7309
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7398
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7310
7399
  case 1:
7311
7400
  currentAgentName = _a.sent();
7312
7401
  if (currentAgentName !== agentName) {
@@ -7317,7 +7406,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7317
7406
  });
7318
7407
  return [2 /*return*/];
7319
7408
  }
7320
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(requestId, clientId, swarmName)];
7409
+ return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
7321
7410
  case 2:
7322
7411
  _a.sent();
7323
7412
  return [2 /*return*/];
@@ -7335,22 +7424,24 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
7335
7424
  * @returns {Promise<void>} - A promise that resolves when the execution is complete.
7336
7425
  */
7337
7426
  var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7338
- var requestId, swarmName, currentAgentName;
7427
+ var methodName, executionId, swarmName, currentAgentName;
7339
7428
  return __generator(this, function (_a) {
7340
7429
  switch (_a.label) {
7341
7430
  case 0:
7342
- requestId = functoolsKit.randomString();
7431
+ methodName = "function execute";
7432
+ executionId = functoolsKit.randomString();
7343
7433
  swarm.loggerService.log("function execute", {
7344
7434
  content: content,
7345
7435
  clientId: clientId,
7346
7436
  agentName: agentName,
7347
- requestId: requestId,
7437
+ methodName: methodName,
7438
+ executionId: executionId,
7348
7439
  });
7349
7440
  swarm.agentValidationService.validate(agentName, "execute");
7350
7441
  swarm.sessionValidationService.validate(clientId, "execute");
7351
7442
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7352
7443
  swarm.swarmValidationService.validate(swarmName, "execute");
7353
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7444
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7354
7445
  case 1:
7355
7446
  currentAgentName = _a.sent();
7356
7447
  if (currentAgentName !== agentName) {
@@ -7361,8 +7452,17 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7361
7452
  });
7362
7453
  return [2 /*return*/];
7363
7454
  }
7364
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", requestId, clientId, swarmName)];
7365
- case 2: return [2 /*return*/, _a.sent()];
7455
+ return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7456
+ return __generator(this, function (_a) {
7457
+ switch (_a.label) {
7458
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
7459
+ case 1: return [2 /*return*/, _a.sent()];
7460
+ }
7461
+ });
7462
+ }); }, {
7463
+ clientId: clientId,
7464
+ executionId: executionId,
7465
+ })];
7366
7466
  }
7367
7467
  });
7368
7468
  }); };
@@ -7378,16 +7478,15 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
7378
7478
  * @returns {Promise<void>} A promise that resolves when the content is emitted.
7379
7479
  */
7380
7480
  var emit = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7381
- var requestId, swarmName, currentAgentName;
7481
+ var methodName, swarmName, currentAgentName;
7382
7482
  return __generator(this, function (_a) {
7383
7483
  switch (_a.label) {
7384
7484
  case 0:
7385
- requestId = functoolsKit.randomString();
7485
+ methodName = "function emit";
7386
7486
  swarm.loggerService.log("function emit", {
7387
7487
  content: content,
7388
7488
  clientId: clientId,
7389
7489
  agentName: agentName,
7390
- requestId: requestId,
7391
7490
  });
7392
7491
  if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7393
7492
  throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
@@ -7396,7 +7495,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7396
7495
  swarm.sessionValidationService.validate(clientId, "emit");
7397
7496
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7398
7497
  swarm.swarmValidationService.validate(swarmName, "emit");
7399
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
7498
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7400
7499
  case 1:
7401
7500
  currentAgentName = _a.sent();
7402
7501
  if (currentAgentName !== agentName) {
@@ -7407,7 +7506,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7407
7506
  });
7408
7507
  return [2 /*return*/];
7409
7508
  }
7410
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, requestId, clientId, swarmName)];
7509
+ return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
7411
7510
  case 2: return [2 /*return*/, _a.sent()];
7412
7511
  }
7413
7512
  });
@@ -7421,21 +7520,20 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
7421
7520
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
7422
7521
  */
7423
7522
  var commitToolOutputForce = function (toolId, content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7424
- var requestId, swarmName;
7523
+ var methodName, swarmName;
7425
7524
  return __generator(this, function (_a) {
7426
7525
  switch (_a.label) {
7427
7526
  case 0:
7428
- requestId = functoolsKit.randomString();
7527
+ methodName = 'function commitToolOutputForce';
7429
7528
  swarm.loggerService.log('function commitToolOutputForce', {
7430
7529
  toolId: toolId,
7431
7530
  content: content,
7432
7531
  clientId: clientId,
7433
- requestId: requestId,
7434
7532
  });
7435
7533
  swarm.sessionValidationService.validate(clientId, "commitToolOutputForce");
7436
7534
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7437
7535
  swarm.swarmValidationService.validate(swarmName, "commitToolOutputForce");
7438
- return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, requestId, clientId, swarmName)];
7536
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, methodName, clientId, swarmName)];
7439
7537
  case 1:
7440
7538
  _a.sent();
7441
7539
  return [2 /*return*/];
@@ -7451,20 +7549,19 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
7451
7549
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7452
7550
  */
7453
7551
  var commitSystemMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7454
- var requestId, swarmName;
7552
+ var methodName, swarmName;
7455
7553
  return __generator(this, function (_a) {
7456
7554
  switch (_a.label) {
7457
7555
  case 0:
7458
- requestId = functoolsKit.randomString();
7556
+ methodName = 'function commitSystemMessageForce';
7459
7557
  swarm.loggerService.log('function commitSystemMessageForce', {
7460
7558
  content: content,
7461
7559
  clientId: clientId,
7462
- requestId: requestId,
7463
7560
  });
7464
7561
  swarm.sessionValidationService.validate(clientId, "commitSystemMessageForce");
7465
7562
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7466
7563
  swarm.swarmValidationService.validate(swarmName, "commitSystemMessageForce");
7467
- return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, requestId, clientId, swarmName)];
7564
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, methodName, clientId, swarmName)];
7468
7565
  case 1:
7469
7566
  _a.sent();
7470
7567
  return [2 /*return*/];
@@ -7479,19 +7576,19 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
7479
7576
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7480
7577
  */
7481
7578
  var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7482
- var requestId, swarmName;
7579
+ var methodName, swarmName;
7483
7580
  return __generator(this, function (_a) {
7484
7581
  switch (_a.label) {
7485
7582
  case 0:
7486
- requestId = functoolsKit.randomString();
7583
+ methodName = 'function commitFlushForce';
7487
7584
  swarm.loggerService.log('function commitFlushForce', {
7488
7585
  clientId: clientId,
7489
- requestId: requestId,
7586
+ methodName: methodName,
7490
7587
  });
7491
7588
  swarm.sessionValidationService.validate(clientId, "commitFlushForce");
7492
7589
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7493
7590
  swarm.swarmValidationService.validate(swarmName, "commitFlushForce");
7494
- return [4 /*yield*/, swarm.sessionPublicService.commitFlush(requestId, clientId, swarmName)];
7591
+ return [4 /*yield*/, swarm.sessionPublicService.commitFlush(methodName, clientId, swarmName)];
7495
7592
  case 1:
7496
7593
  _a.sent();
7497
7594
  return [2 /*return*/];
@@ -7507,20 +7604,19 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
7507
7604
  * @returns {Promise<void>} - A promise that resolves when the message is committed.
7508
7605
  */
7509
7606
  var commitUserMessageForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7510
- var requestId, swarmName;
7607
+ var methodName, swarmName;
7511
7608
  return __generator(this, function (_a) {
7512
7609
  switch (_a.label) {
7513
7610
  case 0:
7514
- requestId = functoolsKit.randomString();
7611
+ methodName = 'function commitSystemMessage';
7515
7612
  swarm.loggerService.log('function commitSystemMessage', {
7516
7613
  content: content,
7517
7614
  clientId: clientId,
7518
- requestId: requestId,
7519
7615
  });
7520
7616
  swarm.sessionValidationService.validate(clientId, "commitUserMessageForce");
7521
7617
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7522
7618
  swarm.swarmValidationService.validate(swarmName, "commitUserMessageForce");
7523
- return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, requestId, clientId, swarmName)];
7619
+ return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, methodName, clientId, swarmName)];
7524
7620
  case 1:
7525
7621
  _a.sent();
7526
7622
  return [2 /*return*/];
@@ -7539,15 +7635,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
7539
7635
  * @returns {Promise<void>} A promise that resolves when the content is emitted.
7540
7636
  */
7541
7637
  var emitForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7542
- var requestId, swarmName;
7638
+ var methodName, swarmName;
7543
7639
  return __generator(this, function (_a) {
7544
7640
  switch (_a.label) {
7545
7641
  case 0:
7546
- requestId = functoolsKit.randomString();
7642
+ methodName = "function emitForce";
7547
7643
  swarm.loggerService.log("function emitForce", {
7548
7644
  content: content,
7549
7645
  clientId: clientId,
7550
- requestId: requestId,
7551
7646
  });
7552
7647
  if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
7553
7648
  throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
@@ -7555,7 +7650,7 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
7555
7650
  swarm.sessionValidationService.validate(clientId, "emitForce");
7556
7651
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7557
7652
  swarm.swarmValidationService.validate(swarmName, "emitForce");
7558
- return [4 /*yield*/, swarm.sessionPublicService.emit(content, requestId, clientId, swarmName)];
7653
+ return [4 /*yield*/, swarm.sessionPublicService.emit(content, methodName, clientId, swarmName)];
7559
7654
  case 1: return [2 /*return*/, _a.sent()];
7560
7655
  }
7561
7656
  });
@@ -7572,22 +7667,29 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
7572
7667
  * @returns {Promise<void>} - A promise that resolves when the execution is complete.
7573
7668
  */
7574
7669
  var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
7575
- var requestId, swarmName;
7670
+ var methodName, executionId, swarmName;
7576
7671
  return __generator(this, function (_a) {
7577
- switch (_a.label) {
7578
- case 0:
7579
- requestId = functoolsKit.randomString();
7580
- swarm.loggerService.log("function executeForce", {
7581
- content: content,
7582
- clientId: clientId,
7583
- requestId: requestId,
7672
+ methodName = "function executeForce";
7673
+ executionId = functoolsKit.randomString();
7674
+ swarm.loggerService.log("function executeForce", {
7675
+ content: content,
7676
+ clientId: clientId,
7677
+ executionId: executionId,
7678
+ });
7679
+ swarm.sessionValidationService.validate(clientId, "executeForce");
7680
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
7681
+ swarm.swarmValidationService.validate(swarmName, "executeForce");
7682
+ return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
7683
+ return __generator(this, function (_a) {
7684
+ switch (_a.label) {
7685
+ case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", methodName, clientId, swarmName)];
7686
+ case 1: return [2 /*return*/, _a.sent()];
7687
+ }
7584
7688
  });
7585
- swarm.sessionValidationService.validate(clientId, "executeForce");
7586
- swarmName = swarm.sessionValidationService.getSwarm(clientId);
7587
- swarm.swarmValidationService.validate(swarmName, "executeForce");
7588
- return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", requestId, clientId, swarmName)];
7589
- case 1: return [2 /*return*/, _a.sent()];
7590
- }
7689
+ }); }, {
7690
+ clientId: clientId,
7691
+ executionId: executionId,
7692
+ })];
7591
7693
  });
7592
7694
  }); };
7593
7695
 
@@ -7675,16 +7777,15 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
7675
7777
  * @returns {Promise<string | null>} - The content of the last user message, or null if no user message is found.
7676
7778
  */
7677
7779
  var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7678
- var requestId, history, last;
7780
+ var methodName, history, last;
7679
7781
  return __generator(this, function (_a) {
7680
7782
  switch (_a.label) {
7681
7783
  case 0:
7682
- requestId = functoolsKit.randomString();
7784
+ methodName = "function getLastUserMessage";
7683
7785
  swarm.loggerService.log("function getLastUserMessage", {
7684
7786
  clientId: clientId,
7685
- requestId: requestId,
7686
7787
  });
7687
- return [4 /*yield*/, getRawHistory(clientId, requestId)];
7788
+ return [4 /*yield*/, getRawHistory(clientId, methodName)];
7688
7789
  case 1:
7689
7790
  history = _a.sent();
7690
7791
  last = history.findLast(function (_a) {
@@ -7703,16 +7804,15 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
7703
7804
  * @returns {Promise<Array>} A promise that resolves to an array of history objects filtered by user role.
7704
7805
  */
7705
7806
  var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7706
- var requestId, history;
7807
+ var methodName, history;
7707
7808
  return __generator(this, function (_a) {
7708
7809
  switch (_a.label) {
7709
7810
  case 0:
7710
- requestId = functoolsKit.randomString();
7811
+ methodName = "function getUserHistory";
7711
7812
  swarm.loggerService.log("function getUserHistory", {
7712
7813
  clientId: clientId,
7713
- requestId: requestId,
7714
7814
  });
7715
- return [4 /*yield*/, getRawHistory(clientId, requestId)];
7815
+ return [4 /*yield*/, getRawHistory(clientId, methodName)];
7716
7816
  case 1:
7717
7817
  history = _a.sent();
7718
7818
  return [2 /*return*/, history.filter(function (_a) {
@@ -7730,16 +7830,15 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
7730
7830
  * @returns {Promise<Array>} - A promise that resolves to an array of history objects where the role is "assistant".
7731
7831
  */
7732
7832
  var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7733
- var requestId, history;
7833
+ var methodName, history;
7734
7834
  return __generator(this, function (_a) {
7735
7835
  switch (_a.label) {
7736
7836
  case 0:
7737
- requestId = functoolsKit.randomString();
7837
+ methodName = "function getAssistantHistory";
7738
7838
  swarm.loggerService.log("function getAssistantHistory", {
7739
7839
  clientId: clientId,
7740
- requestId: requestId,
7741
7840
  });
7742
- return [4 /*yield*/, getRawHistory(clientId, requestId)];
7841
+ return [4 /*yield*/, getRawHistory(clientId, methodName)];
7743
7842
  case 1:
7744
7843
  history = _a.sent();
7745
7844
  return [2 /*return*/, history.filter(function (_a) {
@@ -7757,16 +7856,15 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
7757
7856
  * @returns {Promise<string | null>} - The content of the last assistant message, or null if no user message is found.
7758
7857
  */
7759
7858
  var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7760
- var requestId, history, last;
7859
+ var methodName, history, last;
7761
7860
  return __generator(this, function (_a) {
7762
7861
  switch (_a.label) {
7763
7862
  case 0:
7764
- requestId = functoolsKit.randomString();
7863
+ methodName = "function getLastAssistantMessage";
7765
7864
  swarm.loggerService.log("function getLastAssistantMessage", {
7766
7865
  clientId: clientId,
7767
- requestId: requestId,
7768
7866
  });
7769
- return [4 /*yield*/, getRawHistory(clientId, requestId)];
7867
+ return [4 /*yield*/, getRawHistory(clientId, methodName)];
7770
7868
  case 1:
7771
7869
  history = _a.sent();
7772
7870
  last = history.findLast(function (_a) {
@@ -7785,16 +7883,15 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
7785
7883
  * @returns {Promise<string | null>} - The content of the last system message, or null if no user message is found.
7786
7884
  */
7787
7885
  var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7788
- var requestId, history, last;
7886
+ var methodName, history, last;
7789
7887
  return __generator(this, function (_a) {
7790
7888
  switch (_a.label) {
7791
7889
  case 0:
7792
- requestId = functoolsKit.randomString();
7890
+ methodName = "function getLastSystemMessage";
7793
7891
  swarm.loggerService.log("function getLastSystemMessage", {
7794
7892
  clientId: clientId,
7795
- requestId: requestId,
7796
7893
  });
7797
- return [4 /*yield*/, getRawHistory(clientId, requestId)];
7894
+ return [4 /*yield*/, getRawHistory(clientId, methodName)];
7798
7895
  case 1:
7799
7896
  history = _a.sent();
7800
7897
  last = history.findLast(function (_a) {
@@ -7898,21 +7995,20 @@ var event = function (clientId, topicName, payload) {
7898
7995
  * @returns {Promise<void>} - A promise that resolves when the output is canceled
7899
7996
  */
7900
7997
  var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
7901
- var requestId, swarmName, currentAgentName;
7998
+ var methodName, swarmName, currentAgentName;
7902
7999
  return __generator(this, function (_a) {
7903
8000
  switch (_a.label) {
7904
8001
  case 0:
7905
- requestId = functoolsKit.randomString();
8002
+ methodName = 'function cancelOutput';
7906
8003
  swarm.loggerService.log('function cancelOutput', {
7907
8004
  clientId: clientId,
7908
8005
  agentName: agentName,
7909
- requestId: requestId,
7910
8006
  });
7911
8007
  swarm.agentValidationService.validate(agentName, "cancelOutput");
7912
8008
  swarm.sessionValidationService.validate(clientId, "cancelOutput");
7913
8009
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7914
8010
  swarm.swarmValidationService.validate(swarmName, "cancelOutput");
7915
- return [4 /*yield*/, swarm.swarmPublicService.getAgentName(requestId, clientId, swarmName)];
8011
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
7916
8012
  case 1:
7917
8013
  currentAgentName = _a.sent();
7918
8014
  if (currentAgentName !== agentName) {
@@ -7923,7 +8019,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
7923
8019
  });
7924
8020
  return [2 /*return*/];
7925
8021
  }
7926
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(requestId, clientId, swarmName)];
8022
+ return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
7927
8023
  case 2:
7928
8024
  _a.sent();
7929
8025
  return [2 /*return*/];
@@ -7939,19 +8035,18 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
7939
8035
  * @returns {Promise<void>} - A promise that resolves when the output is canceled
7940
8036
  */
7941
8037
  var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, void 0, function () {
7942
- var requestId, swarmName;
8038
+ var methodName, swarmName;
7943
8039
  return __generator(this, function (_a) {
7944
8040
  switch (_a.label) {
7945
8041
  case 0:
7946
- requestId = functoolsKit.randomString();
8042
+ methodName = 'function cancelOutputForce';
7947
8043
  swarm.loggerService.log('function cancelOutputForce', {
7948
8044
  clientId: clientId,
7949
- requestId: requestId
7950
8045
  });
7951
8046
  swarm.sessionValidationService.validate(clientId, "cancelOutputForce");
7952
8047
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
7953
8048
  swarm.swarmValidationService.validate(swarmName, "cancelOutputForce");
7954
- return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(requestId, clientId, swarmName)];
8049
+ return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(methodName, clientId, swarmName)];
7955
8050
  case 1:
7956
8051
  _a.sent();
7957
8052
  return [2 /*return*/];
@@ -8237,24 +8332,23 @@ var StorageUtils = /** @class */ (function () {
8237
8332
  * @template T
8238
8333
  */
8239
8334
  this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8240
- var requestId;
8335
+ var methodName;
8241
8336
  return __generator(this, function (_a) {
8242
8337
  switch (_a.label) {
8243
8338
  case 0:
8244
- requestId = functoolsKit.randomString();
8339
+ methodName = "StorageUtils take";
8245
8340
  swarm.loggerService.log("StorageUtils take", {
8246
8341
  search: payload.search,
8247
8342
  total: payload.total,
8248
8343
  clientId: payload.clientId,
8249
8344
  storageName: payload.storageName,
8250
8345
  score: payload.score,
8251
- requestId: requestId,
8252
8346
  });
8253
8347
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8254
8348
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8255
8349
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
8256
8350
  }
8257
- return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, requestId, payload.clientId, payload.storageName, payload.score)];
8351
+ return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, methodName, payload.clientId, payload.storageName, payload.score)];
8258
8352
  case 1: return [2 /*return*/, (_a.sent())];
8259
8353
  }
8260
8354
  });
@@ -8269,22 +8363,21 @@ var StorageUtils = /** @class */ (function () {
8269
8363
  * @template T
8270
8364
  */
8271
8365
  this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8272
- var requestId;
8366
+ var methodName;
8273
8367
  return __generator(this, function (_a) {
8274
8368
  switch (_a.label) {
8275
8369
  case 0:
8276
- requestId = functoolsKit.randomString();
8370
+ methodName = "StorageUtils upsert";
8277
8371
  swarm.loggerService.log("StorageUtils upsert", {
8278
8372
  item: payload.item,
8279
8373
  clientId: payload.clientId,
8280
8374
  storageName: payload.storageName,
8281
- requestId: requestId,
8282
8375
  });
8283
8376
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8284
8377
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8285
8378
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
8286
8379
  }
8287
- return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, requestId, payload.clientId, payload.storageName)];
8380
+ return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, methodName, payload.clientId, payload.storageName)];
8288
8381
  case 1: return [2 /*return*/, _a.sent()];
8289
8382
  }
8290
8383
  });
@@ -8298,22 +8391,21 @@ var StorageUtils = /** @class */ (function () {
8298
8391
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
8299
8392
  */
8300
8393
  this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8301
- var requestId;
8394
+ var methodName;
8302
8395
  return __generator(this, function (_a) {
8303
8396
  switch (_a.label) {
8304
8397
  case 0:
8305
- requestId = functoolsKit.randomString();
8398
+ methodName = "StorageUtils remove";
8306
8399
  swarm.loggerService.log("StorageUtils remove", {
8307
8400
  itemId: payload.itemId,
8308
8401
  clientId: payload.clientId,
8309
8402
  storageName: payload.storageName,
8310
- requestId: requestId,
8311
8403
  });
8312
8404
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8313
8405
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8314
8406
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
8315
8407
  }
8316
- return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, requestId, payload.clientId, payload.storageName)];
8408
+ return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, methodName, payload.clientId, payload.storageName)];
8317
8409
  case 1: return [2 /*return*/, _a.sent()];
8318
8410
  }
8319
8411
  });
@@ -8328,22 +8420,21 @@ var StorageUtils = /** @class */ (function () {
8328
8420
  * @template T
8329
8421
  */
8330
8422
  this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8331
- var requestId;
8423
+ var methodName;
8332
8424
  return __generator(this, function (_a) {
8333
8425
  switch (_a.label) {
8334
8426
  case 0:
8335
- requestId = functoolsKit.randomString();
8427
+ methodName = "StorageUtils get";
8336
8428
  swarm.loggerService.log("StorageUtils get", {
8337
8429
  itemId: payload.itemId,
8338
8430
  clientId: payload.clientId,
8339
8431
  storageName: payload.storageName,
8340
- requestId: requestId,
8341
8432
  });
8342
8433
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8343
8434
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8344
8435
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
8345
8436
  }
8346
- return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, requestId, payload.clientId, payload.storageName)];
8437
+ return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, methodName, payload.clientId, payload.storageName)];
8347
8438
  case 1: return [2 /*return*/, (_a.sent())];
8348
8439
  }
8349
8440
  });
@@ -8358,21 +8449,20 @@ var StorageUtils = /** @class */ (function () {
8358
8449
  * @template T
8359
8450
  */
8360
8451
  this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8361
- var requestId;
8452
+ var methodName;
8362
8453
  return __generator(this, function (_a) {
8363
8454
  switch (_a.label) {
8364
8455
  case 0:
8365
- requestId = functoolsKit.randomString();
8456
+ methodName = "StorageUtils list";
8366
8457
  swarm.loggerService.log("StorageUtils list", {
8367
8458
  clientId: payload.clientId,
8368
8459
  storageName: payload.storageName,
8369
- requestId: requestId,
8370
8460
  });
8371
8461
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8372
8462
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8373
8463
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
8374
8464
  }
8375
- return [4 /*yield*/, swarm.storagePublicService.list(requestId, payload.clientId, payload.storageName, payload.filter)];
8465
+ return [4 /*yield*/, swarm.storagePublicService.list(methodName, payload.clientId, payload.storageName, payload.filter)];
8376
8466
  case 1: return [2 /*return*/, (_a.sent())];
8377
8467
  }
8378
8468
  });
@@ -8385,21 +8475,20 @@ var StorageUtils = /** @class */ (function () {
8385
8475
  * @returns {Promise<void>} - A promise that resolves when the operation is complete.
8386
8476
  */
8387
8477
  this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8388
- var requestId;
8478
+ var methodName;
8389
8479
  return __generator(this, function (_a) {
8390
8480
  switch (_a.label) {
8391
8481
  case 0:
8392
- requestId = functoolsKit.randomString();
8482
+ methodName = "StorageUtils clear";
8393
8483
  swarm.loggerService.log("StorageUtils clear", {
8394
8484
  clientId: payload.clientId,
8395
8485
  storageName: payload.storageName,
8396
- requestId: requestId,
8397
8486
  });
8398
8487
  swarm.storageValidationService.validate(payload.storageName, "StorageUtils");
8399
8488
  if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
8400
8489
  throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
8401
8490
  }
8402
- return [4 /*yield*/, swarm.storagePublicService.clear(requestId, payload.clientId, payload.storageName)];
8491
+ return [4 /*yield*/, swarm.storagePublicService.clear(methodName, payload.clientId, payload.storageName)];
8403
8492
  case 1: return [2 /*return*/, _a.sent()];
8404
8493
  }
8405
8494
  });
@@ -8427,20 +8516,19 @@ var StateUtils = /** @class */ (function () {
8427
8516
  * @throws Will throw an error if the state is not registered in the agent.
8428
8517
  */
8429
8518
  this.getState = function (payload) { return __awaiter(_this, void 0, void 0, function () {
8430
- var requestId;
8519
+ var methodName;
8431
8520
  return __generator(this, function (_a) {
8432
8521
  switch (_a.label) {
8433
8522
  case 0:
8434
- requestId = functoolsKit.randomString();
8523
+ methodName = "StateUtils getState";
8435
8524
  swarm.loggerService.log("StateUtils getState", {
8436
8525
  clientId: payload.clientId,
8437
8526
  stateName: payload.stateName,
8438
- requestId: requestId,
8439
8527
  });
8440
8528
  if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
8441
8529
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
8442
8530
  }
8443
- return [4 /*yield*/, swarm.statePublicService.getState(requestId, payload.clientId, payload.stateName)];
8531
+ return [4 /*yield*/, swarm.statePublicService.getState(methodName, payload.clientId, payload.stateName)];
8444
8532
  case 1: return [2 /*return*/, _a.sent()];
8445
8533
  }
8446
8534
  });
@@ -8457,26 +8545,25 @@ var StateUtils = /** @class */ (function () {
8457
8545
  * @throws Will throw an error if the state is not registered in the agent.
8458
8546
  */
8459
8547
  this.setState = function (dispatchFn, payload) { return __awaiter(_this, void 0, void 0, function () {
8460
- var requestId;
8548
+ var methodName;
8461
8549
  var _this = this;
8462
8550
  return __generator(this, function (_a) {
8463
8551
  switch (_a.label) {
8464
8552
  case 0:
8465
- requestId = functoolsKit.randomString();
8553
+ methodName = "StateUtils setState";
8466
8554
  swarm.loggerService.log("StateUtils setState", {
8467
8555
  clientId: payload.clientId,
8468
8556
  stateName: payload.stateName,
8469
- requestId: requestId,
8470
8557
  });
8471
8558
  if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
8472
8559
  throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
8473
8560
  }
8474
8561
  if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
8475
- return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, requestId, payload.clientId, payload.stateName)];
8562
+ return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, methodName, payload.clientId, payload.stateName)];
8476
8563
  case 1: return [2 /*return*/, _a.sent()];
8477
8564
  case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
8478
8565
  return [2 /*return*/, dispatchFn];
8479
- }); }); }, requestId, payload.clientId, payload.stateName)];
8566
+ }); }); }, methodName, payload.clientId, payload.stateName)];
8480
8567
  case 3: return [2 /*return*/, _a.sent()];
8481
8568
  }
8482
8569
  });
@@ -8509,11 +8596,12 @@ var LoggerUtils = /** @class */ (function () {
8509
8596
  */
8510
8597
  var Logger = new LoggerUtils();
8511
8598
 
8512
- exports.ContextService = ContextService;
8599
+ exports.ExecutionContextService = ExecutionContextService;
8513
8600
  exports.History = History;
8514
8601
  exports.HistoryAdapter = HistoryAdapter;
8515
8602
  exports.HistoryInstance = HistoryInstance;
8516
8603
  exports.Logger = Logger;
8604
+ exports.MethodContextService = MethodContextService;
8517
8605
  exports.State = State;
8518
8606
  exports.Storage = Storage;
8519
8607
  exports.addAgent = addAgent;