agent-swarm-kit 1.1.40 → 1.1.42
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 +743 -301
- package/build/index.mjs +742 -302
- package/package.json +1 -1
- package/types.d.ts +465 -96
package/build/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ const contextServices$1 = {
|
|
|
42
42
|
methodContextService: Symbol('methodContextService'),
|
|
43
43
|
payloadContextService: Symbol('payloadContextService'),
|
|
44
44
|
executionContextService: Symbol('executionContextService'),
|
|
45
|
+
schemaContextService: Symbol('schemaContextService'),
|
|
45
46
|
};
|
|
46
47
|
const connectionServices$1 = {
|
|
47
48
|
agentConnectionService: Symbol('agentConnectionService'),
|
|
@@ -3346,6 +3347,24 @@ class LoggerService {
|
|
|
3346
3347
|
}
|
|
3347
3348
|
}
|
|
3348
3349
|
|
|
3350
|
+
/**
|
|
3351
|
+
* @module SchemaContextService
|
|
3352
|
+
* @description Defines a service for managing schema context with a registry of schema services, using dependency injection for scoped instantiation.
|
|
3353
|
+
*/
|
|
3354
|
+
/**
|
|
3355
|
+
* @class SchemaContextService
|
|
3356
|
+
* @description A scoped service that holds the schema context, enabling dependency injection for schema registries.
|
|
3357
|
+
*/
|
|
3358
|
+
const SchemaContextService = diScoped.scoped(class {
|
|
3359
|
+
/**
|
|
3360
|
+
* @constructor
|
|
3361
|
+
* @param {ISchemaContext} context - The schema context containing the registry of schema services.
|
|
3362
|
+
*/
|
|
3363
|
+
constructor(context) {
|
|
3364
|
+
this.context = context;
|
|
3365
|
+
}
|
|
3366
|
+
});
|
|
3367
|
+
|
|
3349
3368
|
/**
|
|
3350
3369
|
* Service class for managing agent schemas in the swarm system.
|
|
3351
3370
|
* Provides a centralized registry for storing and retrieving IAgentSchema instances using ToolRegistry from functools-kit, with shallow validation to ensure schema integrity.
|
|
@@ -3362,6 +3381,13 @@ class AgentSchemaService {
|
|
|
3362
3381
|
* @readonly
|
|
3363
3382
|
*/
|
|
3364
3383
|
this.loggerService = inject(TYPES.loggerService);
|
|
3384
|
+
/**
|
|
3385
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
3386
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
3387
|
+
* @type {TSchemaContextService}
|
|
3388
|
+
* @readonly
|
|
3389
|
+
*/
|
|
3390
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
3365
3391
|
/**
|
|
3366
3392
|
* Registry instance for storing agent schemas, initialized with ToolRegistry from functools-kit.
|
|
3367
3393
|
* Maps AgentName keys to IAgentSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -3369,7 +3395,7 @@ class AgentSchemaService {
|
|
|
3369
3395
|
* @type {ToolRegistry<Record<AgentName, IAgentSchema>>}
|
|
3370
3396
|
* @private
|
|
3371
3397
|
*/
|
|
3372
|
-
this.
|
|
3398
|
+
this._registry = new functoolsKit.ToolRegistry("agentSchemaService");
|
|
3373
3399
|
/**
|
|
3374
3400
|
* Validates an agent schema shallowly, ensuring required fields and array properties meet basic integrity constraints.
|
|
3375
3401
|
* Checks agentName, completion, and prompt as strings; ensures system, dependsOn, states, storages, and tools are arrays of unique strings if present.
|
|
@@ -3508,6 +3534,35 @@ class AgentSchemaService {
|
|
|
3508
3534
|
return this.registry.get(key);
|
|
3509
3535
|
};
|
|
3510
3536
|
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Retrieves the current registry instance for agent schemas.
|
|
3539
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
3540
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
3541
|
+
*
|
|
3542
|
+
* @private
|
|
3543
|
+
* @returns {ToolRegistry<Record<AgentName, IAgentSchema>>} The current registry instance for managing agent schemas.
|
|
3544
|
+
*/
|
|
3545
|
+
get registry() {
|
|
3546
|
+
if (SchemaContextService.hasContext()) {
|
|
3547
|
+
return this.schemaContextService.context.registry.agentSchemaService;
|
|
3548
|
+
}
|
|
3549
|
+
return this._registry;
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* Sets the registry instance for agent schemas.
|
|
3553
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
3554
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
3555
|
+
*
|
|
3556
|
+
* @private
|
|
3557
|
+
* @param {ToolRegistry<Record<AgentName, IAgentSchema>>} value - The new registry instance to set for managing agent schemas.
|
|
3558
|
+
*/
|
|
3559
|
+
set registry(value) {
|
|
3560
|
+
if (SchemaContextService.hasContext()) {
|
|
3561
|
+
this.schemaContextService.context.registry.agentSchemaService = value;
|
|
3562
|
+
return;
|
|
3563
|
+
}
|
|
3564
|
+
this._registry = value;
|
|
3565
|
+
}
|
|
3511
3566
|
}
|
|
3512
3567
|
|
|
3513
3568
|
const AGENT_CHANGE_SYMBOL = Symbol("agent-change");
|
|
@@ -4675,7 +4730,7 @@ class ClientOperator {
|
|
|
4675
4730
|
}
|
|
4676
4731
|
}
|
|
4677
4732
|
|
|
4678
|
-
const METHOD_NAME$
|
|
4733
|
+
const METHOD_NAME$1l = "function.commit.commitToolOutput";
|
|
4679
4734
|
/**
|
|
4680
4735
|
* Commits the output of a tool execution to the active agent in a swarm session.
|
|
4681
4736
|
*
|
|
@@ -4695,19 +4750,19 @@ const METHOD_NAME$1k = "function.commit.commitToolOutput";
|
|
|
4695
4750
|
const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
|
|
4696
4751
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4697
4752
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4698
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4753
|
+
swarm$1.loggerService.log(METHOD_NAME$1l, {
|
|
4699
4754
|
toolId,
|
|
4700
4755
|
content,
|
|
4701
4756
|
clientId,
|
|
4702
4757
|
agentName,
|
|
4703
4758
|
});
|
|
4704
4759
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
4705
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4706
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4760
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1l);
|
|
4761
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1l);
|
|
4707
4762
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4708
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4763
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1l);
|
|
4709
4764
|
// Check if the specified agent is still the active agent in the swarm session
|
|
4710
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4765
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1l, clientId, swarmName);
|
|
4711
4766
|
if (currentAgentName !== agentName) {
|
|
4712
4767
|
// Log a skip message if the agent has changed during the operation
|
|
4713
4768
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -4720,10 +4775,10 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
|
|
|
4720
4775
|
return;
|
|
4721
4776
|
}
|
|
4722
4777
|
// Commit the tool output to the session via the session public service
|
|
4723
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
4778
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1l, clientId, swarmName);
|
|
4724
4779
|
});
|
|
4725
4780
|
|
|
4726
|
-
const METHOD_NAME$
|
|
4781
|
+
const METHOD_NAME$1k = "function.target.execute";
|
|
4727
4782
|
/**
|
|
4728
4783
|
* Sends a message to the active agent in a swarm session as if it originated from the client side.
|
|
4729
4784
|
*
|
|
@@ -4745,19 +4800,19 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4745
4800
|
const executionId = functoolsKit.randomString();
|
|
4746
4801
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4747
4802
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4748
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4803
|
+
swarm$1.loggerService.log(METHOD_NAME$1k, {
|
|
4749
4804
|
content,
|
|
4750
4805
|
clientId,
|
|
4751
4806
|
agentName,
|
|
4752
4807
|
executionId,
|
|
4753
4808
|
});
|
|
4754
4809
|
// Validate the agent, session, and swarm
|
|
4755
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4756
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4810
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1k);
|
|
4811
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1k);
|
|
4757
4812
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4758
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4813
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1k);
|
|
4759
4814
|
// Check if the specified agent is still the active agent
|
|
4760
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4815
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1k, clientId, swarmName);
|
|
4761
4816
|
if (currentAgentName !== agentName) {
|
|
4762
4817
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4763
4818
|
swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
|
|
@@ -4776,7 +4831,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4776
4831
|
agentName,
|
|
4777
4832
|
swarmName,
|
|
4778
4833
|
});
|
|
4779
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
4834
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1k, clientId, swarmName);
|
|
4780
4835
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
4781
4836
|
swarm$1.busService.commitExecutionEnd(clientId, {
|
|
4782
4837
|
agentName,
|
|
@@ -4797,7 +4852,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4797
4852
|
});
|
|
4798
4853
|
|
|
4799
4854
|
/** @private Constant defining the method name for logging and validation context */
|
|
4800
|
-
const METHOD_NAME$
|
|
4855
|
+
const METHOD_NAME$1j = "function.commit.commitFlush";
|
|
4801
4856
|
/**
|
|
4802
4857
|
* Commits a flush of agent history for a specific client and agent in the swarm system.
|
|
4803
4858
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
|
|
@@ -4814,19 +4869,19 @@ const METHOD_NAME$1i = "function.commit.commitFlush";
|
|
|
4814
4869
|
const commitFlush = beginContext(async (clientId, agentName) => {
|
|
4815
4870
|
// Log the flush attempt if enabled
|
|
4816
4871
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4817
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4872
|
+
swarm$1.loggerService.log(METHOD_NAME$1j, {
|
|
4818
4873
|
clientId,
|
|
4819
4874
|
agentName,
|
|
4820
4875
|
});
|
|
4821
4876
|
// Validate the agent exists
|
|
4822
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4877
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1j);
|
|
4823
4878
|
// Validate the session exists and retrieve the associated swarm
|
|
4824
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4879
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1j);
|
|
4825
4880
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4826
4881
|
// Validate the swarm configuration
|
|
4827
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4882
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1j);
|
|
4828
4883
|
// Check if the current agent matches the provided agent
|
|
4829
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4884
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1j, clientId, swarmName);
|
|
4830
4885
|
if (currentAgentName !== agentName) {
|
|
4831
4886
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4832
4887
|
swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
@@ -4837,10 +4892,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
|
|
|
4837
4892
|
return;
|
|
4838
4893
|
}
|
|
4839
4894
|
// Commit the flush of agent history via SessionPublicService
|
|
4840
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
4895
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1j, clientId, swarmName);
|
|
4841
4896
|
});
|
|
4842
4897
|
|
|
4843
|
-
const METHOD_NAME$
|
|
4898
|
+
const METHOD_NAME$1i = "function.target.emit";
|
|
4844
4899
|
/**
|
|
4845
4900
|
* Emits a string as model output without executing an incoming message, with agent activity validation.
|
|
4846
4901
|
*
|
|
@@ -4860,18 +4915,18 @@ const METHOD_NAME$1h = "function.target.emit";
|
|
|
4860
4915
|
const emit = beginContext(async (content, clientId, agentName) => {
|
|
4861
4916
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4862
4917
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4863
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4918
|
+
swarm$1.loggerService.log(METHOD_NAME$1i, {
|
|
4864
4919
|
content,
|
|
4865
4920
|
clientId,
|
|
4866
4921
|
agentName,
|
|
4867
4922
|
});
|
|
4868
4923
|
// Validate the agent, session, and swarm
|
|
4869
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4870
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4924
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1i);
|
|
4925
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1i);
|
|
4871
4926
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4872
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4927
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1i);
|
|
4873
4928
|
// Check if the specified agent is still the active agent
|
|
4874
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4929
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1i, clientId, swarmName);
|
|
4875
4930
|
if (currentAgentName !== agentName) {
|
|
4876
4931
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4877
4932
|
swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
|
|
@@ -4882,10 +4937,10 @@ const emit = beginContext(async (content, clientId, agentName) => {
|
|
|
4882
4937
|
return;
|
|
4883
4938
|
}
|
|
4884
4939
|
// Emit the content directly via the session public service
|
|
4885
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
4940
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1i, clientId, swarmName);
|
|
4886
4941
|
});
|
|
4887
4942
|
|
|
4888
|
-
const METHOD_NAME$
|
|
4943
|
+
const METHOD_NAME$1h = "function.common.getAgentName";
|
|
4889
4944
|
/**
|
|
4890
4945
|
* Retrieves the name of the active agent for a given client session in a swarm.
|
|
4891
4946
|
*
|
|
@@ -4903,19 +4958,19 @@ const METHOD_NAME$1g = "function.common.getAgentName";
|
|
|
4903
4958
|
const getAgentName = beginContext(async (clientId) => {
|
|
4904
4959
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4905
4960
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4906
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4961
|
+
swarm$1.loggerService.log(METHOD_NAME$1h, {
|
|
4907
4962
|
clientId,
|
|
4908
4963
|
});
|
|
4909
4964
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
4910
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4965
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1h);
|
|
4911
4966
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4912
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4967
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1h);
|
|
4913
4968
|
// Retrieve the active agent name via the swarm public service
|
|
4914
|
-
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4969
|
+
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1h, clientId, swarmName);
|
|
4915
4970
|
});
|
|
4916
4971
|
|
|
4917
4972
|
/** @private Constant defining the method name for logging and validation context */
|
|
4918
|
-
const METHOD_NAME$
|
|
4973
|
+
const METHOD_NAME$1g = "function.commit.commitStopTools";
|
|
4919
4974
|
/**
|
|
4920
4975
|
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
4921
4976
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
|
|
@@ -4932,19 +4987,19 @@ const METHOD_NAME$1f = "function.commit.commitStopTools";
|
|
|
4932
4987
|
const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
4933
4988
|
// Log the stop tools attempt if enabled
|
|
4934
4989
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4935
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4990
|
+
swarm$1.loggerService.log(METHOD_NAME$1g, {
|
|
4936
4991
|
clientId,
|
|
4937
4992
|
agentName,
|
|
4938
4993
|
});
|
|
4939
4994
|
// Validate the agent exists
|
|
4940
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4995
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1g);
|
|
4941
4996
|
// Validate the session exists and retrieve the associated swarm
|
|
4942
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4997
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1g);
|
|
4943
4998
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4944
4999
|
// Validate the swarm configuration
|
|
4945
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
5000
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1g);
|
|
4946
5001
|
// Check if the current agent matches the provided agent
|
|
4947
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
5002
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1g, clientId, swarmName);
|
|
4948
5003
|
if (currentAgentName !== agentName) {
|
|
4949
5004
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4950
5005
|
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
@@ -4955,7 +5010,7 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
|
4955
5010
|
return;
|
|
4956
5011
|
}
|
|
4957
5012
|
// Commit the stop of the next tool execution via SessionPublicService
|
|
4958
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
5013
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1g, clientId, swarmName);
|
|
4959
5014
|
});
|
|
4960
5015
|
|
|
4961
5016
|
const METHOD_NAME_UPDATE$2 = "McpUtils.update";
|
|
@@ -5468,7 +5523,7 @@ class AgentConnectionService {
|
|
|
5468
5523
|
}
|
|
5469
5524
|
|
|
5470
5525
|
/** @private Constant defining the method name for logging purposes */
|
|
5471
|
-
const METHOD_NAME$
|
|
5526
|
+
const METHOD_NAME$1f = "function.common.getPayload";
|
|
5472
5527
|
/**
|
|
5473
5528
|
* Retrieves the payload from the current PayloadContextService context.
|
|
5474
5529
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -5479,7 +5534,7 @@ const METHOD_NAME$1e = "function.common.getPayload";
|
|
|
5479
5534
|
* console.log(payload); // { id: number } or null
|
|
5480
5535
|
*/
|
|
5481
5536
|
const getPayload = () => {
|
|
5482
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
5537
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1f);
|
|
5483
5538
|
if (PayloadContextService.hasContext()) {
|
|
5484
5539
|
const { payload } = swarm$1.payloadContextService.context;
|
|
5485
5540
|
return payload;
|
|
@@ -5825,6 +5880,13 @@ class ToolSchemaService {
|
|
|
5825
5880
|
* @readonly
|
|
5826
5881
|
*/
|
|
5827
5882
|
this.loggerService = inject(TYPES.loggerService);
|
|
5883
|
+
/**
|
|
5884
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
5885
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
5886
|
+
* @type {TSchemaContextService}
|
|
5887
|
+
* @readonly
|
|
5888
|
+
*/
|
|
5889
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
5828
5890
|
/**
|
|
5829
5891
|
* Registry instance for storing tool schemas, initialized with ToolRegistry from functools-kit.
|
|
5830
5892
|
* Maps ToolName keys to IAgentTool values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -5832,7 +5894,7 @@ class ToolSchemaService {
|
|
|
5832
5894
|
* @type {ToolRegistry<Record<ToolName, IAgentTool>>}
|
|
5833
5895
|
* @private
|
|
5834
5896
|
*/
|
|
5835
|
-
this.
|
|
5897
|
+
this._registry = new functoolsKit.ToolRegistry("toolSchemaService");
|
|
5836
5898
|
/**
|
|
5837
5899
|
* Validates a tool schema shallowly, ensuring required fields meet basic integrity constraints.
|
|
5838
5900
|
* Checks toolName as a string, call and validate as functions (for tool execution and input validation), and function as an object (tool metadata), using isObject from functools-kit.
|
|
@@ -5908,6 +5970,29 @@ class ToolSchemaService {
|
|
|
5908
5970
|
};
|
|
5909
5971
|
};
|
|
5910
5972
|
}
|
|
5973
|
+
/**
|
|
5974
|
+
* Retrieves the current registry instance for agent schemas.
|
|
5975
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
5976
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
5977
|
+
*/
|
|
5978
|
+
get registry() {
|
|
5979
|
+
if (SchemaContextService.hasContext()) {
|
|
5980
|
+
return this.schemaContextService.context.registry.toolSchemaService;
|
|
5981
|
+
}
|
|
5982
|
+
return this._registry;
|
|
5983
|
+
}
|
|
5984
|
+
/**
|
|
5985
|
+
* Sets the registry instance for agent schemas.
|
|
5986
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
5987
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
5988
|
+
*/
|
|
5989
|
+
set registry(value) {
|
|
5990
|
+
if (SchemaContextService.hasContext()) {
|
|
5991
|
+
this.schemaContextService.context.registry.toolSchemaService = value;
|
|
5992
|
+
return;
|
|
5993
|
+
}
|
|
5994
|
+
this._registry = value;
|
|
5995
|
+
}
|
|
5911
5996
|
}
|
|
5912
5997
|
|
|
5913
5998
|
const AGENT_NEED_FETCH = Symbol("agent-need-fetch");
|
|
@@ -6593,6 +6678,13 @@ class SwarmSchemaService {
|
|
|
6593
6678
|
* @readonly
|
|
6594
6679
|
*/
|
|
6595
6680
|
this.loggerService = inject(TYPES.loggerService);
|
|
6681
|
+
/**
|
|
6682
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
6683
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
6684
|
+
* @type {TSchemaContextService}
|
|
6685
|
+
* @readonly
|
|
6686
|
+
*/
|
|
6687
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
6596
6688
|
/**
|
|
6597
6689
|
* Registry instance for storing swarm schemas, initialized with ToolRegistry from functools-kit.
|
|
6598
6690
|
* Maps SwarmName keys to ISwarmSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -6600,7 +6692,7 @@ class SwarmSchemaService {
|
|
|
6600
6692
|
* @type {ToolRegistry<Record<SwarmName, ISwarmSchema>>}
|
|
6601
6693
|
* @private
|
|
6602
6694
|
*/
|
|
6603
|
-
this.
|
|
6695
|
+
this._registry = new functoolsKit.ToolRegistry("swarmSchemaService");
|
|
6604
6696
|
/**
|
|
6605
6697
|
* Validates a swarm schema shallowly, ensuring required fields and optional properties meet basic integrity constraints.
|
|
6606
6698
|
* Checks swarmName and defaultAgent as strings, agentList as an array of unique strings (AgentName references), and policies, if present, as an array of unique strings (PolicyName references).
|
|
@@ -6685,6 +6777,29 @@ class SwarmSchemaService {
|
|
|
6685
6777
|
return this.registry.get(key);
|
|
6686
6778
|
};
|
|
6687
6779
|
}
|
|
6780
|
+
/**
|
|
6781
|
+
* Retrieves the current registry instance for agent schemas.
|
|
6782
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
6783
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
6784
|
+
*/
|
|
6785
|
+
get registry() {
|
|
6786
|
+
if (SchemaContextService.hasContext()) {
|
|
6787
|
+
return this.schemaContextService.context.registry.swarmSchemaService;
|
|
6788
|
+
}
|
|
6789
|
+
return this._registry;
|
|
6790
|
+
}
|
|
6791
|
+
/**
|
|
6792
|
+
* Sets the registry instance for agent schemas.
|
|
6793
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
6794
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
6795
|
+
*/
|
|
6796
|
+
set registry(value) {
|
|
6797
|
+
if (SchemaContextService.hasContext()) {
|
|
6798
|
+
this.schemaContextService.context.registry.swarmSchemaService = value;
|
|
6799
|
+
return;
|
|
6800
|
+
}
|
|
6801
|
+
this._registry = value;
|
|
6802
|
+
}
|
|
6688
6803
|
}
|
|
6689
6804
|
|
|
6690
6805
|
/**
|
|
@@ -6703,6 +6818,13 @@ class CompletionSchemaService {
|
|
|
6703
6818
|
* @readonly
|
|
6704
6819
|
*/
|
|
6705
6820
|
this.loggerService = inject(TYPES.loggerService);
|
|
6821
|
+
/**
|
|
6822
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
6823
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
6824
|
+
* @type {TSchemaContextService}
|
|
6825
|
+
* @readonly
|
|
6826
|
+
*/
|
|
6827
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
6706
6828
|
/**
|
|
6707
6829
|
* Registry instance for storing completion schemas, initialized with ToolRegistry from functools-kit.
|
|
6708
6830
|
* Maps CompletionName keys to ICompletionSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -6710,7 +6832,7 @@ class CompletionSchemaService {
|
|
|
6710
6832
|
* @type {ToolRegistry<Record<CompletionName, ICompletionSchema>>}
|
|
6711
6833
|
* @private
|
|
6712
6834
|
*/
|
|
6713
|
-
this.
|
|
6835
|
+
this._registry = new functoolsKit.ToolRegistry("completionSchemaService");
|
|
6714
6836
|
/**
|
|
6715
6837
|
* Validates a completion schema shallowly, ensuring required fields meet basic integrity constraints.
|
|
6716
6838
|
* Checks completionName as a string and getCompletion as a function, critical for agent execution in ClientAgent.
|
|
@@ -6776,6 +6898,30 @@ class CompletionSchemaService {
|
|
|
6776
6898
|
return this.registry.get(key);
|
|
6777
6899
|
};
|
|
6778
6900
|
}
|
|
6901
|
+
/**
|
|
6902
|
+
* Retrieves the current registry instance for agent schemas.
|
|
6903
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
6904
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
6905
|
+
*/
|
|
6906
|
+
get registry() {
|
|
6907
|
+
if (SchemaContextService.hasContext()) {
|
|
6908
|
+
return this.schemaContextService.context.registry.completionSchemaService;
|
|
6909
|
+
}
|
|
6910
|
+
return this._registry;
|
|
6911
|
+
}
|
|
6912
|
+
/**
|
|
6913
|
+
* Sets the registry instance for agent schemas.
|
|
6914
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
6915
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
6916
|
+
*/
|
|
6917
|
+
set registry(value) {
|
|
6918
|
+
if (SchemaContextService.hasContext()) {
|
|
6919
|
+
this.schemaContextService.context.registry.completionSchemaService =
|
|
6920
|
+
value;
|
|
6921
|
+
return;
|
|
6922
|
+
}
|
|
6923
|
+
this._registry = value;
|
|
6924
|
+
}
|
|
6779
6925
|
}
|
|
6780
6926
|
|
|
6781
6927
|
/**
|
|
@@ -10096,6 +10242,13 @@ class EmbeddingSchemaService {
|
|
|
10096
10242
|
* @readonly
|
|
10097
10243
|
*/
|
|
10098
10244
|
this.loggerService = inject(TYPES.loggerService);
|
|
10245
|
+
/**
|
|
10246
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
10247
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
10248
|
+
* @type {TSchemaContextService}
|
|
10249
|
+
* @readonly
|
|
10250
|
+
*/
|
|
10251
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
10099
10252
|
/**
|
|
10100
10253
|
* Registry instance for storing embedding schemas, initialized with ToolRegistry from functools-kit.
|
|
10101
10254
|
* Maps EmbeddingName keys to IEmbeddingSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -10103,7 +10256,7 @@ class EmbeddingSchemaService {
|
|
|
10103
10256
|
* @type {ToolRegistry<Record<EmbeddingName, IEmbeddingSchema>>}
|
|
10104
10257
|
* @private
|
|
10105
10258
|
*/
|
|
10106
|
-
this.
|
|
10259
|
+
this._registry = new functoolsKit.ToolRegistry("embeddingSchemaService");
|
|
10107
10260
|
/**
|
|
10108
10261
|
* Validates an embedding schema shallowly, ensuring required fields meet basic integrity constraints.
|
|
10109
10262
|
* Checks embeddingName as a string and calculateSimilarity and createEmbedding as functions, critical for storage operations in StorageConnectionService and SharedStorageConnectionService.
|
|
@@ -10172,6 +10325,29 @@ class EmbeddingSchemaService {
|
|
|
10172
10325
|
return this.registry.get(key);
|
|
10173
10326
|
};
|
|
10174
10327
|
}
|
|
10328
|
+
/**
|
|
10329
|
+
* Retrieves the current registry instance for agent schemas.
|
|
10330
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
10331
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
10332
|
+
*/
|
|
10333
|
+
get registry() {
|
|
10334
|
+
if (SchemaContextService.hasContext()) {
|
|
10335
|
+
return this.schemaContextService.context.registry.embeddingSchemaService;
|
|
10336
|
+
}
|
|
10337
|
+
return this._registry;
|
|
10338
|
+
}
|
|
10339
|
+
/**
|
|
10340
|
+
* Sets the registry instance for agent schemas.
|
|
10341
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
10342
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
10343
|
+
*/
|
|
10344
|
+
set registry(value) {
|
|
10345
|
+
if (SchemaContextService.hasContext()) {
|
|
10346
|
+
this.schemaContextService.context.registry.embeddingSchemaService = value;
|
|
10347
|
+
return;
|
|
10348
|
+
}
|
|
10349
|
+
this._registry = value;
|
|
10350
|
+
}
|
|
10175
10351
|
}
|
|
10176
10352
|
|
|
10177
10353
|
/**
|
|
@@ -10190,6 +10366,13 @@ class StorageSchemaService {
|
|
|
10190
10366
|
* @readonly
|
|
10191
10367
|
*/
|
|
10192
10368
|
this.loggerService = inject(TYPES.loggerService);
|
|
10369
|
+
/**
|
|
10370
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
10371
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
10372
|
+
* @type {TSchemaContextService}
|
|
10373
|
+
* @readonly
|
|
10374
|
+
*/
|
|
10375
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
10193
10376
|
/**
|
|
10194
10377
|
* Registry instance for storing storage schemas, initialized with ToolRegistry from functools-kit.
|
|
10195
10378
|
* Maps StorageName keys to IStorageSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -10197,7 +10380,7 @@ class StorageSchemaService {
|
|
|
10197
10380
|
* @type {ToolRegistry<Record<StorageName, IStorageSchema>>}
|
|
10198
10381
|
* @private
|
|
10199
10382
|
*/
|
|
10200
|
-
this.
|
|
10383
|
+
this._registry = new functoolsKit.ToolRegistry("storageSchemaService");
|
|
10201
10384
|
/**
|
|
10202
10385
|
* Validates a storage schema shallowly, ensuring required fields meet basic integrity constraints.
|
|
10203
10386
|
* Checks storageName as a string, createIndex as a function (for indexing storage data), and embedding as a string (referencing an EmbeddingName from EmbeddingSchemaService).
|
|
@@ -10266,6 +10449,29 @@ class StorageSchemaService {
|
|
|
10266
10449
|
return this.registry.get(key);
|
|
10267
10450
|
};
|
|
10268
10451
|
}
|
|
10452
|
+
/**
|
|
10453
|
+
* Retrieves the current registry instance for agent schemas.
|
|
10454
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
10455
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
10456
|
+
*/
|
|
10457
|
+
get registry() {
|
|
10458
|
+
if (SchemaContextService.hasContext()) {
|
|
10459
|
+
return this.schemaContextService.context.registry.storageSchemaService;
|
|
10460
|
+
}
|
|
10461
|
+
return this._registry;
|
|
10462
|
+
}
|
|
10463
|
+
/**
|
|
10464
|
+
* Sets the registry instance for agent schemas.
|
|
10465
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
10466
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
10467
|
+
*/
|
|
10468
|
+
set registry(value) {
|
|
10469
|
+
if (SchemaContextService.hasContext()) {
|
|
10470
|
+
this.schemaContextService.context.registry.storageSchemaService = value;
|
|
10471
|
+
return;
|
|
10472
|
+
}
|
|
10473
|
+
this._registry = value;
|
|
10474
|
+
}
|
|
10269
10475
|
}
|
|
10270
10476
|
|
|
10271
10477
|
const STORAGE_POOL_DELAY = 0;
|
|
@@ -11340,6 +11546,13 @@ class StateSchemaService {
|
|
|
11340
11546
|
* @readonly
|
|
11341
11547
|
*/
|
|
11342
11548
|
this.loggerService = inject(TYPES.loggerService);
|
|
11549
|
+
/**
|
|
11550
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
11551
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
11552
|
+
* @type {TSchemaContextService}
|
|
11553
|
+
* @readonly
|
|
11554
|
+
*/
|
|
11555
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
11343
11556
|
/**
|
|
11344
11557
|
* Registry instance for storing state schemas, initialized with ToolRegistry from functools-kit.
|
|
11345
11558
|
* Maps StateName keys to IStateSchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -11347,7 +11560,7 @@ class StateSchemaService {
|
|
|
11347
11560
|
* @type {ToolRegistry<Record<StateName, IStateSchema>>}
|
|
11348
11561
|
* @private
|
|
11349
11562
|
*/
|
|
11350
|
-
this.
|
|
11563
|
+
this._registry = new functoolsKit.ToolRegistry("stateSchemaService");
|
|
11351
11564
|
/**
|
|
11352
11565
|
* Validates a state schema shallowly, ensuring required fields and optional properties meet basic integrity constraints.
|
|
11353
11566
|
* Checks stateName as a string and getState as a function (required for state retrieval), and ensures middlewares, if present, is an array of functions.
|
|
@@ -11419,6 +11632,29 @@ class StateSchemaService {
|
|
|
11419
11632
|
return this.registry.get(key);
|
|
11420
11633
|
};
|
|
11421
11634
|
}
|
|
11635
|
+
/**
|
|
11636
|
+
* Retrieves the current registry instance for agent schemas.
|
|
11637
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
11638
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
11639
|
+
*/
|
|
11640
|
+
get registry() {
|
|
11641
|
+
if (SchemaContextService.hasContext()) {
|
|
11642
|
+
return this.schemaContextService.context.registry.stateSchemaService;
|
|
11643
|
+
}
|
|
11644
|
+
return this._registry;
|
|
11645
|
+
}
|
|
11646
|
+
/**
|
|
11647
|
+
* Sets the registry instance for agent schemas.
|
|
11648
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
11649
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
11650
|
+
*/
|
|
11651
|
+
set registry(value) {
|
|
11652
|
+
if (SchemaContextService.hasContext()) {
|
|
11653
|
+
this.schemaContextService.context.registry.stateSchemaService = value;
|
|
11654
|
+
return;
|
|
11655
|
+
}
|
|
11656
|
+
this._registry = value;
|
|
11657
|
+
}
|
|
11422
11658
|
}
|
|
11423
11659
|
|
|
11424
11660
|
/**
|
|
@@ -14251,6 +14487,13 @@ class PolicySchemaService {
|
|
|
14251
14487
|
* @readonly
|
|
14252
14488
|
*/
|
|
14253
14489
|
this.loggerService = inject(TYPES.loggerService);
|
|
14490
|
+
/**
|
|
14491
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
14492
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
14493
|
+
* @type {TSchemaContextService}
|
|
14494
|
+
* @readonly
|
|
14495
|
+
*/
|
|
14496
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
14254
14497
|
/**
|
|
14255
14498
|
* Registry instance for storing policy schemas, initialized with ToolRegistry from functools-kit.
|
|
14256
14499
|
* Maps PolicyName keys to IPolicySchema values, providing efficient storage and retrieval, used in register and get methods.
|
|
@@ -14258,7 +14501,7 @@ class PolicySchemaService {
|
|
|
14258
14501
|
* @type {ToolRegistry<Record<PolicyName, IPolicySchema>>}
|
|
14259
14502
|
* @private
|
|
14260
14503
|
*/
|
|
14261
|
-
this.
|
|
14504
|
+
this._registry = new functoolsKit.ToolRegistry("policySchemaService");
|
|
14262
14505
|
/**
|
|
14263
14506
|
* Validates a policy schema shallowly, ensuring required fields meet basic integrity constraints.
|
|
14264
14507
|
* Checks policyName as a string and getBannedClients as a function, critical for policy enforcement in PolicyConnectionService.
|
|
@@ -14325,6 +14568,29 @@ class PolicySchemaService {
|
|
|
14325
14568
|
return this.registry.get(key);
|
|
14326
14569
|
};
|
|
14327
14570
|
}
|
|
14571
|
+
/**
|
|
14572
|
+
* Retrieves the current registry instance for agent schemas.
|
|
14573
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
14574
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
14575
|
+
*/
|
|
14576
|
+
get registry() {
|
|
14577
|
+
if (SchemaContextService.hasContext()) {
|
|
14578
|
+
return this.schemaContextService.context.registry.policySchemaService;
|
|
14579
|
+
}
|
|
14580
|
+
return this._registry;
|
|
14581
|
+
}
|
|
14582
|
+
/**
|
|
14583
|
+
* Sets the registry instance for agent schemas.
|
|
14584
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
14585
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
14586
|
+
*/
|
|
14587
|
+
set registry(value) {
|
|
14588
|
+
if (SchemaContextService.hasContext()) {
|
|
14589
|
+
this.schemaContextService.context.registry.policySchemaService = value;
|
|
14590
|
+
return;
|
|
14591
|
+
}
|
|
14592
|
+
this._registry = value;
|
|
14593
|
+
}
|
|
14328
14594
|
}
|
|
14329
14595
|
|
|
14330
14596
|
/**
|
|
@@ -15201,11 +15467,18 @@ class WikiSchemaService {
|
|
|
15201
15467
|
* @description Injected logger service instance
|
|
15202
15468
|
*/
|
|
15203
15469
|
this.loggerService = inject(TYPES.loggerService);
|
|
15470
|
+
/**
|
|
15471
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
15472
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
15473
|
+
* @type {TSchemaContextService}
|
|
15474
|
+
* @readonly
|
|
15475
|
+
*/
|
|
15476
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
15204
15477
|
/**
|
|
15205
15478
|
* @private
|
|
15206
15479
|
* @description Registry for storing wiki schemas
|
|
15207
15480
|
*/
|
|
15208
|
-
this.
|
|
15481
|
+
this._registry = new functoolsKit.ToolRegistry("wikiSchemaService");
|
|
15209
15482
|
/**
|
|
15210
15483
|
* Validates basic requirements of a wiki schema
|
|
15211
15484
|
* @private
|
|
@@ -15261,6 +15534,29 @@ class WikiSchemaService {
|
|
|
15261
15534
|
return this.registry.get(key);
|
|
15262
15535
|
};
|
|
15263
15536
|
}
|
|
15537
|
+
/**
|
|
15538
|
+
* Retrieves the current registry instance for agent schemas.
|
|
15539
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
15540
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
15541
|
+
*/
|
|
15542
|
+
get registry() {
|
|
15543
|
+
if (SchemaContextService.hasContext()) {
|
|
15544
|
+
return this.schemaContextService.context.registry.wikiSchemaService;
|
|
15545
|
+
}
|
|
15546
|
+
return this._registry;
|
|
15547
|
+
}
|
|
15548
|
+
/**
|
|
15549
|
+
* Sets the registry instance for agent schemas.
|
|
15550
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
15551
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
15552
|
+
*/
|
|
15553
|
+
set registry(value) {
|
|
15554
|
+
if (SchemaContextService.hasContext()) {
|
|
15555
|
+
this.schemaContextService.context.registry.wikiSchemaService = value;
|
|
15556
|
+
return;
|
|
15557
|
+
}
|
|
15558
|
+
this._registry = value;
|
|
15559
|
+
}
|
|
15264
15560
|
}
|
|
15265
15561
|
|
|
15266
15562
|
/**
|
|
@@ -15554,8 +15850,15 @@ class MCPSchemaService {
|
|
|
15554
15850
|
constructor() {
|
|
15555
15851
|
/** Injected LoggerService for logging operations. */
|
|
15556
15852
|
this.loggerService = inject(TYPES.loggerService);
|
|
15853
|
+
/**
|
|
15854
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
15855
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
15856
|
+
* @type {TSchemaContextService}
|
|
15857
|
+
* @readonly
|
|
15858
|
+
*/
|
|
15859
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
15557
15860
|
/** Registry for storing MCP schemas, keyed by MCP name. */
|
|
15558
|
-
this.
|
|
15861
|
+
this._registry = new functoolsKit.ToolRegistry("mcpSchemaService");
|
|
15559
15862
|
/**
|
|
15560
15863
|
* Validates the basic structure of an MCP schema.
|
|
15561
15864
|
* @param mcpSchema - The MCP schema to validate.
|
|
@@ -15610,6 +15913,29 @@ class MCPSchemaService {
|
|
|
15610
15913
|
return this.registry.get(key);
|
|
15611
15914
|
};
|
|
15612
15915
|
}
|
|
15916
|
+
/**
|
|
15917
|
+
* Retrieves the current registry instance for agent schemas.
|
|
15918
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
15919
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
15920
|
+
*/
|
|
15921
|
+
get registry() {
|
|
15922
|
+
if (SchemaContextService.hasContext()) {
|
|
15923
|
+
return this.schemaContextService.context.registry.mcpSchemaService;
|
|
15924
|
+
}
|
|
15925
|
+
return this._registry;
|
|
15926
|
+
}
|
|
15927
|
+
/**
|
|
15928
|
+
* Sets the registry instance for agent schemas.
|
|
15929
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
15930
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
15931
|
+
*/
|
|
15932
|
+
set registry(value) {
|
|
15933
|
+
if (SchemaContextService.hasContext()) {
|
|
15934
|
+
this.schemaContextService.context.registry.mcpSchemaService = value;
|
|
15935
|
+
return;
|
|
15936
|
+
}
|
|
15937
|
+
this._registry = value;
|
|
15938
|
+
}
|
|
15613
15939
|
}
|
|
15614
15940
|
|
|
15615
15941
|
/**
|
|
@@ -15846,12 +16172,19 @@ class ComputeSchemaService {
|
|
|
15846
16172
|
* @readonly
|
|
15847
16173
|
*/
|
|
15848
16174
|
this.loggerService = inject(TYPES.loggerService);
|
|
16175
|
+
/**
|
|
16176
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
16177
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
16178
|
+
* @type {TSchemaContextService}
|
|
16179
|
+
* @readonly
|
|
16180
|
+
*/
|
|
16181
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
15849
16182
|
/**
|
|
15850
16183
|
* @property {ToolRegistry<Record<ComputeName, IComputeSchema>>} registry
|
|
15851
16184
|
* @description Registry for storing compute schemas.
|
|
15852
16185
|
* @private
|
|
15853
16186
|
*/
|
|
15854
|
-
this.
|
|
16187
|
+
this._registry = new functoolsKit.ToolRegistry("computeSchemaService");
|
|
15855
16188
|
/**
|
|
15856
16189
|
* @method validateShallow
|
|
15857
16190
|
* @description Performs shallow validation of a compute schema.
|
|
@@ -15873,7 +16206,8 @@ class ComputeSchemaService {
|
|
|
15873
16206
|
if (typeof computeSchema.getComputeData !== "function") {
|
|
15874
16207
|
throw new Error(`agent-swarm compute schema validation failed: missing getComputeData for computeName=${computeSchema.computeName}`);
|
|
15875
16208
|
}
|
|
15876
|
-
if (computeSchema.middlewares &&
|
|
16209
|
+
if (computeSchema.middlewares &&
|
|
16210
|
+
!Array.isArray(computeSchema.middlewares)) {
|
|
15877
16211
|
throw new Error(`agent-swarm compute schema validation failed: invalid middlewares for computeName=${computeSchema.computeName} middlewares=${computeSchema.middlewares}`);
|
|
15878
16212
|
}
|
|
15879
16213
|
if (computeSchema.middlewares?.some((value) => typeof value !== "function")) {
|
|
@@ -15923,6 +16257,29 @@ class ComputeSchemaService {
|
|
|
15923
16257
|
return this.registry.get(key);
|
|
15924
16258
|
};
|
|
15925
16259
|
}
|
|
16260
|
+
/**
|
|
16261
|
+
* Retrieves the current registry instance for agent schemas.
|
|
16262
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
16263
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
16264
|
+
*/
|
|
16265
|
+
get registry() {
|
|
16266
|
+
if (SchemaContextService.hasContext()) {
|
|
16267
|
+
return this.schemaContextService.context.registry.computeSchemaService;
|
|
16268
|
+
}
|
|
16269
|
+
return this._registry;
|
|
16270
|
+
}
|
|
16271
|
+
/**
|
|
16272
|
+
* Sets the registry instance for agent schemas.
|
|
16273
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
16274
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
16275
|
+
*/
|
|
16276
|
+
set registry(value) {
|
|
16277
|
+
if (SchemaContextService.hasContext()) {
|
|
16278
|
+
this.schemaContextService.context.registry.computeSchemaService = value;
|
|
16279
|
+
return;
|
|
16280
|
+
}
|
|
16281
|
+
this._registry = value;
|
|
16282
|
+
}
|
|
15926
16283
|
}
|
|
15927
16284
|
|
|
15928
16285
|
/**
|
|
@@ -16745,12 +17102,19 @@ class PipelineSchemaService {
|
|
|
16745
17102
|
* @private
|
|
16746
17103
|
*/
|
|
16747
17104
|
this.loggerService = inject(TYPES.loggerService);
|
|
17105
|
+
/**
|
|
17106
|
+
* Schema context service instance, injected via DI, for managing schema-related context operations.
|
|
17107
|
+
* Provides utilities and methods to interact with schema contexts, supporting schema validation, retrieval, and updates.
|
|
17108
|
+
* @type {TSchemaContextService}
|
|
17109
|
+
* @readonly
|
|
17110
|
+
*/
|
|
17111
|
+
this.schemaContextService = inject(TYPES.schemaContextService);
|
|
16748
17112
|
/**
|
|
16749
17113
|
* @property {ToolRegistry<Record<PipelineName, IPipelineSchema>>} registry
|
|
16750
17114
|
* @description Registry for storing pipeline schemas.
|
|
16751
17115
|
* @private
|
|
16752
17116
|
*/
|
|
16753
|
-
this.
|
|
17117
|
+
this._registry = new functoolsKit.ToolRegistry("pipelineSchemaService");
|
|
16754
17118
|
/**
|
|
16755
17119
|
* @method validateShallow
|
|
16756
17120
|
* @description Performs shallow validation of a pipeline schema.
|
|
@@ -16807,6 +17171,29 @@ class PipelineSchemaService {
|
|
|
16807
17171
|
return this.registry.get(key);
|
|
16808
17172
|
};
|
|
16809
17173
|
}
|
|
17174
|
+
/**
|
|
17175
|
+
* Retrieves the current registry instance for agent schemas.
|
|
17176
|
+
* If a schema context is available via `SchemaContextService`, it returns the registry from the context.
|
|
17177
|
+
* Otherwise, it falls back to the private `_registry` instance.
|
|
17178
|
+
*/
|
|
17179
|
+
get registry() {
|
|
17180
|
+
if (SchemaContextService.hasContext()) {
|
|
17181
|
+
return this.schemaContextService.context.registry.pipelineSchemaService;
|
|
17182
|
+
}
|
|
17183
|
+
return this._registry;
|
|
17184
|
+
}
|
|
17185
|
+
/**
|
|
17186
|
+
* Sets the registry instance for agent schemas.
|
|
17187
|
+
* If a schema context is available via `SchemaContextService`, it updates the registry in the context.
|
|
17188
|
+
* Otherwise, it updates the private `_registry` instance.
|
|
17189
|
+
*/
|
|
17190
|
+
set registry(value) {
|
|
17191
|
+
if (SchemaContextService.hasContext()) {
|
|
17192
|
+
this.schemaContextService.context.registry.pipelineSchemaService = value;
|
|
17193
|
+
return;
|
|
17194
|
+
}
|
|
17195
|
+
this._registry = value;
|
|
17196
|
+
}
|
|
16810
17197
|
}
|
|
16811
17198
|
|
|
16812
17199
|
/**
|
|
@@ -16880,6 +17267,7 @@ class PipelineValidationService {
|
|
|
16880
17267
|
provide(TYPES.methodContextService, () => new MethodContextService());
|
|
16881
17268
|
provide(TYPES.payloadContextService, () => new PayloadContextService());
|
|
16882
17269
|
provide(TYPES.executionContextService, () => new ExecutionContextService());
|
|
17270
|
+
provide(TYPES.schemaContextService, () => new SchemaContextService());
|
|
16883
17271
|
}
|
|
16884
17272
|
{
|
|
16885
17273
|
provide(TYPES.agentConnectionService, () => new AgentConnectionService());
|
|
@@ -16956,6 +17344,7 @@ const contextServices = {
|
|
|
16956
17344
|
methodContextService: inject(TYPES.methodContextService),
|
|
16957
17345
|
payloadContextService: inject(TYPES.payloadContextService),
|
|
16958
17346
|
executionContextService: inject(TYPES.executionContextService),
|
|
17347
|
+
schemaContextService: inject(TYPES.schemaContextService),
|
|
16959
17348
|
};
|
|
16960
17349
|
const connectionServices = {
|
|
16961
17350
|
agentConnectionService: inject(TYPES.agentConnectionService),
|
|
@@ -17033,7 +17422,7 @@ const swarm = {
|
|
|
17033
17422
|
init();
|
|
17034
17423
|
var swarm$1 = swarm;
|
|
17035
17424
|
|
|
17036
|
-
const METHOD_NAME$
|
|
17425
|
+
const METHOD_NAME$1e = "cli.dumpDocs";
|
|
17037
17426
|
/**
|
|
17038
17427
|
* Dumps the documentation for the agents and swarms.
|
|
17039
17428
|
*
|
|
@@ -17043,7 +17432,7 @@ const METHOD_NAME$1d = "cli.dumpDocs";
|
|
|
17043
17432
|
*/
|
|
17044
17433
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
17045
17434
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17046
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17435
|
+
swarm$1.loggerService.log(METHOD_NAME$1e, {
|
|
17047
17436
|
dirName,
|
|
17048
17437
|
});
|
|
17049
17438
|
if (PlantUML) {
|
|
@@ -17053,10 +17442,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17053
17442
|
}
|
|
17054
17443
|
swarm$1.agentValidationService
|
|
17055
17444
|
.getAgentList()
|
|
17056
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17445
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1e));
|
|
17057
17446
|
swarm$1.swarmValidationService
|
|
17058
17447
|
.getSwarmList()
|
|
17059
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17448
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1e));
|
|
17060
17449
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
17061
17450
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
17062
17451
|
if (!dependsOn) {
|
|
@@ -17066,7 +17455,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17066
17455
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
17067
17456
|
});
|
|
17068
17457
|
|
|
17069
|
-
const METHOD_NAME$
|
|
17458
|
+
const METHOD_NAME$1d = "cli.dumpAgent";
|
|
17070
17459
|
/**
|
|
17071
17460
|
* Dumps the agent information into PlantUML format.
|
|
17072
17461
|
*
|
|
@@ -17075,14 +17464,14 @@ const METHOD_NAME$1c = "cli.dumpAgent";
|
|
|
17075
17464
|
*/
|
|
17076
17465
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
17077
17466
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17078
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17467
|
+
swarm$1.loggerService.log(METHOD_NAME$1d, {
|
|
17079
17468
|
agentName,
|
|
17080
17469
|
});
|
|
17081
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17470
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1d);
|
|
17082
17471
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
17083
17472
|
});
|
|
17084
17473
|
|
|
17085
|
-
const METHOD_NAME$
|
|
17474
|
+
const METHOD_NAME$1c = "cli.dumpSwarm";
|
|
17086
17475
|
/**
|
|
17087
17476
|
* Dumps the swarm information into PlantUML format.
|
|
17088
17477
|
*
|
|
@@ -17091,14 +17480,14 @@ const METHOD_NAME$1b = "cli.dumpSwarm";
|
|
|
17091
17480
|
*/
|
|
17092
17481
|
const dumpSwarm = beginContext((swarmName) => {
|
|
17093
17482
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17094
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17483
|
+
swarm$1.loggerService.log(METHOD_NAME$1c, {
|
|
17095
17484
|
swarmName,
|
|
17096
17485
|
});
|
|
17097
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17486
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1c);
|
|
17098
17487
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
17099
17488
|
});
|
|
17100
17489
|
|
|
17101
|
-
const METHOD_NAME$
|
|
17490
|
+
const METHOD_NAME$1b = "cli.dumpPerfomance";
|
|
17102
17491
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
17103
17492
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
17104
17493
|
/**
|
|
@@ -17117,7 +17506,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
17117
17506
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
17118
17507
|
*/
|
|
17119
17508
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
17120
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17509
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1b);
|
|
17121
17510
|
await dumpPerfomanceInternal(dirName);
|
|
17122
17511
|
};
|
|
17123
17512
|
/**
|
|
@@ -17175,7 +17564,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
17175
17564
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
17176
17565
|
});
|
|
17177
17566
|
|
|
17178
|
-
const METHOD_NAME$
|
|
17567
|
+
const METHOD_NAME$1a = "cli.dumpClientPerformance";
|
|
17179
17568
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
17180
17569
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
17181
17570
|
/**
|
|
@@ -17199,7 +17588,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
17199
17588
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
17200
17589
|
*/
|
|
17201
17590
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
17202
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17591
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1a);
|
|
17203
17592
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
17204
17593
|
};
|
|
17205
17594
|
/**
|
|
@@ -17220,7 +17609,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
17220
17609
|
});
|
|
17221
17610
|
|
|
17222
17611
|
/** @private Constant defining the method name for logging and validation context */
|
|
17223
|
-
const METHOD_NAME$
|
|
17612
|
+
const METHOD_NAME$19 = "function.commit.commitFlushForce";
|
|
17224
17613
|
/**
|
|
17225
17614
|
* Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
|
|
17226
17615
|
* Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
|
|
@@ -17238,20 +17627,20 @@ const METHOD_NAME$18 = "function.commit.commitFlushForce";
|
|
|
17238
17627
|
const commitFlushForce = beginContext(async (clientId) => {
|
|
17239
17628
|
// Log the flush attempt if enabled
|
|
17240
17629
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17241
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17630
|
+
swarm$1.loggerService.log(METHOD_NAME$19, {
|
|
17242
17631
|
clientId,
|
|
17243
|
-
METHOD_NAME: METHOD_NAME$
|
|
17632
|
+
METHOD_NAME: METHOD_NAME$19,
|
|
17244
17633
|
});
|
|
17245
17634
|
// Validate the session exists and retrieve the associated swarm
|
|
17246
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17635
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$19);
|
|
17247
17636
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17248
17637
|
// Validate the swarm configuration
|
|
17249
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17638
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$19);
|
|
17250
17639
|
// Commit the flush of agent history via SessionPublicService without agent checks
|
|
17251
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
17640
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$19, clientId, swarmName);
|
|
17252
17641
|
});
|
|
17253
17642
|
|
|
17254
|
-
const METHOD_NAME$
|
|
17643
|
+
const METHOD_NAME$18 = "function.commit.commitToolOutputForce";
|
|
17255
17644
|
/**
|
|
17256
17645
|
* Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
|
|
17257
17646
|
*
|
|
@@ -17270,24 +17659,24 @@ const METHOD_NAME$17 = "function.commit.commitToolOutputForce";
|
|
|
17270
17659
|
const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
|
|
17271
17660
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17272
17661
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17273
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17662
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
17274
17663
|
toolId,
|
|
17275
17664
|
content,
|
|
17276
17665
|
clientId,
|
|
17277
17666
|
});
|
|
17278
17667
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
17279
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17668
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$18);
|
|
17280
17669
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17281
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17670
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$18);
|
|
17282
17671
|
// Commit the tool output to the session via the session public service without checking the active agent
|
|
17283
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
17672
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$18, clientId, swarmName);
|
|
17284
17673
|
});
|
|
17285
17674
|
|
|
17286
17675
|
/**
|
|
17287
17676
|
* @private Constant defining the method name for logging and validation purposes.
|
|
17288
17677
|
* Used as an identifier in log messages and validation checks to track calls to `hasNavigation`.
|
|
17289
17678
|
*/
|
|
17290
|
-
const METHOD_NAME$
|
|
17679
|
+
const METHOD_NAME$17 = "function.common.hasNavigation";
|
|
17291
17680
|
/**
|
|
17292
17681
|
* Checks if a specific agent is part of the navigation route for a given client.
|
|
17293
17682
|
* Validates the agent and client session, retrieves the associated swarm, and queries the navigation route.
|
|
@@ -17298,16 +17687,16 @@ const METHOD_NAME$16 = "function.common.hasNavigation";
|
|
|
17298
17687
|
*/
|
|
17299
17688
|
const hasNavigation = async (clientId, agentName) => {
|
|
17300
17689
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17301
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17302
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17303
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17690
|
+
swarm$1.loggerService.log(METHOD_NAME$17, { clientId });
|
|
17691
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$17);
|
|
17692
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$17);
|
|
17304
17693
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17305
17694
|
return swarm$1.navigationValidationService
|
|
17306
17695
|
.getNavigationRoute(clientId, swarmName)
|
|
17307
17696
|
.has(agentName);
|
|
17308
17697
|
};
|
|
17309
17698
|
|
|
17310
|
-
const METHOD_NAME$
|
|
17699
|
+
const METHOD_NAME$16 = "function.history.getRawHistory";
|
|
17311
17700
|
/**
|
|
17312
17701
|
* Retrieves the raw, unmodified history for a given client session.
|
|
17313
17702
|
*
|
|
@@ -17324,10 +17713,10 @@ const METHOD_NAME$15 = "function.history.getRawHistory";
|
|
|
17324
17713
|
* const rawHistory = await getRawHistory("client-123");
|
|
17325
17714
|
* console.log(rawHistory); // Outputs the full raw history array
|
|
17326
17715
|
*/
|
|
17327
|
-
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$
|
|
17716
|
+
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$16) => {
|
|
17328
17717
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17329
17718
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17330
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17719
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
17331
17720
|
clientId,
|
|
17332
17721
|
});
|
|
17333
17722
|
// Validate the session and swarm
|
|
@@ -17340,7 +17729,7 @@ const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$15)
|
|
|
17340
17729
|
return [...history];
|
|
17341
17730
|
});
|
|
17342
17731
|
|
|
17343
|
-
const METHOD_NAME$
|
|
17732
|
+
const METHOD_NAME$15 = "function.history.getLastUserMessage";
|
|
17344
17733
|
/**
|
|
17345
17734
|
* Retrieves the content of the most recent user message from a client's session history.
|
|
17346
17735
|
*
|
|
@@ -17358,18 +17747,18 @@ const METHOD_NAME$14 = "function.history.getLastUserMessage";
|
|
|
17358
17747
|
const getLastUserMessage = beginContext(async (clientId) => {
|
|
17359
17748
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17360
17749
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17361
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17750
|
+
swarm$1.loggerService.log(METHOD_NAME$15, {
|
|
17362
17751
|
clientId,
|
|
17363
17752
|
});
|
|
17364
17753
|
// Fetch raw history and find the last user message
|
|
17365
|
-
const history = await getRawHistory(clientId, METHOD_NAME$
|
|
17754
|
+
const history = await getRawHistory(clientId, METHOD_NAME$15);
|
|
17366
17755
|
const last = history.findLast(({ role, mode }) => role === "user" && mode === "user");
|
|
17367
17756
|
return last?.content ? last.content : null;
|
|
17368
17757
|
});
|
|
17369
17758
|
|
|
17370
17759
|
const disposeSubject = new functoolsKit.Subject();
|
|
17371
17760
|
|
|
17372
|
-
const METHOD_NAME$
|
|
17761
|
+
const METHOD_NAME$14 = "function.navigate.changeToDefaultAgent";
|
|
17373
17762
|
/**
|
|
17374
17763
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities for switching to the default agent.
|
|
17375
17764
|
*
|
|
@@ -17392,7 +17781,7 @@ const createChangeToDefaultAgent = functoolsKit.memoize(([clientId]) => `${clien
|
|
|
17392
17781
|
}));
|
|
17393
17782
|
{
|
|
17394
17783
|
// Dispose of the current agent's resources and set up the new default agent
|
|
17395
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17784
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$14, clientId, swarmName);
|
|
17396
17785
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17397
17786
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17398
17787
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17430,23 +17819,23 @@ const createGc$3 = functoolsKit.singleshot(async () => {
|
|
|
17430
17819
|
const changeToDefaultAgent = beginContext(async (clientId) => {
|
|
17431
17820
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17432
17821
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17433
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17822
|
+
swarm$1.loggerService.log(METHOD_NAME$14, {
|
|
17434
17823
|
clientId,
|
|
17435
17824
|
});
|
|
17436
17825
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17437
17826
|
const { defaultAgent: agentName } = swarm$1.swarmSchemaService.get(swarmName);
|
|
17438
17827
|
{
|
|
17439
17828
|
// Validate session and default agent
|
|
17440
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17441
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17829
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$14);
|
|
17830
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$14);
|
|
17442
17831
|
}
|
|
17443
17832
|
// Execute the agent change with TTL and queuing
|
|
17444
17833
|
const run = await createChangeToDefaultAgent(clientId);
|
|
17445
17834
|
createGc$3();
|
|
17446
|
-
return await run(METHOD_NAME$
|
|
17835
|
+
return await run(METHOD_NAME$14, agentName, swarmName);
|
|
17447
17836
|
});
|
|
17448
17837
|
|
|
17449
|
-
const METHOD_NAME$
|
|
17838
|
+
const METHOD_NAME$13 = "function.target.emitForce";
|
|
17450
17839
|
/**
|
|
17451
17840
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
17452
17841
|
*
|
|
@@ -17465,19 +17854,19 @@ const METHOD_NAME$12 = "function.target.emitForce";
|
|
|
17465
17854
|
const emitForce = beginContext(async (content, clientId) => {
|
|
17466
17855
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17467
17856
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17468
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17857
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
17469
17858
|
content,
|
|
17470
17859
|
clientId,
|
|
17471
17860
|
});
|
|
17472
17861
|
// Validate the session and swarm
|
|
17473
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17862
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$13);
|
|
17474
17863
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17475
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17864
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$13);
|
|
17476
17865
|
// Emit the content directly via the session public service
|
|
17477
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
17866
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$13, clientId, swarmName);
|
|
17478
17867
|
});
|
|
17479
17868
|
|
|
17480
|
-
const METHOD_NAME$
|
|
17869
|
+
const METHOD_NAME$12 = "function.target.executeForce";
|
|
17481
17870
|
/**
|
|
17482
17871
|
* Sends a message to the active agent in a swarm session as if it originated from the client side, forcing execution regardless of agent activity.
|
|
17483
17872
|
*
|
|
@@ -17498,22 +17887,22 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17498
17887
|
const executionId = functoolsKit.randomString();
|
|
17499
17888
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17500
17889
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17501
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17890
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
17502
17891
|
content,
|
|
17503
17892
|
clientId,
|
|
17504
17893
|
executionId,
|
|
17505
17894
|
});
|
|
17506
17895
|
// Validate the session and swarm
|
|
17507
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17896
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
|
|
17508
17897
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17509
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17898
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$12);
|
|
17510
17899
|
// Execute the command within an execution context with performance tracking
|
|
17511
17900
|
return ExecutionContextService.runInContext(async () => {
|
|
17512
17901
|
let isFinished = false;
|
|
17513
17902
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
17514
17903
|
try {
|
|
17515
17904
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
17516
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
17905
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$12, clientId, swarmName);
|
|
17517
17906
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
17518
17907
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
17519
17908
|
return result;
|
|
@@ -17530,7 +17919,7 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17530
17919
|
});
|
|
17531
17920
|
});
|
|
17532
17921
|
|
|
17533
|
-
const METHOD_NAME$
|
|
17922
|
+
const METHOD_NAME$11 = "function.template.navigateToTriageAgent";
|
|
17534
17923
|
/**
|
|
17535
17924
|
* Will send tool output directly to the model without any additions
|
|
17536
17925
|
*/
|
|
@@ -17581,7 +17970,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
17581
17970
|
*/
|
|
17582
17971
|
return beginContext(async (toolId, clientId) => {
|
|
17583
17972
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17584
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17973
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
17585
17974
|
clientId,
|
|
17586
17975
|
toolId,
|
|
17587
17976
|
});
|
|
@@ -17613,7 +18002,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
17613
18002
|
});
|
|
17614
18003
|
};
|
|
17615
18004
|
|
|
17616
|
-
const METHOD_NAME
|
|
18005
|
+
const METHOD_NAME$10 = "function.navigate.changeToAgent";
|
|
17617
18006
|
/**
|
|
17618
18007
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities.
|
|
17619
18008
|
*
|
|
@@ -17637,7 +18026,7 @@ const createChangeToAgent = functoolsKit.memoize(([clientId]) => `${clientId}`,
|
|
|
17637
18026
|
}));
|
|
17638
18027
|
{
|
|
17639
18028
|
// Dispose of the current agent's resources and set up the new agent
|
|
17640
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME
|
|
18029
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$10, clientId, swarmName);
|
|
17641
18030
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17642
18031
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17643
18032
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17676,16 +18065,16 @@ const createGc$2 = functoolsKit.singleshot(async () => {
|
|
|
17676
18065
|
const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
17677
18066
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17678
18067
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17679
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
18068
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
17680
18069
|
agentName,
|
|
17681
18070
|
clientId,
|
|
17682
18071
|
});
|
|
17683
18072
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17684
18073
|
{
|
|
17685
18074
|
// Validate session, agent, and dependencies
|
|
17686
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME
|
|
17687
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME
|
|
17688
|
-
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME
|
|
18075
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$10);
|
|
18076
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$10);
|
|
18077
|
+
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$10, clientId, swarmName);
|
|
17689
18078
|
if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
|
|
17690
18079
|
console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
|
|
17691
18080
|
}
|
|
@@ -17703,10 +18092,10 @@ const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
|
17703
18092
|
// Execute the agent change with TTL and queuing
|
|
17704
18093
|
const run = await createChangeToAgent(clientId);
|
|
17705
18094
|
createGc$2();
|
|
17706
|
-
return await run(METHOD_NAME
|
|
18095
|
+
return await run(METHOD_NAME$10, agentName, swarmName);
|
|
17707
18096
|
});
|
|
17708
18097
|
|
|
17709
|
-
const METHOD_NAME
|
|
18098
|
+
const METHOD_NAME$$ = "function.template.navigateToAgent";
|
|
17710
18099
|
/**
|
|
17711
18100
|
* Will send tool output directly to the model without any additions
|
|
17712
18101
|
*/
|
|
@@ -17772,7 +18161,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
17772
18161
|
*/
|
|
17773
18162
|
return beginContext(async (toolId, clientId, agentName) => {
|
|
17774
18163
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17775
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
18164
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
17776
18165
|
clientId,
|
|
17777
18166
|
toolId,
|
|
17778
18167
|
});
|
|
@@ -17805,7 +18194,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
17805
18194
|
});
|
|
17806
18195
|
};
|
|
17807
18196
|
|
|
17808
|
-
const METHOD_NAME$
|
|
18197
|
+
const METHOD_NAME$_ = "function.setup.addTool";
|
|
17809
18198
|
/**
|
|
17810
18199
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
17811
18200
|
*
|
|
@@ -17827,7 +18216,7 @@ const METHOD_NAME$Z = "function.setup.addTool";
|
|
|
17827
18216
|
const addTool = beginContext((toolSchema) => {
|
|
17828
18217
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17829
18218
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17830
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18219
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
17831
18220
|
toolSchema,
|
|
17832
18221
|
});
|
|
17833
18222
|
// Register the tool in the validation and schema services
|
|
@@ -17841,7 +18230,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
17841
18230
|
* Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
|
|
17842
18231
|
* @module addAgentNavigation
|
|
17843
18232
|
*/
|
|
17844
|
-
const METHOD_NAME$
|
|
18233
|
+
const METHOD_NAME$Z = "function.alias.addAgentNavigation";
|
|
17845
18234
|
const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
17846
18235
|
/**
|
|
17847
18236
|
* Creates and registers a navigation tool for an agent to navigate to another specified agent.
|
|
@@ -17855,7 +18244,7 @@ const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
|
17855
18244
|
* @returns {ReturnType<typeof addTool>} The result of adding the navigation tool.
|
|
17856
18245
|
*/
|
|
17857
18246
|
const addAgentNavigation = beginContext(({ toolName, docNote, description, navigateTo, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER$1, ...navigateProps }) => {
|
|
17858
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18247
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Z);
|
|
17859
18248
|
const navigate = createNavigateToAgent(navigateProps);
|
|
17860
18249
|
return addTool({
|
|
17861
18250
|
toolName,
|
|
@@ -17884,7 +18273,7 @@ const addAgentNavigation = beginContext(({ toolName, docNote, description, navig
|
|
|
17884
18273
|
* Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
|
|
17885
18274
|
* @module addTriageNavigation
|
|
17886
18275
|
*/
|
|
17887
|
-
const METHOD_NAME$
|
|
18276
|
+
const METHOD_NAME$Y = "function.alias.addTriageNavigation";
|
|
17888
18277
|
const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
17889
18278
|
/**
|
|
17890
18279
|
* Creates and registers a triage navigation tool for an agent to navigate to a triage agent.
|
|
@@ -17897,7 +18286,7 @@ const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
|
17897
18286
|
* @returns {ReturnType<typeof addTool>} The result of adding the triage navigation tool.
|
|
17898
18287
|
*/
|
|
17899
18288
|
const addTriageNavigation = beginContext(({ toolName, docNote, description, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER, ...navigateProps }) => {
|
|
17900
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18289
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$Y);
|
|
17901
18290
|
const navigate = createNavigateToTriageAgent(navigateProps);
|
|
17902
18291
|
return addTool({
|
|
17903
18292
|
toolName,
|
|
@@ -17923,7 +18312,7 @@ const addTriageNavigation = beginContext(({ toolName, docNote, description, skip
|
|
|
17923
18312
|
});
|
|
17924
18313
|
|
|
17925
18314
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
17926
|
-
const METHOD_NAME$
|
|
18315
|
+
const METHOD_NAME$X = "function.setup.addWiki";
|
|
17927
18316
|
/**
|
|
17928
18317
|
* Adds a wiki schema to the system
|
|
17929
18318
|
* @function addWiki
|
|
@@ -17932,7 +18321,7 @@ const METHOD_NAME$W = "function.setup.addWiki";
|
|
|
17932
18321
|
*/
|
|
17933
18322
|
const addWiki = beginContext((wikiSchema) => {
|
|
17934
18323
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17935
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18324
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
17936
18325
|
wikiSchema,
|
|
17937
18326
|
});
|
|
17938
18327
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -17940,7 +18329,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
17940
18329
|
return wikiSchema.wikiName;
|
|
17941
18330
|
});
|
|
17942
18331
|
|
|
17943
|
-
const METHOD_NAME$
|
|
18332
|
+
const METHOD_NAME$W = "function.setup.addAgent";
|
|
17944
18333
|
/**
|
|
17945
18334
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
17946
18335
|
*
|
|
@@ -17960,7 +18349,7 @@ const METHOD_NAME$V = "function.setup.addAgent";
|
|
|
17960
18349
|
const addAgent = beginContext((agentSchema) => {
|
|
17961
18350
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17962
18351
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17963
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18352
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
17964
18353
|
agentSchema,
|
|
17965
18354
|
});
|
|
17966
18355
|
// Register the agent in the validation and schema services
|
|
@@ -17970,7 +18359,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
17970
18359
|
return agentSchema.agentName;
|
|
17971
18360
|
});
|
|
17972
18361
|
|
|
17973
|
-
const METHOD_NAME$
|
|
18362
|
+
const METHOD_NAME$V = "function.setup.addCompletion";
|
|
17974
18363
|
/**
|
|
17975
18364
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
17976
18365
|
*
|
|
@@ -17990,7 +18379,7 @@ const METHOD_NAME$U = "function.setup.addCompletion";
|
|
|
17990
18379
|
const addCompletion = beginContext((completionSchema) => {
|
|
17991
18380
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17992
18381
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17993
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18382
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
17994
18383
|
completionSchema,
|
|
17995
18384
|
});
|
|
17996
18385
|
// Register the completion in the validation and schema services
|
|
@@ -18000,7 +18389,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
18000
18389
|
return completionSchema.completionName;
|
|
18001
18390
|
});
|
|
18002
18391
|
|
|
18003
|
-
const METHOD_NAME$
|
|
18392
|
+
const METHOD_NAME$U = "function.setup.addSwarm";
|
|
18004
18393
|
/**
|
|
18005
18394
|
* Adds a new swarm to the system for managing client sessions.
|
|
18006
18395
|
*
|
|
@@ -18020,7 +18409,7 @@ const METHOD_NAME$T = "function.setup.addSwarm";
|
|
|
18020
18409
|
const addSwarm = beginContext((swarmSchema) => {
|
|
18021
18410
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18022
18411
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18023
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18412
|
+
swarm$1.loggerService.log(METHOD_NAME$U, {
|
|
18024
18413
|
swarmSchema,
|
|
18025
18414
|
});
|
|
18026
18415
|
// Register the swarm in the validation and schema services
|
|
@@ -18030,7 +18419,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
18030
18419
|
return swarmSchema.swarmName;
|
|
18031
18420
|
});
|
|
18032
18421
|
|
|
18033
|
-
const METHOD_NAME$
|
|
18422
|
+
const METHOD_NAME$T = "function.setup.addMCP";
|
|
18034
18423
|
/**
|
|
18035
18424
|
* Registers a new MCP (Model Context Protocol) schema in the system.
|
|
18036
18425
|
* @param mcpSchema - The MCP schema to register.
|
|
@@ -18038,7 +18427,7 @@ const METHOD_NAME$S = "function.setup.addMCP";
|
|
|
18038
18427
|
*/
|
|
18039
18428
|
const addMCP = beginContext((mcpSchema) => {
|
|
18040
18429
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18041
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18430
|
+
swarm$1.loggerService.log(METHOD_NAME$T, {
|
|
18042
18431
|
mcpSchema,
|
|
18043
18432
|
});
|
|
18044
18433
|
swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
|
|
@@ -18046,7 +18435,7 @@ const addMCP = beginContext((mcpSchema) => {
|
|
|
18046
18435
|
return mcpSchema.mcpName;
|
|
18047
18436
|
});
|
|
18048
18437
|
|
|
18049
|
-
const METHOD_NAME$
|
|
18438
|
+
const METHOD_NAME$S = "function.setup.addState";
|
|
18050
18439
|
/**
|
|
18051
18440
|
* Adds a new state to the state registry for use within the swarm system.
|
|
18052
18441
|
*
|
|
@@ -18068,7 +18457,7 @@ const METHOD_NAME$R = "function.setup.addState";
|
|
|
18068
18457
|
const addState = beginContext((stateSchema) => {
|
|
18069
18458
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18070
18459
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18071
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18460
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
18072
18461
|
stateSchema,
|
|
18073
18462
|
});
|
|
18074
18463
|
// Register the policy with StateValidationService for runtime validation
|
|
@@ -18085,7 +18474,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
18085
18474
|
return stateSchema.stateName;
|
|
18086
18475
|
});
|
|
18087
18476
|
|
|
18088
|
-
const METHOD_NAME$
|
|
18477
|
+
const METHOD_NAME$R = "function.setup.addEmbedding";
|
|
18089
18478
|
/**
|
|
18090
18479
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
18091
18480
|
*
|
|
@@ -18105,7 +18494,7 @@ const METHOD_NAME$Q = "function.setup.addEmbedding";
|
|
|
18105
18494
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
18106
18495
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18107
18496
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18108
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18497
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
18109
18498
|
embeddingSchema,
|
|
18110
18499
|
});
|
|
18111
18500
|
// Register the embedding in the validation and schema services
|
|
@@ -18115,7 +18504,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
18115
18504
|
return embeddingSchema.embeddingName;
|
|
18116
18505
|
});
|
|
18117
18506
|
|
|
18118
|
-
const METHOD_NAME$
|
|
18507
|
+
const METHOD_NAME$Q = "function.setup.addStorage";
|
|
18119
18508
|
/**
|
|
18120
18509
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
18121
18510
|
*
|
|
@@ -18137,7 +18526,7 @@ const METHOD_NAME$P = "function.setup.addStorage";
|
|
|
18137
18526
|
const addStorage = beginContext((storageSchema) => {
|
|
18138
18527
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18139
18528
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18140
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18529
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
18141
18530
|
storageSchema,
|
|
18142
18531
|
});
|
|
18143
18532
|
// Register the storage in the validation and schema services
|
|
@@ -18154,7 +18543,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
18154
18543
|
});
|
|
18155
18544
|
|
|
18156
18545
|
/** @private Constant defining the method name for logging and validation context */
|
|
18157
|
-
const METHOD_NAME$
|
|
18546
|
+
const METHOD_NAME$P = "function.setup.addPolicy";
|
|
18158
18547
|
/**
|
|
18159
18548
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
18160
18549
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -18170,7 +18559,7 @@ const METHOD_NAME$O = "function.setup.addPolicy";
|
|
|
18170
18559
|
const addPolicy = beginContext((policySchema) => {
|
|
18171
18560
|
// Log the policy addition attempt if enabled
|
|
18172
18561
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18173
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18562
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
18174
18563
|
policySchema,
|
|
18175
18564
|
});
|
|
18176
18565
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -18211,7 +18600,7 @@ const addCompute = beginContext((computeSchema) => {
|
|
|
18211
18600
|
* @description Method name for the addPipeline operation.
|
|
18212
18601
|
* @private
|
|
18213
18602
|
*/
|
|
18214
|
-
const METHOD_NAME$
|
|
18603
|
+
const METHOD_NAME$O = "function.setup.addPipeline";
|
|
18215
18604
|
/**
|
|
18216
18605
|
* @function addPipeline
|
|
18217
18606
|
* @description Registers a pipeline schema, validates it, and adds it to the pipeline schema service.
|
|
@@ -18221,7 +18610,7 @@ const METHOD_NAME$N = "function.setup.addPipeline";
|
|
|
18221
18610
|
*/
|
|
18222
18611
|
const addPipeline = beginContext((pipelineSchema) => {
|
|
18223
18612
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18224
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18613
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
18225
18614
|
pipelineSchema,
|
|
18226
18615
|
});
|
|
18227
18616
|
swarm$1.pipelineValidationService.addPipeline(pipelineSchema.pipelineName, pipelineSchema);
|
|
@@ -18229,7 +18618,7 @@ const addPipeline = beginContext((pipelineSchema) => {
|
|
|
18229
18618
|
return pipelineSchema.pipelineName;
|
|
18230
18619
|
});
|
|
18231
18620
|
|
|
18232
|
-
const METHOD_NAME$
|
|
18621
|
+
const METHOD_NAME$N = "function.test.overrideAgent";
|
|
18233
18622
|
/**
|
|
18234
18623
|
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
18235
18624
|
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
@@ -18253,13 +18642,14 @@ const METHOD_NAME$M = "function.test.overrideAgent";
|
|
|
18253
18642
|
*/
|
|
18254
18643
|
const overrideAgent = beginContext((agentSchema) => {
|
|
18255
18644
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18256
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18645
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
18257
18646
|
agentSchema,
|
|
18258
18647
|
});
|
|
18648
|
+
swarm$1.agentSchemaService.get(agentSchema.agentName);
|
|
18259
18649
|
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
18260
18650
|
});
|
|
18261
18651
|
|
|
18262
|
-
const METHOD_NAME$
|
|
18652
|
+
const METHOD_NAME$M = "function.test.overrideCompletion";
|
|
18263
18653
|
/**
|
|
18264
18654
|
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
18265
18655
|
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
@@ -18283,13 +18673,13 @@ const METHOD_NAME$L = "function.test.overrideCompletion";
|
|
|
18283
18673
|
*/
|
|
18284
18674
|
const overrideCompletion = beginContext((completionSchema) => {
|
|
18285
18675
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18286
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18676
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
18287
18677
|
completionSchema,
|
|
18288
18678
|
});
|
|
18289
18679
|
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
18290
18680
|
});
|
|
18291
18681
|
|
|
18292
|
-
const METHOD_NAME$
|
|
18682
|
+
const METHOD_NAME$L = "function.test.overrideEmbeding";
|
|
18293
18683
|
/**
|
|
18294
18684
|
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
18295
18685
|
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
@@ -18315,13 +18705,13 @@ const METHOD_NAME$K = "function.test.overrideEmbeding";
|
|
|
18315
18705
|
*/
|
|
18316
18706
|
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
18317
18707
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18318
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18708
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
18319
18709
|
embeddingSchema,
|
|
18320
18710
|
});
|
|
18321
18711
|
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
18322
18712
|
});
|
|
18323
18713
|
|
|
18324
|
-
const METHOD_NAME$
|
|
18714
|
+
const METHOD_NAME$K = "function.test.overridePolicy";
|
|
18325
18715
|
/**
|
|
18326
18716
|
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
18327
18717
|
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
@@ -18345,13 +18735,13 @@ const METHOD_NAME$J = "function.test.overridePolicy";
|
|
|
18345
18735
|
*/
|
|
18346
18736
|
const overridePolicy = beginContext((policySchema) => {
|
|
18347
18737
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18348
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18738
|
+
swarm$1.loggerService.log(METHOD_NAME$K, {
|
|
18349
18739
|
policySchema,
|
|
18350
18740
|
});
|
|
18351
18741
|
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
18352
18742
|
});
|
|
18353
18743
|
|
|
18354
|
-
const METHOD_NAME$
|
|
18744
|
+
const METHOD_NAME$J = "function.test.overrideState";
|
|
18355
18745
|
/**
|
|
18356
18746
|
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
18357
18747
|
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
@@ -18376,13 +18766,13 @@ const METHOD_NAME$I = "function.test.overrideState";
|
|
|
18376
18766
|
*/
|
|
18377
18767
|
const overrideState = beginContext((stateSchema) => {
|
|
18378
18768
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18379
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18769
|
+
swarm$1.loggerService.log(METHOD_NAME$J, {
|
|
18380
18770
|
stateSchema,
|
|
18381
18771
|
});
|
|
18382
18772
|
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
18383
18773
|
});
|
|
18384
18774
|
|
|
18385
|
-
const METHOD_NAME$
|
|
18775
|
+
const METHOD_NAME$I = "function.test.overrideStorage";
|
|
18386
18776
|
/**
|
|
18387
18777
|
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
18388
18778
|
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
@@ -18408,13 +18798,13 @@ const METHOD_NAME$H = "function.test.overrideStorage";
|
|
|
18408
18798
|
*/
|
|
18409
18799
|
const overrideStorage = beginContext((storageSchema) => {
|
|
18410
18800
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18411
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18801
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
18412
18802
|
storageSchema,
|
|
18413
18803
|
});
|
|
18414
18804
|
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
18415
18805
|
});
|
|
18416
18806
|
|
|
18417
|
-
const METHOD_NAME$
|
|
18807
|
+
const METHOD_NAME$H = "function.test.overrideSwarm";
|
|
18418
18808
|
/**
|
|
18419
18809
|
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
18420
18810
|
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
@@ -18438,13 +18828,13 @@ const METHOD_NAME$G = "function.test.overrideSwarm";
|
|
|
18438
18828
|
*/
|
|
18439
18829
|
const overrideSwarm = beginContext((swarmSchema) => {
|
|
18440
18830
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18441
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18831
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
18442
18832
|
swarmSchema,
|
|
18443
18833
|
});
|
|
18444
18834
|
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
18445
18835
|
});
|
|
18446
18836
|
|
|
18447
|
-
const METHOD_NAME$
|
|
18837
|
+
const METHOD_NAME$G = "function.test.overrideTool";
|
|
18448
18838
|
/**
|
|
18449
18839
|
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
18450
18840
|
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
@@ -18468,13 +18858,13 @@ const METHOD_NAME$F = "function.test.overrideTool";
|
|
|
18468
18858
|
*/
|
|
18469
18859
|
const overrideTool = beginContext((toolSchema) => {
|
|
18470
18860
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18471
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18861
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
18472
18862
|
toolSchema,
|
|
18473
18863
|
});
|
|
18474
18864
|
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
18475
18865
|
});
|
|
18476
18866
|
|
|
18477
|
-
const METHOD_NAME$
|
|
18867
|
+
const METHOD_NAME$F = "function.test.overrideMCP";
|
|
18478
18868
|
/**
|
|
18479
18869
|
* Overrides an existing MCP (Model Context Protocol) schema with a new or partial schema.
|
|
18480
18870
|
* @param mcpSchema - The MCP schema containing the name and optional properties to override.
|
|
@@ -18482,13 +18872,13 @@ const METHOD_NAME$E = "function.test.overrideMCP";
|
|
|
18482
18872
|
*/
|
|
18483
18873
|
const overrideMCP = beginContext((mcpSchema) => {
|
|
18484
18874
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18485
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18875
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {
|
|
18486
18876
|
mcpSchema,
|
|
18487
18877
|
});
|
|
18488
18878
|
return swarm$1.mcpSchemaService.override(mcpSchema.mcpName, mcpSchema);
|
|
18489
18879
|
});
|
|
18490
18880
|
|
|
18491
|
-
const METHOD_NAME$
|
|
18881
|
+
const METHOD_NAME$E = "function.test.overrideWiki";
|
|
18492
18882
|
/**
|
|
18493
18883
|
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
18494
18884
|
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
@@ -18512,7 +18902,7 @@ const METHOD_NAME$D = "function.test.overrideWiki";
|
|
|
18512
18902
|
*/
|
|
18513
18903
|
const overrideWiki = beginContext((wikiSchema) => {
|
|
18514
18904
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18515
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18905
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {
|
|
18516
18906
|
wikiSchema,
|
|
18517
18907
|
});
|
|
18518
18908
|
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
@@ -18527,7 +18917,7 @@ const overrideWiki = beginContext((wikiSchema) => {
|
|
|
18527
18917
|
* @description Method name for the overrideCompute operation.
|
|
18528
18918
|
* @private
|
|
18529
18919
|
*/
|
|
18530
|
-
const METHOD_NAME$
|
|
18920
|
+
const METHOD_NAME$D = "function.test.overrideCompute";
|
|
18531
18921
|
/**
|
|
18532
18922
|
* @function overrideCompute
|
|
18533
18923
|
* @description Overrides an existing compute schema with provided partial updates.
|
|
@@ -18536,7 +18926,7 @@ const METHOD_NAME$C = "function.test.overrideCompute";
|
|
|
18536
18926
|
*/
|
|
18537
18927
|
const overrideCompute = beginContext((computeSchema) => {
|
|
18538
18928
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18539
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18929
|
+
swarm$1.loggerService.log(METHOD_NAME$D, {
|
|
18540
18930
|
computeSchema,
|
|
18541
18931
|
});
|
|
18542
18932
|
return swarm$1.computeSchemaService.override(computeSchema.computeName, computeSchema);
|
|
@@ -18551,7 +18941,7 @@ const overrideCompute = beginContext((computeSchema) => {
|
|
|
18551
18941
|
* @description Method name for the overridePipeline operation.
|
|
18552
18942
|
* @private
|
|
18553
18943
|
*/
|
|
18554
|
-
const METHOD_NAME$
|
|
18944
|
+
const METHOD_NAME$C = "function.test.overridePipeline";
|
|
18555
18945
|
/**
|
|
18556
18946
|
* @function overridePipeline
|
|
18557
18947
|
* @description Overrides an existing pipeline schema with provided partial updates.
|
|
@@ -18561,13 +18951,13 @@ const METHOD_NAME$B = "function.test.overridePipeline";
|
|
|
18561
18951
|
*/
|
|
18562
18952
|
const overridePipeline = beginContext((pipelineSchema) => {
|
|
18563
18953
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18564
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18954
|
+
swarm$1.loggerService.log(METHOD_NAME$C, {
|
|
18565
18955
|
pipelineSchema,
|
|
18566
18956
|
});
|
|
18567
18957
|
return swarm$1.pipelineSchemaService.override(pipelineSchema.pipelineName, pipelineSchema);
|
|
18568
18958
|
});
|
|
18569
18959
|
|
|
18570
|
-
const METHOD_NAME$
|
|
18960
|
+
const METHOD_NAME$B = "function.other.markOnline";
|
|
18571
18961
|
/**
|
|
18572
18962
|
* Marks a client as online in the specified swarm.
|
|
18573
18963
|
*
|
|
@@ -18579,16 +18969,16 @@ const METHOD_NAME$A = "function.other.markOnline";
|
|
|
18579
18969
|
const markOnline = async (clientId, swarmName) => {
|
|
18580
18970
|
// Log the operation if logging is enabled in the global configuration
|
|
18581
18971
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18582
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
18972
|
+
swarm.loggerService.log(METHOD_NAME$B, {
|
|
18583
18973
|
clientId,
|
|
18584
18974
|
});
|
|
18585
18975
|
// Validate the swarm name
|
|
18586
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18976
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$B);
|
|
18587
18977
|
// Run the operation in the method context
|
|
18588
18978
|
return await MethodContextService.runInContext(async () => {
|
|
18589
|
-
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$
|
|
18979
|
+
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$B);
|
|
18590
18980
|
}, {
|
|
18591
|
-
methodName: METHOD_NAME$
|
|
18981
|
+
methodName: METHOD_NAME$B,
|
|
18592
18982
|
agentName: "",
|
|
18593
18983
|
policyName: "",
|
|
18594
18984
|
stateName: "",
|
|
@@ -18600,7 +18990,7 @@ const markOnline = async (clientId, swarmName) => {
|
|
|
18600
18990
|
});
|
|
18601
18991
|
};
|
|
18602
18992
|
|
|
18603
|
-
const METHOD_NAME$
|
|
18993
|
+
const METHOD_NAME$A = "function.other.markOffline";
|
|
18604
18994
|
/**
|
|
18605
18995
|
* Marks a client as offline in the specified swarm.
|
|
18606
18996
|
*
|
|
@@ -18615,14 +19005,14 @@ const METHOD_NAME$z = "function.other.markOffline";
|
|
|
18615
19005
|
*/
|
|
18616
19006
|
const markOffline = async (clientId, swarmName) => {
|
|
18617
19007
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18618
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
19008
|
+
swarm.loggerService.log(METHOD_NAME$A, {
|
|
18619
19009
|
clientId,
|
|
18620
19010
|
});
|
|
18621
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19011
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$A);
|
|
18622
19012
|
return await MethodContextService.runInContext(async () => {
|
|
18623
|
-
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$
|
|
19013
|
+
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$A);
|
|
18624
19014
|
}, {
|
|
18625
|
-
methodName: METHOD_NAME$
|
|
19015
|
+
methodName: METHOD_NAME$A,
|
|
18626
19016
|
agentName: "",
|
|
18627
19017
|
policyName: "",
|
|
18628
19018
|
stateName: "",
|
|
@@ -18635,7 +19025,7 @@ const markOffline = async (clientId, swarmName) => {
|
|
|
18635
19025
|
};
|
|
18636
19026
|
|
|
18637
19027
|
/** @private Constant defining the method name for logging and validation context */
|
|
18638
|
-
const METHOD_NAME$
|
|
19028
|
+
const METHOD_NAME$z = "function.commit.commitSystemMessage";
|
|
18639
19029
|
/**
|
|
18640
19030
|
* Commits a system-generated message to the active agent in the swarm system.
|
|
18641
19031
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -18654,20 +19044,20 @@ const METHOD_NAME$y = "function.commit.commitSystemMessage";
|
|
|
18654
19044
|
const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
|
|
18655
19045
|
// Log the commit attempt if enabled
|
|
18656
19046
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18657
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19047
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
18658
19048
|
content,
|
|
18659
19049
|
clientId,
|
|
18660
19050
|
agentName,
|
|
18661
19051
|
});
|
|
18662
19052
|
// Validate the agent exists
|
|
18663
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19053
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$z);
|
|
18664
19054
|
// Validate the session exists and retrieve the associated swarm
|
|
18665
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19055
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
|
|
18666
19056
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18667
19057
|
// Validate the swarm configuration
|
|
18668
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19058
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
|
|
18669
19059
|
// Check if the current agent matches the provided agent
|
|
18670
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19060
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$z, clientId, swarmName);
|
|
18671
19061
|
if (currentAgentName !== agentName) {
|
|
18672
19062
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18673
19063
|
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
@@ -18678,10 +19068,10 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
|
|
|
18678
19068
|
return;
|
|
18679
19069
|
}
|
|
18680
19070
|
// Commit the system message via SessionPublicService
|
|
18681
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19071
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$z, clientId, swarmName);
|
|
18682
19072
|
});
|
|
18683
19073
|
|
|
18684
|
-
const METHOD_NAME$
|
|
19074
|
+
const METHOD_NAME$y = "function.commit.commitSystemMessage";
|
|
18685
19075
|
/**
|
|
18686
19076
|
* Commits a user message to the active agent's history in a swarm session without triggering a response.
|
|
18687
19077
|
*
|
|
@@ -18700,19 +19090,19 @@ const METHOD_NAME$x = "function.commit.commitSystemMessage";
|
|
|
18700
19090
|
const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
|
|
18701
19091
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18702
19092
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18703
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19093
|
+
swarm$1.loggerService.log(METHOD_NAME$y, {
|
|
18704
19094
|
content,
|
|
18705
19095
|
clientId,
|
|
18706
19096
|
agentName,
|
|
18707
19097
|
mode,
|
|
18708
19098
|
});
|
|
18709
19099
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
18710
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18711
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19100
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$y);
|
|
19101
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
|
|
18712
19102
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18713
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19103
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
|
|
18714
19104
|
// Check if the specified agent is still the active agent in the swarm session
|
|
18715
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19105
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$y, clientId, swarmName);
|
|
18716
19106
|
if (currentAgentName !== agentName) {
|
|
18717
19107
|
// Log a skip message if the agent has changed during the operation
|
|
18718
19108
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -18725,18 +19115,18 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
|
|
|
18725
19115
|
}
|
|
18726
19116
|
if (payload) {
|
|
18727
19117
|
return await PayloadContextService.runInContext(async () => {
|
|
18728
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19118
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
|
|
18729
19119
|
}, {
|
|
18730
19120
|
clientId,
|
|
18731
19121
|
payload,
|
|
18732
19122
|
});
|
|
18733
19123
|
}
|
|
18734
19124
|
// Commit the user message to the agent's history via the session public service
|
|
18735
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19125
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
|
|
18736
19126
|
});
|
|
18737
19127
|
|
|
18738
19128
|
/** @private Constant defining the method name for logging and validation context */
|
|
18739
|
-
const METHOD_NAME$
|
|
19129
|
+
const METHOD_NAME$x = "function.commit.commitSystemMessageForce";
|
|
18740
19130
|
/**
|
|
18741
19131
|
* Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
|
|
18742
19132
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -18755,20 +19145,20 @@ const METHOD_NAME$w = "function.commit.commitSystemMessageForce";
|
|
|
18755
19145
|
const commitSystemMessageForce = beginContext(async (content, clientId) => {
|
|
18756
19146
|
// Log the commit attempt if enabled
|
|
18757
19147
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18758
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19148
|
+
swarm$1.loggerService.log(METHOD_NAME$x, {
|
|
18759
19149
|
content,
|
|
18760
19150
|
clientId,
|
|
18761
19151
|
});
|
|
18762
19152
|
// Validate the session exists and retrieve the associated swarm
|
|
18763
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19153
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
|
|
18764
19154
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18765
19155
|
// Validate the swarm configuration
|
|
18766
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19156
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
|
|
18767
19157
|
// Commit the system message via SessionPublicService without agent checks
|
|
18768
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19158
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$x, clientId, swarmName);
|
|
18769
19159
|
});
|
|
18770
19160
|
|
|
18771
|
-
const METHOD_NAME$
|
|
19161
|
+
const METHOD_NAME$w = "function.commit.commitSystemMessage";
|
|
18772
19162
|
/**
|
|
18773
19163
|
* Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
|
|
18774
19164
|
*
|
|
@@ -18786,29 +19176,29 @@ const METHOD_NAME$v = "function.commit.commitSystemMessage";
|
|
|
18786
19176
|
const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
|
|
18787
19177
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18788
19178
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18789
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19179
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
18790
19180
|
content,
|
|
18791
19181
|
clientId,
|
|
18792
19182
|
mode,
|
|
18793
19183
|
});
|
|
18794
19184
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
18795
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19185
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
|
|
18796
19186
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18797
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19187
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
|
|
18798
19188
|
if (payload) {
|
|
18799
19189
|
return await PayloadContextService.runInContext(async () => {
|
|
18800
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19190
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$w, clientId, swarmName);
|
|
18801
19191
|
}, {
|
|
18802
19192
|
clientId,
|
|
18803
19193
|
payload,
|
|
18804
19194
|
});
|
|
18805
19195
|
}
|
|
18806
19196
|
// Commit the user message to the agent's history via the session public service without checking the active agent
|
|
18807
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19197
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$w, clientId, swarmName);
|
|
18808
19198
|
});
|
|
18809
19199
|
|
|
18810
19200
|
/** @private Constant defining the method name for logging and validation context */
|
|
18811
|
-
const METHOD_NAME$
|
|
19201
|
+
const METHOD_NAME$v = "function.commit.commitAssistantMessage";
|
|
18812
19202
|
/**
|
|
18813
19203
|
* Commits an assistant-generated message to the active agent in the swarm system.
|
|
18814
19204
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -18826,20 +19216,20 @@ const METHOD_NAME$u = "function.commit.commitAssistantMessage";
|
|
|
18826
19216
|
const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
|
|
18827
19217
|
// Log the commit attempt if enabled
|
|
18828
19218
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18829
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19219
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
18830
19220
|
content,
|
|
18831
19221
|
clientId,
|
|
18832
19222
|
agentName,
|
|
18833
19223
|
});
|
|
18834
19224
|
// Validate the agent exists
|
|
18835
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19225
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
|
|
18836
19226
|
// Validate the session exists and retrieve the associated swarm
|
|
18837
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19227
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
18838
19228
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18839
19229
|
// Validate the swarm configuration
|
|
18840
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19230
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
18841
19231
|
// Check if the current agent matches the provided agent
|
|
18842
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19232
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
|
|
18843
19233
|
if (currentAgentName !== agentName) {
|
|
18844
19234
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18845
19235
|
swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
|
|
@@ -18850,11 +19240,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
|
|
|
18850
19240
|
return;
|
|
18851
19241
|
}
|
|
18852
19242
|
// Commit the assistant message via SessionPublicService
|
|
18853
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19243
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$v, clientId, swarmName);
|
|
18854
19244
|
});
|
|
18855
19245
|
|
|
18856
19246
|
/** @private Constant defining the method name for logging and validation context */
|
|
18857
|
-
const METHOD_NAME$
|
|
19247
|
+
const METHOD_NAME$u = "function.commit.commitAssistantMessageForce";
|
|
18858
19248
|
/**
|
|
18859
19249
|
* Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
|
|
18860
19250
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -18873,21 +19263,21 @@ const METHOD_NAME$t = "function.commit.commitAssistantMessageForce";
|
|
|
18873
19263
|
const commitAssistantMessageForce = beginContext(async (content, clientId) => {
|
|
18874
19264
|
// Log the commit attempt if enabled
|
|
18875
19265
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18876
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19266
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
18877
19267
|
content,
|
|
18878
19268
|
clientId,
|
|
18879
19269
|
});
|
|
18880
19270
|
// Validate the session exists and retrieve the associated swarm
|
|
18881
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19271
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
18882
19272
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18883
19273
|
// Validate the swarm configuration
|
|
18884
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19274
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
18885
19275
|
// Commit the assistant message via SessionPublicService without agent checks
|
|
18886
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19276
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$u, clientId, swarmName);
|
|
18887
19277
|
});
|
|
18888
19278
|
|
|
18889
19279
|
/** @private Constant defining the method name for logging and validation context */
|
|
18890
|
-
const METHOD_NAME$
|
|
19280
|
+
const METHOD_NAME$t = "function.commit.cancelOutput";
|
|
18891
19281
|
/**
|
|
18892
19282
|
* Cancels the awaited output for a specific client and agent by emitting an empty string.
|
|
18893
19283
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
|
|
@@ -18903,19 +19293,19 @@ const METHOD_NAME$s = "function.commit.cancelOutput";
|
|
|
18903
19293
|
const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
18904
19294
|
// Log the cancellation attempt if enabled
|
|
18905
19295
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18906
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19296
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
18907
19297
|
clientId,
|
|
18908
19298
|
agentName,
|
|
18909
19299
|
});
|
|
18910
19300
|
// Validate the agent exists
|
|
18911
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19301
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$t);
|
|
18912
19302
|
// Validate the session exists and retrieve the associated swarm
|
|
18913
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19303
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
18914
19304
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18915
19305
|
// Validate the swarm configuration
|
|
18916
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19306
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
18917
19307
|
// Check if the current agent matches the provided agent
|
|
18918
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19308
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName);
|
|
18919
19309
|
if (currentAgentName !== agentName) {
|
|
18920
19310
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18921
19311
|
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
@@ -18926,11 +19316,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
|
18926
19316
|
return;
|
|
18927
19317
|
}
|
|
18928
19318
|
// Perform the output cancellation via SwarmPublicService
|
|
18929
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
19319
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$t, clientId, swarmName);
|
|
18930
19320
|
});
|
|
18931
19321
|
|
|
18932
19322
|
/** @private Constant defining the method name for logging and validation context */
|
|
18933
|
-
const METHOD_NAME$
|
|
19323
|
+
const METHOD_NAME$s = "function.commit.cancelOutputForce";
|
|
18934
19324
|
/**
|
|
18935
19325
|
* Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
|
|
18936
19326
|
* Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
|
|
@@ -18947,20 +19337,20 @@ const METHOD_NAME$r = "function.commit.cancelOutputForce";
|
|
|
18947
19337
|
const cancelOutputForce = beginContext(async (clientId) => {
|
|
18948
19338
|
// Log the cancellation attempt if enabled
|
|
18949
19339
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18950
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19340
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
18951
19341
|
clientId,
|
|
18952
19342
|
});
|
|
18953
19343
|
// Validate the session exists and retrieve the associated swarm
|
|
18954
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19344
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
18955
19345
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18956
19346
|
// Validate the swarm configuration
|
|
18957
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19347
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
|
|
18958
19348
|
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
18959
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
19349
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$s, clientId, swarmName);
|
|
18960
19350
|
});
|
|
18961
19351
|
|
|
18962
19352
|
/** @private Constant defining the method name for logging and validation context */
|
|
18963
|
-
const METHOD_NAME$
|
|
19353
|
+
const METHOD_NAME$r = "function.commit.commitStopToolsForce";
|
|
18964
19354
|
/**
|
|
18965
19355
|
* Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
|
|
18966
19356
|
* Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
|
|
@@ -18978,21 +19368,21 @@ const METHOD_NAME$q = "function.commit.commitStopToolsForce";
|
|
|
18978
19368
|
const commitStopToolsForce = beginContext(async (clientId) => {
|
|
18979
19369
|
// Log the stop tools attempt if enabled
|
|
18980
19370
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18981
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19371
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
18982
19372
|
clientId,
|
|
18983
|
-
METHOD_NAME: METHOD_NAME$
|
|
19373
|
+
METHOD_NAME: METHOD_NAME$r,
|
|
18984
19374
|
});
|
|
18985
19375
|
// Validate the session exists and retrieve the associated swarm
|
|
18986
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19376
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
|
|
18987
19377
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18988
19378
|
// Validate the swarm configuration
|
|
18989
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19379
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
|
|
18990
19380
|
// Commit the stop of the next tool execution via SessionPublicService without agent checks
|
|
18991
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
19381
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$r, clientId, swarmName);
|
|
18992
19382
|
});
|
|
18993
19383
|
|
|
18994
19384
|
/** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
|
|
18995
|
-
const METHOD_NAME$
|
|
19385
|
+
const METHOD_NAME$q = "function.target.question";
|
|
18996
19386
|
/**
|
|
18997
19387
|
* Initiates a question process within a chat context
|
|
18998
19388
|
* @function question
|
|
@@ -19004,21 +19394,21 @@ const METHOD_NAME$p = "function.target.question";
|
|
|
19004
19394
|
*/
|
|
19005
19395
|
const question = beginContext(async (message, clientId, agentName, wikiName) => {
|
|
19006
19396
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19007
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19397
|
+
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
19008
19398
|
message,
|
|
19009
19399
|
clientId,
|
|
19010
19400
|
agentName,
|
|
19011
19401
|
wikiName,
|
|
19012
19402
|
});
|
|
19013
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19014
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19403
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
|
|
19404
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$q);
|
|
19015
19405
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19016
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19017
|
-
swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$
|
|
19406
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
|
|
19407
|
+
swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$q);
|
|
19018
19408
|
if (!swarm$1.agentValidationService.hasWiki(agentName, wikiName)) {
|
|
19019
|
-
throw new Error(`agent-swarm ${METHOD_NAME$
|
|
19409
|
+
throw new Error(`agent-swarm ${METHOD_NAME$q} ${wikiName} not registered in ${agentName}`);
|
|
19020
19410
|
}
|
|
19021
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19411
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$q, clientId, swarmName);
|
|
19022
19412
|
if (currentAgentName !== agentName) {
|
|
19023
19413
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19024
19414
|
swarm$1.loggerService.log('function "question" skipped due to the agent change', {
|
|
@@ -19041,7 +19431,7 @@ const question = beginContext(async (message, clientId, agentName, wikiName) =>
|
|
|
19041
19431
|
});
|
|
19042
19432
|
|
|
19043
19433
|
/** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
|
|
19044
|
-
const METHOD_NAME$
|
|
19434
|
+
const METHOD_NAME$p = "function.target.questionForce";
|
|
19045
19435
|
/**
|
|
19046
19436
|
* Initiates a forced question process within a chat context
|
|
19047
19437
|
* @function questionForce
|
|
@@ -19052,17 +19442,17 @@ const METHOD_NAME$o = "function.target.questionForce";
|
|
|
19052
19442
|
*/
|
|
19053
19443
|
const questionForce = beginContext(async (message, clientId, wikiName) => {
|
|
19054
19444
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19055
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19445
|
+
swarm$1.loggerService.log(METHOD_NAME$p, {
|
|
19056
19446
|
message,
|
|
19057
19447
|
clientId,
|
|
19058
19448
|
wikiName,
|
|
19059
19449
|
});
|
|
19060
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19450
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
19061
19451
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19062
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19063
|
-
swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$
|
|
19452
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
19453
|
+
swarm$1.wikiValidationService.validate(wikiName, METHOD_NAME$p);
|
|
19064
19454
|
const { getChat, callbacks } = swarm$1.wikiSchemaService.get(wikiName);
|
|
19065
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19455
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$p, clientId, swarmName);
|
|
19066
19456
|
const args = {
|
|
19067
19457
|
clientId,
|
|
19068
19458
|
message,
|
|
@@ -19074,7 +19464,7 @@ const questionForce = beginContext(async (message, clientId, wikiName) => {
|
|
|
19074
19464
|
return await getChat(args);
|
|
19075
19465
|
});
|
|
19076
19466
|
|
|
19077
|
-
const METHOD_NAME$
|
|
19467
|
+
const METHOD_NAME$o = "function.target.disposeConnection";
|
|
19078
19468
|
/**
|
|
19079
19469
|
* Disposes of a client session and all related resources within a swarm.
|
|
19080
19470
|
*
|
|
@@ -19091,10 +19481,10 @@ const METHOD_NAME$n = "function.target.disposeConnection";
|
|
|
19091
19481
|
* @example
|
|
19092
19482
|
* await disposeConnection("client-123", "TaskSwarm");
|
|
19093
19483
|
*/
|
|
19094
|
-
const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$
|
|
19484
|
+
const disposeConnection = beginContext(async (clientId, swarmName, methodName = METHOD_NAME$o) => {
|
|
19095
19485
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19096
19486
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19097
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19487
|
+
swarm$1.loggerService.log(METHOD_NAME$o, {
|
|
19098
19488
|
clientId,
|
|
19099
19489
|
swarmName,
|
|
19100
19490
|
});
|
|
@@ -19199,7 +19589,7 @@ const disposeConnection = beginContext(async (clientId, swarmName, methodName =
|
|
|
19199
19589
|
PersistMemoryAdapter.dispose(clientId);
|
|
19200
19590
|
});
|
|
19201
19591
|
|
|
19202
|
-
const METHOD_NAME$
|
|
19592
|
+
const METHOD_NAME$n = "function.target.makeAutoDispose";
|
|
19203
19593
|
/**
|
|
19204
19594
|
* Default timeout in seconds before auto-dispose is triggered.
|
|
19205
19595
|
* @constant {number}
|
|
@@ -19230,7 +19620,7 @@ const DEFAULT_TIMEOUT = 15 * 60;
|
|
|
19230
19620
|
const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DEFAULT_TIMEOUT, onDestroy, } = {}) => {
|
|
19231
19621
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19232
19622
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19233
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19623
|
+
swarm$1.loggerService.log(METHOD_NAME$n, {
|
|
19234
19624
|
clientId,
|
|
19235
19625
|
swarmName,
|
|
19236
19626
|
});
|
|
@@ -19263,7 +19653,7 @@ const makeAutoDispose = beginContext((clientId, swarmName, { timeoutSeconds = DE
|
|
|
19263
19653
|
};
|
|
19264
19654
|
});
|
|
19265
19655
|
|
|
19266
|
-
const METHOD_NAME$
|
|
19656
|
+
const METHOD_NAME$m = "function.target.notify";
|
|
19267
19657
|
/**
|
|
19268
19658
|
* Sends a notification message as output from the swarm session without executing an incoming message.
|
|
19269
19659
|
*
|
|
@@ -19283,23 +19673,23 @@ const METHOD_NAME$l = "function.target.notify";
|
|
|
19283
19673
|
const notify = beginContext(async (content, clientId, agentName) => {
|
|
19284
19674
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19285
19675
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19286
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19676
|
+
swarm$1.loggerService.log(METHOD_NAME$m, {
|
|
19287
19677
|
content,
|
|
19288
19678
|
clientId,
|
|
19289
19679
|
agentName,
|
|
19290
19680
|
});
|
|
19291
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19681
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$m);
|
|
19292
19682
|
// Check if the session mode is "makeConnection"
|
|
19293
19683
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
|
|
19294
19684
|
"makeConnection") {
|
|
19295
19685
|
throw new Error(`agent-swarm-kit notify session is not makeConnection clientId=${clientId}`);
|
|
19296
19686
|
}
|
|
19297
19687
|
// Validate the agent, session, and swarm
|
|
19298
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19688
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$m);
|
|
19299
19689
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19300
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19690
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
|
|
19301
19691
|
// Check if the specified agent is still the active agent
|
|
19302
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19692
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$m, clientId, swarmName);
|
|
19303
19693
|
if (currentAgentName !== agentName) {
|
|
19304
19694
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19305
19695
|
swarm$1.loggerService.log('function "notify" skipped due to the agent change', {
|
|
@@ -19310,10 +19700,10 @@ const notify = beginContext(async (content, clientId, agentName) => {
|
|
|
19310
19700
|
return;
|
|
19311
19701
|
}
|
|
19312
19702
|
// Notify the content directly via the session public service
|
|
19313
|
-
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$
|
|
19703
|
+
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$m, clientId, swarmName);
|
|
19314
19704
|
});
|
|
19315
19705
|
|
|
19316
|
-
const METHOD_NAME$
|
|
19706
|
+
const METHOD_NAME$l = "function.target.notifyForce";
|
|
19317
19707
|
/**
|
|
19318
19708
|
* Sends a notification message as output from the swarm session without executing an incoming message.
|
|
19319
19709
|
*
|
|
@@ -19332,11 +19722,11 @@ const METHOD_NAME$k = "function.target.notifyForce";
|
|
|
19332
19722
|
const notifyForce = beginContext(async (content, clientId) => {
|
|
19333
19723
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19334
19724
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19335
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19725
|
+
swarm$1.loggerService.log(METHOD_NAME$l, {
|
|
19336
19726
|
content,
|
|
19337
19727
|
clientId,
|
|
19338
19728
|
});
|
|
19339
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19729
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
|
|
19340
19730
|
// Check if the session mode is "makeConnection"
|
|
19341
19731
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !==
|
|
19342
19732
|
"makeConnection") {
|
|
@@ -19344,12 +19734,12 @@ const notifyForce = beginContext(async (content, clientId) => {
|
|
|
19344
19734
|
}
|
|
19345
19735
|
// Validate the agent, session, and swarm
|
|
19346
19736
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19347
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19737
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
|
|
19348
19738
|
// Notify the content directly via the session public service
|
|
19349
|
-
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$
|
|
19739
|
+
return await swarm$1.sessionPublicService.notify(content, METHOD_NAME$l, clientId, swarmName);
|
|
19350
19740
|
});
|
|
19351
19741
|
|
|
19352
|
-
const METHOD_NAME$
|
|
19742
|
+
const METHOD_NAME$k = "function.target.runStateless";
|
|
19353
19743
|
/**
|
|
19354
19744
|
* Executes a message statelessly with an agent in a swarm session, bypassing chat history.
|
|
19355
19745
|
*
|
|
@@ -19372,19 +19762,19 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
19372
19762
|
const executionId = functoolsKit.randomString();
|
|
19373
19763
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19374
19764
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19375
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19765
|
+
swarm$1.loggerService.log(METHOD_NAME$k, {
|
|
19376
19766
|
content,
|
|
19377
19767
|
clientId,
|
|
19378
19768
|
agentName,
|
|
19379
19769
|
executionId,
|
|
19380
19770
|
});
|
|
19381
19771
|
// Validate the agent, session, and swarm
|
|
19382
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19383
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19772
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
|
|
19773
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
|
|
19384
19774
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19385
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19775
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
|
|
19386
19776
|
// Check if the specified agent is still the active agent
|
|
19387
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19777
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName);
|
|
19388
19778
|
if (currentAgentName !== agentName) {
|
|
19389
19779
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19390
19780
|
swarm$1.loggerService.log('function "runStateless" skipped due to the agent change', {
|
|
@@ -19403,7 +19793,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
19403
19793
|
agentName,
|
|
19404
19794
|
swarmName,
|
|
19405
19795
|
});
|
|
19406
|
-
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$
|
|
19796
|
+
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$k, clientId, swarmName);
|
|
19407
19797
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
19408
19798
|
swarm$1.busService.commitExecutionEnd(clientId, {
|
|
19409
19799
|
agentName,
|
|
@@ -19423,7 +19813,7 @@ const runStateless = beginContext(async (content, clientId, agentName) => {
|
|
|
19423
19813
|
});
|
|
19424
19814
|
});
|
|
19425
19815
|
|
|
19426
|
-
const METHOD_NAME$
|
|
19816
|
+
const METHOD_NAME$j = "function.target.runStatelessForce";
|
|
19427
19817
|
/**
|
|
19428
19818
|
* Executes a message statelessly with the active agent in a swarm session, bypassing chat history and forcing execution regardless of agent activity.
|
|
19429
19819
|
*
|
|
@@ -19444,22 +19834,22 @@ const runStatelessForce = beginContext(async (content, clientId) => {
|
|
|
19444
19834
|
const executionId = functoolsKit.randomString();
|
|
19445
19835
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19446
19836
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19447
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19837
|
+
swarm$1.loggerService.log(METHOD_NAME$j, {
|
|
19448
19838
|
content,
|
|
19449
19839
|
clientId,
|
|
19450
19840
|
executionId,
|
|
19451
19841
|
});
|
|
19452
19842
|
// Validate the session and swarm
|
|
19453
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19843
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
|
|
19454
19844
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19455
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19845
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
|
|
19456
19846
|
// Execute the command statelessly within an execution context with performance tracking
|
|
19457
19847
|
return ExecutionContextService.runInContext(async () => {
|
|
19458
19848
|
let isFinished = false;
|
|
19459
19849
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
19460
19850
|
try {
|
|
19461
19851
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
19462
|
-
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$
|
|
19852
|
+
const result = await swarm$1.sessionPublicService.run(content, METHOD_NAME$j, clientId, swarmName);
|
|
19463
19853
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
19464
19854
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
19465
19855
|
return result;
|
|
@@ -19486,7 +19876,7 @@ const SCHEDULED_DELAY$1 = 1000;
|
|
|
19486
19876
|
* @constant {number}
|
|
19487
19877
|
*/
|
|
19488
19878
|
const RATE_DELAY = 10000;
|
|
19489
|
-
const METHOD_NAME$
|
|
19879
|
+
const METHOD_NAME$i = "function.target.makeConnection";
|
|
19490
19880
|
/**
|
|
19491
19881
|
* Internal implementation of the connection factory for a client to a swarm.
|
|
19492
19882
|
*
|
|
@@ -19501,21 +19891,21 @@ const METHOD_NAME$h = "function.target.makeConnection";
|
|
|
19501
19891
|
const makeConnectionInternal = (connector, clientId, swarmName) => {
|
|
19502
19892
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19503
19893
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19504
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19894
|
+
swarm$1.loggerService.log(METHOD_NAME$i, {
|
|
19505
19895
|
clientId,
|
|
19506
19896
|
swarmName,
|
|
19507
19897
|
});
|
|
19508
19898
|
// Validate the swarm and initialize the session
|
|
19509
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19899
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
|
|
19510
19900
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
19511
19901
|
// Create a queued send function using the session public service
|
|
19512
|
-
const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$
|
|
19902
|
+
const send = functoolsKit.queued(swarm$1.sessionPublicService.connect(connector, METHOD_NAME$i, clientId, swarmName));
|
|
19513
19903
|
// Return a wrapped send function with validation and agent context
|
|
19514
19904
|
return (async (outgoing) => {
|
|
19515
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19905
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
|
|
19516
19906
|
return await send({
|
|
19517
19907
|
data: outgoing,
|
|
19518
|
-
agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19908
|
+
agentName: await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName),
|
|
19519
19909
|
clientId,
|
|
19520
19910
|
});
|
|
19521
19911
|
});
|
|
@@ -19598,13 +19988,13 @@ makeConnection.scheduled = (connector, clientId, swarmName, { delay = SCHEDULED_
|
|
|
19598
19988
|
await online();
|
|
19599
19989
|
if (payload) {
|
|
19600
19990
|
return await PayloadContextService.runInContext(async () => {
|
|
19601
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
19991
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$i, clientId, swarmName);
|
|
19602
19992
|
}, {
|
|
19603
19993
|
clientId,
|
|
19604
19994
|
payload,
|
|
19605
19995
|
});
|
|
19606
19996
|
}
|
|
19607
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
19997
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$i, clientId, swarmName);
|
|
19608
19998
|
}),
|
|
19609
19999
|
delay,
|
|
19610
20000
|
});
|
|
@@ -19667,7 +20057,7 @@ makeConnection.rate = (connector, clientId, swarmName, { delay = RATE_DELAY } =
|
|
|
19667
20057
|
};
|
|
19668
20058
|
};
|
|
19669
20059
|
|
|
19670
|
-
const METHOD_NAME$
|
|
20060
|
+
const METHOD_NAME$h = "function.target.complete";
|
|
19671
20061
|
/**
|
|
19672
20062
|
* Creates a complete function with time-to-live (TTL) and queuing capabilities.
|
|
19673
20063
|
*
|
|
@@ -19720,7 +20110,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
19720
20110
|
const executionId = functoolsKit.randomString();
|
|
19721
20111
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19722
20112
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19723
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20113
|
+
swarm$1.loggerService.log(METHOD_NAME$h, {
|
|
19724
20114
|
content,
|
|
19725
20115
|
clientId,
|
|
19726
20116
|
executionId,
|
|
@@ -19738,7 +20128,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
19738
20128
|
swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
|
|
19739
20129
|
try {
|
|
19740
20130
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
19741
|
-
const result = await run(METHOD_NAME$
|
|
20131
|
+
const result = await run(METHOD_NAME$h, content);
|
|
19742
20132
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
19743
20133
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
19744
20134
|
return result;
|
|
@@ -19768,7 +20158,7 @@ const complete = beginContext(async (content, clientId, swarmName, payload = nul
|
|
|
19768
20158
|
* @constant {number}
|
|
19769
20159
|
*/
|
|
19770
20160
|
const SCHEDULED_DELAY = 1000;
|
|
19771
|
-
const METHOD_NAME$
|
|
20161
|
+
const METHOD_NAME$g = "function.target.session";
|
|
19772
20162
|
/**
|
|
19773
20163
|
* Internal implementation of the session factory for a client and swarm.
|
|
19774
20164
|
*
|
|
@@ -19783,23 +20173,23 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
|
|
|
19783
20173
|
const executionId = functoolsKit.randomString();
|
|
19784
20174
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19785
20175
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19786
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20176
|
+
swarm$1.loggerService.log(METHOD_NAME$g, {
|
|
19787
20177
|
clientId,
|
|
19788
20178
|
swarmName,
|
|
19789
20179
|
executionId,
|
|
19790
20180
|
});
|
|
19791
20181
|
// Validate the swarm and initialize the session
|
|
19792
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
20182
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
|
|
19793
20183
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
19794
20184
|
const complete = functoolsKit.queued(async (content) => {
|
|
19795
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
20185
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
|
|
19796
20186
|
return ExecutionContextService.runInContext(async () => {
|
|
19797
20187
|
let isFinished = false;
|
|
19798
20188
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
19799
20189
|
swarm$1.navigationValidationService.beginMonit(clientId, swarmName);
|
|
19800
20190
|
try {
|
|
19801
20191
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
19802
|
-
const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$
|
|
20192
|
+
const result = await swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$g, clientId, swarmName);
|
|
19803
20193
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
19804
20194
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
19805
20195
|
return result;
|
|
@@ -19820,7 +20210,7 @@ const sessionInternal = (clientId, swarmName, { onDispose = () => { } } = {}) =>
|
|
|
19820
20210
|
return await complete(content);
|
|
19821
20211
|
}),
|
|
19822
20212
|
dispose: async () => {
|
|
19823
|
-
await disposeConnection(clientId, swarmName, METHOD_NAME$
|
|
20213
|
+
await disposeConnection(clientId, swarmName, METHOD_NAME$g);
|
|
19824
20214
|
await onDispose();
|
|
19825
20215
|
},
|
|
19826
20216
|
};
|
|
@@ -19920,13 +20310,13 @@ session.scheduled = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose }
|
|
|
19920
20310
|
await online();
|
|
19921
20311
|
if (payload) {
|
|
19922
20312
|
return await PayloadContextService.runInContext(async () => {
|
|
19923
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
20313
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$g, clientId, swarmName);
|
|
19924
20314
|
}, {
|
|
19925
20315
|
clientId,
|
|
19926
20316
|
payload,
|
|
19927
20317
|
});
|
|
19928
20318
|
}
|
|
19929
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$
|
|
20319
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, "user", METHOD_NAME$g, clientId, swarmName);
|
|
19930
20320
|
}),
|
|
19931
20321
|
delay,
|
|
19932
20322
|
});
|
|
@@ -20014,7 +20404,7 @@ session.rate = (clientId, swarmName, { delay = SCHEDULED_DELAY, onDispose } = {}
|
|
|
20014
20404
|
* @description Method name for the scope operation.
|
|
20015
20405
|
* @private
|
|
20016
20406
|
*/
|
|
20017
|
-
const METHOD_NAME$
|
|
20407
|
+
const METHOD_NAME$f = "function.target.fork";
|
|
20018
20408
|
/**
|
|
20019
20409
|
* @function fork
|
|
20020
20410
|
* @description Executes a provided function within a managed scope, handling session creation, validation, and cleanup.
|
|
@@ -20026,7 +20416,7 @@ const METHOD_NAME$e = "function.target.fork";
|
|
|
20026
20416
|
*/
|
|
20027
20417
|
const fork = beginContext(async (runFn, { clientId, swarmName, onError }) => {
|
|
20028
20418
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
20029
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
20419
|
+
swarm$1.loggerService.log(METHOD_NAME$f, {
|
|
20030
20420
|
clientId,
|
|
20031
20421
|
swarmName,
|
|
20032
20422
|
});
|
|
@@ -20034,9 +20424,9 @@ const fork = beginContext(async (runFn, { clientId, swarmName, onError }) => {
|
|
|
20034
20424
|
throw new Error(`agent-swarm scope Session already exists for clientId=${clientId}`);
|
|
20035
20425
|
}
|
|
20036
20426
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "scope");
|
|
20037
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
20038
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
20039
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
20427
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$f);
|
|
20428
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
|
|
20429
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$f, clientId, swarmName);
|
|
20040
20430
|
let result = null;
|
|
20041
20431
|
try {
|
|
20042
20432
|
result = (await runFn(clientId, agentName));
|
|
@@ -20046,11 +20436,61 @@ const fork = beginContext(async (runFn, { clientId, swarmName, onError }) => {
|
|
|
20046
20436
|
onError && onError(error);
|
|
20047
20437
|
}
|
|
20048
20438
|
finally {
|
|
20049
|
-
await disposeConnection(clientId, swarmName, METHOD_NAME$
|
|
20439
|
+
await disposeConnection(clientId, swarmName, METHOD_NAME$f);
|
|
20050
20440
|
}
|
|
20051
20441
|
return result;
|
|
20052
20442
|
});
|
|
20053
20443
|
|
|
20444
|
+
/**
|
|
20445
|
+
* @module scope
|
|
20446
|
+
* @description Provides a function to execute a specified function within a managed schema context, allowing overrides for schema services.
|
|
20447
|
+
*/
|
|
20448
|
+
/**
|
|
20449
|
+
* @constant {string} METHOD_NAME
|
|
20450
|
+
* @description Method name for the scope operation.
|
|
20451
|
+
* @private
|
|
20452
|
+
*/
|
|
20453
|
+
const METHOD_NAME$e = "function.target.scope";
|
|
20454
|
+
/**
|
|
20455
|
+
* @function scope
|
|
20456
|
+
* @description Executes a provided function within a schema context, with optional overrides for schema services such as agents, completions, and pipelines.
|
|
20457
|
+
* @template T - Type of the result returned by the run function.
|
|
20458
|
+
* @param {Function} runFn - The function to execute within the schema context.
|
|
20459
|
+
* @param {Partial<ISchemaContext["registry"]>} [options] - Optional overrides for schema services, with defaults from the swarm's schema services.
|
|
20460
|
+
* @param {ToolRegistry} [options.agentSchemaService=swarm.agentSchemaService.registry] - Registry for agent schemas.
|
|
20461
|
+
* @param {ToolRegistry} [options.completionSchemaService=swarm.completionSchemaService.registry] - Registry for completion schemas.
|
|
20462
|
+
* @param {ToolRegistry} [options.computeSchemaService=swarm.computeSchemaService.registry] - Registry for compute schemas.
|
|
20463
|
+
* @param {ToolRegistry} [options.embeddingSchemaService=swarm.embeddingSchemaService.registry] - Registry for embedding schemas.
|
|
20464
|
+
* @param {ToolRegistry} [options.mcpSchemaService=swarm.mcpSchemaService.registry] - Registry for MCP schemas.
|
|
20465
|
+
* @param {ToolRegistry} [options.pipelineSchemaService=swarm.pipelineSchemaService.registry] - Registry for pipeline schemas.
|
|
20466
|
+
* @param {ToolRegistry} [options.policySchemaService=swarm.policySchemaService.registry] - Registry for policy schemas.
|
|
20467
|
+
* @param {ToolRegistry} [options.stateSchemaService=swarm.stateSchemaService.registry] - Registry for state schemas.
|
|
20468
|
+
* @param {ToolRegistry} [options.storageSchemaService=swarm.storageSchemaService.registry] - Registry for storage schemas.
|
|
20469
|
+
* @param {ToolRegistry} [options.swarmSchemaService=swarm.swarmSchemaService.registry] - Registry for swarm schemas.
|
|
20470
|
+
* @param {ToolRegistry} [options.toolSchemaService=swarm.toolSchemaService.registry] - Registry for tool schemas.
|
|
20471
|
+
* @param {ToolRegistry} [options.wikiSchemaService=swarm.wikiSchemaService.registry] - Registry for wiki schemas.
|
|
20472
|
+
* @returns {Promise<T>} The result of the executed function.
|
|
20473
|
+
*/
|
|
20474
|
+
const scope = async (runFn, { agentSchemaService = swarm$1.agentSchemaService.registry, completionSchemaService = swarm$1.completionSchemaService.registry, computeSchemaService = swarm$1.computeSchemaService.registry, embeddingSchemaService = swarm$1.embeddingSchemaService.registry, mcpSchemaService = swarm$1.mcpSchemaService.registry, pipelineSchemaService = swarm$1.pipelineSchemaService.registry, policySchemaService = swarm$1.policySchemaService.registry, stateSchemaService = swarm$1.stateSchemaService.registry, storageSchemaService = swarm$1.storageSchemaService.registry, swarmSchemaService = swarm$1.swarmSchemaService.registry, toolSchemaService = swarm$1.toolSchemaService.registry, wikiSchemaService = swarm$1.wikiSchemaService.registry, }) => {
|
|
20475
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$e);
|
|
20476
|
+
return await SchemaContextService.runInContext(runFn, {
|
|
20477
|
+
registry: {
|
|
20478
|
+
agentSchemaService,
|
|
20479
|
+
completionSchemaService,
|
|
20480
|
+
computeSchemaService,
|
|
20481
|
+
embeddingSchemaService,
|
|
20482
|
+
mcpSchemaService,
|
|
20483
|
+
pipelineSchemaService,
|
|
20484
|
+
policySchemaService,
|
|
20485
|
+
stateSchemaService,
|
|
20486
|
+
storageSchemaService,
|
|
20487
|
+
swarmSchemaService,
|
|
20488
|
+
toolSchemaService,
|
|
20489
|
+
wikiSchemaService,
|
|
20490
|
+
},
|
|
20491
|
+
});
|
|
20492
|
+
};
|
|
20493
|
+
|
|
20054
20494
|
/**
|
|
20055
20495
|
* @module startPipeline
|
|
20056
20496
|
* @description Provides a function to initiate a pipeline execution with session validation, logging, and callback handling.
|
|
@@ -22781,6 +23221,7 @@ exports.PersistSwarm = PersistSwarm;
|
|
|
22781
23221
|
exports.Policy = Policy;
|
|
22782
23222
|
exports.RoundRobin = RoundRobin;
|
|
22783
23223
|
exports.Schema = Schema;
|
|
23224
|
+
exports.SchemaContextService = SchemaContextService;
|
|
22784
23225
|
exports.SharedCompute = SharedCompute;
|
|
22785
23226
|
exports.SharedState = SharedState;
|
|
22786
23227
|
exports.SharedStorage = SharedStorage;
|
|
@@ -22888,6 +23329,7 @@ exports.question = question;
|
|
|
22888
23329
|
exports.questionForce = questionForce;
|
|
22889
23330
|
exports.runStateless = runStateless;
|
|
22890
23331
|
exports.runStatelessForce = runStatelessForce;
|
|
23332
|
+
exports.scope = scope;
|
|
22891
23333
|
exports.session = session;
|
|
22892
23334
|
exports.setConfig = setConfig;
|
|
22893
23335
|
exports.startPipeline = startPipeline;
|