agent-swarm-kit 1.0.223 → 1.0.224

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
@@ -64,6 +64,7 @@ const schemaServices$1 = {
64
64
  stateSchemaService: Symbol('stateSchemaService'),
65
65
  memorySchemaService: Symbol('memorySchemaService'),
66
66
  policySchemaService: Symbol('policySchemaService'),
67
+ wikiSchemaService: Symbol('wikiSchemaService'),
67
68
  };
68
69
  const metaServices$1 = {
69
70
  agentMetaService: Symbol('agentMetaService'),
@@ -90,6 +91,7 @@ const validationServices$1 = {
90
91
  storageValidationService: Symbol('storageValidationService'),
91
92
  policyValidationService: Symbol('policyValidationService'),
92
93
  navigationValidationService: Symbol('navigationValidationService'),
94
+ wikiValidationService: Symbol('wikiValidationService'),
93
95
  };
94
96
  const TYPES = {
95
97
  ...baseServices$1,
@@ -3137,6 +3139,16 @@ class AgentSchemaService {
3137
3139
  if (agentSchema.storages?.some((value) => typeof value !== "string")) {
3138
3140
  throw new Error(`agent-swarm agent schema validation failed: invalid storages for agentName=${agentSchema.agentName} storages=[${agentSchema.storages}]`);
3139
3141
  }
3142
+ if (agentSchema.wikiList && !Array.isArray(agentSchema.wikiList)) {
3143
+ throw new Error(`agent-swarm agent schema validation failed: invalid wikiList for agentName=${agentSchema.agentName} wikiList=${agentSchema.wikiList}`);
3144
+ }
3145
+ if (agentSchema.wikiList &&
3146
+ agentSchema.wikiList.length !== new Set(agentSchema.wikiList).size) {
3147
+ throw new Error(`agent-swarm agent schema validation failed: found duplicate wikiList for agentName=${agentSchema.agentName} wikiList=[${agentSchema.wikiList}]`);
3148
+ }
3149
+ if (agentSchema.wikiList?.some((value) => typeof value !== "string")) {
3150
+ throw new Error(`agent-swarm agent schema validation failed: invalid wikiList for agentName=${agentSchema.agentName} wikiList=[${agentSchema.wikiList}]`);
3151
+ }
3140
3152
  if (agentSchema.tools && !Array.isArray(agentSchema.tools)) {
3141
3153
  throw new Error(`agent-swarm agent schema validation failed: invalid tools for agentName=${agentSchema.agentName} tools=${agentSchema.tools}`);
3142
3154
  }
@@ -4307,7 +4319,7 @@ class AgentConnectionService {
4307
4319
  }
4308
4320
 
4309
4321
  /** @private Constant defining the method name for logging purposes */
4310
- const METHOD_NAME$Z = "function.common.getPayload";
4322
+ const METHOD_NAME$10 = "function.common.getPayload";
4311
4323
  /**
4312
4324
  * Retrieves the payload from the current PayloadContextService context.
4313
4325
  * Returns null if no context is available. Logs the operation if logging is enabled.
@@ -4318,7 +4330,7 @@ const METHOD_NAME$Z = "function.common.getPayload";
4318
4330
  * console.log(payload); // { id: number } or null
4319
4331
  */
4320
4332
  const getPayload = () => {
4321
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Z);
4333
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$10);
4322
4334
  if (PayloadContextService.hasContext()) {
4323
4335
  const { payload } = swarm$1.payloadContextService.context;
4324
4336
  return payload;
@@ -7618,6 +7630,14 @@ class AgentValidationService {
7618
7630
  * @readonly
7619
7631
  */
7620
7632
  this.toolValidationService = inject(TYPES.toolValidationService);
7633
+ /**
7634
+ * Wiki validation service instance for validating wikies associated with agents.
7635
+ * Injected via DI, used in validate method to check agent wiki list.
7636
+ * @type {WikiValidationService}
7637
+ * @private
7638
+ * @readonly
7639
+ */
7640
+ this.wikiValidationService = inject(TYPES.wikiValidationService);
7621
7641
  /**
7622
7642
  * Completion validation service instance for validating completion configurations of agents.
7623
7643
  * Injected via DI, used in validate method to check agent completion.
@@ -7675,6 +7695,22 @@ class AgentValidationService {
7675
7695
  }
7676
7696
  return this._agentMap.get(agentName).storages || [];
7677
7697
  };
7698
+ /**
7699
+ * Retrieves the list of wiki names associated with a given agent.
7700
+ * @param {AgentName} agentName - The name of the agent to query, sourced from Agent.interface.
7701
+ * @returns {WikiName[]} An array of wikies names from the agent’s schema.
7702
+ * @throws {Error} If the agent is not found in _agentMap.
7703
+ */
7704
+ this.getWikiList = (agentName) => {
7705
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7706
+ this.loggerService.info("agentValidationService getWikiList", {
7707
+ agentName,
7708
+ });
7709
+ if (!this._agentMap.has(agentName)) {
7710
+ throw new Error(`agent-swarm agent ${agentName} not exist (getWikiList)`);
7711
+ }
7712
+ return this._agentMap.get(agentName).wikiList || [];
7713
+ };
7678
7714
  /**
7679
7715
  * Retrieves the list of state names associated with a given agent.
7680
7716
  * Logs the operation and validates agent existence, supporting ClientState integration.
@@ -7733,6 +7769,25 @@ class AgentValidationService {
7733
7769
  const { storages = [] } = this._agentMap.get(agentName);
7734
7770
  return storages.includes(storageName);
7735
7771
  });
7772
+ /**
7773
+ * Checks if an agent has declared wiki
7774
+ * @param {AgentName} agentName - The name of the agent to check, sourced from Agent.interface.
7775
+ * @param {WikiName} wikiName - The name of the wiki to verify, sourced from Wiki.interface.
7776
+ * @returns {boolean} True if the wiki is registered in the agent’s schema, false otherwise.
7777
+ * @throws {Error} If the agent is not found in _agentMap.
7778
+ */
7779
+ this.hasWiki = functoolsKit.memoize(([agentName, wikiName]) => `${agentName}-${wikiName}`, (agentName, wikiName) => {
7780
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
7781
+ this.loggerService.info("agentValidationService hasWiki", {
7782
+ agentName,
7783
+ wikiName,
7784
+ });
7785
+ if (!this._agentMap.has(agentName)) {
7786
+ throw new Error(`agent-swarm agent ${agentName} not exist (hasWiki)`);
7787
+ }
7788
+ const { wikiList = [] } = this._agentMap.get(agentName);
7789
+ return wikiList.includes(wikiName);
7790
+ });
7736
7791
  /**
7737
7792
  * Checks if an agent has a registered dependency on another agent, memoized for performance.
7738
7793
  * Logs the operation, supporting inter-agent dependency validation within SwarmSchemaService.
@@ -7802,6 +7857,12 @@ class AgentValidationService {
7802
7857
  }
7803
7858
  this.storageValidationService.validate(storageName, source);
7804
7859
  });
7860
+ agent.wikiList?.forEach((wikiName) => {
7861
+ if (typeof wikiName !== "string") {
7862
+ throw new Error(`agent-swarm agent ${agentName} storage list is invalid (wikiName=${String(wikiName)}) source=${source}`);
7863
+ }
7864
+ this.wikiValidationService.validate(wikiName, source);
7865
+ });
7805
7866
  });
7806
7867
  }
7807
7868
  }
@@ -10751,6 +10812,13 @@ class DocService {
10751
10812
  * @private
10752
10813
  */
10753
10814
  this.storageSchemaService = inject(TYPES.storageSchemaService);
10815
+ /**
10816
+ * Wiki schema service instance, injected via DI.
10817
+ * Supplies wiki details for writeAgentDoc, documenting wiki resources used by agents.
10818
+ * @type {WikiSchemaService}
10819
+ * @private
10820
+ */
10821
+ this.wikiSchemaService = inject(TYPES.wikiSchemaService);
10754
10822
  /**
10755
10823
  * State schema service instance, injected via DI.
10756
10824
  * Provides state details for writeAgentDoc, documenting state resources used by agents.
@@ -11085,6 +11153,33 @@ class DocService {
11085
11153
  result.push("");
11086
11154
  }
11087
11155
  }
11156
+ if (agentSchema.wikiList) {
11157
+ result.push(`## Used wiki list`);
11158
+ result.push("");
11159
+ for (let i = 0; i !== agentSchema.wikiList.length; i++) {
11160
+ if (!agentSchema.wikiList[i]) {
11161
+ continue;
11162
+ }
11163
+ result.push(`### ${i + 1}. ${agentSchema.wikiList[i]}`);
11164
+ const { docDescription, callbacks } = this.wikiSchemaService.get(agentSchema.wikiList[i]);
11165
+ if (docDescription) {
11166
+ result.push("");
11167
+ result.push(`#### Wiki description`);
11168
+ result.push("");
11169
+ result.push(docDescription);
11170
+ }
11171
+ if (callbacks) {
11172
+ result.push("");
11173
+ result.push(`#### Wiki callbacks`);
11174
+ result.push("");
11175
+ const callbackList = Object.keys(callbacks);
11176
+ for (let i = 0; i !== callbackList.length; i++) {
11177
+ result.push(`${i + 1}. \`${callbackList[i]}\``);
11178
+ }
11179
+ }
11180
+ result.push("");
11181
+ }
11182
+ }
11088
11183
  if (agentSchema.callbacks) {
11089
11184
  result.push(`## Used callbacks`);
11090
11185
  result.push("");
@@ -13322,6 +13417,123 @@ class NavigationValidationService {
13322
13417
  }
13323
13418
  }
13324
13419
 
13420
+ /**
13421
+ * @class WikiSchemaService
13422
+ * @description Service for managing wiki schema registrations and retrieval
13423
+ */
13424
+ class WikiSchemaService {
13425
+ constructor() {
13426
+ /**
13427
+ * @readonly
13428
+ * @description Injected logger service instance
13429
+ */
13430
+ this.loggerService = inject(TYPES.loggerService);
13431
+ /**
13432
+ * @private
13433
+ * @description Registry for storing wiki schemas
13434
+ */
13435
+ this.registry = new functoolsKit.ToolRegistry("wikiSchemaService");
13436
+ /**
13437
+ * Validates basic requirements of a wiki schema
13438
+ * @private
13439
+ * @param {IWikiSchema} wikiSchema - The wiki schema to validate
13440
+ * @throws {Error} If validation fails
13441
+ */
13442
+ this.validateShallow = (wikiSchema) => {
13443
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13444
+ this.loggerService.info(`wikiSchemaService validateShallow`, {
13445
+ wikiSchema,
13446
+ });
13447
+ if (typeof wikiSchema.wikiName !== "string") {
13448
+ throw new Error(`agent-swarm wiki schema validation failed: missing wikiName`);
13449
+ }
13450
+ if (typeof wikiSchema.getChat !== "function") {
13451
+ throw new Error(`agent-swarm wiki schema validation failed: missing getChat for wikiName=${wikiSchema.wikiName}`);
13452
+ }
13453
+ };
13454
+ /**
13455
+ * Registers a wiki schema with a given key
13456
+ * @public
13457
+ * @param {WikiName} key - The key to register the schema under
13458
+ * @param {IWikiSchema} value - The wiki schema to register
13459
+ */
13460
+ this.register = (key, value) => {
13461
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13462
+ this.loggerService.info(`wikiSchemaService register`, { key });
13463
+ this.validateShallow(value);
13464
+ this.registry = this.registry.register(key, value);
13465
+ };
13466
+ /**
13467
+ * Retrieves a wiki schema by key
13468
+ * @public
13469
+ * @param {WikiName} key - The key of the schema to retrieve
13470
+ * @returns {IWikiSchema} The registered wiki schema
13471
+ */
13472
+ this.get = (key) => {
13473
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13474
+ this.loggerService.info(`wikiSchemaService get`, { key });
13475
+ return this.registry.get(key);
13476
+ };
13477
+ }
13478
+ }
13479
+
13480
+ /**
13481
+ * @class WikiValidationService
13482
+ * @description Service for managing and validating wiki configurations
13483
+ */
13484
+ class WikiValidationService {
13485
+ constructor() {
13486
+ /**
13487
+ * @private
13488
+ * @readonly
13489
+ * @description Injected logger service instance
13490
+ */
13491
+ this.loggerService = inject(TYPES.loggerService);
13492
+ /**
13493
+ * @private
13494
+ * @description Map storing wiki schemas by wiki name
13495
+ */
13496
+ this._wikiMap = new Map();
13497
+ /**
13498
+ * Adds a wiki schema to the validation service
13499
+ * @public
13500
+ * @param {WikiName} wikiName - The name of the wiki
13501
+ * @param {IWikiSchema} wikiSchema - The wiki schema to add
13502
+ * @throws {Error} If wikiName already exists
13503
+ */
13504
+ this.addWiki = (wikiName, wikiSchema) => {
13505
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13506
+ this.loggerService.info("wikiValidationService addWiki", {
13507
+ wikiName,
13508
+ wikiSchema,
13509
+ });
13510
+ if (this._wikiMap.has(wikiName)) {
13511
+ throw new Error(`wiki-swarm wiki ${wikiName} already exist`);
13512
+ }
13513
+ this._wikiMap.set(wikiName, wikiSchema);
13514
+ };
13515
+ /**
13516
+ * Validates the existence of a wiki
13517
+ * @public
13518
+ * @param {WikiName} wikiName - The name of the wiki to validate
13519
+ * @param {string} source - The source requesting validation
13520
+ * @throws {Error} If wikiName is not found
13521
+ * @description Memoized function to cache validation results
13522
+ */
13523
+ this.validate = functoolsKit.memoize(([wikiName]) => wikiName, (wikiName, source) => {
13524
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
13525
+ this.loggerService.info("wikiValidationService validate", {
13526
+ wikiName,
13527
+ source,
13528
+ });
13529
+ const wiki = this._wikiMap.get(wikiName);
13530
+ if (!wiki) {
13531
+ throw new Error(`wiki-swarm wiki ${wikiName} not found source=${source}`);
13532
+ }
13533
+ });
13534
+ }
13535
+ }
13536
+
13325
13537
  {
13326
13538
  provide(TYPES.docService, () => new DocService());
13327
13539
  provide(TYPES.busService, () => new BusService());
@@ -13355,6 +13567,7 @@ class NavigationValidationService {
13355
13567
  provide(TYPES.stateSchemaService, () => new StateSchemaService());
13356
13568
  provide(TYPES.memorySchemaService, () => new MemorySchemaService());
13357
13569
  provide(TYPES.policySchemaService, () => new PolicySchemaService());
13570
+ provide(TYPES.wikiSchemaService, () => new WikiSchemaService());
13358
13571
  }
13359
13572
  {
13360
13573
  provide(TYPES.agentPublicService, () => new AgentPublicService());
@@ -13381,6 +13594,7 @@ class NavigationValidationService {
13381
13594
  provide(TYPES.embeddingValidationService, () => new EmbeddingValidationService());
13382
13595
  provide(TYPES.policyValidationService, () => new PolicyValidationService());
13383
13596
  provide(TYPES.navigationValidationService, () => new NavigationValidationService());
13597
+ provide(TYPES.wikiValidationService, () => new WikiValidationService());
13384
13598
  }
13385
13599
 
13386
13600
  const baseServices = {
@@ -13416,6 +13630,7 @@ const schemaServices = {
13416
13630
  stateSchemaService: inject(TYPES.stateSchemaService),
13417
13631
  memorySchemaService: inject(TYPES.memorySchemaService),
13418
13632
  policySchemaService: inject(TYPES.policySchemaService),
13633
+ wikiSchemaService: inject(TYPES.wikiSchemaService),
13419
13634
  };
13420
13635
  const publicServices = {
13421
13636
  agentPublicService: inject(TYPES.agentPublicService),
@@ -13442,6 +13657,7 @@ const validationServices = {
13442
13657
  embeddingValidationService: inject(TYPES.embeddingValidationService),
13443
13658
  policyValidationService: inject(TYPES.policyValidationService),
13444
13659
  navigationValidationService: inject(TYPES.navigationValidationService),
13660
+ wikiValidationService: inject(TYPES.wikiValidationService),
13445
13661
  };
13446
13662
  /** @inheritDoc */
13447
13663
  const swarm = {
@@ -13456,7 +13672,7 @@ const swarm = {
13456
13672
  init();
13457
13673
  var swarm$1 = swarm;
13458
13674
 
13459
- const METHOD_NAME$Y = "cli.dumpDocs";
13675
+ const METHOD_NAME$$ = "cli.dumpDocs";
13460
13676
  /**
13461
13677
  * Dumps the documentation for the agents and swarms.
13462
13678
  *
@@ -13466,7 +13682,7 @@ const METHOD_NAME$Y = "cli.dumpDocs";
13466
13682
  */
13467
13683
  const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
13468
13684
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13469
- swarm$1.loggerService.log(METHOD_NAME$Y, {
13685
+ swarm$1.loggerService.log(METHOD_NAME$$, {
13470
13686
  dirName,
13471
13687
  });
13472
13688
  if (PlantUML) {
@@ -13476,10 +13692,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
13476
13692
  }
13477
13693
  swarm$1.agentValidationService
13478
13694
  .getAgentList()
13479
- .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$Y));
13695
+ .forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$$));
13480
13696
  swarm$1.swarmValidationService
13481
13697
  .getSwarmList()
13482
- .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$Y));
13698
+ .forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$$));
13483
13699
  swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
13484
13700
  const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
13485
13701
  if (!dependsOn) {
@@ -13489,7 +13705,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
13489
13705
  return swarm$1.docService.dumpDocs(prefix, dirName);
13490
13706
  });
13491
13707
 
13492
- const METHOD_NAME$X = "cli.dumpAgent";
13708
+ const METHOD_NAME$_ = "cli.dumpAgent";
13493
13709
  /**
13494
13710
  * Dumps the agent information into PlantUML format.
13495
13711
  *
@@ -13498,14 +13714,14 @@ const METHOD_NAME$X = "cli.dumpAgent";
13498
13714
  */
13499
13715
  const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
13500
13716
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13501
- swarm$1.loggerService.log(METHOD_NAME$X, {
13717
+ swarm$1.loggerService.log(METHOD_NAME$_, {
13502
13718
  agentName,
13503
13719
  });
13504
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$X);
13720
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$_);
13505
13721
  return swarm$1.agentMetaService.toUML(agentName, withSubtree);
13506
13722
  });
13507
13723
 
13508
- const METHOD_NAME$W = "cli.dumpSwarm";
13724
+ const METHOD_NAME$Z = "cli.dumpSwarm";
13509
13725
  /**
13510
13726
  * Dumps the swarm information into PlantUML format.
13511
13727
  *
@@ -13514,14 +13730,14 @@ const METHOD_NAME$W = "cli.dumpSwarm";
13514
13730
  */
13515
13731
  const dumpSwarm = beginContext((swarmName) => {
13516
13732
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13517
- swarm$1.loggerService.log(METHOD_NAME$W, {
13733
+ swarm$1.loggerService.log(METHOD_NAME$Z, {
13518
13734
  swarmName,
13519
13735
  });
13520
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$W);
13736
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$Z);
13521
13737
  return swarm$1.swarmMetaService.toUML(swarmName);
13522
13738
  });
13523
13739
 
13524
- const METHOD_NAME$V = "cli.dumpPerfomance";
13740
+ const METHOD_NAME$Y = "cli.dumpPerfomance";
13525
13741
  const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
13526
13742
  const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
13527
13743
  /**
@@ -13540,7 +13756,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
13540
13756
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
13541
13757
  */
13542
13758
  const dumpPerfomance = async (dirName = "./logs/meta") => {
13543
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$V);
13759
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Y);
13544
13760
  await dumpPerfomanceInternal(dirName);
13545
13761
  };
13546
13762
  /**
@@ -13598,7 +13814,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
13598
13814
  return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
13599
13815
  });
13600
13816
 
13601
- const METHOD_NAME$U = "cli.dumpClientPerformance";
13817
+ const METHOD_NAME$X = "cli.dumpClientPerformance";
13602
13818
  const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
13603
13819
  const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
13604
13820
  /**
@@ -13622,7 +13838,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
13622
13838
  * @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
13623
13839
  */
13624
13840
  const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
13625
- GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$U);
13841
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$X);
13626
13842
  await dumpClientPerformanceInternal(clientId, dirName);
13627
13843
  };
13628
13844
  /**
@@ -13642,7 +13858,25 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
13642
13858
  });
13643
13859
  });
13644
13860
 
13645
- const METHOD_NAME$T = "function.setup.addAgent";
13861
+ /** @constant {string} METHOD_NAME - The name of the method used for logging */
13862
+ const METHOD_NAME$W = "function.setup.addWiki";
13863
+ /**
13864
+ * Adds a wiki schema to the system
13865
+ * @function addWiki
13866
+ * @param {IWikiSchema} wikiSchema - The wiki schema to add
13867
+ * @returns {string} The name of the added wiki
13868
+ */
13869
+ const addWiki = beginContext((wikiSchema) => {
13870
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13871
+ swarm$1.loggerService.log(METHOD_NAME$W, {
13872
+ wikiSchema,
13873
+ });
13874
+ swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
13875
+ swarm$1.wikiSchemaService.register(wikiSchema.wikiName, wikiSchema);
13876
+ return wikiSchema.wikiName;
13877
+ });
13878
+
13879
+ const METHOD_NAME$V = "function.setup.addAgent";
13646
13880
  /**
13647
13881
  * Adds a new agent to the agent registry for use within the swarm system.
13648
13882
  *
@@ -13662,7 +13896,7 @@ const METHOD_NAME$T = "function.setup.addAgent";
13662
13896
  const addAgent = beginContext((agentSchema) => {
13663
13897
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13664
13898
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13665
- swarm$1.loggerService.log(METHOD_NAME$T, {
13899
+ swarm$1.loggerService.log(METHOD_NAME$V, {
13666
13900
  agentSchema,
13667
13901
  });
13668
13902
  // Register the agent in the validation and schema services
@@ -13672,7 +13906,7 @@ const addAgent = beginContext((agentSchema) => {
13672
13906
  return agentSchema.agentName;
13673
13907
  });
13674
13908
 
13675
- const METHOD_NAME$S = "function.setup.addCompletion";
13909
+ const METHOD_NAME$U = "function.setup.addCompletion";
13676
13910
  /**
13677
13911
  * Adds a completion engine to the registry for use by agents in the swarm system.
13678
13912
  *
@@ -13692,7 +13926,7 @@ const METHOD_NAME$S = "function.setup.addCompletion";
13692
13926
  const addCompletion = beginContext((completionSchema) => {
13693
13927
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13694
13928
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13695
- swarm$1.loggerService.log(METHOD_NAME$S, {
13929
+ swarm$1.loggerService.log(METHOD_NAME$U, {
13696
13930
  completionSchema,
13697
13931
  });
13698
13932
  // Register the completion in the validation and schema services
@@ -13702,7 +13936,7 @@ const addCompletion = beginContext((completionSchema) => {
13702
13936
  return completionSchema.completionName;
13703
13937
  });
13704
13938
 
13705
- const METHOD_NAME$R = "function.setup.addSwarm";
13939
+ const METHOD_NAME$T = "function.setup.addSwarm";
13706
13940
  /**
13707
13941
  * Adds a new swarm to the system for managing client sessions.
13708
13942
  *
@@ -13722,7 +13956,7 @@ const METHOD_NAME$R = "function.setup.addSwarm";
13722
13956
  const addSwarm = beginContext((swarmSchema) => {
13723
13957
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13724
13958
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13725
- swarm$1.loggerService.log(METHOD_NAME$R, {
13959
+ swarm$1.loggerService.log(METHOD_NAME$T, {
13726
13960
  swarmSchema,
13727
13961
  });
13728
13962
  // Register the swarm in the validation and schema services
@@ -13732,7 +13966,7 @@ const addSwarm = beginContext((swarmSchema) => {
13732
13966
  return swarmSchema.swarmName;
13733
13967
  });
13734
13968
 
13735
- const METHOD_NAME$Q = "function.setup.addTool";
13969
+ const METHOD_NAME$S = "function.setup.addTool";
13736
13970
  /**
13737
13971
  * Adds a new tool to the tool registry for use by agents in the swarm system.
13738
13972
  *
@@ -13754,7 +13988,7 @@ const METHOD_NAME$Q = "function.setup.addTool";
13754
13988
  const addTool = beginContext((toolSchema) => {
13755
13989
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13756
13990
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13757
- swarm$1.loggerService.log(METHOD_NAME$Q, {
13991
+ swarm$1.loggerService.log(METHOD_NAME$S, {
13758
13992
  toolSchema,
13759
13993
  });
13760
13994
  // Register the tool in the validation and schema services
@@ -13764,7 +13998,7 @@ const addTool = beginContext((toolSchema) => {
13764
13998
  return toolSchema.toolName;
13765
13999
  });
13766
14000
 
13767
- const METHOD_NAME$P = "function.setup.addState";
14001
+ const METHOD_NAME$R = "function.setup.addState";
13768
14002
  /**
13769
14003
  * Adds a new state to the state registry for use within the swarm system.
13770
14004
  *
@@ -13786,7 +14020,7 @@ const METHOD_NAME$P = "function.setup.addState";
13786
14020
  const addState = beginContext((stateSchema) => {
13787
14021
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13788
14022
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13789
- swarm$1.loggerService.log(METHOD_NAME$P, {
14023
+ swarm$1.loggerService.log(METHOD_NAME$R, {
13790
14024
  stateSchema,
13791
14025
  });
13792
14026
  // Register the state in the schema service
@@ -13801,7 +14035,7 @@ const addState = beginContext((stateSchema) => {
13801
14035
  return stateSchema.stateName;
13802
14036
  });
13803
14037
 
13804
- const METHOD_NAME$O = "function.setup.addEmbedding";
14038
+ const METHOD_NAME$Q = "function.setup.addEmbedding";
13805
14039
  /**
13806
14040
  * Adds a new embedding engine to the embedding registry for use within the swarm system.
13807
14041
  *
@@ -13821,7 +14055,7 @@ const METHOD_NAME$O = "function.setup.addEmbedding";
13821
14055
  const addEmbedding = beginContext((embeddingSchema) => {
13822
14056
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13823
14057
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13824
- swarm$1.loggerService.log(METHOD_NAME$O, {
14058
+ swarm$1.loggerService.log(METHOD_NAME$Q, {
13825
14059
  embeddingSchema,
13826
14060
  });
13827
14061
  // Register the embedding in the validation and schema services
@@ -13831,7 +14065,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
13831
14065
  return embeddingSchema.embeddingName;
13832
14066
  });
13833
14067
 
13834
- const METHOD_NAME$N = "function.setup.addStorage";
14068
+ const METHOD_NAME$P = "function.setup.addStorage";
13835
14069
  /**
13836
14070
  * Adds a new storage engine to the storage registry for use within the swarm system.
13837
14071
  *
@@ -13853,7 +14087,7 @@ const METHOD_NAME$N = "function.setup.addStorage";
13853
14087
  const addStorage = beginContext((storageSchema) => {
13854
14088
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13855
14089
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13856
- swarm$1.loggerService.log(METHOD_NAME$N, {
14090
+ swarm$1.loggerService.log(METHOD_NAME$P, {
13857
14091
  storageSchema,
13858
14092
  });
13859
14093
  // Register the storage in the validation and schema services
@@ -13870,7 +14104,7 @@ const addStorage = beginContext((storageSchema) => {
13870
14104
  });
13871
14105
 
13872
14106
  /** @private Constant defining the method name for logging and validation context */
13873
- const METHOD_NAME$M = "function.setup.addPolicy";
14107
+ const METHOD_NAME$O = "function.setup.addPolicy";
13874
14108
  /**
13875
14109
  * Adds a new policy for agents in the swarm system by registering it with validation and schema services.
13876
14110
  * Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
@@ -13886,7 +14120,7 @@ const METHOD_NAME$M = "function.setup.addPolicy";
13886
14120
  const addPolicy = beginContext((policySchema) => {
13887
14121
  // Log the policy addition attempt if enabled
13888
14122
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13889
- swarm$1.loggerService.log(METHOD_NAME$M, {
14123
+ swarm$1.loggerService.log(METHOD_NAME$O, {
13890
14124
  policySchema,
13891
14125
  });
13892
14126
  // Register the policy with PolicyValidationService for runtime validation
@@ -13897,7 +14131,7 @@ const addPolicy = beginContext((policySchema) => {
13897
14131
  return policySchema.policyName;
13898
14132
  });
13899
14133
 
13900
- const METHOD_NAME$L = "function.other.markOnline";
14134
+ const METHOD_NAME$N = "function.other.markOnline";
13901
14135
  /**
13902
14136
  * Marks a client as online in the specified swarm.
13903
14137
  *
@@ -13909,16 +14143,16 @@ const METHOD_NAME$L = "function.other.markOnline";
13909
14143
  const markOnline = async (clientId, swarmName) => {
13910
14144
  // Log the operation if logging is enabled in the global configuration
13911
14145
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13912
- swarm.loggerService.log(METHOD_NAME$L, {
14146
+ swarm.loggerService.log(METHOD_NAME$N, {
13913
14147
  clientId,
13914
14148
  });
13915
14149
  // Validate the swarm name
13916
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$L);
14150
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$N);
13917
14151
  // Run the operation in the method context
13918
14152
  return await MethodContextService.runInContext(async () => {
13919
- await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$L);
14153
+ await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$N);
13920
14154
  }, {
13921
- methodName: METHOD_NAME$L,
14155
+ methodName: METHOD_NAME$N,
13922
14156
  agentName: "",
13923
14157
  policyName: "",
13924
14158
  stateName: "",
@@ -13928,7 +14162,7 @@ const markOnline = async (clientId, swarmName) => {
13928
14162
  });
13929
14163
  };
13930
14164
 
13931
- const METHOD_NAME$K = "function.other.markOffline";
14165
+ const METHOD_NAME$M = "function.other.markOffline";
13932
14166
  /**
13933
14167
  * Marks a client as offline in the specified swarm.
13934
14168
  *
@@ -13943,14 +14177,14 @@ const METHOD_NAME$K = "function.other.markOffline";
13943
14177
  */
13944
14178
  const markOffline = async (clientId, swarmName) => {
13945
14179
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13946
- swarm.loggerService.log(METHOD_NAME$K, {
14180
+ swarm.loggerService.log(METHOD_NAME$M, {
13947
14181
  clientId,
13948
14182
  });
13949
- swarm.swarmValidationService.validate(swarmName, METHOD_NAME$K);
14183
+ swarm.swarmValidationService.validate(swarmName, METHOD_NAME$M);
13950
14184
  return await MethodContextService.runInContext(async () => {
13951
- await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$K);
14185
+ await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$M);
13952
14186
  }, {
13953
- methodName: METHOD_NAME$K,
14187
+ methodName: METHOD_NAME$M,
13954
14188
  agentName: "",
13955
14189
  policyName: "",
13956
14190
  stateName: "",
@@ -13960,7 +14194,7 @@ const markOffline = async (clientId, swarmName) => {
13960
14194
  });
13961
14195
  };
13962
14196
 
13963
- const METHOD_NAME$J = "function.commit.commitToolOutput";
14197
+ const METHOD_NAME$L = "function.commit.commitToolOutput";
13964
14198
  /**
13965
14199
  * Commits the output of a tool execution to the active agent in a swarm session.
13966
14200
  *
@@ -13980,19 +14214,19 @@ const METHOD_NAME$J = "function.commit.commitToolOutput";
13980
14214
  const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
13981
14215
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
13982
14216
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
13983
- swarm$1.loggerService.log(METHOD_NAME$J, {
14217
+ swarm$1.loggerService.log(METHOD_NAME$L, {
13984
14218
  toolId,
13985
14219
  content,
13986
14220
  clientId,
13987
14221
  agentName,
13988
14222
  });
13989
14223
  // Validate the agent, session, and swarm to ensure they exist and are accessible
13990
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$J);
13991
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$J);
14224
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$L);
14225
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$L);
13992
14226
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
13993
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$J);
14227
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$L);
13994
14228
  // Check if the specified agent is still the active agent in the swarm session
13995
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$J, clientId, swarmName);
14229
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$L, clientId, swarmName);
13996
14230
  if (currentAgentName !== agentName) {
13997
14231
  // Log a skip message if the agent has changed during the operation
13998
14232
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -14005,11 +14239,11 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
14005
14239
  return;
14006
14240
  }
14007
14241
  // Commit the tool output to the session via the session public service
14008
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$J, clientId, swarmName);
14242
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$L, clientId, swarmName);
14009
14243
  });
14010
14244
 
14011
14245
  /** @private Constant defining the method name for logging and validation context */
14012
- const METHOD_NAME$I = "function.commit.commitSystemMessage";
14246
+ const METHOD_NAME$K = "function.commit.commitSystemMessage";
14013
14247
  /**
14014
14248
  * Commits a system-generated message to the active agent in the swarm system.
14015
14249
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -14028,20 +14262,20 @@ const METHOD_NAME$I = "function.commit.commitSystemMessage";
14028
14262
  const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
14029
14263
  // Log the commit attempt if enabled
14030
14264
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14031
- swarm$1.loggerService.log(METHOD_NAME$I, {
14265
+ swarm$1.loggerService.log(METHOD_NAME$K, {
14032
14266
  content,
14033
14267
  clientId,
14034
14268
  agentName,
14035
14269
  });
14036
14270
  // Validate the agent exists
14037
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$I);
14271
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$K);
14038
14272
  // Validate the session exists and retrieve the associated swarm
14039
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$I);
14273
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$K);
14040
14274
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14041
14275
  // Validate the swarm configuration
14042
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$I);
14276
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$K);
14043
14277
  // Check if the current agent matches the provided agent
14044
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$I, clientId, swarmName);
14278
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$K, clientId, swarmName);
14045
14279
  if (currentAgentName !== agentName) {
14046
14280
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14047
14281
  swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
@@ -14052,11 +14286,11 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
14052
14286
  return;
14053
14287
  }
14054
14288
  // Commit the system message via SessionPublicService
14055
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$I, clientId, swarmName);
14289
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$K, clientId, swarmName);
14056
14290
  });
14057
14291
 
14058
14292
  /** @private Constant defining the method name for logging and validation context */
14059
- const METHOD_NAME$H = "function.commit.commitFlush";
14293
+ const METHOD_NAME$J = "function.commit.commitFlush";
14060
14294
  /**
14061
14295
  * Commits a flush of agent history for a specific client and agent in the swarm system.
14062
14296
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
@@ -14073,19 +14307,19 @@ const METHOD_NAME$H = "function.commit.commitFlush";
14073
14307
  const commitFlush = beginContext(async (clientId, agentName) => {
14074
14308
  // Log the flush attempt if enabled
14075
14309
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14076
- swarm$1.loggerService.log(METHOD_NAME$H, {
14310
+ swarm$1.loggerService.log(METHOD_NAME$J, {
14077
14311
  clientId,
14078
14312
  agentName,
14079
14313
  });
14080
14314
  // Validate the agent exists
14081
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$H);
14315
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$J);
14082
14316
  // Validate the session exists and retrieve the associated swarm
14083
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$H);
14317
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$J);
14084
14318
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14085
14319
  // Validate the swarm configuration
14086
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$H);
14320
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$J);
14087
14321
  // Check if the current agent matches the provided agent
14088
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$H, clientId, swarmName);
14322
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$J, clientId, swarmName);
14089
14323
  if (currentAgentName !== agentName) {
14090
14324
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14091
14325
  swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
@@ -14096,10 +14330,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
14096
14330
  return;
14097
14331
  }
14098
14332
  // Commit the flush of agent history via SessionPublicService
14099
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$H, clientId, swarmName);
14333
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$J, clientId, swarmName);
14100
14334
  });
14101
14335
 
14102
- const METHOD_NAME$G = "function.commit.commitSystemMessage";
14336
+ const METHOD_NAME$I = "function.commit.commitSystemMessage";
14103
14337
  /**
14104
14338
  * Commits a user message to the active agent's history in a swarm session without triggering a response.
14105
14339
  *
@@ -14118,19 +14352,19 @@ const METHOD_NAME$G = "function.commit.commitSystemMessage";
14118
14352
  const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
14119
14353
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14120
14354
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14121
- swarm$1.loggerService.log(METHOD_NAME$G, {
14355
+ swarm$1.loggerService.log(METHOD_NAME$I, {
14122
14356
  content,
14123
14357
  clientId,
14124
14358
  agentName,
14125
14359
  mode,
14126
14360
  });
14127
14361
  // Validate the agent, session, and swarm to ensure they exist and are accessible
14128
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$G);
14129
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$G);
14362
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$I);
14363
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$I);
14130
14364
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14131
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$G);
14365
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$I);
14132
14366
  // Check if the specified agent is still the active agent in the swarm session
14133
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$G, clientId, swarmName);
14367
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$I, clientId, swarmName);
14134
14368
  if (currentAgentName !== agentName) {
14135
14369
  // Log a skip message if the agent has changed during the operation
14136
14370
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
@@ -14143,17 +14377,17 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
14143
14377
  }
14144
14378
  if (payload) {
14145
14379
  return await PayloadContextService.runInContext(async () => {
14146
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$G, clientId, swarmName);
14380
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$I, clientId, swarmName);
14147
14381
  }, {
14148
14382
  clientId,
14149
14383
  payload,
14150
14384
  });
14151
14385
  }
14152
14386
  // Commit the user message to the agent's history via the session public service
14153
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$G, clientId, swarmName);
14387
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$I, clientId, swarmName);
14154
14388
  });
14155
14389
 
14156
- const METHOD_NAME$F = "function.commit.commitToolOutputForce";
14390
+ const METHOD_NAME$H = "function.commit.commitToolOutputForce";
14157
14391
  /**
14158
14392
  * Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
14159
14393
  *
@@ -14172,21 +14406,21 @@ const METHOD_NAME$F = "function.commit.commitToolOutputForce";
14172
14406
  const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
14173
14407
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14174
14408
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14175
- swarm$1.loggerService.log(METHOD_NAME$F, {
14409
+ swarm$1.loggerService.log(METHOD_NAME$H, {
14176
14410
  toolId,
14177
14411
  content,
14178
14412
  clientId,
14179
14413
  });
14180
14414
  // Validate the session and swarm to ensure they exist and are accessible
14181
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$F);
14415
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$H);
14182
14416
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14183
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
14417
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$H);
14184
14418
  // Commit the tool output to the session via the session public service without checking the active agent
14185
- await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$F, clientId, swarmName);
14419
+ await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$H, clientId, swarmName);
14186
14420
  });
14187
14421
 
14188
14422
  /** @private Constant defining the method name for logging and validation context */
14189
- const METHOD_NAME$E = "function.commit.commitSystemMessageForce";
14423
+ const METHOD_NAME$G = "function.commit.commitSystemMessageForce";
14190
14424
  /**
14191
14425
  * Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
14192
14426
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -14205,21 +14439,21 @@ const METHOD_NAME$E = "function.commit.commitSystemMessageForce";
14205
14439
  const commitSystemMessageForce = beginContext(async (content, clientId) => {
14206
14440
  // Log the commit attempt if enabled
14207
14441
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14208
- swarm$1.loggerService.log(METHOD_NAME$E, {
14442
+ swarm$1.loggerService.log(METHOD_NAME$G, {
14209
14443
  content,
14210
14444
  clientId,
14211
14445
  });
14212
14446
  // Validate the session exists and retrieve the associated swarm
14213
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
14447
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$G);
14214
14448
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14215
14449
  // Validate the swarm configuration
14216
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
14450
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$G);
14217
14451
  // Commit the system message via SessionPublicService without agent checks
14218
- await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$E, clientId, swarmName);
14452
+ await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$G, clientId, swarmName);
14219
14453
  });
14220
14454
 
14221
14455
  /** @private Constant defining the method name for logging and validation context */
14222
- const METHOD_NAME$D = "function.commit.commitFlushForce";
14456
+ const METHOD_NAME$F = "function.commit.commitFlushForce";
14223
14457
  /**
14224
14458
  * Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
14225
14459
  * Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
@@ -14237,20 +14471,20 @@ const METHOD_NAME$D = "function.commit.commitFlushForce";
14237
14471
  const commitFlushForce = beginContext(async (clientId) => {
14238
14472
  // Log the flush attempt if enabled
14239
14473
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14240
- swarm$1.loggerService.log(METHOD_NAME$D, {
14474
+ swarm$1.loggerService.log(METHOD_NAME$F, {
14241
14475
  clientId,
14242
- METHOD_NAME: METHOD_NAME$D,
14476
+ METHOD_NAME: METHOD_NAME$F,
14243
14477
  });
14244
14478
  // Validate the session exists and retrieve the associated swarm
14245
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
14479
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$F);
14246
14480
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14247
14481
  // Validate the swarm configuration
14248
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
14482
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
14249
14483
  // Commit the flush of agent history via SessionPublicService without agent checks
14250
- await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$D, clientId, swarmName);
14484
+ await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$F, clientId, swarmName);
14251
14485
  });
14252
14486
 
14253
- const METHOD_NAME$C = "function.commit.commitSystemMessage";
14487
+ const METHOD_NAME$E = "function.commit.commitSystemMessage";
14254
14488
  /**
14255
14489
  * Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
14256
14490
  *
@@ -14268,29 +14502,29 @@ const METHOD_NAME$C = "function.commit.commitSystemMessage";
14268
14502
  const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
14269
14503
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14270
14504
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14271
- swarm$1.loggerService.log(METHOD_NAME$C, {
14505
+ swarm$1.loggerService.log(METHOD_NAME$E, {
14272
14506
  content,
14273
14507
  clientId,
14274
14508
  mode,
14275
14509
  });
14276
14510
  // Validate the session and swarm to ensure they exist and are accessible
14277
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
14511
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
14278
14512
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14279
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
14513
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
14280
14514
  if (payload) {
14281
14515
  return await PayloadContextService.runInContext(async () => {
14282
- await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$C, clientId, swarmName);
14516
+ await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$E, clientId, swarmName);
14283
14517
  }, {
14284
14518
  clientId,
14285
14519
  payload,
14286
14520
  });
14287
14521
  }
14288
14522
  // Commit the user message to the agent's history via the session public service without checking the active agent
14289
- return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$C, clientId, swarmName);
14523
+ return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$E, clientId, swarmName);
14290
14524
  });
14291
14525
 
14292
14526
  /** @private Constant defining the method name for logging and validation context */
14293
- const METHOD_NAME$B = "function.commit.commitAssistantMessage";
14527
+ const METHOD_NAME$D = "function.commit.commitAssistantMessage";
14294
14528
  /**
14295
14529
  * Commits an assistant-generated message to the active agent in the swarm system.
14296
14530
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
@@ -14308,20 +14542,20 @@ const METHOD_NAME$B = "function.commit.commitAssistantMessage";
14308
14542
  const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
14309
14543
  // Log the commit attempt if enabled
14310
14544
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14311
- swarm$1.loggerService.log(METHOD_NAME$B, {
14545
+ swarm$1.loggerService.log(METHOD_NAME$D, {
14312
14546
  content,
14313
14547
  clientId,
14314
14548
  agentName,
14315
14549
  });
14316
14550
  // Validate the agent exists
14317
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
14551
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$D);
14318
14552
  // Validate the session exists and retrieve the associated swarm
14319
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
14553
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
14320
14554
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14321
14555
  // Validate the swarm configuration
14322
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
14556
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
14323
14557
  // Check if the current agent matches the provided agent
14324
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName);
14558
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$D, clientId, swarmName);
14325
14559
  if (currentAgentName !== agentName) {
14326
14560
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14327
14561
  swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
@@ -14332,11 +14566,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
14332
14566
  return;
14333
14567
  }
14334
14568
  // Commit the assistant message via SessionPublicService
14335
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$B, clientId, swarmName);
14569
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$D, clientId, swarmName);
14336
14570
  });
14337
14571
 
14338
14572
  /** @private Constant defining the method name for logging and validation context */
14339
- const METHOD_NAME$A = "function.commit.commitAssistantMessageForce";
14573
+ const METHOD_NAME$C = "function.commit.commitAssistantMessageForce";
14340
14574
  /**
14341
14575
  * Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
14342
14576
  * Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
@@ -14355,21 +14589,21 @@ const METHOD_NAME$A = "function.commit.commitAssistantMessageForce";
14355
14589
  const commitAssistantMessageForce = beginContext(async (content, clientId) => {
14356
14590
  // Log the commit attempt if enabled
14357
14591
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14358
- swarm$1.loggerService.log(METHOD_NAME$A, {
14592
+ swarm$1.loggerService.log(METHOD_NAME$C, {
14359
14593
  content,
14360
14594
  clientId,
14361
14595
  });
14362
14596
  // Validate the session exists and retrieve the associated swarm
14363
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
14597
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
14364
14598
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14365
14599
  // Validate the swarm configuration
14366
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
14600
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
14367
14601
  // Commit the assistant message via SessionPublicService without agent checks
14368
- await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$A, clientId, swarmName);
14602
+ await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$C, clientId, swarmName);
14369
14603
  });
14370
14604
 
14371
14605
  /** @private Constant defining the method name for logging and validation context */
14372
- const METHOD_NAME$z = "function.commit.cancelOutput";
14606
+ const METHOD_NAME$B = "function.commit.cancelOutput";
14373
14607
  /**
14374
14608
  * Cancels the awaited output for a specific client and agent by emitting an empty string.
14375
14609
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
@@ -14385,19 +14619,19 @@ const METHOD_NAME$z = "function.commit.cancelOutput";
14385
14619
  const cancelOutput = beginContext(async (clientId, agentName) => {
14386
14620
  // Log the cancellation attempt if enabled
14387
14621
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14388
- swarm$1.loggerService.log(METHOD_NAME$z, {
14622
+ swarm$1.loggerService.log(METHOD_NAME$B, {
14389
14623
  clientId,
14390
14624
  agentName,
14391
14625
  });
14392
14626
  // Validate the agent exists
14393
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$z);
14627
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
14394
14628
  // Validate the session exists and retrieve the associated swarm
14395
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
14629
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
14396
14630
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14397
14631
  // Validate the swarm configuration
14398
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
14632
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
14399
14633
  // Check if the current agent matches the provided agent
14400
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$z, clientId, swarmName);
14634
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName);
14401
14635
  if (currentAgentName !== agentName) {
14402
14636
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14403
14637
  swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
@@ -14408,11 +14642,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
14408
14642
  return;
14409
14643
  }
14410
14644
  // Perform the output cancellation via SwarmPublicService
14411
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$z, clientId, swarmName);
14645
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$B, clientId, swarmName);
14412
14646
  });
14413
14647
 
14414
14648
  /** @private Constant defining the method name for logging and validation context */
14415
- const METHOD_NAME$y = "function.commit.cancelOutputForce";
14649
+ const METHOD_NAME$A = "function.commit.cancelOutputForce";
14416
14650
  /**
14417
14651
  * Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
14418
14652
  * Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
@@ -14429,20 +14663,20 @@ const METHOD_NAME$y = "function.commit.cancelOutputForce";
14429
14663
  const cancelOutputForce = beginContext(async (clientId) => {
14430
14664
  // Log the cancellation attempt if enabled
14431
14665
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14432
- swarm$1.loggerService.log(METHOD_NAME$y, {
14666
+ swarm$1.loggerService.log(METHOD_NAME$A, {
14433
14667
  clientId,
14434
14668
  });
14435
14669
  // Validate the session exists and retrieve the associated swarm
14436
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
14670
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
14437
14671
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14438
14672
  // Validate the swarm configuration
14439
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
14673
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
14440
14674
  // Perform the output cancellation via SwarmPublicService without agent checks
14441
- await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$y, clientId, swarmName);
14675
+ await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$A, clientId, swarmName);
14442
14676
  });
14443
14677
 
14444
14678
  /** @private Constant defining the method name for logging and validation context */
14445
- const METHOD_NAME$x = "function.commit.commitStopTools";
14679
+ const METHOD_NAME$z = "function.commit.commitStopTools";
14446
14680
  /**
14447
14681
  * Prevents the next tool from being executed for a specific client and agent in the swarm system.
14448
14682
  * Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
@@ -14459,19 +14693,19 @@ const METHOD_NAME$x = "function.commit.commitStopTools";
14459
14693
  const commitStopTools = beginContext(async (clientId, agentName) => {
14460
14694
  // Log the stop tools attempt if enabled
14461
14695
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14462
- swarm$1.loggerService.log(METHOD_NAME$x, {
14696
+ swarm$1.loggerService.log(METHOD_NAME$z, {
14463
14697
  clientId,
14464
14698
  agentName,
14465
14699
  });
14466
14700
  // Validate the agent exists
14467
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
14701
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$z);
14468
14702
  // Validate the session exists and retrieve the associated swarm
14469
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
14703
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
14470
14704
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14471
14705
  // Validate the swarm configuration
14472
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
14706
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
14473
14707
  // Check if the current agent matches the provided agent
14474
- const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
14708
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$z, clientId, swarmName);
14475
14709
  if (currentAgentName !== agentName) {
14476
14710
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14477
14711
  swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
@@ -14482,11 +14716,11 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
14482
14716
  return;
14483
14717
  }
14484
14718
  // Commit the stop of the next tool execution via SessionPublicService
14485
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$x, clientId, swarmName);
14719
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$z, clientId, swarmName);
14486
14720
  });
14487
14721
 
14488
14722
  /** @private Constant defining the method name for logging and validation context */
14489
- const METHOD_NAME$w = "function.commit.commitStopToolsForce";
14723
+ const METHOD_NAME$y = "function.commit.commitStopToolsForce";
14490
14724
  /**
14491
14725
  * Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
14492
14726
  * Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
@@ -14504,20 +14738,20 @@ const METHOD_NAME$w = "function.commit.commitStopToolsForce";
14504
14738
  const commitStopToolsForce = beginContext(async (clientId) => {
14505
14739
  // Log the stop tools attempt if enabled
14506
14740
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14507
- swarm$1.loggerService.log(METHOD_NAME$w, {
14741
+ swarm$1.loggerService.log(METHOD_NAME$y, {
14508
14742
  clientId,
14509
- METHOD_NAME: METHOD_NAME$w,
14743
+ METHOD_NAME: METHOD_NAME$y,
14510
14744
  });
14511
14745
  // Validate the session exists and retrieve the associated swarm
14512
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
14746
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
14513
14747
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14514
14748
  // Validate the swarm configuration
14515
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
14749
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
14516
14750
  // Commit the stop of the next tool execution via SessionPublicService without agent checks
14517
- await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$w, clientId, swarmName);
14751
+ await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$y, clientId, swarmName);
14518
14752
  });
14519
14753
 
14520
- const METHOD_NAME$v = "function.target.emitForce";
14754
+ const METHOD_NAME$x = "function.target.emitForce";
14521
14755
  /**
14522
14756
  * Emits a string as model output without executing an incoming message or checking the active agent.
14523
14757
  *
@@ -14536,19 +14770,19 @@ const METHOD_NAME$v = "function.target.emitForce";
14536
14770
  const emitForce = beginContext(async (content, clientId) => {
14537
14771
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14538
14772
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14539
- swarm$1.loggerService.log(METHOD_NAME$v, {
14773
+ swarm$1.loggerService.log(METHOD_NAME$x, {
14540
14774
  content,
14541
14775
  clientId,
14542
14776
  });
14543
14777
  // Validate the session and swarm
14544
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
14778
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
14545
14779
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14546
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
14780
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
14547
14781
  // Emit the content directly via the session public service
14548
- return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$v, clientId, swarmName);
14782
+ return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$x, clientId, swarmName);
14549
14783
  });
14550
14784
 
14551
- const METHOD_NAME$u = "function.target.executeForce";
14785
+ const METHOD_NAME$w = "function.target.executeForce";
14552
14786
  /**
14553
14787
  * Sends a message to the active agent in a swarm session as if it originated from the client side, forcing execution regardless of agent activity.
14554
14788
  *
@@ -14569,22 +14803,22 @@ const executeForce = beginContext(async (content, clientId) => {
14569
14803
  const executionId = functoolsKit.randomString();
14570
14804
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14571
14805
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14572
- swarm$1.loggerService.log(METHOD_NAME$u, {
14806
+ swarm$1.loggerService.log(METHOD_NAME$w, {
14573
14807
  content,
14574
14808
  clientId,
14575
14809
  executionId,
14576
14810
  });
14577
14811
  // Validate the session and swarm
14578
- swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
14812
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
14579
14813
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14580
- swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
14814
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
14581
14815
  // Execute the command within an execution context with performance tracking
14582
14816
  return ExecutionContextService.runInContext(async () => {
14583
14817
  let isFinished = false;
14584
14818
  swarm$1.perfService.startExecution(executionId, clientId, content.length);
14585
14819
  try {
14586
14820
  swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
14587
- const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$u, clientId, swarmName);
14821
+ const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$w, clientId, swarmName);
14588
14822
  isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
14589
14823
  swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
14590
14824
  return result;
@@ -14601,6 +14835,86 @@ const executeForce = beginContext(async (content, clientId) => {
14601
14835
  });
14602
14836
  });
14603
14837
 
14838
+ /** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
14839
+ const METHOD_NAME$v = "function.target.question";
14840
+ /**
14841
+ * Initiates a question process within a chat context
14842
+ * @function question
14843
+ * @param {string} message - The message/question to be processed
14844
+ * @param {string} clientId - Unique identifier for the client
14845
+ * @param {AgentName} agentName - Name of the agent handling the question
14846
+ * @param {WikiName} wikiName - Name of the wiki context
14847
+ * @returns {Promise<string>} The response from the chat process
14848
+ */
14849
+ const question = beginContext(async (message, clientId, agentName, wikiName) => {
14850
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14851
+ swarm$1.loggerService.log(METHOD_NAME$v, {
14852
+ message,
14853
+ clientId,
14854
+ agentName,
14855
+ wikiName,
14856
+ });
14857
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
14858
+ swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
14859
+ const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14860
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
14861
+ swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$v);
14862
+ const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
14863
+ if (currentAgentName !== agentName) {
14864
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14865
+ swarm$1.loggerService.log('function "question" skipped due to the agent change', {
14866
+ currentAgentName,
14867
+ agentName,
14868
+ clientId,
14869
+ });
14870
+ return "";
14871
+ }
14872
+ const { getChat, callbacks } = swarm$1.wikiSchemaService.get(wikiName);
14873
+ const args = {
14874
+ agentName,
14875
+ clientId,
14876
+ message,
14877
+ };
14878
+ if (callbacks?.onChat) {
14879
+ callbacks.onChat(args);
14880
+ }
14881
+ return await getChat(args);
14882
+ });
14883
+
14884
+ /** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
14885
+ const METHOD_NAME$u = "function.target.questionForce";
14886
+ /**
14887
+ * Initiates a forced question process within a chat context
14888
+ * @function questionForce
14889
+ * @param {string} message - The message/question to be processed
14890
+ * @param {string} clientId - Unique identifier for the client
14891
+ * @param {WikiName} wikiName - Name of the wiki context
14892
+ * @returns {Promise<string>} The response from the chat process
14893
+ */
14894
+ const questionForce = beginContext(async (message, clientId, wikiName) => {
14895
+ GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14896
+ swarm$1.loggerService.log(METHOD_NAME$u, {
14897
+ message,
14898
+ clientId,
14899
+ wikiName,
14900
+ });
14901
+ swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
14902
+ const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14903
+ swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
14904
+ swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$u);
14905
+ const { getChat, callbacks } = swarm$1.wikiSchemaService.get(wikiName);
14906
+ const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName);
14907
+ const args = {
14908
+ clientId,
14909
+ message,
14910
+ agentName
14911
+ };
14912
+ if (callbacks?.onChat) {
14913
+ callbacks.onChat(args);
14914
+ }
14915
+ return await getChat(args);
14916
+ });
14917
+
14604
14918
  const METHOD_NAME$t = "function.target.disposeConnection";
14605
14919
  /**
14606
14920
  * Disposes of a client session and all related resources within a swarm.
@@ -14936,19 +15250,17 @@ const METHOD_NAME$o = "function.target.notifyForce";
14936
15250
  *
14937
15251
  * @param {string} content - The content to be sent as the notification output.
14938
15252
  * @param {string} clientId - The unique identifier of the client session sending the notification.
14939
- * @param {AgentName} agentName - The name of the agent intended to send the notification.
14940
15253
  * @returns {Promise<void>} A promise that resolves when the notification is sent
14941
15254
  * @throws {Error} If the session mode is not "makeConnection", or if agent, session, or swarm validation fails.
14942
15255
  * @example
14943
15256
  * await notifyForce("Direct output", "client-123", "AgentX"); // Sends "Direct output" if AgentX is active
14944
15257
  */
14945
- const notifyForce = beginContext(async (content, clientId, agentName) => {
15258
+ const notifyForce = beginContext(async (content, clientId) => {
14946
15259
  // Log the operation details if logging is enabled in GLOBAL_CONFIG
14947
15260
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
14948
15261
  swarm$1.loggerService.log(METHOD_NAME$o, {
14949
15262
  content,
14950
15263
  clientId,
14951
- agentName,
14952
15264
  });
14953
15265
  swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$o);
14954
15266
  // Check if the session mode is "makeConnection"
@@ -14957,11 +15269,8 @@ const notifyForce = beginContext(async (content, clientId, agentName) => {
14957
15269
  throw new Error(`agent-swarm-kit notifyForce session is not makeConnection clientId=${clientId}`);
14958
15270
  }
14959
15271
  // Validate the agent, session, and swarm
14960
- swarm$1.agentValidationService.validate(agentName, METHOD_NAME$o);
14961
15272
  const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
14962
15273
  swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$o);
14963
- // Check if the specified agent is still the active agent
14964
- await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$o, clientId, swarmName);
14965
15274
  // Notify the content directly via the session public service
14966
15275
  return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$o, clientId, swarmName);
14967
15276
  });
@@ -18491,6 +18800,7 @@ exports.addState = addState;
18491
18800
  exports.addStorage = addStorage;
18492
18801
  exports.addSwarm = addSwarm;
18493
18802
  exports.addTool = addTool;
18803
+ exports.addWiki = addWiki;
18494
18804
  exports.beginContext = beginContext;
18495
18805
  exports.cancelOutput = cancelOutput;
18496
18806
  exports.cancelOutputForce = cancelOutputForce;
@@ -18559,6 +18869,8 @@ exports.markOffline = markOffline;
18559
18869
  exports.markOnline = markOnline;
18560
18870
  exports.notify = notify;
18561
18871
  exports.notifyForce = notifyForce;
18872
+ exports.question = question;
18873
+ exports.questionForce = questionForce;
18562
18874
  exports.runStateless = runStateless;
18563
18875
  exports.runStatelessForce = runStatelessForce;
18564
18876
  exports.session = session;