agent-swarm-kit 1.1.0 → 1.1.2
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 +454 -34
- package/build/index.mjs +446 -35
- package/package.json +2 -2
- package/types.d.ts +328 -1
package/build/index.mjs
CHANGED
|
@@ -3443,6 +3443,21 @@ class AgentSchemaService {
|
|
|
3443
3443
|
this.validateShallow(value);
|
|
3444
3444
|
this.registry = this.registry.register(key, value);
|
|
3445
3445
|
};
|
|
3446
|
+
/**
|
|
3447
|
+
* Overrides an existing agent schema in the registry with a new schema.
|
|
3448
|
+
* Replaces the schema associated with the provided key (agentName) in the ToolRegistry.
|
|
3449
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
3450
|
+
* Supports dynamic updates to agent schemas for AgentConnectionService and SwarmConnectionService.
|
|
3451
|
+
* @param {AgentName} key - The name of the agent, used as the registry key, sourced from Agent.interface.
|
|
3452
|
+
* @param {IAgentSchema} value - The new agent schema to override the existing one, sourced from Agent.interface.
|
|
3453
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
3454
|
+
*/
|
|
3455
|
+
this.override = (key, value) => {
|
|
3456
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3457
|
+
this.loggerService.info(`agentSchemaService override`, { key });
|
|
3458
|
+
this.registry = this.registry.override(key, value);
|
|
3459
|
+
return this.registry.get(key);
|
|
3460
|
+
};
|
|
3446
3461
|
/**
|
|
3447
3462
|
* Retrieves an agent schema from the registry by its name.
|
|
3448
3463
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -4818,7 +4833,7 @@ class AgentConnectionService {
|
|
|
4818
4833
|
}
|
|
4819
4834
|
|
|
4820
4835
|
/** @private Constant defining the method name for logging purposes */
|
|
4821
|
-
const METHOD_NAME$
|
|
4836
|
+
const METHOD_NAME$19 = "function.common.getPayload";
|
|
4822
4837
|
/**
|
|
4823
4838
|
* Retrieves the payload from the current PayloadContextService context.
|
|
4824
4839
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -4829,7 +4844,7 @@ const METHOD_NAME$10 = "function.common.getPayload";
|
|
|
4829
4844
|
* console.log(payload); // { id: number } or null
|
|
4830
4845
|
*/
|
|
4831
4846
|
const getPayload = () => {
|
|
4832
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
4847
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$19);
|
|
4833
4848
|
if (PayloadContextService.hasContext()) {
|
|
4834
4849
|
const { payload } = swarm$1.payloadContextService.context;
|
|
4835
4850
|
return payload;
|
|
@@ -5225,6 +5240,21 @@ class ToolSchemaService {
|
|
|
5225
5240
|
this.validateShallow(value);
|
|
5226
5241
|
this.registry = this.registry.register(key, value);
|
|
5227
5242
|
};
|
|
5243
|
+
/**
|
|
5244
|
+
* Overrides an existing tool schema in the registry with a new schema.
|
|
5245
|
+
* Replaces the schema associated with the provided key (toolName) in the ToolRegistry.
|
|
5246
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
5247
|
+
* Supports dynamic updates to tool schemas for AgentConnectionService and SwarmConnectionService.
|
|
5248
|
+
* @param {ToolName} key - The name of the tool to override, sourced from Agent.interface.
|
|
5249
|
+
* @param {IAgentTool} value - The new tool schema to replace the existing one, sourced from Agent.interface.
|
|
5250
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
5251
|
+
*/
|
|
5252
|
+
this.override = (key, value) => {
|
|
5253
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5254
|
+
this.loggerService.info(`toolSchemaService override`, { key });
|
|
5255
|
+
this.registry = this.registry.override(key, value);
|
|
5256
|
+
return this.registry.get(key);
|
|
5257
|
+
};
|
|
5228
5258
|
/**
|
|
5229
5259
|
* Retrieves a tool schema from the registry by its name.
|
|
5230
5260
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -5991,6 +6021,21 @@ class SwarmSchemaService {
|
|
|
5991
6021
|
this.validateShallow(value);
|
|
5992
6022
|
this.registry = this.registry.register(key, value);
|
|
5993
6023
|
};
|
|
6024
|
+
/**
|
|
6025
|
+
* Overrides an existing swarm schema in the registry with a new value.
|
|
6026
|
+
* Replaces the schema associated with the given key in the ToolRegistry.
|
|
6027
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6028
|
+
* Supports dynamic updates to swarm configurations, allowing modifications to agentList, defaultAgent, or policies.
|
|
6029
|
+
* @param {SwarmName} key - The name of the swarm to override, sourced from Swarm.interface.
|
|
6030
|
+
* @param {ISwarmSchema} value - The new swarm schema to replace the existing one, sourced from Swarm.interface.
|
|
6031
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6032
|
+
*/
|
|
6033
|
+
this.override = (key, value) => {
|
|
6034
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6035
|
+
this.loggerService.info(`swarmSchemaService override`, { key });
|
|
6036
|
+
this.registry = this.registry.override(key, value);
|
|
6037
|
+
return this.registry.get(key);
|
|
6038
|
+
};
|
|
5994
6039
|
/**
|
|
5995
6040
|
* Retrieves a swarm schema from the registry by its name.
|
|
5996
6041
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -6067,6 +6112,21 @@ class CompletionSchemaService {
|
|
|
6067
6112
|
this.validateShallow(value);
|
|
6068
6113
|
this.registry = this.registry.register(key, value);
|
|
6069
6114
|
};
|
|
6115
|
+
/**
|
|
6116
|
+
* Overrides an existing completion schema in the registry with a new one.
|
|
6117
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
6118
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6119
|
+
* Supports dynamic updates to completion schemas used by AgentSchemaService, ClientAgent, and other swarm components.
|
|
6120
|
+
* @param {CompletionName} key - The name of the completion to override, sourced from Completion.interface.
|
|
6121
|
+
* @param {ICompletionSchema} value - The new completion schema to replace the existing one, sourced from Completion.interface.
|
|
6122
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6123
|
+
*/
|
|
6124
|
+
this.override = (key, value) => {
|
|
6125
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6126
|
+
this.loggerService.info(`completionSchemaService override`, { key });
|
|
6127
|
+
this.registry = this.registry.override(key, value);
|
|
6128
|
+
return this.registry.get(key);
|
|
6129
|
+
};
|
|
6070
6130
|
/**
|
|
6071
6131
|
* Retrieves a completion schema from the registry by its name.
|
|
6072
6132
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -9274,6 +9334,21 @@ class EmbeddingSchemaService {
|
|
|
9274
9334
|
this.validateShallow(value);
|
|
9275
9335
|
this.registry = this.registry.register(key, value);
|
|
9276
9336
|
};
|
|
9337
|
+
/**
|
|
9338
|
+
* Overrides an existing embedding schema in the registry with a new one.
|
|
9339
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9340
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9341
|
+
* Supports updating embedding logic (e.g., calculateSimilarity and createEmbedding) for storage operations in StorageConnectionService and SharedStorageConnectionService.
|
|
9342
|
+
* @param {EmbeddingName} key - The name of the embedding to override, sourced from Embedding.interface.
|
|
9343
|
+
* @param {IEmbeddingSchema} value - The new embedding schema to associate with the key, sourced from Embedding.interface.
|
|
9344
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9345
|
+
*/
|
|
9346
|
+
this.override = (key, value) => {
|
|
9347
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9348
|
+
this.loggerService.info(`embeddingSchemaService override`, { key });
|
|
9349
|
+
this.registry = this.registry.override(key, value);
|
|
9350
|
+
return this.registry.get(key);
|
|
9351
|
+
};
|
|
9277
9352
|
/**
|
|
9278
9353
|
* Retrieves an embedding schema from the registry by its name.
|
|
9279
9354
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -9353,6 +9428,21 @@ class StorageSchemaService {
|
|
|
9353
9428
|
this.validateShallow(value);
|
|
9354
9429
|
this.registry = this.registry.register(key, value);
|
|
9355
9430
|
};
|
|
9431
|
+
/**
|
|
9432
|
+
* Overrides an existing storage schema in the registry with a new schema.
|
|
9433
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9434
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9435
|
+
* Supports updates to storage configurations for ClientStorage and SharedStorageConnectionService.
|
|
9436
|
+
* @param {StorageName} key - The name of the storage to override, sourced from Storage.interface.
|
|
9437
|
+
* @param {IStorageSchema} value - The new storage schema to replace the existing one, sourced from Storage.interface.
|
|
9438
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9439
|
+
*/
|
|
9440
|
+
this.override = (key, value) => {
|
|
9441
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9442
|
+
this.loggerService.info(`storageSchemaService override`, { key });
|
|
9443
|
+
this.registry = this.registry.override(key, value);
|
|
9444
|
+
return this.registry.get(key);
|
|
9445
|
+
};
|
|
9356
9446
|
/**
|
|
9357
9447
|
* Retrieves a storage schema from the registry by its name.
|
|
9358
9448
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -10473,6 +10563,21 @@ class StateSchemaService {
|
|
|
10473
10563
|
this.validateShallow(value);
|
|
10474
10564
|
this.registry = this.registry.register(key, value);
|
|
10475
10565
|
};
|
|
10566
|
+
/**
|
|
10567
|
+
* Overrides an existing state schema in the registry with a new schema.
|
|
10568
|
+
* Replaces the schema associated with the provided key (stateName) in the ToolRegistry.
|
|
10569
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
10570
|
+
* Supports dynamic updates to state schemas for StateConnectionService and SharedStateConnectionService.
|
|
10571
|
+
* @param {StateName} key - The name of the state to override, sourced from State.interface.
|
|
10572
|
+
* @param {IStateSchema} value - The new state schema to replace the existing one, sourced from State.interface.
|
|
10573
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
10574
|
+
*/
|
|
10575
|
+
this.override = (key, value) => {
|
|
10576
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
10577
|
+
this.loggerService.info(`stateSchemaService override`, { key });
|
|
10578
|
+
this.registry = this.registry.override(key, value);
|
|
10579
|
+
return this.registry.get(key);
|
|
10580
|
+
};
|
|
10476
10581
|
/**
|
|
10477
10582
|
* Retrieves a state schema from the registry by its name.
|
|
10478
10583
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -13260,6 +13365,21 @@ class PolicySchemaService {
|
|
|
13260
13365
|
this.validateShallow(value);
|
|
13261
13366
|
this.registry = this.registry.register(key, value);
|
|
13262
13367
|
};
|
|
13368
|
+
/**
|
|
13369
|
+
* Overrides an existing policy schema in the registry with a new one.
|
|
13370
|
+
* Replaces the schema associated with the provided key (policyName) in the ToolRegistry.
|
|
13371
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
13372
|
+
* Supports dynamic updates to policy schemas, ensuring the latest logic is applied in ClientAgent execution and SessionConnectionService.
|
|
13373
|
+
* @param {PolicyName} key - The name of the policy to override, sourced from Policy.interface.
|
|
13374
|
+
* @param {IPolicySchema} value - The new policy schema to replace the existing one, validated before storage.
|
|
13375
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
13376
|
+
*/
|
|
13377
|
+
this.override = (key, value) => {
|
|
13378
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
13379
|
+
this.loggerService.info(`policySchemaService override`, { key });
|
|
13380
|
+
this.registry = this.registry.override(key, value);
|
|
13381
|
+
return this.registry.get(key);
|
|
13382
|
+
};
|
|
13263
13383
|
/**
|
|
13264
13384
|
* Retrieves a policy schema from the registry by its name.
|
|
13265
13385
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -14171,6 +14291,19 @@ class WikiSchemaService {
|
|
|
14171
14291
|
this.validateShallow(value);
|
|
14172
14292
|
this.registry = this.registry.register(key, value);
|
|
14173
14293
|
};
|
|
14294
|
+
/**
|
|
14295
|
+
* Overrides an existing wiki schema with a new value for a given key
|
|
14296
|
+
* @public
|
|
14297
|
+
* @param {WikiName} key - The key of the schema to override
|
|
14298
|
+
* @param {IWikiSchema} value - The new wiki schema to set
|
|
14299
|
+
* @description Logs the override operation and updates the registry with the new schema
|
|
14300
|
+
*/
|
|
14301
|
+
this.override = (key, value) => {
|
|
14302
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
14303
|
+
this.loggerService.info(`wikiSchemaService override`, { key });
|
|
14304
|
+
this.registry = this.registry.override(key, value);
|
|
14305
|
+
return this.registry.get(key);
|
|
14306
|
+
};
|
|
14174
14307
|
/**
|
|
14175
14308
|
* Retrieves a wiki schema by key
|
|
14176
14309
|
* @public
|
|
@@ -14380,7 +14513,7 @@ const swarm = {
|
|
|
14380
14513
|
init();
|
|
14381
14514
|
var swarm$1 = swarm;
|
|
14382
14515
|
|
|
14383
|
-
const METHOD_NAME
|
|
14516
|
+
const METHOD_NAME$18 = "cli.dumpDocs";
|
|
14384
14517
|
/**
|
|
14385
14518
|
* Dumps the documentation for the agents and swarms.
|
|
14386
14519
|
*
|
|
@@ -14390,7 +14523,7 @@ const METHOD_NAME$$ = "cli.dumpDocs";
|
|
|
14390
14523
|
*/
|
|
14391
14524
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
14392
14525
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14393
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14526
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
14394
14527
|
dirName,
|
|
14395
14528
|
});
|
|
14396
14529
|
if (PlantUML) {
|
|
@@ -14400,10 +14533,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14400
14533
|
}
|
|
14401
14534
|
swarm$1.agentValidationService
|
|
14402
14535
|
.getAgentList()
|
|
14403
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME
|
|
14536
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$18));
|
|
14404
14537
|
swarm$1.swarmValidationService
|
|
14405
14538
|
.getSwarmList()
|
|
14406
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME
|
|
14539
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$18));
|
|
14407
14540
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
14408
14541
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
14409
14542
|
if (!dependsOn) {
|
|
@@ -14413,7 +14546,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14413
14546
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
14414
14547
|
});
|
|
14415
14548
|
|
|
14416
|
-
const METHOD_NAME$
|
|
14549
|
+
const METHOD_NAME$17 = "cli.dumpAgent";
|
|
14417
14550
|
/**
|
|
14418
14551
|
* Dumps the agent information into PlantUML format.
|
|
14419
14552
|
*
|
|
@@ -14422,14 +14555,14 @@ const METHOD_NAME$_ = "cli.dumpAgent";
|
|
|
14422
14555
|
*/
|
|
14423
14556
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
14424
14557
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14425
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14558
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
14426
14559
|
agentName,
|
|
14427
14560
|
});
|
|
14428
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14561
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$17);
|
|
14429
14562
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
14430
14563
|
});
|
|
14431
14564
|
|
|
14432
|
-
const METHOD_NAME$
|
|
14565
|
+
const METHOD_NAME$16 = "cli.dumpSwarm";
|
|
14433
14566
|
/**
|
|
14434
14567
|
* Dumps the swarm information into PlantUML format.
|
|
14435
14568
|
*
|
|
@@ -14438,14 +14571,14 @@ const METHOD_NAME$Z = "cli.dumpSwarm";
|
|
|
14438
14571
|
*/
|
|
14439
14572
|
const dumpSwarm = beginContext((swarmName) => {
|
|
14440
14573
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14441
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14574
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
14442
14575
|
swarmName,
|
|
14443
14576
|
});
|
|
14444
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14577
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$16);
|
|
14445
14578
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
14446
14579
|
});
|
|
14447
14580
|
|
|
14448
|
-
const METHOD_NAME$
|
|
14581
|
+
const METHOD_NAME$15 = "cli.dumpPerfomance";
|
|
14449
14582
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
14450
14583
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
14451
14584
|
/**
|
|
@@ -14464,7 +14597,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
14464
14597
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14465
14598
|
*/
|
|
14466
14599
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
14467
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14600
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$15);
|
|
14468
14601
|
await dumpPerfomanceInternal(dirName);
|
|
14469
14602
|
};
|
|
14470
14603
|
/**
|
|
@@ -14522,7 +14655,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
14522
14655
|
return swarm$1.busService.subscribe(clientId, "execution-bus", queued(async (e) => await fn(e)));
|
|
14523
14656
|
});
|
|
14524
14657
|
|
|
14525
|
-
const METHOD_NAME$
|
|
14658
|
+
const METHOD_NAME$14 = "cli.dumpClientPerformance";
|
|
14526
14659
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
14527
14660
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
14528
14661
|
/**
|
|
@@ -14546,7 +14679,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
14546
14679
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14547
14680
|
*/
|
|
14548
14681
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
14549
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14682
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$14);
|
|
14550
14683
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
14551
14684
|
};
|
|
14552
14685
|
/**
|
|
@@ -14567,7 +14700,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
14567
14700
|
});
|
|
14568
14701
|
|
|
14569
14702
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
14570
|
-
const METHOD_NAME$
|
|
14703
|
+
const METHOD_NAME$13 = "function.setup.addWiki";
|
|
14571
14704
|
/**
|
|
14572
14705
|
* Adds a wiki schema to the system
|
|
14573
14706
|
* @function addWiki
|
|
@@ -14576,7 +14709,7 @@ const METHOD_NAME$W = "function.setup.addWiki";
|
|
|
14576
14709
|
*/
|
|
14577
14710
|
const addWiki = beginContext((wikiSchema) => {
|
|
14578
14711
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14579
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14712
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
14580
14713
|
wikiSchema,
|
|
14581
14714
|
});
|
|
14582
14715
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -14584,7 +14717,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
14584
14717
|
return wikiSchema.wikiName;
|
|
14585
14718
|
});
|
|
14586
14719
|
|
|
14587
|
-
const METHOD_NAME$
|
|
14720
|
+
const METHOD_NAME$12 = "function.setup.addAgent";
|
|
14588
14721
|
/**
|
|
14589
14722
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
14590
14723
|
*
|
|
@@ -14604,7 +14737,7 @@ const METHOD_NAME$V = "function.setup.addAgent";
|
|
|
14604
14737
|
const addAgent = beginContext((agentSchema) => {
|
|
14605
14738
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14606
14739
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14607
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14740
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
14608
14741
|
agentSchema,
|
|
14609
14742
|
});
|
|
14610
14743
|
// Register the agent in the validation and schema services
|
|
@@ -14614,7 +14747,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
14614
14747
|
return agentSchema.agentName;
|
|
14615
14748
|
});
|
|
14616
14749
|
|
|
14617
|
-
const METHOD_NAME$
|
|
14750
|
+
const METHOD_NAME$11 = "function.setup.addCompletion";
|
|
14618
14751
|
/**
|
|
14619
14752
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
14620
14753
|
*
|
|
@@ -14634,7 +14767,7 @@ const METHOD_NAME$U = "function.setup.addCompletion";
|
|
|
14634
14767
|
const addCompletion = beginContext((completionSchema) => {
|
|
14635
14768
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14636
14769
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14637
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14770
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
14638
14771
|
completionSchema,
|
|
14639
14772
|
});
|
|
14640
14773
|
// Register the completion in the validation and schema services
|
|
@@ -14644,7 +14777,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
14644
14777
|
return completionSchema.completionName;
|
|
14645
14778
|
});
|
|
14646
14779
|
|
|
14647
|
-
const METHOD_NAME$
|
|
14780
|
+
const METHOD_NAME$10 = "function.setup.addSwarm";
|
|
14648
14781
|
/**
|
|
14649
14782
|
* Adds a new swarm to the system for managing client sessions.
|
|
14650
14783
|
*
|
|
@@ -14664,7 +14797,7 @@ const METHOD_NAME$T = "function.setup.addSwarm";
|
|
|
14664
14797
|
const addSwarm = beginContext((swarmSchema) => {
|
|
14665
14798
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14666
14799
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14667
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14800
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
14668
14801
|
swarmSchema,
|
|
14669
14802
|
});
|
|
14670
14803
|
// Register the swarm in the validation and schema services
|
|
@@ -14674,7 +14807,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
14674
14807
|
return swarmSchema.swarmName;
|
|
14675
14808
|
});
|
|
14676
14809
|
|
|
14677
|
-
const METHOD_NAME
|
|
14810
|
+
const METHOD_NAME$$ = "function.setup.addTool";
|
|
14678
14811
|
/**
|
|
14679
14812
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
14680
14813
|
*
|
|
@@ -14696,7 +14829,7 @@ const METHOD_NAME$S = "function.setup.addTool";
|
|
|
14696
14829
|
const addTool = beginContext((toolSchema) => {
|
|
14697
14830
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14698
14831
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14699
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14832
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
14700
14833
|
toolSchema,
|
|
14701
14834
|
});
|
|
14702
14835
|
// Register the tool in the validation and schema services
|
|
@@ -14706,7 +14839,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
14706
14839
|
return toolSchema.toolName;
|
|
14707
14840
|
});
|
|
14708
14841
|
|
|
14709
|
-
const METHOD_NAME$
|
|
14842
|
+
const METHOD_NAME$_ = "function.setup.addState";
|
|
14710
14843
|
/**
|
|
14711
14844
|
* Adds a new state to the state registry for use within the swarm system.
|
|
14712
14845
|
*
|
|
@@ -14728,7 +14861,7 @@ const METHOD_NAME$R = "function.setup.addState";
|
|
|
14728
14861
|
const addState = beginContext((stateSchema) => {
|
|
14729
14862
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14730
14863
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14731
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14864
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
14732
14865
|
stateSchema,
|
|
14733
14866
|
});
|
|
14734
14867
|
// Register the state in the schema service
|
|
@@ -14743,7 +14876,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
14743
14876
|
return stateSchema.stateName;
|
|
14744
14877
|
});
|
|
14745
14878
|
|
|
14746
|
-
const METHOD_NAME$
|
|
14879
|
+
const METHOD_NAME$Z = "function.setup.addEmbedding";
|
|
14747
14880
|
/**
|
|
14748
14881
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
14749
14882
|
*
|
|
@@ -14763,7 +14896,7 @@ const METHOD_NAME$Q = "function.setup.addEmbedding";
|
|
|
14763
14896
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
14764
14897
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14765
14898
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14766
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14899
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
14767
14900
|
embeddingSchema,
|
|
14768
14901
|
});
|
|
14769
14902
|
// Register the embedding in the validation and schema services
|
|
@@ -14773,7 +14906,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
14773
14906
|
return embeddingSchema.embeddingName;
|
|
14774
14907
|
});
|
|
14775
14908
|
|
|
14776
|
-
const METHOD_NAME$
|
|
14909
|
+
const METHOD_NAME$Y = "function.setup.addStorage";
|
|
14777
14910
|
/**
|
|
14778
14911
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
14779
14912
|
*
|
|
@@ -14795,7 +14928,7 @@ const METHOD_NAME$P = "function.setup.addStorage";
|
|
|
14795
14928
|
const addStorage = beginContext((storageSchema) => {
|
|
14796
14929
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14797
14930
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14798
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14931
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
14799
14932
|
storageSchema,
|
|
14800
14933
|
});
|
|
14801
14934
|
// Register the storage in the validation and schema services
|
|
@@ -14812,7 +14945,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
14812
14945
|
});
|
|
14813
14946
|
|
|
14814
14947
|
/** @private Constant defining the method name for logging and validation context */
|
|
14815
|
-
const METHOD_NAME$
|
|
14948
|
+
const METHOD_NAME$X = "function.setup.addPolicy";
|
|
14816
14949
|
/**
|
|
14817
14950
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
14818
14951
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -14828,7 +14961,7 @@ const METHOD_NAME$O = "function.setup.addPolicy";
|
|
|
14828
14961
|
const addPolicy = beginContext((policySchema) => {
|
|
14829
14962
|
// Log the policy addition attempt if enabled
|
|
14830
14963
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14831
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14964
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
14832
14965
|
policySchema,
|
|
14833
14966
|
});
|
|
14834
14967
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -14839,6 +14972,281 @@ const addPolicy = beginContext((policySchema) => {
|
|
|
14839
14972
|
return policySchema.policyName;
|
|
14840
14973
|
});
|
|
14841
14974
|
|
|
14975
|
+
const METHOD_NAME$W = "function.test.overrideAgent";
|
|
14976
|
+
/**
|
|
14977
|
+
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
14978
|
+
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
14979
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
14980
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
14981
|
+
*
|
|
14982
|
+
* @param {TAgentSchema} agentSchema - The schema containing the agent’s unique name and optional properties to override.
|
|
14983
|
+
* @param {string} agentSchema.agentName - The unique identifier of the agent to override, matching `IAgentSchema["agentName"]`.
|
|
14984
|
+
* @param {Partial<IAgentSchema>} [agentSchema] - Optional partial schema properties to update, extending `IAgentSchema`.
|
|
14985
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s agent schema service.
|
|
14986
|
+
* @throws {Error} If the agent schema service encounters an error during the override operation (e.g., invalid agentName or schema).
|
|
14987
|
+
*
|
|
14988
|
+
* @example
|
|
14989
|
+
* // Override an agent’s schema with new properties
|
|
14990
|
+
* overrideAgent({
|
|
14991
|
+
* agentName: "WeatherAgent",
|
|
14992
|
+
* description: "Updated weather query handler",
|
|
14993
|
+
* tools: ["getWeather"],
|
|
14994
|
+
* });
|
|
14995
|
+
* // Logs the operation (if enabled) and updates the agent schema in the swarm.
|
|
14996
|
+
*/
|
|
14997
|
+
const overrideAgent = beginContext((agentSchema) => {
|
|
14998
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14999
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
15000
|
+
agentSchema,
|
|
15001
|
+
});
|
|
15002
|
+
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
15003
|
+
});
|
|
15004
|
+
|
|
15005
|
+
const METHOD_NAME$V = "function.test.overrideCompletion";
|
|
15006
|
+
/**
|
|
15007
|
+
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
15008
|
+
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
15009
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15010
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15011
|
+
*
|
|
15012
|
+
* @param {TCompletionSchema} completionSchema - The schema containing the completion’s unique name and optional properties to override.
|
|
15013
|
+
* @param {string} completionSchema.completionName - The unique identifier of the completion to override, matching `ICompletionSchema["completionName"]`.
|
|
15014
|
+
* @param {Partial<ICompletionSchema>} [completionSchema] - Optional partial schema properties to update, extending `ICompletionSchema`.
|
|
15015
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s completion schema service.
|
|
15016
|
+
* @throws {Error} If the completion schema service encounters an error during the override operation (e.g., invalid completionName or schema).
|
|
15017
|
+
*
|
|
15018
|
+
* @example
|
|
15019
|
+
* // Override a completion’s schema with new properties
|
|
15020
|
+
* overrideCompletion({
|
|
15021
|
+
* completionName: "TextCompletion",
|
|
15022
|
+
* model: "gpt-4",
|
|
15023
|
+
* maxTokens: 500,
|
|
15024
|
+
* });
|
|
15025
|
+
* // Logs the operation (if enabled) and updates the completion schema in the swarm.
|
|
15026
|
+
*/
|
|
15027
|
+
const overrideCompletion = beginContext((completionSchema) => {
|
|
15028
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15029
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
15030
|
+
completionSchema,
|
|
15031
|
+
});
|
|
15032
|
+
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
15033
|
+
});
|
|
15034
|
+
|
|
15035
|
+
const METHOD_NAME$U = "function.test.overrideEmbeding";
|
|
15036
|
+
/**
|
|
15037
|
+
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
15038
|
+
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
15039
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15040
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15041
|
+
*
|
|
15042
|
+
* @param {TEmbeddingSchema} embeddingSchema - The schema containing the embedding’s unique name and optional properties to override.
|
|
15043
|
+
* @param {string} embeddingSchema.embeddingName - The unique identifier of the embedding to override, matching `IEmbeddingSchema["embeddingName"]`.
|
|
15044
|
+
* @param {Partial<IEmbeddingSchema>} [embeddingSchema] - Optional partial schema properties to update, extending `IEmbeddingSchema`.
|
|
15045
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s embedding schema service.
|
|
15046
|
+
* @throws {Error} If the embedding schema service encounters an error during the override operation (e.g., invalid embeddingName or schema).
|
|
15047
|
+
*
|
|
15048
|
+
* @example
|
|
15049
|
+
* // Override an embedding’s schema with new properties
|
|
15050
|
+
* overrideEmbeding({
|
|
15051
|
+
* embeddingName: "TextEmbedding",
|
|
15052
|
+
* persist: true,
|
|
15053
|
+
* callbacks: {
|
|
15054
|
+
* onCreate: (text, embeddings) => console.log(`Created embedding for ${text}`),
|
|
15055
|
+
* },
|
|
15056
|
+
* });
|
|
15057
|
+
* // Logs the operation (if enabled) and updates the embedding schema in the swarm.
|
|
15058
|
+
*/
|
|
15059
|
+
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
15060
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15061
|
+
swarm$1.loggerService.log(METHOD_NAME$U, {
|
|
15062
|
+
embeddingSchema,
|
|
15063
|
+
});
|
|
15064
|
+
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
15065
|
+
});
|
|
15066
|
+
|
|
15067
|
+
const METHOD_NAME$T = "function.test.overridePolicy";
|
|
15068
|
+
/**
|
|
15069
|
+
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
15070
|
+
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
15071
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15072
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15073
|
+
*
|
|
15074
|
+
* @param {TPolicySchema} policySchema - The schema containing the policy’s unique name and optional properties to override.
|
|
15075
|
+
* @param {string} policySchema.policyName - The unique identifier of the policy to override, matching `IPolicySchema["policyName"]`.
|
|
15076
|
+
* @param {Partial<IPolicySchema>} [policySchema] - Optional partial schema properties to update, extending `IPolicySchema`.
|
|
15077
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s policy schema service.
|
|
15078
|
+
* @throws {Error} If the policy schema service encounters an error during the override operation (e.g., invalid policyName or schema).
|
|
15079
|
+
*
|
|
15080
|
+
* @example
|
|
15081
|
+
* // Override a policy’s schema with new properties
|
|
15082
|
+
* overridePolicy({
|
|
15083
|
+
* policyName: "ContentFilter",
|
|
15084
|
+
* autoBan: true,
|
|
15085
|
+
* banMessage: "Content policy violation detected.",
|
|
15086
|
+
* });
|
|
15087
|
+
* // Logs the operation (if enabled) and updates the policy schema in the swarm.
|
|
15088
|
+
*/
|
|
15089
|
+
const overridePolicy = beginContext((policySchema) => {
|
|
15090
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15091
|
+
swarm$1.loggerService.log(METHOD_NAME$T, {
|
|
15092
|
+
policySchema,
|
|
15093
|
+
});
|
|
15094
|
+
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
15095
|
+
});
|
|
15096
|
+
|
|
15097
|
+
const METHOD_NAME$S = "function.test.overrideState";
|
|
15098
|
+
/**
|
|
15099
|
+
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
15100
|
+
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
15101
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15102
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15103
|
+
*
|
|
15104
|
+
* @template T - The type of the state data, defaults to `any`.
|
|
15105
|
+
* @param {TStateSchema<T>} stateSchema - The schema containing the state’s unique name and optional properties to override.
|
|
15106
|
+
* @param {string} stateSchema.stateName - The unique identifier of the state to override, matching `IStateSchema<T>["stateName"]`.
|
|
15107
|
+
* @param {Partial<IStateSchema<T>>} [stateSchema] - Optional partial schema properties to update, extending `IStateSchema<T>`.
|
|
15108
|
+
* @returns {IStateSchema<T>} The updated state schema as applied by the swarm’s state schema service.
|
|
15109
|
+
* @throws {Error} If the state schema service encounters an error during the override operation (e.g., invalid stateName or schema).
|
|
15110
|
+
*
|
|
15111
|
+
* @example
|
|
15112
|
+
* // Override a state’s schema with new properties
|
|
15113
|
+
* overrideState({
|
|
15114
|
+
* stateName: "UserPreferences",
|
|
15115
|
+
* persist: true,
|
|
15116
|
+
* getDefaultState: () => ({ theme: "dark" }),
|
|
15117
|
+
* });
|
|
15118
|
+
* // Logs the operation (if enabled) and updates the state schema in the swarm.
|
|
15119
|
+
*/
|
|
15120
|
+
const overrideState = beginContext((stateSchema) => {
|
|
15121
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15122
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
15123
|
+
stateSchema,
|
|
15124
|
+
});
|
|
15125
|
+
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
15126
|
+
});
|
|
15127
|
+
|
|
15128
|
+
const METHOD_NAME$R = "function.test.overrideStorage";
|
|
15129
|
+
/**
|
|
15130
|
+
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
15131
|
+
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
15132
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15133
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15134
|
+
*
|
|
15135
|
+
* @template T - The type of the storage data, defaults to `IStorageData`.
|
|
15136
|
+
* @param {TStorageSchema<T>} storageSchema - The schema containing the storage’s unique name and optional properties to override.
|
|
15137
|
+
* @param {string} storageSchema.storageName - The unique identifier of the storage to override, matching `IStorageSchema<T>["storageName"]`.
|
|
15138
|
+
* @param {Partial<IStorageSchema<T>>} [storageSchema] - Optional partial schema properties to update, extending `IStorageSchema<T>`.
|
|
15139
|
+
* @returns {IStorageSchema<T>} The updated storage schema as applied by the swarm’s storage schema service.
|
|
15140
|
+
* @throws {Error} If the storage schema service encounters an error during the override operation (e.g., invalid storageName or schema).
|
|
15141
|
+
*
|
|
15142
|
+
* @example
|
|
15143
|
+
* // Override a storage’s schema with new properties
|
|
15144
|
+
* overrideStorage({
|
|
15145
|
+
* storageName: "UserData",
|
|
15146
|
+
* persist: true,
|
|
15147
|
+
* embedding: "TextEmbedding",
|
|
15148
|
+
* createIndex: (item) => item.id.toString(),
|
|
15149
|
+
* });
|
|
15150
|
+
* // Logs the operation (if enabled) and updates the storage schema in the swarm.
|
|
15151
|
+
*/
|
|
15152
|
+
const overrideStorage = beginContext((storageSchema) => {
|
|
15153
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15154
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
15155
|
+
storageSchema,
|
|
15156
|
+
});
|
|
15157
|
+
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
15158
|
+
});
|
|
15159
|
+
|
|
15160
|
+
const METHOD_NAME$Q = "function.test.overrideSwarm";
|
|
15161
|
+
/**
|
|
15162
|
+
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
15163
|
+
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
15164
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15165
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15166
|
+
*
|
|
15167
|
+
* @param {TSwarmSchema} swarmSchema - The schema containing the swarm’s unique name and optional properties to override.
|
|
15168
|
+
* @param {string} swarmSchema.swarmName - The unique identifier of the swarm to override, matching `ISwarmSchema["swarmName"]`.
|
|
15169
|
+
* @param {Partial<ISwarmSchema>} [swarmSchema] - Optional partial schema properties to update, extending `ISwarmSchema`.
|
|
15170
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s swarm schema service.
|
|
15171
|
+
* @throws {Error} If the swarm schema service encounters an error during the override operation (e.g., invalid swarmName or schema).
|
|
15172
|
+
*
|
|
15173
|
+
* @example
|
|
15174
|
+
* // Override a swarm’s schema with new properties
|
|
15175
|
+
* overrideSwarm({
|
|
15176
|
+
* swarmName: "MainSwarm",
|
|
15177
|
+
* defaultAgent: "WeatherAgent",
|
|
15178
|
+
* policies: ["ContentFilter"],
|
|
15179
|
+
* });
|
|
15180
|
+
* // Logs the operation (if enabled) and updates the swarm schema in the swarm system.
|
|
15181
|
+
*/
|
|
15182
|
+
const overrideSwarm = beginContext((swarmSchema) => {
|
|
15183
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15184
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
15185
|
+
swarmSchema,
|
|
15186
|
+
});
|
|
15187
|
+
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
15188
|
+
});
|
|
15189
|
+
|
|
15190
|
+
const METHOD_NAME$P = "function.test.overrideTool";
|
|
15191
|
+
/**
|
|
15192
|
+
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
15193
|
+
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
15194
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15195
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15196
|
+
*
|
|
15197
|
+
* @param {TAgentTool} toolSchema - The schema containing the tool’s unique name and optional properties to override.
|
|
15198
|
+
* @param {string} toolSchema.toolName - The unique identifier of the tool to override, matching `IAgentTool["toolName"]`.
|
|
15199
|
+
* @param {Partial<IAgentTool>} [toolSchema] - Optional partial schema properties to update, extending `IAgentTool`.
|
|
15200
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s tool schema service.
|
|
15201
|
+
* @throws {Error} If the tool schema service encounters an error during the override operation (e.g., invalid toolName or schema).
|
|
15202
|
+
*
|
|
15203
|
+
* @example
|
|
15204
|
+
* // Override a tool’s schema with new properties
|
|
15205
|
+
* overrideTool({
|
|
15206
|
+
* toolName: "WeatherTool",
|
|
15207
|
+
* description: "Updated weather data retrieval tool",
|
|
15208
|
+
* execute: async (params) => fetchWeather(params),
|
|
15209
|
+
* });
|
|
15210
|
+
* // Logs the operation (if enabled) and updates the tool schema in the swarm.
|
|
15211
|
+
*/
|
|
15212
|
+
const overrideTool = beginContext((toolSchema) => {
|
|
15213
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15214
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
15215
|
+
toolSchema,
|
|
15216
|
+
});
|
|
15217
|
+
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
15218
|
+
});
|
|
15219
|
+
|
|
15220
|
+
const METHOD_NAME$O = "function.test.overrideWiki";
|
|
15221
|
+
/**
|
|
15222
|
+
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
15223
|
+
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
15224
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15225
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15226
|
+
*
|
|
15227
|
+
* @param {TWikiSchema} wikiSchema - The schema containing the wiki’s unique name and optional properties to override.
|
|
15228
|
+
* @param {string} wikiSchema.wikiName - The unique identifier of the wiki to override, matching `IWikiSchema["wikiName"]`.
|
|
15229
|
+
* @param {Partial<IWikiSchema>} [wikiSchema] - Optional partial schema properties to update, extending `IWikiSchema`.
|
|
15230
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s wiki schema service.
|
|
15231
|
+
* @throws {Error} If the wiki schema service encounters an error during the override operation (e.g., invalid wikiName or schema).
|
|
15232
|
+
*
|
|
15233
|
+
* @example
|
|
15234
|
+
* // Override a wiki’s schema with new properties
|
|
15235
|
+
* overrideWiki({
|
|
15236
|
+
* wikiName: "KnowledgeBase",
|
|
15237
|
+
* description: "Updated knowledge repository",
|
|
15238
|
+
* storage: "WikiStorage",
|
|
15239
|
+
* });
|
|
15240
|
+
* // Logs the operation (if enabled) and updates the wiki schema in the swarm.
|
|
15241
|
+
*/
|
|
15242
|
+
const overrideWiki = beginContext((wikiSchema) => {
|
|
15243
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15244
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
15245
|
+
wikiSchema,
|
|
15246
|
+
});
|
|
15247
|
+
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
15248
|
+
});
|
|
15249
|
+
|
|
14842
15250
|
const METHOD_NAME$N = "function.other.markOnline";
|
|
14843
15251
|
/**
|
|
14844
15252
|
* Marks a client as online in the specified swarm.
|
|
@@ -17226,6 +17634,7 @@ const CHANGE_AGENT_GC$2 = 60 * 1000;
|
|
|
17226
17634
|
*/
|
|
17227
17635
|
const createChangeToAgent = ttl((clientId) => queued(async (methodName, agentName, swarmName) => {
|
|
17228
17636
|
if (!swarm$1.navigationValidationService.shouldNavigate(agentName, clientId, swarmName)) {
|
|
17637
|
+
console.warn(`function "changeToAgent" skipped due to the circular route found clientId=${clientId} swarmName=${swarmName} agentNameTo=${agentName}`);
|
|
17229
17638
|
return false;
|
|
17230
17639
|
}
|
|
17231
17640
|
// Notify all agents in the swarm of the change
|
|
@@ -17295,7 +17704,9 @@ const changeToAgent = beginContext(async (agentName, clientId) => {
|
|
|
17295
17704
|
swarm$1.loggerService.log('function "changeToAgent" skipped due to the agent is not in the swarm', {
|
|
17296
17705
|
agentName,
|
|
17297
17706
|
clientId,
|
|
17707
|
+
swarmName,
|
|
17298
17708
|
});
|
|
17709
|
+
console.warn(`function "changeToAgent" skipped due to the agent is not in the swarm clientId=${clientId} agentName=${agentName} swarmName=${swarmName}`);
|
|
17299
17710
|
return false;
|
|
17300
17711
|
}
|
|
17301
17712
|
// Execute the agent change with TTL and queuing
|
|
@@ -19484,4 +19895,4 @@ const Utils = {
|
|
|
19484
19895
|
PersistEmbeddingUtils,
|
|
19485
19896
|
};
|
|
19486
19897
|
|
|
19487
|
-
export { Adapter, Chat, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedState, SharedStorage, State, Storage, Utils, addAgent, addCompletion, addEmbedding, addPolicy, addState, addStorage, addSwarm, addTool, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|
|
19898
|
+
export { Adapter, Chat, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedState, SharedStorage, State, Storage, Utils, addAgent, addCompletion, addEmbedding, addPolicy, addState, addStorage, addSwarm, addTool, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideEmbeding, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|