agent-swarm-kit 1.1.1 → 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 +452 -35
- package/build/index.mjs +444 -36
- package/package.json +2 -2
- package/types.d.ts +328 -1
package/build/index.cjs
CHANGED
|
@@ -3445,6 +3445,21 @@ class AgentSchemaService {
|
|
|
3445
3445
|
this.validateShallow(value);
|
|
3446
3446
|
this.registry = this.registry.register(key, value);
|
|
3447
3447
|
};
|
|
3448
|
+
/**
|
|
3449
|
+
* Overrides an existing agent schema in the registry with a new schema.
|
|
3450
|
+
* Replaces the schema associated with the provided key (agentName) in the ToolRegistry.
|
|
3451
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
3452
|
+
* Supports dynamic updates to agent schemas for AgentConnectionService and SwarmConnectionService.
|
|
3453
|
+
* @param {AgentName} key - The name of the agent, used as the registry key, sourced from Agent.interface.
|
|
3454
|
+
* @param {IAgentSchema} value - The new agent schema to override the existing one, sourced from Agent.interface.
|
|
3455
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
3456
|
+
*/
|
|
3457
|
+
this.override = (key, value) => {
|
|
3458
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3459
|
+
this.loggerService.info(`agentSchemaService override`, { key });
|
|
3460
|
+
this.registry = this.registry.override(key, value);
|
|
3461
|
+
return this.registry.get(key);
|
|
3462
|
+
};
|
|
3448
3463
|
/**
|
|
3449
3464
|
* Retrieves an agent schema from the registry by its name.
|
|
3450
3465
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -4820,7 +4835,7 @@ class AgentConnectionService {
|
|
|
4820
4835
|
}
|
|
4821
4836
|
|
|
4822
4837
|
/** @private Constant defining the method name for logging purposes */
|
|
4823
|
-
const METHOD_NAME$
|
|
4838
|
+
const METHOD_NAME$19 = "function.common.getPayload";
|
|
4824
4839
|
/**
|
|
4825
4840
|
* Retrieves the payload from the current PayloadContextService context.
|
|
4826
4841
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -4831,7 +4846,7 @@ const METHOD_NAME$10 = "function.common.getPayload";
|
|
|
4831
4846
|
* console.log(payload); // { id: number } or null
|
|
4832
4847
|
*/
|
|
4833
4848
|
const getPayload = () => {
|
|
4834
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
4849
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$19);
|
|
4835
4850
|
if (PayloadContextService.hasContext()) {
|
|
4836
4851
|
const { payload } = swarm$1.payloadContextService.context;
|
|
4837
4852
|
return payload;
|
|
@@ -5227,6 +5242,21 @@ class ToolSchemaService {
|
|
|
5227
5242
|
this.validateShallow(value);
|
|
5228
5243
|
this.registry = this.registry.register(key, value);
|
|
5229
5244
|
};
|
|
5245
|
+
/**
|
|
5246
|
+
* Overrides an existing tool schema in the registry with a new schema.
|
|
5247
|
+
* Replaces the schema associated with the provided key (toolName) in the ToolRegistry.
|
|
5248
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
5249
|
+
* Supports dynamic updates to tool schemas for AgentConnectionService and SwarmConnectionService.
|
|
5250
|
+
* @param {ToolName} key - The name of the tool to override, sourced from Agent.interface.
|
|
5251
|
+
* @param {IAgentTool} value - The new tool schema to replace the existing one, sourced from Agent.interface.
|
|
5252
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
5253
|
+
*/
|
|
5254
|
+
this.override = (key, value) => {
|
|
5255
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5256
|
+
this.loggerService.info(`toolSchemaService override`, { key });
|
|
5257
|
+
this.registry = this.registry.override(key, value);
|
|
5258
|
+
return this.registry.get(key);
|
|
5259
|
+
};
|
|
5230
5260
|
/**
|
|
5231
5261
|
* Retrieves a tool schema from the registry by its name.
|
|
5232
5262
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -5993,6 +6023,21 @@ class SwarmSchemaService {
|
|
|
5993
6023
|
this.validateShallow(value);
|
|
5994
6024
|
this.registry = this.registry.register(key, value);
|
|
5995
6025
|
};
|
|
6026
|
+
/**
|
|
6027
|
+
* Overrides an existing swarm schema in the registry with a new value.
|
|
6028
|
+
* Replaces the schema associated with the given key in the ToolRegistry.
|
|
6029
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6030
|
+
* Supports dynamic updates to swarm configurations, allowing modifications to agentList, defaultAgent, or policies.
|
|
6031
|
+
* @param {SwarmName} key - The name of the swarm to override, sourced from Swarm.interface.
|
|
6032
|
+
* @param {ISwarmSchema} value - The new swarm schema to replace the existing one, sourced from Swarm.interface.
|
|
6033
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6034
|
+
*/
|
|
6035
|
+
this.override = (key, value) => {
|
|
6036
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6037
|
+
this.loggerService.info(`swarmSchemaService override`, { key });
|
|
6038
|
+
this.registry = this.registry.override(key, value);
|
|
6039
|
+
return this.registry.get(key);
|
|
6040
|
+
};
|
|
5996
6041
|
/**
|
|
5997
6042
|
* Retrieves a swarm schema from the registry by its name.
|
|
5998
6043
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -6069,6 +6114,21 @@ class CompletionSchemaService {
|
|
|
6069
6114
|
this.validateShallow(value);
|
|
6070
6115
|
this.registry = this.registry.register(key, value);
|
|
6071
6116
|
};
|
|
6117
|
+
/**
|
|
6118
|
+
* Overrides an existing completion schema in the registry with a new one.
|
|
6119
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
6120
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6121
|
+
* Supports dynamic updates to completion schemas used by AgentSchemaService, ClientAgent, and other swarm components.
|
|
6122
|
+
* @param {CompletionName} key - The name of the completion to override, sourced from Completion.interface.
|
|
6123
|
+
* @param {ICompletionSchema} value - The new completion schema to replace the existing one, sourced from Completion.interface.
|
|
6124
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6125
|
+
*/
|
|
6126
|
+
this.override = (key, value) => {
|
|
6127
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6128
|
+
this.loggerService.info(`completionSchemaService override`, { key });
|
|
6129
|
+
this.registry = this.registry.override(key, value);
|
|
6130
|
+
return this.registry.get(key);
|
|
6131
|
+
};
|
|
6072
6132
|
/**
|
|
6073
6133
|
* Retrieves a completion schema from the registry by its name.
|
|
6074
6134
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -9276,6 +9336,21 @@ class EmbeddingSchemaService {
|
|
|
9276
9336
|
this.validateShallow(value);
|
|
9277
9337
|
this.registry = this.registry.register(key, value);
|
|
9278
9338
|
};
|
|
9339
|
+
/**
|
|
9340
|
+
* Overrides an existing embedding schema in the registry with a new one.
|
|
9341
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9342
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9343
|
+
* Supports updating embedding logic (e.g., calculateSimilarity and createEmbedding) for storage operations in StorageConnectionService and SharedStorageConnectionService.
|
|
9344
|
+
* @param {EmbeddingName} key - The name of the embedding to override, sourced from Embedding.interface.
|
|
9345
|
+
* @param {IEmbeddingSchema} value - The new embedding schema to associate with the key, sourced from Embedding.interface.
|
|
9346
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9347
|
+
*/
|
|
9348
|
+
this.override = (key, value) => {
|
|
9349
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9350
|
+
this.loggerService.info(`embeddingSchemaService override`, { key });
|
|
9351
|
+
this.registry = this.registry.override(key, value);
|
|
9352
|
+
return this.registry.get(key);
|
|
9353
|
+
};
|
|
9279
9354
|
/**
|
|
9280
9355
|
* Retrieves an embedding schema from the registry by its name.
|
|
9281
9356
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -9355,6 +9430,21 @@ class StorageSchemaService {
|
|
|
9355
9430
|
this.validateShallow(value);
|
|
9356
9431
|
this.registry = this.registry.register(key, value);
|
|
9357
9432
|
};
|
|
9433
|
+
/**
|
|
9434
|
+
* Overrides an existing storage schema in the registry with a new schema.
|
|
9435
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9436
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9437
|
+
* Supports updates to storage configurations for ClientStorage and SharedStorageConnectionService.
|
|
9438
|
+
* @param {StorageName} key - The name of the storage to override, sourced from Storage.interface.
|
|
9439
|
+
* @param {IStorageSchema} value - The new storage schema to replace the existing one, sourced from Storage.interface.
|
|
9440
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9441
|
+
*/
|
|
9442
|
+
this.override = (key, value) => {
|
|
9443
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9444
|
+
this.loggerService.info(`storageSchemaService override`, { key });
|
|
9445
|
+
this.registry = this.registry.override(key, value);
|
|
9446
|
+
return this.registry.get(key);
|
|
9447
|
+
};
|
|
9358
9448
|
/**
|
|
9359
9449
|
* Retrieves a storage schema from the registry by its name.
|
|
9360
9450
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -10475,6 +10565,21 @@ class StateSchemaService {
|
|
|
10475
10565
|
this.validateShallow(value);
|
|
10476
10566
|
this.registry = this.registry.register(key, value);
|
|
10477
10567
|
};
|
|
10568
|
+
/**
|
|
10569
|
+
* Overrides an existing state schema in the registry with a new schema.
|
|
10570
|
+
* Replaces the schema associated with the provided key (stateName) in the ToolRegistry.
|
|
10571
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
10572
|
+
* Supports dynamic updates to state schemas for StateConnectionService and SharedStateConnectionService.
|
|
10573
|
+
* @param {StateName} key - The name of the state to override, sourced from State.interface.
|
|
10574
|
+
* @param {IStateSchema} value - The new state schema to replace the existing one, sourced from State.interface.
|
|
10575
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
10576
|
+
*/
|
|
10577
|
+
this.override = (key, value) => {
|
|
10578
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
10579
|
+
this.loggerService.info(`stateSchemaService override`, { key });
|
|
10580
|
+
this.registry = this.registry.override(key, value);
|
|
10581
|
+
return this.registry.get(key);
|
|
10582
|
+
};
|
|
10478
10583
|
/**
|
|
10479
10584
|
* Retrieves a state schema from the registry by its name.
|
|
10480
10585
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -13262,6 +13367,21 @@ class PolicySchemaService {
|
|
|
13262
13367
|
this.validateShallow(value);
|
|
13263
13368
|
this.registry = this.registry.register(key, value);
|
|
13264
13369
|
};
|
|
13370
|
+
/**
|
|
13371
|
+
* Overrides an existing policy schema in the registry with a new one.
|
|
13372
|
+
* Replaces the schema associated with the provided key (policyName) in the ToolRegistry.
|
|
13373
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
13374
|
+
* Supports dynamic updates to policy schemas, ensuring the latest logic is applied in ClientAgent execution and SessionConnectionService.
|
|
13375
|
+
* @param {PolicyName} key - The name of the policy to override, sourced from Policy.interface.
|
|
13376
|
+
* @param {IPolicySchema} value - The new policy schema to replace the existing one, validated before storage.
|
|
13377
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
13378
|
+
*/
|
|
13379
|
+
this.override = (key, value) => {
|
|
13380
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
13381
|
+
this.loggerService.info(`policySchemaService override`, { key });
|
|
13382
|
+
this.registry = this.registry.override(key, value);
|
|
13383
|
+
return this.registry.get(key);
|
|
13384
|
+
};
|
|
13265
13385
|
/**
|
|
13266
13386
|
* Retrieves a policy schema from the registry by its name.
|
|
13267
13387
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -14173,6 +14293,19 @@ class WikiSchemaService {
|
|
|
14173
14293
|
this.validateShallow(value);
|
|
14174
14294
|
this.registry = this.registry.register(key, value);
|
|
14175
14295
|
};
|
|
14296
|
+
/**
|
|
14297
|
+
* Overrides an existing wiki schema with a new value for a given key
|
|
14298
|
+
* @public
|
|
14299
|
+
* @param {WikiName} key - The key of the schema to override
|
|
14300
|
+
* @param {IWikiSchema} value - The new wiki schema to set
|
|
14301
|
+
* @description Logs the override operation and updates the registry with the new schema
|
|
14302
|
+
*/
|
|
14303
|
+
this.override = (key, value) => {
|
|
14304
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
14305
|
+
this.loggerService.info(`wikiSchemaService override`, { key });
|
|
14306
|
+
this.registry = this.registry.override(key, value);
|
|
14307
|
+
return this.registry.get(key);
|
|
14308
|
+
};
|
|
14176
14309
|
/**
|
|
14177
14310
|
* Retrieves a wiki schema by key
|
|
14178
14311
|
* @public
|
|
@@ -14382,7 +14515,7 @@ const swarm = {
|
|
|
14382
14515
|
init();
|
|
14383
14516
|
var swarm$1 = swarm;
|
|
14384
14517
|
|
|
14385
|
-
const METHOD_NAME
|
|
14518
|
+
const METHOD_NAME$18 = "cli.dumpDocs";
|
|
14386
14519
|
/**
|
|
14387
14520
|
* Dumps the documentation for the agents and swarms.
|
|
14388
14521
|
*
|
|
@@ -14392,7 +14525,7 @@ const METHOD_NAME$$ = "cli.dumpDocs";
|
|
|
14392
14525
|
*/
|
|
14393
14526
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
14394
14527
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14395
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14528
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
14396
14529
|
dirName,
|
|
14397
14530
|
});
|
|
14398
14531
|
if (PlantUML) {
|
|
@@ -14402,10 +14535,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14402
14535
|
}
|
|
14403
14536
|
swarm$1.agentValidationService
|
|
14404
14537
|
.getAgentList()
|
|
14405
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME
|
|
14538
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$18));
|
|
14406
14539
|
swarm$1.swarmValidationService
|
|
14407
14540
|
.getSwarmList()
|
|
14408
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME
|
|
14541
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$18));
|
|
14409
14542
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
14410
14543
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
14411
14544
|
if (!dependsOn) {
|
|
@@ -14415,7 +14548,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14415
14548
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
14416
14549
|
});
|
|
14417
14550
|
|
|
14418
|
-
const METHOD_NAME$
|
|
14551
|
+
const METHOD_NAME$17 = "cli.dumpAgent";
|
|
14419
14552
|
/**
|
|
14420
14553
|
* Dumps the agent information into PlantUML format.
|
|
14421
14554
|
*
|
|
@@ -14424,14 +14557,14 @@ const METHOD_NAME$_ = "cli.dumpAgent";
|
|
|
14424
14557
|
*/
|
|
14425
14558
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
14426
14559
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14427
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14560
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
14428
14561
|
agentName,
|
|
14429
14562
|
});
|
|
14430
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14563
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$17);
|
|
14431
14564
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
14432
14565
|
});
|
|
14433
14566
|
|
|
14434
|
-
const METHOD_NAME$
|
|
14567
|
+
const METHOD_NAME$16 = "cli.dumpSwarm";
|
|
14435
14568
|
/**
|
|
14436
14569
|
* Dumps the swarm information into PlantUML format.
|
|
14437
14570
|
*
|
|
@@ -14440,14 +14573,14 @@ const METHOD_NAME$Z = "cli.dumpSwarm";
|
|
|
14440
14573
|
*/
|
|
14441
14574
|
const dumpSwarm = beginContext((swarmName) => {
|
|
14442
14575
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14443
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14576
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
14444
14577
|
swarmName,
|
|
14445
14578
|
});
|
|
14446
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14579
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$16);
|
|
14447
14580
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
14448
14581
|
});
|
|
14449
14582
|
|
|
14450
|
-
const METHOD_NAME$
|
|
14583
|
+
const METHOD_NAME$15 = "cli.dumpPerfomance";
|
|
14451
14584
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
14452
14585
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
14453
14586
|
/**
|
|
@@ -14466,7 +14599,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
14466
14599
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14467
14600
|
*/
|
|
14468
14601
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
14469
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14602
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$15);
|
|
14470
14603
|
await dumpPerfomanceInternal(dirName);
|
|
14471
14604
|
};
|
|
14472
14605
|
/**
|
|
@@ -14524,7 +14657,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
14524
14657
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
14525
14658
|
});
|
|
14526
14659
|
|
|
14527
|
-
const METHOD_NAME$
|
|
14660
|
+
const METHOD_NAME$14 = "cli.dumpClientPerformance";
|
|
14528
14661
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
14529
14662
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
14530
14663
|
/**
|
|
@@ -14548,7 +14681,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
14548
14681
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14549
14682
|
*/
|
|
14550
14683
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
14551
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14684
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$14);
|
|
14552
14685
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
14553
14686
|
};
|
|
14554
14687
|
/**
|
|
@@ -14569,7 +14702,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
14569
14702
|
});
|
|
14570
14703
|
|
|
14571
14704
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
14572
|
-
const METHOD_NAME$
|
|
14705
|
+
const METHOD_NAME$13 = "function.setup.addWiki";
|
|
14573
14706
|
/**
|
|
14574
14707
|
* Adds a wiki schema to the system
|
|
14575
14708
|
* @function addWiki
|
|
@@ -14578,7 +14711,7 @@ const METHOD_NAME$W = "function.setup.addWiki";
|
|
|
14578
14711
|
*/
|
|
14579
14712
|
const addWiki = beginContext((wikiSchema) => {
|
|
14580
14713
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14581
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14714
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
14582
14715
|
wikiSchema,
|
|
14583
14716
|
});
|
|
14584
14717
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -14586,7 +14719,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
14586
14719
|
return wikiSchema.wikiName;
|
|
14587
14720
|
});
|
|
14588
14721
|
|
|
14589
|
-
const METHOD_NAME$
|
|
14722
|
+
const METHOD_NAME$12 = "function.setup.addAgent";
|
|
14590
14723
|
/**
|
|
14591
14724
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
14592
14725
|
*
|
|
@@ -14606,7 +14739,7 @@ const METHOD_NAME$V = "function.setup.addAgent";
|
|
|
14606
14739
|
const addAgent = beginContext((agentSchema) => {
|
|
14607
14740
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14608
14741
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14609
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14742
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
14610
14743
|
agentSchema,
|
|
14611
14744
|
});
|
|
14612
14745
|
// Register the agent in the validation and schema services
|
|
@@ -14616,7 +14749,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
14616
14749
|
return agentSchema.agentName;
|
|
14617
14750
|
});
|
|
14618
14751
|
|
|
14619
|
-
const METHOD_NAME$
|
|
14752
|
+
const METHOD_NAME$11 = "function.setup.addCompletion";
|
|
14620
14753
|
/**
|
|
14621
14754
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
14622
14755
|
*
|
|
@@ -14636,7 +14769,7 @@ const METHOD_NAME$U = "function.setup.addCompletion";
|
|
|
14636
14769
|
const addCompletion = beginContext((completionSchema) => {
|
|
14637
14770
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14638
14771
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14639
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14772
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
14640
14773
|
completionSchema,
|
|
14641
14774
|
});
|
|
14642
14775
|
// Register the completion in the validation and schema services
|
|
@@ -14646,7 +14779,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
14646
14779
|
return completionSchema.completionName;
|
|
14647
14780
|
});
|
|
14648
14781
|
|
|
14649
|
-
const METHOD_NAME$
|
|
14782
|
+
const METHOD_NAME$10 = "function.setup.addSwarm";
|
|
14650
14783
|
/**
|
|
14651
14784
|
* Adds a new swarm to the system for managing client sessions.
|
|
14652
14785
|
*
|
|
@@ -14666,7 +14799,7 @@ const METHOD_NAME$T = "function.setup.addSwarm";
|
|
|
14666
14799
|
const addSwarm = beginContext((swarmSchema) => {
|
|
14667
14800
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14668
14801
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14669
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14802
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
14670
14803
|
swarmSchema,
|
|
14671
14804
|
});
|
|
14672
14805
|
// Register the swarm in the validation and schema services
|
|
@@ -14676,7 +14809,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
14676
14809
|
return swarmSchema.swarmName;
|
|
14677
14810
|
});
|
|
14678
14811
|
|
|
14679
|
-
const METHOD_NAME
|
|
14812
|
+
const METHOD_NAME$$ = "function.setup.addTool";
|
|
14680
14813
|
/**
|
|
14681
14814
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
14682
14815
|
*
|
|
@@ -14698,7 +14831,7 @@ const METHOD_NAME$S = "function.setup.addTool";
|
|
|
14698
14831
|
const addTool = beginContext((toolSchema) => {
|
|
14699
14832
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14700
14833
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14701
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14834
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
14702
14835
|
toolSchema,
|
|
14703
14836
|
});
|
|
14704
14837
|
// Register the tool in the validation and schema services
|
|
@@ -14708,7 +14841,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
14708
14841
|
return toolSchema.toolName;
|
|
14709
14842
|
});
|
|
14710
14843
|
|
|
14711
|
-
const METHOD_NAME$
|
|
14844
|
+
const METHOD_NAME$_ = "function.setup.addState";
|
|
14712
14845
|
/**
|
|
14713
14846
|
* Adds a new state to the state registry for use within the swarm system.
|
|
14714
14847
|
*
|
|
@@ -14730,7 +14863,7 @@ const METHOD_NAME$R = "function.setup.addState";
|
|
|
14730
14863
|
const addState = beginContext((stateSchema) => {
|
|
14731
14864
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14732
14865
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14733
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14866
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
14734
14867
|
stateSchema,
|
|
14735
14868
|
});
|
|
14736
14869
|
// Register the state in the schema service
|
|
@@ -14745,7 +14878,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
14745
14878
|
return stateSchema.stateName;
|
|
14746
14879
|
});
|
|
14747
14880
|
|
|
14748
|
-
const METHOD_NAME$
|
|
14881
|
+
const METHOD_NAME$Z = "function.setup.addEmbedding";
|
|
14749
14882
|
/**
|
|
14750
14883
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
14751
14884
|
*
|
|
@@ -14765,7 +14898,7 @@ const METHOD_NAME$Q = "function.setup.addEmbedding";
|
|
|
14765
14898
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
14766
14899
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14767
14900
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14768
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14901
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
14769
14902
|
embeddingSchema,
|
|
14770
14903
|
});
|
|
14771
14904
|
// Register the embedding in the validation and schema services
|
|
@@ -14775,7 +14908,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
14775
14908
|
return embeddingSchema.embeddingName;
|
|
14776
14909
|
});
|
|
14777
14910
|
|
|
14778
|
-
const METHOD_NAME$
|
|
14911
|
+
const METHOD_NAME$Y = "function.setup.addStorage";
|
|
14779
14912
|
/**
|
|
14780
14913
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
14781
14914
|
*
|
|
@@ -14797,7 +14930,7 @@ const METHOD_NAME$P = "function.setup.addStorage";
|
|
|
14797
14930
|
const addStorage = beginContext((storageSchema) => {
|
|
14798
14931
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14799
14932
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14800
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14933
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
14801
14934
|
storageSchema,
|
|
14802
14935
|
});
|
|
14803
14936
|
// Register the storage in the validation and schema services
|
|
@@ -14814,7 +14947,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
14814
14947
|
});
|
|
14815
14948
|
|
|
14816
14949
|
/** @private Constant defining the method name for logging and validation context */
|
|
14817
|
-
const METHOD_NAME$
|
|
14950
|
+
const METHOD_NAME$X = "function.setup.addPolicy";
|
|
14818
14951
|
/**
|
|
14819
14952
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
14820
14953
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -14830,7 +14963,7 @@ const METHOD_NAME$O = "function.setup.addPolicy";
|
|
|
14830
14963
|
const addPolicy = beginContext((policySchema) => {
|
|
14831
14964
|
// Log the policy addition attempt if enabled
|
|
14832
14965
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14833
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14966
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
14834
14967
|
policySchema,
|
|
14835
14968
|
});
|
|
14836
14969
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -14841,6 +14974,281 @@ const addPolicy = beginContext((policySchema) => {
|
|
|
14841
14974
|
return policySchema.policyName;
|
|
14842
14975
|
});
|
|
14843
14976
|
|
|
14977
|
+
const METHOD_NAME$W = "function.test.overrideAgent";
|
|
14978
|
+
/**
|
|
14979
|
+
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
14980
|
+
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
14981
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
14982
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
14983
|
+
*
|
|
14984
|
+
* @param {TAgentSchema} agentSchema - The schema containing the agent’s unique name and optional properties to override.
|
|
14985
|
+
* @param {string} agentSchema.agentName - The unique identifier of the agent to override, matching `IAgentSchema["agentName"]`.
|
|
14986
|
+
* @param {Partial<IAgentSchema>} [agentSchema] - Optional partial schema properties to update, extending `IAgentSchema`.
|
|
14987
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s agent schema service.
|
|
14988
|
+
* @throws {Error} If the agent schema service encounters an error during the override operation (e.g., invalid agentName or schema).
|
|
14989
|
+
*
|
|
14990
|
+
* @example
|
|
14991
|
+
* // Override an agent’s schema with new properties
|
|
14992
|
+
* overrideAgent({
|
|
14993
|
+
* agentName: "WeatherAgent",
|
|
14994
|
+
* description: "Updated weather query handler",
|
|
14995
|
+
* tools: ["getWeather"],
|
|
14996
|
+
* });
|
|
14997
|
+
* // Logs the operation (if enabled) and updates the agent schema in the swarm.
|
|
14998
|
+
*/
|
|
14999
|
+
const overrideAgent = beginContext((agentSchema) => {
|
|
15000
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15001
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
15002
|
+
agentSchema,
|
|
15003
|
+
});
|
|
15004
|
+
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
15005
|
+
});
|
|
15006
|
+
|
|
15007
|
+
const METHOD_NAME$V = "function.test.overrideCompletion";
|
|
15008
|
+
/**
|
|
15009
|
+
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
15010
|
+
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
15011
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15012
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15013
|
+
*
|
|
15014
|
+
* @param {TCompletionSchema} completionSchema - The schema containing the completion’s unique name and optional properties to override.
|
|
15015
|
+
* @param {string} completionSchema.completionName - The unique identifier of the completion to override, matching `ICompletionSchema["completionName"]`.
|
|
15016
|
+
* @param {Partial<ICompletionSchema>} [completionSchema] - Optional partial schema properties to update, extending `ICompletionSchema`.
|
|
15017
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s completion schema service.
|
|
15018
|
+
* @throws {Error} If the completion schema service encounters an error during the override operation (e.g., invalid completionName or schema).
|
|
15019
|
+
*
|
|
15020
|
+
* @example
|
|
15021
|
+
* // Override a completion’s schema with new properties
|
|
15022
|
+
* overrideCompletion({
|
|
15023
|
+
* completionName: "TextCompletion",
|
|
15024
|
+
* model: "gpt-4",
|
|
15025
|
+
* maxTokens: 500,
|
|
15026
|
+
* });
|
|
15027
|
+
* // Logs the operation (if enabled) and updates the completion schema in the swarm.
|
|
15028
|
+
*/
|
|
15029
|
+
const overrideCompletion = beginContext((completionSchema) => {
|
|
15030
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15031
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
15032
|
+
completionSchema,
|
|
15033
|
+
});
|
|
15034
|
+
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
15035
|
+
});
|
|
15036
|
+
|
|
15037
|
+
const METHOD_NAME$U = "function.test.overrideEmbeding";
|
|
15038
|
+
/**
|
|
15039
|
+
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
15040
|
+
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
15041
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15042
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15043
|
+
*
|
|
15044
|
+
* @param {TEmbeddingSchema} embeddingSchema - The schema containing the embedding’s unique name and optional properties to override.
|
|
15045
|
+
* @param {string} embeddingSchema.embeddingName - The unique identifier of the embedding to override, matching `IEmbeddingSchema["embeddingName"]`.
|
|
15046
|
+
* @param {Partial<IEmbeddingSchema>} [embeddingSchema] - Optional partial schema properties to update, extending `IEmbeddingSchema`.
|
|
15047
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s embedding schema service.
|
|
15048
|
+
* @throws {Error} If the embedding schema service encounters an error during the override operation (e.g., invalid embeddingName or schema).
|
|
15049
|
+
*
|
|
15050
|
+
* @example
|
|
15051
|
+
* // Override an embedding’s schema with new properties
|
|
15052
|
+
* overrideEmbeding({
|
|
15053
|
+
* embeddingName: "TextEmbedding",
|
|
15054
|
+
* persist: true,
|
|
15055
|
+
* callbacks: {
|
|
15056
|
+
* onCreate: (text, embeddings) => console.log(`Created embedding for ${text}`),
|
|
15057
|
+
* },
|
|
15058
|
+
* });
|
|
15059
|
+
* // Logs the operation (if enabled) and updates the embedding schema in the swarm.
|
|
15060
|
+
*/
|
|
15061
|
+
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
15062
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15063
|
+
swarm$1.loggerService.log(METHOD_NAME$U, {
|
|
15064
|
+
embeddingSchema,
|
|
15065
|
+
});
|
|
15066
|
+
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
15067
|
+
});
|
|
15068
|
+
|
|
15069
|
+
const METHOD_NAME$T = "function.test.overridePolicy";
|
|
15070
|
+
/**
|
|
15071
|
+
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
15072
|
+
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
15073
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15074
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15075
|
+
*
|
|
15076
|
+
* @param {TPolicySchema} policySchema - The schema containing the policy’s unique name and optional properties to override.
|
|
15077
|
+
* @param {string} policySchema.policyName - The unique identifier of the policy to override, matching `IPolicySchema["policyName"]`.
|
|
15078
|
+
* @param {Partial<IPolicySchema>} [policySchema] - Optional partial schema properties to update, extending `IPolicySchema`.
|
|
15079
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s policy schema service.
|
|
15080
|
+
* @throws {Error} If the policy schema service encounters an error during the override operation (e.g., invalid policyName or schema).
|
|
15081
|
+
*
|
|
15082
|
+
* @example
|
|
15083
|
+
* // Override a policy’s schema with new properties
|
|
15084
|
+
* overridePolicy({
|
|
15085
|
+
* policyName: "ContentFilter",
|
|
15086
|
+
* autoBan: true,
|
|
15087
|
+
* banMessage: "Content policy violation detected.",
|
|
15088
|
+
* });
|
|
15089
|
+
* // Logs the operation (if enabled) and updates the policy schema in the swarm.
|
|
15090
|
+
*/
|
|
15091
|
+
const overridePolicy = beginContext((policySchema) => {
|
|
15092
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15093
|
+
swarm$1.loggerService.log(METHOD_NAME$T, {
|
|
15094
|
+
policySchema,
|
|
15095
|
+
});
|
|
15096
|
+
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
15097
|
+
});
|
|
15098
|
+
|
|
15099
|
+
const METHOD_NAME$S = "function.test.overrideState";
|
|
15100
|
+
/**
|
|
15101
|
+
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
15102
|
+
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
15103
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15104
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15105
|
+
*
|
|
15106
|
+
* @template T - The type of the state data, defaults to `any`.
|
|
15107
|
+
* @param {TStateSchema<T>} stateSchema - The schema containing the state’s unique name and optional properties to override.
|
|
15108
|
+
* @param {string} stateSchema.stateName - The unique identifier of the state to override, matching `IStateSchema<T>["stateName"]`.
|
|
15109
|
+
* @param {Partial<IStateSchema<T>>} [stateSchema] - Optional partial schema properties to update, extending `IStateSchema<T>`.
|
|
15110
|
+
* @returns {IStateSchema<T>} The updated state schema as applied by the swarm’s state schema service.
|
|
15111
|
+
* @throws {Error} If the state schema service encounters an error during the override operation (e.g., invalid stateName or schema).
|
|
15112
|
+
*
|
|
15113
|
+
* @example
|
|
15114
|
+
* // Override a state’s schema with new properties
|
|
15115
|
+
* overrideState({
|
|
15116
|
+
* stateName: "UserPreferences",
|
|
15117
|
+
* persist: true,
|
|
15118
|
+
* getDefaultState: () => ({ theme: "dark" }),
|
|
15119
|
+
* });
|
|
15120
|
+
* // Logs the operation (if enabled) and updates the state schema in the swarm.
|
|
15121
|
+
*/
|
|
15122
|
+
const overrideState = beginContext((stateSchema) => {
|
|
15123
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15124
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
15125
|
+
stateSchema,
|
|
15126
|
+
});
|
|
15127
|
+
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
15128
|
+
});
|
|
15129
|
+
|
|
15130
|
+
const METHOD_NAME$R = "function.test.overrideStorage";
|
|
15131
|
+
/**
|
|
15132
|
+
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
15133
|
+
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
15134
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15135
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15136
|
+
*
|
|
15137
|
+
* @template T - The type of the storage data, defaults to `IStorageData`.
|
|
15138
|
+
* @param {TStorageSchema<T>} storageSchema - The schema containing the storage’s unique name and optional properties to override.
|
|
15139
|
+
* @param {string} storageSchema.storageName - The unique identifier of the storage to override, matching `IStorageSchema<T>["storageName"]`.
|
|
15140
|
+
* @param {Partial<IStorageSchema<T>>} [storageSchema] - Optional partial schema properties to update, extending `IStorageSchema<T>`.
|
|
15141
|
+
* @returns {IStorageSchema<T>} The updated storage schema as applied by the swarm’s storage schema service.
|
|
15142
|
+
* @throws {Error} If the storage schema service encounters an error during the override operation (e.g., invalid storageName or schema).
|
|
15143
|
+
*
|
|
15144
|
+
* @example
|
|
15145
|
+
* // Override a storage’s schema with new properties
|
|
15146
|
+
* overrideStorage({
|
|
15147
|
+
* storageName: "UserData",
|
|
15148
|
+
* persist: true,
|
|
15149
|
+
* embedding: "TextEmbedding",
|
|
15150
|
+
* createIndex: (item) => item.id.toString(),
|
|
15151
|
+
* });
|
|
15152
|
+
* // Logs the operation (if enabled) and updates the storage schema in the swarm.
|
|
15153
|
+
*/
|
|
15154
|
+
const overrideStorage = beginContext((storageSchema) => {
|
|
15155
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15156
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
15157
|
+
storageSchema,
|
|
15158
|
+
});
|
|
15159
|
+
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
15160
|
+
});
|
|
15161
|
+
|
|
15162
|
+
const METHOD_NAME$Q = "function.test.overrideSwarm";
|
|
15163
|
+
/**
|
|
15164
|
+
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
15165
|
+
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
15166
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15167
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15168
|
+
*
|
|
15169
|
+
* @param {TSwarmSchema} swarmSchema - The schema containing the swarm’s unique name and optional properties to override.
|
|
15170
|
+
* @param {string} swarmSchema.swarmName - The unique identifier of the swarm to override, matching `ISwarmSchema["swarmName"]`.
|
|
15171
|
+
* @param {Partial<ISwarmSchema>} [swarmSchema] - Optional partial schema properties to update, extending `ISwarmSchema`.
|
|
15172
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s swarm schema service.
|
|
15173
|
+
* @throws {Error} If the swarm schema service encounters an error during the override operation (e.g., invalid swarmName or schema).
|
|
15174
|
+
*
|
|
15175
|
+
* @example
|
|
15176
|
+
* // Override a swarm’s schema with new properties
|
|
15177
|
+
* overrideSwarm({
|
|
15178
|
+
* swarmName: "MainSwarm",
|
|
15179
|
+
* defaultAgent: "WeatherAgent",
|
|
15180
|
+
* policies: ["ContentFilter"],
|
|
15181
|
+
* });
|
|
15182
|
+
* // Logs the operation (if enabled) and updates the swarm schema in the swarm system.
|
|
15183
|
+
*/
|
|
15184
|
+
const overrideSwarm = beginContext((swarmSchema) => {
|
|
15185
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15186
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
15187
|
+
swarmSchema,
|
|
15188
|
+
});
|
|
15189
|
+
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
15190
|
+
});
|
|
15191
|
+
|
|
15192
|
+
const METHOD_NAME$P = "function.test.overrideTool";
|
|
15193
|
+
/**
|
|
15194
|
+
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
15195
|
+
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
15196
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15197
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15198
|
+
*
|
|
15199
|
+
* @param {TAgentTool} toolSchema - The schema containing the tool’s unique name and optional properties to override.
|
|
15200
|
+
* @param {string} toolSchema.toolName - The unique identifier of the tool to override, matching `IAgentTool["toolName"]`.
|
|
15201
|
+
* @param {Partial<IAgentTool>} [toolSchema] - Optional partial schema properties to update, extending `IAgentTool`.
|
|
15202
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s tool schema service.
|
|
15203
|
+
* @throws {Error} If the tool schema service encounters an error during the override operation (e.g., invalid toolName or schema).
|
|
15204
|
+
*
|
|
15205
|
+
* @example
|
|
15206
|
+
* // Override a tool’s schema with new properties
|
|
15207
|
+
* overrideTool({
|
|
15208
|
+
* toolName: "WeatherTool",
|
|
15209
|
+
* description: "Updated weather data retrieval tool",
|
|
15210
|
+
* execute: async (params) => fetchWeather(params),
|
|
15211
|
+
* });
|
|
15212
|
+
* // Logs the operation (if enabled) and updates the tool schema in the swarm.
|
|
15213
|
+
*/
|
|
15214
|
+
const overrideTool = beginContext((toolSchema) => {
|
|
15215
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15216
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
15217
|
+
toolSchema,
|
|
15218
|
+
});
|
|
15219
|
+
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
15220
|
+
});
|
|
15221
|
+
|
|
15222
|
+
const METHOD_NAME$O = "function.test.overrideWiki";
|
|
15223
|
+
/**
|
|
15224
|
+
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
15225
|
+
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
15226
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15227
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15228
|
+
*
|
|
15229
|
+
* @param {TWikiSchema} wikiSchema - The schema containing the wiki’s unique name and optional properties to override.
|
|
15230
|
+
* @param {string} wikiSchema.wikiName - The unique identifier of the wiki to override, matching `IWikiSchema["wikiName"]`.
|
|
15231
|
+
* @param {Partial<IWikiSchema>} [wikiSchema] - Optional partial schema properties to update, extending `IWikiSchema`.
|
|
15232
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s wiki schema service.
|
|
15233
|
+
* @throws {Error} If the wiki schema service encounters an error during the override operation (e.g., invalid wikiName or schema).
|
|
15234
|
+
*
|
|
15235
|
+
* @example
|
|
15236
|
+
* // Override a wiki’s schema with new properties
|
|
15237
|
+
* overrideWiki({
|
|
15238
|
+
* wikiName: "KnowledgeBase",
|
|
15239
|
+
* description: "Updated knowledge repository",
|
|
15240
|
+
* storage: "WikiStorage",
|
|
15241
|
+
* });
|
|
15242
|
+
* // Logs the operation (if enabled) and updates the wiki schema in the swarm.
|
|
15243
|
+
*/
|
|
15244
|
+
const overrideWiki = beginContext((wikiSchema) => {
|
|
15245
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15246
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
15247
|
+
wikiSchema,
|
|
15248
|
+
});
|
|
15249
|
+
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
15250
|
+
});
|
|
15251
|
+
|
|
14844
15252
|
const METHOD_NAME$N = "function.other.markOnline";
|
|
14845
15253
|
/**
|
|
14846
15254
|
* Marks a client as online in the specified swarm.
|
|
@@ -17228,7 +17636,7 @@ const CHANGE_AGENT_GC$2 = 60 * 1000;
|
|
|
17228
17636
|
*/
|
|
17229
17637
|
const createChangeToAgent = functoolsKit.ttl((clientId) => functoolsKit.queued(async (methodName, agentName, swarmName) => {
|
|
17230
17638
|
if (!swarm$1.navigationValidationService.shouldNavigate(agentName, clientId, swarmName)) {
|
|
17231
|
-
console.warn(`function "changeToAgent" skipped due to circular route found clientId=${clientId} swarmName=${swarmName} agentNameTo=${agentName}`);
|
|
17639
|
+
console.warn(`function "changeToAgent" skipped due to the circular route found clientId=${clientId} swarmName=${swarmName} agentNameTo=${agentName}`);
|
|
17232
17640
|
return false;
|
|
17233
17641
|
}
|
|
17234
17642
|
// Notify all agents in the swarm of the change
|
|
@@ -19595,6 +20003,15 @@ exports.markOffline = markOffline;
|
|
|
19595
20003
|
exports.markOnline = markOnline;
|
|
19596
20004
|
exports.notify = notify;
|
|
19597
20005
|
exports.notifyForce = notifyForce;
|
|
20006
|
+
exports.overrideAgent = overrideAgent;
|
|
20007
|
+
exports.overrideCompletion = overrideCompletion;
|
|
20008
|
+
exports.overrideEmbeding = overrideEmbeding;
|
|
20009
|
+
exports.overridePolicy = overridePolicy;
|
|
20010
|
+
exports.overrideState = overrideState;
|
|
20011
|
+
exports.overrideStorage = overrideStorage;
|
|
20012
|
+
exports.overrideSwarm = overrideSwarm;
|
|
20013
|
+
exports.overrideTool = overrideTool;
|
|
20014
|
+
exports.overrideWiki = overrideWiki;
|
|
19598
20015
|
exports.question = question;
|
|
19599
20016
|
exports.questionForce = questionForce;
|
|
19600
20017
|
exports.runStateless = runStateless;
|