agent-swarm-kit 1.0.142 → 1.0.143
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 +17 -12
- package/build/index.mjs +17 -12
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -2001,7 +2001,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
2001
2001
|
self._outputSubject.once(unResque);
|
|
2002
2002
|
}
|
|
2003
2003
|
_loop_1 = function (idx) {
|
|
2004
|
-
var tool, targetFn, result_1, result_2, isResolved, status, result_3;
|
|
2004
|
+
var tool, targetFn, result_1, result_2, toolFinishSubject, statusAwaiter, isResolved, status, result_3;
|
|
2005
2005
|
return __generator(this, function (_l) {
|
|
2006
2006
|
switch (_l.label) {
|
|
2007
2007
|
case 0:
|
|
@@ -2049,12 +2049,24 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
2049
2049
|
case 7:
|
|
2050
2050
|
((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onBeforeCall) &&
|
|
2051
2051
|
((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall(tool.id, self.params.clientId, self.params.agentName, tool.function.arguments));
|
|
2052
|
+
toolFinishSubject = new functoolsKit.Subject();
|
|
2053
|
+
statusAwaiter = Promise.race([
|
|
2054
|
+
self._agentChangeSubject.toPromise(),
|
|
2055
|
+
self._toolCommitSubject.toPromise(),
|
|
2056
|
+
self._toolErrorSubject.toPromise(),
|
|
2057
|
+
self._toolStopSubject.toPromise(),
|
|
2058
|
+
self._outputSubject.toPromise(),
|
|
2059
|
+
self._modelResqueSubject.toPromise(),
|
|
2060
|
+
toolFinishSubject.toPromise(),
|
|
2061
|
+
]);
|
|
2052
2062
|
/**
|
|
2053
|
-
*
|
|
2063
|
+
* Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
|
|
2054
2064
|
*/
|
|
2055
|
-
lastToolCallRef = lastToolCallRef
|
|
2065
|
+
lastToolCallRef = lastToolCallRef
|
|
2066
|
+
.then(function () {
|
|
2056
2067
|
return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; });
|
|
2057
|
-
})
|
|
2068
|
+
})
|
|
2069
|
+
.then(function () { return void toolFinishSubject.next(); });
|
|
2058
2070
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2059
2071
|
self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
|
|
2060
2072
|
isResolved = false;
|
|
@@ -2063,14 +2075,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
2063
2075
|
console.warn("agent-swarm no tool output after ".concat(TOOL_NO_OUTPUT_WARNING, "ms clientId=").concat(self.params.clientId, " agentName=").concat(self.params.agentName, " toolId=").concat(tool.id, " functionName=").concat(tool.function.name));
|
|
2064
2076
|
}
|
|
2065
2077
|
});
|
|
2066
|
-
return [4 /*yield*/,
|
|
2067
|
-
self._agentChangeSubject.toPromise(),
|
|
2068
|
-
self._toolCommitSubject.toPromise(),
|
|
2069
|
-
self._toolErrorSubject.toPromise(),
|
|
2070
|
-
self._toolStopSubject.toPromise(),
|
|
2071
|
-
self._outputSubject.toPromise(),
|
|
2072
|
-
self._modelResqueSubject.toPromise(),
|
|
2073
|
-
])];
|
|
2078
|
+
return [4 /*yield*/, statusAwaiter];
|
|
2074
2079
|
case 8:
|
|
2075
2080
|
status = _l.sent();
|
|
2076
2081
|
isResolved = true;
|
package/build/index.mjs
CHANGED
|
@@ -1999,7 +1999,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
1999
1999
|
self._outputSubject.once(unResque);
|
|
2000
2000
|
}
|
|
2001
2001
|
_loop_1 = function (idx) {
|
|
2002
|
-
var tool, targetFn, result_1, result_2, isResolved, status, result_3;
|
|
2002
|
+
var tool, targetFn, result_1, result_2, toolFinishSubject, statusAwaiter, isResolved, status, result_3;
|
|
2003
2003
|
return __generator(this, function (_l) {
|
|
2004
2004
|
switch (_l.label) {
|
|
2005
2005
|
case 0:
|
|
@@ -2047,12 +2047,24 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
2047
2047
|
case 7:
|
|
2048
2048
|
((_d = targetFn.callbacks) === null || _d === void 0 ? void 0 : _d.onBeforeCall) &&
|
|
2049
2049
|
((_e = targetFn.callbacks) === null || _e === void 0 ? void 0 : _e.onBeforeCall(tool.id, self.params.clientId, self.params.agentName, tool.function.arguments));
|
|
2050
|
+
toolFinishSubject = new Subject();
|
|
2051
|
+
statusAwaiter = Promise.race([
|
|
2052
|
+
self._agentChangeSubject.toPromise(),
|
|
2053
|
+
self._toolCommitSubject.toPromise(),
|
|
2054
|
+
self._toolErrorSubject.toPromise(),
|
|
2055
|
+
self._toolStopSubject.toPromise(),
|
|
2056
|
+
self._outputSubject.toPromise(),
|
|
2057
|
+
self._modelResqueSubject.toPromise(),
|
|
2058
|
+
toolFinishSubject.toPromise(),
|
|
2059
|
+
]);
|
|
2050
2060
|
/**
|
|
2051
|
-
*
|
|
2061
|
+
* Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
|
|
2052
2062
|
*/
|
|
2053
|
-
lastToolCallRef = lastToolCallRef
|
|
2063
|
+
lastToolCallRef = lastToolCallRef
|
|
2064
|
+
.then(function () {
|
|
2054
2065
|
return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; });
|
|
2055
|
-
})
|
|
2066
|
+
})
|
|
2067
|
+
.then(function () { return void toolFinishSubject.next(); });
|
|
2056
2068
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2057
2069
|
self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
|
|
2058
2070
|
isResolved = false;
|
|
@@ -2061,14 +2073,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
|
|
|
2061
2073
|
console.warn("agent-swarm no tool output after ".concat(TOOL_NO_OUTPUT_WARNING, "ms clientId=").concat(self.params.clientId, " agentName=").concat(self.params.agentName, " toolId=").concat(tool.id, " functionName=").concat(tool.function.name));
|
|
2062
2074
|
}
|
|
2063
2075
|
});
|
|
2064
|
-
return [4 /*yield*/,
|
|
2065
|
-
self._agentChangeSubject.toPromise(),
|
|
2066
|
-
self._toolCommitSubject.toPromise(),
|
|
2067
|
-
self._toolErrorSubject.toPromise(),
|
|
2068
|
-
self._toolStopSubject.toPromise(),
|
|
2069
|
-
self._outputSubject.toPromise(),
|
|
2070
|
-
self._modelResqueSubject.toPromise(),
|
|
2071
|
-
])];
|
|
2076
|
+
return [4 /*yield*/, statusAwaiter];
|
|
2072
2077
|
case 8:
|
|
2073
2078
|
status = _l.sent();
|
|
2074
2079
|
isResolved = true;
|