agent-swarm-kit 1.1.92 → 1.1.94

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
@@ -3740,6 +3740,8 @@ const createToolCall = async (idx, tool, toolCalls, targetFn, reason, self) => {
3740
3740
  });
3741
3741
  targetFn.callbacks?.onCallError &&
3742
3742
  targetFn.callbacks?.onCallError(tool.id, self.params.clientId, self.params.agentName, tool.function.arguments, error);
3743
+ self.params.callbacks?.onToolError &&
3744
+ self.params.callbacks.onToolError(self.params.clientId, self.params.agentName, error);
3743
3745
  self._toolErrorSubject.next(TOOL_ERROR_SYMBOL);
3744
3746
  }
3745
3747
  };
@@ -5420,6 +5422,8 @@ class MergeMCP {
5420
5422
  console.error(`agent-swarm MCP tool error toolName=${toolName} agentName=${agentName} error=${functoolsKit.getErrorMessage(error)}`);
5421
5423
  {
5422
5424
  const { callbacks = {} } = swarm$1.agentSchemaService.get(agentName);
5425
+ callbacks.onToolError &&
5426
+ callbacks.onToolError(dto.clientId, dto.agentName, error);
5423
5427
  callbacks.onResurrect &&
5424
5428
  callbacks.onResurrect(dto.clientId, dto.agentName, "tool", `MCP execution failed toolName=${toolName}`);
5425
5429
  }
@@ -17811,9 +17815,10 @@ class ExecutionValidationService {
17811
17815
  return;
17812
17816
  }
17813
17817
  const swarmName = this.sessionValidationService.getSwarm(clientId);
17814
- const { size } = this.getExecutionCount(clientId, swarmName).add(executionId);
17815
- if (size >= GLOBAL_CONFIG.CC_MAX_NESTED_EXECUTIONS) {
17816
- const msg = `agent-swarm recursive execution prevented for clientId=${clientId} swarmName=${swarmName} executionId=${executionId} size=${size}`;
17818
+ const executionSet = this.getExecutionCount(clientId, swarmName).add(executionId);
17819
+ if (executionSet.size >= GLOBAL_CONFIG.CC_MAX_NESTED_EXECUTIONS) {
17820
+ const ids = [...executionSet].join(",");
17821
+ const msg = `agent-swarm recursive execution prevented for clientId=${clientId} swarmName=${swarmName} executionId=${executionId} size=${executionSet.size} ids=${ids}`;
17817
17822
  console.error(msg);
17818
17823
  throw new Error(msg);
17819
17824
  }
package/build/index.mjs CHANGED
@@ -3738,6 +3738,8 @@ const createToolCall = async (idx, tool, toolCalls, targetFn, reason, self) => {
3738
3738
  });
3739
3739
  targetFn.callbacks?.onCallError &&
3740
3740
  targetFn.callbacks?.onCallError(tool.id, self.params.clientId, self.params.agentName, tool.function.arguments, error);
3741
+ self.params.callbacks?.onToolError &&
3742
+ self.params.callbacks.onToolError(self.params.clientId, self.params.agentName, error);
3741
3743
  self._toolErrorSubject.next(TOOL_ERROR_SYMBOL);
3742
3744
  }
3743
3745
  };
@@ -5418,6 +5420,8 @@ class MergeMCP {
5418
5420
  console.error(`agent-swarm MCP tool error toolName=${toolName} agentName=${agentName} error=${getErrorMessage(error)}`);
5419
5421
  {
5420
5422
  const { callbacks = {} } = swarm$1.agentSchemaService.get(agentName);
5423
+ callbacks.onToolError &&
5424
+ callbacks.onToolError(dto.clientId, dto.agentName, error);
5421
5425
  callbacks.onResurrect &&
5422
5426
  callbacks.onResurrect(dto.clientId, dto.agentName, "tool", `MCP execution failed toolName=${toolName}`);
5423
5427
  }
@@ -17809,9 +17813,10 @@ class ExecutionValidationService {
17809
17813
  return;
17810
17814
  }
17811
17815
  const swarmName = this.sessionValidationService.getSwarm(clientId);
17812
- const { size } = this.getExecutionCount(clientId, swarmName).add(executionId);
17813
- if (size >= GLOBAL_CONFIG.CC_MAX_NESTED_EXECUTIONS) {
17814
- const msg = `agent-swarm recursive execution prevented for clientId=${clientId} swarmName=${swarmName} executionId=${executionId} size=${size}`;
17816
+ const executionSet = this.getExecutionCount(clientId, swarmName).add(executionId);
17817
+ if (executionSet.size >= GLOBAL_CONFIG.CC_MAX_NESTED_EXECUTIONS) {
17818
+ const ids = [...executionSet].join(",");
17819
+ const msg = `agent-swarm recursive execution prevented for clientId=${clientId} swarmName=${swarmName} executionId=${executionId} size=${executionSet.size} ids=${ids}`;
17815
17820
  console.error(msg);
17816
17821
  throw new Error(msg);
17817
17822
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.92",
3
+ "version": "1.1.94",
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
@@ -3490,6 +3490,15 @@ interface IAgentSchemaInternalCallbacks {
3490
3490
  * @param {IToolRequest} request - The content of the tool request.
3491
3491
  */
3492
3492
  onToolRequest?: (clientId: string, agentName: AgentName, request: IToolRequest[]) => void;
3493
+ /**
3494
+ * Optional callback triggered when a tool throw an error
3495
+ * This callback is used to log the error before resurrect
3496
+ *
3497
+ * @param {string} clientId - The ID of the client interacting with the agent.
3498
+ * @param {AgentName} agentName - The name of the agent making the tool request.
3499
+ * @param {IToolRequest} request - The content of the tool request.
3500
+ */
3501
+ onToolError?: (clientId: string, agentName: AgentName, error: Error) => void;
3493
3502
  /**
3494
3503
  * Optional callback triggered when an assistant message is committed.
3495
3504
  * @param {string} clientId - The ID of the client interacting with the agent.