agent-swarm-kit 1.1.78 → 1.1.80

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.mjs CHANGED
@@ -68,6 +68,7 @@ const schemaServices$1 = {
68
68
  mcpSchemaService: Symbol('mcpSchemaService'),
69
69
  computeSchemaService: Symbol('computeSchemaService'),
70
70
  pipelineSchemaService: Symbol('pipelineSchemaService'),
71
+ navigationSchemaService: Symbol('navigationSchemaService'),
71
72
  };
72
73
  const metaServices$1 = {
73
74
  agentMetaService: Symbol('agentMetaService'),
@@ -4143,10 +4144,10 @@ class ClientAgent {
4143
4144
  }
4144
4145
  return false;
4145
4146
  })
4146
- .sort(({ function: { name: a } }, { function: { name: b } }) => {
4147
- const aStarts = a.startsWith("navigate_to_");
4148
- const bStarts = b.startsWith("navigate_to_");
4149
- return aStarts === bStarts ? 0 : aStarts ? 1 : -1;
4147
+ .sort(({ toolName: a }, { toolName: b }) => {
4148
+ const aStarts = swarm$1.navigationSchemaService.hasTool(a);
4149
+ const bStarts = swarm$1.navigationSchemaService.hasTool(b);
4150
+ return aStarts === bStarts ? 0 : aStarts ? -1 : 1;
4150
4151
  });
4151
4152
  }
4152
4153
  return agentToolList
@@ -17846,6 +17847,60 @@ class ExecutionValidationService {
17846
17847
  }
17847
17848
  }
17848
17849
 
17850
+ /**
17851
+ * @class NavigationSchemaService
17852
+ * Manages a collection of navigation tool names using a Set for efficient registration and lookup.
17853
+ * Injects LoggerService via dependency injection for logging operations.
17854
+ * Supports agent navigation functionality within the swarm system by tracking available navigation tools.
17855
+ */
17856
+ class NavigationSchemaService {
17857
+ constructor() {
17858
+ /**
17859
+ * @private
17860
+ * @readonly
17861
+ * @type {LoggerService}
17862
+ * Logger service instance, injected via dependency injection, for logging navigation schema operations.
17863
+ * Used in register and hasTool methods when GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
17864
+ */
17865
+ this.loggerService = inject(TYPES.loggerService);
17866
+ /**
17867
+ * @private
17868
+ * @type {Set<ToolName>}
17869
+ * Set for storing navigation tool names, ensuring uniqueness and efficient lookup.
17870
+ * Updated via the register method and queried via the hasTool method.
17871
+ */
17872
+ this._navigationToolNameSet = new Set();
17873
+ /**
17874
+ * Registers a navigation tool name in the internal Set.
17875
+ * Logs the registration operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
17876
+ * @param {ToolName} toolName - The name of the navigation tool to register, sourced from Agent.interface.
17877
+ * @returns {Promise<void>} A promise that resolves when the tool name is registered.
17878
+ * @async
17879
+ */
17880
+ this.register = (toolName) => {
17881
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
17882
+ this.loggerService.info(`navigationSchemaService register`, {
17883
+ toolName,
17884
+ });
17885
+ this._navigationToolNameSet.add(toolName);
17886
+ };
17887
+ /**
17888
+ * Checks if a navigation tool name exists in the internal Set.
17889
+ * Logs the lookup operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
17890
+ * @param {ToolName} toolName - The name of the navigation tool to check, sourced from Agent.interface.
17891
+ * @returns {Promise<boolean>} A promise that resolves to true if the tool name exists, false otherwise.
17892
+ * @async
17893
+ */
17894
+ this.hasTool = (toolName) => {
17895
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
17896
+ this.loggerService.info(`navigationSchemaService hasTool`, {
17897
+ toolName,
17898
+ });
17899
+ return this._navigationToolNameSet.has(toolName);
17900
+ };
17901
+ }
17902
+ }
17903
+
17849
17904
  {
17850
17905
  provide(TYPES.docService, () => new DocService());
17851
17906
  provide(TYPES.busService, () => new BusService());
@@ -17887,6 +17942,7 @@ class ExecutionValidationService {
17887
17942
  provide(TYPES.mcpSchemaService, () => new MCPSchemaService());
17888
17943
  provide(TYPES.computeSchemaService, () => new ComputeSchemaService());
17889
17944
  provide(TYPES.pipelineSchemaService, () => new PipelineSchemaService());
17945
+ provide(TYPES.navigationSchemaService, () => new NavigationSchemaService());
17890
17946
  }
17891
17947
  {
17892
17948
  provide(TYPES.agentPublicService, () => new AgentPublicService());
@@ -17965,6 +18021,7 @@ const schemaServices = {
17965
18021
  mcpSchemaService: inject(TYPES.mcpSchemaService),
17966
18022
  computeSchemaService: inject(TYPES.computeSchemaService),
17967
18023
  pipelineSchemaService: inject(TYPES.pipelineSchemaService),
18024
+ navigationSchemaService: inject(TYPES.navigationSchemaService),
17968
18025
  };
17969
18026
  const publicServices = {
17970
18027
  agentPublicService: inject(TYPES.agentPublicService),
@@ -18560,7 +18617,45 @@ async function executeForce(content, clientId) {
18560
18617
  return await executeForceInternal(content, clientId);
18561
18618
  }
18562
18619
 
18563
- const METHOD_NAME$13 = "function.template.navigateToTriageAgent";
18620
+ /** @private Constant defining the method name for logging and validation context */
18621
+ const METHOD_NAME$13 = "function.commit.commitStopToolsForce";
18622
+ /**
18623
+ * Function implementation
18624
+ */
18625
+ const commitStopToolsForceInternal = beginContext(async (clientId) => {
18626
+ // Log the stop tools attempt if enabled
18627
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18628
+ swarm$1.loggerService.log(METHOD_NAME$13, {
18629
+ clientId,
18630
+ METHOD_NAME: METHOD_NAME$13,
18631
+ });
18632
+ // Validate the session exists and retrieve the associated swarm
18633
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$13);
18634
+ const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18635
+ // Validate the swarm configuration
18636
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$13);
18637
+ // Commit the stop of the next tool execution via SessionPublicService without agent checks
18638
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$13, clientId, swarmName);
18639
+ });
18640
+ /**
18641
+ * Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
18642
+ * Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
18643
+ * Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
18644
+ * Integrates with SessionValidationService (session and swarm retrieval), SwarmValidationService (swarm validation),
18645
+ * SessionPublicService (tool execution stop), ToolValidationService (tool context), and LoggerService (logging).
18646
+ * Unlike commitStopTools, this function skips agent validation and active agent checks, providing a more aggressive stop mechanism,
18647
+ * analogous to commitFlushForce vs. commitFlush.
18648
+ *
18649
+ * @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
18650
+ * @param {string} agentName - The name of the agent (unused in this implementation, included for interface consistency with commitStopTools).
18651
+ * @returns {Promise<void>} A promise that resolves when the tool stop is committed.
18652
+ * @throws {Error} If session or swarm validation fails, propagated from respective validation services.
18653
+ */
18654
+ async function commitStopToolsForce(clientId) {
18655
+ return await commitStopToolsForceInternal(clientId);
18656
+ }
18657
+
18658
+ const METHOD_NAME$12 = "function.template.navigateToTriageAgent";
18564
18659
  /**
18565
18660
  * Will send tool output directly to the model without any additions
18566
18661
  */
@@ -18611,13 +18706,14 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
18611
18706
  */
18612
18707
  return beginContext(async (toolId, clientId) => {
18613
18708
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18614
- swarm$1.loggerService.log(METHOD_NAME$13, {
18709
+ swarm$1.loggerService.log(METHOD_NAME$12, {
18615
18710
  clientId,
18616
18711
  toolId,
18617
18712
  });
18618
18713
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18619
18714
  const { defaultAgent } = swarm$1.swarmSchemaService.get(swarmName);
18620
18715
  const lastAgent = await getAgentName(clientId);
18716
+ await commitStopToolsForce(clientId);
18621
18717
  if (await not(hasNavigation(clientId, defaultAgent))) {
18622
18718
  const lastMessage = await getLastUserMessage(clientId);
18623
18719
  await changeToDefaultAgent(clientId);
@@ -18643,7 +18739,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
18643
18739
  });
18644
18740
  };
18645
18741
 
18646
- const METHOD_NAME$12 = "function.navigate.changeToAgent";
18742
+ const METHOD_NAME$11 = "function.navigate.changeToAgent";
18647
18743
  /**
18648
18744
  * Creates a change agent function with time-to-live (TTL) and queuing capabilities.
18649
18745
  *
@@ -18667,7 +18763,7 @@ const createChangeToAgent = memoize(([clientId]) => `${clientId}`, (clientId) =>
18667
18763
  }));
18668
18764
  {
18669
18765
  // Dispose of the current agent's resources and set up the new agent
18670
- const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$12, clientId, swarmName);
18766
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$11, clientId, swarmName);
18671
18767
  await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
18672
18768
  await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
18673
18769
  await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
@@ -18695,16 +18791,16 @@ const createGc$2 = singleshot(async () => {
18695
18791
  const changeToAgentInternal = beginContext(async (agentName, clientId) => {
18696
18792
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18697
18793
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18698
- swarm$1.loggerService.log(METHOD_NAME$12, {
18794
+ swarm$1.loggerService.log(METHOD_NAME$11, {
18699
18795
  agentName,
18700
18796
  clientId,
18701
18797
  });
18702
18798
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
18703
18799
  {
18704
18800
  // Validate session, agent, and dependencies
18705
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
18706
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$12);
18707
- const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$12, clientId, swarmName);
18801
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$11);
18802
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$11);
18803
+ const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$11, clientId, swarmName);
18708
18804
  if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
18709
18805
  console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
18710
18806
  }
@@ -18722,7 +18818,7 @@ const changeToAgentInternal = beginContext(async (agentName, clientId) => {
18722
18818
  // Execute the agent change with TTL and queuing
18723
18819
  const run = await createChangeToAgent(clientId);
18724
18820
  createGc$2();
18725
- return await run(METHOD_NAME$12, agentName, swarmName);
18821
+ return await run(METHOD_NAME$11, agentName, swarmName);
18726
18822
  });
18727
18823
  /**
18728
18824
  * Changes the active agent for a given client session in a swarm.
@@ -18742,7 +18838,7 @@ async function changeToAgent(agentName, clientId) {
18742
18838
  return await changeToAgentInternal(agentName, clientId);
18743
18839
  }
18744
18840
 
18745
- const METHOD_NAME$11 = "function.template.navigateToAgent";
18841
+ const METHOD_NAME$10 = "function.template.navigateToAgent";
18746
18842
  /**
18747
18843
  * Will send tool output directly to the model without any additions
18748
18844
  */
@@ -18808,12 +18904,13 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
18808
18904
  */
18809
18905
  return beginContext(async (toolId, clientId, agentName) => {
18810
18906
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18811
- swarm$1.loggerService.log(METHOD_NAME$11, {
18907
+ swarm$1.loggerService.log(METHOD_NAME$10, {
18812
18908
  clientId,
18813
18909
  toolId,
18814
18910
  });
18815
18911
  const lastMessage = await getLastUserMessage(clientId);
18816
18912
  const lastAgent = await getAgentName(clientId);
18913
+ await commitStopToolsForce(clientId);
18817
18914
  if (await and(not(hasNavigation(clientId, agentName)), Promise.resolve(!emitMessage))) {
18818
18915
  await commitToolOutputForce(toolId, typeof toolOutput === "string"
18819
18916
  ? toolOutput
@@ -18841,14 +18938,14 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
18841
18938
  });
18842
18939
  };
18843
18940
 
18844
- const METHOD_NAME$10 = "function.setup.addTool";
18941
+ const METHOD_NAME$$ = "function.setup.addTool";
18845
18942
  /**
18846
18943
  * Function implementation
18847
18944
  */
18848
18945
  const addToolInternal = beginContext((toolSchema) => {
18849
18946
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
18850
18947
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18851
- swarm$1.loggerService.log(METHOD_NAME$10, {
18948
+ swarm$1.loggerService.log(METHOD_NAME$$, {
18852
18949
  toolSchema,
18853
18950
  });
18854
18951
  // Register the tool in the validation and schema services
@@ -18883,21 +18980,19 @@ function addTool(toolSchema) {
18883
18980
  * Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
18884
18981
  * @module addAgentNavigation
18885
18982
  */
18886
- const METHOD_NAME$$ = "function.alias.addAgentNavigation";
18887
- const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
18983
+ const METHOD_NAME$_ = "function.alias.addAgentNavigation";
18888
18984
  /**
18889
18985
  * Function implementation
18890
18986
  */
18891
- const addAgentNavigationInternal = beginContext(({ toolName, docNote, description, navigateTo, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER$1, ...navigateProps }) => {
18892
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$$);
18987
+ const addAgentNavigationInternal = beginContext(({ toolName, docNote, description, navigateTo, ...navigateProps }) => {
18988
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$_);
18893
18989
  const navigate = createNavigateToAgent(navigateProps);
18894
- return addTool({
18990
+ const toolSchema = addTool({
18895
18991
  toolName,
18896
18992
  docNote,
18897
- call: async ({ toolId, clientId, isLast }) => {
18898
- if (!isLast) {
18899
- await commitToolOutputForce(toolId, skipPlaceholder, clientId);
18900
- return;
18993
+ call: async ({ toolId, clientId, toolCalls }) => {
18994
+ if (toolCalls.length > 1) {
18995
+ console.error("agent-swarm addAgentNavigation model called multiple tools within navigation execution");
18901
18996
  }
18902
18997
  await navigate(toolId, clientId, navigateTo);
18903
18998
  },
@@ -18912,6 +19007,8 @@ const addAgentNavigationInternal = beginContext(({ toolName, docNote, descriptio
18912
19007
  },
18913
19008
  },
18914
19009
  });
19010
+ swarm$1.navigationSchemaService.register(toolName);
19011
+ return toolSchema;
18915
19012
  });
18916
19013
  /**
18917
19014
  * Creates and registers a navigation tool for an agent to navigate to another specified agent.
@@ -18932,21 +19029,19 @@ function addAgentNavigation(params) {
18932
19029
  * Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
18933
19030
  * @module addTriageNavigation
18934
19031
  */
18935
- const METHOD_NAME$_ = "function.alias.addTriageNavigation";
18936
- const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
19032
+ const METHOD_NAME$Z = "function.alias.addTriageNavigation";
18937
19033
  /**
18938
19034
  * Function implementation
18939
19035
  */
18940
- const addTriageNavigationInternal = beginContext(({ toolName, docNote, description, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER, ...navigateProps }) => {
18941
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$_);
19036
+ const addTriageNavigationInternal = beginContext(({ toolName, docNote, description, ...navigateProps }) => {
19037
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Z);
18942
19038
  const navigate = createNavigateToTriageAgent(navigateProps);
18943
- return addTool({
19039
+ const toolSchema = addTool({
18944
19040
  toolName,
18945
19041
  docNote,
18946
- call: async ({ toolId, clientId, isLast }) => {
18947
- if (!isLast) {
18948
- await commitToolOutputForce(toolId, skipPlaceholder, clientId);
18949
- return;
19042
+ call: async ({ toolId, clientId, toolCalls }) => {
19043
+ if (toolCalls.length > 1) {
19044
+ console.error("agent-swarm addTriageNavigation model called multiple tools within navigation execution");
18950
19045
  }
18951
19046
  await navigate(toolId, clientId);
18952
19047
  },
@@ -18961,6 +19056,8 @@ const addTriageNavigationInternal = beginContext(({ toolName, docNote, descripti
18961
19056
  },
18962
19057
  },
18963
19058
  });
19059
+ swarm$1.navigationSchemaService.register(toolName);
19060
+ return toolSchema;
18964
19061
  });
18965
19062
  /**
18966
19063
  * Creates and registers a triage navigation tool for an agent to navigate to a triage agent.
@@ -18977,13 +19074,13 @@ function addTriageNavigation(params) {
18977
19074
  }
18978
19075
 
18979
19076
  /** @constant {string} METHOD_NAME - The name of the method used for logging */
18980
- const METHOD_NAME$Z = "function.setup.addWiki";
19077
+ const METHOD_NAME$Y = "function.setup.addWiki";
18981
19078
  /**
18982
19079
  * Function implementation
18983
19080
  */
18984
19081
  const addWikiInternal = beginContext((wikiSchema) => {
18985
19082
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
18986
- swarm$1.loggerService.log(METHOD_NAME$Z, {
19083
+ swarm$1.loggerService.log(METHOD_NAME$Y, {
18987
19084
  wikiSchema,
18988
19085
  });
18989
19086
  swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
@@ -19070,14 +19167,14 @@ const mapAgentSchema = ({ system, systemDynamic, systemStatic, ...schema }) => r
19070
19167
  : systemDynamic,
19071
19168
  });
19072
19169
 
19073
- const METHOD_NAME$Y = "function.setup.addAgent";
19170
+ const METHOD_NAME$X = "function.setup.addAgent";
19074
19171
  /**
19075
19172
  * Function implementation
19076
19173
  */
19077
19174
  const addAgentInternal = beginContext((publicAgentSchema) => {
19078
19175
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19079
19176
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19080
- swarm$1.loggerService.log(METHOD_NAME$Y, {
19177
+ swarm$1.loggerService.log(METHOD_NAME$X, {
19081
19178
  agentSchema: publicAgentSchema,
19082
19179
  });
19083
19180
  const agentSchema = mapAgentSchema(publicAgentSchema);
@@ -19107,14 +19204,14 @@ function addAgent(agentSchema) {
19107
19204
  return addAgentInternal(agentSchema);
19108
19205
  }
19109
19206
 
19110
- const METHOD_NAME$X = "function.setup.addCompletion";
19207
+ const METHOD_NAME$W = "function.setup.addCompletion";
19111
19208
  /**
19112
19209
  * Function implementation
19113
19210
  */
19114
19211
  const addCompletionInternal = beginContext((completionSchema) => {
19115
19212
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19116
19213
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19117
- swarm$1.loggerService.log(METHOD_NAME$X, {
19214
+ swarm$1.loggerService.log(METHOD_NAME$W, {
19118
19215
  completionSchema,
19119
19216
  });
19120
19217
  // Register the completion in the validation and schema services
@@ -19143,14 +19240,14 @@ function addCompletion(completionSchema) {
19143
19240
  return addCompletionInternal(completionSchema);
19144
19241
  }
19145
19242
 
19146
- const METHOD_NAME$W = "function.setup.addSwarm";
19243
+ const METHOD_NAME$V = "function.setup.addSwarm";
19147
19244
  /**
19148
19245
  * Function implementation
19149
19246
  */
19150
19247
  const addSwarmInternal = beginContext((swarmSchema) => {
19151
19248
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19152
19249
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19153
- swarm$1.loggerService.log(METHOD_NAME$W, {
19250
+ swarm$1.loggerService.log(METHOD_NAME$V, {
19154
19251
  swarmSchema,
19155
19252
  });
19156
19253
  // Register the swarm in the validation and schema services
@@ -19179,13 +19276,13 @@ function addSwarm(swarmSchema) {
19179
19276
  return addSwarmInternal(swarmSchema);
19180
19277
  }
19181
19278
 
19182
- const METHOD_NAME$V = "function.setup.addMCP";
19279
+ const METHOD_NAME$U = "function.setup.addMCP";
19183
19280
  /**
19184
19281
  * Function implementation
19185
19282
  */
19186
19283
  const addMCPInternal = beginContext((mcpSchema) => {
19187
19284
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19188
- swarm$1.loggerService.log(METHOD_NAME$V, {
19285
+ swarm$1.loggerService.log(METHOD_NAME$U, {
19189
19286
  mcpSchema,
19190
19287
  });
19191
19288
  swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
@@ -19201,14 +19298,14 @@ function addMCP(mcpSchema) {
19201
19298
  return addMCPInternal(mcpSchema);
19202
19299
  }
19203
19300
 
19204
- const METHOD_NAME$U = "function.setup.addState";
19301
+ const METHOD_NAME$T = "function.setup.addState";
19205
19302
  /**
19206
19303
  * Function implementation
19207
19304
  */
19208
19305
  const addStateInternal = beginContext((stateSchema) => {
19209
19306
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19210
19307
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19211
- swarm$1.loggerService.log(METHOD_NAME$U, {
19308
+ swarm$1.loggerService.log(METHOD_NAME$T, {
19212
19309
  stateSchema,
19213
19310
  });
19214
19311
  // Register the policy with StateValidationService for runtime validation
@@ -19246,14 +19343,14 @@ function addState(stateSchema) {
19246
19343
  return addStateInternal(stateSchema);
19247
19344
  }
19248
19345
 
19249
- const METHOD_NAME$T = "function.setup.addEmbedding";
19346
+ const METHOD_NAME$S = "function.setup.addEmbedding";
19250
19347
  /**
19251
19348
  * Function implementation
19252
19349
  */
19253
19350
  const addEmbeddingInternal = beginContext((embeddingSchema) => {
19254
19351
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19255
19352
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19256
- swarm$1.loggerService.log(METHOD_NAME$T, {
19353
+ swarm$1.loggerService.log(METHOD_NAME$S, {
19257
19354
  embeddingSchema,
19258
19355
  });
19259
19356
  // Register the embedding in the validation and schema services
@@ -19282,14 +19379,14 @@ function addEmbedding(embeddingSchema) {
19282
19379
  return addEmbeddingInternal(embeddingSchema);
19283
19380
  }
19284
19381
 
19285
- const METHOD_NAME$S = "function.setup.addStorage";
19382
+ const METHOD_NAME$R = "function.setup.addStorage";
19286
19383
  /**
19287
19384
  * Function implementation
19288
19385
  */
19289
19386
  const addStorageInternal = beginContext((storageSchema) => {
19290
19387
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19291
19388
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19292
- swarm$1.loggerService.log(METHOD_NAME$S, {
19389
+ swarm$1.loggerService.log(METHOD_NAME$R, {
19293
19390
  storageSchema,
19294
19391
  });
19295
19392
  // Register the storage in the validation and schema services
@@ -19327,14 +19424,14 @@ function addStorage(storageSchema) {
19327
19424
  }
19328
19425
 
19329
19426
  /** @private Constant defining the method name for logging and validation context */
19330
- const METHOD_NAME$R = "function.setup.addPolicy";
19427
+ const METHOD_NAME$Q = "function.setup.addPolicy";
19331
19428
  /**
19332
19429
  * Function implementation
19333
19430
  */
19334
19431
  const addPolicyInternal = beginContext((policySchema) => {
19335
19432
  // Log the policy addition attempt if enabled
19336
19433
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19337
- swarm$1.loggerService.log(METHOD_NAME$R, {
19434
+ swarm$1.loggerService.log(METHOD_NAME$Q, {
19338
19435
  policySchema,
19339
19436
  });
19340
19437
  // Register the policy with PolicyValidationService for runtime validation
@@ -19395,13 +19492,13 @@ function addCompute(computeSchema) {
19395
19492
  * @description Method name for the addPipeline operation.
19396
19493
  * @private
19397
19494
  */
19398
- const METHOD_NAME$Q = "function.setup.addPipeline";
19495
+ const METHOD_NAME$P = "function.setup.addPipeline";
19399
19496
  /**
19400
19497
  * Function implementation
19401
19498
  */
19402
19499
  const addPipelineInternal = beginContext((pipelineSchema) => {
19403
19500
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19404
- swarm$1.loggerService.log(METHOD_NAME$Q, {
19501
+ swarm$1.loggerService.log(METHOD_NAME$P, {
19405
19502
  pipelineSchema,
19406
19503
  });
19407
19504
  swarm$1.pipelineValidationService.addPipeline(pipelineSchema.pipelineName, pipelineSchema);
@@ -19418,13 +19515,13 @@ function addPipeline(pipelineSchema) {
19418
19515
  return addPipelineInternal(pipelineSchema);
19419
19516
  }
19420
19517
 
19421
- const METHOD_NAME$P = "function.test.overrideAgent";
19518
+ const METHOD_NAME$O = "function.test.overrideAgent";
19422
19519
  /**
19423
19520
  * Function implementation
19424
19521
  */
19425
19522
  const overrideAgentInternal = beginContext((publicAgentSchema) => {
19426
19523
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19427
- swarm$1.loggerService.log(METHOD_NAME$P, {
19524
+ swarm$1.loggerService.log(METHOD_NAME$O, {
19428
19525
  agentSchema: publicAgentSchema,
19429
19526
  });
19430
19527
  const agentSchema = mapAgentSchema(publicAgentSchema);
@@ -19455,13 +19552,13 @@ function overrideAgent(agentSchema) {
19455
19552
  return overrideAgentInternal(agentSchema);
19456
19553
  }
19457
19554
 
19458
- const METHOD_NAME$O = "function.test.overrideCompletion";
19555
+ const METHOD_NAME$N = "function.test.overrideCompletion";
19459
19556
  /**
19460
19557
  * Function implementation
19461
19558
  */
19462
19559
  const overrideCompletionInternal = beginContext((completionSchema) => {
19463
19560
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19464
- swarm$1.loggerService.log(METHOD_NAME$O, {
19561
+ swarm$1.loggerService.log(METHOD_NAME$N, {
19465
19562
  completionSchema,
19466
19563
  });
19467
19564
  return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
@@ -19491,13 +19588,13 @@ function overrideCompletion(completionSchema) {
19491
19588
  return overrideCompletionInternal(completionSchema);
19492
19589
  }
19493
19590
 
19494
- const METHOD_NAME$N = "function.test.overrideEmbeding";
19591
+ const METHOD_NAME$M = "function.test.overrideEmbeding";
19495
19592
  /**
19496
19593
  * Function implementation
19497
19594
  */
19498
19595
  const overrideEmbedingInternal = beginContext((embeddingSchema) => {
19499
19596
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19500
- swarm$1.loggerService.log(METHOD_NAME$N, {
19597
+ swarm$1.loggerService.log(METHOD_NAME$M, {
19501
19598
  embeddingSchema,
19502
19599
  });
19503
19600
  return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
@@ -19529,13 +19626,13 @@ function overrideEmbeding(embeddingSchema) {
19529
19626
  return overrideEmbedingInternal(embeddingSchema);
19530
19627
  }
19531
19628
 
19532
- const METHOD_NAME$M = "function.test.overridePolicy";
19629
+ const METHOD_NAME$L = "function.test.overridePolicy";
19533
19630
  /**
19534
19631
  * Function implementation
19535
19632
  */
19536
19633
  const overridePolicyInternal = beginContext((policySchema) => {
19537
19634
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19538
- swarm$1.loggerService.log(METHOD_NAME$M, {
19635
+ swarm$1.loggerService.log(METHOD_NAME$L, {
19539
19636
  policySchema,
19540
19637
  });
19541
19638
  return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
@@ -19565,13 +19662,13 @@ function overridePolicy(policySchema) {
19565
19662
  return overridePolicyInternal(policySchema);
19566
19663
  }
19567
19664
 
19568
- const METHOD_NAME$L = "function.test.overrideState";
19665
+ const METHOD_NAME$K = "function.test.overrideState";
19569
19666
  /**
19570
19667
  * Function implementation
19571
19668
  */
19572
19669
  const overrideStateInternal = beginContext((stateSchema) => {
19573
19670
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19574
- swarm$1.loggerService.log(METHOD_NAME$L, {
19671
+ swarm$1.loggerService.log(METHOD_NAME$K, {
19575
19672
  stateSchema,
19576
19673
  });
19577
19674
  return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
@@ -19602,13 +19699,13 @@ function overrideState(stateSchema) {
19602
19699
  return overrideStateInternal(stateSchema);
19603
19700
  }
19604
19701
 
19605
- const METHOD_NAME$K = "function.test.overrideStorage";
19702
+ const METHOD_NAME$J = "function.test.overrideStorage";
19606
19703
  /**
19607
19704
  * Function implementation
19608
19705
  */
19609
19706
  const overrideStorageInternal = beginContext((storageSchema) => {
19610
19707
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19611
- swarm$1.loggerService.log(METHOD_NAME$K, {
19708
+ swarm$1.loggerService.log(METHOD_NAME$J, {
19612
19709
  storageSchema,
19613
19710
  });
19614
19711
  return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
@@ -19640,13 +19737,13 @@ function overrideStorage(storageSchema) {
19640
19737
  return overrideStorageInternal(storageSchema);
19641
19738
  }
19642
19739
 
19643
- const METHOD_NAME$J = "function.test.overrideSwarm";
19740
+ const METHOD_NAME$I = "function.test.overrideSwarm";
19644
19741
  /**
19645
19742
  * Function implementation
19646
19743
  */
19647
19744
  const overrideSwarmInternal = beginContext((swarmSchema) => {
19648
19745
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19649
- swarm$1.loggerService.log(METHOD_NAME$J, {
19746
+ swarm$1.loggerService.log(METHOD_NAME$I, {
19650
19747
  swarmSchema,
19651
19748
  });
19652
19749
  return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
@@ -19676,13 +19773,13 @@ function overrideSwarm(swarmSchema) {
19676
19773
  return overrideSwarmInternal(swarmSchema);
19677
19774
  }
19678
19775
 
19679
- const METHOD_NAME$I = "function.test.overrideTool";
19776
+ const METHOD_NAME$H = "function.test.overrideTool";
19680
19777
  /**
19681
19778
  * Function implementation
19682
19779
  */
19683
19780
  const overrideToolInternal = beginContext((toolSchema) => {
19684
19781
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19685
- swarm$1.loggerService.log(METHOD_NAME$I, {
19782
+ swarm$1.loggerService.log(METHOD_NAME$H, {
19686
19783
  toolSchema,
19687
19784
  });
19688
19785
  return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
@@ -19712,13 +19809,13 @@ function overrideTool(toolSchema) {
19712
19809
  return overrideToolInternal(toolSchema);
19713
19810
  }
19714
19811
 
19715
- const METHOD_NAME$H = "function.test.overrideMCP";
19812
+ const METHOD_NAME$G = "function.test.overrideMCP";
19716
19813
  /**
19717
19814
  * Function implementation
19718
19815
  */
19719
19816
  const overrideMCPInternal = beginContext((mcpSchema) => {
19720
19817
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19721
- swarm$1.loggerService.log(METHOD_NAME$H, {
19818
+ swarm$1.loggerService.log(METHOD_NAME$G, {
19722
19819
  mcpSchema,
19723
19820
  });
19724
19821
  return swarm$1.mcpSchemaService.override(mcpSchema.mcpName, mcpSchema);
@@ -19732,13 +19829,13 @@ function overrideMCP(mcpSchema) {
19732
19829
  return overrideMCPInternal(mcpSchema);
19733
19830
  }
19734
19831
 
19735
- const METHOD_NAME$G = "function.test.overrideWiki";
19832
+ const METHOD_NAME$F = "function.test.overrideWiki";
19736
19833
  /**
19737
19834
  * Function implementation
19738
19835
  */
19739
19836
  const overrideWikiInternal = beginContext((wikiSchema) => {
19740
19837
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19741
- swarm$1.loggerService.log(METHOD_NAME$G, {
19838
+ swarm$1.loggerService.log(METHOD_NAME$F, {
19742
19839
  wikiSchema,
19743
19840
  });
19744
19841
  return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
@@ -19777,13 +19874,13 @@ function overrideWiki(wikiSchema) {
19777
19874
  * @description Method name for the overrideCompute operation.
19778
19875
  * @private
19779
19876
  */
19780
- const METHOD_NAME$F = "function.test.overrideCompute";
19877
+ const METHOD_NAME$E = "function.test.overrideCompute";
19781
19878
  /**
19782
19879
  * Function implementation
19783
19880
  */
19784
19881
  const overrideComputeInternal = beginContext((computeSchema) => {
19785
19882
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19786
- swarm$1.loggerService.log(METHOD_NAME$F, {
19883
+ swarm$1.loggerService.log(METHOD_NAME$E, {
19787
19884
  computeSchema,
19788
19885
  });
19789
19886
  return swarm$1.computeSchemaService.override(computeSchema.computeName, computeSchema);
@@ -19806,13 +19903,13 @@ function overrideCompute(computeSchema) {
19806
19903
  * @description Method name for the overridePipeline operation.
19807
19904
  * @private
19808
19905
  */
19809
- const METHOD_NAME$E = "function.test.overridePipeline";
19906
+ const METHOD_NAME$D = "function.test.overridePipeline";
19810
19907
  /**
19811
19908
  * Function implementation
19812
19909
  */
19813
19910
  const overridePipelineInternal = beginContext((pipelineSchema) => {
19814
19911
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19815
- swarm$1.loggerService.log(METHOD_NAME$E, {
19912
+ swarm$1.loggerService.log(METHOD_NAME$D, {
19816
19913
  pipelineSchema,
19817
19914
  });
19818
19915
  return swarm$1.pipelineSchemaService.override(pipelineSchema.pipelineName, pipelineSchema);
@@ -19827,23 +19924,23 @@ function overridePipeline(pipelineSchema) {
19827
19924
  return overridePipelineInternal(pipelineSchema);
19828
19925
  }
19829
19926
 
19830
- const METHOD_NAME$D = "function.other.markOnline";
19927
+ const METHOD_NAME$C = "function.other.markOnline";
19831
19928
  /**
19832
19929
  * Function implementation
19833
19930
  */
19834
19931
  const markOnlineInternal = async (clientId, swarmName) => {
19835
19932
  // Log the operation if logging is enabled in the global configuration
19836
19933
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19837
- swarm.loggerService.log(METHOD_NAME$D, {
19934
+ swarm.loggerService.log(METHOD_NAME$C, {
19838
19935
  clientId,
19839
19936
  });
19840
19937
  // Validate the swarm name
19841
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$D);
19938
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$C);
19842
19939
  // Run the operation in the method context
19843
19940
  return await MethodContextService.runInContext(async () => {
19844
- await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$D);
19941
+ await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$C);
19845
19942
  }, {
19846
- methodName: METHOD_NAME$D,
19943
+ methodName: METHOD_NAME$C,
19847
19944
  agentName: "",
19848
19945
  policyName: "",
19849
19946
  stateName: "",
@@ -19866,20 +19963,20 @@ async function markOnline(clientId, swarmName) {
19866
19963
  return await markOnlineInternal(clientId, swarmName);
19867
19964
  }
19868
19965
 
19869
- const METHOD_NAME$C = "function.other.markOffline";
19966
+ const METHOD_NAME$B = "function.other.markOffline";
19870
19967
  /**
19871
19968
  * Function implementation
19872
19969
  */
19873
19970
  const markOfflineInternal = async (clientId, swarmName) => {
19874
19971
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19875
- swarm.loggerService.log(METHOD_NAME$C, {
19972
+ swarm.loggerService.log(METHOD_NAME$B, {
19876
19973
  clientId,
19877
19974
  });
19878
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$C);
19975
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$B);
19879
19976
  return await MethodContextService.runInContext(async () => {
19880
- await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$C);
19977
+ await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$B);
19881
19978
  }, {
19882
- methodName: METHOD_NAME$C,
19979
+ methodName: METHOD_NAME$B,
19883
19980
  agentName: "",
19884
19981
  policyName: "",
19885
19982
  stateName: "",
@@ -19907,27 +20004,27 @@ async function markOffline(clientId, swarmName) {
19907
20004
  }
19908
20005
 
19909
20006
  /** @private Constant defining the method name for logging and validation context */
19910
- const METHOD_NAME$B = "function.commit.commitSystemMessage";
20007
+ const METHOD_NAME$A = "function.commit.commitSystemMessage";
19911
20008
  /**
19912
20009
  * Function implementation
19913
20010
  */
19914
20011
  const commitSystemMessageInternal = beginContext(async (content, clientId, agentName) => {
19915
20012
  // Log the commit attempt if enabled
19916
20013
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19917
- swarm$1.loggerService.log(METHOD_NAME$B, {
20014
+ swarm$1.loggerService.log(METHOD_NAME$A, {
19918
20015
  content,
19919
20016
  clientId,
19920
20017
  agentName,
19921
20018
  });
19922
20019
  // Validate the agent exists
19923
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
20020
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$A);
19924
20021
  // Validate the session exists and retrieve the associated swarm
19925
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
20022
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
19926
20023
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19927
20024
  // Validate the swarm configuration
19928
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
20025
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
19929
20026
  // Check if the current agent matches the provided agent
19930
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName);
20027
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$A, clientId, swarmName);
19931
20028
  if (currentAgentName !== agentName) {
19932
20029
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19933
20030
  swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
@@ -19938,7 +20035,7 @@ const commitSystemMessageInternal = beginContext(async (content, clientId, agent
19938
20035
  return;
19939
20036
  }
19940
20037
  // Commit the system message via SessionPublicService
19941
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$B, clientId, swarmName);
20038
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$A, clientId, swarmName);
19942
20039
  });
19943
20040
  /**
19944
20041
  * Commits a system-generated message to the active agent in the swarm system.
@@ -19959,26 +20056,26 @@ async function commitSystemMessage(content, clientId, agentName) {
19959
20056
  return await commitSystemMessageInternal(content, clientId, agentName);
19960
20057
  }
19961
20058
 
19962
- const METHOD_NAME$A = "function.commit.commitSystemMessage";
20059
+ const METHOD_NAME$z = "function.commit.commitSystemMessage";
19963
20060
  /**
19964
20061
  * Function implementation
19965
20062
  */
19966
20063
  const commitUserMessageInternal = beginContext(async (content, mode, clientId, agentName, payload) => {
19967
20064
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
19968
20065
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
19969
- swarm$1.loggerService.log(METHOD_NAME$A, {
20066
+ swarm$1.loggerService.log(METHOD_NAME$z, {
19970
20067
  content,
19971
20068
  clientId,
19972
20069
  agentName,
19973
20070
  mode,
19974
20071
  });
19975
20072
  // Validate the agent, session, and swarm to ensure they exist and are accessible
19976
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$A);
19977
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
20073
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$z);
20074
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
19978
20075
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
19979
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
20076
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
19980
20077
  // Check if the specified agent is still the active agent in the swarm session
19981
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$A, clientId, swarmName);
20078
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$z, clientId, swarmName);
19982
20079
  if (currentAgentName !== agentName) {
19983
20080
  // Log a skip message if the agent has changed during the operation
19984
20081
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -19991,14 +20088,14 @@ const commitUserMessageInternal = beginContext(async (content, mode, clientId, a
19991
20088
  }
19992
20089
  if (payload) {
19993
20090
  return await PayloadContextService.runInContext(async () => {
19994
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$A, clientId, swarmName);
20091
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$z, clientId, swarmName);
19995
20092
  }, {
19996
20093
  clientId,
19997
20094
  payload,
19998
20095
  });
19999
20096
  }
20000
20097
  // Commit the user message to the agent's history via the session public service
20001
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$A, clientId, swarmName);
20098
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$z, clientId, swarmName);
20002
20099
  });
20003
20100
  /**
20004
20101
  * Commits a user message to the active agent's history in a swarm session without triggering a response.
@@ -20020,24 +20117,24 @@ async function commitUserMessage(content, mode, clientId, agentName, payload) {
20020
20117
  }
20021
20118
 
20022
20119
  /** @private Constant defining the method name for logging and validation context */
20023
- const METHOD_NAME$z = "function.commit.commitSystemMessageForce";
20120
+ const METHOD_NAME$y = "function.commit.commitSystemMessageForce";
20024
20121
  /**
20025
20122
  * Function implementation
20026
20123
  */
20027
20124
  const commitSystemMessageForceInternal = beginContext(async (content, clientId) => {
20028
20125
  // Log the commit attempt if enabled
20029
20126
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20030
- swarm$1.loggerService.log(METHOD_NAME$z, {
20127
+ swarm$1.loggerService.log(METHOD_NAME$y, {
20031
20128
  content,
20032
20129
  clientId,
20033
20130
  });
20034
20131
  // Validate the session exists and retrieve the associated swarm
20035
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
20132
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
20036
20133
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20037
20134
  // Validate the swarm configuration
20038
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
20135
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
20039
20136
  // Commit the system message via SessionPublicService without agent checks
20040
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$z, clientId, swarmName);
20137
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$y, clientId, swarmName);
20041
20138
  });
20042
20139
  /**
20043
20140
  * Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
@@ -20058,32 +20155,32 @@ async function commitSystemMessageForce(content, clientId) {
20058
20155
  return await commitSystemMessageForceInternal(content, clientId);
20059
20156
  }
20060
20157
 
20061
- const METHOD_NAME$y = "function.commit.commitSystemMessage";
20158
+ const METHOD_NAME$x = "function.commit.commitSystemMessage";
20062
20159
  /**
20063
20160
  * Function implementation
20064
20161
  */
20065
20162
  const commitUserMessageForceInternal = beginContext(async (content, mode, clientId, payload) => {
20066
20163
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
20067
20164
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20068
- swarm$1.loggerService.log(METHOD_NAME$y, {
20165
+ swarm$1.loggerService.log(METHOD_NAME$x, {
20069
20166
  content,
20070
20167
  clientId,
20071
20168
  mode,
20072
20169
  });
20073
20170
  // Validate the session and swarm to ensure they exist and are accessible
20074
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
20171
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
20075
20172
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20076
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
20173
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
20077
20174
  if (payload) {
20078
20175
  return await PayloadContextService.runInContext(async () => {
20079
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
20176
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$x, clientId, swarmName);
20080
20177
  }, {
20081
20178
  clientId,
20082
20179
  payload,
20083
20180
  });
20084
20181
  }
20085
20182
  // Commit the user message to the agent's history via the session public service without checking the active agent
20086
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
20183
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$x, clientId, swarmName);
20087
20184
  });
20088
20185
  /**
20089
20186
  * Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
@@ -20104,27 +20201,27 @@ async function commitUserMessageForce(content, mode, clientId, payload) {
20104
20201
  }
20105
20202
 
20106
20203
  /** @private Constant defining the method name for logging and validation context */
20107
- const METHOD_NAME$x = "function.commit.commitAssistantMessage";
20204
+ const METHOD_NAME$w = "function.commit.commitAssistantMessage";
20108
20205
  /**
20109
20206
  * Function implementation
20110
20207
  */
20111
20208
  const commitAssistantMessageInternal = beginContext(async (content, clientId, agentName) => {
20112
20209
  // Log the commit attempt if enabled
20113
20210
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20114
- swarm$1.loggerService.log(METHOD_NAME$x, {
20211
+ swarm$1.loggerService.log(METHOD_NAME$w, {
20115
20212
  content,
20116
20213
  clientId,
20117
20214
  agentName,
20118
20215
  });
20119
20216
  // Validate the agent exists
20120
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
20217
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
20121
20218
  // Validate the session exists and retrieve the associated swarm
20122
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
20219
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
20123
20220
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20124
20221
  // Validate the swarm configuration
20125
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
20222
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
20126
20223
  // Check if the current agent matches the provided agent
20127
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
20224
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName);
20128
20225
  if (currentAgentName !== agentName) {
20129
20226
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20130
20227
  swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
@@ -20135,7 +20232,7 @@ const commitAssistantMessageInternal = beginContext(async (content, clientId, ag
20135
20232
  return;
20136
20233
  }
20137
20234
  // Commit the assistant message via SessionPublicService
20138
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$x, clientId, swarmName);
20235
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName);
20139
20236
  });
20140
20237
  /**
20141
20238
  * Commits an assistant-generated message to the active agent in the swarm system.
@@ -20156,24 +20253,24 @@ async function commitAssistantMessage(content, clientId, agentName) {
20156
20253
  }
20157
20254
 
20158
20255
  /** @private Constant defining the method name for logging and validation context */
20159
- const METHOD_NAME$w = "function.commit.commitAssistantMessageForce";
20256
+ const METHOD_NAME$v = "function.commit.commitAssistantMessageForce";
20160
20257
  /**
20161
20258
  * Function implementation
20162
20259
  */
20163
20260
  const commitAssistantMessageForceInternal = beginContext(async (content, clientId) => {
20164
20261
  // Log the commit attempt if enabled
20165
20262
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20166
- swarm$1.loggerService.log(METHOD_NAME$w, {
20263
+ swarm$1.loggerService.log(METHOD_NAME$v, {
20167
20264
  content,
20168
20265
  clientId,
20169
20266
  });
20170
20267
  // Validate the session exists and retrieve the associated swarm
20171
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
20268
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
20172
20269
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20173
20270
  // Validate the swarm configuration
20174
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
20271
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
20175
20272
  // Commit the assistant message via SessionPublicService without agent checks
20176
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName);
20273
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$v, clientId, swarmName);
20177
20274
  });
20178
20275
  /**
20179
20276
  * Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
@@ -20195,26 +20292,26 @@ async function commitAssistantMessageForce(content, clientId) {
20195
20292
  }
20196
20293
 
20197
20294
  /** @private Constant defining the method name for logging and validation context */
20198
- const METHOD_NAME$v = "function.commit.cancelOutput";
20295
+ const METHOD_NAME$u = "function.commit.cancelOutput";
20199
20296
  /**
20200
20297
  * Function implementation
20201
20298
  */
20202
20299
  const cancelOutputInternal = beginContext(async (clientId, agentName) => {
20203
20300
  // Log the cancellation attempt if enabled
20204
20301
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20205
- swarm$1.loggerService.log(METHOD_NAME$v, {
20302
+ swarm$1.loggerService.log(METHOD_NAME$u, {
20206
20303
  clientId,
20207
20304
  agentName,
20208
20305
  });
20209
20306
  // Validate the agent exists
20210
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
20307
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$u);
20211
20308
  // Validate the session exists and retrieve the associated swarm
20212
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
20309
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
20213
20310
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20214
20311
  // Validate the swarm configuration
20215
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
20312
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
20216
20313
  // Check if the current agent matches the provided agent
20217
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
20314
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName);
20218
20315
  if (currentAgentName !== agentName) {
20219
20316
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20220
20317
  swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
@@ -20225,7 +20322,7 @@ const cancelOutputInternal = beginContext(async (clientId, agentName) => {
20225
20322
  return;
20226
20323
  }
20227
20324
  // Perform the output cancellation via SwarmPublicService
20228
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$v, clientId, swarmName);
20325
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName);
20229
20326
  });
20230
20327
  /**
20231
20328
  * Cancels the awaited output for a specific client and agent by emitting an empty string.
@@ -20244,23 +20341,23 @@ async function cancelOutput(clientId, agentName) {
20244
20341
  }
20245
20342
 
20246
20343
  /** @private Constant defining the method name for logging and validation context */
20247
- const METHOD_NAME$u = "function.commit.cancelOutputForce";
20344
+ const METHOD_NAME$t = "function.commit.cancelOutputForce";
20248
20345
  /**
20249
20346
  * Function implementation
20250
20347
  */
20251
20348
  const cancelOutputForceInternal = beginContext(async (clientId) => {
20252
20349
  // Log the cancellation attempt if enabled
20253
20350
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20254
- swarm$1.loggerService.log(METHOD_NAME$u, {
20351
+ swarm$1.loggerService.log(METHOD_NAME$t, {
20255
20352
  clientId,
20256
20353
  });
20257
20354
  // Validate the session exists and retrieve the associated swarm
20258
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
20355
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
20259
20356
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20260
20357
  // Validate the swarm configuration
20261
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
20358
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
20262
20359
  // Perform the output cancellation via SwarmPublicService without agent checks
20263
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName);
20360
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$t, clientId, swarmName);
20264
20361
  });
20265
20362
  /**
20266
20363
  * Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
@@ -20279,44 +20376,6 @@ async function cancelOutputForce(clientId) {
20279
20376
  return await cancelOutputForceInternal(clientId);
20280
20377
  }
20281
20378
 
20282
- /** @private Constant defining the method name for logging and validation context */
20283
- const METHOD_NAME$t = "function.commit.commitStopToolsForce";
20284
- /**
20285
- * Function implementation
20286
- */
20287
- const commitStopToolsForceInternal = beginContext(async (clientId) => {
20288
- // Log the stop tools attempt if enabled
20289
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
20290
- swarm$1.loggerService.log(METHOD_NAME$t, {
20291
- clientId,
20292
- METHOD_NAME: METHOD_NAME$t,
20293
- });
20294
- // Validate the session exists and retrieve the associated swarm
20295
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
20296
- const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
20297
- // Validate the swarm configuration
20298
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
20299
- // Commit the stop of the next tool execution via SessionPublicService without agent checks
20300
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$t, clientId, swarmName);
20301
- });
20302
- /**
20303
- * Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
20304
- * Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
20305
- * Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
20306
- * Integrates with SessionValidationService (session and swarm retrieval), SwarmValidationService (swarm validation),
20307
- * SessionPublicService (tool execution stop), ToolValidationService (tool context), and LoggerService (logging).
20308
- * Unlike commitStopTools, this function skips agent validation and active agent checks, providing a more aggressive stop mechanism,
20309
- * analogous to commitFlushForce vs. commitFlush.
20310
- *
20311
- * @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
20312
- * @param {string} agentName - The name of the agent (unused in this implementation, included for interface consistency with commitStopTools).
20313
- * @returns {Promise<void>} A promise that resolves when the tool stop is committed.
20314
- * @throws {Error} If session or swarm validation fails, propagated from respective validation services.
20315
- */
20316
- async function commitStopToolsForce(clientId) {
20317
- return await commitStopToolsForceInternal(clientId);
20318
- }
20319
-
20320
20379
  const METHOD_NAME$s = "function.commit.commitToolRequest";
20321
20380
  /**
20322
20381
  * Function implementation
@@ -23358,9 +23417,10 @@ class ChatUtils {
23358
23417
  const handleCleanup = async () => {
23359
23418
  const now = Date.now();
23360
23419
  for (const chat of this._chats.values()) {
23361
- if (!chat.checkLastActivity(now)) {
23362
- await chat.dispose();
23420
+ if (await chat.checkLastActivity(now)) {
23421
+ continue;
23363
23422
  }
23423
+ await chat.dispose();
23364
23424
  }
23365
23425
  };
23366
23426
  setInterval(handleCleanup, INACTIVITY_CHECK);