agent-swarm-kit 1.0.83 → 1.0.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -834,6 +834,13 @@ interface IModelMessage {
834
834
  * Interface for History Adapter Callbacks
835
835
  */
836
836
  interface IHistoryInstanceCallbacks {
837
+ /**
838
+ * Callback for compute of dynamic system prompt
839
+ * @param clientId - The client ID.
840
+ * @param agentName - The agent name.
841
+ * @returns An array of additional system prompt messages
842
+ */
843
+ getSystemPrompt?: (clientId: string, agentName: AgentName) => Promise<string[]> | string[];
837
844
  /**
838
845
  * Filter condition for history messages.
839
846
  * @param message - The model message.
@@ -1387,6 +1394,8 @@ interface IAgentSchema {
1387
1394
  storages?: StorageName[];
1388
1395
  /** The names of the states used by the agent. */
1389
1396
  states?: StateName[];
1397
+ /** The list of dependencies for changeAgent */
1398
+ dependsOn?: AgentName[];
1390
1399
  /**
1391
1400
  * Validates the output.
1392
1401
  * @param output - The output to validate.
@@ -2336,6 +2345,7 @@ declare class AgentValidationService {
2336
2345
  private readonly completionValidationService;
2337
2346
  private readonly storageValidationService;
2338
2347
  private _agentMap;
2348
+ private _agentDepsMap;
2339
2349
  /**
2340
2350
  * Retrieves the storages used by the agent
2341
2351
  * @param {agentName} agentName - The name of the swarm.
@@ -2361,6 +2371,10 @@ declare class AgentValidationService {
2361
2371
  * Check if agent got registered storage
2362
2372
  */
2363
2373
  hasStorage: ((agentName: AgentName, storageName: StorageName) => boolean) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, boolean>;
2374
+ /**
2375
+ * Check if agent got registered dependency
2376
+ */
2377
+ hasDependency: ((targetAgentName: AgentName, depAgentName: StorageName) => boolean) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, boolean>;
2364
2378
  /**
2365
2379
  * Check if agent got registered state
2366
2380
  */
@@ -3021,6 +3035,57 @@ declare class BusService implements IBus {
3021
3035
  dispose: (clientId: string) => void;
3022
3036
  }
3023
3037
 
3038
+ /**
3039
+ * Interface representing a meta node.
3040
+ */
3041
+ interface IMetaNode {
3042
+ name: string;
3043
+ child?: IMetaNode[];
3044
+ }
3045
+ /**
3046
+ * Service class for managing agent meta nodes and converting them to UML format.
3047
+ */
3048
+ declare class AgentMetaService {
3049
+ private readonly loggerService;
3050
+ private readonly agentSchemaService;
3051
+ private serialize;
3052
+ /**
3053
+ * Creates a meta node for the given agent.
3054
+ * @param {AgentName} agentName - The name of the agent.
3055
+ * @param {Set<AgentName>} seen - A set of seen agent names to avoid circular dependencies.
3056
+ * @returns {IMetaNode} The created meta node.
3057
+ */
3058
+ makeAgentNode: (agentName: AgentName, seen?: Set<string>) => IMetaNode;
3059
+ /**
3060
+ * Converts the meta nodes of the given agent to UML format.
3061
+ * @param {AgentName} agentName - The name of the agent.
3062
+ * @returns {string} The UML representation of the agent's meta nodes.
3063
+ */
3064
+ toUML: (agentName: AgentName) => string;
3065
+ }
3066
+
3067
+ /**
3068
+ * Service for handling swarm metadata.
3069
+ */
3070
+ declare class SwarmMetaService {
3071
+ private readonly loggerService;
3072
+ private readonly swarmSchemaService;
3073
+ private readonly agentMetaService;
3074
+ private serialize;
3075
+ /**
3076
+ * Creates a swarm node with the given swarm name.
3077
+ * @param {SwarmName} swarmName - The name of the swarm.
3078
+ * @returns {IMetaNode} The metadata node of the swarm.
3079
+ */
3080
+ makeSwarmNode: (swarmName: SwarmName) => IMetaNode;
3081
+ /**
3082
+ * Converts the swarm metadata to UML format.
3083
+ * @param {SwarmName} swarmName - The name of the swarm.
3084
+ * @returns {string} The UML representation of the swarm.
3085
+ */
3086
+ toUML: (swarmName: SwarmName) => string;
3087
+ }
3088
+
3024
3089
  declare const swarm: {
3025
3090
  agentValidationService: AgentValidationService;
3026
3091
  toolValidationService: ToolValidationService;
@@ -3029,6 +3094,8 @@ declare const swarm: {
3029
3094
  completionValidationService: CompletionValidationService;
3030
3095
  storageValidationService: StorageValidationService;
3031
3096
  embeddingValidationService: EmbeddingValidationService;
3097
+ agentMetaService: AgentMetaService;
3098
+ swarmMetaService: SwarmMetaService;
3032
3099
  agentPublicService: AgentPublicService;
3033
3100
  historyPublicService: HistoryPublicService;
3034
3101
  sessionPublicService: SessionPublicService;
@@ -3058,6 +3125,22 @@ declare const swarm: {
3058
3125
  loggerService: LoggerService;
3059
3126
  };
3060
3127
 
3128
+ /**
3129
+ * Dumps the agent information into PlantUML format.
3130
+ *
3131
+ * @param {SwarmName} swarmName - The name of the swarm to be dumped.
3132
+ * @returns {string} The UML representation of the swarm.
3133
+ */
3134
+ declare const dumpAgent: (agentName: AgentName) => string;
3135
+
3136
+ /**
3137
+ * Dumps the swarm information into PlantUML format.
3138
+ *
3139
+ * @param {SwarmName} swarmName - The name of the swarm to be dumped.
3140
+ * @returns {string} The UML representation of the swarm.
3141
+ */
3142
+ declare const dumpSwarm: (swarmName: SwarmName) => string;
3143
+
3061
3144
  /**
3062
3145
  * Adds a new agent to the agent registry. The swarm takes only those agents which was registered
3063
3146
  *
@@ -3981,4 +4064,4 @@ declare class SchemaUtils {
3981
4064
  */
3982
4065
  declare const Schema: SchemaUtils;
3983
4066
 
3984
- export { type EventSource, ExecutionContextService, History, HistoryAdapter, HistoryInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type ICompletionArgs, type ICompletionSchema, type ICustomEvent, type IEmbeddingSchema, type IHistoryAdapter, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type IStateSchema, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerAdapter, LoggerInstance, MethodContextService, type ReceiveMessageFn, Schema, type SendMessageFn$1 as SendMessageFn, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, session, setConfig, swarm };
4067
+ export { type EventSource, ExecutionContextService, History, HistoryAdapter, HistoryInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type ICompletionArgs, type ICompletionSchema, type ICustomEvent, type IEmbeddingSchema, type IHistoryAdapter, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type IOutgoingMessage, type ISessionConfig, type IStateSchema, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, Logger, LoggerAdapter, LoggerInstance, MethodContextService, type ReceiveMessageFn, Schema, type SendMessageFn$1 as SendMessageFn, State, Storage, addAgent, addCompletion, addEmbedding, addState, addStorage, addSwarm, addTool, cancelOutput, cancelOutputForce, changeAgent, commitFlush, commitFlushForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, disposeConnection, dumpAgent, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getRawHistory, getSessionMode, getUserHistory, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, session, setConfig, swarm };