agent-swarm-kit 1.0.41 → 1.0.43
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 +22 -15
- package/build/index.mjs +22 -15
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -356,7 +356,10 @@ var validateDefault = function (output) { return __awaiter(void 0, void 0, void
|
|
|
356
356
|
}); };
|
|
357
357
|
|
|
358
358
|
var removeXmlTags = function (input) {
|
|
359
|
-
return input
|
|
359
|
+
return input
|
|
360
|
+
.replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g, '')
|
|
361
|
+
.replace(/\n\s*\n/g, '\n')
|
|
362
|
+
.trim();
|
|
360
363
|
};
|
|
361
364
|
|
|
362
365
|
/**
|
|
@@ -533,11 +536,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
533
536
|
return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
|
|
534
537
|
case 4:
|
|
535
538
|
message = _a.sent();
|
|
536
|
-
|
|
539
|
+
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
540
|
+
case 5:
|
|
541
|
+
result = _a.sent();
|
|
537
542
|
validation = null;
|
|
538
543
|
return [4 /*yield*/, this.params.validate(result)];
|
|
539
|
-
case
|
|
540
|
-
if (!(validation = _a.sent())) return [3 /*break*/,
|
|
544
|
+
case 6:
|
|
545
|
+
if (!(validation = _a.sent())) return [3 /*break*/, 8];
|
|
541
546
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel validation error: ").concat(validation));
|
|
542
547
|
content = getPlaceholder();
|
|
543
548
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -546,11 +551,11 @@ var ClientAgent = /** @class */ (function () {
|
|
|
546
551
|
mode: "tool",
|
|
547
552
|
content: content,
|
|
548
553
|
})];
|
|
549
|
-
case
|
|
554
|
+
case 7:
|
|
550
555
|
_a.sent();
|
|
551
556
|
return [2 /*return*/, content];
|
|
552
|
-
case
|
|
553
|
-
case
|
|
557
|
+
case 8: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
558
|
+
case 9:
|
|
554
559
|
_a.sent();
|
|
555
560
|
return [2 /*return*/, result];
|
|
556
561
|
}
|
|
@@ -835,26 +840,28 @@ var ClientAgent = /** @class */ (function () {
|
|
|
835
840
|
if (!message.tool_calls) {
|
|
836
841
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute no tool calls detected"));
|
|
837
842
|
}
|
|
838
|
-
|
|
839
|
-
return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
843
|
+
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
840
844
|
case 14:
|
|
845
|
+
result = _h.sent();
|
|
846
|
+
return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
847
|
+
case 15:
|
|
841
848
|
_h.sent();
|
|
842
849
|
validation = null;
|
|
843
850
|
return [4 /*yield*/, this.params.validate(result)];
|
|
844
|
-
case
|
|
845
|
-
if (!(validation = _h.sent())) return [3 /*break*/,
|
|
851
|
+
case 16:
|
|
852
|
+
if (!(validation = _h.sent())) return [3 /*break*/, 19];
|
|
846
853
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
|
|
847
854
|
return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
|
|
848
|
-
case
|
|
855
|
+
case 17:
|
|
849
856
|
result1 = _h.sent();
|
|
850
857
|
return [4 /*yield*/, this._emitOuput(mode, result1)];
|
|
851
|
-
case
|
|
858
|
+
case 18:
|
|
852
859
|
_h.sent();
|
|
853
860
|
return [2 /*return*/];
|
|
854
|
-
case
|
|
861
|
+
case 19:
|
|
855
862
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
|
|
856
863
|
return [4 /*yield*/, this._emitOuput(mode, result)];
|
|
857
|
-
case
|
|
864
|
+
case 20:
|
|
858
865
|
_h.sent();
|
|
859
866
|
return [2 /*return*/];
|
|
860
867
|
}
|
package/build/index.mjs
CHANGED
|
@@ -354,7 +354,10 @@ var validateDefault = function (output) { return __awaiter(void 0, void 0, void
|
|
|
354
354
|
}); };
|
|
355
355
|
|
|
356
356
|
var removeXmlTags = function (input) {
|
|
357
|
-
return input
|
|
357
|
+
return input
|
|
358
|
+
.replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g, '')
|
|
359
|
+
.replace(/\n\s*\n/g, '\n')
|
|
360
|
+
.trim();
|
|
358
361
|
};
|
|
359
362
|
|
|
360
363
|
/**
|
|
@@ -531,11 +534,13 @@ var ClientAgent = /** @class */ (function () {
|
|
|
531
534
|
return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
|
|
532
535
|
case 4:
|
|
533
536
|
message = _a.sent();
|
|
534
|
-
|
|
537
|
+
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
538
|
+
case 5:
|
|
539
|
+
result = _a.sent();
|
|
535
540
|
validation = null;
|
|
536
541
|
return [4 /*yield*/, this.params.validate(result)];
|
|
537
|
-
case
|
|
538
|
-
if (!(validation = _a.sent())) return [3 /*break*/,
|
|
542
|
+
case 6:
|
|
543
|
+
if (!(validation = _a.sent())) return [3 /*break*/, 8];
|
|
539
544
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel validation error: ").concat(validation));
|
|
540
545
|
content = getPlaceholder();
|
|
541
546
|
return [4 /*yield*/, this.params.history.push({
|
|
@@ -544,11 +549,11 @@ var ClientAgent = /** @class */ (function () {
|
|
|
544
549
|
mode: "tool",
|
|
545
550
|
content: content,
|
|
546
551
|
})];
|
|
547
|
-
case
|
|
552
|
+
case 7:
|
|
548
553
|
_a.sent();
|
|
549
554
|
return [2 /*return*/, content];
|
|
550
|
-
case
|
|
551
|
-
case
|
|
555
|
+
case 8: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
556
|
+
case 9:
|
|
552
557
|
_a.sent();
|
|
553
558
|
return [2 /*return*/, result];
|
|
554
559
|
}
|
|
@@ -833,26 +838,28 @@ var ClientAgent = /** @class */ (function () {
|
|
|
833
838
|
if (!message.tool_calls) {
|
|
834
839
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute no tool calls detected"));
|
|
835
840
|
}
|
|
836
|
-
|
|
837
|
-
return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
841
|
+
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
838
842
|
case 14:
|
|
843
|
+
result = _h.sent();
|
|
844
|
+
return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
845
|
+
case 15:
|
|
839
846
|
_h.sent();
|
|
840
847
|
validation = null;
|
|
841
848
|
return [4 /*yield*/, this.params.validate(result)];
|
|
842
|
-
case
|
|
843
|
-
if (!(validation = _h.sent())) return [3 /*break*/,
|
|
849
|
+
case 16:
|
|
850
|
+
if (!(validation = _h.sent())) return [3 /*break*/, 19];
|
|
844
851
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute invalid tool call detected: ").concat(validation), { result: result });
|
|
845
852
|
return [4 /*yield*/, this._resurrectModel(mode, "Invalid model output: ".concat(result))];
|
|
846
|
-
case
|
|
853
|
+
case 17:
|
|
847
854
|
result1 = _h.sent();
|
|
848
855
|
return [4 /*yield*/, this._emitOuput(mode, result1)];
|
|
849
|
-
case
|
|
856
|
+
case 18:
|
|
850
857
|
_h.sent();
|
|
851
858
|
return [2 /*return*/];
|
|
852
|
-
case
|
|
859
|
+
case 19:
|
|
853
860
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " execute end result=").concat(result));
|
|
854
861
|
return [4 /*yield*/, this._emitOuput(mode, result)];
|
|
855
|
-
case
|
|
862
|
+
case 20:
|
|
856
863
|
_h.sent();
|
|
857
864
|
return [2 /*return*/];
|
|
858
865
|
}
|