agent-swarm-kit 1.1.26 → 1.1.28
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 +239 -232
- package/build/index.mjs +240 -233
- package/package.json +1 -1
- package/types.d.ts +5 -0
package/build/index.cjs
CHANGED
|
@@ -429,7 +429,7 @@ async function writeFileAtomic(file, data, options = {}) {
|
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
var _a$4, _b$
|
|
432
|
+
var _a$4, _b$2, _c$1, _d$1, _e;
|
|
433
433
|
/** @private Symbol for memoizing the wait-for-initialization operation in PersistBase */
|
|
434
434
|
const BASE_WAIT_FOR_INIT_SYMBOL = Symbol("wait-for-init");
|
|
435
435
|
/** @private Symbol for creating a new key in a persistent list */
|
|
@@ -990,7 +990,7 @@ const PersistList = functoolsKit.makeExtendable((_e = class extends PersistBase
|
|
|
990
990
|
* @returns {Promise<string>} A promise resolving to the new key as a string (e.g., "1", "2").
|
|
991
991
|
* @throws {Error} If key generation fails due to underlying storage issues.
|
|
992
992
|
*/
|
|
993
|
-
this[_b$
|
|
993
|
+
this[_b$2] = functoolsKit.queued(async () => await LIST_CREATE_KEY_FN(this));
|
|
994
994
|
/**
|
|
995
995
|
* Retrieves the key of the last item in the list.
|
|
996
996
|
* Scans all keys to find the highest numeric value, used for pop operations (e.g., dequeuing from a `SwarmName` log).
|
|
@@ -1044,7 +1044,7 @@ const PersistList = functoolsKit.makeExtendable((_e = class extends PersistBase
|
|
|
1044
1044
|
return await this[LIST_POP_SYMBOL]();
|
|
1045
1045
|
}
|
|
1046
1046
|
},
|
|
1047
|
-
_b$
|
|
1047
|
+
_b$2 = LIST_CREATE_KEY_SYMBOL,
|
|
1048
1048
|
_c$1 = LIST_GET_LAST_KEY_SYMBOL,
|
|
1049
1049
|
_d$1 = LIST_POP_SYMBOL,
|
|
1050
1050
|
_e));
|
|
@@ -1747,7 +1747,7 @@ const PersistEmbeddingAdapter = new PersistEmbeddingUtils();
|
|
|
1747
1747
|
*/
|
|
1748
1748
|
const PersistEmbedding = PersistEmbeddingAdapter;
|
|
1749
1749
|
|
|
1750
|
-
var _a$3, _b$
|
|
1750
|
+
var _a$3, _b$1, _c, _d;
|
|
1751
1751
|
/** @private Symbol for memoizing the waitForInit method in HistoryMemoryInstance */
|
|
1752
1752
|
const HISTORY_MEMORY_INSTANCE_WAIT_FOR_INIT = Symbol("wait-for-init");
|
|
1753
1753
|
/** @private Symbol for memoizing the waitForInit method in HistoryPersistInstance */
|
|
@@ -1831,7 +1831,7 @@ const HISTORY_PERSIST_INSTANCE_WAIT_FOR_INIT_FN = async (agentName, self) => {
|
|
|
1831
1831
|
* Manages a persistent history of messages, storing them in memory and on disk.
|
|
1832
1832
|
* @implements {IHistoryInstance}
|
|
1833
1833
|
*/
|
|
1834
|
-
const HistoryPersistInstance = functoolsKit.makeExtendable((_b$
|
|
1834
|
+
const HistoryPersistInstance = functoolsKit.makeExtendable((_b$1 = class {
|
|
1835
1835
|
/**
|
|
1836
1836
|
* Initializes the history for an agent, loading data from persistent storage if needed.
|
|
1837
1837
|
* @param agentName - The name of the agent.
|
|
@@ -2022,7 +2022,7 @@ const HistoryPersistInstance = functoolsKit.makeExtendable((_b$2 = class {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
},
|
|
2024
2024
|
_a$3 = HISTORY_PERSIST_INSTANCE_WAIT_FOR_INIT,
|
|
2025
|
-
_b$
|
|
2025
|
+
_b$1));
|
|
2026
2026
|
/**
|
|
2027
2027
|
* Manages an in-memory history of messages without persistence.
|
|
2028
2028
|
* @implements {IHistoryInstance}
|
|
@@ -2451,7 +2451,7 @@ const beginContext = (run) => (...args) => {
|
|
|
2451
2451
|
return run(...args);
|
|
2452
2452
|
};
|
|
2453
2453
|
|
|
2454
|
-
var _a$2, _b
|
|
2454
|
+
var _a$2, _b;
|
|
2455
2455
|
/** @private Symbol for memoizing the waitForInit method in LoggerInstance */
|
|
2456
2456
|
const LOGGER_INSTANCE_WAIT_FOR_INIT = Symbol("wait-for-init");
|
|
2457
2457
|
/**
|
|
@@ -2472,7 +2472,7 @@ const LOGGER_INSTANCE_WAIT_FOR_FN = async (self) => {
|
|
|
2472
2472
|
* Integrates with GLOBAL_CONFIG for console logging control and callbacks for custom behavior.
|
|
2473
2473
|
* @implements {ILoggerInstance}
|
|
2474
2474
|
*/
|
|
2475
|
-
const LoggerInstance = functoolsKit.makeExtendable((_b
|
|
2475
|
+
const LoggerInstance = functoolsKit.makeExtendable((_b = class {
|
|
2476
2476
|
/**
|
|
2477
2477
|
* Creates a new logger instance for a specific client.
|
|
2478
2478
|
* @param clientId - The client ID associated with this logger instance, used in log prefixes.
|
|
@@ -2549,7 +2549,7 @@ const LoggerInstance = functoolsKit.makeExtendable((_b$1 = class {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
},
|
|
2551
2551
|
_a$2 = LOGGER_INSTANCE_WAIT_FOR_INIT,
|
|
2552
|
-
_b
|
|
2552
|
+
_b));
|
|
2553
2553
|
/**
|
|
2554
2554
|
* Provides utilities for managing logger instances and common logging operations.
|
|
2555
2555
|
* Implements ILoggerAdapter for client-specific logging and ILoggerControl for configuration.
|
|
@@ -4912,6 +4912,50 @@ const getAgentName = beginContext(async (clientId) => {
|
|
|
4912
4912
|
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1c, clientId, swarmName);
|
|
4913
4913
|
});
|
|
4914
4914
|
|
|
4915
|
+
/** @private Constant defining the method name for logging and validation context */
|
|
4916
|
+
const METHOD_NAME$1b = "function.commit.commitStopTools";
|
|
4917
|
+
/**
|
|
4918
|
+
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
4919
|
+
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
|
|
4920
|
+
* Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
|
|
4921
|
+
* Integrates with AgentValidationService (agent validation), SessionValidationService (session and swarm retrieval),
|
|
4922
|
+
* SwarmValidationService (swarm validation), SwarmPublicService (agent retrieval), SessionPublicService (tool execution stop),
|
|
4923
|
+
* ToolValidationService (tool context), and LoggerService (logging). Complements functions like commitFlush by controlling tool flow rather than clearing history.
|
|
4924
|
+
*
|
|
4925
|
+
* @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
|
|
4926
|
+
* @param {string} agentName - The name of the agent whose next tool execution is to be stopped, validated against registered agents.
|
|
4927
|
+
* @returns {Promise<void>} A promise that resolves when the tool stop is committed or skipped (e.g., agent mismatch).
|
|
4928
|
+
* @throws {Error} If agent, session, or swarm validation fails, propagated from respective validation services.
|
|
4929
|
+
*/
|
|
4930
|
+
const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
4931
|
+
// Log the stop tools attempt if enabled
|
|
4932
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4933
|
+
swarm$1.loggerService.log(METHOD_NAME$1b, {
|
|
4934
|
+
clientId,
|
|
4935
|
+
agentName,
|
|
4936
|
+
});
|
|
4937
|
+
// Validate the agent exists
|
|
4938
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1b);
|
|
4939
|
+
// Validate the session exists and retrieve the associated swarm
|
|
4940
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1b);
|
|
4941
|
+
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
4942
|
+
// Validate the swarm configuration
|
|
4943
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1b);
|
|
4944
|
+
// Check if the current agent matches the provided agent
|
|
4945
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1b, clientId, swarmName);
|
|
4946
|
+
if (currentAgentName !== agentName) {
|
|
4947
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
4948
|
+
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
4949
|
+
currentAgentName,
|
|
4950
|
+
agentName,
|
|
4951
|
+
clientId,
|
|
4952
|
+
});
|
|
4953
|
+
return;
|
|
4954
|
+
}
|
|
4955
|
+
// Commit the stop of the next tool execution via SessionPublicService
|
|
4956
|
+
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$1b, clientId, swarmName);
|
|
4957
|
+
});
|
|
4958
|
+
|
|
4915
4959
|
const METHOD_NAME_UPDATE$2 = "McpUtils.update";
|
|
4916
4960
|
/**
|
|
4917
4961
|
* A no-operation implementation of the IMCP interface.
|
|
@@ -5089,6 +5133,7 @@ class MergeMCP {
|
|
|
5089
5133
|
}
|
|
5090
5134
|
catch (error) {
|
|
5091
5135
|
console.error(`agent-swarm MCP tool error toolName=${toolName} agentName=${agentName} error=${functoolsKit.getErrorMessage(error)}`);
|
|
5136
|
+
await commitStopTools(dto.clientId, agentName);
|
|
5092
5137
|
await commitFlush(dto.clientId, agentName);
|
|
5093
5138
|
await emit(createPlaceholder(), dto.clientId, agentName);
|
|
5094
5139
|
}
|
|
@@ -5421,7 +5466,7 @@ class AgentConnectionService {
|
|
|
5421
5466
|
}
|
|
5422
5467
|
|
|
5423
5468
|
/** @private Constant defining the method name for logging purposes */
|
|
5424
|
-
const METHOD_NAME$
|
|
5469
|
+
const METHOD_NAME$1a = "function.common.getPayload";
|
|
5425
5470
|
/**
|
|
5426
5471
|
* Retrieves the payload from the current PayloadContextService context.
|
|
5427
5472
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -5432,7 +5477,7 @@ const METHOD_NAME$1b = "function.common.getPayload";
|
|
|
5432
5477
|
* console.log(payload); // { id: number } or null
|
|
5433
5478
|
*/
|
|
5434
5479
|
const getPayload = () => {
|
|
5435
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
5480
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$1a);
|
|
5436
5481
|
if (PayloadContextService.hasContext()) {
|
|
5437
5482
|
const { payload } = swarm$1.payloadContextService.context;
|
|
5438
5483
|
return payload;
|
|
@@ -15820,6 +15865,9 @@ class ComputeSchemaService {
|
|
|
15820
15865
|
if (typeof computeSchema.computeName !== "string") {
|
|
15821
15866
|
throw new Error(`agent-swarm compute schema validation failed: missing computeName`);
|
|
15822
15867
|
}
|
|
15868
|
+
if (computeSchema.ttl && typeof computeSchema.ttl !== "number") {
|
|
15869
|
+
throw new Error(`agent-swarm compute schema validation failed: invalid ttl`);
|
|
15870
|
+
}
|
|
15823
15871
|
if (typeof computeSchema.getComputeData !== "function") {
|
|
15824
15872
|
throw new Error(`agent-swarm compute schema validation failed: missing getComputeData for computeName=${computeSchema.computeName}`);
|
|
15825
15873
|
}
|
|
@@ -16033,7 +16081,7 @@ class StateValidationService {
|
|
|
16033
16081
|
* @module ClientCompute
|
|
16034
16082
|
* @description Provides a class for managing client-side computations with event handling and state management.
|
|
16035
16083
|
*/
|
|
16036
|
-
var _a$1
|
|
16084
|
+
var _a$1;
|
|
16037
16085
|
/**
|
|
16038
16086
|
* @constant {symbol} DISPOSE_SLOT_FN_SYMBOL
|
|
16039
16087
|
* @description Symbol for the dispose function slot.
|
|
@@ -16094,18 +16142,15 @@ class ClientCompute {
|
|
|
16094
16142
|
* @private
|
|
16095
16143
|
*/
|
|
16096
16144
|
this[_a$1] = () => { };
|
|
16097
|
-
/**
|
|
16098
|
-
* @property {Function} GET_COMPUTE_DATA_FN_SYMBOL
|
|
16099
|
-
* @description Memoized function for retrieving compute data.
|
|
16100
|
-
* @private
|
|
16101
|
-
*/
|
|
16102
|
-
this[_b] = functoolsKit.singleshot(async () => {
|
|
16103
|
-
return await GET_COMPUTE_DATA_FN(this);
|
|
16104
|
-
});
|
|
16105
16145
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
16106
16146
|
this.params.logger.debug(`ClientCompute computeName=${this.params.computeName} clientId=${this.params.clientId} shared=${this.params.shared} CTOR`, {
|
|
16107
16147
|
params,
|
|
16108
16148
|
});
|
|
16149
|
+
this[GET_COMPUTE_DATA_FN_SYMBOL] = functoolsKit.ttl(async () => {
|
|
16150
|
+
return await GET_COMPUTE_DATA_FN(this);
|
|
16151
|
+
}, {
|
|
16152
|
+
timeout: params.ttl,
|
|
16153
|
+
});
|
|
16109
16154
|
this.params.binding.forEach(({ stateChanged }) => (this[DISPOSE_SLOT_FN_SYMBOL] = functoolsKit.compose(this[DISPOSE_SLOT_FN_SYMBOL], stateChanged.subscribe((stateName) => this.calculate(stateName)))));
|
|
16110
16155
|
if (this.params.callbacks?.onInit) {
|
|
16111
16156
|
this.params.callbacks.onInit(this.params.clientId, this.params.computeName);
|
|
@@ -16162,12 +16207,17 @@ class ClientCompute {
|
|
|
16162
16207
|
}
|
|
16163
16208
|
}
|
|
16164
16209
|
}
|
|
16165
|
-
_a$1 = DISPOSE_SLOT_FN_SYMBOL
|
|
16210
|
+
_a$1 = DISPOSE_SLOT_FN_SYMBOL;
|
|
16166
16211
|
|
|
16167
16212
|
/**
|
|
16168
16213
|
* @module ComputeConnectionService
|
|
16169
16214
|
* @description Manages compute instances and their lifecycle, integrating with dependency injection and state management.
|
|
16170
16215
|
*/
|
|
16216
|
+
/**
|
|
16217
|
+
* @constant {number} DEFAULT_COMPUTE_TTL
|
|
16218
|
+
* @description Default time-to-live (TTL) for compute instances, set to 24 hours.
|
|
16219
|
+
*/
|
|
16220
|
+
const DEFAULT_COMPUTE_TTL = 24 * 60 * 60 * 1000;
|
|
16171
16221
|
/**
|
|
16172
16222
|
* @class ComputeConnectionService
|
|
16173
16223
|
* @template T - Type extending IComputeData.
|
|
@@ -16233,7 +16283,7 @@ class ComputeConnectionService {
|
|
|
16233
16283
|
*/
|
|
16234
16284
|
this.getComputeRef = functoolsKit.memoize(([clientId, computeName]) => `${clientId}-${computeName}`, (clientId, computeName) => {
|
|
16235
16285
|
this.sessionValidationService.addComputeUsage(clientId, computeName);
|
|
16236
|
-
const { getComputeData, dependsOn = [], middlewares = [], callbacks, shared = false, } = this.computeSchemaService.get(computeName);
|
|
16286
|
+
const { getComputeData, dependsOn = [], middlewares = [], callbacks, ttl = DEFAULT_COMPUTE_TTL, shared = false, } = this.computeSchemaService.get(computeName);
|
|
16237
16287
|
if (shared) {
|
|
16238
16288
|
this._sharedComputeSet.add(computeName);
|
|
16239
16289
|
return this.sharedComputeConnectionService.getComputeRef(computeName);
|
|
@@ -16245,6 +16295,7 @@ class ComputeConnectionService {
|
|
|
16245
16295
|
bus: this.busService,
|
|
16246
16296
|
getComputeData,
|
|
16247
16297
|
binding: dependsOn.map((stateName) => this.stateConnectionService.getStateRef(clientId, stateName)),
|
|
16298
|
+
ttl,
|
|
16248
16299
|
dependsOn,
|
|
16249
16300
|
middlewares,
|
|
16250
16301
|
callbacks,
|
|
@@ -16836,7 +16887,7 @@ const swarm = {
|
|
|
16836
16887
|
init();
|
|
16837
16888
|
var swarm$1 = swarm;
|
|
16838
16889
|
|
|
16839
|
-
const METHOD_NAME$
|
|
16890
|
+
const METHOD_NAME$19 = "cli.dumpDocs";
|
|
16840
16891
|
/**
|
|
16841
16892
|
* Dumps the documentation for the agents and swarms.
|
|
16842
16893
|
*
|
|
@@ -16846,7 +16897,7 @@ const METHOD_NAME$1a = "cli.dumpDocs";
|
|
|
16846
16897
|
*/
|
|
16847
16898
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
16848
16899
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
16849
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
16900
|
+
swarm$1.loggerService.log(METHOD_NAME$19, {
|
|
16850
16901
|
dirName,
|
|
16851
16902
|
});
|
|
16852
16903
|
if (PlantUML) {
|
|
@@ -16856,10 +16907,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
16856
16907
|
}
|
|
16857
16908
|
swarm$1.agentValidationService
|
|
16858
16909
|
.getAgentList()
|
|
16859
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
16910
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$19));
|
|
16860
16911
|
swarm$1.swarmValidationService
|
|
16861
16912
|
.getSwarmList()
|
|
16862
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
16913
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$19));
|
|
16863
16914
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
16864
16915
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
16865
16916
|
if (!dependsOn) {
|
|
@@ -16869,7 +16920,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
16869
16920
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
16870
16921
|
});
|
|
16871
16922
|
|
|
16872
|
-
const METHOD_NAME$
|
|
16923
|
+
const METHOD_NAME$18 = "cli.dumpAgent";
|
|
16873
16924
|
/**
|
|
16874
16925
|
* Dumps the agent information into PlantUML format.
|
|
16875
16926
|
*
|
|
@@ -16878,14 +16929,14 @@ const METHOD_NAME$19 = "cli.dumpAgent";
|
|
|
16878
16929
|
*/
|
|
16879
16930
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
16880
16931
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
16881
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
16932
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
16882
16933
|
agentName,
|
|
16883
16934
|
});
|
|
16884
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
16935
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$18);
|
|
16885
16936
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
16886
16937
|
});
|
|
16887
16938
|
|
|
16888
|
-
const METHOD_NAME$
|
|
16939
|
+
const METHOD_NAME$17 = "cli.dumpSwarm";
|
|
16889
16940
|
/**
|
|
16890
16941
|
* Dumps the swarm information into PlantUML format.
|
|
16891
16942
|
*
|
|
@@ -16894,14 +16945,14 @@ const METHOD_NAME$18 = "cli.dumpSwarm";
|
|
|
16894
16945
|
*/
|
|
16895
16946
|
const dumpSwarm = beginContext((swarmName) => {
|
|
16896
16947
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
16897
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
16948
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
16898
16949
|
swarmName,
|
|
16899
16950
|
});
|
|
16900
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
16951
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$17);
|
|
16901
16952
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
16902
16953
|
});
|
|
16903
16954
|
|
|
16904
|
-
const METHOD_NAME$
|
|
16955
|
+
const METHOD_NAME$16 = "cli.dumpPerfomance";
|
|
16905
16956
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
16906
16957
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
16907
16958
|
/**
|
|
@@ -16920,7 +16971,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
16920
16971
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
16921
16972
|
*/
|
|
16922
16973
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
16923
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
16974
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$16);
|
|
16924
16975
|
await dumpPerfomanceInternal(dirName);
|
|
16925
16976
|
};
|
|
16926
16977
|
/**
|
|
@@ -16978,7 +17029,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
16978
17029
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
16979
17030
|
});
|
|
16980
17031
|
|
|
16981
|
-
const METHOD_NAME$
|
|
17032
|
+
const METHOD_NAME$15 = "cli.dumpClientPerformance";
|
|
16982
17033
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
16983
17034
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
16984
17035
|
/**
|
|
@@ -17002,7 +17053,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
17002
17053
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
17003
17054
|
*/
|
|
17004
17055
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
17005
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17056
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$15);
|
|
17006
17057
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
17007
17058
|
};
|
|
17008
17059
|
/**
|
|
@@ -17023,7 +17074,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
17023
17074
|
});
|
|
17024
17075
|
|
|
17025
17076
|
/** @private Constant defining the method name for logging and validation context */
|
|
17026
|
-
const METHOD_NAME$
|
|
17077
|
+
const METHOD_NAME$14 = "function.commit.commitFlushForce";
|
|
17027
17078
|
/**
|
|
17028
17079
|
* Forcefully commits a flush of agent history for a specific client in the swarm system, without checking the active agent.
|
|
17029
17080
|
* Validates the session and swarm, then proceeds with flushing the history regardless of the current agent state.
|
|
@@ -17041,20 +17092,20 @@ const METHOD_NAME$15 = "function.commit.commitFlushForce";
|
|
|
17041
17092
|
const commitFlushForce = beginContext(async (clientId) => {
|
|
17042
17093
|
// Log the flush attempt if enabled
|
|
17043
17094
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17044
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17095
|
+
swarm$1.loggerService.log(METHOD_NAME$14, {
|
|
17045
17096
|
clientId,
|
|
17046
|
-
METHOD_NAME: METHOD_NAME$
|
|
17097
|
+
METHOD_NAME: METHOD_NAME$14,
|
|
17047
17098
|
});
|
|
17048
17099
|
// Validate the session exists and retrieve the associated swarm
|
|
17049
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17100
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$14);
|
|
17050
17101
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17051
17102
|
// Validate the swarm configuration
|
|
17052
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17103
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$14);
|
|
17053
17104
|
// Commit the flush of agent history via SessionPublicService without agent checks
|
|
17054
|
-
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
17105
|
+
await swarm$1.sessionPublicService.commitFlush(METHOD_NAME$14, clientId, swarmName);
|
|
17055
17106
|
});
|
|
17056
17107
|
|
|
17057
|
-
const METHOD_NAME$
|
|
17108
|
+
const METHOD_NAME$13 = "function.commit.commitToolOutputForce";
|
|
17058
17109
|
/**
|
|
17059
17110
|
* Commits the output of a tool execution to the active agent in a swarm session without checking the active agent.
|
|
17060
17111
|
*
|
|
@@ -17073,24 +17124,24 @@ const METHOD_NAME$14 = "function.commit.commitToolOutputForce";
|
|
|
17073
17124
|
const commitToolOutputForce = beginContext(async (toolId, content, clientId) => {
|
|
17074
17125
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17075
17126
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17076
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17127
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
17077
17128
|
toolId,
|
|
17078
17129
|
content,
|
|
17079
17130
|
clientId,
|
|
17080
17131
|
});
|
|
17081
17132
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
17082
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17133
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$13);
|
|
17083
17134
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17084
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17135
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$13);
|
|
17085
17136
|
// Commit the tool output to the session via the session public service without checking the active agent
|
|
17086
|
-
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
17137
|
+
await swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$13, clientId, swarmName);
|
|
17087
17138
|
});
|
|
17088
17139
|
|
|
17089
17140
|
/**
|
|
17090
17141
|
* @private Constant defining the method name for logging and validation purposes.
|
|
17091
17142
|
* Used as an identifier in log messages and validation checks to track calls to `hasNavigation`.
|
|
17092
17143
|
*/
|
|
17093
|
-
const METHOD_NAME$
|
|
17144
|
+
const METHOD_NAME$12 = "function.common.hasNavigation";
|
|
17094
17145
|
/**
|
|
17095
17146
|
* Checks if a specific agent is part of the navigation route for a given client.
|
|
17096
17147
|
* Validates the agent and client session, retrieves the associated swarm, and queries the navigation route.
|
|
@@ -17101,16 +17152,16 @@ const METHOD_NAME$13 = "function.common.hasNavigation";
|
|
|
17101
17152
|
*/
|
|
17102
17153
|
const hasNavigation = async (clientId, agentName) => {
|
|
17103
17154
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17104
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17105
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17106
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17155
|
+
swarm$1.loggerService.log(METHOD_NAME$12, { clientId });
|
|
17156
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$12);
|
|
17157
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$12);
|
|
17107
17158
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17108
17159
|
return swarm$1.navigationValidationService
|
|
17109
17160
|
.getNavigationRoute(clientId, swarmName)
|
|
17110
17161
|
.has(agentName);
|
|
17111
17162
|
};
|
|
17112
17163
|
|
|
17113
|
-
const METHOD_NAME$
|
|
17164
|
+
const METHOD_NAME$11 = "function.history.getRawHistory";
|
|
17114
17165
|
/**
|
|
17115
17166
|
* Retrieves the raw, unmodified history for a given client session.
|
|
17116
17167
|
*
|
|
@@ -17127,10 +17178,10 @@ const METHOD_NAME$12 = "function.history.getRawHistory";
|
|
|
17127
17178
|
* const rawHistory = await getRawHistory("client-123");
|
|
17128
17179
|
* console.log(rawHistory); // Outputs the full raw history array
|
|
17129
17180
|
*/
|
|
17130
|
-
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$
|
|
17181
|
+
const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$11) => {
|
|
17131
17182
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17132
17183
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17133
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17184
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
17134
17185
|
clientId,
|
|
17135
17186
|
});
|
|
17136
17187
|
// Validate the session and swarm
|
|
@@ -17143,7 +17194,7 @@ const getRawHistory = beginContext(async (clientId, methodName = METHOD_NAME$12)
|
|
|
17143
17194
|
return [...history];
|
|
17144
17195
|
});
|
|
17145
17196
|
|
|
17146
|
-
const METHOD_NAME$
|
|
17197
|
+
const METHOD_NAME$10 = "function.history.getLastUserMessage";
|
|
17147
17198
|
/**
|
|
17148
17199
|
* Retrieves the content of the most recent user message from a client's session history.
|
|
17149
17200
|
*
|
|
@@ -17161,16 +17212,16 @@ const METHOD_NAME$11 = "function.history.getLastUserMessage";
|
|
|
17161
17212
|
const getLastUserMessage = beginContext(async (clientId) => {
|
|
17162
17213
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17163
17214
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17164
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17215
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
17165
17216
|
clientId,
|
|
17166
17217
|
});
|
|
17167
17218
|
// Fetch raw history and find the last user message
|
|
17168
|
-
const history = await getRawHistory(clientId, METHOD_NAME$
|
|
17219
|
+
const history = await getRawHistory(clientId, METHOD_NAME$10);
|
|
17169
17220
|
const last = history.findLast(({ role, mode }) => role === "user" && mode === "user");
|
|
17170
17221
|
return last?.content ? last.content : null;
|
|
17171
17222
|
});
|
|
17172
17223
|
|
|
17173
|
-
const METHOD_NAME
|
|
17224
|
+
const METHOD_NAME$$ = "function.navigate.changeToDefaultAgent";
|
|
17174
17225
|
/**
|
|
17175
17226
|
* Time-to-live for the change agent function in milliseconds.
|
|
17176
17227
|
* Defines how long the cached change agent function remains valid before expiring.
|
|
@@ -17205,7 +17256,7 @@ const createChangeToDefaultAgent = functoolsKit.ttl((clientId) => functoolsKit.q
|
|
|
17205
17256
|
}));
|
|
17206
17257
|
{
|
|
17207
17258
|
// Dispose of the current agent's resources and set up the new default agent
|
|
17208
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME
|
|
17259
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$$, clientId, swarmName);
|
|
17209
17260
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17210
17261
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17211
17262
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17244,23 +17295,23 @@ const createGc$3 = functoolsKit.singleshot(async () => {
|
|
|
17244
17295
|
const changeToDefaultAgent = beginContext(async (clientId) => {
|
|
17245
17296
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17246
17297
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17247
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
17298
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
17248
17299
|
clientId,
|
|
17249
17300
|
});
|
|
17250
17301
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17251
17302
|
const { defaultAgent: agentName } = swarm$1.swarmSchemaService.get(swarmName);
|
|
17252
17303
|
{
|
|
17253
17304
|
// Validate session and default agent
|
|
17254
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME
|
|
17255
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME
|
|
17305
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$$);
|
|
17306
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$$);
|
|
17256
17307
|
}
|
|
17257
17308
|
// Execute the agent change with TTL and queuing
|
|
17258
17309
|
const run = await createChangeToDefaultAgent(clientId);
|
|
17259
17310
|
createGc$3();
|
|
17260
|
-
return await run(METHOD_NAME
|
|
17311
|
+
return await run(METHOD_NAME$$, agentName, swarmName);
|
|
17261
17312
|
});
|
|
17262
17313
|
|
|
17263
|
-
const METHOD_NAME
|
|
17314
|
+
const METHOD_NAME$_ = "function.target.emitForce";
|
|
17264
17315
|
/**
|
|
17265
17316
|
* Emits a string as model output without executing an incoming message or checking the active agent.
|
|
17266
17317
|
*
|
|
@@ -17279,19 +17330,19 @@ const METHOD_NAME$$ = "function.target.emitForce";
|
|
|
17279
17330
|
const emitForce = beginContext(async (content, clientId) => {
|
|
17280
17331
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17281
17332
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17282
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
17333
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
17283
17334
|
content,
|
|
17284
17335
|
clientId,
|
|
17285
17336
|
});
|
|
17286
17337
|
// Validate the session and swarm
|
|
17287
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME
|
|
17338
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$_);
|
|
17288
17339
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17289
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME
|
|
17340
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$_);
|
|
17290
17341
|
// Emit the content directly via the session public service
|
|
17291
|
-
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME
|
|
17342
|
+
return await swarm$1.sessionPublicService.emit(content, METHOD_NAME$_, clientId, swarmName);
|
|
17292
17343
|
});
|
|
17293
17344
|
|
|
17294
|
-
const METHOD_NAME$
|
|
17345
|
+
const METHOD_NAME$Z = "function.target.executeForce";
|
|
17295
17346
|
/**
|
|
17296
17347
|
* 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.
|
|
17297
17348
|
*
|
|
@@ -17312,22 +17363,22 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17312
17363
|
const executionId = functoolsKit.randomString();
|
|
17313
17364
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17314
17365
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17315
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17366
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
17316
17367
|
content,
|
|
17317
17368
|
clientId,
|
|
17318
17369
|
executionId,
|
|
17319
17370
|
});
|
|
17320
17371
|
// Validate the session and swarm
|
|
17321
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17372
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$Z);
|
|
17322
17373
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17323
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
17374
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$Z);
|
|
17324
17375
|
// Execute the command within an execution context with performance tracking
|
|
17325
17376
|
return ExecutionContextService.runInContext(async () => {
|
|
17326
17377
|
let isFinished = false;
|
|
17327
17378
|
swarm$1.perfService.startExecution(executionId, clientId, content.length);
|
|
17328
17379
|
try {
|
|
17329
17380
|
swarm$1.busService.commitExecutionBegin(clientId, { swarmName });
|
|
17330
|
-
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
17381
|
+
const result = await swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$Z, clientId, swarmName);
|
|
17331
17382
|
isFinished = swarm$1.perfService.endExecution(executionId, clientId, result.length);
|
|
17332
17383
|
swarm$1.busService.commitExecutionEnd(clientId, { swarmName });
|
|
17333
17384
|
return result;
|
|
@@ -17344,7 +17395,7 @@ const executeForce = beginContext(async (content, clientId) => {
|
|
|
17344
17395
|
});
|
|
17345
17396
|
});
|
|
17346
17397
|
|
|
17347
|
-
const METHOD_NAME$
|
|
17398
|
+
const METHOD_NAME$Y = "function.template.navigateToTriageAgent";
|
|
17348
17399
|
/**
|
|
17349
17400
|
* Will send tool output directly to the model without any additions
|
|
17350
17401
|
*/
|
|
@@ -17395,7 +17446,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
17395
17446
|
*/
|
|
17396
17447
|
return beginContext(async (toolId, clientId) => {
|
|
17397
17448
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17398
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17449
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
17399
17450
|
clientId,
|
|
17400
17451
|
toolId,
|
|
17401
17452
|
});
|
|
@@ -17427,7 +17478,7 @@ const createNavigateToTriageAgent = ({ flushMessage, lastMessage: lastMessageFn
|
|
|
17427
17478
|
});
|
|
17428
17479
|
};
|
|
17429
17480
|
|
|
17430
|
-
const METHOD_NAME$
|
|
17481
|
+
const METHOD_NAME$X = "function.navigate.changeToAgent";
|
|
17431
17482
|
/**
|
|
17432
17483
|
* Time-to-live for the change agent function in milliseconds.
|
|
17433
17484
|
* Defines how long the cached change agent function remains valid before expiring.
|
|
@@ -17463,7 +17514,7 @@ const createChangeToAgent = functoolsKit.ttl((clientId) => functoolsKit.queued(a
|
|
|
17463
17514
|
}));
|
|
17464
17515
|
{
|
|
17465
17516
|
// Dispose of the current agent's resources and set up the new agent
|
|
17466
|
-
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17517
|
+
const agentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$X, clientId, swarmName);
|
|
17467
17518
|
await swarm$1.agentPublicService.dispose(methodName, clientId, agentName);
|
|
17468
17519
|
await swarm$1.historyPublicService.dispose(methodName, clientId, agentName);
|
|
17469
17520
|
await swarm$1.swarmPublicService.setAgentRef(methodName, clientId, swarmName, agentName, await swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName));
|
|
@@ -17503,16 +17554,16 @@ const createGc$2 = functoolsKit.singleshot(async () => {
|
|
|
17503
17554
|
const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
17504
17555
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17505
17556
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17506
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17557
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
17507
17558
|
agentName,
|
|
17508
17559
|
clientId,
|
|
17509
17560
|
});
|
|
17510
17561
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
17511
17562
|
{
|
|
17512
17563
|
// Validate session, agent, and dependencies
|
|
17513
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
17514
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
17515
|
-
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
17564
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$X);
|
|
17565
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$X);
|
|
17566
|
+
const activeAgent = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$X, clientId, swarmName);
|
|
17516
17567
|
if (!swarm$1.agentValidationService.hasDependency(activeAgent, agentName)) {
|
|
17517
17568
|
console.error(`agent-swarm missing dependency detected for activeAgent=${activeAgent} dependencyAgent=${agentName}`);
|
|
17518
17569
|
}
|
|
@@ -17530,10 +17581,10 @@ const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
|
17530
17581
|
// Execute the agent change with TTL and queuing
|
|
17531
17582
|
const run = await createChangeToAgent(clientId);
|
|
17532
17583
|
createGc$2();
|
|
17533
|
-
return await run(METHOD_NAME$
|
|
17584
|
+
return await run(METHOD_NAME$X, agentName, swarmName);
|
|
17534
17585
|
});
|
|
17535
17586
|
|
|
17536
|
-
const METHOD_NAME$
|
|
17587
|
+
const METHOD_NAME$W = "function.template.navigateToAgent";
|
|
17537
17588
|
/**
|
|
17538
17589
|
* Will send tool output directly to the model without any additions
|
|
17539
17590
|
*/
|
|
@@ -17599,7 +17650,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
17599
17650
|
*/
|
|
17600
17651
|
return beginContext(async (toolId, clientId, agentName) => {
|
|
17601
17652
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17602
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17653
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
17603
17654
|
clientId,
|
|
17604
17655
|
toolId,
|
|
17605
17656
|
});
|
|
@@ -17632,7 +17683,7 @@ const createNavigateToAgent = ({ executeMessage = DEFAULT_EXECUTE_MESSAGE, emitM
|
|
|
17632
17683
|
});
|
|
17633
17684
|
};
|
|
17634
17685
|
|
|
17635
|
-
const METHOD_NAME$
|
|
17686
|
+
const METHOD_NAME$V = "function.setup.addTool";
|
|
17636
17687
|
/**
|
|
17637
17688
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
17638
17689
|
*
|
|
@@ -17654,7 +17705,7 @@ const METHOD_NAME$W = "function.setup.addTool";
|
|
|
17654
17705
|
const addTool = beginContext((toolSchema) => {
|
|
17655
17706
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17656
17707
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17657
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17708
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
17658
17709
|
toolSchema,
|
|
17659
17710
|
});
|
|
17660
17711
|
// Register the tool in the validation and schema services
|
|
@@ -17668,7 +17719,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
17668
17719
|
* Adds navigation functionality to an agent by creating a tool that allows navigation to a specified agent.
|
|
17669
17720
|
* @module addAgentNavigation
|
|
17670
17721
|
*/
|
|
17671
|
-
const METHOD_NAME$
|
|
17722
|
+
const METHOD_NAME$U = "function.alias.addAgentNavigation";
|
|
17672
17723
|
const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
17673
17724
|
/**
|
|
17674
17725
|
* Creates and registers a navigation tool for an agent to navigate to another specified agent.
|
|
@@ -17682,7 +17733,7 @@ const DEFAULT_SKIP_PLACEHOLDER$1 = "Navigation canceled";
|
|
|
17682
17733
|
* @returns {ReturnType<typeof addTool>} The result of adding the navigation tool.
|
|
17683
17734
|
*/
|
|
17684
17735
|
const addAgentNavigation = beginContext(({ toolName, docNote, description, navigateTo, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER$1, ...navigateProps }) => {
|
|
17685
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17736
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$U);
|
|
17686
17737
|
const navigate = createNavigateToAgent(navigateProps);
|
|
17687
17738
|
return addTool({
|
|
17688
17739
|
toolName,
|
|
@@ -17711,7 +17762,7 @@ const addAgentNavigation = beginContext(({ toolName, docNote, description, navig
|
|
|
17711
17762
|
* Adds triage navigation functionality to an agent by creating a tool that facilitates navigation to a triage agent.
|
|
17712
17763
|
* @module addTriageNavigation
|
|
17713
17764
|
*/
|
|
17714
|
-
const METHOD_NAME$
|
|
17765
|
+
const METHOD_NAME$T = "function.alias.addTriageNavigation";
|
|
17715
17766
|
const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
17716
17767
|
/**
|
|
17717
17768
|
* Creates and registers a triage navigation tool for an agent to navigate to a triage agent.
|
|
@@ -17724,7 +17775,7 @@ const DEFAULT_SKIP_PLACEHOLDER = "Navigation canceled";
|
|
|
17724
17775
|
* @returns {ReturnType<typeof addTool>} The result of adding the triage navigation tool.
|
|
17725
17776
|
*/
|
|
17726
17777
|
const addTriageNavigation = beginContext(({ toolName, docNote, description, skipPlaceholder = DEFAULT_SKIP_PLACEHOLDER, ...navigateProps }) => {
|
|
17727
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
17778
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$T);
|
|
17728
17779
|
const navigate = createNavigateToTriageAgent(navigateProps);
|
|
17729
17780
|
return addTool({
|
|
17730
17781
|
toolName,
|
|
@@ -17750,7 +17801,7 @@ const addTriageNavigation = beginContext(({ toolName, docNote, description, skip
|
|
|
17750
17801
|
});
|
|
17751
17802
|
|
|
17752
17803
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
17753
|
-
const METHOD_NAME$
|
|
17804
|
+
const METHOD_NAME$S = "function.setup.addWiki";
|
|
17754
17805
|
/**
|
|
17755
17806
|
* Adds a wiki schema to the system
|
|
17756
17807
|
* @function addWiki
|
|
@@ -17759,7 +17810,7 @@ const METHOD_NAME$T = "function.setup.addWiki";
|
|
|
17759
17810
|
*/
|
|
17760
17811
|
const addWiki = beginContext((wikiSchema) => {
|
|
17761
17812
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17762
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17813
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
17763
17814
|
wikiSchema,
|
|
17764
17815
|
});
|
|
17765
17816
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -17767,7 +17818,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
17767
17818
|
return wikiSchema.wikiName;
|
|
17768
17819
|
});
|
|
17769
17820
|
|
|
17770
|
-
const METHOD_NAME$
|
|
17821
|
+
const METHOD_NAME$R = "function.setup.addAgent";
|
|
17771
17822
|
/**
|
|
17772
17823
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
17773
17824
|
*
|
|
@@ -17787,7 +17838,7 @@ const METHOD_NAME$S = "function.setup.addAgent";
|
|
|
17787
17838
|
const addAgent = beginContext((agentSchema) => {
|
|
17788
17839
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17789
17840
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17790
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17841
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
17791
17842
|
agentSchema,
|
|
17792
17843
|
});
|
|
17793
17844
|
// Register the agent in the validation and schema services
|
|
@@ -17797,7 +17848,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
17797
17848
|
return agentSchema.agentName;
|
|
17798
17849
|
});
|
|
17799
17850
|
|
|
17800
|
-
const METHOD_NAME$
|
|
17851
|
+
const METHOD_NAME$Q = "function.setup.addCompletion";
|
|
17801
17852
|
/**
|
|
17802
17853
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
17803
17854
|
*
|
|
@@ -17817,7 +17868,7 @@ const METHOD_NAME$R = "function.setup.addCompletion";
|
|
|
17817
17868
|
const addCompletion = beginContext((completionSchema) => {
|
|
17818
17869
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17819
17870
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17820
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17871
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
17821
17872
|
completionSchema,
|
|
17822
17873
|
});
|
|
17823
17874
|
// Register the completion in the validation and schema services
|
|
@@ -17827,7 +17878,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
17827
17878
|
return completionSchema.completionName;
|
|
17828
17879
|
});
|
|
17829
17880
|
|
|
17830
|
-
const METHOD_NAME$
|
|
17881
|
+
const METHOD_NAME$P = "function.setup.addSwarm";
|
|
17831
17882
|
/**
|
|
17832
17883
|
* Adds a new swarm to the system for managing client sessions.
|
|
17833
17884
|
*
|
|
@@ -17847,7 +17898,7 @@ const METHOD_NAME$Q = "function.setup.addSwarm";
|
|
|
17847
17898
|
const addSwarm = beginContext((swarmSchema) => {
|
|
17848
17899
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17849
17900
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17850
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17901
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
17851
17902
|
swarmSchema,
|
|
17852
17903
|
});
|
|
17853
17904
|
// Register the swarm in the validation and schema services
|
|
@@ -17857,7 +17908,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
17857
17908
|
return swarmSchema.swarmName;
|
|
17858
17909
|
});
|
|
17859
17910
|
|
|
17860
|
-
const METHOD_NAME$
|
|
17911
|
+
const METHOD_NAME$O = "function.setup.addMCP";
|
|
17861
17912
|
/**
|
|
17862
17913
|
* Registers a new MCP (Model Context Protocol) schema in the system.
|
|
17863
17914
|
* @param mcpSchema - The MCP schema to register.
|
|
@@ -17865,7 +17916,7 @@ const METHOD_NAME$P = "function.setup.addMCP";
|
|
|
17865
17916
|
*/
|
|
17866
17917
|
const addMCP = beginContext((mcpSchema) => {
|
|
17867
17918
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17868
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17919
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
17869
17920
|
mcpSchema,
|
|
17870
17921
|
});
|
|
17871
17922
|
swarm$1.mcpValidationService.addMCP(mcpSchema.mcpName, mcpSchema);
|
|
@@ -17873,7 +17924,7 @@ const addMCP = beginContext((mcpSchema) => {
|
|
|
17873
17924
|
return mcpSchema.mcpName;
|
|
17874
17925
|
});
|
|
17875
17926
|
|
|
17876
|
-
const METHOD_NAME$
|
|
17927
|
+
const METHOD_NAME$N = "function.setup.addState";
|
|
17877
17928
|
/**
|
|
17878
17929
|
* Adds a new state to the state registry for use within the swarm system.
|
|
17879
17930
|
*
|
|
@@ -17895,7 +17946,7 @@ const METHOD_NAME$O = "function.setup.addState";
|
|
|
17895
17946
|
const addState = beginContext((stateSchema) => {
|
|
17896
17947
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17897
17948
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17898
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17949
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
17899
17950
|
stateSchema,
|
|
17900
17951
|
});
|
|
17901
17952
|
// Register the policy with StateValidationService for runtime validation
|
|
@@ -17912,7 +17963,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
17912
17963
|
return stateSchema.stateName;
|
|
17913
17964
|
});
|
|
17914
17965
|
|
|
17915
|
-
const METHOD_NAME$
|
|
17966
|
+
const METHOD_NAME$M = "function.setup.addEmbedding";
|
|
17916
17967
|
/**
|
|
17917
17968
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
17918
17969
|
*
|
|
@@ -17932,7 +17983,7 @@ const METHOD_NAME$N = "function.setup.addEmbedding";
|
|
|
17932
17983
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
17933
17984
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17934
17985
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17935
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
17986
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
17936
17987
|
embeddingSchema,
|
|
17937
17988
|
});
|
|
17938
17989
|
// Register the embedding in the validation and schema services
|
|
@@ -17942,7 +17993,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
17942
17993
|
return embeddingSchema.embeddingName;
|
|
17943
17994
|
});
|
|
17944
17995
|
|
|
17945
|
-
const METHOD_NAME$
|
|
17996
|
+
const METHOD_NAME$L = "function.setup.addStorage";
|
|
17946
17997
|
/**
|
|
17947
17998
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
17948
17999
|
*
|
|
@@ -17964,7 +18015,7 @@ const METHOD_NAME$M = "function.setup.addStorage";
|
|
|
17964
18015
|
const addStorage = beginContext((storageSchema) => {
|
|
17965
18016
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
17966
18017
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17967
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18018
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
17968
18019
|
storageSchema,
|
|
17969
18020
|
});
|
|
17970
18021
|
// Register the storage in the validation and schema services
|
|
@@ -17981,7 +18032,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
17981
18032
|
});
|
|
17982
18033
|
|
|
17983
18034
|
/** @private Constant defining the method name for logging and validation context */
|
|
17984
|
-
const METHOD_NAME$
|
|
18035
|
+
const METHOD_NAME$K = "function.setup.addPolicy";
|
|
17985
18036
|
/**
|
|
17986
18037
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
17987
18038
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -17997,7 +18048,7 @@ const METHOD_NAME$L = "function.setup.addPolicy";
|
|
|
17997
18048
|
const addPolicy = beginContext((policySchema) => {
|
|
17998
18049
|
// Log the policy addition attempt if enabled
|
|
17999
18050
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18000
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18051
|
+
swarm$1.loggerService.log(METHOD_NAME$K, {
|
|
18001
18052
|
policySchema,
|
|
18002
18053
|
});
|
|
18003
18054
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -18029,7 +18080,7 @@ const addCompute = beginContext((computeSchema) => {
|
|
|
18029
18080
|
return computeSchema.computeName;
|
|
18030
18081
|
});
|
|
18031
18082
|
|
|
18032
|
-
const METHOD_NAME$
|
|
18083
|
+
const METHOD_NAME$J = "function.test.overrideAgent";
|
|
18033
18084
|
/**
|
|
18034
18085
|
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
18035
18086
|
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
@@ -18053,13 +18104,13 @@ const METHOD_NAME$K = "function.test.overrideAgent";
|
|
|
18053
18104
|
*/
|
|
18054
18105
|
const overrideAgent = beginContext((agentSchema) => {
|
|
18055
18106
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18056
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18107
|
+
swarm$1.loggerService.log(METHOD_NAME$J, {
|
|
18057
18108
|
agentSchema,
|
|
18058
18109
|
});
|
|
18059
18110
|
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
18060
18111
|
});
|
|
18061
18112
|
|
|
18062
|
-
const METHOD_NAME$
|
|
18113
|
+
const METHOD_NAME$I = "function.test.overrideCompletion";
|
|
18063
18114
|
/**
|
|
18064
18115
|
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
18065
18116
|
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
@@ -18083,13 +18134,13 @@ const METHOD_NAME$J = "function.test.overrideCompletion";
|
|
|
18083
18134
|
*/
|
|
18084
18135
|
const overrideCompletion = beginContext((completionSchema) => {
|
|
18085
18136
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18086
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18137
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
18087
18138
|
completionSchema,
|
|
18088
18139
|
});
|
|
18089
18140
|
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
18090
18141
|
});
|
|
18091
18142
|
|
|
18092
|
-
const METHOD_NAME$
|
|
18143
|
+
const METHOD_NAME$H = "function.test.overrideEmbeding";
|
|
18093
18144
|
/**
|
|
18094
18145
|
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
18095
18146
|
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
@@ -18115,13 +18166,13 @@ const METHOD_NAME$I = "function.test.overrideEmbeding";
|
|
|
18115
18166
|
*/
|
|
18116
18167
|
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
18117
18168
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18118
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18169
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
18119
18170
|
embeddingSchema,
|
|
18120
18171
|
});
|
|
18121
18172
|
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
18122
18173
|
});
|
|
18123
18174
|
|
|
18124
|
-
const METHOD_NAME$
|
|
18175
|
+
const METHOD_NAME$G = "function.test.overridePolicy";
|
|
18125
18176
|
/**
|
|
18126
18177
|
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
18127
18178
|
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
@@ -18145,13 +18196,13 @@ const METHOD_NAME$H = "function.test.overridePolicy";
|
|
|
18145
18196
|
*/
|
|
18146
18197
|
const overridePolicy = beginContext((policySchema) => {
|
|
18147
18198
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18148
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18199
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
18149
18200
|
policySchema,
|
|
18150
18201
|
});
|
|
18151
18202
|
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
18152
18203
|
});
|
|
18153
18204
|
|
|
18154
|
-
const METHOD_NAME$
|
|
18205
|
+
const METHOD_NAME$F = "function.test.overrideState";
|
|
18155
18206
|
/**
|
|
18156
18207
|
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
18157
18208
|
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
@@ -18176,13 +18227,13 @@ const METHOD_NAME$G = "function.test.overrideState";
|
|
|
18176
18227
|
*/
|
|
18177
18228
|
const overrideState = beginContext((stateSchema) => {
|
|
18178
18229
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18179
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18230
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {
|
|
18180
18231
|
stateSchema,
|
|
18181
18232
|
});
|
|
18182
18233
|
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
18183
18234
|
});
|
|
18184
18235
|
|
|
18185
|
-
const METHOD_NAME$
|
|
18236
|
+
const METHOD_NAME$E = "function.test.overrideStorage";
|
|
18186
18237
|
/**
|
|
18187
18238
|
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
18188
18239
|
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
@@ -18208,13 +18259,13 @@ const METHOD_NAME$F = "function.test.overrideStorage";
|
|
|
18208
18259
|
*/
|
|
18209
18260
|
const overrideStorage = beginContext((storageSchema) => {
|
|
18210
18261
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18211
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18262
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {
|
|
18212
18263
|
storageSchema,
|
|
18213
18264
|
});
|
|
18214
18265
|
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
18215
18266
|
});
|
|
18216
18267
|
|
|
18217
|
-
const METHOD_NAME$
|
|
18268
|
+
const METHOD_NAME$D = "function.test.overrideSwarm";
|
|
18218
18269
|
/**
|
|
18219
18270
|
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
18220
18271
|
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
@@ -18238,13 +18289,13 @@ const METHOD_NAME$E = "function.test.overrideSwarm";
|
|
|
18238
18289
|
*/
|
|
18239
18290
|
const overrideSwarm = beginContext((swarmSchema) => {
|
|
18240
18291
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18241
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18292
|
+
swarm$1.loggerService.log(METHOD_NAME$D, {
|
|
18242
18293
|
swarmSchema,
|
|
18243
18294
|
});
|
|
18244
18295
|
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
18245
18296
|
});
|
|
18246
18297
|
|
|
18247
|
-
const METHOD_NAME$
|
|
18298
|
+
const METHOD_NAME$C = "function.test.overrideTool";
|
|
18248
18299
|
/**
|
|
18249
18300
|
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
18250
18301
|
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
@@ -18268,13 +18319,13 @@ const METHOD_NAME$D = "function.test.overrideTool";
|
|
|
18268
18319
|
*/
|
|
18269
18320
|
const overrideTool = beginContext((toolSchema) => {
|
|
18270
18321
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18271
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18322
|
+
swarm$1.loggerService.log(METHOD_NAME$C, {
|
|
18272
18323
|
toolSchema,
|
|
18273
18324
|
});
|
|
18274
18325
|
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
18275
18326
|
});
|
|
18276
18327
|
|
|
18277
|
-
const METHOD_NAME$
|
|
18328
|
+
const METHOD_NAME$B = "function.test.overrideMCP";
|
|
18278
18329
|
/**
|
|
18279
18330
|
* Overrides an existing MCP (Model Context Protocol) schema with a new or partial schema.
|
|
18280
18331
|
* @param mcpSchema - The MCP schema containing the name and optional properties to override.
|
|
@@ -18282,13 +18333,13 @@ const METHOD_NAME$C = "function.test.overrideMCP";
|
|
|
18282
18333
|
*/
|
|
18283
18334
|
const overrideMCP = beginContext((mcpSchema) => {
|
|
18284
18335
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18285
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18336
|
+
swarm$1.loggerService.log(METHOD_NAME$B, {
|
|
18286
18337
|
mcpSchema,
|
|
18287
18338
|
});
|
|
18288
18339
|
return swarm$1.mcpSchemaService.override(mcpSchema.mcpName, mcpSchema);
|
|
18289
18340
|
});
|
|
18290
18341
|
|
|
18291
|
-
const METHOD_NAME$
|
|
18342
|
+
const METHOD_NAME$A = "function.test.overrideWiki";
|
|
18292
18343
|
/**
|
|
18293
18344
|
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
18294
18345
|
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
@@ -18312,7 +18363,7 @@ const METHOD_NAME$B = "function.test.overrideWiki";
|
|
|
18312
18363
|
*/
|
|
18313
18364
|
const overrideWiki = beginContext((wikiSchema) => {
|
|
18314
18365
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18315
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18366
|
+
swarm$1.loggerService.log(METHOD_NAME$A, {
|
|
18316
18367
|
wikiSchema,
|
|
18317
18368
|
});
|
|
18318
18369
|
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
@@ -18327,7 +18378,7 @@ const overrideWiki = beginContext((wikiSchema) => {
|
|
|
18327
18378
|
* @description Method name for the overrideCompute operation.
|
|
18328
18379
|
* @private
|
|
18329
18380
|
*/
|
|
18330
|
-
const METHOD_NAME$
|
|
18381
|
+
const METHOD_NAME$z = "function.test.overrideCompute";
|
|
18331
18382
|
/**
|
|
18332
18383
|
* @function overrideCompute
|
|
18333
18384
|
* @description Overrides an existing compute schema with provided partial updates.
|
|
@@ -18336,13 +18387,13 @@ const METHOD_NAME$A = "function.test.overrideCompute";
|
|
|
18336
18387
|
*/
|
|
18337
18388
|
const overrideCompute = beginContext((computeSchema) => {
|
|
18338
18389
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18339
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18390
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
18340
18391
|
computeSchema,
|
|
18341
18392
|
});
|
|
18342
18393
|
return swarm$1.computeSchemaService.override(computeSchema.computeName, computeSchema);
|
|
18343
18394
|
});
|
|
18344
18395
|
|
|
18345
|
-
const METHOD_NAME$
|
|
18396
|
+
const METHOD_NAME$y = "function.other.markOnline";
|
|
18346
18397
|
/**
|
|
18347
18398
|
* Marks a client as online in the specified swarm.
|
|
18348
18399
|
*
|
|
@@ -18354,16 +18405,16 @@ const METHOD_NAME$z = "function.other.markOnline";
|
|
|
18354
18405
|
const markOnline = async (clientId, swarmName) => {
|
|
18355
18406
|
// Log the operation if logging is enabled in the global configuration
|
|
18356
18407
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18357
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
18408
|
+
swarm.loggerService.log(METHOD_NAME$y, {
|
|
18358
18409
|
clientId,
|
|
18359
18410
|
});
|
|
18360
18411
|
// Validate the swarm name
|
|
18361
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18412
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$y);
|
|
18362
18413
|
// Run the operation in the method context
|
|
18363
18414
|
return await MethodContextService.runInContext(async () => {
|
|
18364
|
-
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$
|
|
18415
|
+
await swarm.aliveService.markOnline(clientId, swarmName, METHOD_NAME$y);
|
|
18365
18416
|
}, {
|
|
18366
|
-
methodName: METHOD_NAME$
|
|
18417
|
+
methodName: METHOD_NAME$y,
|
|
18367
18418
|
agentName: "",
|
|
18368
18419
|
policyName: "",
|
|
18369
18420
|
stateName: "",
|
|
@@ -18375,7 +18426,7 @@ const markOnline = async (clientId, swarmName) => {
|
|
|
18375
18426
|
});
|
|
18376
18427
|
};
|
|
18377
18428
|
|
|
18378
|
-
const METHOD_NAME$
|
|
18429
|
+
const METHOD_NAME$x = "function.other.markOffline";
|
|
18379
18430
|
/**
|
|
18380
18431
|
* Marks a client as offline in the specified swarm.
|
|
18381
18432
|
*
|
|
@@ -18390,14 +18441,14 @@ const METHOD_NAME$y = "function.other.markOffline";
|
|
|
18390
18441
|
*/
|
|
18391
18442
|
const markOffline = async (clientId, swarmName) => {
|
|
18392
18443
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18393
|
-
swarm.loggerService.log(METHOD_NAME$
|
|
18444
|
+
swarm.loggerService.log(METHOD_NAME$x, {
|
|
18394
18445
|
clientId,
|
|
18395
18446
|
});
|
|
18396
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18447
|
+
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$x);
|
|
18397
18448
|
return await MethodContextService.runInContext(async () => {
|
|
18398
|
-
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$
|
|
18449
|
+
await swarm.aliveService.markOffline(clientId, swarmName, METHOD_NAME$x);
|
|
18399
18450
|
}, {
|
|
18400
|
-
methodName: METHOD_NAME$
|
|
18451
|
+
methodName: METHOD_NAME$x,
|
|
18401
18452
|
agentName: "",
|
|
18402
18453
|
policyName: "",
|
|
18403
18454
|
stateName: "",
|
|
@@ -18410,7 +18461,7 @@ const markOffline = async (clientId, swarmName) => {
|
|
|
18410
18461
|
};
|
|
18411
18462
|
|
|
18412
18463
|
/** @private Constant defining the method name for logging and validation context */
|
|
18413
|
-
const METHOD_NAME$
|
|
18464
|
+
const METHOD_NAME$w = "function.commit.commitSystemMessage";
|
|
18414
18465
|
/**
|
|
18415
18466
|
* Commits a system-generated message to the active agent in the swarm system.
|
|
18416
18467
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -18429,20 +18480,20 @@ const METHOD_NAME$x = "function.commit.commitSystemMessage";
|
|
|
18429
18480
|
const commitSystemMessage = beginContext(async (content, clientId, agentName) => {
|
|
18430
18481
|
// Log the commit attempt if enabled
|
|
18431
18482
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18432
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18483
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
18433
18484
|
content,
|
|
18434
18485
|
clientId,
|
|
18435
18486
|
agentName,
|
|
18436
18487
|
});
|
|
18437
18488
|
// Validate the agent exists
|
|
18438
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18489
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
|
|
18439
18490
|
// Validate the session exists and retrieve the associated swarm
|
|
18440
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18491
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
|
|
18441
18492
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18442
18493
|
// Validate the swarm configuration
|
|
18443
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18494
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
|
|
18444
18495
|
// Check if the current agent matches the provided agent
|
|
18445
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18496
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName);
|
|
18446
18497
|
if (currentAgentName !== agentName) {
|
|
18447
18498
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18448
18499
|
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
@@ -18453,10 +18504,10 @@ const commitSystemMessage = beginContext(async (content, clientId, agentName) =>
|
|
|
18453
18504
|
return;
|
|
18454
18505
|
}
|
|
18455
18506
|
// Commit the system message via SessionPublicService
|
|
18456
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
18507
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$w, clientId, swarmName);
|
|
18457
18508
|
});
|
|
18458
18509
|
|
|
18459
|
-
const METHOD_NAME$
|
|
18510
|
+
const METHOD_NAME$v = "function.commit.commitSystemMessage";
|
|
18460
18511
|
/**
|
|
18461
18512
|
* Commits a user message to the active agent's history in a swarm session without triggering a response.
|
|
18462
18513
|
*
|
|
@@ -18475,19 +18526,19 @@ const METHOD_NAME$w = "function.commit.commitSystemMessage";
|
|
|
18475
18526
|
const commitUserMessage = beginContext(async (content, mode, clientId, agentName, payload) => {
|
|
18476
18527
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18477
18528
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18478
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18529
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
18479
18530
|
content,
|
|
18480
18531
|
clientId,
|
|
18481
18532
|
agentName,
|
|
18482
18533
|
mode,
|
|
18483
18534
|
});
|
|
18484
18535
|
// Validate the agent, session, and swarm to ensure they exist and are accessible
|
|
18485
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18486
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18536
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
|
|
18537
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
18487
18538
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18488
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18539
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
18489
18540
|
// Check if the specified agent is still the active agent in the swarm session
|
|
18490
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18541
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName);
|
|
18491
18542
|
if (currentAgentName !== agentName) {
|
|
18492
18543
|
// Log a skip message if the agent has changed during the operation
|
|
18493
18544
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
@@ -18500,18 +18551,18 @@ const commitUserMessage = beginContext(async (content, mode, clientId, agentName
|
|
|
18500
18551
|
}
|
|
18501
18552
|
if (payload) {
|
|
18502
18553
|
return await PayloadContextService.runInContext(async () => {
|
|
18503
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
18554
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$v, clientId, swarmName);
|
|
18504
18555
|
}, {
|
|
18505
18556
|
clientId,
|
|
18506
18557
|
payload,
|
|
18507
18558
|
});
|
|
18508
18559
|
}
|
|
18509
18560
|
// Commit the user message to the agent's history via the session public service
|
|
18510
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
18561
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$v, clientId, swarmName);
|
|
18511
18562
|
});
|
|
18512
18563
|
|
|
18513
18564
|
/** @private Constant defining the method name for logging and validation context */
|
|
18514
|
-
const METHOD_NAME$
|
|
18565
|
+
const METHOD_NAME$u = "function.commit.commitSystemMessageForce";
|
|
18515
18566
|
/**
|
|
18516
18567
|
* Forcefully commits a system-generated message to a session in the swarm system, without checking the active agent.
|
|
18517
18568
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -18530,20 +18581,20 @@ const METHOD_NAME$v = "function.commit.commitSystemMessageForce";
|
|
|
18530
18581
|
const commitSystemMessageForce = beginContext(async (content, clientId) => {
|
|
18531
18582
|
// Log the commit attempt if enabled
|
|
18532
18583
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18533
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18584
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
18534
18585
|
content,
|
|
18535
18586
|
clientId,
|
|
18536
18587
|
});
|
|
18537
18588
|
// Validate the session exists and retrieve the associated swarm
|
|
18538
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18589
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
18539
18590
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18540
18591
|
// Validate the swarm configuration
|
|
18541
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18592
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
18542
18593
|
// Commit the system message via SessionPublicService without agent checks
|
|
18543
|
-
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
18594
|
+
await swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$u, clientId, swarmName);
|
|
18544
18595
|
});
|
|
18545
18596
|
|
|
18546
|
-
const METHOD_NAME$
|
|
18597
|
+
const METHOD_NAME$t = "function.commit.commitSystemMessage";
|
|
18547
18598
|
/**
|
|
18548
18599
|
* Commits a user message to the active agent's history in a swarm session without triggering a response and without checking the active agent.
|
|
18549
18600
|
*
|
|
@@ -18561,29 +18612,29 @@ const METHOD_NAME$u = "function.commit.commitSystemMessage";
|
|
|
18561
18612
|
const commitUserMessageForce = beginContext(async (content, mode, clientId, payload) => {
|
|
18562
18613
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
18563
18614
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18564
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18615
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
18565
18616
|
content,
|
|
18566
18617
|
clientId,
|
|
18567
18618
|
mode,
|
|
18568
18619
|
});
|
|
18569
18620
|
// Validate the session and swarm to ensure they exist and are accessible
|
|
18570
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18621
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
18571
18622
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18572
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18623
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
18573
18624
|
if (payload) {
|
|
18574
18625
|
return await PayloadContextService.runInContext(async () => {
|
|
18575
|
-
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
18626
|
+
await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$t, clientId, swarmName);
|
|
18576
18627
|
}, {
|
|
18577
18628
|
clientId,
|
|
18578
18629
|
payload,
|
|
18579
18630
|
});
|
|
18580
18631
|
}
|
|
18581
18632
|
// Commit the user message to the agent's history via the session public service without checking the active agent
|
|
18582
|
-
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$
|
|
18633
|
+
return await swarm$1.sessionPublicService.commitUserMessage(content, mode, METHOD_NAME$t, clientId, swarmName);
|
|
18583
18634
|
});
|
|
18584
18635
|
|
|
18585
18636
|
/** @private Constant defining the method name for logging and validation context */
|
|
18586
|
-
const METHOD_NAME$
|
|
18637
|
+
const METHOD_NAME$s = "function.commit.commitAssistantMessage";
|
|
18587
18638
|
/**
|
|
18588
18639
|
* Commits an assistant-generated message to the active agent in the swarm system.
|
|
18589
18640
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before committing the message.
|
|
@@ -18601,20 +18652,20 @@ const METHOD_NAME$t = "function.commit.commitAssistantMessage";
|
|
|
18601
18652
|
const commitAssistantMessage = beginContext(async (content, clientId, agentName) => {
|
|
18602
18653
|
// Log the commit attempt if enabled
|
|
18603
18654
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18604
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18655
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
18605
18656
|
content,
|
|
18606
18657
|
clientId,
|
|
18607
18658
|
agentName,
|
|
18608
18659
|
});
|
|
18609
18660
|
// Validate the agent exists
|
|
18610
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18661
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
|
|
18611
18662
|
// Validate the session exists and retrieve the associated swarm
|
|
18612
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18663
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
18613
18664
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18614
18665
|
// Validate the swarm configuration
|
|
18615
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18666
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
|
|
18616
18667
|
// Check if the current agent matches the provided agent
|
|
18617
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18668
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$s, clientId, swarmName);
|
|
18618
18669
|
if (currentAgentName !== agentName) {
|
|
18619
18670
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18620
18671
|
swarm$1.loggerService.log('function "commitAssistantMessage" skipped due to the agent change', {
|
|
@@ -18625,11 +18676,11 @@ const commitAssistantMessage = beginContext(async (content, clientId, agentName)
|
|
|
18625
18676
|
return;
|
|
18626
18677
|
}
|
|
18627
18678
|
// Commit the assistant message via SessionPublicService
|
|
18628
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
18679
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$s, clientId, swarmName);
|
|
18629
18680
|
});
|
|
18630
18681
|
|
|
18631
18682
|
/** @private Constant defining the method name for logging and validation context */
|
|
18632
|
-
const METHOD_NAME$
|
|
18683
|
+
const METHOD_NAME$r = "function.commit.commitAssistantMessageForce";
|
|
18633
18684
|
/**
|
|
18634
18685
|
* Forcefully commits an assistant-generated message to a session in the swarm system, without checking the active agent.
|
|
18635
18686
|
* Validates the session and swarm, then proceeds with committing the message regardless of the current agent state.
|
|
@@ -18648,21 +18699,21 @@ const METHOD_NAME$s = "function.commit.commitAssistantMessageForce";
|
|
|
18648
18699
|
const commitAssistantMessageForce = beginContext(async (content, clientId) => {
|
|
18649
18700
|
// Log the commit attempt if enabled
|
|
18650
18701
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18651
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18702
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
18652
18703
|
content,
|
|
18653
18704
|
clientId,
|
|
18654
18705
|
});
|
|
18655
18706
|
// Validate the session exists and retrieve the associated swarm
|
|
18656
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18707
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
|
|
18657
18708
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18658
18709
|
// Validate the swarm configuration
|
|
18659
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18710
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
|
|
18660
18711
|
// Commit the assistant message via SessionPublicService without agent checks
|
|
18661
|
-
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
18712
|
+
await swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$r, clientId, swarmName);
|
|
18662
18713
|
});
|
|
18663
18714
|
|
|
18664
18715
|
/** @private Constant defining the method name for logging and validation context */
|
|
18665
|
-
const METHOD_NAME$
|
|
18716
|
+
const METHOD_NAME$q = "function.commit.cancelOutput";
|
|
18666
18717
|
/**
|
|
18667
18718
|
* Cancels the awaited output for a specific client and agent by emitting an empty string.
|
|
18668
18719
|
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before cancellation.
|
|
@@ -18678,19 +18729,19 @@ const METHOD_NAME$r = "function.commit.cancelOutput";
|
|
|
18678
18729
|
const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
18679
18730
|
// Log the cancellation attempt if enabled
|
|
18680
18731
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18681
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
18732
|
+
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
18682
18733
|
clientId,
|
|
18683
18734
|
agentName,
|
|
18684
18735
|
});
|
|
18685
18736
|
// Validate the agent exists
|
|
18686
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
18737
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$q);
|
|
18687
18738
|
// Validate the session exists and retrieve the associated swarm
|
|
18688
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
18739
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
|
|
18689
18740
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18690
18741
|
// Validate the swarm configuration
|
|
18691
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
18742
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
|
|
18692
18743
|
// Check if the current agent matches the provided agent
|
|
18693
|
-
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
18744
|
+
const currentAgentName = await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$q, clientId, swarmName);
|
|
18694
18745
|
if (currentAgentName !== agentName) {
|
|
18695
18746
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18696
18747
|
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
@@ -18701,11 +18752,11 @@ const cancelOutput = beginContext(async (clientId, agentName) => {
|
|
|
18701
18752
|
return;
|
|
18702
18753
|
}
|
|
18703
18754
|
// Perform the output cancellation via SwarmPublicService
|
|
18704
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
18755
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$q, clientId, swarmName);
|
|
18705
18756
|
});
|
|
18706
18757
|
|
|
18707
18758
|
/** @private Constant defining the method name for logging and validation context */
|
|
18708
|
-
const METHOD_NAME$
|
|
18759
|
+
const METHOD_NAME$p = "function.commit.cancelOutputForce";
|
|
18709
18760
|
/**
|
|
18710
18761
|
* Forcefully cancels the awaited output for a specific client by emitting an empty string, without checking the active agent.
|
|
18711
18762
|
* Validates the session and swarm, then proceeds with cancellation regardless of the current agent state.
|
|
@@ -18721,61 +18772,17 @@ const METHOD_NAME$q = "function.commit.cancelOutputForce";
|
|
|
18721
18772
|
*/
|
|
18722
18773
|
const cancelOutputForce = beginContext(async (clientId) => {
|
|
18723
18774
|
// Log the cancellation attempt if enabled
|
|
18724
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18725
|
-
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
18726
|
-
clientId,
|
|
18727
|
-
});
|
|
18728
|
-
// Validate the session exists and retrieve the associated swarm
|
|
18729
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
|
|
18730
|
-
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18731
|
-
// Validate the swarm configuration
|
|
18732
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
|
|
18733
|
-
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
18734
|
-
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$q, clientId, swarmName);
|
|
18735
|
-
});
|
|
18736
|
-
|
|
18737
|
-
/** @private Constant defining the method name for logging and validation context */
|
|
18738
|
-
const METHOD_NAME$p = "function.commit.commitStopTools";
|
|
18739
|
-
/**
|
|
18740
|
-
* Prevents the next tool from being executed for a specific client and agent in the swarm system.
|
|
18741
|
-
* Validates the agent, session, and swarm, ensuring the current agent matches the provided agent before stopping tool execution.
|
|
18742
|
-
* Runs within a beginContext wrapper for execution context management, logging operations via LoggerService.
|
|
18743
|
-
* Integrates with AgentValidationService (agent validation), SessionValidationService (session and swarm retrieval),
|
|
18744
|
-
* SwarmValidationService (swarm validation), SwarmPublicService (agent retrieval), SessionPublicService (tool execution stop),
|
|
18745
|
-
* ToolValidationService (tool context), and LoggerService (logging). Complements functions like commitFlush by controlling tool flow rather than clearing history.
|
|
18746
|
-
*
|
|
18747
|
-
* @param {string} clientId - The ID of the client associated with the session, validated against active sessions.
|
|
18748
|
-
* @param {string} agentName - The name of the agent whose next tool execution is to be stopped, validated against registered agents.
|
|
18749
|
-
* @returns {Promise<void>} A promise that resolves when the tool stop is committed or skipped (e.g., agent mismatch).
|
|
18750
|
-
* @throws {Error} If agent, session, or swarm validation fails, propagated from respective validation services.
|
|
18751
|
-
*/
|
|
18752
|
-
const commitStopTools = beginContext(async (clientId, agentName) => {
|
|
18753
|
-
// Log the stop tools attempt if enabled
|
|
18754
18775
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18755
18776
|
swarm$1.loggerService.log(METHOD_NAME$p, {
|
|
18756
18777
|
clientId,
|
|
18757
|
-
agentName,
|
|
18758
18778
|
});
|
|
18759
|
-
// Validate the agent exists
|
|
18760
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$p);
|
|
18761
18779
|
// Validate the session exists and retrieve the associated swarm
|
|
18762
18780
|
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
18763
18781
|
const swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
18764
18782
|
// Validate the swarm configuration
|
|
18765
18783
|
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
18766
|
-
//
|
|
18767
|
-
|
|
18768
|
-
if (currentAgentName !== agentName) {
|
|
18769
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
18770
|
-
swarm$1.loggerService.log('function "commitStopTools" skipped due to the agent change', {
|
|
18771
|
-
currentAgentName,
|
|
18772
|
-
agentName,
|
|
18773
|
-
clientId,
|
|
18774
|
-
});
|
|
18775
|
-
return;
|
|
18776
|
-
}
|
|
18777
|
-
// Commit the stop of the next tool execution via SessionPublicService
|
|
18778
|
-
await swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$p, clientId, swarmName);
|
|
18784
|
+
// Perform the output cancellation via SwarmPublicService without agent checks
|
|
18785
|
+
await swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$p, clientId, swarmName);
|
|
18779
18786
|
});
|
|
18780
18787
|
|
|
18781
18788
|
/** @private Constant defining the method name for logging and validation context */
|