agent-swarm-kit 1.0.134 → 1.0.136

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
@@ -1813,6 +1813,7 @@ var AgentSchemaService = /** @class */ (function () {
1813
1813
  var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
1814
1814
  var TOOL_ERROR_SYMBOL = Symbol("tool-error");
1815
1815
  var TOOL_STOP_SYMBOL = Symbol("tool-stop");
1816
+ var TOOL_NO_OUTPUT_WARNING = 15000;
1816
1817
  var getPlaceholder = function () {
1817
1818
  return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
1818
1819
  };
@@ -1929,7 +1930,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
1929
1930
  case 4:
1930
1931
  _j.sent();
1931
1932
  _loop_1 = function (idx) {
1932
- var tool, targetFn, result_1, result_2, status, result_3;
1933
+ var tool, targetFn, result_1, result_2, isResolved, status, result_3;
1933
1934
  return __generator(this, function (_k) {
1934
1935
  switch (_k.label) {
1935
1936
  case 0:
@@ -2006,6 +2007,12 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2006
2007
  });
2007
2008
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2008
2009
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
2010
+ isResolved = false;
2011
+ functoolsKit.sleep(TOOL_NO_OUTPUT_WARNING).then(function () {
2012
+ if (!isResolved) {
2013
+ 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));
2014
+ }
2015
+ });
2009
2016
  return [4 /*yield*/, Promise.race([
2010
2017
  self._agentChangeSubject.toPromise(),
2011
2018
  self._toolCommitSubject.toPromise(),
@@ -2015,6 +2022,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2015
2022
  ])];
2016
2023
  case 8:
2017
2024
  status = _k.sent();
2025
+ isResolved = true;
2018
2026
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2019
2027
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call end"));
2020
2028
  if (status === AGENT_CHANGE_SYMBOL) {
package/build/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { scoped } from 'di-scoped';
2
2
  import { createActivator } from 'di-kit';
3
- import { trycatch, singleshot, memoize, randomString, ToolRegistry, Subject, queued, getErrorMessage, errorData, not, isObject, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, execpool, SortedArray, Source, schedule, rate, ttl } from 'functools-kit';
3
+ import { trycatch, singleshot, memoize, randomString, ToolRegistry, Subject, queued, getErrorMessage, errorData, sleep, not, isObject, createAwaiter, cancelable, CANCELED_PROMISE_SYMBOL, execpool, SortedArray, Source, schedule, rate, ttl } from 'functools-kit';
4
4
  import xml2js from 'xml2js';
5
5
  import { AsyncResource } from 'async_hooks';
6
6
  import { omit } from 'lodash-es';
@@ -1811,6 +1811,7 @@ var AgentSchemaService = /** @class */ (function () {
1811
1811
  var AGENT_CHANGE_SYMBOL = Symbol("agent-change");
1812
1812
  var TOOL_ERROR_SYMBOL = Symbol("tool-error");
1813
1813
  var TOOL_STOP_SYMBOL = Symbol("tool-stop");
1814
+ var TOOL_NO_OUTPUT_WARNING = 15000;
1814
1815
  var getPlaceholder = function () {
1815
1816
  return GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS[Math.floor(Math.random() * GLOBAL_CONFIG.CC_EMPTY_OUTPUT_PLACEHOLDERS.length)];
1816
1817
  };
@@ -1927,7 +1928,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
1927
1928
  case 4:
1928
1929
  _j.sent();
1929
1930
  _loop_1 = function (idx) {
1930
- var tool, targetFn, result_1, result_2, status, result_3;
1931
+ var tool, targetFn, result_1, result_2, isResolved, status, result_3;
1931
1932
  return __generator(this, function (_k) {
1932
1933
  switch (_k.label) {
1933
1934
  case 0:
@@ -2004,6 +2005,12 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2004
2005
  });
2005
2006
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2006
2007
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call executing"));
2008
+ isResolved = false;
2009
+ sleep(TOOL_NO_OUTPUT_WARNING).then(function () {
2010
+ if (!isResolved) {
2011
+ 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));
2012
+ }
2013
+ });
2007
2014
  return [4 /*yield*/, Promise.race([
2008
2015
  self._agentChangeSubject.toPromise(),
2009
2016
  self._toolCommitSubject.toPromise(),
@@ -2013,6 +2020,7 @@ var EXECUTE_FN = function (incoming, mode, self) { return __awaiter(void 0, void
2013
2020
  ])];
2014
2021
  case 8:
2015
2022
  status = _k.sent();
2023
+ isResolved = true;
2016
2024
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
2017
2025
  self.params.logger.debug("ClientAgent agentName=".concat(self.params.agentName, " clientId=").concat(self.params.clientId, " functionName=").concat(tool.function.name, " tool call end"));
2018
2026
  if (status === AGENT_CHANGE_SYMBOL) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.134",
3
+ "version": "1.0.136",
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
@@ -4455,7 +4455,7 @@ declare const addSwarm: (swarmSchema: ISwarmSchema) => string;
4455
4455
  * @param {IAgentTool} toolSchema - The schema of the tool to be added.
4456
4456
  * @returns {string} The name of the tool that was added.
4457
4457
  */
4458
- declare const addTool: (toolSchema: IAgentTool<Record<string, string | number | boolean>>) => string;
4458
+ declare const addTool: <T extends any = Record<string, ToolValue>>(storageSchema: IAgentTool<T>) => string;
4459
4459
 
4460
4460
  /**
4461
4461
  * Adds a new state to the state registry. The swarm takes only those states which was registered
@@ -4463,7 +4463,7 @@ declare const addTool: (toolSchema: IAgentTool<Record<string, string | number |
4463
4463
  * @param {IStateSchema} stateSchema - The schema of the state to be added.
4464
4464
  * @returns {string} The name of the added state.
4465
4465
  */
4466
- declare const addState: (stateSchema: IStateSchema<any>) => string;
4466
+ declare const addState: <T extends unknown = any>(storageSchema: IStateSchema<T>) => string;
4467
4467
 
4468
4468
  /**
4469
4469
  * Adds a new embedding to the embedding registry. The swarm takes only those embeddings which was registered