agent-swarm-kit 1.1.45 → 1.1.46
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 +536 -221
- package/build/index.mjs +538 -225
- package/package.json +1 -1
- package/types.d.ts +284 -132
package/build/index.cjs
CHANGED
|
@@ -3565,6 +3565,64 @@ class AgentSchemaService {
|
|
|
3565
3565
|
}
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
|
+
/**
|
|
3569
|
+
* Checks if a given value is a plain JavaScript object.
|
|
3570
|
+
* Returns `true` only for objects that inherit directly from `Object.prototype`, excluding arrays, null, and other non-object types.
|
|
3571
|
+
*
|
|
3572
|
+
* @param {any} obj - The value to check for being a plain object.
|
|
3573
|
+
* @returns {boolean} Returns `true` if the value is a plain object (e.g., `{}` or `{ key: "value" }`), otherwise `false`.
|
|
3574
|
+
*
|
|
3575
|
+
* @example
|
|
3576
|
+
* // Basic usage with various types
|
|
3577
|
+
* console.log(isObject({})); // true
|
|
3578
|
+
* console.log(isObject({ key: "value" })); // true
|
|
3579
|
+
* console.log(isObject([])); // false (arrays are objects but not plain objects)
|
|
3580
|
+
* console.log(isObject(null)); // false
|
|
3581
|
+
* console.log(isObject("string")); // false
|
|
3582
|
+
* console.log(isObject(42)); // false
|
|
3583
|
+
*
|
|
3584
|
+
* @example
|
|
3585
|
+
* // Testing with custom objects and prototypes
|
|
3586
|
+
* const customObj = Object.create(null);
|
|
3587
|
+
* console.log(isObject(customObj)); // false (does not inherit from Object.prototype)
|
|
3588
|
+
* const plainObj = Object.create(Object.prototype);
|
|
3589
|
+
* console.log(isObject(plainObj)); // true
|
|
3590
|
+
*
|
|
3591
|
+
* @remarks
|
|
3592
|
+
* This function performs a strict check for plain objects by verifying:
|
|
3593
|
+
* 1. The value’s type is `"object"` (via `typeof`), excluding primitives.
|
|
3594
|
+
* 2. The value is not `null`.
|
|
3595
|
+
* 3. The value’s prototype is exactly `Object.prototype`, distinguishing plain objects from arrays, functions,
|
|
3596
|
+
* or objects with custom prototypes (e.g., instances of classes or `Object.create(null)`).
|
|
3597
|
+
* This is useful in scenarios requiring type safety, such as validating configuration objects or JSON-parsed data
|
|
3598
|
+
* in the agent swarm system, where distinguishing between plain objects and other object-like types is critical.
|
|
3599
|
+
*
|
|
3600
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf|Object.getPrototypeOf}
|
|
3601
|
+
* for details on prototype checking.
|
|
3602
|
+
*/
|
|
3603
|
+
const isObject = (obj) => {
|
|
3604
|
+
if (typeof obj === "object" && obj !== null) {
|
|
3605
|
+
return Object.getPrototypeOf(obj) === Object.prototype;
|
|
3606
|
+
}
|
|
3607
|
+
else {
|
|
3608
|
+
return false;
|
|
3609
|
+
}
|
|
3610
|
+
};
|
|
3611
|
+
|
|
3612
|
+
const createToolRequest = ({ toolName, params, }) => {
|
|
3613
|
+
if (!isObject(params)) {
|
|
3614
|
+
throw new Error("agent-swarm createToolRequest params is not object");
|
|
3615
|
+
}
|
|
3616
|
+
return {
|
|
3617
|
+
id: `call_${Math.random().toString(36).slice(2, 11)}`,
|
|
3618
|
+
type: "function",
|
|
3619
|
+
function: {
|
|
3620
|
+
name: toolName,
|
|
3621
|
+
arguments: params,
|
|
3622
|
+
},
|
|
3623
|
+
};
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3568
3626
|
const AGENT_CHANGE_SYMBOL = Symbol("agent-change");
|
|
3569
3627
|
const MODEL_RESQUE_SYMBOL = Symbol("model-resque");
|
|
3570
3628
|
const TOOL_ERROR_SYMBOL = Symbol("tool-error");
|
|
@@ -4448,6 +4506,41 @@ class ClientAgent {
|
|
|
4448
4506
|
clientId: this.params.clientId,
|
|
4449
4507
|
});
|
|
4450
4508
|
}
|
|
4509
|
+
/**
|
|
4510
|
+
* Commits a tool request to the agent's history and emits an event via BusService.
|
|
4511
|
+
* This method is used to log tool requests and notify the system of the requested tool calls.
|
|
4512
|
+
* The tool requests are transformed into tool call objects using the `createToolRequest` utility.
|
|
4513
|
+
*
|
|
4514
|
+
* @param {IToolRequest[]} request - An array of tool request objects, each containing details about the requested tools.
|
|
4515
|
+
* @returns {Promise<void>} Resolves when the tool request is committed to history and the event is emitted.
|
|
4516
|
+
*/
|
|
4517
|
+
async commitToolRequest(request) {
|
|
4518
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4519
|
+
this.params.logger.debug(`ClientAgent agentName=${this.params.agentName} clientId=${this.params.clientId} commitToolRequest`, { request });
|
|
4520
|
+
this.params.onToolRequest &&
|
|
4521
|
+
this.params.onToolRequest(this.params.clientId, this.params.agentName, request);
|
|
4522
|
+
const tool_calls = request.map(createToolRequest);
|
|
4523
|
+
await this.params.history.push({
|
|
4524
|
+
role: "assistant",
|
|
4525
|
+
agentName: this.params.agentName,
|
|
4526
|
+
mode: "tool",
|
|
4527
|
+
content: "",
|
|
4528
|
+
tool_calls,
|
|
4529
|
+
});
|
|
4530
|
+
await this.params.bus.emit(this.params.clientId, {
|
|
4531
|
+
type: "commit-tool-request",
|
|
4532
|
+
source: "agent-bus",
|
|
4533
|
+
input: {
|
|
4534
|
+
request,
|
|
4535
|
+
},
|
|
4536
|
+
output: {},
|
|
4537
|
+
context: {
|
|
4538
|
+
agentName: this.params.agentName,
|
|
4539
|
+
},
|
|
4540
|
+
clientId: this.params.clientId,
|
|
4541
|
+
});
|
|
4542
|
+
return tool_calls.map(({ id }) => id);
|
|
4543
|
+
}
|
|
4451
4544
|
/**
|
|
4452
4545
|
* Commits an assistant message to the history without triggering execution, notifying the system via BusService.
|
|
4453
4546
|
* Useful for logging assistant responses, coordinated with HistoryConnectionService.
|
|
@@ -4666,6 +4759,16 @@ class ClientOperator {
|
|
|
4666
4759
|
this.params.logger.debug(`ClientOperator agentName=${this.params.agentName} clientId=${this.params.clientId} commitSystemMessage - not supported`);
|
|
4667
4760
|
return Promise.resolve();
|
|
4668
4761
|
}
|
|
4762
|
+
/**
|
|
4763
|
+
* Commits tool request (not supported)
|
|
4764
|
+
* @returns {Promise<string[]>}
|
|
4765
|
+
*/
|
|
4766
|
+
commitToolRequest() {
|
|
4767
|
+
console.warn(`ClientOperator: commitToolRequest should not be called for clientId=${this.params.clientId} agentName=${this.params.agentName}`);
|
|
4768
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4769
|
+
this.params.logger.debug(`ClientOperator agentName=${this.params.agentName} clientId=${this.params.clientId} commitToolRequest - not supported`);
|
|
4770
|
+
return Promise.resolve([]);
|
|
4771
|
+
}
|
|
4669
4772
|
/**
|
|
4670
4773
|
* Commits user message
|
|
4671
4774
|
* @param {string} content - Message content
|
|
@@ -4730,7 +4833,7 @@ class ClientOperator {
|
|
|
4730
4833
|
}
|
|
4731
4834
|
}
|
|
4732
4835
|
|
|
4733
|
-
const METHOD_NAME$
|
|
4836
|
+
const METHOD_NAME$1n = "function.commit.commitToolOutput";
|
|
4734
4837
|
/**
|
|
4735
4838
|
* Commits the output of a tool execution to the active agent in a swarm session.
|
|
4736
4839
|
*
|
|
@@ -4750,19 +4853,19 @@ const METHOD_NAME$1l = "function.commit.commitToolOutput";
|
|
|
4750
4853
|
const commitToolOutput = beginContext(async (toolId, content, clientId, agentName) => {
|
|
4751
4854
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4752
4855
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4753
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4856
|
+
swarm$1.loggerService.log(METHOD_NAME$1n, {
|
|
4754
4857
|
toolId,
|
|
4755
4858
|
content,
|
|
4756
4859
|
clientId,
|
|
4757
4860
|
agentName,
|
|
4758
4861
|
});
|
|
4759
4862
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
4760
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4761
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4863
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1n);
|
|
4864
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1n);
|
|
4762
4865
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4763
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4866
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1n);
|
|
4764
4867
|
// Check if the specified agent is still the active agent in the swarm session
|
|
4765
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4868
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1n, clientId, swarmName);
|
|
4766
4869
|
if (currentAgentName !== agentName) {
|
|
4767
4870
|
// Log a skip message if the agent has changed during the operation
|
|
4768
4871
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -4775,10 +4878,10 @@ const commitToolOutput = beginContext(async (toolId, content, clientId, agentNam
|
|
|
4775
4878
|
return;
|
|
4776
4879
|
}
|
|
4777
4880
|
// Commit the tool output to the session via the session public service
|
|
4778
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
4881
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1n, clientId, swarmName);
|
|
4779
4882
|
});
|
|
4780
4883
|
|
|
4781
|
-
const METHOD_NAME$
|
|
4884
|
+
const METHOD_NAME$1m = "function.target.execute";
|
|
4782
4885
|
/**
|
|
4783
4886
|
* Sends a message to the active agent in a swarm session as if it originated from the client side.
|
|
4784
4887
|
*
|
|
@@ -4800,19 +4903,19 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4800
4903
|
const executionId = functoolsKit.randomString();
|
|
4801
4904
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4802
4905
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4803
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4906
|
+
swarm$1.loggerService.log(METHOD_NAME$1m, {
|
|
4804
4907
|
content,
|
|
4805
4908
|
clientId,
|
|
4806
4909
|
agentName,
|
|
4807
4910
|
executionId,
|
|
4808
4911
|
});
|
|
4809
4912
|
// Validate the agent, session, and swarm
|
|
4810
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4811
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4913
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1m);
|
|
4914
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1m);
|
|
4812
4915
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4813
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4916
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1m);
|
|
4814
4917
|
// Check if the specified agent is still the active agent
|
|
4815
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4918
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1m, clientId, swarmName);
|
|
4816
4919
|
if (currentAgentName !== agentName) {
|
|
4817
4920
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4818
4921
|
swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
|
|
@@ -4831,7 +4934,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4831
4934
|
agentName,
|
|
4832
4935
|
swarmName,
|
|
4833
4936
|
});
|
|
4834
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
4937
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$1m, clientId, swarmName);
|
|
4835
4938
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
4836
4939
|
swarm$1.busService.commitExecutionEnd(clientId, {
|
|
4837
4940
|
agentName,
|
|
@@ -4852,7 +4955,7 @@ const execute = beginContext(async (content, clientId, agentName) => {
|
|
|
4852
4955
|
});
|
|
4853
4956
|
|
|
4854
4957
|
/** @private Constant defining the method name for logging and validation context */
|
|
4855
|
-
const METHOD_NAME$
|
|
4958
|
+
const METHOD_NAME$1l = "function.commit.commitFlush";
|
|
4856
4959
|
/**
|
|
4857
4960
|
* Commits a flush of agent history for a specific client and agent in the swarm system.
|
|
4858
4961
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before flushing the history.
|
|
@@ -4869,19 +4972,19 @@ const METHOD_NAME$1j = "function.commit.commitFlush";
|
|
|
4869
4972
|
const commitFlush = beginContext(async (clientId, agentName) => {
|
|
4870
4973
|
// Log the flush attempt if enabled
|
|
4871
4974
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4872
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
4975
|
+
swarm$1.loggerService.log(METHOD_NAME$1l, {
|
|
4873
4976
|
clientId,
|
|
4874
4977
|
agentName,
|
|
4875
4978
|
});
|
|
4876
4979
|
// Validate the agent exists
|
|
4877
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4980
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1l);
|
|
4878
4981
|
// Validate the session exists and retrieve the associated swarm
|
|
4879
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
4982
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1l);
|
|
4880
4983
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4881
4984
|
// Validate the swarm configuration
|
|
4882
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
4985
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1l);
|
|
4883
4986
|
// Check if the current agent matches the provided agent
|
|
4884
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
4987
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1l, clientId, swarmName);
|
|
4885
4988
|
if (currentAgentName !== agentName) {
|
|
4886
4989
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4887
4990
|
swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
@@ -4892,10 +4995,10 @@ const commitFlush = beginContext(async (clientId, agentName) => {
|
|
|
4892
4995
|
return;
|
|
4893
4996
|
}
|
|
4894
4997
|
// Commit the flush of agent history via SessionPublicService
|
|
4895
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
4998
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1l, clientId, swarmName);
|
|
4896
4999
|
});
|
|
4897
5000
|
|
|
4898
|
-
const METHOD_NAME$
|
|
5001
|
+
const METHOD_NAME$1k = "function.target.emit";
|
|
4899
5002
|
/**
|
|
4900
5003
|
* Emits a string as model output without executing an incoming message, with agent activity validation.
|
|
4901
5004
|
*
|
|
@@ -4915,18 +5018,18 @@ const METHOD_NAME$1i = "function.target.emit";
|
|
|
4915
5018
|
const emit = beginContext(async (content, clientId, agentName) => {
|
|
4916
5019
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4917
5020
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4918
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
5021
|
+
swarm$1.loggerService.log(METHOD_NAME$1k, {
|
|
4919
5022
|
content,
|
|
4920
5023
|
clientId,
|
|
4921
5024
|
agentName,
|
|
4922
5025
|
});
|
|
4923
5026
|
// Validate the agent, session, and swarm
|
|
4924
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
4925
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
5027
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1k);
|
|
5028
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1k);
|
|
4926
5029
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4927
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
5030
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1k);
|
|
4928
5031
|
// Check if the specified agent is still the active agent
|
|
4929
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
5032
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1k, clientId, swarmName);
|
|
4930
5033
|
if (currentAgentName !== agentName) {
|
|
4931
5034
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4932
5035
|
swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
|
|
@@ -4937,10 +5040,10 @@ const emit = beginContext(async (content, clientId, agentName) => {
|
|
|
4937
5040
|
return;
|
|
4938
5041
|
}
|
|
4939
5042
|
// Emit the content directly via the session public service
|
|
4940
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
5043
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$1k, clientId, swarmName);
|
|
4941
5044
|
});
|
|
4942
5045
|
|
|
4943
|
-
const METHOD_NAME$
|
|
5046
|
+
const METHOD_NAME$1j = "function.common.getAgentName";
|
|
4944
5047
|
/**
|
|
4945
5048
|
* Retrieves the name of the active agent for a given client session in a swarm.
|
|
4946
5049
|
*
|
|
@@ -4958,19 +5061,19 @@ const METHOD_NAME$1h = "function.common.getAgentName";
|
|
|
4958
5061
|
const getAgentName = beginContext(async (clientId) => {
|
|
4959
5062
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
4960
5063
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4961
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
5064
|
+
swarm$1.loggerService.log(METHOD_NAME$1j, {
|
|
4962
5065
|
clientId,
|
|
4963
5066
|
});
|
|
4964
5067
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
4965
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
5068
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1j);
|
|
4966
5069
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4967
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
5070
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1j);
|
|
4968
5071
|
// Retrieve the active agent name via the swarm public service
|
|
4969
|
-
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
5072
|
+
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1j, clientId, swarmName);
|
|
4970
5073
|
});
|
|
4971
5074
|
|
|
4972
5075
|
/** @private Constant defining the method name for logging and validation context */
|
|
4973
|
-
const METHOD_NAME$
|
|
5076
|
+
const METHOD_NAME$1i = "function.commit.commitStopTools";
|
|
4974
5077
|
/**
|
|
4975
5078
|
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
4976
5079
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
|
|
@@ -4987,19 +5090,19 @@ const METHOD_NAME$1g = "function.commit.commitStopTools";
|
|
|
4987
5090
|
const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
4988
5091
|
// Log the stop tools attempt if enabled
|
|
4989
5092
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4990
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
5093
|
+
swarm$1.loggerService.log(METHOD_NAME$1i, {
|
|
4991
5094
|
clientId,
|
|
4992
5095
|
agentName,
|
|
4993
5096
|
});
|
|
4994
5097
|
// Validate the agent exists
|
|
4995
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
5098
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1i);
|
|
4996
5099
|
// Validate the session exists and retrieve the associated swarm
|
|
4997
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
5100
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1i);
|
|
4998
5101
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4999
5102
|
// Validate the swarm configuration
|
|
5000
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
5103
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1i);
|
|
5001
5104
|
// Check if the current agent matches the provided agent
|
|
5002
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
5105
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1i, clientId, swarmName);
|
|
5003
5106
|
if (currentAgentName !== agentName) {
|
|
5004
5107
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
5005
5108
|
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
@@ -5010,7 +5113,7 @@ const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
|
5010
5113
|
return;
|
|
5011
5114
|
}
|
|
5012
5115
|
// Commit the stop of the next tool execution via SessionPublicService
|
|
5013
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
5116
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1i, clientId, swarmName);
|
|
5014
5117
|
});
|
|
5015
5118
|
|
|
5016
5119
|
const METHOD_NAME_UPDATE$2 = "McpUtils.update";
|
|
@@ -5440,6 +5543,20 @@ class AgentConnectionService {
|
|
|
5440
5543
|
});
|
|
5441
5544
|
return await this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitSystemMessage(message);
|
|
5442
5545
|
};
|
|
5546
|
+
/**
|
|
5547
|
+
* Commits a tool request to the agent’s history.
|
|
5548
|
+
* Delegates to ClientAgent.commitToolRequest, using context from MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
5549
|
+
* Mirrors SessionPublicService’s commitToolRequest, supporting ClientAgent’s tool request handling and HistoryPublicService.
|
|
5550
|
+
* @param {IToolRequest[]} request - An array of tool request objects to commit.
|
|
5551
|
+
* @returns {Promise<string[]>} A promise resolving to the commit result, type determined by ClientAgent’s implementation.
|
|
5552
|
+
*/
|
|
5553
|
+
this.commitToolRequest = async (request) => {
|
|
5554
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5555
|
+
this.loggerService.info(`agentConnectionService commitToolRequest`, {
|
|
5556
|
+
request,
|
|
5557
|
+
});
|
|
5558
|
+
return await this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).commitToolRequest(request);
|
|
5559
|
+
};
|
|
5443
5560
|
/**
|
|
5444
5561
|
* Commits an assistant message to the agent’s history.
|
|
5445
5562
|
* Delegates to ClientAgent.commitAssistantMessage, using context from MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -5523,7 +5640,7 @@ class AgentConnectionService {
|
|
|
5523
5640
|
}
|
|
5524
5641
|
|
|
5525
5642
|
/** @private Constant defining the method name for logging purposes */
|
|
5526
|
-
const METHOD_NAME$
|
|
5643
|
+
const METHOD_NAME$1h = "function.common.getPayload";
|
|
5527
5644
|
/**
|
|
5528
5645
|
* Retrieves the payload from the current PayloadContextService context.
|
|
5529
5646
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -5534,7 +5651,7 @@ const METHOD_NAME$1f = "function.common.getPayload";
|
|
|
5534
5651
|
* console.log(payload); // { id: number } or null
|
|
5535
5652
|
*/
|
|
5536
5653
|
const getPayload = () => {
|
|
5537
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
5654
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1h);
|
|
5538
5655
|
if (PayloadContextService.hasContext()) {
|
|
5539
5656
|
const { payload } = swarm$1.payloadContextService.context;
|
|
5540
5657
|
return payload;
|
|
@@ -5673,7 +5790,7 @@ class ClientHistory {
|
|
|
5673
5790
|
}))
|
|
5674
5791
|
.filter(({ content, tool_calls }) => !!content || !!tool_calls?.length)
|
|
5675
5792
|
.filter(this._filterCondition)
|
|
5676
|
-
.slice(-
|
|
5793
|
+
.slice(-this.params.keepMessages);
|
|
5677
5794
|
const assistantToolOutputCallSet = new Set(commonMessages
|
|
5678
5795
|
.filter(({ tool_call_id }) => !!tool_call_id)
|
|
5679
5796
|
.map(({ tool_call_id }) => tool_call_id));
|
|
@@ -5774,6 +5891,13 @@ class HistoryConnectionService {
|
|
|
5774
5891
|
* @private
|
|
5775
5892
|
*/
|
|
5776
5893
|
this.sessionValidationService = inject(TYPES.sessionValidationService);
|
|
5894
|
+
/**
|
|
5895
|
+
* Agent schema service instance, injected via DI, for managing agent schema-related operations.
|
|
5896
|
+
* Used to validate and process agent schemas within the history connection service.
|
|
5897
|
+
* @type {AgentSchemaService}
|
|
5898
|
+
* @private
|
|
5899
|
+
*/
|
|
5900
|
+
this.agentSchemaService = inject(TYPES.agentSchemaService);
|
|
5777
5901
|
/**
|
|
5778
5902
|
* Retrieves or creates a memoized ClientHistory instance for a given client and agent.
|
|
5779
5903
|
* Uses functools-kit’s memoize to cache instances by a composite key (clientId-agentName), ensuring efficient reuse across calls.
|
|
@@ -5785,9 +5909,11 @@ class HistoryConnectionService {
|
|
|
5785
5909
|
*/
|
|
5786
5910
|
this.getHistory = functoolsKit.memoize(([clientId, agentName]) => `${clientId}-${agentName}`, (clientId, agentName) => {
|
|
5787
5911
|
this.sessionValidationService.addHistoryUsage(clientId, agentName);
|
|
5912
|
+
const { keepMessages = GLOBAL_CONFIG.CC_KEEP_MESSAGES } = this.agentSchemaService.get(agentName);
|
|
5788
5913
|
return new ClientHistory({
|
|
5789
5914
|
clientId,
|
|
5790
5915
|
agentName,
|
|
5916
|
+
keepMessages,
|
|
5791
5917
|
bus: this.busService,
|
|
5792
5918
|
items: GLOBAL_CONFIG.CC_GET_AGENT_HISTORY_ADAPTER(clientId, agentName),
|
|
5793
5919
|
logger: this.loggerService,
|
|
@@ -6089,6 +6215,19 @@ class NoopAgent {
|
|
|
6089
6215
|
console.error(message, context);
|
|
6090
6216
|
return await this.defaultAgent.commitSystemMessage(content);
|
|
6091
6217
|
}
|
|
6218
|
+
/**
|
|
6219
|
+
* Logs an attempt to commit a tool request for the missing agent and delegates to the default agent's commitToolRequest method.
|
|
6220
|
+
* @param {IToolRequest[]} request - An array of tool requests to commit.
|
|
6221
|
+
* @returns {Promise<void>} Resolves when the default agent's commitToolRequest method completes.
|
|
6222
|
+
* @async
|
|
6223
|
+
*/
|
|
6224
|
+
async commitToolRequest(request) {
|
|
6225
|
+
const message = `called commitToolOutput on agent which not in the swarm clientId=${this.clientId} agentName=${this.agentName} swarmName=${this.swarmName}`;
|
|
6226
|
+
const context = { request };
|
|
6227
|
+
this.logger.log(message, context);
|
|
6228
|
+
console.error(message, context);
|
|
6229
|
+
return await this.defaultAgent.commitToolRequest(request);
|
|
6230
|
+
}
|
|
6092
6231
|
/**
|
|
6093
6232
|
* Logs an attempt to commit a user message for the missing agent and delegates to the default agent's commitUserMessage method.
|
|
6094
6233
|
* @param {string} content - The user message content to commit.
|
|
@@ -7192,6 +7331,34 @@ class ClientSession {
|
|
|
7192
7331
|
});
|
|
7193
7332
|
return result;
|
|
7194
7333
|
}
|
|
7334
|
+
/**
|
|
7335
|
+
* Commits a tool request to the agent's history via the swarm’s agent (ClientAgent) and logs the action via BusService.
|
|
7336
|
+
* Supports ToolSchemaService by linking tool requests to tool execution, integrating with ClientAgent’s history management.
|
|
7337
|
+
*
|
|
7338
|
+
* @param {IToolRequest[]} request - An array of tool requests to commit, typically representing tool execution details.
|
|
7339
|
+
* @returns {Promise<string[]>} Resolves when the tool request is committed and the event is logged.
|
|
7340
|
+
*/
|
|
7341
|
+
async commitToolRequest(request) {
|
|
7342
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
7343
|
+
this.params.logger.debug(`ClientSession clientId=${this.params.clientId} commitToolRequest`, {
|
|
7344
|
+
request,
|
|
7345
|
+
});
|
|
7346
|
+
const agent = await this.params.swarm.getAgent();
|
|
7347
|
+
const result = await agent.commitToolRequest(request);
|
|
7348
|
+
await this.params.bus.emit(this.params.clientId, {
|
|
7349
|
+
type: "commit-tool-request",
|
|
7350
|
+
source: "session-bus",
|
|
7351
|
+
input: {
|
|
7352
|
+
request,
|
|
7353
|
+
},
|
|
7354
|
+
output: {},
|
|
7355
|
+
context: {
|
|
7356
|
+
swarmName: this.params.swarmName,
|
|
7357
|
+
},
|
|
7358
|
+
clientId: this.params.clientId,
|
|
7359
|
+
});
|
|
7360
|
+
return result;
|
|
7361
|
+
}
|
|
7195
7362
|
/**
|
|
7196
7363
|
* Commits a system message to the agent’s history via the swarm’s agent (ClientAgent), logging via BusService.
|
|
7197
7364
|
* Supports system-level updates within the session, coordinated with ClientHistory.
|
|
@@ -7785,6 +7952,21 @@ class SessionConnectionService {
|
|
|
7785
7952
|
});
|
|
7786
7953
|
return await this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitSystemMessage(message);
|
|
7787
7954
|
};
|
|
7955
|
+
/**
|
|
7956
|
+
* Commits a tool request to the session’s history.
|
|
7957
|
+
* Delegates to ClientSession.commitToolRequest, using context from MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
7958
|
+
* Mirrors SessionPublicService’s commitToolRequest, supporting ClientAgent’s tool requests and HistoryPublicService integration.
|
|
7959
|
+
*
|
|
7960
|
+
* @param {IToolRequest[]} request - An array of tool requests to commit.
|
|
7961
|
+
* @returns {Promise<string[]>} A promise resolving when the tool requests are committed.
|
|
7962
|
+
*/
|
|
7963
|
+
this.commitToolRequest = async (request) => {
|
|
7964
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
7965
|
+
this.loggerService.info(`sessionConnectionService commitToolRequest`, {
|
|
7966
|
+
request,
|
|
7967
|
+
});
|
|
7968
|
+
return await this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).commitToolRequest(request);
|
|
7969
|
+
};
|
|
7788
7970
|
/**
|
|
7789
7971
|
* Commits an assistant message to the session’s history.
|
|
7790
7972
|
* Delegates to ClientSession.commitAssistantMessage, using context from MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -8069,6 +8251,39 @@ class AgentPublicService {
|
|
|
8069
8251
|
computeName: "",
|
|
8070
8252
|
});
|
|
8071
8253
|
};
|
|
8254
|
+
/**
|
|
8255
|
+
* Commits a tool request to the agent’s history.
|
|
8256
|
+
* Wraps AgentConnectionService.commitToolRequest with MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
8257
|
+
* Used for submitting tool requests, typically in scenarios where multiple tools are involved in agent operations.
|
|
8258
|
+
*
|
|
8259
|
+
* @param {IToolRequest[]} request - An array of tool requests to commit.
|
|
8260
|
+
* @param {string} methodName - The method name for context and logging.
|
|
8261
|
+
* @param {string} clientId - The client ID for session tracking.
|
|
8262
|
+
* @param {AgentName} agentName - The agent name for identification.
|
|
8263
|
+
* @returns {Promise<unknown>} A promise resolving to the commit result.
|
|
8264
|
+
*/
|
|
8265
|
+
this.commitToolRequest = async (request, methodName, clientId, agentName) => {
|
|
8266
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
8267
|
+
this.loggerService.info("agentPublicService commitToolRequest", {
|
|
8268
|
+
methodName,
|
|
8269
|
+
request,
|
|
8270
|
+
clientId,
|
|
8271
|
+
agentName,
|
|
8272
|
+
});
|
|
8273
|
+
return await MethodContextService.runInContext(async () => {
|
|
8274
|
+
return await this.agentConnectionService.commitToolRequest(request);
|
|
8275
|
+
}, {
|
|
8276
|
+
methodName,
|
|
8277
|
+
clientId,
|
|
8278
|
+
agentName,
|
|
8279
|
+
policyName: "",
|
|
8280
|
+
swarmName: "",
|
|
8281
|
+
storageName: "",
|
|
8282
|
+
stateName: "",
|
|
8283
|
+
mcpName: "",
|
|
8284
|
+
computeName: "",
|
|
8285
|
+
});
|
|
8286
|
+
};
|
|
8072
8287
|
/**
|
|
8073
8288
|
* Commits an assistant message to the agent’s history.
|
|
8074
8289
|
* Wraps AgentConnectionService.commitAssistantMessage with MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -8720,6 +8935,39 @@ class SessionPublicService {
|
|
|
8720
8935
|
computeName: "",
|
|
8721
8936
|
});
|
|
8722
8937
|
};
|
|
8938
|
+
/**
|
|
8939
|
+
* Commits a tool request to the session’s history.
|
|
8940
|
+
* Wraps SessionConnectionService.commitToolRequest with MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
8941
|
+
* Supports ClientAgent’s tool execution requests, mirrored in AgentPublicService.
|
|
8942
|
+
*
|
|
8943
|
+
* @param {IToolRequest[]} request - The array of tool requests to commit.
|
|
8944
|
+
* @param {string} methodName - The name of the method invoking the operation, used for logging and context.
|
|
8945
|
+
* @param {string} clientId - The client ID for session tracking.
|
|
8946
|
+
* @param {SwarmName} swarmName - The swarm name for context.
|
|
8947
|
+
* @returns {Promise<void>} A promise resolving when the tool request is committed.
|
|
8948
|
+
*/
|
|
8949
|
+
this.commitToolRequest = async (request, methodName, clientId, swarmName) => {
|
|
8950
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
8951
|
+
this.loggerService.info("sessionPublicService commitToolRequest", {
|
|
8952
|
+
methodName,
|
|
8953
|
+
request,
|
|
8954
|
+
clientId,
|
|
8955
|
+
swarmName,
|
|
8956
|
+
});
|
|
8957
|
+
return await MethodContextService.runInContext(async () => {
|
|
8958
|
+
return await this.sessionConnectionService.commitToolRequest(request);
|
|
8959
|
+
}, {
|
|
8960
|
+
methodName,
|
|
8961
|
+
clientId,
|
|
8962
|
+
swarmName,
|
|
8963
|
+
policyName: "",
|
|
8964
|
+
agentName: "",
|
|
8965
|
+
storageName: "",
|
|
8966
|
+
stateName: "",
|
|
8967
|
+
mcpName: "",
|
|
8968
|
+
computeName: "",
|
|
8969
|
+
});
|
|
8970
|
+
};
|
|
8723
8971
|
/**
|
|
8724
8972
|
* Commits an assistant message to the session’s history.
|
|
8725
8973
|
* Wraps SessionConnectionService.commitAssistantMessage with MethodContextService, logging via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -17422,7 +17670,7 @@ const swarm = {
|
|
|
17422
17670
|
init();
|
|
17423
17671
|
var swarm$1 = swarm;
|
|
17424
17672
|
|
|
17425
|
-
const METHOD_NAME$
|
|
17673
|
+
const METHOD_NAME$1g = "cli.dumpDocs";
|
|
17426
17674
|
/**
|
|
17427
17675
|
* Dumps the documentation for the agents and swarms.
|
|
17428
17676
|
*
|
|
@@ -17432,7 +17680,7 @@ const METHOD_NAME$1e = "cli.dumpDocs";
|
|
|
17432
17680
|
*/
|
|
17433
17681
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
17434
17682
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17435
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17683
|
+
swarm$1.loggerService.log(METHOD_NAME$1g, {
|
|
17436
17684
|
dirName,
|
|
17437
17685
|
});
|
|
17438
17686
|
if (PlantUML) {
|
|
@@ -17442,10 +17690,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17442
17690
|
}
|
|
17443
17691
|
swarm$1.agentValidationService
|
|
17444
17692
|
.getAgentList()
|
|
17445
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17693
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1g));
|
|
17446
17694
|
swarm$1.swarmValidationService
|
|
17447
17695
|
.getSwarmList()
|
|
17448
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17696
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1g));
|
|
17449
17697
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
17450
17698
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
17451
17699
|
if (!dependsOn) {
|
|
@@ -17455,7 +17703,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
17455
17703
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
17456
17704
|
});
|
|
17457
17705
|
|
|
17458
|
-
const METHOD_NAME$
|
|
17706
|
+
const METHOD_NAME$1f = "cli.dumpAgent";
|
|
17459
17707
|
/**
|
|
17460
17708
|
* Dumps the agent information into PlantUML format.
|
|
17461
17709
|
*
|
|
@@ -17464,14 +17712,14 @@ const METHOD_NAME$1d = "cli.dumpAgent";
|
|
|
17464
17712
|
*/
|
|
17465
17713
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
17466
17714
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17467
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17715
|
+
swarm$1.loggerService.log(METHOD_NAME$1f, {
|
|
17468
17716
|
agentName,
|
|
17469
17717
|
});
|
|
17470
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17718
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1f);
|
|
17471
17719
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
17472
17720
|
});
|
|
17473
17721
|
|
|
17474
|
-
const METHOD_NAME$
|
|
17722
|
+
const METHOD_NAME$1e = "cli.dumpSwarm";
|
|
17475
17723
|
/**
|
|
17476
17724
|
* Dumps the swarm information into PlantUML format.
|
|
17477
17725
|
*
|
|
@@ -17480,14 +17728,14 @@ const METHOD_NAME$1c = "cli.dumpSwarm";
|
|
|
17480
17728
|
*/
|
|
17481
17729
|
const dumpSwarm = beginContext((swarmName) => {
|
|
17482
17730
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17483
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17731
|
+
swarm$1.loggerService.log(METHOD_NAME$1e, {
|
|
17484
17732
|
swarmName,
|
|
17485
17733
|
});
|
|
17486
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17734
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1e);
|
|
17487
17735
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
17488
17736
|
});
|
|
17489
17737
|
|
|
17490
|
-
const METHOD_NAME$
|
|
17738
|
+
const METHOD_NAME$1d = "cli.dumpPerfomance";
|
|
17491
17739
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
17492
17740
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
17493
17741
|
/**
|
|
@@ -17506,7 +17754,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
17506
17754
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
17507
17755
|
*/
|
|
17508
17756
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
17509
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17757
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1d);
|
|
17510
17758
|
await dumpPerfomanceInternal(dirName);
|
|
17511
17759
|
};
|
|
17512
17760
|
/**
|
|
@@ -17564,7 +17812,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
17564
17812
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
17565
17813
|
});
|
|
17566
17814
|
|
|
17567
|
-
const METHOD_NAME$
|
|
17815
|
+
const METHOD_NAME$1c = "cli.dumpClientPerformance";
|
|
17568
17816
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
17569
17817
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
17570
17818
|
/**
|
|
@@ -17588,7 +17836,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
17588
17836
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
17589
17837
|
*/
|
|
17590
17838
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
17591
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17839
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1c);
|
|
17592
17840
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
17593
17841
|
};
|
|
17594
17842
|
/**
|
|
@@ -17609,7 +17857,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
17609
17857
|
});
|
|
17610
17858
|
|
|
17611
17859
|
/** @private Constant defining the method name for logging and validation context */
|
|
17612
|
-
const METHOD_NAME$
|
|
17860
|
+
const METHOD_NAME$1b = "function.commit.commitFlushForce";
|
|
17613
17861
|
/**
|
|
17614
17862
|
* Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
|
|
17615
17863
|
* Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
|
|
@@ -17627,20 +17875,20 @@ const METHOD_NAME$19 = "function.commit.commitFlushForce";
|
|
|
17627
17875
|
const commitFlushForce = beginContext(async (clientId) => {
|
|
17628
17876
|
// Log the flush attempt if enabled
|
|
17629
17877
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17630
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17878
|
+
swarm$1.loggerService.log(METHOD_NAME$1b, {
|
|
17631
17879
|
clientId,
|
|
17632
|
-
METHOD_NAME: METHOD_NAME$
|
|
17880
|
+
METHOD_NAME: METHOD_NAME$1b,
|
|
17633
17881
|
});
|
|
17634
17882
|
// Validate the session exists and retrieve the associated swarm
|
|
17635
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17883
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1b);
|
|
17636
17884
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17637
17885
|
// Validate the swarm configuration
|
|
17638
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17886
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1b);
|
|
17639
17887
|
// Commit the flush of agent history via SessionPublicService without agent checks
|
|
17640
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
17888
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$1b, clientId, swarmName);
|
|
17641
17889
|
});
|
|
17642
17890
|
|
|
17643
|
-
const METHOD_NAME$
|
|
17891
|
+
const METHOD_NAME$1a = "function.commit.commitToolOutputForce";
|
|
17644
17892
|
/**
|
|
17645
17893
|
* Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
|
|
17646
17894
|
*
|
|
@@ -17659,24 +17907,24 @@ const METHOD_NAME$18 = "function.commit.commitToolOutputForce";
|
|
|
17659
17907
|
const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
|
|
17660
17908
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17661
17909
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17662
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17910
|
+
swarm$1.loggerService.log(METHOD_NAME$1a, {
|
|
17663
17911
|
toolId,
|
|
17664
17912
|
content,
|
|
17665
17913
|
clientId,
|
|
17666
17914
|
});
|
|
17667
17915
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
17668
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17916
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1a);
|
|
17669
17917
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17670
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17918
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1a);
|
|
17671
17919
|
// Commit the tool output to the session via the session public service without checking the active agent
|
|
17672
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
17920
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$1a, clientId, swarmName);
|
|
17673
17921
|
});
|
|
17674
17922
|
|
|
17675
17923
|
/**
|
|
17676
17924
|
* @private Constant defining the method name for logging and validation purposes.
|
|
17677
17925
|
* Used as an identifier in log messages and validation checks to track calls to `hasNavigation`.
|
|
17678
17926
|
*/
|
|
17679
|
-
const METHOD_NAME$
|
|
17927
|
+
const METHOD_NAME$19 = "function.common.hasNavigation";
|
|
17680
17928
|
/**
|
|
17681
17929
|
* Checks if a specific agent is part of the navigation route for a given client.
|
|
17682
17930
|
* Validates the agent and client session, retrieves the associated swarm, and queries the navigation route.
|
|
@@ -17687,16 +17935,16 @@ const METHOD_NAME$17 = "function.common.hasNavigation";
|
|
|
17687
17935
|
*/
|
|
17688
17936
|
const hasNavigation = async (clientId, agentName) => {
|
|
17689
17937
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17690
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17691
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17692
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17938
|
+
swarm$1.loggerService.log(METHOD_NAME$19, { clientId });
|
|
17939
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$19);
|
|
17940
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$19);
|
|
17693
17941
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17694
17942
|
return swarm$1.navigationValidationService
|
|
17695
17943
|
.getNavigationRoute(clientId, swarmName)
|
|
17696
17944
|
.has(agentName);
|
|
17697
17945
|
};
|
|
17698
17946
|
|
|
17699
|
-
const METHOD_NAME$
|
|
17947
|
+
const METHOD_NAME$18 = "function.history.getRawHistory";
|
|
17700
17948
|
/**
|
|
17701
17949
|
* Retrieves the raw, unmodified history for a given client session.
|
|
17702
17950
|
*
|
|
@@ -17713,10 +17961,10 @@ const METHOD_NAME$16 = "function.history.getRawHistory";
|
|
|
17713
17961
|
* const rawHistory = await getRawHistory("client-123");
|
|
17714
17962
|
* console.log(rawHistory); // Outputs the full raw history array
|
|
17715
17963
|
*/
|
|
17716
|
-
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$
|
|
17964
|
+
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$18) => {
|
|
17717
17965
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17718
17966
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17719
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17967
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
17720
17968
|
clientId,
|
|
17721
17969
|
});
|
|
17722
17970
|
// Validate the session and swarm
|
|
@@ -17729,7 +17977,7 @@ const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$16)
|
|
|
17729
17977
|
return [...history];
|
|
17730
17978
|
});
|
|
17731
17979
|
|
|
17732
|
-
const METHOD_NAME$
|
|
17980
|
+
const METHOD_NAME$17 = "function.history.getLastUserMessage";
|
|
17733
17981
|
/**
|
|
17734
17982
|
* Retrieves the content of the most recent user message from a client's session history.
|
|
17735
17983
|
*
|
|
@@ -17747,18 +17995,18 @@ const METHOD_NAME$15 = "function.history.getLastUserMessage";
|
|
|
17747
17995
|
const getLastUserMessage = beginContext(async (clientId) => {
|
|
17748
17996
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17749
17997
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17750
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17998
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
17751
17999
|
clientId,
|
|
17752
18000
|
});
|
|
17753
18001
|
// Fetch raw history and find the last user message
|
|
17754
|
-
const history = await getRawHistory(clientId, METHOD_NAME$
|
|
18002
|
+
const history = await getRawHistory(clientId, METHOD_NAME$17);
|
|
17755
18003
|
const last = history.findLast(({ role, mode }) => role === "user" && mode === "user");
|
|
17756
18004
|
return last?.content ? last.content : null;
|
|
17757
18005
|
});
|
|
17758
18006
|
|
|
17759
18007
|
const disposeSubject = new functoolsKit.Subject();
|
|
17760
18008
|
|
|
17761
|
-
const METHOD_NAME$
|
|
18009
|
+
const METHOD_NAME$16 = "function.navigate.changeToDefaultAgent";
|
|
17762
18010
|
/**
|
|
17763
18011
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities for switching to the default agent.
|
|
17764
18012
|
*
|
|
@@ -17781,7 +18029,7 @@ const createChangeToDefaultAgent = functoolsKit.memoize(([clientId]) => `${clien
|
|
|
17781
18029
|
}));
|
|
17782
18030
|
{
|
|
17783
18031
|
// Dispose of the current agent's resources and set up the new default agent
|
|
17784
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18032
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$16, clientId, swarmName);
|
|
17785
18033
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17786
18034
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17787
18035
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17819,23 +18067,23 @@ const createGc$3 = functoolsKit.singleshot(async () => {
|
|
|
17819
18067
|
const changeToDefaultAgent = beginContext(async (clientId) => {
|
|
17820
18068
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17821
18069
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17822
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18070
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
17823
18071
|
clientId,
|
|
17824
18072
|
});
|
|
17825
18073
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17826
18074
|
const { defaultAgent: agentName } = swarm$1.swarmSchemaService.get(swarmName);
|
|
17827
18075
|
{
|
|
17828
18076
|
// Validate session and default agent
|
|
17829
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17830
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18077
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$16);
|
|
18078
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$16);
|
|
17831
18079
|
}
|
|
17832
18080
|
// Execute the agent change with TTL and queuing
|
|
17833
18081
|
const run = await createChangeToDefaultAgent(clientId);
|
|
17834
18082
|
createGc$3();
|
|
17835
|
-
return await run(METHOD_NAME$
|
|
18083
|
+
return await run(METHOD_NAME$16, agentName, swarmName);
|
|
17836
18084
|
});
|
|
17837
18085
|
|
|
17838
|
-
const METHOD_NAME$
|
|
18086
|
+
const METHOD_NAME$15 = "function.target.emitForce";
|
|
17839
18087
|
/**
|
|
17840
18088
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
17841
18089
|
*
|
|
@@ -17854,19 +18102,19 @@ const METHOD_NAME$13 = "function.target.emitForce";
|
|
|
17854
18102
|
const emitForce = beginContext(async (content, clientId) => {
|
|
17855
18103
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17856
18104
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17857
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18105
|
+
swarm$1.loggerService.log(METHOD_NAME$15, {
|
|
17858
18106
|
content,
|
|
17859
18107
|
clientId,
|
|
17860
18108
|
});
|
|
17861
18109
|
// Validate the session and swarm
|
|
17862
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18110
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$15);
|
|
17863
18111
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17864
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18112
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$15);
|
|
17865
18113
|
// Emit the content directly via the session public service
|
|
17866
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
18114
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$15, clientId, swarmName);
|
|
17867
18115
|
});
|
|
17868
18116
|
|
|
17869
|
-
const METHOD_NAME$
|
|
18117
|
+
const METHOD_NAME$14 = "function.target.executeForce";
|
|
17870
18118
|
/**
|
|
17871
18119
|
* 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.
|
|
17872
18120
|
*
|
|
@@ -17887,22 +18135,22 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17887
18135
|
const executionId = functoolsKit.randomString();
|
|
17888
18136
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17889
18137
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17890
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18138
|
+
swarm$1.loggerService.log(METHOD_NAME$14, {
|
|
17891
18139
|
content,
|
|
17892
18140
|
clientId,
|
|
17893
18141
|
executionId,
|
|
17894
18142
|
});
|
|
17895
18143
|
// Validate the session and swarm
|
|
17896
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18144
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$14);
|
|
17897
18145
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17898
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18146
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$14);
|
|
17899
18147
|
// Execute the command within an execution context with performance tracking
|
|
17900
18148
|
return ExecutionContextService.runInContext(async () => {
|
|
17901
18149
|
let isFinished = false;
|
|
17902
18150
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
17903
18151
|
try {
|
|
17904
18152
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
17905
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
18153
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$14, clientId, swarmName);
|
|
17906
18154
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
17907
18155
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
17908
18156
|
return result;
|
|
@@ -17919,7 +18167,7 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17919
18167
|
});
|
|
17920
18168
|
});
|
|
17921
18169
|
|
|
17922
|
-
const METHOD_NAME$
|
|
18170
|
+
const METHOD_NAME$13 = "function.template.navigateToTriageAgent";
|
|
17923
18171
|
/**
|
|
17924
18172
|
* Will send tool output directly to the model without any additions
|
|
17925
18173
|
*/
|
|
@@ -17970,7 +18218,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
17970
18218
|
*/
|
|
17971
18219
|
return beginContext(async (toolId, clientId) => {
|
|
17972
18220
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17973
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18221
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
17974
18222
|
clientId,
|
|
17975
18223
|
toolId,
|
|
17976
18224
|
});
|
|
@@ -18002,7 +18250,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
18002
18250
|
});
|
|
18003
18251
|
};
|
|
18004
18252
|
|
|
18005
|
-
const METHOD_NAME$
|
|
18253
|
+
const METHOD_NAME$12 = "function.navigate.changeToAgent";
|
|
18006
18254
|
/**
|
|
18007
18255
|
* Creates a change agent function with time-to-live (TTL) and queuing capabilities.
|
|
18008
18256
|
*
|
|
@@ -18026,7 +18274,7 @@ const createChangeToAgent = functoolsKit.memoize(([clientId]) => `${clientId}`,
|
|
|
18026
18274
|
}));
|
|
18027
18275
|
{
|
|
18028
18276
|
// Dispose of the current agent's resources and set up the new agent
|
|
18029
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18277
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$12, clientId, swarmName);
|
|
18030
18278
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
18031
18279
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
18032
18280
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -18065,16 +18313,16 @@ const createGc$2 = functoolsKit.singleshot(async () => {
|
|
|
18065
18313
|
const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
18066
18314
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18067
18315
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18068
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18316
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
18069
18317
|
agentName,
|
|
18070
18318
|
clientId,
|
|
18071
18319
|
});
|
|
18072
18320
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18073
18321
|
{
|
|
18074
18322
|
// Validate session, agent, and dependencies
|
|
18075
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18076
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18077
|
-
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18323
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
|
|
18324
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$12);
|
|
18325
|
+
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$12, clientId, swarmName);
|
|
18078
18326
|
if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
|
|
18079
18327
|
console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
|
|
18080
18328
|
}
|
|
@@ -18092,10 +18340,10 @@ const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
|
18092
18340
|
// Execute the agent change with TTL and queuing
|
|
18093
18341
|
const run = await createChangeToAgent(clientId);
|
|
18094
18342
|
createGc$2();
|
|
18095
|
-
return await run(METHOD_NAME$
|
|
18343
|
+
return await run(METHOD_NAME$12, agentName, swarmName);
|
|
18096
18344
|
});
|
|
18097
18345
|
|
|
18098
|
-
const METHOD_NAME
|
|
18346
|
+
const METHOD_NAME$11 = "function.template.navigateToAgent";
|
|
18099
18347
|
/**
|
|
18100
18348
|
* Will send tool output directly to the model without any additions
|
|
18101
18349
|
*/
|
|
@@ -18161,7 +18409,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
18161
18409
|
*/
|
|
18162
18410
|
return beginContext(async (toolId, clientId, agentName) => {
|
|
18163
18411
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18164
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
18412
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
18165
18413
|
clientId,
|
|
18166
18414
|
toolId,
|
|
18167
18415
|
});
|
|
@@ -18194,7 +18442,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
18194
18442
|
});
|
|
18195
18443
|
};
|
|
18196
18444
|
|
|
18197
|
-
const METHOD_NAME$
|
|
18445
|
+
const METHOD_NAME$10 = "function.setup.addTool";
|
|
18198
18446
|
/**
|
|
18199
18447
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
18200
18448
|
*
|
|
@@ -18216,7 +18464,7 @@ const METHOD_NAME$_ = "function.setup.addTool";
|
|
|
18216
18464
|
const addTool = beginContext((toolSchema) => {
|
|
18217
18465
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18218
18466
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18219
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18467
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
18220
18468
|
toolSchema,
|
|
18221
18469
|
});
|
|
18222
18470
|
// Register the tool in the validation and schema services
|
|
@@ -18230,7 +18478,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
18230
18478
|
* Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
|
|
18231
18479
|
* @module addAgentNavigation
|
|
18232
18480
|
*/
|
|
18233
|
-
const METHOD_NAME
|
|
18481
|
+
const METHOD_NAME$$ = "function.alias.addAgentNavigation";
|
|
18234
18482
|
const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
18235
18483
|
/**
|
|
18236
18484
|
* Creates and registers a navigation tool for an agent to navigate to another specified agent.
|
|
@@ -18244,7 +18492,7 @@ const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
|
18244
18492
|
* @returns {ReturnType<typeof addTool>} The result of adding the navigation tool.
|
|
18245
18493
|
*/
|
|
18246
18494
|
const addAgentNavigation = beginContext(({ toolName, docNote, description, navigateTo, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER$1, ...navigateProps }) => {
|
|
18247
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME
|
|
18495
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$$);
|
|
18248
18496
|
const navigate = createNavigateToAgent(navigateProps);
|
|
18249
18497
|
return addTool({
|
|
18250
18498
|
toolName,
|
|
@@ -18273,7 +18521,7 @@ const addAgentNavigation = beginContext(({ toolName, docNote, description, navig
|
|
|
18273
18521
|
* Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
|
|
18274
18522
|
* @module addTriageNavigation
|
|
18275
18523
|
*/
|
|
18276
|
-
const METHOD_NAME$
|
|
18524
|
+
const METHOD_NAME$_ = "function.alias.addTriageNavigation";
|
|
18277
18525
|
const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
18278
18526
|
/**
|
|
18279
18527
|
* Creates and registers a triage navigation tool for an agent to navigate to a triage agent.
|
|
@@ -18286,7 +18534,7 @@ const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
|
18286
18534
|
* @returns {ReturnType<typeof addTool>} The result of adding the triage navigation tool.
|
|
18287
18535
|
*/
|
|
18288
18536
|
const addTriageNavigation = beginContext(({ toolName, docNote, description, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER, ...navigateProps }) => {
|
|
18289
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
18537
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$_);
|
|
18290
18538
|
const navigate = createNavigateToTriageAgent(navigateProps);
|
|
18291
18539
|
return addTool({
|
|
18292
18540
|
toolName,
|
|
@@ -18312,7 +18560,7 @@ const addTriageNavigation = beginContext(({ toolName, docNote, description, skip
|
|
|
18312
18560
|
});
|
|
18313
18561
|
|
|
18314
18562
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
18315
|
-
const METHOD_NAME$
|
|
18563
|
+
const METHOD_NAME$Z = "function.setup.addWiki";
|
|
18316
18564
|
/**
|
|
18317
18565
|
* Adds a wiki schema to the system
|
|
18318
18566
|
* @function addWiki
|
|
@@ -18321,7 +18569,7 @@ const METHOD_NAME$X = "function.setup.addWiki";
|
|
|
18321
18569
|
*/
|
|
18322
18570
|
const addWiki = beginContext((wikiSchema) => {
|
|
18323
18571
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18324
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18572
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
18325
18573
|
wikiSchema,
|
|
18326
18574
|
});
|
|
18327
18575
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -18329,7 +18577,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
18329
18577
|
return wikiSchema.wikiName;
|
|
18330
18578
|
});
|
|
18331
18579
|
|
|
18332
|
-
const METHOD_NAME$
|
|
18580
|
+
const METHOD_NAME$Y = "function.setup.addAgent";
|
|
18333
18581
|
/**
|
|
18334
18582
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
18335
18583
|
*
|
|
@@ -18349,7 +18597,7 @@ const METHOD_NAME$W = "function.setup.addAgent";
|
|
|
18349
18597
|
const addAgent = beginContext((agentSchema) => {
|
|
18350
18598
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18351
18599
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18352
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18600
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
18353
18601
|
agentSchema,
|
|
18354
18602
|
});
|
|
18355
18603
|
// Register the agent in the validation and schema services
|
|
@@ -18359,7 +18607,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
18359
18607
|
return agentSchema.agentName;
|
|
18360
18608
|
});
|
|
18361
18609
|
|
|
18362
|
-
const METHOD_NAME$
|
|
18610
|
+
const METHOD_NAME$X = "function.setup.addCompletion";
|
|
18363
18611
|
/**
|
|
18364
18612
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
18365
18613
|
*
|
|
@@ -18379,7 +18627,7 @@ const METHOD_NAME$V = "function.setup.addCompletion";
|
|
|
18379
18627
|
const addCompletion = beginContext((completionSchema) => {
|
|
18380
18628
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18381
18629
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18382
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18630
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
18383
18631
|
completionSchema,
|
|
18384
18632
|
});
|
|
18385
18633
|
// Register the completion in the validation and schema services
|
|
@@ -18389,7 +18637,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
18389
18637
|
return completionSchema.completionName;
|
|
18390
18638
|
});
|
|
18391
18639
|
|
|
18392
|
-
const METHOD_NAME$
|
|
18640
|
+
const METHOD_NAME$W = "function.setup.addSwarm";
|
|
18393
18641
|
/**
|
|
18394
18642
|
* Adds a new swarm to the system for managing client sessions.
|
|
18395
18643
|
*
|
|
@@ -18409,7 +18657,7 @@ const METHOD_NAME$U = "function.setup.addSwarm";
|
|
|
18409
18657
|
const addSwarm = beginContext((swarmSchema) => {
|
|
18410
18658
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18411
18659
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18412
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18660
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
18413
18661
|
swarmSchema,
|
|
18414
18662
|
});
|
|
18415
18663
|
// Register the swarm in the validation and schema services
|
|
@@ -18419,7 +18667,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
18419
18667
|
return swarmSchema.swarmName;
|
|
18420
18668
|
});
|
|
18421
18669
|
|
|
18422
|
-
const METHOD_NAME$
|
|
18670
|
+
const METHOD_NAME$V = "function.setup.addMCP";
|
|
18423
18671
|
/**
|
|
18424
18672
|
* Registers a new MCP (Model Context Protocol) schema in the system.
|
|
18425
18673
|
* @param mcpSchema - The MCP schema to register.
|
|
@@ -18427,7 +18675,7 @@ const METHOD_NAME$T = "function.setup.addMCP";
|
|
|
18427
18675
|
*/
|
|
18428
18676
|
const addMCP = beginContext((mcpSchema) => {
|
|
18429
18677
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18430
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18678
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
18431
18679
|
mcpSchema,
|
|
18432
18680
|
});
|
|
18433
18681
|
swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
|
|
@@ -18435,7 +18683,7 @@ const addMCP = beginContext((mcpSchema) => {
|
|
|
18435
18683
|
return mcpSchema.mcpName;
|
|
18436
18684
|
});
|
|
18437
18685
|
|
|
18438
|
-
const METHOD_NAME$
|
|
18686
|
+
const METHOD_NAME$U = "function.setup.addState";
|
|
18439
18687
|
/**
|
|
18440
18688
|
* Adds a new state to the state registry for use within the swarm system.
|
|
18441
18689
|
*
|
|
@@ -18457,7 +18705,7 @@ const METHOD_NAME$S = "function.setup.addState";
|
|
|
18457
18705
|
const addState = beginContext((stateSchema) => {
|
|
18458
18706
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18459
18707
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18460
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18708
|
+
swarm$1.loggerService.log(METHOD_NAME$U, {
|
|
18461
18709
|
stateSchema,
|
|
18462
18710
|
});
|
|
18463
18711
|
// Register the policy with StateValidationService for runtime validation
|
|
@@ -18474,7 +18722,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
18474
18722
|
return stateSchema.stateName;
|
|
18475
18723
|
});
|
|
18476
18724
|
|
|
18477
|
-
const METHOD_NAME$
|
|
18725
|
+
const METHOD_NAME$T = "function.setup.addEmbedding";
|
|
18478
18726
|
/**
|
|
18479
18727
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
18480
18728
|
*
|
|
@@ -18494,7 +18742,7 @@ const METHOD_NAME$R = "function.setup.addEmbedding";
|
|
|
18494
18742
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
18495
18743
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18496
18744
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18497
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18745
|
+
swarm$1.loggerService.log(METHOD_NAME$T, {
|
|
18498
18746
|
embeddingSchema,
|
|
18499
18747
|
});
|
|
18500
18748
|
// Register the embedding in the validation and schema services
|
|
@@ -18504,7 +18752,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
18504
18752
|
return embeddingSchema.embeddingName;
|
|
18505
18753
|
});
|
|
18506
18754
|
|
|
18507
|
-
const METHOD_NAME$
|
|
18755
|
+
const METHOD_NAME$S = "function.setup.addStorage";
|
|
18508
18756
|
/**
|
|
18509
18757
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
18510
18758
|
*
|
|
@@ -18526,7 +18774,7 @@ const METHOD_NAME$Q = "function.setup.addStorage";
|
|
|
18526
18774
|
const addStorage = beginContext((storageSchema) => {
|
|
18527
18775
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18528
18776
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18529
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18777
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
18530
18778
|
storageSchema,
|
|
18531
18779
|
});
|
|
18532
18780
|
// Register the storage in the validation and schema services
|
|
@@ -18543,7 +18791,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
18543
18791
|
});
|
|
18544
18792
|
|
|
18545
18793
|
/** @private Constant defining the method name for logging and validation context */
|
|
18546
|
-
const METHOD_NAME$
|
|
18794
|
+
const METHOD_NAME$R = "function.setup.addPolicy";
|
|
18547
18795
|
/**
|
|
18548
18796
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
18549
18797
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -18559,7 +18807,7 @@ const METHOD_NAME$P = "function.setup.addPolicy";
|
|
|
18559
18807
|
const addPolicy = beginContext((policySchema) => {
|
|
18560
18808
|
// Log the policy addition attempt if enabled
|
|
18561
18809
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18562
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18810
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
18563
18811
|
policySchema,
|
|
18564
18812
|
});
|
|
18565
18813
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -18600,7 +18848,7 @@ const addCompute = beginContext((computeSchema) => {
|
|
|
18600
18848
|
* @description Method name for the addPipeline operation.
|
|
18601
18849
|
* @private
|
|
18602
18850
|
*/
|
|
18603
|
-
const METHOD_NAME$
|
|
18851
|
+
const METHOD_NAME$Q = "function.setup.addPipeline";
|
|
18604
18852
|
/**
|
|
18605
18853
|
* @function addPipeline
|
|
18606
18854
|
* @description Registers a pipeline schema, validates it, and adds it to the pipeline schema service.
|
|
@@ -18610,7 +18858,7 @@ const METHOD_NAME$O = "function.setup.addPipeline";
|
|
|
18610
18858
|
*/
|
|
18611
18859
|
const addPipeline = beginContext((pipelineSchema) => {
|
|
18612
18860
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18613
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18861
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
18614
18862
|
pipelineSchema,
|
|
18615
18863
|
});
|
|
18616
18864
|
swarm$1.pipelineValidationService.addPipeline(pipelineSchema.pipelineName, pipelineSchema);
|
|
@@ -18618,7 +18866,7 @@ const addPipeline = beginContext((pipelineSchema) => {
|
|
|
18618
18866
|
return pipelineSchema.pipelineName;
|
|
18619
18867
|
});
|
|
18620
18868
|
|
|
18621
|
-
const METHOD_NAME$
|
|
18869
|
+
const METHOD_NAME$P = "function.test.overrideAgent";
|
|
18622
18870
|
/**
|
|
18623
18871
|
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
18624
18872
|
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
@@ -18642,14 +18890,14 @@ const METHOD_NAME$N = "function.test.overrideAgent";
|
|
|
18642
18890
|
*/
|
|
18643
18891
|
const overrideAgent = beginContext((agentSchema) => {
|
|
18644
18892
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18645
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18893
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
18646
18894
|
agentSchema,
|
|
18647
18895
|
});
|
|
18648
18896
|
swarm$1.agentSchemaService.get(agentSchema.agentName);
|
|
18649
18897
|
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
18650
18898
|
});
|
|
18651
18899
|
|
|
18652
|
-
const METHOD_NAME$
|
|
18900
|
+
const METHOD_NAME$O = "function.test.overrideCompletion";
|
|
18653
18901
|
/**
|
|
18654
18902
|
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
18655
18903
|
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
@@ -18673,13 +18921,13 @@ const METHOD_NAME$M = "function.test.overrideCompletion";
|
|
|
18673
18921
|
*/
|
|
18674
18922
|
const overrideCompletion = beginContext((completionSchema) => {
|
|
18675
18923
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18676
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18924
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
18677
18925
|
completionSchema,
|
|
18678
18926
|
});
|
|
18679
18927
|
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
18680
18928
|
});
|
|
18681
18929
|
|
|
18682
|
-
const METHOD_NAME$
|
|
18930
|
+
const METHOD_NAME$N = "function.test.overrideEmbeding";
|
|
18683
18931
|
/**
|
|
18684
18932
|
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
18685
18933
|
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
@@ -18705,13 +18953,13 @@ const METHOD_NAME$L = "function.test.overrideEmbeding";
|
|
|
18705
18953
|
*/
|
|
18706
18954
|
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
18707
18955
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18708
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18956
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
18709
18957
|
embeddingSchema,
|
|
18710
18958
|
});
|
|
18711
18959
|
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
18712
18960
|
});
|
|
18713
18961
|
|
|
18714
|
-
const METHOD_NAME$
|
|
18962
|
+
const METHOD_NAME$M = "function.test.overridePolicy";
|
|
18715
18963
|
/**
|
|
18716
18964
|
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
18717
18965
|
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
@@ -18735,13 +18983,13 @@ const METHOD_NAME$K = "function.test.overridePolicy";
|
|
|
18735
18983
|
*/
|
|
18736
18984
|
const overridePolicy = beginContext((policySchema) => {
|
|
18737
18985
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18738
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18986
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
18739
18987
|
policySchema,
|
|
18740
18988
|
});
|
|
18741
18989
|
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
18742
18990
|
});
|
|
18743
18991
|
|
|
18744
|
-
const METHOD_NAME$
|
|
18992
|
+
const METHOD_NAME$L = "function.test.overrideState";
|
|
18745
18993
|
/**
|
|
18746
18994
|
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
18747
18995
|
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
@@ -18766,13 +19014,13 @@ const METHOD_NAME$J = "function.test.overrideState";
|
|
|
18766
19014
|
*/
|
|
18767
19015
|
const overrideState = beginContext((stateSchema) => {
|
|
18768
19016
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18769
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19017
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
18770
19018
|
stateSchema,
|
|
18771
19019
|
});
|
|
18772
19020
|
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
18773
19021
|
});
|
|
18774
19022
|
|
|
18775
|
-
const METHOD_NAME$
|
|
19023
|
+
const METHOD_NAME$K = "function.test.overrideStorage";
|
|
18776
19024
|
/**
|
|
18777
19025
|
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
18778
19026
|
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
@@ -18798,13 +19046,13 @@ const METHOD_NAME$I = "function.test.overrideStorage";
|
|
|
18798
19046
|
*/
|
|
18799
19047
|
const overrideStorage = beginContext((storageSchema) => {
|
|
18800
19048
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18801
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19049
|
+
swarm$1.loggerService.log(METHOD_NAME$K, {
|
|
18802
19050
|
storageSchema,
|
|
18803
19051
|
});
|
|
18804
19052
|
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
18805
19053
|
});
|
|
18806
19054
|
|
|
18807
|
-
const METHOD_NAME$
|
|
19055
|
+
const METHOD_NAME$J = "function.test.overrideSwarm";
|
|
18808
19056
|
/**
|
|
18809
19057
|
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
18810
19058
|
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
@@ -18828,13 +19076,13 @@ const METHOD_NAME$H = "function.test.overrideSwarm";
|
|
|
18828
19076
|
*/
|
|
18829
19077
|
const overrideSwarm = beginContext((swarmSchema) => {
|
|
18830
19078
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18831
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19079
|
+
swarm$1.loggerService.log(METHOD_NAME$J, {
|
|
18832
19080
|
swarmSchema,
|
|
18833
19081
|
});
|
|
18834
19082
|
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
18835
19083
|
});
|
|
18836
19084
|
|
|
18837
|
-
const METHOD_NAME$
|
|
19085
|
+
const METHOD_NAME$I = "function.test.overrideTool";
|
|
18838
19086
|
/**
|
|
18839
19087
|
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
18840
19088
|
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
@@ -18858,13 +19106,13 @@ const METHOD_NAME$G = "function.test.overrideTool";
|
|
|
18858
19106
|
*/
|
|
18859
19107
|
const overrideTool = beginContext((toolSchema) => {
|
|
18860
19108
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18861
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19109
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
18862
19110
|
toolSchema,
|
|
18863
19111
|
});
|
|
18864
19112
|
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
18865
19113
|
});
|
|
18866
19114
|
|
|
18867
|
-
const METHOD_NAME$
|
|
19115
|
+
const METHOD_NAME$H = "function.test.overrideMCP";
|
|
18868
19116
|
/**
|
|
18869
19117
|
* Overrides an existing MCP (Model Context Protocol) schema with a new or partial schema.
|
|
18870
19118
|
* @param mcpSchema - The MCP schema containing the name and optional properties to override.
|
|
@@ -18872,13 +19120,13 @@ const METHOD_NAME$F = "function.test.overrideMCP";
|
|
|
18872
19120
|
*/
|
|
18873
19121
|
const overrideMCP = beginContext((mcpSchema) => {
|
|
18874
19122
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18875
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19123
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
18876
19124
|
mcpSchema,
|
|
18877
19125
|
});
|
|
18878
19126
|
return swarm$1.mcpSchemaService.override(mcpSchema.mcpName, mcpSchema);
|
|
18879
19127
|
});
|
|
18880
19128
|
|
|
18881
|
-
const METHOD_NAME$
|
|
19129
|
+
const METHOD_NAME$G = "function.test.overrideWiki";
|
|
18882
19130
|
/**
|
|
18883
19131
|
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
18884
19132
|
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
@@ -18902,7 +19150,7 @@ const METHOD_NAME$E = "function.test.overrideWiki";
|
|
|
18902
19150
|
*/
|
|
18903
19151
|
const overrideWiki = beginContext((wikiSchema) => {
|
|
18904
19152
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18905
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19153
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
18906
19154
|
wikiSchema,
|
|
18907
19155
|
});
|
|
18908
19156
|
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
@@ -18917,7 +19165,7 @@ const overrideWiki = beginContext((wikiSchema) => {
|
|
|
18917
19165
|
* @description Method name for the overrideCompute operation.
|
|
18918
19166
|
* @private
|
|
18919
19167
|
*/
|
|
18920
|
-
const METHOD_NAME$
|
|
19168
|
+
const METHOD_NAME$F = "function.test.overrideCompute";
|
|
18921
19169
|
/**
|
|
18922
19170
|
* @function overrideCompute
|
|
18923
19171
|
* @description Overrides an existing compute schema with provided partial updates.
|
|
@@ -18926,7 +19174,7 @@ const METHOD_NAME$D = "function.test.overrideCompute";
|
|
|
18926
19174
|
*/
|
|
18927
19175
|
const overrideCompute = beginContext((computeSchema) => {
|
|
18928
19176
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18929
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19177
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {
|
|
18930
19178
|
computeSchema,
|
|
18931
19179
|
});
|
|
18932
19180
|
return swarm$1.computeSchemaService.override(computeSchema.computeName, computeSchema);
|
|
@@ -18941,7 +19189,7 @@ const overrideCompute = beginContext((computeSchema) => {
|
|
|
18941
19189
|
* @description Method name for the overridePipeline operation.
|
|
18942
19190
|
* @private
|
|
18943
19191
|
*/
|
|
18944
|
-
const METHOD_NAME$
|
|
19192
|
+
const METHOD_NAME$E = "function.test.overridePipeline";
|
|
18945
19193
|
/**
|
|
18946
19194
|
* @function overridePipeline
|
|
18947
19195
|
* @description Overrides an existing pipeline schema with provided partial updates.
|
|
@@ -18951,13 +19199,13 @@ const METHOD_NAME$C = "function.test.overridePipeline";
|
|
|
18951
19199
|
*/
|
|
18952
19200
|
const overridePipeline = beginContext((pipelineSchema) => {
|
|
18953
19201
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18954
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19202
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {
|
|
18955
19203
|
pipelineSchema,
|
|
18956
19204
|
});
|
|
18957
19205
|
return swarm$1.pipelineSchemaService.override(pipelineSchema.pipelineName, pipelineSchema);
|
|
18958
19206
|
});
|
|
18959
19207
|
|
|
18960
|
-
const METHOD_NAME$
|
|
19208
|
+
const METHOD_NAME$D = "function.other.markOnline";
|
|
18961
19209
|
/**
|
|
18962
19210
|
* Marks a client as online in the specified swarm.
|
|
18963
19211
|
*
|
|
@@ -18969,16 +19217,16 @@ const METHOD_NAME$B = "function.other.markOnline";
|
|
|
18969
19217
|
const markOnline = async (clientId, swarmName) => {
|
|
18970
19218
|
// Log the operation if logging is enabled in the global configuration
|
|
18971
19219
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18972
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
19220
|
+
swarm.loggerService.log(METHOD_NAME$D, {
|
|
18973
19221
|
clientId,
|
|
18974
19222
|
});
|
|
18975
19223
|
// Validate the swarm name
|
|
18976
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19224
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$D);
|
|
18977
19225
|
// Run the operation in the method context
|
|
18978
19226
|
return await MethodContextService.runInContext(async () => {
|
|
18979
|
-
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$
|
|
19227
|
+
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$D);
|
|
18980
19228
|
}, {
|
|
18981
|
-
methodName: METHOD_NAME$
|
|
19229
|
+
methodName: METHOD_NAME$D,
|
|
18982
19230
|
agentName: "",
|
|
18983
19231
|
policyName: "",
|
|
18984
19232
|
stateName: "",
|
|
@@ -18990,7 +19238,7 @@ const markOnline = async (clientId, swarmName) => {
|
|
|
18990
19238
|
});
|
|
18991
19239
|
};
|
|
18992
19240
|
|
|
18993
|
-
const METHOD_NAME$
|
|
19241
|
+
const METHOD_NAME$C = "function.other.markOffline";
|
|
18994
19242
|
/**
|
|
18995
19243
|
* Marks a client as offline in the specified swarm.
|
|
18996
19244
|
*
|
|
@@ -19005,14 +19253,14 @@ const METHOD_NAME$A = "function.other.markOffline";
|
|
|
19005
19253
|
*/
|
|
19006
19254
|
const markOffline = async (clientId, swarmName) => {
|
|
19007
19255
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19008
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
19256
|
+
swarm.loggerService.log(METHOD_NAME$C, {
|
|
19009
19257
|
clientId,
|
|
19010
19258
|
});
|
|
19011
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19259
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$C);
|
|
19012
19260
|
return await MethodContextService.runInContext(async () => {
|
|
19013
|
-
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$
|
|
19261
|
+
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$C);
|
|
19014
19262
|
}, {
|
|
19015
|
-
methodName: METHOD_NAME$
|
|
19263
|
+
methodName: METHOD_NAME$C,
|
|
19016
19264
|
agentName: "",
|
|
19017
19265
|
policyName: "",
|
|
19018
19266
|
stateName: "",
|
|
@@ -19025,7 +19273,7 @@ const markOffline = async (clientId, swarmName) => {
|
|
|
19025
19273
|
};
|
|
19026
19274
|
|
|
19027
19275
|
/** @private Constant defining the method name for logging and validation context */
|
|
19028
|
-
const METHOD_NAME$
|
|
19276
|
+
const METHOD_NAME$B = "function.commit.commitSystemMessage";
|
|
19029
19277
|
/**
|
|
19030
19278
|
* Commits a system-generated message to the active agent in the swarm system.
|
|
19031
19279
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -19044,20 +19292,20 @@ const METHOD_NAME$z = "function.commit.commitSystemMessage";
|
|
|
19044
19292
|
const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
|
|
19045
19293
|
// Log the commit attempt if enabled
|
|
19046
19294
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19047
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19295
|
+
swarm$1.loggerService.log(METHOD_NAME$B, {
|
|
19048
19296
|
content,
|
|
19049
19297
|
clientId,
|
|
19050
19298
|
agentName,
|
|
19051
19299
|
});
|
|
19052
19300
|
// Validate the agent exists
|
|
19053
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19301
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
|
|
19054
19302
|
// Validate the session exists and retrieve the associated swarm
|
|
19055
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19303
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
|
|
19056
19304
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19057
19305
|
// Validate the swarm configuration
|
|
19058
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19306
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
|
|
19059
19307
|
// Check if the current agent matches the provided agent
|
|
19060
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19308
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName);
|
|
19061
19309
|
if (currentAgentName !== agentName) {
|
|
19062
19310
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19063
19311
|
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
@@ -19068,10 +19316,10 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
|
|
|
19068
19316
|
return;
|
|
19069
19317
|
}
|
|
19070
19318
|
// Commit the system message via SessionPublicService
|
|
19071
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19319
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$B, clientId, swarmName);
|
|
19072
19320
|
});
|
|
19073
19321
|
|
|
19074
|
-
const METHOD_NAME$
|
|
19322
|
+
const METHOD_NAME$A = "function.commit.commitSystemMessage";
|
|
19075
19323
|
/**
|
|
19076
19324
|
* Commits a user message to the active agent's history in a swarm session without triggering a response.
|
|
19077
19325
|
*
|
|
@@ -19090,19 +19338,19 @@ const METHOD_NAME$y = "function.commit.commitSystemMessage";
|
|
|
19090
19338
|
const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
|
|
19091
19339
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19092
19340
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19093
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19341
|
+
swarm$1.loggerService.log(METHOD_NAME$A, {
|
|
19094
19342
|
content,
|
|
19095
19343
|
clientId,
|
|
19096
19344
|
agentName,
|
|
19097
19345
|
mode,
|
|
19098
19346
|
});
|
|
19099
19347
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
19100
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19101
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19348
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$A);
|
|
19349
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
|
|
19102
19350
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19103
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19351
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
|
|
19104
19352
|
// Check if the specified agent is still the active agent in the swarm session
|
|
19105
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19353
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$A, clientId, swarmName);
|
|
19106
19354
|
if (currentAgentName !== agentName) {
|
|
19107
19355
|
// Log a skip message if the agent has changed during the operation
|
|
19108
19356
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -19115,18 +19363,18 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
|
|
|
19115
19363
|
}
|
|
19116
19364
|
if (payload) {
|
|
19117
19365
|
return await PayloadContextService.runInContext(async () => {
|
|
19118
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19366
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$A, clientId, swarmName);
|
|
19119
19367
|
}, {
|
|
19120
19368
|
clientId,
|
|
19121
19369
|
payload,
|
|
19122
19370
|
});
|
|
19123
19371
|
}
|
|
19124
19372
|
// Commit the user message to the agent's history via the session public service
|
|
19125
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19373
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$A, clientId, swarmName);
|
|
19126
19374
|
});
|
|
19127
19375
|
|
|
19128
19376
|
/** @private Constant defining the method name for logging and validation context */
|
|
19129
|
-
const METHOD_NAME$
|
|
19377
|
+
const METHOD_NAME$z = "function.commit.commitSystemMessageForce";
|
|
19130
19378
|
/**
|
|
19131
19379
|
* Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
|
|
19132
19380
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -19145,20 +19393,20 @@ const METHOD_NAME$x = "function.commit.commitSystemMessageForce";
|
|
|
19145
19393
|
const commitSystemMessageForce = beginContext(async (content, clientId) => {
|
|
19146
19394
|
// Log the commit attempt if enabled
|
|
19147
19395
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19148
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19396
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
19149
19397
|
content,
|
|
19150
19398
|
clientId,
|
|
19151
19399
|
});
|
|
19152
19400
|
// Validate the session exists and retrieve the associated swarm
|
|
19153
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19401
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
|
|
19154
19402
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19155
19403
|
// Validate the swarm configuration
|
|
19156
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19404
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
|
|
19157
19405
|
// Commit the system message via SessionPublicService without agent checks
|
|
19158
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
19406
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$z, clientId, swarmName);
|
|
19159
19407
|
});
|
|
19160
19408
|
|
|
19161
|
-
const METHOD_NAME$
|
|
19409
|
+
const METHOD_NAME$y = "function.commit.commitSystemMessage";
|
|
19162
19410
|
/**
|
|
19163
19411
|
* Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
|
|
19164
19412
|
*
|
|
@@ -19176,29 +19424,29 @@ const METHOD_NAME$w = "function.commit.commitSystemMessage";
|
|
|
19176
19424
|
const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
|
|
19177
19425
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
19178
19426
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19179
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19427
|
+
swarm$1.loggerService.log(METHOD_NAME$y, {
|
|
19180
19428
|
content,
|
|
19181
19429
|
clientId,
|
|
19182
19430
|
mode,
|
|
19183
19431
|
});
|
|
19184
19432
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
19185
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19433
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
|
|
19186
19434
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19187
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19435
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
|
|
19188
19436
|
if (payload) {
|
|
19189
19437
|
return await PayloadContextService.runInContext(async () => {
|
|
19190
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19438
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
|
|
19191
19439
|
}, {
|
|
19192
19440
|
clientId,
|
|
19193
19441
|
payload,
|
|
19194
19442
|
});
|
|
19195
19443
|
}
|
|
19196
19444
|
// Commit the user message to the agent's history via the session public service without checking the active agent
|
|
19197
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
19445
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$y, clientId, swarmName);
|
|
19198
19446
|
});
|
|
19199
19447
|
|
|
19200
19448
|
/** @private Constant defining the method name for logging and validation context */
|
|
19201
|
-
const METHOD_NAME$
|
|
19449
|
+
const METHOD_NAME$x = "function.commit.commitAssistantMessage";
|
|
19202
19450
|
/**
|
|
19203
19451
|
* Commits an assistant-generated message to the active agent in the swarm system.
|
|
19204
19452
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -19216,20 +19464,20 @@ const METHOD_NAME$v = "function.commit.commitAssistantMessage";
|
|
|
19216
19464
|
const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
|
|
19217
19465
|
// Log the commit attempt if enabled
|
|
19218
19466
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19219
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19467
|
+
swarm$1.loggerService.log(METHOD_NAME$x, {
|
|
19220
19468
|
content,
|
|
19221
19469
|
clientId,
|
|
19222
19470
|
agentName,
|
|
19223
19471
|
});
|
|
19224
19472
|
// Validate the agent exists
|
|
19225
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19473
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$x);
|
|
19226
19474
|
// Validate the session exists and retrieve the associated swarm
|
|
19227
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19475
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
|
|
19228
19476
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19229
19477
|
// Validate the swarm configuration
|
|
19230
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19478
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
|
|
19231
19479
|
// Check if the current agent matches the provided agent
|
|
19232
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19480
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$x, clientId, swarmName);
|
|
19233
19481
|
if (currentAgentName !== agentName) {
|
|
19234
19482
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19235
19483
|
swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
|
|
@@ -19240,11 +19488,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
|
|
|
19240
19488
|
return;
|
|
19241
19489
|
}
|
|
19242
19490
|
// Commit the assistant message via SessionPublicService
|
|
19243
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19491
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$x, clientId, swarmName);
|
|
19244
19492
|
});
|
|
19245
19493
|
|
|
19246
19494
|
/** @private Constant defining the method name for logging and validation context */
|
|
19247
|
-
const METHOD_NAME$
|
|
19495
|
+
const METHOD_NAME$w = "function.commit.commitAssistantMessageForce";
|
|
19248
19496
|
/**
|
|
19249
19497
|
* Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
|
|
19250
19498
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -19263,21 +19511,21 @@ const METHOD_NAME$u = "function.commit.commitAssistantMessageForce";
|
|
|
19263
19511
|
const commitAssistantMessageForce = beginContext(async (content, clientId) => {
|
|
19264
19512
|
// Log the commit attempt if enabled
|
|
19265
19513
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19266
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19514
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
19267
19515
|
content,
|
|
19268
19516
|
clientId,
|
|
19269
19517
|
});
|
|
19270
19518
|
// Validate the session exists and retrieve the associated swarm
|
|
19271
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19519
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
|
|
19272
19520
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19273
19521
|
// Validate the swarm configuration
|
|
19274
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19522
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
|
|
19275
19523
|
// Commit the assistant message via SessionPublicService without agent checks
|
|
19276
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
19524
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName);
|
|
19277
19525
|
});
|
|
19278
19526
|
|
|
19279
19527
|
/** @private Constant defining the method name for logging and validation context */
|
|
19280
|
-
const METHOD_NAME$
|
|
19528
|
+
const METHOD_NAME$v = "function.commit.cancelOutput";
|
|
19281
19529
|
/**
|
|
19282
19530
|
* Cancels the awaited output for a specific client and agent by emitting an empty string.
|
|
19283
19531
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
|
|
@@ -19293,19 +19541,19 @@ const METHOD_NAME$t = "function.commit.cancelOutput";
|
|
|
19293
19541
|
const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
19294
19542
|
// Log the cancellation attempt if enabled
|
|
19295
19543
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19296
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19544
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
19297
19545
|
clientId,
|
|
19298
19546
|
agentName,
|
|
19299
19547
|
});
|
|
19300
19548
|
// Validate the agent exists
|
|
19301
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
19549
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
|
|
19302
19550
|
// Validate the session exists and retrieve the associated swarm
|
|
19303
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19551
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
19304
19552
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19305
19553
|
// Validate the swarm configuration
|
|
19306
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19554
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
19307
19555
|
// Check if the current agent matches the provided agent
|
|
19308
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
19556
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
|
|
19309
19557
|
if (currentAgentName !== agentName) {
|
|
19310
19558
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19311
19559
|
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
@@ -19316,11 +19564,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
|
19316
19564
|
return;
|
|
19317
19565
|
}
|
|
19318
19566
|
// Perform the output cancellation via SwarmPublicService
|
|
19319
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
19567
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$v, clientId, swarmName);
|
|
19320
19568
|
});
|
|
19321
19569
|
|
|
19322
19570
|
/** @private Constant defining the method name for logging and validation context */
|
|
19323
|
-
const METHOD_NAME$
|
|
19571
|
+
const METHOD_NAME$u = "function.commit.cancelOutputForce";
|
|
19324
19572
|
/**
|
|
19325
19573
|
* Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
|
|
19326
19574
|
* Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
|
|
@@ -19337,20 +19585,20 @@ const METHOD_NAME$s = "function.commit.cancelOutputForce";
|
|
|
19337
19585
|
const cancelOutputForce = beginContext(async (clientId) => {
|
|
19338
19586
|
// Log the cancellation attempt if enabled
|
|
19339
19587
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19340
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19588
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
19341
19589
|
clientId,
|
|
19342
19590
|
});
|
|
19343
19591
|
// Validate the session exists and retrieve the associated swarm
|
|
19344
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19592
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
19345
19593
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19346
19594
|
// Validate the swarm configuration
|
|
19347
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19595
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
19348
19596
|
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
19349
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
19597
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName);
|
|
19350
19598
|
});
|
|
19351
19599
|
|
|
19352
19600
|
/** @private Constant defining the method name for logging and validation context */
|
|
19353
|
-
const METHOD_NAME$
|
|
19601
|
+
const METHOD_NAME$t = "function.commit.commitStopToolsForce";
|
|
19354
19602
|
/**
|
|
19355
19603
|
* Forcefully prevents the next tool from being executed for a specific client in the swarm system, without checking the active agent.
|
|
19356
19604
|
* Validates the session and swarm, then proceeds with stopping tool execution regardless of the current agent state.
|
|
@@ -19368,17 +19616,82 @@ const METHOD_NAME$r = "function.commit.commitStopToolsForce";
|
|
|
19368
19616
|
const commitStopToolsForce = beginContext(async (clientId) => {
|
|
19369
19617
|
// Log the stop tools attempt if enabled
|
|
19370
19618
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19371
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
19619
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
19372
19620
|
clientId,
|
|
19373
|
-
METHOD_NAME: METHOD_NAME$
|
|
19621
|
+
METHOD_NAME: METHOD_NAME$t,
|
|
19374
19622
|
});
|
|
19375
19623
|
// Validate the session exists and retrieve the associated swarm
|
|
19376
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
19624
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
19377
19625
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19378
19626
|
// Validate the swarm configuration
|
|
19379
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
19627
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
19380
19628
|
// Commit the stop of the next tool execution via SessionPublicService without agent checks
|
|
19381
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
19629
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$t, clientId, swarmName);
|
|
19630
|
+
});
|
|
19631
|
+
|
|
19632
|
+
const METHOD_NAME$s = "function.commit.commitToolRequest";
|
|
19633
|
+
/**
|
|
19634
|
+
* Commits a tool request to the active agent in the swarm system.
|
|
19635
|
+
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the request.
|
|
19636
|
+
* Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
|
|
19637
|
+
* Integrates with AgentValidationService (agent validation), SessionValidationService (session and swarm retrieval),
|
|
19638
|
+
* SwarmValidationService (swarm validation), SwarmPublicService (agent retrieval), SessionPublicService (tool request committing),
|
|
19639
|
+
* and LoggerService (logging). Complements functions like commitSystemMessage by handling tool requests rather than system messages.
|
|
19640
|
+
*
|
|
19641
|
+
* @param {IToolRequest | IToolRequest[]} request - The tool request(s) to commit, either as a single request or an array of requests.
|
|
19642
|
+
* @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
|
|
19643
|
+
* @param {string} agentName - The name of the agent to commit the request for, validated against registered agents.
|
|
19644
|
+
* @returns {Promise<string[] | null>} A promise that resolves with an array of results if the request is committed, or `null` if skipped (e.g., agent mismatch).
|
|
19645
|
+
* @throws {Error} If agent, session, or swarm validation fails, propagated from respective validation services.
|
|
19646
|
+
*/
|
|
19647
|
+
const commitToolRequest = beginContext(async (request, clientId, agentName) => {
|
|
19648
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19649
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
19650
|
+
request,
|
|
19651
|
+
clientId,
|
|
19652
|
+
agentName,
|
|
19653
|
+
});
|
|
19654
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
|
|
19655
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
19656
|
+
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19657
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
|
|
19658
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$s, clientId, swarmName);
|
|
19659
|
+
if (currentAgentName !== agentName) {
|
|
19660
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19661
|
+
swarm$1.loggerService.log('function "commitToolRequest" skipped due to the agent change', {
|
|
19662
|
+
currentAgentName,
|
|
19663
|
+
agentName,
|
|
19664
|
+
clientId,
|
|
19665
|
+
});
|
|
19666
|
+
return null;
|
|
19667
|
+
}
|
|
19668
|
+
return await swarm$1.sessionPublicService.commitToolRequest(Array.isArray(request) ? request : [request], METHOD_NAME$s, clientId, swarmName);
|
|
19669
|
+
});
|
|
19670
|
+
|
|
19671
|
+
const METHOD_NAME$r = "function.commit.commitToolRequestForce";
|
|
19672
|
+
/**
|
|
19673
|
+
* Forcefully commits a tool request to the active agent in the swarm system.
|
|
19674
|
+
* Validates the session and swarm, bypassing agent validation to directly commit the request.
|
|
19675
|
+
* Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
|
|
19676
|
+
* Integrates with SessionValidationService (session and swarm retrieval), SwarmValidationService (swarm validation),
|
|
19677
|
+
* SessionPublicService (tool request committing), and LoggerService (logging).
|
|
19678
|
+
* Complements functions like commitToolRequest by skipping agent validation for direct tool request commits.
|
|
19679
|
+
*
|
|
19680
|
+
* @param {IToolRequest | IToolRequest[]} request - The tool request(s) to commit, either as a single request or an array of requests.
|
|
19681
|
+
* @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
|
|
19682
|
+
* @returns {Promise<string[]>} A promise that resolves with an array of results if the request is committed.
|
|
19683
|
+
* @throws {Error} If session or swarm validation fails, propagated from respective validation services.
|
|
19684
|
+
*/
|
|
19685
|
+
const commitToolRequestForce = beginContext(async (request, clientId) => {
|
|
19686
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
19687
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
19688
|
+
request,
|
|
19689
|
+
clientId,
|
|
19690
|
+
});
|
|
19691
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
|
|
19692
|
+
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
19693
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
|
|
19694
|
+
return await swarm$1.sessionPublicService.commitToolRequest(Array.isArray(request) ? request : [request], METHOD_NAME$r, clientId, swarmName);
|
|
19382
19695
|
});
|
|
19383
19696
|
|
|
19384
19697
|
/** @constant {string} METHOD_NAME - The name of the method used for logging and validation */
|
|
@@ -23246,6 +23559,8 @@ exports.commitSystemMessage = commitSystemMessage;
|
|
|
23246
23559
|
exports.commitSystemMessageForce = commitSystemMessageForce;
|
|
23247
23560
|
exports.commitToolOutput = commitToolOutput;
|
|
23248
23561
|
exports.commitToolOutputForce = commitToolOutputForce;
|
|
23562
|
+
exports.commitToolRequest = commitToolRequest;
|
|
23563
|
+
exports.commitToolRequestForce = commitToolRequestForce;
|
|
23249
23564
|
exports.commitUserMessage = commitUserMessage;
|
|
23250
23565
|
exports.commitUserMessageForce = commitUserMessageForce;
|
|
23251
23566
|
exports.complete = complete;
|