agent-swarm-kit 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +454 -34
- package/build/index.mjs +446 -35
- package/package.json +2 -2
- package/types.d.ts +328 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-swarm-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"di-kit": "^1.0.14",
|
|
83
83
|
"di-scoped": "^1.0.16",
|
|
84
|
-
"functools-kit": "^1.0.
|
|
84
|
+
"functools-kit": "^1.0.80",
|
|
85
85
|
"get-moment-stamp": "^1.1.1",
|
|
86
86
|
"lodash-es": "4.17.21",
|
|
87
87
|
"xml2js": "0.6.2"
|
package/types.d.ts
CHANGED
|
@@ -4152,6 +4152,16 @@ declare class AgentSchemaService {
|
|
|
4152
4152
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
4153
4153
|
*/
|
|
4154
4154
|
register: (key: AgentName, value: IAgentSchema) => void;
|
|
4155
|
+
/**
|
|
4156
|
+
* Overrides an existing agent schema in the registry with a new schema.
|
|
4157
|
+
* Replaces the schema associated with the provided key (agentName) in the ToolRegistry.
|
|
4158
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
4159
|
+
* Supports dynamic updates to agent schemas for AgentConnectionService and SwarmConnectionService.
|
|
4160
|
+
* @param {AgentName} key - The name of the agent, used as the registry key, sourced from Agent.interface.
|
|
4161
|
+
* @param {IAgentSchema} value - The new agent schema to override the existing one, sourced from Agent.interface.
|
|
4162
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
4163
|
+
*/
|
|
4164
|
+
override: (key: AgentName, value: Partial<IAgentSchema>) => IAgentSchema;
|
|
4155
4165
|
/**
|
|
4156
4166
|
* Retrieves an agent schema from the registry by its name.
|
|
4157
4167
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -4207,6 +4217,16 @@ declare class ToolSchemaService {
|
|
|
4207
4217
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
4208
4218
|
*/
|
|
4209
4219
|
register: (key: ToolName, value: IAgentTool) => void;
|
|
4220
|
+
/**
|
|
4221
|
+
* Overrides an existing tool schema in the registry with a new schema.
|
|
4222
|
+
* Replaces the schema associated with the provided key (toolName) in the ToolRegistry.
|
|
4223
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
4224
|
+
* Supports dynamic updates to tool schemas for AgentConnectionService and SwarmConnectionService.
|
|
4225
|
+
* @param {ToolName} key - The name of the tool to override, sourced from Agent.interface.
|
|
4226
|
+
* @param {IAgentTool} value - The new tool schema to replace the existing one, sourced from Agent.interface.
|
|
4227
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
4228
|
+
*/
|
|
4229
|
+
override: (key: ToolName, value: Partial<IAgentTool>) => IAgentTool<Record<string, ToolValue>>;
|
|
4210
4230
|
/**
|
|
4211
4231
|
* Retrieves a tool schema from the registry by its name.
|
|
4212
4232
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -4509,6 +4529,16 @@ declare class SwarmSchemaService {
|
|
|
4509
4529
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
4510
4530
|
*/
|
|
4511
4531
|
register: (key: SwarmName, value: ISwarmSchema) => void;
|
|
4532
|
+
/**
|
|
4533
|
+
* Overrides an existing swarm schema in the registry with a new value.
|
|
4534
|
+
* Replaces the schema associated with the given key in the ToolRegistry.
|
|
4535
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
4536
|
+
* Supports dynamic updates to swarm configurations, allowing modifications to agentList, defaultAgent, or policies.
|
|
4537
|
+
* @param {SwarmName} key - The name of the swarm to override, sourced from Swarm.interface.
|
|
4538
|
+
* @param {ISwarmSchema} value - The new swarm schema to replace the existing one, sourced from Swarm.interface.
|
|
4539
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
4540
|
+
*/
|
|
4541
|
+
override: (key: SwarmName, value: Partial<ISwarmSchema>) => ISwarmSchema;
|
|
4512
4542
|
/**
|
|
4513
4543
|
* Retrieves a swarm schema from the registry by its name.
|
|
4514
4544
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -4563,6 +4593,16 @@ declare class CompletionSchemaService {
|
|
|
4563
4593
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
4564
4594
|
*/
|
|
4565
4595
|
register: (key: CompletionName, value: ICompletionSchema) => void;
|
|
4596
|
+
/**
|
|
4597
|
+
* Overrides an existing completion schema in the registry with a new one.
|
|
4598
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
4599
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
4600
|
+
* Supports dynamic updates to completion schemas used by AgentSchemaService, ClientAgent, and other swarm components.
|
|
4601
|
+
* @param {CompletionName} key - The name of the completion to override, sourced from Completion.interface.
|
|
4602
|
+
* @param {ICompletionSchema} value - The new completion schema to replace the existing one, sourced from Completion.interface.
|
|
4603
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
4604
|
+
*/
|
|
4605
|
+
override: (key: CompletionName, value: Partial<ICompletionSchema>) => ICompletionSchema;
|
|
4566
4606
|
/**
|
|
4567
4607
|
* Retrieves a completion schema from the registry by its name.
|
|
4568
4608
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -6004,6 +6044,16 @@ declare class EmbeddingSchemaService {
|
|
|
6004
6044
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
6005
6045
|
*/
|
|
6006
6046
|
register: (key: EmbeddingName, value: IEmbeddingSchema) => void;
|
|
6047
|
+
/**
|
|
6048
|
+
* Overrides an existing embedding schema in the registry with a new one.
|
|
6049
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
6050
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6051
|
+
* Supports updating embedding logic (e.g., calculateSimilarity and createEmbedding) for storage operations in StorageConnectionService and SharedStorageConnectionService.
|
|
6052
|
+
* @param {EmbeddingName} key - The name of the embedding to override, sourced from Embedding.interface.
|
|
6053
|
+
* @param {IEmbeddingSchema} value - The new embedding schema to associate with the key, sourced from Embedding.interface.
|
|
6054
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6055
|
+
*/
|
|
6056
|
+
override: (key: EmbeddingName, value: Partial<IEmbeddingSchema>) => IEmbeddingSchema;
|
|
6007
6057
|
/**
|
|
6008
6058
|
* Retrieves an embedding schema from the registry by its name.
|
|
6009
6059
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -6058,6 +6108,16 @@ declare class StorageSchemaService {
|
|
|
6058
6108
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
6059
6109
|
*/
|
|
6060
6110
|
register: (key: StorageName, value: IStorageSchema) => void;
|
|
6111
|
+
/**
|
|
6112
|
+
* Overrides an existing storage schema in the registry with a new schema.
|
|
6113
|
+
* Replaces the schema associated with the provided key in the ToolRegistry.
|
|
6114
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6115
|
+
* Supports updates to storage configurations for ClientStorage and SharedStorageConnectionService.
|
|
6116
|
+
* @param {StorageName} key - The name of the storage to override, sourced from Storage.interface.
|
|
6117
|
+
* @param {IStorageSchema} value - The new storage schema to replace the existing one, sourced from Storage.interface.
|
|
6118
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6119
|
+
*/
|
|
6120
|
+
override: (key: StorageName, value: Partial<IStorageSchema>) => IStorageSchema<IStorageData>;
|
|
6061
6121
|
/**
|
|
6062
6122
|
* Retrieves a storage schema from the registry by its name.
|
|
6063
6123
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -6848,6 +6908,16 @@ declare class StateSchemaService {
|
|
|
6848
6908
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
6849
6909
|
*/
|
|
6850
6910
|
register: (key: StateName, value: IStateSchema) => void;
|
|
6911
|
+
/**
|
|
6912
|
+
* Overrides an existing state schema in the registry with a new schema.
|
|
6913
|
+
* Replaces the schema associated with the provided key (stateName) in the ToolRegistry.
|
|
6914
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
6915
|
+
* Supports dynamic updates to state schemas for StateConnectionService and SharedStateConnectionService.
|
|
6916
|
+
* @param {StateName} key - The name of the state to override, sourced from State.interface.
|
|
6917
|
+
* @param {IStateSchema} value - The new state schema to replace the existing one, sourced from State.interface.
|
|
6918
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
6919
|
+
*/
|
|
6920
|
+
override: (key: StateName, value: Partial<IStateSchema>) => IStateSchema<any>;
|
|
6851
6921
|
/**
|
|
6852
6922
|
* Retrieves a state schema from the registry by its name.
|
|
6853
6923
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -8081,6 +8151,16 @@ declare class PolicySchemaService {
|
|
|
8081
8151
|
* @throws {Error} If validation fails in validateShallow, propagated with detailed error messages.
|
|
8082
8152
|
*/
|
|
8083
8153
|
register: (key: PolicyName, value: IPolicySchema) => void;
|
|
8154
|
+
/**
|
|
8155
|
+
* Overrides an existing policy schema in the registry with a new one.
|
|
8156
|
+
* Replaces the schema associated with the provided key (policyName) in the ToolRegistry.
|
|
8157
|
+
* Logs the override operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
8158
|
+
* Supports dynamic updates to policy schemas, ensuring the latest logic is applied in ClientAgent execution and SessionConnectionService.
|
|
8159
|
+
* @param {PolicyName} key - The name of the policy to override, sourced from Policy.interface.
|
|
8160
|
+
* @param {IPolicySchema} value - The new policy schema to replace the existing one, validated before storage.
|
|
8161
|
+
* @throws {Error} If the key does not exist in the registry (inherent to ToolRegistry.override behavior).
|
|
8162
|
+
*/
|
|
8163
|
+
override: (key: PolicyName, value: Partial<IPolicySchema>) => IPolicySchema;
|
|
8084
8164
|
/**
|
|
8085
8165
|
* Retrieves a policy schema from the registry by its name.
|
|
8086
8166
|
* Fetches the schema from ToolRegistry using the provided key, logging the operation via LoggerService if GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO is true.
|
|
@@ -8571,6 +8651,14 @@ declare class WikiSchemaService {
|
|
|
8571
8651
|
* @param {IWikiSchema} value - The wiki schema to register
|
|
8572
8652
|
*/
|
|
8573
8653
|
register: (key: WikiName, value: IWikiSchema) => void;
|
|
8654
|
+
/**
|
|
8655
|
+
* Overrides an existing wiki schema with a new value for a given key
|
|
8656
|
+
* @public
|
|
8657
|
+
* @param {WikiName} key - The key of the schema to override
|
|
8658
|
+
* @param {IWikiSchema} value - The new wiki schema to set
|
|
8659
|
+
* @description Logs the override operation and updates the registry with the new schema
|
|
8660
|
+
*/
|
|
8661
|
+
override: (key: WikiName, value: Partial<IWikiSchema>) => IWikiSchema;
|
|
8574
8662
|
/**
|
|
8575
8663
|
* Retrieves a wiki schema by key
|
|
8576
8664
|
* @public
|
|
@@ -9053,6 +9141,245 @@ declare const addStorage: <T extends IStorageData = IStorageData>(storageSchema:
|
|
|
9053
9141
|
*/
|
|
9054
9142
|
declare const addPolicy: (policySchema: IPolicySchema) => string;
|
|
9055
9143
|
|
|
9144
|
+
type TAgentSchema = {
|
|
9145
|
+
agentName: IAgentSchema["agentName"];
|
|
9146
|
+
} & Partial<IAgentSchema>;
|
|
9147
|
+
/**
|
|
9148
|
+
* Overrides an existing agent schema in the swarm system with a new or partial schema.
|
|
9149
|
+
* This function updates the configuration of an agent identified by its `agentName`, applying the provided schema properties.
|
|
9150
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9151
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9152
|
+
*
|
|
9153
|
+
* @param {TAgentSchema} agentSchema - The schema containing the agent’s unique name and optional properties to override.
|
|
9154
|
+
* @param {string} agentSchema.agentName - The unique identifier of the agent to override, matching `IAgentSchema["agentName"]`.
|
|
9155
|
+
* @param {Partial<IAgentSchema>} [agentSchema] - Optional partial schema properties to update, extending `IAgentSchema`.
|
|
9156
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s agent schema service.
|
|
9157
|
+
* @throws {Error} If the agent schema service encounters an error during the override operation (e.g., invalid agentName or schema).
|
|
9158
|
+
*
|
|
9159
|
+
* @example
|
|
9160
|
+
* // Override an agent’s schema with new properties
|
|
9161
|
+
* overrideAgent({
|
|
9162
|
+
* agentName: "WeatherAgent",
|
|
9163
|
+
* description: "Updated weather query handler",
|
|
9164
|
+
* tools: ["getWeather"],
|
|
9165
|
+
* });
|
|
9166
|
+
* // Logs the operation (if enabled) and updates the agent schema in the swarm.
|
|
9167
|
+
*/
|
|
9168
|
+
declare const overrideAgent: (agentSchema: TAgentSchema) => IAgentSchema;
|
|
9169
|
+
|
|
9170
|
+
type TCompletionSchema = {
|
|
9171
|
+
completionName: ICompletionSchema["completionName"];
|
|
9172
|
+
} & Partial<ICompletionSchema>;
|
|
9173
|
+
/**
|
|
9174
|
+
* Overrides an existing completion schema in the swarm system with a new or partial schema.
|
|
9175
|
+
* This function updates the configuration of a completion mechanism identified by its `completionName`, applying the provided schema properties.
|
|
9176
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9177
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9178
|
+
*
|
|
9179
|
+
* @param {TCompletionSchema} completionSchema - The schema containing the completion’s unique name and optional properties to override.
|
|
9180
|
+
* @param {string} completionSchema.completionName - The unique identifier of the completion to override, matching `ICompletionSchema["completionName"]`.
|
|
9181
|
+
* @param {Partial<ICompletionSchema>} [completionSchema] - Optional partial schema properties to update, extending `ICompletionSchema`.
|
|
9182
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s completion schema service.
|
|
9183
|
+
* @throws {Error} If the completion schema service encounters an error during the override operation (e.g., invalid completionName or schema).
|
|
9184
|
+
*
|
|
9185
|
+
* @example
|
|
9186
|
+
* // Override a completion’s schema with new properties
|
|
9187
|
+
* overrideCompletion({
|
|
9188
|
+
* completionName: "TextCompletion",
|
|
9189
|
+
* model: "gpt-4",
|
|
9190
|
+
* maxTokens: 500,
|
|
9191
|
+
* });
|
|
9192
|
+
* // Logs the operation (if enabled) and updates the completion schema in the swarm.
|
|
9193
|
+
*/
|
|
9194
|
+
declare const overrideCompletion: (completionSchema: TCompletionSchema) => ICompletionSchema;
|
|
9195
|
+
|
|
9196
|
+
type TEmbeddingSchema = {
|
|
9197
|
+
embeddingName: IEmbeddingSchema["embeddingName"];
|
|
9198
|
+
} & Partial<IEmbeddingSchema>;
|
|
9199
|
+
/**
|
|
9200
|
+
* Overrides an existing embedding schema in the swarm system with a new or partial schema.
|
|
9201
|
+
* This function updates the configuration of an embedding mechanism identified by its `embeddingName`, applying the provided schema properties.
|
|
9202
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9203
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9204
|
+
*
|
|
9205
|
+
* @param {TEmbeddingSchema} embeddingSchema - The schema containing the embedding’s unique name and optional properties to override.
|
|
9206
|
+
* @param {string} embeddingSchema.embeddingName - The unique identifier of the embedding to override, matching `IEmbeddingSchema["embeddingName"]`.
|
|
9207
|
+
* @param {Partial<IEmbeddingSchema>} [embeddingSchema] - Optional partial schema properties to update, extending `IEmbeddingSchema`.
|
|
9208
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s embedding schema service.
|
|
9209
|
+
* @throws {Error} If the embedding schema service encounters an error during the override operation (e.g., invalid embeddingName or schema).
|
|
9210
|
+
*
|
|
9211
|
+
* @example
|
|
9212
|
+
* // Override an embedding’s schema with new properties
|
|
9213
|
+
* overrideEmbeding({
|
|
9214
|
+
* embeddingName: "TextEmbedding",
|
|
9215
|
+
* persist: true,
|
|
9216
|
+
* callbacks: {
|
|
9217
|
+
* onCreate: (text, embeddings) => console.log(`Created embedding for ${text}`),
|
|
9218
|
+
* },
|
|
9219
|
+
* });
|
|
9220
|
+
* // Logs the operation (if enabled) and updates the embedding schema in the swarm.
|
|
9221
|
+
*/
|
|
9222
|
+
declare const overrideEmbeding: (embeddingSchema: TEmbeddingSchema) => IEmbeddingSchema;
|
|
9223
|
+
|
|
9224
|
+
type TPolicySchema = {
|
|
9225
|
+
policyName: IPolicySchema["policyName"];
|
|
9226
|
+
} & Partial<IPolicySchema>;
|
|
9227
|
+
/**
|
|
9228
|
+
* Overrides an existing policy schema in the swarm system with a new or partial schema.
|
|
9229
|
+
* This function updates the configuration of a policy identified by its `policyName`, applying the provided schema properties.
|
|
9230
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9231
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9232
|
+
*
|
|
9233
|
+
* @param {TPolicySchema} policySchema - The schema containing the policy’s unique name and optional properties to override.
|
|
9234
|
+
* @param {string} policySchema.policyName - The unique identifier of the policy to override, matching `IPolicySchema["policyName"]`.
|
|
9235
|
+
* @param {Partial<IPolicySchema>} [policySchema] - Optional partial schema properties to update, extending `IPolicySchema`.
|
|
9236
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s policy schema service.
|
|
9237
|
+
* @throws {Error} If the policy schema service encounters an error during the override operation (e.g., invalid policyName or schema).
|
|
9238
|
+
*
|
|
9239
|
+
* @example
|
|
9240
|
+
* // Override a policy’s schema with new properties
|
|
9241
|
+
* overridePolicy({
|
|
9242
|
+
* policyName: "ContentFilter",
|
|
9243
|
+
* autoBan: true,
|
|
9244
|
+
* banMessage: "Content policy violation detected.",
|
|
9245
|
+
* });
|
|
9246
|
+
* // Logs the operation (if enabled) and updates the policy schema in the swarm.
|
|
9247
|
+
*/
|
|
9248
|
+
declare const overridePolicy: (policySchema: TPolicySchema) => IPolicySchema;
|
|
9249
|
+
|
|
9250
|
+
type TStateSchema<T extends unknown = any> = {
|
|
9251
|
+
stateName: IStateSchema<T>["stateName"];
|
|
9252
|
+
} & Partial<IStateSchema<T>>;
|
|
9253
|
+
/**
|
|
9254
|
+
* Overrides an existing state schema in the swarm system with a new or partial schema.
|
|
9255
|
+
* This function updates the configuration of a state identified by its `stateName`, applying the provided schema properties.
|
|
9256
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9257
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9258
|
+
*
|
|
9259
|
+
* @template T - The type of the state data, defaults to `any`.
|
|
9260
|
+
* @param {TStateSchema<T>} stateSchema - The schema containing the state’s unique name and optional properties to override.
|
|
9261
|
+
* @param {string} stateSchema.stateName - The unique identifier of the state to override, matching `IStateSchema<T>["stateName"]`.
|
|
9262
|
+
* @param {Partial<IStateSchema<T>>} [stateSchema] - Optional partial schema properties to update, extending `IStateSchema<T>`.
|
|
9263
|
+
* @returns {IStateSchema<T>} The updated state schema as applied by the swarm’s state schema service.
|
|
9264
|
+
* @throws {Error} If the state schema service encounters an error during the override operation (e.g., invalid stateName or schema).
|
|
9265
|
+
*
|
|
9266
|
+
* @example
|
|
9267
|
+
* // Override a state’s schema with new properties
|
|
9268
|
+
* overrideState({
|
|
9269
|
+
* stateName: "UserPreferences",
|
|
9270
|
+
* persist: true,
|
|
9271
|
+
* getDefaultState: () => ({ theme: "dark" }),
|
|
9272
|
+
* });
|
|
9273
|
+
* // Logs the operation (if enabled) and updates the state schema in the swarm.
|
|
9274
|
+
*/
|
|
9275
|
+
declare const overrideState: <T extends unknown = any>(stateSchema: TStateSchema<T>) => IStateSchema<T>;
|
|
9276
|
+
|
|
9277
|
+
type TStorageSchema<T extends IStorageData = IStorageData> = {
|
|
9278
|
+
storageName: IStorageSchema<T>["storageName"];
|
|
9279
|
+
} & Partial<IStorageSchema<T>>;
|
|
9280
|
+
/**
|
|
9281
|
+
* Overrides an existing storage schema in the swarm system with a new or partial schema.
|
|
9282
|
+
* This function updates the configuration of a storage identified by its `storageName`, applying the provided schema properties.
|
|
9283
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9284
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9285
|
+
*
|
|
9286
|
+
* @template T - The type of the storage data, defaults to `IStorageData`.
|
|
9287
|
+
* @param {TStorageSchema<T>} storageSchema - The schema containing the storage’s unique name and optional properties to override.
|
|
9288
|
+
* @param {string} storageSchema.storageName - The unique identifier of the storage to override, matching `IStorageSchema<T>["storageName"]`.
|
|
9289
|
+
* @param {Partial<IStorageSchema<T>>} [storageSchema] - Optional partial schema properties to update, extending `IStorageSchema<T>`.
|
|
9290
|
+
* @returns {IStorageSchema<T>} The updated storage schema as applied by the swarm’s storage schema service.
|
|
9291
|
+
* @throws {Error} If the storage schema service encounters an error during the override operation (e.g., invalid storageName or schema).
|
|
9292
|
+
*
|
|
9293
|
+
* @example
|
|
9294
|
+
* // Override a storage’s schema with new properties
|
|
9295
|
+
* overrideStorage({
|
|
9296
|
+
* storageName: "UserData",
|
|
9297
|
+
* persist: true,
|
|
9298
|
+
* embedding: "TextEmbedding",
|
|
9299
|
+
* createIndex: (item) => item.id.toString(),
|
|
9300
|
+
* });
|
|
9301
|
+
* // Logs the operation (if enabled) and updates the storage schema in the swarm.
|
|
9302
|
+
*/
|
|
9303
|
+
declare const overrideStorage: <T extends IStorageData = IStorageData>(storageSchema: TStorageSchema<T>) => IStorageSchema<T>;
|
|
9304
|
+
|
|
9305
|
+
type TSwarmSchema = {
|
|
9306
|
+
swarmName: ISwarmSchema["swarmName"];
|
|
9307
|
+
} & Partial<ISwarmSchema>;
|
|
9308
|
+
/**
|
|
9309
|
+
* Overrides an existing swarm schema in the swarm system with a new or partial schema.
|
|
9310
|
+
* This function updates the configuration of a swarm identified by its `swarmName`, applying the provided schema properties.
|
|
9311
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9312
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9313
|
+
*
|
|
9314
|
+
* @param {TSwarmSchema} swarmSchema - The schema containing the swarm’s unique name and optional properties to override.
|
|
9315
|
+
* @param {string} swarmSchema.swarmName - The unique identifier of the swarm to override, matching `ISwarmSchema["swarmName"]`.
|
|
9316
|
+
* @param {Partial<ISwarmSchema>} [swarmSchema] - Optional partial schema properties to update, extending `ISwarmSchema`.
|
|
9317
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s swarm schema service.
|
|
9318
|
+
* @throws {Error} If the swarm schema service encounters an error during the override operation (e.g., invalid swarmName or schema).
|
|
9319
|
+
*
|
|
9320
|
+
* @example
|
|
9321
|
+
* // Override a swarm’s schema with new properties
|
|
9322
|
+
* overrideSwarm({
|
|
9323
|
+
* swarmName: "MainSwarm",
|
|
9324
|
+
* defaultAgent: "WeatherAgent",
|
|
9325
|
+
* policies: ["ContentFilter"],
|
|
9326
|
+
* });
|
|
9327
|
+
* // Logs the operation (if enabled) and updates the swarm schema in the swarm system.
|
|
9328
|
+
*/
|
|
9329
|
+
declare const overrideSwarm: (swarmSchema: TSwarmSchema) => ISwarmSchema;
|
|
9330
|
+
|
|
9331
|
+
type TAgentTool = {
|
|
9332
|
+
toolName: IAgentTool["toolName"];
|
|
9333
|
+
} & Partial<IAgentTool>;
|
|
9334
|
+
/**
|
|
9335
|
+
* Overrides an existing tool schema in the swarm system with a new or partial schema.
|
|
9336
|
+
* This function updates the configuration of a tool identified by its `toolName`, applying the provided schema properties.
|
|
9337
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9338
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9339
|
+
*
|
|
9340
|
+
* @param {TAgentTool} toolSchema - The schema containing the tool’s unique name and optional properties to override.
|
|
9341
|
+
* @param {string} toolSchema.toolName - The unique identifier of the tool to override, matching `IAgentTool["toolName"]`.
|
|
9342
|
+
* @param {Partial<IAgentTool>} [toolSchema] - Optional partial schema properties to update, extending `IAgentTool`.
|
|
9343
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s tool schema service.
|
|
9344
|
+
* @throws {Error} If the tool schema service encounters an error during the override operation (e.g., invalid toolName or schema).
|
|
9345
|
+
*
|
|
9346
|
+
* @example
|
|
9347
|
+
* // Override a tool’s schema with new properties
|
|
9348
|
+
* overrideTool({
|
|
9349
|
+
* toolName: "WeatherTool",
|
|
9350
|
+
* description: "Updated weather data retrieval tool",
|
|
9351
|
+
* execute: async (params) => fetchWeather(params),
|
|
9352
|
+
* });
|
|
9353
|
+
* // Logs the operation (if enabled) and updates the tool schema in the swarm.
|
|
9354
|
+
*/
|
|
9355
|
+
declare const overrideTool: (toolSchema: TAgentTool) => IAgentTool<Record<string, ToolValue>>;
|
|
9356
|
+
|
|
9357
|
+
type TWikiSchema = {
|
|
9358
|
+
wikiName: IWikiSchema["wikiName"];
|
|
9359
|
+
} & Partial<IWikiSchema>;
|
|
9360
|
+
/**
|
|
9361
|
+
* Overrides an existing wiki schema in the swarm system with a new or partial schema.
|
|
9362
|
+
* This function updates the configuration of a wiki identified by its `wikiName`, applying the provided schema properties.
|
|
9363
|
+
* It operates outside any existing method or execution contexts to ensure isolation, leveraging `beginContext` for a clean execution scope.
|
|
9364
|
+
* Logs the override operation if logging is enabled in the global configuration.
|
|
9365
|
+
*
|
|
9366
|
+
* @param {TWikiSchema} wikiSchema - The schema containing the wiki’s unique name and optional properties to override.
|
|
9367
|
+
* @param {string} wikiSchema.wikiName - The unique identifier of the wiki to override, matching `IWikiSchema["wikiName"]`.
|
|
9368
|
+
* @param {Partial<IWikiSchema>} [wikiSchema] - Optional partial schema properties to update, extending `IWikiSchema`.
|
|
9369
|
+
* @returns {void} No return value; the override is applied directly to the swarm’s wiki schema service.
|
|
9370
|
+
* @throws {Error} If the wiki schema service encounters an error during the override operation (e.g., invalid wikiName or schema).
|
|
9371
|
+
*
|
|
9372
|
+
* @example
|
|
9373
|
+
* // Override a wiki’s schema with new properties
|
|
9374
|
+
* overrideWiki({
|
|
9375
|
+
* wikiName: "KnowledgeBase",
|
|
9376
|
+
* description: "Updated knowledge repository",
|
|
9377
|
+
* storage: "WikiStorage",
|
|
9378
|
+
* });
|
|
9379
|
+
* // Logs the operation (if enabled) and updates the wiki schema in the swarm.
|
|
9380
|
+
*/
|
|
9381
|
+
declare const overrideWiki: (wikiSchema: TWikiSchema) => IWikiSchema;
|
|
9382
|
+
|
|
9056
9383
|
/**
|
|
9057
9384
|
* Marks a client as online in the specified swarm.
|
|
9058
9385
|
*
|
|
@@ -11905,4 +12232,4 @@ declare const Utils: {
|
|
|
11905
12232
|
PersistEmbeddingUtils: typeof PersistEmbeddingUtils;
|
|
11906
12233
|
};
|
|
11907
12234
|
|
|
11908
|
-
export { Adapter, Chat, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addCompletion, addEmbedding, addPolicy, addState, addStorage, addSwarm, addTool, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|
|
12235
|
+
export { Adapter, Chat, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addCompletion, addEmbedding, addPolicy, addState, addStorage, addSwarm, addTool, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideEmbeding, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|