agent-swarm-kit 1.1.1 → 1.1.3
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 +457 -35
- package/build/index.mjs +449 -36
- package/package.json +2 -2
- package/types.d.ts +332 -1
package/build/index.cjs
CHANGED
|
@@ -3078,6 +3078,10 @@ const CC_DEFAULT_CONNECT_OPERATOR = (clientId, agentName) => OperatorAdapter.con
|
|
|
3078
3078
|
* Flag to enable operator timeout, used in `ClientOperator` for message processing.
|
|
3079
3079
|
*/
|
|
3080
3080
|
const CC_ENABLE_OPERATOR_TIMEOUT = false;
|
|
3081
|
+
/**
|
|
3082
|
+
* Disable fetch of data from all storages. Quite usefull for unit tests
|
|
3083
|
+
*/
|
|
3084
|
+
const CC_STORAGE_DISABLE_GET_DATA = false;
|
|
3081
3085
|
const GLOBAL_CONFIG = {
|
|
3082
3086
|
CC_TOOL_CALL_EXCEPTION_FLUSH_PROMPT,
|
|
3083
3087
|
CC_TOOL_CALL_EXCEPTION_RECOMPLETE_PROMPT,
|
|
@@ -3128,6 +3132,7 @@ const GLOBAL_CONFIG = {
|
|
|
3128
3132
|
CC_THROW_WHEN_NAVIGATION_RECURSION,
|
|
3129
3133
|
CC_DEFAULT_CONNECT_OPERATOR,
|
|
3130
3134
|
CC_ENABLE_OPERATOR_TIMEOUT,
|
|
3135
|
+
CC_STORAGE_DISABLE_GET_DATA,
|
|
3131
3136
|
};
|
|
3132
3137
|
GLOBAL_CONFIG.CC_RESQUE_STRATEGY = "flush";
|
|
3133
3138
|
/**
|
|
@@ -3445,6 +3450,21 @@ class AgentSchemaService {
|
|
|
3445
3450
|
this.validateShallow(value);
|
|
3446
3451
|
this.registry = this.registry.register(key, value);
|
|
3447
3452
|
};
|
|
3453
|
+
/**
|
|
3454
|
+
* Overrides an existing agent schema in the registry with a new schema.
|
|
3455
|
+
* Replaces the schema associated with the provided key (agentName) in the ToolRegistry.
|
|
3456
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
3457
|
+
* Supports dynamic updates to agent schemas for AgentConnectionService and SwarmConnectionService.
|
|
3458
|
+
* @param {AgentName} key - The name of the agent, used as the registry key, sourced from Agent.interface.
|
|
3459
|
+
* @param {IAgentSchema} value - The new agent schema to override the existing one, sourced from Agent.interface.
|
|
3460
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
3461
|
+
*/
|
|
3462
|
+
this.override = (key, value) => {
|
|
3463
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
3464
|
+
this.loggerService.info(`agentSchemaService override`, { key });
|
|
3465
|
+
this.registry = this.registry.override(key, value);
|
|
3466
|
+
return this.registry.get(key);
|
|
3467
|
+
};
|
|
3448
3468
|
/**
|
|
3449
3469
|
* Retrieves an agent schema from the registry by its name.
|
|
3450
3470
|
* 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 +4840,7 @@ class AgentConnectionService {
|
|
|
4820
4840
|
}
|
|
4821
4841
|
|
|
4822
4842
|
/** @private Constant defining the method name for logging purposes */
|
|
4823
|
-
const METHOD_NAME$
|
|
4843
|
+
const METHOD_NAME$19 = "function.common.getPayload";
|
|
4824
4844
|
/**
|
|
4825
4845
|
* Retrieves the payload from the current PayloadContextService context.
|
|
4826
4846
|
* Returns null if no context is available. Logs the operation if logging is enabled.
|
|
@@ -4831,7 +4851,7 @@ const METHOD_NAME$10 = "function.common.getPayload";
|
|
|
4831
4851
|
* console.log(payload); // { id: number } or null
|
|
4832
4852
|
*/
|
|
4833
4853
|
const getPayload = () => {
|
|
4834
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
4854
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$19);
|
|
4835
4855
|
if (PayloadContextService.hasContext()) {
|
|
4836
4856
|
const { payload } = swarm$1.payloadContextService.context;
|
|
4837
4857
|
return payload;
|
|
@@ -5227,6 +5247,21 @@ class ToolSchemaService {
|
|
|
5227
5247
|
this.validateShallow(value);
|
|
5228
5248
|
this.registry = this.registry.register(key, value);
|
|
5229
5249
|
};
|
|
5250
|
+
/**
|
|
5251
|
+
* Overrides an existing tool schema in the registry with a new schema.
|
|
5252
|
+
* Replaces the schema associated with the provided key (toolName) in the ToolRegistry.
|
|
5253
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
5254
|
+
* Supports dynamic updates to tool schemas for AgentConnectionService and SwarmConnectionService.
|
|
5255
|
+
* @param {ToolName} key - The name of the tool to override, sourced from Agent.interface.
|
|
5256
|
+
* @param {IAgentTool} value - The new tool schema to replace the existing one, sourced from Agent.interface.
|
|
5257
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
5258
|
+
*/
|
|
5259
|
+
this.override = (key, value) => {
|
|
5260
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5261
|
+
this.loggerService.info(`toolSchemaService override`, { key });
|
|
5262
|
+
this.registry = this.registry.override(key, value);
|
|
5263
|
+
return this.registry.get(key);
|
|
5264
|
+
};
|
|
5230
5265
|
/**
|
|
5231
5266
|
* Retrieves a tool schema from the registry by its name.
|
|
5232
5267
|
* 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 +6028,21 @@ class SwarmSchemaService {
|
|
|
5993
6028
|
this.validateShallow(value);
|
|
5994
6029
|
this.registry = this.registry.register(key, value);
|
|
5995
6030
|
};
|
|
6031
|
+
/**
|
|
6032
|
+
* Overrides an existing swarm schema in the registry with a new value.
|
|
6033
|
+
* Replaces the schema associated with the given key in the ToolRegistry.
|
|
6034
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6035
|
+
* Supports dynamic updates to swarm configurations, allowing modifications to agentList, defaultAgent, or policies.
|
|
6036
|
+
* @param {SwarmName} key - The name of the swarm to override, sourced from Swarm.interface.
|
|
6037
|
+
* @param {ISwarmSchema} value - The new swarm schema to replace the existing one, sourced from Swarm.interface.
|
|
6038
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6039
|
+
*/
|
|
6040
|
+
this.override = (key, value) => {
|
|
6041
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6042
|
+
this.loggerService.info(`swarmSchemaService override`, { key });
|
|
6043
|
+
this.registry = this.registry.override(key, value);
|
|
6044
|
+
return this.registry.get(key);
|
|
6045
|
+
};
|
|
5996
6046
|
/**
|
|
5997
6047
|
* Retrieves a swarm schema from the registry by its name.
|
|
5998
6048
|
* 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 +6119,21 @@ class CompletionSchemaService {
|
|
|
6069
6119
|
this.validateShallow(value);
|
|
6070
6120
|
this.registry = this.registry.register(key, value);
|
|
6071
6121
|
};
|
|
6122
|
+
/**
|
|
6123
|
+
* Overrides an existing completion schema in the registry with a new one.
|
|
6124
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
6125
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6126
|
+
* Supports dynamic updates to completion schemas used by AgentSchemaService, ClientAgent, and other swarm components.
|
|
6127
|
+
* @param {CompletionName} key - The name of the completion to override, sourced from Completion.interface.
|
|
6128
|
+
* @param {ICompletionSchema} value - The new completion schema to replace the existing one, sourced from Completion.interface.
|
|
6129
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6130
|
+
*/
|
|
6131
|
+
this.override = (key, value) => {
|
|
6132
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
6133
|
+
this.loggerService.info(`completionSchemaService override`, { key });
|
|
6134
|
+
this.registry = this.registry.override(key, value);
|
|
6135
|
+
return this.registry.get(key);
|
|
6136
|
+
};
|
|
6072
6137
|
/**
|
|
6073
6138
|
* Retrieves a completion schema from the registry by its name.
|
|
6074
6139
|
* 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 +9341,21 @@ class EmbeddingSchemaService {
|
|
|
9276
9341
|
this.validateShallow(value);
|
|
9277
9342
|
this.registry = this.registry.register(key, value);
|
|
9278
9343
|
};
|
|
9344
|
+
/**
|
|
9345
|
+
* Overrides an existing embedding schema in the registry with a new one.
|
|
9346
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9347
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9348
|
+
* Supports updating embedding logic (e.g., calculateSimilarity and createEmbedding) for storage operations in StorageConnectionService and SharedStorageConnectionService.
|
|
9349
|
+
* @param {EmbeddingName} key - The name of the embedding to override, sourced from Embedding.interface.
|
|
9350
|
+
* @param {IEmbeddingSchema} value - The new embedding schema to associate with the key, sourced from Embedding.interface.
|
|
9351
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9352
|
+
*/
|
|
9353
|
+
this.override = (key, value) => {
|
|
9354
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9355
|
+
this.loggerService.info(`embeddingSchemaService override`, { key });
|
|
9356
|
+
this.registry = this.registry.override(key, value);
|
|
9357
|
+
return this.registry.get(key);
|
|
9358
|
+
};
|
|
9279
9359
|
/**
|
|
9280
9360
|
* Retrieves an embedding schema from the registry by its name.
|
|
9281
9361
|
* 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 +9435,21 @@ class StorageSchemaService {
|
|
|
9355
9435
|
this.validateShallow(value);
|
|
9356
9436
|
this.registry = this.registry.register(key, value);
|
|
9357
9437
|
};
|
|
9438
|
+
/**
|
|
9439
|
+
* Overrides an existing storage schema in the registry with a new schema.
|
|
9440
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
9441
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
9442
|
+
* Supports updates to storage configurations for ClientStorage and SharedStorageConnectionService.
|
|
9443
|
+
* @param {StorageName} key - The name of the storage to override, sourced from Storage.interface.
|
|
9444
|
+
* @param {IStorageSchema} value - The new storage schema to replace the existing one, sourced from Storage.interface.
|
|
9445
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
9446
|
+
*/
|
|
9447
|
+
this.override = (key, value) => {
|
|
9448
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9449
|
+
this.loggerService.info(`storageSchemaService override`, { key });
|
|
9450
|
+
this.registry = this.registry.override(key, value);
|
|
9451
|
+
return this.registry.get(key);
|
|
9452
|
+
};
|
|
9358
9453
|
/**
|
|
9359
9454
|
* Retrieves a storage schema from the registry by its name.
|
|
9360
9455
|
* 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 +10570,21 @@ class StateSchemaService {
|
|
|
10475
10570
|
this.validateShallow(value);
|
|
10476
10571
|
this.registry = this.registry.register(key, value);
|
|
10477
10572
|
};
|
|
10573
|
+
/**
|
|
10574
|
+
* Overrides an existing state schema in the registry with a new schema.
|
|
10575
|
+
* Replaces the schema associated with the provided key (stateName) in the ToolRegistry.
|
|
10576
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
10577
|
+
* Supports dynamic updates to state schemas for StateConnectionService and SharedStateConnectionService.
|
|
10578
|
+
* @param {StateName} key - The name of the state to override, sourced from State.interface.
|
|
10579
|
+
* @param {IStateSchema} value - The new state schema to replace the existing one, sourced from State.interface.
|
|
10580
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
10581
|
+
*/
|
|
10582
|
+
this.override = (key, value) => {
|
|
10583
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
10584
|
+
this.loggerService.info(`stateSchemaService override`, { key });
|
|
10585
|
+
this.registry = this.registry.override(key, value);
|
|
10586
|
+
return this.registry.get(key);
|
|
10587
|
+
};
|
|
10478
10588
|
/**
|
|
10479
10589
|
* Retrieves a state schema from the registry by its name.
|
|
10480
10590
|
* 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 +13372,21 @@ class PolicySchemaService {
|
|
|
13262
13372
|
this.validateShallow(value);
|
|
13263
13373
|
this.registry = this.registry.register(key, value);
|
|
13264
13374
|
};
|
|
13375
|
+
/**
|
|
13376
|
+
* Overrides an existing policy schema in the registry with a new one.
|
|
13377
|
+
* Replaces the schema associated with the provided key (policyName) in the ToolRegistry.
|
|
13378
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
13379
|
+
* Supports dynamic updates to policy schemas, ensuring the latest logic is applied in ClientAgent execution and SessionConnectionService.
|
|
13380
|
+
* @param {PolicyName} key - The name of the policy to override, sourced from Policy.interface.
|
|
13381
|
+
* @param {IPolicySchema} value - The new policy schema to replace the existing one, validated before storage.
|
|
13382
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
13383
|
+
*/
|
|
13384
|
+
this.override = (key, value) => {
|
|
13385
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
13386
|
+
this.loggerService.info(`policySchemaService override`, { key });
|
|
13387
|
+
this.registry = this.registry.override(key, value);
|
|
13388
|
+
return this.registry.get(key);
|
|
13389
|
+
};
|
|
13265
13390
|
/**
|
|
13266
13391
|
* Retrieves a policy schema from the registry by its name.
|
|
13267
13392
|
* 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 +14298,19 @@ class WikiSchemaService {
|
|
|
14173
14298
|
this.validateShallow(value);
|
|
14174
14299
|
this.registry = this.registry.register(key, value);
|
|
14175
14300
|
};
|
|
14301
|
+
/**
|
|
14302
|
+
* Overrides an existing wiki schema with a new value for a given key
|
|
14303
|
+
* @public
|
|
14304
|
+
* @param {WikiName} key - The key of the schema to override
|
|
14305
|
+
* @param {IWikiSchema} value - The new wiki schema to set
|
|
14306
|
+
* @description Logs the override operation and updates the registry with the new schema
|
|
14307
|
+
*/
|
|
14308
|
+
this.override = (key, value) => {
|
|
14309
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
14310
|
+
this.loggerService.info(`wikiSchemaService override`, { key });
|
|
14311
|
+
this.registry = this.registry.override(key, value);
|
|
14312
|
+
return this.registry.get(key);
|
|
14313
|
+
};
|
|
14176
14314
|
/**
|
|
14177
14315
|
* Retrieves a wiki schema by key
|
|
14178
14316
|
* @public
|
|
@@ -14382,7 +14520,7 @@ const swarm = {
|
|
|
14382
14520
|
init();
|
|
14383
14521
|
var swarm$1 = swarm;
|
|
14384
14522
|
|
|
14385
|
-
const METHOD_NAME
|
|
14523
|
+
const METHOD_NAME$18 = "cli.dumpDocs";
|
|
14386
14524
|
/**
|
|
14387
14525
|
* Dumps the documentation for the agents and swarms.
|
|
14388
14526
|
*
|
|
@@ -14392,7 +14530,7 @@ const METHOD_NAME$$ = "cli.dumpDocs";
|
|
|
14392
14530
|
*/
|
|
14393
14531
|
const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantUML) => {
|
|
14394
14532
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14395
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14533
|
+
swarm$1.loggerService.log(METHOD_NAME$18, {
|
|
14396
14534
|
dirName,
|
|
14397
14535
|
});
|
|
14398
14536
|
if (PlantUML) {
|
|
@@ -14402,10 +14540,10 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14402
14540
|
}
|
|
14403
14541
|
swarm$1.agentValidationService
|
|
14404
14542
|
.getAgentList()
|
|
14405
|
-
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME
|
|
14543
|
+
.forEach((agentName) => swarm$1.agentValidationService.validate(agentName, METHOD_NAME$18));
|
|
14406
14544
|
swarm$1.swarmValidationService
|
|
14407
14545
|
.getSwarmList()
|
|
14408
|
-
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME
|
|
14546
|
+
.forEach((swarmName) => swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$18));
|
|
14409
14547
|
swarm$1.agentValidationService.getAgentList().forEach((agentName) => {
|
|
14410
14548
|
const { dependsOn } = swarm$1.agentSchemaService.get(agentName);
|
|
14411
14549
|
if (!dependsOn) {
|
|
@@ -14415,7 +14553,7 @@ const dumpDocs = beginContext((prefix = "swarm", dirName = "./docs/chat", PlantU
|
|
|
14415
14553
|
return swarm$1.docService.dumpDocs(prefix, dirName);
|
|
14416
14554
|
});
|
|
14417
14555
|
|
|
14418
|
-
const METHOD_NAME$
|
|
14556
|
+
const METHOD_NAME$17 = "cli.dumpAgent";
|
|
14419
14557
|
/**
|
|
14420
14558
|
* Dumps the agent information into PlantUML format.
|
|
14421
14559
|
*
|
|
@@ -14424,14 +14562,14 @@ const METHOD_NAME$_ = "cli.dumpAgent";
|
|
|
14424
14562
|
*/
|
|
14425
14563
|
const dumpAgent = beginContext((agentName, { withSubtree = false } = {}) => {
|
|
14426
14564
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14427
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14565
|
+
swarm$1.loggerService.log(METHOD_NAME$17, {
|
|
14428
14566
|
agentName,
|
|
14429
14567
|
});
|
|
14430
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
14568
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$17);
|
|
14431
14569
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
14432
14570
|
});
|
|
14433
14571
|
|
|
14434
|
-
const METHOD_NAME$
|
|
14572
|
+
const METHOD_NAME$16 = "cli.dumpSwarm";
|
|
14435
14573
|
/**
|
|
14436
14574
|
* Dumps the swarm information into PlantUML format.
|
|
14437
14575
|
*
|
|
@@ -14440,14 +14578,14 @@ const METHOD_NAME$Z = "cli.dumpSwarm";
|
|
|
14440
14578
|
*/
|
|
14441
14579
|
const dumpSwarm = beginContext((swarmName) => {
|
|
14442
14580
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14443
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14581
|
+
swarm$1.loggerService.log(METHOD_NAME$16, {
|
|
14444
14582
|
swarmName,
|
|
14445
14583
|
});
|
|
14446
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
14584
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$16);
|
|
14447
14585
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
14448
14586
|
});
|
|
14449
14587
|
|
|
14450
|
-
const METHOD_NAME$
|
|
14588
|
+
const METHOD_NAME$15 = "cli.dumpPerfomance";
|
|
14451
14589
|
const METHOD_NAME_INTERNAL$1 = "cli.dumpPerfomance.internal";
|
|
14452
14590
|
const METHOD_NAME_INTERVAL = "cli.dumpPerfomance.interval";
|
|
14453
14591
|
/**
|
|
@@ -14466,7 +14604,7 @@ const dumpPerfomanceInternal = beginContext(async (dirName = "./logs/meta") => {
|
|
|
14466
14604
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14467
14605
|
*/
|
|
14468
14606
|
const dumpPerfomance = async (dirName = "./logs/meta") => {
|
|
14469
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14607
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$15);
|
|
14470
14608
|
await dumpPerfomanceInternal(dirName);
|
|
14471
14609
|
};
|
|
14472
14610
|
/**
|
|
@@ -14524,7 +14662,7 @@ const listenExecutionEvent = beginContext((clientId, fn) => {
|
|
|
14524
14662
|
return swarm$1.busService.subscribe(clientId, "execution-bus", functoolsKit.queued(async (e) => await fn(e)));
|
|
14525
14663
|
});
|
|
14526
14664
|
|
|
14527
|
-
const METHOD_NAME$
|
|
14665
|
+
const METHOD_NAME$14 = "cli.dumpClientPerformance";
|
|
14528
14666
|
const METHOD_NAME_INTERNAL = "cli.dumpClientPerformance.internal";
|
|
14529
14667
|
const METHOD_NAME_EXECUTE = "cli.dumpClientPerformance.execute";
|
|
14530
14668
|
/**
|
|
@@ -14548,7 +14686,7 @@ const dumpClientPerformanceInternal = beginContext(async (clientId, dirName = ".
|
|
|
14548
14686
|
* @returns {Promise<void>} A promise that resolves when the performance data has been dumped.
|
|
14549
14687
|
*/
|
|
14550
14688
|
const dumpClientPerformance = async (clientId, dirName = "./logs/client") => {
|
|
14551
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$
|
|
14689
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG && swarm$1.loggerService.log(METHOD_NAME$14);
|
|
14552
14690
|
await dumpClientPerformanceInternal(clientId, dirName);
|
|
14553
14691
|
};
|
|
14554
14692
|
/**
|
|
@@ -14569,7 +14707,7 @@ dumpClientPerformance.runAfterExecute = beginContext(async (dirName = "./logs/cl
|
|
|
14569
14707
|
});
|
|
14570
14708
|
|
|
14571
14709
|
/** @constant {string} METHOD_NAME - The name of the method used for logging */
|
|
14572
|
-
const METHOD_NAME$
|
|
14710
|
+
const METHOD_NAME$13 = "function.setup.addWiki";
|
|
14573
14711
|
/**
|
|
14574
14712
|
* Adds a wiki schema to the system
|
|
14575
14713
|
* @function addWiki
|
|
@@ -14578,7 +14716,7 @@ const METHOD_NAME$W = "function.setup.addWiki";
|
|
|
14578
14716
|
*/
|
|
14579
14717
|
const addWiki = beginContext((wikiSchema) => {
|
|
14580
14718
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14581
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14719
|
+
swarm$1.loggerService.log(METHOD_NAME$13, {
|
|
14582
14720
|
wikiSchema,
|
|
14583
14721
|
});
|
|
14584
14722
|
swarm$1.wikiValidationService.addWiki(wikiSchema.wikiName, wikiSchema);
|
|
@@ -14586,7 +14724,7 @@ const addWiki = beginContext((wikiSchema) => {
|
|
|
14586
14724
|
return wikiSchema.wikiName;
|
|
14587
14725
|
});
|
|
14588
14726
|
|
|
14589
|
-
const METHOD_NAME$
|
|
14727
|
+
const METHOD_NAME$12 = "function.setup.addAgent";
|
|
14590
14728
|
/**
|
|
14591
14729
|
* Adds a new agent to the agent registry for use within the swarm system.
|
|
14592
14730
|
*
|
|
@@ -14606,7 +14744,7 @@ const METHOD_NAME$V = "function.setup.addAgent";
|
|
|
14606
14744
|
const addAgent = beginContext((agentSchema) => {
|
|
14607
14745
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14608
14746
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14609
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14747
|
+
swarm$1.loggerService.log(METHOD_NAME$12, {
|
|
14610
14748
|
agentSchema,
|
|
14611
14749
|
});
|
|
14612
14750
|
// Register the agent in the validation and schema services
|
|
@@ -14616,7 +14754,7 @@ const addAgent = beginContext((agentSchema) => {
|
|
|
14616
14754
|
return agentSchema.agentName;
|
|
14617
14755
|
});
|
|
14618
14756
|
|
|
14619
|
-
const METHOD_NAME$
|
|
14757
|
+
const METHOD_NAME$11 = "function.setup.addCompletion";
|
|
14620
14758
|
/**
|
|
14621
14759
|
* Adds a completion engine to the registry for use by agents in the swarm system.
|
|
14622
14760
|
*
|
|
@@ -14636,7 +14774,7 @@ const METHOD_NAME$U = "function.setup.addCompletion";
|
|
|
14636
14774
|
const addCompletion = beginContext((completionSchema) => {
|
|
14637
14775
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14638
14776
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14639
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14777
|
+
swarm$1.loggerService.log(METHOD_NAME$11, {
|
|
14640
14778
|
completionSchema,
|
|
14641
14779
|
});
|
|
14642
14780
|
// Register the completion in the validation and schema services
|
|
@@ -14646,7 +14784,7 @@ const addCompletion = beginContext((completionSchema) => {
|
|
|
14646
14784
|
return completionSchema.completionName;
|
|
14647
14785
|
});
|
|
14648
14786
|
|
|
14649
|
-
const METHOD_NAME$
|
|
14787
|
+
const METHOD_NAME$10 = "function.setup.addSwarm";
|
|
14650
14788
|
/**
|
|
14651
14789
|
* Adds a new swarm to the system for managing client sessions.
|
|
14652
14790
|
*
|
|
@@ -14666,7 +14804,7 @@ const METHOD_NAME$T = "function.setup.addSwarm";
|
|
|
14666
14804
|
const addSwarm = beginContext((swarmSchema) => {
|
|
14667
14805
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14668
14806
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14669
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14807
|
+
swarm$1.loggerService.log(METHOD_NAME$10, {
|
|
14670
14808
|
swarmSchema,
|
|
14671
14809
|
});
|
|
14672
14810
|
// Register the swarm in the validation and schema services
|
|
@@ -14676,7 +14814,7 @@ const addSwarm = beginContext((swarmSchema) => {
|
|
|
14676
14814
|
return swarmSchema.swarmName;
|
|
14677
14815
|
});
|
|
14678
14816
|
|
|
14679
|
-
const METHOD_NAME
|
|
14817
|
+
const METHOD_NAME$$ = "function.setup.addTool";
|
|
14680
14818
|
/**
|
|
14681
14819
|
* Adds a new tool to the tool registry for use by agents in the swarm system.
|
|
14682
14820
|
*
|
|
@@ -14698,7 +14836,7 @@ const METHOD_NAME$S = "function.setup.addTool";
|
|
|
14698
14836
|
const addTool = beginContext((toolSchema) => {
|
|
14699
14837
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14700
14838
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14701
|
-
swarm$1.loggerService.log(METHOD_NAME
|
|
14839
|
+
swarm$1.loggerService.log(METHOD_NAME$$, {
|
|
14702
14840
|
toolSchema,
|
|
14703
14841
|
});
|
|
14704
14842
|
// Register the tool in the validation and schema services
|
|
@@ -14708,7 +14846,7 @@ const addTool = beginContext((toolSchema) => {
|
|
|
14708
14846
|
return toolSchema.toolName;
|
|
14709
14847
|
});
|
|
14710
14848
|
|
|
14711
|
-
const METHOD_NAME$
|
|
14849
|
+
const METHOD_NAME$_ = "function.setup.addState";
|
|
14712
14850
|
/**
|
|
14713
14851
|
* Adds a new state to the state registry for use within the swarm system.
|
|
14714
14852
|
*
|
|
@@ -14730,7 +14868,7 @@ const METHOD_NAME$R = "function.setup.addState";
|
|
|
14730
14868
|
const addState = beginContext((stateSchema) => {
|
|
14731
14869
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14732
14870
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14733
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14871
|
+
swarm$1.loggerService.log(METHOD_NAME$_, {
|
|
14734
14872
|
stateSchema,
|
|
14735
14873
|
});
|
|
14736
14874
|
// Register the state in the schema service
|
|
@@ -14745,7 +14883,7 @@ const addState = beginContext((stateSchema) => {
|
|
|
14745
14883
|
return stateSchema.stateName;
|
|
14746
14884
|
});
|
|
14747
14885
|
|
|
14748
|
-
const METHOD_NAME$
|
|
14886
|
+
const METHOD_NAME$Z = "function.setup.addEmbedding";
|
|
14749
14887
|
/**
|
|
14750
14888
|
* Adds a new embedding engine to the embedding registry for use within the swarm system.
|
|
14751
14889
|
*
|
|
@@ -14765,7 +14903,7 @@ const METHOD_NAME$Q = "function.setup.addEmbedding";
|
|
|
14765
14903
|
const addEmbedding = beginContext((embeddingSchema) => {
|
|
14766
14904
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14767
14905
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14768
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14906
|
+
swarm$1.loggerService.log(METHOD_NAME$Z, {
|
|
14769
14907
|
embeddingSchema,
|
|
14770
14908
|
});
|
|
14771
14909
|
// Register the embedding in the validation and schema services
|
|
@@ -14775,7 +14913,7 @@ const addEmbedding = beginContext((embeddingSchema) => {
|
|
|
14775
14913
|
return embeddingSchema.embeddingName;
|
|
14776
14914
|
});
|
|
14777
14915
|
|
|
14778
|
-
const METHOD_NAME$
|
|
14916
|
+
const METHOD_NAME$Y = "function.setup.addStorage";
|
|
14779
14917
|
/**
|
|
14780
14918
|
* Adds a new storage engine to the storage registry for use within the swarm system.
|
|
14781
14919
|
*
|
|
@@ -14797,7 +14935,7 @@ const METHOD_NAME$P = "function.setup.addStorage";
|
|
|
14797
14935
|
const addStorage = beginContext((storageSchema) => {
|
|
14798
14936
|
// Log the operation details if logging is enabled in GLOBAL_CONFIG
|
|
14799
14937
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14800
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14938
|
+
swarm$1.loggerService.log(METHOD_NAME$Y, {
|
|
14801
14939
|
storageSchema,
|
|
14802
14940
|
});
|
|
14803
14941
|
// Register the storage in the validation and schema services
|
|
@@ -14814,7 +14952,7 @@ const addStorage = beginContext((storageSchema) => {
|
|
|
14814
14952
|
});
|
|
14815
14953
|
|
|
14816
14954
|
/** @private Constant defining the method name for logging and validation context */
|
|
14817
|
-
const METHOD_NAME$
|
|
14955
|
+
const METHOD_NAME$X = "function.setup.addPolicy";
|
|
14818
14956
|
/**
|
|
14819
14957
|
* Adds a new policy for agents in the swarm system by registering it with validation and schema services.
|
|
14820
14958
|
* Registers the policy with PolicyValidationService for runtime validation and PolicySchemaService for schema management.
|
|
@@ -14830,7 +14968,7 @@ const METHOD_NAME$O = "function.setup.addPolicy";
|
|
|
14830
14968
|
const addPolicy = beginContext((policySchema) => {
|
|
14831
14969
|
// Log the policy addition attempt if enabled
|
|
14832
14970
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
14833
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
14971
|
+
swarm$1.loggerService.log(METHOD_NAME$X, {
|
|
14834
14972
|
policySchema,
|
|
14835
14973
|
});
|
|
14836
14974
|
// Register the policy with PolicyValidationService for runtime validation
|
|
@@ -14841,6 +14979,281 @@ const addPolicy = beginContext((policySchema) => {
|
|
|
14841
14979
|
return policySchema.policyName;
|
|
14842
14980
|
});
|
|
14843
14981
|
|
|
14982
|
+
const METHOD_NAME$W = "function.test.overrideAgent";
|
|
14983
|
+
/**
|
|
14984
|
+
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
14985
|
+
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
14986
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
14987
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
14988
|
+
*
|
|
14989
|
+
* @param {TAgentSchema} agentSchema - The schema containing the agent’s unique name and optional properties to override.
|
|
14990
|
+
* @param {string} agentSchema.agentName - The unique identifier of the agent to override, matching `IAgentSchema["agentName"]`.
|
|
14991
|
+
* @param {Partial<IAgentSchema>} [agentSchema] - Optional partial schema properties to update, extending `IAgentSchema`.
|
|
14992
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s agent schema service.
|
|
14993
|
+
* @throws {Error} If the agent schema service encounters an error during the override operation (e.g., invalid agentName or schema).
|
|
14994
|
+
*
|
|
14995
|
+
* @example
|
|
14996
|
+
* // Override an agent’s schema with new properties
|
|
14997
|
+
* overrideAgent({
|
|
14998
|
+
* agentName: "WeatherAgent",
|
|
14999
|
+
* description: "Updated weather query handler",
|
|
15000
|
+
* tools: ["getWeather"],
|
|
15001
|
+
* });
|
|
15002
|
+
* // Logs the operation (if enabled) and updates the agent schema in the swarm.
|
|
15003
|
+
*/
|
|
15004
|
+
const overrideAgent = beginContext((agentSchema) => {
|
|
15005
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15006
|
+
swarm$1.loggerService.log(METHOD_NAME$W, {
|
|
15007
|
+
agentSchema,
|
|
15008
|
+
});
|
|
15009
|
+
return swarm$1.agentSchemaService.override(agentSchema.agentName, agentSchema);
|
|
15010
|
+
});
|
|
15011
|
+
|
|
15012
|
+
const METHOD_NAME$V = "function.test.overrideCompletion";
|
|
15013
|
+
/**
|
|
15014
|
+
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
15015
|
+
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
15016
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15017
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15018
|
+
*
|
|
15019
|
+
* @param {TCompletionSchema} completionSchema - The schema containing the completion’s unique name and optional properties to override.
|
|
15020
|
+
* @param {string} completionSchema.completionName - The unique identifier of the completion to override, matching `ICompletionSchema["completionName"]`.
|
|
15021
|
+
* @param {Partial<ICompletionSchema>} [completionSchema] - Optional partial schema properties to update, extending `ICompletionSchema`.
|
|
15022
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s completion schema service.
|
|
15023
|
+
* @throws {Error} If the completion schema service encounters an error during the override operation (e.g., invalid completionName or schema).
|
|
15024
|
+
*
|
|
15025
|
+
* @example
|
|
15026
|
+
* // Override a completion’s schema with new properties
|
|
15027
|
+
* overrideCompletion({
|
|
15028
|
+
* completionName: "TextCompletion",
|
|
15029
|
+
* model: "gpt-4",
|
|
15030
|
+
* maxTokens: 500,
|
|
15031
|
+
* });
|
|
15032
|
+
* // Logs the operation (if enabled) and updates the completion schema in the swarm.
|
|
15033
|
+
*/
|
|
15034
|
+
const overrideCompletion = beginContext((completionSchema) => {
|
|
15035
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15036
|
+
swarm$1.loggerService.log(METHOD_NAME$V, {
|
|
15037
|
+
completionSchema,
|
|
15038
|
+
});
|
|
15039
|
+
return swarm$1.completionSchemaService.override(completionSchema.completionName, completionSchema);
|
|
15040
|
+
});
|
|
15041
|
+
|
|
15042
|
+
const METHOD_NAME$U = "function.test.overrideEmbeding";
|
|
15043
|
+
/**
|
|
15044
|
+
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
15045
|
+
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
15046
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15047
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15048
|
+
*
|
|
15049
|
+
* @param {TEmbeddingSchema} embeddingSchema - The schema containing the embedding’s unique name and optional properties to override.
|
|
15050
|
+
* @param {string} embeddingSchema.embeddingName - The unique identifier of the embedding to override, matching `IEmbeddingSchema["embeddingName"]`.
|
|
15051
|
+
* @param {Partial<IEmbeddingSchema>} [embeddingSchema] - Optional partial schema properties to update, extending `IEmbeddingSchema`.
|
|
15052
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s embedding schema service.
|
|
15053
|
+
* @throws {Error} If the embedding schema service encounters an error during the override operation (e.g., invalid embeddingName or schema).
|
|
15054
|
+
*
|
|
15055
|
+
* @example
|
|
15056
|
+
* // Override an embedding’s schema with new properties
|
|
15057
|
+
* overrideEmbeding({
|
|
15058
|
+
* embeddingName: "TextEmbedding",
|
|
15059
|
+
* persist: true,
|
|
15060
|
+
* callbacks: {
|
|
15061
|
+
* onCreate: (text, embeddings) => console.log(`Created embedding for ${text}`),
|
|
15062
|
+
* },
|
|
15063
|
+
* });
|
|
15064
|
+
* // Logs the operation (if enabled) and updates the embedding schema in the swarm.
|
|
15065
|
+
*/
|
|
15066
|
+
const overrideEmbeding = beginContext((embeddingSchema) => {
|
|
15067
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15068
|
+
swarm$1.loggerService.log(METHOD_NAME$U, {
|
|
15069
|
+
embeddingSchema,
|
|
15070
|
+
});
|
|
15071
|
+
return swarm$1.embeddingSchemaService.override(embeddingSchema.embeddingName, embeddingSchema);
|
|
15072
|
+
});
|
|
15073
|
+
|
|
15074
|
+
const METHOD_NAME$T = "function.test.overridePolicy";
|
|
15075
|
+
/**
|
|
15076
|
+
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
15077
|
+
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
15078
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15079
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15080
|
+
*
|
|
15081
|
+
* @param {TPolicySchema} policySchema - The schema containing the policy’s unique name and optional properties to override.
|
|
15082
|
+
* @param {string} policySchema.policyName - The unique identifier of the policy to override, matching `IPolicySchema["policyName"]`.
|
|
15083
|
+
* @param {Partial<IPolicySchema>} [policySchema] - Optional partial schema properties to update, extending `IPolicySchema`.
|
|
15084
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s policy schema service.
|
|
15085
|
+
* @throws {Error} If the policy schema service encounters an error during the override operation (e.g., invalid policyName or schema).
|
|
15086
|
+
*
|
|
15087
|
+
* @example
|
|
15088
|
+
* // Override a policy’s schema with new properties
|
|
15089
|
+
* overridePolicy({
|
|
15090
|
+
* policyName: "ContentFilter",
|
|
15091
|
+
* autoBan: true,
|
|
15092
|
+
* banMessage: "Content policy violation detected.",
|
|
15093
|
+
* });
|
|
15094
|
+
* // Logs the operation (if enabled) and updates the policy schema in the swarm.
|
|
15095
|
+
*/
|
|
15096
|
+
const overridePolicy = beginContext((policySchema) => {
|
|
15097
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15098
|
+
swarm$1.loggerService.log(METHOD_NAME$T, {
|
|
15099
|
+
policySchema,
|
|
15100
|
+
});
|
|
15101
|
+
return swarm$1.policySchemaService.override(policySchema.policyName, policySchema);
|
|
15102
|
+
});
|
|
15103
|
+
|
|
15104
|
+
const METHOD_NAME$S = "function.test.overrideState";
|
|
15105
|
+
/**
|
|
15106
|
+
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
15107
|
+
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
15108
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15109
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15110
|
+
*
|
|
15111
|
+
* @template T - The type of the state data, defaults to `any`.
|
|
15112
|
+
* @param {TStateSchema<T>} stateSchema - The schema containing the state’s unique name and optional properties to override.
|
|
15113
|
+
* @param {string} stateSchema.stateName - The unique identifier of the state to override, matching `IStateSchema<T>["stateName"]`.
|
|
15114
|
+
* @param {Partial<IStateSchema<T>>} [stateSchema] - Optional partial schema properties to update, extending `IStateSchema<T>`.
|
|
15115
|
+
* @returns {IStateSchema<T>} The updated state schema as applied by the swarm’s state schema service.
|
|
15116
|
+
* @throws {Error} If the state schema service encounters an error during the override operation (e.g., invalid stateName or schema).
|
|
15117
|
+
*
|
|
15118
|
+
* @example
|
|
15119
|
+
* // Override a state’s schema with new properties
|
|
15120
|
+
* overrideState({
|
|
15121
|
+
* stateName: "UserPreferences",
|
|
15122
|
+
* persist: true,
|
|
15123
|
+
* getDefaultState: () => ({ theme: "dark" }),
|
|
15124
|
+
* });
|
|
15125
|
+
* // Logs the operation (if enabled) and updates the state schema in the swarm.
|
|
15126
|
+
*/
|
|
15127
|
+
const overrideState = beginContext((stateSchema) => {
|
|
15128
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15129
|
+
swarm$1.loggerService.log(METHOD_NAME$S, {
|
|
15130
|
+
stateSchema,
|
|
15131
|
+
});
|
|
15132
|
+
return swarm$1.stateSchemaService.override(stateSchema.stateName, stateSchema);
|
|
15133
|
+
});
|
|
15134
|
+
|
|
15135
|
+
const METHOD_NAME$R = "function.test.overrideStorage";
|
|
15136
|
+
/**
|
|
15137
|
+
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
15138
|
+
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
15139
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15140
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15141
|
+
*
|
|
15142
|
+
* @template T - The type of the storage data, defaults to `IStorageData`.
|
|
15143
|
+
* @param {TStorageSchema<T>} storageSchema - The schema containing the storage’s unique name and optional properties to override.
|
|
15144
|
+
* @param {string} storageSchema.storageName - The unique identifier of the storage to override, matching `IStorageSchema<T>["storageName"]`.
|
|
15145
|
+
* @param {Partial<IStorageSchema<T>>} [storageSchema] - Optional partial schema properties to update, extending `IStorageSchema<T>`.
|
|
15146
|
+
* @returns {IStorageSchema<T>} The updated storage schema as applied by the swarm’s storage schema service.
|
|
15147
|
+
* @throws {Error} If the storage schema service encounters an error during the override operation (e.g., invalid storageName or schema).
|
|
15148
|
+
*
|
|
15149
|
+
* @example
|
|
15150
|
+
* // Override a storage’s schema with new properties
|
|
15151
|
+
* overrideStorage({
|
|
15152
|
+
* storageName: "UserData",
|
|
15153
|
+
* persist: true,
|
|
15154
|
+
* embedding: "TextEmbedding",
|
|
15155
|
+
* createIndex: (item) => item.id.toString(),
|
|
15156
|
+
* });
|
|
15157
|
+
* // Logs the operation (if enabled) and updates the storage schema in the swarm.
|
|
15158
|
+
*/
|
|
15159
|
+
const overrideStorage = beginContext((storageSchema) => {
|
|
15160
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15161
|
+
swarm$1.loggerService.log(METHOD_NAME$R, {
|
|
15162
|
+
storageSchema,
|
|
15163
|
+
});
|
|
15164
|
+
return swarm$1.storageSchemaService.override(storageSchema.storageName, storageSchema);
|
|
15165
|
+
});
|
|
15166
|
+
|
|
15167
|
+
const METHOD_NAME$Q = "function.test.overrideSwarm";
|
|
15168
|
+
/**
|
|
15169
|
+
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
15170
|
+
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
15171
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15172
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15173
|
+
*
|
|
15174
|
+
* @param {TSwarmSchema} swarmSchema - The schema containing the swarm’s unique name and optional properties to override.
|
|
15175
|
+
* @param {string} swarmSchema.swarmName - The unique identifier of the swarm to override, matching `ISwarmSchema["swarmName"]`.
|
|
15176
|
+
* @param {Partial<ISwarmSchema>} [swarmSchema] - Optional partial schema properties to update, extending `ISwarmSchema`.
|
|
15177
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s swarm schema service.
|
|
15178
|
+
* @throws {Error} If the swarm schema service encounters an error during the override operation (e.g., invalid swarmName or schema).
|
|
15179
|
+
*
|
|
15180
|
+
* @example
|
|
15181
|
+
* // Override a swarm’s schema with new properties
|
|
15182
|
+
* overrideSwarm({
|
|
15183
|
+
* swarmName: "MainSwarm",
|
|
15184
|
+
* defaultAgent: "WeatherAgent",
|
|
15185
|
+
* policies: ["ContentFilter"],
|
|
15186
|
+
* });
|
|
15187
|
+
* // Logs the operation (if enabled) and updates the swarm schema in the swarm system.
|
|
15188
|
+
*/
|
|
15189
|
+
const overrideSwarm = beginContext((swarmSchema) => {
|
|
15190
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15191
|
+
swarm$1.loggerService.log(METHOD_NAME$Q, {
|
|
15192
|
+
swarmSchema,
|
|
15193
|
+
});
|
|
15194
|
+
return swarm$1.swarmSchemaService.override(swarmSchema.swarmName, swarmSchema);
|
|
15195
|
+
});
|
|
15196
|
+
|
|
15197
|
+
const METHOD_NAME$P = "function.test.overrideTool";
|
|
15198
|
+
/**
|
|
15199
|
+
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
15200
|
+
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
15201
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15202
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15203
|
+
*
|
|
15204
|
+
* @param {TAgentTool} toolSchema - The schema containing the tool’s unique name and optional properties to override.
|
|
15205
|
+
* @param {string} toolSchema.toolName - The unique identifier of the tool to override, matching `IAgentTool["toolName"]`.
|
|
15206
|
+
* @param {Partial<IAgentTool>} [toolSchema] - Optional partial schema properties to update, extending `IAgentTool`.
|
|
15207
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s tool schema service.
|
|
15208
|
+
* @throws {Error} If the tool schema service encounters an error during the override operation (e.g., invalid toolName or schema).
|
|
15209
|
+
*
|
|
15210
|
+
* @example
|
|
15211
|
+
* // Override a tool’s schema with new properties
|
|
15212
|
+
* overrideTool({
|
|
15213
|
+
* toolName: "WeatherTool",
|
|
15214
|
+
* description: "Updated weather data retrieval tool",
|
|
15215
|
+
* execute: async (params) => fetchWeather(params),
|
|
15216
|
+
* });
|
|
15217
|
+
* // Logs the operation (if enabled) and updates the tool schema in the swarm.
|
|
15218
|
+
*/
|
|
15219
|
+
const overrideTool = beginContext((toolSchema) => {
|
|
15220
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15221
|
+
swarm$1.loggerService.log(METHOD_NAME$P, {
|
|
15222
|
+
toolSchema,
|
|
15223
|
+
});
|
|
15224
|
+
return swarm$1.toolSchemaService.override(toolSchema.toolName, toolSchema);
|
|
15225
|
+
});
|
|
15226
|
+
|
|
15227
|
+
const METHOD_NAME$O = "function.test.overrideWiki";
|
|
15228
|
+
/**
|
|
15229
|
+
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
15230
|
+
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
15231
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
15232
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
15233
|
+
*
|
|
15234
|
+
* @param {TWikiSchema} wikiSchema - The schema containing the wiki’s unique name and optional properties to override.
|
|
15235
|
+
* @param {string} wikiSchema.wikiName - The unique identifier of the wiki to override, matching `IWikiSchema["wikiName"]`.
|
|
15236
|
+
* @param {Partial<IWikiSchema>} [wikiSchema] - Optional partial schema properties to update, extending `IWikiSchema`.
|
|
15237
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s wiki schema service.
|
|
15238
|
+
* @throws {Error} If the wiki schema service encounters an error during the override operation (e.g., invalid wikiName or schema).
|
|
15239
|
+
*
|
|
15240
|
+
* @example
|
|
15241
|
+
* // Override a wiki’s schema with new properties
|
|
15242
|
+
* overrideWiki({
|
|
15243
|
+
* wikiName: "KnowledgeBase",
|
|
15244
|
+
* description: "Updated knowledge repository",
|
|
15245
|
+
* storage: "WikiStorage",
|
|
15246
|
+
* });
|
|
15247
|
+
* // Logs the operation (if enabled) and updates the wiki schema in the swarm.
|
|
15248
|
+
*/
|
|
15249
|
+
const overrideWiki = beginContext((wikiSchema) => {
|
|
15250
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
15251
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
15252
|
+
wikiSchema,
|
|
15253
|
+
});
|
|
15254
|
+
return swarm$1.wikiSchemaService.override(wikiSchema.wikiName, wikiSchema);
|
|
15255
|
+
});
|
|
15256
|
+
|
|
14844
15257
|
const METHOD_NAME$N = "function.other.markOnline";
|
|
14845
15258
|
/**
|
|
14846
15259
|
* Marks a client as online in the specified swarm.
|
|
@@ -17228,7 +17641,7 @@ const CHANGE_AGENT_GC$2 = 60 * 1000;
|
|
|
17228
17641
|
*/
|
|
17229
17642
|
const createChangeToAgent = functoolsKit.ttl((clientId) => functoolsKit.queued(async (methodName, agentName, swarmName) => {
|
|
17230
17643
|
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}`);
|
|
17644
|
+
console.warn(`function "changeToAgent" skipped due to the circular route found clientId=${clientId} swarmName=${swarmName} agentNameTo=${agentName}`);
|
|
17232
17645
|
return false;
|
|
17233
17646
|
}
|
|
17234
17647
|
// Notify all agents in the swarm of the change
|
|
@@ -19595,6 +20008,15 @@ exports.markOffline = markOffline;
|
|
|
19595
20008
|
exports.markOnline = markOnline;
|
|
19596
20009
|
exports.notify = notify;
|
|
19597
20010
|
exports.notifyForce = notifyForce;
|
|
20011
|
+
exports.overrideAgent = overrideAgent;
|
|
20012
|
+
exports.overrideCompletion = overrideCompletion;
|
|
20013
|
+
exports.overrideEmbeding = overrideEmbeding;
|
|
20014
|
+
exports.overridePolicy = overridePolicy;
|
|
20015
|
+
exports.overrideState = overrideState;
|
|
20016
|
+
exports.overrideStorage = overrideStorage;
|
|
20017
|
+
exports.overrideSwarm = overrideSwarm;
|
|
20018
|
+
exports.overrideTool = overrideTool;
|
|
20019
|
+
exports.overrideWiki = overrideWiki;
|
|
19598
20020
|
exports.question = question;
|
|
19599
20021
|
exports.questionForce = questionForce;
|
|
19600
20022
|
exports.runStateless = runStateless;
|