agent-swarm-kit 1.0.103 → 1.0.104

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
@@ -1610,6 +1610,7 @@ var AgentSchemaService = /** @class */ (function () {
1610
1610
  }());
1611
1611
 
1612
1612
  var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
1613
+ var TOOL_ERROR_SYMBOL = Symbol("tool-error");
1613
1614
  var getPlaceholder = function () {
1614
1615
  return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
1615
1616
  };
@@ -1626,8 +1627,8 @@ var ClientAgent = /** @class */ (function () {
1626
1627
  var _this = this;
1627
1628
  this.params = params;
1628
1629
  this._agentChangeSubject = new functoolsKit.Subject();
1629
- this._toolCommitSubject = new functoolsKit.Subject();
1630
1630
  this._toolErrorSubject = new functoolsKit.Subject();
1631
+ this._toolCommitSubject = new functoolsKit.Subject();
1631
1632
  this._outputSubject = new functoolsKit.Subject();
1632
1633
  /**
1633
1634
  * Emits the output result after validation.
@@ -2052,7 +2053,7 @@ var ClientAgent = /** @class */ (function () {
2052
2053
  case 4:
2053
2054
  _h.sent();
2054
2055
  _loop_1 = function (idx) {
2055
- var tool, targetFn, result_2, result_3, status;
2056
+ var tool, targetFn, result_2, result_3, status, result_4;
2056
2057
  return __generator(this, function (_j) {
2057
2058
  switch (_j.label) {
2058
2059
  case 0:
@@ -2122,7 +2123,7 @@ var ClientAgent = /** @class */ (function () {
2122
2123
  });
2123
2124
  ((_a = targetFn.callbacks) === null || _a === void 0 ? void 0 : _a.onCallError) &&
2124
2125
  ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onCallError(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments, error));
2125
- _this._toolErrorSubject.next();
2126
+ _this._toolErrorSubject.next(TOOL_ERROR_SYMBOL);
2126
2127
  });
2127
2128
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2128
2129
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
@@ -2143,7 +2144,19 @@ var ClientAgent = /** @class */ (function () {
2143
2144
  this_1.params.callbacks.onAfterToolCalls(this_1.params.clientId, this_1.params.agentName, toolCalls);
2144
2145
  return [2 /*return*/, { value: void 0 }];
2145
2146
  }
2146
- return [2 /*return*/];
2147
+ if (!(status === TOOL_ERROR_SYMBOL)) return [3 /*break*/, 11];
2148
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2149
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " the next tool execution stopped due to the call error"));
2150
+ return [4 /*yield*/, this_1._resurrectModel(mode, "Function call failed with error: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
2151
+ case 9:
2152
+ result_4 = _j.sent();
2153
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2154
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_4));
2155
+ return [4 /*yield*/, this_1._emitOuput(mode, result_4)];
2156
+ case 10:
2157
+ _j.sent();
2158
+ return [2 /*return*/, { value: void 0 }];
2159
+ case 11: return [2 /*return*/];
2147
2160
  }
2148
2161
  });
2149
2162
  };
@@ -7663,7 +7676,6 @@ var DocService = /** @class */ (function () {
7663
7676
  if (!entries.length) {
7664
7677
  result.push("");
7665
7678
  result.push("*Empty parameters*");
7666
- result.push("");
7667
7679
  }
7668
7680
  }
7669
7681
  if (callbacks) {
package/build/index.mjs CHANGED
@@ -1608,6 +1608,7 @@ var AgentSchemaService = /** @class */ (function () {
1608
1608
  }());
1609
1609
 
1610
1610
  var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
1611
+ var TOOL_ERROR_SYMBOL = Symbol("tool-error");
1611
1612
  var getPlaceholder = function () {
1612
1613
  return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
1613
1614
  };
@@ -1624,8 +1625,8 @@ var ClientAgent = /** @class */ (function () {
1624
1625
  var _this = this;
1625
1626
  this.params = params;
1626
1627
  this._agentChangeSubject = new Subject();
1627
- this._toolCommitSubject = new Subject();
1628
1628
  this._toolErrorSubject = new Subject();
1629
+ this._toolCommitSubject = new Subject();
1629
1630
  this._outputSubject = new Subject();
1630
1631
  /**
1631
1632
  * Emits the output result after validation.
@@ -2050,7 +2051,7 @@ var ClientAgent = /** @class */ (function () {
2050
2051
  case 4:
2051
2052
  _h.sent();
2052
2053
  _loop_1 = function (idx) {
2053
- var tool, targetFn, result_2, result_3, status;
2054
+ var tool, targetFn, result_2, result_3, status, result_4;
2054
2055
  return __generator(this, function (_j) {
2055
2056
  switch (_j.label) {
2056
2057
  case 0:
@@ -2120,7 +2121,7 @@ var ClientAgent = /** @class */ (function () {
2120
2121
  });
2121
2122
  ((_a = targetFn.callbacks) === null || _a === void 0 ? void 0 : _a.onCallError) &&
2122
2123
  ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onCallError(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments, error));
2123
- _this._toolErrorSubject.next();
2124
+ _this._toolErrorSubject.next(TOOL_ERROR_SYMBOL);
2124
2125
  });
2125
2126
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2126
2127
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
@@ -2141,7 +2142,19 @@ var ClientAgent = /** @class */ (function () {
2141
2142
  this_1.params.callbacks.onAfterToolCalls(this_1.params.clientId, this_1.params.agentName, toolCalls);
2142
2143
  return [2 /*return*/, { value: void 0 }];
2143
2144
  }
2144
- return [2 /*return*/];
2145
+ if (!(status === TOOL_ERROR_SYMBOL)) return [3 /*break*/, 11];
2146
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2147
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " the next tool execution stopped due to the call error"));
2148
+ return [4 /*yield*/, this_1._resurrectModel(mode, "Function call failed with error: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
2149
+ case 9:
2150
+ result_4 = _j.sent();
2151
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2152
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_4));
2153
+ return [4 /*yield*/, this_1._emitOuput(mode, result_4)];
2154
+ case 10:
2155
+ _j.sent();
2156
+ return [2 /*return*/, { value: void 0 }];
2157
+ case 11: return [2 /*return*/];
2145
2158
  }
2146
2159
  });
2147
2160
  };
@@ -7661,7 +7674,6 @@ var DocService = /** @class */ (function () {
7661
7674
  if (!entries.length) {
7662
7675
  result.push("");
7663
7676
  result.push("*Empty parameters*");
7664
- result.push("");
7665
7677
  }
7666
7678
  }
7667
7679
  if (callbacks) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.103",
3
+ "version": "1.0.104",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -1527,6 +1527,7 @@ declare class LoggerService implements ILogger {
1527
1527
  }
1528
1528
 
1529
1529
  declare const AGENT_CHANGE_SYMBOL: unique symbol;
1530
+ declare const TOOL_ERROR_SYMBOL: unique symbol;
1530
1531
  /**
1531
1532
  * Represents a client agent that interacts with the system.
1532
1533
  * @implements {IAgent}
@@ -1534,8 +1535,8 @@ declare const AGENT_CHANGE_SYMBOL: unique symbol;
1534
1535
  declare class ClientAgent implements IAgent {
1535
1536
  readonly params: IAgentParams;
1536
1537
  readonly _agentChangeSubject: Subject<typeof AGENT_CHANGE_SYMBOL>;
1538
+ readonly _toolErrorSubject: Subject<typeof TOOL_ERROR_SYMBOL>;
1537
1539
  readonly _toolCommitSubject: Subject<void>;
1538
- readonly _toolErrorSubject: Subject<void>;
1539
1540
  readonly _outputSubject: Subject<string>;
1540
1541
  /**
1541
1542
  * Creates an instance of ClientAgent.