agent-swarm-kit 1.0.170 → 1.0.172

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
@@ -3879,6 +3879,41 @@ class AgentConnectionService {
3879
3879
  }
3880
3880
  }
3881
3881
 
3882
+ /**
3883
+ * A scoped service class that encapsulates a payload context for dependency injection.
3884
+ * Provides a way to access execution metadata and payload data within a specific scope.
3885
+ * Scoped using `di-scoped` to ensure instance isolation per scope.
3886
+ */
3887
+ const PayloadContextService = diScoped.scoped(class {
3888
+ /**
3889
+ * Creates a new instance of PayloadContextService with the provided context.
3890
+ * @param context - The payload context containing client, execution, process IDs, and payload data.
3891
+ */
3892
+ constructor(context) {
3893
+ this.context = context;
3894
+ }
3895
+ });
3896
+
3897
+ /** @private Constant defining the method name for logging purposes */
3898
+ const METHOD_NAME$S = "function.common.getPayload";
3899
+ /**
3900
+ * Retrieves the payload from the current PayloadContextService context.
3901
+ * Returns null if no context is available. Logs the operation if logging is enabled.
3902
+ * @template Payload - The type of the payload object, defaults to a generic object.
3903
+ * @returns the payload data from the context, or null if no context exists.
3904
+ * @example
3905
+ * const payload = await getPayload<{ id: number }>();
3906
+ * console.log(payload); // { id: number } or null
3907
+ */
3908
+ const getPayload = () => {
3909
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$S);
3910
+ if (PayloadContextService.hasContext()) {
3911
+ const { payload } = swarm$1.payloadContextService.context;
3912
+ return payload;
3913
+ }
3914
+ return null;
3915
+ };
3916
+
3882
3917
  /**
3883
3918
  * Class representing the history of client messages in the swarm system, implementing the IHistory interface.
3884
3919
  * Manages storage, retrieval, and filtering of messages for an agent, with event emission via BusService.
@@ -3910,6 +3945,9 @@ class ClientHistory {
3910
3945
  async push(message) {
3911
3946
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
3912
3947
  this.params.logger.debug(`ClientHistory agentName=${this.params.agentName} push`, { message });
3948
+ if (message.mode === "user" && message.role === "user") {
3949
+ message = { ...message, payload: getPayload() };
3950
+ }
3913
3951
  await this.params.items.push(message, this.params.clientId, this.params.agentName);
3914
3952
  await this.params.bus.emit(this.params.clientId, {
3915
3953
  type: "push",
@@ -12459,21 +12497,6 @@ class PolicyConnectionService {
12459
12497
  }
12460
12498
  }
12461
12499
 
12462
- /**
12463
- * A scoped service class that encapsulates a payload context for dependency injection.
12464
- * Provides a way to access execution metadata and payload data within a specific scope.
12465
- * Scoped using `di-scoped` to ensure instance isolation per scope.
12466
- */
12467
- const PayloadContextService = diScoped.scoped(class {
12468
- /**
12469
- * Creates a new instance of PayloadContextService with the provided context.
12470
- * @param context - The payload context containing client, execution, process IDs, and payload data.
12471
- */
12472
- constructor(context) {
12473
- this.context = context;
12474
- }
12475
- });
12476
-
12477
12500
  {
12478
12501
  provide(TYPES.docService, () => new DocService());
12479
12502
  provide(TYPES.busService, () => new BusService());
@@ -12603,7 +12626,7 @@ const swarm = {
12603
12626
  init();
12604
12627
  var swarm$1 = swarm;
12605
12628
 
12606
- const METHOD_NAME$S = "cli.dumpDocs";
12629
+ const METHOD_NAME$R = "cli.dumpDocs";
12607
12630
  /**
12608
12631
  * Dumps the documentation for the agents and swarms.
12609
12632
  *
@@ -12613,7 +12636,7 @@ const METHOD_NAME$S = "cli.dumpDocs";
12613
12636
  */
12614
12637
  const dumpDocs = beginContext((dirName = "./docs/chat", PlantUML) => {
12615
12638
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12616
- swarm$1.loggerService.log(METHOD_NAME$S, {
12639
+ swarm$1.loggerService.log(METHOD_NAME$R, {
12617
12640
  dirName,
12618
12641
  });
12619
12642
  if (PlantUML) {
@@ -12623,10 +12646,10 @@ const dumpDocs = beginContext((dirName = "./docs/chat", PlantUML) => {
12623
12646
  }
12624
12647
  swarm$1.agentValidationService
12625
12648
  .getAgentList()
12626
- .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$S));
12649
+ .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$R));
12627
12650
  swarm$1.swarmValidationService
12628
12651
  .getSwarmList()
12629
- .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$S));
12652
+ .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$R));
12630
12653
  swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
12631
12654
  const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
12632
12655
  if (!dependsOn) {
@@ -12636,7 +12659,7 @@ const dumpDocs = beginContext((dirName = "./docs/chat", PlantUML) => {
12636
12659
  return swarm$1.docService.dumpDocs(dirName);
12637
12660
  });
12638
12661
 
12639
- const METHOD_NAME$R = "cli.dumpAgent";
12662
+ const METHOD_NAME$Q = "cli.dumpAgent";
12640
12663
  /**
12641
12664
  * Dumps the agent information into PlantUML format.
12642
12665
  *
@@ -12645,14 +12668,14 @@ const METHOD_NAME$R = "cli.dumpAgent";
12645
12668
  */
12646
12669
  const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
12647
12670
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12648
- swarm$1.loggerService.log(METHOD_NAME$R, {
12671
+ swarm$1.loggerService.log(METHOD_NAME$Q, {
12649
12672
  agentName,
12650
12673
  });
12651
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$R);
12674
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$Q);
12652
12675
  return swarm$1.agentMetaService.toUML(agentName, withSubtree);
12653
12676
  });
12654
12677
 
12655
- const METHOD_NAME$Q = "cli.dumpSwarm";
12678
+ const METHOD_NAME$P = "cli.dumpSwarm";
12656
12679
  /**
12657
12680
  * Dumps the swarm information into PlantUML format.
12658
12681
  *
@@ -12661,14 +12684,14 @@ const METHOD_NAME$Q = "cli.dumpSwarm";
12661
12684
  */
12662
12685
  const dumpSwarm = beginContext((swarmName) => {
12663
12686
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12664
- swarm$1.loggerService.log(METHOD_NAME$Q, {
12687
+ swarm$1.loggerService.log(METHOD_NAME$P, {
12665
12688
  swarmName,
12666
12689
  });
12667
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$Q);
12690
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$P);
12668
12691
  return swarm$1.swarmMetaService.toUML(swarmName);
12669
12692
  });
12670
12693
 
12671
- const METHOD_NAME$P = "cli.dumpPerfomance";
12694
+ const METHOD_NAME$O = "cli.dumpPerfomance";
12672
12695
  const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
12673
12696
  const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
12674
12697
  /**
@@ -12687,7 +12710,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
12687
12710
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
12688
12711
  */
12689
12712
  const dumpPerfomance = async (dirName = "./logs/meta") => {
12690
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$P);
12713
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$O);
12691
12714
  await dumpPerfomanceInternal(dirName);
12692
12715
  };
12693
12716
  /**
@@ -12745,7 +12768,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
12745
12768
  return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
12746
12769
  });
12747
12770
 
12748
- const METHOD_NAME$O = "cli.dumpClientPerformance";
12771
+ const METHOD_NAME$N = "cli.dumpClientPerformance";
12749
12772
  const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
12750
12773
  const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
12751
12774
  /**
@@ -12769,7 +12792,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
12769
12792
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
12770
12793
  */
12771
12794
  const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
12772
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$O);
12795
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$N);
12773
12796
  await dumpClientPerformanceInternal(clientId, dirName);
12774
12797
  };
12775
12798
  /**
@@ -12789,7 +12812,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
12789
12812
  });
12790
12813
  });
12791
12814
 
12792
- const METHOD_NAME$N = "function.setup.addAgent";
12815
+ const METHOD_NAME$M = "function.setup.addAgent";
12793
12816
  /**
12794
12817
  * Adds a new agent to the agent registry for use within the swarm system.
12795
12818
  *
@@ -12809,7 +12832,7 @@ const METHOD_NAME$N = "function.setup.addAgent";
12809
12832
  const addAgent = beginContext((agentSchema) => {
12810
12833
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12811
12834
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12812
- swarm$1.loggerService.log(METHOD_NAME$N, {
12835
+ swarm$1.loggerService.log(METHOD_NAME$M, {
12813
12836
  agentSchema,
12814
12837
  });
12815
12838
  // Register the agent in the validation and schema services
@@ -12819,7 +12842,7 @@ const addAgent = beginContext((agentSchema) => {
12819
12842
  return agentSchema.agentName;
12820
12843
  });
12821
12844
 
12822
- const METHOD_NAME$M = "function.setup.addCompletion";
12845
+ const METHOD_NAME$L = "function.setup.addCompletion";
12823
12846
  /**
12824
12847
  * Adds a completion engine to the registry for use by agents in the swarm system.
12825
12848
  *
@@ -12839,7 +12862,7 @@ const METHOD_NAME$M = "function.setup.addCompletion";
12839
12862
  const addCompletion = beginContext((completionSchema) => {
12840
12863
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12841
12864
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12842
- swarm$1.loggerService.log(METHOD_NAME$M, {
12865
+ swarm$1.loggerService.log(METHOD_NAME$L, {
12843
12866
  completionSchema,
12844
12867
  });
12845
12868
  // Register the completion in the validation and schema services
@@ -12849,7 +12872,7 @@ const addCompletion = beginContext((completionSchema) => {
12849
12872
  return completionSchema.completionName;
12850
12873
  });
12851
12874
 
12852
- const METHOD_NAME$L = "function.setup.addSwarm";
12875
+ const METHOD_NAME$K = "function.setup.addSwarm";
12853
12876
  /**
12854
12877
  * Adds a new swarm to the system for managing client sessions.
12855
12878
  *
@@ -12869,7 +12892,7 @@ const METHOD_NAME$L = "function.setup.addSwarm";
12869
12892
  const addSwarm = beginContext((swarmSchema) => {
12870
12893
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12871
12894
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12872
- swarm$1.loggerService.log(METHOD_NAME$L, {
12895
+ swarm$1.loggerService.log(METHOD_NAME$K, {
12873
12896
  swarmSchema,
12874
12897
  });
12875
12898
  // Register the swarm in the validation and schema services
@@ -12879,7 +12902,7 @@ const addSwarm = beginContext((swarmSchema) => {
12879
12902
  return swarmSchema.swarmName;
12880
12903
  });
12881
12904
 
12882
- const METHOD_NAME$K = "function.setup.addTool";
12905
+ const METHOD_NAME$J = "function.setup.addTool";
12883
12906
  /**
12884
12907
  * Adds a new tool to the tool registry for use by agents in the swarm system.
12885
12908
  *
@@ -12901,7 +12924,7 @@ const METHOD_NAME$K = "function.setup.addTool";
12901
12924
  const addTool = beginContext((toolSchema) => {
12902
12925
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12903
12926
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12904
- swarm$1.loggerService.log(METHOD_NAME$K, {
12927
+ swarm$1.loggerService.log(METHOD_NAME$J, {
12905
12928
  toolSchema,
12906
12929
  });
12907
12930
  // Register the tool in the validation and schema services
@@ -12911,7 +12934,7 @@ const addTool = beginContext((toolSchema) => {
12911
12934
  return toolSchema.toolName;
12912
12935
  });
12913
12936
 
12914
- const METHOD_NAME$J = "function.setup.addState";
12937
+ const METHOD_NAME$I = "function.setup.addState";
12915
12938
  /**
12916
12939
  * Adds a new state to the state registry for use within the swarm system.
12917
12940
  *
@@ -12933,7 +12956,7 @@ const METHOD_NAME$J = "function.setup.addState";
12933
12956
  const addState = beginContext((stateSchema) => {
12934
12957
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12935
12958
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12936
- swarm$1.loggerService.log(METHOD_NAME$J, {
12959
+ swarm$1.loggerService.log(METHOD_NAME$I, {
12937
12960
  stateSchema,
12938
12961
  });
12939
12962
  // Register the state in the schema service
@@ -12948,7 +12971,7 @@ const addState = beginContext((stateSchema) => {
12948
12971
  return stateSchema.stateName;
12949
12972
  });
12950
12973
 
12951
- const METHOD_NAME$I = "function.setup.addEmbedding";
12974
+ const METHOD_NAME$H = "function.setup.addEmbedding";
12952
12975
  /**
12953
12976
  * Adds a new embedding engine to the embedding registry for use within the swarm system.
12954
12977
  *
@@ -12968,7 +12991,7 @@ const METHOD_NAME$I = "function.setup.addEmbedding";
12968
12991
  const addEmbedding = beginContext((embeddingSchema) => {
12969
12992
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
12970
12993
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
12971
- swarm$1.loggerService.log(METHOD_NAME$I, {
12994
+ swarm$1.loggerService.log(METHOD_NAME$H, {
12972
12995
  embeddingSchema,
12973
12996
  });
12974
12997
  // Register the embedding in the validation and schema services
@@ -12978,7 +13001,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
12978
13001
  return embeddingSchema.embeddingName;
12979
13002
  });
12980
13003
 
12981
- const METHOD_NAME$H = "function.setup.addStorage";
13004
+ const METHOD_NAME$G = "function.setup.addStorage";
12982
13005
  /**
12983
13006
  * Adds a new storage engine to the storage registry for use within the swarm system.
12984
13007
  *
@@ -13000,7 +13023,7 @@ const METHOD_NAME$H = "function.setup.addStorage";
13000
13023
  const addStorage = beginContext((storageSchema) => {
13001
13024
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13002
13025
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13003
- swarm$1.loggerService.log(METHOD_NAME$H, {
13026
+ swarm$1.loggerService.log(METHOD_NAME$G, {
13004
13027
  storageSchema,
13005
13028
  });
13006
13029
  // Register the storage in the validation and schema services
@@ -13017,7 +13040,7 @@ const addStorage = beginContext((storageSchema) => {
13017
13040
  });
13018
13041
 
13019
13042
  /** @private Constant defining the method name for logging and validation context */
13020
- const METHOD_NAME$G = "function.setup.addPolicy";
13043
+ const METHOD_NAME$F = "function.setup.addPolicy";
13021
13044
  /**
13022
13045
  * Adds a new policy for agents in the swarm system by registering it with validation and schema services.
13023
13046
  * Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
@@ -13033,7 +13056,7 @@ const METHOD_NAME$G = "function.setup.addPolicy";
13033
13056
  const addPolicy = beginContext((policySchema) => {
13034
13057
  // Log the policy addition attempt if enabled
13035
13058
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13036
- swarm$1.loggerService.log(METHOD_NAME$G, {
13059
+ swarm$1.loggerService.log(METHOD_NAME$F, {
13037
13060
  policySchema,
13038
13061
  });
13039
13062
  // Register the policy with PolicyValidationService for runtime validation
@@ -13044,7 +13067,7 @@ const addPolicy = beginContext((policySchema) => {
13044
13067
  return policySchema.policyName;
13045
13068
  });
13046
13069
 
13047
- const METHOD_NAME$F = "function.commit.commitToolOutput";
13070
+ const METHOD_NAME$E = "function.commit.commitToolOutput";
13048
13071
  /**
13049
13072
  * Commits the output of a tool execution to the active agent in a swarm session.
13050
13073
  *
@@ -13064,19 +13087,19 @@ const METHOD_NAME$F = "function.commit.commitToolOutput";
13064
13087
  const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
13065
13088
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13066
13089
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13067
- swarm$1.loggerService.log(METHOD_NAME$F, {
13090
+ swarm$1.loggerService.log(METHOD_NAME$E, {
13068
13091
  toolId,
13069
13092
  content,
13070
13093
  clientId,
13071
13094
  agentName,
13072
13095
  });
13073
13096
  // Validate the agent, session, and swarm to ensure they exist and are accessible
13074
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
13075
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$F);
13097
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$E);
13098
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
13076
13099
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13077
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
13100
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
13078
13101
  // Check if the specified agent is still the active agent in the swarm session
13079
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$F, clientId, swarmName);
13102
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$E, clientId, swarmName);
13080
13103
  if (currentAgentName !== agentName) {
13081
13104
  // Log a skip message if the agent has changed during the operation
13082
13105
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -13089,11 +13112,11 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
13089
13112
  return;
13090
13113
  }
13091
13114
  // Commit the tool output to the session via the session public service
13092
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$F, clientId, swarmName);
13115
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$E, clientId, swarmName);
13093
13116
  });
13094
13117
 
13095
13118
  /** @private Constant defining the method name for logging and validation context */
13096
- const METHOD_NAME$E = "function.commit.commitSystemMessage";
13119
+ const METHOD_NAME$D = "function.commit.commitSystemMessage";
13097
13120
  /**
13098
13121
  * Commits a system-generated message to the active agent in the swarm system.
13099
13122
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -13112,20 +13135,20 @@ const METHOD_NAME$E = "function.commit.commitSystemMessage";
13112
13135
  const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
13113
13136
  // Log the commit attempt if enabled
13114
13137
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13115
- swarm$1.loggerService.log(METHOD_NAME$E, {
13138
+ swarm$1.loggerService.log(METHOD_NAME$D, {
13116
13139
  content,
13117
13140
  clientId,
13118
13141
  agentName,
13119
13142
  });
13120
13143
  // Validate the agent exists
13121
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$E);
13144
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$D);
13122
13145
  // Validate the session exists and retrieve the associated swarm
13123
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
13146
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
13124
13147
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13125
13148
  // Validate the swarm configuration
13126
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
13149
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
13127
13150
  // Check if the current agent matches the provided agent
13128
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$E, clientId, swarmName);
13151
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$D, clientId, swarmName);
13129
13152
  if (currentAgentName !== agentName) {
13130
13153
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13131
13154
  swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
@@ -13136,11 +13159,11 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
13136
13159
  return;
13137
13160
  }
13138
13161
  // Commit the system message via SessionPublicService
13139
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$E, clientId, swarmName);
13162
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$D, clientId, swarmName);
13140
13163
  });
13141
13164
 
13142
13165
  /** @private Constant defining the method name for logging and validation context */
13143
- const METHOD_NAME$D = "function.commit.commitFlush";
13166
+ const METHOD_NAME$C = "function.commit.commitFlush";
13144
13167
  /**
13145
13168
  * Commits a flush of agent history for a specific client and agent in the swarm system.
13146
13169
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
@@ -13157,19 +13180,19 @@ const METHOD_NAME$D = "function.commit.commitFlush";
13157
13180
  const commitFlush = beginContext(async (clientId, agentName) => {
13158
13181
  // Log the flush attempt if enabled
13159
13182
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13160
- swarm$1.loggerService.log(METHOD_NAME$D, {
13183
+ swarm$1.loggerService.log(METHOD_NAME$C, {
13161
13184
  clientId,
13162
13185
  agentName,
13163
13186
  });
13164
13187
  // Validate the agent exists
13165
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$D);
13188
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$C);
13166
13189
  // Validate the session exists and retrieve the associated swarm
13167
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
13190
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
13168
13191
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13169
13192
  // Validate the swarm configuration
13170
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
13193
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
13171
13194
  // Check if the current agent matches the provided agent
13172
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$D, clientId, swarmName);
13195
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$C, clientId, swarmName);
13173
13196
  if (currentAgentName !== agentName) {
13174
13197
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13175
13198
  swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
@@ -13180,10 +13203,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
13180
13203
  return;
13181
13204
  }
13182
13205
  // Commit the flush of agent history via SessionPublicService
13183
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$D, clientId, swarmName);
13206
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$C, clientId, swarmName);
13184
13207
  });
13185
13208
 
13186
- const METHOD_NAME$C = "function.commit.commitSystemMessage";
13209
+ const METHOD_NAME$B = "function.commit.commitSystemMessage";
13187
13210
  /**
13188
13211
  * Commits a user message to the active agent's history in a swarm session without triggering a response.
13189
13212
  *
@@ -13202,18 +13225,18 @@ const METHOD_NAME$C = "function.commit.commitSystemMessage";
13202
13225
  const commitUserMessage = beginContext(async (content, clientId, agentName) => {
13203
13226
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13204
13227
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13205
- swarm$1.loggerService.log(METHOD_NAME$C, {
13228
+ swarm$1.loggerService.log(METHOD_NAME$B, {
13206
13229
  content,
13207
13230
  clientId,
13208
13231
  agentName,
13209
13232
  });
13210
13233
  // Validate the agent, session, and swarm to ensure they exist and are accessible
13211
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$C);
13212
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
13234
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
13235
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
13213
13236
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13214
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
13237
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
13215
13238
  // Check if the specified agent is still the active agent in the swarm session
13216
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$C, clientId, swarmName);
13239
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName);
13217
13240
  if (currentAgentName !== agentName) {
13218
13241
  // Log a skip message if the agent has changed during the operation
13219
13242
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -13225,10 +13248,10 @@ const commitUserMessage = beginContext(async (content, clientId, agentName) => {
13225
13248
  return;
13226
13249
  }
13227
13250
  // Commit the user message to the agent's history via the session public service
13228
- await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$C, clientId, swarmName);
13251
+ await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$B, clientId, swarmName);
13229
13252
  });
13230
13253
 
13231
- const METHOD_NAME$B = "function.commit.commitToolOutputForce";
13254
+ const METHOD_NAME$A = "function.commit.commitToolOutputForce";
13232
13255
  /**
13233
13256
  * Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
13234
13257
  *
@@ -13247,21 +13270,21 @@ const METHOD_NAME$B = "function.commit.commitToolOutputForce";
13247
13270
  const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
13248
13271
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13249
13272
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13250
- swarm$1.loggerService.log(METHOD_NAME$B, {
13273
+ swarm$1.loggerService.log(METHOD_NAME$A, {
13251
13274
  toolId,
13252
13275
  content,
13253
13276
  clientId,
13254
13277
  });
13255
13278
  // Validate the session and swarm to ensure they exist and are accessible
13256
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
13279
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
13257
13280
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13258
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
13281
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
13259
13282
  // Commit the tool output to the session via the session public service without checking the active agent
13260
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$B, clientId, swarmName);
13283
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$A, clientId, swarmName);
13261
13284
  });
13262
13285
 
13263
13286
  /** @private Constant defining the method name for logging and validation context */
13264
- const METHOD_NAME$A = "function.commit.commitSystemMessageForce";
13287
+ const METHOD_NAME$z = "function.commit.commitSystemMessageForce";
13265
13288
  /**
13266
13289
  * Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
13267
13290
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -13280,21 +13303,21 @@ const METHOD_NAME$A = "function.commit.commitSystemMessageForce";
13280
13303
  const commitSystemMessageForce = beginContext(async (content, clientId) => {
13281
13304
  // Log the commit attempt if enabled
13282
13305
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13283
- swarm$1.loggerService.log(METHOD_NAME$A, {
13306
+ swarm$1.loggerService.log(METHOD_NAME$z, {
13284
13307
  content,
13285
13308
  clientId,
13286
13309
  });
13287
13310
  // Validate the session exists and retrieve the associated swarm
13288
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
13311
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
13289
13312
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13290
13313
  // Validate the swarm configuration
13291
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
13314
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
13292
13315
  // Commit the system message via SessionPublicService without agent checks
13293
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$A, clientId, swarmName);
13316
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$z, clientId, swarmName);
13294
13317
  });
13295
13318
 
13296
13319
  /** @private Constant defining the method name for logging and validation context */
13297
- const METHOD_NAME$z = "function.commit.commitFlushForce";
13320
+ const METHOD_NAME$y = "function.commit.commitFlushForce";
13298
13321
  /**
13299
13322
  * Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
13300
13323
  * Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
@@ -13312,20 +13335,20 @@ const METHOD_NAME$z = "function.commit.commitFlushForce";
13312
13335
  const commitFlushForce = beginContext(async (clientId) => {
13313
13336
  // Log the flush attempt if enabled
13314
13337
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13315
- swarm$1.loggerService.log(METHOD_NAME$z, {
13338
+ swarm$1.loggerService.log(METHOD_NAME$y, {
13316
13339
  clientId,
13317
- METHOD_NAME: METHOD_NAME$z,
13340
+ METHOD_NAME: METHOD_NAME$y,
13318
13341
  });
13319
13342
  // Validate the session exists and retrieve the associated swarm
13320
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
13343
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
13321
13344
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13322
13345
  // Validate the swarm configuration
13323
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
13346
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
13324
13347
  // Commit the flush of agent history via SessionPublicService without agent checks
13325
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$z, clientId, swarmName);
13348
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$y, clientId, swarmName);
13326
13349
  });
13327
13350
 
13328
- const METHOD_NAME$y = "function.commit.commitSystemMessage";
13351
+ const METHOD_NAME$x = "function.commit.commitSystemMessage";
13329
13352
  /**
13330
13353
  * Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
13331
13354
  *
@@ -13343,20 +13366,20 @@ const METHOD_NAME$y = "function.commit.commitSystemMessage";
13343
13366
  const commitUserMessageForce = beginContext(async (content, clientId) => {
13344
13367
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13345
13368
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13346
- swarm$1.loggerService.log(METHOD_NAME$y, {
13369
+ swarm$1.loggerService.log(METHOD_NAME$x, {
13347
13370
  content,
13348
13371
  clientId,
13349
13372
  });
13350
13373
  // Validate the session and swarm to ensure they exist and are accessible
13351
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
13374
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
13352
13375
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13353
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
13376
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
13354
13377
  // Commit the user message to the agent's history via the session public service without checking the active agent
13355
- await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$y, clientId, swarmName);
13378
+ await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$x, clientId, swarmName);
13356
13379
  });
13357
13380
 
13358
13381
  /** @private Constant defining the method name for logging and validation context */
13359
- const METHOD_NAME$x = "function.commit.commitAssistantMessage";
13382
+ const METHOD_NAME$w = "function.commit.commitAssistantMessage";
13360
13383
  /**
13361
13384
  * Commits an assistant-generated message to the active agent in the swarm system.
13362
13385
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -13374,20 +13397,20 @@ const METHOD_NAME$x = "function.commit.commitAssistantMessage";
13374
13397
  const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
13375
13398
  // Log the commit attempt if enabled
13376
13399
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13377
- swarm$1.loggerService.log(METHOD_NAME$x, {
13400
+ swarm$1.loggerService.log(METHOD_NAME$w, {
13378
13401
  content,
13379
13402
  clientId,
13380
13403
  agentName,
13381
13404
  });
13382
13405
  // Validate the agent exists
13383
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
13406
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
13384
13407
  // Validate the session exists and retrieve the associated swarm
13385
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
13408
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
13386
13409
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13387
13410
  // Validate the swarm configuration
13388
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
13411
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
13389
13412
  // Check if the current agent matches the provided agent
13390
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
13413
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName);
13391
13414
  if (currentAgentName !== agentName) {
13392
13415
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13393
13416
  swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
@@ -13398,11 +13421,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
13398
13421
  return;
13399
13422
  }
13400
13423
  // Commit the assistant message via SessionPublicService
13401
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$x, clientId, swarmName);
13424
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName);
13402
13425
  });
13403
13426
 
13404
13427
  /** @private Constant defining the method name for logging and validation context */
13405
- const METHOD_NAME$w = "function.commit.commitAssistantMessageForce";
13428
+ const METHOD_NAME$v = "function.commit.commitAssistantMessageForce";
13406
13429
  /**
13407
13430
  * Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
13408
13431
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -13421,21 +13444,21 @@ const METHOD_NAME$w = "function.commit.commitAssistantMessageForce";
13421
13444
  const commitAssistantMessageForce = beginContext(async (content, clientId) => {
13422
13445
  // Log the commit attempt if enabled
13423
13446
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13424
- swarm$1.loggerService.log(METHOD_NAME$w, {
13447
+ swarm$1.loggerService.log(METHOD_NAME$v, {
13425
13448
  content,
13426
13449
  clientId,
13427
13450
  });
13428
13451
  // Validate the session exists and retrieve the associated swarm
13429
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
13452
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
13430
13453
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13431
13454
  // Validate the swarm configuration
13432
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
13455
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
13433
13456
  // Commit the assistant message via SessionPublicService without agent checks
13434
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName);
13457
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$v, clientId, swarmName);
13435
13458
  });
13436
13459
 
13437
13460
  /** @private Constant defining the method name for logging and validation context */
13438
- const METHOD_NAME$v = "function.commit.cancelOutput";
13461
+ const METHOD_NAME$u = "function.commit.cancelOutput";
13439
13462
  /**
13440
13463
  * Cancels the awaited output for a specific client and agent by emitting an empty string.
13441
13464
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
@@ -13451,19 +13474,19 @@ const METHOD_NAME$v = "function.commit.cancelOutput";
13451
13474
  const cancelOutput = beginContext(async (clientId, agentName) => {
13452
13475
  // Log the cancellation attempt if enabled
13453
13476
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13454
- swarm$1.loggerService.log(METHOD_NAME$v, {
13477
+ swarm$1.loggerService.log(METHOD_NAME$u, {
13455
13478
  clientId,
13456
13479
  agentName,
13457
13480
  });
13458
13481
  // Validate the agent exists
13459
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
13482
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$u);
13460
13483
  // Validate the session exists and retrieve the associated swarm
13461
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
13484
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
13462
13485
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13463
13486
  // Validate the swarm configuration
13464
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
13487
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
13465
13488
  // Check if the current agent matches the provided agent
13466
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
13489
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName);
13467
13490
  if (currentAgentName !== agentName) {
13468
13491
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13469
13492
  swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
@@ -13474,11 +13497,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
13474
13497
  return;
13475
13498
  }
13476
13499
  // Perform the output cancellation via SwarmPublicService
13477
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$v, clientId, swarmName);
13500
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName);
13478
13501
  });
13479
13502
 
13480
13503
  /** @private Constant defining the method name for logging and validation context */
13481
- const METHOD_NAME$u = "function.commit.cancelOutputForce";
13504
+ const METHOD_NAME$t = "function.commit.cancelOutputForce";
13482
13505
  /**
13483
13506
  * Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
13484
13507
  * Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
@@ -13495,20 +13518,20 @@ const METHOD_NAME$u = "function.commit.cancelOutputForce";
13495
13518
  const cancelOutputForce = beginContext(async (clientId) => {
13496
13519
  // Log the cancellation attempt if enabled
13497
13520
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13498
- swarm$1.loggerService.log(METHOD_NAME$u, {
13521
+ swarm$1.loggerService.log(METHOD_NAME$t, {
13499
13522
  clientId,
13500
13523
  });
13501
13524
  // Validate the session exists and retrieve the associated swarm
13502
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
13525
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
13503
13526
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13504
13527
  // Validate the swarm configuration
13505
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
13528
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
13506
13529
  // Perform the output cancellation via SwarmPublicService without agent checks
13507
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName);
13530
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$t, clientId, swarmName);
13508
13531
  });
13509
13532
 
13510
13533
  /** @private Constant defining the method name for logging and validation context */
13511
- const METHOD_NAME$t = "function.commit.commitStopTools";
13534
+ const METHOD_NAME$s = "function.commit.commitStopTools";
13512
13535
  /**
13513
13536
  * Prevents the next tool from being executed for a specific client and agent in the swarm system.
13514
13537
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
@@ -13525,19 +13548,19 @@ const METHOD_NAME$t = "function.commit.commitStopTools";
13525
13548
  const commitStopTools = beginContext(async (clientId, agentName) => {
13526
13549
  // Log the stop tools attempt if enabled
13527
13550
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13528
- swarm$1.loggerService.log(METHOD_NAME$t, {
13551
+ swarm$1.loggerService.log(METHOD_NAME$s, {
13529
13552
  clientId,
13530
13553
  agentName,
13531
13554
  });
13532
13555
  // Validate the agent exists
13533
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$t);
13556
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
13534
13557
  // Validate the session exists and retrieve the associated swarm
13535
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
13558
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
13536
13559
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13537
13560
  // Validate the swarm configuration
13538
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
13561
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
13539
13562
  // Check if the current agent matches the provided agent
13540
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName);
13563
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$s, clientId, swarmName);
13541
13564
  if (currentAgentName !== agentName) {
13542
13565
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13543
13566
  swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
@@ -13548,11 +13571,11 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
13548
13571
  return;
13549
13572
  }
13550
13573
  // Commit the stop of the next tool execution via SessionPublicService
13551
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$t, clientId, swarmName);
13574
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$s, clientId, swarmName);
13552
13575
  });
13553
13576
 
13554
13577
  /** @private Constant defining the method name for logging and validation context */
13555
- const METHOD_NAME$s = "function.commit.commitStopToolsForce";
13578
+ const METHOD_NAME$r = "function.commit.commitStopToolsForce";
13556
13579
  /**
13557
13580
  * Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
13558
13581
  * Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
@@ -13570,20 +13593,20 @@ const METHOD_NAME$s = "function.commit.commitStopToolsForce";
13570
13593
  const commitStopToolsForce = beginContext(async (clientId) => {
13571
13594
  // Log the stop tools attempt if enabled
13572
13595
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13573
- swarm$1.loggerService.log(METHOD_NAME$s, {
13596
+ swarm$1.loggerService.log(METHOD_NAME$r, {
13574
13597
  clientId,
13575
- METHOD_NAME: METHOD_NAME$s,
13598
+ METHOD_NAME: METHOD_NAME$r,
13576
13599
  });
13577
13600
  // Validate the session exists and retrieve the associated swarm
13578
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
13601
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
13579
13602
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13580
13603
  // Validate the swarm configuration
13581
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
13604
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
13582
13605
  // Commit the stop of the next tool execution via SessionPublicService without agent checks
13583
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$s, clientId, swarmName);
13606
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$r, clientId, swarmName);
13584
13607
  });
13585
13608
 
13586
- const METHOD_NAME$r = "function.target.emitForce";
13609
+ const METHOD_NAME$q = "function.target.emitForce";
13587
13610
  /**
13588
13611
  * Emits a string as model output without executing an incoming message or checking the active agent.
13589
13612
  *
@@ -13602,7 +13625,7 @@ const METHOD_NAME$r = "function.target.emitForce";
13602
13625
  const emitForce = beginContext(async (content, clientId) => {
13603
13626
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13604
13627
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13605
- swarm$1.loggerService.log(METHOD_NAME$r, {
13628
+ swarm$1.loggerService.log(METHOD_NAME$q, {
13606
13629
  content,
13607
13630
  clientId,
13608
13631
  });
@@ -13612,14 +13635,14 @@ const emitForce = beginContext(async (content, clientId) => {
13612
13635
  throw new Error(`agent-swarm-kit emitForce session is not makeConnection clientId=${clientId}`);
13613
13636
  }
13614
13637
  // Validate the session and swarm
13615
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
13638
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
13616
13639
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13617
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
13640
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
13618
13641
  // Emit the content directly via the session public service
13619
- return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$r, clientId, swarmName);
13642
+ return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$q, clientId, swarmName);
13620
13643
  });
13621
13644
 
13622
- const METHOD_NAME$q = "function.target.executeForce";
13645
+ const METHOD_NAME$p = "function.target.executeForce";
13623
13646
  /**
13624
13647
  * 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.
13625
13648
  *
@@ -13640,22 +13663,22 @@ const executeForce = beginContext(async (content, clientId) => {
13640
13663
  const executionId = functoolsKit.randomString();
13641
13664
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13642
13665
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13643
- swarm$1.loggerService.log(METHOD_NAME$q, {
13666
+ swarm$1.loggerService.log(METHOD_NAME$p, {
13644
13667
  content,
13645
13668
  clientId,
13646
13669
  executionId,
13647
13670
  });
13648
13671
  // Validate the session and swarm
13649
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
13672
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
13650
13673
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13651
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
13674
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
13652
13675
  // Execute the command within an execution context with performance tracking
13653
13676
  return ExecutionContextService.runInContext(async () => {
13654
13677
  let isFinished = false;
13655
13678
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
13656
13679
  try {
13657
13680
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
13658
- const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$q, clientId, swarmName);
13681
+ const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$p, clientId, swarmName);
13659
13682
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
13660
13683
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
13661
13684
  return result;
@@ -13672,7 +13695,7 @@ const executeForce = beginContext(async (content, clientId) => {
13672
13695
  });
13673
13696
  });
13674
13697
 
13675
- const METHOD_NAME$p = "function.target.disposeConnection";
13698
+ const METHOD_NAME$o = "function.target.disposeConnection";
13676
13699
  /**
13677
13700
  * Disposes of a client session and all related resources within a swarm.
13678
13701
  *
@@ -13689,10 +13712,10 @@ const METHOD_NAME$p = "function.target.disposeConnection";
13689
13712
  * @example
13690
13713
  * await disposeConnection("client-123", "TaskSwarm");
13691
13714
  */
13692
- const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$p) => {
13715
+ const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$o) => {
13693
13716
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13694
13717
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13695
- swarm$1.loggerService.log(METHOD_NAME$p, {
13718
+ swarm$1.loggerService.log(METHOD_NAME$o, {
13696
13719
  clientId,
13697
13720
  swarmName,
13698
13721
  });
@@ -13759,7 +13782,7 @@ const disposeConnection = beginContext(async (clientId, swarmName, methodName =
13759
13782
  PersistMemoryAdapter.dispose(clientId);
13760
13783
  });
13761
13784
 
13762
- const METHOD_NAME$o = "function.target.makeAutoDispose";
13785
+ const METHOD_NAME$n = "function.target.makeAutoDispose";
13763
13786
  /**
13764
13787
  * Default timeout in seconds before auto-dispose is triggered.
13765
13788
  * @constant {number}
@@ -13790,7 +13813,7 @@ const DEFAULT_TIMEOUT = 15 * 60;
13790
13813
  const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DEFAULT_TIMEOUT, onDestroy, } = {}) => {
13791
13814
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13792
13815
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13793
- swarm$1.loggerService.log(METHOD_NAME$o, {
13816
+ swarm$1.loggerService.log(METHOD_NAME$n, {
13794
13817
  clientId,
13795
13818
  swarmName,
13796
13819
  });
@@ -13823,7 +13846,7 @@ const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DE
13823
13846
  };
13824
13847
  });
13825
13848
 
13826
- const METHOD_NAME$n = "function.target.execute";
13849
+ const METHOD_NAME$m = "function.target.execute";
13827
13850
  /**
13828
13851
  * Sends a message to the active agent in a swarm session as if it originated from the client side.
13829
13852
  *
@@ -13845,19 +13868,19 @@ const execute = beginContext(async (content, clientId, agentName) => {
13845
13868
  const executionId = functoolsKit.randomString();
13846
13869
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13847
13870
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13848
- swarm$1.loggerService.log(METHOD_NAME$n, {
13871
+ swarm$1.loggerService.log(METHOD_NAME$m, {
13849
13872
  content,
13850
13873
  clientId,
13851
13874
  agentName,
13852
13875
  executionId,
13853
13876
  });
13854
13877
  // Validate the agent, session, and swarm
13855
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$n);
13856
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$n);
13878
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$m);
13879
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$m);
13857
13880
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13858
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$n);
13881
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
13859
13882
  // Check if the specified agent is still the active agent
13860
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$n, clientId, swarmName);
13883
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$m, clientId, swarmName);
13861
13884
  if (currentAgentName !== agentName) {
13862
13885
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13863
13886
  swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
@@ -13876,7 +13899,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
13876
13899
  agentName,
13877
13900
  swarmName,
13878
13901
  });
13879
- const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$n, clientId, swarmName);
13902
+ const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$m, clientId, swarmName);
13880
13903
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
13881
13904
  swarm$1.busService.commitExecutionEnd(clientId, {
13882
13905
  agentName,
@@ -13896,7 +13919,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
13896
13919
  });
13897
13920
  });
13898
13921
 
13899
- const METHOD_NAME$m = "function.target.emit";
13922
+ const METHOD_NAME$l = "function.target.emit";
13900
13923
  /**
13901
13924
  * Emits a string as model output without executing an incoming message, with agent activity validation.
13902
13925
  *
@@ -13916,7 +13939,7 @@ const METHOD_NAME$m = "function.target.emit";
13916
13939
  const emit = beginContext(async (content, clientId, agentName) => {
13917
13940
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13918
13941
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13919
- swarm$1.loggerService.log(METHOD_NAME$m, {
13942
+ swarm$1.loggerService.log(METHOD_NAME$l, {
13920
13943
  content,
13921
13944
  clientId,
13922
13945
  agentName,
@@ -13927,12 +13950,12 @@ const emit = beginContext(async (content, clientId, agentName) => {
13927
13950
  throw new Error(`agent-swarm-kit emit session is not makeConnection clientId=${clientId}`);
13928
13951
  }
13929
13952
  // Validate the agent, session, and swarm
13930
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$m);
13931
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$m);
13953
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
13954
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
13932
13955
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13933
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
13956
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
13934
13957
  // Check if the specified agent is still the active agent
13935
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$m, clientId, swarmName);
13958
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName);
13936
13959
  if (currentAgentName !== agentName) {
13937
13960
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13938
13961
  swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
@@ -13943,10 +13966,10 @@ const emit = beginContext(async (content, clientId, agentName) => {
13943
13966
  return;
13944
13967
  }
13945
13968
  // Emit the content directly via the session public service
13946
- return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$m, clientId, swarmName);
13969
+ return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$l, clientId, swarmName);
13947
13970
  });
13948
13971
 
13949
- const METHOD_NAME$l = "function.target.runStateless";
13972
+ const METHOD_NAME$k = "function.target.runStateless";
13950
13973
  /**
13951
13974
  * Executes a message statelessly with an agent in a swarm session, bypassing chat history.
13952
13975
  *
@@ -13969,19 +13992,19 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
13969
13992
  const executionId = functoolsKit.randomString();
13970
13993
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13971
13994
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13972
- swarm$1.loggerService.log(METHOD_NAME$l, {
13995
+ swarm$1.loggerService.log(METHOD_NAME$k, {
13973
13996
  content,
13974
13997
  clientId,
13975
13998
  agentName,
13976
13999
  executionId,
13977
14000
  });
13978
14001
  // Validate the agent, session, and swarm
13979
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
13980
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
14002
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
14003
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
13981
14004
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13982
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
14005
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
13983
14006
  // Check if the specified agent is still the active agent
13984
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName);
14007
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName);
13985
14008
  if (currentAgentName !== agentName) {
13986
14009
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13987
14010
  swarm$1.loggerService.log('function "runStateless" skipped due to the agent change', {
@@ -14000,7 +14023,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
14000
14023
  agentName,
14001
14024
  swarmName,
14002
14025
  });
14003
- const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$l, clientId, swarmName);
14026
+ const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$k, clientId, swarmName);
14004
14027
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
14005
14028
  swarm$1.busService.commitExecutionEnd(clientId, {
14006
14029
  agentName,
@@ -14020,7 +14043,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
14020
14043
  });
14021
14044
  });
14022
14045
 
14023
- const METHOD_NAME$k = "function.target.runStatelessForce";
14046
+ const METHOD_NAME$j = "function.target.runStatelessForce";
14024
14047
  /**
14025
14048
  * Executes a message statelessly with the active agent in a swarm session, bypassing chat history and forcing execution regardless of agent activity.
14026
14049
  *
@@ -14041,22 +14064,22 @@ const runStatelessForce = beginContext(async (content, clientId) => {
14041
14064
  const executionId = functoolsKit.randomString();
14042
14065
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14043
14066
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14044
- swarm$1.loggerService.log(METHOD_NAME$k, {
14067
+ swarm$1.loggerService.log(METHOD_NAME$j, {
14045
14068
  content,
14046
14069
  clientId,
14047
14070
  executionId,
14048
14071
  });
14049
14072
  // Validate the session and swarm
14050
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
14073
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
14051
14074
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14052
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
14075
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
14053
14076
  // Execute the command statelessly within an execution context with performance tracking
14054
14077
  return ExecutionContextService.runInContext(async () => {
14055
14078
  let isFinished = false;
14056
14079
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
14057
14080
  try {
14058
14081
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
14059
- const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$k, clientId, swarmName);
14082
+ const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$j, clientId, swarmName);
14060
14083
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
14061
14084
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
14062
14085
  return result;
@@ -14083,7 +14106,7 @@ const SCHEDULED_DELAY$1 = 1000;
14083
14106
  * @constant {number}
14084
14107
  */
14085
14108
  const RATE_DELAY = 10000;
14086
- const METHOD_NAME$j = "function.target.makeConnection";
14109
+ const METHOD_NAME$i = "function.target.makeConnection";
14087
14110
  /**
14088
14111
  * Internal implementation of the connection factory for a client to a swarm.
14089
14112
  *
@@ -14098,21 +14121,21 @@ const METHOD_NAME$j = "function.target.makeConnection";
14098
14121
  const makeConnectionInternal = (connector, clientId, swarmName) => {
14099
14122
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14100
14123
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14101
- swarm$1.loggerService.log(METHOD_NAME$j, {
14124
+ swarm$1.loggerService.log(METHOD_NAME$i, {
14102
14125
  clientId,
14103
14126
  swarmName,
14104
14127
  });
14105
14128
  // Validate the swarm and initialize the session
14106
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
14129
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
14107
14130
  swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
14108
14131
  // Create a queued send function using the session public service
14109
- const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$j, clientId, swarmName));
14132
+ const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$i, clientId, swarmName));
14110
14133
  // Return a wrapped send function with validation and agent context
14111
14134
  return (async (outgoing) => {
14112
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
14135
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
14113
14136
  return await send({
14114
14137
  data: outgoing,
14115
- agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName),
14138
+ agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName),
14116
14139
  clientId,
14117
14140
  });
14118
14141
  });
@@ -14184,13 +14207,13 @@ makeConnection.scheduled = (connector, clientId, swarmName, { delay = SCHEDULED_
14184
14207
  }
14185
14208
  if (payload) {
14186
14209
  return await PayloadContextService.runInContext(async () => {
14187
- await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$j, clientId, swarmName);
14210
+ await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$i, clientId, swarmName);
14188
14211
  }, {
14189
14212
  clientId,
14190
14213
  payload,
14191
14214
  });
14192
14215
  }
14193
- await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$j, clientId, swarmName);
14216
+ await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$i, clientId, swarmName);
14194
14217
  }),
14195
14218
  delay,
14196
14219
  });
@@ -14248,7 +14271,7 @@ makeConnection.rate = (connector, clientId, swarmName, { delay = RATE_DELAY } =
14248
14271
  };
14249
14272
  };
14250
14273
 
14251
- const METHOD_NAME$i = "function.target.complete";
14274
+ const METHOD_NAME$h = "function.target.complete";
14252
14275
  /**
14253
14276
  * Time-to-live for the complete function in milliseconds.
14254
14277
  * Defines how long the cached complete function remains valid before expiring.
@@ -14314,7 +14337,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
14314
14337
  const executionId = functoolsKit.randomString();
14315
14338
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14316
14339
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14317
- swarm$1.loggerService.log(METHOD_NAME$i, {
14340
+ swarm$1.loggerService.log(METHOD_NAME$h, {
14318
14341
  content,
14319
14342
  clientId,
14320
14343
  executionId,
@@ -14330,7 +14353,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
14330
14353
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
14331
14354
  try {
14332
14355
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
14333
- const result = await run(METHOD_NAME$i, content);
14356
+ const result = await run(METHOD_NAME$h, content);
14334
14357
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
14335
14358
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
14336
14359
  return result;
@@ -14360,7 +14383,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
14360
14383
  * @constant {number}
14361
14384
  */
14362
14385
  const SCHEDULED_DELAY = 1000;
14363
- const METHOD_NAME$h = "function.target.session";
14386
+ const METHOD_NAME$g = "function.target.session";
14364
14387
  /**
14365
14388
  * Internal implementation of the session factory for a client and swarm.
14366
14389
  *
@@ -14375,22 +14398,22 @@ const sessionInternal = (clientId, swarmName) => {
14375
14398
  const executionId = functoolsKit.randomString();
14376
14399
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14377
14400
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14378
- swarm$1.loggerService.log(METHOD_NAME$h, {
14401
+ swarm$1.loggerService.log(METHOD_NAME$g, {
14379
14402
  clientId,
14380
14403
  swarmName,
14381
14404
  executionId,
14382
14405
  });
14383
14406
  // Validate the swarm and initialize the session
14384
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
14407
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
14385
14408
  swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
14386
14409
  const complete = functoolsKit.queued(async (content) => {
14387
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
14410
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
14388
14411
  return ExecutionContextService.runInContext(async () => {
14389
14412
  let isFinished = false;
14390
14413
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
14391
14414
  try {
14392
14415
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
14393
- const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$h, clientId, swarmName);
14416
+ const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$g, clientId, swarmName);
14394
14417
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
14395
14418
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
14396
14419
  return result;
@@ -14410,7 +14433,7 @@ const sessionInternal = (clientId, swarmName) => {
14410
14433
  complete: (async (content) => {
14411
14434
  return await complete(content);
14412
14435
  }),
14413
- dispose: async () => await disposeConnection(clientId, swarmName, METHOD_NAME$h),
14436
+ dispose: async () => await disposeConnection(clientId, swarmName, METHOD_NAME$g),
14414
14437
  };
14415
14438
  };
14416
14439
  /**
@@ -14488,13 +14511,13 @@ session.scheduled = (clientId, swarmName, { delay = SCHEDULED_DELAY } = {}) => {
14488
14511
  }
14489
14512
  if (payload) {
14490
14513
  return await PayloadContextService.runInContext(async () => {
14491
- return await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$h, clientId, swarmName);
14514
+ return await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$g, clientId, swarmName);
14492
14515
  }, {
14493
14516
  clientId,
14494
14517
  payload,
14495
14518
  });
14496
14519
  }
14497
- return await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$h, clientId, swarmName);
14520
+ return await swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$g, clientId, swarmName);
14498
14521
  }),
14499
14522
  delay,
14500
14523
  });
@@ -14566,25 +14589,6 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY } = {}) => {
14566
14589
  };
14567
14590
  };
14568
14591
 
14569
- /** @private Constant defining the method name for logging purposes */
14570
- const METHOD_NAME$g = "function.common.getPayload";
14571
- /**
14572
- * Retrieves the payload from the current PayloadContextService context.
14573
- * Returns null if no context is available. Logs the operation if logging is enabled.
14574
- * @template Payload - The type of the payload object, defaults to a generic object.
14575
- * @returns A promise resolving to the payload data from the context, or null if no context exists.
14576
- * @example
14577
- * const payload = await getPayload<{ id: number }>();
14578
- * console.log(payload); // { id: number } or {}
14579
- */
14580
- const getPayload = async () => {
14581
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$g);
14582
- const result = PayloadContextService.hasContext()
14583
- ? swarm$1.payloadContextService.context
14584
- : null;
14585
- return result;
14586
- };
14587
-
14588
14592
  const METHOD_NAME$f = "function.common.getAgentName";
14589
14593
  /**
14590
14594
  * Retrieves the name of the active agent for a given client session in a swarm.