agent-swarm-kit 1.0.48 → 1.0.50

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
@@ -3125,6 +3125,9 @@ var AgentValidationService = /** @class */ (function () {
3125
3125
  }
3126
3126
  _this.completionValidationService.validate(agent.completion, source);
3127
3127
  (_a = agent.tools) === null || _a === void 0 ? void 0 : _a.forEach(function (toolName) {
3128
+ if (typeof toolName !== "string") {
3129
+ throw new Error("agent-swarm agent ".concat(agentName, " tool list is invalid (toolName=").concat(String(toolName), ") source=").concat(source));
3130
+ }
3128
3131
  _this.toolValidationService.validate(toolName, source);
3129
3132
  });
3130
3133
  });
@@ -4584,6 +4587,34 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
4584
4587
  });
4585
4588
  }); };
4586
4589
 
4590
+ /**
4591
+ * Send the message to the active agent in the swarm content like it income from client side
4592
+ * Should be used to review tool output and initiate conversation from the model side to client
4593
+ *
4594
+ * Will execute even if the agent is inactive
4595
+ *
4596
+ * @param {string} content - The content to be executed.
4597
+ * @param {string} clientId - The ID of the client requesting execution.
4598
+ * @returns {Promise<void>} - A promise that resolves when the execution is complete.
4599
+ */
4600
+ var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
4601
+ var swarmName;
4602
+ return __generator(this, function (_a) {
4603
+ switch (_a.label) {
4604
+ case 0:
4605
+ swarm.loggerService.log("function executeForce", {
4606
+ content: content,
4607
+ clientId: clientId,
4608
+ });
4609
+ swarm.sessionValidationService.validate(clientId, "executeForce");
4610
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
4611
+ swarm.swarmValidationService.validate(swarmName, "executeForce");
4612
+ return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", clientId, swarmName)];
4613
+ case 1: return [2 /*return*/, _a.sent()];
4614
+ }
4615
+ });
4616
+ }); };
4617
+
4587
4618
  /**
4588
4619
  * Retrieves the last message sent by the user from the client's message history.
4589
4620
  *
@@ -4785,6 +4816,7 @@ exports.disposeConnection = disposeConnection;
4785
4816
  exports.emit = emit;
4786
4817
  exports.emitForce = emitForce;
4787
4818
  exports.execute = execute;
4819
+ exports.executeForce = executeForce;
4788
4820
  exports.getAgentHistory = getAgentHistory;
4789
4821
  exports.getAgentName = getAgentName;
4790
4822
  exports.getAssistantHistory = getAssistantHistory;
package/build/index.mjs CHANGED
@@ -3123,6 +3123,9 @@ var AgentValidationService = /** @class */ (function () {
3123
3123
  }
3124
3124
  _this.completionValidationService.validate(agent.completion, source);
3125
3125
  (_a = agent.tools) === null || _a === void 0 ? void 0 : _a.forEach(function (toolName) {
3126
+ if (typeof toolName !== "string") {
3127
+ throw new Error("agent-swarm agent ".concat(agentName, " tool list is invalid (toolName=").concat(String(toolName), ") source=").concat(source));
3128
+ }
3126
3129
  _this.toolValidationService.validate(toolName, source);
3127
3130
  });
3128
3131
  });
@@ -4582,6 +4585,34 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
4582
4585
  });
4583
4586
  }); };
4584
4587
 
4588
+ /**
4589
+ * Send the message to the active agent in the swarm content like it income from client side
4590
+ * Should be used to review tool output and initiate conversation from the model side to client
4591
+ *
4592
+ * Will execute even if the agent is inactive
4593
+ *
4594
+ * @param {string} content - The content to be executed.
4595
+ * @param {string} clientId - The ID of the client requesting execution.
4596
+ * @returns {Promise<void>} - A promise that resolves when the execution is complete.
4597
+ */
4598
+ var executeForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
4599
+ var swarmName;
4600
+ return __generator(this, function (_a) {
4601
+ switch (_a.label) {
4602
+ case 0:
4603
+ swarm.loggerService.log("function executeForce", {
4604
+ content: content,
4605
+ clientId: clientId,
4606
+ });
4607
+ swarm.sessionValidationService.validate(clientId, "executeForce");
4608
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
4609
+ swarm.swarmValidationService.validate(swarmName, "executeForce");
4610
+ return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", clientId, swarmName)];
4611
+ case 1: return [2 /*return*/, _a.sent()];
4612
+ }
4613
+ });
4614
+ }); };
4615
+
4585
4616
  /**
4586
4617
  * Retrieves the last message sent by the user from the client's message history.
4587
4618
  *
@@ -4764,4 +4795,4 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
4764
4795
  };
4765
4796
  };
4766
4797
 
4767
- export { ContextService, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
4798
+ export { ContextService, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
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
@@ -2063,6 +2063,18 @@ declare const commitUserMessageForce: (content: string, clientId: string) => Pro
2063
2063
  */
2064
2064
  declare const emitForce: (content: string, clientId: string) => Promise<void>;
2065
2065
 
2066
+ /**
2067
+ * Send the message to the active agent in the swarm content like it income from client side
2068
+ * Should be used to review tool output and initiate conversation from the model side to client
2069
+ *
2070
+ * Will execute even if the agent is inactive
2071
+ *
2072
+ * @param {string} content - The content to be executed.
2073
+ * @param {string} clientId - The ID of the client requesting execution.
2074
+ * @returns {Promise<void>} - A promise that resolves when the execution is complete.
2075
+ */
2076
+ declare const executeForce: (content: string, clientId: string) => Promise<string>;
2077
+
2066
2078
  /**
2067
2079
  * Retrieves the last message sent by the user from the client's message history.
2068
2080
  *
@@ -2162,4 +2174,4 @@ declare const GLOBAL_CONFIG: {
2162
2174
  };
2163
2175
  declare const setConfig: (config: Partial<typeof GLOBAL_CONFIG>) => void;
2164
2176
 
2165
- export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionArgs, type ICompletionSchema, type IIncomingMessage, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };
2177
+ export { ContextService, type IAgentSchema, type IAgentTool, type ICompletionArgs, type ICompletionSchema, type IIncomingMessage, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type ISwarmSchema, type ITool, type IToolCall, type ReceiveMessageFn, type SendMessageFn$1 as SendMessageFn, addAgent, addCompletion, addSwarm, addTool, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, makeAutoDispose, makeConnection, session, setConfig, swarm };