agent-swarm-kit 1.0.43 → 1.0.45

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
@@ -712,12 +712,11 @@ var ClientAgent = /** @class */ (function () {
712
712
  * @returns {Promise<void>}
713
713
  */
714
714
  this.execute = functoolsKit.queued(function (incoming, mode) { return __awaiter(_this, void 0, void 0, function () {
715
- var rawMessage, message, toolCalls, _loop_1, this_1, toolCalls_1, toolCalls_1_1, tool, state_1, e_1_1, result, validation, result1;
716
- var e_1, _a;
715
+ var rawMessage, message, toolCalls, _loop_1, this_1, idx, state_1, result, validation, result1;
717
716
  var _this = this;
718
- var _b, _c, _d, _e, _f, _g;
719
- return __generator(this, function (_h) {
720
- switch (_h.label) {
717
+ var _a, _b, _c, _d, _e, _f;
718
+ return __generator(this, function (_g) {
719
+ switch (_g.label) {
721
720
  case 0:
722
721
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute begin"), { incoming: incoming, mode: mode });
723
722
  this.params.onExecute &&
@@ -729,14 +728,14 @@ var ClientAgent = /** @class */ (function () {
729
728
  content: incoming.trim(),
730
729
  })];
731
730
  case 1:
732
- _h.sent();
731
+ _g.sent();
733
732
  return [4 /*yield*/, this.getCompletion(mode)];
734
733
  case 2:
735
- rawMessage = _h.sent();
734
+ rawMessage = _g.sent();
736
735
  return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
737
736
  case 3:
738
- message = _h.sent();
739
- if (!message.tool_calls) return [3 /*break*/, 13];
737
+ message = _g.sent();
738
+ if (!message.tool_calls) return [3 /*break*/, 9];
740
739
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " tool call begin"));
741
740
  toolCalls = message.tool_calls.map(function (call) {
742
741
  var _a, _b;
@@ -748,45 +747,56 @@ var ClientAgent = /** @class */ (function () {
748
747
  });
749
748
  return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
750
749
  case 4:
751
- _h.sent();
752
- _loop_1 = function (tool) {
753
- var targetFn, result_2, result_3;
754
- return __generator(this, function (_j) {
755
- switch (_j.label) {
750
+ _g.sent();
751
+ _loop_1 = function (idx) {
752
+ var tool, targetFn, result_2, result_3;
753
+ return __generator(this, function (_h) {
754
+ switch (_h.label) {
756
755
  case 0:
757
- targetFn = (_b = this_1.params.tools) === null || _b === void 0 ? void 0 : _b.find(function (t) { return t.function.name === tool.function.name; });
756
+ tool = toolCalls[idx];
757
+ targetFn = (_a = this_1.params.tools) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.function.name === tool.function.name; });
758
758
  if (!!targetFn) return [3 /*break*/, 3];
759
759
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"), this_1.params.tools);
760
760
  return [4 /*yield*/, this_1._resurrectModel(mode, "No target function for ".concat(tool.function.name))];
761
761
  case 1:
762
- result_2 = _j.sent();
762
+ result_2 = _h.sent();
763
763
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_2));
764
764
  return [4 /*yield*/, this_1._emitOuput(mode, result_2)];
765
765
  case 2:
766
- _j.sent();
766
+ _h.sent();
767
767
  return [2 /*return*/, { value: void 0 }];
768
768
  case 3:
769
- ((_c = targetFn.callbacks) === null || _c === void 0 ? void 0 : _c.onValidate) &&
770
- ((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onValidate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
771
- return [4 /*yield*/, functoolsKit.not(targetFn.validate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments))];
769
+ ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onValidate) &&
770
+ ((_c = targetFn.callbacks) === null || _c === void 0 ? void 0 : _c.onValidate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
771
+ return [4 /*yield*/, functoolsKit.not(targetFn.validate({
772
+ clientId: this_1.params.clientId,
773
+ agentName: this_1.params.agentName,
774
+ params: tool.function.arguments
775
+ }))];
772
776
  case 4:
773
- if (!_j.sent()) return [3 /*break*/, 7];
777
+ if (!_h.sent()) return [3 /*break*/, 7];
774
778
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool validation not passed"));
775
779
  return [4 /*yield*/, this_1._resurrectModel(mode, "Function validation failed: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
776
780
  case 5:
777
- result_3 = _j.sent();
781
+ result_3 = _h.sent();
778
782
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_3));
779
783
  return [4 /*yield*/, this_1._emitOuput(mode, result_3)];
780
784
  case 6:
781
- _j.sent();
785
+ _h.sent();
782
786
  return [2 /*return*/, { value: void 0 }];
783
787
  case 7:
784
- ((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall) &&
785
- ((_f = targetFn.callbacks) === null || _f === void 0 ? void 0 : _f.onBeforeCall(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
788
+ ((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onBeforeCall) &&
789
+ ((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
786
790
  /**
787
791
  * @description Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
788
792
  */
789
- Promise.resolve(targetFn.call(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments)).then(function () {
793
+ Promise.resolve(targetFn.call({
794
+ toolId: tool.id,
795
+ clientId: this_1.params.clientId,
796
+ agentName: this_1.params.agentName,
797
+ params: tool.function.arguments,
798
+ isLast: idx === toolCalls.length - 1,
799
+ })).then(function () {
790
800
  var _a, _b;
791
801
  ((_a = targetFn.callbacks) === null || _a === void 0 ? void 0 : _a.onAfterCall) &&
792
802
  ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onAfterCall(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments));
@@ -797,72 +807,57 @@ var ClientAgent = /** @class */ (function () {
797
807
  this_1._outputSubject.toPromise(),
798
808
  ])];
799
809
  case 8:
800
- _j.sent();
810
+ _h.sent();
801
811
  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 end"));
802
812
  return [2 /*return*/];
803
813
  }
804
814
  });
805
815
  };
806
816
  this_1 = this;
807
- _h.label = 5;
817
+ idx = 0;
818
+ _g.label = 5;
808
819
  case 5:
809
- _h.trys.push([5, 10, 11, 12]);
810
- toolCalls_1 = __values(toolCalls), toolCalls_1_1 = toolCalls_1.next();
811
- _h.label = 6;
820
+ if (!(idx !== toolCalls.length)) return [3 /*break*/, 8];
821
+ return [5 /*yield**/, _loop_1(idx)];
812
822
  case 6:
813
- if (!!toolCalls_1_1.done) return [3 /*break*/, 9];
814
- tool = toolCalls_1_1.value;
815
- return [5 /*yield**/, _loop_1(tool)];
816
- case 7:
817
- state_1 = _h.sent();
823
+ state_1 = _g.sent();
818
824
  if (typeof state_1 === "object")
819
825
  return [2 /*return*/, state_1.value];
820
- _h.label = 8;
826
+ _g.label = 7;
827
+ case 7:
828
+ idx++;
829
+ return [3 /*break*/, 5];
821
830
  case 8:
822
- toolCalls_1_1 = toolCalls_1.next();
823
- return [3 /*break*/, 6];
824
- case 9: return [3 /*break*/, 12];
825
- case 10:
826
- e_1_1 = _h.sent();
827
- e_1 = { error: e_1_1 };
828
- return [3 /*break*/, 12];
829
- case 11:
830
- try {
831
- if (toolCalls_1_1 && !toolCalls_1_1.done && (_a = toolCalls_1.return)) _a.call(toolCalls_1);
832
- }
833
- finally { if (e_1) throw e_1.error; }
834
- return [7 /*endfinally*/];
835
- case 12:
836
- ((_g = this.params.callbacks) === null || _g === void 0 ? void 0 : _g.onAfterToolCalls) &&
831
+ ((_f = this.params.callbacks) === null || _f === void 0 ? void 0 : _f.onAfterToolCalls) &&
837
832
  this.params.callbacks.onAfterToolCalls(this.params.clientId, this.params.agentName, toolCalls);
838
833
  return [2 /*return*/];
839
- case 13:
834
+ case 9:
840
835
  if (!message.tool_calls) {
841
836
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute no tool calls detected"));
842
837
  }
843
838
  return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
844
- case 14:
845
- result = _h.sent();
839
+ case 10:
840
+ result = _g.sent();
846
841
  return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
847
- case 15:
848
- _h.sent();
842
+ case 11:
843
+ _g.sent();
849
844
  validation = null;
850
845
  return [4 /*yield*/, this.params.validate(result)];
851
- case 16:
852
- if (!(validation = _h.sent())) return [3 /*break*/, 19];
846
+ case 12:
847
+ if (!(validation = _g.sent())) return [3 /*break*/, 15];
853
848
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
854
849
  return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
855
- case 17:
856
- result1 = _h.sent();
850
+ case 13:
851
+ result1 = _g.sent();
857
852
  return [4 /*yield*/, this._emitOuput(mode, result1)];
858
- case 18:
859
- _h.sent();
853
+ case 14:
854
+ _g.sent();
860
855
  return [2 /*return*/];
861
- case 19:
856
+ case 15:
862
857
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
863
858
  return [4 /*yield*/, this._emitOuput(mode, result)];
864
- case 20:
865
- _h.sent();
859
+ case 16:
860
+ _g.sent();
866
861
  return [2 /*return*/];
867
862
  }
868
863
  });
package/build/index.mjs CHANGED
@@ -710,12 +710,11 @@ var ClientAgent = /** @class */ (function () {
710
710
  * @returns {Promise<void>}
711
711
  */
712
712
  this.execute = queued(function (incoming, mode) { return __awaiter(_this, void 0, void 0, function () {
713
- var rawMessage, message, toolCalls, _loop_1, this_1, toolCalls_1, toolCalls_1_1, tool, state_1, e_1_1, result, validation, result1;
714
- var e_1, _a;
713
+ var rawMessage, message, toolCalls, _loop_1, this_1, idx, state_1, result, validation, result1;
715
714
  var _this = this;
716
- var _b, _c, _d, _e, _f, _g;
717
- return __generator(this, function (_h) {
718
- switch (_h.label) {
715
+ var _a, _b, _c, _d, _e, _f;
716
+ return __generator(this, function (_g) {
717
+ switch (_g.label) {
719
718
  case 0:
720
719
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute begin"), { incoming: incoming, mode: mode });
721
720
  this.params.onExecute &&
@@ -727,14 +726,14 @@ var ClientAgent = /** @class */ (function () {
727
726
  content: incoming.trim(),
728
727
  })];
729
728
  case 1:
730
- _h.sent();
729
+ _g.sent();
731
730
  return [4 /*yield*/, this.getCompletion(mode)];
732
731
  case 2:
733
- rawMessage = _h.sent();
732
+ rawMessage = _g.sent();
734
733
  return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
735
734
  case 3:
736
- message = _h.sent();
737
- if (!message.tool_calls) return [3 /*break*/, 13];
735
+ message = _g.sent();
736
+ if (!message.tool_calls) return [3 /*break*/, 9];
738
737
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " tool call begin"));
739
738
  toolCalls = message.tool_calls.map(function (call) {
740
739
  var _a, _b;
@@ -746,45 +745,56 @@ var ClientAgent = /** @class */ (function () {
746
745
  });
747
746
  return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
748
747
  case 4:
749
- _h.sent();
750
- _loop_1 = function (tool) {
751
- var targetFn, result_2, result_3;
752
- return __generator(this, function (_j) {
753
- switch (_j.label) {
748
+ _g.sent();
749
+ _loop_1 = function (idx) {
750
+ var tool, targetFn, result_2, result_3;
751
+ return __generator(this, function (_h) {
752
+ switch (_h.label) {
754
753
  case 0:
755
- targetFn = (_b = this_1.params.tools) === null || _b === void 0 ? void 0 : _b.find(function (t) { return t.function.name === tool.function.name; });
754
+ tool = toolCalls[idx];
755
+ targetFn = (_a = this_1.params.tools) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.function.name === tool.function.name; });
756
756
  if (!!targetFn) return [3 /*break*/, 3];
757
757
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"), this_1.params.tools);
758
758
  return [4 /*yield*/, this_1._resurrectModel(mode, "No target function for ".concat(tool.function.name))];
759
759
  case 1:
760
- result_2 = _j.sent();
760
+ result_2 = _h.sent();
761
761
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_2));
762
762
  return [4 /*yield*/, this_1._emitOuput(mode, result_2)];
763
763
  case 2:
764
- _j.sent();
764
+ _h.sent();
765
765
  return [2 /*return*/, { value: void 0 }];
766
766
  case 3:
767
- ((_c = targetFn.callbacks) === null || _c === void 0 ? void 0 : _c.onValidate) &&
768
- ((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onValidate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
769
- return [4 /*yield*/, not(targetFn.validate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments))];
767
+ ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onValidate) &&
768
+ ((_c = targetFn.callbacks) === null || _c === void 0 ? void 0 : _c.onValidate(this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
769
+ return [4 /*yield*/, not(targetFn.validate({
770
+ clientId: this_1.params.clientId,
771
+ agentName: this_1.params.agentName,
772
+ params: tool.function.arguments
773
+ }))];
770
774
  case 4:
771
- if (!_j.sent()) return [3 /*break*/, 7];
775
+ if (!_h.sent()) return [3 /*break*/, 7];
772
776
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool validation not passed"));
773
777
  return [4 /*yield*/, this_1._resurrectModel(mode, "Function validation failed: name=".concat(tool.function.name, " arguments=").concat(JSON.stringify(tool.function.arguments)))];
774
778
  case 5:
775
- result_3 = _j.sent();
779
+ result_3 = _h.sent();
776
780
  this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " execute end result=").concat(result_3));
777
781
  return [4 /*yield*/, this_1._emitOuput(mode, result_3)];
778
782
  case 6:
779
- _j.sent();
783
+ _h.sent();
780
784
  return [2 /*return*/, { value: void 0 }];
781
785
  case 7:
782
- ((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall) &&
783
- ((_f = targetFn.callbacks) === null || _f === void 0 ? void 0 : _f.onBeforeCall(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
786
+ ((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onBeforeCall) &&
787
+ ((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments));
784
788
  /**
785
789
  * @description Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
786
790
  */
787
- Promise.resolve(targetFn.call(tool.id, this_1.params.clientId, this_1.params.agentName, tool.function.arguments)).then(function () {
791
+ Promise.resolve(targetFn.call({
792
+ toolId: tool.id,
793
+ clientId: this_1.params.clientId,
794
+ agentName: this_1.params.agentName,
795
+ params: tool.function.arguments,
796
+ isLast: idx === toolCalls.length - 1,
797
+ })).then(function () {
788
798
  var _a, _b;
789
799
  ((_a = targetFn.callbacks) === null || _a === void 0 ? void 0 : _a.onAfterCall) &&
790
800
  ((_b = targetFn.callbacks) === null || _b === void 0 ? void 0 : _b.onAfterCall(tool.id, _this.params.clientId, _this.params.agentName, tool.function.arguments));
@@ -795,72 +805,57 @@ var ClientAgent = /** @class */ (function () {
795
805
  this_1._outputSubject.toPromise(),
796
806
  ])];
797
807
  case 8:
798
- _j.sent();
808
+ _h.sent();
799
809
  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 end"));
800
810
  return [2 /*return*/];
801
811
  }
802
812
  });
803
813
  };
804
814
  this_1 = this;
805
- _h.label = 5;
815
+ idx = 0;
816
+ _g.label = 5;
806
817
  case 5:
807
- _h.trys.push([5, 10, 11, 12]);
808
- toolCalls_1 = __values(toolCalls), toolCalls_1_1 = toolCalls_1.next();
809
- _h.label = 6;
818
+ if (!(idx !== toolCalls.length)) return [3 /*break*/, 8];
819
+ return [5 /*yield**/, _loop_1(idx)];
810
820
  case 6:
811
- if (!!toolCalls_1_1.done) return [3 /*break*/, 9];
812
- tool = toolCalls_1_1.value;
813
- return [5 /*yield**/, _loop_1(tool)];
814
- case 7:
815
- state_1 = _h.sent();
821
+ state_1 = _g.sent();
816
822
  if (typeof state_1 === "object")
817
823
  return [2 /*return*/, state_1.value];
818
- _h.label = 8;
824
+ _g.label = 7;
825
+ case 7:
826
+ idx++;
827
+ return [3 /*break*/, 5];
819
828
  case 8:
820
- toolCalls_1_1 = toolCalls_1.next();
821
- return [3 /*break*/, 6];
822
- case 9: return [3 /*break*/, 12];
823
- case 10:
824
- e_1_1 = _h.sent();
825
- e_1 = { error: e_1_1 };
826
- return [3 /*break*/, 12];
827
- case 11:
828
- try {
829
- if (toolCalls_1_1 && !toolCalls_1_1.done && (_a = toolCalls_1.return)) _a.call(toolCalls_1);
830
- }
831
- finally { if (e_1) throw e_1.error; }
832
- return [7 /*endfinally*/];
833
- case 12:
834
- ((_g = this.params.callbacks) === null || _g === void 0 ? void 0 : _g.onAfterToolCalls) &&
829
+ ((_f = this.params.callbacks) === null || _f === void 0 ? void 0 : _f.onAfterToolCalls) &&
835
830
  this.params.callbacks.onAfterToolCalls(this.params.clientId, this.params.agentName, toolCalls);
836
831
  return [2 /*return*/];
837
- case 13:
832
+ case 9:
838
833
  if (!message.tool_calls) {
839
834
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute no tool calls detected"));
840
835
  }
841
836
  return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
842
- case 14:
843
- result = _h.sent();
837
+ case 10:
838
+ result = _g.sent();
844
839
  return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
845
- case 15:
846
- _h.sent();
840
+ case 11:
841
+ _g.sent();
847
842
  validation = null;
848
843
  return [4 /*yield*/, this.params.validate(result)];
849
- case 16:
850
- if (!(validation = _h.sent())) return [3 /*break*/, 19];
844
+ case 12:
845
+ if (!(validation = _g.sent())) return [3 /*break*/, 15];
851
846
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
852
847
  return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
853
- case 17:
854
- result1 = _h.sent();
848
+ case 13:
849
+ result1 = _g.sent();
855
850
  return [4 /*yield*/, this._emitOuput(mode, result1)];
856
- case 18:
857
- _h.sent();
851
+ case 14:
852
+ _g.sent();
858
853
  return [2 /*return*/];
859
- case 19:
854
+ case 15:
860
855
  this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
861
856
  return [4 /*yield*/, this._emitOuput(mode, result)];
862
- case 20:
863
- _h.sent();
857
+ case 16:
858
+ _g.sent();
864
859
  return [2 /*return*/];
865
860
  }
866
861
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
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
@@ -538,7 +538,13 @@ interface IAgentTool<T = Record<string, unknown>> extends ITool {
538
538
  * @param params - The parameters for the tool.
539
539
  * @returns A promise that resolves when the tool call is complete.
540
540
  */
541
- call(toolId: string, clientId: string, agentName: AgentName, params: T): Promise<void>;
541
+ call(dto: {
542
+ toolId: string;
543
+ clientId: string;
544
+ agentName: AgentName;
545
+ params: T;
546
+ isLast: boolean;
547
+ }): Promise<void>;
542
548
  /**
543
549
  * Validates the parameters for the tool.
544
550
  * @param clientId - The ID of the client.
@@ -546,7 +552,11 @@ interface IAgentTool<T = Record<string, unknown>> extends ITool {
546
552
  * @param params - The parameters for the tool.
547
553
  * @returns A promise that resolves to a boolean indicating whether the parameters are valid, or a boolean.
548
554
  */
549
- validate(clientId: string, agentName: AgentName, params: T): Promise<boolean> | boolean;
555
+ validate(dto: {
556
+ clientId: string;
557
+ agentName: AgentName;
558
+ params: T;
559
+ }): Promise<boolean> | boolean;
550
560
  /** The name of the tool. */
551
561
  callbacks?: Partial<IAgentToolCallbacks>;
552
562
  }