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