agent-swarm-kit 1.0.220 → 1.0.222
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 +257 -222
- package/build/index.mjs +257 -223
- package/package.json +1 -1
- package/types.d.ts +16 -2
package/build/index.cjs
CHANGED
|
@@ -2757,6 +2757,7 @@ const LoggerAdapter = new LoggerUtils();
|
|
|
2757
2757
|
*/
|
|
2758
2758
|
const Logger = LoggerAdapter;
|
|
2759
2759
|
|
|
2760
|
+
const CC_THROW_WHEN_NAVIGATION_RECURSION = true;
|
|
2760
2761
|
const CC_TOOL_CALL_EXCEPTION_FLUSH_PROMPT = "Start the conversation";
|
|
2761
2762
|
const CC_TOOL_CALL_EXCEPTION_RECOMPLETE_PROMPT = functoolsKit.str.newline("Please analyze the last tool call message and identify any errors in its syntax or parameters.", "Then, provide a corrected version of the tool call that properly follows the required format and includes all necessary parameters with appropriate values.", "Include a brief explanation of what was fixed as a text content of a new message with correct tool calls request");
|
|
2762
2763
|
const CC_TOOL_CALL_EXCEPTION_CUSTOM_FUNCTION = () => Promise.resolve(null);
|
|
@@ -2891,6 +2892,7 @@ const GLOBAL_CONFIG = {
|
|
|
2891
2892
|
CC_DEFAULT_WRITE_EMBEDDING_CACHE,
|
|
2892
2893
|
CC_PERSIST_EMBEDDING_CACHE,
|
|
2893
2894
|
CC_DEFAULT_AGENT_TOOL_VALIDATE,
|
|
2895
|
+
CC_THROW_WHEN_NAVIGATION_RECURSION,
|
|
2894
2896
|
};
|
|
2895
2897
|
GLOBAL_CONFIG.CC_RESQUE_STRATEGY = "flush";
|
|
2896
2898
|
/**
|
|
@@ -4305,7 +4307,7 @@ class AgentConnectionService {
|
|
|
4305
4307
|
}
|
|
4306
4308
|
|
|
4307
4309
|
/** @private Constant defining the method name for logging purposes */
|
|
4308
|
-
const METHOD_NAME$
|
|
4310
|
+
const METHOD_NAME$Y = "function.common.getPayload";
|
|
4309
4311
|
/**
|
|
4310
4312
|
* Retrieves the payload from the current PayloadContextService context.
|
|
4311
4313
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -4316,7 +4318,7 @@ const METHOD_NAME$X = "function.common.getPayload";
|
|
|
4316
4318
|
* console.log(payload); // { id: number } or null
|
|
4317
4319
|
*/
|
|
4318
4320
|
const getPayload = () => {
|
|
4319
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
4321
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Y);
|
|
4320
4322
|
if (PayloadContextService.hasContext()) {
|
|
4321
4323
|
const { payload } = swarm$1.payloadContextService.context;
|
|
4322
4324
|
return payload;
|
|
@@ -13273,6 +13275,14 @@ class NavigationValidationService {
|
|
|
13273
13275
|
swarmName,
|
|
13274
13276
|
agentName,
|
|
13275
13277
|
});
|
|
13278
|
+
console.warn(`agent-swarm navigation skipped due to recursion`, {
|
|
13279
|
+
clientId,
|
|
13280
|
+
agentName,
|
|
13281
|
+
swarmName,
|
|
13282
|
+
});
|
|
13283
|
+
if (GLOBAL_CONFIG.CC_THROW_WHEN_NAVIGATION_RECURSION) {
|
|
13284
|
+
throw new Error(`agent-swarm navigation skipped due to recursion clientId=${clientId} swarmName=${swarmName} agentName=${agentName}`);
|
|
13285
|
+
}
|
|
13276
13286
|
return false;
|
|
13277
13287
|
}
|
|
13278
13288
|
navigationRoute.add(agentName);
|
|
@@ -13446,7 +13456,7 @@ const swarm = {
|
|
|
13446
13456
|
init();
|
|
13447
13457
|
var swarm$1 = swarm;
|
|
13448
13458
|
|
|
13449
|
-
const METHOD_NAME$
|
|
13459
|
+
const METHOD_NAME$X = "cli.dumpDocs";
|
|
13450
13460
|
/**
|
|
13451
13461
|
* Dumps the documentation for the agents and swarms.
|
|
13452
13462
|
*
|
|
@@ -13456,7 +13466,7 @@ const METHOD_NAME$W = "cli.dumpDocs";
|
|
|
13456
13466
|
*/
|
|
13457
13467
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
13458
13468
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13459
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13469
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
13460
13470
|
dirName,
|
|
13461
13471
|
});
|
|
13462
13472
|
if (PlantUML) {
|
|
@@ -13466,10 +13476,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
13466
13476
|
}
|
|
13467
13477
|
swarm$1.agentValidationService
|
|
13468
13478
|
.getAgentList()
|
|
13469
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
13479
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$X));
|
|
13470
13480
|
swarm$1.swarmValidationService
|
|
13471
13481
|
.getSwarmList()
|
|
13472
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
13482
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$X));
|
|
13473
13483
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
13474
13484
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
13475
13485
|
if (!dependsOn) {
|
|
@@ -13479,7 +13489,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
13479
13489
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
13480
13490
|
});
|
|
13481
13491
|
|
|
13482
|
-
const METHOD_NAME$
|
|
13492
|
+
const METHOD_NAME$W = "cli.dumpAgent";
|
|
13483
13493
|
/**
|
|
13484
13494
|
* Dumps the agent information into PlantUML format.
|
|
13485
13495
|
*
|
|
@@ -13488,14 +13498,14 @@ const METHOD_NAME$V = "cli.dumpAgent";
|
|
|
13488
13498
|
*/
|
|
13489
13499
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
13490
13500
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13491
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13501
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
13492
13502
|
agentName,
|
|
13493
13503
|
});
|
|
13494
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
13504
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$W);
|
|
13495
13505
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
13496
13506
|
});
|
|
13497
13507
|
|
|
13498
|
-
const METHOD_NAME$
|
|
13508
|
+
const METHOD_NAME$V = "cli.dumpSwarm";
|
|
13499
13509
|
/**
|
|
13500
13510
|
* Dumps the swarm information into PlantUML format.
|
|
13501
13511
|
*
|
|
@@ -13504,14 +13514,14 @@ const METHOD_NAME$U = "cli.dumpSwarm";
|
|
|
13504
13514
|
*/
|
|
13505
13515
|
const dumpSwarm = beginContext((swarmName) => {
|
|
13506
13516
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13507
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13517
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
13508
13518
|
swarmName,
|
|
13509
13519
|
});
|
|
13510
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
13520
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$V);
|
|
13511
13521
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
13512
13522
|
});
|
|
13513
13523
|
|
|
13514
|
-
const METHOD_NAME$
|
|
13524
|
+
const METHOD_NAME$U = "cli.dumpPerfomance";
|
|
13515
13525
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
13516
13526
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
13517
13527
|
/**
|
|
@@ -13530,7 +13540,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
13530
13540
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
13531
13541
|
*/
|
|
13532
13542
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
13533
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
13543
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$U);
|
|
13534
13544
|
await dumpPerfomanceInternal(dirName);
|
|
13535
13545
|
};
|
|
13536
13546
|
/**
|
|
@@ -13588,7 +13598,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
13588
13598
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
13589
13599
|
});
|
|
13590
13600
|
|
|
13591
|
-
const METHOD_NAME$
|
|
13601
|
+
const METHOD_NAME$T = "cli.dumpClientPerformance";
|
|
13592
13602
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
13593
13603
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
13594
13604
|
/**
|
|
@@ -13612,7 +13622,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
13612
13622
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
13613
13623
|
*/
|
|
13614
13624
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
13615
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
13625
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$T);
|
|
13616
13626
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
13617
13627
|
};
|
|
13618
13628
|
/**
|
|
@@ -13632,7 +13642,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
13632
13642
|
});
|
|
13633
13643
|
});
|
|
13634
13644
|
|
|
13635
|
-
const METHOD_NAME$
|
|
13645
|
+
const METHOD_NAME$S = "function.setup.addAgent";
|
|
13636
13646
|
/**
|
|
13637
13647
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
13638
13648
|
*
|
|
@@ -13652,7 +13662,7 @@ const METHOD_NAME$R = "function.setup.addAgent";
|
|
|
13652
13662
|
const addAgent = beginContext((agentSchema) => {
|
|
13653
13663
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13654
13664
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13655
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13665
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
13656
13666
|
agentSchema,
|
|
13657
13667
|
});
|
|
13658
13668
|
// Register the agent in the validation and schema services
|
|
@@ -13662,7 +13672,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
13662
13672
|
return agentSchema.agentName;
|
|
13663
13673
|
});
|
|
13664
13674
|
|
|
13665
|
-
const METHOD_NAME$
|
|
13675
|
+
const METHOD_NAME$R = "function.setup.addCompletion";
|
|
13666
13676
|
/**
|
|
13667
13677
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
13668
13678
|
*
|
|
@@ -13682,7 +13692,7 @@ const METHOD_NAME$Q = "function.setup.addCompletion";
|
|
|
13682
13692
|
const addCompletion = beginContext((completionSchema) => {
|
|
13683
13693
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13684
13694
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13685
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13695
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
13686
13696
|
completionSchema,
|
|
13687
13697
|
});
|
|
13688
13698
|
// Register the completion in the validation and schema services
|
|
@@ -13692,7 +13702,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
13692
13702
|
return completionSchema.completionName;
|
|
13693
13703
|
});
|
|
13694
13704
|
|
|
13695
|
-
const METHOD_NAME$
|
|
13705
|
+
const METHOD_NAME$Q = "function.setup.addSwarm";
|
|
13696
13706
|
/**
|
|
13697
13707
|
* Adds a new swarm to the system for managing client sessions.
|
|
13698
13708
|
*
|
|
@@ -13712,7 +13722,7 @@ const METHOD_NAME$P = "function.setup.addSwarm";
|
|
|
13712
13722
|
const addSwarm = beginContext((swarmSchema) => {
|
|
13713
13723
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13714
13724
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13715
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13725
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
13716
13726
|
swarmSchema,
|
|
13717
13727
|
});
|
|
13718
13728
|
// Register the swarm in the validation and schema services
|
|
@@ -13722,7 +13732,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
13722
13732
|
return swarmSchema.swarmName;
|
|
13723
13733
|
});
|
|
13724
13734
|
|
|
13725
|
-
const METHOD_NAME$
|
|
13735
|
+
const METHOD_NAME$P = "function.setup.addTool";
|
|
13726
13736
|
/**
|
|
13727
13737
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
13728
13738
|
*
|
|
@@ -13744,7 +13754,7 @@ const METHOD_NAME$O = "function.setup.addTool";
|
|
|
13744
13754
|
const addTool = beginContext((toolSchema) => {
|
|
13745
13755
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13746
13756
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13747
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13757
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
13748
13758
|
toolSchema,
|
|
13749
13759
|
});
|
|
13750
13760
|
// Register the tool in the validation and schema services
|
|
@@ -13754,7 +13764,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
13754
13764
|
return toolSchema.toolName;
|
|
13755
13765
|
});
|
|
13756
13766
|
|
|
13757
|
-
const METHOD_NAME$
|
|
13767
|
+
const METHOD_NAME$O = "function.setup.addState";
|
|
13758
13768
|
/**
|
|
13759
13769
|
* Adds a new state to the state registry for use within the swarm system.
|
|
13760
13770
|
*
|
|
@@ -13776,7 +13786,7 @@ const METHOD_NAME$N = "function.setup.addState";
|
|
|
13776
13786
|
const addState = beginContext((stateSchema) => {
|
|
13777
13787
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13778
13788
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13779
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13789
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
13780
13790
|
stateSchema,
|
|
13781
13791
|
});
|
|
13782
13792
|
// Register the state in the schema service
|
|
@@ -13791,7 +13801,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
13791
13801
|
return stateSchema.stateName;
|
|
13792
13802
|
});
|
|
13793
13803
|
|
|
13794
|
-
const METHOD_NAME$
|
|
13804
|
+
const METHOD_NAME$N = "function.setup.addEmbedding";
|
|
13795
13805
|
/**
|
|
13796
13806
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
13797
13807
|
*
|
|
@@ -13811,7 +13821,7 @@ const METHOD_NAME$M = "function.setup.addEmbedding";
|
|
|
13811
13821
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
13812
13822
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13813
13823
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13814
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13824
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
13815
13825
|
embeddingSchema,
|
|
13816
13826
|
});
|
|
13817
13827
|
// Register the embedding in the validation and schema services
|
|
@@ -13821,7 +13831,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
13821
13831
|
return embeddingSchema.embeddingName;
|
|
13822
13832
|
});
|
|
13823
13833
|
|
|
13824
|
-
const METHOD_NAME$
|
|
13834
|
+
const METHOD_NAME$M = "function.setup.addStorage";
|
|
13825
13835
|
/**
|
|
13826
13836
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
13827
13837
|
*
|
|
@@ -13843,7 +13853,7 @@ const METHOD_NAME$L = "function.setup.addStorage";
|
|
|
13843
13853
|
const addStorage = beginContext((storageSchema) => {
|
|
13844
13854
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13845
13855
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13846
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13856
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
13847
13857
|
storageSchema,
|
|
13848
13858
|
});
|
|
13849
13859
|
// Register the storage in the validation and schema services
|
|
@@ -13860,7 +13870,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
13860
13870
|
});
|
|
13861
13871
|
|
|
13862
13872
|
/** @private Constant defining the method name for logging and validation context */
|
|
13863
|
-
const METHOD_NAME$
|
|
13873
|
+
const METHOD_NAME$L = "function.setup.addPolicy";
|
|
13864
13874
|
/**
|
|
13865
13875
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
13866
13876
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -13876,7 +13886,7 @@ const METHOD_NAME$K = "function.setup.addPolicy";
|
|
|
13876
13886
|
const addPolicy = beginContext((policySchema) => {
|
|
13877
13887
|
// Log the policy addition attempt if enabled
|
|
13878
13888
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13879
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13889
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
13880
13890
|
policySchema,
|
|
13881
13891
|
});
|
|
13882
13892
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -13887,7 +13897,7 @@ const addPolicy = beginContext((policySchema) => {
|
|
|
13887
13897
|
return policySchema.policyName;
|
|
13888
13898
|
});
|
|
13889
13899
|
|
|
13890
|
-
const METHOD_NAME$
|
|
13900
|
+
const METHOD_NAME$K = "function.other.markOnline";
|
|
13891
13901
|
/**
|
|
13892
13902
|
* Marks a client as online in the specified swarm.
|
|
13893
13903
|
*
|
|
@@ -13899,16 +13909,16 @@ const METHOD_NAME$J = "function.other.markOnline";
|
|
|
13899
13909
|
const markOnline = async (clientId, swarmName) => {
|
|
13900
13910
|
// Log the operation if logging is enabled in the global configuration
|
|
13901
13911
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13902
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
13912
|
+
swarm.loggerService.log(METHOD_NAME$K, {
|
|
13903
13913
|
clientId,
|
|
13904
13914
|
});
|
|
13905
13915
|
// Validate the swarm name
|
|
13906
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
13916
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$K);
|
|
13907
13917
|
// Run the operation in the method context
|
|
13908
13918
|
return await MethodContextService.runInContext(async () => {
|
|
13909
|
-
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$
|
|
13919
|
+
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$K);
|
|
13910
13920
|
}, {
|
|
13911
|
-
methodName: METHOD_NAME$
|
|
13921
|
+
methodName: METHOD_NAME$K,
|
|
13912
13922
|
agentName: "",
|
|
13913
13923
|
policyName: "",
|
|
13914
13924
|
stateName: "",
|
|
@@ -13918,7 +13928,7 @@ const markOnline = async (clientId, swarmName) => {
|
|
|
13918
13928
|
});
|
|
13919
13929
|
};
|
|
13920
13930
|
|
|
13921
|
-
const METHOD_NAME$
|
|
13931
|
+
const METHOD_NAME$J = "function.other.markOffline";
|
|
13922
13932
|
/**
|
|
13923
13933
|
* Marks a client as offline in the specified swarm.
|
|
13924
13934
|
*
|
|
@@ -13933,14 +13943,14 @@ const METHOD_NAME$I = "function.other.markOffline";
|
|
|
13933
13943
|
*/
|
|
13934
13944
|
const markOffline = async (clientId, swarmName) => {
|
|
13935
13945
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13936
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
13946
|
+
swarm.loggerService.log(METHOD_NAME$J, {
|
|
13937
13947
|
clientId,
|
|
13938
13948
|
});
|
|
13939
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
13949
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$J);
|
|
13940
13950
|
return await MethodContextService.runInContext(async () => {
|
|
13941
|
-
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$
|
|
13951
|
+
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$J);
|
|
13942
13952
|
}, {
|
|
13943
|
-
methodName: METHOD_NAME$
|
|
13953
|
+
methodName: METHOD_NAME$J,
|
|
13944
13954
|
agentName: "",
|
|
13945
13955
|
policyName: "",
|
|
13946
13956
|
stateName: "",
|
|
@@ -13950,7 +13960,7 @@ const markOffline = async (clientId, swarmName) => {
|
|
|
13950
13960
|
});
|
|
13951
13961
|
};
|
|
13952
13962
|
|
|
13953
|
-
const METHOD_NAME$
|
|
13963
|
+
const METHOD_NAME$I = "function.commit.commitToolOutput";
|
|
13954
13964
|
/**
|
|
13955
13965
|
* Commits the output of a tool execution to the active agent in a swarm session.
|
|
13956
13966
|
*
|
|
@@ -13970,19 +13980,19 @@ const METHOD_NAME$H = "function.commit.commitToolOutput";
|
|
|
13970
13980
|
const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
|
|
13971
13981
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
13972
13982
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
13973
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
13983
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
13974
13984
|
toolId,
|
|
13975
13985
|
content,
|
|
13976
13986
|
clientId,
|
|
13977
13987
|
agentName,
|
|
13978
13988
|
});
|
|
13979
13989
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
13980
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
13981
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
13990
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$I);
|
|
13991
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$I);
|
|
13982
13992
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
13983
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
13993
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$I);
|
|
13984
13994
|
// Check if the specified agent is still the active agent in the swarm session
|
|
13985
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
13995
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$I, clientId, swarmName);
|
|
13986
13996
|
if (currentAgentName !== agentName) {
|
|
13987
13997
|
// Log a skip message if the agent has changed during the operation
|
|
13988
13998
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -13995,11 +14005,11 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
|
|
|
13995
14005
|
return;
|
|
13996
14006
|
}
|
|
13997
14007
|
// Commit the tool output to the session via the session public service
|
|
13998
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
14008
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$I, clientId, swarmName);
|
|
13999
14009
|
});
|
|
14000
14010
|
|
|
14001
14011
|
/** @private Constant defining the method name for logging and validation context */
|
|
14002
|
-
const METHOD_NAME$
|
|
14012
|
+
const METHOD_NAME$H = "function.commit.commitSystemMessage";
|
|
14003
14013
|
/**
|
|
14004
14014
|
* Commits a system-generated message to the active agent in the swarm system.
|
|
14005
14015
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -14018,20 +14028,20 @@ const METHOD_NAME$G = "function.commit.commitSystemMessage";
|
|
|
14018
14028
|
const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
|
|
14019
14029
|
// Log the commit attempt if enabled
|
|
14020
14030
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14021
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14031
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
14022
14032
|
content,
|
|
14023
14033
|
clientId,
|
|
14024
14034
|
agentName,
|
|
14025
14035
|
});
|
|
14026
14036
|
// Validate the agent exists
|
|
14027
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14037
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$H);
|
|
14028
14038
|
// Validate the session exists and retrieve the associated swarm
|
|
14029
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14039
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$H);
|
|
14030
14040
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14031
14041
|
// Validate the swarm configuration
|
|
14032
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14042
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$H);
|
|
14033
14043
|
// Check if the current agent matches the provided agent
|
|
14034
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14044
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$H, clientId, swarmName);
|
|
14035
14045
|
if (currentAgentName !== agentName) {
|
|
14036
14046
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14037
14047
|
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
@@ -14042,11 +14052,11 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
|
|
|
14042
14052
|
return;
|
|
14043
14053
|
}
|
|
14044
14054
|
// Commit the system message via SessionPublicService
|
|
14045
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
14055
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$H, clientId, swarmName);
|
|
14046
14056
|
});
|
|
14047
14057
|
|
|
14048
14058
|
/** @private Constant defining the method name for logging and validation context */
|
|
14049
|
-
const METHOD_NAME$
|
|
14059
|
+
const METHOD_NAME$G = "function.commit.commitFlush";
|
|
14050
14060
|
/**
|
|
14051
14061
|
* Commits a flush of agent history for a specific client and agent in the swarm system.
|
|
14052
14062
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
|
|
@@ -14063,19 +14073,19 @@ const METHOD_NAME$F = "function.commit.commitFlush";
|
|
|
14063
14073
|
const commitFlush = beginContext(async (clientId, agentName) => {
|
|
14064
14074
|
// Log the flush attempt if enabled
|
|
14065
14075
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14066
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14076
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
14067
14077
|
clientId,
|
|
14068
14078
|
agentName,
|
|
14069
14079
|
});
|
|
14070
14080
|
// Validate the agent exists
|
|
14071
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14081
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$G);
|
|
14072
14082
|
// Validate the session exists and retrieve the associated swarm
|
|
14073
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14083
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$G);
|
|
14074
14084
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14075
14085
|
// Validate the swarm configuration
|
|
14076
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14086
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$G);
|
|
14077
14087
|
// Check if the current agent matches the provided agent
|
|
14078
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14088
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$G, clientId, swarmName);
|
|
14079
14089
|
if (currentAgentName !== agentName) {
|
|
14080
14090
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14081
14091
|
swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
@@ -14086,10 +14096,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
|
|
|
14086
14096
|
return;
|
|
14087
14097
|
}
|
|
14088
14098
|
// Commit the flush of agent history via SessionPublicService
|
|
14089
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
14099
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$G, clientId, swarmName);
|
|
14090
14100
|
});
|
|
14091
14101
|
|
|
14092
|
-
const METHOD_NAME$
|
|
14102
|
+
const METHOD_NAME$F = "function.commit.commitSystemMessage";
|
|
14093
14103
|
/**
|
|
14094
14104
|
* Commits a user message to the active agent's history in a swarm session without triggering a response.
|
|
14095
14105
|
*
|
|
@@ -14108,19 +14118,19 @@ const METHOD_NAME$E = "function.commit.commitSystemMessage";
|
|
|
14108
14118
|
const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
|
|
14109
14119
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14110
14120
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14111
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14121
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {
|
|
14112
14122
|
content,
|
|
14113
14123
|
clientId,
|
|
14114
14124
|
agentName,
|
|
14115
14125
|
mode,
|
|
14116
14126
|
});
|
|
14117
14127
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
14118
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14119
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14128
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$F);
|
|
14129
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$F);
|
|
14120
14130
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14121
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14131
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$F);
|
|
14122
14132
|
// Check if the specified agent is still the active agent in the swarm session
|
|
14123
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14133
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$F, clientId, swarmName);
|
|
14124
14134
|
if (currentAgentName !== agentName) {
|
|
14125
14135
|
// Log a skip message if the agent has changed during the operation
|
|
14126
14136
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -14133,17 +14143,17 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
|
|
|
14133
14143
|
}
|
|
14134
14144
|
if (payload) {
|
|
14135
14145
|
return await PayloadContextService.runInContext(async () => {
|
|
14136
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
14146
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$F, clientId, swarmName);
|
|
14137
14147
|
}, {
|
|
14138
14148
|
clientId,
|
|
14139
14149
|
payload,
|
|
14140
14150
|
});
|
|
14141
14151
|
}
|
|
14142
14152
|
// Commit the user message to the agent's history via the session public service
|
|
14143
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
14153
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$F, clientId, swarmName);
|
|
14144
14154
|
});
|
|
14145
14155
|
|
|
14146
|
-
const METHOD_NAME$
|
|
14156
|
+
const METHOD_NAME$E = "function.commit.commitToolOutputForce";
|
|
14147
14157
|
/**
|
|
14148
14158
|
* Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
|
|
14149
14159
|
*
|
|
@@ -14162,21 +14172,21 @@ const METHOD_NAME$D = "function.commit.commitToolOutputForce";
|
|
|
14162
14172
|
const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
|
|
14163
14173
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14164
14174
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14165
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14175
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {
|
|
14166
14176
|
toolId,
|
|
14167
14177
|
content,
|
|
14168
14178
|
clientId,
|
|
14169
14179
|
});
|
|
14170
14180
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
14171
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14181
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
|
|
14172
14182
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14173
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14183
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
|
|
14174
14184
|
// Commit the tool output to the session via the session public service without checking the active agent
|
|
14175
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
14185
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$E, clientId, swarmName);
|
|
14176
14186
|
});
|
|
14177
14187
|
|
|
14178
14188
|
/** @private Constant defining the method name for logging and validation context */
|
|
14179
|
-
const METHOD_NAME$
|
|
14189
|
+
const METHOD_NAME$D = "function.commit.commitSystemMessageForce";
|
|
14180
14190
|
/**
|
|
14181
14191
|
* Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
|
|
14182
14192
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -14195,21 +14205,21 @@ const METHOD_NAME$C = "function.commit.commitSystemMessageForce";
|
|
|
14195
14205
|
const commitSystemMessageForce = beginContext(async (content, clientId) => {
|
|
14196
14206
|
// Log the commit attempt if enabled
|
|
14197
14207
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14198
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14208
|
+
swarm$1.loggerService.log(METHOD_NAME$D, {
|
|
14199
14209
|
content,
|
|
14200
14210
|
clientId,
|
|
14201
14211
|
});
|
|
14202
14212
|
// Validate the session exists and retrieve the associated swarm
|
|
14203
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14213
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
|
|
14204
14214
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14205
14215
|
// Validate the swarm configuration
|
|
14206
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14216
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
|
|
14207
14217
|
// Commit the system message via SessionPublicService without agent checks
|
|
14208
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
14218
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$D, clientId, swarmName);
|
|
14209
14219
|
});
|
|
14210
14220
|
|
|
14211
14221
|
/** @private Constant defining the method name for logging and validation context */
|
|
14212
|
-
const METHOD_NAME$
|
|
14222
|
+
const METHOD_NAME$C = "function.commit.commitFlushForce";
|
|
14213
14223
|
/**
|
|
14214
14224
|
* Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
|
|
14215
14225
|
* Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
|
|
@@ -14227,20 +14237,20 @@ const METHOD_NAME$B = "function.commit.commitFlushForce";
|
|
|
14227
14237
|
const commitFlushForce = beginContext(async (clientId) => {
|
|
14228
14238
|
// Log the flush attempt if enabled
|
|
14229
14239
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14230
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14240
|
+
swarm$1.loggerService.log(METHOD_NAME$C, {
|
|
14231
14241
|
clientId,
|
|
14232
|
-
METHOD_NAME: METHOD_NAME$
|
|
14242
|
+
METHOD_NAME: METHOD_NAME$C,
|
|
14233
14243
|
});
|
|
14234
14244
|
// Validate the session exists and retrieve the associated swarm
|
|
14235
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14245
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
|
|
14236
14246
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14237
14247
|
// Validate the swarm configuration
|
|
14238
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14248
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
|
|
14239
14249
|
// Commit the flush of agent history via SessionPublicService without agent checks
|
|
14240
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
14250
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$C, clientId, swarmName);
|
|
14241
14251
|
});
|
|
14242
14252
|
|
|
14243
|
-
const METHOD_NAME$
|
|
14253
|
+
const METHOD_NAME$B = "function.commit.commitSystemMessage";
|
|
14244
14254
|
/**
|
|
14245
14255
|
* Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
|
|
14246
14256
|
*
|
|
@@ -14258,29 +14268,29 @@ const METHOD_NAME$A = "function.commit.commitSystemMessage";
|
|
|
14258
14268
|
const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
|
|
14259
14269
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14260
14270
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14261
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14271
|
+
swarm$1.loggerService.log(METHOD_NAME$B, {
|
|
14262
14272
|
content,
|
|
14263
14273
|
clientId,
|
|
14264
14274
|
mode,
|
|
14265
14275
|
});
|
|
14266
14276
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
14267
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14277
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
|
|
14268
14278
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14269
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14279
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
|
|
14270
14280
|
if (payload) {
|
|
14271
14281
|
return await PayloadContextService.runInContext(async () => {
|
|
14272
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
14282
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$B, clientId, swarmName);
|
|
14273
14283
|
}, {
|
|
14274
14284
|
clientId,
|
|
14275
14285
|
payload,
|
|
14276
14286
|
});
|
|
14277
14287
|
}
|
|
14278
14288
|
// Commit the user message to the agent's history via the session public service without checking the active agent
|
|
14279
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
14289
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$B, clientId, swarmName);
|
|
14280
14290
|
});
|
|
14281
14291
|
|
|
14282
14292
|
/** @private Constant defining the method name for logging and validation context */
|
|
14283
|
-
const METHOD_NAME$
|
|
14293
|
+
const METHOD_NAME$A = "function.commit.commitAssistantMessage";
|
|
14284
14294
|
/**
|
|
14285
14295
|
* Commits an assistant-generated message to the active agent in the swarm system.
|
|
14286
14296
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -14298,20 +14308,20 @@ const METHOD_NAME$z = "function.commit.commitAssistantMessage";
|
|
|
14298
14308
|
const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
|
|
14299
14309
|
// Log the commit attempt if enabled
|
|
14300
14310
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14301
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14311
|
+
swarm$1.loggerService.log(METHOD_NAME$A, {
|
|
14302
14312
|
content,
|
|
14303
14313
|
clientId,
|
|
14304
14314
|
agentName,
|
|
14305
14315
|
});
|
|
14306
14316
|
// Validate the agent exists
|
|
14307
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14317
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$A);
|
|
14308
14318
|
// Validate the session exists and retrieve the associated swarm
|
|
14309
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14319
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
|
|
14310
14320
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14311
14321
|
// Validate the swarm configuration
|
|
14312
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14322
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
|
|
14313
14323
|
// Check if the current agent matches the provided agent
|
|
14314
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14324
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$A, clientId, swarmName);
|
|
14315
14325
|
if (currentAgentName !== agentName) {
|
|
14316
14326
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14317
14327
|
swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
|
|
@@ -14322,11 +14332,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
|
|
|
14322
14332
|
return;
|
|
14323
14333
|
}
|
|
14324
14334
|
// Commit the assistant message via SessionPublicService
|
|
14325
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
14335
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$A, clientId, swarmName);
|
|
14326
14336
|
});
|
|
14327
14337
|
|
|
14328
14338
|
/** @private Constant defining the method name for logging and validation context */
|
|
14329
|
-
const METHOD_NAME$
|
|
14339
|
+
const METHOD_NAME$z = "function.commit.commitAssistantMessageForce";
|
|
14330
14340
|
/**
|
|
14331
14341
|
* Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
|
|
14332
14342
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -14345,21 +14355,21 @@ const METHOD_NAME$y = "function.commit.commitAssistantMessageForce";
|
|
|
14345
14355
|
const commitAssistantMessageForce = beginContext(async (content, clientId) => {
|
|
14346
14356
|
// Log the commit attempt if enabled
|
|
14347
14357
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14348
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14358
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
14349
14359
|
content,
|
|
14350
14360
|
clientId,
|
|
14351
14361
|
});
|
|
14352
14362
|
// Validate the session exists and retrieve the associated swarm
|
|
14353
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14363
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
|
|
14354
14364
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14355
14365
|
// Validate the swarm configuration
|
|
14356
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14366
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
|
|
14357
14367
|
// Commit the assistant message via SessionPublicService without agent checks
|
|
14358
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
14368
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$z, clientId, swarmName);
|
|
14359
14369
|
});
|
|
14360
14370
|
|
|
14361
14371
|
/** @private Constant defining the method name for logging and validation context */
|
|
14362
|
-
const METHOD_NAME$
|
|
14372
|
+
const METHOD_NAME$y = "function.commit.cancelOutput";
|
|
14363
14373
|
/**
|
|
14364
14374
|
* Cancels the awaited output for a specific client and agent by emitting an empty string.
|
|
14365
14375
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
|
|
@@ -14375,19 +14385,19 @@ const METHOD_NAME$x = "function.commit.cancelOutput";
|
|
|
14375
14385
|
const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
14376
14386
|
// Log the cancellation attempt if enabled
|
|
14377
14387
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14378
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14388
|
+
swarm$1.loggerService.log(METHOD_NAME$y, {
|
|
14379
14389
|
clientId,
|
|
14380
14390
|
agentName,
|
|
14381
14391
|
});
|
|
14382
14392
|
// Validate the agent exists
|
|
14383
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14393
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$y);
|
|
14384
14394
|
// Validate the session exists and retrieve the associated swarm
|
|
14385
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14395
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
|
|
14386
14396
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14387
14397
|
// Validate the swarm configuration
|
|
14388
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14398
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
|
|
14389
14399
|
// Check if the current agent matches the provided agent
|
|
14390
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14400
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$y, clientId, swarmName);
|
|
14391
14401
|
if (currentAgentName !== agentName) {
|
|
14392
14402
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14393
14403
|
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
@@ -14398,11 +14408,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
|
14398
14408
|
return;
|
|
14399
14409
|
}
|
|
14400
14410
|
// Perform the output cancellation via SwarmPublicService
|
|
14401
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
14411
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$y, clientId, swarmName);
|
|
14402
14412
|
});
|
|
14403
14413
|
|
|
14404
14414
|
/** @private Constant defining the method name for logging and validation context */
|
|
14405
|
-
const METHOD_NAME$
|
|
14415
|
+
const METHOD_NAME$x = "function.commit.cancelOutputForce";
|
|
14406
14416
|
/**
|
|
14407
14417
|
* Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
|
|
14408
14418
|
* Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
|
|
@@ -14419,20 +14429,20 @@ const METHOD_NAME$w = "function.commit.cancelOutputForce";
|
|
|
14419
14429
|
const cancelOutputForce = beginContext(async (clientId) => {
|
|
14420
14430
|
// Log the cancellation attempt if enabled
|
|
14421
14431
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14422
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14432
|
+
swarm$1.loggerService.log(METHOD_NAME$x, {
|
|
14423
14433
|
clientId,
|
|
14424
14434
|
});
|
|
14425
14435
|
// Validate the session exists and retrieve the associated swarm
|
|
14426
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14436
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
|
|
14427
14437
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14428
14438
|
// Validate the swarm configuration
|
|
14429
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14439
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
|
|
14430
14440
|
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
14431
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
14441
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$x, clientId, swarmName);
|
|
14432
14442
|
});
|
|
14433
14443
|
|
|
14434
14444
|
/** @private Constant defining the method name for logging and validation context */
|
|
14435
|
-
const METHOD_NAME$
|
|
14445
|
+
const METHOD_NAME$w = "function.commit.commitStopTools";
|
|
14436
14446
|
/**
|
|
14437
14447
|
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
14438
14448
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
|
|
@@ -14449,19 +14459,19 @@ const METHOD_NAME$v = "function.commit.commitStopTools";
|
|
|
14449
14459
|
const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
14450
14460
|
// Log the stop tools attempt if enabled
|
|
14451
14461
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14452
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14462
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
14453
14463
|
clientId,
|
|
14454
14464
|
agentName,
|
|
14455
14465
|
});
|
|
14456
14466
|
// Validate the agent exists
|
|
14457
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14467
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
|
|
14458
14468
|
// Validate the session exists and retrieve the associated swarm
|
|
14459
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14469
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
|
|
14460
14470
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14461
14471
|
// Validate the swarm configuration
|
|
14462
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14472
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
|
|
14463
14473
|
// Check if the current agent matches the provided agent
|
|
14464
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14474
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName);
|
|
14465
14475
|
if (currentAgentName !== agentName) {
|
|
14466
14476
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14467
14477
|
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
@@ -14472,11 +14482,11 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
|
14472
14482
|
return;
|
|
14473
14483
|
}
|
|
14474
14484
|
// Commit the stop of the next tool execution via SessionPublicService
|
|
14475
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
14485
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$w, clientId, swarmName);
|
|
14476
14486
|
});
|
|
14477
14487
|
|
|
14478
14488
|
/** @private Constant defining the method name for logging and validation context */
|
|
14479
|
-
const METHOD_NAME$
|
|
14489
|
+
const METHOD_NAME$v = "function.commit.commitStopToolsForce";
|
|
14480
14490
|
/**
|
|
14481
14491
|
* Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
|
|
14482
14492
|
* Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
|
|
@@ -14494,20 +14504,20 @@ const METHOD_NAME$u = "function.commit.commitStopToolsForce";
|
|
|
14494
14504
|
const commitStopToolsForce = beginContext(async (clientId) => {
|
|
14495
14505
|
// Log the stop tools attempt if enabled
|
|
14496
14506
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14497
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14507
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
14498
14508
|
clientId,
|
|
14499
|
-
METHOD_NAME: METHOD_NAME$
|
|
14509
|
+
METHOD_NAME: METHOD_NAME$v,
|
|
14500
14510
|
});
|
|
14501
14511
|
// Validate the session exists and retrieve the associated swarm
|
|
14502
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14512
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
14503
14513
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14504
14514
|
// Validate the swarm configuration
|
|
14505
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14515
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
14506
14516
|
// Commit the stop of the next tool execution via SessionPublicService without agent checks
|
|
14507
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
14517
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$v, clientId, swarmName);
|
|
14508
14518
|
});
|
|
14509
14519
|
|
|
14510
|
-
const METHOD_NAME$
|
|
14520
|
+
const METHOD_NAME$u = "function.target.emitForce";
|
|
14511
14521
|
/**
|
|
14512
14522
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
14513
14523
|
*
|
|
@@ -14526,19 +14536,19 @@ const METHOD_NAME$t = "function.target.emitForce";
|
|
|
14526
14536
|
const emitForce = beginContext(async (content, clientId) => {
|
|
14527
14537
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14528
14538
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14529
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14539
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
14530
14540
|
content,
|
|
14531
14541
|
clientId,
|
|
14532
14542
|
});
|
|
14533
14543
|
// Validate the session and swarm
|
|
14534
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14544
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
14535
14545
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14536
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14546
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
14537
14547
|
// Emit the content directly via the session public service
|
|
14538
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
14548
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$u, clientId, swarmName);
|
|
14539
14549
|
});
|
|
14540
14550
|
|
|
14541
|
-
const METHOD_NAME$
|
|
14551
|
+
const METHOD_NAME$t = "function.target.executeForce";
|
|
14542
14552
|
/**
|
|
14543
14553
|
* 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.
|
|
14544
14554
|
*
|
|
@@ -14559,22 +14569,22 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
14559
14569
|
const executionId = functoolsKit.randomString();
|
|
14560
14570
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14561
14571
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14562
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14572
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
14563
14573
|
content,
|
|
14564
14574
|
clientId,
|
|
14565
14575
|
executionId,
|
|
14566
14576
|
});
|
|
14567
14577
|
// Validate the session and swarm
|
|
14568
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14578
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
14569
14579
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14570
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14580
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
14571
14581
|
// Execute the command within an execution context with performance tracking
|
|
14572
14582
|
return ExecutionContextService.runInContext(async () => {
|
|
14573
14583
|
let isFinished = false;
|
|
14574
14584
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
14575
14585
|
try {
|
|
14576
14586
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
14577
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
14587
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$t, clientId, swarmName);
|
|
14578
14588
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
14579
14589
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
14580
14590
|
return result;
|
|
@@ -14591,7 +14601,7 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
14591
14601
|
});
|
|
14592
14602
|
});
|
|
14593
14603
|
|
|
14594
|
-
const METHOD_NAME$
|
|
14604
|
+
const METHOD_NAME$s = "function.target.disposeConnection";
|
|
14595
14605
|
/**
|
|
14596
14606
|
* Disposes of a client session and all related resources within a swarm.
|
|
14597
14607
|
*
|
|
@@ -14608,10 +14618,10 @@ const METHOD_NAME$r = "function.target.disposeConnection";
|
|
|
14608
14618
|
* @example
|
|
14609
14619
|
* await disposeConnection("client-123", "TaskSwarm");
|
|
14610
14620
|
*/
|
|
14611
|
-
const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$
|
|
14621
|
+
const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$s) => {
|
|
14612
14622
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14613
14623
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14614
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14624
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
14615
14625
|
clientId,
|
|
14616
14626
|
swarmName,
|
|
14617
14627
|
});
|
|
@@ -14683,7 +14693,7 @@ const disposeConnection = beginContext(async (clientId, swarmName, methodName =
|
|
|
14683
14693
|
PersistMemoryAdapter.dispose(clientId);
|
|
14684
14694
|
});
|
|
14685
14695
|
|
|
14686
|
-
const METHOD_NAME$
|
|
14696
|
+
const METHOD_NAME$r = "function.target.makeAutoDispose";
|
|
14687
14697
|
/**
|
|
14688
14698
|
* Default timeout in seconds before auto-dispose is triggered.
|
|
14689
14699
|
* @constant {number}
|
|
@@ -14714,7 +14724,7 @@ const DEFAULT_TIMEOUT = 15 * 60;
|
|
|
14714
14724
|
const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DEFAULT_TIMEOUT, onDestroy, } = {}) => {
|
|
14715
14725
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14716
14726
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14717
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14727
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
14718
14728
|
clientId,
|
|
14719
14729
|
swarmName,
|
|
14720
14730
|
});
|
|
@@ -14747,7 +14757,7 @@ const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DE
|
|
|
14747
14757
|
};
|
|
14748
14758
|
});
|
|
14749
14759
|
|
|
14750
|
-
const METHOD_NAME$
|
|
14760
|
+
const METHOD_NAME$q = "function.target.execute";
|
|
14751
14761
|
/**
|
|
14752
14762
|
* Sends a message to the active agent in a swarm session as if it originated from the client side.
|
|
14753
14763
|
*
|
|
@@ -14769,19 +14779,19 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
14769
14779
|
const executionId = functoolsKit.randomString();
|
|
14770
14780
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14771
14781
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14772
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14782
|
+
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
14773
14783
|
content,
|
|
14774
14784
|
clientId,
|
|
14775
14785
|
agentName,
|
|
14776
14786
|
executionId,
|
|
14777
14787
|
});
|
|
14778
14788
|
// Validate the agent, session, and swarm
|
|
14779
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14780
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14789
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$q);
|
|
14790
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
|
|
14781
14791
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14782
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14792
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
|
|
14783
14793
|
// Check if the specified agent is still the active agent
|
|
14784
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14794
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$q, clientId, swarmName);
|
|
14785
14795
|
if (currentAgentName !== agentName) {
|
|
14786
14796
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14787
14797
|
swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
|
|
@@ -14800,7 +14810,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
14800
14810
|
agentName,
|
|
14801
14811
|
swarmName,
|
|
14802
14812
|
});
|
|
14803
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
14813
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$q, clientId, swarmName);
|
|
14804
14814
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
14805
14815
|
swarm$1.busService.commitExecutionEnd(clientId, {
|
|
14806
14816
|
agentName,
|
|
@@ -14820,7 +14830,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
14820
14830
|
});
|
|
14821
14831
|
});
|
|
14822
14832
|
|
|
14823
|
-
const METHOD_NAME$
|
|
14833
|
+
const METHOD_NAME$p = "function.target.emit";
|
|
14824
14834
|
/**
|
|
14825
14835
|
* Emits a string as model output without executing an incoming message, with agent activity validation.
|
|
14826
14836
|
*
|
|
@@ -14840,18 +14850,18 @@ const METHOD_NAME$o = "function.target.emit";
|
|
|
14840
14850
|
const emit = beginContext(async (content, clientId, agentName) => {
|
|
14841
14851
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14842
14852
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14843
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14853
|
+
swarm$1.loggerService.log(METHOD_NAME$p, {
|
|
14844
14854
|
content,
|
|
14845
14855
|
clientId,
|
|
14846
14856
|
agentName,
|
|
14847
14857
|
});
|
|
14848
14858
|
// Validate the agent, session, and swarm
|
|
14849
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14850
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14859
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$p);
|
|
14860
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
14851
14861
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14852
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14862
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
14853
14863
|
// Check if the specified agent is still the active agent
|
|
14854
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14864
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$p, clientId, swarmName);
|
|
14855
14865
|
if (currentAgentName !== agentName) {
|
|
14856
14866
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14857
14867
|
swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
|
|
@@ -14862,10 +14872,10 @@ const emit = beginContext(async (content, clientId, agentName) => {
|
|
|
14862
14872
|
return;
|
|
14863
14873
|
}
|
|
14864
14874
|
// Emit the content directly via the session public service
|
|
14865
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
14875
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$p, clientId, swarmName);
|
|
14866
14876
|
});
|
|
14867
14877
|
|
|
14868
|
-
const METHOD_NAME$
|
|
14878
|
+
const METHOD_NAME$o = "function.target.notify";
|
|
14869
14879
|
/**
|
|
14870
14880
|
* Sends a notification message as output from the swarm session without executing an incoming message.
|
|
14871
14881
|
*
|
|
@@ -14885,23 +14895,23 @@ const METHOD_NAME$n = "function.target.notify";
|
|
|
14885
14895
|
const notify = beginContext(async (content, clientId, agentName) => {
|
|
14886
14896
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14887
14897
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14888
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14898
|
+
swarm$1.loggerService.log(METHOD_NAME$o, {
|
|
14889
14899
|
content,
|
|
14890
14900
|
clientId,
|
|
14891
14901
|
agentName,
|
|
14892
14902
|
});
|
|
14893
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14903
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$o);
|
|
14894
14904
|
// Check if the session mode is "makeConnection"
|
|
14895
14905
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
|
|
14896
14906
|
"makeConnection") {
|
|
14897
14907
|
throw new Error(`agent-swarm-kit notify session is not makeConnection clientId=${clientId}`);
|
|
14898
14908
|
}
|
|
14899
14909
|
// Validate the agent, session, and swarm
|
|
14900
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14910
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$o);
|
|
14901
14911
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14902
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14912
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$o);
|
|
14903
14913
|
// Check if the specified agent is still the active agent
|
|
14904
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14914
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$o, clientId, swarmName);
|
|
14905
14915
|
if (currentAgentName !== agentName) {
|
|
14906
14916
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14907
14917
|
swarm$1.loggerService.log('function "notify" skipped due to the agent change', {
|
|
@@ -14912,10 +14922,10 @@ const notify = beginContext(async (content, clientId, agentName) => {
|
|
|
14912
14922
|
return;
|
|
14913
14923
|
}
|
|
14914
14924
|
// Notify the content directly via the session public service
|
|
14915
|
-
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$
|
|
14925
|
+
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$o, clientId, swarmName);
|
|
14916
14926
|
});
|
|
14917
14927
|
|
|
14918
|
-
const METHOD_NAME$
|
|
14928
|
+
const METHOD_NAME$n = "function.target.notifyForce";
|
|
14919
14929
|
/**
|
|
14920
14930
|
* Sends a notification message as output from the swarm session without executing an incoming message.
|
|
14921
14931
|
*
|
|
@@ -14935,28 +14945,28 @@ const METHOD_NAME$m = "function.target.notifyForce";
|
|
|
14935
14945
|
const notifyForce = beginContext(async (content, clientId, agentName) => {
|
|
14936
14946
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14937
14947
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14938
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14948
|
+
swarm$1.loggerService.log(METHOD_NAME$n, {
|
|
14939
14949
|
content,
|
|
14940
14950
|
clientId,
|
|
14941
14951
|
agentName,
|
|
14942
14952
|
});
|
|
14943
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14953
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$n);
|
|
14944
14954
|
// Check if the session mode is "makeConnection"
|
|
14945
14955
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
|
|
14946
14956
|
"makeConnection") {
|
|
14947
14957
|
throw new Error(`agent-swarm-kit notifyForce session is not makeConnection clientId=${clientId}`);
|
|
14948
14958
|
}
|
|
14949
14959
|
// Validate the agent, session, and swarm
|
|
14950
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14960
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$n);
|
|
14951
14961
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14952
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14962
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$n);
|
|
14953
14963
|
// Check if the specified agent is still the active agent
|
|
14954
|
-
await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
14964
|
+
await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$n, clientId, swarmName);
|
|
14955
14965
|
// Notify the content directly via the session public service
|
|
14956
|
-
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$
|
|
14966
|
+
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$n, clientId, swarmName);
|
|
14957
14967
|
});
|
|
14958
14968
|
|
|
14959
|
-
const METHOD_NAME$
|
|
14969
|
+
const METHOD_NAME$m = "function.target.runStateless";
|
|
14960
14970
|
/**
|
|
14961
14971
|
* Executes a message statelessly with an agent in a swarm session, bypassing chat history.
|
|
14962
14972
|
*
|
|
@@ -14979,19 +14989,19 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
14979
14989
|
const executionId = functoolsKit.randomString();
|
|
14980
14990
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14981
14991
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14982
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14992
|
+
swarm$1.loggerService.log(METHOD_NAME$m, {
|
|
14983
14993
|
content,
|
|
14984
14994
|
clientId,
|
|
14985
14995
|
agentName,
|
|
14986
14996
|
executionId,
|
|
14987
14997
|
});
|
|
14988
14998
|
// Validate the agent, session, and swarm
|
|
14989
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14990
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
14999
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$m);
|
|
15000
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$m);
|
|
14991
15001
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
14992
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15002
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
|
|
14993
15003
|
// Check if the specified agent is still the active agent
|
|
14994
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
15004
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$m, clientId, swarmName);
|
|
14995
15005
|
if (currentAgentName !== agentName) {
|
|
14996
15006
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14997
15007
|
swarm$1.loggerService.log('function "runStateless" skipped due to the agent change', {
|
|
@@ -15010,7 +15020,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
15010
15020
|
agentName,
|
|
15011
15021
|
swarmName,
|
|
15012
15022
|
});
|
|
15013
|
-
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$
|
|
15023
|
+
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$m, clientId, swarmName);
|
|
15014
15024
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
15015
15025
|
swarm$1.busService.commitExecutionEnd(clientId, {
|
|
15016
15026
|
agentName,
|
|
@@ -15030,7 +15040,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
15030
15040
|
});
|
|
15031
15041
|
});
|
|
15032
15042
|
|
|
15033
|
-
const METHOD_NAME$
|
|
15043
|
+
const METHOD_NAME$l = "function.target.runStatelessForce";
|
|
15034
15044
|
/**
|
|
15035
15045
|
* Executes a message statelessly with the active agent in a swarm session, bypassing chat history and forcing execution regardless of agent activity.
|
|
15036
15046
|
*
|
|
@@ -15051,22 +15061,22 @@ const runStatelessForce = beginContext(async (content, clientId) => {
|
|
|
15051
15061
|
const executionId = functoolsKit.randomString();
|
|
15052
15062
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15053
15063
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15054
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15064
|
+
swarm$1.loggerService.log(METHOD_NAME$l, {
|
|
15055
15065
|
content,
|
|
15056
15066
|
clientId,
|
|
15057
15067
|
executionId,
|
|
15058
15068
|
});
|
|
15059
15069
|
// Validate the session and swarm
|
|
15060
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15070
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
|
|
15061
15071
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
15062
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15072
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
|
|
15063
15073
|
// Execute the command statelessly within an execution context with performance tracking
|
|
15064
15074
|
return ExecutionContextService.runInContext(async () => {
|
|
15065
15075
|
let isFinished = false;
|
|
15066
15076
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
15067
15077
|
try {
|
|
15068
15078
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
15069
|
-
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$
|
|
15079
|
+
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$l, clientId, swarmName);
|
|
15070
15080
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
15071
15081
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
15072
15082
|
return result;
|
|
@@ -15093,7 +15103,7 @@ const SCHEDULED_DELAY$1 = 1000;
|
|
|
15093
15103
|
* @constant {number}
|
|
15094
15104
|
*/
|
|
15095
15105
|
const RATE_DELAY = 10000;
|
|
15096
|
-
const METHOD_NAME$
|
|
15106
|
+
const METHOD_NAME$k = "function.target.makeConnection";
|
|
15097
15107
|
/**
|
|
15098
15108
|
* Internal implementation of the connection factory for a client to a swarm.
|
|
15099
15109
|
*
|
|
@@ -15108,21 +15118,21 @@ const METHOD_NAME$j = "function.target.makeConnection";
|
|
|
15108
15118
|
const makeConnectionInternal = (connector, clientId, swarmName) => {
|
|
15109
15119
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15110
15120
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15111
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15121
|
+
swarm$1.loggerService.log(METHOD_NAME$k, {
|
|
15112
15122
|
clientId,
|
|
15113
15123
|
swarmName,
|
|
15114
15124
|
});
|
|
15115
15125
|
// Validate the swarm and initialize the session
|
|
15116
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15126
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
|
|
15117
15127
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
15118
15128
|
// Create a queued send function using the session public service
|
|
15119
|
-
const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$
|
|
15129
|
+
const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$k, clientId, swarmName));
|
|
15120
15130
|
// Return a wrapped send function with validation and agent context
|
|
15121
15131
|
return (async (outgoing) => {
|
|
15122
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15132
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
|
|
15123
15133
|
return await send({
|
|
15124
15134
|
data: outgoing,
|
|
15125
|
-
agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
15135
|
+
agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName),
|
|
15126
15136
|
clientId,
|
|
15127
15137
|
});
|
|
15128
15138
|
});
|
|
@@ -15205,13 +15215,13 @@ makeConnection.scheduled = (connector, clientId, swarmName, { delay = SCHEDULED_
|
|
|
15205
15215
|
await online();
|
|
15206
15216
|
if (payload) {
|
|
15207
15217
|
return await PayloadContextService.runInContext(async () => {
|
|
15208
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
15218
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$k, clientId, swarmName);
|
|
15209
15219
|
}, {
|
|
15210
15220
|
clientId,
|
|
15211
15221
|
payload,
|
|
15212
15222
|
});
|
|
15213
15223
|
}
|
|
15214
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
15224
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$k, clientId, swarmName);
|
|
15215
15225
|
}),
|
|
15216
15226
|
delay,
|
|
15217
15227
|
});
|
|
@@ -15274,7 +15284,7 @@ makeConnection.rate = (connector, clientId, swarmName, { delay = RATE_DELAY } =
|
|
|
15274
15284
|
};
|
|
15275
15285
|
};
|
|
15276
15286
|
|
|
15277
|
-
const METHOD_NAME$
|
|
15287
|
+
const METHOD_NAME$j = "function.target.complete";
|
|
15278
15288
|
/**
|
|
15279
15289
|
* Time-to-live for the complete function in milliseconds.
|
|
15280
15290
|
* Defines how long the cached complete function remains valid before expiring.
|
|
@@ -15340,7 +15350,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
15340
15350
|
const executionId = functoolsKit.randomString();
|
|
15341
15351
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15342
15352
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15343
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15353
|
+
swarm$1.loggerService.log(METHOD_NAME$j, {
|
|
15344
15354
|
content,
|
|
15345
15355
|
clientId,
|
|
15346
15356
|
executionId,
|
|
@@ -15358,7 +15368,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
15358
15368
|
swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
|
|
15359
15369
|
try {
|
|
15360
15370
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
15361
|
-
const result = await run(METHOD_NAME$
|
|
15371
|
+
const result = await run(METHOD_NAME$j, content);
|
|
15362
15372
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
15363
15373
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
15364
15374
|
return result;
|
|
@@ -15388,7 +15398,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
15388
15398
|
* @constant {number}
|
|
15389
15399
|
*/
|
|
15390
15400
|
const SCHEDULED_DELAY = 1000;
|
|
15391
|
-
const METHOD_NAME$
|
|
15401
|
+
const METHOD_NAME$i = "function.target.session";
|
|
15392
15402
|
/**
|
|
15393
15403
|
* Internal implementation of the session factory for a client and swarm.
|
|
15394
15404
|
*
|
|
@@ -15403,23 +15413,23 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
|
|
|
15403
15413
|
const executionId = functoolsKit.randomString();
|
|
15404
15414
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15405
15415
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15406
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15416
|
+
swarm$1.loggerService.log(METHOD_NAME$i, {
|
|
15407
15417
|
clientId,
|
|
15408
15418
|
swarmName,
|
|
15409
15419
|
executionId,
|
|
15410
15420
|
});
|
|
15411
15421
|
// Validate the swarm and initialize the session
|
|
15412
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15422
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
|
|
15413
15423
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
15414
15424
|
const complete = functoolsKit.queued(async (content) => {
|
|
15415
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15425
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
|
|
15416
15426
|
return ExecutionContextService.runInContext(async () => {
|
|
15417
15427
|
let isFinished = false;
|
|
15418
15428
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
15419
15429
|
swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
|
|
15420
15430
|
try {
|
|
15421
15431
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
15422
|
-
const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$
|
|
15432
|
+
const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$i, clientId, swarmName);
|
|
15423
15433
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
15424
15434
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
15425
15435
|
return result;
|
|
@@ -15440,7 +15450,7 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
|
|
|
15440
15450
|
return await complete(content);
|
|
15441
15451
|
}),
|
|
15442
15452
|
dispose: async () => {
|
|
15443
|
-
await disposeConnection(clientId, swarmName, METHOD_NAME$
|
|
15453
|
+
await disposeConnection(clientId, swarmName, METHOD_NAME$i);
|
|
15444
15454
|
await onDispose();
|
|
15445
15455
|
},
|
|
15446
15456
|
};
|
|
@@ -15540,13 +15550,13 @@ session.scheduled = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose }
|
|
|
15540
15550
|
await online();
|
|
15541
15551
|
if (payload) {
|
|
15542
15552
|
return await PayloadContextService.runInContext(async () => {
|
|
15543
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
15553
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$i, clientId, swarmName);
|
|
15544
15554
|
}, {
|
|
15545
15555
|
clientId,
|
|
15546
15556
|
payload,
|
|
15547
15557
|
});
|
|
15548
15558
|
}
|
|
15549
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
15559
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$i, clientId, swarmName);
|
|
15550
15560
|
}),
|
|
15551
15561
|
delay,
|
|
15552
15562
|
});
|
|
@@ -15626,7 +15636,7 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose } = {}
|
|
|
15626
15636
|
};
|
|
15627
15637
|
|
|
15628
15638
|
/** @private Constant defining the method name for logging purposes */
|
|
15629
|
-
const METHOD_NAME$
|
|
15639
|
+
const METHOD_NAME$h = "function.common.hasSession";
|
|
15630
15640
|
/**
|
|
15631
15641
|
* Checks if a session exists for the given client ID.
|
|
15632
15642
|
*
|
|
@@ -15637,11 +15647,12 @@ const METHOD_NAME$g = "function.common.hasSession";
|
|
|
15637
15647
|
* @returns {boolean} `true` if the session exists, otherwise `false`.
|
|
15638
15648
|
*/
|
|
15639
15649
|
const hasSession = (clientId) => {
|
|
15640
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15650
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15651
|
+
swarm$1.loggerService.log(METHOD_NAME$h, { clientId });
|
|
15641
15652
|
return swarm$1.sessionValidationService.hasSession(clientId);
|
|
15642
15653
|
};
|
|
15643
15654
|
|
|
15644
|
-
const METHOD_NAME$
|
|
15655
|
+
const METHOD_NAME$g = "function.common.getAgentName";
|
|
15645
15656
|
/**
|
|
15646
15657
|
* Retrieves the name of the active agent for a given client session in a swarm.
|
|
15647
15658
|
*
|
|
@@ -15659,18 +15670,18 @@ const METHOD_NAME$f = "function.common.getAgentName";
|
|
|
15659
15670
|
const getAgentName = beginContext(async (clientId) => {
|
|
15660
15671
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15661
15672
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15662
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15673
|
+
swarm$1.loggerService.log(METHOD_NAME$g, {
|
|
15663
15674
|
clientId,
|
|
15664
15675
|
});
|
|
15665
15676
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
15666
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15677
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
|
|
15667
15678
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
15668
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15679
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
|
|
15669
15680
|
// Retrieve the active agent name via the swarm public service
|
|
15670
|
-
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
15681
|
+
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$g, clientId, swarmName);
|
|
15671
15682
|
});
|
|
15672
15683
|
|
|
15673
|
-
const METHOD_NAME$
|
|
15684
|
+
const METHOD_NAME$f = "function.common.getAgentHistory";
|
|
15674
15685
|
/**
|
|
15675
15686
|
* Retrieves the history prepared for a specific agent, incorporating rescue algorithm tweaks.
|
|
15676
15687
|
*
|
|
@@ -15689,22 +15700,22 @@ const METHOD_NAME$e = "function.common.getAgentHistory";
|
|
|
15689
15700
|
const getAgentHistory = beginContext(async (clientId, agentName) => {
|
|
15690
15701
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15691
15702
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15692
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15703
|
+
swarm$1.loggerService.log(METHOD_NAME$f, {
|
|
15693
15704
|
clientId,
|
|
15694
15705
|
agentName,
|
|
15695
15706
|
});
|
|
15696
15707
|
// Validate the session and agent to ensure they exist and are accessible
|
|
15697
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15698
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
15708
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
|
|
15709
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$f);
|
|
15699
15710
|
// Retrieve the agent's prompt configuration from the agent schema service
|
|
15700
15711
|
const { prompt } = swarm$1.agentSchemaService.get(agentName);
|
|
15701
15712
|
// Fetch the agent's history using the prompt and rescue tweaks via the history public service
|
|
15702
|
-
const history = await swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$
|
|
15713
|
+
const history = await swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$f, clientId, agentName);
|
|
15703
15714
|
// Return a shallow copy of the history array
|
|
15704
15715
|
return [...history];
|
|
15705
15716
|
});
|
|
15706
15717
|
|
|
15707
|
-
const METHOD_NAME$
|
|
15718
|
+
const METHOD_NAME$e = "function.common.getSessionMode";
|
|
15708
15719
|
/**
|
|
15709
15720
|
* Retrieves the session mode for a given client session in a swarm.
|
|
15710
15721
|
*
|
|
@@ -15722,18 +15733,18 @@ const METHOD_NAME$d = "function.common.getSessionMode";
|
|
|
15722
15733
|
const getSessionMode = beginContext(async (clientId) => {
|
|
15723
15734
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
15724
15735
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15725
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15736
|
+
swarm$1.loggerService.log(METHOD_NAME$e, {
|
|
15726
15737
|
clientId,
|
|
15727
15738
|
});
|
|
15728
15739
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
15729
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
15740
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
|
|
15730
15741
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
15731
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
15742
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$e);
|
|
15732
15743
|
// Retrieve the session mode from the session validation service
|
|
15733
15744
|
return swarm$1.sessionValidationService.getSessionMode(clientId);
|
|
15734
15745
|
});
|
|
15735
15746
|
|
|
15736
|
-
const METHOD_NAME$
|
|
15747
|
+
const METHOD_NAME$d = "function.common.getSessionContext";
|
|
15737
15748
|
/**
|
|
15738
15749
|
* Retrieves the session context for the current execution environment.
|
|
15739
15750
|
*
|
|
@@ -15750,7 +15761,7 @@ const METHOD_NAME$c = "function.common.getSessionContext";
|
|
|
15750
15761
|
const getSessionContext = async () => {
|
|
15751
15762
|
// Log the operation if logging is enabled in GLOBAL_CONFIG
|
|
15752
15763
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15753
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
15764
|
+
swarm$1.loggerService.log(METHOD_NAME$d);
|
|
15754
15765
|
// Determine the method context, if active
|
|
15755
15766
|
const methodContext = MethodContextService.hasContext()
|
|
15756
15767
|
? swarm$1.methodContextService.context
|
|
@@ -15770,6 +15781,29 @@ const getSessionContext = async () => {
|
|
|
15770
15781
|
};
|
|
15771
15782
|
};
|
|
15772
15783
|
|
|
15784
|
+
/**
|
|
15785
|
+
* @private Constant defining the method name for logging purposes.
|
|
15786
|
+
* Used as an identifier in log messages to track calls to `getNavigationRoute`.
|
|
15787
|
+
*/
|
|
15788
|
+
const METHOD_NAME$c = "function.common.getNavigationRoute";
|
|
15789
|
+
/**
|
|
15790
|
+
* Retrieves the navigation route for a given client and swarm.
|
|
15791
|
+
* Delegates to `NavigationValidationService.getNavigationRoute` to obtain a `Set` of visited agent names,
|
|
15792
|
+
* with optional logging based on global configuration.
|
|
15793
|
+
* @param {string} clientId - The unique identifier of the client requesting the navigation route.
|
|
15794
|
+
* @param {SwarmName} swarmName - The name of the swarm context for which the route is retrieved.
|
|
15795
|
+
* @returns {Set<string>} A set of `AgentName`s representing the visited agents in the navigation route.
|
|
15796
|
+
*/
|
|
15797
|
+
const getNavigationRoute = (clientId, swarmName) => {
|
|
15798
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15799
|
+
swarm$1.loggerService.log(METHOD_NAME$c, {
|
|
15800
|
+
clientId,
|
|
15801
|
+
swarmName,
|
|
15802
|
+
});
|
|
15803
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$c);
|
|
15804
|
+
return swarm$1.navigationValidationService.getNavigationRoute(clientId, swarmName);
|
|
15805
|
+
};
|
|
15806
|
+
|
|
15773
15807
|
const METHOD_NAME$b = "function.history.getRawHistory";
|
|
15774
15808
|
/**
|
|
15775
15809
|
* Retrieves the raw, unmodified history for a given client session.
|
|
@@ -18469,6 +18503,7 @@ exports.getAssistantHistory = getAssistantHistory;
|
|
|
18469
18503
|
exports.getLastAssistantMessage = getLastAssistantMessage;
|
|
18470
18504
|
exports.getLastSystemMessage = getLastSystemMessage;
|
|
18471
18505
|
exports.getLastUserMessage = getLastUserMessage;
|
|
18506
|
+
exports.getNavigationRoute = getNavigationRoute;
|
|
18472
18507
|
exports.getPayload = getPayload;
|
|
18473
18508
|
exports.getRawHistory = getRawHistory;
|
|
18474
18509
|
exports.getSessionContext = getSessionContext;
|