agent-swarm-kit 1.1.96 → 1.1.97

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
@@ -7346,6 +7346,7 @@ class ClientSession {
7346
7346
  const outputAwaiter = this.params.swarm.waitForOutput();
7347
7347
  agent.execute(message, mode);
7348
7348
  const output = await outputAwaiter;
7349
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7349
7350
  if (await functoolsKit.not(this.params.policy.validateOutput(output, this.params.clientId, this.params.swarmName))) {
7350
7351
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
7351
7352
  this.params.logger.debug(`ClientSession clientId=${this.params.clientId} execution output emit canceled due to the banhammer of a client`, {
@@ -7610,6 +7611,7 @@ class ClientSession {
7610
7611
  clientId: this.params.clientId,
7611
7612
  });
7612
7613
  this._notifySubject.subscribe(async (data) => {
7614
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7613
7615
  await connector({
7614
7616
  data,
7615
7617
  agentName: await this.params.swarm.getAgentName(),
@@ -7620,6 +7622,7 @@ class ClientSession {
7620
7622
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
7621
7623
  this.params.logger.debug(`ClientSession clientId=${this.params.clientId} connect call`);
7622
7624
  const data = await this.execute(incoming.data, "user");
7625
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7623
7626
  if (!data) {
7624
7627
  return "";
7625
7628
  }
@@ -17847,8 +17850,30 @@ class ExecutionValidationService {
17847
17850
  if (!this.sessionValidationService.hasSession(clientId)) {
17848
17851
  return;
17849
17852
  }
17850
- const { executionSet } = this.getExecutionCount(clientId, swarmName);
17853
+ const { executionSet, executionIgnore } = this.getExecutionCount(clientId, swarmName);
17851
17854
  executionSet.delete(executionId);
17855
+ executionIgnore.add(executionId);
17856
+ };
17857
+ /**
17858
+ * Clears all tracked execution IDs for a specific client and swarm.
17859
+ * This effectively resets the execution count for the given client and swarm context,
17860
+ * but does not remove the memoized entry itself.
17861
+ *
17862
+ * @param {string} clientId - The unique identifier for the client.
17863
+ * @param {SwarmName} swarmName - The name of the swarm associated with the client.
17864
+ * @returns {void}
17865
+ */
17866
+ this.flushCount = (clientId, swarmName) => {
17867
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
17868
+ this.loggerService.info("executionValidationService dispose", {
17869
+ clientId,
17870
+ swarmName,
17871
+ });
17872
+ if (!this.sessionValidationService.hasSession(clientId)) {
17873
+ return;
17874
+ }
17875
+ const { executionSet } = this.getExecutionCount(clientId, swarmName);
17876
+ executionSet.clear();
17852
17877
  };
17853
17878
  /**
17854
17879
  * Clears the memoized execution count for a specific client and swarm.
package/build/index.mjs CHANGED
@@ -7344,6 +7344,7 @@ class ClientSession {
7344
7344
  const outputAwaiter = this.params.swarm.waitForOutput();
7345
7345
  agent.execute(message, mode);
7346
7346
  const output = await outputAwaiter;
7347
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7347
7348
  if (await not(this.params.policy.validateOutput(output, this.params.clientId, this.params.swarmName))) {
7348
7349
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
7349
7350
  this.params.logger.debug(`ClientSession clientId=${this.params.clientId} execution output emit canceled due to the banhammer of a client`, {
@@ -7608,6 +7609,7 @@ class ClientSession {
7608
7609
  clientId: this.params.clientId,
7609
7610
  });
7610
7611
  this._notifySubject.subscribe(async (data) => {
7612
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7611
7613
  await connector({
7612
7614
  data,
7613
7615
  agentName: await this.params.swarm.getAgentName(),
@@ -7618,6 +7620,7 @@ class ClientSession {
7618
7620
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
7619
7621
  this.params.logger.debug(`ClientSession clientId=${this.params.clientId} connect call`);
7620
7622
  const data = await this.execute(incoming.data, "user");
7623
+ await swarm$1.executionValidationService.flushCount(this.params.clientId, this.params.swarmName);
7621
7624
  if (!data) {
7622
7625
  return "";
7623
7626
  }
@@ -17845,8 +17848,30 @@ class ExecutionValidationService {
17845
17848
  if (!this.sessionValidationService.hasSession(clientId)) {
17846
17849
  return;
17847
17850
  }
17848
- const { executionSet } = this.getExecutionCount(clientId, swarmName);
17851
+ const { executionSet, executionIgnore } = this.getExecutionCount(clientId, swarmName);
17849
17852
  executionSet.delete(executionId);
17853
+ executionIgnore.add(executionId);
17854
+ };
17855
+ /**
17856
+ * Clears all tracked execution IDs for a specific client and swarm.
17857
+ * This effectively resets the execution count for the given client and swarm context,
17858
+ * but does not remove the memoized entry itself.
17859
+ *
17860
+ * @param {string} clientId - The unique identifier for the client.
17861
+ * @param {SwarmName} swarmName - The name of the swarm associated with the client.
17862
+ * @returns {void}
17863
+ */
17864
+ this.flushCount = (clientId, swarmName) => {
17865
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
17866
+ this.loggerService.info("executionValidationService dispose", {
17867
+ clientId,
17868
+ swarmName,
17869
+ });
17870
+ if (!this.sessionValidationService.hasSession(clientId)) {
17871
+ return;
17872
+ }
17873
+ const { executionSet } = this.getExecutionCount(clientId, swarmName);
17874
+ executionSet.clear();
17850
17875
  };
17851
17876
  /**
17852
17877
  * Clears the memoized execution count for a specific client and swarm.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.96",
3
+ "version": "1.1.97",
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
@@ -10665,6 +10665,16 @@ declare class ExecutionValidationService {
10665
10665
  * @returns {void}
10666
10666
  */
10667
10667
  decrementCount: (executionId: string, clientId: string, swarmName: SwarmName) => void;
10668
+ /**
10669
+ * Clears all tracked execution IDs for a specific client and swarm.
10670
+ * This effectively resets the execution count for the given client and swarm context,
10671
+ * but does not remove the memoized entry itself.
10672
+ *
10673
+ * @param {string} clientId - The unique identifier for the client.
10674
+ * @param {SwarmName} swarmName - The name of the swarm associated with the client.
10675
+ * @returns {void}
10676
+ */
10677
+ flushCount: (clientId: string, swarmName: SwarmName) => void;
10668
10678
  /**
10669
10679
  * Clears the memoized execution count for a specific client and swarm.
10670
10680
  * @param {string} clientId - The unique identifier for the client.