agent-swarm-kit 1.1.167 → 1.1.169
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 +333 -283
- package/build/index.mjs +333 -284
- package/package.json +1 -1
- package/types.d.ts +964 -925
package/build/index.cjs
CHANGED
|
@@ -4626,26 +4626,26 @@ class ClientOperator {
|
|
|
4626
4626
|
}
|
|
4627
4627
|
}
|
|
4628
4628
|
|
|
4629
|
-
const METHOD_NAME$
|
|
4629
|
+
const METHOD_NAME$1L = "function.commit.commitToolOutput";
|
|
4630
4630
|
/**
|
|
4631
4631
|
* Function implementation
|
|
4632
4632
|
*/
|
|
4633
4633
|
const commitToolOutputInternal = beginContext(async (toolId, content, clientId, agentName) => {
|
|
4634
4634
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4635
4635
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4636
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4636
|
+
swarm$1.loggerService.log(METHOD_NAME$1L, {
|
|
4637
4637
|
toolId,
|
|
4638
4638
|
content,
|
|
4639
4639
|
clientId,
|
|
4640
4640
|
agentName,
|
|
4641
4641
|
});
|
|
4642
4642
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
4643
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4644
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4643
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1L);
|
|
4644
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1L);
|
|
4645
4645
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4646
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4646
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1L);
|
|
4647
4647
|
// Check if the specified agent is still the active agent in the swarm session
|
|
4648
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4648
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1L, clientId, swarmName);
|
|
4649
4649
|
if (currentAgentName !== agentName) {
|
|
4650
4650
|
// Log a skip message if the agent has changed during the operation
|
|
4651
4651
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -4658,7 +4658,7 @@ const commitToolOutputInternal = beginContext(async (toolId, content, clientId,
|
|
|
4658
4658
|
return;
|
|
4659
4659
|
}
|
|
4660
4660
|
// Commit the tool output to the session via the session public service
|
|
4661
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
4661
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1L, clientId, swarmName);
|
|
4662
4662
|
});
|
|
4663
4663
|
/**
|
|
4664
4664
|
* Commits the output of a tool execution to the active agent in a swarm session.
|
|
@@ -4683,7 +4683,7 @@ async function commitToolOutput(toolId, content, clientId, agentName) {
|
|
|
4683
4683
|
const disposeSubject = new functoolsKit.Subject();
|
|
4684
4684
|
const errorSubject = new functoolsKit.Subject();
|
|
4685
4685
|
|
|
4686
|
-
const METHOD_NAME$
|
|
4686
|
+
const METHOD_NAME$1K = "function.target.execute";
|
|
4687
4687
|
/**
|
|
4688
4688
|
* Function implementation
|
|
4689
4689
|
*/
|
|
@@ -4691,19 +4691,19 @@ const executeInternal = beginContext(async (content, clientId, agentName) => {
|
|
|
4691
4691
|
const executionId = functoolsKit.randomString();
|
|
4692
4692
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4693
4693
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4694
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4694
|
+
swarm$1.loggerService.log(METHOD_NAME$1K, {
|
|
4695
4695
|
content,
|
|
4696
4696
|
clientId,
|
|
4697
4697
|
agentName,
|
|
4698
4698
|
executionId,
|
|
4699
4699
|
});
|
|
4700
4700
|
// Validate the agent, session, and swarm
|
|
4701
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4702
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4701
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1K);
|
|
4702
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1K);
|
|
4703
4703
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4704
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4704
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1K);
|
|
4705
4705
|
// Check if the specified agent is still the active agent
|
|
4706
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4706
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1K, clientId, swarmName);
|
|
4707
4707
|
if (currentAgentName !== agentName) {
|
|
4708
4708
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4709
4709
|
swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
|
|
@@ -4729,7 +4729,7 @@ const executeInternal = beginContext(async (content, clientId, agentName) => {
|
|
|
4729
4729
|
errorValue = error;
|
|
4730
4730
|
}
|
|
4731
4731
|
});
|
|
4732
|
-
result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
4732
|
+
result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1K, clientId, swarmName);
|
|
4733
4733
|
unError();
|
|
4734
4734
|
if (errorValue) {
|
|
4735
4735
|
throw errorValue;
|
|
@@ -4775,26 +4775,26 @@ async function execute(content, clientId, agentName) {
|
|
|
4775
4775
|
}
|
|
4776
4776
|
|
|
4777
4777
|
/** @private Constant defining the method name for logging and validation context*/
|
|
4778
|
-
const METHOD_NAME$
|
|
4778
|
+
const METHOD_NAME$1J = "function.commit.commitFlush";
|
|
4779
4779
|
/**
|
|
4780
4780
|
* Function implementation
|
|
4781
4781
|
*/
|
|
4782
4782
|
const commitFlushInternal = beginContext(async (clientId, agentName) => {
|
|
4783
4783
|
// Log the flush attempt if enabled
|
|
4784
4784
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4785
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4785
|
+
swarm$1.loggerService.log(METHOD_NAME$1J, {
|
|
4786
4786
|
clientId,
|
|
4787
4787
|
agentName,
|
|
4788
4788
|
});
|
|
4789
4789
|
// Validate the agent exists
|
|
4790
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4790
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1J);
|
|
4791
4791
|
// Validate the session exists and retrieve the associated swarm
|
|
4792
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4792
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1J);
|
|
4793
4793
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4794
4794
|
// Validate the swarm configuration
|
|
4795
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4795
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1J);
|
|
4796
4796
|
// Check if the current agent matches the provided agent
|
|
4797
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4797
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1J, clientId, swarmName);
|
|
4798
4798
|
if (currentAgentName !== agentName) {
|
|
4799
4799
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4800
4800
|
swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
@@ -4805,7 +4805,7 @@ const commitFlushInternal = beginContext(async (clientId, agentName) => {
|
|
|
4805
4805
|
return;
|
|
4806
4806
|
}
|
|
4807
4807
|
// Commit the flush of agent history via SessionPublicService
|
|
4808
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
4808
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1J, clientId, swarmName);
|
|
4809
4809
|
});
|
|
4810
4810
|
/**
|
|
4811
4811
|
* Commits a flush of agent history for a specific client and agent in the swarm system.
|
|
@@ -4824,25 +4824,25 @@ async function commitFlush(clientId, agentName) {
|
|
|
4824
4824
|
return await commitFlushInternal(clientId, agentName);
|
|
4825
4825
|
}
|
|
4826
4826
|
|
|
4827
|
-
const METHOD_NAME$
|
|
4827
|
+
const METHOD_NAME$1I = "function.target.emit";
|
|
4828
4828
|
/**
|
|
4829
4829
|
* Function implementation
|
|
4830
4830
|
*/
|
|
4831
4831
|
const emitInternal = beginContext(async (content, clientId, agentName) => {
|
|
4832
4832
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4833
4833
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4834
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4834
|
+
swarm$1.loggerService.log(METHOD_NAME$1I, {
|
|
4835
4835
|
content,
|
|
4836
4836
|
clientId,
|
|
4837
4837
|
agentName,
|
|
4838
4838
|
});
|
|
4839
4839
|
// Validate the agent, session, and swarm
|
|
4840
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4841
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4840
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1I);
|
|
4841
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1I);
|
|
4842
4842
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4843
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4843
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1I);
|
|
4844
4844
|
// Check if the specified agent is still the active agent
|
|
4845
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4845
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1I, clientId, swarmName);
|
|
4846
4846
|
if (currentAgentName !== agentName) {
|
|
4847
4847
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4848
4848
|
swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
|
|
@@ -4853,7 +4853,7 @@ const emitInternal = beginContext(async (content, clientId, agentName) => {
|
|
|
4853
4853
|
return;
|
|
4854
4854
|
}
|
|
4855
4855
|
// Emit the content directly via the session public service
|
|
4856
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
4856
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1I, clientId, swarmName);
|
|
4857
4857
|
});
|
|
4858
4858
|
/**
|
|
4859
4859
|
* Emits a string as model output without executing an incoming message, with agent activity validation.
|
|
@@ -4875,22 +4875,22 @@ async function emit(content, clientId, agentName) {
|
|
|
4875
4875
|
return await emitInternal(content, clientId, agentName);
|
|
4876
4876
|
}
|
|
4877
4877
|
|
|
4878
|
-
const METHOD_NAME$
|
|
4878
|
+
const METHOD_NAME$1H = "function.common.getAgentName";
|
|
4879
4879
|
/**
|
|
4880
4880
|
* Function implementation
|
|
4881
4881
|
*/
|
|
4882
4882
|
const getAgentNameInternal = beginContext(async (clientId) => {
|
|
4883
4883
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4884
4884
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4885
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4885
|
+
swarm$1.loggerService.log(METHOD_NAME$1H, {
|
|
4886
4886
|
clientId,
|
|
4887
4887
|
});
|
|
4888
4888
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
4889
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4889
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1H);
|
|
4890
4890
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4891
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4891
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1H);
|
|
4892
4892
|
// Retrieve the active agent name via the swarm public service
|
|
4893
|
-
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4893
|
+
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1H, clientId, swarmName);
|
|
4894
4894
|
});
|
|
4895
4895
|
/**
|
|
4896
4896
|
* Retrieves the name of the active agent for a given client session in a swarm.
|
|
@@ -4911,26 +4911,26 @@ async function getAgentName(clientId) {
|
|
|
4911
4911
|
}
|
|
4912
4912
|
|
|
4913
4913
|
/** @private Constant defining the method name for logging and validation context*/
|
|
4914
|
-
const METHOD_NAME$
|
|
4914
|
+
const METHOD_NAME$1G = "function.commit.commitStopTools";
|
|
4915
4915
|
/**
|
|
4916
4916
|
* Function implementation
|
|
4917
4917
|
*/
|
|
4918
4918
|
const commitStopToolsInternal = beginContext(async (clientId, agentName) => {
|
|
4919
4919
|
// Log the stop tools attempt if enabled
|
|
4920
4920
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4921
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4921
|
+
swarm$1.loggerService.log(METHOD_NAME$1G, {
|
|
4922
4922
|
clientId,
|
|
4923
4923
|
agentName,
|
|
4924
4924
|
});
|
|
4925
4925
|
// Validate the agent exists
|
|
4926
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4926
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1G);
|
|
4927
4927
|
// Validate the session exists and retrieve the associated swarm
|
|
4928
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4928
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1G);
|
|
4929
4929
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4930
4930
|
// Validate the swarm configuration
|
|
4931
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4931
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1G);
|
|
4932
4932
|
// Check if the current agent matches the provided agent
|
|
4933
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4933
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1G, clientId, swarmName);
|
|
4934
4934
|
if (currentAgentName !== agentName) {
|
|
4935
4935
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4936
4936
|
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
@@ -4941,7 +4941,7 @@ const commitStopToolsInternal = beginContext(async (clientId, agentName) => {
|
|
|
4941
4941
|
return;
|
|
4942
4942
|
}
|
|
4943
4943
|
// Commit the stop of the next tool execution via SessionPublicService
|
|
4944
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
4944
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1G, clientId, swarmName);
|
|
4945
4945
|
});
|
|
4946
4946
|
/**
|
|
4947
4947
|
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
@@ -5455,12 +5455,12 @@ class AgentConnectionService {
|
|
|
5455
5455
|
}
|
|
5456
5456
|
|
|
5457
5457
|
/** @private Constant defining the method name for logging purposes*/
|
|
5458
|
-
const METHOD_NAME$
|
|
5458
|
+
const METHOD_NAME$1F = "function.common.getPayload";
|
|
5459
5459
|
/**
|
|
5460
5460
|
* Function implementation
|
|
5461
5461
|
*/
|
|
5462
5462
|
const getPayloadInternal = () => {
|
|
5463
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
5463
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1F);
|
|
5464
5464
|
if (PayloadContextService.hasContext()) {
|
|
5465
5465
|
const { payload } = swarm$1.payloadContextService.context;
|
|
5466
5466
|
return payload;
|
|
@@ -17094,14 +17094,14 @@ const swarm = {
|
|
|
17094
17094
|
init();
|
|
17095
17095
|
var swarm$1 = swarm;
|
|
17096
17096
|
|
|
17097
|
-
const METHOD_NAME$
|
|
17097
|
+
const METHOD_NAME$1E = "cli.dumpDocs";
|
|
17098
17098
|
/**
|
|
17099
17099
|
* Dumps the documentation for the agents and swarms.
|
|
17100
17100
|
*
|
|
17101
17101
|
*/
|
|
17102
17102
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML, sanitizeMarkdown = (t) => t) => {
|
|
17103
17103
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17104
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17104
|
+
swarm$1.loggerService.log(METHOD_NAME$1E, {
|
|
17105
17105
|
dirName,
|
|
17106
17106
|
});
|
|
17107
17107
|
if (PlantUML) {
|
|
@@ -17111,10 +17111,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17111
17111
|
}
|
|
17112
17112
|
swarm$1.agentValidationService
|
|
17113
17113
|
.getAgentList()
|
|
17114
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17114
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1E));
|
|
17115
17115
|
swarm$1.swarmValidationService
|
|
17116
17116
|
.getSwarmList()
|
|
17117
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17117
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1E));
|
|
17118
17118
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
17119
17119
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
17120
17120
|
if (!dependsOn) {
|
|
@@ -17123,39 +17123,39 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17123
17123
|
});
|
|
17124
17124
|
swarm$1.outlineValidationService
|
|
17125
17125
|
.getOutlineList()
|
|
17126
|
-
.forEach((swarmName) => swarm$1.outlineValidationService.validate(swarmName, METHOD_NAME$
|
|
17126
|
+
.forEach((swarmName) => swarm$1.outlineValidationService.validate(swarmName, METHOD_NAME$1E));
|
|
17127
17127
|
return swarm$1.docService.dumpDocs(prefix, dirName, sanitizeMarkdown);
|
|
17128
17128
|
});
|
|
17129
17129
|
|
|
17130
|
-
const METHOD_NAME$
|
|
17130
|
+
const METHOD_NAME$1D = "cli.dumpAgent";
|
|
17131
17131
|
/**
|
|
17132
17132
|
* Dumps the agent information into PlantUML format.
|
|
17133
17133
|
*
|
|
17134
17134
|
*/
|
|
17135
17135
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
17136
17136
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17137
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17137
|
+
swarm$1.loggerService.log(METHOD_NAME$1D, {
|
|
17138
17138
|
agentName,
|
|
17139
17139
|
});
|
|
17140
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17140
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1D);
|
|
17141
17141
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
17142
17142
|
});
|
|
17143
17143
|
|
|
17144
|
-
const METHOD_NAME$
|
|
17144
|
+
const METHOD_NAME$1C = "cli.dumpSwarm";
|
|
17145
17145
|
/**
|
|
17146
17146
|
* Dumps the swarm information into PlantUML format.
|
|
17147
17147
|
*
|
|
17148
17148
|
*/
|
|
17149
17149
|
const dumpSwarm = beginContext((swarmName) => {
|
|
17150
17150
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17151
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17151
|
+
swarm$1.loggerService.log(METHOD_NAME$1C, {
|
|
17152
17152
|
swarmName,
|
|
17153
17153
|
});
|
|
17154
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17154
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1C);
|
|
17155
17155
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
17156
17156
|
});
|
|
17157
17157
|
|
|
17158
|
-
const METHOD_NAME$
|
|
17158
|
+
const METHOD_NAME$1B = "cli.dumpPerfomance";
|
|
17159
17159
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
17160
17160
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
17161
17161
|
/**
|
|
@@ -17172,7 +17172,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
17172
17172
|
*
|
|
17173
17173
|
*/
|
|
17174
17174
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
17175
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17175
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1B);
|
|
17176
17176
|
await dumpPerfomanceInternal(dirName);
|
|
17177
17177
|
};
|
|
17178
17178
|
/**
|
|
@@ -17224,7 +17224,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
17224
17224
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
17225
17225
|
});
|
|
17226
17226
|
|
|
17227
|
-
const METHOD_NAME$
|
|
17227
|
+
const METHOD_NAME$1A = "cli.dumpClientPerformance";
|
|
17228
17228
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
17229
17229
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
17230
17230
|
/**
|
|
@@ -17242,7 +17242,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
17242
17242
|
*
|
|
17243
17243
|
*/
|
|
17244
17244
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
17245
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17245
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1A);
|
|
17246
17246
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
17247
17247
|
};
|
|
17248
17248
|
/**
|
|
@@ -17368,24 +17368,24 @@ const dumpOutlineResult = beginContext(async (result, outputDir = "./dump/outlin
|
|
|
17368
17368
|
});
|
|
17369
17369
|
|
|
17370
17370
|
/** @private Constant defining the method name for logging and validation context*/
|
|
17371
|
-
const METHOD_NAME$
|
|
17371
|
+
const METHOD_NAME$1z = "function.commit.commitFlushForce";
|
|
17372
17372
|
/**
|
|
17373
17373
|
* Function implementation
|
|
17374
17374
|
*/
|
|
17375
17375
|
const commitFlushForceInternal = beginContext(async (clientId) => {
|
|
17376
17376
|
// Log the flush attempt if enabled
|
|
17377
17377
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17378
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17378
|
+
swarm$1.loggerService.log(METHOD_NAME$1z, {
|
|
17379
17379
|
clientId,
|
|
17380
|
-
METHOD_NAME: METHOD_NAME$
|
|
17380
|
+
METHOD_NAME: METHOD_NAME$1z,
|
|
17381
17381
|
});
|
|
17382
17382
|
// Validate the session exists and retrieve the associated swarm
|
|
17383
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17383
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1z);
|
|
17384
17384
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17385
17385
|
// Validate the swarm configuration
|
|
17386
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17386
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1z);
|
|
17387
17387
|
// Commit the flush of agent history via SessionPublicService without agent checks
|
|
17388
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
17388
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1z, clientId, swarmName);
|
|
17389
17389
|
});
|
|
17390
17390
|
/**
|
|
17391
17391
|
* Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
|
|
@@ -17404,24 +17404,24 @@ async function commitFlushForce(clientId) {
|
|
|
17404
17404
|
return await commitFlushForceInternal(clientId);
|
|
17405
17405
|
}
|
|
17406
17406
|
|
|
17407
|
-
const METHOD_NAME$
|
|
17407
|
+
const METHOD_NAME$1y = "function.commit.commitToolOutputForce";
|
|
17408
17408
|
/**
|
|
17409
17409
|
* Function implementation
|
|
17410
17410
|
*/
|
|
17411
17411
|
const commitToolOutputForceInternal = beginContext(async (toolId, content, clientId) => {
|
|
17412
17412
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17413
17413
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17414
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17414
|
+
swarm$1.loggerService.log(METHOD_NAME$1y, {
|
|
17415
17415
|
toolId,
|
|
17416
17416
|
content,
|
|
17417
17417
|
clientId,
|
|
17418
17418
|
});
|
|
17419
17419
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
17420
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17420
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1y);
|
|
17421
17421
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17422
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17422
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1y);
|
|
17423
17423
|
// Commit the tool output to the session via the session public service without checking the active agent
|
|
17424
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
17424
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1y, clientId, swarmName);
|
|
17425
17425
|
});
|
|
17426
17426
|
/**
|
|
17427
17427
|
* Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
|
|
@@ -17446,15 +17446,15 @@ async function commitToolOutputForce(toolId, content, clientId) {
|
|
|
17446
17446
|
* @private Constant defining the method name for logging and validation purposes.
|
|
17447
17447
|
* Used as an identifier in log messages and validation checks to track calls to `hasNavigation`.
|
|
17448
17448
|
*/
|
|
17449
|
-
const METHOD_NAME$
|
|
17449
|
+
const METHOD_NAME$1x = "function.common.hasNavigation";
|
|
17450
17450
|
/**
|
|
17451
17451
|
* Function implementation
|
|
17452
17452
|
*/
|
|
17453
17453
|
const hasNavigationInternal = async (clientId, agentName) => {
|
|
17454
17454
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17455
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17456
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17457
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17455
|
+
swarm$1.loggerService.log(METHOD_NAME$1x, { clientId });
|
|
17456
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1x);
|
|
17457
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1x);
|
|
17458
17458
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17459
17459
|
return swarm$1.navigationValidationService
|
|
17460
17460
|
.getNavigationRoute(clientId, swarmName)
|
|
@@ -17471,14 +17471,14 @@ async function hasNavigation(clientId, agentName) {
|
|
|
17471
17471
|
return await hasNavigationInternal(clientId, agentName);
|
|
17472
17472
|
}
|
|
17473
17473
|
|
|
17474
|
-
const METHOD_NAME$
|
|
17474
|
+
const METHOD_NAME$1w = "function.history.getRawHistory";
|
|
17475
17475
|
/**
|
|
17476
17476
|
* Function implementation
|
|
17477
17477
|
*/
|
|
17478
17478
|
const getRawHistoryInternal = beginContext(async (clientId, methodName) => {
|
|
17479
17479
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17480
17480
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17481
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17481
|
+
swarm$1.loggerService.log(METHOD_NAME$1w, {
|
|
17482
17482
|
clientId,
|
|
17483
17483
|
});
|
|
17484
17484
|
// Validate the session and swarm
|
|
@@ -17506,21 +17506,21 @@ const getRawHistoryInternal = beginContext(async (clientId, methodName) => {
|
|
|
17506
17506
|
* console.log(rawHistory); // Outputs the full raw history array
|
|
17507
17507
|
*/
|
|
17508
17508
|
async function getRawHistory(clientId) {
|
|
17509
|
-
return await getRawHistoryInternal(clientId, METHOD_NAME$
|
|
17509
|
+
return await getRawHistoryInternal(clientId, METHOD_NAME$1w);
|
|
17510
17510
|
}
|
|
17511
17511
|
|
|
17512
|
-
const METHOD_NAME$
|
|
17512
|
+
const METHOD_NAME$1v = "function.history.getLastUserMessage";
|
|
17513
17513
|
/**
|
|
17514
17514
|
* Function implementation
|
|
17515
17515
|
*/
|
|
17516
17516
|
const getLastUserMessageInternal = beginContext(async (clientId) => {
|
|
17517
17517
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17518
17518
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17519
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17519
|
+
swarm$1.loggerService.log(METHOD_NAME$1v, {
|
|
17520
17520
|
clientId,
|
|
17521
17521
|
});
|
|
17522
17522
|
// Fetch raw history and find the last user message
|
|
17523
|
-
const history = await getRawHistoryInternal(clientId, METHOD_NAME$
|
|
17523
|
+
const history = await getRawHistoryInternal(clientId, METHOD_NAME$1v);
|
|
17524
17524
|
const last = history.findLast(({ role, mode }) => role === "user" && mode === "user");
|
|
17525
17525
|
return last?.content ? last.content : null;
|
|
17526
17526
|
});
|
|
@@ -17542,7 +17542,7 @@ async function getLastUserMessage(clientId) {
|
|
|
17542
17542
|
return await getLastUserMessageInternal(clientId);
|
|
17543
17543
|
}
|
|
17544
17544
|
|
|
17545
|
-
const METHOD_NAME$
|
|
17545
|
+
const METHOD_NAME$1u = "function.navigate.changeToDefaultAgent";
|
|
17546
17546
|
/**
|
|
17547
17547
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities for switching to the default agent.
|
|
17548
17548
|
*
|
|
@@ -17563,7 +17563,7 @@ const createChangeToDefaultAgent = functoolsKit.memoize(([clientId]) => `${clien
|
|
|
17563
17563
|
}));
|
|
17564
17564
|
{
|
|
17565
17565
|
// Dispose of the current agent's resources and set up the new default agent
|
|
17566
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17566
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1u, clientId, swarmName);
|
|
17567
17567
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17568
17568
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17569
17569
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17590,20 +17590,20 @@ const createGc$3 = functoolsKit.singleshot(async () => {
|
|
|
17590
17590
|
const changeToDefaultAgentInternal = beginContext(async (clientId) => {
|
|
17591
17591
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17592
17592
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17593
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17593
|
+
swarm$1.loggerService.log(METHOD_NAME$1u, {
|
|
17594
17594
|
clientId,
|
|
17595
17595
|
});
|
|
17596
17596
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17597
17597
|
const { defaultAgent: agentName } = swarm$1.swarmSchemaService.get(swarmName);
|
|
17598
17598
|
{
|
|
17599
17599
|
// Validate session and default agent
|
|
17600
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17601
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17600
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1u);
|
|
17601
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1u);
|
|
17602
17602
|
}
|
|
17603
17603
|
// Execute the agent change with TTL and queuing
|
|
17604
17604
|
const run = await createChangeToDefaultAgent(clientId);
|
|
17605
17605
|
createGc$3();
|
|
17606
|
-
return await run(METHOD_NAME$
|
|
17606
|
+
return await run(METHOD_NAME$1u, agentName, swarmName);
|
|
17607
17607
|
});
|
|
17608
17608
|
/**
|
|
17609
17609
|
* Navigates back to the default agent for a given client session in a swarm.
|
|
@@ -17622,23 +17622,23 @@ async function changeToDefaultAgent(clientId) {
|
|
|
17622
17622
|
return await changeToDefaultAgentInternal(clientId);
|
|
17623
17623
|
}
|
|
17624
17624
|
|
|
17625
|
-
const METHOD_NAME$
|
|
17625
|
+
const METHOD_NAME$1t = "function.target.emitForce";
|
|
17626
17626
|
/**
|
|
17627
17627
|
* Function implementation
|
|
17628
17628
|
*/
|
|
17629
17629
|
const emitForceInternal = beginContext(async (content, clientId) => {
|
|
17630
17630
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17631
17631
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17632
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17632
|
+
swarm$1.loggerService.log(METHOD_NAME$1t, {
|
|
17633
17633
|
content,
|
|
17634
17634
|
clientId,
|
|
17635
17635
|
});
|
|
17636
17636
|
// Validate the session and swarm
|
|
17637
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17637
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1t);
|
|
17638
17638
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17639
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17639
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1t);
|
|
17640
17640
|
// Emit the content directly via the session public service
|
|
17641
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
17641
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1t, clientId, swarmName);
|
|
17642
17642
|
});
|
|
17643
17643
|
/**
|
|
17644
17644
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
@@ -17659,7 +17659,7 @@ async function emitForce(content, clientId) {
|
|
|
17659
17659
|
return await emitForceInternal(content, clientId);
|
|
17660
17660
|
}
|
|
17661
17661
|
|
|
17662
|
-
const METHOD_NAME$
|
|
17662
|
+
const METHOD_NAME$1s = "function.target.executeForce";
|
|
17663
17663
|
/**
|
|
17664
17664
|
* Function implementation
|
|
17665
17665
|
*/
|
|
@@ -17667,15 +17667,15 @@ const executeForceInternal = beginContext(async (content, clientId) => {
|
|
|
17667
17667
|
const executionId = functoolsKit.randomString();
|
|
17668
17668
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17669
17669
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17670
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17670
|
+
swarm$1.loggerService.log(METHOD_NAME$1s, {
|
|
17671
17671
|
content,
|
|
17672
17672
|
clientId,
|
|
17673
17673
|
executionId,
|
|
17674
17674
|
});
|
|
17675
17675
|
// Validate the session and swarm
|
|
17676
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17676
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1s);
|
|
17677
17677
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17678
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17678
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1s);
|
|
17679
17679
|
// Execute the command within an execution context with performance tracking
|
|
17680
17680
|
return ExecutionContextService.runInContext(async () => {
|
|
17681
17681
|
let isFinished = false;
|
|
@@ -17689,7 +17689,7 @@ const executeForceInternal = beginContext(async (content, clientId) => {
|
|
|
17689
17689
|
errorValue = error;
|
|
17690
17690
|
}
|
|
17691
17691
|
});
|
|
17692
|
-
result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
17692
|
+
result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1s, clientId, swarmName);
|
|
17693
17693
|
unError();
|
|
17694
17694
|
if (errorValue) {
|
|
17695
17695
|
throw errorValue;
|
|
@@ -17731,24 +17731,24 @@ async function executeForce(content, clientId) {
|
|
|
17731
17731
|
}
|
|
17732
17732
|
|
|
17733
17733
|
/** @private Constant defining the method name for logging and validation context*/
|
|
17734
|
-
const METHOD_NAME$
|
|
17734
|
+
const METHOD_NAME$1r = "function.commit.commitStopToolsForce";
|
|
17735
17735
|
/**
|
|
17736
17736
|
* Function implementation
|
|
17737
17737
|
*/
|
|
17738
17738
|
const commitStopToolsForceInternal = beginContext(async (clientId) => {
|
|
17739
17739
|
// Log the stop tools attempt if enabled
|
|
17740
17740
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17741
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17741
|
+
swarm$1.loggerService.log(METHOD_NAME$1r, {
|
|
17742
17742
|
clientId,
|
|
17743
|
-
METHOD_NAME: METHOD_NAME$
|
|
17743
|
+
METHOD_NAME: METHOD_NAME$1r,
|
|
17744
17744
|
});
|
|
17745
17745
|
// Validate the session exists and retrieve the associated swarm
|
|
17746
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17746
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1r);
|
|
17747
17747
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17748
17748
|
// Validate the swarm configuration
|
|
17749
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17749
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1r);
|
|
17750
17750
|
// Commit the stop of the next tool execution via SessionPublicService without agent checks
|
|
17751
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
17751
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1r, clientId, swarmName);
|
|
17752
17752
|
});
|
|
17753
17753
|
/**
|
|
17754
17754
|
* Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
|
|
@@ -17767,7 +17767,7 @@ async function commitStopToolsForce(clientId) {
|
|
|
17767
17767
|
return await commitStopToolsForceInternal(clientId);
|
|
17768
17768
|
}
|
|
17769
17769
|
|
|
17770
|
-
const METHOD_NAME$
|
|
17770
|
+
const METHOD_NAME$1q = "function.template.navigateToTriageAgent";
|
|
17771
17771
|
/**
|
|
17772
17772
|
* Will send tool output directly to the model without any additions
|
|
17773
17773
|
*/
|
|
@@ -17809,7 +17809,7 @@ const createNavigateToTriageAgent = ({ flushMessage, beforeNavigate, lastMessage
|
|
|
17809
17809
|
*/
|
|
17810
17810
|
return beginContext(async (toolId, clientId) => {
|
|
17811
17811
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17812
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17812
|
+
swarm$1.loggerService.log(METHOD_NAME$1q, {
|
|
17813
17813
|
clientId,
|
|
17814
17814
|
toolId,
|
|
17815
17815
|
});
|
|
@@ -17844,7 +17844,7 @@ const createNavigateToTriageAgent = ({ flushMessage, beforeNavigate, lastMessage
|
|
|
17844
17844
|
});
|
|
17845
17845
|
};
|
|
17846
17846
|
|
|
17847
|
-
const METHOD_NAME$
|
|
17847
|
+
const METHOD_NAME$1p = "function.navigate.changeToAgent";
|
|
17848
17848
|
/**
|
|
17849
17849
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities.
|
|
17850
17850
|
*
|
|
@@ -17866,7 +17866,7 @@ const createChangeToAgent = functoolsKit.memoize(([clientId]) => `${clientId}`,
|
|
|
17866
17866
|
}));
|
|
17867
17867
|
{
|
|
17868
17868
|
// Dispose of the current agent's resources and set up the new agent
|
|
17869
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17869
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1p, clientId, swarmName);
|
|
17870
17870
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17871
17871
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17872
17872
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17893,16 +17893,16 @@ const createGc$2 = functoolsKit.singleshot(async () => {
|
|
|
17893
17893
|
const changeToAgentInternal = beginContext(async (agentName, clientId) => {
|
|
17894
17894
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17895
17895
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17896
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17896
|
+
swarm$1.loggerService.log(METHOD_NAME$1p, {
|
|
17897
17897
|
agentName,
|
|
17898
17898
|
clientId,
|
|
17899
17899
|
});
|
|
17900
17900
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17901
17901
|
{
|
|
17902
17902
|
// Validate session, agent, and dependencies
|
|
17903
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17904
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17905
|
-
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17903
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1p);
|
|
17904
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1p);
|
|
17905
|
+
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1p, clientId, swarmName);
|
|
17906
17906
|
if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
|
|
17907
17907
|
console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
|
|
17908
17908
|
}
|
|
@@ -17920,7 +17920,7 @@ const changeToAgentInternal = beginContext(async (agentName, clientId) => {
|
|
|
17920
17920
|
// Execute the agent change with TTL and queuing
|
|
17921
17921
|
const run = await createChangeToAgent(clientId);
|
|
17922
17922
|
createGc$2();
|
|
17923
|
-
return await run(METHOD_NAME$
|
|
17923
|
+
return await run(METHOD_NAME$1p, agentName, swarmName);
|
|
17924
17924
|
});
|
|
17925
17925
|
/**
|
|
17926
17926
|
* Changes the active agent for a given client session in a swarm.
|
|
@@ -17940,7 +17940,7 @@ async function changeToAgent(agentName, clientId) {
|
|
|
17940
17940
|
return await changeToAgentInternal(agentName, clientId);
|
|
17941
17941
|
}
|
|
17942
17942
|
|
|
17943
|
-
const METHOD_NAME$
|
|
17943
|
+
const METHOD_NAME$1o = "function.template.navigateToAgent";
|
|
17944
17944
|
/**
|
|
17945
17945
|
* Will send tool output directly to the model without any additions
|
|
17946
17946
|
*/
|
|
@@ -17996,7 +17996,7 @@ const createNavigateToAgent = ({ beforeNavigate, lastMessage: lastMessageFn = DE
|
|
|
17996
17996
|
*/
|
|
17997
17997
|
return beginContext(async (toolId, clientId, agentName) => {
|
|
17998
17998
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17999
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17999
|
+
swarm$1.loggerService.log(METHOD_NAME$1o, {
|
|
18000
18000
|
clientId,
|
|
18001
18001
|
toolId,
|
|
18002
18002
|
});
|
|
@@ -18034,7 +18034,7 @@ const createNavigateToAgent = ({ beforeNavigate, lastMessage: lastMessageFn = DE
|
|
|
18034
18034
|
});
|
|
18035
18035
|
};
|
|
18036
18036
|
|
|
18037
|
-
const METHOD_NAME$
|
|
18037
|
+
const METHOD_NAME$1n = "function.template.commitAction";
|
|
18038
18038
|
/**
|
|
18039
18039
|
* Creates a commit action handler that executes actions and modifies system state (WRITE pattern).
|
|
18040
18040
|
*
|
|
@@ -18083,7 +18083,7 @@ const createCommitAction = ({ validateParams, executeAction, emptyContent, fallb
|
|
|
18083
18083
|
return beginContext(async (toolId, clientId, agentName, toolName, params, toolCalls, isLast) => {
|
|
18084
18084
|
let executeMessage = "";
|
|
18085
18085
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18086
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18086
|
+
swarm$1.loggerService.log(METHOD_NAME$1n, {
|
|
18087
18087
|
clientId,
|
|
18088
18088
|
toolId,
|
|
18089
18089
|
agentName,
|
|
@@ -18177,7 +18177,7 @@ const createCommitAction = ({ validateParams, executeAction, emptyContent, fallb
|
|
|
18177
18177
|
});
|
|
18178
18178
|
};
|
|
18179
18179
|
|
|
18180
|
-
const METHOD_NAME$
|
|
18180
|
+
const METHOD_NAME$1m = "function.template.fetchInfo";
|
|
18181
18181
|
/**
|
|
18182
18182
|
* Default message when content is empty.
|
|
18183
18183
|
*/
|
|
@@ -18223,7 +18223,7 @@ const createFetchInfo = ({ fetchContent, fallback, emptyContent = DEFAULT_EMPTY_
|
|
|
18223
18223
|
return beginContext(async (toolId, clientId, agentName, toolName, params, isLast) => {
|
|
18224
18224
|
let executeMessage = "";
|
|
18225
18225
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18226
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18226
|
+
swarm$1.loggerService.log(METHOD_NAME$1m, {
|
|
18227
18227
|
clientId,
|
|
18228
18228
|
toolId,
|
|
18229
18229
|
agentName,
|
|
@@ -18234,7 +18234,7 @@ const createFetchInfo = ({ fetchContent, fallback, emptyContent = DEFAULT_EMPTY_
|
|
|
18234
18234
|
const currentAgentName = await getAgentName(clientId);
|
|
18235
18235
|
if (currentAgentName !== agentName) {
|
|
18236
18236
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18237
|
-
swarm$1.loggerService.log(`${METHOD_NAME$
|
|
18237
|
+
swarm$1.loggerService.log(`${METHOD_NAME$1m} skipped due to agent change`, {
|
|
18238
18238
|
currentAgentName,
|
|
18239
18239
|
agentName,
|
|
18240
18240
|
clientId,
|
|
@@ -18269,14 +18269,14 @@ const createFetchInfo = ({ fetchContent, fallback, emptyContent = DEFAULT_EMPTY_
|
|
|
18269
18269
|
});
|
|
18270
18270
|
};
|
|
18271
18271
|
|
|
18272
|
-
const METHOD_NAME$
|
|
18272
|
+
const METHOD_NAME$1l = "function.setup.addTool";
|
|
18273
18273
|
/**
|
|
18274
18274
|
* Function implementation
|
|
18275
18275
|
*/
|
|
18276
18276
|
const addToolInternal = beginContext((toolSchema) => {
|
|
18277
18277
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18278
18278
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18279
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18279
|
+
swarm$1.loggerService.log(METHOD_NAME$1l, {
|
|
18280
18280
|
toolSchema,
|
|
18281
18281
|
});
|
|
18282
18282
|
// Register the tool in the validation and schema services
|
|
@@ -18310,12 +18310,12 @@ function addTool(toolSchema) {
|
|
|
18310
18310
|
* Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
|
|
18311
18311
|
* @module addAgentNavigation
|
|
18312
18312
|
*/
|
|
18313
|
-
const METHOD_NAME$
|
|
18313
|
+
const METHOD_NAME$1k = "function.alias.addAgentNavigation";
|
|
18314
18314
|
/**
|
|
18315
18315
|
* Function implementation
|
|
18316
18316
|
*/
|
|
18317
18317
|
const addAgentNavigationInternal = beginContext(({ toolName, docNote, description, navigateTo, isAvailable, ...navigateProps }) => {
|
|
18318
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18318
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1k);
|
|
18319
18319
|
const navigate = createNavigateToAgent(navigateProps);
|
|
18320
18320
|
const toolSchema = addTool({
|
|
18321
18321
|
toolName,
|
|
@@ -18354,12 +18354,12 @@ function addAgentNavigation(params) {
|
|
|
18354
18354
|
* Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
|
|
18355
18355
|
* @module addTriageNavigation
|
|
18356
18356
|
*/
|
|
18357
|
-
const METHOD_NAME$
|
|
18357
|
+
const METHOD_NAME$1j = "function.alias.addTriageNavigation";
|
|
18358
18358
|
/**
|
|
18359
18359
|
* Function implementation
|
|
18360
18360
|
*/
|
|
18361
18361
|
const addTriageNavigationInternal = beginContext(({ toolName, docNote, description, isAvailable, ...navigateProps }) => {
|
|
18362
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18362
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1j);
|
|
18363
18363
|
const navigate = createNavigateToTriageAgent(navigateProps);
|
|
18364
18364
|
const toolSchema = addTool({
|
|
18365
18365
|
toolName,
|
|
@@ -18398,12 +18398,12 @@ function addTriageNavigation(params) {
|
|
|
18398
18398
|
* Adds commit action functionality to an agent by creating a tool that validates and executes actions.
|
|
18399
18399
|
* @module addCommitAction
|
|
18400
18400
|
*/
|
|
18401
|
-
const METHOD_NAME$
|
|
18401
|
+
const METHOD_NAME$1i = "function.alias.addCommitAction";
|
|
18402
18402
|
/**
|
|
18403
18403
|
* Function implementation
|
|
18404
18404
|
*/
|
|
18405
18405
|
const addCommitActionInternal = beginContext(({ toolName, docNote, function: functionSchema, isAvailable, ...actionProps }) => {
|
|
18406
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18406
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1i);
|
|
18407
18407
|
const action = createCommitAction(actionProps);
|
|
18408
18408
|
const toolSchema = addTool({
|
|
18409
18409
|
toolName,
|
|
@@ -18480,12 +18480,12 @@ function addCommitAction(params) {
|
|
|
18480
18480
|
* Adds fetch info functionality to an agent by creating a tool that fetches and provides information.
|
|
18481
18481
|
* @module addFetchInfo
|
|
18482
18482
|
*/
|
|
18483
|
-
const METHOD_NAME$
|
|
18483
|
+
const METHOD_NAME$1h = "function.alias.addFetchInfo";
|
|
18484
18484
|
/**
|
|
18485
18485
|
* Function implementation
|
|
18486
18486
|
*/
|
|
18487
18487
|
const addFetchInfoInternal = beginContext(({ toolName, docNote, function: functionSchema, isAvailable, validateParams: validate, ...fetchProps }) => {
|
|
18488
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18488
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1h);
|
|
18489
18489
|
const fetch = createFetchInfo(fetchProps);
|
|
18490
18490
|
const toolSchema = addTool({
|
|
18491
18491
|
toolName,
|
|
@@ -18551,13 +18551,13 @@ function addFetchInfo(params) {
|
|
|
18551
18551
|
}
|
|
18552
18552
|
|
|
18553
18553
|
/** @constant {string} METHOD_NAME - The name of the method used for logging*/
|
|
18554
|
-
const METHOD_NAME$
|
|
18554
|
+
const METHOD_NAME$1g = "function.setup.addAdvisor";
|
|
18555
18555
|
/**
|
|
18556
18556
|
* Function implementation
|
|
18557
18557
|
*/
|
|
18558
18558
|
const addAdvisorInternal = beginContext((advisorSchema) => {
|
|
18559
18559
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18560
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18560
|
+
swarm$1.loggerService.log(METHOD_NAME$1g, {
|
|
18561
18561
|
advisorSchema,
|
|
18562
18562
|
});
|
|
18563
18563
|
swarm$1.advisorValidationService.addAdvisor(advisorSchema.advisorName, advisorSchema);
|
|
@@ -18668,14 +18668,14 @@ const mapAgentSchema = ({ system, systemDynamic, systemStatic, ...schema }) => r
|
|
|
18668
18668
|
: systemDynamic,
|
|
18669
18669
|
});
|
|
18670
18670
|
|
|
18671
|
-
const METHOD_NAME$
|
|
18671
|
+
const METHOD_NAME$1f = "function.setup.addAgent";
|
|
18672
18672
|
/**
|
|
18673
18673
|
* Function implementation
|
|
18674
18674
|
*/
|
|
18675
18675
|
const addAgentInternal = beginContext((publicAgentSchema) => {
|
|
18676
18676
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18677
18677
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18678
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18678
|
+
swarm$1.loggerService.log(METHOD_NAME$1f, {
|
|
18679
18679
|
agentSchema: publicAgentSchema,
|
|
18680
18680
|
});
|
|
18681
18681
|
const agentSchema = mapAgentSchema(publicAgentSchema);
|
|
@@ -18714,27 +18714,19 @@ function addAgent(agentSchema) {
|
|
|
18714
18714
|
const mapCompletionSchema = ({ getCompletion, ...schema }) => removeUndefined({
|
|
18715
18715
|
...schema,
|
|
18716
18716
|
getCompletion: getCompletion
|
|
18717
|
-
? async (
|
|
18718
|
-
const params = {
|
|
18719
|
-
mode,
|
|
18720
|
-
messages,
|
|
18721
|
-
agentName,
|
|
18722
|
-
clientId,
|
|
18723
|
-
format,
|
|
18724
|
-
outlineName,
|
|
18725
|
-
tools,
|
|
18726
|
-
};
|
|
18717
|
+
? async (args) => {
|
|
18727
18718
|
try {
|
|
18728
|
-
return await getCompletion(
|
|
18719
|
+
return await getCompletion(args);
|
|
18729
18720
|
}
|
|
18730
18721
|
catch (error) {
|
|
18731
|
-
if (clientId) {
|
|
18732
|
-
errorSubject.next([clientId, error]);
|
|
18722
|
+
if ("clientId" in args && args.clientId) {
|
|
18723
|
+
errorSubject.next([args.clientId, error]);
|
|
18733
18724
|
}
|
|
18734
18725
|
return {
|
|
18735
|
-
|
|
18726
|
+
error: functoolsKit.getErrorMessage(error),
|
|
18727
|
+
agentName: ("agentName" in args && args.agentName) || "",
|
|
18736
18728
|
content: "",
|
|
18737
|
-
mode,
|
|
18729
|
+
mode: ("mode" in args && args.mode) || "",
|
|
18738
18730
|
role: "assistant",
|
|
18739
18731
|
};
|
|
18740
18732
|
}
|
|
@@ -18742,14 +18734,14 @@ const mapCompletionSchema = ({ getCompletion, ...schema }) => removeUndefined({
|
|
|
18742
18734
|
: undefined,
|
|
18743
18735
|
});
|
|
18744
18736
|
|
|
18745
|
-
const METHOD_NAME$
|
|
18737
|
+
const METHOD_NAME$1e = "function.setup.addCompletion";
|
|
18746
18738
|
/**
|
|
18747
18739
|
* Function implementation
|
|
18748
18740
|
*/
|
|
18749
18741
|
const addCompletionInternal = beginContext((completionPublicSchema) => {
|
|
18750
18742
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18751
18743
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18752
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18744
|
+
swarm$1.loggerService.log(METHOD_NAME$1e, {
|
|
18753
18745
|
completionSchema: completionPublicSchema,
|
|
18754
18746
|
});
|
|
18755
18747
|
const completionSchema = mapCompletionSchema(completionPublicSchema);
|
|
@@ -18779,14 +18771,14 @@ function addCompletion(completionSchema) {
|
|
|
18779
18771
|
return addCompletionInternal(completionSchema);
|
|
18780
18772
|
}
|
|
18781
18773
|
|
|
18782
|
-
const METHOD_NAME$
|
|
18774
|
+
const METHOD_NAME$1d = "function.setup.addSwarm";
|
|
18783
18775
|
/**
|
|
18784
18776
|
* Function implementation
|
|
18785
18777
|
*/
|
|
18786
18778
|
const addSwarmInternal = beginContext((swarmSchema) => {
|
|
18787
18779
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18788
18780
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18789
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18781
|
+
swarm$1.loggerService.log(METHOD_NAME$1d, {
|
|
18790
18782
|
swarmSchema,
|
|
18791
18783
|
});
|
|
18792
18784
|
// Register the swarm in the validation and schema services
|
|
@@ -18815,13 +18807,13 @@ function addSwarm(swarmSchema) {
|
|
|
18815
18807
|
return addSwarmInternal(swarmSchema);
|
|
18816
18808
|
}
|
|
18817
18809
|
|
|
18818
|
-
const METHOD_NAME$
|
|
18810
|
+
const METHOD_NAME$1c = "function.setup.addMCP";
|
|
18819
18811
|
/**
|
|
18820
18812
|
* Function implementation
|
|
18821
18813
|
*/
|
|
18822
18814
|
const addMCPInternal = beginContext((mcpSchema) => {
|
|
18823
18815
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18824
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18816
|
+
swarm$1.loggerService.log(METHOD_NAME$1c, {
|
|
18825
18817
|
mcpSchema,
|
|
18826
18818
|
});
|
|
18827
18819
|
swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
|
|
@@ -18836,14 +18828,14 @@ function addMCP(mcpSchema) {
|
|
|
18836
18828
|
return addMCPInternal(mcpSchema);
|
|
18837
18829
|
}
|
|
18838
18830
|
|
|
18839
|
-
const METHOD_NAME$
|
|
18831
|
+
const METHOD_NAME$1b = "function.setup.addState";
|
|
18840
18832
|
/**
|
|
18841
18833
|
* Function implementation
|
|
18842
18834
|
*/
|
|
18843
18835
|
const addStateInternal = beginContext((stateSchema) => {
|
|
18844
18836
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18845
18837
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18846
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18838
|
+
swarm$1.loggerService.log(METHOD_NAME$1b, {
|
|
18847
18839
|
stateSchema,
|
|
18848
18840
|
});
|
|
18849
18841
|
// Register the policy with StateValidationService for runtime validation
|
|
@@ -18881,14 +18873,14 @@ function addState(stateSchema) {
|
|
|
18881
18873
|
return addStateInternal(stateSchema);
|
|
18882
18874
|
}
|
|
18883
18875
|
|
|
18884
|
-
const METHOD_NAME$
|
|
18876
|
+
const METHOD_NAME$1a = "function.setup.addEmbedding";
|
|
18885
18877
|
/**
|
|
18886
18878
|
* Function implementation
|
|
18887
18879
|
*/
|
|
18888
18880
|
const addEmbeddingInternal = beginContext((embeddingSchema) => {
|
|
18889
18881
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18890
18882
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18891
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18883
|
+
swarm$1.loggerService.log(METHOD_NAME$1a, {
|
|
18892
18884
|
embeddingSchema,
|
|
18893
18885
|
});
|
|
18894
18886
|
// Register the embedding in the validation and schema services
|
|
@@ -18917,14 +18909,14 @@ function addEmbedding(embeddingSchema) {
|
|
|
18917
18909
|
return addEmbeddingInternal(embeddingSchema);
|
|
18918
18910
|
}
|
|
18919
18911
|
|
|
18920
|
-
const METHOD_NAME$
|
|
18912
|
+
const METHOD_NAME$19 = "function.setup.addStorage";
|
|
18921
18913
|
/**
|
|
18922
18914
|
* Function implementation
|
|
18923
18915
|
*/
|
|
18924
18916
|
const addStorageInternal = beginContext((storageSchema) => {
|
|
18925
18917
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18926
18918
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18927
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18919
|
+
swarm$1.loggerService.log(METHOD_NAME$19, {
|
|
18928
18920
|
storageSchema,
|
|
18929
18921
|
});
|
|
18930
18922
|
// Register the storage in the validation and schema services
|
|
@@ -18962,14 +18954,14 @@ function addStorage(storageSchema) {
|
|
|
18962
18954
|
}
|
|
18963
18955
|
|
|
18964
18956
|
/** @private Constant defining the method name for logging and validation context*/
|
|
18965
|
-
const METHOD_NAME$
|
|
18957
|
+
const METHOD_NAME$18 = "function.setup.addPolicy";
|
|
18966
18958
|
/**
|
|
18967
18959
|
* Function implementation
|
|
18968
18960
|
*/
|
|
18969
18961
|
const addPolicyInternal = beginContext((policySchema) => {
|
|
18970
18962
|
// Log the policy addition attempt if enabled
|
|
18971
18963
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18972
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18964
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
18973
18965
|
policySchema,
|
|
18974
18966
|
});
|
|
18975
18967
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -19030,13 +19022,13 @@ function addCompute(computeSchema) {
|
|
|
19030
19022
|
* Method name for the addPipeline operation.
|
|
19031
19023
|
* @private
|
|
19032
19024
|
*/
|
|
19033
|
-
const METHOD_NAME$
|
|
19025
|
+
const METHOD_NAME$17 = "function.setup.addPipeline";
|
|
19034
19026
|
/**
|
|
19035
19027
|
* Function implementation
|
|
19036
19028
|
*/
|
|
19037
19029
|
const addPipelineInternal = beginContext((pipelineSchema) => {
|
|
19038
19030
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19039
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19031
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
19040
19032
|
pipelineSchema,
|
|
19041
19033
|
});
|
|
19042
19034
|
swarm$1.pipelineValidationService.addPipeline(pipelineSchema.pipelineName, pipelineSchema);
|
|
@@ -19059,7 +19051,7 @@ function addPipeline(pipelineSchema) {
|
|
|
19059
19051
|
* @private
|
|
19060
19052
|
* @constant {string}
|
|
19061
19053
|
*/
|
|
19062
|
-
const METHOD_NAME$
|
|
19054
|
+
const METHOD_NAME$16 = "function.setup.addOutline";
|
|
19063
19055
|
/**
|
|
19064
19056
|
* Internal implementation of the outline addition logic, wrapped in a clean context.
|
|
19065
19057
|
* Registers the outline schema with both the validation and schema services and logs the operation if enabled.
|
|
@@ -19067,7 +19059,7 @@ const METHOD_NAME$15 = "function.setup.addOutline";
|
|
|
19067
19059
|
*/
|
|
19068
19060
|
const addOutlineInternal = beginContext((outlineSchema) => {
|
|
19069
19061
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19070
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19062
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
19071
19063
|
outlineSchema,
|
|
19072
19064
|
});
|
|
19073
19065
|
swarm$1.outlineValidationService.addOutline(outlineSchema.outlineName, outlineSchema);
|
|
@@ -19086,13 +19078,13 @@ function addOutline(outlineSchema) {
|
|
|
19086
19078
|
return addOutlineInternal(outlineSchema);
|
|
19087
19079
|
}
|
|
19088
19080
|
|
|
19089
|
-
const METHOD_NAME$
|
|
19081
|
+
const METHOD_NAME$15 = "function.test.overrideAgent";
|
|
19090
19082
|
/**
|
|
19091
19083
|
* Function implementation
|
|
19092
19084
|
*/
|
|
19093
19085
|
const overrideAgentInternal = beginContext((publicAgentSchema) => {
|
|
19094
19086
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19095
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19087
|
+
swarm$1.loggerService.log(METHOD_NAME$15, {
|
|
19096
19088
|
agentSchema: publicAgentSchema,
|
|
19097
19089
|
});
|
|
19098
19090
|
const agentSchema = mapAgentSchema(publicAgentSchema);
|
|
@@ -19121,13 +19113,13 @@ function overrideAgent(agentSchema) {
|
|
|
19121
19113
|
return overrideAgentInternal(agentSchema);
|
|
19122
19114
|
}
|
|
19123
19115
|
|
|
19124
|
-
const METHOD_NAME$
|
|
19116
|
+
const METHOD_NAME$14 = "function.test.overrideCompletion";
|
|
19125
19117
|
/**
|
|
19126
19118
|
* Function implementation
|
|
19127
19119
|
*/
|
|
19128
19120
|
const overrideCompletionInternal = beginContext((publicCompletionSchema) => {
|
|
19129
19121
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19130
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19122
|
+
swarm$1.loggerService.log(METHOD_NAME$14, {
|
|
19131
19123
|
completionSchema: publicCompletionSchema,
|
|
19132
19124
|
});
|
|
19133
19125
|
const completionSchema = mapCompletionSchema(publicCompletionSchema);
|
|
@@ -19156,13 +19148,13 @@ function overrideCompletion(completionSchema) {
|
|
|
19156
19148
|
return overrideCompletionInternal(completionSchema);
|
|
19157
19149
|
}
|
|
19158
19150
|
|
|
19159
|
-
const METHOD_NAME$
|
|
19151
|
+
const METHOD_NAME$13 = "function.test.overrideEmbeding";
|
|
19160
19152
|
/**
|
|
19161
19153
|
* Function implementation
|
|
19162
19154
|
*/
|
|
19163
19155
|
const overrideEmbedingInternal = beginContext((publicEmbeddingSchema) => {
|
|
19164
19156
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19165
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19157
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
19166
19158
|
embeddingSchema: publicEmbeddingSchema,
|
|
19167
19159
|
});
|
|
19168
19160
|
const embeddingSchema = removeUndefined(publicEmbeddingSchema);
|
|
@@ -19193,13 +19185,13 @@ function overrideEmbeding(embeddingSchema) {
|
|
|
19193
19185
|
return overrideEmbedingInternal(embeddingSchema);
|
|
19194
19186
|
}
|
|
19195
19187
|
|
|
19196
|
-
const METHOD_NAME$
|
|
19188
|
+
const METHOD_NAME$12 = "function.test.overridePolicy";
|
|
19197
19189
|
/**
|
|
19198
19190
|
* Function implementation
|
|
19199
19191
|
*/
|
|
19200
19192
|
const overridePolicyInternal = beginContext((publicPolicySchema) => {
|
|
19201
19193
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19202
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19194
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
19203
19195
|
policySchema: publicPolicySchema,
|
|
19204
19196
|
});
|
|
19205
19197
|
const policySchema = removeUndefined(publicPolicySchema);
|
|
@@ -19228,13 +19220,13 @@ function overridePolicy(policySchema) {
|
|
|
19228
19220
|
return overridePolicyInternal(policySchema);
|
|
19229
19221
|
}
|
|
19230
19222
|
|
|
19231
|
-
const METHOD_NAME$
|
|
19223
|
+
const METHOD_NAME$11 = "function.test.overrideState";
|
|
19232
19224
|
/**
|
|
19233
19225
|
* Function implementation
|
|
19234
19226
|
*/
|
|
19235
19227
|
const overrideStateInternal = beginContext((publicStateSchema) => {
|
|
19236
19228
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19237
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19229
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
19238
19230
|
stateSchema: publicStateSchema,
|
|
19239
19231
|
});
|
|
19240
19232
|
const stateSchema = removeUndefined(publicStateSchema);
|
|
@@ -19264,13 +19256,13 @@ function overrideState(stateSchema) {
|
|
|
19264
19256
|
return overrideStateInternal(stateSchema);
|
|
19265
19257
|
}
|
|
19266
19258
|
|
|
19267
|
-
const METHOD_NAME
|
|
19259
|
+
const METHOD_NAME$10 = "function.test.overrideStorage";
|
|
19268
19260
|
/**
|
|
19269
19261
|
* Function implementation
|
|
19270
19262
|
*/
|
|
19271
19263
|
const overrideStorageInternal = beginContext((publicStorageSchema) => {
|
|
19272
19264
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19273
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
19265
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
19274
19266
|
storageSchema: publicStorageSchema,
|
|
19275
19267
|
});
|
|
19276
19268
|
const storageSchema = removeUndefined(publicStorageSchema);
|
|
@@ -19301,13 +19293,13 @@ function overrideStorage(storageSchema) {
|
|
|
19301
19293
|
return overrideStorageInternal(storageSchema);
|
|
19302
19294
|
}
|
|
19303
19295
|
|
|
19304
|
-
const METHOD_NAME
|
|
19296
|
+
const METHOD_NAME$$ = "function.test.overrideSwarm";
|
|
19305
19297
|
/**
|
|
19306
19298
|
* Function implementation
|
|
19307
19299
|
*/
|
|
19308
19300
|
const overrideSwarmInternal = beginContext((publicSwarmSchema) => {
|
|
19309
19301
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19310
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
19302
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
19311
19303
|
swarmSchema: publicSwarmSchema,
|
|
19312
19304
|
});
|
|
19313
19305
|
const swarmSchema = removeUndefined(publicSwarmSchema);
|
|
@@ -19336,13 +19328,13 @@ function overrideSwarm(swarmSchema) {
|
|
|
19336
19328
|
return overrideSwarmInternal(swarmSchema);
|
|
19337
19329
|
}
|
|
19338
19330
|
|
|
19339
|
-
const METHOD_NAME$
|
|
19331
|
+
const METHOD_NAME$_ = "function.test.overrideTool";
|
|
19340
19332
|
/**
|
|
19341
19333
|
* Function implementation
|
|
19342
19334
|
*/
|
|
19343
19335
|
const overrideToolInternal = beginContext((publicToolSchema) => {
|
|
19344
19336
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19345
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19337
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
19346
19338
|
toolSchema: publicToolSchema,
|
|
19347
19339
|
});
|
|
19348
19340
|
const toolSchema = removeUndefined(publicToolSchema);
|
|
@@ -19370,13 +19362,13 @@ function overrideTool(toolSchema) {
|
|
|
19370
19362
|
return overrideToolInternal(toolSchema);
|
|
19371
19363
|
}
|
|
19372
19364
|
|
|
19373
|
-
const METHOD_NAME$
|
|
19365
|
+
const METHOD_NAME$Z = "function.test.overrideMCP";
|
|
19374
19366
|
/**
|
|
19375
19367
|
* Function implementation
|
|
19376
19368
|
*/
|
|
19377
19369
|
const overrideMCPInternal = beginContext((publicMcpSchema) => {
|
|
19378
19370
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19379
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19371
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
19380
19372
|
mcpSchema: publicMcpSchema,
|
|
19381
19373
|
});
|
|
19382
19374
|
const mcpSchema = removeUndefined(publicMcpSchema);
|
|
@@ -19390,13 +19382,13 @@ function overrideMCP(mcpSchema) {
|
|
|
19390
19382
|
return overrideMCPInternal(mcpSchema);
|
|
19391
19383
|
}
|
|
19392
19384
|
|
|
19393
|
-
const METHOD_NAME$
|
|
19385
|
+
const METHOD_NAME$Y = "function.test.overrideAdvisor";
|
|
19394
19386
|
/**
|
|
19395
19387
|
* Function implementation
|
|
19396
19388
|
*/
|
|
19397
19389
|
const overrideAdvisorInternal = beginContext((publicAdvisorSchema) => {
|
|
19398
19390
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19399
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19391
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
19400
19392
|
advisorSchema: publicAdvisorSchema,
|
|
19401
19393
|
});
|
|
19402
19394
|
const advisorSchema = removeUndefined(publicAdvisorSchema);
|
|
@@ -19443,13 +19435,13 @@ function overrideAdvisor(advisorSchema) {
|
|
|
19443
19435
|
* Method name for the overrideCompute operation.
|
|
19444
19436
|
* @private
|
|
19445
19437
|
*/
|
|
19446
|
-
const METHOD_NAME$
|
|
19438
|
+
const METHOD_NAME$X = "function.test.overrideCompute";
|
|
19447
19439
|
/**
|
|
19448
19440
|
* Function implementation
|
|
19449
19441
|
*/
|
|
19450
19442
|
const overrideComputeInternal = beginContext((publicComputeSchema) => {
|
|
19451
19443
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19452
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19444
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
19453
19445
|
computeSchema: publicComputeSchema,
|
|
19454
19446
|
});
|
|
19455
19447
|
const computeSchema = removeUndefined(publicComputeSchema);
|
|
@@ -19473,13 +19465,13 @@ function overrideCompute(computeSchema) {
|
|
|
19473
19465
|
* Method name for the overridePipeline operation.
|
|
19474
19466
|
* @private
|
|
19475
19467
|
*/
|
|
19476
|
-
const METHOD_NAME$
|
|
19468
|
+
const METHOD_NAME$W = "function.test.overridePipeline";
|
|
19477
19469
|
/**
|
|
19478
19470
|
* Function implementation
|
|
19479
19471
|
*/
|
|
19480
19472
|
const overridePipelineInternal = beginContext((publicPipelineSchema) => {
|
|
19481
19473
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19482
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19474
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
19483
19475
|
pipelineSchema: publicPipelineSchema,
|
|
19484
19476
|
});
|
|
19485
19477
|
const pipelineSchema = removeUndefined(publicPipelineSchema);
|
|
@@ -19501,7 +19493,7 @@ function overridePipeline(pipelineSchema) {
|
|
|
19501
19493
|
* @private
|
|
19502
19494
|
* @constant {string}
|
|
19503
19495
|
*/
|
|
19504
|
-
const METHOD_NAME$
|
|
19496
|
+
const METHOD_NAME$V = "function.test.overrideOutline";
|
|
19505
19497
|
/**
|
|
19506
19498
|
* Internal implementation of the outline override logic, wrapped in a clean context.
|
|
19507
19499
|
* Updates the specified outline schema in the swarm's schema service and logs the operation if enabled.
|
|
@@ -19509,7 +19501,7 @@ const METHOD_NAME$U = "function.test.overrideOutline";
|
|
|
19509
19501
|
*/
|
|
19510
19502
|
const overrideOutlineInternal = beginContext((publicOutlineSchema) => {
|
|
19511
19503
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19512
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19504
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
19513
19505
|
outlineSchema: publicOutlineSchema,
|
|
19514
19506
|
});
|
|
19515
19507
|
const outlineSchema = removeUndefined(publicOutlineSchema);
|
|
@@ -19527,23 +19519,23 @@ function overrideOutline(outlineSchema) {
|
|
|
19527
19519
|
return overrideOutlineInternal(outlineSchema);
|
|
19528
19520
|
}
|
|
19529
19521
|
|
|
19530
|
-
const METHOD_NAME$
|
|
19522
|
+
const METHOD_NAME$U = "function.other.markOnline";
|
|
19531
19523
|
/**
|
|
19532
19524
|
* Function implementation
|
|
19533
19525
|
*/
|
|
19534
19526
|
const markOnlineInternal = async (clientId, swarmName) => {
|
|
19535
19527
|
// Log the operation if logging is enabled in the global configuration
|
|
19536
19528
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19537
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
19529
|
+
swarm.loggerService.log(METHOD_NAME$U, {
|
|
19538
19530
|
clientId,
|
|
19539
19531
|
});
|
|
19540
19532
|
// Validate the swarm name
|
|
19541
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19533
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$U);
|
|
19542
19534
|
// Run the operation in the method context
|
|
19543
19535
|
return await MethodContextService.runInContext(async () => {
|
|
19544
|
-
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$
|
|
19536
|
+
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$U);
|
|
19545
19537
|
}, {
|
|
19546
|
-
methodName: METHOD_NAME$
|
|
19538
|
+
methodName: METHOD_NAME$U,
|
|
19547
19539
|
agentName: "",
|
|
19548
19540
|
policyName: "",
|
|
19549
19541
|
stateName: "",
|
|
@@ -19566,20 +19558,20 @@ async function markOnline(clientId, swarmName) {
|
|
|
19566
19558
|
return await markOnlineInternal(clientId, swarmName);
|
|
19567
19559
|
}
|
|
19568
19560
|
|
|
19569
|
-
const METHOD_NAME$
|
|
19561
|
+
const METHOD_NAME$T = "function.other.markOffline";
|
|
19570
19562
|
/**
|
|
19571
19563
|
* Function implementation
|
|
19572
19564
|
*/
|
|
19573
19565
|
const markOfflineInternal = async (clientId, swarmName) => {
|
|
19574
19566
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19575
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
19567
|
+
swarm.loggerService.log(METHOD_NAME$T, {
|
|
19576
19568
|
clientId,
|
|
19577
19569
|
});
|
|
19578
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19570
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$T);
|
|
19579
19571
|
return await MethodContextService.runInContext(async () => {
|
|
19580
|
-
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$
|
|
19572
|
+
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$T);
|
|
19581
19573
|
}, {
|
|
19582
|
-
methodName: METHOD_NAME$
|
|
19574
|
+
methodName: METHOD_NAME$T,
|
|
19583
19575
|
agentName: "",
|
|
19584
19576
|
policyName: "",
|
|
19585
19577
|
stateName: "",
|
|
@@ -19607,27 +19599,27 @@ async function markOffline(clientId, swarmName) {
|
|
|
19607
19599
|
}
|
|
19608
19600
|
|
|
19609
19601
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19610
|
-
const METHOD_NAME$
|
|
19602
|
+
const METHOD_NAME$S = "function.commit.commitSystemMessage";
|
|
19611
19603
|
/**
|
|
19612
19604
|
* Function implementation
|
|
19613
19605
|
*/
|
|
19614
19606
|
const commitSystemMessageInternal = beginContext(async (content, clientId, agentName) => {
|
|
19615
19607
|
// Log the commit attempt if enabled
|
|
19616
19608
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19617
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19609
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
19618
19610
|
content,
|
|
19619
19611
|
clientId,
|
|
19620
19612
|
agentName,
|
|
19621
19613
|
});
|
|
19622
19614
|
// Validate the agent exists
|
|
19623
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19615
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$S);
|
|
19624
19616
|
// Validate the session exists and retrieve the associated swarm
|
|
19625
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19617
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$S);
|
|
19626
19618
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19627
19619
|
// Validate the swarm configuration
|
|
19628
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19620
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$S);
|
|
19629
19621
|
// Check if the current agent matches the provided agent
|
|
19630
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19622
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$S, clientId, swarmName);
|
|
19631
19623
|
if (currentAgentName !== agentName) {
|
|
19632
19624
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19633
19625
|
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
@@ -19638,7 +19630,7 @@ const commitSystemMessageInternal = beginContext(async (content, clientId, agent
|
|
|
19638
19630
|
return;
|
|
19639
19631
|
}
|
|
19640
19632
|
// Commit the system message via SessionPublicService
|
|
19641
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19633
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$S, clientId, swarmName);
|
|
19642
19634
|
});
|
|
19643
19635
|
/**
|
|
19644
19636
|
* Commits a system-generated message to the active agent in the swarm system.
|
|
@@ -19660,22 +19652,22 @@ async function commitSystemMessage(content, clientId, agentName) {
|
|
|
19660
19652
|
}
|
|
19661
19653
|
|
|
19662
19654
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19663
|
-
const METHOD_NAME$
|
|
19655
|
+
const METHOD_NAME$R = "function.commit.commitDeveloperMessage";
|
|
19664
19656
|
/**
|
|
19665
19657
|
* Function implementation
|
|
19666
19658
|
*/
|
|
19667
19659
|
const commitDeveloperMessageInternal = beginContext(async (content, clientId, agentName) => {
|
|
19668
19660
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19669
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19661
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
19670
19662
|
content,
|
|
19671
19663
|
clientId,
|
|
19672
19664
|
agentName,
|
|
19673
19665
|
});
|
|
19674
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19675
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19666
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$R);
|
|
19667
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$R);
|
|
19676
19668
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19677
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19678
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19669
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$R);
|
|
19670
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$R, clientId, swarmName);
|
|
19679
19671
|
if (currentAgentName !== agentName) {
|
|
19680
19672
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19681
19673
|
swarm$1.loggerService.log('function "commitDeveloperMessage" skipped due to the agent change', {
|
|
@@ -19685,7 +19677,7 @@ const commitDeveloperMessageInternal = beginContext(async (content, clientId, ag
|
|
|
19685
19677
|
});
|
|
19686
19678
|
return;
|
|
19687
19679
|
}
|
|
19688
|
-
await swarm$1.sessionPublicService.commitDeveloperMessage(content, METHOD_NAME$
|
|
19680
|
+
await swarm$1.sessionPublicService.commitDeveloperMessage(content, METHOD_NAME$R, clientId, swarmName);
|
|
19689
19681
|
});
|
|
19690
19682
|
/**
|
|
19691
19683
|
* Commits a developer-generated message to the active agent in the swarm system.
|
|
@@ -19706,26 +19698,26 @@ async function commitDeveloperMessage(content, clientId, agentName) {
|
|
|
19706
19698
|
return await commitDeveloperMessageInternal(content, clientId, agentName);
|
|
19707
19699
|
}
|
|
19708
19700
|
|
|
19709
|
-
const METHOD_NAME$
|
|
19701
|
+
const METHOD_NAME$Q = "function.commit.commitSystemMessage";
|
|
19710
19702
|
/**
|
|
19711
19703
|
* Function implementation
|
|
19712
19704
|
*/
|
|
19713
19705
|
const commitUserMessageInternal = beginContext(async (content, mode, clientId, agentName, payload) => {
|
|
19714
19706
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19715
19707
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19716
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19708
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
19717
19709
|
content,
|
|
19718
19710
|
clientId,
|
|
19719
19711
|
agentName,
|
|
19720
19712
|
mode,
|
|
19721
19713
|
});
|
|
19722
19714
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
19723
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19724
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19715
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$Q);
|
|
19716
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$Q);
|
|
19725
19717
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19726
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19718
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$Q);
|
|
19727
19719
|
// Check if the specified agent is still the active agent in the swarm session
|
|
19728
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19720
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$Q, clientId, swarmName);
|
|
19729
19721
|
if (currentAgentName !== agentName) {
|
|
19730
19722
|
// Log a skip message if the agent has changed during the operation
|
|
19731
19723
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -19738,14 +19730,14 @@ const commitUserMessageInternal = beginContext(async (content, mode, clientId, a
|
|
|
19738
19730
|
}
|
|
19739
19731
|
if (payload) {
|
|
19740
19732
|
return await PayloadContextService.runInContext(async () => {
|
|
19741
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19733
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$Q, clientId, swarmName);
|
|
19742
19734
|
}, {
|
|
19743
19735
|
clientId,
|
|
19744
19736
|
payload,
|
|
19745
19737
|
});
|
|
19746
19738
|
}
|
|
19747
19739
|
// Commit the user message to the agent's history via the session public service
|
|
19748
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19740
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$Q, clientId, swarmName);
|
|
19749
19741
|
});
|
|
19750
19742
|
/**
|
|
19751
19743
|
* Commits a user message to the active agent's history in a swarm session without triggering a response.
|
|
@@ -19769,24 +19761,24 @@ async function commitUserMessage(content, mode, clientId, agentName, payload) {
|
|
|
19769
19761
|
}
|
|
19770
19762
|
|
|
19771
19763
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19772
|
-
const METHOD_NAME$
|
|
19764
|
+
const METHOD_NAME$P = "function.commit.commitSystemMessageForce";
|
|
19773
19765
|
/**
|
|
19774
19766
|
* Function implementation
|
|
19775
19767
|
*/
|
|
19776
19768
|
const commitSystemMessageForceInternal = beginContext(async (content, clientId) => {
|
|
19777
19769
|
// Log the commit attempt if enabled
|
|
19778
19770
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19779
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19771
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
19780
19772
|
content,
|
|
19781
19773
|
clientId,
|
|
19782
19774
|
});
|
|
19783
19775
|
// Validate the session exists and retrieve the associated swarm
|
|
19784
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19776
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$P);
|
|
19785
19777
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19786
19778
|
// Validate the swarm configuration
|
|
19787
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19779
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$P);
|
|
19788
19780
|
// Commit the system message via SessionPublicService without agent checks
|
|
19789
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19781
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$P, clientId, swarmName);
|
|
19790
19782
|
});
|
|
19791
19783
|
/**
|
|
19792
19784
|
* Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
|
|
@@ -19807,7 +19799,7 @@ async function commitSystemMessageForce(content, clientId) {
|
|
|
19807
19799
|
}
|
|
19808
19800
|
|
|
19809
19801
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19810
|
-
const METHOD_NAME$
|
|
19802
|
+
const METHOD_NAME$O = "function.commit.commitDeveloperMessageForce";
|
|
19811
19803
|
/**
|
|
19812
19804
|
* Internal implementation for forcefully committing a developer message to a session in the swarm system.
|
|
19813
19805
|
* Logs the operation if enabled, validates the session and swarm, and commits the message via SessionPublicService.
|
|
@@ -19820,14 +19812,14 @@ const METHOD_NAME$N = "function.commit.commitDeveloperMessageForce";
|
|
|
19820
19812
|
*/
|
|
19821
19813
|
const commitDeveloperMessageForceInternal = beginContext(async (content, clientId) => {
|
|
19822
19814
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19823
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19815
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
19824
19816
|
content,
|
|
19825
19817
|
clientId,
|
|
19826
19818
|
});
|
|
19827
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19819
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$O);
|
|
19828
19820
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19829
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19830
|
-
await swarm$1.sessionPublicService.commitDeveloperMessage(content, METHOD_NAME$
|
|
19821
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$O);
|
|
19822
|
+
await swarm$1.sessionPublicService.commitDeveloperMessage(content, METHOD_NAME$O, clientId, swarmName);
|
|
19831
19823
|
});
|
|
19832
19824
|
/**
|
|
19833
19825
|
* Forcefully commits a developer-generated message to a session in the swarm system, without checking the active agent.
|
|
@@ -19846,32 +19838,32 @@ async function commitDeveloperMessageForce(content, clientId) {
|
|
|
19846
19838
|
return await commitDeveloperMessageForceInternal(content, clientId);
|
|
19847
19839
|
}
|
|
19848
19840
|
|
|
19849
|
-
const METHOD_NAME$
|
|
19841
|
+
const METHOD_NAME$N = "function.commit.commitSystemMessage";
|
|
19850
19842
|
/**
|
|
19851
19843
|
* Function implementation
|
|
19852
19844
|
*/
|
|
19853
19845
|
const commitUserMessageForceInternal = beginContext(async (content, mode, clientId, payload) => {
|
|
19854
19846
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19855
19847
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19856
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19848
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
19857
19849
|
content,
|
|
19858
19850
|
clientId,
|
|
19859
19851
|
mode,
|
|
19860
19852
|
});
|
|
19861
19853
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
19862
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19854
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$N);
|
|
19863
19855
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19864
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19856
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$N);
|
|
19865
19857
|
if (payload) {
|
|
19866
19858
|
return await PayloadContextService.runInContext(async () => {
|
|
19867
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19859
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$N, clientId, swarmName);
|
|
19868
19860
|
}, {
|
|
19869
19861
|
clientId,
|
|
19870
19862
|
payload,
|
|
19871
19863
|
});
|
|
19872
19864
|
}
|
|
19873
19865
|
// Commit the user message to the agent's history via the session public service without checking the active agent
|
|
19874
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19866
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$N, clientId, swarmName);
|
|
19875
19867
|
});
|
|
19876
19868
|
/**
|
|
19877
19869
|
* Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
|
|
@@ -19894,27 +19886,27 @@ async function commitUserMessageForce(content, mode, clientId, payload) {
|
|
|
19894
19886
|
}
|
|
19895
19887
|
|
|
19896
19888
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19897
|
-
const METHOD_NAME$
|
|
19889
|
+
const METHOD_NAME$M = "function.commit.commitAssistantMessage";
|
|
19898
19890
|
/**
|
|
19899
19891
|
* Function implementation
|
|
19900
19892
|
*/
|
|
19901
19893
|
const commitAssistantMessageInternal = beginContext(async (content, clientId, agentName) => {
|
|
19902
19894
|
// Log the commit attempt if enabled
|
|
19903
19895
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19904
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19896
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
19905
19897
|
content,
|
|
19906
19898
|
clientId,
|
|
19907
19899
|
agentName,
|
|
19908
19900
|
});
|
|
19909
19901
|
// Validate the agent exists
|
|
19910
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19902
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$M);
|
|
19911
19903
|
// Validate the session exists and retrieve the associated swarm
|
|
19912
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19904
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$M);
|
|
19913
19905
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19914
19906
|
// Validate the swarm configuration
|
|
19915
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19907
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$M);
|
|
19916
19908
|
// Check if the current agent matches the provided agent
|
|
19917
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19909
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$M, clientId, swarmName);
|
|
19918
19910
|
if (currentAgentName !== agentName) {
|
|
19919
19911
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19920
19912
|
swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
|
|
@@ -19925,7 +19917,7 @@ const commitAssistantMessageInternal = beginContext(async (content, clientId, ag
|
|
|
19925
19917
|
return;
|
|
19926
19918
|
}
|
|
19927
19919
|
// Commit the assistant message via SessionPublicService
|
|
19928
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19920
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$M, clientId, swarmName);
|
|
19929
19921
|
});
|
|
19930
19922
|
/**
|
|
19931
19923
|
* Commits an assistant-generated message to the active agent in the swarm system.
|
|
@@ -19946,24 +19938,24 @@ async function commitAssistantMessage(content, clientId, agentName) {
|
|
|
19946
19938
|
}
|
|
19947
19939
|
|
|
19948
19940
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19949
|
-
const METHOD_NAME$
|
|
19941
|
+
const METHOD_NAME$L = "function.commit.commitAssistantMessageForce";
|
|
19950
19942
|
/**
|
|
19951
19943
|
* Function implementation
|
|
19952
19944
|
*/
|
|
19953
19945
|
const commitAssistantMessageForceInternal = beginContext(async (content, clientId) => {
|
|
19954
19946
|
// Log the commit attempt if enabled
|
|
19955
19947
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19956
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19948
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
19957
19949
|
content,
|
|
19958
19950
|
clientId,
|
|
19959
19951
|
});
|
|
19960
19952
|
// Validate the session exists and retrieve the associated swarm
|
|
19961
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19953
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$L);
|
|
19962
19954
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19963
19955
|
// Validate the swarm configuration
|
|
19964
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19956
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$L);
|
|
19965
19957
|
// Commit the assistant message via SessionPublicService without agent checks
|
|
19966
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19958
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$L, clientId, swarmName);
|
|
19967
19959
|
});
|
|
19968
19960
|
/**
|
|
19969
19961
|
* Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
|
|
@@ -19984,26 +19976,26 @@ async function commitAssistantMessageForce(content, clientId) {
|
|
|
19984
19976
|
}
|
|
19985
19977
|
|
|
19986
19978
|
/** @private Constant defining the method name for logging and validation context*/
|
|
19987
|
-
const METHOD_NAME$
|
|
19979
|
+
const METHOD_NAME$K = "function.commit.cancelOutput";
|
|
19988
19980
|
/**
|
|
19989
19981
|
* Function implementation
|
|
19990
19982
|
*/
|
|
19991
19983
|
const cancelOutputInternal = beginContext(async (clientId, agentName) => {
|
|
19992
19984
|
// Log the cancellation attempt if enabled
|
|
19993
19985
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19994
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19986
|
+
swarm$1.loggerService.log(METHOD_NAME$K, {
|
|
19995
19987
|
clientId,
|
|
19996
19988
|
agentName,
|
|
19997
19989
|
});
|
|
19998
19990
|
// Validate the agent exists
|
|
19999
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19991
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$K);
|
|
20000
19992
|
// Validate the session exists and retrieve the associated swarm
|
|
20001
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19993
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$K);
|
|
20002
19994
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
20003
19995
|
// Validate the swarm configuration
|
|
20004
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19996
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$K);
|
|
20005
19997
|
// Check if the current agent matches the provided agent
|
|
20006
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19998
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$K, clientId, swarmName);
|
|
20007
19999
|
if (currentAgentName !== agentName) {
|
|
20008
20000
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20009
20001
|
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
@@ -20014,7 +20006,7 @@ const cancelOutputInternal = beginContext(async (clientId, agentName) => {
|
|
|
20014
20006
|
return;
|
|
20015
20007
|
}
|
|
20016
20008
|
// Perform the output cancellation via SwarmPublicService
|
|
20017
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
20009
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$K, clientId, swarmName);
|
|
20018
20010
|
});
|
|
20019
20011
|
/**
|
|
20020
20012
|
* Cancels the awaited output for a specific client and agent by emitting an empty string.
|
|
@@ -20033,23 +20025,23 @@ async function cancelOutput(clientId, agentName) {
|
|
|
20033
20025
|
}
|
|
20034
20026
|
|
|
20035
20027
|
/** @private Constant defining the method name for logging and validation context*/
|
|
20036
|
-
const METHOD_NAME$
|
|
20028
|
+
const METHOD_NAME$J = "function.commit.cancelOutputForce";
|
|
20037
20029
|
/**
|
|
20038
20030
|
* Function implementation
|
|
20039
20031
|
*/
|
|
20040
20032
|
const cancelOutputForceInternal = beginContext(async (clientId) => {
|
|
20041
20033
|
// Log the cancellation attempt if enabled
|
|
20042
20034
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20043
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20035
|
+
swarm$1.loggerService.log(METHOD_NAME$J, {
|
|
20044
20036
|
clientId,
|
|
20045
20037
|
});
|
|
20046
20038
|
// Validate the session exists and retrieve the associated swarm
|
|
20047
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
20039
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$J);
|
|
20048
20040
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
20049
20041
|
// Validate the swarm configuration
|
|
20050
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
20042
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$J);
|
|
20051
20043
|
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
20052
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
20044
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$J, clientId, swarmName);
|
|
20053
20045
|
});
|
|
20054
20046
|
/**
|
|
20055
20047
|
* Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
|
|
@@ -20067,22 +20059,22 @@ async function cancelOutputForce(clientId) {
|
|
|
20067
20059
|
return await cancelOutputForceInternal(clientId);
|
|
20068
20060
|
}
|
|
20069
20061
|
|
|
20070
|
-
const METHOD_NAME$
|
|
20062
|
+
const METHOD_NAME$I = "function.commit.commitToolRequest";
|
|
20071
20063
|
/**
|
|
20072
20064
|
* Function implementation
|
|
20073
20065
|
*/
|
|
20074
20066
|
const commitToolRequestInternal = beginContext(async (request, clientId, agentName) => {
|
|
20075
20067
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20076
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20068
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
20077
20069
|
request,
|
|
20078
20070
|
clientId,
|
|
20079
20071
|
agentName,
|
|
20080
20072
|
});
|
|
20081
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
20082
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
20073
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$I);
|
|
20074
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$I);
|
|
20083
20075
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
20084
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
20085
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
20076
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$I);
|
|
20077
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$I, clientId, swarmName);
|
|
20086
20078
|
if (currentAgentName !== agentName) {
|
|
20087
20079
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20088
20080
|
swarm$1.loggerService.log('function "commitToolRequest" skipped due to the agent change', {
|
|
@@ -20092,7 +20084,7 @@ const commitToolRequestInternal = beginContext(async (request, clientId, agentNa
|
|
|
20092
20084
|
});
|
|
20093
20085
|
return null;
|
|
20094
20086
|
}
|
|
20095
|
-
return await swarm$1.sessionPublicService.commitToolRequest(Array.isArray(request) ? request : [request], METHOD_NAME$
|
|
20087
|
+
return await swarm$1.sessionPublicService.commitToolRequest(Array.isArray(request) ? request : [request], METHOD_NAME$I, clientId, swarmName);
|
|
20096
20088
|
});
|
|
20097
20089
|
/**
|
|
20098
20090
|
* Commits a tool request to the active agent in the swarm system.
|
|
@@ -20107,21 +20099,21 @@ async function commitToolRequest(request, clientId, agentName) {
|
|
|
20107
20099
|
return await commitToolRequestInternal(request, clientId, agentName);
|
|
20108
20100
|
}
|
|
20109
20101
|
|
|
20110
|
-
const METHOD_NAME$
|
|
20102
|
+
const METHOD_NAME$H = "function.commit.commitToolRequestForce";
|
|
20111
20103
|
/**
|
|
20112
20104
|
* Function implementation
|
|
20113
20105
|
*/
|
|
20114
20106
|
const commitToolRequestForceInternal = beginContext(async (request, clientId) => {
|
|
20115
20107
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20116
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20108
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
20117
20109
|
request,
|
|
20118
20110
|
clientId,
|
|
20119
20111
|
});
|
|
20120
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
20112
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$H);
|
|
20121
20113
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
20122
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
20114
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$H);
|
|
20123
20115
|
const requests = Array.isArray(request) ? request : [request];
|
|
20124
|
-
return await swarm$1.sessionPublicService.commitToolRequest(requests, METHOD_NAME$
|
|
20116
|
+
return await swarm$1.sessionPublicService.commitToolRequest(requests, METHOD_NAME$H, clientId, swarmName);
|
|
20125
20117
|
});
|
|
20126
20118
|
/**
|
|
20127
20119
|
* Forcefully commits a tool request to the active agent in the swarm system.
|
|
@@ -20138,17 +20130,17 @@ async function commitToolRequestForce(request, clientId) {
|
|
|
20138
20130
|
}
|
|
20139
20131
|
|
|
20140
20132
|
/** @constant {string} METHOD_NAME - The name of the method used for logging and validation*/
|
|
20141
|
-
const METHOD_NAME$
|
|
20133
|
+
const METHOD_NAME$G = "function.target.ask";
|
|
20142
20134
|
/**
|
|
20143
20135
|
* Function implementation
|
|
20144
20136
|
*/
|
|
20145
20137
|
const askInternal = beginContext(async (message, advisorName) => {
|
|
20146
20138
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20147
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20139
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
20148
20140
|
message,
|
|
20149
20141
|
advisorName,
|
|
20150
20142
|
});
|
|
20151
|
-
swarm$1.advisorValidationService.validate(advisorName, METHOD_NAME$
|
|
20143
|
+
swarm$1.advisorValidationService.validate(advisorName, METHOD_NAME$G);
|
|
20152
20144
|
const { getChat, callbacks } = swarm$1.advisorSchemaService.get(advisorName);
|
|
20153
20145
|
if (callbacks?.onChat) {
|
|
20154
20146
|
callbacks.onChat(message);
|
|
@@ -20187,7 +20179,7 @@ async function ask(message, advisorName) {
|
|
|
20187
20179
|
return await askInternal(message, advisorName);
|
|
20188
20180
|
}
|
|
20189
20181
|
|
|
20190
|
-
const METHOD_NAME$
|
|
20182
|
+
const METHOD_NAME$F = "function.target.json";
|
|
20191
20183
|
const MAX_ATTEMPTS = 5;
|
|
20192
20184
|
/**
|
|
20193
20185
|
* A class implementing the IOutlineHistory interface to manage a history of outline messages.
|
|
@@ -20231,13 +20223,14 @@ class OutlineHistory {
|
|
|
20231
20223
|
*/
|
|
20232
20224
|
const jsonInternal = beginContext(async (outlineName, param) => {
|
|
20233
20225
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20234
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20235
|
-
swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME$
|
|
20226
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {});
|
|
20227
|
+
swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME$F);
|
|
20236
20228
|
const resultId = functoolsKit.randomString();
|
|
20237
20229
|
const clientId = `${resultId}_outline`;
|
|
20238
20230
|
const { getOutlineHistory, completion, validations = [], maxAttempts = MAX_ATTEMPTS, format, prompt, system, callbacks: outlineCallbacks, } = swarm$1.outlineSchemaService.get(outlineName);
|
|
20239
|
-
swarm$1.completionValidationService.validate(completion, METHOD_NAME$
|
|
20240
|
-
const
|
|
20231
|
+
swarm$1.completionValidationService.validate(completion, METHOD_NAME$F);
|
|
20232
|
+
const completionSchema = swarm$1.completionSchemaService.get(completion);
|
|
20233
|
+
const { getCompletion, flags = [], callbacks: completionCallbacks, } = completionSchema;
|
|
20241
20234
|
let errorMessage = "";
|
|
20242
20235
|
let history;
|
|
20243
20236
|
const modelPrompt = typeof prompt === "function" ? await prompt(outlineName) : prompt;
|
|
@@ -20299,8 +20292,9 @@ const jsonInternal = beginContext(async (outlineName, param) => {
|
|
|
20299
20292
|
if (completionCallbacks?.onComplete) {
|
|
20300
20293
|
completionCallbacks.onComplete({
|
|
20301
20294
|
messages,
|
|
20302
|
-
mode: "tool",
|
|
20303
20295
|
outlineName,
|
|
20296
|
+
format,
|
|
20297
|
+
clientId,
|
|
20304
20298
|
}, output);
|
|
20305
20299
|
}
|
|
20306
20300
|
const data = JSON.parse(output.content);
|
|
@@ -20369,6 +20363,61 @@ async function json(outlineName, param = {}) {
|
|
|
20369
20363
|
return await jsonInternal(outlineName, param);
|
|
20370
20364
|
}
|
|
20371
20365
|
|
|
20366
|
+
const METHOD_NAME$E = "function.target.chat";
|
|
20367
|
+
/**
|
|
20368
|
+
* Internal function to process a chat completion request.
|
|
20369
|
+
* Executes outside existing contexts using `beginContext` to ensure isolation.
|
|
20370
|
+
* Processes a single completion request and returns the output message.
|
|
20371
|
+
* @private
|
|
20372
|
+
* @async
|
|
20373
|
+
*/
|
|
20374
|
+
const chatInternal = beginContext(async (completionName, messages) => {
|
|
20375
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20376
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {});
|
|
20377
|
+
swarm$1.completionValidationService.validate(completionName, METHOD_NAME$E);
|
|
20378
|
+
const resultId = functoolsKit.randomString();
|
|
20379
|
+
const clientId = `${resultId}_chat`;
|
|
20380
|
+
const completionSchema = swarm$1.completionSchemaService.get(completionName);
|
|
20381
|
+
if (completionSchema.json) {
|
|
20382
|
+
throw new Error(`${METHOD_NAME$E} completion ${completionName} should not have json=true. Use a non-JSON completion for chat.`);
|
|
20383
|
+
}
|
|
20384
|
+
const { getCompletion } = completionSchema;
|
|
20385
|
+
let errorValue = null;
|
|
20386
|
+
const unError = errorSubject.subscribe(([errorClientId, error]) => {
|
|
20387
|
+
if (clientId === errorClientId) {
|
|
20388
|
+
errorValue = error;
|
|
20389
|
+
}
|
|
20390
|
+
});
|
|
20391
|
+
const { content } = await getCompletion({
|
|
20392
|
+
clientId,
|
|
20393
|
+
messages,
|
|
20394
|
+
mode: "user",
|
|
20395
|
+
});
|
|
20396
|
+
unError();
|
|
20397
|
+
if (errorValue) {
|
|
20398
|
+
throw errorValue;
|
|
20399
|
+
}
|
|
20400
|
+
return content;
|
|
20401
|
+
});
|
|
20402
|
+
/**
|
|
20403
|
+
* Processes a chat completion request by sending messages to a specified completion service.
|
|
20404
|
+
* Delegates to an internal context-isolated function to ensure clean execution.
|
|
20405
|
+
* @async
|
|
20406
|
+
*
|
|
20407
|
+
* @param completionName The name of the completion service to use.
|
|
20408
|
+
* @param messages Array of messages representing the conversation history.
|
|
20409
|
+
* @example
|
|
20410
|
+
* // Example usage
|
|
20411
|
+
* const output = await chat("openai", [
|
|
20412
|
+
* { role: "system", content: "You are a helpful assistant." },
|
|
20413
|
+
* { role: "user", content: "Hello, how are you?" }
|
|
20414
|
+
* ]);
|
|
20415
|
+
* console.log(output.content); // Logs the completion output
|
|
20416
|
+
*/
|
|
20417
|
+
async function chat(completionName, messages) {
|
|
20418
|
+
return await chatInternal(completionName, messages);
|
|
20419
|
+
}
|
|
20420
|
+
|
|
20372
20421
|
const METHOD_NAME$D = "function.target.disposeConnection";
|
|
20373
20422
|
/**
|
|
20374
20423
|
* Disposes of a client session and all related resources within a swarm.
|
|
@@ -21551,7 +21600,7 @@ const getAgentHistoryInternal = beginContext(async (clientId, agentName) => {
|
|
|
21551
21600
|
* @throws {Error} If validation fails (e.g., invalid session or agent) or if the history public service encounters an error during retrieval.
|
|
21552
21601
|
* @example
|
|
21553
21602
|
* const history = await getAgentHistory("client-123", "AgentX");
|
|
21554
|
-
* console.log(history); // Outputs array of
|
|
21603
|
+
* console.log(history); // Outputs array of ISwarmMessage objects
|
|
21555
21604
|
*/
|
|
21556
21605
|
async function getAgentHistory(clientId, agentName) {
|
|
21557
21606
|
return await getAgentHistoryInternal(clientId, agentName);
|
|
@@ -24556,6 +24605,7 @@ exports.cancelOutputForce = cancelOutputForce;
|
|
|
24556
24605
|
exports.changeToAgent = changeToAgent;
|
|
24557
24606
|
exports.changeToDefaultAgent = changeToDefaultAgent;
|
|
24558
24607
|
exports.changeToPrevAgent = changeToPrevAgent;
|
|
24608
|
+
exports.chat = chat;
|
|
24559
24609
|
exports.commitAssistantMessage = commitAssistantMessage;
|
|
24560
24610
|
exports.commitAssistantMessageForce = commitAssistantMessageForce;
|
|
24561
24611
|
exports.commitDeveloperMessage = commitDeveloperMessage;
|