agent-swarm-kit 1.1.65 → 1.1.67

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 CHANGED
@@ -23193,11 +23193,12 @@ const ChatInstance = functoolsKit.makeExtendable(class {
23193
23193
  * @param {Partial<IChatInstanceCallbacks>} callbacks - Event callbacks
23194
23194
  * @param {DisposeFn} onDispose - Dispose callback function
23195
23195
  */
23196
- constructor(clientId, swarmName, onDispose, callbacks) {
23196
+ constructor(clientId, swarmName, onDispose, callbacks, payload) {
23197
23197
  this.clientId = clientId;
23198
23198
  this.swarmName = swarmName;
23199
23199
  this.onDispose = onDispose;
23200
23200
  this.callbacks = callbacks;
23201
+ this.payload = payload;
23201
23202
  /** @private */
23202
23203
  this._disposeSubject = new functoolsKit.Subject();
23203
23204
  /** @private */
@@ -23314,7 +23315,7 @@ class ChatUtils {
23314
23315
  * @param {SwarmName} swarmName - Name of the swarm
23315
23316
  * @returns {IChatInstance} The chat instance for the given client
23316
23317
  */
23317
- this.getChatInstance = (clientId, swarmName) => {
23318
+ this.getChatInstance = (clientId, swarmName, payload = {}) => {
23318
23319
  return this._chats.has(clientId)
23319
23320
  ? this._chats.get(clientId)
23320
23321
  : this._chats
@@ -23323,6 +23324,7 @@ class ChatUtils {
23323
23324
  swarmName,
23324
23325
  () => this._chats.delete(clientId),
23325
23326
  this.ChatInstanceCallbacks,
23327
+ payload,
23326
23328
  ]))
23327
23329
  .get(clientId);
23328
23330
  };
@@ -23332,14 +23334,14 @@ class ChatUtils {
23332
23334
  * @param {SwarmName} swarmName - Name of the swarm
23333
23335
  * @returns {Promise<void>}
23334
23336
  */
23335
- this.beginChat = async (clientId, swarmName) => {
23337
+ this.beginChat = async (clientId, swarmName, payload = {}) => {
23336
23338
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
23337
23339
  swarm$1.loggerService.log("ChatUtils.beginChat", {
23338
23340
  clientId,
23339
23341
  swarmName,
23340
23342
  });
23341
23343
  this.initializeCleanup();
23342
- return await this.getChatInstance(clientId, swarmName).beginChat();
23344
+ return await this.getChatInstance(clientId, swarmName, payload).beginChat();
23343
23345
  };
23344
23346
  /**
23345
23347
  * Sends a message for a client
package/build/index.mjs CHANGED
@@ -23191,11 +23191,12 @@ const ChatInstance = makeExtendable(class {
23191
23191
  * @param {Partial<IChatInstanceCallbacks>} callbacks - Event callbacks
23192
23192
  * @param {DisposeFn} onDispose - Dispose callback function
23193
23193
  */
23194
- constructor(clientId, swarmName, onDispose, callbacks) {
23194
+ constructor(clientId, swarmName, onDispose, callbacks, payload) {
23195
23195
  this.clientId = clientId;
23196
23196
  this.swarmName = swarmName;
23197
23197
  this.onDispose = onDispose;
23198
23198
  this.callbacks = callbacks;
23199
+ this.payload = payload;
23199
23200
  /** @private */
23200
23201
  this._disposeSubject = new Subject();
23201
23202
  /** @private */
@@ -23312,7 +23313,7 @@ class ChatUtils {
23312
23313
  * @param {SwarmName} swarmName - Name of the swarm
23313
23314
  * @returns {IChatInstance} The chat instance for the given client
23314
23315
  */
23315
- this.getChatInstance = (clientId, swarmName) => {
23316
+ this.getChatInstance = (clientId, swarmName, payload = {}) => {
23316
23317
  return this._chats.has(clientId)
23317
23318
  ? this._chats.get(clientId)
23318
23319
  : this._chats
@@ -23321,6 +23322,7 @@ class ChatUtils {
23321
23322
  swarmName,
23322
23323
  () => this._chats.delete(clientId),
23323
23324
  this.ChatInstanceCallbacks,
23325
+ payload,
23324
23326
  ]))
23325
23327
  .get(clientId);
23326
23328
  };
@@ -23330,14 +23332,14 @@ class ChatUtils {
23330
23332
  * @param {SwarmName} swarmName - Name of the swarm
23331
23333
  * @returns {Promise<void>}
23332
23334
  */
23333
- this.beginChat = async (clientId, swarmName) => {
23335
+ this.beginChat = async (clientId, swarmName, payload = {}) => {
23334
23336
  GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
23335
23337
  swarm$1.loggerService.log("ChatUtils.beginChat", {
23336
23338
  clientId,
23337
23339
  swarmName,
23338
23340
  });
23339
23341
  this.initializeCleanup();
23340
- return await this.getChatInstance(clientId, swarmName).beginChat();
23342
+ return await this.getChatInstance(clientId, swarmName, payload).beginChat();
23341
23343
  };
23342
23344
  /**
23343
23345
  * Sends a message for a client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.1.65",
3
+ "version": "1.1.67",
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
@@ -3410,7 +3410,7 @@ interface IAgentTool<T = Record<string, ToolValue>> {
3410
3410
  /** Tool type defenition. For now, should be `function` */
3411
3411
  type: ITool['type'];
3412
3412
  /** Optional dynamic factory to resolve tool metadata */
3413
- function: ITool['function'] | ((clientId: string, agentName: AgentName) => Promise<ITool['function']>);
3413
+ function: ITool['function'] | ((clientId: string, agentName: AgentName) => (ITool['function'] | Promise<ITool['function']>));
3414
3414
  }
3415
3415
  /**
3416
3416
  * Interface representing the runtime parameters for an agent.
@@ -14323,14 +14323,14 @@ interface IChatControl {
14323
14323
  /**
14324
14324
  * @typedef {new (clientId: SessionId, swarmName: SwarmName, callbacks: IChatInstanceCallbacks, onDispose: DisposeFn) => IChatInstance} TChatInstanceCtor
14325
14325
  */
14326
- type TChatInstanceCtor = new (clientId: SessionId, swarmName: SwarmName, onDispose: DisposeFn, callbacks: IChatInstanceCallbacks) => IChatInstance;
14326
+ type TChatInstanceCtor = new <Payload extends unknown = any>(clientId: SessionId, swarmName: SwarmName, onDispose: DisposeFn, callbacks: IChatInstanceCallbacks, payload: Payload) => IChatInstance;
14327
14327
  /**
14328
14328
  * @class ChatInstance
14329
14329
  * @implements {IChatInstance}
14330
14330
  * @description Implementation of a single chat instance
14331
14331
  */
14332
14332
  declare const ChatInstance: {
14333
- new (clientId: SessionId, swarmName: SwarmName, onDispose: DisposeFn, callbacks: Partial<IChatInstanceCallbacks>): {
14333
+ new <Payload extends unknown = any>(clientId: SessionId, swarmName: SwarmName, onDispose: DisposeFn, callbacks: Partial<IChatInstanceCallbacks>, payload: Payload): {
14334
14334
  /** @private */
14335
14335
  _disposeSubject: Subject<string>;
14336
14336
  /** @private */
@@ -14341,6 +14341,7 @@ declare const ChatInstance: {
14341
14341
  readonly swarmName: SwarmName;
14342
14342
  readonly onDispose: DisposeFn;
14343
14343
  readonly callbacks: Partial<IChatInstanceCallbacks>;
14344
+ readonly payload: Payload;
14344
14345
  /**
14345
14346
  * Checks if the chat has been active within the timeout period
14346
14347
  * @param {number} now - Current timestamp
@@ -14408,7 +14409,7 @@ declare class ChatUtils implements IChatControl {
14408
14409
  * @param {SwarmName} swarmName - Name of the swarm
14409
14410
  * @returns {Promise<void>}
14410
14411
  */
14411
- beginChat: (clientId: SessionId, swarmName: SwarmName) => Promise<void>;
14412
+ beginChat: <Payload extends unknown = any>(clientId: SessionId, swarmName: SwarmName, payload?: Payload) => Promise<void>;
14412
14413
  /**
14413
14414
  * Sends a message for a client
14414
14415
  * @param {SessionId} clientId - Unique client identifier