agent-swarm-kit 1.1.138 → 1.1.140

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
@@ -6631,6 +6631,7 @@ class ClientSwarm {
6631
6631
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
6632
6632
  this.params.logger.debug(`ClientSwarm swarmName=${this.params.swarmName} clientId=${this.params.clientId} setBusy`, { isBusy });
6633
6633
  this._isBusy += isBusy ? 1 : -1;
6634
+ return Promise.resolve();
6634
6635
  }
6635
6636
  /**
6636
6637
  * Getter for the list of agent name-agent pairs from the agent map (params.agentMap).
@@ -7487,11 +7488,19 @@ class ClientSession {
7487
7488
  this.params.onExecute &&
7488
7489
  this.params.onExecute(this.params.clientId, this.params.swarmName, message, mode);
7489
7490
  const agent = await this.params.swarm.getAgent();
7490
- this.params.swarm.setBusy(true);
7491
+ if (await this.params.swarm.getCheckBusy()) {
7492
+ return "";
7493
+ }
7494
+ await this.params.swarm.setBusy(true);
7491
7495
  const outputAwaiter = this.params.swarm.waitForOutput();
7492
7496
  agent.execute(message, mode);
7493
- const output = await outputAwaiter;
7494
- this.params.swarm.setBusy(false);
7497
+ let output = "";
7498
+ try {
7499
+ output = await outputAwaiter;
7500
+ }
7501
+ finally {
7502
+ await this.params.swarm.setBusy(false);
7503
+ }
7495
7504
  await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7496
7505
  if (await functoolsKit.not(this.params.policy.validateOutput(output, this.params.clientId, this.params.swarmName))) {
7497
7506
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
package/build/index.mjs CHANGED
@@ -6629,6 +6629,7 @@ class ClientSwarm {
6629
6629
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
6630
6630
  this.params.logger.debug(`ClientSwarm swarmName=${this.params.swarmName} clientId=${this.params.clientId} setBusy`, { isBusy });
6631
6631
  this._isBusy += isBusy ? 1 : -1;
6632
+ return Promise.resolve();
6632
6633
  }
6633
6634
  /**
6634
6635
  * Getter for the list of agent name-agent pairs from the agent map (params.agentMap).
@@ -7485,11 +7486,19 @@ class ClientSession {
7485
7486
  this.params.onExecute &&
7486
7487
  this.params.onExecute(this.params.clientId, this.params.swarmName, message, mode);
7487
7488
  const agent = await this.params.swarm.getAgent();
7488
- this.params.swarm.setBusy(true);
7489
+ if (await this.params.swarm.getCheckBusy()) {
7490
+ return "";
7491
+ }
7492
+ await this.params.swarm.setBusy(true);
7489
7493
  const outputAwaiter = this.params.swarm.waitForOutput();
7490
7494
  agent.execute(message, mode);
7491
- const output = await outputAwaiter;
7492
- this.params.swarm.setBusy(false);
7495
+ let output = "";
7496
+ try {
7497
+ output = await outputAwaiter;
7498
+ }
7499
+ finally {
7500
+ await this.params.swarm.setBusy(false);
7501
+ }
7493
7502
  await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7494
7503
  if (await not(this.params.policy.validateOutput(output, this.params.clientId, this.params.swarmName))) {
7495
7504
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.138",
3
+ "version": "1.1.140",
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
@@ -1337,7 +1337,7 @@ interface ISwarm {
1337
1337
  * @param {boolean} isBusy - True to mark the swarm as busy, false to mark it as idle.
1338
1338
  * @throws {Error} If setting the busy state fails (e.g., due to internal errors).
1339
1339
  */
1340
- setBusy(isBusy: boolean): void;
1340
+ setBusy(isBusy: boolean): Promise<void>;
1341
1341
  }
1342
1342
  /**
1343
1343
  * Type representing the unique name of a swarm within the system.
@@ -5466,7 +5466,7 @@ declare class ClientSwarm implements ISwarm {
5466
5466
  * Enables coordinated state management and debugging.
5467
5467
  * @param {boolean} isBusy - True to mark the swarm as busy, false to mark it as idle.
5468
5468
  */
5469
- setBusy(isBusy: boolean): void;
5469
+ setBusy(isBusy: boolean): Promise<void>;
5470
5470
  /**
5471
5471
  * Subject that emits when an agent reference changes, providing the agent name and instance.
5472
5472
  * Used by setAgentRef to notify subscribers (e.g., waitForOutput) of updates to agent instances.