agent-swarm-kit 1.0.178 → 1.0.180

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
@@ -4535,10 +4535,7 @@ const WAIT_FOR_OUTPUT_FN = async (self) => {
4535
4535
  agentName,
4536
4536
  output: await agent.waitForOutput(),
4537
4537
  }))
4538
- .concat(self._emitSubject.toPromise().then(async (output) => ({
4539
- agentName: await self.getAgentName(),
4540
- output,
4541
- })))
4538
+ .concat(self._emitSubject.toPromise())
4542
4539
  .concat(self._cancelOutputSubject.toPromise())));
4543
4540
  const handleOutput = () => {
4544
4541
  getOutput.cancel();
@@ -4649,7 +4646,10 @@ class ClientSwarm {
4649
4646
  async emit(message) {
4650
4647
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
4651
4648
  this.params.logger.debug(`ClientSwarm swarmName=${this.params.swarmName} clientId=${this.params.clientId} emit`);
4652
- await this._emitSubject.next(message);
4649
+ await this._emitSubject.next({
4650
+ agentName: await this.getAgentName(),
4651
+ output: message,
4652
+ });
4653
4653
  await this.params.bus.emit(this.params.clientId, {
4654
4654
  type: "emit",
4655
4655
  source: "session-bus",
@@ -17231,6 +17231,7 @@ class AdapterUtils {
17231
17231
  */
17232
17232
  functoolsKit.execpool(functoolsKit.retry(async ({ agentName, messages: rawMessages, mode, tools, clientId, }) => {
17233
17233
  LoggerAdapter.logClient(clientId, "AdapterUtils fromLMStudio completion", JSON.stringify(rawMessages));
17234
+ const toolNames = new Set(tools?.map((tool) => tool.function.name));
17234
17235
  const messages = rawMessages.map(({ role, tool_call_id, tool_calls, content }) => ({
17235
17236
  role,
17236
17237
  tool_call_id,
@@ -17256,7 +17257,9 @@ class AdapterUtils {
17256
17257
  mode,
17257
17258
  agentName,
17258
17259
  role,
17259
- tool_calls: tool_calls?.map(({ function: f, ...rest }) => ({
17260
+ tool_calls: tool_calls
17261
+ ?.filter(({ function: { name } }) => toolNames.has(name))
17262
+ ?.map(({ function: f, ...rest }) => ({
17260
17263
  ...rest,
17261
17264
  function: {
17262
17265
  name: f.name,
package/build/index.mjs CHANGED
@@ -4533,10 +4533,7 @@ const WAIT_FOR_OUTPUT_FN = async (self) => {
4533
4533
  agentName,
4534
4534
  output: await agent.waitForOutput(),
4535
4535
  }))
4536
- .concat(self._emitSubject.toPromise().then(async (output) => ({
4537
- agentName: await self.getAgentName(),
4538
- output,
4539
- })))
4536
+ .concat(self._emitSubject.toPromise())
4540
4537
  .concat(self._cancelOutputSubject.toPromise())));
4541
4538
  const handleOutput = () => {
4542
4539
  getOutput.cancel();
@@ -4647,7 +4644,10 @@ class ClientSwarm {
4647
4644
  async emit(message) {
4648
4645
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
4649
4646
  this.params.logger.debug(`ClientSwarm swarmName=${this.params.swarmName} clientId=${this.params.clientId} emit`);
4650
- await this._emitSubject.next(message);
4647
+ await this._emitSubject.next({
4648
+ agentName: await this.getAgentName(),
4649
+ output: message,
4650
+ });
4651
4651
  await this.params.bus.emit(this.params.clientId, {
4652
4652
  type: "emit",
4653
4653
  source: "session-bus",
@@ -17229,6 +17229,7 @@ class AdapterUtils {
17229
17229
  */
17230
17230
  execpool(retry(async ({ agentName, messages: rawMessages, mode, tools, clientId, }) => {
17231
17231
  LoggerAdapter.logClient(clientId, "AdapterUtils fromLMStudio completion", JSON.stringify(rawMessages));
17232
+ const toolNames = new Set(tools?.map((tool) => tool.function.name));
17232
17233
  const messages = rawMessages.map(({ role, tool_call_id, tool_calls, content }) => ({
17233
17234
  role,
17234
17235
  tool_call_id,
@@ -17254,7 +17255,9 @@ class AdapterUtils {
17254
17255
  mode,
17255
17256
  agentName,
17256
17257
  role,
17257
- tool_calls: tool_calls?.map(({ function: f, ...rest }) => ({
17258
+ tool_calls: tool_calls
17259
+ ?.filter(({ function: { name } }) => toolNames.has(name))
17260
+ ?.map(({ function: f, ...rest }) => ({
17258
17261
  ...rest,
17259
17262
  function: {
17260
17263
  name: f.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.178",
3
+ "version": "1.0.180",
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
@@ -3907,7 +3907,10 @@ declare class ClientSwarm implements ISwarm {
3907
3907
  * @type {Subject<string>}
3908
3908
  * @readonly
3909
3909
  */
3910
- readonly _emitSubject: Subject<string>;
3910
+ readonly _emitSubject: Subject<{
3911
+ agentName: string;
3912
+ output: string;
3913
+ }>;
3911
3914
  /**
3912
3915
  * Subject that emits to cancel output waiting, providing an empty output string and agent name.
3913
3916
  * Triggered by cancelOutput to interrupt waitForOutput, ensuring responsive cancellation.