agent-swarm-kit 1.0.142 → 1.0.144

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
@@ -1977,7 +1977,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
1977
1977
  return [4 /*yield*/, self.params.history.push(__assign(__assign({}, message), { agentName: self.params.agentName }))];
1978
1978
  case 4:
1979
1979
  _k.sent();
1980
- lastToolCallRef = Promise.resolve();
1980
+ lastToolCallRef = Promise.resolve(null);
1981
1981
  isResqued_1 = false;
1982
1982
  {
1983
1983
  unResque = self._modelResqueSubject.once(function () {
@@ -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, statusAwaiter, isResolved, status, result_3;
2005
2005
  return __generator(this, function (_l) {
2006
2006
  switch (_l.label) {
2007
2007
  case 0:
@@ -2049,12 +2049,21 @@ 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
+ statusAwaiter = Promise.race([
2053
+ self._agentChangeSubject.toPromise(),
2054
+ self._toolCommitSubject.toPromise(),
2055
+ self._toolErrorSubject.toPromise(),
2056
+ self._toolStopSubject.toPromise(),
2057
+ self._outputSubject.toPromise(),
2058
+ self._modelResqueSubject.toPromise(),
2059
+ ]);
2052
2060
  /**
2053
- * @description Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
2061
+ * Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
2054
2062
  */
2055
- lastToolCallRef = lastToolCallRef.then(function () {
2056
- return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; });
2057
- });
2063
+ {
2064
+ lastToolCallRef.then(function () { return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; }); });
2065
+ lastToolCallRef = lastToolCallRef.then(function () { return statusAwaiter; });
2066
+ }
2058
2067
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2059
2068
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
2060
2069
  isResolved = false;
@@ -2063,14 +2072,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2063
2072
  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
2073
  }
2065
2074
  });
2066
- return [4 /*yield*/, Promise.race([
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
- ])];
2075
+ return [4 /*yield*/, statusAwaiter];
2074
2076
  case 8:
2075
2077
  status = _l.sent();
2076
2078
  isResolved = true;
package/build/index.mjs CHANGED
@@ -1975,7 +1975,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
1975
1975
  return [4 /*yield*/, self.params.history.push(__assign(__assign({}, message), { agentName: self.params.agentName }))];
1976
1976
  case 4:
1977
1977
  _k.sent();
1978
- lastToolCallRef = Promise.resolve();
1978
+ lastToolCallRef = Promise.resolve(null);
1979
1979
  isResqued_1 = false;
1980
1980
  {
1981
1981
  unResque = self._modelResqueSubject.once(function () {
@@ -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, statusAwaiter, isResolved, status, result_3;
2003
2003
  return __generator(this, function (_l) {
2004
2004
  switch (_l.label) {
2005
2005
  case 0:
@@ -2047,12 +2047,21 @@ 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
+ statusAwaiter = Promise.race([
2051
+ self._agentChangeSubject.toPromise(),
2052
+ self._toolCommitSubject.toPromise(),
2053
+ self._toolErrorSubject.toPromise(),
2054
+ self._toolStopSubject.toPromise(),
2055
+ self._outputSubject.toPromise(),
2056
+ self._modelResqueSubject.toPromise(),
2057
+ ]);
2050
2058
  /**
2051
- * @description Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
2059
+ * Do not await to avoid deadlock! The tool can send the message to other agents by emulating user messages
2052
2060
  */
2053
- lastToolCallRef = lastToolCallRef.then(function () {
2054
- return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; });
2055
- });
2061
+ {
2062
+ lastToolCallRef.then(function () { return createToolCall(idx, tool, toolCalls_1, targetFn, self, function () { return isResqued_1; }); });
2063
+ lastToolCallRef = lastToolCallRef.then(function () { return statusAwaiter; });
2064
+ }
2056
2065
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2057
2066
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
2058
2067
  isResolved = false;
@@ -2061,14 +2070,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2061
2070
  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
2071
  }
2063
2072
  });
2064
- return [4 /*yield*/, Promise.race([
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
- ])];
2073
+ return [4 /*yield*/, statusAwaiter];
2072
2074
  case 8:
2073
2075
  status = _l.sent();
2074
2076
  isResolved = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",