agent-swarm-kit 1.1.35 → 1.1.36

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
@@ -4675,7 +4675,7 @@ class ClientOperator {
4675
4675
  }
4676
4676
  }
4677
4677
 
4678
- const METHOD_NAME$1j = "function.commit.commitToolOutput";
4678
+ const METHOD_NAME$1k = "function.commit.commitToolOutput";
4679
4679
  /**
4680
4680
  * Commits the output of a tool execution to the active agent in a swarm session.
4681
4681
  *
@@ -4695,19 +4695,19 @@ const METHOD_NAME$1j = "function.commit.commitToolOutput";
4695
4695
  const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
4696
4696
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
4697
4697
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4698
- swarm$1.loggerService.log(METHOD_NAME$1j, {
4698
+ swarm$1.loggerService.log(METHOD_NAME$1k, {
4699
4699
  toolId,
4700
4700
  content,
4701
4701
  clientId,
4702
4702
  agentName,
4703
4703
  });
4704
4704
  // Validate the agent, session, and swarm to ensure they exist and are accessible
4705
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1j);
4706
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1j);
4705
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1k);
4706
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1k);
4707
4707
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4708
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1j);
4708
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1k);
4709
4709
  // Check if the specified agent is still the active agent in the swarm session
4710
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1j, clientId, swarmName);
4710
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1k, clientId, swarmName);
4711
4711
  if (currentAgentName !== agentName) {
4712
4712
  // Log a skip message if the agent has changed during the operation
4713
4713
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -4720,10 +4720,10 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
4720
4720
  return;
4721
4721
  }
4722
4722
  // Commit the tool output to the session via the session public service
4723
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1j, clientId, swarmName);
4723
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1k, clientId, swarmName);
4724
4724
  });
4725
4725
 
4726
- const METHOD_NAME$1i = "function.target.execute";
4726
+ const METHOD_NAME$1j = "function.target.execute";
4727
4727
  /**
4728
4728
  * Sends a message to the active agent in a swarm session as if it originated from the client side.
4729
4729
  *
@@ -4745,19 +4745,19 @@ const execute = beginContext(async (content, clientId, agentName) => {
4745
4745
  const executionId = functoolsKit.randomString();
4746
4746
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
4747
4747
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4748
- swarm$1.loggerService.log(METHOD_NAME$1i, {
4748
+ swarm$1.loggerService.log(METHOD_NAME$1j, {
4749
4749
  content,
4750
4750
  clientId,
4751
4751
  agentName,
4752
4752
  executionId,
4753
4753
  });
4754
4754
  // Validate the agent, session, and swarm
4755
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1i);
4756
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1i);
4755
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1j);
4756
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1j);
4757
4757
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4758
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1i);
4758
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1j);
4759
4759
  // Check if the specified agent is still the active agent
4760
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1i, clientId, swarmName);
4760
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1j, clientId, swarmName);
4761
4761
  if (currentAgentName !== agentName) {
4762
4762
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4763
4763
  swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
@@ -4776,7 +4776,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
4776
4776
  agentName,
4777
4777
  swarmName,
4778
4778
  });
4779
- const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1i, clientId, swarmName);
4779
+ const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1j, clientId, swarmName);
4780
4780
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
4781
4781
  swarm$1.busService.commitExecutionEnd(clientId, {
4782
4782
  agentName,
@@ -4797,7 +4797,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
4797
4797
  });
4798
4798
 
4799
4799
  /** @private Constant defining the method name for logging and validation context */
4800
- const METHOD_NAME$1h = "function.commit.commitFlush";
4800
+ const METHOD_NAME$1i = "function.commit.commitFlush";
4801
4801
  /**
4802
4802
  * Commits a flush of agent history for a specific client and agent in the swarm system.
4803
4803
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
@@ -4814,19 +4814,19 @@ const METHOD_NAME$1h = "function.commit.commitFlush";
4814
4814
  const commitFlush = beginContext(async (clientId, agentName) => {
4815
4815
  // Log the flush attempt if enabled
4816
4816
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4817
- swarm$1.loggerService.log(METHOD_NAME$1h, {
4817
+ swarm$1.loggerService.log(METHOD_NAME$1i, {
4818
4818
  clientId,
4819
4819
  agentName,
4820
4820
  });
4821
4821
  // Validate the agent exists
4822
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1h);
4822
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1i);
4823
4823
  // Validate the session exists and retrieve the associated swarm
4824
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1h);
4824
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1i);
4825
4825
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4826
4826
  // Validate the swarm configuration
4827
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1h);
4827
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1i);
4828
4828
  // Check if the current agent matches the provided agent
4829
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1h, clientId, swarmName);
4829
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1i, clientId, swarmName);
4830
4830
  if (currentAgentName !== agentName) {
4831
4831
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4832
4832
  swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
@@ -4837,10 +4837,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
4837
4837
  return;
4838
4838
  }
4839
4839
  // Commit the flush of agent history via SessionPublicService
4840
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1h, clientId, swarmName);
4840
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1i, clientId, swarmName);
4841
4841
  });
4842
4842
 
4843
- const METHOD_NAME$1g = "function.target.emit";
4843
+ const METHOD_NAME$1h = "function.target.emit";
4844
4844
  /**
4845
4845
  * Emits a string as model output without executing an incoming message, with agent activity validation.
4846
4846
  *
@@ -4860,18 +4860,18 @@ const METHOD_NAME$1g = "function.target.emit";
4860
4860
  const emit = beginContext(async (content, clientId, agentName) => {
4861
4861
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
4862
4862
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4863
- swarm$1.loggerService.log(METHOD_NAME$1g, {
4863
+ swarm$1.loggerService.log(METHOD_NAME$1h, {
4864
4864
  content,
4865
4865
  clientId,
4866
4866
  agentName,
4867
4867
  });
4868
4868
  // Validate the agent, session, and swarm
4869
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1g);
4870
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1g);
4869
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1h);
4870
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1h);
4871
4871
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4872
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1g);
4872
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1h);
4873
4873
  // Check if the specified agent is still the active agent
4874
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1g, clientId, swarmName);
4874
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1h, clientId, swarmName);
4875
4875
  if (currentAgentName !== agentName) {
4876
4876
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4877
4877
  swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
@@ -4882,10 +4882,10 @@ const emit = beginContext(async (content, clientId, agentName) => {
4882
4882
  return;
4883
4883
  }
4884
4884
  // Emit the content directly via the session public service
4885
- return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1g, clientId, swarmName);
4885
+ return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1h, clientId, swarmName);
4886
4886
  });
4887
4887
 
4888
- const METHOD_NAME$1f = "function.common.getAgentName";
4888
+ const METHOD_NAME$1g = "function.common.getAgentName";
4889
4889
  /**
4890
4890
  * Retrieves the name of the active agent for a given client session in a swarm.
4891
4891
  *
@@ -4903,19 +4903,19 @@ const METHOD_NAME$1f = "function.common.getAgentName";
4903
4903
  const getAgentName = beginContext(async (clientId) => {
4904
4904
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
4905
4905
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4906
- swarm$1.loggerService.log(METHOD_NAME$1f, {
4906
+ swarm$1.loggerService.log(METHOD_NAME$1g, {
4907
4907
  clientId,
4908
4908
  });
4909
4909
  // Validate the session and swarm to ensure they exist and are accessible
4910
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1f);
4910
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1g);
4911
4911
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4912
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1f);
4912
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1g);
4913
4913
  // Retrieve the active agent name via the swarm public service
4914
- return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1f, clientId, swarmName);
4914
+ return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1g, clientId, swarmName);
4915
4915
  });
4916
4916
 
4917
4917
  /** @private Constant defining the method name for logging and validation context */
4918
- const METHOD_NAME$1e = "function.commit.commitStopTools";
4918
+ const METHOD_NAME$1f = "function.commit.commitStopTools";
4919
4919
  /**
4920
4920
  * Prevents the next tool from being executed for a specific client and agent in the swarm system.
4921
4921
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
@@ -4932,19 +4932,19 @@ const METHOD_NAME$1e = "function.commit.commitStopTools";
4932
4932
  const commitStopTools = beginContext(async (clientId, agentName) => {
4933
4933
  // Log the stop tools attempt if enabled
4934
4934
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4935
- swarm$1.loggerService.log(METHOD_NAME$1e, {
4935
+ swarm$1.loggerService.log(METHOD_NAME$1f, {
4936
4936
  clientId,
4937
4937
  agentName,
4938
4938
  });
4939
4939
  // Validate the agent exists
4940
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1e);
4940
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1f);
4941
4941
  // Validate the session exists and retrieve the associated swarm
4942
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1e);
4942
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1f);
4943
4943
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
4944
4944
  // Validate the swarm configuration
4945
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1e);
4945
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1f);
4946
4946
  // Check if the current agent matches the provided agent
4947
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1e, clientId, swarmName);
4947
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1f, clientId, swarmName);
4948
4948
  if (currentAgentName !== agentName) {
4949
4949
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
4950
4950
  swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
@@ -4955,7 +4955,7 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
4955
4955
  return;
4956
4956
  }
4957
4957
  // Commit the stop of the next tool execution via SessionPublicService
4958
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1e, clientId, swarmName);
4958
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1f, clientId, swarmName);
4959
4959
  });
4960
4960
 
4961
4961
  const METHOD_NAME_UPDATE$2 = "McpUtils.update";
@@ -5468,7 +5468,7 @@ class AgentConnectionService {
5468
5468
  }
5469
5469
 
5470
5470
  /** @private Constant defining the method name for logging purposes */
5471
- const METHOD_NAME$1d = "function.common.getPayload";
5471
+ const METHOD_NAME$1e = "function.common.getPayload";
5472
5472
  /**
5473
5473
  * Retrieves the payload from the current PayloadContextService context.
5474
5474
  * Returns null if no context is available. Logs the operation if logging is enabled.
@@ -5479,7 +5479,7 @@ const METHOD_NAME$1d = "function.common.getPayload";
5479
5479
  * console.log(payload); // { id: number } or null
5480
5480
  */
5481
5481
  const getPayload = () => {
5482
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1d);
5482
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1e);
5483
5483
  if (PayloadContextService.hasContext()) {
5484
5484
  const { payload } = swarm$1.payloadContextService.context;
5485
5485
  return payload;
@@ -17033,7 +17033,7 @@ const swarm = {
17033
17033
  init();
17034
17034
  var swarm$1 = swarm;
17035
17035
 
17036
- const METHOD_NAME$1c = "cli.dumpDocs";
17036
+ const METHOD_NAME$1d = "cli.dumpDocs";
17037
17037
  /**
17038
17038
  * Dumps the documentation for the agents and swarms.
17039
17039
  *
@@ -17043,7 +17043,7 @@ const METHOD_NAME$1c = "cli.dumpDocs";
17043
17043
  */
17044
17044
  const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
17045
17045
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17046
- swarm$1.loggerService.log(METHOD_NAME$1c, {
17046
+ swarm$1.loggerService.log(METHOD_NAME$1d, {
17047
17047
  dirName,
17048
17048
  });
17049
17049
  if (PlantUML) {
@@ -17053,10 +17053,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
17053
17053
  }
17054
17054
  swarm$1.agentValidationService
17055
17055
  .getAgentList()
17056
- .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1c));
17056
+ .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1d));
17057
17057
  swarm$1.swarmValidationService
17058
17058
  .getSwarmList()
17059
- .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1c));
17059
+ .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1d));
17060
17060
  swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
17061
17061
  const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
17062
17062
  if (!dependsOn) {
@@ -17066,7 +17066,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
17066
17066
  return swarm$1.docService.dumpDocs(prefix, dirName);
17067
17067
  });
17068
17068
 
17069
- const METHOD_NAME$1b = "cli.dumpAgent";
17069
+ const METHOD_NAME$1c = "cli.dumpAgent";
17070
17070
  /**
17071
17071
  * Dumps the agent information into PlantUML format.
17072
17072
  *
@@ -17075,14 +17075,14 @@ const METHOD_NAME$1b = "cli.dumpAgent";
17075
17075
  */
17076
17076
  const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
17077
17077
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17078
- swarm$1.loggerService.log(METHOD_NAME$1b, {
17078
+ swarm$1.loggerService.log(METHOD_NAME$1c, {
17079
17079
  agentName,
17080
17080
  });
17081
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1b);
17081
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1c);
17082
17082
  return swarm$1.agentMetaService.toUML(agentName, withSubtree);
17083
17083
  });
17084
17084
 
17085
- const METHOD_NAME$1a = "cli.dumpSwarm";
17085
+ const METHOD_NAME$1b = "cli.dumpSwarm";
17086
17086
  /**
17087
17087
  * Dumps the swarm information into PlantUML format.
17088
17088
  *
@@ -17091,14 +17091,14 @@ const METHOD_NAME$1a = "cli.dumpSwarm";
17091
17091
  */
17092
17092
  const dumpSwarm = beginContext((swarmName) => {
17093
17093
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17094
- swarm$1.loggerService.log(METHOD_NAME$1a, {
17094
+ swarm$1.loggerService.log(METHOD_NAME$1b, {
17095
17095
  swarmName,
17096
17096
  });
17097
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1a);
17097
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1b);
17098
17098
  return swarm$1.swarmMetaService.toUML(swarmName);
17099
17099
  });
17100
17100
 
17101
- const METHOD_NAME$19 = "cli.dumpPerfomance";
17101
+ const METHOD_NAME$1a = "cli.dumpPerfomance";
17102
17102
  const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
17103
17103
  const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
17104
17104
  /**
@@ -17117,7 +17117,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
17117
17117
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
17118
17118
  */
17119
17119
  const dumpPerfomance = async (dirName = "./logs/meta") => {
17120
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$19);
17120
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1a);
17121
17121
  await dumpPerfomanceInternal(dirName);
17122
17122
  };
17123
17123
  /**
@@ -17175,7 +17175,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
17175
17175
  return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
17176
17176
  });
17177
17177
 
17178
- const METHOD_NAME$18 = "cli.dumpClientPerformance";
17178
+ const METHOD_NAME$19 = "cli.dumpClientPerformance";
17179
17179
  const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
17180
17180
  const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
17181
17181
  /**
@@ -17199,7 +17199,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
17199
17199
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
17200
17200
  */
17201
17201
  const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
17202
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$18);
17202
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$19);
17203
17203
  await dumpClientPerformanceInternal(clientId, dirName);
17204
17204
  };
17205
17205
  /**
@@ -17220,7 +17220,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
17220
17220
  });
17221
17221
 
17222
17222
  /** @private Constant defining the method name for logging and validation context */
17223
- const METHOD_NAME$17 = "function.commit.commitFlushForce";
17223
+ const METHOD_NAME$18 = "function.commit.commitFlushForce";
17224
17224
  /**
17225
17225
  * Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
17226
17226
  * Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
@@ -17238,20 +17238,20 @@ const METHOD_NAME$17 = "function.commit.commitFlushForce";
17238
17238
  const commitFlushForce = beginContext(async (clientId) => {
17239
17239
  // Log the flush attempt if enabled
17240
17240
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17241
- swarm$1.loggerService.log(METHOD_NAME$17, {
17241
+ swarm$1.loggerService.log(METHOD_NAME$18, {
17242
17242
  clientId,
17243
- METHOD_NAME: METHOD_NAME$17,
17243
+ METHOD_NAME: METHOD_NAME$18,
17244
17244
  });
17245
17245
  // Validate the session exists and retrieve the associated swarm
17246
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$17);
17246
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$18);
17247
17247
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17248
17248
  // Validate the swarm configuration
17249
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$17);
17249
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$18);
17250
17250
  // Commit the flush of agent history via SessionPublicService without agent checks
17251
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$17, clientId, swarmName);
17251
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$18, clientId, swarmName);
17252
17252
  });
17253
17253
 
17254
- const METHOD_NAME$16 = "function.commit.commitToolOutputForce";
17254
+ const METHOD_NAME$17 = "function.commit.commitToolOutputForce";
17255
17255
  /**
17256
17256
  * Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
17257
17257
  *
@@ -17270,24 +17270,24 @@ const METHOD_NAME$16 = "function.commit.commitToolOutputForce";
17270
17270
  const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
17271
17271
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17272
17272
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17273
- swarm$1.loggerService.log(METHOD_NAME$16, {
17273
+ swarm$1.loggerService.log(METHOD_NAME$17, {
17274
17274
  toolId,
17275
17275
  content,
17276
17276
  clientId,
17277
17277
  });
17278
17278
  // Validate the session and swarm to ensure they exist and are accessible
17279
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$16);
17279
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$17);
17280
17280
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17281
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$16);
17281
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$17);
17282
17282
  // Commit the tool output to the session via the session public service without checking the active agent
17283
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$16, clientId, swarmName);
17283
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$17, clientId, swarmName);
17284
17284
  });
17285
17285
 
17286
17286
  /**
17287
17287
  * @private Constant defining the method name for logging and validation purposes.
17288
17288
  * Used as an identifier in log messages and validation checks to track calls to `hasNavigation`.
17289
17289
  */
17290
- const METHOD_NAME$15 = "function.common.hasNavigation";
17290
+ const METHOD_NAME$16 = "function.common.hasNavigation";
17291
17291
  /**
17292
17292
  * Checks if a specific agent is part of the navigation route for a given client.
17293
17293
  * Validates the agent and client session, retrieves the associated swarm, and queries the navigation route.
@@ -17298,16 +17298,16 @@ const METHOD_NAME$15 = "function.common.hasNavigation";
17298
17298
  */
17299
17299
  const hasNavigation = async (clientId, agentName) => {
17300
17300
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17301
- swarm$1.loggerService.log(METHOD_NAME$15, { clientId });
17302
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$15);
17303
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$15);
17301
+ swarm$1.loggerService.log(METHOD_NAME$16, { clientId });
17302
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$16);
17303
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$16);
17304
17304
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17305
17305
  return swarm$1.navigationValidationService
17306
17306
  .getNavigationRoute(clientId, swarmName)
17307
17307
  .has(agentName);
17308
17308
  };
17309
17309
 
17310
- const METHOD_NAME$14 = "function.history.getRawHistory";
17310
+ const METHOD_NAME$15 = "function.history.getRawHistory";
17311
17311
  /**
17312
17312
  * Retrieves the raw, unmodified history for a given client session.
17313
17313
  *
@@ -17324,10 +17324,10 @@ const METHOD_NAME$14 = "function.history.getRawHistory";
17324
17324
  * const rawHistory = await getRawHistory("client-123");
17325
17325
  * console.log(rawHistory); // Outputs the full raw history array
17326
17326
  */
17327
- const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$14) => {
17327
+ const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$15) => {
17328
17328
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17329
17329
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17330
- swarm$1.loggerService.log(METHOD_NAME$14, {
17330
+ swarm$1.loggerService.log(METHOD_NAME$15, {
17331
17331
  clientId,
17332
17332
  });
17333
17333
  // Validate the session and swarm
@@ -17340,7 +17340,7 @@ const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$14)
17340
17340
  return [...history];
17341
17341
  });
17342
17342
 
17343
- const METHOD_NAME$13 = "function.history.getLastUserMessage";
17343
+ const METHOD_NAME$14 = "function.history.getLastUserMessage";
17344
17344
  /**
17345
17345
  * Retrieves the content of the most recent user message from a client's session history.
17346
17346
  *
@@ -17358,16 +17358,16 @@ const METHOD_NAME$13 = "function.history.getLastUserMessage";
17358
17358
  const getLastUserMessage = beginContext(async (clientId) => {
17359
17359
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17360
17360
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17361
- swarm$1.loggerService.log(METHOD_NAME$13, {
17361
+ swarm$1.loggerService.log(METHOD_NAME$14, {
17362
17362
  clientId,
17363
17363
  });
17364
17364
  // Fetch raw history and find the last user message
17365
- const history = await getRawHistory(clientId, METHOD_NAME$13);
17365
+ const history = await getRawHistory(clientId, METHOD_NAME$14);
17366
17366
  const last = history.findLast(({ role, mode }) => role === "user" && mode === "user");
17367
17367
  return last?.content ? last.content : null;
17368
17368
  });
17369
17369
 
17370
- const METHOD_NAME$12 = "function.navigate.changeToDefaultAgent";
17370
+ const METHOD_NAME$13 = "function.navigate.changeToDefaultAgent";
17371
17371
  /**
17372
17372
  * Time-to-live for the change agent function in milliseconds.
17373
17373
  * Defines how long the cached change agent function remains valid before expiring.
@@ -17402,7 +17402,7 @@ const createChangeToDefaultAgent = functoolsKit.ttl((clientId) => functoolsKit.q
17402
17402
  }));
17403
17403
  {
17404
17404
  // Dispose of the current agent's resources and set up the new default agent
17405
- const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$12, clientId, swarmName);
17405
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$13, clientId, swarmName);
17406
17406
  await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
17407
17407
  await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
17408
17408
  await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
@@ -17441,23 +17441,23 @@ const createGc$3 = functoolsKit.singleshot(async () => {
17441
17441
  const changeToDefaultAgent = beginContext(async (clientId) => {
17442
17442
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17443
17443
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17444
- swarm$1.loggerService.log(METHOD_NAME$12, {
17444
+ swarm$1.loggerService.log(METHOD_NAME$13, {
17445
17445
  clientId,
17446
17446
  });
17447
17447
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17448
17448
  const { defaultAgent: agentName } = swarm$1.swarmSchemaService.get(swarmName);
17449
17449
  {
17450
17450
  // Validate session and default agent
17451
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
17452
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$12);
17451
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$13);
17452
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$13);
17453
17453
  }
17454
17454
  // Execute the agent change with TTL and queuing
17455
17455
  const run = await createChangeToDefaultAgent(clientId);
17456
17456
  createGc$3();
17457
- return await run(METHOD_NAME$12, agentName, swarmName);
17457
+ return await run(METHOD_NAME$13, agentName, swarmName);
17458
17458
  });
17459
17459
 
17460
- const METHOD_NAME$11 = "function.target.emitForce";
17460
+ const METHOD_NAME$12 = "function.target.emitForce";
17461
17461
  /**
17462
17462
  * Emits a string as model output without executing an incoming message or checking the active agent.
17463
17463
  *
@@ -17476,19 +17476,19 @@ const METHOD_NAME$11 = "function.target.emitForce";
17476
17476
  const emitForce = beginContext(async (content, clientId) => {
17477
17477
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17478
17478
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17479
- swarm$1.loggerService.log(METHOD_NAME$11, {
17479
+ swarm$1.loggerService.log(METHOD_NAME$12, {
17480
17480
  content,
17481
17481
  clientId,
17482
17482
  });
17483
17483
  // Validate the session and swarm
17484
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$11);
17484
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
17485
17485
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17486
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$11);
17486
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$12);
17487
17487
  // Emit the content directly via the session public service
17488
- return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$11, clientId, swarmName);
17488
+ return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$12, clientId, swarmName);
17489
17489
  });
17490
17490
 
17491
- const METHOD_NAME$10 = "function.target.executeForce";
17491
+ const METHOD_NAME$11 = "function.target.executeForce";
17492
17492
  /**
17493
17493
  * Sends a message to the active agent in a swarm session as if it originated from the client side, forcing execution regardless of agent activity.
17494
17494
  *
@@ -17509,22 +17509,22 @@ const executeForce = beginContext(async (content, clientId) => {
17509
17509
  const executionId = functoolsKit.randomString();
17510
17510
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17511
17511
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17512
- swarm$1.loggerService.log(METHOD_NAME$10, {
17512
+ swarm$1.loggerService.log(METHOD_NAME$11, {
17513
17513
  content,
17514
17514
  clientId,
17515
17515
  executionId,
17516
17516
  });
17517
17517
  // Validate the session and swarm
17518
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$10);
17518
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$11);
17519
17519
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17520
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$10);
17520
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$11);
17521
17521
  // Execute the command within an execution context with performance tracking
17522
17522
  return ExecutionContextService.runInContext(async () => {
17523
17523
  let isFinished = false;
17524
17524
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
17525
17525
  try {
17526
17526
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
17527
- const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$10, clientId, swarmName);
17527
+ const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$11, clientId, swarmName);
17528
17528
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
17529
17529
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
17530
17530
  return result;
@@ -17541,7 +17541,7 @@ const executeForce = beginContext(async (content, clientId) => {
17541
17541
  });
17542
17542
  });
17543
17543
 
17544
- const METHOD_NAME$$ = "function.template.navigateToTriageAgent";
17544
+ const METHOD_NAME$10 = "function.template.navigateToTriageAgent";
17545
17545
  /**
17546
17546
  * Will send tool output directly to the model without any additions
17547
17547
  */
@@ -17592,7 +17592,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
17592
17592
  */
17593
17593
  return beginContext(async (toolId, clientId) => {
17594
17594
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17595
- swarm$1.loggerService.log(METHOD_NAME$$, {
17595
+ swarm$1.loggerService.log(METHOD_NAME$10, {
17596
17596
  clientId,
17597
17597
  toolId,
17598
17598
  });
@@ -17624,7 +17624,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
17624
17624
  });
17625
17625
  };
17626
17626
 
17627
- const METHOD_NAME$_ = "function.navigate.changeToAgent";
17627
+ const METHOD_NAME$$ = "function.navigate.changeToAgent";
17628
17628
  /**
17629
17629
  * Time-to-live for the change agent function in milliseconds.
17630
17630
  * Defines how long the cached change agent function remains valid before expiring.
@@ -17660,7 +17660,7 @@ const createChangeToAgent = functoolsKit.ttl((clientId) => functoolsKit.queued(a
17660
17660
  }));
17661
17661
  {
17662
17662
  // Dispose of the current agent's resources and set up the new agent
17663
- const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$_, clientId, swarmName);
17663
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$$, clientId, swarmName);
17664
17664
  await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
17665
17665
  await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
17666
17666
  await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
@@ -17700,16 +17700,16 @@ const createGc$2 = functoolsKit.singleshot(async () => {
17700
17700
  const changeToAgent = beginContext(async (agentName, clientId) => {
17701
17701
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17702
17702
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17703
- swarm$1.loggerService.log(METHOD_NAME$_, {
17703
+ swarm$1.loggerService.log(METHOD_NAME$$, {
17704
17704
  agentName,
17705
17705
  clientId,
17706
17706
  });
17707
17707
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
17708
17708
  {
17709
17709
  // Validate session, agent, and dependencies
17710
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$_);
17711
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$_);
17712
- const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$_, clientId, swarmName);
17710
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$$);
17711
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$$);
17712
+ const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$$, clientId, swarmName);
17713
17713
  if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
17714
17714
  console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
17715
17715
  }
@@ -17727,10 +17727,10 @@ const changeToAgent = beginContext(async (agentName, clientId) => {
17727
17727
  // Execute the agent change with TTL and queuing
17728
17728
  const run = await createChangeToAgent(clientId);
17729
17729
  createGc$2();
17730
- return await run(METHOD_NAME$_, agentName, swarmName);
17730
+ return await run(METHOD_NAME$$, agentName, swarmName);
17731
17731
  });
17732
17732
 
17733
- const METHOD_NAME$Z = "function.template.navigateToAgent";
17733
+ const METHOD_NAME$_ = "function.template.navigateToAgent";
17734
17734
  /**
17735
17735
  * Will send tool output directly to the model without any additions
17736
17736
  */
@@ -17796,7 +17796,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
17796
17796
  */
17797
17797
  return beginContext(async (toolId, clientId, agentName) => {
17798
17798
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17799
- swarm$1.loggerService.log(METHOD_NAME$Z, {
17799
+ swarm$1.loggerService.log(METHOD_NAME$_, {
17800
17800
  clientId,
17801
17801
  toolId,
17802
17802
  });
@@ -17829,7 +17829,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
17829
17829
  });
17830
17830
  };
17831
17831
 
17832
- const METHOD_NAME$Y = "function.setup.addTool";
17832
+ const METHOD_NAME$Z = "function.setup.addTool";
17833
17833
  /**
17834
17834
  * Adds a new tool to the tool registry for use by agents in the swarm system.
17835
17835
  *
@@ -17851,7 +17851,7 @@ const METHOD_NAME$Y = "function.setup.addTool";
17851
17851
  const addTool = beginContext((toolSchema) => {
17852
17852
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17853
17853
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17854
- swarm$1.loggerService.log(METHOD_NAME$Y, {
17854
+ swarm$1.loggerService.log(METHOD_NAME$Z, {
17855
17855
  toolSchema,
17856
17856
  });
17857
17857
  // Register the tool in the validation and schema services
@@ -17865,7 +17865,7 @@ const addTool = beginContext((toolSchema) => {
17865
17865
  * Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
17866
17866
  * @module addAgentNavigation
17867
17867
  */
17868
- const METHOD_NAME$X = "function.alias.addAgentNavigation";
17868
+ const METHOD_NAME$Y = "function.alias.addAgentNavigation";
17869
17869
  const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
17870
17870
  /**
17871
17871
  * Creates and registers a navigation tool for an agent to navigate to another specified agent.
@@ -17879,7 +17879,7 @@ const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
17879
17879
  * @returns {ReturnType<typeof addTool>} The result of adding the navigation tool.
17880
17880
  */
17881
17881
  const addAgentNavigation = beginContext(({ toolName, docNote, description, navigateTo, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER$1, ...navigateProps }) => {
17882
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$X);
17882
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Y);
17883
17883
  const navigate = createNavigateToAgent(navigateProps);
17884
17884
  return addTool({
17885
17885
  toolName,
@@ -17908,7 +17908,7 @@ const addAgentNavigation = beginContext(({ toolName, docNote, description, navig
17908
17908
  * Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
17909
17909
  * @module addTriageNavigation
17910
17910
  */
17911
- const METHOD_NAME$W = "function.alias.addTriageNavigation";
17911
+ const METHOD_NAME$X = "function.alias.addTriageNavigation";
17912
17912
  const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
17913
17913
  /**
17914
17914
  * Creates and registers a triage navigation tool for an agent to navigate to a triage agent.
@@ -17921,7 +17921,7 @@ const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
17921
17921
  * @returns {ReturnType<typeof addTool>} The result of adding the triage navigation tool.
17922
17922
  */
17923
17923
  const addTriageNavigation = beginContext(({ toolName, docNote, description, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER, ...navigateProps }) => {
17924
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$W);
17924
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$X);
17925
17925
  const navigate = createNavigateToTriageAgent(navigateProps);
17926
17926
  return addTool({
17927
17927
  toolName,
@@ -17947,7 +17947,7 @@ const addTriageNavigation = beginContext(({ toolName, docNote, description, skip
17947
17947
  });
17948
17948
 
17949
17949
  /** @constant {string} METHOD_NAME - The name of the method used for logging */
17950
- const METHOD_NAME$V = "function.setup.addWiki";
17950
+ const METHOD_NAME$W = "function.setup.addWiki";
17951
17951
  /**
17952
17952
  * Adds a wiki schema to the system
17953
17953
  * @function addWiki
@@ -17956,7 +17956,7 @@ const METHOD_NAME$V = "function.setup.addWiki";
17956
17956
  */
17957
17957
  const addWiki = beginContext((wikiSchema) => {
17958
17958
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17959
- swarm$1.loggerService.log(METHOD_NAME$V, {
17959
+ swarm$1.loggerService.log(METHOD_NAME$W, {
17960
17960
  wikiSchema,
17961
17961
  });
17962
17962
  swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
@@ -17964,7 +17964,7 @@ const addWiki = beginContext((wikiSchema) => {
17964
17964
  return wikiSchema.wikiName;
17965
17965
  });
17966
17966
 
17967
- const METHOD_NAME$U = "function.setup.addAgent";
17967
+ const METHOD_NAME$V = "function.setup.addAgent";
17968
17968
  /**
17969
17969
  * Adds a new agent to the agent registry for use within the swarm system.
17970
17970
  *
@@ -17984,7 +17984,7 @@ const METHOD_NAME$U = "function.setup.addAgent";
17984
17984
  const addAgent = beginContext((agentSchema) => {
17985
17985
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
17986
17986
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17987
- swarm$1.loggerService.log(METHOD_NAME$U, {
17987
+ swarm$1.loggerService.log(METHOD_NAME$V, {
17988
17988
  agentSchema,
17989
17989
  });
17990
17990
  // Register the agent in the validation and schema services
@@ -17994,7 +17994,7 @@ const addAgent = beginContext((agentSchema) => {
17994
17994
  return agentSchema.agentName;
17995
17995
  });
17996
17996
 
17997
- const METHOD_NAME$T = "function.setup.addCompletion";
17997
+ const METHOD_NAME$U = "function.setup.addCompletion";
17998
17998
  /**
17999
17999
  * Adds a completion engine to the registry for use by agents in the swarm system.
18000
18000
  *
@@ -18014,7 +18014,7 @@ const METHOD_NAME$T = "function.setup.addCompletion";
18014
18014
  const addCompletion = beginContext((completionSchema) => {
18015
18015
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18016
18016
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18017
- swarm$1.loggerService.log(METHOD_NAME$T, {
18017
+ swarm$1.loggerService.log(METHOD_NAME$U, {
18018
18018
  completionSchema,
18019
18019
  });
18020
18020
  // Register the completion in the validation and schema services
@@ -18024,7 +18024,7 @@ const addCompletion = beginContext((completionSchema) => {
18024
18024
  return completionSchema.completionName;
18025
18025
  });
18026
18026
 
18027
- const METHOD_NAME$S = "function.setup.addSwarm";
18027
+ const METHOD_NAME$T = "function.setup.addSwarm";
18028
18028
  /**
18029
18029
  * Adds a new swarm to the system for managing client sessions.
18030
18030
  *
@@ -18044,7 +18044,7 @@ const METHOD_NAME$S = "function.setup.addSwarm";
18044
18044
  const addSwarm = beginContext((swarmSchema) => {
18045
18045
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18046
18046
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18047
- swarm$1.loggerService.log(METHOD_NAME$S, {
18047
+ swarm$1.loggerService.log(METHOD_NAME$T, {
18048
18048
  swarmSchema,
18049
18049
  });
18050
18050
  // Register the swarm in the validation and schema services
@@ -18054,7 +18054,7 @@ const addSwarm = beginContext((swarmSchema) => {
18054
18054
  return swarmSchema.swarmName;
18055
18055
  });
18056
18056
 
18057
- const METHOD_NAME$R = "function.setup.addMCP";
18057
+ const METHOD_NAME$S = "function.setup.addMCP";
18058
18058
  /**
18059
18059
  * Registers a new MCP (Model Context Protocol) schema in the system.
18060
18060
  * @param mcpSchema - The MCP schema to register.
@@ -18062,7 +18062,7 @@ const METHOD_NAME$R = "function.setup.addMCP";
18062
18062
  */
18063
18063
  const addMCP = beginContext((mcpSchema) => {
18064
18064
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18065
- swarm$1.loggerService.log(METHOD_NAME$R, {
18065
+ swarm$1.loggerService.log(METHOD_NAME$S, {
18066
18066
  mcpSchema,
18067
18067
  });
18068
18068
  swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
@@ -18070,7 +18070,7 @@ const addMCP = beginContext((mcpSchema) => {
18070
18070
  return mcpSchema.mcpName;
18071
18071
  });
18072
18072
 
18073
- const METHOD_NAME$Q = "function.setup.addState";
18073
+ const METHOD_NAME$R = "function.setup.addState";
18074
18074
  /**
18075
18075
  * Adds a new state to the state registry for use within the swarm system.
18076
18076
  *
@@ -18092,7 +18092,7 @@ const METHOD_NAME$Q = "function.setup.addState";
18092
18092
  const addState = beginContext((stateSchema) => {
18093
18093
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18094
18094
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18095
- swarm$1.loggerService.log(METHOD_NAME$Q, {
18095
+ swarm$1.loggerService.log(METHOD_NAME$R, {
18096
18096
  stateSchema,
18097
18097
  });
18098
18098
  // Register the policy with StateValidationService for runtime validation
@@ -18109,7 +18109,7 @@ const addState = beginContext((stateSchema) => {
18109
18109
  return stateSchema.stateName;
18110
18110
  });
18111
18111
 
18112
- const METHOD_NAME$P = "function.setup.addEmbedding";
18112
+ const METHOD_NAME$Q = "function.setup.addEmbedding";
18113
18113
  /**
18114
18114
  * Adds a new embedding engine to the embedding registry for use within the swarm system.
18115
18115
  *
@@ -18129,7 +18129,7 @@ const METHOD_NAME$P = "function.setup.addEmbedding";
18129
18129
  const addEmbedding = beginContext((embeddingSchema) => {
18130
18130
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18131
18131
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18132
- swarm$1.loggerService.log(METHOD_NAME$P, {
18132
+ swarm$1.loggerService.log(METHOD_NAME$Q, {
18133
18133
  embeddingSchema,
18134
18134
  });
18135
18135
  // Register the embedding in the validation and schema services
@@ -18139,7 +18139,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
18139
18139
  return embeddingSchema.embeddingName;
18140
18140
  });
18141
18141
 
18142
- const METHOD_NAME$O = "function.setup.addStorage";
18142
+ const METHOD_NAME$P = "function.setup.addStorage";
18143
18143
  /**
18144
18144
  * Adds a new storage engine to the storage registry for use within the swarm system.
18145
18145
  *
@@ -18161,7 +18161,7 @@ const METHOD_NAME$O = "function.setup.addStorage";
18161
18161
  const addStorage = beginContext((storageSchema) => {
18162
18162
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18163
18163
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18164
- swarm$1.loggerService.log(METHOD_NAME$O, {
18164
+ swarm$1.loggerService.log(METHOD_NAME$P, {
18165
18165
  storageSchema,
18166
18166
  });
18167
18167
  // Register the storage in the validation and schema services
@@ -18178,7 +18178,7 @@ const addStorage = beginContext((storageSchema) => {
18178
18178
  });
18179
18179
 
18180
18180
  /** @private Constant defining the method name for logging and validation context */
18181
- const METHOD_NAME$N = "function.setup.addPolicy";
18181
+ const METHOD_NAME$O = "function.setup.addPolicy";
18182
18182
  /**
18183
18183
  * Adds a new policy for agents in the swarm system by registering it with validation and schema services.
18184
18184
  * Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
@@ -18194,7 +18194,7 @@ const METHOD_NAME$N = "function.setup.addPolicy";
18194
18194
  const addPolicy = beginContext((policySchema) => {
18195
18195
  // Log the policy addition attempt if enabled
18196
18196
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18197
- swarm$1.loggerService.log(METHOD_NAME$N, {
18197
+ swarm$1.loggerService.log(METHOD_NAME$O, {
18198
18198
  policySchema,
18199
18199
  });
18200
18200
  // Register the policy with PolicyValidationService for runtime validation
@@ -18235,7 +18235,7 @@ const addCompute = beginContext((computeSchema) => {
18235
18235
  * @description Method name for the addPipeline operation.
18236
18236
  * @private
18237
18237
  */
18238
- const METHOD_NAME$M = "function.setup.addPipeline";
18238
+ const METHOD_NAME$N = "function.setup.addPipeline";
18239
18239
  /**
18240
18240
  * @function addPipeline
18241
18241
  * @description Registers a pipeline schema, validates it, and adds it to the pipeline schema service.
@@ -18245,7 +18245,7 @@ const METHOD_NAME$M = "function.setup.addPipeline";
18245
18245
  */
18246
18246
  const addPipeline = beginContext((pipelineSchema) => {
18247
18247
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18248
- swarm$1.loggerService.log(METHOD_NAME$M, {
18248
+ swarm$1.loggerService.log(METHOD_NAME$N, {
18249
18249
  pipelineSchema,
18250
18250
  });
18251
18251
  swarm$1.pipelineValidationService.addPipeline(pipelineSchema.pipelineName, pipelineSchema);
@@ -18253,7 +18253,7 @@ const addPipeline = beginContext((pipelineSchema) => {
18253
18253
  return pipelineSchema.pipelineName;
18254
18254
  });
18255
18255
 
18256
- const METHOD_NAME$L = "function.test.overrideAgent";
18256
+ const METHOD_NAME$M = "function.test.overrideAgent";
18257
18257
  /**
18258
18258
  * Overrides an existing agent schema in the swarm system with a new or partial schema.
18259
18259
  * This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
@@ -18277,13 +18277,13 @@ const METHOD_NAME$L = "function.test.overrideAgent";
18277
18277
  */
18278
18278
  const overrideAgent = beginContext((agentSchema) => {
18279
18279
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18280
- swarm$1.loggerService.log(METHOD_NAME$L, {
18280
+ swarm$1.loggerService.log(METHOD_NAME$M, {
18281
18281
  agentSchema,
18282
18282
  });
18283
18283
  return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
18284
18284
  });
18285
18285
 
18286
- const METHOD_NAME$K = "function.test.overrideCompletion";
18286
+ const METHOD_NAME$L = "function.test.overrideCompletion";
18287
18287
  /**
18288
18288
  * Overrides an existing completion schema in the swarm system with a new or partial schema.
18289
18289
  * This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
@@ -18307,13 +18307,13 @@ const METHOD_NAME$K = "function.test.overrideCompletion";
18307
18307
  */
18308
18308
  const overrideCompletion = beginContext((completionSchema) => {
18309
18309
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18310
- swarm$1.loggerService.log(METHOD_NAME$K, {
18310
+ swarm$1.loggerService.log(METHOD_NAME$L, {
18311
18311
  completionSchema,
18312
18312
  });
18313
18313
  return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
18314
18314
  });
18315
18315
 
18316
- const METHOD_NAME$J = "function.test.overrideEmbeding";
18316
+ const METHOD_NAME$K = "function.test.overrideEmbeding";
18317
18317
  /**
18318
18318
  * Overrides an existing embedding schema in the swarm system with a new or partial schema.
18319
18319
  * This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
@@ -18339,13 +18339,13 @@ const METHOD_NAME$J = "function.test.overrideEmbeding";
18339
18339
  */
18340
18340
  const overrideEmbeding = beginContext((embeddingSchema) => {
18341
18341
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18342
- swarm$1.loggerService.log(METHOD_NAME$J, {
18342
+ swarm$1.loggerService.log(METHOD_NAME$K, {
18343
18343
  embeddingSchema,
18344
18344
  });
18345
18345
  return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
18346
18346
  });
18347
18347
 
18348
- const METHOD_NAME$I = "function.test.overridePolicy";
18348
+ const METHOD_NAME$J = "function.test.overridePolicy";
18349
18349
  /**
18350
18350
  * Overrides an existing policy schema in the swarm system with a new or partial schema.
18351
18351
  * This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
@@ -18369,13 +18369,13 @@ const METHOD_NAME$I = "function.test.overridePolicy";
18369
18369
  */
18370
18370
  const overridePolicy = beginContext((policySchema) => {
18371
18371
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18372
- swarm$1.loggerService.log(METHOD_NAME$I, {
18372
+ swarm$1.loggerService.log(METHOD_NAME$J, {
18373
18373
  policySchema,
18374
18374
  });
18375
18375
  return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
18376
18376
  });
18377
18377
 
18378
- const METHOD_NAME$H = "function.test.overrideState";
18378
+ const METHOD_NAME$I = "function.test.overrideState";
18379
18379
  /**
18380
18380
  * Overrides an existing state schema in the swarm system with a new or partial schema.
18381
18381
  * This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
@@ -18400,13 +18400,13 @@ const METHOD_NAME$H = "function.test.overrideState";
18400
18400
  */
18401
18401
  const overrideState = beginContext((stateSchema) => {
18402
18402
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18403
- swarm$1.loggerService.log(METHOD_NAME$H, {
18403
+ swarm$1.loggerService.log(METHOD_NAME$I, {
18404
18404
  stateSchema,
18405
18405
  });
18406
18406
  return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
18407
18407
  });
18408
18408
 
18409
- const METHOD_NAME$G = "function.test.overrideStorage";
18409
+ const METHOD_NAME$H = "function.test.overrideStorage";
18410
18410
  /**
18411
18411
  * Overrides an existing storage schema in the swarm system with a new or partial schema.
18412
18412
  * This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
@@ -18432,13 +18432,13 @@ const METHOD_NAME$G = "function.test.overrideStorage";
18432
18432
  */
18433
18433
  const overrideStorage = beginContext((storageSchema) => {
18434
18434
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18435
- swarm$1.loggerService.log(METHOD_NAME$G, {
18435
+ swarm$1.loggerService.log(METHOD_NAME$H, {
18436
18436
  storageSchema,
18437
18437
  });
18438
18438
  return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
18439
18439
  });
18440
18440
 
18441
- const METHOD_NAME$F = "function.test.overrideSwarm";
18441
+ const METHOD_NAME$G = "function.test.overrideSwarm";
18442
18442
  /**
18443
18443
  * Overrides an existing swarm schema in the swarm system with a new or partial schema.
18444
18444
  * This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
@@ -18462,13 +18462,13 @@ const METHOD_NAME$F = "function.test.overrideSwarm";
18462
18462
  */
18463
18463
  const overrideSwarm = beginContext((swarmSchema) => {
18464
18464
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18465
- swarm$1.loggerService.log(METHOD_NAME$F, {
18465
+ swarm$1.loggerService.log(METHOD_NAME$G, {
18466
18466
  swarmSchema,
18467
18467
  });
18468
18468
  return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
18469
18469
  });
18470
18470
 
18471
- const METHOD_NAME$E = "function.test.overrideTool";
18471
+ const METHOD_NAME$F = "function.test.overrideTool";
18472
18472
  /**
18473
18473
  * Overrides an existing tool schema in the swarm system with a new or partial schema.
18474
18474
  * This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
@@ -18492,13 +18492,13 @@ const METHOD_NAME$E = "function.test.overrideTool";
18492
18492
  */
18493
18493
  const overrideTool = beginContext((toolSchema) => {
18494
18494
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18495
- swarm$1.loggerService.log(METHOD_NAME$E, {
18495
+ swarm$1.loggerService.log(METHOD_NAME$F, {
18496
18496
  toolSchema,
18497
18497
  });
18498
18498
  return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
18499
18499
  });
18500
18500
 
18501
- const METHOD_NAME$D = "function.test.overrideMCP";
18501
+ const METHOD_NAME$E = "function.test.overrideMCP";
18502
18502
  /**
18503
18503
  * Overrides an existing MCP (Model Context Protocol) schema with a new or partial schema.
18504
18504
  * @param mcpSchema - The MCP schema containing the name and optional properties to override.
@@ -18506,13 +18506,13 @@ const METHOD_NAME$D = "function.test.overrideMCP";
18506
18506
  */
18507
18507
  const overrideMCP = beginContext((mcpSchema) => {
18508
18508
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18509
- swarm$1.loggerService.log(METHOD_NAME$D, {
18509
+ swarm$1.loggerService.log(METHOD_NAME$E, {
18510
18510
  mcpSchema,
18511
18511
  });
18512
18512
  return swarm$1.mcpSchemaService.override(mcpSchema.mcpName, mcpSchema);
18513
18513
  });
18514
18514
 
18515
- const METHOD_NAME$C = "function.test.overrideWiki";
18515
+ const METHOD_NAME$D = "function.test.overrideWiki";
18516
18516
  /**
18517
18517
  * Overrides an existing wiki schema in the swarm system with a new or partial schema.
18518
18518
  * This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
@@ -18536,7 +18536,7 @@ const METHOD_NAME$C = "function.test.overrideWiki";
18536
18536
  */
18537
18537
  const overrideWiki = beginContext((wikiSchema) => {
18538
18538
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18539
- swarm$1.loggerService.log(METHOD_NAME$C, {
18539
+ swarm$1.loggerService.log(METHOD_NAME$D, {
18540
18540
  wikiSchema,
18541
18541
  });
18542
18542
  return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
@@ -18551,7 +18551,7 @@ const overrideWiki = beginContext((wikiSchema) => {
18551
18551
  * @description Method name for the overrideCompute operation.
18552
18552
  * @private
18553
18553
  */
18554
- const METHOD_NAME$B = "function.test.overrideCompute";
18554
+ const METHOD_NAME$C = "function.test.overrideCompute";
18555
18555
  /**
18556
18556
  * @function overrideCompute
18557
18557
  * @description Overrides an existing compute schema with provided partial updates.
@@ -18560,7 +18560,7 @@ const METHOD_NAME$B = "function.test.overrideCompute";
18560
18560
  */
18561
18561
  const overrideCompute = beginContext((computeSchema) => {
18562
18562
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18563
- swarm$1.loggerService.log(METHOD_NAME$B, {
18563
+ swarm$1.loggerService.log(METHOD_NAME$C, {
18564
18564
  computeSchema,
18565
18565
  });
18566
18566
  return swarm$1.computeSchemaService.override(computeSchema.computeName, computeSchema);
@@ -18575,7 +18575,7 @@ const overrideCompute = beginContext((computeSchema) => {
18575
18575
  * @description Method name for the overridePipeline operation.
18576
18576
  * @private
18577
18577
  */
18578
- const METHOD_NAME$A = "function.test.overridePipeline";
18578
+ const METHOD_NAME$B = "function.test.overridePipeline";
18579
18579
  /**
18580
18580
  * @function overridePipeline
18581
18581
  * @description Overrides an existing pipeline schema with provided partial updates.
@@ -18585,13 +18585,13 @@ const METHOD_NAME$A = "function.test.overridePipeline";
18585
18585
  */
18586
18586
  const overridePipeline = beginContext((pipelineSchema) => {
18587
18587
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18588
- swarm$1.loggerService.log(METHOD_NAME$A, {
18588
+ swarm$1.loggerService.log(METHOD_NAME$B, {
18589
18589
  pipelineSchema,
18590
18590
  });
18591
18591
  return swarm$1.pipelineSchemaService.override(pipelineSchema.pipelineName, pipelineSchema);
18592
18592
  });
18593
18593
 
18594
- const METHOD_NAME$z = "function.other.markOnline";
18594
+ const METHOD_NAME$A = "function.other.markOnline";
18595
18595
  /**
18596
18596
  * Marks a client as online in the specified swarm.
18597
18597
  *
@@ -18603,16 +18603,16 @@ const METHOD_NAME$z = "function.other.markOnline";
18603
18603
  const markOnline = async (clientId, swarmName) => {
18604
18604
  // Log the operation if logging is enabled in the global configuration
18605
18605
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18606
- swarm.loggerService.log(METHOD_NAME$z, {
18606
+ swarm.loggerService.log(METHOD_NAME$A, {
18607
18607
  clientId,
18608
18608
  });
18609
18609
  // Validate the swarm name
18610
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$z);
18610
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$A);
18611
18611
  // Run the operation in the method context
18612
18612
  return await MethodContextService.runInContext(async () => {
18613
- await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$z);
18613
+ await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$A);
18614
18614
  }, {
18615
- methodName: METHOD_NAME$z,
18615
+ methodName: METHOD_NAME$A,
18616
18616
  agentName: "",
18617
18617
  policyName: "",
18618
18618
  stateName: "",
@@ -18624,7 +18624,7 @@ const markOnline = async (clientId, swarmName) => {
18624
18624
  });
18625
18625
  };
18626
18626
 
18627
- const METHOD_NAME$y = "function.other.markOffline";
18627
+ const METHOD_NAME$z = "function.other.markOffline";
18628
18628
  /**
18629
18629
  * Marks a client as offline in the specified swarm.
18630
18630
  *
@@ -18639,14 +18639,14 @@ const METHOD_NAME$y = "function.other.markOffline";
18639
18639
  */
18640
18640
  const markOffline = async (clientId, swarmName) => {
18641
18641
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18642
- swarm.loggerService.log(METHOD_NAME$y, {
18642
+ swarm.loggerService.log(METHOD_NAME$z, {
18643
18643
  clientId,
18644
18644
  });
18645
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$y);
18645
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$z);
18646
18646
  return await MethodContextService.runInContext(async () => {
18647
- await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$y);
18647
+ await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$z);
18648
18648
  }, {
18649
- methodName: METHOD_NAME$y,
18649
+ methodName: METHOD_NAME$z,
18650
18650
  agentName: "",
18651
18651
  policyName: "",
18652
18652
  stateName: "",
@@ -18659,7 +18659,7 @@ const markOffline = async (clientId, swarmName) => {
18659
18659
  };
18660
18660
 
18661
18661
  /** @private Constant defining the method name for logging and validation context */
18662
- const METHOD_NAME$x = "function.commit.commitSystemMessage";
18662
+ const METHOD_NAME$y = "function.commit.commitSystemMessage";
18663
18663
  /**
18664
18664
  * Commits a system-generated message to the active agent in the swarm system.
18665
18665
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -18678,20 +18678,20 @@ const METHOD_NAME$x = "function.commit.commitSystemMessage";
18678
18678
  const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
18679
18679
  // Log the commit attempt if enabled
18680
18680
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18681
- swarm$1.loggerService.log(METHOD_NAME$x, {
18681
+ swarm$1.loggerService.log(METHOD_NAME$y, {
18682
18682
  content,
18683
18683
  clientId,
18684
18684
  agentName,
18685
18685
  });
18686
18686
  // Validate the agent exists
18687
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
18687
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$y);
18688
18688
  // Validate the session exists and retrieve the associated swarm
18689
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
18689
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
18690
18690
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18691
18691
  // Validate the swarm configuration
18692
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
18692
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
18693
18693
  // Check if the current agent matches the provided agent
18694
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
18694
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$y, clientId, swarmName);
18695
18695
  if (currentAgentName !== agentName) {
18696
18696
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18697
18697
  swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
@@ -18702,10 +18702,10 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
18702
18702
  return;
18703
18703
  }
18704
18704
  // Commit the system message via SessionPublicService
18705
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$x, clientId, swarmName);
18705
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$y, clientId, swarmName);
18706
18706
  });
18707
18707
 
18708
- const METHOD_NAME$w = "function.commit.commitSystemMessage";
18708
+ const METHOD_NAME$x = "function.commit.commitSystemMessage";
18709
18709
  /**
18710
18710
  * Commits a user message to the active agent's history in a swarm session without triggering a response.
18711
18711
  *
@@ -18724,19 +18724,19 @@ const METHOD_NAME$w = "function.commit.commitSystemMessage";
18724
18724
  const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
18725
18725
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18726
18726
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18727
- swarm$1.loggerService.log(METHOD_NAME$w, {
18727
+ swarm$1.loggerService.log(METHOD_NAME$x, {
18728
18728
  content,
18729
18729
  clientId,
18730
18730
  agentName,
18731
18731
  mode,
18732
18732
  });
18733
18733
  // Validate the agent, session, and swarm to ensure they exist and are accessible
18734
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
18735
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
18734
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
18735
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
18736
18736
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18737
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
18737
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
18738
18738
  // Check if the specified agent is still the active agent in the swarm session
18739
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName);
18739
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
18740
18740
  if (currentAgentName !== agentName) {
18741
18741
  // Log a skip message if the agent has changed during the operation
18742
18742
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -18749,18 +18749,18 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
18749
18749
  }
18750
18750
  if (payload) {
18751
18751
  return await PayloadContextService.runInContext(async () => {
18752
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$w, clientId, swarmName);
18752
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$x, clientId, swarmName);
18753
18753
  }, {
18754
18754
  clientId,
18755
18755
  payload,
18756
18756
  });
18757
18757
  }
18758
18758
  // Commit the user message to the agent's history via the session public service
18759
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$w, clientId, swarmName);
18759
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$x, clientId, swarmName);
18760
18760
  });
18761
18761
 
18762
18762
  /** @private Constant defining the method name for logging and validation context */
18763
- const METHOD_NAME$v = "function.commit.commitSystemMessageForce";
18763
+ const METHOD_NAME$w = "function.commit.commitSystemMessageForce";
18764
18764
  /**
18765
18765
  * Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
18766
18766
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -18779,20 +18779,20 @@ const METHOD_NAME$v = "function.commit.commitSystemMessageForce";
18779
18779
  const commitSystemMessageForce = beginContext(async (content, clientId) => {
18780
18780
  // Log the commit attempt if enabled
18781
18781
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18782
- swarm$1.loggerService.log(METHOD_NAME$v, {
18782
+ swarm$1.loggerService.log(METHOD_NAME$w, {
18783
18783
  content,
18784
18784
  clientId,
18785
18785
  });
18786
18786
  // Validate the session exists and retrieve the associated swarm
18787
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
18787
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
18788
18788
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18789
18789
  // Validate the swarm configuration
18790
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
18790
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
18791
18791
  // Commit the system message via SessionPublicService without agent checks
18792
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$v, clientId, swarmName);
18792
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$w, clientId, swarmName);
18793
18793
  });
18794
18794
 
18795
- const METHOD_NAME$u = "function.commit.commitSystemMessage";
18795
+ const METHOD_NAME$v = "function.commit.commitSystemMessage";
18796
18796
  /**
18797
18797
  * Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
18798
18798
  *
@@ -18810,29 +18810,29 @@ const METHOD_NAME$u = "function.commit.commitSystemMessage";
18810
18810
  const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
18811
18811
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18812
18812
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18813
- swarm$1.loggerService.log(METHOD_NAME$u, {
18813
+ swarm$1.loggerService.log(METHOD_NAME$v, {
18814
18814
  content,
18815
18815
  clientId,
18816
18816
  mode,
18817
18817
  });
18818
18818
  // Validate the session and swarm to ensure they exist and are accessible
18819
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
18819
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
18820
18820
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18821
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
18821
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
18822
18822
  if (payload) {
18823
18823
  return await PayloadContextService.runInContext(async () => {
18824
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$u, clientId, swarmName);
18824
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$v, clientId, swarmName);
18825
18825
  }, {
18826
18826
  clientId,
18827
18827
  payload,
18828
18828
  });
18829
18829
  }
18830
18830
  // Commit the user message to the agent's history via the session public service without checking the active agent
18831
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$u, clientId, swarmName);
18831
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$v, clientId, swarmName);
18832
18832
  });
18833
18833
 
18834
18834
  /** @private Constant defining the method name for logging and validation context */
18835
- const METHOD_NAME$t = "function.commit.commitAssistantMessage";
18835
+ const METHOD_NAME$u = "function.commit.commitAssistantMessage";
18836
18836
  /**
18837
18837
  * Commits an assistant-generated message to the active agent in the swarm system.
18838
18838
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -18850,20 +18850,20 @@ const METHOD_NAME$t = "function.commit.commitAssistantMessage";
18850
18850
  const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
18851
18851
  // Log the commit attempt if enabled
18852
18852
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18853
- swarm$1.loggerService.log(METHOD_NAME$t, {
18853
+ swarm$1.loggerService.log(METHOD_NAME$u, {
18854
18854
  content,
18855
18855
  clientId,
18856
18856
  agentName,
18857
18857
  });
18858
18858
  // Validate the agent exists
18859
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$t);
18859
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$u);
18860
18860
  // Validate the session exists and retrieve the associated swarm
18861
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
18861
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
18862
18862
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18863
18863
  // Validate the swarm configuration
18864
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
18864
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
18865
18865
  // Check if the current agent matches the provided agent
18866
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName);
18866
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName);
18867
18867
  if (currentAgentName !== agentName) {
18868
18868
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18869
18869
  swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
@@ -18874,11 +18874,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
18874
18874
  return;
18875
18875
  }
18876
18876
  // Commit the assistant message via SessionPublicService
18877
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$t, clientId, swarmName);
18877
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$u, clientId, swarmName);
18878
18878
  });
18879
18879
 
18880
18880
  /** @private Constant defining the method name for logging and validation context */
18881
- const METHOD_NAME$s = "function.commit.commitAssistantMessageForce";
18881
+ const METHOD_NAME$t = "function.commit.commitAssistantMessageForce";
18882
18882
  /**
18883
18883
  * Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
18884
18884
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -18897,21 +18897,21 @@ const METHOD_NAME$s = "function.commit.commitAssistantMessageForce";
18897
18897
  const commitAssistantMessageForce = beginContext(async (content, clientId) => {
18898
18898
  // Log the commit attempt if enabled
18899
18899
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18900
- swarm$1.loggerService.log(METHOD_NAME$s, {
18900
+ swarm$1.loggerService.log(METHOD_NAME$t, {
18901
18901
  content,
18902
18902
  clientId,
18903
18903
  });
18904
18904
  // Validate the session exists and retrieve the associated swarm
18905
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
18905
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
18906
18906
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18907
18907
  // Validate the swarm configuration
18908
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
18908
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
18909
18909
  // Commit the assistant message via SessionPublicService without agent checks
18910
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$s, clientId, swarmName);
18910
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$t, clientId, swarmName);
18911
18911
  });
18912
18912
 
18913
18913
  /** @private Constant defining the method name for logging and validation context */
18914
- const METHOD_NAME$r = "function.commit.cancelOutput";
18914
+ const METHOD_NAME$s = "function.commit.cancelOutput";
18915
18915
  /**
18916
18916
  * Cancels the awaited output for a specific client and agent by emitting an empty string.
18917
18917
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
@@ -18927,19 +18927,19 @@ const METHOD_NAME$r = "function.commit.cancelOutput";
18927
18927
  const cancelOutput = beginContext(async (clientId, agentName) => {
18928
18928
  // Log the cancellation attempt if enabled
18929
18929
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18930
- swarm$1.loggerService.log(METHOD_NAME$r, {
18930
+ swarm$1.loggerService.log(METHOD_NAME$s, {
18931
18931
  clientId,
18932
18932
  agentName,
18933
18933
  });
18934
18934
  // Validate the agent exists
18935
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$r);
18935
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
18936
18936
  // Validate the session exists and retrieve the associated swarm
18937
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
18937
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
18938
18938
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18939
18939
  // Validate the swarm configuration
18940
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
18940
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
18941
18941
  // Check if the current agent matches the provided agent
18942
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$r, clientId, swarmName);
18942
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$s, clientId, swarmName);
18943
18943
  if (currentAgentName !== agentName) {
18944
18944
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18945
18945
  swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
@@ -18950,11 +18950,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
18950
18950
  return;
18951
18951
  }
18952
18952
  // Perform the output cancellation via SwarmPublicService
18953
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$r, clientId, swarmName);
18953
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$s, clientId, swarmName);
18954
18954
  });
18955
18955
 
18956
18956
  /** @private Constant defining the method name for logging and validation context */
18957
- const METHOD_NAME$q = "function.commit.cancelOutputForce";
18957
+ const METHOD_NAME$r = "function.commit.cancelOutputForce";
18958
18958
  /**
18959
18959
  * Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
18960
18960
  * Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
@@ -18971,20 +18971,20 @@ const METHOD_NAME$q = "function.commit.cancelOutputForce";
18971
18971
  const cancelOutputForce = beginContext(async (clientId) => {
18972
18972
  // Log the cancellation attempt if enabled
18973
18973
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18974
- swarm$1.loggerService.log(METHOD_NAME$q, {
18974
+ swarm$1.loggerService.log(METHOD_NAME$r, {
18975
18975
  clientId,
18976
18976
  });
18977
18977
  // Validate the session exists and retrieve the associated swarm
18978
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
18978
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
18979
18979
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18980
18980
  // Validate the swarm configuration
18981
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
18981
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
18982
18982
  // Perform the output cancellation via SwarmPublicService without agent checks
18983
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$q, clientId, swarmName);
18983
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$r, clientId, swarmName);
18984
18984
  });
18985
18985
 
18986
18986
  /** @private Constant defining the method name for logging and validation context */
18987
- const METHOD_NAME$p = "function.commit.commitStopToolsForce";
18987
+ const METHOD_NAME$q = "function.commit.commitStopToolsForce";
18988
18988
  /**
18989
18989
  * Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
18990
18990
  * Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
@@ -19002,21 +19002,21 @@ const METHOD_NAME$p = "function.commit.commitStopToolsForce";
19002
19002
  const commitStopToolsForce = beginContext(async (clientId) => {
19003
19003
  // Log the stop tools attempt if enabled
19004
19004
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19005
- swarm$1.loggerService.log(METHOD_NAME$p, {
19005
+ swarm$1.loggerService.log(METHOD_NAME$q, {
19006
19006
  clientId,
19007
- METHOD_NAME: METHOD_NAME$p,
19007
+ METHOD_NAME: METHOD_NAME$q,
19008
19008
  });
19009
19009
  // Validate the session exists and retrieve the associated swarm
19010
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
19010
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
19011
19011
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19012
19012
  // Validate the swarm configuration
19013
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
19013
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
19014
19014
  // Commit the stop of the next tool execution via SessionPublicService without agent checks
19015
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$p, clientId, swarmName);
19015
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$q, clientId, swarmName);
19016
19016
  });
19017
19017
 
19018
19018
  /** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
19019
- const METHOD_NAME$o = "function.target.question";
19019
+ const METHOD_NAME$p = "function.target.question";
19020
19020
  /**
19021
19021
  * Initiates a question process within a chat context
19022
19022
  * @function question
@@ -19028,21 +19028,21 @@ const METHOD_NAME$o = "function.target.question";
19028
19028
  */
19029
19029
  const question = beginContext(async (message, clientId, agentName, wikiName) => {
19030
19030
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19031
- swarm$1.loggerService.log(METHOD_NAME$o, {
19031
+ swarm$1.loggerService.log(METHOD_NAME$p, {
19032
19032
  message,
19033
19033
  clientId,
19034
19034
  agentName,
19035
19035
  wikiName,
19036
19036
  });
19037
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$o);
19038
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$o);
19037
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
19038
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$p);
19039
19039
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19040
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$o);
19041
- swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$o);
19040
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
19041
+ swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$p);
19042
19042
  if (!swarm$1.agentValidationService.hasWiki(agentName, wikiName)) {
19043
- throw new Error(`agent-swarm ${METHOD_NAME$o} ${wikiName} not registered in ${agentName}`);
19043
+ throw new Error(`agent-swarm ${METHOD_NAME$p} ${wikiName} not registered in ${agentName}`);
19044
19044
  }
19045
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$o, clientId, swarmName);
19045
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$p, clientId, swarmName);
19046
19046
  if (currentAgentName !== agentName) {
19047
19047
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19048
19048
  swarm$1.loggerService.log('function "question" skipped due to the agent change', {
@@ -19065,7 +19065,7 @@ const question = beginContext(async (message, clientId, agentName, wikiName) =>
19065
19065
  });
19066
19066
 
19067
19067
  /** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
19068
- const METHOD_NAME$n = "function.target.questionForce";
19068
+ const METHOD_NAME$o = "function.target.questionForce";
19069
19069
  /**
19070
19070
  * Initiates a forced question process within a chat context
19071
19071
  * @function questionForce
@@ -19076,17 +19076,17 @@ const METHOD_NAME$n = "function.target.questionForce";
19076
19076
  */
19077
19077
  const questionForce = beginContext(async (message, clientId, wikiName) => {
19078
19078
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19079
- swarm$1.loggerService.log(METHOD_NAME$n, {
19079
+ swarm$1.loggerService.log(METHOD_NAME$o, {
19080
19080
  message,
19081
19081
  clientId,
19082
19082
  wikiName,
19083
19083
  });
19084
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$n);
19084
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$o);
19085
19085
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19086
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$n);
19087
- swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$n);
19086
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$o);
19087
+ swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$o);
19088
19088
  const { getChat, callbacks } = swarm$1.wikiSchemaService.get(wikiName);
19089
- const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$n, clientId, swarmName);
19089
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$o, clientId, swarmName);
19090
19090
  const args = {
19091
19091
  clientId,
19092
19092
  message,
@@ -19098,7 +19098,7 @@ const questionForce = beginContext(async (message, clientId, wikiName) => {
19098
19098
  return await getChat(args);
19099
19099
  });
19100
19100
 
19101
- const METHOD_NAME$m = "function.target.disposeConnection";
19101
+ const METHOD_NAME$n = "function.target.disposeConnection";
19102
19102
  /**
19103
19103
  * Disposes of a client session and all related resources within a swarm.
19104
19104
  *
@@ -19115,10 +19115,10 @@ const METHOD_NAME$m = "function.target.disposeConnection";
19115
19115
  * @example
19116
19116
  * await disposeConnection("client-123", "TaskSwarm");
19117
19117
  */
19118
- const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$m) => {
19118
+ const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$n) => {
19119
19119
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19120
19120
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19121
- swarm$1.loggerService.log(METHOD_NAME$m, {
19121
+ swarm$1.loggerService.log(METHOD_NAME$n, {
19122
19122
  clientId,
19123
19123
  swarmName,
19124
19124
  });
@@ -19222,7 +19222,7 @@ const disposeConnection = beginContext(async (clientId, swarmName, methodName =
19222
19222
  PersistMemoryAdapter.dispose(clientId);
19223
19223
  });
19224
19224
 
19225
- const METHOD_NAME$l = "function.target.makeAutoDispose";
19225
+ const METHOD_NAME$m = "function.target.makeAutoDispose";
19226
19226
  /**
19227
19227
  * Default timeout in seconds before auto-dispose is triggered.
19228
19228
  * @constant {number}
@@ -19253,7 +19253,7 @@ const DEFAULT_TIMEOUT = 15 * 60;
19253
19253
  const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DEFAULT_TIMEOUT, onDestroy, } = {}) => {
19254
19254
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19255
19255
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19256
- swarm$1.loggerService.log(METHOD_NAME$l, {
19256
+ swarm$1.loggerService.log(METHOD_NAME$m, {
19257
19257
  clientId,
19258
19258
  swarmName,
19259
19259
  });
@@ -19286,7 +19286,7 @@ const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DE
19286
19286
  };
19287
19287
  });
19288
19288
 
19289
- const METHOD_NAME$k = "function.target.notify";
19289
+ const METHOD_NAME$l = "function.target.notify";
19290
19290
  /**
19291
19291
  * Sends a notification message as output from the swarm session without executing an incoming message.
19292
19292
  *
@@ -19306,23 +19306,23 @@ const METHOD_NAME$k = "function.target.notify";
19306
19306
  const notify = beginContext(async (content, clientId, agentName) => {
19307
19307
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19308
19308
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19309
- swarm$1.loggerService.log(METHOD_NAME$k, {
19309
+ swarm$1.loggerService.log(METHOD_NAME$l, {
19310
19310
  content,
19311
19311
  clientId,
19312
19312
  agentName,
19313
19313
  });
19314
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
19314
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
19315
19315
  // Check if the session mode is "makeConnection"
19316
19316
  if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
19317
19317
  "makeConnection") {
19318
19318
  throw new Error(`agent-swarm-kit notify session is not makeConnection clientId=${clientId}`);
19319
19319
  }
19320
19320
  // Validate the agent, session, and swarm
19321
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
19321
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
19322
19322
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19323
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
19323
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
19324
19324
  // Check if the specified agent is still the active agent
19325
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName);
19325
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName);
19326
19326
  if (currentAgentName !== agentName) {
19327
19327
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19328
19328
  swarm$1.loggerService.log('function "notify" skipped due to the agent change', {
@@ -19333,10 +19333,10 @@ const notify = beginContext(async (content, clientId, agentName) => {
19333
19333
  return;
19334
19334
  }
19335
19335
  // Notify the content directly via the session public service
19336
- return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$k, clientId, swarmName);
19336
+ return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$l, clientId, swarmName);
19337
19337
  });
19338
19338
 
19339
- const METHOD_NAME$j = "function.target.notifyForce";
19339
+ const METHOD_NAME$k = "function.target.notifyForce";
19340
19340
  /**
19341
19341
  * Sends a notification message as output from the swarm session without executing an incoming message.
19342
19342
  *
@@ -19355,11 +19355,11 @@ const METHOD_NAME$j = "function.target.notifyForce";
19355
19355
  const notifyForce = beginContext(async (content, clientId) => {
19356
19356
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19357
19357
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19358
- swarm$1.loggerService.log(METHOD_NAME$j, {
19358
+ swarm$1.loggerService.log(METHOD_NAME$k, {
19359
19359
  content,
19360
19360
  clientId,
19361
19361
  });
19362
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
19362
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
19363
19363
  // Check if the session mode is "makeConnection"
19364
19364
  if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
19365
19365
  "makeConnection") {
@@ -19367,12 +19367,12 @@ const notifyForce = beginContext(async (content, clientId) => {
19367
19367
  }
19368
19368
  // Validate the agent, session, and swarm
19369
19369
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19370
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
19370
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
19371
19371
  // Notify the content directly via the session public service
19372
- return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$j, clientId, swarmName);
19372
+ return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$k, clientId, swarmName);
19373
19373
  });
19374
19374
 
19375
- const METHOD_NAME$i = "function.target.runStateless";
19375
+ const METHOD_NAME$j = "function.target.runStateless";
19376
19376
  /**
19377
19377
  * Executes a message statelessly with an agent in a swarm session, bypassing chat history.
19378
19378
  *
@@ -19395,19 +19395,19 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
19395
19395
  const executionId = functoolsKit.randomString();
19396
19396
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19397
19397
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19398
- swarm$1.loggerService.log(METHOD_NAME$i, {
19398
+ swarm$1.loggerService.log(METHOD_NAME$j, {
19399
19399
  content,
19400
19400
  clientId,
19401
19401
  agentName,
19402
19402
  executionId,
19403
19403
  });
19404
19404
  // Validate the agent, session, and swarm
19405
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$i);
19406
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
19405
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$j);
19406
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
19407
19407
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19408
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
19408
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
19409
19409
  // Check if the specified agent is still the active agent
19410
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName);
19410
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName);
19411
19411
  if (currentAgentName !== agentName) {
19412
19412
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19413
19413
  swarm$1.loggerService.log('function "runStateless" skipped due to the agent change', {
@@ -19426,7 +19426,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
19426
19426
  agentName,
19427
19427
  swarmName,
19428
19428
  });
19429
- const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$i, clientId, swarmName);
19429
+ const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$j, clientId, swarmName);
19430
19430
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
19431
19431
  swarm$1.busService.commitExecutionEnd(clientId, {
19432
19432
  agentName,
@@ -19446,7 +19446,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
19446
19446
  });
19447
19447
  });
19448
19448
 
19449
- const METHOD_NAME$h = "function.target.runStatelessForce";
19449
+ const METHOD_NAME$i = "function.target.runStatelessForce";
19450
19450
  /**
19451
19451
  * Executes a message statelessly with the active agent in a swarm session, bypassing chat history and forcing execution regardless of agent activity.
19452
19452
  *
@@ -19467,22 +19467,22 @@ const runStatelessForce = beginContext(async (content, clientId) => {
19467
19467
  const executionId = functoolsKit.randomString();
19468
19468
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19469
19469
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19470
- swarm$1.loggerService.log(METHOD_NAME$h, {
19470
+ swarm$1.loggerService.log(METHOD_NAME$i, {
19471
19471
  content,
19472
19472
  clientId,
19473
19473
  executionId,
19474
19474
  });
19475
19475
  // Validate the session and swarm
19476
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
19476
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
19477
19477
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19478
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
19478
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
19479
19479
  // Execute the command statelessly within an execution context with performance tracking
19480
19480
  return ExecutionContextService.runInContext(async () => {
19481
19481
  let isFinished = false;
19482
19482
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
19483
19483
  try {
19484
19484
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
19485
- const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$h, clientId, swarmName);
19485
+ const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$i, clientId, swarmName);
19486
19486
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
19487
19487
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
19488
19488
  return result;
@@ -19509,7 +19509,7 @@ const SCHEDULED_DELAY$1 = 1000;
19509
19509
  * @constant {number}
19510
19510
  */
19511
19511
  const RATE_DELAY = 10000;
19512
- const METHOD_NAME$g = "function.target.makeConnection";
19512
+ const METHOD_NAME$h = "function.target.makeConnection";
19513
19513
  /**
19514
19514
  * Internal implementation of the connection factory for a client to a swarm.
19515
19515
  *
@@ -19524,21 +19524,21 @@ const METHOD_NAME$g = "function.target.makeConnection";
19524
19524
  const makeConnectionInternal = (connector, clientId, swarmName) => {
19525
19525
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19526
19526
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19527
- swarm$1.loggerService.log(METHOD_NAME$g, {
19527
+ swarm$1.loggerService.log(METHOD_NAME$h, {
19528
19528
  clientId,
19529
19529
  swarmName,
19530
19530
  });
19531
19531
  // Validate the swarm and initialize the session
19532
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
19532
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
19533
19533
  swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
19534
19534
  // Create a queued send function using the session public service
19535
- const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$g, clientId, swarmName));
19535
+ const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$h, clientId, swarmName));
19536
19536
  // Return a wrapped send function with validation and agent context
19537
19537
  return (async (outgoing) => {
19538
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
19538
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
19539
19539
  return await send({
19540
19540
  data: outgoing,
19541
- agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$g, clientId, swarmName),
19541
+ agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName),
19542
19542
  clientId,
19543
19543
  });
19544
19544
  });
@@ -19621,13 +19621,13 @@ makeConnection.scheduled = (connector, clientId, swarmName, { delay = SCHEDULED_
19621
19621
  await online();
19622
19622
  if (payload) {
19623
19623
  return await PayloadContextService.runInContext(async () => {
19624
- await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$g, clientId, swarmName);
19624
+ await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$h, clientId, swarmName);
19625
19625
  }, {
19626
19626
  clientId,
19627
19627
  payload,
19628
19628
  });
19629
19629
  }
19630
- await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$g, clientId, swarmName);
19630
+ await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$h, clientId, swarmName);
19631
19631
  }),
19632
19632
  delay,
19633
19633
  });
@@ -19690,7 +19690,7 @@ makeConnection.rate = (connector, clientId, swarmName, { delay = RATE_DELAY } =
19690
19690
  };
19691
19691
  };
19692
19692
 
19693
- const METHOD_NAME$f = "function.target.complete";
19693
+ const METHOD_NAME$g = "function.target.complete";
19694
19694
  /**
19695
19695
  * Time-to-live for the complete function in milliseconds.
19696
19696
  * Defines how long the cached complete function remains valid before expiring.
@@ -19756,7 +19756,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
19756
19756
  const executionId = functoolsKit.randomString();
19757
19757
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19758
19758
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19759
- swarm$1.loggerService.log(METHOD_NAME$f, {
19759
+ swarm$1.loggerService.log(METHOD_NAME$g, {
19760
19760
  content,
19761
19761
  clientId,
19762
19762
  executionId,
@@ -19774,7 +19774,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
19774
19774
  swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
19775
19775
  try {
19776
19776
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
19777
- const result = await run(METHOD_NAME$f, content);
19777
+ const result = await run(METHOD_NAME$g, content);
19778
19778
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
19779
19779
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
19780
19780
  return result;
@@ -19804,7 +19804,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
19804
19804
  * @constant {number}
19805
19805
  */
19806
19806
  const SCHEDULED_DELAY = 1000;
19807
- const METHOD_NAME$e = "function.target.session";
19807
+ const METHOD_NAME$f = "function.target.session";
19808
19808
  /**
19809
19809
  * Internal implementation of the session factory for a client and swarm.
19810
19810
  *
@@ -19819,23 +19819,23 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
19819
19819
  const executionId = functoolsKit.randomString();
19820
19820
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19821
19821
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19822
- swarm$1.loggerService.log(METHOD_NAME$e, {
19822
+ swarm$1.loggerService.log(METHOD_NAME$f, {
19823
19823
  clientId,
19824
19824
  swarmName,
19825
19825
  executionId,
19826
19826
  });
19827
19827
  // Validate the swarm and initialize the session
19828
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$e);
19828
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$f);
19829
19829
  swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
19830
19830
  const complete = functoolsKit.queued(async (content) => {
19831
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
19831
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
19832
19832
  return ExecutionContextService.runInContext(async () => {
19833
19833
  let isFinished = false;
19834
19834
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
19835
19835
  swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
19836
19836
  try {
19837
19837
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
19838
- const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$e, clientId, swarmName);
19838
+ const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$f, clientId, swarmName);
19839
19839
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
19840
19840
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
19841
19841
  return result;
@@ -19856,7 +19856,7 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
19856
19856
  return await complete(content);
19857
19857
  }),
19858
19858
  dispose: async () => {
19859
- await disposeConnection(clientId, swarmName, METHOD_NAME$e);
19859
+ await disposeConnection(clientId, swarmName, METHOD_NAME$f);
19860
19860
  await onDispose();
19861
19861
  },
19862
19862
  };
@@ -19956,13 +19956,13 @@ session.scheduled = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose }
19956
19956
  await online();
19957
19957
  if (payload) {
19958
19958
  return await PayloadContextService.runInContext(async () => {
19959
- return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$e, clientId, swarmName);
19959
+ return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$f, clientId, swarmName);
19960
19960
  }, {
19961
19961
  clientId,
19962
19962
  payload,
19963
19963
  });
19964
19964
  }
19965
- return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$e, clientId, swarmName);
19965
+ return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$f, clientId, swarmName);
19966
19966
  }),
19967
19967
  delay,
19968
19968
  });
@@ -20041,6 +20041,52 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose } = {}
20041
20041
  };
20042
20042
  };
20043
20043
 
20044
+ /**
20045
+ * @module scope
20046
+ * @description Provides a function to execute a scoped operation with session management, validation, and error handling.
20047
+ */
20048
+ /**
20049
+ * @constant {string} METHOD_NAME
20050
+ * @description Method name for the scope operation.
20051
+ * @private
20052
+ */
20053
+ const METHOD_NAME$e = "function.target.scope";
20054
+ /**
20055
+ * @function scope
20056
+ * @description Executes a provided function within a managed scope, handling session creation, validation, and cleanup.
20057
+ * @template T - Type of the result returned by the run function.
20058
+ * @param {Function} runFn - The function to execute, receiving clientId and agentName as arguments.
20059
+ * @param {IScopeOptions} options - Configuration options for the scope operation.
20060
+ * @returns {Promise<T | void>} The result of the run function or void if no result is returned.
20061
+ * @throws {Error} If a session already exists for the clientId.
20062
+ */
20063
+ const scope = beginContext(async (runFn, { clientId, swarmName, onError }) => {
20064
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20065
+ swarm$1.loggerService.log(METHOD_NAME$e, {
20066
+ clientId,
20067
+ swarmName,
20068
+ });
20069
+ if (swarm$1.sessionValidationService.hasSession(clientId)) {
20070
+ throw new Error(`agent-swarm scope Session already exists for clientId=${clientId}`);
20071
+ }
20072
+ swarm$1.sessionValidationService.addSession(clientId, swarmName, "scope");
20073
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$e);
20074
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
20075
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$e, clientId, swarmName);
20076
+ let result = null;
20077
+ try {
20078
+ result = (await runFn(clientId, agentName));
20079
+ }
20080
+ catch (error) {
20081
+ console.error(`agent-swarm scope error for clientId=${clientId}`, error);
20082
+ onError && onError(error);
20083
+ }
20084
+ finally {
20085
+ await disposeConnection(clientId, swarmName, METHOD_NAME$e);
20086
+ }
20087
+ return result;
20088
+ });
20089
+
20044
20090
  /** @constant {number} INACTIVITY_CHECK - Interval for checking inactivity in milliseconds (1 minute) */
20045
20091
  const INACTIVITY_CHECK = 60 * 1000;
20046
20092
  /** @constant {number} INACTIVITY_TIMEOUT - Timeout duration for inactivity in milliseconds (15 minutes) */
@@ -20296,14 +20342,36 @@ class ChatUtils {
20296
20342
  */
20297
20343
  const Chat = new ChatUtils();
20298
20344
 
20345
+ /**
20346
+ * @module startPipeline
20347
+ * @description Provides a function to initiate a pipeline execution with session validation, logging, and callback handling.
20348
+ */
20349
+ /**
20350
+ * @constant {string} METHOD_NAME
20351
+ * @description Method name for the startPipeline operation.
20352
+ * @private
20353
+ */
20299
20354
  const METHOD_NAME$d = "function.target.startPipeline";
20355
+ /**
20356
+ * @function startPipeline
20357
+ * @description Executes a pipeline with the specified name, handling session creation, validation, and lifecycle callbacks.
20358
+ * @template Payload - Type extending object for the pipeline payload.
20359
+ * @template T - Type of the result returned by the pipeline execution.
20360
+ * @param {string} clientId - The client identifier.
20361
+ * @param {PipelineName} pipelineName - The name of the pipeline to execute.
20362
+ * @param {SwarmName} swarmName - The name of the swarm associated with the pipeline.
20363
+ * @param {Payload} [payload={}] - Optional payload data for the pipeline.
20364
+ * @returns {Promise<T>} The result of the pipeline execution.
20365
+ */
20300
20366
  const startPipeline = beginContext(async (clientId, pipelineName, swarmName, payload = {}) => {
20301
20367
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20302
20368
  swarm$1.loggerService.log(METHOD_NAME$d, {
20303
20369
  clientId,
20304
20370
  pipelineName,
20305
20371
  });
20306
- await Chat.beginChat(clientId, swarmName);
20372
+ if (!swarm$1.sessionValidationService.hasSession(clientId)) {
20373
+ await Chat.beginChat(clientId, swarmName);
20374
+ }
20307
20375
  swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$d);
20308
20376
  swarm$1.pipelineValidationService.validate(pipelineName, METHOD_NAME$d);
20309
20377
  const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$d, clientId, swarmName);
@@ -22864,6 +22932,7 @@ exports.question = question;
22864
22932
  exports.questionForce = questionForce;
22865
22933
  exports.runStateless = runStateless;
22866
22934
  exports.runStatelessForce = runStatelessForce;
22935
+ exports.scope = scope;
22867
22936
  exports.session = session;
22868
22937
  exports.setConfig = setConfig;
22869
22938
  exports.startPipeline = startPipeline;